Page 2 of 2
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Mon Mar 10, 2003 5:58 pm
by Mastermind
Pype.Clicker wrote:
Are you in protected mode ? We do not even know ...
No. I am in Pmode.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Mon Mar 10, 2003 6:01 pm
by Mastermind
Therx: I am going to try your code (and restart my computer), so I'll be gone for some time. Thanks for help.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Tue Mar 11, 2003 2:00 am
by Pype.Clicker
Just adding &keypress will not sufficient! you cannot guarantee the single-character 'keypress' will be followed by some 0 character to terminate the string, so you're likely to see random garbage on screen.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Tue Mar 11, 2003 2:42 am
by distantvoices
I agree with Pype.
It is better to stuff the scancodes in a kind of circular buffer, whch keeps them for some routine that interprets and hands them over as characters (modified with shift, alt, etc - kbd-led-switching too ...) to the console/task that requested the input.
an other routine shall be responsible for stuffing the chars to screen/input buffer (some empty string f. ex - via stream-like functions)
int output(int color, int row, int col, char *string) ;
this char *string thing is fuzzy. Why don't you just pass the character in question by value (it is just located on the stack)? It would ease your life to use pointers only where they are really necessary.
stay safe gosh
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Tue Mar 11, 2003 4:51 am
by Pype.Clicker
Mastermind wrote:
When I compile the code, the asciiShift[] and the asciiNonSh[] in the keydefs.h always gives me problems (initialization makes integer from pointer without a cast).
You #define'd NULL 0, but in most implementations, NULL is defined as (void*)0. If for some obscure reason a generic header file is declaring NULL before you (and i suspect this is the case, otherwise why would you have #ifndef NULL ?), then there is a conflict when you have unshifted[]={NULL, ... }
I suggest you give a look to the output of gcc -E your-main-file.c, (after the pre-processing stage) so that you'll be aware of what is actually read by the compiler when it processes your file.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Tue Mar 11, 2003 3:57 pm
by Therx
No. I was refering to your code(Pype.Clicker).
char keypress[2]; is not a pointer(is it?) so you will need the &keypress
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Posted: Tue Mar 11, 2003 8:57 pm
by Tim
char keypress[2]; is an array. Arrays decay to pointers when passed to functions; this effectively means that arrays and pointers are the same thing.