New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
main.c in branches/UKMO/dev_merge_2017_GC_couple_pkg/NEMOGCM/EXTERNAL/AGRIF/LIB – NEMO

source: branches/UKMO/dev_merge_2017_GC_couple_pkg/NEMOGCM/EXTERNAL/AGRIF/LIB/main.c @ 9677

Last change on this file since 9677 was 9677, checked in by dancopsey, 6 years ago

Strip out SVN keywords.

File size: 108.8 KB
Line 
1/* A Bison parser, made by GNU Bison 2.3.  */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6   Free Software Foundation, Inc.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21   Boston, MA 02110-1301, USA.  */
22
23/* As a special exception, you may create a larger work that contains
24   part or all of the Bison parser skeleton and distribute that work
25   under terms of your choice, so long as that work isn't itself a
26   parser generator using the skeleton or a modified version thereof
27   as a parser skeleton.  Alternatively, if you modify or redistribute
28   the parser skeleton itself, you may (at your option) remove this
29   special exception, which will cause the skeleton and the resulting
30   Bison output files to be licensed under the GNU General Public
31   License without this special exception.
32
33   This special exception was added by the Free Software Foundation in
34   version 2.2 of Bison.  */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37   simplifying the original so-called "semantic" parser.  */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40   infringing on user name space.  This should be done even for local
41   variables, as they might otherwise be expanded by user macros.
42   There are some unavoidable exceptions within include files to
43   define necessary library symbols; they are noted "INFRINGES ON
44   USER NAME SPACE" below.  */
45
46/* Identify Bison output.  */
47#define YYBISON 1
48
49/* Bison version.  */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name.  */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers.  */
56#define YYPURE 0
57
58/* Using locations.  */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names.  */
62#define yyparse convert_parse
63#define yylex   convert_lex
64#define yyerror convert_error
65#define yylval  convert_lval
66#define yychar  convert_char
67#define yydebug convert_debug
68#define yynerrs convert_nerrs
69
70
71/* Tokens.  */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74   /* Put the tokens into the symbol table, so that GDB and other debuggers
75      know about them.  */
76   enum yytokentype {
77     TOK_SEP = 258,
78     TOK_KIND = 259,
79     TOK_EQUAL = 260,
80     TOK_USE = 261,
81     TOK_MODULEMAIN = 262,
82     TOK_NOTGRIDDEP = 263,
83     TOK_USEITEM = 264,
84     TOK_NAME = 265,
85     TOK_CSTINT = 266,
86     TOK_PROBTYPE = 267
87   };
88#endif
89/* Tokens.  */
90#define TOK_SEP 258
91#define TOK_KIND 259
92#define TOK_EQUAL 260
93#define TOK_USE 261
94#define TOK_MODULEMAIN 262
95#define TOK_NOTGRIDDEP 263
96#define TOK_USEITEM 264
97#define TOK_NAME 265
98#define TOK_CSTINT 266
99#define TOK_PROBTYPE 267
100
101
102
103
104/* Copy the first part of user declarations.  */
105#line 35 "convert.y"
106
107#include <stdlib.h>
108#include <stdio.h>
109#include <string.h>
110#include "decl.h"
111
112int line_num=1;
113extern FILE * convert_in;
114
115int convert_error(const char *s)
116{
117    printf("##\n## ERROR in conv: '%s' (line %d, file: %s)\n##\n", s, line_num, config_file);
118    exit(0);
119}
120
121
122
123/* Enabling traces.  */
124#ifndef YYDEBUG
125# define YYDEBUG 1
126#endif
127
128/* Enabling verbose error messages.  */
129#ifdef YYERROR_VERBOSE
130# undef YYERROR_VERBOSE
131# define YYERROR_VERBOSE 1
132#else
133# define YYERROR_VERBOSE 0
134#endif
135
136/* Enabling the token table.  */
137#ifndef YYTOKEN_TABLE
138# define YYTOKEN_TABLE 0
139#endif
140
141#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
142typedef union YYSTYPE
143#line 52 "convert.y"
144{
145    char na[LONG_M];
146}
147/* Line 193 of yacc.c.  */
148#line 149 "convert.tab.c"
149   YYSTYPE;
150# define yystype YYSTYPE /* obsolescent; will be withdrawn */
151# define YYSTYPE_IS_DECLARED 1
152# define YYSTYPE_IS_TRIVIAL 1
153#endif
154
155
156
157/* Copy the second part of user declarations.  */
158
159
160/* Line 216 of yacc.c.  */
161#line 162 "convert.tab.c"
162
163#ifdef short
164# undef short
165#endif
166
167#ifdef YYTYPE_UINT8
168typedef YYTYPE_UINT8 yytype_uint8;
169#else
170typedef unsigned char yytype_uint8;
171#endif
172
173#ifdef YYTYPE_INT8
174typedef YYTYPE_INT8 yytype_int8;
175#elif (defined __STDC__ || defined __C99__FUNC__ \
176     || defined __cplusplus || defined _MSC_VER)
177typedef signed char yytype_int8;
178#else
179typedef short int yytype_int8;
180#endif
181
182#ifdef YYTYPE_UINT16
183typedef YYTYPE_UINT16 yytype_uint16;
184#else
185typedef unsigned short int yytype_uint16;
186#endif
187
188#ifdef YYTYPE_INT16
189typedef YYTYPE_INT16 yytype_int16;
190#else
191typedef short int yytype_int16;
192#endif
193
194#ifndef YYSIZE_T
195# ifdef __SIZE_TYPE__
196#  define YYSIZE_T __SIZE_TYPE__
197# elif defined size_t
198#  define YYSIZE_T size_t
199# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
200     || defined __cplusplus || defined _MSC_VER)
201#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
202#  define YYSIZE_T size_t
203# else
204#  define YYSIZE_T unsigned int
205# endif
206#endif
207
208#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
209
210#ifndef YY_
211# if defined YYENABLE_NLS && YYENABLE_NLS
212#  if ENABLE_NLS
213#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
214#   define YY_(msgid) dgettext ("bison-runtime", msgid)
215#  endif
216# endif
217# ifndef YY_
218#  define YY_(msgid) msgid
219# endif
220#endif
221
222/* Suppress unused-variable warnings by "using" E.  */
223#if ! defined lint || defined __GNUC__
224# define YYUSE(e) ((void) (e))
225#else
226# define YYUSE(e) /* empty */
227#endif
228
229/* Identity function, used to suppress warnings about constant conditions.  */
230#ifndef lint
231# define YYID(n) (n)
232#else
233#if (defined __STDC__ || defined __C99__FUNC__ \
234     || defined __cplusplus || defined _MSC_VER)
235static int
236YYID (int i)
237#else
238static int
239YYID (i)
240    int i;
241#endif
242{
243  return i;
244}
245#endif
246
247#if ! defined yyoverflow || YYERROR_VERBOSE
248
249/* The parser invokes alloca or malloc; define the necessary symbols.  */
250
251# ifdef YYSTACK_USE_ALLOCA
252#  if YYSTACK_USE_ALLOCA
253#   ifdef __GNUC__
254#    define YYSTACK_ALLOC __builtin_alloca
255#   elif defined __BUILTIN_VA_ARG_INCR
256#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
257#   elif defined _AIX
258#    define YYSTACK_ALLOC __alloca
259#   elif defined _MSC_VER
260#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
261#    define alloca _alloca
262#   else
263#    define YYSTACK_ALLOC alloca
264#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
265     || defined __cplusplus || defined _MSC_VER)
266#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
267#     ifndef _STDLIB_H
268#      define _STDLIB_H 1
269#     endif
270#    endif
271#   endif
272#  endif
273# endif
274
275# ifdef YYSTACK_ALLOC
276   /* Pacify GCC's `empty if-body' warning.  */
277#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
278#  ifndef YYSTACK_ALLOC_MAXIMUM
279    /* The OS might guarantee only one guard page at the bottom of the stack,
280       and a page size can be as small as 4096 bytes.  So we cannot safely
281       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
282       to allow for a few compiler-allocated temporary stack slots.  */
283#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
284#  endif
285# else
286#  define YYSTACK_ALLOC YYMALLOC
287#  define YYSTACK_FREE YYFREE
288#  ifndef YYSTACK_ALLOC_MAXIMUM
289#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
290#  endif
291#  if (defined __cplusplus && ! defined _STDLIB_H \
292       && ! ((defined YYMALLOC || defined malloc) \
293        && (defined YYFREE || defined free)))
294#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
295#   ifndef _STDLIB_H
296#    define _STDLIB_H 1
297#   endif
298#  endif
299#  ifndef YYMALLOC
300#   define YYMALLOC malloc
301#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
302     || defined __cplusplus || defined _MSC_VER)
303void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
304#   endif
305#  endif
306#  ifndef YYFREE
307#   define YYFREE free
308#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309     || defined __cplusplus || defined _MSC_VER)
310void free (void *); /* INFRINGES ON USER NAME SPACE */
311#   endif
312#  endif
313# endif
314#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
315
316
317#if (! defined yyoverflow \
318     && (! defined __cplusplus \
319    || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
320
321/* A type that is properly aligned for any stack member.  */
322union yyalloc
323{
324  yytype_int16 yyss;
325  YYSTYPE yyvs;
326  };
327
328/* The size of the maximum gap between one aligned stack and the next.  */
329# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
330
331/* The size of an array large to enough to hold all stacks, each with
332   N elements.  */
333# define YYSTACK_BYTES(N) \
334     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
335      + YYSTACK_GAP_MAXIMUM)
336
337/* Copy COUNT objects from FROM to TO.  The source and destination do
338   not overlap.  */
339# ifndef YYCOPY
340#  if defined __GNUC__ && 1 < __GNUC__
341#   define YYCOPY(To, From, Count) \
342      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
343#  else
344#   define YYCOPY(To, From, Count)     \
345      do             \
346   {              \
347     YYSIZE_T yyi;            \
348     for (yyi = 0; yyi < (Count); yyi++)  \
349       (To)[yyi] = (From)[yyi];     \
350   }              \
351      while (YYID (0))
352#  endif
353# endif
354
355/* Relocate STACK from its old location to the new one.  The
356   local variables YYSIZE and YYSTACKSIZE give the old and new number of
357   elements in the stack, and YYPTR gives the new location of the
358   stack.  Advance YYPTR to a properly aligned location for the next
359   stack.  */
360# define YYSTACK_RELOCATE(Stack)             \
361    do                           \
362      {                          \
363   YYSIZE_T yynewbytes;                \
364   YYCOPY (&yyptr->Stack, Stack, yysize);          \
365   Stack = &yyptr->Stack;                 \
366   yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
367   yyptr += yynewbytes / sizeof (*yyptr);          \
368      }                          \
369    while (YYID (0))
370
371#endif
372
373/* YYFINAL -- State number of the termination state.  */
374#define YYFINAL  2
375/* YYLAST -- Last index in YYTABLE.  */
376#define YYLAST   29
377
378/* YYNTOKENS -- Number of terminals.  */
379#define YYNTOKENS  16
380/* YYNNTS -- Number of nonterminals.  */
381#define YYNNTS  3
382/* YYNRULES -- Number of rules.  */
383#define YYNRULES  11
384/* YYNRULES -- Number of states.  */
385#define YYNSTATES  29
386
387/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
388#define YYUNDEFTOK  2
389#define YYMAXUTOK   267
390
391#define YYTRANSLATE(YYX)                  \
392  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
393
394/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
395static const yytype_uint8 yytranslate[] =
396{
397       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
398      15,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
400       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
401       2,     2,     2,     2,    13,     2,     2,     2,     2,     2,
402       2,     2,     2,     2,     2,     2,     2,     2,     2,    14,
403       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
408       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
411       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
412       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
413       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
414       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
415       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
416       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
417       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
418       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
419       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
422       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
423       5,     6,     7,     8,     9,    10,    11,    12
424};
425
426#if YYDEBUG
427/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
428   YYRHS.  */
429static const yytype_uint8 yyprhs[] =
430{
431       0,     0,     3,     4,     7,     9,    13,    19,    27,    31,
432      37,    42
433};
434
435/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
436static const yytype_int8 yyrhs[] =
437{
438      17,     0,    -1,    -1,    17,    18,    -1,    15,    -1,    12,
439      10,    14,    -1,    12,    10,    13,    10,    14,    -1,    12,
440      10,    13,    10,    13,    10,    14,    -1,     7,    10,    14,
441      -1,     4,    10,     5,    11,    14,    -1,     8,     3,    10,
442      14,    -1,     6,     9,    14,    -1
443};
444
445/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
446static const yytype_uint8 yyrline[] =
447{
448       0,    71,    71,    72,    75,    76,    77,    78,    79,    84,
449     100,   104
450};
451#endif
452
453#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
454/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
455   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
456static const char *const yytname[] =
457{
458  "$end", "error", "$undefined", "TOK_SEP", "TOK_KIND", "TOK_EQUAL",
459  "TOK_USE", "TOK_MODULEMAIN", "TOK_NOTGRIDDEP", "TOK_USEITEM", "TOK_NAME",
460  "TOK_CSTINT", "TOK_PROBTYPE", "','", "';'", "'\\n'", "$accept", "input",
461  "line", 0
462};
463#endif
464
465# ifdef YYPRINT
466/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
467   token YYLEX-NUM.  */
468static const yytype_uint16 yytoknum[] =
469{
470       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
471     265,   266,   267,    44,    59,    10
472};
473# endif
474
475/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
476static const yytype_uint8 yyr1[] =
477{
478       0,    16,    17,    17,    18,    18,    18,    18,    18,    18,
479      18,    18
480};
481
482/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
483static const yytype_uint8 yyr2[] =
484{
485       0,     2,     0,     2,     1,     3,     5,     7,     3,     5,
486       4,     3
487};
488
489/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
490   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
491   means the default is an error.  */
492static const yytype_uint8 yydefact[] =
493{
494       2,     0,     1,     0,     0,     0,     0,     0,     4,     3,
495       0,     0,     0,     0,     0,     0,    11,     8,     0,     0,
496       5,     0,    10,     0,     9,     0,     6,     0,     7
497};
498
499/* YYDEFGOTO[NTERM-NUM].  */
500static const yytype_int8 yydefgoto[] =
501{
502      -1,     1,     9
503};
504
505/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
506   STATE-NUM.  */
507#define YYPACT_NINF -13
508static const yytype_int8 yypact[] =
509{
510     -13,     0,   -13,    -7,     2,    -5,    10,     4,   -13,   -13,
511      11,     3,     5,     8,   -12,     9,   -13,   -13,     7,    12,
512     -13,    13,   -13,    -4,   -13,    14,   -13,    15,   -13
513};
514
515/* YYPGOTO[NTERM-NUM].  */
516static const yytype_int8 yypgoto[] =
517{
518     -13,   -13,   -13
519};
520
521/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
522   positive, shift that token.  If negative, reduce the rule which
523   number is the opposite.  If zero, do what YYDEFACT says.
524   If YYTABLE_NINF, syntax error.  */
525#define YYTABLE_NINF -1
526static const yytype_uint8 yytable[] =
527{
528       2,    19,    20,    10,     3,    12,     4,     5,     6,    25,
529      26,    11,     7,    13,    14,     8,    15,    16,    18,    17,
530      21,    22,    23,     0,    27,     0,     0,    24,     0,    28
531};
532
533static const yytype_int8 yycheck[] =
534{
535       0,    13,    14,    10,     4,    10,     6,     7,     8,    13,
536      14,     9,    12,     3,    10,    15,     5,    14,    10,    14,
537      11,    14,    10,    -1,    10,    -1,    -1,    14,    -1,    14
538};
539
540/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
541   symbol of state STATE-NUM.  */
542static const yytype_uint8 yystos[] =
543{
544       0,    17,     0,     4,     6,     7,     8,    12,    15,    18,
545      10,     9,    10,     3,    10,     5,    14,    14,    10,    13,
546      14,    11,    14,    10,    14,    13,    14,    10,    14
547};
548
549#define yyerrok      (yyerrstatus = 0)
550#define yyclearin (yychar = YYEMPTY)
551#define YYEMPTY      (-2)
552#define YYEOF     0
553
554#define YYACCEPT  goto yyacceptlab
555#define YYABORT      goto yyabortlab
556#define YYERROR      goto yyerrorlab
557
558
559/* Like YYERROR except do call yyerror.  This remains here temporarily
560   to ease the transition to the new meaning of YYERROR, for GCC.
561   Once GCC version 2 has supplanted version 1, this can go.  */
562
563#define YYFAIL    goto yyerrlab
564
565#define YYRECOVERING()  (!!yyerrstatus)
566
567#define YYBACKUP(Token, Value)               \
568do                      \
569  if (yychar == YYEMPTY && yylen == 1)          \
570    {                      \
571      yychar = (Token);                \
572      yylval = (Value);                \
573      yytoken = YYTRANSLATE (yychar);           \
574      YYPOPSTACK (1);                  \
575      goto yybackup;                \
576    }                      \
577  else                        \
578    {                      \
579      yyerror (YY_("syntax error: cannot back up")); \
580      YYERROR;                   \
581    }                      \
582while (YYID (0))
583
584
585#define YYTERROR  1
586#define YYERRCODE 256
587
588
589/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
590   If N is 0, then set CURRENT to the empty location which ends
591   the previous symbol: RHS[0] (always defined).  */
592
593#define YYRHSLOC(Rhs, K) ((Rhs)[K])
594#ifndef YYLLOC_DEFAULT
595# define YYLLOC_DEFAULT(Current, Rhs, N)           \
596    do                           \
597      if (YYID (N))                                                    \
598   {                       \
599     (Current).first_line   = YYRHSLOC (Rhs, 1).first_line; \
600     (Current).first_column = YYRHSLOC (Rhs, 1).first_column;  \
601     (Current).last_line    = YYRHSLOC (Rhs, N).last_line;     \
602     (Current).last_column  = YYRHSLOC (Rhs, N).last_column;   \
603   }                       \
604      else                       \
605   {                       \
606     (Current).first_line   = (Current).last_line   =    \
607       YYRHSLOC (Rhs, 0).last_line;          \
608     (Current).first_column = (Current).last_column =    \
609       YYRHSLOC (Rhs, 0).last_column;           \
610   }                       \
611    while (YYID (0))
612#endif
613
614
615/* YY_LOCATION_PRINT -- Print the location on the stream.
616   This macro was not mandated originally: define only if we know
617   we won't break user code: when these are the locations we know.  */
618
619#ifndef YY_LOCATION_PRINT
620# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
621#  define YY_LOCATION_PRINT(File, Loc)       \
622     fprintf (File, "%d.%d-%d.%d",        \
623         (Loc).first_line, (Loc).first_column,  \
624         (Loc).last_line,  (Loc).last_column)
625# else
626#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
627# endif
628#endif
629
630
631/* YYLEX -- calling `yylex' with the right arguments.  */
632
633#ifdef YYLEX_PARAM
634# define YYLEX yylex (YYLEX_PARAM)
635#else
636# define YYLEX yylex ()
637#endif
638
639/* Enable debugging if requested.  */
640#if YYDEBUG
641
642# ifndef YYFPRINTF
643#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
644#  define YYFPRINTF fprintf
645# endif
646
647# define YYDPRINTF(Args)         \
648do {                 \
649  if (yydebug)             \
650    YYFPRINTF Args;           \
651} while (YYID (0))
652
653# define YY_SYMBOL_PRINT(Title, Type, Value, Location)           \
654do {                            \
655  if (yydebug)                        \
656    {                           \
657      YYFPRINTF (stderr, "%s ", Title);                 \
658      yy_symbol_print (stderr,                    \
659        Type, Value); \
660      YYFPRINTF (stderr, "\n");                   \
661    }                           \
662} while (YYID (0))
663
664
665/*--------------------------------.
666| Print this symbol on YYOUTPUT.  |
667`--------------------------------*/
668
669/*ARGSUSED*/
670#if (defined __STDC__ || defined __C99__FUNC__ \
671     || defined __cplusplus || defined _MSC_VER)
672static void
673yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
674#else
675static void
676yy_symbol_value_print (yyoutput, yytype, yyvaluep)
677    FILE *yyoutput;
678    int yytype;
679    YYSTYPE const * const yyvaluep;
680#endif
681{
682  if (!yyvaluep)
683    return;
684# ifdef YYPRINT
685  if (yytype < YYNTOKENS)
686    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
687# else
688  YYUSE (yyoutput);
689# endif
690  switch (yytype)
691    {
692      default:
693   break;
694    }
695}
696
697
698/*--------------------------------.
699| Print this symbol on YYOUTPUT.  |
700`--------------------------------*/
701
702#if (defined __STDC__ || defined __C99__FUNC__ \
703     || defined __cplusplus || defined _MSC_VER)
704static void
705yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
706#else
707static void
708yy_symbol_print (yyoutput, yytype, yyvaluep)
709    FILE *yyoutput;
710    int yytype;
711    YYSTYPE const * const yyvaluep;
712#endif
713{
714  if (yytype < YYNTOKENS)
715    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
716  else
717    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
718
719  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
720  YYFPRINTF (yyoutput, ")");
721}
722
723/*------------------------------------------------------------------.
724| yy_stack_print -- Print the state stack from its BOTTOM up to its |
725| TOP (included).                                                   |
726`------------------------------------------------------------------*/
727
728#if (defined __STDC__ || defined __C99__FUNC__ \
729     || defined __cplusplus || defined _MSC_VER)
730static void
731yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
732#else
733static void
734yy_stack_print (bottom, top)
735    yytype_int16 *bottom;
736    yytype_int16 *top;
737#endif
738{
739  YYFPRINTF (stderr, "Stack now");
740  for (; bottom <= top; ++bottom)
741    YYFPRINTF (stderr, " %d", *bottom);
742  YYFPRINTF (stderr, "\n");
743}
744
745# define YY_STACK_PRINT(Bottom, Top)            \
746do {                       \
747  if (yydebug)                   \
748    yy_stack_print ((Bottom), (Top));           \
749} while (YYID (0))
750
751
752/*------------------------------------------------.
753| Report that the YYRULE is going to be reduced.  |
754`------------------------------------------------*/
755
756#if (defined __STDC__ || defined __C99__FUNC__ \
757     || defined __cplusplus || defined _MSC_VER)
758static void
759yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
760#else
761static void
762yy_reduce_print (yyvsp, yyrule)
763    YYSTYPE *yyvsp;
764    int yyrule;
765#endif
766{
767  int yynrhs = yyr2[yyrule];
768  int yyi;
769  unsigned long int yylno = yyrline[yyrule];
770  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
771        yyrule - 1, yylno);
772  /* The symbols being reduced.  */
773  for (yyi = 0; yyi < yynrhs; yyi++)
774    {
775      fprintf (stderr, "   $%d = ", yyi + 1);
776      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
777             &(yyvsp[(yyi + 1) - (yynrhs)])
778                         );
779      fprintf (stderr, "\n");
780    }
781}
782
783# define YY_REDUCE_PRINT(Rule)      \
784do {              \
785  if (yydebug)          \
786    yy_reduce_print (yyvsp, Rule); \
787} while (YYID (0))
788
789/* Nonzero means print parse trace.  It is left uninitialized so that
790   multiple parsers can coexist.  */
791int yydebug;
792#else /* !YYDEBUG */
793# define YYDPRINTF(Args)
794# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
795# define YY_STACK_PRINT(Bottom, Top)
796# define YY_REDUCE_PRINT(Rule)
797#endif /* !YYDEBUG */
798
799
800/* YYINITDEPTH -- initial size of the parser's stacks.  */
801#ifndef  YYINITDEPTH
802# define YYINITDEPTH 200
803#endif
804
805/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
806   if the built-in stack extension method is used).
807
808   Do not make this value too large; the results are undefined if
809   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
810   evaluated with infinite-precision integer arithmetic.  */
811
812#ifndef YYMAXDEPTH
813# define YYMAXDEPTH 10000
814#endif
815
816
817
818#if YYERROR_VERBOSE
819
820# ifndef yystrlen
821#  if defined __GLIBC__ && defined _STRING_H
822#   define yystrlen strlen
823#  else
824/* Return the length of YYSTR.  */
825#if (defined __STDC__ || defined __C99__FUNC__ \
826     || defined __cplusplus || defined _MSC_VER)
827static YYSIZE_T
828yystrlen (const char *yystr)
829#else
830static YYSIZE_T
831yystrlen (yystr)
832    const char *yystr;
833#endif
834{
835  YYSIZE_T yylen;
836  for (yylen = 0; yystr[yylen]; yylen++)
837    continue;
838  return yylen;
839}
840#  endif
841# endif
842
843# ifndef yystpcpy
844#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
845#   define yystpcpy stpcpy
846#  else
847/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
848   YYDEST.  */
849#if (defined __STDC__ || defined __C99__FUNC__ \
850     || defined __cplusplus || defined _MSC_VER)
851static char *
852yystpcpy (char *yydest, const char *yysrc)
853#else
854static char *
855yystpcpy (yydest, yysrc)
856    char *yydest;
857    const char *yysrc;
858#endif
859{
860  char *yyd = yydest;
861  const char *yys = yysrc;
862
863  while ((*yyd++ = *yys++) != '\0')
864    continue;
865
866  return yyd - 1;
867}
868#  endif
869# endif
870
871# ifndef yytnamerr
872/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
873   quotes and backslashes, so that it's suitable for yyerror.  The
874   heuristic is that double-quoting is unnecessary unless the string
875   contains an apostrophe, a comma, or backslash (other than
876   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
877   null, do not copy; instead, return the length of what the result
878   would have been.  */
879static YYSIZE_T
880yytnamerr (char *yyres, const char *yystr)
881{
882  if (*yystr == '"')
883    {
884      YYSIZE_T yyn = 0;
885      char const *yyp = yystr;
886
887      for (;;)
888   switch (*++yyp)
889     {
890     case '\'':
891     case ',':
892       goto do_not_strip_quotes;
893
894     case '\\':
895       if (*++yyp != '\\')
896         goto do_not_strip_quotes;
897       /* Fall through.  */
898     default:
899       if (yyres)
900         yyres[yyn] = *yyp;
901       yyn++;
902       break;
903
904     case '"':
905       if (yyres)
906         yyres[yyn] = '\0';
907       return yyn;
908     }
909    do_not_strip_quotes: ;
910    }
911
912  if (! yyres)
913    return yystrlen (yystr);
914
915  return yystpcpy (yyres, yystr) - yyres;
916}
917# endif
918
919/* Copy into YYRESULT an error message about the unexpected token
920   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
921   including the terminating null byte.  If YYRESULT is null, do not
922   copy anything; just return the number of bytes that would be
923   copied.  As a special case, return 0 if an ordinary "syntax error"
924   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
925   size calculation.  */
926static YYSIZE_T
927yysyntax_error (char *yyresult, int yystate, int yychar)
928{
929  int yyn = yypact[yystate];
930
931  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
932    return 0;
933  else
934    {
935      int yytype = YYTRANSLATE (yychar);
936      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
937      YYSIZE_T yysize = yysize0;
938      YYSIZE_T yysize1;
939      int yysize_overflow = 0;
940      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
941      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
942      int yyx;
943
944# if 0
945      /* This is so xgettext sees the translatable formats that are
946    constructed on the fly.  */
947      YY_("syntax error, unexpected %s");
948      YY_("syntax error, unexpected %s, expecting %s");
949      YY_("syntax error, unexpected %s, expecting %s or %s");
950      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
951      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
952# endif
953      char *yyfmt;
954      char const *yyf;
955      static char const yyunexpected[] = "syntax error, unexpected %s";
956      static char const yyexpecting[] = ", expecting %s";
957      static char const yyor[] = " or %s";
958      char yyformat[sizeof yyunexpected
959          + sizeof yyexpecting - 1
960          + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
961             * (sizeof yyor - 1))];
962      char const *yyprefix = yyexpecting;
963
964      /* Start YYX at -YYN if negative to avoid negative indexes in
965    YYCHECK.  */
966      int yyxbegin = yyn < 0 ? -yyn : 0;
967
968      /* Stay within bounds of both yycheck and yytname.  */
969      int yychecklim = YYLAST - yyn + 1;
970      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
971      int yycount = 1;
972
973      yyarg[0] = yytname[yytype];
974      yyfmt = yystpcpy (yyformat, yyunexpected);
975
976      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
977   if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
978     {
979       if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
980         {
981      yycount = 1;
982      yysize = yysize0;
983      yyformat[sizeof yyunexpected - 1] = '\0';
984      break;
985         }
986       yyarg[yycount++] = yytname[yyx];
987       yysize1 = yysize + yytnamerr (0, yytname[yyx]);
988       yysize_overflow |= (yysize1 < yysize);
989       yysize = yysize1;
990       yyfmt = yystpcpy (yyfmt, yyprefix);
991       yyprefix = yyor;
992     }
993
994      yyf = YY_(yyformat);
995      yysize1 = yysize + yystrlen (yyf);
996      yysize_overflow |= (yysize1 < yysize);
997      yysize = yysize1;
998
999      if (yysize_overflow)
1000   return YYSIZE_MAXIMUM;
1001
1002      if (yyresult)
1003   {
1004     /* Avoid sprintf, as that infringes on the user's name space.
1005        Don't have undefined behavior even if the translation
1006        produced a string with the wrong number of "%s"s.  */
1007     char *yyp = yyresult;
1008     int yyi = 0;
1009     while ((*yyp = *yyf) != '\0')
1010       {
1011         if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1012      {
1013        yyp += yytnamerr (yyp, yyarg[yyi++]);
1014        yyf += 2;
1015      }
1016         else
1017      {
1018        yyp++;
1019        yyf++;
1020      }
1021       }
1022   }
1023      return yysize;
1024    }
1025}
1026#endif /* YYERROR_VERBOSE */
1027
1028
1029/*-----------------------------------------------.
1030| Release the memory associated to this symbol.  |
1031`-----------------------------------------------*/
1032
1033/*ARGSUSED*/
1034#if (defined __STDC__ || defined __C99__FUNC__ \
1035     || defined __cplusplus || defined _MSC_VER)
1036static void
1037yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1038#else
1039static void
1040yydestruct (yymsg, yytype, yyvaluep)
1041    const char *yymsg;
1042    int yytype;
1043    YYSTYPE *yyvaluep;
1044#endif
1045{
1046  YYUSE (yyvaluep);
1047
1048  if (!yymsg)
1049    yymsg = "Deleting";
1050  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1051
1052  switch (yytype)
1053    {
1054
1055      default:
1056   break;
1057    }
1058}
1059
1060
1061/* Prevent warnings from -Wmissing-prototypes.  */
1062
1063#ifdef YYPARSE_PARAM
1064#if defined __STDC__ || defined __cplusplus
1065int yyparse (void *YYPARSE_PARAM);
1066#else
1067int yyparse ();
1068#endif
1069#else /* ! YYPARSE_PARAM */
1070#if defined __STDC__ || defined __cplusplus
1071int yyparse (void);
1072#else
1073int yyparse ();
1074#endif
1075#endif /* ! YYPARSE_PARAM */
1076
1077
1078
1079/* The look-ahead symbol.  */
1080int yychar;
1081
1082/* The semantic value of the look-ahead symbol.  */
1083YYSTYPE yylval;
1084
1085/* Number of syntax errors so far.  */
1086int yynerrs;
1087
1088
1089
1090/*----------.
1091| yyparse.  |
1092`----------*/
1093
1094#ifdef YYPARSE_PARAM
1095#if (defined __STDC__ || defined __C99__FUNC__ \
1096     || defined __cplusplus || defined _MSC_VER)
1097int
1098yyparse (void *YYPARSE_PARAM)
1099#else
1100int
1101yyparse (YYPARSE_PARAM)
1102    void *YYPARSE_PARAM;
1103#endif
1104#else /* ! YYPARSE_PARAM */
1105#if (defined __STDC__ || defined __C99__FUNC__ \
1106     || defined __cplusplus || defined _MSC_VER)
1107int
1108yyparse (void)
1109#else
1110int
1111yyparse ()
1112
1113#endif
1114#endif
1115{
1116 
1117  int yystate;
1118  int yyn;
1119  int yyresult;
1120  /* Number of tokens to shift before error messages enabled.  */
1121  int yyerrstatus;
1122  /* Look-ahead token as an internal (translated) token number.  */
1123  int yytoken = 0;
1124#if YYERROR_VERBOSE
1125  /* Buffer for error messages, and its allocated size.  */
1126  char yymsgbuf[128];
1127  char *yymsg = yymsgbuf;
1128  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1129#endif
1130
1131  /* Three stacks and their tools:
1132     `yyss': related to states,
1133     `yyvs': related to semantic values,
1134     `yyls': related to locations.
1135
1136     Refer to the stacks thru separate pointers, to allow yyoverflow
1137     to reallocate them elsewhere.  */
1138
1139  /* The state stack.  */
1140  yytype_int16 yyssa[YYINITDEPTH];
1141  yytype_int16 *yyss = yyssa;
1142  yytype_int16 *yyssp;
1143
1144  /* The semantic value stack.  */
1145  YYSTYPE yyvsa[YYINITDEPTH];
1146  YYSTYPE *yyvs = yyvsa;
1147  YYSTYPE *yyvsp;
1148
1149
1150
1151#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1152
1153  YYSIZE_T yystacksize = YYINITDEPTH;
1154
1155  /* The variables used to return semantic value and location from the
1156     action routines.  */
1157  YYSTYPE yyval;
1158
1159
1160  /* The number of symbols on the RHS of the reduced rule.
1161     Keep to zero when no symbol should be popped.  */
1162  int yylen = 0;
1163
1164  YYDPRINTF ((stderr, "Starting parse\n"));
1165
1166  yystate = 0;
1167  yyerrstatus = 0;
1168  yynerrs = 0;
1169  yychar = YYEMPTY;     /* Cause a token to be read.  */
1170
1171  /* Initialize stack pointers.
1172     Waste one element of value and location stack
1173     so that they stay on the same level as the state stack.
1174     The wasted elements are never initialized.  */
1175
1176  yyssp = yyss;
1177  yyvsp = yyvs;
1178
1179  goto yysetstate;
1180
1181/*------------------------------------------------------------.
1182| yynewstate -- Push a new state, which is found in yystate.  |
1183`------------------------------------------------------------*/
1184 yynewstate:
1185  /* In all cases, when you get here, the value and location stacks
1186     have just been pushed.  So pushing a state here evens the stacks.  */
1187  yyssp++;
1188
1189 yysetstate:
1190  *yyssp = yystate;
1191
1192  if (yyss + yystacksize - 1 <= yyssp)
1193    {
1194      /* Get the current used size of the three stacks, in elements.  */
1195      YYSIZE_T yysize = yyssp - yyss + 1;
1196
1197#ifdef yyoverflow
1198      {
1199   /* Give user a chance to reallocate the stack.  Use copies of
1200      these so that the &'s don't force the real ones into
1201      memory.  */
1202   YYSTYPE *yyvs1 = yyvs;
1203   yytype_int16 *yyss1 = yyss;
1204
1205
1206   /* Each stack pointer address is followed by the size of the
1207      data in use in that stack, in bytes.  This used to be a
1208      conditional around just the two extra args, but that might
1209      be undefined if yyoverflow is a macro.  */
1210   yyoverflow (YY_("memory exhausted"),
1211          &yyss1, yysize * sizeof (*yyssp),
1212          &yyvs1, yysize * sizeof (*yyvsp),
1213
1214          &yystacksize);
1215
1216   yyss = yyss1;
1217   yyvs = yyvs1;
1218      }
1219#else /* no yyoverflow */
1220# ifndef YYSTACK_RELOCATE
1221      goto yyexhaustedlab;
1222# else
1223      /* Extend the stack our own way.  */
1224      if (YYMAXDEPTH <= yystacksize)
1225   goto yyexhaustedlab;
1226      yystacksize *= 2;
1227      if (YYMAXDEPTH < yystacksize)
1228   yystacksize = YYMAXDEPTH;
1229
1230      {
1231   yytype_int16 *yyss1 = yyss;
1232   union yyalloc *yyptr =
1233     (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1234   if (! yyptr)
1235     goto yyexhaustedlab;
1236   YYSTACK_RELOCATE (yyss);
1237   YYSTACK_RELOCATE (yyvs);
1238
1239#  undef YYSTACK_RELOCATE
1240   if (yyss1 != yyssa)
1241     YYSTACK_FREE (yyss1);
1242      }
1243# endif
1244#endif /* no yyoverflow */
1245
1246      yyssp = yyss + yysize - 1;
1247      yyvsp = yyvs + yysize - 1;
1248
1249
1250      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1251        (unsigned long int) yystacksize));
1252
1253      if (yyss + yystacksize - 1 <= yyssp)
1254   YYABORT;
1255    }
1256
1257  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1258
1259  goto yybackup;
1260
1261/*-----------.
1262| yybackup.  |
1263`-----------*/
1264yybackup:
1265
1266  /* Do appropriate processing given the current state.  Read a
1267     look-ahead token if we need one and don't already have one.  */
1268
1269  /* First try to decide what to do without reference to look-ahead token.  */
1270  yyn = yypact[yystate];
1271  if (yyn == YYPACT_NINF)
1272    goto yydefault;
1273
1274  /* Not known => get a look-ahead token if don't already have one.  */
1275
1276  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1277  if (yychar == YYEMPTY)
1278    {
1279      YYDPRINTF ((stderr, "Reading a token: "));
1280      yychar = YYLEX;
1281    }
1282
1283  if (yychar <= YYEOF)
1284    {
1285      yychar = yytoken = YYEOF;
1286      YYDPRINTF ((stderr, "Now at end of input.\n"));
1287    }
1288  else
1289    {
1290      yytoken = YYTRANSLATE (yychar);
1291      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1292    }
1293
1294  /* If the proper action on seeing token YYTOKEN is to reduce or to
1295     detect an error, take that action.  */
1296  yyn += yytoken;
1297  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1298    goto yydefault;
1299  yyn = yytable[yyn];
1300  if (yyn <= 0)
1301    {
1302      if (yyn == 0 || yyn == YYTABLE_NINF)
1303   goto yyerrlab;
1304      yyn = -yyn;
1305      goto yyreduce;
1306    }
1307
1308  if (yyn == YYFINAL)
1309    YYACCEPT;
1310
1311  /* Count tokens shifted since error; after three, turn off error
1312     status.  */
1313  if (yyerrstatus)
1314    yyerrstatus--;
1315
1316  /* Shift the look-ahead token.  */
1317  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1318
1319  /* Discard the shifted token unless it is eof.  */
1320  if (yychar != YYEOF)
1321    yychar = YYEMPTY;
1322
1323  yystate = yyn;
1324  *++yyvsp = yylval;
1325
1326  goto yynewstate;
1327
1328
1329/*-----------------------------------------------------------.
1330| yydefault -- do the default action for the current state.  |
1331`-----------------------------------------------------------*/
1332yydefault:
1333  yyn = yydefact[yystate];
1334  if (yyn == 0)
1335    goto yyerrlab;
1336  goto yyreduce;
1337
1338
1339/*-----------------------------.
1340| yyreduce -- Do a reduction.  |
1341`-----------------------------*/
1342yyreduce:
1343  /* yyn is the number of a rule to reduce with.  */
1344  yylen = yyr2[yyn];
1345
1346  /* If YYLEN is nonzero, implement the default value of the action:
1347     `$$ = $1'.
1348
1349     Otherwise, the following line sets YYVAL to garbage.
1350     This behavior is undocumented and Bison
1351     users should not rely upon it.  Assigning to YYVAL
1352     unconditionally makes the parser a bit smaller, and it avoids a
1353     GCC warning that YYVAL may be used uninitialized.  */
1354  yyval = yyvsp[1-yylen];
1355
1356
1357  YY_REDUCE_PRINT (yyn);
1358  switch (yyn)
1359    {
1360        case 5:
1361#line 76 "convert.y"
1362    { initdimprob(1,(yyvsp[(2) - (3)].na),"0","0"); ;}
1363    break;
1364
1365  case 6:
1366#line 77 "convert.y"
1367    { initdimprob(2,(yyvsp[(2) - (5)].na), (yyvsp[(4) - (5)].na),"0"); ;}
1368    break;
1369
1370  case 7:
1371#line 78 "convert.y"
1372    { initdimprob(3,(yyvsp[(2) - (7)].na), (yyvsp[(4) - (7)].na), (yyvsp[(6) - (7)].na)); ;}
1373    break;
1374
1375  case 8:
1376#line 80 "convert.y"
1377    {
1378            listofmodules = Addtolistnom((yyvsp[(2) - (3)].na),listofmodules,0);
1379            Addmoduletothelist((yyvsp[(2) - (3)].na));
1380        ;}
1381    break;
1382
1383  case 9:
1384#line 85 "convert.y"
1385    {
1386            if (!strcasecmp((yyvsp[(4) - (5)].na),"4"))
1387            {
1388                listofkind = Addtolistnom((yyvsp[(2) - (5)].na),listofkind,4);
1389            }
1390            else if (!strcasecmp((yyvsp[(4) - (5)].na),"8"))
1391            {
1392                listofkind = Addtolistnom((yyvsp[(2) - (5)].na),listofkind,8);
1393            }
1394            else
1395            {
1396                printf("##\n## Unknown kind type : %s (must be 4 or 8)\n##",(yyvsp[(4) - (5)].na));
1397                exit(0);
1398            }
1399        ;}
1400    break;
1401
1402  case 10:
1403#line 101 "convert.y"
1404    {
1405            Add_NotGridDepend_Var_1((yyvsp[(3) - (4)].na));
1406        ;}
1407    break;
1408
1409  case 11:
1410#line 105 "convert.y"
1411    {
1412            if (!strcasecmp((yyvsp[(2) - (3)].na),"FIXED_GRIDS"))      fixedgrids = 1;
1413            if (!strcasecmp((yyvsp[(2) - (3)].na),"ONLY_FIXED_GRIDS")) onlyfixedgrids = 1;
1414        ;}
1415    break;
1416
1417
1418/* Line 1267 of yacc.c.  */
1419#line 1420 "convert.tab.c"
1420      default: break;
1421    }
1422  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1423
1424  YYPOPSTACK (yylen);
1425  yylen = 0;
1426  YY_STACK_PRINT (yyss, yyssp);
1427
1428  *++yyvsp = yyval;
1429
1430
1431  /* Now `shift' the result of the reduction.  Determine what state
1432     that goes to, based on the state we popped back to and the rule
1433     number reduced by.  */
1434
1435  yyn = yyr1[yyn];
1436
1437  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1438  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1439    yystate = yytable[yystate];
1440  else
1441    yystate = yydefgoto[yyn - YYNTOKENS];
1442
1443  goto yynewstate;
1444
1445
1446/*------------------------------------.
1447| yyerrlab -- here on detecting error |
1448`------------------------------------*/
1449yyerrlab:
1450  /* If not already recovering from an error, report this error.  */
1451  if (!yyerrstatus)
1452    {
1453      ++yynerrs;
1454#if ! YYERROR_VERBOSE
1455      yyerror (YY_("syntax error"));
1456#else
1457      {
1458   YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1459   if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1460     {
1461       YYSIZE_T yyalloc = 2 * yysize;
1462       if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1463         yyalloc = YYSTACK_ALLOC_MAXIMUM;
1464       if (yymsg != yymsgbuf)
1465         YYSTACK_FREE (yymsg);
1466       yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1467       if (yymsg)
1468         yymsg_alloc = yyalloc;
1469       else
1470         {
1471      yymsg = yymsgbuf;
1472      yymsg_alloc = sizeof yymsgbuf;
1473         }
1474     }
1475
1476   if (0 < yysize && yysize <= yymsg_alloc)
1477     {
1478       (void) yysyntax_error (yymsg, yystate, yychar);
1479       yyerror (yymsg);
1480     }
1481   else
1482     {
1483       yyerror (YY_("syntax error"));
1484       if (yysize != 0)
1485         goto yyexhaustedlab;
1486     }
1487      }
1488#endif
1489    }
1490
1491
1492
1493  if (yyerrstatus == 3)
1494    {
1495      /* If just tried and failed to reuse look-ahead token after an
1496    error, discard it.  */
1497
1498      if (yychar <= YYEOF)
1499   {
1500     /* Return failure if at end of input.  */
1501     if (yychar == YYEOF)
1502       YYABORT;
1503   }
1504      else
1505   {
1506     yydestruct ("Error: discarding",
1507            yytoken, &yylval);
1508     yychar = YYEMPTY;
1509   }
1510    }
1511
1512  /* Else will try to reuse look-ahead token after shifting the error
1513     token.  */
1514  goto yyerrlab1;
1515
1516
1517/*---------------------------------------------------.
1518| yyerrorlab -- error raised explicitly by YYERROR.  |
1519`---------------------------------------------------*/
1520yyerrorlab:
1521
1522  /* Pacify compilers like GCC when the user code never invokes
1523     YYERROR and the label yyerrorlab therefore never appears in user
1524     code.  */
1525  if (/*CONSTCOND*/ 0)
1526     goto yyerrorlab;
1527
1528  /* Do not reclaim the symbols of the rule which action triggered
1529     this YYERROR.  */
1530  YYPOPSTACK (yylen);
1531  yylen = 0;
1532  YY_STACK_PRINT (yyss, yyssp);
1533  yystate = *yyssp;
1534  goto yyerrlab1;
1535
1536
1537/*-------------------------------------------------------------.
1538| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1539`-------------------------------------------------------------*/
1540yyerrlab1:
1541  yyerrstatus = 3;   /* Each real token shifted decrements this.  */
1542
1543  for (;;)
1544    {
1545      yyn = yypact[yystate];
1546      if (yyn != YYPACT_NINF)
1547   {
1548     yyn += YYTERROR;
1549     if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1550       {
1551         yyn = yytable[yyn];
1552         if (0 < yyn)
1553      break;
1554       }
1555   }
1556
1557      /* Pop the current state because it cannot handle the error token.  */
1558      if (yyssp == yyss)
1559   YYABORT;
1560
1561
1562      yydestruct ("Error: popping",
1563        yystos[yystate], yyvsp);
1564      YYPOPSTACK (1);
1565      yystate = *yyssp;
1566      YY_STACK_PRINT (yyss, yyssp);
1567    }
1568
1569  if (yyn == YYFINAL)
1570    YYACCEPT;
1571
1572  *++yyvsp = yylval;
1573
1574
1575  /* Shift the error token.  */
1576  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1577
1578  yystate = yyn;
1579  goto yynewstate;
1580
1581
1582/*-------------------------------------.
1583| yyacceptlab -- YYACCEPT comes here.  |
1584`-------------------------------------*/
1585yyacceptlab:
1586  yyresult = 0;
1587  goto yyreturn;
1588
1589/*-----------------------------------.
1590| yyabortlab -- YYABORT comes here.  |
1591`-----------------------------------*/
1592yyabortlab:
1593  yyresult = 1;
1594  goto yyreturn;
1595
1596#ifndef yyoverflow
1597/*-------------------------------------------------.
1598| yyexhaustedlab -- memory exhaustion comes here.  |
1599`-------------------------------------------------*/
1600yyexhaustedlab:
1601  yyerror (YY_("memory exhausted"));
1602  yyresult = 2;
1603  /* Fall through.  */
1604#endif
1605
1606yyreturn:
1607  if (yychar != YYEOF && yychar != YYEMPTY)
1608     yydestruct ("Cleanup: discarding lookahead",
1609       yytoken, &yylval);
1610  /* Do not reclaim the symbols of the rule which action triggered
1611     this YYABORT or YYACCEPT.  */
1612  YYPOPSTACK (yylen);
1613  YY_STACK_PRINT (yyss, yyssp);
1614  while (yyssp != yyss)
1615    {
1616      yydestruct ("Cleanup: popping",
1617        yystos[*yyssp], yyvsp);
1618      YYPOPSTACK (1);
1619    }
1620#ifndef yyoverflow
1621  if (yyss != yyssa)
1622    YYSTACK_FREE (yyss);
1623#endif
1624#if YYERROR_VERBOSE
1625  if (yymsg != yymsgbuf)
1626    YYSTACK_FREE (yymsg);
1627#endif
1628  /* Make sure YYID is used.  */
1629  return YYID (yyresult);
1630}
1631
1632
1633#line 110 "convert.y"
1634
1635
1636void print_usage()
1637{
1638    printf("usage : conv <config_file> -convfile  <FILENAME>\n");
1639    printf(" [-workdir <directory>] [-incdir <directory>]\n");
1640    printf(" [-comdirin   <directory>] [-comdirout <directory>]\n");
1641    printf(" [-convfile  <FILENAME>] [-SubloopScalar] [-SubloopScalar1] \n");
1642    printf(" [-free|-fixed]\n");
1643    exit(0);
1644}
1645
1646int main(int argc,char *argv[])
1647{
1648    extern FILE * convert_in ;
1649    FILE *dependglobaloutput;
1650    int i;
1651    listnom *parcours;
1652    listvar *newvar;
1653    int stylegiven = 0;
1654    int infreegiven ;
1655    int infixedgiven ;
1656    int lengthmainfile;
1657
1658    char filetoparse[LONG_FNAME];
1659
1660/******************************************************************************/
1661/*  1-  Variables initialization                                              */
1662/******************************************************************************/
1663    List_Global_Var = (listvar *) NULL;
1664    List_GlobalParameter_Var = (listvar *) NULL;
1665    List_Common_Var = (listvar *) NULL;
1666    List_Allocate_Var = (listallocate *) NULL;
1667    List_SubroutineWhereAgrifUsed = (listnom *) NULL;
1668    List_Subroutine_For_Alloc = (listnom *) NULL;
1669    List_Include = (listusemodule *) NULL;
1670    List_NameOfModuleUsed = (listusemodule *) NULL;
1671    listofmoduletmp = (listusemodule *) NULL;
1672    List_SubroutineDeclaration_Var = (listvar *) NULL;
1673    List_UsedInSubroutine_Var = (listvar *) NULL;
1674    List_NotGridDepend_Var = (listvar *) NULL;
1675    Listofavailableindices = (listindice *) NULL;
1676    Listofavailableindices_glob = (listindice **) calloc(NB_CAT_VARIABLES,sizeof(listindice *));
1677    List_CouplePointed_Var = (listvarpointtovar *) NULL;
1678    List_ModuleUsed_Var = (listvar *) NULL;
1679    List_ModuleUsedInModuleUsed_Var = (listvar *) NULL;
1680    List_GlobParamModuleUsed_Var = (listparameter *) NULL;
1681    List_GlobParamModuleUsedInModuleUsed_Var = (listparameter *) NULL;
1682    List_SubroutineArgument_Var = (listvar *) NULL;
1683    List_FunctionType_Var = (listvar *) NULL;
1684    tmpuselocallist = (listusemodule *) NULL;
1685    List_ContainsSubroutine = (listnom *) NULL;
1686    oldfortran_out = (FILE *) NULL;
1687
1688    if (argc < 2) print_usage();
1689   
1690    strcpy(config_file, argv[1]);
1691    strcpy(work_dir, ".");
1692    strcpy(input_dir, ".");
1693    strcpy(output_dir, "AGRIF_MODELFILES");
1694    strcpy(include_dir, "AGRIF_INC");
1695    strcpy(filetoparse, "");
1696    strcpy(subofagrifinitgrids, "");
1697    strcpy(meetagrifinitgrids, "");
1698    strcpy(mpiinitvar, "");
1699
1700    length_last = 0 ;
1701    length_first = 0 ;
1702    length_v_vallengspec = 0 ;
1703    length_v_commoninfile = 0 ;
1704    length_v_precision = 0 ;
1705    length_v_IntentSpec = 0 ;
1706    length_v_initialvalue = 0 ;
1707    length_v_readedlistdimension = 0 ;
1708    length_a_nomvar = 0 ;
1709    length_toprintglob = 0 ;
1710    length_tmpvargridname = 0 ;
1711    length_ligne_Subloop = 0 ;
1712    length_toprint_utilagrif = 0 ;
1713    length_toprinttmp_utilchar = 0 ;
1714    length_ligne_writedecl = 0 ;
1715    length_newname_toamr = 0 ;
1716    length_newname_writedecl = 0 ;
1717    length_ligne_toamr = 0 ;
1718    length_tmpligne_writedecl = 0 ;
1719    value_char_size = 0 ;
1720    value_char_size1 = 0 ;
1721    value_char_size2 = 0 ;
1722    value_char_size3 = 0 ;
1723    inallocate = 0;
1724    infixed = 1;
1725    infree  = 0;
1726
1727    onlyfixedgrids=0;
1728    fixedgrids=0;
1729    InAgrifParentDef = 0;
1730    IndicenbmaillesX=0;
1731    IndicenbmaillesY=0;
1732    IndicenbmaillesZ=0;
1733    created_dimensionlist = 1;
1734    /* current indice in the table tabvars             */
1735    for ( i=0 ; i<NB_CAT_VARIABLES ; i++)
1736    {
1737        indicemaxtabvars[i] = 0;
1738    }
1739    SubloopScalar = 0;
1740    todebug = 0;
1741    retour77 = 1 ;
1742    shouldincludempif = 0 ;
1743
1744    Read_val_max();
1745
1746/******************************************************************************/
1747/*  2-  Program arguments                                                     */
1748/******************************************************************************/
1749
1750    if ( (convert_in=fopen(config_file,"r")) == NULL )
1751    {
1752        printf("##\n## ERROR: the configuration file '%s' doesn't exist.\n##\n", config_file);
1753        print_usage();
1754    }
1755
1756    i=2;
1757    while ( i < argc )
1758    {
1759        if (!strcasecmp(argv[i], "-workdir"))
1760        {
1761            strcpy(work_dir,argv[i+1]);
1762            i++;
1763        }
1764        else if (!strcasecmp(argv[i], "-incdir"))
1765        {
1766            strcpy(include_dir,argv[i+1]);
1767            i++;
1768        }
1769        else if (!strcasecmp(argv[i], "-comdirin")) /* input directory           */
1770        {
1771            strcpy(input_dir,argv[i+1]);
1772            i++;
1773        }
1774        else if (!strcasecmp(argv[i], "-comdirout")) /* output directory         */
1775        {
1776            strcpy(output_dir,argv[i+1]);
1777            i++;
1778        }
1779        else if (!strcasecmp(argv[i], "-convfile")) /* file to parse             */
1780        {
1781            strcpy(filetoparse, argv[i+1]);
1782            i++;
1783            lengthmainfile = strlen(filetoparse);
1784            if (!strcasecmp(&filetoparse[lengthmainfile-4], ".f90"))
1785            {
1786                infixed = 0;
1787                infree = 1;
1788            }
1789            else
1790            {
1791                infixed = 1;
1792                infree = 0;
1793            }
1794        }
1795        else if (!strcasecmp(argv[i], "-free"))
1796        {
1797            stylegiven = 1;
1798            infreegiven  = 1 ;
1799            infixedgiven = 0;
1800        }
1801        else if (!strcasecmp(argv[i], "-fixed"))
1802        {
1803            stylegiven = 1;
1804            infreegiven  = 0;
1805            infixedgiven = 1;
1806        }
1807        else if (!strcasecmp(argv[i], "-SubloopScalar"))
1808        {
1809            SubloopScalar = 1 ;
1810        }
1811        else if (!strcasecmp(argv[i], "-SubloopScalar1"))
1812        {
1813            SubloopScalar = 2 ;
1814        }
1815        else if (!strcasecmp(argv[i], "-todebug"))
1816        {
1817            todebug = 1 ;
1818        }
1819        else if (!strcasecmp(argv[i],"-rm")) { }
1820        else
1821        {
1822            printf("##\n## Unkwon option : %s\n##\n", argv[i]);
1823            exit(0);
1824        }
1825        i++;
1826    }
1827    // Check input file
1828    if ( strlen(filetoparse) == 0 )         // -convfile has not been specified
1829    {
1830        printf("##\n## ERROR: please provide a file to parse with -convfile.\n##\n");
1831        print_usage();
1832    }
1833    // Setup input & output directories
1834    if ( strcasecmp(work_dir, ".") != 0 )   // -workdir has been changed...
1835    {
1836        if ( strcasecmp(input_dir,  ".") == 0 )                 // ...and -comdirin  has NOT been changed
1837        {
1838            strcpy(input_dir, work_dir);
1839        }
1840        if ( strcasecmp(output_dir, "AGRIF_MODELFILES") == 0 )  // ...and -comdirout has NOT been changed
1841        {
1842            sprintf(output_dir, "%s/%s", work_dir, "AGRIF_MODELFILES");
1843        }
1844        if ( strcasecmp(include_dir, "AGRIF_INC") == 0 )        // ...and -incdir    has NOT been changed
1845        {
1846            sprintf(include_dir, "%s/%s", work_dir, "AGRIF_INC");
1847        }
1848    }
1849    if (stylegiven == 1)
1850    {
1851        infree  = infreegiven;
1852        infixed = infixedgiven;
1853    }
1854
1855/******************************************************************************/
1856/*  3-  Parsing of the conv file <name>.in                                    */
1857/******************************************************************************/
1858
1859    if ( strstr(filetoparse, ".f90") || strstr(filetoparse, ".F90") ) retour77 = 0;
1860
1861    convert_parse();
1862
1863/******************************************************************************/
1864/*  4-  Preparation of the file parsing                                       */
1865/******************************************************************************/
1866
1867    sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
1868    /*                                                                         */
1869    if ( (dependglobaloutput=fopen(dependfilename, "r")) != NULL )
1870    {
1871        for (i=0;i<NB_CAT_VARIABLES;i++)
1872        {
1873            fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars[i]);
1874        }
1875        fclose(dependglobaloutput);
1876    }
1877    Readthedependavailablefile();
1878    /* Read the .dependnbxnby file which contains indices of nbmaillsX, nbmailleY and nbmailleZ */
1879    Readthedependnbxnbyfile();
1880    Read_Subroutine_For_Alloc();
1881
1882/******************************************************************************/
1883/*  5-  Parsing of the input file (2 times)                                   */
1884/******************************************************************************/
1885
1886    /* Record all variables in list                                            */
1887    firstpass = 1;
1888    process_fortran(filetoparse);
1889
1890    CompleteThelistvarindoloop();
1891    /* Read list of module used                                                */
1892    RecordUseModulesVariables();
1893    /* Read list of module used in module used                                 */
1894    RecordUseModulesUseModulesVariables();
1895    /* Save variables are considered as globals ones                           */
1896    Update_List_Global_Var_From_List_Save_Var();
1897    /* Update all lists                                                        */
1898    ListUpdate();
1899
1900    Clean_List_Global_Var();
1901    /* Indice tabvars identification                                           */
1902    IndiceTabvarsIdentification();
1903    /* Update all lists                                                        */
1904    ListUpdate();
1905    /* The allocation subroutine is necessary ????                             */
1906    New_Allocate_Subroutine_Is_Necessary();
1907    /* The allocation subroutine is necessary for common list                  */
1908    New_Allocate_Subroutine_For_Common_Is_Necessary();
1909    /* Sort List_SubroutineArgument_Var                                        */
1910    Sort_List_SubroutineArgument_Var();
1911    /* Clean all lists                                                         */
1912    ListClean();
1913    /* Update Indice of List_UsedInSubroutine_Var from module used             */
1914    List_UsedInSubroutine_Var_Update_From_Module_Used();
1915    /* Update List_SubroutineWhereAgrifUsed                                    */
1916    UpdateList_SubroutineWhereAgrifUsed();
1917    /* Update List_UsedInSubroutine_Var with v_readedlistdimension             */
1918    UpdateList_UsedInSubroutine_With_dimension();
1919
1920    ModifyThelistvarindoloop();
1921    UpdateListDeclarationWithDimensionList();
1922    GiveTypeOfVariables();
1923
1924    /* Build new subroutines                                                   */
1925    firstpass = 0;
1926    process_fortran(filetoparse);
1927
1928    newvar = (listvar *) NULL;
1929
1930    while ( newvar )
1931    {
1932        printf("++++ %s %d %s %s %s\n",
1933            newvar->var->v_nomvar,
1934            newvar->var->v_nbdim,
1935            newvar->var->v_subroutinename,
1936            newvar->var->v_modulename,
1937            newvar->var->v_typevar);
1938        newvar = newvar->suiv;
1939    }
1940
1941/******************************************************************************/
1942/*  6-  Write informations in output files                                    */
1943/******************************************************************************/
1944
1945    /* Write the .dependglobal_agrif file which contain the max indice         */
1946    /*    of the tabvars table                                                 */
1947    sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
1948    dependglobaloutput = fopen(dependfilename, "w");
1949    for (i=0;i<NB_CAT_VARIABLES;i++)
1950    {
1951        fprintf(dependglobaloutput,"%d\n",indicemaxtabvars[i]);
1952    }
1953    fclose(dependglobaloutput);
1954    /* Write the list of available indice                                      */
1955    Writethedependavailablefile();
1956    /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
1957    /*    nbmailleY and nbmailleZ                                              */
1958    Writethedependnbxnbyfile();
1959    /* Write the .depend<namefile> file which contain general informations     */
1960    /*    about variable of this file                                          */
1961    parcours = List_NameOfModule;
1962    while( parcours )
1963    {
1964        Writethedependlistofmoduleused(parcours->o_nom);
1965        WritedependParameterList(parcours->o_nom);
1966        Writethedependfile(parcours->o_nom,List_Global_Var);
1967        parcours=parcours->suiv;
1968    }
1969    parcours = List_NameOfCommon;
1970    while( parcours )
1971    {
1972        Writethedependfile(parcours->o_nom,List_Common_Var);
1973        parcours=parcours->suiv;
1974    }
1975    Write_Subroutine_For_Alloc();
1976
1977/******************************************************************************/
1978/*  7-  Create files in AGRIF_INC directory                                   */
1979/******************************************************************************/
1980
1981    creefichieramr();
1982
1983    Write_val_max();
1984
1985    if ( todebug == 1 ) printf("Out of CONV \n");
1986    return 0;
1987}
1988
1989#line 2 "convert.yy.c"
1990
1991#line 4 "convert.yy.c"
1992
1993#define  YY_INT_ALIGNED short int
1994
1995/* A lexical scanner generated by flex */
1996
1997#define yy_create_buffer convert__create_buffer
1998#define yy_delete_buffer convert__delete_buffer
1999#define yy_flex_debug convert__flex_debug
2000#define yy_init_buffer convert__init_buffer
2001#define yy_flush_buffer convert__flush_buffer
2002#define yy_load_buffer_state convert__load_buffer_state
2003#define yy_switch_to_buffer convert__switch_to_buffer
2004#define yyin convert_in
2005#define yyleng convert_leng
2006#define yylex convert_lex
2007#define yylineno convert_lineno
2008#define yyout convert_out
2009#define yyrestart convert_restart
2010#define yytext convert_text
2011#define yywrap convert_wrap
2012#define yyalloc convert_alloc
2013#define yyrealloc convert_realloc
2014#define yyfree convert_free
2015
2016#define FLEX_SCANNER
2017#define YY_FLEX_MAJOR_VERSION 2
2018#define YY_FLEX_MINOR_VERSION 5
2019#define YY_FLEX_SUBMINOR_VERSION 35
2020#if YY_FLEX_SUBMINOR_VERSION > 0
2021#define FLEX_BETA
2022#endif
2023
2024/* First, we deal with  platform-specific or compiler-specific issues. */
2025
2026/* begin standard C headers. */
2027#include <stdio.h>
2028#include <string.h>
2029#include <errno.h>
2030#include <stdlib.h>
2031
2032/* end standard C headers. */
2033
2034/* flex integer type definitions */
2035
2036#ifndef FLEXINT_H
2037#define FLEXINT_H
2038
2039/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
2040
2041#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
2042
2043/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
2044 * if you want the limit (max/min) macros for int types.
2045 */
2046#ifndef __STDC_LIMIT_MACROS
2047#define __STDC_LIMIT_MACROS 1
2048#endif
2049
2050#include <inttypes.h>
2051typedef int8_t flex_int8_t;
2052typedef uint8_t flex_uint8_t;
2053typedef int16_t flex_int16_t;
2054typedef uint16_t flex_uint16_t;
2055typedef int32_t flex_int32_t;
2056typedef uint32_t flex_uint32_t;
2057typedef uint64_t flex_uint64_t;
2058#else
2059typedef signed char flex_int8_t;
2060typedef short int flex_int16_t;
2061typedef int flex_int32_t;
2062typedef unsigned char flex_uint8_t; 
2063typedef unsigned short int flex_uint16_t;
2064typedef unsigned int flex_uint32_t;
2065#endif /* ! C99 */
2066
2067/* Limits of integral types. */
2068#ifndef INT8_MIN
2069#define INT8_MIN               (-128)
2070#endif
2071#ifndef INT16_MIN
2072#define INT16_MIN              (-32767-1)
2073#endif
2074#ifndef INT32_MIN
2075#define INT32_MIN              (-2147483647-1)
2076#endif
2077#ifndef INT8_MAX
2078#define INT8_MAX               (127)
2079#endif
2080#ifndef INT16_MAX
2081#define INT16_MAX              (32767)
2082#endif
2083#ifndef INT32_MAX
2084#define INT32_MAX              (2147483647)
2085#endif
2086#ifndef UINT8_MAX
2087#define UINT8_MAX              (255U)
2088#endif
2089#ifndef UINT16_MAX
2090#define UINT16_MAX             (65535U)
2091#endif
2092#ifndef UINT32_MAX
2093#define UINT32_MAX             (4294967295U)
2094#endif
2095
2096#endif /* ! FLEXINT_H */
2097
2098#ifdef __cplusplus
2099
2100/* The "const" storage-class-modifier is valid. */
2101#define YY_USE_CONST
2102
2103#else /* ! __cplusplus */
2104
2105/* C99 requires __STDC__ to be defined as 1. */
2106#if defined (__STDC__)
2107
2108#define YY_USE_CONST
2109
2110#endif   /* defined (__STDC__) */
2111#endif   /* ! __cplusplus */
2112
2113#ifdef YY_USE_CONST
2114#define yyconst const
2115#else
2116#define yyconst
2117#endif
2118
2119/* Returned upon end-of-file. */
2120#define YY_NULL 0
2121
2122/* Promotes a possibly negative, possibly signed char to an unsigned
2123 * integer for use as an array index.  If the signed char is negative,
2124 * we want to instead treat it as an 8-bit unsigned char, hence the
2125 * double cast.
2126 */
2127#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
2128
2129/* Enter a start condition.  This macro really ought to take a parameter,
2130 * but we do it the disgusting crufty way forced on us by the ()-less
2131 * definition of BEGIN.
2132 */
2133#define BEGIN (yy_start) = 1 + 2 *
2134
2135/* Translate the current start state into a value that can be later handed
2136 * to BEGIN to return to the state.  The YYSTATE alias is for lex
2137 * compatibility.
2138 */
2139#define YY_START (((yy_start) - 1) / 2)
2140#define YYSTATE YY_START
2141
2142/* Action number for EOF rule of a given start state. */
2143#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
2144
2145/* Special action meaning "start processing a new file". */
2146#define YY_NEW_FILE convert_restart(convert_in  )
2147
2148#define YY_END_OF_BUFFER_CHAR 0
2149
2150/* Size of default input buffer. */
2151#ifndef YY_BUF_SIZE
2152#define YY_BUF_SIZE 16384
2153#endif
2154
2155/* The state buf must be large enough to hold one state per character in the main buffer.
2156 */
2157#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
2158
2159#ifndef YY_TYPEDEF_YY_BUFFER_STATE
2160#define YY_TYPEDEF_YY_BUFFER_STATE
2161typedef struct yy_buffer_state *YY_BUFFER_STATE;
2162#endif
2163
2164#ifndef YY_TYPEDEF_YY_SIZE_T
2165#define YY_TYPEDEF_YY_SIZE_T
2166typedef size_t yy_size_t;
2167#endif
2168
2169extern yy_size_t convert_leng;
2170
2171extern FILE *convert_in, *convert_out;
2172
2173#define EOB_ACT_CONTINUE_SCAN 0
2174#define EOB_ACT_END_OF_FILE 1
2175#define EOB_ACT_LAST_MATCH 2
2176
2177    #define YY_LESS_LINENO(n)
2178   
2179/* Return all but the first "n" matched characters back to the input stream. */
2180#define yyless(n) \
2181   do \
2182      { \
2183      /* Undo effects of setting up convert_text. */ \
2184        int yyless_macro_arg = (n); \
2185        YY_LESS_LINENO(yyless_macro_arg);\
2186      *yy_cp = (yy_hold_char); \
2187      YY_RESTORE_YY_MORE_OFFSET \
2188      (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
2189      YY_DO_BEFORE_ACTION; /* set up convert_text again */ \
2190      } \
2191   while ( 0 )
2192
2193#define unput(c) yyunput( c, (yytext_ptr)  )
2194
2195#ifndef YY_STRUCT_YY_BUFFER_STATE
2196#define YY_STRUCT_YY_BUFFER_STATE
2197struct yy_buffer_state
2198   {
2199   FILE *yy_input_file;
2200
2201   char *yy_ch_buf;     /* input buffer */
2202   char *yy_buf_pos;    /* current position in input buffer */
2203
2204   /* Size of input buffer in bytes, not including room for EOB
2205    * characters.
2206    */
2207   yy_size_t yy_buf_size;
2208
2209   /* Number of characters read into yy_ch_buf, not including EOB
2210    * characters.
2211    */
2212   yy_size_t yy_n_chars;
2213
2214   /* Whether we "own" the buffer - i.e., we know we created it,
2215    * and can realloc() it to grow it, and should free() it to
2216    * delete it.
2217    */
2218   int yy_is_our_buffer;
2219
2220   /* Whether this is an "interactive" input source; if so, and
2221    * if we're using stdio for input, then we want to use getc()
2222    * instead of fread(), to make sure we stop fetching input after
2223    * each newline.
2224    */
2225   int yy_is_interactive;
2226
2227   /* Whether we're considered to be at the beginning of a line.
2228    * If so, '^' rules will be active on the next match, otherwise
2229    * not.
2230    */
2231   int yy_at_bol;
2232
2233    int yy_bs_lineno; /**< The line count. */
2234    int yy_bs_column; /**< The column count. */
2235   
2236   /* Whether to try to fill the input buffer when we reach the
2237    * end of it.
2238    */
2239   int yy_fill_buffer;
2240
2241   int yy_buffer_status;
2242
2243#define YY_BUFFER_NEW 0
2244#define YY_BUFFER_NORMAL 1
2245   /* When an EOF's been seen but there's still some text to process
2246    * then we mark the buffer as YY_EOF_PENDING, to indicate that we
2247    * shouldn't try reading from the input source any more.  We might
2248    * still have a bunch of tokens to match, though, because of
2249    * possible backing-up.
2250    *
2251    * When we actually see the EOF, we change the status to "new"
2252    * (via convert_restart()), so that the user can continue scanning by
2253    * just pointing convert_in at a new input file.
2254    */
2255#define YY_BUFFER_EOF_PENDING 2
2256
2257   };
2258#endif /* !YY_STRUCT_YY_BUFFER_STATE */
2259
2260/* Stack of input buffers. */
2261static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
2262static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
2263static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
2264
2265/* We provide macros for accessing buffer states in case in the
2266 * future we want to put the buffer states in a more general
2267 * "scanner state".
2268 *
2269 * Returns the top of the stack, or NULL.
2270 */
2271#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
2272                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
2273                          : NULL)
2274
2275/* Same as previous macro, but useful when we know that the buffer stack is not
2276 * NULL or when we need an lvalue. For internal use only.
2277 */
2278#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
2279
2280/* yy_hold_char holds the character lost when convert_text is formed. */
2281static char yy_hold_char;
2282static yy_size_t yy_n_chars;     /* number of characters read into yy_ch_buf */
2283yy_size_t convert_leng;
2284
2285/* Points to current character in buffer. */
2286static char *yy_c_buf_p = (char *) 0;
2287static int yy_init = 0;    /* whether we need to initialize */
2288static int yy_start = 0;   /* start state number */
2289
2290/* Flag which is used to allow convert_wrap()'s to do buffer switches
2291 * instead of setting up a fresh convert_in.  A bit of a hack ...
2292 */
2293static int yy_did_buffer_switch_on_eof;
2294
2295void convert_restart (FILE *input_file  );
2296void convert__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
2297YY_BUFFER_STATE convert__create_buffer (FILE *file,int size  );
2298void convert__delete_buffer (YY_BUFFER_STATE b  );
2299void convert__flush_buffer (YY_BUFFER_STATE b  );
2300void convert_push_buffer_state (YY_BUFFER_STATE new_buffer  );
2301void convert_pop_buffer_state (void );
2302
2303static void convert_ensure_buffer_stack (void );
2304static void convert__load_buffer_state (void );
2305static void convert__init_buffer (YY_BUFFER_STATE b,FILE *file  );
2306
2307#define YY_FLUSH_BUFFER convert__flush_buffer(YY_CURRENT_BUFFER )
2308
2309YY_BUFFER_STATE convert__scan_buffer (char *base,yy_size_t size  );
2310YY_BUFFER_STATE convert__scan_string (yyconst char *yy_str  );
2311YY_BUFFER_STATE convert__scan_bytes (yyconst char *bytes,yy_size_t len  );
2312
2313void *convert_alloc (yy_size_t  );
2314void *convert_realloc (void *,yy_size_t  );
2315void convert_free (void *  );
2316
2317#define yy_new_buffer convert__create_buffer
2318
2319#define yy_set_interactive(is_interactive) \
2320   { \
2321   if ( ! YY_CURRENT_BUFFER ){ \
2322        convert_ensure_buffer_stack (); \
2323      YY_CURRENT_BUFFER_LVALUE =    \
2324            convert__create_buffer(convert_in,YY_BUF_SIZE ); \
2325   } \
2326   YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
2327   }
2328
2329#define yy_set_bol(at_bol) \
2330   { \
2331   if ( ! YY_CURRENT_BUFFER ){\
2332        convert_ensure_buffer_stack (); \
2333      YY_CURRENT_BUFFER_LVALUE =    \
2334            convert__create_buffer(convert_in,YY_BUF_SIZE ); \
2335   } \
2336   YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
2337   }
2338
2339#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
2340
2341/* Begin user sect3 */
2342
2343#define convert_wrap(n) 1
2344#define YY_SKIP_YYWRAP
2345
2346typedef unsigned char YY_CHAR;
2347
2348FILE *convert_in = (FILE *) 0, *convert_out = (FILE *) 0;
2349
2350typedef int yy_state_type;
2351
2352extern int convert_lineno;
2353
2354int convert_lineno = 1;
2355
2356extern char *convert_text;
2357#define yytext_ptr convert_text
2358
2359static yy_state_type yy_get_previous_state (void );
2360static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
2361static int yy_get_next_buffer (void );
2362static void yy_fatal_error (yyconst char msg[]  );
2363
2364/* Done after the current pattern has been matched and before the
2365 * corresponding action - sets up convert_text.
2366 */
2367#define YY_DO_BEFORE_ACTION \
2368   (yytext_ptr) = yy_bp; \
2369   convert_leng = (yy_size_t) (yy_cp - yy_bp); \
2370   (yy_hold_char) = *yy_cp; \
2371   *yy_cp = '\0'; \
2372   (yy_c_buf_p) = yy_cp;
2373
2374#define YY_NUM_RULES 15
2375#define YY_END_OF_BUFFER 16
2376/* This struct is not used in this scanner,
2377   but its presence is necessary. */
2378struct yy_trans_info
2379   {
2380   flex_int32_t yy_verify;
2381   flex_int32_t yy_nxt;
2382   };
2383static yyconst flex_int16_t yy_accept[84] =
2384    {   0,
2385        0,    0,    0,    0,   16,   15,   14,   13,   15,   12,
2386       11,   11,   11,   11,   12,    7,   10,   10,   10,   10,
2387       10,   10,   10,   14,    0,    4,   11,    9,    9,    9,
2388        5,   10,   10,   10,   10,   10,   10,   10,   10,    8,
2389       10,   10,   10,   10,   10,    3,   10,    6,   10,   10,
2390       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
2391       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
2392       10,   10,    2,   10,   10,   10,    1,   10,   10,   10,
2393       10,    8,    0
2394    } ;
2395
2396static yyconst flex_int32_t yy_ec[256] =
2397    {   0,
2398        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
2399        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2400        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2401        1,    2,    1,    1,    1,    1,    4,    1,    1,    5,
2402        6,    1,    1,    7,    1,    1,    1,    8,    9,   10,
2403       11,    8,    8,    8,   12,    8,    8,   13,   14,    1,
2404       15,    1,    1,    1,   16,   17,   17,   18,   19,   20,
2405       21,   17,   22,   17,   23,   24,   25,   26,   27,   28,
2406       17,   29,   30,   31,   32,   17,   17,   33,   34,   17,
2407       35,    1,   36,    1,   37,    1,   38,   17,   17,   39,
2408
2409       40,   41,   42,   17,   43,   17,   44,   45,   46,   47,
2410       48,   49,   17,   50,   51,   52,   53,   17,   17,   54,
2411       55,   17,    1,    1,    1,    1,    1,    1,    1,    1,
2412        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2413        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2414        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2415        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2416        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2417        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2418        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2419
2420        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2421        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2422        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2423        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2424        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2425        1,    1,    1,    1,    1
2426    } ;
2427
2428static yyconst flex_int32_t yy_meta[56] =
2429    {   0,
2430        1,    1,    2,    1,    1,    1,    1,    3,    3,    3,
2431        3,    3,    1,    1,    1,    3,    3,    3,    3,    3,
2432        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
2433        3,    3,    3,    3,    1,    1,    3,    3,    3,    3,
2434        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
2435        3,    3,    3,    3,    3
2436    } ;
2437
2438static yyconst flex_int16_t yy_base[86] =
2439    {   0,
2440        0,    0,    0,    0,  192,  194,  186,  194,  176,  194,
2441       48,   53,   58,   69,  164,  194,    0,   60,   51,   47,
2442       49,   67,   55,  173,  170,  169,   90,  194,  194,  194,
2443      194,    0,  160,   53,   62,   58,   66,   62,   74,    0,
2444       85,   95,   94,   82,  101,    0,  101,    0,   91,  134,
2445       96,  133,  100,  103,   99,  105,  109,  106,  102,  101,
2446      113,   99,  115,  113,  119,  127,  123,  139,  130,  142,
2447      137,  132,    0,   81,  144,  143,    0,  136,  144,  150,
2448      139,    0,  194,  190,   81
2449    } ;
2450
2451static yyconst flex_int16_t yy_def[86] =
2452    {   0,
2453       83,    1,    1,    1,   83,   83,   83,   83,   84,   83,
2454       83,   83,   83,   83,   83,   83,   85,   85,   85,   85,
2455       85,   85,   85,   83,   84,   84,   83,   83,   83,   83,
2456       83,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2457       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2458       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2459       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2460       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2461       85,   85,    0,   83,   83
2462    } ;
2463
2464static yyconst flex_int16_t yy_nxt[250] =
2465    {   0,
2466        6,    7,    8,    9,   10,   10,   10,   11,   12,   13,
2467       14,   11,   15,   10,   16,   17,   17,   17,   17,   18,
2468       17,   17,   19,   17,   17,   20,   21,   22,   17,   17,
2469       17,   23,   17,   17,   10,   10,   17,   17,   17,   17,
2470       18,   17,   17,   19,   17,   17,   20,   21,   22,   17,
2471       17,   17,   23,   17,   17,   27,   27,   27,   27,   27,
2472       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
2473       28,   33,   35,   36,   37,   29,   27,   27,   27,   27,
2474       27,   34,   38,   32,   39,   41,   30,   42,   43,   44,
2475       45,   28,   46,   35,   36,   37,   29,   27,   27,   27,
2476
2477       27,   27,   34,   47,   38,   39,   41,   30,   42,   43,
2478       44,   45,   48,   46,   49,   50,   51,   76,   52,   53,
2479       55,   57,   58,   59,   47,   60,   61,   62,   63,   64,
2480       65,   66,   67,   48,   68,   49,   50,   69,   51,   52,
2481       53,   55,   57,   58,   59,   70,   60,   61,   62,   63,
2482       64,   65,   66,   67,   71,   68,   72,   73,   69,   74,
2483       75,   40,   77,   78,   79,   80,   70,   81,   82,   56,
2484       54,   40,   26,   26,   24,   71,   31,   72,   73,   26,
2485       74,   75,   40,   77,   78,   79,   80,   24,   81,   82,
2486       25,   83,   25,    5,   83,   83,   83,   83,   83,   83,
2487
2488       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2489       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2490       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2491       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2492       83,   83,   83,   83,   83,   83,   83,   83,   83
2493    } ;
2494
2495static yyconst flex_int16_t yy_chk[250] =
2496    {   0,
2497        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2498        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2499        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2500        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2501        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2502        1,    1,    1,    1,    1,   11,   11,   11,   11,   11,
2503       12,   12,   12,   12,   12,   13,   13,   13,   13,   13,
2504       12,   18,   19,   20,   21,   13,   14,   14,   14,   14,
2505       14,   18,   22,   85,   23,   34,   14,   35,   36,   37,
2506       38,   12,   39,   19,   20,   21,   13,   27,   27,   27,
2507
2508       27,   27,   18,   41,   22,   23,   34,   14,   35,   36,
2509       37,   38,   42,   39,   43,   44,   45,   74,   47,   49,
2510       51,   53,   54,   55,   41,   56,   57,   58,   59,   60,
2511       61,   62,   63,   42,   64,   43,   44,   65,   45,   47,
2512       49,   51,   53,   54,   55,   66,   56,   57,   58,   59,
2513       60,   61,   62,   63,   67,   64,   68,   69,   65,   70,
2514       71,   72,   75,   76,   78,   79,   66,   80,   81,   52,
2515       50,   33,   26,   25,   24,   67,   15,   68,   69,    9,
2516       70,   71,   72,   75,   76,   78,   79,    7,   80,   81,
2517       84,    5,   84,   83,   83,   83,   83,   83,   83,   83,
2518
2519       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2520       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2521       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2522       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2523       83,   83,   83,   83,   83,   83,   83,   83,   83
2524    } ;
2525
2526static yy_state_type yy_last_accepting_state;
2527static char *yy_last_accepting_cpos;
2528
2529extern int convert__flex_debug;
2530int convert__flex_debug = 0;
2531
2532/* The intent behind this definition is that it'll catch
2533 * any uses of REJECT which flex missed.
2534 */
2535#define REJECT reject_used_but_not_detected
2536#define yymore() yymore_used_but_not_detected
2537#define YY_MORE_ADJ 0
2538#define YY_RESTORE_YY_MORE_OFFSET
2539char *convert_text;
2540#line 1 "convert.lex"
2541/******************************************************************************/
2542/*                                                                            */
2543/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
2544/*                                                                            */
2545/* Copyright or   or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */
2546/*                        Cyril Mazauric (Cyril_Mazauric@yahoo.fr)            */
2547/* This software is governed by the CeCILL-C license under French law and     */
2548/* abiding by the rules of distribution of free software.  You can  use,      */
2549/* modify and/ or redistribute the software under the terms of the CeCILL-C   */
2550/* license as circulated by CEA, CNRS and INRIA at the following URL          */
2551/* "http://www.cecill.info".                                                  */
2552/*                                                                            */
2553/* As a counterpart to the access to the source code and  rights to copy,     */
2554/* modify and redistribute granted by the license, users are provided only    */
2555/* with a limited warranty  and the software's author,  the holder of the     */
2556/* economic rights,  and the successive licensors  have only  limited         */
2557/* liability.                                                                 */
2558/*                                                                            */
2559/* In this respect, the user's attention is drawn to the risks associated     */
2560/* with loading,  using,  modifying and/or developing or reproducing the      */
2561/* software by the user in light of its specific status of free software,     */
2562/* that may mean  that it is complicated to manipulate,  and  that  also      */
2563/* therefore means  that it is reserved for developers  and  experienced      */
2564/* professionals having in-depth computer knowledge. Users are therefore      */
2565/* encouraged to load and test the software's suitability as regards their    */
2566/* requirements in conditions enabling the security of their systems and/or   */
2567/* data to be ensured and,  more generally, to use and operate it in the      */
2568/* same conditions as regards security.                                       */
2569/*                                                                            */
2570/* The fact that you are presently reading this means that you have had       */
2571/* knowledge of the CeCILL-C license and that you accept its terms.           */
2572/******************************************************************************/
2573/* version 1.7                                                                */
2574/******************************************************************************/
2575
2576#line 40 "convert.lex"
2577#include <math.h>
2578#include <stdlib.h>
2579#include <string.h>
2580
2581#define YY_NO_INPUT
2582#line 595 "convert.yy.c"
2583
2584#define INITIAL 0
2585#define character 1
2586
2587#ifndef YY_NO_UNISTD_H
2588/* Special case for "unistd.h", since it is non-ANSI. We include it way
2589 * down here because we want the user's section 1 to have been scanned first.
2590 * The user has a chance to override it with an option.
2591 */
2592#include <unistd.h>
2593#endif
2594
2595#ifndef YY_EXTRA_TYPE
2596#define YY_EXTRA_TYPE void *
2597#endif
2598
2599static int yy_init_globals (void );
2600
2601/* Accessor methods to globals.
2602   These are made visible to non-reentrant scanners for convenience. */
2603
2604int convert_lex_destroy (void );
2605
2606int convert_get_debug (void );
2607
2608void convert_set_debug (int debug_flag  );
2609
2610YY_EXTRA_TYPE convert_get_extra (void );
2611
2612void convert_set_extra (YY_EXTRA_TYPE user_defined  );
2613
2614FILE *convert_get_in (void );
2615
2616void convert_set_in  (FILE * in_str  );
2617
2618FILE *convert_get_out (void );
2619
2620void convert_set_out  (FILE * out_str  );
2621
2622yy_size_t convert_get_leng (void );
2623
2624char *convert_get_text (void );
2625
2626int convert_get_lineno (void );
2627
2628void convert_set_lineno (int line_number  );
2629
2630/* Macros after this point can all be overridden by user definitions in
2631 * section 1.
2632 */
2633
2634#ifndef YY_SKIP_YYWRAP
2635#ifdef __cplusplus
2636extern "C" int convert_wrap (void );
2637#else
2638extern int convert_wrap (void );
2639#endif
2640#endif
2641
2642    static void yyunput (int c,char *buf_ptr  );
2643   
2644#ifndef yytext_ptr
2645static void yy_flex_strncpy (char *,yyconst char *,int );
2646#endif
2647
2648#ifdef YY_NEED_STRLEN
2649static int yy_flex_strlen (yyconst char * );
2650#endif
2651
2652#ifndef YY_NO_INPUT
2653
2654#ifdef __cplusplus
2655static int yyinput (void );
2656#else
2657static int input (void );
2658#endif
2659
2660#endif
2661
2662/* Amount of stuff to slurp up with each read. */
2663#ifndef YY_READ_BUF_SIZE
2664#define YY_READ_BUF_SIZE 8192
2665#endif
2666
2667/* Copy whatever the last rule matched to the standard output. */
2668#ifndef ECHO
2669/* This used to be an fputs(), but since the string might contain NUL's,
2670 * we now use fwrite().
2671 */
2672#define ECHO fwrite( convert_text, convert_leng, 1, convert_out )
2673#endif
2674
2675/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
2676 * is returned in "result".
2677 */
2678#ifndef YY_INPUT
2679#define YY_INPUT(buf,result,max_size) \
2680   if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
2681      { \
2682      int c = '*'; \
2683      yy_size_t n; \
2684      for ( n = 0; n < max_size && \
2685              (c = getc( convert_in )) != EOF && c != '\n'; ++n ) \
2686         buf[n] = (char) c; \
2687      if ( c == '\n' ) \
2688         buf[n++] = (char) c; \
2689      if ( c == EOF && ferror( convert_in ) ) \
2690         YY_FATAL_ERROR( "input in flex scanner failed" ); \
2691      result = n; \
2692      } \
2693   else \
2694      { \
2695      errno=0; \
2696      while ( (result = fread(buf, 1, max_size, convert_in))==0 && ferror(convert_in)) \
2697         { \
2698         if( errno != EINTR) \
2699            { \
2700            YY_FATAL_ERROR( "input in flex scanner failed" ); \
2701            break; \
2702            } \
2703         errno=0; \
2704         clearerr(convert_in); \
2705         } \
2706      }\
2707\
2708
2709#endif
2710
2711/* No semi-colon after return; correct usage is to write "yyterminate();" -
2712 * we don't want an extra ';' after the "return" because that will cause
2713 * some compilers to complain about unreachable statements.
2714 */
2715#ifndef yyterminate
2716#define yyterminate() return YY_NULL
2717#endif
2718
2719/* Number of entries by which start-condition stack grows. */
2720#ifndef YY_START_STACK_INCR
2721#define YY_START_STACK_INCR 25
2722#endif
2723
2724/* Report a fatal error. */
2725#ifndef YY_FATAL_ERROR
2726#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
2727#endif
2728
2729/* end tables serialization structures and prototypes */
2730
2731/* Default declaration of generated scanner - a define so the user can
2732 * easily add parameters.
2733 */
2734#ifndef YY_DECL
2735#define YY_DECL_IS_OURS 1
2736
2737extern int convert_lex (void);
2738
2739#define YY_DECL int convert_lex (void)
2740#endif /* !YY_DECL */
2741
2742/* Code executed at the beginning of each rule, after convert_text and convert_leng
2743 * have been set up.
2744 */
2745#ifndef YY_USER_ACTION
2746#define YY_USER_ACTION
2747#endif
2748
2749/* Code executed at the end of each rule. */
2750#ifndef YY_BREAK
2751#define YY_BREAK break;
2752#endif
2753
2754#define YY_RULE_SETUP \
2755   YY_USER_ACTION
2756
2757/** The main scanner function which does all the work.
2758 */
2759YY_DECL
2760{
2761   register yy_state_type yy_current_state;
2762   register char *yy_cp, *yy_bp;
2763   register int yy_act;
2764   
2765#line 54 "convert.lex"
2766
2767#line 780 "convert.yy.c"
2768
2769   if ( !(yy_init) )
2770      {
2771      (yy_init) = 1;
2772
2773#ifdef YY_USER_INIT
2774      YY_USER_INIT;
2775#endif
2776
2777      if ( ! (yy_start) )
2778         (yy_start) = 1;   /* first start state */
2779
2780      if ( ! convert_in )
2781         convert_in = stdin;
2782
2783      if ( ! convert_out )
2784         convert_out = stdout;
2785
2786      if ( ! YY_CURRENT_BUFFER ) {
2787         convert_ensure_buffer_stack ();
2788         YY_CURRENT_BUFFER_LVALUE =
2789            convert__create_buffer(convert_in,YY_BUF_SIZE );
2790      }
2791
2792      convert__load_buffer_state( );
2793      }
2794
2795   while ( 1 )    /* loops until end-of-file is reached */
2796      {
2797      yy_cp = (yy_c_buf_p);
2798
2799      /* Support of convert_text. */
2800      *yy_cp = (yy_hold_char);
2801
2802      /* yy_bp points to the position in yy_ch_buf of the start of
2803       * the current run.
2804       */
2805      yy_bp = yy_cp;
2806
2807      yy_current_state = (yy_start);
2808yy_match:
2809      do
2810         {
2811         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
2812         if ( yy_accept[yy_current_state] )
2813            {
2814            (yy_last_accepting_state) = yy_current_state;
2815            (yy_last_accepting_cpos) = yy_cp;
2816            }
2817         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2818            {
2819            yy_current_state = (int) yy_def[yy_current_state];
2820            if ( yy_current_state >= 84 )
2821               yy_c = yy_meta[(unsigned int) yy_c];
2822            }
2823         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2824         ++yy_cp;
2825         }
2826      while ( yy_base[yy_current_state] != 194 );
2827
2828yy_find_action:
2829      yy_act = yy_accept[yy_current_state];
2830      if ( yy_act == 0 )
2831         { /* have to back up */
2832         yy_cp = (yy_last_accepting_cpos);
2833         yy_current_state = (yy_last_accepting_state);
2834         yy_act = yy_accept[yy_current_state];
2835         }
2836
2837      YY_DO_BEFORE_ACTION;
2838
2839do_action:  /* This label is used only to access EOF actions. */
2840
2841      switch ( yy_act )
2842   { /* beginning of action switch */
2843         case 0: /* must back up */
2844         /* undo the effects of YY_DO_BEFORE_ACTION */
2845         *yy_cp = (yy_hold_char);
2846         yy_cp = (yy_last_accepting_cpos);
2847         yy_current_state = (yy_last_accepting_state);
2848         goto yy_find_action;
2849
2850case 1:
2851YY_RULE_SETUP
2852#line 55 "convert.lex"
2853{ return TOK_MODULEMAIN; } /* name of the module                      */
2854   YY_BREAK
2855case 2:
2856YY_RULE_SETUP
2857#line 56 "convert.lex"
2858{ return TOK_NOTGRIDDEP; } /* variable which are not grid dependent   */
2859   YY_BREAK
2860case 3:
2861YY_RULE_SETUP
2862#line 57 "convert.lex"
2863{ return TOK_USE; }
2864   YY_BREAK
2865case 4:
2866YY_RULE_SETUP
2867#line 58 "convert.lex"
2868{ }
2869   YY_BREAK
2870case 5:
2871YY_RULE_SETUP
2872#line 59 "convert.lex"
2873{ return TOK_SEP; }
2874   YY_BREAK
2875case 6:
2876YY_RULE_SETUP
2877#line 60 "convert.lex"
2878{ return TOK_KIND; }
2879   YY_BREAK
2880case 7:
2881YY_RULE_SETUP
2882#line 61 "convert.lex"
2883{ return TOK_EQUAL; }
2884   YY_BREAK
2885case 8:
2886YY_RULE_SETUP
2887#line 62 "convert.lex"
2888{ strcpy(yylval.na,convert_text); return TOK_USEITEM;  }
2889   YY_BREAK
2890case 9:
2891YY_RULE_SETUP
2892#line 63 "convert.lex"
2893{ strcpy(yylval.na,convert_text); return TOK_PROBTYPE; }  /* dimension of the problem */
2894   YY_BREAK
2895case 10:
2896YY_RULE_SETUP
2897#line 64 "convert.lex"
2898{ strcpy(yylval.na,convert_text); return TOK_NAME; }
2899   YY_BREAK
2900case 11:
2901YY_RULE_SETUP
2902#line 65 "convert.lex"
2903{ strcpy(yylval.na,convert_text); return TOK_CSTINT; }
2904   YY_BREAK
2905case 12:
2906YY_RULE_SETUP
2907#line 66 "convert.lex"
2908{ return (int) *convert_text; }
2909   YY_BREAK
2910case 13:
2911/* rule 13 can match eol */
2912YY_RULE_SETUP
2913#line 67 "convert.lex"
2914{ line_num++; return (int) *convert_text; }
2915   YY_BREAK
2916case 14:
2917YY_RULE_SETUP
2918#line 68 "convert.lex"
2919;
2920   YY_BREAK
2921case 15:
2922YY_RULE_SETUP
2923#line 69 "convert.lex"
2924ECHO;
2925   YY_BREAK
2926#line 939 "convert.yy.c"
2927case YY_STATE_EOF(INITIAL):
2928case YY_STATE_EOF(character):
2929   yyterminate();
2930
2931   case YY_END_OF_BUFFER:
2932      {
2933      /* Amount of text matched not including the EOB char. */
2934      int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2935
2936      /* Undo the effects of YY_DO_BEFORE_ACTION. */
2937      *yy_cp = (yy_hold_char);
2938      YY_RESTORE_YY_MORE_OFFSET
2939
2940      if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2941         {
2942         /* We're scanning a new file or input source.  It's
2943          * possible that this happened because the user
2944          * just pointed convert_in at a new source and called
2945          * convert_lex().  If so, then we have to assure
2946          * consistency between YY_CURRENT_BUFFER and our
2947          * globals.  Here is the right place to do so, because
2948          * this is the first action (other than possibly a
2949          * back-up) that will match for the new input source.
2950          */
2951         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2952         YY_CURRENT_BUFFER_LVALUE->yy_input_file = convert_in;
2953         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2954         }
2955
2956      /* Note that here we test for yy_c_buf_p "<=" to the position
2957       * of the first EOB in the buffer, since yy_c_buf_p will
2958       * already have been incremented past the NUL character
2959       * (since all states make transitions on EOB to the
2960       * end-of-buffer state).  Contrast this with the test
2961       * in input().
2962       */
2963      if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2964         { /* This was really a NUL. */
2965         yy_state_type yy_next_state;
2966
2967         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2968
2969         yy_current_state = yy_get_previous_state(  );
2970
2971         /* Okay, we're now positioned to make the NUL
2972          * transition.  We couldn't have
2973          * yy_get_previous_state() go ahead and do it
2974          * for us because it doesn't know how to deal
2975          * with the possibility of jamming (and we don't
2976          * want to build jamming into it because then it
2977          * will run more slowly).
2978          */
2979
2980         yy_next_state = yy_try_NUL_trans( yy_current_state );
2981
2982         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2983
2984         if ( yy_next_state )
2985            {
2986            /* Consume the NUL. */
2987            yy_cp = ++(yy_c_buf_p);
2988            yy_current_state = yy_next_state;
2989            goto yy_match;
2990            }
2991
2992         else
2993            {
2994            yy_cp = (yy_c_buf_p);
2995            goto yy_find_action;
2996            }
2997         }
2998
2999      else switch ( yy_get_next_buffer(  ) )
3000         {
3001         case EOB_ACT_END_OF_FILE:
3002            {
3003            (yy_did_buffer_switch_on_eof) = 0;
3004
3005            if ( convert_wrap( ) )
3006               {
3007               /* Note: because we've taken care in
3008                * yy_get_next_buffer() to have set up
3009                * convert_text, we can now set up
3010                * yy_c_buf_p so that if some total
3011                * hoser (like flex itself) wants to
3012                * call the scanner after we return the
3013                * YY_NULL, it'll still work - another
3014                * YY_NULL will get returned.
3015                */
3016               (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
3017
3018               yy_act = YY_STATE_EOF(YY_START);
3019               goto do_action;
3020               }
3021
3022            else
3023               {
3024               if ( ! (yy_did_buffer_switch_on_eof) )
3025                  YY_NEW_FILE;
3026               }
3027            break;
3028            }
3029
3030         case EOB_ACT_CONTINUE_SCAN:
3031            (yy_c_buf_p) =
3032               (yytext_ptr) + yy_amount_of_matched_text;
3033
3034            yy_current_state = yy_get_previous_state(  );
3035
3036            yy_cp = (yy_c_buf_p);
3037            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3038            goto yy_match;
3039
3040         case EOB_ACT_LAST_MATCH:
3041            (yy_c_buf_p) =
3042            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3043
3044            yy_current_state = yy_get_previous_state(  );
3045
3046            yy_cp = (yy_c_buf_p);
3047            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3048            goto yy_find_action;
3049         }
3050      break;
3051      }
3052
3053   default:
3054      YY_FATAL_ERROR(
3055         "fatal flex scanner internal error--no action found" );
3056   } /* end of action switch */
3057      } /* end of scanning one token */
3058} /* end of convert_lex */
3059
3060/* yy_get_next_buffer - try to read in a new buffer
3061 *
3062 * Returns a code representing an action:
3063 * EOB_ACT_LAST_MATCH -
3064 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
3065 * EOB_ACT_END_OF_FILE - end of file
3066 */
3067static int yy_get_next_buffer (void)
3068{
3069      register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3070   register char *source = (yytext_ptr);
3071   register int number_to_move, i;
3072   int ret_val;
3073
3074   if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3075      YY_FATAL_ERROR(
3076      "fatal flex scanner internal error--end of buffer missed" );
3077
3078   if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3079      { /* Don't try to fill the buffer, so this is an EOF. */
3080      if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3081         {
3082         /* We matched a single character, the EOB, so
3083          * treat this as a final EOF.
3084          */
3085         return EOB_ACT_END_OF_FILE;
3086         }
3087
3088      else
3089         {
3090         /* We matched some text prior to the EOB, first
3091          * process it.
3092          */
3093         return EOB_ACT_LAST_MATCH;
3094         }
3095      }
3096
3097   /* Try to read more data. */
3098
3099   /* First move last chars to start of buffer. */
3100   number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3101
3102   for ( i = 0; i < number_to_move; ++i )
3103      *(dest++) = *(source++);
3104
3105   if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3106      /* don't do the read, it's not guaranteed to return an EOF,
3107       * just force an EOF
3108       */
3109      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3110
3111   else
3112      {
3113         yy_size_t num_to_read =
3114         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3115
3116      while ( num_to_read <= 0 )
3117         { /* Not enough room in the buffer - grow it. */
3118
3119         /* just a shorter name for the current buffer */
3120         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
3121
3122         int yy_c_buf_p_offset =
3123            (int) ((yy_c_buf_p) - b->yy_ch_buf);
3124
3125         if ( b->yy_is_our_buffer )
3126            {
3127            yy_size_t new_size = b->yy_buf_size * 2;
3128
3129            if ( new_size <= 0 )
3130               b->yy_buf_size += b->yy_buf_size / 8;
3131            else
3132               b->yy_buf_size *= 2;
3133
3134            b->yy_ch_buf = (char *)
3135               /* Include room in for 2 EOB chars. */
3136               convert_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
3137            }
3138         else
3139            /* Can't grow it, we don't own it. */
3140            b->yy_ch_buf = 0;
3141
3142         if ( ! b->yy_ch_buf )
3143            YY_FATAL_ERROR(
3144            "fatal error - scanner input buffer overflow" );
3145
3146         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3147
3148         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3149                  number_to_move - 1;
3150
3151         }
3152
3153      if ( num_to_read > YY_READ_BUF_SIZE )
3154         num_to_read = YY_READ_BUF_SIZE;
3155
3156      /* Read in more data. */
3157      YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3158         (yy_n_chars), num_to_read );
3159
3160      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3161      }
3162
3163   if ( (yy_n_chars) == 0 )
3164      {
3165      if ( number_to_move == YY_MORE_ADJ )
3166         {
3167         ret_val = EOB_ACT_END_OF_FILE;
3168         convert_restart(convert_in  );
3169         }
3170
3171      else
3172         {
3173         ret_val = EOB_ACT_LAST_MATCH;
3174         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3175            YY_BUFFER_EOF_PENDING;
3176         }
3177      }
3178
3179   else
3180      ret_val = EOB_ACT_CONTINUE_SCAN;
3181
3182   if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3183      /* Extend the array by 50%, plus the number we really need. */
3184      yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3185      YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) convert_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
3186      if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3187         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3188   }
3189
3190   (yy_n_chars) += number_to_move;
3191   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
3192   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
3193
3194   (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3195
3196   return ret_val;
3197}
3198
3199/* yy_get_previous_state - get the state just before the EOB char was reached */
3200
3201    static yy_state_type yy_get_previous_state (void)
3202{
3203   register yy_state_type yy_current_state;
3204   register char *yy_cp;
3205   
3206   yy_current_state = (yy_start);
3207
3208   for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3209      {
3210      register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3211      if ( yy_accept[yy_current_state] )
3212         {
3213         (yy_last_accepting_state) = yy_current_state;
3214         (yy_last_accepting_cpos) = yy_cp;
3215         }
3216      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3217         {
3218         yy_current_state = (int) yy_def[yy_current_state];
3219         if ( yy_current_state >= 84 )
3220            yy_c = yy_meta[(unsigned int) yy_c];
3221         }
3222      yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3223      }
3224
3225   return yy_current_state;
3226}
3227
3228/* yy_try_NUL_trans - try to make a transition on the NUL character
3229 *
3230 * synopsis
3231 * next_state = yy_try_NUL_trans( current_state );
3232 */
3233    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
3234{
3235   register int yy_is_jam;
3236      register char *yy_cp = (yy_c_buf_p);
3237
3238   register YY_CHAR yy_c = 1;
3239   if ( yy_accept[yy_current_state] )
3240      {
3241      (yy_last_accepting_state) = yy_current_state;
3242      (yy_last_accepting_cpos) = yy_cp;
3243      }
3244   while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3245      {
3246      yy_current_state = (int) yy_def[yy_current_state];
3247      if ( yy_current_state >= 84 )
3248         yy_c = yy_meta[(unsigned int) yy_c];
3249      }
3250   yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3251   yy_is_jam = (yy_current_state == 83);
3252
3253   return yy_is_jam ? 0 : yy_current_state;
3254}
3255
3256    static void yyunput (int c, register char * yy_bp )
3257{
3258   register char *yy_cp;
3259   
3260    yy_cp = (yy_c_buf_p);
3261
3262   /* undo effects of setting up convert_text */
3263   *yy_cp = (yy_hold_char);
3264
3265   if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3266      { /* need to shift things up to make room */
3267      /* +2 for EOB chars. */
3268      register yy_size_t number_to_move = (yy_n_chars) + 2;
3269      register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3270               YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3271      register char *source =
3272            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3273
3274      while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3275         *--dest = *--source;
3276
3277      yy_cp += (int) (dest - source);
3278      yy_bp += (int) (dest - source);
3279      YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3280         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3281
3282      if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3283         YY_FATAL_ERROR( "flex scanner push-back overflow" );
3284      }
3285
3286   *--yy_cp = (char) c;
3287
3288   (yytext_ptr) = yy_bp;
3289   (yy_hold_char) = *yy_cp;
3290   (yy_c_buf_p) = yy_cp;
3291}
3292
3293#ifndef YY_NO_INPUT
3294#ifdef __cplusplus
3295    static int yyinput (void)
3296#else
3297    static int input  (void)
3298#endif
3299
3300{
3301   int c;
3302   
3303   *(yy_c_buf_p) = (yy_hold_char);
3304
3305   if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3306      {
3307      /* yy_c_buf_p now points to the character we want to return.
3308       * If this occurs *before* the EOB characters, then it's a
3309       * valid NUL; if not, then we've hit the end of the buffer.
3310       */
3311      if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3312         /* This was really a NUL. */
3313         *(yy_c_buf_p) = '\0';
3314
3315      else
3316         { /* need more input */
3317         yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
3318         ++(yy_c_buf_p);
3319
3320         switch ( yy_get_next_buffer(  ) )
3321            {
3322            case EOB_ACT_LAST_MATCH:
3323               /* This happens because yy_g_n_b()
3324                * sees that we've accumulated a
3325                * token and flags that we need to
3326                * try matching the token before
3327                * proceeding.  But for input(),
3328                * there's no matching to consider.
3329                * So convert the EOB_ACT_LAST_MATCH
3330                * to EOB_ACT_END_OF_FILE.
3331                */
3332
3333               /* Reset buffer status. */
3334               convert_restart(convert_in );
3335
3336               /*FALLTHROUGH*/
3337
3338            case EOB_ACT_END_OF_FILE:
3339               {
3340               if ( convert_wrap( ) )
3341                  return 0;
3342
3343               if ( ! (yy_did_buffer_switch_on_eof) )
3344                  YY_NEW_FILE;
3345#ifdef __cplusplus
3346               return yyinput();
3347#else
3348               return input();
3349#endif
3350               }
3351
3352            case EOB_ACT_CONTINUE_SCAN:
3353               (yy_c_buf_p) = (yytext_ptr) + offset;
3354               break;
3355            }
3356         }
3357      }
3358
3359   c = *(unsigned char *) (yy_c_buf_p);   /* cast for 8-bit char's */
3360   *(yy_c_buf_p) = '\0';   /* preserve convert_text */
3361   (yy_hold_char) = *++(yy_c_buf_p);
3362
3363   return c;
3364}
3365#endif   /* ifndef YY_NO_INPUT */
3366
3367/** Immediately switch to a different input stream.
3368 * @param input_file A readable stream.
3369 *
3370 * @note This function does not reset the start condition to @c INITIAL .
3371 */
3372    void convert_restart  (FILE * input_file )
3373{
3374   
3375   if ( ! YY_CURRENT_BUFFER ){
3376        convert_ensure_buffer_stack ();
3377      YY_CURRENT_BUFFER_LVALUE =
3378            convert__create_buffer(convert_in,YY_BUF_SIZE );
3379   }
3380
3381   convert__init_buffer(YY_CURRENT_BUFFER,input_file );
3382   convert__load_buffer_state( );
3383}
3384
3385/** Switch to a different input buffer.
3386 * @param new_buffer The new input buffer.
3387 *
3388 */
3389    void convert__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
3390{
3391   
3392   /* TODO. We should be able to replace this entire function body
3393    * with
3394    *    convert_pop_buffer_state();
3395    *    convert_push_buffer_state(new_buffer);
3396     */
3397   convert_ensure_buffer_stack ();
3398   if ( YY_CURRENT_BUFFER == new_buffer )
3399      return;
3400
3401   if ( YY_CURRENT_BUFFER )
3402      {
3403      /* Flush out information for old buffer. */
3404      *(yy_c_buf_p) = (yy_hold_char);
3405      YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3406      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3407      }
3408
3409   YY_CURRENT_BUFFER_LVALUE = new_buffer;
3410   convert__load_buffer_state( );
3411
3412   /* We don't actually know whether we did this switch during
3413    * EOF (convert_wrap()) processing, but the only time this flag
3414    * is looked at is after convert_wrap() is called, so it's safe
3415    * to go ahead and always set it.
3416    */
3417   (yy_did_buffer_switch_on_eof) = 1;
3418}
3419
3420static void convert__load_buffer_state  (void)
3421{
3422      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3423   (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3424   convert_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3425   (yy_hold_char) = *(yy_c_buf_p);
3426}
3427
3428/** Allocate and initialize an input buffer state.
3429 * @param file A readable stream.
3430 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
3431 *
3432 * @return the allocated buffer state.
3433 */
3434    YY_BUFFER_STATE convert__create_buffer  (FILE * file, int  size )
3435{
3436   YY_BUFFER_STATE b;
3437   
3438   b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state )  );
3439   if ( ! b )
3440      YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
3441
3442   b->yy_buf_size = size;
3443
3444   /* yy_ch_buf has to be 2 characters longer than the size given because
3445    * we need to put in 2 end-of-buffer characters.
3446    */
3447   b->yy_ch_buf = (char *) convert_alloc(b->yy_buf_size + 2  );
3448   if ( ! b->yy_ch_buf )
3449      YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
3450
3451   b->yy_is_our_buffer = 1;
3452
3453   convert__init_buffer(b,file );
3454
3455   return b;
3456}
3457
3458/** Destroy the buffer.
3459 * @param b a buffer created with convert__create_buffer()
3460 *
3461 */
3462    void convert__delete_buffer (YY_BUFFER_STATE  b )
3463{
3464   
3465   if ( ! b )
3466      return;
3467
3468   if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3469      YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
3470
3471   if ( b->yy_is_our_buffer )
3472      convert_free((void *) b->yy_ch_buf  );
3473
3474   convert_free((void *) b  );
3475}
3476
3477#ifndef __cplusplus
3478extern int isatty (int );
3479#endif /* __cplusplus */
3480   
3481/* Initializes or reinitializes a buffer.
3482 * This function is sometimes called more than once on the same buffer,
3483 * such as during a convert_restart() or at EOF.
3484 */
3485    static void convert__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
3486
3487{
3488   int oerrno = errno;
3489   
3490   convert__flush_buffer(b );
3491
3492   b->yy_input_file = file;
3493   b->yy_fill_buffer = 1;
3494
3495    /* If b is the current buffer, then convert__init_buffer was _probably_
3496     * called from convert_restart() or through yy_get_next_buffer.
3497     * In that case, we don't want to reset the lineno or column.
3498     */
3499    if (b != YY_CURRENT_BUFFER){
3500        b->yy_bs_lineno = 1;
3501        b->yy_bs_column = 0;
3502    }
3503
3504        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
3505   
3506   errno = oerrno;
3507}
3508
3509/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
3510 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
3511 *
3512 */
3513    void convert__flush_buffer (YY_BUFFER_STATE  b )
3514{
3515      if ( ! b )
3516      return;
3517
3518   b->yy_n_chars = 0;
3519
3520   /* We always need two end-of-buffer characters.  The first causes
3521    * a transition to the end-of-buffer state.  The second causes
3522    * a jam in that state.
3523    */
3524   b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3525   b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3526
3527   b->yy_buf_pos = &b->yy_ch_buf[0];
3528
3529   b->yy_at_bol = 1;
3530   b->yy_buffer_status = YY_BUFFER_NEW;
3531
3532   if ( b == YY_CURRENT_BUFFER )
3533      convert__load_buffer_state( );
3534}
3535
3536/** Pushes the new state onto the stack. The new state becomes
3537 *  the current state. This function will allocate the stack
3538 *  if necessary.
3539 *  @param new_buffer The new state.
3540 * 
3541 */
3542void convert_push_buffer_state (YY_BUFFER_STATE new_buffer )
3543{
3544      if (new_buffer == NULL)
3545      return;
3546
3547   convert_ensure_buffer_stack();
3548
3549   /* This block is copied from convert__switch_to_buffer. */
3550   if ( YY_CURRENT_BUFFER )
3551      {
3552      /* Flush out information for old buffer. */
3553      *(yy_c_buf_p) = (yy_hold_char);
3554      YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3555      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3556      }
3557
3558   /* Only push if top exists. Otherwise, replace top. */
3559   if (YY_CURRENT_BUFFER)
3560      (yy_buffer_stack_top)++;
3561   YY_CURRENT_BUFFER_LVALUE = new_buffer;
3562
3563   /* copied from convert__switch_to_buffer. */
3564   convert__load_buffer_state( );
3565   (yy_did_buffer_switch_on_eof) = 1;
3566}
3567
3568/** Removes and deletes the top of the stack, if present.
3569 *  The next element becomes the new top.
3570 * 
3571 */
3572void convert_pop_buffer_state (void)
3573{
3574      if (!YY_CURRENT_BUFFER)
3575      return;
3576
3577   convert__delete_buffer(YY_CURRENT_BUFFER );
3578   YY_CURRENT_BUFFER_LVALUE = NULL;
3579   if ((yy_buffer_stack_top) > 0)
3580      --(yy_buffer_stack_top);
3581
3582   if (YY_CURRENT_BUFFER) {
3583      convert__load_buffer_state( );
3584      (yy_did_buffer_switch_on_eof) = 1;
3585   }
3586}
3587
3588/* Allocates the stack if it does not exist.
3589 *  Guarantees space for at least one push.
3590 */
3591static void convert_ensure_buffer_stack (void)
3592{
3593   yy_size_t num_to_alloc;
3594   
3595   if (!(yy_buffer_stack)) {
3596
3597      /* First allocation is just for 2 elements, since we don't know if this
3598       * scanner will even need a stack. We use 2 instead of 1 to avoid an
3599       * immediate realloc on the next call.
3600         */
3601      num_to_alloc = 1;
3602      (yy_buffer_stack) = (struct yy_buffer_state**)convert_alloc
3603                        (num_to_alloc * sizeof(struct yy_buffer_state*)
3604                        );
3605      if ( ! (yy_buffer_stack) )
3606         YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
3607                         
3608      memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3609           
3610      (yy_buffer_stack_max) = num_to_alloc;
3611      (yy_buffer_stack_top) = 0;
3612      return;
3613   }
3614
3615   if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3616
3617      /* Increase the buffer to prepare for a possible push. */
3618      int grow_size = 8 /* arbitrary grow size */;
3619
3620      num_to_alloc = (yy_buffer_stack_max) + grow_size;
3621      (yy_buffer_stack) = (struct yy_buffer_state**)convert_realloc
3622                        ((yy_buffer_stack),
3623                        num_to_alloc * sizeof(struct yy_buffer_state*)
3624                        );
3625      if ( ! (yy_buffer_stack) )
3626         YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
3627
3628      /* zero only the new slots.*/
3629      memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3630      (yy_buffer_stack_max) = num_to_alloc;
3631   }
3632}
3633
3634/** Setup the input buffer state to scan directly from a user-specified character buffer.
3635 * @param base the character buffer
3636 * @param size the size in bytes of the character buffer
3637 *
3638 * @return the newly allocated buffer state object.
3639 */
3640YY_BUFFER_STATE convert__scan_buffer  (char * base, yy_size_t  size )
3641{
3642   YY_BUFFER_STATE b;
3643   
3644   if ( size < 2 ||
3645        base[size-2] != YY_END_OF_BUFFER_CHAR ||
3646        base[size-1] != YY_END_OF_BUFFER_CHAR )
3647      /* They forgot to leave room for the EOB's. */
3648      return 0;
3649
3650   b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state )  );
3651   if ( ! b )
3652      YY_FATAL_ERROR( "out of dynamic memory in convert__scan_buffer()" );
3653
3654   b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3655   b->yy_buf_pos = b->yy_ch_buf = base;
3656   b->yy_is_our_buffer = 0;
3657   b->yy_input_file = 0;
3658   b->yy_n_chars = b->yy_buf_size;
3659   b->yy_is_interactive = 0;
3660   b->yy_at_bol = 1;
3661   b->yy_fill_buffer = 0;
3662   b->yy_buffer_status = YY_BUFFER_NEW;
3663
3664   convert__switch_to_buffer();
3665
3666   return b;
3667}
3668
3669/** Setup the input buffer state to scan a string. The next call to convert_lex() will
3670 * scan from a @e copy of @a str.
3671 * @param yystr a NUL-terminated string to scan
3672 *
3673 * @return the newly allocated buffer state object.
3674 * @note If you want to scan bytes that may contain NUL values, then use
3675 *       convert__scan_bytes() instead.
3676 */
3677YY_BUFFER_STATE convert__scan_string (yyconst char * yystr )
3678{
3679   
3680   return convert__scan_bytes(yystr,strlen(yystr) );
3681}
3682
3683/** Setup the input buffer state to scan the given bytes. The next call to convert_lex() will
3684 * scan from a @e copy of @a bytes.
3685 * @param bytes the byte buffer to scan
3686 * @param len the number of bytes in the buffer pointed to by @a bytes.
3687 *
3688 * @return the newly allocated buffer state object.
3689 */
3690YY_BUFFER_STATE convert__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
3691{
3692   YY_BUFFER_STATE b;
3693   char *buf;
3694   yy_size_t n, i;
3695   
3696   /* Get memory for full buffer, including space for trailing EOB's. */
3697   n = _yybytes_len + 2;
3698   buf = (char *) convert_alloc();
3699   if ( ! buf )
3700      YY_FATAL_ERROR( "out of dynamic memory in convert__scan_bytes()" );
3701
3702   for ( i = 0; i < _yybytes_len; ++i )
3703      buf[i] = yybytes[i];
3704
3705   buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3706
3707   b = convert__scan_buffer(buf,n );
3708   if ( ! b )
3709      YY_FATAL_ERROR( "bad buffer in convert__scan_bytes()" );
3710
3711   /* It's okay to grow etc. this buffer, and we should throw it
3712    * away when we're done.
3713    */
3714   b->yy_is_our_buffer = 1;
3715
3716   return b;
3717}
3718
3719#ifndef YY_EXIT_FAILURE
3720#define YY_EXIT_FAILURE 2
3721#endif
3722
3723static void yy_fatal_error (yyconst char* msg )
3724{
3725      (void) fprintf( stderr, "%s\n", msg );
3726   exit( YY_EXIT_FAILURE );
3727}
3728
3729/* Redefine yyless() so it works in section 3 code. */
3730
3731#undef yyless
3732#define yyless(n) \
3733   do \
3734      { \
3735      /* Undo effects of setting up convert_text. */ \
3736        int yyless_macro_arg = (n); \
3737        YY_LESS_LINENO(yyless_macro_arg);\
3738      convert_text[convert_leng] = (yy_hold_char); \
3739      (yy_c_buf_p) = convert_text + yyless_macro_arg; \
3740      (yy_hold_char) = *(yy_c_buf_p); \
3741      *(yy_c_buf_p) = '\0'; \
3742      convert_leng = yyless_macro_arg; \
3743      } \
3744   while ( 0 )
3745
3746/* Accessor  methods (get/set functions) to struct members. */
3747
3748/** Get the current line number.
3749 *
3750 */
3751int convert_get_lineno  (void)
3752{
3753       
3754    return convert_lineno;
3755}
3756
3757/** Get the input stream.
3758 *
3759 */
3760FILE *convert_get_in  (void)
3761{
3762        return convert_in;
3763}
3764
3765/** Get the output stream.
3766 *
3767 */
3768FILE *convert_get_out  (void)
3769{
3770        return convert_out;
3771}
3772
3773/** Get the length of the current token.
3774 *
3775 */
3776yy_size_t convert_get_leng  (void)
3777{
3778        return convert_leng;
3779}
3780
3781/** Get the current token.
3782 *
3783 */
3784
3785char *convert_get_text  (void)
3786{
3787        return convert_text;
3788}
3789
3790/** Set the current line number.
3791 * @param line_number
3792 *
3793 */
3794void convert_set_lineno (int  line_number )
3795{
3796   
3797    convert_lineno = line_number;
3798}
3799
3800/** Set the input stream. This does not discard the current
3801 * input buffer.
3802 * @param in_str A readable stream.
3803 *
3804 * @see convert__switch_to_buffer
3805 */
3806void convert_set_in (FILE *  in_str )
3807{
3808        convert_in = in_str ;
3809}
3810
3811void convert_set_out (FILE *  out_str )
3812{
3813        convert_out = out_str ;
3814}
3815
3816int convert_get_debug  (void)
3817{
3818        return convert__flex_debug;
3819}
3820
3821void convert_set_debug (int  bdebug )
3822{
3823        convert__flex_debug = bdebug ;
3824}
3825
3826static int yy_init_globals (void)
3827{
3828        /* Initialization is the same as for the non-reentrant scanner.
3829     * This function is called from convert_lex_destroy(), so don't allocate here.
3830     */
3831
3832    (yy_buffer_stack) = 0;
3833    (yy_buffer_stack_top) = 0;
3834    (yy_buffer_stack_max) = 0;
3835    (yy_c_buf_p) = (char *) 0;
3836    (yy_init) = 0;
3837    (yy_start) = 0;
3838
3839/* Defined in main.c */
3840#ifdef YY_STDINIT
3841    convert_in = stdin;
3842    convert_out = stdout;
3843#else
3844    convert_in = (FILE *) 0;
3845    convert_out = (FILE *) 0;
3846#endif
3847
3848    /* For future reference: Set errno on error, since we are called by
3849     * convert_lex_init()
3850     */
3851    return 0;
3852}
3853
3854/* convert_lex_destroy is for both reentrant and non-reentrant scanners. */
3855int convert_lex_destroy  (void)
3856{
3857   
3858    /* Pop the buffer stack, destroying each element. */
3859   while(YY_CURRENT_BUFFER){
3860      convert__delete_buffer(YY_CURRENT_BUFFER  );
3861      YY_CURRENT_BUFFER_LVALUE = NULL;
3862      convert_pop_buffer_state();
3863   }
3864
3865   /* Destroy the stack itself. */
3866   convert_free((yy_buffer_stack) );
3867   (yy_buffer_stack) = NULL;
3868
3869    /* Reset the globals. This is important in a non-reentrant scanner so the next time
3870     * convert_lex() is called, initialization will occur. */
3871    yy_init_globals( );
3872
3873    return 0;
3874}
3875
3876/*
3877 * Internal utility routines.
3878 */
3879
3880#ifndef yytext_ptr
3881static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3882{
3883   register int i;
3884   for ( i = 0; i < n; ++i )
3885      s1[i] = s2[i];
3886}
3887#endif
3888
3889#ifdef YY_NEED_STRLEN
3890static int yy_flex_strlen (yyconst char * s )
3891{
3892   register int n;
3893   for ( n = 0; s[n]; ++n )
3894      ;
3895
3896   return n;
3897}
3898#endif
3899
3900void *convert_alloc (yy_size_t  size )
3901{
3902   return (void *) malloc( size );
3903}
3904
3905void *convert_realloc  (void * ptr, yy_size_t  size )
3906{
3907   /* The cast to (char *) in the following accommodates both
3908    * implementations that use char* generic pointers, and those
3909    * that use void* generic pointers.  It works with the latter
3910    * because both ANSI C and C++ allow castless assignment from
3911    * any pointer type to void*, and deal with argument conversions
3912    * as though doing an assignment.
3913    */
3914   return (void *) realloc( (char *) ptr, size );
3915}
3916
3917void convert_free (void * ptr )
3918{
3919   free( (char *) ptr );   /* see convert_realloc() for (char *) cast */
3920}
3921
3922#define YYTABLES_NAME "yytables"
3923
3924#line 69 "convert.lex"
3925
3926
3927
Note: See TracBrowser for help on using the repository browser.