1 | %{ |
1 | %{ |
2 | /* |
2 | /* |
3 | * static char *rcsid_object_c = |
3 | * static char *rcsid_object_c = |
4 | * "$Id: loader.l,v 1.4 2006/05/11 20:15:30 root Exp $"; |
4 | * "$Id: loader.l,v 1.6 2006/07/01 21:06:06 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
643 | |
643 | |
644 | %} |
644 | %} |
645 | |
645 | |
646 | ^msg{WS}$ { BEGIN( MESSAGE ); msgbuf[0]='\0'; } |
646 | ^msg{WS}$ { BEGIN( MESSAGE ); msgbuf[0]='\0'; } |
647 | <MESSAGE>^endmsg{WS}$ { BEGIN( INITIAL ); |
647 | <MESSAGE>^endmsg{WS}$ { BEGIN( INITIAL ); |
648 | op->msg=add_string(msgbuf); |
|
|
649 | /* Just print a warning so we can be reasonably safe |
648 | /* Just print a warning so we can be reasonably safe |
650 | * about not overflowing the buffer. |
649 | * about not overflowing the buffer. |
651 | */ |
650 | */ |
652 | if (strlen(op->msg) > (HUGE_BUF/2)) |
651 | if (strlen(msgbuf) >= HUGE_BUF) |
|
|
652 | { |
653 | LOG(llevDebug, "\n\tWarning message length > %d (max allowed=%d): %d\n>%.80s<\n", |
653 | LOG(llevDebug, "\n\tError message length >= %d: %d\n>%.80s<\n", |
654 | HUGE_BUF/2, HUGE_BUF, strlen(op->msg),op->msg); |
654 | HUGE_BUF, strlen(op->msg),op->msg); |
|
|
655 | op->msg = add_string ("ERROR, please report: string too long, winged.\n"); |
|
|
656 | } |
|
|
657 | else |
|
|
658 | op->msg = add_string (msgbuf); |
655 | } |
659 | } |
656 | <MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
660 | <MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
657 | |
661 | |
658 | ^lore{WS}$ { BEGIN( LORE ); lorebuf[0]='\0'; } |
662 | ^lore{WS}$ { BEGIN( LORE ); lorebuf[0]='\0'; } |
659 | <LORE>^endlore{WS}$ { BEGIN( INITIAL ); |
663 | <LORE>^endlore{WS}$ { BEGIN( INITIAL ); |
… | |
… | |
1643 | * NEVER touch buf between PREPARE_FASTCAT(buf) and |
1647 | * NEVER touch buf between PREPARE_FASTCAT(buf) and |
1644 | * FINISH_FASTCAT(buf) |
1648 | * FINISH_FASTCAT(buf) |
1645 | */ |
1649 | */ |
1646 | static int already_run = 0; |
1650 | static int already_run = 0; |
1647 | static int flag_lens[NUM_FLAGS]; |
1651 | static int flag_lens[NUM_FLAGS]; |
1648 | static char buf2[HUGE_BUF]; |
1652 | char buf2[4096]; // / was HUFE_BUF, which was hugely incorrect, as is this value, but much less so |
1649 | static char buf[HUGE_BUF]; |
1653 | static char buf[128*1024]; // < the assumption is that every object always fits. fixing this bug, however |
1650 | char* fastbuf; |
1654 | char* fastbuf; // \ requires a large rewrite of the code, so its left to the next total rewrite. |
1651 | int tmp; |
1655 | int tmp; |
1652 | int i; |
1656 | int i; |
1653 | #if 0 |
|
|
1654 | /*Memory polluting code. Should help detect problems, very slow*/ |
|
|
1655 | for (i=0;i<HUGE_BUF;i++){ |
|
|
1656 | buf[i]='a'+(unsigned short)(i%25); |
|
|
1657 | } |
|
|
1658 | #endif |
|
|
1659 | event *etmp; |
1657 | event *etmp; |
1660 | event *etmp2; |
1658 | event *etmp2; |
1661 | key_value * my_field; |
1659 | key_value * my_field; |
1662 | key_value * arch_field; |
1660 | key_value * arch_field; |
1663 | |
1661 | |