! ! Copyright (C) 2002 Simon Baldwin (simon_baldwin@yahoo.com) ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! ! #Ifdef DEBUG; Constant MSCP_DEBUG 1; #Endif; Include "mscp.inf"; Include "infglk.h"; Array user_input_line -> 256; Array event_buffer --> 4; ! Read a line from the given window [ readline window; ! Request line, passing user_input_line->1 address glk_request_line_event (window, user_input_line + 1, 255, 0); ! Wait for line input event do { glk_select (event_buffer); } until (event_buffer-->0 == evtype_LineInput); ! Set data length, and return user_input_line->0 = event_buffer-->2; return user_input_line; ]; ! Busy callback, just calls glk_tick and returns. We can't pass glk_tick ! directly as the callback function because it returns 0 (false). [ callback; glk_tick (); return true; ]; ! Main program [ Main window line retcode; ! Set Glk as the I/O system @setiosys 2 0; ! Open a window, and use only fixed fonts window = glk_window_open (GLK_NULL, 0, 0, wintype_TextBuffer, 1); if (window == GLK_NULL) quit; glk_set_window (window); glk_set_style (style_Preformatted); ! Xboard processing loop mscp_xboard (); do { line = readline (window); retcode = mscp_xboard (line, callback); } until (retcode == -1); ];