version 1.37 | | version 1.38 |
---|
| | |
%{ | | %{ |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: loader.l,v 1.37 2003/02/07 06:57:17 garbled Exp $"; | | * "$Id: loader.l,v 1.38 2003/02/12 06:30:25 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
static int lex_error; | | static int lex_error; |
static char msgbuf[HUGE_BUF]; | | static char msgbuf[HUGE_BUF]; |
| | static char lorebuf[HUGE_BUF]; |
| | |
#define SET_OR_CLEAR_FLAG(op, flag, val) \ | | #define SET_OR_CLEAR_FLAG(op, flag, val) \ |
{ if (val) SET_FLAG(op, flag); else CLEAR_FLAG(op, flag); } | | { if (val) SET_FLAG(op, flag); else CLEAR_FLAG(op, flag); } |
| | |
A .+ | | A .+ |
| | |
%x MESSAGE | | %x MESSAGE |
| | %x LORE |
%x SCRIPT | | %x SCRIPT |
| | |
/* Don't have to link with -lfl with this */ | | /* Don't have to link with -lfl with this */ |
| | |
HUGE_BUF/2, HUGE_BUF, strlen(op->msg),op->msg); | | HUGE_BUF/2, HUGE_BUF, strlen(op->msg),op->msg); |
} | | } |
<MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } | | <MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
| | |
| | ^lore{WS}$ { BEGIN( LORE ); lorebuf[0]='\0'; } |
| | <LORE>^endlore{WS}$ { BEGIN( INITIAL ); |
| | op->lore=add_string(lorebuf); |
| | /* Just print a warning so we can be reasonably safe |
| | * about not overflowing the buffer. |
| | */ |
| | if (strlen(op->lore) > (HUGE_BUF/2)) |
| | LOG(llevDebug, "\n\tWarning lore length > %d (max allowed=%d): %d\n>%.80s<\n", |
| | HUGE_BUF/2, HUGE_BUF, strlen(op->lore),op->lore); |
| | } |
| | <LORE>.* {strcat(lorebuf, yytext); strcat(lorebuf,"\n"); } |
| | |
^object{S} { char *yv=yval(); | | ^object{S} { char *yv=yval(); |
| | |
if (*yv=='\0') { | | if (*yv=='\0') { |
| | |
if (tmp->arch!=NULL) | | if (tmp->arch!=NULL) |
copy_object(&tmp->arch->clone,tmp); | | copy_object(&tmp->arch->clone,tmp); |
strcpy(msgbuf, ""); | | strcpy(msgbuf, ""); |
| | strcpy(lorebuf, ""); |
lex_load(tmp, map_flags); | | lex_load(tmp, map_flags); |
insert_ob_in_ob(tmp,op); | | insert_ob_in_ob(tmp,op); |
} | | } |
| | |
char inbuf[MAX_BUF]; | | char inbuf[MAX_BUF]; |
| | |
strcpy(msgbuf, ""); | | strcpy(msgbuf, ""); |
| | strcpy(lorebuf, ""); |
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); |
| | |
int retval; | | int retval; |
| | |
strcpy(msgbuf, ""); | | strcpy(msgbuf, ""); |
| | strcpy(lorebuf, ""); |
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); |
| | |
strcat(buf,op->msg); | | strcat(buf,op->msg); |
strcat(buf,"endmsg\n"); | | strcat(buf,"endmsg\n"); |
} | | } |
| | if(op->lore && op->lore!=op2->lore) { |
| | strcat(buf,"lore\n"); |
| | strcat(buf,op->lore); |
| | strcat(buf,"endlore\n"); |
| | } |
if(op->other_arch!=op2->other_arch&&op->other_arch!=NULL && | | if(op->other_arch!=op2->other_arch&&op->other_arch!=NULL && |
op->other_arch->name) { | | op->other_arch->name) { |
sprintf(buf2,"other_arch %s\n",op->other_arch->name); | | sprintf(buf2,"other_arch %s\n",op->other_arch->name); |