mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
It appears that the token OPAQUE in ncgen.y
is somehow in interference with something in the HDF4 code. So, I changed the OPAQUE -> OPAQUE_ and that appears to fix the problem with bison when HDF4 is enabled. ps. when Visual Studio complained about token 'constant' it turn out that it mean token type, not the actual token named 'constant'. Instead the actual token that was causing the problem was 'OPAQUE'.
This commit is contained in:
parent
7cb03504ed
commit
0415300fbc
@ -261,7 +261,7 @@ yytext[MAXTRST-1] = '\0';
|
||||
|
||||
compound|struct|structure {return lexdebug(COMPOUND);}
|
||||
enum {return lexdebug(ENUM);}
|
||||
opaque {return lexdebug(OPAQUE);}
|
||||
opaque {return lexdebug(OPAQUE_);}
|
||||
|
||||
float|real {return lexdebug(FLOAT_K);}
|
||||
char {return lexdebug(CHAR_K);}
|
||||
|
@ -175,7 +175,7 @@ NCConstant constant;
|
||||
TYPES
|
||||
COMPOUND
|
||||
ENUM
|
||||
OPAQUE
|
||||
OPAQUE_
|
||||
OPAQUESTRING /* 0x<even number of hexdigits> */
|
||||
GROUP
|
||||
PATH /* / or (/IDENT)+(.IDENT)? */
|
||||
@ -340,7 +340,7 @@ enumid: ident '=' constint
|
||||
}
|
||||
;
|
||||
|
||||
opaquedecl: OPAQUE '(' INT_CONST ')' typename
|
||||
opaquedecl: OPAQUE_ '(' INT_CONST ')' typename
|
||||
{
|
||||
vercheck(NC_OPAQUE);
|
||||
addtogroup($5); /*sets prefix*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#line 3 "lex.ncg.c"
|
||||
#line 3 "ncgenl.c"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
@ -65,7 +65,6 @@ typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
typedef uint64_t flex_uint64_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
@ -172,12 +171,7 @@ typedef unsigned int flex_uint32_t;
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
extern yy_size_t ncgleng;
|
||||
extern int ncgleng;
|
||||
|
||||
extern FILE *ncgin, *ncgout;
|
||||
|
||||
@ -203,6 +197,11 @@ extern FILE *ncgin, *ncgout;
|
||||
|
||||
#define unput(c) yyunput( c, (yytext_ptr) )
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
@ -220,7 +219,7 @@ struct yy_buffer_state
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_n_chars;
|
||||
int yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
@ -290,8 +289,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
|
||||
|
||||
/* yy_hold_char holds the character lost when ncgtext is formed. */
|
||||
static char yy_hold_char;
|
||||
static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
|
||||
yy_size_t ncgleng;
|
||||
static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
||||
int ncgleng;
|
||||
|
||||
/* Points to current character in buffer. */
|
||||
static char *yy_c_buf_p = (char *) 0;
|
||||
@ -319,7 +318,7 @@ static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file );
|
||||
|
||||
YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size );
|
||||
YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str );
|
||||
YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len );
|
||||
YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,int len );
|
||||
|
||||
void *ncgalloc (yy_size_t );
|
||||
void *ncgrealloc (void *,yy_size_t );
|
||||
@ -374,7 +373,7 @@ static void yy_fatal_error (yyconst char msg[] );
|
||||
*/
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
(yytext_ptr) = yy_bp; \
|
||||
ncgleng = (yy_size_t) (yy_cp - yy_bp); \
|
||||
ncgleng = (size_t) (yy_cp - yy_bp); \
|
||||
(yy_hold_char) = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
@ -1320,7 +1319,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})*
|
||||
/* Note: this definition of string will work for utf8 as well,
|
||||
although it is a very relaxed definition
|
||||
*/
|
||||
#line 1324 "lex.ncg.c"
|
||||
#line 1323 "ncgenl.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define ST_C_COMMENT 1
|
||||
@ -1361,7 +1360,7 @@ FILE *ncgget_out (void );
|
||||
|
||||
void ncgset_out (FILE * out_str );
|
||||
|
||||
yy_size_t ncgget_leng (void );
|
||||
int ncgget_leng (void );
|
||||
|
||||
char *ncgget_text (void );
|
||||
|
||||
@ -1422,7 +1421,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
yy_size_t n; \
|
||||
int n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1506,7 +1505,7 @@ YY_DECL
|
||||
|
||||
#line 217 "ncgen.l"
|
||||
|
||||
#line 1510 "lex.ncg.c"
|
||||
#line 1509 "ncgenl.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -1659,7 +1658,7 @@ YY_RULE_SETUP
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 264 "ncgen.l"
|
||||
{return lexdebug(OPAQUE);}
|
||||
{return lexdebug(OPAQUE_);}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
@ -2119,7 +2118,7 @@ YY_RULE_SETUP
|
||||
#line 570 "ncgen.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 2123 "lex.ncg.c"
|
||||
#line 2122 "ncgenl.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(TEXT):
|
||||
yyterminate();
|
||||
@ -2306,7 +2305,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
else
|
||||
{
|
||||
yy_size_t num_to_read =
|
||||
int num_to_read =
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
|
||||
while ( num_to_read <= 0 )
|
||||
@ -2320,7 +2319,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
if ( b->yy_is_our_buffer )
|
||||
{
|
||||
yy_size_t new_size = b->yy_buf_size * 2;
|
||||
int new_size = b->yy_buf_size * 2;
|
||||
|
||||
if ( new_size <= 0 )
|
||||
b->yy_buf_size += b->yy_buf_size / 8;
|
||||
@ -2351,7 +2350,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
||||
(yy_n_chars), num_to_read );
|
||||
(yy_n_chars), (size_t) num_to_read );
|
||||
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
||||
}
|
||||
@ -2461,7 +2460,7 @@ static int yy_get_next_buffer (void)
|
||||
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
|
||||
{ /* need to shift things up to make room */
|
||||
/* +2 for EOB chars. */
|
||||
register yy_size_t number_to_move = (yy_n_chars) + 2;
|
||||
register int number_to_move = (yy_n_chars) + 2;
|
||||
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
|
||||
register char *source =
|
||||
@ -2510,7 +2509,7 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
else
|
||||
{ /* need more input */
|
||||
yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
|
||||
int offset = (yy_c_buf_p) - (yytext_ptr);
|
||||
++(yy_c_buf_p);
|
||||
|
||||
switch ( yy_get_next_buffer( ) )
|
||||
@ -2534,7 +2533,7 @@ static int yy_get_next_buffer (void)
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( ncgwrap( ) )
|
||||
return 0;
|
||||
return EOF;
|
||||
|
||||
if ( ! (yy_did_buffer_switch_on_eof) )
|
||||
YY_NEW_FILE;
|
||||
@ -2786,7 +2785,7 @@ void ncgpop_buffer_state (void)
|
||||
*/
|
||||
static void ncgensure_buffer_stack (void)
|
||||
{
|
||||
yy_size_t num_to_alloc;
|
||||
int num_to_alloc;
|
||||
|
||||
if (!(yy_buffer_stack)) {
|
||||
|
||||
@ -2883,11 +2882,12 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr )
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
|
||||
YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, int _yybytes_len )
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
char *buf;
|
||||
yy_size_t n, i;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
@ -2969,7 +2969,7 @@ FILE *ncgget_out (void)
|
||||
/** Get the length of the current token.
|
||||
*
|
||||
*/
|
||||
yy_size_t ncgget_leng (void)
|
||||
int ncgget_leng (void)
|
||||
{
|
||||
return ncgleng;
|
||||
}
|
||||
|
2492
ncgen/ncgeny.c
2492
ncgen/ncgeny.c
File diff suppressed because it is too large
Load Diff
216
ncgen/ncgeny.h
216
ncgen/ncgeny.h
@ -1,14 +1,13 @@
|
||||
/* A Bison parser, made by GNU Bison 2.3. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -16,9 +15,7 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
@ -33,139 +30,100 @@
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YY_NCG_NCGEN_TAB_H_INCLUDED
|
||||
# define YY_NCG_NCGEN_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int ncgdebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
NC_UNLIMITED_K = 258,
|
||||
CHAR_K = 259,
|
||||
BYTE_K = 260,
|
||||
SHORT_K = 261,
|
||||
INT_K = 262,
|
||||
FLOAT_K = 263,
|
||||
DOUBLE_K = 264,
|
||||
UBYTE_K = 265,
|
||||
USHORT_K = 266,
|
||||
UINT_K = 267,
|
||||
INT64_K = 268,
|
||||
UINT64_K = 269,
|
||||
IDENT = 270,
|
||||
TERMSTRING = 271,
|
||||
CHAR_CONST = 272,
|
||||
BYTE_CONST = 273,
|
||||
SHORT_CONST = 274,
|
||||
INT_CONST = 275,
|
||||
INT64_CONST = 276,
|
||||
UBYTE_CONST = 277,
|
||||
USHORT_CONST = 278,
|
||||
UINT_CONST = 279,
|
||||
UINT64_CONST = 280,
|
||||
FLOAT_CONST = 281,
|
||||
DOUBLE_CONST = 282,
|
||||
DIMENSIONS = 283,
|
||||
VARIABLES = 284,
|
||||
NETCDF = 285,
|
||||
DATA = 286,
|
||||
TYPES = 287,
|
||||
COMPOUND = 288,
|
||||
ENUM = 289,
|
||||
OPAQUE = 290,
|
||||
OPAQUESTRING = 291,
|
||||
GROUP = 292,
|
||||
PATH = 293,
|
||||
FILLMARKER = 294,
|
||||
NIL = 295,
|
||||
_FILLVALUE = 296,
|
||||
_FORMAT = 297,
|
||||
_STORAGE = 298,
|
||||
_CHUNKSIZES = 299,
|
||||
_DEFLATELEVEL = 300,
|
||||
_SHUFFLE = 301,
|
||||
_ENDIANNESS = 302,
|
||||
_NOFILL = 303,
|
||||
_FLETCHER32 = 304,
|
||||
_NCPROPS = 305,
|
||||
_ISNETCDF4 = 306,
|
||||
_SUPERBLOCK = 307,
|
||||
DATASETID = 308
|
||||
};
|
||||
enum yytokentype
|
||||
{
|
||||
NC_UNLIMITED_K = 258,
|
||||
CHAR_K = 259,
|
||||
BYTE_K = 260,
|
||||
SHORT_K = 261,
|
||||
INT_K = 262,
|
||||
FLOAT_K = 263,
|
||||
DOUBLE_K = 264,
|
||||
UBYTE_K = 265,
|
||||
USHORT_K = 266,
|
||||
UINT_K = 267,
|
||||
INT64_K = 268,
|
||||
UINT64_K = 269,
|
||||
IDENT = 270,
|
||||
TERMSTRING = 271,
|
||||
CHAR_CONST = 272,
|
||||
BYTE_CONST = 273,
|
||||
SHORT_CONST = 274,
|
||||
INT_CONST = 275,
|
||||
INT64_CONST = 276,
|
||||
UBYTE_CONST = 277,
|
||||
USHORT_CONST = 278,
|
||||
UINT_CONST = 279,
|
||||
UINT64_CONST = 280,
|
||||
FLOAT_CONST = 281,
|
||||
DOUBLE_CONST = 282,
|
||||
DIMENSIONS = 283,
|
||||
VARIABLES = 284,
|
||||
NETCDF = 285,
|
||||
DATA = 286,
|
||||
TYPES = 287,
|
||||
COMPOUND = 288,
|
||||
ENUM = 289,
|
||||
OPAQUE_ = 290,
|
||||
OPAQUESTRING = 291,
|
||||
GROUP = 292,
|
||||
PATH = 293,
|
||||
FILLMARKER = 294,
|
||||
NIL = 295,
|
||||
_FILLVALUE = 296,
|
||||
_FORMAT = 297,
|
||||
_STORAGE = 298,
|
||||
_CHUNKSIZES = 299,
|
||||
_DEFLATELEVEL = 300,
|
||||
_SHUFFLE = 301,
|
||||
_ENDIANNESS = 302,
|
||||
_NOFILL = 303,
|
||||
_FLETCHER32 = 304,
|
||||
_NCPROPS = 305,
|
||||
_ISNETCDF4 = 306,
|
||||
_SUPERBLOCK = 307,
|
||||
DATASETID = 308
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define NC_UNLIMITED_K 258
|
||||
#define CHAR_K 259
|
||||
#define BYTE_K 260
|
||||
#define SHORT_K 261
|
||||
#define INT_K 262
|
||||
#define FLOAT_K 263
|
||||
#define DOUBLE_K 264
|
||||
#define UBYTE_K 265
|
||||
#define USHORT_K 266
|
||||
#define UINT_K 267
|
||||
#define INT64_K 268
|
||||
#define UINT64_K 269
|
||||
#define IDENT 270
|
||||
#define TERMSTRING 271
|
||||
#define CHAR_CONST 272
|
||||
#define BYTE_CONST 273
|
||||
#define SHORT_CONST 274
|
||||
#define INT_CONST 275
|
||||
#define INT64_CONST 276
|
||||
#define UBYTE_CONST 277
|
||||
#define USHORT_CONST 278
|
||||
#define UINT_CONST 279
|
||||
#define UINT64_CONST 280
|
||||
#define FLOAT_CONST 281
|
||||
#define DOUBLE_CONST 282
|
||||
#define DIMENSIONS 283
|
||||
#define VARIABLES 284
|
||||
#define NETCDF 285
|
||||
#define DATA 286
|
||||
#define TYPES 287
|
||||
#define COMPOUND 288
|
||||
#define ENUM 289
|
||||
#define OPAQUE 290
|
||||
#define OPAQUESTRING 291
|
||||
#define GROUP 292
|
||||
#define PATH 293
|
||||
#define FILLMARKER 294
|
||||
#define NIL 295
|
||||
#define _FILLVALUE 296
|
||||
#define _FORMAT 297
|
||||
#define _STORAGE 298
|
||||
#define _CHUNKSIZES 299
|
||||
#define _DEFLATELEVEL 300
|
||||
#define _SHUFFLE 301
|
||||
#define _ENDIANNESS 302
|
||||
#define _NOFILL 303
|
||||
#define _FLETCHER32 304
|
||||
#define _NCPROPS 305
|
||||
#define _ISNETCDF4 306
|
||||
#define _SUPERBLOCK 307
|
||||
#define DATASETID 308
|
||||
|
||||
|
||||
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 136 "ncgen.y"
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 136 "ncgen.y" /* yacc.c:1909 */
|
||||
|
||||
Symbol* sym;
|
||||
unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/
|
||||
long mark; /* track indices into the sequence*/
|
||||
int nctype; /* for tracking attribute list type*/
|
||||
Datalist* datalist;
|
||||
NCConstant constant;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 164 "ncgen.tab.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
#line 117 "ncgeny.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE ncglval;
|
||||
|
||||
int ncgparse (void);
|
||||
|
||||
#endif /* !YY_NCG_NCGEN_TAB_H_INCLUDED */
|
||||
|
Loading…
Reference in New Issue
Block a user