'pull' prebuilts from master into release branch
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -50,7 +50,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
@@ -167,7 +167,7 @@ extern FILE *yyin, *yyout;
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
do \
|
||||
@@ -224,7 +224,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
@@ -568,9 +568,7 @@ int yy_flex_debug = 0;
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "dgn_comp.l"
|
||||
#line 2 "dgn_comp.l"
|
||||
/* NetHack 3.6 dgn_comp.l $NHDT-Date: 1448710672 2015/11/28 11:37:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
|
||||
/* NetHack 3.6 dgn_comp.l $NHDT-Date: 1449233101 2015/12/04 12:45:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $ */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* Copyright (c) 1990 by M. Stephenson */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -638,7 +636,6 @@ int FDECL(yyoutput, (int));
|
||||
genericptr_t FDECL(realloc, (genericptr_t,size_t));
|
||||
#endif
|
||||
|
||||
|
||||
void FDECL(init_yyin, (FILE *));
|
||||
void FDECL(init_yyout, (FILE *));
|
||||
|
||||
@@ -650,8 +647,6 @@ extern YYSTYPE yylval;
|
||||
|
||||
int nh_line_number = 1;
|
||||
|
||||
#line 654 "dgn_lex.c"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
@@ -710,7 +705,7 @@ extern int yywrap (void );
|
||||
#endif
|
||||
|
||||
static void yyunput (int c,char *buf_ptr );
|
||||
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
@@ -834,10 +829,6 @@ YY_DECL
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 83 "dgn_comp.l"
|
||||
|
||||
#line 841 "dgn_lex.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@@ -923,153 +914,123 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 84 "dgn_comp.l"
|
||||
return(A_DUNGEON);
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 85 "dgn_comp.l"
|
||||
{ yylval.i=1; return(UP_OR_DOWN); }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 86 "dgn_comp.l"
|
||||
{ yylval.i=0; return(UP_OR_DOWN); }
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 87 "dgn_comp.l"
|
||||
return(ENTRY);
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 88 "dgn_comp.l"
|
||||
return(STAIR);
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 89 "dgn_comp.l"
|
||||
return(NO_UP);
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 90 "dgn_comp.l"
|
||||
return(NO_DOWN);
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 91 "dgn_comp.l"
|
||||
return(PORTAL);
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 92 "dgn_comp.l"
|
||||
return(PROTOFILE);
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 93 "dgn_comp.l"
|
||||
return(DESCRIPTION);
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 94 "dgn_comp.l"
|
||||
return(LEVELDESC);
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 95 "dgn_comp.l"
|
||||
return(ALIGNMENT);
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 96 "dgn_comp.l"
|
||||
return(LEVALIGN);
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 97 "dgn_comp.l"
|
||||
{ yylval.i=TOWN ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 98 "dgn_comp.l"
|
||||
{ yylval.i=HELLISH ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 99 "dgn_comp.l"
|
||||
{ yylval.i=MAZELIKE ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 100 "dgn_comp.l"
|
||||
{ yylval.i=ROGUELIKE ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 101 "dgn_comp.l"
|
||||
{ yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 102 "dgn_comp.l"
|
||||
{ yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 103 "dgn_comp.l"
|
||||
{ yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 104 "dgn_comp.l"
|
||||
{ yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 105 "dgn_comp.l"
|
||||
{ yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); }
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 106 "dgn_comp.l"
|
||||
return(BRANCH);
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 107 "dgn_comp.l"
|
||||
return(CHBRANCH);
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 108 "dgn_comp.l"
|
||||
return(LEVEL);
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 109 "dgn_comp.l"
|
||||
return(RNDLEVEL);
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 110 "dgn_comp.l"
|
||||
return(CHLEVEL);
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 111 "dgn_comp.l"
|
||||
return(RNDCHLEVEL);
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 112 "dgn_comp.l"
|
||||
{ yylval.i=atoi(yytext); return(INTEGER); }
|
||||
YY_BREAK
|
||||
case 30:
|
||||
/* rule 30 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 113 "dgn_comp.l"
|
||||
{ yytext[yyleng - 1] = '\0'; /* discard the trailing \" */
|
||||
yylval.str = dupstr(yytext + 1); /* skip the first \" */
|
||||
return STRING; }
|
||||
@@ -1077,31 +1038,25 @@ YY_RULE_SETUP
|
||||
case 31:
|
||||
/* rule 31 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 116 "dgn_comp.l"
|
||||
{ nh_line_number++; }
|
||||
YY_BREAK
|
||||
case 32:
|
||||
/* rule 32 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 117 "dgn_comp.l"
|
||||
{ nh_line_number++; }
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 118 "dgn_comp.l"
|
||||
; /* skip trailing tabs & spaces */
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 119 "dgn_comp.l"
|
||||
{ return yytext[0]; }
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 120 "dgn_comp.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1105 "dgn_lex.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@@ -1379,7 +1334,7 @@ static int yy_get_next_buffer (void)
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp;
|
||||
|
||||
|
||||
yy_current_state = (yy_start);
|
||||
yy_current_state += YY_AT_BOL();
|
||||
|
||||
@@ -1434,7 +1389,7 @@ static int yy_get_next_buffer (void)
|
||||
static void yyunput (int c, register char * yy_bp )
|
||||
{
|
||||
register char *yy_cp;
|
||||
|
||||
|
||||
yy_cp = (yy_c_buf_p);
|
||||
|
||||
/* undo effects of setting up yytext */
|
||||
@@ -1477,7 +1432,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
*(yy_c_buf_p) = (yy_hold_char);
|
||||
|
||||
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
|
||||
@@ -1546,12 +1501,12 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/** Immediately switch to a different input stream.
|
||||
* @param input_file A readable stream.
|
||||
*
|
||||
*
|
||||
* @note This function does not reset the start condition to @c INITIAL .
|
||||
*/
|
||||
void yyrestart (FILE * input_file )
|
||||
{
|
||||
|
||||
|
||||
if ( ! YY_CURRENT_BUFFER ){
|
||||
yyensure_buffer_stack ();
|
||||
YY_CURRENT_BUFFER_LVALUE =
|
||||
@@ -1564,11 +1519,11 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/** Switch to a different input buffer.
|
||||
* @param new_buffer The new input buffer.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
|
||||
{
|
||||
|
||||
|
||||
/* TODO. We should be able to replace this entire function body
|
||||
* with
|
||||
* yypop_buffer_state();
|
||||
@@ -1608,13 +1563,13 @@ static void yy_load_buffer_state (void)
|
||||
/** Allocate and initialize an input buffer state.
|
||||
* @param file A readable stream.
|
||||
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
|
||||
*
|
||||
*
|
||||
* @return the allocated buffer state.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
|
||||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
||||
@@ -1637,11 +1592,11 @@ static void yy_load_buffer_state (void)
|
||||
|
||||
/** Destroy the buffer.
|
||||
* @param b a buffer created with yy_create_buffer()
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yy_delete_buffer (YY_BUFFER_STATE b )
|
||||
{
|
||||
|
||||
|
||||
if ( ! b )
|
||||
return;
|
||||
|
||||
@@ -1662,7 +1617,7 @@ static void yy_load_buffer_state (void)
|
||||
|
||||
{
|
||||
int oerrno = errno;
|
||||
|
||||
|
||||
yy_flush_buffer(b );
|
||||
|
||||
b->yy_input_file = file;
|
||||
@@ -1678,13 +1633,13 @@ static void yy_load_buffer_state (void)
|
||||
}
|
||||
|
||||
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
||||
|
||||
|
||||
errno = oerrno;
|
||||
}
|
||||
|
||||
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
|
||||
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yy_flush_buffer (YY_BUFFER_STATE b )
|
||||
{
|
||||
@@ -1713,7 +1668,7 @@ static void yy_load_buffer_state (void)
|
||||
* the current state. This function will allocate the stack
|
||||
* if necessary.
|
||||
* @param new_buffer The new state.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
|
||||
{
|
||||
@@ -1743,7 +1698,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
|
||||
|
||||
/** Removes and deletes the top of the stack, if present.
|
||||
* The next element becomes the new top.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yypop_buffer_state (void)
|
||||
{
|
||||
@@ -1767,7 +1722,7 @@ void yypop_buffer_state (void)
|
||||
static void yyensure_buffer_stack (void)
|
||||
{
|
||||
yy_size_t num_to_alloc;
|
||||
|
||||
|
||||
if (!(yy_buffer_stack)) {
|
||||
|
||||
/* First allocation is just for 2 elements, since we don't know if this
|
||||
@@ -1780,7 +1735,7 @@ static void yyensure_buffer_stack (void)
|
||||
);
|
||||
if ( ! (yy_buffer_stack) )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
||||
|
||||
|
||||
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
(yy_buffer_stack_max) = num_to_alloc;
|
||||
@@ -1810,13 +1765,13 @@ static void yyensure_buffer_stack (void)
|
||||
/** Setup the input buffer state to scan directly from a user-specified character buffer.
|
||||
* @param base the character buffer
|
||||
* @param size the size in bytes of the character buffer
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
if ( size < 2 ||
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
@@ -1845,14 +1800,14 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
|
||||
/** Setup the input buffer state to scan a string. The next call to yylex() will
|
||||
* scan from a @e copy of @a str.
|
||||
* @param yystr a NUL-terminated string to scan
|
||||
*
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
* @note If you want to scan bytes that may contain NUL values, then use
|
||||
* yy_scan_bytes() instead.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
|
||||
{
|
||||
|
||||
|
||||
return yy_scan_bytes(yystr,strlen(yystr) );
|
||||
}
|
||||
|
||||
@@ -1860,7 +1815,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
|
||||
* scan from a @e copy of @a bytes.
|
||||
* @param yybytes the byte buffer to scan
|
||||
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
|
||||
*
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
|
||||
@@ -1869,7 +1824,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
buf = (char *) yyalloc(n );
|
||||
@@ -1923,16 +1878,16 @@ static void yy_fatal_error (yyconst char* msg )
|
||||
/* Accessor methods (get/set functions) to struct members. */
|
||||
|
||||
/** Get the current line number.
|
||||
*
|
||||
*
|
||||
*/
|
||||
int yyget_lineno (void)
|
||||
{
|
||||
|
||||
|
||||
return yylineno;
|
||||
}
|
||||
|
||||
/** Get the input stream.
|
||||
*
|
||||
*
|
||||
*/
|
||||
FILE *yyget_in (void)
|
||||
{
|
||||
@@ -1940,7 +1895,7 @@ FILE *yyget_in (void)
|
||||
}
|
||||
|
||||
/** Get the output stream.
|
||||
*
|
||||
*
|
||||
*/
|
||||
FILE *yyget_out (void)
|
||||
{
|
||||
@@ -1948,7 +1903,7 @@ FILE *yyget_out (void)
|
||||
}
|
||||
|
||||
/** Get the length of the current token.
|
||||
*
|
||||
*
|
||||
*/
|
||||
yy_size_t yyget_leng (void)
|
||||
{
|
||||
@@ -1956,7 +1911,7 @@ yy_size_t yyget_leng (void)
|
||||
}
|
||||
|
||||
/** Get the current token.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
char *yyget_text (void)
|
||||
@@ -1966,18 +1921,18 @@ char *yyget_text (void)
|
||||
|
||||
/** Set the current line number.
|
||||
* @param line_number
|
||||
*
|
||||
*
|
||||
*/
|
||||
void yyset_lineno (int line_number )
|
||||
{
|
||||
|
||||
|
||||
yylineno = line_number;
|
||||
}
|
||||
|
||||
/** Set the input stream. This does not discard the current
|
||||
* input buffer.
|
||||
* @param in_str A readable stream.
|
||||
*
|
||||
*
|
||||
* @see yy_switch_to_buffer
|
||||
*/
|
||||
void yyset_in (FILE * in_str )
|
||||
@@ -2031,7 +1986,7 @@ static int yy_init_globals (void)
|
||||
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
|
||||
int yylex_destroy (void)
|
||||
{
|
||||
|
||||
|
||||
/* Pop the buffer stack, destroying each element. */
|
||||
while(YY_CURRENT_BUFFER){
|
||||
yy_delete_buffer(YY_CURRENT_BUFFER );
|
||||
@@ -2098,10 +2053,6 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 120 "dgn_comp.l"
|
||||
|
||||
|
||||
|
||||
/* routine to switch to another input file; needed for flex */
|
||||
void
|
||||
init_yyin( input_f )
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
#ifndef lint
|
||||
static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
|
||||
/* static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; */
|
||||
/* static char nhsccsid[] = "@(#)yaccpar 1.9.0-nh (NetHack) 12/03/2015"; */
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define YYBYACC 1
|
||||
#define YYMAJOR 1
|
||||
#define YYMINOR 9
|
||||
#define YYPATCH 20070509
|
||||
#define YYSUBMINOR "0-nh"
|
||||
|
||||
#define YYEMPTY (-1)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define yyerrok (yyerrflag = 0)
|
||||
#define YYRECOVERING (yyerrflag != 0)
|
||||
|
||||
extern int yyparse(void);
|
||||
|
||||
static int yygrowstack(void);
|
||||
#define yyclearin (yychar=(-1))
|
||||
#define yyerrok (yyerrflag=0)
|
||||
#define YYRECOVERING (yyerrflag!=0)
|
||||
#define YYPREFIX "yy"
|
||||
#line 2 "dgn_comp.y"
|
||||
/* NetHack 3.6 dgn_comp.y $NHDT-Date: 1432512785 2015/05/25 00:13:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
|
||||
/* NetHack 3.6 dgn_comp.y $NHDT-Date: 1449233106 2015/12/04 12:45:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $ */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* Copyright (c) 1990 by M. Stephenson */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -82,13 +73,11 @@ extern int fatal_error;
|
||||
extern const char *fname;
|
||||
extern FILE *yyin, *yyout; /* from dgn_lex.c */
|
||||
|
||||
#line 66 "dgn_comp.y"
|
||||
typedef union
|
||||
{
|
||||
int i;
|
||||
char* str;
|
||||
} YYSTYPE;
|
||||
#line 92 "y.tab.c"
|
||||
#define INTEGER 257
|
||||
#define A_DUNGEON 258
|
||||
#define BRANCH 259
|
||||
@@ -323,40 +312,28 @@ char *yyrule[] = {
|
||||
"rcouple : '(' INTEGER ',' INTEGER ')'",
|
||||
};
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* define the initial stack-sizes */
|
||||
#ifdef YYSTACKSIZE
|
||||
#undef YYMAXDEPTH
|
||||
#define YYMAXDEPTH YYSTACKSIZE
|
||||
#define YYMAXDEPTH YYSTACKSIZE
|
||||
#else
|
||||
#ifdef YYMAXDEPTH
|
||||
#define YYSTACKSIZE YYMAXDEPTH
|
||||
#else
|
||||
#define YYSTACKSIZE 10000
|
||||
#define YYMAXDEPTH 10000
|
||||
#define YYSTACKSIZE 500
|
||||
#define YYMAXDEPTH 500
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define YYINITSTACKSIZE 500
|
||||
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
short *yyssp;
|
||||
int yydebug;
|
||||
int yynerrs;
|
||||
int yyerrflag;
|
||||
int yychar;
|
||||
short *yyssp;
|
||||
YYSTYPE *yyvsp;
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
|
||||
/* variables for the parser stack */
|
||||
static short *yyss;
|
||||
static short *yysslim;
|
||||
static YYSTYPE *yyvs;
|
||||
static int yystacksize;
|
||||
#line 433 "dgn_comp.y"
|
||||
YYSTYPE yyval;
|
||||
YYSTYPE yylval;
|
||||
short yyss[YYSTACKSIZE];
|
||||
YYSTYPE yyvs[YYSTACKSIZE];
|
||||
#define yystacksize YYSTACKSIZE
|
||||
|
||||
void
|
||||
init_dungeon()
|
||||
@@ -603,53 +580,17 @@ output_dgn()
|
||||
}
|
||||
|
||||
/*dgn_comp.y*/
|
||||
#line 607 "y.tab.c"
|
||||
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
||||
static int yygrowstack(void)
|
||||
{
|
||||
int newsize, i;
|
||||
short *newss;
|
||||
YYSTYPE *newvs;
|
||||
|
||||
if ((newsize = yystacksize) == 0)
|
||||
newsize = YYINITSTACKSIZE;
|
||||
else if (newsize >= YYMAXDEPTH)
|
||||
return -1;
|
||||
else if ((newsize *= 2) > YYMAXDEPTH)
|
||||
newsize = YYMAXDEPTH;
|
||||
|
||||
i = yyssp - yyss;
|
||||
newss = (yyss != 0)
|
||||
? (short *)realloc(yyss, newsize * sizeof(*newss))
|
||||
: (short *)malloc(newsize * sizeof(*newss));
|
||||
if (newss == 0)
|
||||
return -1;
|
||||
|
||||
yyss = newss;
|
||||
yyssp = newss + i;
|
||||
newvs = (yyvs != 0)
|
||||
? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
|
||||
: (YYSTYPE *)malloc(newsize * sizeof(*newvs));
|
||||
if (newvs == 0)
|
||||
return -1;
|
||||
|
||||
yyvs = newvs;
|
||||
yyvsp = newvs + i;
|
||||
yystacksize = newsize;
|
||||
yysslim = yyss + newsize - 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define YYABORT goto yyabort
|
||||
#define YYREJECT goto yyabort
|
||||
#define YYACCEPT goto yyaccept
|
||||
#define YYERROR goto yyerrlab
|
||||
int
|
||||
yyparse(void)
|
||||
yyparse()
|
||||
{
|
||||
register int yym, yyn, yystate;
|
||||
#if YYDEBUG
|
||||
register const char *yys;
|
||||
register char *yys;
|
||||
extern char *getenv();
|
||||
|
||||
if ((yys = getenv("YYDEBUG")) != 0)
|
||||
{
|
||||
@@ -661,9 +602,8 @@ yyparse(void)
|
||||
|
||||
yynerrs = 0;
|
||||
yyerrflag = 0;
|
||||
yychar = YYEMPTY;
|
||||
yychar = (-1);
|
||||
|
||||
if (yyss == NULL && yygrowstack()) goto yyoverflow;
|
||||
yyssp = yyss;
|
||||
yyvsp = yyvs;
|
||||
*yyssp = yystate = 0;
|
||||
@@ -684,7 +624,7 @@ yyloop:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
|
||||
if ((yyn = yysindex[yystate]) != 0 && (yyn += yychar) >= 0 &&
|
||||
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
|
||||
{
|
||||
#if YYDEBUG
|
||||
@@ -692,40 +632,36 @@ yyloop:
|
||||
printf("%sdebug: state %d, shifting to state %d\n",
|
||||
YYPREFIX, yystate, yytable[yyn]);
|
||||
#endif
|
||||
if (yyssp >= yysslim && yygrowstack())
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
{
|
||||
goto yyoverflow;
|
||||
}
|
||||
*++yyssp = yystate = yytable[yyn];
|
||||
*++yyvsp = yylval;
|
||||
yychar = YYEMPTY;
|
||||
yychar = (-1);
|
||||
if (yyerrflag > 0) --yyerrflag;
|
||||
goto yyloop;
|
||||
}
|
||||
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
|
||||
if ((yyn = yyrindex[yystate]) != 0 && (yyn += yychar) >= 0 &&
|
||||
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
|
||||
{
|
||||
yyn = yytable[yyn];
|
||||
goto yyreduce;
|
||||
}
|
||||
if (yyerrflag) goto yyinrecovery;
|
||||
|
||||
goto yynewerror;
|
||||
yynewerror:
|
||||
yyerror("syntax error");
|
||||
|
||||
#ifdef lint
|
||||
goto yyerrlab;
|
||||
#endif
|
||||
|
||||
yyerrlab:
|
||||
++yynerrs;
|
||||
|
||||
yyinrecovery:
|
||||
if (yyerrflag < 3)
|
||||
{
|
||||
yyerrflag = 3;
|
||||
for (;;)
|
||||
{
|
||||
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
|
||||
if ((yyn = yysindex[*yyssp]) != 0 && (yyn += YYERRCODE) >= 0 &&
|
||||
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
|
||||
{
|
||||
#if YYDEBUG
|
||||
@@ -733,7 +669,7 @@ yyinrecovery:
|
||||
printf("%sdebug: state %d, error recovery shifting\
|
||||
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
|
||||
#endif
|
||||
if (yyssp >= yysslim && yygrowstack())
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
{
|
||||
goto yyoverflow;
|
||||
}
|
||||
@@ -767,10 +703,9 @@ yyinrecovery:
|
||||
YYPREFIX, yystate, yychar, yys);
|
||||
}
|
||||
#endif
|
||||
yychar = YYEMPTY;
|
||||
yychar = (-1);
|
||||
goto yyloop;
|
||||
}
|
||||
|
||||
yyreduce:
|
||||
#if YYDEBUG
|
||||
if (yydebug)
|
||||
@@ -778,20 +713,15 @@ yyreduce:
|
||||
YYPREFIX, yystate, yyn, yyrule[yyn]);
|
||||
#endif
|
||||
yym = yylen[yyn];
|
||||
if (yym)
|
||||
yyval = yyvsp[1-yym];
|
||||
else
|
||||
memset(&yyval, 0, sizeof yyval);
|
||||
yyval = yyvsp[1-yym];
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
#line 83 "dgn_comp.y"
|
||||
{
|
||||
output_dgn();
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
#line 99 "dgn_comp.y"
|
||||
{
|
||||
init_dungeon();
|
||||
Strcpy(tmpdungeon[n_dgns].name, yyvsp[-3].str);
|
||||
@@ -803,25 +733,21 @@ case 9:
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
#line 111 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = 0;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
#line 115 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = yyvsp[0].i;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
#line 126 "dgn_comp.y"
|
||||
{
|
||||
tmpdungeon[n_dgns].entry_lev = yyvsp[0].i;
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
#line 135 "dgn_comp.y"
|
||||
{
|
||||
if(yyvsp[0].i <= TOWN || yyvsp[0].i >= D_ALIGN_CHAOTIC)
|
||||
yyerror("Illegal description - ignoring!");
|
||||
@@ -830,7 +756,6 @@ case 17:
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
#line 142 "dgn_comp.y"
|
||||
{
|
||||
if(yyvsp[0].i && yyvsp[0].i < D_ALIGN_CHAOTIC)
|
||||
yyerror("Illegal alignment - ignoring!");
|
||||
@@ -839,14 +764,12 @@ case 18:
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
#line 151 "dgn_comp.y"
|
||||
{
|
||||
Strcpy(tmpdungeon[n_dgns].protoname, yyvsp[0].str);
|
||||
Free(yyvsp[0].str);
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
#line 165 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-3].str);
|
||||
@@ -858,7 +781,6 @@ case 25:
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
#line 175 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-4].str);
|
||||
@@ -871,7 +793,6 @@ case 26:
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
#line 188 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-4].str);
|
||||
@@ -884,7 +805,6 @@ case 27:
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
#line 199 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-5].str);
|
||||
@@ -898,7 +818,6 @@ case 28:
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
#line 213 "dgn_comp.y"
|
||||
{
|
||||
if(yyvsp[0].i >= D_ALIGN_CHAOTIC)
|
||||
yyerror("Illegal description - ignoring!");
|
||||
@@ -907,7 +826,6 @@ case 29:
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
#line 220 "dgn_comp.y"
|
||||
{
|
||||
if(yyvsp[0].i && yyvsp[0].i < D_ALIGN_CHAOTIC)
|
||||
yyerror("Illegal alignment - ignoring!");
|
||||
@@ -916,7 +834,6 @@ case 30:
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
#line 229 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-4].str);
|
||||
@@ -931,7 +848,6 @@ case 31:
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
#line 242 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-5].str);
|
||||
@@ -947,7 +863,6 @@ case 32:
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
#line 258 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-5].str);
|
||||
@@ -963,7 +878,6 @@ case 33:
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
#line 272 "dgn_comp.y"
|
||||
{
|
||||
init_level();
|
||||
Strcpy(tmplevel[n_levs].name, yyvsp[-6].str);
|
||||
@@ -980,7 +894,6 @@ case 34:
|
||||
}
|
||||
break;
|
||||
case 37:
|
||||
#line 293 "dgn_comp.y"
|
||||
{
|
||||
init_branch();
|
||||
Strcpy(tmpbranch[n_brs].name, yyvsp[-4].str);
|
||||
@@ -994,7 +907,6 @@ case 37:
|
||||
}
|
||||
break;
|
||||
case 38:
|
||||
#line 307 "dgn_comp.y"
|
||||
{
|
||||
init_branch();
|
||||
Strcpy(tmpbranch[n_brs].name, yyvsp[-5].str);
|
||||
@@ -1010,49 +922,41 @@ case 38:
|
||||
}
|
||||
break;
|
||||
case 39:
|
||||
#line 323 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = TBR_STAIR; /* two way stair */
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
#line 327 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = TBR_STAIR; /* two way stair */
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
#line 331 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = TBR_NO_UP; /* no up staircase */
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
#line 335 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = TBR_NO_DOWN; /* no down staircase */
|
||||
}
|
||||
break;
|
||||
case 43:
|
||||
#line 339 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = TBR_PORTAL; /* portal connection */
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
#line 345 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = 0; /* defaults to down */
|
||||
}
|
||||
break;
|
||||
case 45:
|
||||
#line 349 "dgn_comp.y"
|
||||
{
|
||||
yyval.i = yyvsp[0].i;
|
||||
}
|
||||
break;
|
||||
case 46:
|
||||
#line 355 "dgn_comp.y"
|
||||
{
|
||||
char *p = yyvsp[0].str;
|
||||
if (strlen(p) != 1) {
|
||||
@@ -1065,7 +969,6 @@ case 46:
|
||||
}
|
||||
break;
|
||||
case 47:
|
||||
#line 385 "dgn_comp.y"
|
||||
{
|
||||
if (yyvsp[-3].i < -MAXLEVEL || yyvsp[-3].i > MAXLEVEL) {
|
||||
yyerror("Abs base out of dlevel range - zeroing!");
|
||||
@@ -1082,7 +985,6 @@ case 47:
|
||||
}
|
||||
break;
|
||||
case 48:
|
||||
#line 422 "dgn_comp.y"
|
||||
{
|
||||
if (yyvsp[-3].i < -MAXLEVEL || yyvsp[-3].i > MAXLEVEL) {
|
||||
yyerror("Rel base out of dlevel range - zeroing!");
|
||||
@@ -1093,7 +995,6 @@ case 48:
|
||||
}
|
||||
}
|
||||
break;
|
||||
#line 1097 "y.tab.c"
|
||||
}
|
||||
yyssp -= yym;
|
||||
yystate = *yyssp;
|
||||
@@ -1126,7 +1027,7 @@ break;
|
||||
if (yychar == 0) goto yyaccept;
|
||||
goto yyloop;
|
||||
}
|
||||
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
|
||||
if ((yyn = yygindex[yym]) != 0 && (yyn += yystate) >= 0 &&
|
||||
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
|
||||
yystate = yytable[yyn];
|
||||
else
|
||||
@@ -1136,20 +1037,17 @@ break;
|
||||
printf("%sdebug: after reduction, shifting from state %d \
|
||||
to state %d\n", YYPREFIX, *yyssp, yystate);
|
||||
#endif
|
||||
if (yyssp >= yysslim && yygrowstack())
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
{
|
||||
goto yyoverflow;
|
||||
}
|
||||
*++yyssp = yystate;
|
||||
*++yyvsp = yyval;
|
||||
goto yyloop;
|
||||
|
||||
yyoverflow:
|
||||
yyerror("yacc stack overflow");
|
||||
|
||||
yyabort:
|
||||
return (1);
|
||||
|
||||
yyaccept:
|
||||
return (0);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user