1 /* 2 * GNU Typist - interactive typing tutor program for UNIX systems 3 * 4 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 5 * Simon Baldwin (simonb@sco.com) 6 * Copyright (C) 2003, 2008 7 * GNU Typist Development Team <bug-gtypist@gnu.org> 8 * 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 #ifndef SCRIPT_H 23 #define SCRIPT_H 24 25 #include <stdio.h> 26 27 /* things to help parse the input file */ 28 #define SCR_COMMAND(X) (X[0]) 29 #define SCR_SEP(X) (X[1]) 30 #define SCR_DATA(X) (&X[2]) 31 #define C_COMMENT '#' 32 #define C_ALT_COMMENT '!' 33 #define C_SEP ':' 34 #define C_CONT ' ' 35 #define C_LABEL '*' 36 #define C_TUTORIAL 'T' 37 #define C_INSTRUCTION 'I' 38 #define C_CLEAR 'B' 39 #define C_GOTO 'G' 40 #define C_EXIT 'X' 41 #define C_QUERY 'Q' 42 #define C_YGOTO 'Y' 43 #define C_NGOTO 'N' 44 #define C_DRILL 'D' 45 #define C_DRILL_PRACTICE_ONLY 'd' 46 #define C_SPEEDTEST 'S' 47 #define C_SPEEDTEST_PRACTICE_ONLY 's' 48 #define C_KEYBIND 'K' 49 #define C_ERROR_MAX_SET 'E' 50 #define C_ON_FAILURE_SET 'F' 51 #define C_MENU 'M' 52 53 #define ASCII_NL '\n' 54 #define ASCII_NULL '\0' 55 #define ASCII_ESC 27 56 #define ASCII_BELL 7 57 #define ASCII_SPACE ' ' 58 #define ASCII_DASH '-' 59 #define ASCII_TAB '\t' 60 #define ASCII_BS 8 61 #define ASCII_DEL 127 62 #define STRING_NL "\n" 63 64 /* limits on line lengths from the script file and screen */ 65 #define MAX_SCR_LINE 1024 66 #define MIN_SCR_LINE 2 67 #define MAX_WIN_LINE 128 68 69 extern int global_line_counter; 70 71 extern char *__last_label; 72 73 void __update_last_label (const char *); 74 75 /* a global area for label indexing - singly linked lists, hashed */ 76 #define NLHASH 32 /* num hash lists */ 77 struct label_entry { 78 char *label; /* label string */ 79 long offset; /* offset into file */ 80 int line_count; /* line number in script */ 81 struct label_entry *next; /* pointer to next element */ 82 }; 83 extern struct label_entry *global_label_list[NLHASH]; 84 85 86 extern void build_label_index( FILE *script ); 87 extern void get_script_line( FILE *script, char *line ); 88 extern char *buffer_command( FILE *script, char *line ); 89 extern void seek_label( FILE *script, char *label, char *ref_line ); 90 extern int hash_label( char *label ); 91 extern void do_exit( FILE *script ); 92 93 94 extern void bind_F12 (const char *); // Defined in gtypist.c 95 96 #endif /* !SCRIPT_H */ 97