Commit Graph

358 Commits (c6c137d68891c356477a2a6519af0943af72abea)

Author SHA1 Message Date
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.
4 years ago
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.
4 years ago
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.
4 years ago
joseLuís 5d1dfe1d02 rust fix poc-direct; update readme deps badge 4 years ago
joseLuís ab2675b358 rust: add poc-direct example
- fix NcDirect dim_[y|x] methods.
- add NcDirect.dim_yx() method.
4 years ago
joseLuís a9413eafb2 rust: add poc-kittyzapper example
- fix ncdirect_[b|f]g_rgb8 functions.
- fix NcDirect.bg_rgb8 method.
- new printf![] macro.
4 years ago
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.
4 years ago
joseLuís 7d53abc1b1 rust: finish Notcurses methods & fix tests 4 years ago
joseLuís b62c1ec74b rust: refactor NcCell constructors 4 years ago
joseLuís 815507293d rust: fix tests 4 years ago
joseLuís c07b68f783 rust: add example poc-cjkscroll 4 years ago
joseLuís bf7f5de745 rust: fix putchar related methods.
- refactor NcCell constructors.
- add Notcurses.term_dim_yx method.
- reduce name imports.
- fix comments.
4 years ago
joseLuís ca38d9109e rust: add NcCell Methods.
- improve some apis.
- made some functions const.
- add comments and intra-doc links.
- fix comments.
4 years ago
joseLuís bda47b7403 rust: add methods for NcResizeCb & NcPalette.
- fix intra-doc links.
- refactor palette module.
4 years ago
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.
4 years ago
joseLuís 3be38890c9 rust: refactor input module.
- unify NcInput & NcKey in the same module.
- fix lifetimes issue.
4 years ago
joseLuís 298f250ee8 rust: refactor unsafe functions.
- remove unneeded unsafe.
- simplify lifetimes.
- fix ncplane_gradient_sized.
- fix NcChannelPair
- fix comments.
- rustfmt.
4 years ago
joseLuís af11b123fa rust: add NcProgBar widget 4 years ago
joseLuís 4c048ef625 rust: finish adding Notcurses methods. 4 years ago
joseLuís fa693a89c1 rust: add most Notcurses methods.
- fix some comments.
4 years ago
joseLuís fd1b81c0f8 rust: add NcPixel methods.
- finish updating the functions.
4 years ago
joseLuís 0db4e48a6b rust: endianess updates for NcPixel & NcCell
- Update NcPixel functions, and their descriptions.
- Update NcPixel constructor.
4 years ago
joseLuís 6752741982 rust: add dynamic linesig control
- add new functions notcurses_linesigs_disable & notcurses_linesigs_enable.
- fix comments.
4 years ago
joseLuís 240b58d52b rust: update msrv in readme 4 years ago
joseLuís de56912cc4 rust: keep adding NcPlane methods & more
- new type NcResizeCb.
- new functions ncresizecb_safe & ncresizecb_unsafe.
- update NcPlaneOptions constructors.
- Improve & fix comments.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
joseLuís 2957893da9 rust: update cell tests; minor doc fix 4 years ago
joseLuís 7f175cf37c rust: NcCell width-aware constructors #1203 #1205 4 years ago
nick black 2d07bbee59
Merge branch 'master' of github.com:dankamongmen/notcurses 4 years ago
nick black d6d5757b1d
v2.1.1 4 years ago
joseLuís 4cca3ddd48 rust: working on input
- make char: all NCKEY_* constants.
- make const fn: nckey_mouse_p, ncinput_equal_p & NcInput::new.
- make rsleep!() return the notcurses_render() result.
- new Notcurses constructor with_flags().
- new example: full-input.rs.
- fix comments.
4 years ago
nick black 6edafd1f84
v2.1.0 4 years ago
Nick Black 6106dea18a
track+use width for polycolumn EGCs #1203 (#1205)
Some EGCs are more than 2 columns (wcwidth() never returns more than 2, so far as i can tell, but when multiple characters combine, we use the sum). An example would be ကြေ (Myanmar) which occupies three columns over the course of three characters. Track the width (biased by 1) in cell->width, taking over 8 bits from cell->reserved. Use this width in rasterization. Closes #1203.
4 years ago
nick black 8497ee1877
v2.0.12 4 years ago
joseLuís b229f0247c rust: update some comments 4 years ago
nick black eb485cda21
v2.0.11 4 years ago
nick black 10c8dec7c0
fix up notcurses_debug rust test #1189 4 years ago
nick black 361a253aea
v2.0.10 4 years ago
joseLuís ac29cab8e4 rust: fix documentation building; #1125
- Preparing to host the documentation in the github pages, at least until
- libnotcurses-sys can get into Ubuntu 20.
- fix Cargo.toml, add documentation link.
- update documentation link in README.
- improve lib doc comment, among others.
4 years ago
joseLuís 98d86ec286 rust: remove cc build dep. & stdout.c file; #355 4 years ago
joseLuís a0e1577b56 rust: fix comments 4 years ago
joseLuís 96eaa29484 rust: add lib doc comments with examples 4 years ago
joseLuís c46c06a2e9 rust: move NcScale & NcVisual to visual module 4 years ago
joseLuís 01f7434a9a rust: rename bindgen module to ffi 4 years ago
joseLuís d19c753227 rust: use cstring macro instead of CString function 4 years ago
joseLuís 57d2eddbf5 rust: more refactoring, channel methods, new macro.
- add NcChannel methods
- add the `NcChannelMethods` Trait to be able to use them,
  since you can't implement methods over a primitive otherwise, unlike over a struct like NcPlane. And NcChannel is a type alias of `u32`.
- create more channel functions, to set the r,g,b separately.
- made some functions const
- add new rsleep![] macro, for rendering before sleeping.
- improve doc comments.
- fix previous commits.
4 years ago
joseLuís 5def609c73 rust: add stats methods 4 years ago
joseLuís e822e85a14 rust: Drop trait doesn't work with &muts; del impls 4 years ago
joseLuís 2483771af1 rust: Don't derive the Copy trait
- implement the Drop trait for the all the obvious types.
- resolve lifetime issues revealed from not being Copy.
  - return
4 years ago
joseLuís 6ad18bfa7b rust: refactoring and corrections.
- reorder cell, ncchannel & ncplane reimplemented functions.
- minor fixes and corrections.
- improve doc comments.
4 years ago
joseLuís 01e4f7de5a rust: big refactor
- move tests to their own submodules
- move functions reimplementations to reimplemented submodule.
- remove types submodules and move them to their parent.
- add more NcPlane & Notcurses methods
- rename NcChar back to NcEgc, and NcCharBackstop tp NcEgcBackstop
- add ncpile_top & ncpile_bottom functions.
- fix Notcurses stdplane(_mut) methods
- make cell_load_char not return anything since it was always 1.
4 years ago
joseLuís 38bdc627a4 rust: more refactoring
- new macros module, with sleep![] and cstring![] macros.
- rename NCell constructors.
- more plane methods.
- improve doc comments.
4 years ago
joseLuís 4ea2ccc51d rust: more refactor and fixes
- create some more notcurses tests.
- rename `constructors` submodules to `wrapped`.
- fix ncplane_str so to accept &str.
- implement some rusty methods for NcPlane, as a POC.
- improve multiple doc comments.
4 years ago
joseLuís 24640eb80e rust: big modules refactor
- remove the types module, and move the types definitions
  into submodules
- improve multiple comments
4 years ago
joseLuís 1206a281ec rust: keep refactoring and improving docs
- remove the use of inline code markings inside rustdoc [`links`],
  because they are too visually distracting.
- Use descriptive language in the doc comments, instead of imperative.
- Rename NcChannels to NcChannelPair, for improved clarity.
- Improve more comments, add inner links.
- Improve some tests.
- separate tests and constructors into submodules for cells and channels
4 years ago
joseLuís 279f36ec93 rust: more tests, refactors & improvements
- separate tests and constructors into submodules for cells and channels
- add missing functions channels_set_bg_palindex & channels_set_fg_palindex
- fix bug in channel_palindex_p function
- wrap NCSTYLE_* constants
- add more missing cell tests
- improve many doc comments
- fix some types
4 years ago
nick black 8083b46e3b
v2.0.9 4 years ago
joseLuís e2ec27d413 rust: more tests, refactors & improvements
- add ncplane_putchar_yx & ncplane_putchar static functions
- complete test for channel_default_p
- add more tests for ncplane
- separate tests and constructors into submodules for ncplane and notcurses
- make public FILE_NC & FILE_LIBC
- improve integration tests.
- clean & rustfmt
- add constant NCRESULT_OK, NCRESULT_ERR and use them to refer to
  the NcResult values when appropriate
4 years ago
joseLuís a4e7513b11 rust: downgrade bindgen & pkg-config #355 4 years ago
joseLuís 059007bd50 rust: more improvements
- fix bindings module, by not making public the wrapped bindgen types
- add notcurses_stddim_yx_const()
- fix return types of TODO
- add plane constructor new() wrapping ncpile_create()
- add plane constructor new_bound() wrapping ncplane_create()
- add plane constructor new_termsize() wrapping ncpile_create() with the terminal size
- add plane doc comment
4 years ago
nick black 2a45620cd6
v2.0.8 4 years ago
joseLuís b64a257ecf rust: replace cell macros with constructors
- add NcCell constructors: new(), new_blank(), with_char()
- remove cell initializer macros
- update full-basics example
- add more doc comments
4 years ago
joseLuís 58c3d66c15 rust: add ncpile funcs & upd function-summary
- add functions ncpile_create, ncpile_render, ncpile_rasterize
- add new script tools/blame-nick.sh
- upd script tools/function-summary.sh and the generated data
- upd bindgen version
4 years ago
joseLuís 657da94887 rust: add MSRV
- make a little change to ensure MSRV 1.40.0
- show MSRV (Minimum Supported Rust Version) in README
- show up-to-date state of crate dependencies in README
- update comments
4 years ago
nick black ebc80915a3 c++/rust struck #1138 4 years ago
joseLuís 433068a5ae rust: further types cleanup
- made sigset_t private.
- made FILE_LIBC & FILE_NC private.
- add NCMETRIC_ prefix to the related constants.
- Improve more comments.
4 years ago
joseLuís 8b6495a894 rust: rename type aliases for consistency
Rename all bound types so that they start by Nc (and constants by NC),
except Notcurses:

- rename Cell to NcCell.
- rename CELL_* constants to NCCELL_*.
- rename Channel to NcChannel & Channels to NcChannels.
- rename CHANNEL_* constants to NCCHANNEL_*.
- rename Egc to NcChar & EgcBackstop to NcCharBackstop.
- rename Palette to NcPalette & PaletteIndex to NcPaletteIndex.
- rename IntResult to NcResult.
- rename Color to NcColor.
- rename Rgb to NcRgb.
- rename AlphaBits to NcAlphaBits.
- rename StyleMask to NcStyleMask.
- rename LIBC_FILE to FILE_LIBC & NC_FILE to FILE_NC.

Also:
- new type NcTime for timespec.
- rustfmt.
4 years ago
joseLuís 1dda2d7d58 rust: add new functions
- ncpile_create
- ncplane_reparent_family
- ncplane_resizecb
4 years ago
nick black 73b2f1bf19
v2.0.7 4 years ago
nick black acdcf9e41f
v2.0.6 4 years ago
nick black 537caa2173
v2.0.5 4 years ago
joseLuís e23cd63aac rust: improve comments
- use new syntax for doclinks
- improve some comments
- add README
4 years ago
nick black 7fa89b45da rust: unfuck ncaligns #1115 4 years ago
nick black 9ce821a045 [headscratch] 4 years ago
nick black ee019b2d5a rust: clear all mention of ncplane->horiz #1115 4 years ago
nick black bc245e09fc rust: drop ncplane_options__bindgen_ty_1 4 years ago
joseLuís 4de2652f8d rust: more fixes and improvements
- fix notcurses_init unit test
- fix fn call name: `nplane_at_cursor_cell` → `ncplane_at_cursor_cell`.
- make LIBC_FILE & NC_FILE type aliases with doc comment.
- add lib module comment.
- improve direct-cursor example.
- fix full-text example and rename it to full-basics.
4 years ago
joseLuís 9fe0363937 rust: improve testing
- add new alias `t_all` for running every test even if some fail.
- call it from `.drone.yml` to have more complete testing picture.
- add a new test for `notcurses_init` as the first test.
4 years ago
joseLuís 1f77571174 rust: cleanup
- remove deprecated functions ncplane_new & nctablet_ncplane
- fix some comments
- run rustfmt
4 years ago
joseLuís 9563c9e02e rust: new NcFile type to wrap libc::FILE
The notcurses FILE type (`NC_FILE`) is imported via bindgen as a struct,
while the equivalent Rust libc::FILE (`LIBC_FILE`) is an opaque enum.
Several methods are provided to convert back and forth between both types,
so it works both with rust libc operations and notcurses file I/O operations.

- new notcurses_debug() test as the first usage of `NcFile`
4 years ago
joseLuís 107cb05fce rust: refactor examples 4 years ago
joseLuís 2e47618a6a rust: 2+ notcurses convenience constructors 4 years ago
joseLuís 08b000de28 rust: remove no_std; fix #1119 4 years ago
joseLuís d9a74dab26 rust: start adding notcurses tests 4 years ago
joseLuís 00f5001342 rust: ncplane constructors
- new NcPlane & NcPlaneOptions constructors.
- new NcHoriz enum for NcPlaneOptions horiz parameter.
- Make NCPLANE_OPTION_HORALIGNED u64 for consistency with expected value type.
4 years ago
nick black 259b2b6012
make it clear that sixel is not yet supported 4 years ago
nick black 7622cefc3a
v2.0.4 4 years ago
joseLuís 04882971a2 rust: more refactoring
- make Notcurses `new()` constructor not output banners.
- add an additional constructor `with_banners()`.
- add new aliases for running examples silently.
- improve comments & run rustfmt.
4 years ago
nick black 0d31a03be9
v2.0.3 4 years ago
joseLuís 7a164c3009 rust: continue reworking the API & improve documentation
- remove macros module and move macros to types submodules.
- document the macros.
- add ncmetric macros.
- add missing constants for NcVisual and ncmetric.
- add missing function ncstrwidth
- remove types/colors module and move the content to types/channel
- add more doc comments.
4 years ago
joseLuís f22dfd78b5 rust: continue reworking the API & improve documentation
- separate the `types` module into submodules to improve clarity & maintenance.
- more constructors for NcMenu, NcMenuItem, NcMenuSection, NcMenuOptions.
- add more missing docs, specially for constants
4 years ago
joseLuís 08a0da358e rust: continue reworking the API & improve documentation
- remove _IO_FILE import and usage.
- create handy constructors for NcDirect & Notcurses.
  (but can't implement destructors for copy types…).
- when possible substitute mutable pointers `*mut` for mutable references `&mut`
  with associated lifetimes.
- new widgets module, starting with NcReader & NcReaderOptions constructors
4 years ago
joseLuís 965a0771d8 rust: continue reworking the API & improve documentation
- rename `Pixel` to `NcPixel`
- rename `cell_simple_initializer` to `cell_char_initializer`
  and `cell_load_simple` to `cell_load_char`
- create constructor for `NcReader`
- fix and improve documentation for several types.
- Add `NcDirectOptions` struct and `NcDirectOptionHoriz` union
4 years ago
joseLuís 4673a86ea2 rust: API refactor & improve documentation
- rename EGC to Egc, EGCBackstop to EgcBackstop and ChannelPair to Channels.
- make the original type aliased structs non-public (e.g. ncdirect, ncalign…)
- fix and improve documentation for several types.
- revert renaming crate to nc on use.
- directly import the used types at the beginning of the module.

Now the rustdoc generated documentation is much cleaner.
4 years ago
joseLuís d82f0934b3 rust: show inline documentation for curated bindings 4 years ago
joseLuís 27628e961a rust: improve bindings 4 years ago
joseLuís a40cabb9d0 rust: move integration tests out of lib.rs 4 years ago
joseLuís c8316d75ae rust: continue improving bindings and API
- use libc types and functions directly when possible
	- char32_t -> u32 -> char
	- size_t -> u64
	- free()
	- strcmp()
	NOTE: it seems libc::timespec doesn't work with notcurses_getc()
- rename types
  	- Input -> NcInput
	- Scale -> NcScale
- `suppuabize` function is now private.
- `bindings` module is now public.
- improve comments.
4 years ago