version 1.5 | | version 1.6 |
---|
| | |
/* A lexical scanner generated by flex */ | | /* A lexical scanner generated by flex */ |
| | |
/* Scanner skeleton version: | | /* Scanner skeleton version: |
* $Header: /cvsroot/crossfire/crossfire/random_maps/reader.c,v 1.5 2000/12/15 03:09:19 peterm Exp $ | | * $Header: /cvsroot/crossfire/crossfire/random_maps/reader.c,v 1.6 2001/01/31 07:54:51 cvs Exp $ |
*/ | | */ |
| | |
#define FLEX_SCANNER | | #define FLEX_SCANNER |
| | |
#line 2 "reader.l" | | #line 2 "reader.l" |
/* | | /* |
* static char *reader_l = | | * static char *reader_l = |
* "$Id: reader.c,v 1.5 2000/12/15 03:09:19 peterm Exp $"; | | * "$Id: reader.c,v 1.6 2001/01/31 07:54:51 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <random_map.h> | | #include <random_map.h> |
| | |
| | |
/* All the variable names. Each entry should correspond to the | | |
* V_ vlaue in loader.h (that is, the 20'th value in this array should | | |
* correspond to the 20'th V_(value) in loader.h) The V_??? get | | |
* used as indexes into this array. | | |
*/ | | |
| | |
/* If you change this list (add/delete/rename), also update the list | | |
* in crossedit/Attr.c, around line 360. That list is the variables | | |
* that can be set in crossedit for various objects. | | |
*/ | | |
| | |
#define YY_DECL int rmap_lex_read(RMParms *RP) | | #define YY_DECL int rmap_lex_read(RMParms *RP) |
| | |
static char *rmap_yval(); | | static char *rmap_yval(); |
| | |
YY_DECL | | YY_DECL |
{ | | { |
register yy_state_type yy_current_state; | | register yy_state_type yy_current_state; |
register char *yy_cp, *yy_bp; | | register char *yy_cp = NULL, *yy_bp = NULL; |
register int yy_act; | | register int yy_act; |
| | |
#line 74 "reader.l" | | #line 63 "reader.l" |
| | |
| | |
| | |
| | |
| | |
case 1: | | case 1: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 86 "reader.l" | | #line 75 "reader.l" |
strcpy(RP->wallstyle,rmap_yval()); | | strcpy(RP->wallstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 2: | | case 2: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 87 "reader.l" | | #line 76 "reader.l" |
strcpy(RP->floorstyle,rmap_yval()); | | strcpy(RP->floorstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 3: | | case 3: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 88 "reader.l" | | #line 77 "reader.l" |
strcpy(RP->monsterstyle,rmap_yval()); | | strcpy(RP->monsterstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 4: | | case 4: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 89 "reader.l" | | #line 78 "reader.l" |
strcpy(RP->treasurestyle,rmap_yval()); | | strcpy(RP->treasurestyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 5: | | case 5: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 90 "reader.l" | | #line 79 "reader.l" |
strcpy(RP->layoutstyle,rmap_yval()); | | strcpy(RP->layoutstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 6: | | case 6: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 91 "reader.l" | | #line 80 "reader.l" |
strcpy(RP->doorstyle,rmap_yval()); | | strcpy(RP->doorstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 7: | | case 7: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 92 "reader.l" | | #line 81 "reader.l" |
strcpy(RP->decorstyle,rmap_yval()); | | strcpy(RP->decorstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 8: | | case 8: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 93 "reader.l" | | #line 82 "reader.l" |
RP->Xsize = IVAL; | | RP->Xsize = IVAL; |
YY_BREAK | | YY_BREAK |
case 9: | | case 9: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 94 "reader.l" | | #line 83 "reader.l" |
RP->Ysize = IVAL; | | RP->Ysize = IVAL; |
YY_BREAK | | YY_BREAK |
case 10: | | case 10: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 95 "reader.l" | | #line 84 "reader.l" |
RP->layoutoptions1 = IVAL; | | RP->layoutoptions1 = IVAL; |
YY_BREAK | | YY_BREAK |
case 11: | | case 11: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 96 "reader.l" | | #line 85 "reader.l" |
RP->layoutoptions2 = IVAL; | | RP->layoutoptions2 = IVAL; |
YY_BREAK | | YY_BREAK |
case 12: | | case 12: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 97 "reader.l" | | #line 86 "reader.l" |
RP->layoutoptions3 = IVAL; | | RP->layoutoptions3 = IVAL; |
YY_BREAK | | YY_BREAK |
case 13: | | case 13: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 98 "reader.l" | | #line 87 "reader.l" |
RP->symmetry = IVAL; | | RP->symmetry = IVAL; |
YY_BREAK | | YY_BREAK |
case 14: | | case 14: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 99 "reader.l" | | #line 88 "reader.l" |
RP->difficulty = IVAL; | | RP->difficulty = IVAL; |
YY_BREAK | | YY_BREAK |
case 15: | | case 15: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 100 "reader.l" | | #line 89 "reader.l" |
RP->decoroptions = IVAL; | | RP->decoroptions = IVAL; |
YY_BREAK | | YY_BREAK |
case 16: | | case 16: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 101 "reader.l" | | #line 90 "reader.l" |
strcpy(RP->exitstyle,rmap_yval()); | | strcpy(RP->exitstyle,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 17: | | case 17: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 102 "reader.l" | | #line 91 "reader.l" |
RP->dungeon_level = IVAL; | | RP->dungeon_level = IVAL; |
YY_BREAK | | YY_BREAK |
case 18: | | case 18: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 103 "reader.l" | | #line 92 "reader.l" |
RP->dungeon_depth = IVAL; | | RP->dungeon_depth = IVAL; |
YY_BREAK | | YY_BREAK |
case 19: | | case 19: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 104 "reader.l" | | #line 93 "reader.l" |
strcpy(RP->final_map,rmap_yval()); | | strcpy(RP->final_map,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 20: | | case 20: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 105 "reader.l" | | #line 94 "reader.l" |
RP-> orientation = IVAL; | | RP-> orientation = IVAL; |
YY_BREAK | | YY_BREAK |
case 21: | | case 21: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 106 "reader.l" | | #line 95 "reader.l" |
RP->origin_x = IVAL; | | RP->origin_x = IVAL; |
YY_BREAK | | YY_BREAK |
case 22: | | case 22: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 107 "reader.l" | | #line 96 "reader.l" |
RP-> origin_y = IVAL; | | RP-> origin_y = IVAL; |
YY_BREAK | | YY_BREAK |
case 23: | | case 23: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 108 "reader.l" | | #line 97 "reader.l" |
strcpy(RP->origin_map,rmap_yval()); | | strcpy(RP->origin_map,rmap_yval()); |
YY_BREAK | | YY_BREAK |
case 24: | | case 24: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 109 "reader.l" | | #line 98 "reader.l" |
RP->random_seed = IVAL; | | RP->random_seed = IVAL; |
YY_BREAK | | YY_BREAK |
case 25: | | case 25: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 110 "reader.l" | | #line 99 "reader.l" |
RP->treasureoptions = IVAL; | | RP->treasureoptions = IVAL; |
YY_BREAK | | YY_BREAK |
case 26: | | case 26: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 111 "reader.l" | | #line 100 "reader.l" |
RP->generate_treasure_now = IVAL; | | RP->generate_treasure_now = IVAL; |
YY_BREAK | | YY_BREAK |
case 27: | | case 27: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 114 "reader.l" | | #line 103 "reader.l" |
{/* ignore empty lines, newlines we don't do above */} | | {/* ignore empty lines, newlines we don't do above */} |
YY_BREAK | | YY_BREAK |
case 28: | | case 28: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 115 "reader.l" | | #line 104 "reader.l" |
{} | | {} |
YY_BREAK | | YY_BREAK |
case YY_STATE_EOF(INITIAL): | | case YY_STATE_EOF(INITIAL): |
case YY_STATE_EOF(MESSAGE): | | case YY_STATE_EOF(MESSAGE): |
#line 117 "reader.l" | | #line 106 "reader.l" |
{/* If we got an error, return the error. Otherwise, return that we got EOF */ | | {/* If we got an error, return the error. Otherwise, return that we got EOF */ |
if (rmap_lex_error!=0) return rmap_lex_error; else return LL_EOF;} | | if (rmap_lex_error!=0) return rmap_lex_error; else return LL_EOF;} |
YY_BREAK | | YY_BREAK |
case 29: | | case 29: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 119 "reader.l" | | #line 108 "reader.l" |
{ yyerror( "Unrecognized string"); rmap_lex_error= -1; } | | { yyerror( "Unrecognized string"); rmap_lex_error= -1; } |
YY_BREAK | | YY_BREAK |
case 30: | | case 30: |
YY_RULE_SETUP | | YY_RULE_SETUP |
#line 120 "reader.l" | | #line 109 "reader.l" |
ECHO; | | ECHO; |
YY_BREAK | | YY_BREAK |
| | |
| | |
return 0; | | return 0; |
} | | } |
#endif | | #endif |
#line 120 "reader.l" | | #line 109 "reader.l" |
| | |
| | |
/*int yyerror(char *s) | | /*int yyerror(char *s) |
| | |
return retval; | | return retval; |
} | | } |
| | |
| | |
| | /* This takes a buffer, scans it for variables, and sets those variables |
| | * as appropriate in op. |
| | * |
| | * This function appears to be used in only 2 places - in crossedit to |
| | * override values and in c_wiz to mutate values. |
| | */ |
| | int set_random_map_variable(RMParms *rp,char *buf) { |
| | YY_BUFFER_STATE yybufstate; |
| | int retval; |
| | |
| | yybufstate=yy_scan_string(buf); |
| | retval=rmap_lex_read(rp); |
| | yy_delete_buffer(yybufstate); |
| | return retval; |
| | } |