48 |
double tokval; |
double tokval; |
49 |
|
|
50 |
/* T_ID: the identifier. */ |
/* T_ID: the identifier. */ |
51 |
char tokid[9]; |
char tokid[LONG_NAME_LEN + 1]; |
52 |
|
|
53 |
/* T_ID, T_STRING: token string value. |
/* T_ID, T_STRING: token string value. |
54 |
For T_ID, this is not truncated to 8 characters as is tokid. */ |
For T_ID, this is not truncated to SHORT_NAME_LEN characters as is tokid. */ |
55 |
struct string tokstr; |
struct string tokstr; |
56 |
|
|
57 |
/* Static variables. */ |
/* Static variables. */ |
116 |
assert (put_token != 0); |
assert (put_token != 0); |
117 |
token = put_token; |
token = put_token; |
118 |
ds_replace (&tokstr, ds_c_str (&put_tokstr)); |
ds_replace (&tokstr, ds_c_str (&put_tokstr)); |
119 |
strncpy (tokid, ds_c_str (&put_tokstr), 8); |
strncpy (tokid, ds_c_str (&put_tokstr), SHORT_NAME_LEN); |
120 |
tokid[8] = 0; |
tokid[SHORT_NAME_LEN] = 0; |
121 |
tokval = put_tokval; |
tokval = put_tokval; |
122 |
put_token = 0; |
put_token = 0; |
123 |
} |
} |
137 |
void |
void |
138 |
lex_get (void) |
lex_get (void) |
139 |
{ |
{ |
140 |
|
int i; |
141 |
|
|
142 |
/* If a token was pushed ahead, return it. */ |
/* If a token was pushed ahead, return it. */ |
143 |
if (put_token) |
if (put_token) |
144 |
{ |
{ |
356 |
} |
} |
357 |
|
|
358 |
/* Copy id to tokstr. */ |
/* Copy id to tokstr. */ |
359 |
ds_putc (&tokstr, toupper ((unsigned char) *prog++)); |
ds_putc (&tokstr, *prog++); |
360 |
while (CHAR_IS_IDN (*prog)) |
while (CHAR_IS_IDN (*prog)) |
361 |
ds_putc (&tokstr, toupper ((unsigned char) *prog++)); |
ds_putc (&tokstr, *prog++); |
362 |
|
|
363 |
/* Copy tokstr to tokid, truncating it to 8 characters. */ |
/* Copy tokstr to tokid, truncating it to LONG_NAME_LEN characters.*/ |
364 |
strncpy (tokid, ds_c_str (&tokstr), 8); |
strncpy (tokid, ds_c_str (&tokstr), LONG_NAME_LEN); |
365 |
tokid[8] = 0; |
tokid[LONG_NAME_LEN] = 0; |
366 |
|
|
367 |
|
/* Convert to upper case */ |
368 |
|
for ( i = 0 ; i < ds_length(&tokstr) ; ++i ) |
369 |
|
tokstr.string[i] = toupper(tokstr.string[i]); |
370 |
|
|
371 |
token = lex_id_to_token (ds_c_str (&tokstr), ds_length (&tokstr)); |
token = lex_id_to_token (ds_c_str (&tokstr), ds_length (&tokstr)); |
372 |
break; |
break; |
720 |
save_token (); |
save_token (); |
721 |
token = T_ID; |
token = T_ID; |
722 |
ds_replace (&tokstr, id); |
ds_replace (&tokstr, id); |
723 |
strncpy (tokid, ds_c_str (&tokstr), 8); |
strncpy (tokid, ds_c_str (&tokstr), SHORT_NAME_LEN); |
724 |
tokid[8] = 0; |
tokid[SHORT_NAME_LEN] = 0; |
725 |
} |
} |
726 |
|
|
727 |
/* Weird line processing functions. */ |
/* Weird line processing functions. */ |