diff --git a/cxx/Makefile.am b/cxx/Makefile.am index 28c493c6f..c42e9975e 100644 --- a/cxx/Makefile.am +++ b/cxx/Makefile.am @@ -12,7 +12,7 @@ # c++ -c -g -O2 -I../libsrc -I. -Df2cFortran nctst.cpp # c++ -o nctst -g -O2 nctst.o libnetcdf_c++.a -L../libsrc -lnetcdf -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = CLEANFILES = nctst_classic.nc nctst_64bit_offset.nc nctst_netcdf4.nc \ diff --git a/examples/CXX/Makefile.am b/examples/CXX/Makefile.am index a90774467..ed0fb0855 100644 --- a/examples/CXX/Makefile.am +++ b/examples/CXX/Makefile.am @@ -7,7 +7,7 @@ # We will need to find the C++ header files. AM_CXXFLAGS = -I$(top_srcdir)/cxx -AM_CPPFLAGS = -I$(top_srcdir)/cxx +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cxx AM_LDFLAGS= LDADD = diff --git a/examples/F90/Makefile.am b/examples/F90/Makefile.am index 3b5856b10..3310aa996 100644 --- a/examples/F90/Makefile.am +++ b/examples/F90/Makefile.am @@ -16,7 +16,7 @@ AM_LDFLAGS = # Tell the compiler where to find the .mod files. The .mod file is # built, and therefore found in the build directory, not the source # directory. -AM_FCFLAGS += -I$(top_srcdir)/fortran -I$(top_builddir)/f90 @MOD_FLAG@$(top_builddir)/f90 +AM_FCFLAGS += -I$(top_srcdir) -I$(top_srcdir)/fortran -I$(top_builddir)/f90 @MOD_FLAG@$(top_builddir)/f90 AM_FFLAGS += ${AM_FCFLAGS} if BUILD_SEPARATE_FORTRAN diff --git a/fortran/Makefile.am b/fortran/Makefile.am index 2d5cd501f..ef7672e81 100644 --- a/fortran/Makefile.am +++ b/fortran/Makefile.am @@ -5,7 +5,7 @@ # $Id: Makefile.am,v 1.60 2010/05/29 00:21:22 dmh Exp $ -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = # May need to set this. libnetcdff_la_LIBADD = diff --git a/libdispatch/Makefile.am b/libdispatch/Makefile.am index 4057fb313..0d9697da7 100755 --- a/libdispatch/Makefile.am +++ b/libdispatch/Makefile.am @@ -22,7 +22,7 @@ endif EXTRA_DIST = netcdf.c # Set up include directories. -AM_CPPFLAGS = -I${top_srcdir}/liblib -I${top_srcdir}/libsrc +AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/liblib -I${top_srcdir}/libsrc if USE_DAP AM_CPPFLAGS += -I${top_srcdir}/oc endif diff --git a/liblib/Makefile.am b/liblib/Makefile.am index df0f7c9bf..9416aaea6 100755 --- a/liblib/Makefile.am +++ b/liblib/Makefile.am @@ -9,7 +9,7 @@ # $Id: Makefile.am,v 1.13 2010/06/01 15:34:50 ed Exp $ AM_LDFLAGS = -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) # This is our output lib_LTLIBRARIES = libnetcdf.la diff --git a/libncdap3/Makefile.am b/libncdap3/Makefile.am index 9721c2337..ad4450166 100755 --- a/libncdap3/Makefile.am +++ b/libncdap3/Makefile.am @@ -15,7 +15,7 @@ LDADD= #CURL_CFLAGS = @CURL_CFLAGS@ #AM_CPPFLAGS = ${CURL_CFLAGS} #AM_LDFLAGS = $(CURL_LIBS) -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = # DRNO Sources diff --git a/libncdap4/Makefile.am b/libncdap4/Makefile.am index b8b57199c..fef7717bd 100755 --- a/libncdap4/Makefile.am +++ b/libncdap4/Makefile.am @@ -10,7 +10,7 @@ DISTCLEANFILES = CLEANFILES = LDADD= -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am index b03a4a9c5..157ec9321 100644 --- a/libsrc/Makefile.am +++ b/libsrc/Makefile.am @@ -76,7 +76,7 @@ endif # BUILD_V2 if USE_DISPATCH -AM_CPPFLAGS += -I${top_srcdir}/liblib +AM_CPPFLAGS += -I${top_srcdir} -I${top_srcdir}/liblib AM_CPPFLAGS += -I${top_srcdir}/libsrc -I${top_srcdir}/libdispatch -I${top_srcdir}/oc @@ -194,14 +194,8 @@ endif check_PROGRAMS = $(TESTPROGRAMS) TESTS = $(TESTPROGRAMS) -# If building a DLL, the test program needs to define DLL_NETCDF. -if BUILD_DLL -t_nc_CPPFLAGS = -DDLL_NETCDF -endif - CLEANFILES += t_nc - # These files are cleaned on developer workstations (and then rebuilt # with m4), but they are included in the distribution so that the user # does not have to have m4. diff --git a/libsrc/ncx.h b/libsrc/ncx.h index b2bd6a2e1..98f17c23e 100644 --- a/libsrc/ncx.h +++ b/libsrc/ncx.h @@ -105,7 +105,6 @@ typedef unsigned char uchar; #define X_INT_MIN (-2147483647-1) #define X_INT_MAX 2147483647 #define X_UINT_MAX 4294967295U -#define X_INT64_MAX 9223372036854775807LL #define X_FLOAT_MAX 3.402823466e+38f #define X_FLOAT_MIN (-X_FLOAT_MAX) #define X_FLT_MAX X_FLOAT_MAX /* alias compatible with limits.h */ diff --git a/libsrc4/Makefile.am b/libsrc4/Makefile.am index 92bc6ca48..014c253b2 100644 --- a/libsrc4/Makefile.am +++ b/libsrc4/Makefile.am @@ -8,7 +8,7 @@ # $Id: Makefile.am,v 1.194 2010/06/01 15:34:50 ed Exp $ # Initialize -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = LDADD = libnetcdf_la_LIBADD = diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 926219f9f..a1bb279ec 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -10,7 +10,7 @@ if USE_NETCDF4 AM_LDFLAGS = ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@ -AM_CPPFLAGS = -I$(top_builddir)/liblib @EXTERN_CFLAGS@ +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/liblib @EXTERN_CFLAGS@ # Unfortunately, libsrc4 contains nc_test.h AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index c293ddef6..4d92704ea 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -7,7 +7,7 @@ LDADD = -lm AM_LDFLAGS = -AM_CPPFLAGS = -I$(top_srcdir)/nc_test +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/nc_test LDADD += ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@ AM_CPPFLAGS += -I${top_srcdir}/liblib @EXTERN_CPPFLAGS@ diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index 9a5006584..fca988c5c 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -31,7 +31,7 @@ TESTS = run_tests.sh CLEANFILES = c0.nc c0_64.nc AM_LDFLAGS = -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) LDADD = ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@ AM_CPPFLAGS += -I${top_srcdir}/liblib @EXTERN_CPPFLAGS@ diff --git a/ncgen3/Makefile.am b/ncgen3/Makefile.am index 05a1a8aea..c574ef949 100644 --- a/ncgen3/Makefile.am +++ b/ncgen3/Makefile.am @@ -4,8 +4,8 @@ # $Id: Makefile.am,v 1.54 2010/05/29 00:42:11 dmh Exp $ -AM_LDFLAGS = -AM_CPPFLAGS = +AM_LDFLAGS = +AM_CPPFLAGS = -I${top_srcdir} LDADD = LDADD += ${top_builddir}/liblib/libnetcdf.la @EXTERN_LDFLAGS@ diff --git a/nctest/Makefile.am b/nctest/Makefile.am index 844464ceb..4f009b317 100644 --- a/nctest/Makefile.am +++ b/nctest/Makefile.am @@ -8,7 +8,7 @@ # One of the tests needs the math library for some reason. LDADD = -lm -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_LDFLAGS = AM_CPPFLAGS += -I$(top_builddir)/liblib diff --git a/nf_test/Makefile.am b/nf_test/Makefile.am index 41159dac8..cd1b36c3f 100644 --- a/nf_test/Makefile.am +++ b/nf_test/Makefile.am @@ -20,7 +20,7 @@ LDADD = AM_LDFLAGS = AM_CFLAGS = -AM_CPPFLAGS = +AM_CPPFLAGS = -I$(top_srcdir) AM_FFLAGS = AM_FCFLAGS = TESTS = diff --git a/oc/Makefile.am b/oc/Makefile.am index 12bfd5362..f286984b0 100755 --- a/oc/Makefile.am +++ b/oc/Makefile.am @@ -8,7 +8,7 @@ # $Id: Makefile.am,v 1.1 2010/05/23 21:05:33 dmh Exp $ # Cause C preprocessor to search current and parent directory. -AM_CPPFLAGS = -I$(top_srcdir)/libsrc +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libsrc # Linker needs to search current directory when building tests. AM_LDFLAGS = diff --git a/udunits/lib/parser.c b/udunits/lib/parser.c index 40e53486e..9fd44ea2f 100644 --- a/udunits/lib/parser.c +++ b/udunits/lib/parser.c @@ -1,22 +1,24 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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, see . */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -27,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -45,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.2" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -53,28 +55,57 @@ /* Pure parsers. */ #define YYPURE 0 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse utparse -#define yylex utlex -#define yyerror uterror -#define yylval utlval -#define yychar utchar -#define yydebug utdebug -#define yynerrs utnerrs +#define yyparse utparse +#define yylex utlex +#define yyerror uterror +#define yylval utlval +#define yychar utchar +#define yydebug utdebug +#define yynerrs utnerrs + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ERR = 258, + SHIFT = 259, + MULTIPLY = 260, + DIVIDE = 261, + INT = 262, + EXPONENT = 263, + REAL = 264, + ID = 265, + DATE = 266, + CLOCK = 267, + TIMESTAMP = 268, + LOGREF = 269 + }; +#endif +/* Tokens. */ +#define ERR 258 +#define SHIFT 259 +#define MULTIPLY 260 +#define DIVIDE 261 +#define INT 262 +#define EXPONENT 263 +#define REAL 264 +#define ID 265 +#define DATE 266 +#define CLOCK 267 +#define TIMESTAMP 268 +#define LOGREF 269 + + /* Copy the first part of user declarations. */ - -/* Line 189 of yacc.c */ #line 1 "parser.y" /* @@ -178,9 +209,6 @@ uterror( } -/* Line 189 of yacc.c */ -#line 183 "parser.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -199,72 +227,30 @@ uterror( # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ERR = 258, - SHIFT = 259, - MULTIPLY = 260, - DIVIDE = 261, - INT = 262, - EXPONENT = 263, - REAL = 264, - ID = 265, - DATE = 266, - CLOCK = 267, - TIMESTAMP = 268, - LOGREF = 269 - }; -#endif -/* Tokens. */ -#define ERR 258 -#define SHIFT 259 -#define MULTIPLY 260 -#define DIVIDE 261 -#define INT 262 -#define EXPONENT 263 -#define REAL 264 -#define ID 265 -#define DATE 266 -#define CLOCK 267 -#define TIMESTAMP 268 -#define LOGREF 269 - - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -{ - -/* Line 214 of yacc.c */ #line 103 "parser.y" - +{ char* id; /* identifier */ ut_unit* unit; /* "unit" structure */ double rval; /* floating-point numerical value */ long ival; /* integer numerical value */ - - - -/* Line 214 of yacc.c */ -#line 256 "parser.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 187 of yacc.c. */ +#line 241 "parser.c" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 268 "parser.c" +/* Line 216 of yacc.c. */ +#line 254 "parser.c" #ifdef short # undef short @@ -314,7 +300,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -339,14 +325,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -427,9 +413,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -463,12 +449,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -685,18 +671,9 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -753,7 +730,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -864,20 +841,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -911,11 +885,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1195,8 +1169,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1212,10 +1188,11 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ -/* The lookahead symbol. */ + +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1223,9 +1200,9 @@ int yynerrs; -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1249,39 +1226,14 @@ yyparse () #endif #endif { - - - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - + + int yystate; int yyn; int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1289,28 +1241,51 @@ yyparse () YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ + yyssp = yyss; yyvsp = yyvs; @@ -1340,6 +1315,7 @@ yyparse () YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1347,6 +1323,7 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1369,8 +1346,9 @@ yyparse () (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1381,6 +1359,7 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1390,9 +1369,6 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1401,16 +1377,16 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1442,16 +1418,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1491,8 +1471,6 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1464 of yacc.c */ #line 133 "parser.y" { _finalUnit = ut_get_dimensionless_unit_one(_unitSystem); @@ -1501,8 +1479,6 @@ yyreduce: break; case 3: - -/* Line 1464 of yacc.c */ #line 137 "parser.y" { _finalUnit = (yyvsp[(1) - (1)].unit); @@ -1511,8 +1487,6 @@ yyreduce: break; case 4: - -/* Line 1464 of yacc.c */ #line 141 "parser.y" { ut_set_status(UT_SYNTAX); @@ -1521,8 +1495,6 @@ yyreduce: break; case 5: - -/* Line 1464 of yacc.c */ #line 147 "parser.y" { (yyval.unit) = (yyvsp[(1) - (1)].unit); @@ -1530,8 +1502,6 @@ yyreduce: break; case 6: - -/* Line 1464 of yacc.c */ #line 150 "parser.y" { (yyval.unit) = ut_offset((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].rval)); @@ -1544,8 +1514,6 @@ yyreduce: break; case 7: - -/* Line 1464 of yacc.c */ #line 158 "parser.y" { (yyval.unit) = ut_offset((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].ival)); @@ -1558,8 +1526,6 @@ yyreduce: break; case 8: - -/* Line 1464 of yacc.c */ #line 166 "parser.y" { (yyval.unit) = ut_offset_by_time((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].rval)); @@ -1572,8 +1538,6 @@ yyreduce: break; case 9: - -/* Line 1464 of yacc.c */ #line 176 "parser.y" { (yyval.unit) = (yyvsp[(1) - (1)].unit); @@ -1581,8 +1545,6 @@ yyreduce: break; case 10: - -/* Line 1464 of yacc.c */ #line 179 "parser.y" { (yyval.unit) = ut_multiply((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].unit)); @@ -1596,8 +1558,6 @@ yyreduce: break; case 11: - -/* Line 1464 of yacc.c */ #line 188 "parser.y" { (yyval.unit) = ut_multiply((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].unit)); @@ -1611,8 +1571,6 @@ yyreduce: break; case 12: - -/* Line 1464 of yacc.c */ #line 197 "parser.y" { (yyval.unit) = ut_divide((yyvsp[(1) - (3)].unit), (yyvsp[(3) - (3)].unit)); @@ -1626,8 +1584,6 @@ yyreduce: break; case 13: - -/* Line 1464 of yacc.c */ #line 208 "parser.y" { (yyval.unit) = (yyvsp[(1) - (1)].unit); @@ -1635,8 +1591,6 @@ yyreduce: break; case 14: - -/* Line 1464 of yacc.c */ #line 211 "parser.y" { (yyval.unit) = ut_raise((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].ival)); @@ -1649,8 +1603,6 @@ yyreduce: break; case 15: - -/* Line 1464 of yacc.c */ #line 219 "parser.y" { (yyval.unit) = ut_raise((yyvsp[(1) - (2)].unit), (yyvsp[(2) - (2)].ival)); @@ -1663,8 +1615,6 @@ yyreduce: break; case 16: - -/* Line 1464 of yacc.c */ #line 229 "parser.y" { double prefix = 1; @@ -1717,8 +1667,6 @@ yyreduce: break; case 17: - -/* Line 1464 of yacc.c */ #line 277 "parser.y" { (yyval.unit) = (yyvsp[(2) - (3)].unit); @@ -1726,8 +1674,6 @@ yyreduce: break; case 18: - -/* Line 1464 of yacc.c */ #line 280 "parser.y" { (yyval.unit) = ut_log((yyvsp[(1) - (3)].rval), (yyvsp[(2) - (3)].unit)); @@ -1740,8 +1686,6 @@ yyreduce: break; case 19: - -/* Line 1464 of yacc.c */ #line 288 "parser.y" { (yyval.unit) = ut_scale((yyvsp[(1) - (1)].rval), @@ -1750,8 +1694,6 @@ yyreduce: break; case 20: - -/* Line 1464 of yacc.c */ #line 294 "parser.y" { (yyval.rval) = (yyvsp[(1) - (1)].ival); @@ -1759,8 +1701,6 @@ yyreduce: break; case 21: - -/* Line 1464 of yacc.c */ #line 297 "parser.y" { (yyval.rval) = (yyvsp[(1) - (1)].rval); @@ -1768,8 +1708,6 @@ yyreduce: break; case 22: - -/* Line 1464 of yacc.c */ #line 302 "parser.y" { (yyval.rval) = (yyvsp[(1) - (1)].rval); @@ -1777,8 +1715,6 @@ yyreduce: break; case 23: - -/* Line 1464 of yacc.c */ #line 305 "parser.y" { (yyval.rval) = (yyvsp[(1) - (2)].rval) + (yyvsp[(2) - (2)].rval); @@ -1786,8 +1722,6 @@ yyreduce: break; case 24: - -/* Line 1464 of yacc.c */ #line 308 "parser.y" { (yyval.rval) = (yyvsp[(1) - (3)].rval) + ((yyvsp[(2) - (3)].rval) - (yyvsp[(3) - (3)].rval)); @@ -1795,8 +1729,6 @@ yyreduce: break; case 25: - -/* Line 1464 of yacc.c */ #line 311 "parser.y" { int mag = (yyvsp[(3) - (3)].ival) >= 0 ? (yyvsp[(3) - (3)].ival) : -(yyvsp[(3) - (3)].ival); @@ -1814,8 +1746,6 @@ yyreduce: break; case 26: - -/* Line 1464 of yacc.c */ #line 324 "parser.y" { int error = 0; @@ -1839,8 +1769,6 @@ yyreduce: break; case 27: - -/* Line 1464 of yacc.c */ #line 343 "parser.y" { (yyval.rval) = (yyvsp[(1) - (1)].rval); @@ -1848,8 +1776,6 @@ yyreduce: break; case 28: - -/* Line 1464 of yacc.c */ #line 346 "parser.y" { (yyval.rval) = (yyvsp[(1) - (2)].rval) - (yyvsp[(2) - (2)].rval); @@ -1857,8 +1783,6 @@ yyreduce: break; case 29: - -/* Line 1464 of yacc.c */ #line 349 "parser.y" { int mag = (yyvsp[(2) - (2)].ival) >= 0 ? (yyvsp[(2) - (2)].ival) : -(yyvsp[(2) - (2)].ival); @@ -1876,8 +1800,6 @@ yyreduce: break; case 30: - -/* Line 1464 of yacc.c */ #line 362 "parser.y" { int error = 0; @@ -1901,9 +1823,8 @@ yyreduce: break; - -/* Line 1464 of yacc.c */ -#line 1907 "parser.c" +/* Line 1267 of yacc.c. */ +#line 1828 "parser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1914,6 +1835,7 @@ yyreduce: *++yyvsp = yyval; + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1978,7 +1900,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1995,7 +1917,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -2052,6 +1974,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -2076,7 +2001,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2087,7 +2012,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -2113,8 +2038,6 @@ yyreturn: } - -/* Line 1684 of yacc.c */ #line 383 "parser.y"