



KeyboardPrimitive (lines 978-1029)
Back to List
Browsing parserm.h
0978 [ KeyboardPrimitive a_buffer a_table done ix;
0979 if (gg_commandstr ~= 0 && gg_command_reading ~= false) {
0980 ! get_line_stream
0981 done = glk($0091, gg_commandstr, a_buffer+WORDSIZE, (INPUT_BUFFER_LEN-WORDSIZE)-1);
0982 if (done == 0) {
0983 glk($0044, gg_commandstr, 0); ! stream_close
0984 gg_commandstr = 0;
0985 gg_command_reading = false;
0986 ! L__M(##CommandsRead, 5); would come after prompt
0987 ! fall through to normal user input.
0988 }
0989 else {
0990 ! Trim the trailing newline
0991 if ((a_buffer+WORDSIZE)->(done-1) == 10) done = done-1;
0992 a_buffer-->0 = done;
0993 glk($0086, 8); ! set input style
0994 glk($0084, a_buffer+WORDSIZE, done); ! put_buffer
0995 glk($0086, 0); ! set normal style
0996 print "^";
0997 jump KPContinue;
0998 }
0999 }
1000 done = false;
1001 glk($00D0, gg_mainwin, a_buffer+WORDSIZE, INPUT_BUFFER_LEN-WORDSIZE, 0); ! request_line_event
1002 while (~~done) {
1003 glk($00C0, gg_event); ! select
1004 switch (gg_event-->0) {
1005 5: ! evtype_Arrange
1006 DrawStatusLine();
1007 3: ! evtype_LineInput
1008 if (gg_event-->1 == gg_mainwin) {
1009 a_buffer-->0 = gg_event-->2;
1010 done = true;
1011 }
1012 }
1013 ix = HandleGlkEvent(gg_event, 0, a_buffer);
1014 if (ix == 2) done = true;
1015 else if (ix == -1) done = false;
1016 }
1017 if (gg_commandstr ~= 0 && gg_command_reading == false) {
1018 ! put_buffer_stream
1019 glk($0085, gg_commandstr, a_buffer+WORDSIZE, a_buffer-->0);
1020 glk($0081, gg_commandstr, 10); ! put_char_stream (newline)
1021 }
1022 .KPContinue;
1023 Tokenise__(a_buffer,a_table);
1024 ! It's time to close any quote window we've got going.
1025 if (gg_quotewin) {
1026 glk($0024, gg_quotewin, 0); ! close_window
1027 gg_quotewin = 0;
1028 }
1029 ];
Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.