Commit Graph

330 Commits

Author SHA1 Message Date
joseLuís
8c29276c70 rust: improve some comments 2020-12-31 03:56:36 +01:00
joseLuís
5e7bf86b9c rust: almost complete poc-menu example, still has bugs.
- add NcMenuSection::new_separator() constructor.
- rename constructor method for an empty NcInput to new();
- fix notcurses_getc_blocking() function name and error logic.
- improve comments.
- change type of NCMENU_OPTION_* to u64 (like in C API)
- fix error_str![] macro.
- improve error messages.
2020-12-31 00:11:49 +01:00
joseLuís
31e7305ce8 rust: start improving errors reporting.
- refactor error![] macro, switch place for $msg & $ok parameters.
- add more meaningful NcError return values in several functions related with poc-menu example, for starters.
- the poc-menu example now doesn't randomly fail, IDKW but OK I guess.
- minor unrelated corrections.
2020-12-30 19:11:55 +01:00
joseLuís
8e5e60f588 rust: Continue with poc-menu example.
- add NcPlane.pustr_aligned() method.
- disable notcurses_stddim_yx* functions & methods for now.
- make input argument optional for notcurses_getc_nblocking().
- update full-basics example.
- fix comments.
2020-12-30 18:40:54 +01:00
joseLuís
624bee6d71 rust: add most NcCell methods
- add & fix comments.
- add methods links.
2020-12-30 00:48:09 +01:00
joseLuís
7b4c105fdf rust: finish updating rust for ncdirect changes
- update function and method names.
- update intra-doc links.
- update examples.
2020-12-29 02:56:01 +01:00
nick black
a7b131a11c
update rust for ncdirect changes 2020-12-28 20:15:26 -05:00
joseLuís
ff2a22a9a9 rust: Finish adding NcChannel* methods.
- make channels_set[f|b]g_rgb() functions (and corresponding methods) return the NcChannelPair, taking advantage of the fact that those functions can't fail in Rust.
- documentation fixes.
- fix NCSCALE definition typo.
2020-12-28 17:59:27 +01:00
joseLuís
b6c84cfce2 rust: more 2.1.2 catch-ups
- deprecate old ncdirect_style_* functions.
- add `NCSCALE_*_HIRES` constants.
- BONUS: update ncdirect_raster_frame, removed parameters.
2020-12-28 13:47:44 +01:00
joseLuís
5d90e7de15 rust: update more NcPlane methods' return type to NcResult.
- rustfmt, comments…
2020-12-27 20:27:46 +01:00
joseLuís
9dda358364 rust: make modifications to match v2.1.2
- add new ffi::functions: ncplane_resize_maximize, notcurses_cansextant,
- substitute rust reimplementions of ncplane_at_cursor_cell & ncplane_at_yx_cell by ffi ones.
- substitute ncvisual_default_blitter by ncvisual_defblitter.
- rename cell style functions
2020-12-27 19:55:13 +01:00
joseLuís
55d49a43f6 rust: continue NcMenu PoC example; fixes
- modify ncmenu constructor Accept &mut[] instead of Vec<> to avoid FFI related problems. Furthermore, from rust 1.48 it's easy to convert a Vec into an array using the std::convert::TryInto trait.
- fix ncmenu method names.
- fix & refactor Notcurses contructors; add `with_debug` constructor.
- make NcPlane.set_base receive a char instead of a reference, since it's copy.
- add `rre` cargo alias for running examples on release.
2020-12-27 19:00:32 +01:00
joseLuís
a880eaf018 rust: new NcMenu PoC example & more error refactoring.
- new example poc-menu (WIP).
- improve constructors for NcMenu*.
- divide NcMenu* methods into submodules.
- fix return type for NcPlane constructors.
- use NcResult on functions returning references.
- fix a couple of Notcurses methods.
- add more NcChannelPair methods.
- refactor NcInput constructors.
- rename error_ptr![] to error_ref_mut![]
- new macro cstring_mut![].
- new error_ref![] macro.
- update examples & tests.
- bump version in readme.
2020-12-26 20:29:06 +01:00
nick black
55d563b646
v2.1.2 2020-12-26 02:53:40 -05:00
joseLuís
2762e9e561 rust: refactor errors for NcPlane & NcReader.
- add ncplane_new_bound_test helper function.
- update examples & tests as needed.
- rustfmt & minor fixes.
2020-12-26 07:34:26 +01:00
joseLuís
e966348321 rust: add NcMenu methods & fix error_ptr macro 2020-12-26 06:16:54 +01:00
joseLuís
e75432fcf2 rust: deprecate ncvisual_default_blitter 2020-12-26 05:46:05 +01:00
joseLuís
05d5c36622 rust: remove integration tests
- they really are unit tests.
- move version test to its right place.
- BONUS: add rstring![] macro.
2020-12-26 05:41:17 +01:00
joseLuís
fbe4352233 rust: refactor sleep macros
- receive a variable number of arguments.
- make rsleep use methods and deal with NcResult.
- new fsleep to flush an NcDirect context.
- fix macro usages in examples.
2020-12-26 05:14:27 +01:00
joseLuís
763f3efdc5 rust: continue refactoring the error system.
- deal with null()|null_mut() being returned from
  functions, previously ignored.
- new macros: error_ptr & error_str to deal with
  functions returning *mut T & *const c_char into
  NcResult<&mut T> or NcResult<String>, respectively.
2020-12-26 03:58:55 +01:00
joseLuís
bef4f534e9 rust: fix missing imports 2020-12-25 23:12:08 +01:00
joseLuís
36e81a573a rust: finish NcDirect & Notcurses methods.
- add missing NcDirect methods: raster_frame & render_frame.
- finish refactoring Notcurses methods.
  - turn more Option returns into NcResult.
2020-12-25 20:10:31 +01:00
joseLuís
6049e07d27 rust: continue refactoring the error system.
- made const NotcursesOptions constructors.
- refactor Notcurses constructors to return NcResult.
- pass NotcursesOptions by value, since it's Copy.
- update tests.
- add helper modules for Notcurses & NcPlane.
  - new initialization functions to be used in tests.
- BONUS:
  - refactor NcDirect
  - update examples.
2020-12-25 19:35:21 +01:00
joseLuís
b12abeddc9 rust: finish NcDirect error system refactor
- change Option return type for NcResult when appropriate.
- make NcDirect constructors return NcResult.
- rename NcError::new() to with_msg() and simplify new().
- refactor examples:
  - rename direct-image.rs to direct-image-c.rs
  - recreate using rust methods, as direct-image-rust.rs
  - differentiate more throughly between both styles.
  - remove the sys namespace on both examples.
2020-12-25 17:41:02 +01:00
joseLuís
1687af89e0 rust: refactor error system.
We need to use Result<> to manage error flow,
at least on the methods API. This way it will
finally feel idiomatic Rust and more concise.
Also, we can't return a non Result from main.

- rename NcResult to NcIntResult.
- new NcError & NcResult types.
- new error![] macro to reduce boilerplate.
- change return type of NcDirect methods to NcResult.
  - refactor several examples to return NcResult:
    direct-cursor, poc-direct & poc-kittyzapper.
- BONUS: fix test not stopping notcurses context.
- update lib doc-comment.
- fix typo in readme.
2020-12-25 05:16:34 +01:00
joseLuís
5d1dfe1d02 rust fix poc-direct; update readme deps badge 2020-12-25 00:53:03 +01:00
joseLuís
ab2675b358 rust: add poc-direct example
- fix NcDirect dim_[y|x] methods.
- add NcDirect.dim_yx() method.
2020-12-24 19:56:12 +01:00
joseLuís
a9413eafb2 rust: add poc-kittyzapper example
- fix ncdirect_[b|f]g_rgb8 functions.
- fix NcDirect.bg_rgb8 method.
- new printf![] macro.
2020-12-24 18:40:33 +01:00
joseLuís
3c8328c9cc rust: add all NcDirect methods.
- add missing ncdirect_* static inline functions.
- update Notcurses.getc().
- add NcTime constructor.
- add NcSigSet type + constructor.
- minor fixes.
2020-12-24 18:02:33 +01:00
joseLuís
7d53abc1b1 rust: finish Notcurses methods & fix tests 2020-12-24 03:24:39 +01:00
joseLuís
b62c1ec74b rust: refactor NcCell constructors 2020-12-24 03:04:46 +01:00
joseLuís
815507293d rust: fix tests 2020-12-23 22:12:04 +01:00
joseLuís
c07b68f783 rust: add example poc-cjkscroll 2020-12-23 21:50:23 +01:00
joseLuís
bf7f5de745 rust: fix putchar related methods.
- refactor NcCell constructors.
- add Notcurses.term_dim_yx method.
- reduce name imports.
- fix comments.
2020-12-23 21:49:36 +01:00
joseLuís
ca38d9109e rust: add NcCell Methods.
- improve some apis.
- made some functions const.
- add comments and intra-doc links.
- fix comments.
2020-12-23 20:07:25 +01:00
joseLuís
bda47b7403 rust: add methods for NcResizeCb & NcPalette.
- fix intra-doc links.
- refactor palette module.
2020-12-23 18:45:19 +01:00
joseLuís
1afa9cc1db rust: add more methods.
- add NcChannel & NcChannelPair methods.
- add more NcPlane methods.
- add comments and intra-links.
- refactor intra-links style in all modules.
2020-12-23 13:38:28 +01:00
joseLuís
3be38890c9 rust: refactor input module.
- unify NcInput & NcKey in the same module.
- fix lifetimes issue.
2020-12-23 00:40:28 +01:00
joseLuís
298f250ee8 rust: refactor unsafe functions.
- remove unneeded unsafe.
- simplify lifetimes.
- fix ncplane_gradient_sized.
- fix NcChannelPair
- fix comments.
- rustfmt.
2020-12-23 00:27:29 +01:00
joseLuís
af11b123fa rust: add NcProgBar widget 2020-12-23 00:12:30 +01:00
joseLuís
4c048ef625 rust: finish adding Notcurses methods. 2020-12-22 15:17:50 +01:00
joseLuís
fa693a89c1 rust: add most Notcurses methods.
- fix some comments.
2020-12-22 15:01:07 +01:00
joseLuís
fd1b81c0f8 rust: add NcPixel methods.
- finish updating the functions.
2020-12-21 21:15:10 +01:00
joseLuís
0db4e48a6b rust: endianess updates for NcPixel & NcCell
- Update NcPixel functions, and their descriptions.
- Update NcPixel constructor.
2020-12-21 20:34:50 +01:00
joseLuís
6752741982 rust: add dynamic linesig control
- add new functions notcurses_linesigs_disable & notcurses_linesigs_enable.
- fix comments.
2020-12-21 16:44:04 +01:00
joseLuís
240b58d52b rust: update msrv in readme 2020-12-20 19:00:08 +01:00
joseLuís
de56912cc4 rust: keep adding NcPlane methods & more
- new type NcResizeCb.
- new functions ncresizecb_safe & ncresizecb_unsafe.
- update NcPlaneOptions constructors.
- Improve & fix comments.
2020-12-20 18:56:46 +01:00
joseLuís
183d6473cd rust: continue adding NcPlane methods.
- add new module fade.
  - new type NcFadeCb.
  - move NcFadeCtx here.
- add TOC for NcPlane methods sections.
- fix & improve comments.
- remove deprecated ncplane functions.
2020-12-20 00:30:46 +01:00
joseLuís
84987b61a9 rust: refactor ncbox, ncalign; add NcPlane methods.
- wrap NCBOX* constants.
- new NcBoxMask type.
- new NCRESULT_MAX const.
- add NcPlane box & perimeter methods.
- move NcAlign to notcurses mod.
- update notcurses_align & test.
- improve comments.
- rustfmt.
2020-12-19 18:01:28 +01:00
joseLuís
493298f0f1 rust: new dimension types & NcPlane methods.
- add new NcDimension and NcOffset types.
- add more NcPlane methods.
- remove NcPlane methods:
  - ncplane_put_egc.
- add missing NCKEY_ESC and NCKEY_SPACE keycodes.
- add notcurses methods: getc_nblock.
- fix comments.
- rustfmt.
2020-12-19 03:44:55 +01:00