mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
When ncgen is invoked without a -k flag,
it tries to infer the file kind based on the constructs and types used in the .cdl file. Previously, it included cdf5 as an inferrable kind, but this is almost never what is wanted. So limit inferable kinds to netcdf classic vs netcdf enhanced. Also fix tst_inttags4.sh test.
This commit is contained in:
parent
15263f7a95
commit
ddacf2db38
@ -5,7 +5,7 @@ variables:
|
||||
ubyte ub(d) ;
|
||||
ushort us(d) ;
|
||||
uint ui(d) ;
|
||||
int i64(d) ;
|
||||
int64 i64(d) ;
|
||||
uint64 ui64(d) ;
|
||||
|
||||
// global attributes:
|
||||
@ -18,7 +18,7 @@ data:
|
||||
|
||||
ui = 4294967294, 4294967294, 4294967294 ;
|
||||
|
||||
i64 = -1, -1, -1 ;
|
||||
i64 = 9223372036854775807, 9223372036854775807, 9223372036854775807 ;
|
||||
|
||||
ui64 = 18446744073709551615, 18446744073709551615, 18446744073709551615 ;
|
||||
}
|
||||
|
16
ncgen/main.c
16
ncgen/main.c
@ -506,7 +506,7 @@ main(
|
||||
#endif
|
||||
|
||||
if(l_flag == L_JAVA || l_flag == L_F77) {
|
||||
k_flag = 1;
|
||||
k_flag = NC_FORMAT_CLASSIC;
|
||||
if(enhanced_flag) {
|
||||
derror("Java or Fortran requires classic model CDL input");
|
||||
return 0;
|
||||
@ -517,12 +517,12 @@ main(
|
||||
k_flag = globalspecials._Format;
|
||||
|
||||
if(cdf5_flag && !enhanced_flag && k_flag == 0)
|
||||
k_flag = 5;
|
||||
k_flag = NC_FORMAT_64BIT_DATA;
|
||||
if(enhanced_flag && k_flag == 0)
|
||||
k_flag = 3;
|
||||
k_flag = NC_FORMAT_NETCDF4;
|
||||
|
||||
if(enhanced_flag && k_flag != 3) {
|
||||
if(enhanced_flag && k_flag != 3 && k_flag != 5) {
|
||||
if(enhanced_flag && k_flag != NC_FORMAT_NETCDF4) {
|
||||
if(enhanced_flag && k_flag != NC_FORMAT_NETCDF4 && k_flag != NC_FORMAT_64BIT_DATA) {
|
||||
derror("-k or _Format conflicts with enhanced CDL input");
|
||||
return 0;
|
||||
}
|
||||
@ -530,13 +530,13 @@ main(
|
||||
|
||||
if(specials_flag > 0 && k_flag == 0)
|
||||
#ifdef USE_NETCDF4
|
||||
k_flag = 3;
|
||||
k_flag = NC_FORMAT_NETCDF4;
|
||||
#else
|
||||
k_flag = 1;
|
||||
k_flag = NC_FORMAT_CLASSIC;
|
||||
#endif
|
||||
|
||||
if(k_flag == 0)
|
||||
k_flag = 1;
|
||||
k_flag = NC_FORMAT_CLASSIC;
|
||||
|
||||
/* Figure out usingclassic */
|
||||
switch (k_flag) {
|
||||
|
@ -1394,15 +1394,19 @@ datalistextend(Datalist* dl, NCConstant* con)
|
||||
dlappend(dl,con);
|
||||
}
|
||||
|
||||
/*
|
||||
Try to infer the file type from the
|
||||
kinds of constructs used in the cdl file.
|
||||
*/
|
||||
static void
|
||||
vercheck(int tid)
|
||||
{
|
||||
switch (tid) {
|
||||
case NC_UBYTE: markcdf5("netCDF4/5 type: UBYTE"); break;
|
||||
case NC_USHORT: markcdf5("netCDF4/5 type: USHORT"); break;
|
||||
case NC_UINT: markcdf5("netCDF4/5 type: UINT"); break;
|
||||
case NC_INT64: markcdf5("netCDF4/5 type: INT64"); break;
|
||||
case NC_UINT64: markcdf5("netCDF4/5 type: UINT64"); break;
|
||||
case NC_UBYTE: markcdf4("netCDF4/5 type: UBYTE"); break;
|
||||
case NC_USHORT: markcdf4("netCDF4/5 type: USHORT"); break;
|
||||
case NC_UINT: markcdf4("netCDF4/5 type: UINT"); break;
|
||||
case NC_INT64: markcdf4("netCDF4/5 type: INT64"); break;
|
||||
case NC_UINT64: markcdf4("netCDF4/5 type: UINT64"); break;
|
||||
case NC_STRING: markcdf4("netCDF4 type: STRING"); break;
|
||||
case NC_VLEN: markcdf4("netCDF4 type: VLEN"); break;
|
||||
case NC_OPAQUE: markcdf4("netCDF4 type: OPAQUE"); break;
|
||||
|
197
ncgen/ncgenl.c
197
ncgen/ncgenl.c
@ -26,8 +26,8 @@
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 0
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
@ -72,6 +72,7 @@ typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
#endif /* ! C99 */
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t;
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* The state buf must be large enough to hold one state per character in the main buffer.
|
||||
@ -180,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;
|
||||
|
||||
@ -194,7 +180,6 @@ extern FILE *ncgin, *ncgout;
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
#define YY_LINENO_REWIND_TO(ptr)
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
@ -212,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
|
||||
@ -300,7 +290,7 @@ 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 int yy_n_chars; /* number of characters read into yy_ch_buf */
|
||||
yy_size_t ncgleng;
|
||||
int ncgleng;
|
||||
|
||||
/* Points to current character in buffer. */
|
||||
static char *yy_c_buf_p = (char *) 0;
|
||||
@ -328,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 );
|
||||
@ -371,17 +361,11 @@ extern int ncglineno;
|
||||
int ncglineno = 1;
|
||||
|
||||
extern char *ncgtext;
|
||||
#ifdef yytext_ptr
|
||||
#undef yytext_ptr
|
||||
#endif
|
||||
#define yytext_ptr ncgtext
|
||||
|
||||
static yy_state_type yy_get_previous_state (void );
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
|
||||
static int yy_get_next_buffer (void );
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
__attribute__((__noreturn__))
|
||||
#endif
|
||||
static void yy_fatal_error (yyconst char msg[] );
|
||||
|
||||
/* Done after the current pattern has been matched and before the
|
||||
@ -453,7 +437,7 @@ static yyconst flex_int16_t yy_accept[417] =
|
||||
34, 34, 34, 34, 34, 0
|
||||
} ;
|
||||
|
||||
static yyconst YY_CHAR yy_ec[256] =
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
||||
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -485,7 +469,7 @@ static yyconst YY_CHAR yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst YY_CHAR yy_meta[69] =
|
||||
static yyconst flex_int32_t yy_meta[69] =
|
||||
{ 0,
|
||||
1, 1, 2, 1, 1, 1, 3, 4, 5, 5,
|
||||
6, 7, 8, 8, 8, 8, 8, 8, 8, 1,
|
||||
@ -496,7 +480,7 @@ static yyconst YY_CHAR yy_meta[69] =
|
||||
11, 11, 11, 14, 1, 11, 11, 11
|
||||
} ;
|
||||
|
||||
static yyconst flex_uint16_t yy_base[435] =
|
||||
static yyconst flex_int16_t yy_base[435] =
|
||||
{ 0,
|
||||
0, 0, 325, 321, 264, 255, 318, 2347, 67, 2347,
|
||||
64, 269, 61, 62, 95, 77, 136, 259, 51, 61,
|
||||
@ -600,7 +584,7 @@ static yyconst flex_int16_t yy_def[435] =
|
||||
416, 416, 416, 416
|
||||
} ;
|
||||
|
||||
static yyconst flex_uint16_t yy_nxt[2416] =
|
||||
static yyconst flex_int16_t yy_nxt[2416] =
|
||||
{ 0,
|
||||
8, 9, 10, 9, 8, 11, 12, 8, 13, 14,
|
||||
15, 16, 17, 18, 18, 18, 18, 18, 18, 8,
|
||||
@ -1335,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 1339 "ncgenl.c"
|
||||
#line 1323 "ncgenl.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define ST_C_COMMENT 1
|
||||
@ -1370,19 +1354,19 @@ void ncgset_extra (YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *ncgget_in (void );
|
||||
|
||||
void ncgset_in (FILE * _in_str );
|
||||
void ncgset_in (FILE * in_str );
|
||||
|
||||
FILE *ncgget_out (void );
|
||||
|
||||
void ncgset_out (FILE * _out_str );
|
||||
void ncgset_out (FILE * out_str );
|
||||
|
||||
yy_size_t ncgget_leng (void );
|
||||
int ncgget_leng (void );
|
||||
|
||||
char *ncgget_text (void );
|
||||
|
||||
int ncgget_lineno (void );
|
||||
|
||||
void ncgset_lineno (int _line_number );
|
||||
void ncgset_lineno (int line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
@ -1396,12 +1380,8 @@ extern int ncgwrap (void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
static void yyunput (int c,char *buf_ptr );
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
#endif
|
||||
@ -1422,12 +1402,7 @@ static int input (void );
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Copy whatever the last rule matched to the standard output. */
|
||||
@ -1435,7 +1410,7 @@ static int input (void );
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
|
||||
#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout )
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
@ -1446,7 +1421,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
size_t n; \
|
||||
int n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1514,7 +1489,7 @@ extern int ncglex (void);
|
||||
|
||||
/* Code executed at the end of each rule. */
|
||||
#ifndef YY_BREAK
|
||||
#define YY_BREAK /*LINTED*/break;
|
||||
#define YY_BREAK break;
|
||||
#endif
|
||||
|
||||
#define YY_RULE_SETUP \
|
||||
@ -1524,10 +1499,14 @@ extern int ncglex (void);
|
||||
*/
|
||||
YY_DECL
|
||||
{
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp, *yy_bp;
|
||||
int yy_act;
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 217 "ncgen.l"
|
||||
|
||||
#line 1509 "ncgenl.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
(yy_init) = 1;
|
||||
@ -1554,12 +1533,7 @@ YY_DECL
|
||||
ncg_load_buffer_state( );
|
||||
}
|
||||
|
||||
{
|
||||
#line 217 "ncgen.l"
|
||||
|
||||
#line 1561 "ncgenl.c"
|
||||
|
||||
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
||||
while ( 1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
yy_cp = (yy_c_buf_p);
|
||||
|
||||
@ -1575,7 +1549,7 @@ YY_DECL
|
||||
yy_match:
|
||||
do
|
||||
{
|
||||
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
@ -2144,7 +2118,7 @@ YY_RULE_SETUP
|
||||
#line 570 "ncgen.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 2148 "ncgenl.c"
|
||||
#line 2122 "ncgenl.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(TEXT):
|
||||
yyterminate();
|
||||
@ -2276,7 +2250,6 @@ case YY_STATE_EOF(TEXT):
|
||||
"fatal flex scanner internal error--no action found" );
|
||||
} /* end of action switch */
|
||||
} /* end of scanning one token */
|
||||
} /* end of user's declarations */
|
||||
} /* end of ncglex */
|
||||
|
||||
/* yy_get_next_buffer - try to read in a new buffer
|
||||
@ -2288,9 +2261,9 @@ case YY_STATE_EOF(TEXT):
|
||||
*/
|
||||
static int yy_get_next_buffer (void)
|
||||
{
|
||||
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
char *source = (yytext_ptr);
|
||||
yy_size_t number_to_move, i;
|
||||
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
register char *source = (yytext_ptr);
|
||||
register int number_to_move, i;
|
||||
int ret_val;
|
||||
|
||||
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
|
||||
@ -2319,7 +2292,7 @@ static int yy_get_next_buffer (void)
|
||||
/* Try to read more data. */
|
||||
|
||||
/* First move last chars to start of buffer. */
|
||||
number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
|
||||
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
|
||||
|
||||
for ( i = 0; i < number_to_move; ++i )
|
||||
*(dest++) = *(source++);
|
||||
@ -2332,21 +2305,21 @@ 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 )
|
||||
{ /* Not enough room in the buffer - grow it. */
|
||||
|
||||
/* just a shorter name for the current buffer */
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
|
||||
|
||||
int yy_c_buf_p_offset =
|
||||
(int) ((yy_c_buf_p) - b->yy_ch_buf);
|
||||
|
||||
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;
|
||||
@ -2377,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);
|
||||
}
|
||||
@ -2401,9 +2374,9 @@ static int yy_get_next_buffer (void)
|
||||
else
|
||||
ret_val = EOB_ACT_CONTINUE_SCAN;
|
||||
|
||||
if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
||||
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
||||
/* Extend the array by 50%, plus the number we really need. */
|
||||
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
|
||||
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
|
||||
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
||||
@ -2422,14 +2395,14 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
static yy_state_type yy_get_previous_state (void)
|
||||
{
|
||||
yy_state_type yy_current_state;
|
||||
char *yy_cp;
|
||||
register yy_state_type yy_current_state;
|
||||
register char *yy_cp;
|
||||
|
||||
yy_current_state = (yy_start);
|
||||
|
||||
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
|
||||
{
|
||||
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
@ -2454,10 +2427,10 @@ static int yy_get_next_buffer (void)
|
||||
*/
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
|
||||
{
|
||||
int yy_is_jam;
|
||||
char *yy_cp = (yy_c_buf_p);
|
||||
register int yy_is_jam;
|
||||
register char *yy_cp = (yy_c_buf_p);
|
||||
|
||||
YY_CHAR yy_c = 1;
|
||||
register YY_CHAR yy_c = 1;
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
@ -2472,14 +2445,12 @@ static int yy_get_next_buffer (void)
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 416);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
static void yyunput (int c, char * yy_bp )
|
||||
static void yyunput (int c, register char * yy_bp )
|
||||
{
|
||||
char *yy_cp;
|
||||
register char *yy_cp;
|
||||
|
||||
yy_cp = (yy_c_buf_p);
|
||||
|
||||
@ -2489,10 +2460,10 @@ 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. */
|
||||
yy_size_t number_to_move = (yy_n_chars) + 2;
|
||||
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
|
||||
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];
|
||||
char *source =
|
||||
register char *source =
|
||||
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
|
||||
|
||||
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
||||
@ -2514,8 +2485,6 @@ static int yy_get_next_buffer (void)
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
#ifdef __cplusplus
|
||||
static int yyinput (void)
|
||||
@ -2540,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( ) )
|
||||
@ -2665,7 +2634,7 @@ static void ncg_load_buffer_state (void)
|
||||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" );
|
||||
|
||||
b->yy_buf_size = (yy_size_t)size;
|
||||
b->yy_buf_size = size;
|
||||
|
||||
/* yy_ch_buf has to be 2 characters longer than the size given because
|
||||
* we need to put in 2 end-of-buffer characters.
|
||||
@ -2700,6 +2669,10 @@ static void ncg_load_buffer_state (void)
|
||||
ncgfree((void *) b );
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
extern int isatty (int );
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Initializes or reinitializes a buffer.
|
||||
* This function is sometimes called more than once on the same buffer,
|
||||
* such as during a ncgrestart() or at EOF.
|
||||
@ -2812,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)) {
|
||||
|
||||
@ -2820,7 +2793,7 @@ static void ncgensure_buffer_stack (void)
|
||||
* scanner will even need a stack. We use 2 instead of 1 to avoid an
|
||||
* immediate realloc on the next call.
|
||||
*/
|
||||
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
|
||||
num_to_alloc = 1;
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
);
|
||||
@ -2837,7 +2810,7 @@ static void ncgensure_buffer_stack (void)
|
||||
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
|
||||
|
||||
/* Increase the buffer to prepare for a possible push. */
|
||||
yy_size_t grow_size = 8 /* arbitrary grow size */;
|
||||
int grow_size = 8 /* arbitrary grow size */;
|
||||
|
||||
num_to_alloc = (yy_buffer_stack_max) + grow_size;
|
||||
(yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc
|
||||
@ -2904,17 +2877,17 @@ YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr )
|
||||
|
||||
/** Setup the input buffer state to scan the given bytes. The next call to ncglex() will
|
||||
* 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.
|
||||
* @param bytes the byte buffer to scan
|
||||
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
||||
*
|
||||
* @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;
|
||||
yy_size_t i;
|
||||
int i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
@ -2945,7 +2918,7 @@ YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
|
||||
|
||||
static void yy_fatal_error (yyconst char* msg )
|
||||
{
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
exit( YY_EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -2996,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;
|
||||
}
|
||||
@ -3011,29 +2984,29 @@ char *ncgget_text (void)
|
||||
}
|
||||
|
||||
/** Set the current line number.
|
||||
* @param _line_number line number
|
||||
* @param line_number
|
||||
*
|
||||
*/
|
||||
void ncgset_lineno (int _line_number )
|
||||
void ncgset_lineno (int line_number )
|
||||
{
|
||||
|
||||
ncglineno = _line_number;
|
||||
ncglineno = line_number;
|
||||
}
|
||||
|
||||
/** Set the input stream. This does not discard the current
|
||||
* input buffer.
|
||||
* @param _in_str A readable stream.
|
||||
* @param in_str A readable stream.
|
||||
*
|
||||
* @see ncg_switch_to_buffer
|
||||
*/
|
||||
void ncgset_in (FILE * _in_str )
|
||||
void ncgset_in (FILE * in_str )
|
||||
{
|
||||
ncgin = _in_str ;
|
||||
ncgin = in_str ;
|
||||
}
|
||||
|
||||
void ncgset_out (FILE * _out_str )
|
||||
void ncgset_out (FILE * out_str )
|
||||
{
|
||||
ncgout = _out_str ;
|
||||
ncgout = out_str ;
|
||||
}
|
||||
|
||||
int ncgget_debug (void)
|
||||
@ -3041,9 +3014,9 @@ int ncgget_debug (void)
|
||||
return ncg_flex_debug;
|
||||
}
|
||||
|
||||
void ncgset_debug (int _bdebug )
|
||||
void ncgset_debug (int bdebug )
|
||||
{
|
||||
ncg_flex_debug = _bdebug ;
|
||||
ncg_flex_debug = bdebug ;
|
||||
}
|
||||
|
||||
static int yy_init_globals (void)
|
||||
@ -3103,8 +3076,7 @@ int ncglex_destroy (void)
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
|
||||
{
|
||||
|
||||
int i;
|
||||
register int i;
|
||||
for ( i = 0; i < n; ++i )
|
||||
s1[i] = s2[i];
|
||||
}
|
||||
@ -3113,7 +3085,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * s )
|
||||
{
|
||||
int n;
|
||||
register int n;
|
||||
for ( n = 0; s[n]; ++n )
|
||||
;
|
||||
|
||||
@ -3123,12 +3095,11 @@ static int yy_flex_strlen (yyconst char * s )
|
||||
|
||||
void *ncgalloc (yy_size_t size )
|
||||
{
|
||||
return (void *) malloc( size );
|
||||
return (void *) malloc( size );
|
||||
}
|
||||
|
||||
void *ncgrealloc (void * ptr, yy_size_t size )
|
||||
{
|
||||
|
||||
/* The cast to (char *) in the following accommodates both
|
||||
* implementations that use char* generic pointers, and those
|
||||
* that use void* generic pointers. It works with the latter
|
||||
@ -3141,7 +3112,7 @@ void *ncgrealloc (void * ptr, yy_size_t size )
|
||||
|
||||
void ncgfree (void * ptr )
|
||||
{
|
||||
free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */
|
||||
free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */
|
||||
}
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
@ -3401,15 +3401,19 @@ datalistextend(Datalist* dl, NCConstant* con)
|
||||
dlappend(dl,con);
|
||||
}
|
||||
|
||||
/*
|
||||
Try to infer the file type from the
|
||||
kinds of constructs used in the cdl file.
|
||||
*/
|
||||
static void
|
||||
vercheck(int tid)
|
||||
{
|
||||
switch (tid) {
|
||||
case NC_UBYTE: markcdf5("netCDF4/5 type: UBYTE"); break;
|
||||
case NC_USHORT: markcdf5("netCDF4/5 type: USHORT"); break;
|
||||
case NC_UINT: markcdf5("netCDF4/5 type: UINT"); break;
|
||||
case NC_INT64: markcdf5("netCDF4/5 type: INT64"); break;
|
||||
case NC_UINT64: markcdf5("netCDF4/5 type: UINT64"); break;
|
||||
case NC_UBYTE: markcdf4("netCDF4/5 type: UBYTE"); break;
|
||||
case NC_USHORT: markcdf4("netCDF4/5 type: USHORT"); break;
|
||||
case NC_UINT: markcdf4("netCDF4/5 type: UINT"); break;
|
||||
case NC_INT64: markcdf4("netCDF4/5 type: INT64"); break;
|
||||
case NC_UINT64: markcdf4("netCDF4/5 type: UINT64"); break;
|
||||
case NC_STRING: markcdf4("netCDF4 type: STRING"); break;
|
||||
case NC_VLEN: markcdf4("netCDF4 type: VLEN"); break;
|
||||
case NC_OPAQUE: markcdf4("netCDF4 type: OPAQUE"); break;
|
||||
|
Loading…
Reference in New Issue
Block a user