Skip to content

Commit af4324e

Browse files
The file ncgenl.c is #include'd in ncgeny.c.
However, it looks like visual studio is trying to compile ncgenl.c on its own, which of course will fail. So I changed the name to ncgenl.h so it would not be compiled. This appears to fix the bison/flex problems in #366. What I still do not understand is why hdf4 is involved. p.s. Visual Studio is really tenacious about its caches. I had a devil of a time getting it to recognize my changes.
1 parent 7cb0350 commit af4324e

File tree

7 files changed

+1335
-1523
lines changed

7 files changed

+1335
-1523
lines changed

include/nc.h

-7
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ NC_check_id(int ncid, NC **ncpp);
7777
overlap real file descriptors */
7878
extern int nc__pseudofd(void);
7979

80-
/* This function sets a default create flag that will be logically
81-
or'd to whatever flags are passed into nc_create for all future
82-
calls to nc_create.
83-
Valid default create flags are NC_64BIT_OFFSET, NC_CLOBBER,
84-
NC_LOCK, NC_SHARE. */
85-
extern int nc_set_default_format(int format, int *old_formatp);
86-
8780
/* This function gets a current default create flag */
8881
extern int nc_get_default_format(void);
8982

ncgen/CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c offsets.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h )
1+
SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c offsets.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h ncgenl.h ncgeny.h)
22

33
IF(USE_X_GETOPT)
44
SET(ncgen_FILES ${ncgen_FILES} XGetopt.c)
@@ -46,29 +46,29 @@ ENDIF()
4646
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c)
4747
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
4848

49-
# These rules are used if someone wants to rebuild ncgeny.c or ncgenl.c
49+
# These rules are used if someone wants to rebuild ncgeny.c or ncgenl.h
5050
# Otherwise never invoked, but records how to do it.
5151
# BTW: note that renaming is essential because otherwise
5252
# autoconf will forcibly delete files of the name *.tab.*
5353

5454
ADD_CUSTOM_COMMAND(
5555
OUTPUT ncgentab.h
5656
COMMAND flex -Pncg -8 ncgen.l
57-
COMMAND rm -f ncgenl.c
58-
COMMAND mv lex.ncg.c ncgenl.c
57+
COMMAND rm -f ncgenl.h
58+
COMMAND mv lex.ncg.c ncgenl.h
5959

6060
COMMAND bison -pncg -t -d ncgen.y
6161
COMMAND rm -f ncgeny.c ncgeny.h
6262
COMMAND mv ncgen.tab.c ncgeny.c
6363
COMMAND mv ncgen.tab.h ncgeny.h
6464
COMMAND mv ncgeny.h ${CMAKE_CURRENT_SOURCE_DIR}
6565
COMMAND mv ncgeny.c ${CMAKE_CURRENT_SOURCE_DIR}
66-
COMMAND mv ncgenl.c ${CMAKE_CURRENT_SOURCE_DIR}
66+
COMMAND mv ncgenl.h ${CMAKE_CURRENT_SOURCE_DIR}
6767

6868
)
6969
ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h)
7070

7171
## Specify files to be distributed by 'make dist'
7272
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
73-
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenl.c ncgen.l internals.html c0.cdl c0_4.cdl ref_camrun.cdl ncf199.cdl CMakeLists.txt Makefile.am ncgen.1)
73+
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgen.l internals.html c0.cdl c0_4.cdl ref_camrun.cdl ncf199.cdl CMakeLists.txt Makefile.am ncgen.1)
7474
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")

ncgen/ncgen.l

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct Specialtoken specials[] = {
137137

138138
%}
139139
%x ST_C_COMMENT
140-
%x TEXT
140+
%x ARBTEXT
141141
%p 6000
142142

143143
/* The most correct (validating) version of UTF8 character set
@@ -283,7 +283,7 @@ variables: {return lexdebug(VARIABLES);}
283283
data: {return lexdebug(DATA);}
284284
group: {return lexdebug(GROUP);}
285285

286-
(netcdf|NETCDF|netCDF) {BEGIN(TEXT);return lexdebug(NETCDF);}
286+
(netcdf|NETCDF|netCDF) {BEGIN(ARBTEXT);return lexdebug(NETCDF);}
287287

288288
DoubleInf|-?Infinity { /* missing value (pre-2.4 backward compatibility) */
289289
if (yytext[0] == '-') {
@@ -344,7 +344,7 @@ NIL|nil|Nil {
344344
return 0;
345345
}
346346

347-
<TEXT>{DATASETID} {
347+
<ARBTEXT>{DATASETID} {
348348
int c;
349349
char* p; char* q;
350350
/* copy the trimmed name */

ncgen/ncgen.y

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ unsigned long size; /* allow for zero size to indicate e.g. UNLIMITED*/
139139
long mark; /* track indices into the sequence*/
140140
int nctype; /* for tracking attribute list type*/
141141
Datalist* datalist;
142-
NCConstant constant;
142+
NCConstant ncconstant;
143143
}
144144

145145
%token <sym>
@@ -202,8 +202,8 @@ NCConstant constant;
202202
%type <sym> type_var_ref
203203
%type <mark> enumidlist fieldlist fields varlist dimspec dimlist field
204204
fielddimspec fielddimlist
205-
%type <constant> dataitem constdata constint conststring constbool
206-
%type <constant> simpleconstant function econstref
205+
%type <ncconstant> dataitem constdata constint conststring constbool
206+
%type <ncconstant> simpleconstant function econstref
207207
%type <datalist> datalist intlist datalist1 datalist0 arglist
208208

209209

@@ -894,7 +894,7 @@ ncgwrap(void) /* returns 1 on EOF if no more input */
894894
}
895895

896896
/* get lexical input routine generated by lex */
897-
#include "ncgenl.c"
897+
#include "ncgenl.h"
898898

899899
/* Really should init our data within this file */
900900
void

0 commit comments

Comments
 (0)