version 1.4, 2002/06/18 03:22:15 |
version 1.5, 2002/07/12 00:26:24 |
|
|
initdic(); |
initdic(); |
outbufsiz = BUFCLICK; |
outbufsiz = BUFCLICK; |
outbuf = malloc(outbufsiz); |
outbuf = malloc(outbufsiz); |
|
if (outbuf == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fheader = (struct fcode_header *)outbuf; |
fheader = (struct fcode_header *)outbuf; |
outpos = 0; |
outpos = 0; |
emit(hdrtype); |
emit(hdrtype); |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
if (!fadd(dictionary, fcode)) |
if (!fadd(dictionary, fcode)) |
token_err(yylineno, infile, NULL, |
token_err(yylineno, infile, NULL, |
"Duplicate definition: `%s'\n", fcode->name); |
"Duplicate definition: `%s'\n", fcode->name); |
|
|
token->type); |
token->type); |
} |
} |
alias = malloc(sizeof(*alias)); |
alias = malloc(sizeof(*alias)); |
|
if (alias == NULL) |
|
(void)err(1, "out of memory"); |
|
|
alias->name = strdup(token->text); |
alias->name = strdup(token->text); |
|
if (alias->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
token = yylex(); |
token = yylex(); |
if (token == NULL) { |
if (token == NULL) { |
(void)printf( "EOF in alias definition\n"); |
(void)printf( "EOF in alias definition\n"); |
return; |
return; |
} |
} |
alias->equiv = strdup(token->text); |
alias->equiv = strdup(token->text); |
|
if (alias->equiv == NULL) |
|
(void)err(1, "out of memory"); |
|
|
if (!aadd(aliases, alias)) { |
if (!aadd(aliases, alias)) { |
(void)printf( "ERROR: Duplicate alias %s\n", |
(void)printf( "ERROR: Duplicate alias %s\n", |
alias->name); |
alias->name); |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |
|
|
|
|
/* Add new code to dictionary */ |
/* Add new code to dictionary */ |
fcode = malloc(sizeof(*fcode)); |
fcode = malloc(sizeof(*fcode)); |
|
if (fcode == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fcode->num = nextfcode++; |
fcode->num = nextfcode++; |
fcode->name = strdup(token->text); |
fcode->name = strdup(token->text); |
|
if (fcode->name == NULL) |
|
(void)err(1, "out of memory"); |
|
|
fadd(dictionary, fcode); |
fadd(dictionary, fcode); |
|
|
if (state == 0) |
if (state == 0) |