Re: Bugs when porting ncurses to a new platform
Thomas Dickey <[email protected]> Tue, 30 Jun 2026 20:47:06 -0400
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <[email protected]> |
--AS0a8RzeIgVzV3ga Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 30, 2026 at 12:27:45AM +0000, Antonio Ni=F1o D=EDaz wrote: > Hello! >=20 > I'm trying to get ncurses working in a new platform (Nintendo DS using > [BlocksDS](https://blocksds.skylyrac.net/)). I've created a terminal > emulator that supports 16-color, 256-color and direct color commands > (foreground and background), as well as a few other commands like "bold", > "move cursor" and "clear screen". Basically, I'm cherry-picking terminfo > configuration settings from other terminals to create my own configuration > based on what I actually support, and I'm trying to understand every sett= ing > I use. So far I've managed to get 16 and 256 color modes working, as wel= l as > moving the cursor around and clearing the screen. However, I have two is= sues > that I've spent a few days debugging with no success. I've even added pr= intf > logs in ncurses in many places (the trace system doesn't work for some > reason) but ncurses has so many build options and code paths that it's ha= rd > to know what actually gets used (printf-debugging has helped to get color > working, though). >=20 > ---------------- =2E.. > 2) getch() only works for blocking input. >=20 > If I use `timeout(-1)` I can see calls to `read()`. They block as expect= ed > and I can see that the value is received by ncurses. However, if I use > `timeout(0)` I never see any syscall being used. Maybe I'm looking at the > wrong place, but the same code works on PC, so I assume it's something to= do > with my port. I do support setting non-blocking mode for `stdin` with > `ioctl(FIONBIO)` and `fcntl(F_SETFL, O_NONBLOCK)`, and I also support > querying the amount of characters available to read from `stdin` with > `ioctl(FIONREAD)`, but I don't know if this is even used by ncurses. no - ncurses basically uses select() or poll() to detect new data. In a quick check, timeout() sets a _delay member of the window, which when negative will bypass a timed delay when looking for data. =20 > How does ncurses get new characters for non-blocking input? >=20 > ---------------- >=20 > This is my build configuration: >=20 > ./configure \ > --with-normal \ > --without-shared --without-progs --without-manpages --without-tests \ > --target=3Darm --host=3Darm --build=3Damd64 \ > --disable-database --disable-db-install \ > --disable-gnat-projects --disable-home-terminfo \ > --enable-termcap \ > --disable-widec \ > --prefix=3D$PWD/mybuild \ > --with-trace \ > --enable-getcap \ > --disable-sigwinch \ > --enable-ext-colors --enable-rgb-color \ > --enable-ext-mouse \ > CFLAGS=3D"-mthumb -mcpu=3Darm946e-s+nofp -O2 -ffunction-sections -fdata-s= ections -I$BLOCKSDS/libs/libnds/include" \ > BUILD_CC=3Dgcc \ > CC=3Darm-none-eabi-gcc \ > cf_cv_have_tcgetattr=3Dyes \ > ac_cv_func_gettimeofday=3Dyes \ > ac_cv_type_sigset_t=3Dno The output from the configure script (config.log, config.status) would tell us for example if it's using select or poll. --=20 Thomas E. Dickey <[email protected]> https://invisible-island.net --AS0a8RzeIgVzV3ga Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmpEY4YACgkQzCr0RyFn vgN3+wv/TIla2Cmh/VpsgKzaESyYpqSBJrrIsbERDiNFDOb2k0Af2yG1BCBF8JP+ 1Ax1/Ff0r9ciL87Qx9C7oEAm3FLiSuUv2rky0lIFEwtIDNElc1NWEDghc8hx0QXP ovtPbm0pJ68bjWPJB/RNTQBCHfnaSaSahb2kU87mxG0Q3I3mlkq1ZDq77oLCxI76 HiRWtvI+U+Bq5VSDT4Mg/K/8ILOnxRSk0DtRhQn8v0tDTgg6F7DnOsBAs3tp8kc0 AzOS/6b8zm70hQDe80U6j+/XNCnWD1lTtuGagWRc0NTWrTWWKPcIYKp7fjG7rzk2 30USQ0Vf9//vT2LJqWn+MU/eWs5YEEBxwR0uOpcC1GN+jRmefgOHHcf6hymHa6Ee fN19KzimKInljIZOqRqHrgz6peHC6JYYMmzj3i0f3GgS4q8irI6GK3TYMU3+cKN3 t6S7Ea/kpKY4ZgARlOzTWNBUZmnHtGaBvB8b1KTwaisge/5Svfi8gjjQy68eaxZ2 3jpp8jbr =yNSV -----END PGP SIGNATURE----- --AS0a8RzeIgVzV3ga--