[363] | 1 | /*
|
---|
| 2 | * TOPPERS/JSP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Just Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | * Copyright (C) 2003-2004 by Ryosuke Takeuchi
|
---|
| 9 | * Platform Development Center RIOCH COMPANY,LTD. JAPAN
|
---|
| 10 | * Copyright (C) 2006-2010 by Witz Corporation, JAPAN
|
---|
| 11 | *
|
---|
| 12 | * The above copyright holders grant permission gratis to use,
|
---|
| 13 | * duplicate, modify, or redistribute (hereafter called use) this
|
---|
| 14 | * software (including the one made by modifying this software),
|
---|
| 15 | * provided that the following four conditions (1) through (4) are
|
---|
| 16 | * satisfied.
|
---|
| 17 | *
|
---|
| 18 | * (1) When this software is used in the form of source code, the above
|
---|
| 19 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
| 20 | * below must be retained in the source code without modification.
|
---|
| 21 | *
|
---|
| 22 | * (2) When this software is redistributed in the forms usable for the
|
---|
| 23 | * development of other software, such as in library form, the above
|
---|
| 24 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
| 25 | * below must be shown without modification in the document provided
|
---|
| 26 | * with the redistributed software, such as the user manual.
|
---|
| 27 | *
|
---|
| 28 | * (3) When this software is redistributed in the forms unusable for the
|
---|
| 29 | * development of other software, such as the case when the software
|
---|
| 30 | * is embedded in a piece of equipment, either of the following two
|
---|
| 31 | * conditions must be satisfied:
|
---|
| 32 | *
|
---|
| 33 | * (a) The above copyright notice, this use conditions, and the
|
---|
| 34 | * disclaimer shown below must be shown without modification in
|
---|
| 35 | * the document provided with the redistributed software, such as
|
---|
| 36 | * the user manual.
|
---|
| 37 | *
|
---|
| 38 | * (b) How the software is to be redistributed must be reported to the
|
---|
| 39 | * TOPPERS Project according to the procedure described
|
---|
| 40 | * separately.
|
---|
| 41 | *
|
---|
| 42 | * (4) The above copyright holders and the TOPPERS Project are exempt
|
---|
| 43 | * from responsibility for any type of damage directly or indirectly
|
---|
| 44 | * caused from the use of this software and are indemnified by any
|
---|
| 45 | * users or end users of this software from any and all causes of
|
---|
| 46 | * action whatsoever.
|
---|
| 47 | *
|
---|
| 48 | * THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
|
---|
| 49 | * THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
|
---|
| 50 | * INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
|
---|
| 51 | * PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
|
---|
| 52 | * TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
|
---|
| 53 | * INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
|
---|
| 54 | *
|
---|
| 55 | * ä¸è¨èä½æ¨©è
|
---|
| 56 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 57 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»
|
---|
| 58 | * åé
|
---|
| 59 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 60 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½æ¨©
|
---|
| 61 | * 表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼ã¹
|
---|
| 62 | * ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 63 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
| 64 | * ã§ããå½¢ã§åé
|
---|
| 65 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 66 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 67 | ã
|
---|
| 68 | * ãã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿
|
---|
| 69 | * 証è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 70 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
| 71 | * ã§ããªãå½¢ã§åé
|
---|
| 72 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
| 73 | * (a) åé
|
---|
| 74 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 75 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½
|
---|
| 76 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 77 | * (b) åé
|
---|
| 78 | å¸ã®å½¢æ
|
---|
| 79 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«å ±
|
---|
| 80 | * åãããã¨ï¼
|
---|
| 81 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害
|
---|
| 82 | * ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 83 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 84 | 責ãããã¨ï¼ã¾ãï¼
|
---|
| 85 | * æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãçç±ã«åºã¥
|
---|
| 86 | * ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 87 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 88 | 責ãããã¨ï¼
|
---|
| 89 | *
|
---|
| 90 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 91 | ãã
|
---|
| 92 | * ã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®çã«å¯¾ã
|
---|
| 93 | * ãé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨
|
---|
| 94 | * ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè²
|
---|
| 95 | * ããªãï¼
|
---|
| 96 | *
|
---|
| 97 | * @(#) $Id: tlcs900offset.cpp,v 1.4 2007/04/17 05:08:07 honda Exp $
|
---|
| 98 | */
|
---|
| 99 | // tlcs900offset.cpp : ã³ã³ã½ã¼ã« ã¢ããªã±ã¼ã·ã§ã³ç¨ã®ã¨ã³ã㪠ãã¤ã³ãã®å®ç¾©
|
---|
| 100 | //
|
---|
| 101 |
|
---|
| 102 | #include <stdio.h>
|
---|
| 103 | #include <stdlib.h>
|
---|
| 104 | #include <string.h>
|
---|
| 105 |
|
---|
| 106 | #define BUF_SIZE 512
|
---|
| 107 | #define STR_SIZE 128
|
---|
| 108 | #define BIT_SIZE 6
|
---|
| 109 |
|
---|
| 110 | #define NORMAL_STATE 0
|
---|
| 111 | #define TEXPTN_STATE 1
|
---|
| 112 | #define SP_STATE 2
|
---|
| 113 | #define PC_STATE 3
|
---|
| 114 | #define ENATEX_STATE 4
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | static char const default_input_file[] = "makeoffset.asm";
|
---|
| 118 | static char const default_output_file[] = "offset.inc";
|
---|
| 119 | static char const lf[] = "\n";
|
---|
| 120 |
|
---|
| 121 | static char input_file[STR_SIZE];
|
---|
| 122 | static char output_file[STR_SIZE];
|
---|
| 123 |
|
---|
| 124 | /*
|
---|
| 125 | å
|
---|
| 126 | ¥åãã¡ã¤ã«ãBEGIN, ENDã®åºéã§ããå ´åã¯
|
---|
| 127 | offset_state = NORMAL_STATE;
|
---|
| 128 | */
|
---|
| 129 | static int offset_state = NORMAL_STATE;
|
---|
| 130 |
|
---|
| 131 | static bool test_string(char** s, char const * t);
|
---|
| 132 | static bool skip_space(char** s);
|
---|
| 133 | static bool skip_char(char** s, char const c);
|
---|
| 134 |
|
---|
| 135 | unsigned int atoh(char* s);
|
---|
| 136 | void get_num(char* s);
|
---|
| 137 | void get_num_undo(char* s);
|
---|
| 138 |
|
---|
| 139 | int main(int argc, char* argv[]){
|
---|
| 140 | FILE* pfo;
|
---|
| 141 | FILE* pfi;
|
---|
| 142 | int nCnt, address;
|
---|
| 143 | int shift_bit = 1;
|
---|
| 144 | int shift_cnt = 0;
|
---|
| 145 |
|
---|
| 146 | char* s;
|
---|
| 147 | char str[100];
|
---|
| 148 |
|
---|
| 149 | char buf[BUF_SIZE];
|
---|
| 150 | char c;
|
---|
| 151 |
|
---|
| 152 | strcpy(input_file, default_input_file);
|
---|
| 153 | strcpy(output_file, default_output_file);
|
---|
| 154 |
|
---|
| 155 | //ã³ãã³ãã©ã¤ã³å
|
---|
| 156 | ¥åã解æ
|
---|
| 157 | for(nCnt = 1 ; nCnt < argc ; nCnt++){
|
---|
| 158 | s = argv[nCnt];
|
---|
| 159 | if(*s++ == '-'){
|
---|
| 160 | c = *s;
|
---|
| 161 | while(*s != 0){
|
---|
| 162 | if(*s == ':')
|
---|
| 163 | break;
|
---|
| 164 | s++;
|
---|
| 165 | }
|
---|
| 166 | if(*s++ == ':'){
|
---|
| 167 | switch(c){
|
---|
| 168 | //output file name
|
---|
| 169 | case 'O':
|
---|
| 170 | case 'o':
|
---|
| 171 | strcpy(output_file, s);
|
---|
| 172 | break;
|
---|
| 173 | //input file name
|
---|
| 174 | case 'R':
|
---|
| 175 | case 'r':
|
---|
| 176 | strcpy(input_file, s);
|
---|
| 177 | break;
|
---|
| 178 | default:
|
---|
| 179 | printf("tlcs900offset -R:input_file -O:output_file\n");
|
---|
| 180 | break;
|
---|
| 181 | }
|
---|
| 182 | }
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
| 185 | //input, outputãã¡ã¤ã«åã®æ¨æºåºå
|
---|
| 186 | printf("input file = %s\n", input_file);
|
---|
| 187 | printf("output file = %s\n", output_file);
|
---|
| 188 |
|
---|
| 189 | if((pfi = fopen(input_file, "r")) == NULL){
|
---|
| 190 | fprintf(stderr, "can't open input file!");
|
---|
| 191 | exit(1);
|
---|
| 192 | }
|
---|
| 193 | if((pfo = fopen(output_file, "w")) == NULL){
|
---|
| 194 | fclose(pfi);
|
---|
| 195 | fprintf(stderr, "can't open output file!");
|
---|
| 196 | exit(1);
|
---|
| 197 | }
|
---|
| 198 |
|
---|
| 199 | //inputãã¡ã¤ã«ã®åãè¾¼ã¿
|
---|
| 200 | for(;;){
|
---|
| 201 | if((fgets(buf, BUF_SIZE, pfi)) == NULL)
|
---|
| 202 | break;
|
---|
| 203 | s = buf;
|
---|
| 204 | switch(offset_state){
|
---|
| 205 | //; BEGIN TCB_texptnã®ç¯å²ã®è§£æ
|
---|
| 206 | case TEXPTN_STATE:
|
---|
| 207 | if(test_string(&s, "; END")){
|
---|
| 208 | offset_state = NORMAL_STATE;
|
---|
| 209 | continue;
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | if(test_string(&s, "line") || test_string(&s, "call"))
|
---|
| 213 | continue;
|
---|
| 214 |
|
---|
| 215 | if(skip_char(&s, 'x')){
|
---|
| 216 | continue;
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | get_num(s);
|
---|
| 220 | address = atoh(s);
|
---|
| 221 | printf("TCB_texptn\tequ\t%d\n",address);
|
---|
| 222 | fputs("TCB_texptn\t\tequ\t", pfo);
|
---|
| 223 | sprintf(str,"%d",address);
|
---|
| 224 | fputs(str, pfo);
|
---|
| 225 | fputs(lf, pfo);
|
---|
| 226 | break;
|
---|
| 227 |
|
---|
| 228 | case SP_STATE:
|
---|
| 229 | //; BEGIN TCB_spã®ç¯å²ã®è§£æ
|
---|
| 230 | if(test_string(&s, "; END")){
|
---|
| 231 | offset_state = NORMAL_STATE;
|
---|
| 232 | continue;
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | if(test_string(&s, "line") || test_string(&s, "call") )
|
---|
| 236 | continue;
|
---|
| 237 |
|
---|
| 238 | if(skip_space(&s))
|
---|
| 239 | continue;
|
---|
| 240 |
|
---|
| 241 | if(skip_char(&s, '(')){
|
---|
| 242 | continue;
|
---|
| 243 | }
|
---|
| 244 |
|
---|
| 245 | if(skip_char(&s, 'x')){
|
---|
| 246 | continue;
|
---|
| 247 | }
|
---|
| 248 |
|
---|
| 249 | get_num(s);
|
---|
| 250 | address = atoh(s);
|
---|
| 251 | printf("TCB_sp\t\tequ\t%d\n",address);
|
---|
| 252 | fputs("TCB_sp\t\t\tequ\t", pfo);
|
---|
| 253 | sprintf(str,"%d",address);
|
---|
| 254 | fputs(str, pfo);
|
---|
| 255 | fputs(lf, pfo);
|
---|
| 256 |
|
---|
| 257 | break;
|
---|
| 258 |
|
---|
| 259 | case PC_STATE:
|
---|
| 260 | //; BEGIN TCB_pcã®ç¯å²ã®è§£æ
|
---|
| 261 | if(test_string(&s, "; END")){
|
---|
| 262 | offset_state = NORMAL_STATE;
|
---|
| 263 | continue;
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | if(test_string(&s, "line") || test_string(&s, "call"))
|
---|
| 267 | continue;
|
---|
| 268 |
|
---|
| 269 | if(skip_char(&s, 'x')){
|
---|
| 270 | continue;
|
---|
| 271 | }
|
---|
| 272 | get_num(s);
|
---|
| 273 | address = atoh(s);
|
---|
| 274 | printf("TCB_pc\tequ\t%d\n",address);
|
---|
| 275 | fputs("TCB_pc\t\t\tequ\t", pfo);
|
---|
| 276 | sprintf(str,"%d",address);
|
---|
| 277 | fputs(str, pfo);
|
---|
| 278 | fputs(lf, pfo);
|
---|
| 279 | break;
|
---|
| 280 |
|
---|
| 281 | case ENATEX_STATE:
|
---|
| 282 | //; BEGIN TCB_pcã®ç¯å²ã®è§£æ
|
---|
| 283 | if(test_string(&s, "; END")){
|
---|
| 284 | offset_state = NORMAL_STATE;
|
---|
| 285 | continue;
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | if(test_string(&s, "line") || test_string(&s, "call"))
|
---|
| 289 | continue;
|
---|
| 290 |
|
---|
| 291 | if(skip_char(&s, 'x')){
|
---|
| 292 | continue;
|
---|
| 293 | }
|
---|
| 294 | get_num(s);
|
---|
| 295 | address = atoh(s);
|
---|
| 296 | printf("TCB_enatex\tequ\t%d\n",address);
|
---|
| 297 | fputs("TCB_enatex\t\tequ\t", pfo);
|
---|
| 298 | sprintf(str,"%d",address);
|
---|
| 299 | fputs(str, pfo);
|
---|
| 300 | fputs(lf, pfo);
|
---|
| 301 | get_num_undo(s);
|
---|
| 302 | if(skip_char(&s, ',')){
|
---|
| 303 | continue;
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | *(s + BIT_SIZE) = '\0';
|
---|
| 307 | printf("TCB_enatex_mask\tequ\t%s\n",s);
|
---|
| 308 | fputs("TCB_enatex_mask\tequ\t", pfo);
|
---|
| 309 | fputs(s, pfo);
|
---|
| 310 | fputs(lf, pfo);
|
---|
| 311 |
|
---|
| 312 | if(skip_char(&s, 'x')){
|
---|
| 313 | continue;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | address = atoh(s);
|
---|
| 317 |
|
---|
| 318 | for(shift_cnt=0;shift_cnt<=16;shift_cnt++){
|
---|
| 319 | if(address == shift_bit){
|
---|
| 320 | printf("TCB_enatex_bit\tequ\t%d\n",shift_cnt);
|
---|
| 321 | fputs("TCB_enatex_bit\tequ\t", pfo);
|
---|
| 322 | sprintf(str,"%d",shift_cnt);
|
---|
| 323 | fputs(str, pfo);
|
---|
| 324 | fputs(lf, pfo);
|
---|
| 325 | }
|
---|
| 326 | shift_bit<<=1;
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | break;
|
---|
| 330 |
|
---|
| 331 | default:
|
---|
| 332 | if(test_string(&s, "; BEGIN TCB_texptn")){
|
---|
| 333 | offset_state = TEXPTN_STATE;
|
---|
| 334 | continue;
|
---|
| 335 | }else if(test_string(&s, "; BEGIN TCB_sp")){
|
---|
| 336 | offset_state = SP_STATE;
|
---|
| 337 | continue;
|
---|
| 338 | }else if(test_string(&s, "; BEGIN TCB_pc")){
|
---|
| 339 | offset_state = PC_STATE;
|
---|
| 340 | continue;
|
---|
| 341 | }else if(test_string(&s, "; BEGIN TCB_enatex")){
|
---|
| 342 | offset_state = ENATEX_STATE;
|
---|
| 343 | continue;
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | break;
|
---|
| 347 | }
|
---|
| 348 | }
|
---|
| 349 | return 0;
|
---|
| 350 | }
|
---|
| 351 |
|
---|
| 352 | /*
|
---|
| 353 | * 16é²æååãintåã«å¤æ
|
---|
| 354 | */
|
---|
| 355 | unsigned int atoh(char* s)
|
---|
| 356 | {
|
---|
| 357 | int nCnt = 0;
|
---|
| 358 | for(;;){
|
---|
| 359 | if(*s >= '0' && *s <= '9')
|
---|
| 360 | nCnt = (nCnt * 16) + (*s - '0');
|
---|
| 361 | else if(*s >= 'A' && *s <= 'F')
|
---|
| 362 | nCnt = (nCnt * 16) + (*s - 'A' + 10);
|
---|
| 363 | else if(*s >= 'a' && *s <= 'f')
|
---|
| 364 | nCnt = (nCnt * 16) + (*s - 'a' + 10);
|
---|
| 365 | else
|
---|
| 366 | break;
|
---|
| 367 | s++;
|
---|
| 368 | }
|
---|
| 369 | return nCnt;
|
---|
| 370 | }
|
---|
| 371 | /*
|
---|
| 372 | * ã¢ãã¬ã¹é¨åãæ½åº
|
---|
| 373 | */
|
---|
| 374 | void get_num(char* s)
|
---|
| 375 | {
|
---|
| 376 | int nCnt;
|
---|
| 377 |
|
---|
| 378 | for(nCnt = 0 ; nCnt < 4 ; nCnt++){
|
---|
| 379 | if(*(s+nCnt) == ')'){
|
---|
| 380 | *(s+nCnt) = '\0';
|
---|
| 381 | }
|
---|
| 382 | }
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | /*
|
---|
| 386 | * get_numã§æ¸ãæããé¨åãå
|
---|
| 387 | ã«æ»ã
|
---|
| 388 | */
|
---|
| 389 | void get_num_undo(char* s)
|
---|
| 390 | {
|
---|
| 391 | int nCnt;
|
---|
| 392 |
|
---|
| 393 | for(nCnt = 0 ; nCnt < 4 ; nCnt++){
|
---|
| 394 | if(*(s+nCnt) == '\0'){
|
---|
| 395 | *(s+nCnt) = ')';
|
---|
| 396 | }
|
---|
| 397 | }
|
---|
| 398 | }
|
---|
| 399 |
|
---|
| 400 |
|
---|
| 401 | /*
|
---|
| 402 | * æååãæ¯è¼ãã¦åä¸ãªãã°TURE
|
---|
| 403 | */
|
---|
| 404 | static bool test_string(char** s, char const *t)
|
---|
| 405 | {
|
---|
| 406 | char* p;
|
---|
| 407 | char c;
|
---|
| 408 |
|
---|
| 409 | p = *s;
|
---|
| 410 | while(*p <= ' '){
|
---|
| 411 | if(*p == 0)
|
---|
| 412 | return false;
|
---|
| 413 | p++;
|
---|
| 414 | }
|
---|
| 415 | while((c = *p++) != 0){
|
---|
| 416 | if(c != *t++)
|
---|
| 417 | break;
|
---|
| 418 | if(*t == 0){
|
---|
| 419 | *s = p;
|
---|
| 420 | return true;
|
---|
| 421 | }
|
---|
| 422 | }
|
---|
| 423 | return false;
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | /*
|
---|
| 427 | * æå®ã®ãã£ã©ã¯ã¿ã¾ã§ã¹ããã
|
---|
| 428 | */
|
---|
| 429 | static bool skip_char(char** s, char const c)
|
---|
| 430 | {
|
---|
| 431 | char* p;
|
---|
| 432 |
|
---|
| 433 | p = *s;
|
---|
| 434 | while(*p != c){
|
---|
| 435 | if(*p == 0)
|
---|
| 436 | break;
|
---|
| 437 | p++;
|
---|
| 438 | }
|
---|
| 439 | if(*p){
|
---|
| 440 | p++;
|
---|
| 441 | *s = p;
|
---|
| 442 | return false;
|
---|
| 443 | }
|
---|
| 444 | else{
|
---|
| 445 | *s = p;
|
---|
| 446 | return true;
|
---|
| 447 | }
|
---|
| 448 | }
|
---|
| 449 |
|
---|
| 450 | /*
|
---|
| 451 | * ã¹ãã¼ã¹ã¾ãã¯ã¿ããã¹ããããã
|
---|
| 452 | */
|
---|
| 453 | static bool skip_space(char** s)
|
---|
| 454 | {
|
---|
| 455 | char* p;
|
---|
| 456 |
|
---|
| 457 | p = *s;
|
---|
| 458 | while(*p <= ' '){
|
---|
| 459 | if(*p == 0)
|
---|
| 460 | break;
|
---|
| 461 | p++;
|
---|
| 462 | }
|
---|
| 463 | *s = p;
|
---|
| 464 | if(*p)
|
---|
| 465 | return false;
|
---|
| 466 | else
|
---|
| 467 | return true;
|
---|
| 468 | }
|
---|