`chtype` has its uses, but won't help with Unicode. For example, Cdk's design is a dead end, as mentioned in its future plans <https://invisible-island.net/cdk/cdk.html#future>. `cchar_t` to store ncurses uses a structure wide-characters, e.g., Unicode as a base and zero-or-more combining characters.
On Tuesday, February 26, 2019 at 12:10:06 AM UTC-5, Sydney Bean wrote: > > Hello :) > I'm working on a FFI API for ncurses > https://github.com/dys-bigwig/racket-ncurses and I'm having some trouble > figuring out how best to represent the titular construct: an array of long > ints. > > To quote Dan Gookin's excellent ncurses reference: > > "chstr is an array of formatted text to be displayed on the screen. The >> array is composed of chtype characters, which are not char but long int >> values. (The chtype character consists of a character plus attribute >> information.)" > > > this being my first time doing anything of this nature, I'm struggling to > work out just what features/procedures/representation I should be using to > best facilitate this. > I have the single chtype defined as follows: > > (define _chtype (make-ctype _long #f #f)) > > > and I'm using char->integer to convert racket chars for the addch family > of functions, combined with a bitwise-ior to apply the attribute mask. I > did try providing a racket conversion function as part of the definition, > but that prevented the attribute mask from being applied (trying to apply > bitwise-ior to #\A for example). Back to the matter at hand, for the > addchstr function (which utilises the aforementioned chtype-arrays) my plan > is to use string->list and then map the bitwise-ior over said list. > However, I first need to decide how to represent the associated c array > type which will be populated with these attribute masked (long) integers. > > I feel I'm really at the point (as if I wasn't before) of needing to ask > for assistance from someone who has a better idea of how this should be > handled, so as to minimise the amount of work I may potentially have to > redo. > > Advice would be greatly appreciated. Thank you. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.