version 1.9 | | version 1.10 |
---|
| | |
/* A lexical scanner generated by flex */ | | /* A lexical scanner generated by flex */ |
| | |
/* Scanner skeleton version: | | /* Scanner skeleton version: |
* $Header: /cvsroot/crossfire/crossfire/common/loader.c,v 1.9 2001/02/11 09:12:12 cvs Exp $ | | * $Header: /cvsroot/crossfire/crossfire/common/loader.c,v 1.10 2001/02/23 06:06:35 mwedel Exp $ |
*/ | | */ |
| | |
#define FLEX_SCANNER | | #define FLEX_SCANNER |
| | |
#line 2 "loader.l" | | #line 2 "loader.l" |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: loader.c,v 1.9 2001/02/11 09:12:12 cvs Exp $"; | | * "$Id: loader.c,v 1.10 2001/02/23 06:06:35 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static char *yval(); | | static char *yval(); |
| | |
static int lex_error; | | static int lex_error; |
| | static char msgbuf[HUGE_BUF]; |
| | |
#define FREE_AND_COPY(sv,nv) { if (sv) free_string(sv); sv=add_string(nv); } | | #define FREE_AND_COPY(sv,nv) { if (sv) free_string(sv); sv=add_string(nv); } |
#define SET_OR_CLEAR_FLAG(op, flag, val) \ | | #define SET_OR_CLEAR_FLAG(op, flag, val) \ |
| | |
register char *yy_cp = NULL, *yy_bp = NULL; | | register char *yy_cp = NULL, *yy_bp = NULL; |
register int yy_act; | | register int yy_act; |
| | |
#line 146 "loader.l" | | #line 147 "loader.l" |
| | |
| | |
| | |
/* Declare some local variables */ | | /* Declare some local variables */ |
char msgbuf[HUGE_BUF]; | | |
int ismore=0; | | int ismore=0; |
| | |
lex_error=0; | | lex_error=0; |
strcpy(msgbuf, ""); | | |
| | |
| | |
| | |
| | |
yy_c_buf_p = yy_cp -= 1; | | yy_c_buf_p = yy_cp -= 1; |
YY_DO_BEFORE_ACTION; /* set up yytext again */ | | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 158 "loader.l" | | #line 157 "loader.l" |
{ BEGIN( MESSAGE ); msgbuf[0]='\0'; } | | { BEGIN( MESSAGE ); msgbuf[0]='\0'; } |
YY_BREAK | | YY_BREAK |
case 2: | | case 2: |
| | |
yy_c_buf_p = yy_cp -= 1; | | yy_c_buf_p = yy_cp -= 1; |
YY_DO_BEFORE_ACTION; /* set up yytext again */ | | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 159 "loader.l" | | #line 158 "loader.l" |
{ BEGIN( INITIAL ); | | { BEGIN( INITIAL ); |
op->msg=add_string(msgbuf); | | op->msg=add_string(msgbuf); |
/* Just print a warning so we can be reasonably safe | | /* Just print a warning so we can be reasonably safe |
| | |
YY_BREAK | | YY_BREAK |
case 3: | | case 3: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 168 "loader.l" | | #line 167 "loader.l" |
{strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } | | {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
YY_BREAK | | YY_BREAK |
case 4: | | case 4: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 171 "loader.l" | | #line 170 "loader.l" |
{ char *yv=yval(); | | { char *yv=yval(); |
| | |
if (*yv=='\0') { | | if (*yv=='\0') { |
| | |
YY_BREAK | | YY_BREAK |
case 5: | | case 5: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 181 "loader.l" | | #line 180 "loader.l" |
{ char *yv=yval(); | | { char *yv=yval(); |
| | |
if (*yv=='\0') LOG(llevError,"Name without val\n"); | | if (*yv=='\0') LOG(llevError,"Name without val\n"); |
| | |
YY_BREAK | | YY_BREAK |
case 6: | | case 6: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 186 "loader.l" | | #line 185 "loader.l" |
FREE_AND_COPY(op->race,yval()); | | FREE_AND_COPY(op->race,yval()); |
YY_BREAK | | YY_BREAK |
case 7: | | case 7: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 187 "loader.l" | | #line 186 "loader.l" |
FREE_AND_COPY(op->slaying, yval()); | | FREE_AND_COPY(op->slaying, yval()); |
YY_BREAK | | YY_BREAK |
case 8: | | case 8: |
| | |
yy_c_buf_p = yy_cp -= 1; | | yy_c_buf_p = yy_cp -= 1; |
YY_DO_BEFORE_ACTION; /* set up yytext again */ | | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 188 "loader.l" | | #line 187 "loader.l" |
LOG(llevError,"Got depreciated Inventory command?\n"); | | LOG(llevError,"Got depreciated Inventory command?\n"); |
YY_BREAK | | YY_BREAK |
case 9: | | case 9: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 191 "loader.l" | | #line 190 "loader.l" |
{ /* If op->arch has been set, then this new object | | { /* If op->arch has been set, then this new object |
* must be part of the inventory. So process | | * must be part of the inventory. So process |
* appropriately. | | * appropriately. |
| | |
tmp->arch = find_archetype(yval()); | | tmp->arch = find_archetype(yval()); |
if (tmp->arch!=NULL) | | if (tmp->arch!=NULL) |
copy_object(&tmp->arch->clone,tmp); | | copy_object(&tmp->arch->clone,tmp); |
| | strcpy(msgbuf, ""); |
lex_load(tmp, map_flags); | | lex_load(tmp, map_flags); |
insert_ob_in_ob(tmp,op); | | insert_ob_in_ob(tmp,op); |
} | | } |
| | |
int retval; | | int retval; |
char inbuf[MAX_BUF]; | | char inbuf[MAX_BUF]; |
| | |
| | strcpy(msgbuf, ""); |
if (bufstate==LO_NEWFILE || bufstate==LO_NOREAD) { | | if (bufstate==LO_NEWFILE || bufstate==LO_NOREAD) { |
/* LOG(llevDebug,"Switching lex buffers\n");*/ | | /* LOG(llevDebug,"Switching lex buffers\n");*/ |
yy_delete_buffer(YY_CURRENT_BUFFER); | | yy_delete_buffer(YY_CURRENT_BUFFER); |
| | |
YY_BUFFER_STATE yybufstate,yycurbuf=YY_CURRENT_BUFFER; | | YY_BUFFER_STATE yybufstate,yycurbuf=YY_CURRENT_BUFFER; |
int retval; | | int retval; |
| | |
| | strcpy(msgbuf, ""); |
yy_push_state(INITIAL); | | yy_push_state(INITIAL); |
yybufstate=yy_scan_string(buf); | | yybufstate=yy_scan_string(buf); |
retval=lex_load(op,0); | | retval=lex_load(op,0); |