rnowley / nim-ncurses Goto Github PK
View Code? Open in Web Editor NEWA Nim language wrapper for NCurses
A Nim language wrapper for NCurses
The line
u1: cint = 1
A_NORMAL* = (u1 - u1)
A_ATTRIBUTES* = NCURSES_BITS(not (u1 - u1), 0)
crashes nim since not (u1 - u1) is a 64 bit value (on my amd64 machine) which cannot be converted to chtype
Replacing the first line by
u1:uint32= 1
fixes the issue
This is with
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2020-11-20
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: fcb2ec4ed69fe924e7e3899e0084f534124255d4
active boot switches: -d:release
Whats about unicode?
printw("Привет")
Looks like: ~_ ~@ ~B
Hint: used config file '/etc/nim.cfg' [Conf]
Hint: system [Processing]
Hint: hellocurses [Processing]
Hint: ncurses [Processing]
nim-ncurses/ncurses.nim(60, 25) Error: list of key:value pairs expected
My import line is: import /home/myhome/nimfiles/nim-ncurses/ncurses.nim
Hi!
You should not use 'libncursesw.so' directly as a 'dynlib' under Linux, because there is a high probability that this file is a linker script containing the line
INPUT(libncursesw.so.5 -ltinfo)
(or)
INPUT(libncursesw.so.6 -ltinfo)
Instead, you should use there 'libncursesw.so.(5|6)'. I checked this, and it works. The original 'libncursesw.so' leads to the following error message when invoking a program which was linked with your 'ncurses'-module:
could not load: libncursesw.so
compile with -d:nimDebugDlOpen for more information
With the mentioned flag set, the following error message is printed when this program is invoked:
/usr/lib/x86_64-linux-gnu/libncursesw.so: file too short
could not load: libncursesw.so
The reason for this behaviour is that 'dlopen()' is unable to handle linker scripts. Linker scripts are meant to be used solely with the linker 'ld'. I doubt that 'dlopen()' will ever be able to handle such files, because they may contain anything ld's scripting language supports, even dependencies on static libraries ('XXX.a').
Nim seems currently unable to generate modules containing dynamically loadable object files, but, until (if ever) this is the case, workarounds as described above must be used.
If you wish, i could create a pull-request with the fix, but currently this is bothersome for me, as i have little time for such things, and i have made no good experiences with these things (yet).
Greetings
runkharr
Compiles ok, but complains about missing libncurses.dll at runtime. Where can I get that from?
I don't know if this issue is known, but when I try to install this package via nimble, it gives me the following error:
$ nimble install ncurses
Downloading https://github.com/rnowley/nim-ncurses using git
Tip: 11 messages have been suppressed, use --verbose to show them.
Error: Could not read package info file in /tmp/nimble_14345/githubcom_rnowleynimncurses/ncurses.nimble;
... Reading as ini file failed with:
... Invalid section: .
... Evaluating as NimScript file failed with:
... tmp/nimble_14345/githubcom_rnowleynimncurses/ncurses.nimble(2, 1) Error: undeclared identifier: 'name'.
Nim version: 0.18.0
Nimble version: 0.8.10
Hello,
It would be interesting to have a nimble package for this wrapper.
https://linux.die.net/man/3/mvaddch says:
int mvaddch(int y, int x, const chtype ch);
https://github.com/rnowley/nim-ncurses/blob/master/ncurses.nim says:
proc mvaddch*(y: int; x: int; character: chtype): cint {.cdecl, discardable, importc: "mvaddch", dynlib: libncurses.}
looks like int
should be cint
leads to more type safety
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.