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 vendors/AGRIF/CMEMS_2020/LIB – NEMO

source: vendors/AGRIF/CMEMS_2020/LIB/main.c @ 10725

Last change on this file since 10725 was 10725, checked in by rblod, 5 years ago

Update agrif library and conv see ticket #2129

  • Property svn:keywords set to Id
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
1657    char filetoparse[LONG_FNAME];
1658
1659/******************************************************************************/
1660/*  1-  Variables initialization                                              */
1661/******************************************************************************/
1662    List_Global_Var = (listvar *) NULL;
1663    List_GlobalParameter_Var = (listvar *) NULL;
1664    List_Common_Var = (listvar *) NULL;
1665    List_Allocate_Var = (listallocate *) NULL;
1666    List_SubroutineWhereAgrifUsed = (listnom *) NULL;
1667    List_Subroutine_For_Alloc = (listnom *) NULL;
1668    List_Include = (listusemodule *) NULL;
1669    List_NameOfModuleUsed = (listusemodule *) NULL;
1670    listofmoduletmp = (listusemodule *) NULL;
1671    List_SubroutineDeclaration_Var = (listvar *) NULL;
1672    List_UsedInSubroutine_Var = (listvar *) NULL;
1673    List_NotGridDepend_Var = (listvar *) NULL;
1674    Listofavailableindices = (listindice *) NULL;
1675    Listofavailableindices_glob = (listindice **) calloc(NB_CAT_VARIABLES,sizeof(listindice *));
1676    List_CouplePointed_Var = (listvarpointtovar *) NULL;
1677    List_ModuleUsed_Var = (listvar *) NULL;
1678    List_ModuleUsedInModuleUsed_Var = (listvar *) NULL;
1679    List_GlobParamModuleUsed_Var = (listparameter *) NULL;
1680    List_GlobParamModuleUsedInModuleUsed_Var = (listparameter *) NULL;
1681    List_SubroutineArgument_Var = (listvar *) NULL;
1682    List_FunctionType_Var = (listvar *) NULL;
1683    tmpuselocallist = (listusemodule *) NULL;
1684    List_ContainsSubroutine = (listnom *) NULL;
1685    List_Do_labels = (listname *) NULL;
1686    oldfortran_out = (FILE *) NULL;
1687
1688    if ( argc < 2 )
1689        print_usage();
1690
1691    strcpy(config_file, argv[1]);
1692    strcpy(work_dir, ".");
1693    strcpy(input_dir, ".");
1694    strcpy(output_dir, "AGRIF_MODELFILES");
1695    strcpy(include_dir, "AGRIF_INC");
1696    strcpy(filetoparse, "");
1697    strcpy(subofagrifinitgrids, "");
1698    strcpy(meetagrifinitgrids, "");
1699    strcpy(mpiinitvar, "");
1700
1701    length_last = 0 ;
1702    length_first = 0 ;
1703    length_v_vallengspec = 0 ;
1704    length_v_commoninfile = 0 ;
1705    length_v_precision = 0 ;
1706    length_v_IntentSpec = 0 ;
1707    length_v_initialvalue = 0 ;
1708    length_v_readedlistdimension = 0 ;
1709    length_a_nomvar = 0 ;
1710    length_toprintglob = 0 ;
1711    length_tmpvargridname = 0 ;
1712    length_ligne_Subloop = 0 ;
1713    length_toprint_utilagrif = 0 ;
1714    length_toprinttmp_utilchar = 0 ;
1715    length_ligne_writedecl = 0 ;
1716    length_newname_toamr = 0 ;
1717    length_newname_writedecl = 0 ;
1718    length_ligne_toamr = 0 ;
1719    length_tmpligne_writedecl = 0 ;
1720    value_char_size = 0 ;
1721    value_char_size1 = 0 ;
1722    value_char_size2 = 0 ;
1723    value_char_size3 = 0 ;
1724    inallocate = 0;
1725    infixed = 1;
1726    infree  = 0;
1727
1728    onlyfixedgrids=0;
1729    fixedgrids=0;
1730    InAgrifParentDef = 0;
1731    IndicenbmaillesX=0;
1732    IndicenbmaillesY=0;
1733    IndicenbmaillesZ=0;
1734    created_dimensionlist = 1;
1735    /* current indice in the table tabvars             */
1736    for ( i=0 ; i<NB_CAT_VARIABLES ; i++)
1737    {
1738        indicemaxtabvars[i] = 0;
1739    }
1740    SubloopScalar = 0;
1741    todebug = 0;
1742    retour77 = 1 ;
1743    shouldincludempif = 0 ;
1744
1745    Read_val_max();
1746
1747/******************************************************************************/
1748/*  2-  Program arguments                                                     */
1749/******************************************************************************/
1750
1751    if ( (convert_in=fopen(config_file,"r")) == NULL )
1752    {
1753        printf("##\n## ERROR: the configuration file '%s' doesn't exist.\n##\n", config_file);
1754        print_usage();
1755    }
1756
1757    i=2;
1758    while ( i < argc )
1759    {
1760        if (!strcasecmp(argv[i], "-workdir"))
1761        {
1762            strcpy(work_dir,argv[i+1]);
1763            i++;
1764        }
1765        else if (!strcasecmp(argv[i], "-incdir"))
1766        {
1767            strcpy(include_dir,argv[i+1]);
1768            i++;
1769        }
1770        else if (!strcasecmp(argv[i], "-comdirin")) /* input directory           */
1771        {
1772            strcpy(input_dir,argv[i+1]);
1773            i++;
1774        }
1775        else if (!strcasecmp(argv[i], "-comdirout")) /* output directory         */
1776        {
1777            strcpy(output_dir,argv[i+1]);
1778            i++;
1779        }
1780        else if (!strcasecmp(argv[i], "-convfile")) /* file to parse             */
1781        {
1782            strcpy(filetoparse, argv[i+1]);
1783            i++;
1784            infree  = (strstr(filetoparse, ".f90") != NULL) || (strstr(filetoparse, ".F90") != NULL);
1785            infixed = ! infree;
1786        }
1787        else if (!strcasecmp(argv[i], "-free"))
1788        {
1789            stylegiven = 1;
1790            infreegiven  = 1 ;
1791            infixedgiven = 0;
1792        }
1793        else if (!strcasecmp(argv[i], "-fixed"))
1794        {
1795            stylegiven = 1;
1796            infreegiven  = 0;
1797            infixedgiven = 1;
1798        }
1799        else if (!strcasecmp(argv[i], "-SubloopScalar"))
1800        {
1801            SubloopScalar = 1 ;
1802        }
1803        else if (!strcasecmp(argv[i], "-SubloopScalar1"))
1804        {
1805            SubloopScalar = 2 ;
1806        }
1807        else if (!strcasecmp(argv[i], "-todebug"))
1808        {
1809            todebug = 1 ;
1810        }
1811        else if (!strcasecmp(argv[i],"-rm")) { }
1812        else
1813        {
1814            printf("##\n## Unkwon option : %s\n##\n", argv[i]);
1815            exit(0);
1816        }
1817        i++;
1818    }
1819    // Check input file
1820    if ( strlen(filetoparse) == 0 )         // -convfile has not been specified
1821    {
1822        printf("##\n## ERROR: please provide a file to parse with -convfile.\n##\n");
1823        print_usage();
1824    }
1825    // Setup input & output directories
1826    if ( strcasecmp(work_dir, ".") != 0 )   // -workdir has been changed...
1827    {
1828        if ( strcasecmp(input_dir,  ".") == 0 )                 // ...and -comdirin  has NOT been changed
1829        {
1830            strcpy(input_dir, work_dir);
1831        }
1832        if ( strcasecmp(output_dir, "AGRIF_MODELFILES") == 0 )  // ...and -comdirout has NOT been changed
1833        {
1834            sprintf(output_dir, "%s/%s", work_dir, "AGRIF_MODELFILES");
1835        }
1836        if ( strcasecmp(include_dir, "AGRIF_INC") == 0 )        // ...and -incdir    has NOT been changed
1837        {
1838            sprintf(include_dir, "%s/%s", work_dir, "AGRIF_INC");
1839        }
1840    }
1841    if (stylegiven == 1)
1842    {
1843        infree  = infreegiven;
1844        infixed = infixedgiven;
1845    }
1846
1847/******************************************************************************/
1848/*  3-  Parsing of the conv file <name>.in                                    */
1849/******************************************************************************/
1850
1851    if ( strstr(filetoparse, ".f90") || strstr(filetoparse, ".F90") ) retour77 = 0;
1852
1853    convert_parse();
1854
1855/******************************************************************************/
1856/*  4-  Preparation of the file parsing                                       */
1857/******************************************************************************/
1858
1859    sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
1860    /*                                                                         */
1861    if ( (dependglobaloutput=fopen(dependfilename, "r")) != NULL )
1862    {
1863        for (i=0;i<NB_CAT_VARIABLES;i++)
1864        {
1865            fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars[i]);
1866        }
1867        fclose(dependglobaloutput);
1868    }
1869    Readthedependavailablefile();
1870    /* Read the .dependnbxnby file which contains indices of nbmaillsX, nbmailleY and nbmailleZ */
1871    Readthedependnbxnbyfile();
1872    Read_Subroutine_For_Alloc();
1873
1874/******************************************************************************/
1875/*  5-  Parsing of the input file (2 times)                                   */
1876/******************************************************************************/
1877
1878    /* Record all variables in list                                            */
1879    firstpass = 1;
1880    process_fortran(filetoparse);
1881
1882    CompleteThelistvarindoloop();
1883    /* Read list of module used                                                */
1884    RecordUseModulesVariables();
1885    /* Read list of module used in module used                                 */
1886    RecordUseModulesUseModulesVariables();
1887    /* Save variables are considered as globals ones                           */
1888    Update_List_Global_Var_From_List_Save_Var();
1889    /* Update all lists                                                        */
1890    ListUpdate();
1891
1892    Clean_List_Global_Var();
1893    /* Indice tabvars identification                                           */
1894    IndiceTabvarsIdentification();
1895    /* Update all lists                                                        */
1896    ListUpdate();
1897    /* The allocation subroutine is necessary ????                             */
1898    New_Allocate_Subroutine_Is_Necessary();
1899    /* The allocation subroutine is necessary for common list                  */
1900    New_Allocate_Subroutine_For_Common_Is_Necessary();
1901    /* Sort List_SubroutineArgument_Var                                        */
1902    Sort_List_SubroutineArgument_Var();
1903    /* Clean all lists                                                         */
1904    ListClean();
1905    /* Update Indice of List_UsedInSubroutine_Var from module used             */
1906    List_UsedInSubroutine_Var_Update_From_Module_Used();
1907    /* Update List_SubroutineWhereAgrifUsed                                    */
1908    UpdateList_SubroutineWhereAgrifUsed();
1909    /* Update List_UsedInSubroutine_Var with v_readedlistdimension             */
1910    UpdateList_UsedInSubroutine_With_dimension();
1911
1912    ModifyThelistvarindoloop();
1913    UpdateListDeclarationWithDimensionList();
1914    GiveTypeOfVariables();
1915
1916    /* Build new subroutines                                                   */
1917    firstpass = 0;
1918    /*
1919    printf("**********************************\n");
1920    printf("SECOND PASSES \n");
1921    printf("**********************************\n");
1922    */
1923    process_fortran(filetoparse);
1924
1925    newvar = (listvar *) NULL;
1926
1927    while ( newvar )
1928    {
1929        printf("++++ %s %d %s %s %s\n",
1930            newvar->var->v_nomvar,
1931            newvar->var->v_nbdim,
1932            newvar->var->v_subroutinename,
1933            newvar->var->v_modulename,
1934            newvar->var->v_typevar);
1935        newvar = newvar->suiv;
1936    }
1937
1938/******************************************************************************/
1939/*  6-  Write informations in output files                                    */
1940/******************************************************************************/
1941
1942    /* Write the .dependglobal_agrif file which contain the max indice         */
1943    /*    of the tabvars table                                                 */
1944    sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
1945    dependglobaloutput = fopen(dependfilename, "w");
1946    for (i=0;i<NB_CAT_VARIABLES;i++)
1947    {
1948        fprintf(dependglobaloutput,"%d\n",indicemaxtabvars[i]);
1949    }
1950    fclose(dependglobaloutput);
1951    /* Write the list of available indice                                      */
1952    Writethedependavailablefile();
1953    /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
1954    /*    nbmailleY and nbmailleZ                                              */
1955    Writethedependnbxnbyfile();
1956    /* Write the .depend<namefile> file which contain general informations     */
1957    /*    about variable of this file                                          */
1958    parcours = List_NameOfModule;
1959    while( parcours )
1960    {
1961        Writethedependlistofmoduleused(parcours->o_nom);
1962        WritedependParameterList(parcours->o_nom);
1963        Writethedependfile(parcours->o_nom,List_Global_Var);
1964        parcours=parcours->suiv;
1965    }
1966    parcours = List_NameOfCommon;
1967    while( parcours )
1968    {
1969        Writethedependfile(parcours->o_nom,List_Common_Var);
1970        parcours=parcours->suiv;
1971    }
1972    Write_Subroutine_For_Alloc();
1973
1974/******************************************************************************/
1975/*  7-  Create files in AGRIF_INC directory                                   */
1976/******************************************************************************/
1977
1978    creefichieramr();
1979
1980    Write_val_max();
1981
1982    if ( todebug == 1 ) printf("Out of CONV \n");
1983    return 0;
1984}
1985
1986#line 2 "convert.yy.c"
1987
1988#line 4 "convert.yy.c"
1989
1990#define  YY_INT_ALIGNED short int
1991
1992/* A lexical scanner generated by flex */
1993
1994#define yy_create_buffer convert__create_buffer
1995#define yy_delete_buffer convert__delete_buffer
1996#define yy_flex_debug convert__flex_debug
1997#define yy_init_buffer convert__init_buffer
1998#define yy_flush_buffer convert__flush_buffer
1999#define yy_load_buffer_state convert__load_buffer_state
2000#define yy_switch_to_buffer convert__switch_to_buffer
2001#define yyin convert_in
2002#define yyleng convert_leng
2003#define yylex convert_lex
2004#define yylineno convert_lineno
2005#define yyout convert_out
2006#define yyrestart convert_restart
2007#define yytext convert_text
2008#define yywrap convert_wrap
2009#define yyalloc convert_alloc
2010#define yyrealloc convert_realloc
2011#define yyfree convert_free
2012
2013#define FLEX_SCANNER
2014#define YY_FLEX_MAJOR_VERSION 2
2015#define YY_FLEX_MINOR_VERSION 5
2016#define YY_FLEX_SUBMINOR_VERSION 35
2017#if YY_FLEX_SUBMINOR_VERSION > 0
2018#define FLEX_BETA
2019#endif
2020
2021/* First, we deal with  platform-specific or compiler-specific issues. */
2022
2023/* begin standard C headers. */
2024#include <stdio.h>
2025#include <string.h>
2026#include <errno.h>
2027#include <stdlib.h>
2028
2029/* end standard C headers. */
2030
2031/* flex integer type definitions */
2032
2033#ifndef FLEXINT_H
2034#define FLEXINT_H
2035
2036/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
2037
2038#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
2039
2040/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
2041 * if you want the limit (max/min) macros for int types.
2042 */
2043#ifndef __STDC_LIMIT_MACROS
2044#define __STDC_LIMIT_MACROS 1
2045#endif
2046
2047#include <inttypes.h>
2048typedef int8_t flex_int8_t;
2049typedef uint8_t flex_uint8_t;
2050typedef int16_t flex_int16_t;
2051typedef uint16_t flex_uint16_t;
2052typedef int32_t flex_int32_t;
2053typedef uint32_t flex_uint32_t;
2054typedef uint64_t flex_uint64_t;
2055#else
2056typedef signed char flex_int8_t;
2057typedef short int flex_int16_t;
2058typedef int flex_int32_t;
2059typedef unsigned char flex_uint8_t; 
2060typedef unsigned short int flex_uint16_t;
2061typedef unsigned int flex_uint32_t;
2062#endif /* ! C99 */
2063
2064/* Limits of integral types. */
2065#ifndef INT8_MIN
2066#define INT8_MIN               (-128)
2067#endif
2068#ifndef INT16_MIN
2069#define INT16_MIN              (-32767-1)
2070#endif
2071#ifndef INT32_MIN
2072#define INT32_MIN              (-2147483647-1)
2073#endif
2074#ifndef INT8_MAX
2075#define INT8_MAX               (127)
2076#endif
2077#ifndef INT16_MAX
2078#define INT16_MAX              (32767)
2079#endif
2080#ifndef INT32_MAX
2081#define INT32_MAX              (2147483647)
2082#endif
2083#ifndef UINT8_MAX
2084#define UINT8_MAX              (255U)
2085#endif
2086#ifndef UINT16_MAX
2087#define UINT16_MAX             (65535U)
2088#endif
2089#ifndef UINT32_MAX
2090#define UINT32_MAX             (4294967295U)
2091#endif
2092
2093#endif /* ! FLEXINT_H */
2094
2095#ifdef __cplusplus
2096
2097/* The "const" storage-class-modifier is valid. */
2098#define YY_USE_CONST
2099
2100#else /* ! __cplusplus */
2101
2102/* C99 requires __STDC__ to be defined as 1. */
2103#if defined (__STDC__)
2104
2105#define YY_USE_CONST
2106
2107#endif   /* defined (__STDC__) */
2108#endif   /* ! __cplusplus */
2109
2110#ifdef YY_USE_CONST
2111#define yyconst const
2112#else
2113#define yyconst
2114#endif
2115
2116/* Returned upon end-of-file. */
2117#define YY_NULL 0
2118
2119/* Promotes a possibly negative, possibly signed char to an unsigned
2120 * integer for use as an array index.  If the signed char is negative,
2121 * we want to instead treat it as an 8-bit unsigned char, hence the
2122 * double cast.
2123 */
2124#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
2125
2126/* Enter a start condition.  This macro really ought to take a parameter,
2127 * but we do it the disgusting crufty way forced on us by the ()-less
2128 * definition of BEGIN.
2129 */
2130#define BEGIN (yy_start) = 1 + 2 *
2131
2132/* Translate the current start state into a value that can be later handed
2133 * to BEGIN to return to the state.  The YYSTATE alias is for lex
2134 * compatibility.
2135 */
2136#define YY_START (((yy_start) - 1) / 2)
2137#define YYSTATE YY_START
2138
2139/* Action number for EOF rule of a given start state. */
2140#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
2141
2142/* Special action meaning "start processing a new file". */
2143#define YY_NEW_FILE convert_restart(convert_in  )
2144
2145#define YY_END_OF_BUFFER_CHAR 0
2146
2147/* Size of default input buffer. */
2148#ifndef YY_BUF_SIZE
2149#define YY_BUF_SIZE 16384
2150#endif
2151
2152/* The state buf must be large enough to hold one state per character in the main buffer.
2153 */
2154#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
2155
2156#ifndef YY_TYPEDEF_YY_BUFFER_STATE
2157#define YY_TYPEDEF_YY_BUFFER_STATE
2158typedef struct yy_buffer_state *YY_BUFFER_STATE;
2159#endif
2160
2161#ifndef YY_TYPEDEF_YY_SIZE_T
2162#define YY_TYPEDEF_YY_SIZE_T
2163typedef size_t yy_size_t;
2164#endif
2165
2166extern yy_size_t convert_leng;
2167
2168extern FILE *convert_in, *convert_out;
2169
2170#define EOB_ACT_CONTINUE_SCAN 0
2171#define EOB_ACT_END_OF_FILE 1
2172#define EOB_ACT_LAST_MATCH 2
2173
2174    #define YY_LESS_LINENO(n)
2175   
2176/* Return all but the first "n" matched characters back to the input stream. */
2177#define yyless(n) \
2178   do \
2179      { \
2180      /* Undo effects of setting up convert_text. */ \
2181        int yyless_macro_arg = (n); \
2182        YY_LESS_LINENO(yyless_macro_arg);\
2183      *yy_cp = (yy_hold_char); \
2184      YY_RESTORE_YY_MORE_OFFSET \
2185      (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
2186      YY_DO_BEFORE_ACTION; /* set up convert_text again */ \
2187      } \
2188   while ( 0 )
2189
2190#define unput(c) yyunput( c, (yytext_ptr)  )
2191
2192#ifndef YY_STRUCT_YY_BUFFER_STATE
2193#define YY_STRUCT_YY_BUFFER_STATE
2194struct yy_buffer_state
2195   {
2196   FILE *yy_input_file;
2197
2198   char *yy_ch_buf;     /* input buffer */
2199   char *yy_buf_pos;    /* current position in input buffer */
2200
2201   /* Size of input buffer in bytes, not including room for EOB
2202    * characters.
2203    */
2204   yy_size_t yy_buf_size;
2205
2206   /* Number of characters read into yy_ch_buf, not including EOB
2207    * characters.
2208    */
2209   yy_size_t yy_n_chars;
2210
2211   /* Whether we "own" the buffer - i.e., we know we created it,
2212    * and can realloc() it to grow it, and should free() it to
2213    * delete it.
2214    */
2215   int yy_is_our_buffer;
2216
2217   /* Whether this is an "interactive" input source; if so, and
2218    * if we're using stdio for input, then we want to use getc()
2219    * instead of fread(), to make sure we stop fetching input after
2220    * each newline.
2221    */
2222   int yy_is_interactive;
2223
2224   /* Whether we're considered to be at the beginning of a line.
2225    * If so, '^' rules will be active on the next match, otherwise
2226    * not.
2227    */
2228   int yy_at_bol;
2229
2230    int yy_bs_lineno; /**< The line count. */
2231    int yy_bs_column; /**< The column count. */
2232   
2233   /* Whether to try to fill the input buffer when we reach the
2234    * end of it.
2235    */
2236   int yy_fill_buffer;
2237
2238   int yy_buffer_status;
2239
2240#define YY_BUFFER_NEW 0
2241#define YY_BUFFER_NORMAL 1
2242   /* When an EOF's been seen but there's still some text to process
2243    * then we mark the buffer as YY_EOF_PENDING, to indicate that we
2244    * shouldn't try reading from the input source any more.  We might
2245    * still have a bunch of tokens to match, though, because of
2246    * possible backing-up.
2247    *
2248    * When we actually see the EOF, we change the status to "new"
2249    * (via convert_restart()), so that the user can continue scanning by
2250    * just pointing convert_in at a new input file.
2251    */
2252#define YY_BUFFER_EOF_PENDING 2
2253
2254   };
2255#endif /* !YY_STRUCT_YY_BUFFER_STATE */
2256
2257/* Stack of input buffers. */
2258static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
2259static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
2260static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
2261
2262/* We provide macros for accessing buffer states in case in the
2263 * future we want to put the buffer states in a more general
2264 * "scanner state".
2265 *
2266 * Returns the top of the stack, or NULL.
2267 */
2268#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
2269                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
2270                          : NULL)
2271
2272/* Same as previous macro, but useful when we know that the buffer stack is not
2273 * NULL or when we need an lvalue. For internal use only.
2274 */
2275#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
2276
2277/* yy_hold_char holds the character lost when convert_text is formed. */
2278static char yy_hold_char;
2279static yy_size_t yy_n_chars;     /* number of characters read into yy_ch_buf */
2280yy_size_t convert_leng;
2281
2282/* Points to current character in buffer. */
2283static char *yy_c_buf_p = (char *) 0;
2284static int yy_init = 0;    /* whether we need to initialize */
2285static int yy_start = 0;   /* start state number */
2286
2287/* Flag which is used to allow convert_wrap()'s to do buffer switches
2288 * instead of setting up a fresh convert_in.  A bit of a hack ...
2289 */
2290static int yy_did_buffer_switch_on_eof;
2291
2292void convert_restart (FILE *input_file  );
2293void convert__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
2294YY_BUFFER_STATE convert__create_buffer (FILE *file,int size  );
2295void convert__delete_buffer (YY_BUFFER_STATE b  );
2296void convert__flush_buffer (YY_BUFFER_STATE b  );
2297void convert_push_buffer_state (YY_BUFFER_STATE new_buffer  );
2298void convert_pop_buffer_state (void );
2299
2300static void convert_ensure_buffer_stack (void );
2301static void convert__load_buffer_state (void );
2302static void convert__init_buffer (YY_BUFFER_STATE b,FILE *file  );
2303
2304#define YY_FLUSH_BUFFER convert__flush_buffer(YY_CURRENT_BUFFER )
2305
2306YY_BUFFER_STATE convert__scan_buffer (char *base,yy_size_t size  );
2307YY_BUFFER_STATE convert__scan_string (yyconst char *yy_str  );
2308YY_BUFFER_STATE convert__scan_bytes (yyconst char *bytes,yy_size_t len  );
2309
2310void *convert_alloc (yy_size_t  );
2311void *convert_realloc (void *,yy_size_t  );
2312void convert_free (void *  );
2313
2314#define yy_new_buffer convert__create_buffer
2315
2316#define yy_set_interactive(is_interactive) \
2317   { \
2318   if ( ! YY_CURRENT_BUFFER ){ \
2319        convert_ensure_buffer_stack (); \
2320      YY_CURRENT_BUFFER_LVALUE =    \
2321            convert__create_buffer(convert_in,YY_BUF_SIZE ); \
2322   } \
2323   YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
2324   }
2325
2326#define yy_set_bol(at_bol) \
2327   { \
2328   if ( ! YY_CURRENT_BUFFER ){\
2329        convert_ensure_buffer_stack (); \
2330      YY_CURRENT_BUFFER_LVALUE =    \
2331            convert__create_buffer(convert_in,YY_BUF_SIZE ); \
2332   } \
2333   YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
2334   }
2335
2336#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
2337
2338/* Begin user sect3 */
2339
2340#define convert_wrap(n) 1
2341#define YY_SKIP_YYWRAP
2342
2343typedef unsigned char YY_CHAR;
2344
2345FILE *convert_in = (FILE *) 0, *convert_out = (FILE *) 0;
2346
2347typedef int yy_state_type;
2348
2349extern int convert_lineno;
2350
2351int convert_lineno = 1;
2352
2353extern char *convert_text;
2354#define yytext_ptr convert_text
2355
2356static yy_state_type yy_get_previous_state (void );
2357static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
2358static int yy_get_next_buffer (void );
2359static void yy_fatal_error (yyconst char msg[]  );
2360
2361/* Done after the current pattern has been matched and before the
2362 * corresponding action - sets up convert_text.
2363 */
2364#define YY_DO_BEFORE_ACTION \
2365   (yytext_ptr) = yy_bp; \
2366   convert_leng = (yy_size_t) (yy_cp - yy_bp); \
2367   (yy_hold_char) = *yy_cp; \
2368   *yy_cp = '\0'; \
2369   (yy_c_buf_p) = yy_cp;
2370
2371#define YY_NUM_RULES 15
2372#define YY_END_OF_BUFFER 16
2373/* This struct is not used in this scanner,
2374   but its presence is necessary. */
2375struct yy_trans_info
2376   {
2377   flex_int32_t yy_verify;
2378   flex_int32_t yy_nxt;
2379   };
2380static yyconst flex_int16_t yy_accept[84] =
2381    {   0,
2382        0,    0,    0,    0,   16,   15,   14,   13,   15,   12,
2383       11,   11,   11,   11,   12,    7,   10,   10,   10,   10,
2384       10,   10,   10,   14,    0,    4,   11,    9,    9,    9,
2385        5,   10,   10,   10,   10,   10,   10,   10,   10,    8,
2386       10,   10,   10,   10,   10,    3,   10,    6,   10,   10,
2387       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
2388       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
2389       10,   10,    2,   10,   10,   10,    1,   10,   10,   10,
2390       10,    8,    0
2391    } ;
2392
2393static yyconst flex_int32_t yy_ec[256] =
2394    {   0,
2395        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
2396        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2397        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2398        1,    2,    1,    1,    1,    1,    4,    1,    1,    5,
2399        6,    1,    1,    7,    1,    1,    1,    8,    9,   10,
2400       11,    8,    8,    8,   12,    8,    8,   13,   14,    1,
2401       15,    1,    1,    1,   16,   17,   17,   18,   19,   20,
2402       21,   17,   22,   17,   23,   24,   25,   26,   27,   28,
2403       17,   29,   30,   31,   32,   17,   17,   33,   34,   17,
2404       35,    1,   36,    1,   37,    1,   38,   17,   17,   39,
2405
2406       40,   41,   42,   17,   43,   17,   44,   45,   46,   47,
2407       48,   49,   17,   50,   51,   52,   53,   17,   17,   54,
2408       55,   17,    1,    1,    1,    1,    1,    1,    1,    1,
2409        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2410        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2411        1,    1,    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
2417        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2418        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2419        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
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
2423    } ;
2424
2425static yyconst flex_int32_t yy_meta[56] =
2426    {   0,
2427        1,    1,    2,    1,    1,    1,    1,    3,    3,    3,
2428        3,    3,    1,    1,    1,    3,    3,    3,    3,    3,
2429        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
2430        3,    3,    3,    3,    1,    1,    3,    3,    3,    3,
2431        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
2432        3,    3,    3,    3,    3
2433    } ;
2434
2435static yyconst flex_int16_t yy_base[86] =
2436    {   0,
2437        0,    0,    0,    0,  192,  194,  186,  194,  176,  194,
2438       48,   53,   58,   69,  164,  194,    0,   60,   51,   47,
2439       49,   67,   55,  173,  170,  169,   90,  194,  194,  194,
2440      194,    0,  160,   53,   62,   58,   66,   62,   74,    0,
2441       85,   95,   94,   82,  101,    0,  101,    0,   91,  134,
2442       96,  133,  100,  103,   99,  105,  109,  106,  102,  101,
2443      113,   99,  115,  113,  119,  127,  123,  139,  130,  142,
2444      137,  132,    0,   81,  144,  143,    0,  136,  144,  150,
2445      139,    0,  194,  190,   81
2446    } ;
2447
2448static yyconst flex_int16_t yy_def[86] =
2449    {   0,
2450       83,    1,    1,    1,   83,   83,   83,   83,   84,   83,
2451       83,   83,   83,   83,   83,   83,   85,   85,   85,   85,
2452       85,   85,   85,   83,   84,   84,   83,   83,   83,   83,
2453       83,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2454       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2455       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2456       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2457       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
2458       85,   85,    0,   83,   83
2459    } ;
2460
2461static yyconst flex_int16_t yy_nxt[250] =
2462    {   0,
2463        6,    7,    8,    9,   10,   10,   10,   11,   12,   13,
2464       14,   11,   15,   10,   16,   17,   17,   17,   17,   18,
2465       17,   17,   19,   17,   17,   20,   21,   22,   17,   17,
2466       17,   23,   17,   17,   10,   10,   17,   17,   17,   17,
2467       18,   17,   17,   19,   17,   17,   20,   21,   22,   17,
2468       17,   17,   23,   17,   17,   27,   27,   27,   27,   27,
2469       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
2470       28,   33,   35,   36,   37,   29,   27,   27,   27,   27,
2471       27,   34,   38,   32,   39,   41,   30,   42,   43,   44,
2472       45,   28,   46,   35,   36,   37,   29,   27,   27,   27,
2473
2474       27,   27,   34,   47,   38,   39,   41,   30,   42,   43,
2475       44,   45,   48,   46,   49,   50,   51,   76,   52,   53,
2476       55,   57,   58,   59,   47,   60,   61,   62,   63,   64,
2477       65,   66,   67,   48,   68,   49,   50,   69,   51,   52,
2478       53,   55,   57,   58,   59,   70,   60,   61,   62,   63,
2479       64,   65,   66,   67,   71,   68,   72,   73,   69,   74,
2480       75,   40,   77,   78,   79,   80,   70,   81,   82,   56,
2481       54,   40,   26,   26,   24,   71,   31,   72,   73,   26,
2482       74,   75,   40,   77,   78,   79,   80,   24,   81,   82,
2483       25,   83,   25,    5,   83,   83,   83,   83,   83,   83,
2484
2485       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2486       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2487       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2488       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2489       83,   83,   83,   83,   83,   83,   83,   83,   83
2490    } ;
2491
2492static yyconst flex_int16_t yy_chk[250] =
2493    {   0,
2494        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2495        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
2496        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
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,   11,   11,   11,   11,   11,
2500       12,   12,   12,   12,   12,   13,   13,   13,   13,   13,
2501       12,   18,   19,   20,   21,   13,   14,   14,   14,   14,
2502       14,   18,   22,   85,   23,   34,   14,   35,   36,   37,
2503       38,   12,   39,   19,   20,   21,   13,   27,   27,   27,
2504
2505       27,   27,   18,   41,   22,   23,   34,   14,   35,   36,
2506       37,   38,   42,   39,   43,   44,   45,   74,   47,   49,
2507       51,   53,   54,   55,   41,   56,   57,   58,   59,   60,
2508       61,   62,   63,   42,   64,   43,   44,   65,   45,   47,
2509       49,   51,   53,   54,   55,   66,   56,   57,   58,   59,
2510       60,   61,   62,   63,   67,   64,   68,   69,   65,   70,
2511       71,   72,   75,   76,   78,   79,   66,   80,   81,   52,
2512       50,   33,   26,   25,   24,   67,   15,   68,   69,    9,
2513       70,   71,   72,   75,   76,   78,   79,    7,   80,   81,
2514       84,    5,   84,   83,   83,   83,   83,   83,   83,   83,
2515
2516       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2517       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2518       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2519       83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
2520       83,   83,   83,   83,   83,   83,   83,   83,   83
2521    } ;
2522
2523static yy_state_type yy_last_accepting_state;
2524static char *yy_last_accepting_cpos;
2525
2526extern int convert__flex_debug;
2527int convert__flex_debug = 0;
2528
2529/* The intent behind this definition is that it'll catch
2530 * any uses of REJECT which flex missed.
2531 */
2532#define REJECT reject_used_but_not_detected
2533#define yymore() yymore_used_but_not_detected
2534#define YY_MORE_ADJ 0
2535#define YY_RESTORE_YY_MORE_OFFSET
2536char *convert_text;
2537#line 1 "convert.lex"
2538/******************************************************************************/
2539/*                                                                            */
2540/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
2541/*                                                                            */
2542/* Copyright or   or Copr. Laurent Debreu (Laurent.Debreu@imag.fr)            */
2543/*                        Cyril Mazauric (Cyril_Mazauric@yahoo.fr)            */
2544/* This software is governed by the CeCILL-C license under French law and     */
2545/* abiding by the rules of distribution of free software.  You can  use,      */
2546/* modify and/ or redistribute the software under the terms of the CeCILL-C   */
2547/* license as circulated by CEA, CNRS and INRIA at the following URL          */
2548/* "http://www.cecill.info".                                                  */
2549/*                                                                            */
2550/* As a counterpart to the access to the source code and  rights to copy,     */
2551/* modify and redistribute granted by the license, users are provided only    */
2552/* with a limited warranty  and the software's author,  the holder of the     */
2553/* economic rights,  and the successive licensors  have only  limited         */
2554/* liability.                                                                 */
2555/*                                                                            */
2556/* In this respect, the user's attention is drawn to the risks associated     */
2557/* with loading,  using,  modifying and/or developing or reproducing the      */
2558/* software by the user in light of its specific status of free software,     */
2559/* that may mean  that it is complicated to manipulate,  and  that  also      */
2560/* therefore means  that it is reserved for developers  and  experienced      */
2561/* professionals having in-depth computer knowledge. Users are therefore      */
2562/* encouraged to load and test the software's suitability as regards their    */
2563/* requirements in conditions enabling the security of their systems and/or   */
2564/* data to be ensured and,  more generally, to use and operate it in the      */
2565/* same conditions as regards security.                                       */
2566/*                                                                            */
2567/* The fact that you are presently reading this means that you have had       */
2568/* knowledge of the CeCILL-C license and that you accept its terms.           */
2569/******************************************************************************/
2570/* version 1.7                                                                */
2571/******************************************************************************/
2572
2573#line 40 "convert.lex"
2574#include <math.h>
2575#include <stdlib.h>
2576#include <string.h>
2577
2578#define YY_NO_INPUT
2579#line 595 "convert.yy.c"
2580
2581#define INITIAL 0
2582#define character 1
2583
2584#ifndef YY_NO_UNISTD_H
2585/* Special case for "unistd.h", since it is non-ANSI. We include it way
2586 * down here because we want the user's section 1 to have been scanned first.
2587 * The user has a chance to override it with an option.
2588 */
2589#include <unistd.h>
2590#endif
2591
2592#ifndef YY_EXTRA_TYPE
2593#define YY_EXTRA_TYPE void *
2594#endif
2595
2596static int yy_init_globals (void );
2597
2598/* Accessor methods to globals.
2599   These are made visible to non-reentrant scanners for convenience. */
2600
2601int convert_lex_destroy (void );
2602
2603int convert_get_debug (void );
2604
2605void convert_set_debug (int debug_flag  );
2606
2607YY_EXTRA_TYPE convert_get_extra (void );
2608
2609void convert_set_extra (YY_EXTRA_TYPE user_defined  );
2610
2611FILE *convert_get_in (void );
2612
2613void convert_set_in  (FILE * in_str  );
2614
2615FILE *convert_get_out (void );
2616
2617void convert_set_out  (FILE * out_str  );
2618
2619yy_size_t convert_get_leng (void );
2620
2621char *convert_get_text (void );
2622
2623int convert_get_lineno (void );
2624
2625void convert_set_lineno (int line_number  );
2626
2627/* Macros after this point can all be overridden by user definitions in
2628 * section 1.
2629 */
2630
2631#ifndef YY_SKIP_YYWRAP
2632#ifdef __cplusplus
2633extern "C" int convert_wrap (void );
2634#else
2635extern int convert_wrap (void );
2636#endif
2637#endif
2638
2639    static void yyunput (int c,char *buf_ptr  );
2640   
2641#ifndef yytext_ptr
2642static void yy_flex_strncpy (char *,yyconst char *,int );
2643#endif
2644
2645#ifdef YY_NEED_STRLEN
2646static int yy_flex_strlen (yyconst char * );
2647#endif
2648
2649#ifndef YY_NO_INPUT
2650
2651#ifdef __cplusplus
2652static int yyinput (void );
2653#else
2654static int input (void );
2655#endif
2656
2657#endif
2658
2659/* Amount of stuff to slurp up with each read. */
2660#ifndef YY_READ_BUF_SIZE
2661#define YY_READ_BUF_SIZE 8192
2662#endif
2663
2664/* Copy whatever the last rule matched to the standard output. */
2665#ifndef ECHO
2666/* This used to be an fputs(), but since the string might contain NUL's,
2667 * we now use fwrite().
2668 */
2669#define ECHO fwrite( convert_text, convert_leng, 1, convert_out )
2670#endif
2671
2672/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
2673 * is returned in "result".
2674 */
2675#ifndef YY_INPUT
2676#define YY_INPUT(buf,result,max_size) \
2677   if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
2678      { \
2679      int c = '*'; \
2680      yy_size_t n; \
2681      for ( n = 0; n < max_size && \
2682              (c = getc( convert_in )) != EOF && c != '\n'; ++n ) \
2683         buf[n] = (char) c; \
2684      if ( c == '\n' ) \
2685         buf[n++] = (char) c; \
2686      if ( c == EOF && ferror( convert_in ) ) \
2687         YY_FATAL_ERROR( "input in flex scanner failed" ); \
2688      result = n; \
2689      } \
2690   else \
2691      { \
2692      errno=0; \
2693      while ( (result = fread(buf, 1, max_size, convert_in))==0 && ferror(convert_in)) \
2694         { \
2695         if( errno != EINTR) \
2696            { \
2697            YY_FATAL_ERROR( "input in flex scanner failed" ); \
2698            break; \
2699            } \
2700         errno=0; \
2701         clearerr(convert_in); \
2702         } \
2703      }\
2704\
2705
2706#endif
2707
2708/* No semi-colon after return; correct usage is to write "yyterminate();" -
2709 * we don't want an extra ';' after the "return" because that will cause
2710 * some compilers to complain about unreachable statements.
2711 */
2712#ifndef yyterminate
2713#define yyterminate() return YY_NULL
2714#endif
2715
2716/* Number of entries by which start-condition stack grows. */
2717#ifndef YY_START_STACK_INCR
2718#define YY_START_STACK_INCR 25
2719#endif
2720
2721/* Report a fatal error. */
2722#ifndef YY_FATAL_ERROR
2723#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
2724#endif
2725
2726/* end tables serialization structures and prototypes */
2727
2728/* Default declaration of generated scanner - a define so the user can
2729 * easily add parameters.
2730 */
2731#ifndef YY_DECL
2732#define YY_DECL_IS_OURS 1
2733
2734extern int convert_lex (void);
2735
2736#define YY_DECL int convert_lex (void)
2737#endif /* !YY_DECL */
2738
2739/* Code executed at the beginning of each rule, after convert_text and convert_leng
2740 * have been set up.
2741 */
2742#ifndef YY_USER_ACTION
2743#define YY_USER_ACTION
2744#endif
2745
2746/* Code executed at the end of each rule. */
2747#ifndef YY_BREAK
2748#define YY_BREAK break;
2749#endif
2750
2751#define YY_RULE_SETUP \
2752   YY_USER_ACTION
2753
2754/** The main scanner function which does all the work.
2755 */
2756YY_DECL
2757{
2758   register yy_state_type yy_current_state;
2759   register char *yy_cp, *yy_bp;
2760   register int yy_act;
2761   
2762#line 54 "convert.lex"
2763
2764#line 780 "convert.yy.c"
2765
2766   if ( !(yy_init) )
2767      {
2768      (yy_init) = 1;
2769
2770#ifdef YY_USER_INIT
2771      YY_USER_INIT;
2772#endif
2773
2774      if ( ! (yy_start) )
2775         (yy_start) = 1;   /* first start state */
2776
2777      if ( ! convert_in )
2778         convert_in = stdin;
2779
2780      if ( ! convert_out )
2781         convert_out = stdout;
2782
2783      if ( ! YY_CURRENT_BUFFER ) {
2784         convert_ensure_buffer_stack ();
2785         YY_CURRENT_BUFFER_LVALUE =
2786            convert__create_buffer(convert_in,YY_BUF_SIZE );
2787      }
2788
2789      convert__load_buffer_state( );
2790      }
2791
2792   while ( 1 )    /* loops until end-of-file is reached */
2793      {
2794      yy_cp = (yy_c_buf_p);
2795
2796      /* Support of convert_text. */
2797      *yy_cp = (yy_hold_char);
2798
2799      /* yy_bp points to the position in yy_ch_buf of the start of
2800       * the current run.
2801       */
2802      yy_bp = yy_cp;
2803
2804      yy_current_state = (yy_start);
2805yy_match:
2806      do
2807         {
2808         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
2809         if ( yy_accept[yy_current_state] )
2810            {
2811            (yy_last_accepting_state) = yy_current_state;
2812            (yy_last_accepting_cpos) = yy_cp;
2813            }
2814         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2815            {
2816            yy_current_state = (int) yy_def[yy_current_state];
2817            if ( yy_current_state >= 84 )
2818               yy_c = yy_meta[(unsigned int) yy_c];
2819            }
2820         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2821         ++yy_cp;
2822         }
2823      while ( yy_base[yy_current_state] != 194 );
2824
2825yy_find_action:
2826      yy_act = yy_accept[yy_current_state];
2827      if ( yy_act == 0 )
2828         { /* have to back up */
2829         yy_cp = (yy_last_accepting_cpos);
2830         yy_current_state = (yy_last_accepting_state);
2831         yy_act = yy_accept[yy_current_state];
2832         }
2833
2834      YY_DO_BEFORE_ACTION;
2835
2836do_action:  /* This label is used only to access EOF actions. */
2837
2838      switch ( yy_act )
2839   { /* beginning of action switch */
2840         case 0: /* must back up */
2841         /* undo the effects of YY_DO_BEFORE_ACTION */
2842         *yy_cp = (yy_hold_char);
2843         yy_cp = (yy_last_accepting_cpos);
2844         yy_current_state = (yy_last_accepting_state);
2845         goto yy_find_action;
2846
2847case 1:
2848YY_RULE_SETUP
2849#line 55 "convert.lex"
2850{ return TOK_MODULEMAIN; } /* name of the module                      */
2851   YY_BREAK
2852case 2:
2853YY_RULE_SETUP
2854#line 56 "convert.lex"
2855{ return TOK_NOTGRIDDEP; } /* variable which are not grid dependent   */
2856   YY_BREAK
2857case 3:
2858YY_RULE_SETUP
2859#line 57 "convert.lex"
2860{ return TOK_USE; }
2861   YY_BREAK
2862case 4:
2863YY_RULE_SETUP
2864#line 58 "convert.lex"
2865{ }
2866   YY_BREAK
2867case 5:
2868YY_RULE_SETUP
2869#line 59 "convert.lex"
2870{ return TOK_SEP; }
2871   YY_BREAK
2872case 6:
2873YY_RULE_SETUP
2874#line 60 "convert.lex"
2875{ return TOK_KIND; }
2876   YY_BREAK
2877case 7:
2878YY_RULE_SETUP
2879#line 61 "convert.lex"
2880{ return TOK_EQUAL; }
2881   YY_BREAK
2882case 8:
2883YY_RULE_SETUP
2884#line 62 "convert.lex"
2885{ strcpy(yylval.na,convert_text); return TOK_USEITEM;  }
2886   YY_BREAK
2887case 9:
2888YY_RULE_SETUP
2889#line 63 "convert.lex"
2890{ strcpy(yylval.na,convert_text); return TOK_PROBTYPE; }  /* dimension of the problem */
2891   YY_BREAK
2892case 10:
2893YY_RULE_SETUP
2894#line 64 "convert.lex"
2895{ strcpy(yylval.na,convert_text); return TOK_NAME; }
2896   YY_BREAK
2897case 11:
2898YY_RULE_SETUP
2899#line 65 "convert.lex"
2900{ strcpy(yylval.na,convert_text); return TOK_CSTINT; }
2901   YY_BREAK
2902case 12:
2903YY_RULE_SETUP
2904#line 66 "convert.lex"
2905{ return (int) *convert_text; }
2906   YY_BREAK
2907case 13:
2908/* rule 13 can match eol */
2909YY_RULE_SETUP
2910#line 67 "convert.lex"
2911{ line_num++; return (int) *convert_text; }
2912   YY_BREAK
2913case 14:
2914YY_RULE_SETUP
2915#line 68 "convert.lex"
2916;
2917   YY_BREAK
2918case 15:
2919YY_RULE_SETUP
2920#line 69 "convert.lex"
2921ECHO;
2922   YY_BREAK
2923#line 939 "convert.yy.c"
2924case YY_STATE_EOF(INITIAL):
2925case YY_STATE_EOF(character):
2926   yyterminate();
2927
2928   case YY_END_OF_BUFFER:
2929      {
2930      /* Amount of text matched not including the EOB char. */
2931      int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2932
2933      /* Undo the effects of YY_DO_BEFORE_ACTION. */
2934      *yy_cp = (yy_hold_char);
2935      YY_RESTORE_YY_MORE_OFFSET
2936
2937      if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2938         {
2939         /* We're scanning a new file or input source.  It's
2940          * possible that this happened because the user
2941          * just pointed convert_in at a new source and called
2942          * convert_lex().  If so, then we have to assure
2943          * consistency between YY_CURRENT_BUFFER and our
2944          * globals.  Here is the right place to do so, because
2945          * this is the first action (other than possibly a
2946          * back-up) that will match for the new input source.
2947          */
2948         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2949         YY_CURRENT_BUFFER_LVALUE->yy_input_file = convert_in;
2950         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2951         }
2952
2953      /* Note that here we test for yy_c_buf_p "<=" to the position
2954       * of the first EOB in the buffer, since yy_c_buf_p will
2955       * already have been incremented past the NUL character
2956       * (since all states make transitions on EOB to the
2957       * end-of-buffer state).  Contrast this with the test
2958       * in input().
2959       */
2960      if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2961         { /* This was really a NUL. */
2962         yy_state_type yy_next_state;
2963
2964         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2965
2966         yy_current_state = yy_get_previous_state(  );
2967
2968         /* Okay, we're now positioned to make the NUL
2969          * transition.  We couldn't have
2970          * yy_get_previous_state() go ahead and do it
2971          * for us because it doesn't know how to deal
2972          * with the possibility of jamming (and we don't
2973          * want to build jamming into it because then it
2974          * will run more slowly).
2975          */
2976
2977         yy_next_state = yy_try_NUL_trans( yy_current_state );
2978
2979         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2980
2981         if ( yy_next_state )
2982            {
2983            /* Consume the NUL. */
2984            yy_cp = ++(yy_c_buf_p);
2985            yy_current_state = yy_next_state;
2986            goto yy_match;
2987            }
2988
2989         else
2990            {
2991            yy_cp = (yy_c_buf_p);
2992            goto yy_find_action;
2993            }
2994         }
2995
2996      else switch ( yy_get_next_buffer(  ) )
2997         {
2998         case EOB_ACT_END_OF_FILE:
2999            {
3000            (yy_did_buffer_switch_on_eof) = 0;
3001
3002            if ( convert_wrap( ) )
3003               {
3004               /* Note: because we've taken care in
3005                * yy_get_next_buffer() to have set up
3006                * convert_text, we can now set up
3007                * yy_c_buf_p so that if some total
3008                * hoser (like flex itself) wants to
3009                * call the scanner after we return the
3010                * YY_NULL, it'll still work - another
3011                * YY_NULL will get returned.
3012                */
3013               (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
3014
3015               yy_act = YY_STATE_EOF(YY_START);
3016               goto do_action;
3017               }
3018
3019            else
3020               {
3021               if ( ! (yy_did_buffer_switch_on_eof) )
3022                  YY_NEW_FILE;
3023               }
3024            break;
3025            }
3026
3027         case EOB_ACT_CONTINUE_SCAN:
3028            (yy_c_buf_p) =
3029               (yytext_ptr) + yy_amount_of_matched_text;
3030
3031            yy_current_state = yy_get_previous_state(  );
3032
3033            yy_cp = (yy_c_buf_p);
3034            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3035            goto yy_match;
3036
3037         case EOB_ACT_LAST_MATCH:
3038            (yy_c_buf_p) =
3039            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
3040
3041            yy_current_state = yy_get_previous_state(  );
3042
3043            yy_cp = (yy_c_buf_p);
3044            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
3045            goto yy_find_action;
3046         }
3047      break;
3048      }
3049
3050   default:
3051      YY_FATAL_ERROR(
3052         "fatal flex scanner internal error--no action found" );
3053   } /* end of action switch */
3054      } /* end of scanning one token */
3055} /* end of convert_lex */
3056
3057/* yy_get_next_buffer - try to read in a new buffer
3058 *
3059 * Returns a code representing an action:
3060 * EOB_ACT_LAST_MATCH -
3061 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
3062 * EOB_ACT_END_OF_FILE - end of file
3063 */
3064static int yy_get_next_buffer (void)
3065{
3066      register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3067   register char *source = (yytext_ptr);
3068   register int number_to_move, i;
3069   int ret_val;
3070
3071   if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3072      YY_FATAL_ERROR(
3073      "fatal flex scanner internal error--end of buffer missed" );
3074
3075   if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3076      { /* Don't try to fill the buffer, so this is an EOF. */
3077      if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3078         {
3079         /* We matched a single character, the EOB, so
3080          * treat this as a final EOF.
3081          */
3082         return EOB_ACT_END_OF_FILE;
3083         }
3084
3085      else
3086         {
3087         /* We matched some text prior to the EOB, first
3088          * process it.
3089          */
3090         return EOB_ACT_LAST_MATCH;
3091         }
3092      }
3093
3094   /* Try to read more data. */
3095
3096   /* First move last chars to start of buffer. */
3097   number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
3098
3099   for ( i = 0; i < number_to_move; ++i )
3100      *(dest++) = *(source++);
3101
3102   if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3103      /* don't do the read, it's not guaranteed to return an EOF,
3104       * just force an EOF
3105       */
3106      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3107
3108   else
3109      {
3110         yy_size_t num_to_read =
3111         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3112
3113      while ( num_to_read <= 0 )
3114         { /* Not enough room in the buffer - grow it. */
3115
3116         /* just a shorter name for the current buffer */
3117         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
3118
3119         int yy_c_buf_p_offset =
3120            (int) ((yy_c_buf_p) - b->yy_ch_buf);
3121
3122         if ( b->yy_is_our_buffer )
3123            {
3124            yy_size_t new_size = b->yy_buf_size * 2;
3125
3126            if ( new_size <= 0 )
3127               b->yy_buf_size += b->yy_buf_size / 8;
3128            else
3129               b->yy_buf_size *= 2;
3130
3131            b->yy_ch_buf = (char *)
3132               /* Include room in for 2 EOB chars. */
3133               convert_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
3134            }
3135         else
3136            /* Can't grow it, we don't own it. */
3137            b->yy_ch_buf = 0;
3138
3139         if ( ! b->yy_ch_buf )
3140            YY_FATAL_ERROR(
3141            "fatal error - scanner input buffer overflow" );
3142
3143         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
3144
3145         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
3146                  number_to_move - 1;
3147
3148         }
3149
3150      if ( num_to_read > YY_READ_BUF_SIZE )
3151         num_to_read = YY_READ_BUF_SIZE;
3152
3153      /* Read in more data. */
3154      YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
3155         (yy_n_chars), num_to_read );
3156
3157      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3158      }
3159
3160   if ( (yy_n_chars) == 0 )
3161      {
3162      if ( number_to_move == YY_MORE_ADJ )
3163         {
3164         ret_val = EOB_ACT_END_OF_FILE;
3165         convert_restart(convert_in  );
3166         }
3167
3168      else
3169         {
3170         ret_val = EOB_ACT_LAST_MATCH;
3171         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
3172            YY_BUFFER_EOF_PENDING;
3173         }
3174      }
3175
3176   else
3177      ret_val = EOB_ACT_CONTINUE_SCAN;
3178
3179   if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
3180      /* Extend the array by 50%, plus the number we really need. */
3181      yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
3182      YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) convert_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
3183      if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3184         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
3185   }
3186
3187   (yy_n_chars) += number_to_move;
3188   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
3189   YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
3190
3191   (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
3192
3193   return ret_val;
3194}
3195
3196/* yy_get_previous_state - get the state just before the EOB char was reached */
3197
3198    static yy_state_type yy_get_previous_state (void)
3199{
3200   register yy_state_type yy_current_state;
3201   register char *yy_cp;
3202   
3203   yy_current_state = (yy_start);
3204
3205   for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
3206      {
3207      register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
3208      if ( yy_accept[yy_current_state] )
3209         {
3210         (yy_last_accepting_state) = yy_current_state;
3211         (yy_last_accepting_cpos) = yy_cp;
3212         }
3213      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3214         {
3215         yy_current_state = (int) yy_def[yy_current_state];
3216         if ( yy_current_state >= 84 )
3217            yy_c = yy_meta[(unsigned int) yy_c];
3218         }
3219      yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3220      }
3221
3222   return yy_current_state;
3223}
3224
3225/* yy_try_NUL_trans - try to make a transition on the NUL character
3226 *
3227 * synopsis
3228 * next_state = yy_try_NUL_trans( current_state );
3229 */
3230    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
3231{
3232   register int yy_is_jam;
3233      register char *yy_cp = (yy_c_buf_p);
3234
3235   register YY_CHAR yy_c = 1;
3236   if ( yy_accept[yy_current_state] )
3237      {
3238      (yy_last_accepting_state) = yy_current_state;
3239      (yy_last_accepting_cpos) = yy_cp;
3240      }
3241   while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
3242      {
3243      yy_current_state = (int) yy_def[yy_current_state];
3244      if ( yy_current_state >= 84 )
3245         yy_c = yy_meta[(unsigned int) yy_c];
3246      }
3247   yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
3248   yy_is_jam = (yy_current_state == 83);
3249
3250   return yy_is_jam ? 0 : yy_current_state;
3251}
3252
3253    static void yyunput (int c, register char * yy_bp )
3254{
3255   register char *yy_cp;
3256   
3257    yy_cp = (yy_c_buf_p);
3258
3259   /* undo effects of setting up convert_text */
3260   *yy_cp = (yy_hold_char);
3261
3262   if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3263      { /* need to shift things up to make room */
3264      /* +2 for EOB chars. */
3265      register yy_size_t number_to_move = (yy_n_chars) + 2;
3266      register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
3267               YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
3268      register char *source =
3269            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
3270
3271      while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
3272         *--dest = *--source;
3273
3274      yy_cp += (int) (dest - source);
3275      yy_bp += (int) (dest - source);
3276      YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
3277         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
3278
3279      if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
3280         YY_FATAL_ERROR( "flex scanner push-back overflow" );
3281      }
3282
3283   *--yy_cp = (char) c;
3284
3285   (yytext_ptr) = yy_bp;
3286   (yy_hold_char) = *yy_cp;
3287   (yy_c_buf_p) = yy_cp;
3288}
3289
3290#ifndef YY_NO_INPUT
3291#ifdef __cplusplus
3292    static int yyinput (void)
3293#else
3294    static int input  (void)
3295#endif
3296
3297{
3298   int c;
3299   
3300   *(yy_c_buf_p) = (yy_hold_char);
3301
3302   if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
3303      {
3304      /* yy_c_buf_p now points to the character we want to return.
3305       * If this occurs *before* the EOB characters, then it's a
3306       * valid NUL; if not, then we've hit the end of the buffer.
3307       */
3308      if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
3309         /* This was really a NUL. */
3310         *(yy_c_buf_p) = '\0';
3311
3312      else
3313         { /* need more input */
3314         yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
3315         ++(yy_c_buf_p);
3316
3317         switch ( yy_get_next_buffer(  ) )
3318            {
3319            case EOB_ACT_LAST_MATCH:
3320               /* This happens because yy_g_n_b()
3321                * sees that we've accumulated a
3322                * token and flags that we need to
3323                * try matching the token before
3324                * proceeding.  But for input(),
3325                * there's no matching to consider.
3326                * So convert the EOB_ACT_LAST_MATCH
3327                * to EOB_ACT_END_OF_FILE.
3328                */
3329
3330               /* Reset buffer status. */
3331               convert_restart(convert_in );
3332
3333               /*FALLTHROUGH*/
3334
3335            case EOB_ACT_END_OF_FILE:
3336               {
3337               if ( convert_wrap( ) )
3338                  return 0;
3339
3340               if ( ! (yy_did_buffer_switch_on_eof) )
3341                  YY_NEW_FILE;
3342#ifdef __cplusplus
3343               return yyinput();
3344#else
3345               return input();
3346#endif
3347               }
3348
3349            case EOB_ACT_CONTINUE_SCAN:
3350               (yy_c_buf_p) = (yytext_ptr) + offset;
3351               break;
3352            }
3353         }
3354      }
3355
3356   c = *(unsigned char *) (yy_c_buf_p);   /* cast for 8-bit char's */
3357   *(yy_c_buf_p) = '\0';   /* preserve convert_text */
3358   (yy_hold_char) = *++(yy_c_buf_p);
3359
3360   return c;
3361}
3362#endif   /* ifndef YY_NO_INPUT */
3363
3364/** Immediately switch to a different input stream.
3365 * @param input_file A readable stream.
3366 *
3367 * @note This function does not reset the start condition to @c INITIAL .
3368 */
3369    void convert_restart  (FILE * input_file )
3370{
3371   
3372   if ( ! YY_CURRENT_BUFFER ){
3373        convert_ensure_buffer_stack ();
3374      YY_CURRENT_BUFFER_LVALUE =
3375            convert__create_buffer(convert_in,YY_BUF_SIZE );
3376   }
3377
3378   convert__init_buffer(YY_CURRENT_BUFFER,input_file );
3379   convert__load_buffer_state( );
3380}
3381
3382/** Switch to a different input buffer.
3383 * @param new_buffer The new input buffer.
3384 *
3385 */
3386    void convert__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
3387{
3388   
3389   /* TODO. We should be able to replace this entire function body
3390    * with
3391    *    convert_pop_buffer_state();
3392    *    convert_push_buffer_state(new_buffer);
3393     */
3394   convert_ensure_buffer_stack ();
3395   if ( YY_CURRENT_BUFFER == new_buffer )
3396      return;
3397
3398   if ( YY_CURRENT_BUFFER )
3399      {
3400      /* Flush out information for old buffer. */
3401      *(yy_c_buf_p) = (yy_hold_char);
3402      YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3403      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3404      }
3405
3406   YY_CURRENT_BUFFER_LVALUE = new_buffer;
3407   convert__load_buffer_state( );
3408
3409   /* We don't actually know whether we did this switch during
3410    * EOF (convert_wrap()) processing, but the only time this flag
3411    * is looked at is after convert_wrap() is called, so it's safe
3412    * to go ahead and always set it.
3413    */
3414   (yy_did_buffer_switch_on_eof) = 1;
3415}
3416
3417static void convert__load_buffer_state  (void)
3418{
3419      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
3420   (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
3421   convert_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
3422   (yy_hold_char) = *(yy_c_buf_p);
3423}
3424
3425/** Allocate and initialize an input buffer state.
3426 * @param file A readable stream.
3427 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
3428 *
3429 * @return the allocated buffer state.
3430 */
3431    YY_BUFFER_STATE convert__create_buffer  (FILE * file, int  size )
3432{
3433   YY_BUFFER_STATE b;
3434   
3435   b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state )  );
3436   if ( ! b )
3437      YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
3438
3439   b->yy_buf_size = size;
3440
3441   /* yy_ch_buf has to be 2 characters longer than the size given because
3442    * we need to put in 2 end-of-buffer characters.
3443    */
3444   b->yy_ch_buf = (char *) convert_alloc(b->yy_buf_size + 2  );
3445   if ( ! b->yy_ch_buf )
3446      YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
3447
3448   b->yy_is_our_buffer = 1;
3449
3450   convert__init_buffer(b,file );
3451
3452   return b;
3453}
3454
3455/** Destroy the buffer.
3456 * @param b a buffer created with convert__create_buffer()
3457 *
3458 */
3459    void convert__delete_buffer (YY_BUFFER_STATE  b )
3460{
3461   
3462   if ( ! b )
3463      return;
3464
3465   if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
3466      YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
3467
3468   if ( b->yy_is_our_buffer )
3469      convert_free((void *) b->yy_ch_buf  );
3470
3471   convert_free((void *) b  );
3472}
3473
3474#ifndef __cplusplus
3475extern int isatty (int );
3476#endif /* __cplusplus */
3477   
3478/* Initializes or reinitializes a buffer.
3479 * This function is sometimes called more than once on the same buffer,
3480 * such as during a convert_restart() or at EOF.
3481 */
3482    static void convert__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
3483
3484{
3485   int oerrno = errno;
3486   
3487   convert__flush_buffer(b );
3488
3489   b->yy_input_file = file;
3490   b->yy_fill_buffer = 1;
3491
3492    /* If b is the current buffer, then convert__init_buffer was _probably_
3493     * called from convert_restart() or through yy_get_next_buffer.
3494     * In that case, we don't want to reset the lineno or column.
3495     */
3496    if (b != YY_CURRENT_BUFFER){
3497        b->yy_bs_lineno = 1;
3498        b->yy_bs_column = 0;
3499    }
3500
3501        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
3502   
3503   errno = oerrno;
3504}
3505
3506/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
3507 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
3508 *
3509 */
3510    void convert__flush_buffer (YY_BUFFER_STATE  b )
3511{
3512      if ( ! b )
3513      return;
3514
3515   b->yy_n_chars = 0;
3516
3517   /* We always need two end-of-buffer characters.  The first causes
3518    * a transition to the end-of-buffer state.  The second causes
3519    * a jam in that state.
3520    */
3521   b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3522   b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3523
3524   b->yy_buf_pos = &b->yy_ch_buf[0];
3525
3526   b->yy_at_bol = 1;
3527   b->yy_buffer_status = YY_BUFFER_NEW;
3528
3529   if ( b == YY_CURRENT_BUFFER )
3530      convert__load_buffer_state( );
3531}
3532
3533/** Pushes the new state onto the stack. The new state becomes
3534 *  the current state. This function will allocate the stack
3535 *  if necessary.
3536 *  @param new_buffer The new state.
3537 * 
3538 */
3539void convert_push_buffer_state (YY_BUFFER_STATE new_buffer )
3540{
3541      if (new_buffer == NULL)
3542      return;
3543
3544   convert_ensure_buffer_stack();
3545
3546   /* This block is copied from convert__switch_to_buffer. */
3547   if ( YY_CURRENT_BUFFER )
3548      {
3549      /* Flush out information for old buffer. */
3550      *(yy_c_buf_p) = (yy_hold_char);
3551      YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3552      YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3553      }
3554
3555   /* Only push if top exists. Otherwise, replace top. */
3556   if (YY_CURRENT_BUFFER)
3557      (yy_buffer_stack_top)++;
3558   YY_CURRENT_BUFFER_LVALUE = new_buffer;
3559
3560   /* copied from convert__switch_to_buffer. */
3561   convert__load_buffer_state( );
3562   (yy_did_buffer_switch_on_eof) = 1;
3563}
3564
3565/** Removes and deletes the top of the stack, if present.
3566 *  The next element becomes the new top.
3567 * 
3568 */
3569void convert_pop_buffer_state (void)
3570{
3571      if (!YY_CURRENT_BUFFER)
3572      return;
3573
3574   convert__delete_buffer(YY_CURRENT_BUFFER );
3575   YY_CURRENT_BUFFER_LVALUE = NULL;
3576   if ((yy_buffer_stack_top) > 0)
3577      --(yy_buffer_stack_top);
3578
3579   if (YY_CURRENT_BUFFER) {
3580      convert__load_buffer_state( );
3581      (yy_did_buffer_switch_on_eof) = 1;
3582   }
3583}
3584
3585/* Allocates the stack if it does not exist.
3586 *  Guarantees space for at least one push.
3587 */
3588static void convert_ensure_buffer_stack (void)
3589{
3590   yy_size_t num_to_alloc;
3591   
3592   if (!(yy_buffer_stack)) {
3593
3594      /* First allocation is just for 2 elements, since we don't know if this
3595       * scanner will even need a stack. We use 2 instead of 1 to avoid an
3596       * immediate realloc on the next call.
3597         */
3598      num_to_alloc = 1;
3599      (yy_buffer_stack) = (struct yy_buffer_state**)convert_alloc
3600                        (num_to_alloc * sizeof(struct yy_buffer_state*)
3601                        );
3602      if ( ! (yy_buffer_stack) )
3603         YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
3604                         
3605      memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3606           
3607      (yy_buffer_stack_max) = num_to_alloc;
3608      (yy_buffer_stack_top) = 0;
3609      return;
3610   }
3611
3612   if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3613
3614      /* Increase the buffer to prepare for a possible push. */
3615      int grow_size = 8 /* arbitrary grow size */;
3616
3617      num_to_alloc = (yy_buffer_stack_max) + grow_size;
3618      (yy_buffer_stack) = (struct yy_buffer_state**)convert_realloc
3619                        ((yy_buffer_stack),
3620                        num_to_alloc * sizeof(struct yy_buffer_state*)
3621                        );
3622      if ( ! (yy_buffer_stack) )
3623         YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
3624
3625      /* zero only the new slots.*/
3626      memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3627      (yy_buffer_stack_max) = num_to_alloc;
3628   }
3629}
3630
3631/** Setup the input buffer state to scan directly from a user-specified character buffer.
3632 * @param base the character buffer
3633 * @param size the size in bytes of the character buffer
3634 *
3635 * @return the newly allocated buffer state object.
3636 */
3637YY_BUFFER_STATE convert__scan_buffer  (char * base, yy_size_t  size )
3638{
3639   YY_BUFFER_STATE b;
3640   
3641   if ( size < 2 ||
3642        base[size-2] != YY_END_OF_BUFFER_CHAR ||
3643        base[size-1] != YY_END_OF_BUFFER_CHAR )
3644      /* They forgot to leave room for the EOB's. */
3645      return 0;
3646
3647   b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state )  );
3648   if ( ! b )
3649      YY_FATAL_ERROR( "out of dynamic memory in convert__scan_buffer()" );
3650
3651   b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3652   b->yy_buf_pos = b->yy_ch_buf = base;
3653   b->yy_is_our_buffer = 0;
3654   b->yy_input_file = 0;
3655   b->yy_n_chars = b->yy_buf_size;
3656   b->yy_is_interactive = 0;
3657   b->yy_at_bol = 1;
3658   b->yy_fill_buffer = 0;
3659   b->yy_buffer_status = YY_BUFFER_NEW;
3660
3661   convert__switch_to_buffer();
3662
3663   return b;
3664}
3665
3666/** Setup the input buffer state to scan a string. The next call to convert_lex() will
3667 * scan from a @e copy of @a str.
3668 * @param yystr a NUL-terminated string to scan
3669 *
3670 * @return the newly allocated buffer state object.
3671 * @note If you want to scan bytes that may contain NUL values, then use
3672 *       convert__scan_bytes() instead.
3673 */
3674YY_BUFFER_STATE convert__scan_string (yyconst char * yystr )
3675{
3676   
3677   return convert__scan_bytes(yystr,strlen(yystr) );
3678}
3679
3680/** Setup the input buffer state to scan the given bytes. The next call to convert_lex() will
3681 * scan from a @e copy of @a bytes.
3682 * @param bytes the byte buffer to scan
3683 * @param len the number of bytes in the buffer pointed to by @a bytes.
3684 *
3685 * @return the newly allocated buffer state object.
3686 */
3687YY_BUFFER_STATE convert__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
3688{
3689   YY_BUFFER_STATE b;
3690   char *buf;
3691   yy_size_t n, i;
3692   
3693   /* Get memory for full buffer, including space for trailing EOB's. */
3694   n = _yybytes_len + 2;
3695   buf = (char *) convert_alloc();
3696   if ( ! buf )
3697      YY_FATAL_ERROR( "out of dynamic memory in convert__scan_bytes()" );
3698
3699   for ( i = 0; i < _yybytes_len; ++i )
3700      buf[i] = yybytes[i];
3701
3702   buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3703
3704   b = convert__scan_buffer(buf,n );
3705   if ( ! b )
3706      YY_FATAL_ERROR( "bad buffer in convert__scan_bytes()" );
3707
3708   /* It's okay to grow etc. this buffer, and we should throw it
3709    * away when we're done.
3710    */
3711   b->yy_is_our_buffer = 1;
3712
3713   return b;
3714}
3715
3716#ifndef YY_EXIT_FAILURE
3717#define YY_EXIT_FAILURE 2
3718#endif
3719
3720static void yy_fatal_error (yyconst char* msg )
3721{
3722      (void) fprintf( stderr, "%s\n", msg );
3723   exit( YY_EXIT_FAILURE );
3724}
3725
3726/* Redefine yyless() so it works in section 3 code. */
3727
3728#undef yyless
3729#define yyless(n) \
3730   do \
3731      { \
3732      /* Undo effects of setting up convert_text. */ \
3733        int yyless_macro_arg = (n); \
3734        YY_LESS_LINENO(yyless_macro_arg);\
3735      convert_text[convert_leng] = (yy_hold_char); \
3736      (yy_c_buf_p) = convert_text + yyless_macro_arg; \
3737      (yy_hold_char) = *(yy_c_buf_p); \
3738      *(yy_c_buf_p) = '\0'; \
3739      convert_leng = yyless_macro_arg; \
3740      } \
3741   while ( 0 )
3742
3743/* Accessor  methods (get/set functions) to struct members. */
3744
3745/** Get the current line number.
3746 *
3747 */
3748int convert_get_lineno  (void)
3749{
3750       
3751    return convert_lineno;
3752}
3753
3754/** Get the input stream.
3755 *
3756 */
3757FILE *convert_get_in  (void)
3758{
3759        return convert_in;
3760}
3761
3762/** Get the output stream.
3763 *
3764 */
3765FILE *convert_get_out  (void)
3766{
3767        return convert_out;
3768}
3769
3770/** Get the length of the current token.
3771 *
3772 */
3773yy_size_t convert_get_leng  (void)
3774{
3775        return convert_leng;
3776}
3777
3778/** Get the current token.
3779 *
3780 */
3781
3782char *convert_get_text  (void)
3783{
3784        return convert_text;
3785}
3786
3787/** Set the current line number.
3788 * @param line_number
3789 *
3790 */
3791void convert_set_lineno (int  line_number )
3792{
3793   
3794    convert_lineno = line_number;
3795}
3796
3797/** Set the input stream. This does not discard the current
3798 * input buffer.
3799 * @param in_str A readable stream.
3800 *
3801 * @see convert__switch_to_buffer
3802 */
3803void convert_set_in (FILE *  in_str )
3804{
3805        convert_in = in_str ;
3806}
3807
3808void convert_set_out (FILE *  out_str )
3809{
3810        convert_out = out_str ;
3811}
3812
3813int convert_get_debug  (void)
3814{
3815        return convert__flex_debug;
3816}
3817
3818void convert_set_debug (int  bdebug )
3819{
3820        convert__flex_debug = bdebug ;
3821}
3822
3823static int yy_init_globals (void)
3824{
3825        /* Initialization is the same as for the non-reentrant scanner.
3826     * This function is called from convert_lex_destroy(), so don't allocate here.
3827     */
3828
3829    (yy_buffer_stack) = 0;
3830    (yy_buffer_stack_top) = 0;
3831    (yy_buffer_stack_max) = 0;
3832    (yy_c_buf_p) = (char *) 0;
3833    (yy_init) = 0;
3834    (yy_start) = 0;
3835
3836/* Defined in main.c */
3837#ifdef YY_STDINIT
3838    convert_in = stdin;
3839    convert_out = stdout;
3840#else
3841    convert_in = (FILE *) 0;
3842    convert_out = (FILE *) 0;
3843#endif
3844
3845    /* For future reference: Set errno on error, since we are called by
3846     * convert_lex_init()
3847     */
3848    return 0;
3849}
3850
3851/* convert_lex_destroy is for both reentrant and non-reentrant scanners. */
3852int convert_lex_destroy  (void)
3853{
3854   
3855    /* Pop the buffer stack, destroying each element. */
3856   while(YY_CURRENT_BUFFER){
3857      convert__delete_buffer(YY_CURRENT_BUFFER  );
3858      YY_CURRENT_BUFFER_LVALUE = NULL;
3859      convert_pop_buffer_state();
3860   }
3861
3862   /* Destroy the stack itself. */
3863   convert_free((yy_buffer_stack) );
3864   (yy_buffer_stack) = NULL;
3865
3866    /* Reset the globals. This is important in a non-reentrant scanner so the next time
3867     * convert_lex() is called, initialization will occur. */
3868    yy_init_globals( );
3869
3870    return 0;
3871}
3872
3873/*
3874 * Internal utility routines.
3875 */
3876
3877#ifndef yytext_ptr
3878static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3879{
3880   register int i;
3881   for ( i = 0; i < n; ++i )
3882      s1[i] = s2[i];
3883}
3884#endif
3885
3886#ifdef YY_NEED_STRLEN
3887static int yy_flex_strlen (yyconst char * s )
3888{
3889   register int n;
3890   for ( n = 0; s[n]; ++n )
3891      ;
3892
3893   return n;
3894}
3895#endif
3896
3897void *convert_alloc (yy_size_t  size )
3898{
3899   return (void *) malloc( size );
3900}
3901
3902void *convert_realloc  (void * ptr, yy_size_t  size )
3903{
3904   /* The cast to (char *) in the following accommodates both
3905    * implementations that use char* generic pointers, and those
3906    * that use void* generic pointers.  It works with the latter
3907    * because both ANSI C and C++ allow castless assignment from
3908    * any pointer type to void*, and deal with argument conversions
3909    * as though doing an assignment.
3910    */
3911   return (void *) realloc( (char *) ptr, size );
3912}
3913
3914void convert_free (void * ptr )
3915{
3916   free( (char *) ptr );   /* see convert_realloc() for (char *) cast */
3917}
3918
3919#define YYTABLES_NAME "yytables"
3920
3921#line 69 "convert.lex"
3922
3923
3924
Note: See TracBrowser for help on using the repository browser.