src/chess/pgn.c

changeset 82
e75865d90111
parent 81
82d3b044aa69
equal deleted inserted replaced
81:82d3b044aa69 82:e75865d90111
61 61
62 char tagkey[32]; 62 char tagkey[32];
63 char tagvalue[128]; 63 char tagvalue[128];
64 64
65 /* read tag pairs */ 65 /* read tag pairs */
66 bool readmoves = false; 66 while (true) {
67 while (!readmoves) {
68 while (isspace(c = fgetc(stream))); 67 while (isspace(c = fgetc(stream)));
69 if (c == '1') { 68 if (c == '1') {
70 readmoves = true;
71 break; 69 break;
72 } 70 }
73 if (c != '[') { 71 if (c != '[') {
74 return pgn_error_missing_bracket; 72 return pgn_error_missing_bracket;
75 } 73 }
107 105
108 char movestr[10]; 106 char movestr[10];
109 Move move; 107 Move move;
110 uint8_t curcol = WHITE; 108 uint8_t curcol = WHITE;
111 109
112 while (readmoves) { 110 while (true) {
113 /* move */ 111 /* move */
114 while (isspace(c = fgetc(stream))); 112 while (isspace(c = fgetc(stream)));
115 i = 0; 113 i = 0;
116 do { 114 do {
117 movestr[i++] = c; 115 movestr[i++] = c;

mercurial