| version 1.3 | | version 1.4 |
|---|
| | |
| /* 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.3 1999/07/13 04:47:59 cvs Exp $ | | * $Header: /cvsroot/crossfire/crossfire/common/loader.c,v 1.4 2000/04/27 07:04:18 cvs Exp $ |
| */ | | */ |
| | | |
| #define FLEX_SCANNER | | #define FLEX_SCANNER |
| | |
| { \ | | { \ |
| /* Undo effects of setting up yytext. */ \ | | /* Undo effects of setting up yytext. */ \ |
| *yy_cp = yy_hold_char; \ | | *yy_cp = yy_hold_char; \ |
| | | YY_RESTORE_YY_MORE_OFFSET \ |
| yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ | | yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ |
| YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
| } \ | | } \ |
| | |
| #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) | | #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) |
| | | |
| YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); | | YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); |
| YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); | | YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); |
| YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); | | YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); |
| | | |
| static void *yy_flex_alloc YY_PROTO(( yy_size_t )); | | static void *yy_flex_alloc YY_PROTO(( yy_size_t )); |
| | |
| #define REJECT reject_used_but_not_detected | | #define REJECT reject_used_but_not_detected |
| #define yymore() yymore_used_but_not_detected | | #define yymore() yymore_used_but_not_detected |
| #define YY_MORE_ADJ 0 | | #define YY_MORE_ADJ 0 |
| | | #define YY_RESTORE_YY_MORE_OFFSET |
| char *yytext; | | char *yytext; |
| #line 1 "loader.l" | | #line 1 "loader.l" |
| #define INITIAL 0 | | #define INITIAL 0 |
| #line 2 "loader.l" | | #line 2 "loader.l" |
| /* | | /* |
| * static char *rcsid_object_c = | | * static char *rcsid_object_c = |
| * "$Id: loader.c,v 1.3 1999/07/13 04:47:59 cvs Exp $"; | | * "$Id: loader.c,v 1.4 2000/04/27 07:04:18 cvs Exp $"; |
| */ | | */ |
| | | |
| /* | | /* |
| CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | | |
| Copyright (C) 1994 Mark Wedel | | Copyright (C) 2000 Mark Wedel |
| Copyright (C) 1992 Frank Tore Johansen | | Copyright (C) 1992 Frank Tore Johansen |
| | | |
| This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify |
| | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software |
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | | |
| The author can be reached via e-mail to master@rahul.net | | The author can be reached via e-mail to mwedel@scruz.net |
| */ | | */ |
| | | |
| /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. | | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
| | |
| static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); | | static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); |
| #endif | | #endif |
| | | |
| | | #ifdef YY_NEED_STRLEN |
| | | static int yy_flex_strlen YY_PROTO(( yyconst char * )); |
| | | #endif |
| | | |
| #ifndef YY_NO_INPUT | | #ifndef YY_NO_INPUT |
| #ifdef __cplusplus | | #ifdef __cplusplus |
| static int yyinput YY_PROTO(( void )); | | static int yyinput YY_PROTO(( void )); |
| | |
| 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 117 "loader.l" | | #line 117 "loader.l" |
| | |
| | | |
| /* Undo the effects of YY_DO_BEFORE_ACTION. */ | | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
| *yy_cp = yy_hold_char; | | *yy_cp = yy_hold_char; |
| | | YY_RESTORE_YY_MORE_OFFSET |
| | | |
| if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) | | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) |
| { | | { |
| | |
| { /* Don't try to fill the buffer, so this is an EOF. */ | | { /* Don't try to fill the buffer, so this is an EOF. */ |
| if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) | | if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) |
| { | | { |
| /* We matched a singled characater, the EOB, so | | /* We matched a single character, the EOB, so |
| * treat this as a final EOF. | | * treat this as a final EOF. |
| */ | | */ |
| return EOB_ACT_END_OF_FILE; | | return EOB_ACT_END_OF_FILE; |
| | |
| /* don't do the read, it's not guaranteed to return an EOF, | | /* don't do the read, it's not guaranteed to return an EOF, |
| * just force an EOF | | * just force an EOF |
| */ | | */ |
| yy_n_chars = 0; | | yy_current_buffer->yy_n_chars = yy_n_chars = 0; |
| | | |
| else | | else |
| { | | { |
| | |
| /* Read in more data. */ | | /* Read in more data. */ |
| YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), | | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), |
| yy_n_chars, num_to_read ); | | yy_n_chars, num_to_read ); |
| | | |
| | | yy_current_buffer->yy_n_chars = yy_n_chars; |
| } | | } |
| | | |
| if ( yy_n_chars == 0 ) | | if ( yy_n_chars == 0 ) |
| | |
| | | |
| yy_cp += (int) (dest - source); | | yy_cp += (int) (dest - source); |
| yy_bp += (int) (dest - source); | | yy_bp += (int) (dest - source); |
| | | yy_current_buffer->yy_n_chars = |
| yy_n_chars = yy_current_buffer->yy_buf_size; | | yy_n_chars = yy_current_buffer->yy_buf_size; |
| | | |
| if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
| | |
| | | |
| else | | else |
| { /* need more input */ | | { /* need more input */ |
| yytext_ptr = yy_c_buf_p; | | int offset = yy_c_buf_p - yytext_ptr; |
| ++yy_c_buf_p; | | ++yy_c_buf_p; |
| | | |
| switch ( yy_get_next_buffer() ) | | switch ( yy_get_next_buffer() ) |
| { | | { |
| | | case EOB_ACT_LAST_MATCH: |
| | | /* This happens because yy_g_n_b() |
| | | * sees that we've accumulated a |
| | | * token and flags that we need to |
| | | * try matching the token before |
| | | * proceeding. But for input(), |
| | | * there's no matching to consider. |
| | | * So convert the EOB_ACT_LAST_MATCH |
| | | * to EOB_ACT_END_OF_FILE. |
| | | */ |
| | | |
| | | /* Reset buffer status. */ |
| | | yyrestart( yyin ); |
| | | |
| | | /* fall through */ |
| | | |
| case EOB_ACT_END_OF_FILE: | | case EOB_ACT_END_OF_FILE: |
| { | | { |
| if ( yywrap() ) | | if ( yywrap() ) |
| { | | |
| yy_c_buf_p = | | |
| yytext_ptr + YY_MORE_ADJ; | | |
| return EOF; | | return EOF; |
| } | | |
| | | |
| if ( ! yy_did_buffer_switch_on_eof ) | | if ( ! yy_did_buffer_switch_on_eof ) |
| YY_NEW_FILE; | | YY_NEW_FILE; |
| | |
| } | | } |
| | | |
| case EOB_ACT_CONTINUE_SCAN: | | case EOB_ACT_CONTINUE_SCAN: |
| yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; | | yy_c_buf_p = yytext_ptr + offset; |
| break; | | break; |
| | | |
| case EOB_ACT_LAST_MATCH: | | |
| #ifdef __cplusplus | | |
| YY_FATAL_ERROR( | | |
| "unexpected last match in yyinput()" ); | | |
| #else | | |
| YY_FATAL_ERROR( | | |
| "unexpected last match in input()" ); | | |
| #endif | | |
| } | | } |
| } | | } |
| } | | } |
| | |
| #endif | | #endif |
| | | |
| { | | { |
| | | if ( ! b ) |
| | | return; |
| | | |
| b->yy_n_chars = 0; | | b->yy_n_chars = 0; |
| | | |
| /* We always need two end-of-buffer characters. The first causes | | /* We always need two end-of-buffer characters. The first causes |
| | |
| | | |
| #ifndef YY_NO_SCAN_STRING | | #ifndef YY_NO_SCAN_STRING |
| #ifdef YY_USE_PROTOS | | #ifdef YY_USE_PROTOS |
| YY_BUFFER_STATE yy_scan_string( yyconst char *str ) | | YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) |
| #else | | #else |
| YY_BUFFER_STATE yy_scan_string( str ) | | YY_BUFFER_STATE yy_scan_string( yy_str ) |
| yyconst char *str; | | yyconst char *yy_str; |
| #endif | | #endif |
| { | | { |
| int len; | | int len; |
| for ( len = 0; str[len]; ++len ) | | for ( len = 0; yy_str[len]; ++len ) |
| ; | | ; |
| | | |
| return yy_scan_bytes( str, len ); | | return yy_scan_bytes( yy_str, len ); |
| } | | } |
| #endif | | #endif |
| | | |
| | |
| { \ | | { \ |
| /* Undo effects of setting up yytext. */ \ | | /* Undo effects of setting up yytext. */ \ |
| yytext[yyleng] = yy_hold_char; \ | | yytext[yyleng] = yy_hold_char; \ |
| yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ | | yy_c_buf_p = yytext + n; \ |
| yy_hold_char = *yy_c_buf_p; \ | | yy_hold_char = *yy_c_buf_p; \ |
| *yy_c_buf_p = '\0'; \ | | *yy_c_buf_p = '\0'; \ |
| yyleng = n; \ | | yyleng = n; \ |
| | |
| } | | } |
| #endif | | #endif |
| | | |
| | | #ifdef YY_NEED_STRLEN |
| | | #ifdef YY_USE_PROTOS |
| | | static int yy_flex_strlen( yyconst char *s ) |
| | | #else |
| | | static int yy_flex_strlen( s ) |
| | | yyconst char *s; |
| | | #endif |
| | | { |
| | | register int n; |
| | | for ( n = 0; s[n]; ++n ) |
| | | ; |
| | | |
| | | return n; |
| | | } |
| | | #endif |
| | | |
| | | |
| #ifdef YY_USE_PROTOS | | #ifdef YY_USE_PROTOS |
| static void *yy_flex_alloc( yy_size_t size ) | | static void *yy_flex_alloc( yy_size_t size ) |
| | |
| /* Our save file syntax is very simple, so we can use a very simple | | /* Our save file syntax is very simple, so we can use a very simple |
| * processing mechanism here instead using something like bison | | * processing mechanism here instead using something like bison |
| * This skips over the space and returns the value, or "" if no value | | * This skips over the space and returns the value, or "" if no value |
| * is found. | | * is found. Modified 4/26/2000 to also strip spaces at end of |
| | | * line |
| */ | | */ |
| static char *yval() | | static char *yval() |
| { | | { |
| static char *em=""; | | static char *em=""; |
| char *cp; | | char *cp,*end; |
| | | |
| | | /* First skip over start of line, like animation or name */ |
| | | for (cp=yytext; *cp!=' '; cp++) { |
| | | if (*cp=='\0') { |
| | | return em; |
| | | } |
| | | } |
| | | |
| cp=strchr(yytext,' '); | | /* Skip over whitespace */ |
| if (cp) return cp+1; | | for (; *cp==' '; cp++) { |
| else return em; | | if (*cp=='\0') { |
| | | return em; |
| | | } |
| | | } |
| | | /* Got last character before null and strip |
| | | * off tailing whitespace |
| | | */ |
| | | for (end=cp+strlen(cp)-1; *end==' '; end--) { |
| | | if (end==cp) return em; |
| | | *end='\0'; |
| | | } |
| | | return cp; |
| } | | } |
| | | |
| | | |