Hi
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
If you make the window with a frame around it, (uncomment the framewin line) the characters are printed normally, and afterwards any window written to is also printed normally.
program ncurtest; uses GPC, GPCUtil, CRT, FrameWin;
var submenu : WinState;
Data : array[1..3] of string( 32 ) = ( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789');
i : integer;
begin i := (ScreenSize.X - 32) div 2; MakeWin( SubMenu, i, 2, i + 32, 7 ); { FrameWin('HELP: hit Enter to exit', DoubleFrame ); } FillWin( ' ', 16 * Blue ); HideCursor; for i := 1 to 3 do WriteStrAt( 2,i, Data[ i ], 16 * Blue + LightGray ); end.
Russ
Note to support@slackware.com, bug-ncurses@gnu.org: gpc@gnu.de is a pascal mailing list unit CRT is a pascal interface to ncurses
Russell Whitaker wrote:
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
If you make the window with a frame around it, (uncomment the framewin line) the characters are printed normally, and afterwards any window written to is also printed normally.
program ncurtest; uses GPC, GPCUtil, CRT, FrameWin;
var submenu : WinState;
Data : array[1..3] of string( 32 ) = ( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789');
i : integer;
begin i := (ScreenSize.X - 32) div 2; MakeWin( SubMenu, i, 2, i + 32, 7 ); { FrameWin('HELP: hit Enter to exit', DoubleFrame ); } FillWin( ' ', 16 * Blue ); HideCursor; for i := 1 to 3 do WriteStrAt( 2,i, Data[ i ], 16 * Blue + LightGray ); end.
Russ
Note to support@slackware.com, bug-ncurses@gnu.org: gpc@gnu.de is a pascal mailing list unit CRT is a pascal interface to ncurses
AFAICS, something was changed WRT A_ALTCHARSET. With previous ncurses versions, one could (apparently) get direct font access with this attribute (e.g. IBM PC character mapping if such a font was loaded, at least on the Linux console). Now some ASCII characters have been redefined with A_ALTCHARSET.
I don't know if the change was intentional (but it appears so, looking at tinfo/lib_acs.c:84-116 in 5.4) or whether A_ALTCHARSET was ever intended to mean what I supposed it did.
Anyway, the affected characters are all printable ASCII characters which are the same, at least in the IBM PC character mapping and probably most other fonts, so if necessary I could just turn off A_ALTCHARSET for those characters (#if 0 in the example below).
Is this the recommended thing to do, or is there another way to get direct access to all characters of the underlying font (on the Linux console)?
#include <ncurses.h>
int main () { unsigned i; initscr (); for (i = 32; i < 256; i++) #if 1 mvaddch (i / 32, i % 32, i | A_ALTCHARSET); #else mvaddch (i / 32, i % 32, (i >= 32 && i < 127) ? i : i | A_ALTCHARSET); #endif getch (); endwin (); return 0; }
If so, Russ, you could try this patch (touch crt.pas after applying to force recompilation):
--- units/crtc.c.orig Sun Apr 10 23:18:13 2005 +++ units/crtc.c Sun Apr 10 23:20:27 2005 @@ -2694,7 +2694,7 @@ } #endif if (!pccs && !_p_IsPrintable (ch)) return ' '; - return (crt_LinuxConsole && pccs) ? ch | A_ALTCHARSET : ch; + return (crt_LinuxConsole && pccs && (ch < 32 || ch > 126)) ? ch | A_ALTCHARSET : ch; }
GLOBAL (void crt_ReadChar (int x, int y, Char *ch, TTextAttr *attr))
Frank
Frank Heckenbach wrote:
Russell Whitaker wrote:
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
If you make the window with a frame around it, (uncomment the framewin line) the characters are printed normally, and afterwards any window written to is also printed normally.
program ncurtest; uses GPC, GPCUtil, CRT, FrameWin;
var submenu : WinState;
Data : array[1..3] of string( 32 ) = ( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789');
i : integer;
begin i := (ScreenSize.X - 32) div 2; MakeWin( SubMenu, i, 2, i + 32, 7 ); { FrameWin('HELP: hit Enter to exit', DoubleFrame ); } FillWin( ' ', 16 * Blue ); HideCursor; for i := 1 to 3 do WriteStrAt( 2,i, Data[ i ], 16 * Blue + LightGray ); end.
Russ
Note to support@slackware.com, bug-ncurses@gnu.org: gpc@gnu.de is a pascal mailing list unit CRT is a pascal interface to ncurses
AFAICS, something was changed WRT A_ALTCHARSET. With previous ncurses versions, one could (apparently) get direct font access with this attribute (e.g. IBM PC character mapping if such a font was loaded, at least on the Linux console). Now some ASCII characters have been redefined with A_ALTCHARSET.
I don't know if the change was intentional (but it appears so, looking at tinfo/lib_acs.c:84-116 in 5.4) or whether A_ALTCHARSET was ever intended to mean what I supposed it did.
Anyway, the affected characters are all printable ASCII characters which are the same, at least in the IBM PC character mapping and probably most other fonts, so if necessary I could just turn off A_ALTCHARSET for those characters (#if 0 in the example below).
Is this the recommended thing to do, or is there another way to get direct access to all characters of the underlying font (on the Linux console)?
#include <ncurses.h>
int main () { unsigned i; initscr (); for (i = 32; i < 256; i++) #if 1 mvaddch (i / 32, i % 32, i | A_ALTCHARSET); #else mvaddch (i / 32, i % 32, (i >= 32 && i < 127) ? i : i | A_ALTCHARSET); #endif getch (); endwin (); return 0; }
If so, Russ, you could try this patch (touch crt.pas after applying to force recompilation):
--- units/crtc.c.orig Sun Apr 10 23:18:13 2005 +++ units/crtc.c Sun Apr 10 23:20:27 2005 @@ -2694,7 +2694,7 @@ } #endif if (!pccs && !_p_IsPrintable (ch)) return ' ';
- return (crt_LinuxConsole && pccs) ? ch | A_ALTCHARSET : ch;
- return (crt_LinuxConsole && pccs && (ch < 32 || ch > 126)) ? ch | A_ALTCHARSET : ch;
}
GLOBAL (void crt_ReadChar (int x, int y, Char *ch, TTextAttr *attr))
Frank
I used to monitor Thomas Dickey's fine ncurses mailing list. He is constantly changing ncurses. (just guessing here ) If slackware got a bad version snapshot you might need to download and install a new version of ncurses. Sometimes that is easier said than done. With SuSE, the RPM database almost forces the installation of the bundled base packages such as ncurses.
Another ncurses issue is your terminfo database. Check out "infocmp" and related terminfo tools. Some distros set up broken terminfo's that need to be modified or rebuilt ( see "tic").
While the ncurses writing scheme might seem overly complex, and a throwback to serial line consoles, it is IMO a real asset and worth learning. The linux console is far and away the most advance console interface (see "console codes").
Rick Engebretson wrote:
I used to monitor Thomas Dickey's fine ncurses mailing list.
Me too. :-)
He is constantly changing ncurses. (just guessing here ) If slackware got a bad version snapshot you might need to download and install a new version of ncurses. Sometimes that is easier said than done. With SuSE, the RPM database almost forces the installation of the bundled base packages such as ncurses.
You can always install a second copy in /usr/local (or your home directory or wherever) and use appropriate options for linking your programs with those. Relinking all system programs is more difficult (and probably not necessary).
Another ncurses issue is your terminfo database. Check out "infocmp" and related terminfo tools. Some distros set up broken terminfo's that need to be modified or rebuilt ( see "tic").
Generally that's a common caveat, but not in this case. I tried both versions with the same terminfo database, and saw the difference.
Frank
Frank Heckenbach wrote:
Rick Engebretson wrote:
I used to monitor Thomas Dickey's fine ncurses mailing list.
Me too. :-)
He is constantly changing ncurses. (just guessing here ) If slackware got a bad version snapshot you might need to download and install a new version of ncurses. Sometimes that is easier said than done. With SuSE, the RPM database almost forces the installation of the bundled base packages such as ncurses.
You can always install a second copy in /usr/local (or your home directory or wherever) and use appropriate options for linking your programs with those. Relinking all system programs is more difficult (and probably not necessary).
Another ncurses issue is your terminfo database. Check out "infocmp" and related terminfo tools. Some distros set up broken terminfo's that need to be modified or rebuilt ( see "tic").
Generally that's a common caveat, but not in this case. I tried both versions with the same terminfo database, and saw the difference.
Frank
I'm well aware that you understand the linux console. Your CRT unit goes far beyond the basic Borland appeasement. Perhaps I was just sharing my many mistakes on the subject.
On Sun, 10 Apr 2005, Frank Heckenbach wrote:
Russell Whitaker wrote:
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
[..]
If so, Russ, you could try this patch (touch crt.pas after applying to force recompilation):
[..]
Patch works. Just to be sure tried it with both ncurses-5.3 and ncurses-5.4
Thanks, Russ
Russell Whitaker wrote:
On Sun, 10 Apr 2005, Frank Heckenbach wrote:
Russell Whitaker wrote:
Program below illustrates a bug: lower case a, lower case f thru z, and number 0 are printed with graphic characters. This bug did not appear in earlier versions of slackware.
[..]
If so, Russ, you could try this patch (touch crt.pas after applying to force recompilation):
[..]
Patch works. Just to be sure tried it with both ncurses-5.3 and ncurses-5.4
Thanks, Russ
Besides patching patches, I think you should work with this GPC programmer;
***************************** -- his recent announcement -- "GPC Pascal programmers:
I have gotten a complete ncurses interface working for GNU Pascal. I have tested it on MaxOSX (using unix prompt), although more testing is needed. This is the UNIX terminal ncurses, no graphics.
The interface file (ncurses.pas), one-page documentation (ncurses.txt) and a few test files (*.pas) are attached as a gzip tar file (16k). Any testing or suggestions are welcome.
After testing, and after I get at least one more library confirmed (menu), I would like to submit this as a candidate to include in the GPC Pascal package.
Sincerely,
willett kempton Visible Software
willett@UDel.Edu " ****************************
He has a direct interface to the ncurses libraries and has already submitted a unit.
A similar situation exists for FPC. The nCRT and oCRT units are fine units written by Ken Wright. But, besides adding another layer or two, these units offer incomplete access to the ncurses library.
If you really want to program ncurses, program ncurses.
On Sat, 30 Apr 2005, Rick Engebretson wrote:
Russell Whitaker wrote:
[..]
Patch works. Just to be sure tried it with both ncurses-5.3 and ncurses-5.4
Besides patching patches, I think you should work with this GPC programmer;
-- his recent announcement --
[..]
If you really want to program ncurses, program ncurses.
I'll do that for new work.
However, I have a program I wrote two years ago which only reciently broke, and I would prefer not to have to rewrite it just to keep it running.
Russ
Russell Whitaker wrote:
On Sat, 30 Apr 2005, Rick Engebretson wrote:
Russell Whitaker wrote:
[..]
Patch works. Just to be sure tried it with both ncurses-5.3 and ncurses-5.4
Besides patching patches, I think you should work with this GPC programmer;
-- his recent announcement --
[..]
If you really want to program ncurses, program ncurses.
I'll do that for new work.
However, I have a program I wrote two years ago which only reciently broke, and I would prefer not to have to rewrite it just to keep it running.
Russ
I have started an ObjWindows unit to serve my goal, framebuffer graphics. I don't pretend my work is a model for anybody. I'm hopelessly slow. But I'll upload meaningful versions and post notices as seems useful.
Midnight Commander is a good ncurses example. The "software label keys" are a nice feature often overlooked. Further, if you press Ctrl-o you toggle a subshell command line. This is also a nice feature overlooked. Also, the gpm mouse is usually compiled into ncurses. Ncurses has very complete color routines, rarely used.
A pascal interface can really improve the many naming issues of ncurses.
etc., etc.,