In programs compiled using the CRT unit, the keys /, *, -, + and ENTER of the numeric keypad are no longer availables (they display other characters). How to solve this problem ?
[French Keyboard/Windows ME/GPC 20010331/GCC 2.95.2]
Thanks for help.
-- "couperin"
Couperin wrote:
In programs compiled using the CRT unit, the keys /, *, -, + and ENTER of the numeric keypad are no longer availables (they display other characters). How to solve this problem ?
Does this happen only recently (since the update of PDCurses for DJGPP)?
Which other characters do you get? Can you find out what codes they give in C (using curses). I'm not sure if PDCurses comes with an according test program, but AFAIK the corresponding tests from ncurses can also be used with PDCurses.
If you can't easily test it, perhaps Maurice can. If you have the codes, it should be easy to translate them in crtc.c (e.g., like it's done with PADSTAR etc. which are the normal codes for these keys).
Frank
Frank Heckenbach wrote:
Couperin wrote:
In programs compiled using the CRT unit, the keys /, *, -, + and ENTER of the numeric keypad are no longer availables (they display other characters). How to solve this problem ?
Does this happen only recently (since the update of PDCurses for DJGPP)?
Which other characters do you get? Can you find out what codes they give in C (using curses). I'm not sure if PDCurses comes with an according test program, but AFAIK the corresponding tests from ncurses can also be used with PDCurses.
If you can't easily test it, perhaps Maurice can. If you have the codes, it should be easy to translate them in crtc.c (e.g., like it's done with PADSTAR etc. which are the normal codes for these keys).
For me (djgpp/w98se/gpc-20020410) * - + work as expected but / and Enter give extended 255 with the following small test program:
-------------------------------------------------------------
program kybtest; uses crt; var c:char; begin writeln('hit some key (end for $)'); repeat c:=readkey; if c=#0 then begin c:=readkey; writeln('extended ',c,ord(c):5) end else writeln(' ',c,ord(c):5); until c='$'; end.
-------------------------------------------------------------
(with BP the same gives all as expected).
Maurice
Maurice Lombardi wrote:
For me (djgpp/w98se/gpc-20020410) * - + work as expected but / and Enter give extended 255
Of course, ksUnknown does not tell me much. I'd need the codes as reported by curses in order to do anything about it.
Frank
Frank Heckenbach wrote:
Maurice Lombardi wrote:
For me (djgpp/w98se/gpc-20020410) * - + work as expected but / and Enter give extended 255
Of course, ksUnknown does not tell me much. I'd need the codes as reported by curses in order to do anything about it.
I am not able to write a C program to check.
I stepped through pascal and crtc.c (with rhide) It seems that the curses function is wgetch() if so the results are (for the numeric keypad)
/ 458 * 463 - 464 + 465 Enter 459
Maurice
Maurice Lombardi wrote:
Frank Heckenbach wrote:
Maurice Lombardi wrote:
For me (djgpp/w98se/gpc-20020410) * - + work as expected but / and Enter give extended 255
Of course, ksUnknown does not tell me much. I'd need the codes as reported by curses in order to do anything about it.
I am not able to write a C program to check.
The demos that come with PDCurses should be sufficient.
I stepped through pascal and crtc.c (with rhide) It seems that the curses function is wgetch() if so the results are (for the numeric keypad)
/ 458 Enter 459
OK, that's PADSLASH and PADENTER according to curses.h. I'm adding support for them in CRT.
Frank
On 23 Apr 2002 at 0:25, Frank Heckenbach wrote:
Couperin wrote:
In programs compiled using the CRT unit, the keys /, *, -, + and ENTER of the numeric keypad are no longer availables (they display other characters). How to solve this problem ?
Does this happen only recently (since the update of PDCurses for DJGPP)?
It's an old problem I always had, I think, but it becomes really annoying. My version of PDCurses seems to be 2.4.
Which other characters do you get? Can you find out what codes they give in C (using curses). I'm not sure if PDCurses comes with an according test program, but AFAIK the corresponding tests from ncurses can also be used with PDCurses.
The problem appears with Readln I tried to write a little program : ***************************** Program keytest; Uses Crt; Const Escape = 256+27; Var Touche : Word; Caractere : Char; Function Bioskey(Commande:Integer):Integer;C; Begin Repeat Writeln('Press a key + ENTER'); Readln(Caractere); Writeln(Caractere,' : ',Ord(Caractere)); Writeln('Press the same key'); Touche := BiosKey(0); Writeln(Chr(Touche),' : ',Touche, ' (',Touche Shr 8,' * 256 + ',Touche And $00FF,')'); Writeln; Until Touche = Escape; End. ***************************** Here is the output I get :
Press a key + ENTER - - : 202 Press the same key / : 13615 (53 * 256 + 47)
Press a key + ENTER ¤ ¤ : 207 Press the same key * : 14122 (55 * 256 + 42)
Press a key + ENTER ð ð : 208 Press the same key - : 18989 (74 * 256 + 45)
Press a key + ENTER Ð Ð : 209 Press the same key + : 20011 (78 * 256 + 43)
Press a key + ENTER - - : 203 Press the same key : 7181 (28 * 256 + 13) *****************************
Of course, if I suppress "Uses Crt", everything is OK.
Thanks for your help. -- "Couperin"
Couperin wrote:
On 23 Apr 2002 at 0:25, Frank Heckenbach wrote:
Couperin wrote:
In programs compiled using the CRT unit, the keys /, *, -, + and ENTER of the numeric keypad are no longer availables (they display other characters). How to solve this problem ?
Does this happen only recently (since the update of PDCurses for DJGPP)?
It's an old problem I always had, I think, but it becomes really annoying.
I see. When you wrote "no longer", it didn't sound exactly like an old problem. Please always state exactly what you mean, otherwise you might lead us on a false trace (especially now that Maurice updated PDCurses for DJGPP just a few days ago).
BTW, I don't think you've stated yet whether you use DJGPP, Cygwin or mingw.
The problem appears with Readln
Another important information that was missing in the original mail.
This makes a big difference, since on the curses level, this calls wgetnstr rather than wgetch. CRT passes the output of wgetnstr through unchanged, so the problem seems to be in PDCurses (perhaps DJGPP specific, since it works for me on PDCurses/X11, with NumLock turned on, of course). So you might want to report it to the PDCurses author.
Frank