From: Rod O. <rod...@us...> - 2008-08-11 18:52:20
|
Update of /cvsroot/win32forth/win32forth/src/console In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13511 Modified Files: CommandWindow.f NewConsole.f Log Message: Rod: changed Key Buffer to hold integers, replaying macros is better Index: NewConsole.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/console/NewConsole.f,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NewConsole.f 11 Aug 2008 17:48:48 -0000 1.12 --- NewConsole.f 11 Aug 2008 18:52:13 -0000 1.13 *************** *** 242,254 **** Prompt: cmd false to entered ! BEGIN auto_key cmd.VirtualKey ?dup ! IF 0 SetVirtualKey: cmd HandleChar: cmd ! ELSE ! KeyBufferEmpty: cmd ! IF call WaitMessage drop ! ELSE GetKey: cmd HandleChar: cmd ! THEN THEN ! PauseForMessages entered auto_key? UNTIL EnteredString >r swap r@ move r> ; --- 242,253 ---- Prompt: cmd false to entered ! BEGIN ! auto_key ! KeyBufferEmpty: cmd ! IF call WaitMessage drop ! ELSE GetKey: cmd HandleChar: cmd THEN ! PauseForMessages entered auto_key? ! UNTIL EnteredString >r swap r@ move r> ; *************** *** 257,263 **** ' AcceptCommand SetAction: cmd ! : c_pushkey ( c -- ) \ push into the keyboard buffer, if c > 255 put into VirtualKey where only latest is kept ! dup -256 and IF SetVirtualKey: cmd ELSE PutKey: cmd THEN ! ; : c_"pushkeys ( a n -- ) \ push the characters of string a n --- 256,260 ---- ' AcceptCommand SetAction: cmd ! : c_pushkey ( c -- ) PutKey: cmd ; : c_"pushkeys ( a n -- ) \ push the characters of string a n *************** *** 270,274 **** \ PauseForMessage PauseForMessages \ Winpause ! KeyBufferEmpty: cmd not cmd.VirtualKey or KeysOn: cmd ; --- 267,271 ---- \ PauseForMessage PauseForMessages \ Winpause ! KeyBufferEmpty: cmd not KeysOn: cmd ; *************** *** 278,282 **** Prompt: cmd KeyBufferEmpty: cmd IF BEGIN KeysOff: cmd WaitForMessage c_key? auto_key? UNTIL THEN ! cmd.VirtualKey ?dup 0= IF GetKey: cmd ELSE 0 SetVirtualKey: cmd THEN EndPrompt: cmd ; --- 275,279 ---- Prompt: cmd KeyBufferEmpty: cmd IF BEGIN KeysOff: cmd WaitForMessage c_key? auto_key? UNTIL THEN ! GetKey: cmd EndPrompt: cmd ; Index: CommandWindow.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/console/CommandWindow.f,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CommandWindow.f 6 Aug 2008 18:19:53 -0000 1.9 --- CommandWindow.f 11 Aug 2008 18:52:13 -0000 1.10 *************** *** 86,92 **** \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ! 256 bytes KeyBuffer ! byte head ! \ byte tail :M EmptyKeyBuffer: ( -- ) 0 to head ;M --- 86,91 ---- \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ! 1024 bytes KeyBuffer ! int head :M EmptyKeyBuffer: ( -- ) 0 to head ;M *************** *** 94,111 **** :M KeyBufferEmpty: ( -- f ) head 0= ;M ! :M PutKey: ( c -- ) \ as long as key buffer is not full head 255 = IF drop beep ! ELSE KeyBuffer head + c! head 1+ to head THEN ;M ! :M GetKey: ( -- c ) \ returns 0 if KeyBuffer is empty KeyBufferEmpty: self IF 0 ! ELSE KeyBuffer c@ KeyBuffer dup 1+ swap 255 move head 1- to head THEN ;M - :M KeyString: ( -- a n ) KeyBuffer head ;M - \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\ Selecting Text \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ --- 93,108 ---- :M KeyBufferEmpty: ( -- f ) head 0= ;M ! :M PutKey: ( n -- ) \ as long as key buffer is not full head 255 = IF drop beep ! ELSE KeyBuffer head 4 * + ! head 1+ to head THEN ;M ! :M GetKey: ( -- n ) \ returns 0 if KeyBuffer is empty KeyBufferEmpty: self IF 0 ! ELSE KeyBuffer @ KeyBuffer dup 4 + swap 1020 move head 1- to head THEN ;M \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\ Selecting Text \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ *************** *** 1084,1088 **** KeysOn IF HandleChar: self ! ELSE dup 27 = IF true to Abort? THEN dup 256 < IF PutKey: self ELSE SetVirtualKey: self THEN THEN \ drop false to Abort? --- 1081,1085 ---- KeysOn IF HandleChar: self ! ELSE dup 27 = IF true to Abort? THEN PutKey: self THEN \ drop false to Abort? *************** *** 1140,1145 **** VK_SHIFT call GetKeyState 32768 and IF 0x80000 or THEN THEN ! dup IF LogKeyStrokes KeysOn IF dup HandleKeys THEN THEN ! to VirtualKey 0 ;M --- 1137,1141 ---- VK_SHIFT call GetKeyState 32768 and IF 0x80000 or THEN THEN ! dup IF LogKeyStrokes KeysOn IF dup HandleKeys THEN PutKey: self THEN 0 ;M |