#define cant_open_file 0x1 #define cant_close_file 0x2 #define bad_first_line 0x4 #define bad_second_line 0x8 #define bad_third_line 0x10 #define bad_fourth_line 0x20 #define file_ended_prematurely 0x40 #define missing_newline 0x80 #define wrong_number_of_lines 0x100 #define wrong_checksum 0x200 #define no_file_open 0x400 #define bad_last_line 0x800 \ #define unexpected_char 100 \ #define STR_BUF_LENGTH 160 \ /*4:*/ #line 71 "gb_io.w" /*7:*/ #line 91 "gb_io.w" #include #ifdef SYSV #include #else #include #endif /*:7*//*31:*/ #line 445 "gb_io.w" #include "localdefs.h" /*:31*/ #line 72 "gb_io.w" /*5:*/ #line 82 "gb_io.w" long io_errors; /*:5*/ #line 73 "gb_io.w" /*8:*/ #line 104 "gb_io.w" static char buffer[81]; static char*cur_pos= buffer; static FILE*cur_file; /*:8*//*10:*/ #line 151 "gb_io.w" static char icode[256]; static long checksum_prime= (1<<30)-83; static long magic; static int line_no; static long final_magic; static long tot_lines; static char more_data; /*:10*//*11:*/ #line 181 "gb_io.w" static char*imap= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz_^~&@,;.:?!%#$+-*/|\\<=>()[]{}`'\" \n"; /*:11*//*34:*/ #line 472 "gb_io.w" static char file_name[20]; /* DECLARATIONS */ long new_checksum ( char *s, long old_checksum ); /*:34*/ #line 74 "gb_io.w" /*9:*/ #line 119 "gb_io.w" static fill_buf() {register char*p; if(!fgets(buffer,81,cur_file)){ io_errors|= file_ended_prematurely;buffer[0]= more_data= 0; } for(p= buffer;*p;p++); if(p--==buffer||*p!='\n'){ io_errors|= missing_newline;p++; } while(--p>=buffer&&*p==' '); *++p= '\n';*++p= 0; cur_pos= buffer; } /*:9*//*15:*/ #line 209 "gb_io.w" static icode_setup() {register int k; register char*p; for(k= 0;k<256;k++)icode[k]= unexpected_char; for(p= imap,k= 0;*p;p++,k++)icode[*p]= k; } /*:15*/ #line 75 "gb_io.w" /*12:*/ #line 187 "gb_io.w" char imap_chr(d) int d; { return d<0||d>strlen(imap)?'\0':imap[d]; } int imap_ord(c) char c; { /*14:*/ #line 206 "gb_io.w" if(!icode['1'])icode_setup(); /*:14*/ #line 197 "gb_io.w" ; return icode[c]; } /*:12*//*17:*/ #line 227 "gb_io.w" gb_newline() { if(++line_no>tot_lines)more_data= 0; if(more_data){ fill_buf(); if(buffer[0]!='*') magic= new_checksum(buffer,magic); } } /*:17*//*18:*/ #line 241 "gb_io.w" long new_checksum ( char *s, long old_checksum ) {register long a= old_checksum; register char*p; for(p= s;*p;p++) a= (a+a+icode[*p])%checksum_prime; return a; } /*:18*//*20:*/ #line 258 "gb_io.w" int gb_eof(){return!more_data;} /*:20*//*22:*/ #line 276 "gb_io.w" char gb_char() { if(*cur_pos)return(*cur_pos++); return'\n'; } gb_backup() { if(cur_pos>buffer) cur_pos--; } /*:22*//*24:*/ #line 310 "gb_io.w" int gb_digit(d) char d; { if(icode[*cur_pos]