/* A lexical scanner generated by flex */ /* scanner skeleton version: * $Header: /home/horse/u0/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp Locker: vern $ */ #define FLEX_SCANNER #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* use prototypes in function declarations */ #define YY_USE_PROTOS /* the "const" storage-class-modifier is valid */ #define YY_USE_CONST #else /* ! __cplusplus */ #ifdef __STDC__ #ifdef __GNUC__ #include void *malloc( size_t ); void free( void* ); #else #include #endif /* __GNUC__ */ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #define YY_USE_CONST #endif #ifndef YY_USE_CONST #define const #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () /* we can't get here if it's an ANSI C compiler, or a C++ compiler, * so it's got to be a K&R compiler, and therefore there's no standard * place from which to include these definitions */ char *malloc(); int free(); int read(); #endif /* amount of stuff to slurp up with each read */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* returned upon end-of-file */ #define YY_END_TOK 0 /* copy whatever the last rule matched to the standard output */ /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ /* this used to be an fputs(), but since the string might contain NUL's, * we now use fwrite() */ #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) /* gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #define YY_INPUT(buf,result,max_size) \ if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ YY_FATAL_ERROR( "read() in flex scanner failed" ); #define YY_NULL 0 /* no semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #define yyterminate() return ( YY_NULL ) /* report a fatal error */ /* The funky do-while is used to turn this macro definition into * a single C statement (which needs a semi-colon terminator). * This avoids problems with code like: * * if ( something_happens ) * YY_FATAL_ERROR( "oops, the something happened" ); * else * everything_okay(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the YY_FATAL_ERROR() call. */ #define YY_FATAL_ERROR(msg) \ do \ { \ (void) fputs( msg, stderr ); \ (void) putc( '\n', stderr ); \ exit( 1 ); \ } \ while ( 0 ) /* default yywrap function - always treat EOF as an EOF */ #define yywrap() 1 /* enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN */ #define BEGIN yy_start = 1 + 2 * /* action number for EOF rule of a given start state */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* special action meaning "start processing a new file" */ #define YY_NEW_FILE \ do \ { \ yy_init_buffer( yy_current_buffer, yyin ); \ yy_load_buffer_state(); \ } \ while ( 0 ) /* default declaration of generated scanner - a define so the user can * easily add parameters */ #define YY_DECL int yylex YY_PROTO(( void )) /* code executed at the end of each rule */ #define YY_BREAK break; #define YY_END_OF_BUFFER_CHAR 0 #ifndef YY_BUF_SIZE #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ #endif typedef struct yy_buffer_state *YY_BUFFER_STATE; #define YY_CHAR char # line 1 "load.l" #define INITIAL 0 /* load.l Copyright (C) 1994 Lambert Klasen & Detlef Steuer klasen@asterix.uni-muenster.de steuer@amadeus.statistik.uni-dortmund.de This file is free source code; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. 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 COPYING for more details. */ # line 20 "load.l" #include #include #include #include #include "xgammon.h" #include "gammon.h" /* for some irix */ #ifdef irix #define usleep(a) sleep((a/10)) #endif char kind; char *player[2]; int games_replayed; static float fval, *inarray; static int count = 0, endarray; static int found_black, found_white; static int have_tournament = 0; static int wraped = 0; void replay_init_game (); void print_move (MOVE *m); extern float point_values[], prime_length_factor[]; extern int replaying; extern unsigned long delaytime; extern FILE * protokol_file; extern void ShowCompiMove (); extern void DrawEmptyBoard (); extern void DrawBoard (); extern void RedrawAllStones (); extern void RemoveStone (); extern void DrawDice (); extern void DrawDoubler (); extern void open_protokol (); #define LOAD 1 #define LOAD_CONFIG 2 #define REPLAY 3 #define GETMOVE 4 #define FIBSLOAD 5 # line 68 "load.l" /* done after the current pattern has been matched and before the * corresponding action - sets up yytext */ #define YY_DO_BEFORE_ACTION \ yytext = yy_bp; \ yyleng = yy_cp - yy_bp; \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* return all but the first 'n' matched characters back to the input stream */ #define yyless(n) \ do \ { \ /* undo effects of setting up yytext */ \ *yy_cp = yy_hold_char; \ yy_c_buf_p = yy_cp = yy_bp + n; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext ) struct yy_buffer_state { FILE *yy_input_file; YY_CHAR *yy_ch_buf; /* input buffer */ YY_CHAR *yy_buf_pos; /* current position in input buffer */ /* size of input buffer in bytes, not including room for EOB characters */ int yy_buf_size; /* number of characters read into yy_ch_buf, not including EOB characters */ int yy_n_chars; int yy_eof_status; /* whether we've seen an EOF on this buffer */ #define EOF_NOT_SEEN 0 /* "pending" happens when the EOF has been seen but there's still * some text process */ #define EOF_PENDING 1 #define EOF_DONE 2 }; static YY_BUFFER_STATE yy_current_buffer; /* we provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state" */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed */ static YY_CHAR yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif #ifndef YY_USER_INIT #define YY_USER_INIT #endif extern YY_CHAR *yytext; extern int yyleng; extern FILE *yyin, *yyout; YY_CHAR *yytext; int yyleng; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; #define YY_END_OF_BUFFER 32 typedef int yy_state_type; static const short int yy_accept[452] = { 0, 0, 0, 0, 0, 0, 0, 12, 12, 13, 13, 0, 0, 32, 29, 30, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 29, 29, 15, 16, 15, 12, 12, 14, 17, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 13, 0, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 9, 9, 9, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 11, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 25, 0, 0, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0 } ; static const YY_CHAR yy_ec[128] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 5, 6, 7, 1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 17, 1, 1, 1, 1, 1, 1, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 1, 1, 1, 1, 1, 1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 18, 28, 29, 30, 31, 32, 33, 18, 34, 35, 36, 37, 38, 39, 18, 40, 18, 1, 1, 1, 1, 1 } ; static const YY_CHAR yy_meta[41] = { 0, 1, 2, 3, 1, 1, 1, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9, 9, 9, 9, 9, 11, 9, 9, 9, 9, 9, 9, 9, 9 } ; static const short int yy_base[477] = { 0, 943, 942, 0, 0, 39, 0, 72, 97, 122, 0, 941, 940, 941, 946, 946, 914, 160, 936, 39, 53, 40, 54, 57, 41, 55, 0, 931, 29, 934, 946, 87, 176, 193, 946, 946, 0, 215, 51, 930, 916, 915, 58, 229, 930, 906, 78, 66, 68, 80, 79, 928, 161, 175, 0, 0, 923, 902, 901, 924, 92, 164, 93, 181, 183, 184, 230, 899, 80, 0, 84, 919, 890, 888, 890, 186, 185, 187, 198, 188, 186, 918, 215, 889, 889, 216, 214, 233, 245, 247, 250, 251, 234, 250, 257, 946, 894, 911, 913, 888, 911, 910, 256, 909, 162, 892, 884, 253, 873, 885, 260, 904, 116, 259, 268, 269, 246, 882, 194, 0, 874, 260, 249, 271, 267, 293, 870, 188, 900, 899, 898, 274, 287, 275, 292, 294, 297, 298, 946, 892, 304, 946, 866, 862, 873, 877, 299, 863, 869, 876, 889, 283, 853, 861, 301, 886, 305, 307, 885, 316, 884, 306, 883, 338, 853, 849, 880, 853, 878, 843, 860, 875, 0, 848, 850, 856, 851, 314, 315, 320, 324, 323, 327, 870, 373, 302, 845, 868, 0, 833, 310, 849, 838, 311, 864, 847, 838, 835, 832, 859, 342, 858, 331, 349, 384, 857, 359, 828, 828, 854, 833, 836, 825, 830, 823, 825, 335, 829, 813, 811, 822, 370, 344, 385, 341, 362, 364, 388, 843, 809, 825, 808, 813, 818, 821, 812, 809, 811, 808, 812, 811, 797, 374, 367, 378, 946, 829, 368, 796, 794, 812, 791, 793, 805, 789, 805, 796, 946, 787, 795, 387, 817, 402, 420, 408, 814, 797, 814, 793, 798, 786, 790, 791, 775, 793, 806, 805, 399, 804, 409, 443, 460, 803, 802, 778, 0, 786, 799, 784, 772, 776, 946, 774, 410, 377, 413, 400, 489, 794, 793, 792, 791, 420, 790, 946, 773, 430, 501, 412, 411, 449, 765, 787, 769, 0, 459, 759, 755, 760, 0, 764, 416, 455, 451, 485, 433, 765, 760, 946, 768, 946, 771, 768, 760, 747, 750, 771, 739, 435, 502, 473, 454, 946, 739, 737, 751, 748, 734, 766, 736, 478, 486, 475, 491, 764, 727, 737, 946, 741, 467, 729, 519, 520, 759, 521, 0, 738, 731, 733, 723, 476, 522, 517, 529, 724, 733, 723, 711, 716, 482, 530, 536, 537, 697, 687, 693, 667, 946, 946, 683, 675, 674, 645, 668, 642, 641, 538, 621, 637, 565, 597, 621, 582, 541, 579, 543, 561, 577, 592, 591, 531, 565, 557, 560, 0, 540, 567, 582, 566, 585, 469, 551, 583, 581, 946, 548, 580, 946, 565, 546, 545, 563, 570, 946, 545, 946, 547, 566, 541, 537, 529, 527, 522, 553, 524, 461, 444, 394, 346, 164, 946, 946, 600, 611, 620, 627, 631, 638, 649, 656, 662, 669, 674, 677, 684, 691, 694, 701, 64, 710, 39, 717, 720, 725, 734, 741, 744 } ; static const short int yy_def[477] = { 0, 452, 452, 451, 3, 452, 5, 453, 453, 451, 9, 452, 452, 451, 451, 451, 451, 454, 454, 454, 454, 454, 454, 454, 454, 454, 455, 456, 451, 457, 451, 457, 458, 458, 451, 451, 459, 459, 37, 459, 459, 451, 451, 454, 454, 451, 454, 454, 454, 454, 454, 454, 454, 454, 455, 455, 456, 451, 451, 457, 457, 457, 457, 457, 457, 457, 457, 33, 33, 459, 460, 459, 459, 451, 451, 454, 454, 454, 454, 454, 451, 454, 454, 451, 451, 457, 457, 457, 457, 457, 457, 457, 33, 460, 451, 451, 451, 459, 451, 451, 454, 454, 454, 454, 454, 451, 461, 454, 451, 451, 457, 457, 457, 457, 457, 457, 33, 451, 462, 463, 451, 451, 451, 454, 451, 454, 451, 461, 451, 451, 451, 457, 464, 457, 457, 457, 457, 33, 451, 462, 451, 451, 463, 451, 451, 451, 454, 451, 451, 451, 451, 451, 451, 451, 457, 464, 464, 464, 457, 457, 457, 457, 457, 457, 451, 451, 451, 451, 454, 451, 451, 451, 465, 451, 451, 451, 451, 457, 464, 464, 457, 457, 457, 457, 457, 457, 451, 451, 466, 451, 451, 451, 451, 451, 465, 451, 451, 451, 451, 457, 464, 464, 457, 457, 184, 457, 457, 451, 451, 466, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 457, 464, 464, 457, 457, 457, 457, 457, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 451, 457, 457, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 467, 457, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 457, 467, 467, 457, 451, 451, 468, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 281, 464, 469, 451, 451, 451, 451, 451, 451, 451, 457, 297, 457, 281, 464, 451, 469, 451, 470, 451, 451, 451, 451, 471, 451, 457, 307, 457, 464, 464, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 471, 451, 457, 464, 457, 464, 451, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 464, 451, 451, 451, 451, 451, 451, 451, 457, 464, 457, 464, 472, 451, 451, 451, 451, 457, 464, 184, 464, 472, 451, 451, 451, 451, 457, 464, 457, 464, 451, 451, 451, 451, 451, 451, 464, 473, 464, 451, 451, 451, 451, 464, 451, 473, 297, 451, 474, 451, 464, 451, 464, 451, 451, 474, 451, 464, 451, 451, 451, 475, 464, 451, 451, 451, 475, 464, 451, 451, 451, 451, 464, 451, 451, 476, 464, 451, 476, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 0, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451 } ; static const short int yy_nxt[987] = { 0, 14, 15, 16, 14, 14, 14, 14, 17, 17, 17, 17, 17, 17, 17, 17, 17, 14, 18, 18, 19, 18, 20, 18, 18, 18, 18, 18, 18, 21, 22, 18, 23, 24, 18, 18, 25, 18, 18, 18, 18, 15, 45, 45, 45, 328, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 45, 45, 45, 49, 45, 57, 46, 58, 69, 69, 69, 69, 52, 45, 300, 45, 28, 29, 30, 31, 29, 29, 29, 29, 47, 45, 45, 45, 41, 48, 50, 76, 51, 29, 60, 74, 53, 93, 94, 60, 60, 33, 29, 30, 31, 29, 29, 29, 29, 77, 61, 67, 62, 63, 79, 85, 88, 75, 29, 78, 96, 64, 92, 60, 133, 65, 33, 34, 35, 34, 34, 34, 34, 34, 36, 37, 38, 39, 39, 39, 39, 39, 39, 34, 36, 36, 40, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 42, 45, 45, 450, 60, 43, 43, 43, 43, 43, 43, 43, 43, 43, 59, 45, 66, 59, 59, 59, 59, 60, 86, 60, 60, 45, 45, 45, 45, 81, 59, 59, 87, 66, 59, 59, 59, 59, 45, 125, 139, 140, 150, 105, 102, 101, 82, 59, 104, 41, 89, 451, 90, 91, 60, 45, 60, 68, 70, 100, 71, 71, 71, 71, 71, 71, 71, 71, 71, 42, 60, 103, 110, 60, 43, 43, 43, 43, 43, 43, 43, 43, 43, 107, 87, 60, 61, 60, 62, 63, 60, 60, 111, 45, 116, 95, 45, 64, 67, 60, 60, 65, 95, 95, 95, 95, 95, 128, 60, 60, 67, 45, 41, 112, 60, 60, 134, 115, 137, 451, 131, 113, 123, 41, 145, 114, 147, 156, 135, 144, 41, 146, 60, 45, 60, 136, 148, 60, 163, 45, 173, 60, 60, 157, 154, 156, 60, 156, 158, 141, 141, 141, 141, 141, 60, 156, 60, 161, 159, 174, 156, 157, 67, 60, 60, 183, 160, 60, 214, 162, 168, 60, 206, 41, 177, 179, 181, 178, 60, 201, 85, 60, 156, 85, 156, 211, 199, 215, 200, 60, 449, 202, 236, 225, 61, 203, 62, 63, 222, 60, 224, 245, 60, 228, 60, 64, 246, 156, 60, 65, 60, 237, 185, 60, 60, 243, 244, 307, 60, 205, 205, 205, 205, 205, 205, 156, 85, 60, 60, 85, 226, 226, 226, 226, 226, 226, 264, 260, 262, 156, 261, 157, 60, 242, 247, 179, 278, 276, 60, 60, 60, 324, 60, 60, 448, 294, 60, 178, 59, 309, 279, 59, 59, 59, 59, 85, 85, 282, 280, 306, 60, 178, 342, 156, 59, 60, 281, 316, 323, 280, 295, 59, 308, 279, 59, 59, 59, 59, 317, 156, 338, 60, 350, 325, 156, 339, 318, 59, 59, 321, 279, 59, 59, 59, 59, 329, 330, 331, 330, 156, 332, 155, 330, 60, 59, 60, 60, 340, 60, 447, 379, 388, 60, 353, 367, 156, 156, 155, 296, 156, 446, 156, 425, 352, 363, 310, 310, 310, 310, 310, 310, 157, 156, 368, 361, 157, 322, 322, 322, 322, 322, 322, 322, 322, 322, 362, 341, 364, 157, 60, 156, 156, 156, 381, 381, 381, 381, 381, 381, 156, 156, 156, 351, 178, 178, 390, 60, 156, 156, 370, 156, 156, 390, 156, 371, 433, 156, 373, 156, 382, 380, 445, 429, 444, 157, 443, 391, 410, 420, 442, 441, 440, 439, 389, 415, 403, 438, 437, 436, 435, 178, 405, 405, 405, 405, 405, 405, 432, 434, 432, 430, 428, 427, 426, 424, 423, 422, 421, 418, 417, 416, 414, 407, 413, 412, 411, 409, 178, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 407, 44, 44, 44, 406, 44, 44, 44, 54, 54, 54, 56, 56, 56, 56, 59, 397, 59, 59, 59, 59, 59, 59, 59, 59, 59, 67, 404, 67, 67, 67, 67, 67, 67, 67, 67, 67, 69, 69, 69, 402, 69, 69, 69, 95, 95, 402, 401, 400, 95, 127, 127, 127, 399, 397, 127, 141, 141, 142, 142, 142, 155, 396, 155, 155, 155, 155, 155, 155, 155, 155, 155, 194, 194, 194, 209, 209, 209, 280, 395, 280, 280, 280, 280, 280, 280, 280, 280, 280, 312, 394, 312, 312, 312, 393, 312, 312, 312, 336, 336, 336, 374, 374, 374, 398, 392, 398, 398, 398, 387, 398, 398, 398, 408, 386, 408, 408, 408, 385, 408, 408, 408, 419, 419, 419, 431, 431, 431, 431, 431, 431, 431, 384, 383, 378, 377, 376, 375, 372, 369, 357, 357, 366, 365, 360, 359, 358, 357, 356, 355, 354, 349, 348, 347, 346, 345, 330, 330, 330, 344, 343, 337, 335, 334, 333, 327, 311, 326, 320, 319, 315, 314, 313, 311, 305, 304, 304, 303, 302, 301, 299, 298, 297, 60, 293, 292, 291, 290, 289, 288, 288, 287, 286, 285, 284, 283, 277, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 263, 259, 258, 257, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 60, 241, 240, 239, 238, 235, 234, 187, 233, 232, 231, 208, 230, 229, 227, 223, 221, 220, 219, 218, 217, 216, 213, 212, 210, 208, 207, 204, 198, 197, 196, 195, 193, 192, 191, 190, 189, 188, 187, 186, 184, 182, 180, 156, 176, 175, 172, 171, 170, 169, 167, 166, 165, 164, 141, 153, 152, 151, 149, 143, 138, 132, 130, 129, 41, 126, 124, 122, 121, 120, 119, 118, 117, 109, 108, 106, 99, 98, 97, 70, 67, 60, 84, 83, 55, 80, 41, 45, 73, 72, 70, 60, 55, 45, 41, 451, 15, 15, 15, 15, 13, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451 } ; static const short int yy_chk[987] = { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 21, 24, 470, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 20, 22, 25, 21, 23, 28, 19, 28, 38, 38, 38, 38, 24, 47, 468, 48, 5, 7, 7, 7, 7, 7, 7, 7, 20, 46, 50, 49, 42, 20, 22, 47, 23, 7, 31, 42, 25, 70, 70, 60, 62, 7, 8, 8, 8, 8, 8, 8, 8, 48, 31, 68, 31, 31, 50, 60, 62, 46, 8, 49, 70, 31, 68, 112, 112, 31, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 17, 52, 104, 449, 61, 17, 17, 17, 17, 17, 17, 17, 17, 17, 32, 53, 32, 32, 32, 32, 32, 63, 61, 64, 65, 76, 75, 77, 79, 52, 32, 33, 61, 33, 33, 33, 33, 33, 78, 104, 118, 118, 127, 80, 77, 76, 53, 33, 79, 80, 63, 127, 64, 65, 86, 82, 85, 33, 37, 75, 37, 37, 37, 37, 37, 37, 37, 37, 37, 43, 66, 78, 86, 87, 43, 43, 43, 43, 43, 43, 43, 43, 43, 82, 85, 88, 66, 89, 66, 66, 90, 91, 87, 107, 92, 93, 102, 66, 92, 113, 110, 66, 94, 94, 94, 94, 94, 107, 114, 115, 116, 123, 122, 88, 131, 133, 113, 91, 116, 93, 110, 89, 102, 121, 122, 90, 124, 132, 114, 121, 124, 123, 134, 125, 135, 115, 125, 136, 137, 146, 151, 154, 185, 132, 131, 156, 161, 157, 133, 140, 140, 140, 140, 140, 177, 178, 159, 136, 134, 151, 179, 156, 137, 181, 180, 161, 135, 182, 193, 136, 146, 202, 185, 190, 154, 157, 159, 156, 163, 179, 180, 224, 200, 182, 222, 190, 177, 193, 178, 203, 448, 180, 216, 203, 163, 181, 163, 163, 200, 206, 202, 225, 225, 206, 226, 163, 226, 243, 247, 163, 221, 216, 163, 184, 242, 222, 224, 294, 244, 184, 184, 184, 184, 184, 184, 223, 221, 260, 227, 184, 204, 204, 204, 204, 204, 204, 247, 242, 244, 277, 243, 223, 262, 221, 227, 294, 262, 260, 264, 279, 293, 309, 308, 295, 447, 277, 321, 223, 263, 296, 263, 263, 263, 263, 263, 279, 293, 264, 296, 293, 306, 277, 325, 325, 263, 338, 263, 302, 308, 309, 279, 280, 295, 280, 280, 280, 280, 280, 302, 310, 321, 323, 338, 310, 341, 322, 302, 280, 281, 306, 281, 281, 281, 281, 281, 315, 315, 315, 315, 420, 315, 322, 315, 340, 281, 352, 370, 323, 350, 446, 370, 379, 379, 341, 359, 324, 351, 322, 281, 297, 445, 353, 420, 340, 352, 297, 297, 297, 297, 297, 297, 324, 339, 359, 350, 297, 307, 307, 307, 307, 307, 307, 307, 307, 307, 351, 324, 353, 339, 361, 362, 364, 371, 372, 372, 372, 372, 372, 372, 373, 380, 410, 339, 307, 339, 381, 381, 382, 396, 361, 415, 403, 405, 405, 362, 429, 429, 364, 425, 373, 371, 444, 425, 443, 396, 442, 382, 403, 415, 441, 440, 439, 438, 380, 410, 396, 437, 436, 434, 432, 396, 399, 399, 399, 399, 399, 399, 431, 430, 428, 426, 423, 422, 421, 419, 418, 417, 416, 413, 412, 411, 409, 408, 407, 406, 404, 402, 399, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453, 453, 454, 401, 454, 454, 454, 400, 454, 454, 454, 455, 455, 455, 456, 456, 456, 456, 457, 398, 457, 457, 457, 457, 457, 457, 457, 457, 457, 458, 397, 458, 458, 458, 458, 458, 458, 458, 458, 458, 459, 459, 459, 395, 459, 459, 459, 460, 460, 394, 393, 392, 460, 461, 461, 461, 391, 390, 461, 462, 462, 463, 463, 463, 464, 389, 464, 464, 464, 464, 464, 464, 464, 464, 464, 465, 465, 465, 466, 466, 466, 467, 386, 467, 467, 467, 467, 467, 467, 467, 467, 467, 469, 385, 469, 469, 469, 384, 469, 469, 469, 471, 471, 471, 472, 472, 472, 473, 383, 473, 473, 473, 378, 473, 473, 473, 474, 377, 474, 474, 474, 376, 474, 474, 474, 475, 475, 475, 476, 476, 476, 476, 476, 476, 476, 375, 374, 369, 368, 367, 366, 363, 360, 358, 356, 355, 354, 349, 348, 347, 346, 345, 344, 343, 337, 336, 335, 334, 333, 332, 331, 329, 327, 326, 320, 318, 317, 316, 313, 312, 311, 305, 303, 301, 300, 299, 298, 292, 290, 289, 288, 287, 286, 284, 283, 282, 278, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 261, 259, 258, 256, 255, 254, 253, 252, 251, 250, 249, 248, 246, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 220, 219, 218, 217, 215, 214, 213, 212, 211, 210, 209, 208, 207, 205, 201, 199, 198, 197, 196, 195, 194, 192, 191, 189, 187, 186, 183, 176, 175, 174, 173, 171, 170, 169, 168, 167, 166, 165, 164, 162, 160, 158, 155, 153, 152, 150, 149, 148, 147, 145, 144, 143, 142, 139, 130, 129, 128, 126, 120, 117, 111, 109, 108, 106, 105, 103, 101, 100, 99, 98, 97, 96, 84, 83, 81, 74, 73, 72, 71, 67, 59, 58, 57, 56, 51, 45, 44, 41, 40, 39, 29, 27, 18, 16, 13, 12, 11, 2, 1, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451 } ; static yy_state_type yy_last_accepting_state; static YY_CHAR *yy_last_accepting_cpos; /* the intent behind this definition is that it'll catch * any uses of REJECT which flex missed */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 /* these variables are all declared out here so that section 3 code can * manipulate them */ /* points to current character in buffer */ static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); #define yy_new_buffer yy_create_buffer #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif YY_DECL { register yy_state_type yy_current_state; register YY_CHAR *yy_cp, *yy_bp; register int yy_act; if ( yy_init ) { YY_USER_INIT; if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( yy_current_buffer ) yy_init_buffer( yy_current_buffer, yyin ); else yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); yy_init = 0; } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* support of yytext */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of the * current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[*yy_cp]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = yy_def[yy_current_state]; if ( yy_current_state >= 452 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 451 ); yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; YY_USER_ACTION; do_action: /* this label is used only to access EOF actions */ switch ( yy_act ) { case 0: /* must backtrack */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: # line 69 "load.l" { char *r = yytext; int i = 1; while (*(r+i) != ' ') i++; player[0] = malloc (i+1); strncpy (player[0], r, i); r = strstr (yytext, " and ") + 5; i = 1; while (*(r+i) != ' ') i++; player[1] = malloc (i+1); strncpy (player[1], r, i); r = r + i + 9; tournament.winning_point = atoi (r); #ifdef DEBUG_REPLAY fprintf (stderr, "player: %s %s\n", player[0], player[1]); fprintf (stderr, "winning_point: %d\n", tournament.winning_point); #endif AppendDialogText (LOWER, yytext); } YY_BREAK case 2: # line 95 "load.l" { AppendDialogText (LOWER, yytext); roll[0] = *(yytext+yyleng-9) - '0'; roll[1] = *(yytext+yyleng-3) - '0'; if (strncmp (player[1], yytext, strlen (player[1])) == 0) turn = BLACK; else if (strncmp (player[0], yytext, strlen (player[0])) == 0) turn = WHITE; #ifdef DEBUG_REPLAY fprintf (stderr,"roll %c %c turn %d\n", *(yytext+yyleng-9), *(yytext+yyleng-3), turn); #endif DrawDice (turn); XSync (Player[0].X11Set.dpy, 0); while(1) { XEvent event; XtAppNextEvent(app_con, &event); if (event.type == ButtonRelease && event.xbutton.window == Player[0].X11Set.board.window) { XtDispatchEvent (&event); break; } else if (event.type == KeyRelease && event.xkey.window == Player[0].X11Set.board.window) { break; } XtDispatchEvent(&event); } } YY_BREAK case 3: # line 126 "load.l" { char *r = yytext; count = 0; AppendDialogText (LOWER, yytext); while (*r != ',') r++; roll[0] = *(r-1) - '0'; while (*r != '\n') r++; roll[1] = *(r-1) - '0'; #ifdef DEBUG_REPLAY fprintf (stderr, "initial roll %s", yytext ); fprintf (stderr, "roll %d %d\n", roll[0], roll[1]); #endif if (games_replayed%2 == 0) { char *p; p = player[0]; player[0] = player[1]; player[1] = p; } games_replayed++; if (strncmp ((r+1), player[0], strlen (player[0])) == 0) turn = BLACK; else turn = WHITE; #ifdef DEBUG_REPLAY fprintf (stderr ,"turn %d\n", turn); #endif replay_init_game (); } YY_BREAK case 4: # line 155 "load.l" { if (strncmp (player[0], yytext, strlen(player[0])) == 0) { doubler.owner = BLACK; } else if (strncmp (player[1], yytext, strlen(player[1])) == 0) { doubler.owner = WHITE; } AppendDialogText (LOWER, yytext); XSync (Player[0].X11Set.dpy, 0); while(1) { XEvent event; XtAppNextEvent(app_con, &event); if (event.type == ButtonRelease && event.xbutton.window == Player[0].X11Set.board.window) { XtDispatchEvent(&event); break; } else if (event.type == KeyRelease && event.xkey.window == Player[0].X11Set.board.window) { break; } XtDispatchEvent(&event); } } YY_BREAK case 5: # line 181 "load.l" { if (strncmp (player[0], yytext, strlen(player[0])) == 0 || strncmp (player[1], yytext, strlen(player[1])) == 0) { doubler.value *= 2; DrawDoubler (doubler.value, doubler.owner); #ifdef DEBUG_REPLAY fprintf (stderr,"doubling accepted\n"); #endif } AppendDialogText (LOWER, yytext); } YY_BREAK case 6: # line 193 "load.l" { AppendDialogText (LOWER, yytext); #ifdef DEBUG_REPLAY fprintf (stderr,"doubling resign\n"); #endif } YY_BREAK case 7: # line 200 "load.l" { if (strncmp (player[0], yytext, strlen(player[0]) - 1) == 0) BEGIN GETMOVE; else if (strncmp (player[1], yytext, strlen(player[1]) - 1) == 0) BEGIN GETMOVE; AppendDialogText (LOWER, yytext); count = 0; #ifdef DEBUG_REPLAY fprintf (stderr,"switching to getmove\n"); #endif } YY_BREAK case 8: # line 212 "load.l" { AppendDialogText (LOWER, yytext); if (turn == BLACK) turn = WHITE; else turn = BLACK; } YY_BREAK case 9: # line 218 "load.l" { char *to = yytext; int f, t; AppendDialogText (LOWER, yytext); f = atoi (yytext); turn = Pin[f].color; while (*to != '-') to++; to++; t = atoi (to); #ifdef DEBUG_REPLAY fprintf (stderr,"from %d to %d\n", f, t); #endif RemoveStone (f); if (Pin[t].count == 1 && Pin[t].color != turn) { PutStone (Pin[t].color, (turn == BLACK) ? WHITE_BAR : BLACK_BAR); RemoveStone (t); } PutStone (turn, t); XSync (Player[0].X11Set.dpy, 0); usleep (delaytime); } YY_BREAK case 10: # line 238 "load.l" { int f, t, f_color; AppendDialogText (LOWER, yytext); t = atoi ((yytext+4)); if (t < 7) { f_color = BLACK; f = BLACK_BAR; turn = BLACK; /* for RemoveStone () */ } else { f_color = WHITE; f = WHITE_BAR; turn = WHITE; } #ifdef DEBUG_REPLAY fprintf (stderr,"from (bar) %d to %d\n", f, t); #endif RemoveStone (f); if (Pin[t].count == 1 && Pin[t].color != f_color) { PutStone (Pin[t].color, (f_color == BLACK) ? WHITE_BAR : BLACK_BAR); RemoveStone (t); } PutStone (f_color, t); XSync (Player[0].X11Set.dpy, 0); usleep (delaytime); } YY_BREAK case 11: # line 265 "load.l" { int f, t; AppendDialogText (LOWER, yytext); f = atoi (yytext); if (Pin[f].color == BLACK) { t = 25+BLACK; turn = BLACK; } else { t = 25+WHITE; turn = WHITE; } #ifdef DEBUG_REPLAY fprintf (stderr, "from %d to %d (off)\n", f, t); #endif RemoveStone (f); PutStone (turn, t); XSync (Player[0].X11Set.dpy, 0); usleep (delaytime); } YY_BREAK case 12: # line 286 "load.l" { AppendDialogText (LOWER, yytext); } YY_BREAK case 13: # line 287 "load.l" { AppendDialogText (LOWER, yytext); } YY_BREAK case 14: # line 288 "load.l" { AppendDialogText (LOWER, yytext); } YY_BREAK case 15: # line 289 "load.l" { AppendDialogText (LOWER, yytext); } YY_BREAK case 16: # line 291 "load.l" { AppendDialogText (LOWER, "\n"); } YY_BREAK case 17: # line 292 "load.l" { AppendDialogText (LOWER, "\n"); BEGIN REPLAY; } YY_BREAK case 18: # line 297 "load.l" { if (strncmp( yytext+6, "black", 5) == 0) { turn = BLACK; other = WHITE; direction = 1; start_pin = 0; end_pin = 25; Player[0].beginner_of_game = 1; Player[1].beginner_of_game = 0; } if (strncmp( yytext+6, "white", 5) == 0) { turn = WHITE; other = BLACK; direction = -1; start_pin = 25; end_pin = 0; Player[1].beginner_of_game = 1; Player[0].beginner_of_game = 0; } } YY_BREAK case 19: # line 318 "load.l" { roll[0] = *(yytext+13) - '0'; roll[1] = *(yytext+15) - '0'; roll[0] *= direction; roll[1] *= direction; if (roll[0] == roll[1]) { roll[3] = roll[0]; roll[2] = roll[1]; to_move = 4; pash = 1; } else { roll[2] = roll[3] = 0; pash = 0; to_move = 2; } } YY_BREAK case 20: # line 338 "load.l" { doubler.value = atoi((yytext+15)); } YY_BREAK case 21: # line 341 "load.l" { if (*(yytext+14) == 'b') doubler.owner = BLACK; else if (*(yytext+14) == 'w') doubler.owner = WHITE; else doubler.owner = 0; } YY_BREAK case 22: # line 347 "load.l" { char *r = yytext+8; r = strstr (yytext, "black: ") + strlen ("black: "); if ((Pin[0].count = atoi(r))) Pin[0].color = BLACK; r = strstr (yytext, "white: ") + strlen ("white: "); if ((Pin[25].count = atoi(r))) Pin[25].color = WHITE; found_black += Pin[0].count; found_white += Pin[25].count; } YY_BREAK case 23: # line 360 "load.l" { int p, m; char *r = yytext+4; p = atoi(r); while (*r != ' ') r++; r++; m = atoi (r); while (*r != ' ') r++; r++; if (strncmp(r, "black", 5) == 0) { Pin[p].color = BLACK; found_black += m; } else if (strncmp(r, "white", 5) == 0) { Pin[p].color = WHITE; found_white += m; } Pin[p].count = m; } YY_BREAK case 24: # line 384 "load.l" { int i = 1; char *r = strstr(yytext, "between") + 8; if (kind == 'g') { while (*(r+i) != ' ') i++; strncpy (Player[0].name, r, i-1); *(Player[0].name+i) = '\0'; r = r+i+5; i=1; while (*(r+i) != ':') i++; strncpy (Player[1].name, r, i); *(Player[0].name+i) = '\0'; have_tournament = 1; if (strncmp (yytext, "money-game", 10) == 0) { sprintf (add_text, "%s and %s play a money-game match", Player[0].name, Player[1].name); tournament.winning_point = 0; gammon_resource.moneygame = 1; } else { sprintf (add_text, "%s and %s play a %d points match", Player[0].name, Player[1].name, tournament.winning_point); gammon_resource.moneygame = 0; gammon_resource.winat = tournament.winning_point = atoi(yytext); } AppendDialogText (UPPER, add_text); } } YY_BREAK case 25: # line 413 "load.l" { char *r = strstr (yytext, "has") + 4, *p; if (strncmp (yytext, Player[0].name, strlen(Player[0].name)) == 0) Player[0].points = atoi(yytext); else if (strncmp (yytext, Player[1].name, strlen(Player[1].name)) == 0) Player[1].points = atoi(yytext); while (*r != ',') r++; r+=2; if (strncmp (r, Player[0].name, strlen(Player[0].name)) == 0) { p = strstr(r, "has") + 4; Player[0].points = atoi(p); } else if (strncmp (r, Player[1].name, strlen(Player[1].name)) == 0) { p = strstr(r, "has") + 4; Player[1].points = atoi(p); } sprintf (add_text, "%s points: %d, %s points: %d", Player[1].name, Player[1].points, Player[0].name, Player[0].points); AppendDialogText (UPPER, add_text); } YY_BREAK case 26: # line 433 "load.l" { count = 0; endarray = 24; inarray = (point_values+1); } YY_BREAK case 27: # line 439 "load.l" { if (count < 24) { fprintf (stderr, "incomplete array: point_values\n"); } count = 0; endarray = 8; inarray = prime_length_factor; } YY_BREAK case 28: # line 448 "load.l" { fval = atof (yytext); if ((count ++) >= endarray) { fprintf (stderr, "too many float values for array %s\n", (endarray == 24) ? "point_values" : "prine_length_factor"); } else { *(inarray++) = fval; } } YY_BREAK case 29: # line 458 "load.l" ; YY_BREAK case 30: # line 459 "load.l" ; YY_BREAK case 31: # line 460 "load.l" ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(LOAD): case YY_STATE_EOF(LOAD_CONFIG): case YY_STATE_EOF(REPLAY): case YY_STATE_EOF(GETMOVE): case YY_STATE_EOF(FIBSLOAD): yyterminate(); case YY_END_OF_BUFFER: { /* amount of text matched not including the EOB char */ int yy_amount_of_matched_text = yy_cp - yytext - 1; /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; /* note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the end- * of-buffer state). Contrast this with the test in yyinput(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* this was really a NUL */ { yy_state_type yy_next_state; yy_c_buf_p = yytext + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* okay, we're now positioned to make the * NUL transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we * don't want to build jamming into it because * then it will run more slowly) */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext + YY_MORE_ADJ; if ( yy_next_state ) { /* consume the NUL */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* note: because we've taken care in * yy_get_next_buffer() to have set up yytext, * we can now set up yy_c_buf_p so that if some * total hoser (like flex itself) wants * to call the scanner after we return the * YY_NULL, it'll still work - another YY_NULL * will get returned. */ yy_c_buf_p = yytext + YY_MORE_ADJ; yy_act = YY_STATE_EOF((yy_start - 1) / 2); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } } break; case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext + YY_MORE_ADJ; goto yy_find_action; } break; } default: #ifdef FLEX_DEBUG printf( "action # %d\n", yy_act ); #endif YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } } } /* yy_get_next_buffer - try to read in a new buffer * * synopsis * int yy_get_next_buffer(); * * returns a code representing an action * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); /* try to read more data */ /* first move last chars to start of buffer */ number_to_move = yy_c_buf_p - yytext; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; else if ( num_to_read <= 0 ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); /* read in more data */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); } if ( yy_n_chars == 0 ) { if ( number_to_move - YY_MORE_ADJ == 1 ) { ret_val = EOB_ACT_END_OF_FILE; yy_current_buffer->yy_eof_status = EOF_DONE; } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_eof_status = EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; /* yytext begins at the second character in yy_ch_buf; the first * character is the one which preceded it before reading in the latest * buffer; it needs to be kept around in case it's a newline, so * yy_get_previous_state() will have with '^' rules active */ yytext = &yy_current_buffer->yy_ch_buf[1]; return ( ret_val ); } /* yy_get_previous_state - get the state just before the EOB char was reached * * synopsis * yy_state_type yy_get_previous_state(); */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register YY_CHAR *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = yy_def[yy_current_state]; if ( yy_current_state >= 452 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return ( yy_current_state ); } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) register yy_state_type yy_current_state; #endif { register int yy_is_jam; register YY_CHAR *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = yy_def[yy_current_state]; if ( yy_current_state >= 452 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 451); return ( yy_is_jam ? 0 : yy_current_state ); } #ifdef YY_USE_PROTOS static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) #else static void yyunput( c, yy_bp ) YY_CHAR c; register YY_CHAR *yy_bp; #endif { register YY_CHAR *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ register YY_CHAR *dest = &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; register YY_CHAR *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += dest - source; yy_bp += dest - source; yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) yy_cp[-2] = '\n'; *--yy_cp = c; /* note: the formal parameter *must* be called "yy_bp" for this * macro to now work correctly */ YY_DO_BEFORE_ACTION; /* set up yytext again */ } #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; YY_CHAR *yy_cp = yy_c_buf_p; *yy_cp = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* this was really a NUL */ *yy_c_buf_p = '\0'; else { /* need more input */ yytext = yy_c_buf_p; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { yy_c_buf_p = yytext + YY_MORE_ADJ; return ( EOF ); } YY_NEW_FILE; #ifdef __cplusplus return ( yyinput() ); #else return ( input() ); #endif } break; case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext + YY_MORE_ADJ; break; case EOB_ACT_LAST_MATCH: #ifdef __cplusplus YY_FATAL_ERROR( "unexpected last match in yyinput()" ); #else YY_FATAL_ERROR( "unexpected last match in input()" ); #endif } } } c = *yy_c_buf_p; yy_hold_char = *++yy_c_buf_p; return ( c ); } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* flush out information for old buffer */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* we don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); return ( b ); } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; free( (char *) b->yy_ch_buf ); free( (char *) b ); } #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { b->yy_input_file = file; /* we put in the '\n' and start reading from [1] so that an * initial match-at-newline will be true. */ b->yy_ch_buf[0] = '\n'; b->yy_n_chars = 1; /* we always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[1]; b->yy_eof_status = EOF_NOT_SEEN; } # line 460 "load.l" void load (Widget w, XEvent *e, String *vector, Cardinal *count) { FILE *f; char * filename = "xgammon.save"; int i; if (*vector[0] == 'p') kind = 'p'; /* position */ else if (*vector[0] == 'g') kind = 'g'; /* game */ else if (*vector[0] == 'r') kind = 'r'; /* replay */ else if (*vector[0] == 'm') { /* menu */ if (replaying) kind = 'r'; else kind = 'g'; filename = vector[1]; } f = fopen (filename,"r"); if (!f) { AppendDialogText (LOWER, "Couldn't open save file for reading, sorry!\n"); return; } for (i=0; i<29; i++) { Pin[i].color = 0; Pin[i].count = 0; } found_black = found_white = 0; if (!wraped) { yyin = f; wraped = 1; } else { yyin = f; YY_NEW_FILE; } count = 0; have_tournament = 0; if (kind != 'r') BEGIN LOAD; else { BEGIN REPLAY; games_replayed = 0; } Player[0].points = Player[1].points = 0; if (!gammon_resource.rollout) { AppendDialogText (LOWER, "\ngame aborted\n"); } if (kind != 'r') AppendDialogText (LOWER, "\ntournament restart\nloading position\n\n"); yylex(); fclose (f); if (!replaying) { if (found_white<15) Pin[25+WHITE].count = 15 - found_white; if (found_black<15) Pin[25+BLACK].count = 15 - found_black; if (turn == BLACK) { Player[0].beginner_of_game = 1; Player[1].beginner_of_game = 0; } else { Player[0].beginner_of_game = 0; Player[1].beginner_of_game = 1; } } else { end_of_game = 1; end_of_tournament = 1; break_loop = REPLAY_GAME; initialize = REPLAY_GAME; replaying = 0; return; } if (!gammon_resource.rollout) { DrawEmptyBoard (); DrawBoard (); RedrawAllStones (); DrawDice (turn); DrawDoubler (doubler.value, doubler.owner); sprintf (add_text, "%s rolls %d and %d.\n", Player[turn-1].name, roll[0], roll[1]); AppendDialogText (LOWER, add_text); break_loop = initialize = LOADED_POSITION; end_of_game = 1; } } void print_move (MOVE *m) { int i; for (i=0; i<4; i++) fprintf (stderr,"%d %d\t", (m+i)->from, (m+i)->to); fprintf (stderr,"\n"); } void replay_init_game (void) { int i; DrawEmptyBoard (); DrawBoard (); for (i=0; i<29; i++) { Pin[i].count=0; Pin[i].color=0; } Pin[ 1].color = BLACK; Pin[ 1].count = 2; Pin[12].color = BLACK; Pin[12].count = 5; Pin[17].color = BLACK; Pin[17].count = 3; Pin[19].color = BLACK; Pin[19].count = 5; Pin[ 6].color = WHITE; Pin[ 6].count = 5; Pin[ 8].color = WHITE; Pin[ 8].count = 3; Pin[13].color = WHITE; Pin[13].count = 5; Pin[24].color = WHITE; Pin[24].count = 2; RedrawAllStones (); Pin[(25+BLACK)].color = BLACK; Pin[(25+WHITE)].color = WHITE; doubler.value = 1; doubler.owner = 0; DrawDoubler (doubler.value, doubler.owner); } void load_config (void) { FILE *f; if (!(f = fopen ("xgammon.config", "r"))) { fprintf (stderr, "Couldn't open config file for reading, sorry!\n"); return; } if (!wraped) { yyin = f; wraped = 1; } else { yyin = f; YY_NEW_FILE; } BEGIN LOAD_CONFIG; yylex(); if (count < 8) { fprintf (stderr, "incomplete array: prime_length_factors\n"); } count = 0; fclose (f); }