1 /* A Bison parser, made by GNU Bison 1.875a.  */
2 
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20 
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25 
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28 
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35 
36 /* Identify Bison output.  */
37 #define YYBISON 1
38 
39 /* Skeleton name.  */
40 #define YYSKELETON_NAME "yacc.c"
41 
42 /* Pure parsers.  */
43 #define YYPURE 0
44 
45 /* Using locations.  */
46 #define YYLSP_NEEDED 0
47 
48 /* If NAME_PREFIX is specified substitute the variables and functions
49    names.  */
50 #define yyparse dice_yyparse
51 #define yylex   dice_yylex
52 #define yyerror dice_yyerror
53 #define yylval  dice_yylval
54 #define yychar  dice_yychar
55 #define yydebug dice_yydebug
56 #define yynerrs dice_yynerrs
57 
58 
59 /* Tokens.  */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62    /* Put the tokens into the symbol table, so that GDB and other debuggers
63       know about them.  */
64    enum yytokentype {
65      lFLOAT = 258,
66      tokINTEGER = 259,
67      tokARRAY = 260,
68      NAME = 261,
69      SIN = 262,
70      COS = 263,
71      TAN = 264,
72      ACOS = 265,
73      ASIN = 266,
74      ATAN = 267,
75      LOG = 268,
76      EXP = 269,
77      ABS_TOKEN = 270,
78      SQRT = 271,
79      WHERE = 272,
80      INDEX = 273,
81      EQEQ = 274,
82      LT = 275,
83      LE = 276,
84      GT = 277,
85      GE = 278,
86      NE = 279,
87      LTLT = 280,
88      GTGT = 281,
89      JOIN = 282
90    };
91 #endif
92 #define lFLOAT 258
93 #define tokINTEGER 259
94 #define tokARRAY 260
95 #define NAME 261
96 #define SIN 262
97 #define COS 263
98 #define TAN 264
99 #define ACOS 265
100 #define ASIN 266
101 #define ATAN 267
102 #define LOG 268
103 #define EXP 269
104 #define ABS_TOKEN 270
105 #define SQRT 271
106 #define WHERE 272
107 #define INDEX 273
108 #define EQEQ 274
109 #define LT 275
110 #define LE 276
111 #define GT 277
112 #define GE 278
113 #define NE 279
114 #define LTLT 280
115 #define GTGT 281
116 #define JOIN 282
117 
118 
119 
120 
121 /* Copy the first part of user declarations.  */
122 
123 /* Force the definition for Linux */
124 /* Possible bug in older Linux yacc */
125 
126 #ifndef NOBISON
127 extern int yylex();
128 extern "C" {
129         void yyerror( const char *);
130         int  yyparse( void );
131 }
132 #endif
133 #include <XdmfExpr.h>
134 #include <XdmfArray.h>
135 #include <XdmfHDF.h>
136 #include <math.h>
137 
138 static xdmf2::XdmfArray *XdmfExprReturnValue;
139 XdmfExprSymbol *XdmfExprItemsTable = NULL;
140 
141 
142 namespace xdmf2
143 {
144 
145 class XdmfInt64Array : public XdmfArray {
146 public :
XdmfInt64Array(XdmfInt64 Length)147         XdmfInt64Array( XdmfInt64 Length ) {
148                 this->SetNumberType( XDMF_INT64_TYPE );
149                 this->SetNumberOfElements( Length );
150                 }
XdmfInt64Array()151         XdmfInt64Array() {
152                 this->SetNumberType( XDMF_INT64_TYPE );
153                 this->SetNumberOfElements( 10 );
154                 };
155 };
156 
157 }
158 
159 #define ADD_XDMF_tokARRAY_TO_SYMBOL( a ) \
160         { \
161         char        name[80]; \
162         XdmfExprSymbol *sp; \
163         sprintf( name, "XdmfArray_%X", ( XdmfLength)(a) ); \
164         sp = XdmfExprSymbolLookup( name ); \
165         sp->ClientData = (a); \
166         }
167 
168 
169 
170 /* Enabling traces.  */
171 #ifndef YYDEBUG
172 # define YYDEBUG 0
173 #endif
174 
175 /* Enabling verbose error messages.  */
176 #ifdef YYERROR_VERBOSE
177 # undef YYERROR_VERBOSE
178 # define YYERROR_VERBOSE 1
179 #else
180 # define YYERROR_VERBOSE 0
181 #endif
182 
183 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
184 
185 typedef union YYSTYPE {
186         double                DoubleValue;
187         long                IntegerValue;
188         void                *ArrayPointer;
189         XdmfExprSymbol        *Symbol;
190 } YYSTYPE;
191 /* Line 191 of yacc.c.  */
192 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
193 # define YYSTYPE_IS_DECLARED 1
194 # define YYSTYPE_IS_TRIVIAL 1
195 #endif
196 
197 
198 
199 /* Copy the second part of user declarations.  */
200 
201 
202 /* Line 214 of yacc.c.  */
203 
204 
205 #if ! defined (yyoverflow) || YYERROR_VERBOSE
206 
207 /* The parser invokes alloca or malloc; define the necessary symbols.  */
208 
209 # if YYSTACK_USE_ALLOCA
210 #  define YYSTACK_ALLOC alloca
211 # else
212 #  ifndef YYSTACK_USE_ALLOCA
213 #   if defined (alloca) || defined (_ALLOCA_H)
214 #    define YYSTACK_ALLOC alloca
215 #   else
216 #    ifdef __GNUC__
217 #     define YYSTACK_ALLOC __builtin_alloca
218 #    endif
219 #   endif
220 #  endif
221 # endif
222 
223 # ifdef YYSTACK_ALLOC
224    /* Pacify GCC's `empty if-body' warning. */
225 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
226 # else
227 #  if defined (__STDC__) || defined (__cplusplus)
228 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
229 #   define YYSIZE_T size_t
230 #  endif
231 #  define YYSTACK_ALLOC malloc
232 #  define YYSTACK_FREE free
233 # endif
234 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
235 
236 
237 #if (! defined (yyoverflow) \
238      && (! defined (__cplusplus) \
239          || (YYSTYPE_IS_TRIVIAL)))
240 
241 /* A type that is properly aligned for any stack member.  */
242 union yyalloc
243 {
244   short yyss;
245   YYSTYPE yyvs;
246   };
247 
248 /* The size of the maximum gap between one aligned stack and the next.  */
249 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
250 
251 /* The size of an array large to enough to hold all stacks, each with
252    N elements.  */
253 # define YYSTACK_BYTES(N) \
254      ((N) * (sizeof (short) + sizeof (YYSTYPE))                                \
255       + YYSTACK_GAP_MAXIMUM)
256 
257 /* Copy COUNT objects from FROM to TO.  The source and destination do
258    not overlap.  */
259 # ifndef YYCOPY
260 #  if 1 < __GNUC__
261 #   define YYCOPY(To, From, Count) \
262       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
263 #  else
264 #   define YYCOPY(To, From, Count)                \
265       do                                        \
266         {                                        \
267           register YYSIZE_T yyi;                \
268           for (yyi = 0; yyi < (Count); yyi++)        \
269             (To)[yyi] = (From)[yyi];                \
270         }                                        \
271       while (0)
272 #  endif
273 # endif
274 
275 /* Relocate STACK from its old location to the new one.  The
276    local variables YYSIZE and YYSTACKSIZE give the old and new number of
277    elements in the stack, and YYPTR gives the new location of the
278    stack.  Advance YYPTR to a properly aligned location for the next
279    stack.  */
280 # define YYSTACK_RELOCATE(Stack)                                        \
281     do                                                                        \
282       {                                                                        \
283         YYSIZE_T yynewbytes;                                                \
284         YYCOPY (&yyptr->Stack, Stack, yysize);                                \
285         Stack = &yyptr->Stack;                                                \
286         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
287         yyptr += yynewbytes / sizeof (*yyptr);                                \
288       }                                                                        \
289     while (0)
290 
291 #endif
292 
293 #if defined (__STDC__) || defined (__cplusplus)
294    typedef signed char yysigned_char;
295 #else
296    typedef short yysigned_char;
297 #endif
298 
299 /* YYFINAL -- State number of the termination state. */
300 #define YYFINAL  22
301 /* YYLAST -- Last index in YYTABLE.  */
302 #define YYLAST   278
303 
304 /* YYNTOKENS -- Number of terminals. */
305 #define YYNTOKENS  40
306 /* YYNNTS -- Number of nonterminals. */
307 #define YYNNTS  5
308 /* YYNRULES -- Number of rules. */
309 #define YYNRULES  46
310 /* YYNRULES -- Number of states. */
311 #define YYNSTATES  119
312 
313 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
314 #define YYUNDEFTOK  2
315 #define YYMAXUTOK   282
316 
317 #define YYTRANSLATE(YYX)                                                 \
318   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
319 
320 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
321 static const unsigned char yytranslate[] =
322 {
323        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
324        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
325        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
326        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
327       38,    39,    30,    29,    32,    28,     2,    31,     2,     2,
328        2,     2,     2,     2,     2,     2,     2,     2,    37,    33,
329        2,    34,     2,     2,     2,     2,     2,     2,     2,     2,
330        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
331        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
332        2,    35,     2,    36,     2,     2,     2,     2,     2,     2,
333        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
334        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
335        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
336        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
337        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
338        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
339        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
340        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
341        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
342        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
343        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
344        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
345        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
346        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
347        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
348        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
349        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
350       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
351       25,    26,    27
352 };
353 
354 #if YYDEBUG
355 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
356    YYRHS.  */
357 static const unsigned char yyprhs[] =
358 {
359        0,     0,     3,     5,     9,    13,    20,    27,    36,    45,
360       47,    49,    53,    57,    61,    65,    69,    73,    77,    81,
361       85,    89,    93,    97,   101,   105,   110,   117,   124,   131,
362      138,   145,   152,   159,   166,   173,   178,   182,   187,   189,
363      193,   197,   201,   205,   210,   214,   216
364 };
365 
366 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
367 static const yysigned_char yyrhs[] =
368 {
369       41,     0,    -1,    42,    -1,     5,    34,    43,    -1,     5,
370       34,    44,    -1,     5,    35,    43,    36,    34,    44,    -1,
371        5,    35,    43,    36,    34,    43,    -1,     5,    35,     4,
372       37,     4,    36,    34,    44,    -1,     5,    35,     4,    37,
373        4,    36,    34,    43,    -1,    43,    -1,    44,    -1,    43,
374       29,    43,    -1,    43,    32,    43,    -1,    43,    33,    43,
375       -1,    43,    28,    43,    -1,    43,    30,    43,    -1,    43,
376       31,    43,    -1,    43,    29,    44,    -1,    43,    28,    44,
377       -1,    43,    30,    44,    -1,    43,    31,    44,    -1,    44,
378       29,    43,    -1,    44,    28,    43,    -1,    44,    30,    43,
379       -1,    44,    31,    43,    -1,     5,    35,    43,    36,    -1,
380        5,    35,     4,    37,     4,    36,    -1,    18,    38,    43,
381       19,    43,    39,    -1,    17,    38,    43,    19,    43,    39,
382       -1,    17,    38,    43,    19,    44,    39,    -1,    17,    38,
383       43,    20,    44,    39,    -1,    17,    38,    43,    21,    44,
384       39,    -1,    17,    38,    43,    22,    44,    39,    -1,    17,
385       38,    43,    23,    44,    39,    -1,    17,    38,    43,    24,
386       44,    39,    -1,     6,    38,    43,    39,    -1,    38,    43,
387       39,    -1,    27,    38,    43,    39,    -1,     5,    -1,    44,
388       29,    44,    -1,    44,    28,    44,    -1,    44,    30,    44,
389       -1,    44,    31,    44,    -1,     6,    38,    44,    39,    -1,
390       38,    44,    39,    -1,     4,    -1,     3,    -1
391 };
392 
393 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
394 static const unsigned short yyrline[] =
395 {
396        0,    68,    68,    76,    84,    89,   101,   117,   128,   141,
397      148,   153,   162,   239,   303,   312,   322,   331,   340,   349,
398      358,   367,   376,   385,   394,   403,   413,   424,   469,   502,
399      523,   544,   565,   586,   607,   628,   646,   650,   654,   671,
400      675,   679,   683,   687,   695,   699,   703
401 };
402 #endif
403 
404 #if YYDEBUG || YYERROR_VERBOSE
405 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
406    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
407 static const char *const yytname[] =
408 {
409   "$end", "error", "$undefined", "lFLOAT", "tokINTEGER", "tokARRAY", "NAME",
410   "SIN", "COS", "TAN", "ACOS", "ASIN", "ATAN", "LOG", "EXP", "ABS_TOKEN",
411   "SQRT", "WHERE", "INDEX", "EQEQ", "LT", "LE", "GT", "GE", "NE", "LTLT",
412   "GTGT", "JOIN", "'-'", "'+'", "'*'", "'/'", "','", "';'", "'='", "'['",
413   "']'", "':'", "'('", "')'", "$accept", "statemant_list", "statement",
414   "ArrayExpression", "ScalarExpression", 0
415 };
416 #endif
417 
418 # ifdef YYPRINT
419 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
420    token YYLEX-NUM.  */
421 static const unsigned short yytoknum[] =
422 {
423        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
424      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
425      275,   276,   277,   278,   279,   280,   281,   282,    45,    43,
426       42,    47,    44,    59,    61,    91,    93,    58,    40,    41
427 };
428 # endif
429 
430 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
431 static const unsigned char yyr1[] =
432 {
433        0,    40,    41,    42,    42,    42,    42,    42,    42,    42,
434       42,    43,    43,    43,    43,    43,    43,    43,    43,    43,
435       43,    43,    43,    43,    43,    43,    43,    43,    43,    43,
436       43,    43,    43,    43,    43,    43,    43,    43,    43,    44,
437       44,    44,    44,    44,    44,    44,    44
438 };
439 
440 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
441 static const unsigned char yyr2[] =
442 {
443        0,     2,     1,     3,     3,     6,     6,     8,     8,     1,
444        1,     3,     3,     3,     3,     3,     3,     3,     3,     3,
445        3,     3,     3,     3,     3,     4,     6,     6,     6,     6,
446        6,     6,     6,     6,     6,     4,     3,     4,     1,     3,
447        3,     3,     3,     4,     3,     1,     1
448 };
449 
450 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
451    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
452    means the default is an error.  */
453 static const unsigned char yydefact[] =
454 {
455        0,    46,    45,    38,     0,     0,     0,     0,     0,     0,
456        2,     9,    10,     0,     0,     0,     0,     0,     0,    38,
457        0,     0,     1,     0,     0,     0,     0,     0,     0,     0,
458        0,     0,     0,     3,     4,    45,     0,     0,     0,     0,
459        0,     0,     0,     0,    36,    44,    14,    18,    11,    17,
460       15,    19,    16,    20,    12,    13,    22,    40,    21,    39,
461       23,    41,    24,    42,     0,    25,    35,    43,     0,     0,
462        0,     0,     0,     0,     0,    37,    45,     0,     0,     0,
463        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
464        0,    25,    26,     6,     5,    28,    29,     0,     0,     0,
465        0,     0,     0,    30,    31,    32,    33,    34,    27,     0,
466        0,     0,    40,    39,    41,    42,    26,     8,     7
467 };
468 
469 /* YYDEFGOTO[NTERM-NUM]. */
470 static const yysigned_char yydefgoto[] =
471 {
472       -1,     9,    10,    11,    37
473 };
474 
475 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
476    STATE-NUM.  */
477 #define YYPACT_NINF -36
478 static const short yypact[] =
479 {
480        1,   -36,   -36,   -33,   -35,   -27,   -24,   -16,    88,    27,
481      -36,   245,    26,    88,   113,    88,    88,    88,    88,     5,
482      143,     7,   -36,    88,    88,    88,    88,    88,    88,    88,
483       88,    88,    88,   245,    26,     4,   227,    26,   155,   108,
484      137,    56,   167,   117,   -36,   -36,   220,   -14,   220,   -14,
485      -12,   -36,   -12,   -36,   -36,   -36,   220,   -14,   220,   -14,
486      -12,   -36,   -12,   -36,    38,    11,   -36,   -36,    88,     6,
487        6,     6,     6,     6,    88,   -36,    10,   236,    40,    88,
488      179,   150,    36,     6,   162,   174,   186,   198,   203,   191,
489       73,   -36,    46,   245,    26,   -36,   -36,     6,   210,     6,
490        6,     6,     6,   -36,   -36,   -36,   -36,   -36,   -36,    45,
491       88,   215,     3,     3,   -36,   -36,   -36,   245,    26
492 };
493 
494 /* YYPGOTO[NTERM-NUM].  */
495 static const yysigned_char yypgoto[] =
496 {
497      -36,   -36,   -36,    35,     0
498 };
499 
500 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
501    positive, shift that token.  If negative, reduce the rule which
502    number is the opposite.  If zero, do what YYDEFACT says.
503    If YYTABLE_NINF, syntax error.  */
504 #define YYTABLE_NINF -1
505 static const unsigned char yytable[] =
506 {
507       12,    13,    14,    15,     1,     2,     3,     4,    21,     1,
508        2,    16,    82,    34,    17,    39,    31,    32,     5,     6,
509       27,    28,    18,    47,    49,    51,    53,    22,     7,    57,
510       59,    61,    63,   101,   102,    29,    30,    31,    32,     8,
511       43,    64,    78,    20,    83,    79,    45,    90,    33,    36,
512       38,    40,    41,    42,    29,    30,    31,    32,    46,    48,
513       50,    52,    54,    55,    56,    58,    60,    62,    81,    84,
514       85,    86,    87,    88,    97,    74,    92,   109,    77,    94,
515      110,   116,     0,    98,    23,    24,    25,    26,    27,    28,
516        0,     1,     2,    19,     4,     0,     0,   111,     0,   112,
517      113,   114,   115,    80,     0,     5,     6,     0,     0,    89,
518      118,     0,     0,     0,    93,     7,     1,    35,    19,     4,
519        1,    76,    19,     4,     0,     0,     8,     0,     0,     0,
520        5,     6,     0,     0,     5,     6,    29,    30,    31,    32,
521        7,     0,     0,     0,     7,   117,     0,    67,     0,     0,
522        0,     8,     0,     0,     0,     8,    68,    69,    70,    71,
523       72,    73,     0,     0,     0,    23,    24,    25,    26,    27,
524       28,    23,    24,    25,    26,    27,    28,     0,    29,    30,
525       31,    32,    44,    23,    24,    25,    26,    27,    28,    96,
526       99,   100,   101,   102,    66,    23,    24,    25,    26,    27,
527       28,   103,    99,   100,   101,   102,    75,    23,    24,    25,
528       26,    27,    28,   104,    99,   100,   101,   102,    95,    23,
529       24,    25,    26,    27,    28,   105,    99,   100,   101,   102,
530      108,    99,   100,   101,   102,     0,     0,   106,    99,   100,
531      101,   102,   107,    99,   100,   101,   102,     0,     0,    45,
532       25,    26,    27,    28,    67,    23,    24,    25,    26,    27,
533       28,     0,     0,    65,    23,    24,    25,    26,    27,    28,
534        0,     0,    91,    23,    24,    25,    26,    27,    28
535 };
536 
537 static const yysigned_char yycheck[] =
538 {
539        0,    34,    35,    38,     3,     4,     5,     6,     8,     3,
540        4,    38,     6,    13,    38,    15,    30,    31,    17,    18,
541       32,    33,    38,    23,    24,    25,    26,     0,    27,    29,
542       30,    31,    32,    30,    31,    28,    29,    30,    31,    38,
543       35,    37,     4,     8,    38,    34,    39,    37,    13,    14,
544       15,    16,    17,    18,    28,    29,    30,    31,    23,    24,
545       25,    26,    27,    28,    29,    30,    31,    32,    68,    69,
546       70,    71,    72,    73,    38,    19,    36,     4,    43,    79,
547       34,    36,    -1,    83,    28,    29,    30,    31,    32,    33,
548       -1,     3,     4,     5,     6,    -1,    -1,    97,    -1,    99,
549      100,   101,   102,    68,    -1,    17,    18,    -1,    -1,    74,
550      110,    -1,    -1,    -1,    79,    27,     3,     4,     5,     6,
551        3,     4,     5,     6,    -1,    -1,    38,    -1,    -1,    -1,
552       17,    18,    -1,    -1,    17,    18,    28,    29,    30,    31,
553       27,    -1,    -1,    -1,    27,   110,    -1,    39,    -1,    -1,
554       -1,    38,    -1,    -1,    -1,    38,    19,    20,    21,    22,
555       23,    24,    -1,    -1,    -1,    28,    29,    30,    31,    32,
556       33,    28,    29,    30,    31,    32,    33,    -1,    28,    29,
557       30,    31,    39,    28,    29,    30,    31,    32,    33,    39,
558       28,    29,    30,    31,    39,    28,    29,    30,    31,    32,
559       33,    39,    28,    29,    30,    31,    39,    28,    29,    30,
560       31,    32,    33,    39,    28,    29,    30,    31,    39,    28,
561       29,    30,    31,    32,    33,    39,    28,    29,    30,    31,
562       39,    28,    29,    30,    31,    -1,    -1,    39,    28,    29,
563       30,    31,    39,    28,    29,    30,    31,    -1,    -1,    39,
564       30,    31,    32,    33,    39,    28,    29,    30,    31,    32,
565       33,    -1,    -1,    36,    28,    29,    30,    31,    32,    33,
566       -1,    -1,    36,    28,    29,    30,    31,    32,    33
567 };
568 
569 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
570    symbol of state STATE-NUM.  */
571 static const unsigned char yystos[] =
572 {
573        0,     3,     4,     5,     6,    17,    18,    27,    38,    41,
574       42,    43,    44,    34,    35,    38,    38,    38,    38,     5,
575       43,    44,     0,    28,    29,    30,    31,    32,    33,    28,
576       29,    30,    31,    43,    44,     4,    43,    44,    43,    44,
577       43,    43,    43,    35,    39,    39,    43,    44,    43,    44,
578       43,    44,    43,    44,    43,    43,    43,    44,    43,    44,
579       43,    44,    43,    44,    37,    36,    39,    39,    19,    20,
580       21,    22,    23,    24,    19,    39,     4,    43,     4,    34,
581       43,    44,     6,    38,    44,    44,    44,    44,    44,    43,
582       37,    36,    36,    43,    44,    39,    39,    38,    44,    28,
583       29,    30,    31,    39,    39,    39,    39,    39,    39,     4,
584       34,    44,    44,    44,    44,    44,    36,    43,    44
585 };
586 
587 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
588 # define YYSIZE_T __SIZE_TYPE__
589 #endif
590 #if ! defined (YYSIZE_T) && defined (size_t)
591 # define YYSIZE_T size_t
592 #endif
593 #if ! defined (YYSIZE_T)
594 # if defined (__STDC__) || defined (__cplusplus)
595 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
596 #  define YYSIZE_T size_t
597 # endif
598 #endif
599 #if ! defined (YYSIZE_T)
600 # define YYSIZE_T unsigned int
601 #endif
602 
603 #define yyerrok                (yyerrstatus = 0)
604 #define yyclearin        (yychar = YYEMPTY)
605 #define YYEMPTY                (-2)
606 #define YYEOF                0
607 
608 #define YYACCEPT        goto yyacceptlab
609 #define YYABORT                goto yyabortlab
610 #define YYERROR                goto yyerrlab1
611 
612 
613 /* Like YYERROR except do call yyerror.  This remains here temporarily
614    to ease the transition to the new meaning of YYERROR, for GCC.
615    Once GCC version 2 has supplanted version 1, this can go.  */
616 
617 #define YYFAIL                goto yyerrlab
618 
619 #define YYRECOVERING()  (!!yyerrstatus)
620 
621 #define YYBACKUP(Token, Value)                                        \
622 do                                                                \
623   if (yychar == YYEMPTY && yylen == 1)                                \
624     {                                                                \
625       yychar = (Token);                                                \
626       yylval = (Value);                                                \
627       yytoken = YYTRANSLATE (yychar);                                \
628       YYPOPSTACK;                                                \
629       goto yybackup;                                                \
630     }                                                                \
631   else                                                                \
632     {                                                                 \
633       yyerror ("syntax error: cannot back up");\
634       YYERROR;                                                        \
635     }                                                                \
636 while (0)
637 
638 #define YYTERROR        1
639 #define YYERRCODE        256
640 
641 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
642    are run).  */
643 
644 #ifndef YYLLOC_DEFAULT
645 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
646   Current.first_line   = Rhs[1].first_line;      \
647   Current.first_column = Rhs[1].first_column;    \
648   Current.last_line    = Rhs[N].last_line;       \
649   Current.last_column  = Rhs[N].last_column;
650 #endif
651 
652 /* YYLEX -- calling `yylex' with the right arguments.  */
653 
654 #ifdef YYLEX_PARAM
655 # define YYLEX yylex (YYLEX_PARAM)
656 #else
657 # define YYLEX yylex ()
658 #endif
659 
660 /* Enable debugging if requested.  */
661 #if YYDEBUG
662 
663 # ifndef YYFPRINTF
664 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
665 #  define YYFPRINTF fprintf
666 # endif
667 
668 # define YYDPRINTF(Args)                        \
669 do {                                                \
670   if (yydebug)                                        \
671     YYFPRINTF Args;                                \
672 } while (0)
673 
674 # define YYDSYMPRINT(Args)                        \
675 do {                                                \
676   if (yydebug)                                        \
677     yysymprint Args;                                \
678 } while (0)
679 
680 # define YYDSYMPRINTF(Title, Token, Value, Location)                \
681 do {                                                                \
682   if (yydebug)                                                        \
683     {                                                                \
684       YYFPRINTF (stderr, "%s ", Title);                                \
685       yysymprint (stderr,                                         \
686                   Token, Value);        \
687       YYFPRINTF (stderr, "\n");                                        \
688     }                                                                \
689 } while (0)
690 
691 /*------------------------------------------------------------------.
692 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
693 | TOP (cinluded).                                                   |
694 `------------------------------------------------------------------*/
695 
696 #if defined (__STDC__) || defined (__cplusplus)
697 static void
yy_stack_print(short * bottom,short * top)698 yy_stack_print (short *bottom, short *top)
699 #else
700 static void
701 yy_stack_print (bottom, top)
702     short *bottom;
703     short *top;
704 #endif
705 {
706   YYFPRINTF (stderr, "Stack now");
707   for (/* Nothing. */; bottom <= top; ++bottom)
708     YYFPRINTF (stderr, " %d", *bottom);
709   YYFPRINTF (stderr, "\n");
710 }
711 
712 # define YY_STACK_PRINT(Bottom, Top)                                \
713 do {                                                                \
714   if (yydebug)                                                        \
715     yy_stack_print ((Bottom), (Top));                                \
716 } while (0)
717 
718 
719 /*------------------------------------------------.
720 | Report that the YYRULE is going to be reduced.  |
721 `------------------------------------------------*/
722 
723 #if defined (__STDC__) || defined (__cplusplus)
724 static void
yy_reduce_print(int yyrule)725 yy_reduce_print (int yyrule)
726 #else
727 static void
728 yy_reduce_print (yyrule)
729     int yyrule;
730 #endif
731 {
732   int yyi;
733   unsigned int yylineno = yyrline[yyrule];
734   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
735              yyrule - 1, yylineno);
736   /* Print the symbols being reduced, and their result.  */
737   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
738     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
739   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
740 }
741 
742 # define YY_REDUCE_PRINT(Rule)                \
743 do {                                        \
744   if (yydebug)                                \
745     yy_reduce_print (Rule);                \
746 } while (0)
747 
748 /* Nonzero means print parse trace.  It is left uninitialized so that
749    multiple parsers can coexist.  */
750 int yydebug;
751 #else /* !YYDEBUG */
752 # define YYDPRINTF(Args)
753 # define YYDSYMPRINT(Args)
754 # define YYDSYMPRINTF(Title, Token, Value, Location)
755 # define YY_STACK_PRINT(Bottom, Top)
756 # define YY_REDUCE_PRINT(Rule)
757 #endif /* !YYDEBUG */
758 
759 
760 /* YYINITDEPTH -- initial size of the parser's stacks.  */
761 #ifndef        YYINITDEPTH
762 # define YYINITDEPTH 200
763 #endif
764 
765 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
766    if the built-in stack extension method is used).
767 
768    Do not make this value too large; the results are undefined if
769    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
770    evaluated with infinite-precision integer arithmetic.  */
771 
772 #if YYMAXDEPTH == 0
773 # undef YYMAXDEPTH
774 #endif
775 
776 #ifndef YYMAXDEPTH
777 # define YYMAXDEPTH 10000
778 #endif
779 
780 
781 
782 #if YYERROR_VERBOSE
783 
784 # ifndef yystrlen
785 #  if defined (__GLIBC__) && defined (_STRING_H)
786 #   define yystrlen strlen
787 #  else
788 /* Return the length of YYSTR.  */
789 static YYSIZE_T
790 #   if defined (__STDC__) || defined (__cplusplus)
yystrlen(const char * yystr)791 yystrlen (const char *yystr)
792 #   else
793 yystrlen (yystr)
794      const char *yystr;
795 #   endif
796 {
797   register const char *yys = yystr;
798 
799   while (*yys++ != '\0')
800     continue;
801 
802   return yys - yystr - 1;
803 }
804 #  endif
805 # endif
806 
807 # ifndef yystpcpy
808 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
809 #   define yystpcpy stpcpy
810 #  else
811 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
812    YYDEST.  */
813 static char *
814 #   if defined (__STDC__) || defined (__cplusplus)
yystpcpy(char * yydest,const char * yysrc)815 yystpcpy (char *yydest, const char *yysrc)
816 #   else
817 yystpcpy (yydest, yysrc)
818      char *yydest;
819      const char *yysrc;
820 #   endif
821 {
822   register char *yyd = yydest;
823   register const char *yys = yysrc;
824 
825   while ((*yyd++ = *yys++) != '\0')
826     continue;
827 
828   return yyd - 1;
829 }
830 #  endif
831 # endif
832 
833 #endif /* !YYERROR_VERBOSE */
834 
835 
836 
837 #if YYDEBUG
838 /*--------------------------------.
839 | Print this symbol on YYOUTPUT.  |
840 `--------------------------------*/
841 
842 #if defined (__STDC__) || defined (__cplusplus)
843 static void
yysymprint(FILE * yyoutput,int yytype,YYSTYPE * yyvaluep)844 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
845 #else
846 static void
847 yysymprint (yyoutput, yytype, yyvaluep)
848     FILE *yyoutput;
849     int yytype;
850     YYSTYPE *yyvaluep;
851 #endif
852 {
853   /* Pacify ``unused variable'' warnings.  */
854   (void) yyvaluep;
855 
856   if (yytype < YYNTOKENS)
857     {
858       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
859 # ifdef YYPRINT
860       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
861 # endif
862     }
863   else
864     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
865 
866   YYFPRINTF (yyoutput, ")");
867 }
868 
869 #endif /* ! YYDEBUG */
870 /*-----------------------------------------------.
871 | Release the memory associated to this symbol.  |
872 `-----------------------------------------------*/
873 
874 #if defined (__STDC__) || defined (__cplusplus)
875 static void
yydestruct(int yytype,YYSTYPE * yyvaluep)876 yydestruct (int yytype, YYSTYPE *yyvaluep)
877 #else
878 static void
879 yydestruct (yytype, yyvaluep)
880     int yytype;
881     YYSTYPE *yyvaluep;
882 #endif
883 {
884   /* Pacify ``unused variable'' warnings.  */
885   (void) yyvaluep;
886   (void) yytype;
887 }
888 
889 
890 /* Prevent warnings from -Wmissing-prototypes.  */
891 
892 #ifdef YYPARSE_PARAM
893 # if defined (__STDC__) || defined (__cplusplus)
894 int yyparse (void *YYPARSE_PARAM);
895 # else
896 int yyparse ();
897 # endif
898 #else /* ! YYPARSE_PARAM */
899 #if defined (__STDC__) || defined (__cplusplus)
900 int yyparse (void);
901 #else
902 int yyparse ();
903 #endif
904 #endif /* ! YYPARSE_PARAM */
905 
906 
907 
908 /* The lookahead symbol.  */
909 int yychar;
910 
911 /* The semantic value of the lookahead symbol.  */
912 YYSTYPE yylval;
913 
914 /* Number of syntax errors so far.  */
915 int yynerrs;
916 
917 
918 
919 /*----------.
920 | yyparse.  |
921 `----------*/
922 
923 #ifdef YYPARSE_PARAM
924 # if defined (__STDC__) || defined (__cplusplus)
yyparse(void * YYPARSE_PARAM)925 int yyparse (void *YYPARSE_PARAM)
926 # else
927 int yyparse (YYPARSE_PARAM)
928   void *YYPARSE_PARAM;
929 # endif
930 #else /* ! YYPARSE_PARAM */
931 #if defined (__STDC__) || defined (__cplusplus)
932 int
933 yyparse (void)
934 #else
935 int
936 yyparse ()
937 
938 #endif
939 #endif
940 {
941 
942   register int yystate;
943   register int yyn;
944   int yyresult;
945   /* Number of tokens to shift before error messages enabled.  */
946   int yyerrstatus;
947   /* Lookahead token as an internal (translated) token number.  */
948   int yytoken = 0;
949 
950   /* Three stacks and their tools:
951      `yyss': related to states,
952      `yyvs': related to semantic values,
953      `yyls': related to locations.
954 
955      Refer to the stacks thru separate pointers, to allow yyoverflow
956      to reallocate them elsewhere.  */
957 
958   /* The state stack.  */
959   short        yyssa[YYINITDEPTH];
960   short *yyss = yyssa;
961   register short *yyssp;
962 
963   /* The semantic value stack.  */
964   YYSTYPE yyvsa[YYINITDEPTH];
965   YYSTYPE *yyvs = yyvsa;
966   register YYSTYPE *yyvsp;
967 
968 
969 
970 #define YYPOPSTACK   (yyvsp--, yyssp--)
971 
972   YYSIZE_T yystacksize = YYINITDEPTH;
973 
974   /* The variables used to return semantic value and location from the
975      action routines.  */
976   YYSTYPE yyval;
977 
978 
979   /* When reducing, the number of symbols on the RHS of the reduced
980      rule.  */
981   int yylen;
982 
983   YYDPRINTF ((stderr, "Starting parse\n"));
984 
985   yystate = 0;
986   yyerrstatus = 0;
987   yynerrs = 0;
988   yychar = YYEMPTY;                /* Cause a token to be read.  */
989 
990   /* Initialize stack pointers.
991      Waste one element of value and location stack
992      so that they stay on the same level as the state stack.
993      The wasted elements are never initialized.  */
994 
995   yyssp = yyss;
996   yyvsp = yyvs;
997 
998   goto yysetstate;
999 
1000 /*------------------------------------------------------------.
1001 | yynewstate -- Push a new state, which is found in yystate.  |
1002 `------------------------------------------------------------*/
1003  yynewstate:
1004   /* In all cases, when you get here, the value and location stacks
1005      have just been pushed. so pushing a state here evens the stacks.
1006      */
1007   yyssp++;
1008 
1009  yysetstate:
1010   *yyssp = yystate;
1011 
1012   if (yyss + yystacksize - 1 <= yyssp)
1013     {
1014       /* Get the current used size of the three stacks, in elements.  */
1015       YYSIZE_T yysize = yyssp - yyss + 1;
1016 
1017 #ifdef yyoverflow
1018       {
1019         /* Give user a chance to reallocate the stack. Use copies of
1020            these so that the &'s don't force the real ones into
1021            memory.  */
1022         YYSTYPE *yyvs1 = yyvs;
1023         short *yyss1 = yyss;
1024 
1025 
1026         /* Each stack pointer address is followed by the size of the
1027            data in use in that stack, in bytes.  This used to be a
1028            conditional around just the two extra args, but that might
1029            be undefined if yyoverflow is a macro.  */
1030         yyoverflow ("parser stack overflow",
1031                     &yyss1, yysize * sizeof (*yyssp),
1032                     &yyvs1, yysize * sizeof (*yyvsp),
1033 
1034                     &yystacksize);
1035 
1036         yyss = yyss1;
1037         yyvs = yyvs1;
1038       }
1039 #else /* no yyoverflow */
1040 # ifndef YYSTACK_RELOCATE
1041       goto yyoverflowlab;
1042 # else
1043       /* Extend the stack our own way.  */
1044       if (YYMAXDEPTH <= yystacksize)
1045         goto yyoverflowlab;
1046       yystacksize *= 2;
1047       if (YYMAXDEPTH < yystacksize)
1048         yystacksize = YYMAXDEPTH;
1049 
1050       {
1051         short *yyss1 = yyss;
1052         union yyalloc *yyptr =
1053           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1054         if (! yyptr)
1055           goto yyoverflowlab;
1056         YYSTACK_RELOCATE (yyss);
1057         YYSTACK_RELOCATE (yyvs);
1058 
1059 #  undef YYSTACK_RELOCATE
1060         if (yyss1 != yyssa)
1061           YYSTACK_FREE (yyss1);
1062       }
1063 # endif
1064 #endif /* no yyoverflow */
1065 
1066       yyssp = yyss + yysize - 1;
1067       yyvsp = yyvs + yysize - 1;
1068 
1069 
1070       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1071                   (unsigned long int) yystacksize));
1072 
1073       if (yyss + yystacksize - 1 <= yyssp)
1074         YYABORT;
1075     }
1076 
1077   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1078 
1079   goto yybackup;
1080 
1081 /*-----------.
1082 | yybackup.  |
1083 `-----------*/
1084 yybackup:
1085 
1086 /* Do appropriate processing given the current state.  */
1087 /* Read a lookahead token if we need one and don't already have one.  */
1088 /* yyresume: */
1089 
1090   /* First try to decide what to do without reference to lookahead token.  */
1091 
1092   yyn = yypact[yystate];
1093   if (yyn == YYPACT_NINF)
1094     goto yydefault;
1095 
1096   /* Not known => get a lookahead token if don't already have one.  */
1097 
1098   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1099   if (yychar == YYEMPTY)
1100     {
1101       YYDPRINTF ((stderr, "Reading a token: "));
1102       yychar = YYLEX;
1103     }
1104 
1105   if (yychar <= YYEOF)
1106     {
1107       yychar = yytoken = YYEOF;
1108       YYDPRINTF ((stderr, "Now at end of input.\n"));
1109     }
1110   else
1111     {
1112       yytoken = YYTRANSLATE (yychar);
1113       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1114     }
1115 
1116   /* If the proper action on seeing token YYTOKEN is to reduce or to
1117      detect an error, take that action.  */
1118   yyn += yytoken;
1119   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1120     goto yydefault;
1121   yyn = yytable[yyn];
1122   if (yyn <= 0)
1123     {
1124       if (yyn == 0 || yyn == YYTABLE_NINF)
1125         goto yyerrlab;
1126       yyn = -yyn;
1127       goto yyreduce;
1128     }
1129 
1130   if (yyn == YYFINAL)
1131     YYACCEPT;
1132 
1133   /* Shift the lookahead token.  */
1134   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1135 
1136   /* Discard the token being shifted unless it is eof.  */
1137   if (yychar != YYEOF)
1138     yychar = YYEMPTY;
1139 
1140   *++yyvsp = yylval;
1141 
1142 
1143   /* Count tokens shifted since error; after three, turn off error
1144      status.  */
1145   if (yyerrstatus)
1146     yyerrstatus--;
1147 
1148   yystate = yyn;
1149   goto yynewstate;
1150 
1151 
1152 /*-----------------------------------------------------------.
1153 | yydefault -- do the default action for the current state.  |
1154 `-----------------------------------------------------------*/
1155 yydefault:
1156   yyn = yydefact[yystate];
1157   if (yyn == 0)
1158     goto yyerrlab;
1159   goto yyreduce;
1160 
1161 
1162 /*-----------------------------.
1163 | yyreduce -- Do a reduction.  |
1164 `-----------------------------*/
1165 yyreduce:
1166   /* yyn is the number of a rule to reduce with.  */
1167   yylen = yyr2[yyn];
1168 
1169   /* If YYLEN is nonzero, implement the default value of the action:
1170      `$$ = $1'.
1171 
1172      Otherwise, the following line sets YYVAL to garbage.
1173      This behavior is undocumented and Bison
1174      users should not rely upon it.  Assigning to YYVAL
1175      unconditionally makes the parser a bit smaller, and it avoids a
1176      GCC warning that YYVAL may be used uninitialized.  */
1177   yyval = yyvsp[1-yylen];
1178 
1179 
1180   YY_REDUCE_PRINT (yyn);
1181   switch (yyn)
1182     {
1183         case 2:
1184 
1185     {
1186                 /*
1187                 printf("Complete\n");
1188                 printf("XdmfExprReturnValue Nelms = %d\n", XdmfExprReturnValue->GetNumberOfElements());
1189                 */
1190                 }
1191     break;
1192 
1193   case 3:
1194 
1195     {
1196                 xdmf2::XdmfArray *TempArray = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1197 
1198                 /* printf("Setting %s from ArrayExpression\n", $1); */
1199                 XdmfExprReturnValue = (xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1200                 *XdmfExprReturnValue = *TempArray;
1201                 delete TempArray;
1202                 }
1203     break;
1204 
1205   case 4:
1206 
1207     {
1208                 /* printf("Setting %s from ScalarExpression\n", $1); */
1209                 XdmfExprReturnValue = (xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1210                 *XdmfExprReturnValue = yyvsp[0].DoubleValue;
1211                 }
1212     break;
1213 
1214   case 5:
1215 
1216     {
1217                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1218                         xdmf2::XdmfArray        *Result = ( xdmf2::XdmfArray *)yyvsp[-5].ArrayPointer;
1219                         XdmfLength        i, index, Length = Array1->GetNumberOfElements();
1220 
1221                         for( i = 0 ; i < Length ; i++ ){
1222                                 index = (XdmfLength)Array1->GetValueAsFloat64( i );
1223                                 Result->SetValueFromFloat64( index, yyvsp[0].DoubleValue );
1224                                 }
1225                         delete Array1;
1226                         XdmfExprReturnValue = Result;
1227                 }
1228     break;
1229 
1230   case 6:
1231 
1232     {
1233                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1234                         xdmf2::XdmfArray        *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1235                         xdmf2::XdmfArray        *Result = ( xdmf2::XdmfArray *)yyvsp[-5].ArrayPointer;
1236                         XdmfFloat64        Value;
1237                         XdmfLength        i, index, Length = Array1->GetNumberOfElements();
1238 
1239                         for( i = 0 ; i < Length ; i++ ){
1240                                 index = (XdmfLength)Array1->GetValueAsFloat64( i );
1241                                 Value = Array2->GetValueAsFloat64( i );
1242                                 Result->SetValueFromFloat64( index, Value );
1243                                 }
1244                         delete Array1;
1245                         delete Array2;
1246                         XdmfExprReturnValue = Result;
1247                 }
1248     break;
1249 
1250   case 7:
1251 
1252     {
1253                         xdmf2::XdmfArray *Range;
1254 
1255                         /* printf("Array Range %d:%d = ScalarExpression \n", $3, $5);         */
1256                         Range = (xdmf2::XdmfArray *)yyvsp[-7].ArrayPointer;
1257                         XdmfExprReturnValue = Range->Reference( yyvsp[-5].IntegerValue, yyvsp[-3].IntegerValue ); /* This is a Reference */
1258                         *XdmfExprReturnValue = yyvsp[0].DoubleValue;
1259 
1260                         /* Now Point to the Entire Array */
1261                         XdmfExprReturnValue = (xdmf2::XdmfArray *)yyvsp[-7].ArrayPointer;
1262                         }
1263     break;
1264 
1265   case 8:
1266 
1267     {
1268                         xdmf2::XdmfArray *TempArray = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1269                         xdmf2::XdmfArray *Range;
1270 
1271                         /* printf("Array Range %d:%d = ArrayExpression \n", $3, $5);         */
1272                         Range = (xdmf2::XdmfArray *)yyvsp[-7].ArrayPointer;
1273                         XdmfExprReturnValue = Range->Reference( yyvsp[-5].IntegerValue, yyvsp[-3].IntegerValue ); /* This is a Reference */
1274                         *XdmfExprReturnValue = *TempArray;
1275 
1276                         /* Now Point to the Entire Array */
1277                         XdmfExprReturnValue = (xdmf2::XdmfArray *)yyvsp[-7].ArrayPointer;
1278                         delete TempArray;
1279                         }
1280     break;
1281 
1282   case 9:
1283 
1284     {
1285                 xdmf2::XdmfArray *TempArray = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1286 
1287                 /* printf("Clone from ArrayExpression\n"); */
1288                 XdmfExprReturnValue = TempArray;
1289                 /* printf("XdmfExprReturnValue Nelms = %d\n", XdmfExprReturnValue->GetNumberOfElements()); */
1290                 }
1291     break;
1292 
1293   case 10:
1294 
1295     {
1296                 printf("Pointless !! Scalar = %g\n", yyvsp[0].DoubleValue);
1297                 }
1298     break;
1299 
1300   case 11:
1301 
1302     {
1303                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1304                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1305 
1306                         /* printf("Array 0x%X + 0x%X\n", Array1, Array2); */
1307                         *Array1 += *Array2;
1308                         yyval.ArrayPointer = Array1;
1309                         delete Array2;
1310                         }
1311     break;
1312 
1313   case 12:
1314 
1315     {
1316                         /* Interlace */
1317                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1318                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1319                         xdmf2::XdmfArray *NewArray = new xdmf2::XdmfArray();
1320                         XdmfInt32 i, Rank1, Rank2;
1321                         XdmfInt64 NewLength, Length1, Length2, IFactor, Lcd;
1322                         XdmfInt64 Dimension1[ XDMF_MAX_DIMENSION ];
1323                         XdmfInt64 Dimension2[ XDMF_MAX_DIMENSION ];
1324                         XdmfInt64 Start[ XDMF_MAX_DIMENSION ];
1325                         XdmfInt64 Stride[ XDMF_MAX_DIMENSION ];
1326                         XdmfInt64 Count[ XDMF_MAX_DIMENSION ];
1327                         XdmfInt64 NewDimension[ XDMF_MAX_DIMENSION ];
1328 
1329                         /* printf("Array 0x%X , 0x%X\n", Array1, Array2); */
1330 
1331                         Rank1 = Array1->GetShape( Dimension1 );
1332                         Rank2 = Array2->GetShape( Dimension2 );
1333                         if( Rank1 != Rank2 ){
1334                                 printf(" Interlace : Rank Mismatch !!\n");
1335                                 }
1336                         NewArray->CopyType( Array1 );
1337 
1338                         Length1 = Array1->GetNumberOfElements();
1339                         Length2 = Array2->GetNumberOfElements();
1340                         NewLength = Length1 + Length2;
1341                         IFactor = Length1 / Length2;
1342                         Lcd = Length1;
1343                         if( Length2 < Length1 ){
1344                                 Lcd = Length2;
1345                                 }
1346                         NewDimension[0] = Lcd;
1347                         NewDimension[1] = NewLength / Lcd;
1348                         NewArray->SetShape( 2, NewDimension );
1349                         /*
1350                         printf("Rank1 = %d Rank2 = %d\n", Rank1, Rank2 );
1351                         printf("Array1 Size = %d\n", Array1->GetNumberOfElements() );
1352                         printf("Array2 Size = %d\n", Array2->GetNumberOfElements() );
1353                         printf("NewLength = %d\n", NewLength );
1354                         printf("Lcd = %d\n", Lcd );
1355                         printf("IFactor = %d\n", IFactor );
1356                         printf("New Dims = %s\n", NewArray->GetShapeAsString() );
1357                         */
1358                         /* NewArray->Generate( -55.0,  -55.0 ); */
1359                         /* Copy in Array 1 */
1360                         Start[0] = 0; Start[1] = 0;
1361                         Stride[0] = 1; Stride[1] = 1;
1362                         Count[0] = Lcd; Count[1] = Length1 / Lcd;
1363                         NewArray->SelectHyperSlab( Start, Stride, Count );
1364                         Array1->SelectAll();
1365                         /*
1366                         printf("Copy in Array1 = %s\n", NewArray->GetHyperSlabAsString() );
1367                         */
1368                         CopyArray( Array1, NewArray );
1369                         /* Copy in Array 2 */
1370                         Start[0] = 0; Start[1] = Length1 / Lcd;
1371                         Stride[0] = 1; Stride[1] = 1;
1372                         Count[0] = Lcd; Count[1] = Length2 / Lcd;
1373                         NewArray->SelectHyperSlab( Start, Stride, Count );
1374                         Array2->SelectAll();
1375                         /*
1376                         printf("Copy in Array2 = %s\n", NewArray->GetHyperSlabAsString() );
1377                         */
1378                         CopyArray( Array2, NewArray );
1379                         NewDimension[0] = Dimension1[0] + Dimension2[0];
1380                         for( i = 1 ; i < Rank1 ; i++ ){
1381                                 NewDimension[i] = Dimension1[i];
1382                                 }
1383                         NewArray->Reform( Rank1, NewDimension );
1384                         /*
1385                         printf("Result(%s) = %s\n", NewArray->GetShapeAsString(), NewArray->GetValues() );
1386                         */
1387                         yyval.ArrayPointer = NewArray;
1388                         delete Array1;
1389                         delete Array2;
1390                         }
1391     break;
1392 
1393   case 13:
1394 
1395     {
1396                         /* Interlace */
1397                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1398                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1399                         xdmf2::XdmfArray *NewArray = new xdmf2::XdmfArray();
1400                         XdmfInt32 i, Rank1, Rank2;
1401                         XdmfInt64 Dimension1[ XDMF_MAX_DIMENSION ];
1402                         XdmfInt64 Dimension2[ XDMF_MAX_DIMENSION ];
1403                         XdmfInt64 Start[ XDMF_MAX_DIMENSION ];
1404                         XdmfInt64 Stride[ XDMF_MAX_DIMENSION ];
1405                         XdmfInt64 Count[ XDMF_MAX_DIMENSION ];
1406                         XdmfInt64 NewDimension[ XDMF_MAX_DIMENSION ];
1407 
1408                          /* printf("Array 0x%X  << 0x%X\n", Array1, Array2); */
1409 
1410                         Rank1 = Array1->GetShape( Dimension1 );
1411                         Rank2 = Array2->GetShape( Dimension2 );
1412                         if( Rank1 != Rank2 ){
1413                                 printf(" Cat : Rank Mismatch !!\n");
1414                                 }
1415                         NewDimension[0] = Dimension1[0] + Dimension2[0];
1416                         for( i = 1 ; i < Rank1 ; i++ ){
1417                                 NewDimension[i] = Dimension1[i];
1418                                 }
1419                         NewArray->CopyType( Array1 );
1420                         NewArray->SetShape( Rank1, NewDimension );
1421 
1422                         /*
1423                         NewArray->Generate( -55.0,  -55.0 );
1424                         */
1425                         /* Copy in Array 1 */
1426                         for( i = 0 ; i < Rank1 ; i++ ){
1427                                 Start[i] = 0;
1428                                 Stride[i] = 1;
1429                                 Count[i] = Dimension1[i];
1430                                 }
1431                         NewArray->SelectHyperSlab( Start, Stride, Count );
1432                         Array1->SelectAll();
1433                         /*
1434                         printf("Copy in Array1 = %s\n", NewArray->GetHyperSlabAsString() );
1435                         */
1436                         CopyArray( Array1, NewArray );
1437                         /* Copy in Array 2 */
1438                         Start[0] = Dimension1[0];
1439                         Stride[0] = 1;
1440                         Count[0] = Dimension2[0];
1441                         for( i = 1 ; i < Rank1 ; i++ ){
1442                                 Start[i] = 0;
1443                                 Stride[i] = 1;
1444                                 Count[i] = Dimension1[i];
1445                                 }
1446                         NewArray->SelectHyperSlab( Start, Stride, Count );
1447                         Array2->SelectAll();
1448                         /*
1449                         printf("Copy in Array2 = %s\n", NewArray->GetHyperSlabAsString() );
1450                         */
1451                         CopyArray( Array2, NewArray );
1452                         /*
1453                         printf("Result(%s) = %s\n", NewArray->GetShapeAsString(), NewArray->GetValues() );
1454                         */
1455                         yyval.ArrayPointer = NewArray;
1456                         delete Array1;
1457                         delete Array2;
1458                         }
1459     break;
1460 
1461   case 14:
1462 
1463     {
1464                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1465                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1466 
1467                         /* printf("Array 0x%X + 0x%X\n", Array1, Array2); */
1468                         *Array1 -= *Array2;
1469                         yyval.ArrayPointer = Array1;
1470                         delete Array2;
1471                         }
1472     break;
1473 
1474   case 15:
1475 
1476     {
1477                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1478                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1479 
1480                         /* printf("Array 0x%X * 0x%X\n", Array1, Array2); */
1481                         *Array1 *= *Array2;
1482                         yyval.ArrayPointer = Array1;
1483                         delete Array2;
1484                         /* printf("Array1 Nelms = %d\n", Array1->GetNumberOfElements()); */
1485                         }
1486     break;
1487 
1488   case 16:
1489 
1490     {
1491                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1492                         xdmf2::XdmfArray *Array2 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1493 
1494                         /* printf("Array 0x%X + 0x%X\n", Array1, Array2); */
1495                         *Array1 /= *Array2;
1496                         yyval.ArrayPointer = Array1;
1497                         delete Array2;
1498                         }
1499     break;
1500 
1501   case 17:
1502 
1503     {
1504                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1505                         xdmf2::XdmfArray *Result;
1506 
1507                         /* printf("Array + %g\n", $3); */
1508                         Result  = Array1;
1509                         *Result += yyvsp[0].DoubleValue;
1510                         yyval.ArrayPointer = Result;
1511                         }
1512     break;
1513 
1514   case 18:
1515 
1516     {
1517                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1518                         xdmf2::XdmfArray *Result;
1519 
1520                         /* printf("Array - %g\n", $3); */
1521                         Result  = Array1;
1522                         *Result -= yyvsp[0].DoubleValue;
1523                         yyval.ArrayPointer = Result;
1524                         }
1525     break;
1526 
1527   case 19:
1528 
1529     {
1530                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1531                         xdmf2::XdmfArray *Result;
1532 
1533                         /* printf("Array * %g\n", $3); */
1534                         Result  = Array1;
1535                         *Result *= yyvsp[0].DoubleValue;
1536                         yyval.ArrayPointer = Result;
1537                         }
1538     break;
1539 
1540   case 20:
1541 
1542     {
1543                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-2].ArrayPointer;
1544                         xdmf2::XdmfArray *Result;
1545 
1546                         /* printf("Array / %g\n", $3); */
1547                         Result  = Array1;
1548                         *Result /= yyvsp[0].DoubleValue;
1549                         yyval.ArrayPointer = Result;
1550                         }
1551     break;
1552 
1553   case 21:
1554 
1555     {
1556                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1557                         xdmf2::XdmfArray *Result;
1558 
1559                         /* printf("Array + %g\n", $1); */
1560                         Result  = Array1;
1561                         *Result += yyvsp[-2].DoubleValue;
1562                         yyval.ArrayPointer = Result;
1563                         }
1564     break;
1565 
1566   case 22:
1567 
1568     {
1569                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1570                         xdmf2::XdmfArray *Result;
1571 
1572                         /* printf("Array - %g\n", $1); */
1573                         Result  = Array1;
1574                         *Result -= yyvsp[-2].DoubleValue;
1575                         yyval.ArrayPointer = Result;
1576                         }
1577     break;
1578 
1579   case 23:
1580 
1581     {
1582                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1583                         xdmf2::XdmfArray *Result;
1584 
1585                         /* printf("Array * %g\n", $1); */
1586                         Result  = Array1;
1587                         *Result *= yyvsp[-2].DoubleValue;
1588                         yyval.ArrayPointer = Result;
1589                         }
1590     break;
1591 
1592   case 24:
1593 
1594     {
1595                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1596                         xdmf2::XdmfArray *Result;
1597 
1598                         /* printf("Array / %g\n", $1); */
1599                         Result  = Array1;
1600                         *Result /= yyvsp[-2].DoubleValue;
1601                         yyval.ArrayPointer = Result;
1602                         }
1603     break;
1604 
1605   case 25:
1606 
1607     {
1608                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1609                         xdmf2::XdmfArray        *Array2 = ( xdmf2::XdmfArray *)yyvsp[-1].ArrayPointer;
1610                         xdmf2::XdmfArray        *Result;
1611 
1612                         /* printf("ArrayExpression From Indexes\n"); */
1613                         Result = Array1->Clone( Array2 );
1614                         delete Array2;
1615                         yyval.ArrayPointer = Result;
1616                 }
1617     break;
1618 
1619   case 26:
1620 
1621     {
1622                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-5].ArrayPointer;
1623                         xdmf2::XdmfArray *Range, *Result;
1624 
1625                         /* printf("ArrayExpression From Array Range %d:%d\n", $3, $5);         */
1626                         Range = Array1->Reference( yyvsp[-3].IntegerValue, yyvsp[-1].IntegerValue ); /* This not a copy  */
1627 
1628                         Result  = Range->Clone(); /* So Copy It */
1629                         delete Array1;
1630                         yyval.ArrayPointer = Result;
1631                         }
1632     break;
1633 
1634   case 27:
1635 
1636     {
1637                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1638                         xdmf2::XdmfArray        *Array2 = ( xdmf2::XdmfArray *)yyvsp[-1].ArrayPointer;
1639                         XdmfLength        i, howmany = 0, cntr = 0;
1640                         XdmfLength        Length1 = Array1->GetNumberOfElements(), Length2;
1641                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length1 );
1642                         XdmfInt64        A1Value, A2Value;
1643                         XdmfInt64        *A1Values, *A2Values;
1644                         float                Percent;
1645 
1646                         if(Array1->GetNumberType() != XDMF_INT64_TYPE){
1647                                 yyerror("INDEX operator only uses XdmfInt64 Arrays");
1648                                 return( 0 );
1649                                 }
1650                         if(Array2->GetNumberType() != XDMF_INT64_TYPE){
1651                                 yyerror("INDEX operator only uses XdmfInt64 Arrays");
1652                                 return( 0 );
1653                                 }
1654                         Length2 = Array2->GetNumberOfElements();
1655                         A1Values = (XdmfInt64 *)Array1->GetDataPointer();
1656                         A2Values = (XdmfInt64 *)Array2->GetDataPointer();
1657                         for( i = 0 ; i < Length1 ; i++ ){
1658                                 /* A1Value = Array1->GetValueAsFloat64( i ); */
1659                                 A1Value = *A1Values++;
1660                                 cntr = 0;
1661                                 A2Value = A1Value + 1;
1662                                 while((cntr < Length2) && (A2Value != A1Value)) {
1663                                         /* A2Value = Array2->GetValueAsFloat64(cntr); */
1664                                         A2Value = A2Values[cntr];
1665                                         cntr++;
1666                                         }
1667                                 howmany++;
1668                                 if(howmany > 5000){
1669                                         Percent = 100.0 * i / Length1;
1670                                         printf("%5.2f %% Done\n", Percent);
1671                                         howmany = 0;
1672                                         }
1673                                 if( A1Value == A2Value ) {
1674                                         Index->SetValue( i, cntr - 1 );
1675                                 }else{
1676                                         Index->SetValue( i, -1);
1677                                         }
1678                                 }
1679                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1680                         }
1681     break;
1682 
1683   case 28:
1684 
1685     {
1686                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1687                         /* XdmfLength        howmany = 0; */
1688                         XdmfLength        i, cntr = 0;
1689                         XdmfLength        Length1 = Array1->GetNumberOfElements(), Length2;
1690                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length1 );
1691                         xdmf2::XdmfArray        *Array2 = ( xdmf2::XdmfArray *)yyvsp[-1].ArrayPointer;
1692                         XdmfFloat64        A1Value, A2Value;
1693 
1694                         Length2 = Array2->GetNumberOfElements();
1695                         for( i = 0 ; i < Length1 ; i++ ){
1696                                 A1Value = Array1->GetValueAsFloat64( i );
1697                                 cntr = 0;
1698                                 A2Value = A1Value + 1;
1699                                 while((cntr < Length2) && (A2Value != A1Value)) {
1700                                         A2Value = Array2->GetValueAsFloat64(cntr);
1701                                         cntr++;
1702                                         }
1703 /*
1704                                 howmany++;
1705                                 if(howmany > 1000){
1706                                         cout << "Checked " << i << " of " << Length1 << endl;
1707                                         howmany = 0;
1708                                         }
1709 */
1710                                 if( A1Value == A2Value ) {
1711                                         Index->SetValue( i, cntr - 1 );
1712                                 }else{
1713                                         Index->SetValue( i, -1);
1714                                         }
1715                                 }
1716                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1717                         }
1718     break;
1719 
1720   case 29:
1721 
1722     {
1723                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1724                         XdmfLength        i, cntr = 0;
1725                         XdmfLength        Length = Array1->GetNumberOfElements();
1726                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1727                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1728 
1729                         for( i = 0 ; i < Length ; i++ ){
1730                                 Value = Array1->GetValueAsFloat64( i );
1731                                 if( Value == SValue ) {
1732                                         Index->SetValue( cntr++, i );
1733                                         }
1734                                 }
1735                         /* printf("Found %d Wheres\n", cntr ); */
1736                         if( cntr == 0 ){
1737                                 yyerror("WHERE Function Length == 0");
1738                                 return( 0 );
1739                                 }
1740                         Index->SetNumberOfElements( cntr );
1741                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1742                         }
1743     break;
1744 
1745   case 30:
1746 
1747     {
1748                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1749                         XdmfLength        i, cntr = 0;
1750                         XdmfLength        Length = Array1->GetNumberOfElements();
1751                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1752                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1753 
1754                         for( i = 0 ; i < Length ; i++ ){
1755                                 Value = Array1->GetValueAsFloat64( i );
1756                                 if( Value < SValue ) {
1757                                         Index->SetValue( cntr++, i );
1758                                         }
1759                                 }
1760                         /* printf("Found %d Wheres\n", cntr ); */
1761                         if( cntr == 0 ){
1762                                 yyerror("WHERE Function Length == 0");
1763                                 return( 0 );
1764                                 }
1765                         Index->SetNumberOfElements( cntr );
1766                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1767                         }
1768     break;
1769 
1770   case 31:
1771 
1772     {
1773                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1774                         XdmfLength        i, cntr = 0;
1775                         XdmfLength        Length = Array1->GetNumberOfElements();
1776                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1777                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1778 
1779                         for( i = 0 ; i < Length ; i++ ){
1780                                 Value = Array1->GetValueAsFloat64( i );
1781                                 if( Value <= SValue ) {
1782                                         Index->SetValue( cntr++, i );
1783                                         }
1784                                 }
1785                         /* printf("Found %d Wheres\n", cntr ); */
1786                         if( cntr == 0 ){
1787                                 yyerror("WHERE Function Length == 0");
1788                                 return( 0 );
1789                                 }
1790                         Index->SetNumberOfElements( cntr );
1791                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1792                         }
1793     break;
1794 
1795   case 32:
1796 
1797     {
1798                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1799                         XdmfLength        i, cntr = 0;
1800                         XdmfLength        Length = Array1->GetNumberOfElements();
1801                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1802                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1803 
1804                         for( i = 0 ; i < Length ; i++ ){
1805                                 Value = Array1->GetValueAsFloat64( i );
1806                                 if( Value > SValue ) {
1807                                         Index->SetValue( cntr++, i );
1808                                         }
1809                                 }
1810                         /* printf("Found %d Wheres\n", cntr ); */
1811                         if( cntr == 0 ){
1812                                 yyerror("WHERE Function Length == 0");
1813                                 return( 0 );
1814                                 }
1815                         Index->SetNumberOfElements( cntr );
1816                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1817                         }
1818     break;
1819 
1820   case 33:
1821 
1822     {
1823                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1824                         XdmfLength        i, cntr = 0;
1825                         XdmfLength        Length = Array1->GetNumberOfElements();
1826                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1827                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1828 
1829                         for( i = 0 ; i < Length ; i++ ){
1830                                 Value = Array1->GetValueAsFloat64( i );
1831                                 if( Value >= SValue ) {
1832                                         Index->SetValue( cntr++, i );
1833                                         }
1834                                 }
1835                         /* printf("Found %d Wheres\n", cntr ); */
1836                         if( cntr == 0 ){
1837                                 yyerror("WHERE Function Length == 0");
1838                                 return( 0 );
1839                                 }
1840                         Index->SetNumberOfElements( cntr );
1841                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1842                         }
1843     break;
1844 
1845   case 34:
1846 
1847     {
1848                         xdmf2::XdmfArray        *Array1 = ( xdmf2::XdmfArray *)yyvsp[-3].ArrayPointer;
1849                         XdmfLength        i, cntr = 0;
1850                         XdmfLength        Length = Array1->GetNumberOfElements();
1851                         xdmf2::XdmfInt64Array        *Index = new xdmf2::XdmfInt64Array( Length );
1852                         XdmfFloat64        Value, SValue = yyvsp[-1].DoubleValue;
1853 
1854                         for( i = 0 ; i < Length ; i++ ){
1855                                 Value = Array1->GetValueAsFloat64( i );
1856                                 if( Value != SValue ) {
1857                                         Index->SetValue( cntr++, i );
1858                                         }
1859                                 }
1860                         /* printf("Found %d Wheres\n", cntr ); */
1861                         if( cntr == 0 ){
1862                                 yyerror("WHERE Function Length == 0");
1863                                 return( 0 );
1864                                 }
1865                         Index->SetNumberOfElements( cntr );
1866                         yyval.ArrayPointer = ( xdmf2::XdmfArray *)Index;
1867                         }
1868     break;
1869 
1870   case 35:
1871 
1872     {
1873 
1874                         if( yyvsp[-3].Symbol->DoubleFunctionPtr == NULL ){
1875                                 /* printf("Bad Function Ptr for %s\n", $1->Name ); */
1876                                 yyval.ArrayPointer = yyvsp[-1].ArrayPointer;
1877                         } else {
1878                                 xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[-1].ArrayPointer;
1879                                 XdmfFloat64        Value;
1880                                 XdmfLength        i, Length = Array1->GetNumberOfElements();
1881 
1882                                 /* printf("Function Call %s\n", $1->Name ); */
1883                                 for( i = 0 ; i < Length ; i++ ){
1884                                         Value = Array1->GetValueAsFloat64( i );
1885                                         Array1->SetValueFromFloat64( i, (yyvsp[-3].Symbol->DoubleFunctionPtr)( Value ) );
1886                                         }
1887                                 yyval.ArrayPointer = Array1;
1888                         }
1889                         }
1890     break;
1891 
1892   case 36:
1893 
1894     {
1895                         /* printf("( ArrayExpression )\n"); */
1896                         yyval.ArrayPointer = yyvsp[-1].ArrayPointer;
1897                         }
1898     break;
1899 
1900   case 37:
1901 
1902     {
1903                         /* printf("( ArrayExpression )\n"); */
1904                         yyval.ArrayPointer = yyvsp[-1].ArrayPointer;
1905                         }
1906     break;
1907 
1908   case 38:
1909 
1910     {
1911                         xdmf2::XdmfArray *Array1 = ( xdmf2::XdmfArray *)yyvsp[0].ArrayPointer;
1912                         xdmf2::XdmfArray *Result;
1913 
1914                         /* printf("ArrayExpression From Array\n"); */
1915 
1916                         if ( Array1 == NULL ){
1917                                 /* Bomb */
1918                                 yyerror("NULL Array Pointer");
1919                                 return( 0 );
1920                         } else {
1921                                 Result  = Array1->Clone();
1922                                 yyval.ArrayPointer = Result;
1923                                 }
1924                         }
1925     break;
1926 
1927   case 39:
1928 
1929     {
1930                         /* printf("Scalar +\n"); */
1931                         yyval.DoubleValue = yyvsp[-2].DoubleValue + yyvsp[0].DoubleValue;
1932                         }
1933     break;
1934 
1935   case 40:
1936 
1937     {
1938                         /* printf("Scalar -\n"); */
1939                         yyval.DoubleValue = yyvsp[-2].DoubleValue - yyvsp[0].DoubleValue;
1940                         }
1941     break;
1942 
1943   case 41:
1944 
1945     {
1946                         /* printf("Scalar *\n"); */
1947                         yyval.DoubleValue = yyvsp[-2].DoubleValue * yyvsp[0].DoubleValue;
1948                         }
1949     break;
1950 
1951   case 42:
1952 
1953     {
1954                         /* printf("Scalar /\n"); */
1955                         yyval.DoubleValue = yyvsp[-2].DoubleValue / yyvsp[0].DoubleValue;
1956                         }
1957     break;
1958 
1959   case 43:
1960 
1961     {
1962                         if( yyvsp[-3].Symbol->DoubleFunctionPtr == NULL ){
1963                                 /* printf("Bad Function Ptr for %s\n", $1->Name ); */
1964                                 yyval.DoubleValue = 0.0;
1965                         } else {
1966                                 yyval.DoubleValue = (yyvsp[-3].Symbol->DoubleFunctionPtr)( yyvsp[-1].DoubleValue );
1967                         }
1968                         }
1969     break;
1970 
1971   case 44:
1972 
1973     {
1974                         /* printf ("( ScalarExpression )\n"); */
1975                         yyval.DoubleValue = yyvsp[-1].DoubleValue;
1976                         }
1977     break;
1978 
1979   case 45:
1980 
1981     {
1982                         /* printf ("ScalarExpression from tokINTEGER\n"); */
1983                         yyval.DoubleValue = yyvsp[0].IntegerValue;
1984                         }
1985     break;
1986 
1987   case 46:
1988 
1989     {
1990                         /* printf ("ScalarExpression from FLOAT\n"); */
1991                         yyval.DoubleValue = yyvsp[0].DoubleValue;
1992                         }
1993     break;
1994 
1995 
1996     }
1997 
1998 /* Line 999 of yacc.c.  */
1999 
2000 
2001   yyvsp -= yylen;
2002   yyssp -= yylen;
2003 
2004 
2005   YY_STACK_PRINT (yyss, yyssp);
2006 
2007   *++yyvsp = yyval;
2008 
2009 
2010   /* Now `shift' the result of the reduction.  Determine what state
2011      that goes to, based on the state we popped back to and the rule
2012      number reduced by.  */
2013 
2014   yyn = yyr1[yyn];
2015 
2016   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2017   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2018     yystate = yytable[yystate];
2019   else
2020     yystate = yydefgoto[yyn - YYNTOKENS];
2021 
2022   goto yynewstate;
2023 
2024 
2025 /*------------------------------------.
2026 | yyerrlab -- here on detecting error |
2027 `------------------------------------*/
2028 yyerrlab:
2029   /* If not already recovering from an error, report this error.  */
2030   if (!yyerrstatus)
2031     {
2032       ++yynerrs;
2033 #if YYERROR_VERBOSE
2034       yyn = yypact[yystate];
2035 
2036       if (YYPACT_NINF < yyn && yyn < YYLAST)
2037         {
2038           YYSIZE_T yysize = 0;
2039           int yytype = YYTRANSLATE (yychar);
2040           char *yymsg;
2041           int yyx, yycount;
2042 
2043           yycount = 0;
2044           /* Start YYX at -YYN if negative to avoid negative indexes in
2045              YYCHECK.  */
2046           for (yyx = yyn < 0 ? -yyn : 0;
2047                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2048             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2049               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2050           yysize += yystrlen ("syntax error, unexpected ") + 1;
2051           yysize += yystrlen (yytname[yytype]);
2052           yymsg = (char *) YYSTACK_ALLOC (yysize);
2053           if (yymsg != 0)
2054             {
2055               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2056               yyp = yystpcpy (yyp, yytname[yytype]);
2057 
2058               if (yycount < 5)
2059                 {
2060                   yycount = 0;
2061                   for (yyx = yyn < 0 ? -yyn : 0;
2062                        yyx < (int) (sizeof (yytname) / sizeof (char *));
2063                        yyx++)
2064                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2065                       {
2066                         const char *yyq = ! yycount ? ", expecting " : " or ";
2067                         yyp = yystpcpy (yyp, yyq);
2068                         yyp = yystpcpy (yyp, yytname[yyx]);
2069                         yycount++;
2070                       }
2071                 }
2072               yyerror (yymsg);
2073               YYSTACK_FREE (yymsg);
2074             }
2075           else
2076             yyerror ("syntax error; also virtual memory exhausted");
2077         }
2078       else
2079 #endif /* YYERROR_VERBOSE */
2080         yyerror ("syntax error");
2081     }
2082 
2083 
2084 
2085   if (yyerrstatus == 3)
2086     {
2087       /* If just tried and failed to reuse lookahead token after an
2088          error, discard it.  */
2089 
2090       /* Return failure if at end of input.  */
2091       if (yychar == YYEOF)
2092         {
2093           /* Pop the error token.  */
2094           YYPOPSTACK;
2095           /* Pop the rest of the stack.  */
2096           while (yyss < yyssp)
2097             {
2098               YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2099               yydestruct (yystos[*yyssp], yyvsp);
2100               YYPOPSTACK;
2101             }
2102           YYABORT;
2103         }
2104 
2105       YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2106       yydestruct (yytoken, &yylval);
2107       yychar = YYEMPTY;
2108 
2109     }
2110 
2111   /* Else will try to reuse lookahead token after shifting the error
2112      token.  */
2113   goto yyerrlab1;
2114 
2115 
2116 /*----------------------------------------------------.
2117 | yyerrlab1 -- error raised explicitly by an action.  |
2118 `----------------------------------------------------*/
2119 yyerrlab1:
2120   yyerrstatus = 3;        /* Each real token shifted decrements this.  */
2121 
2122   for (;;)
2123     {
2124       yyn = yypact[yystate];
2125       if (yyn != YYPACT_NINF)
2126         {
2127           yyn += YYTERROR;
2128           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2129             {
2130               yyn = yytable[yyn];
2131               if (0 < yyn)
2132                 break;
2133             }
2134         }
2135 
2136       /* Pop the current state because it cannot handle the error token.  */
2137       if (yyssp == yyss)
2138         YYABORT;
2139 
2140       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2141       yydestruct (yystos[yystate], yyvsp);
2142       yyvsp--;
2143       yystate = *--yyssp;
2144 
2145       YY_STACK_PRINT (yyss, yyssp);
2146     }
2147 
2148   if (yyn == YYFINAL)
2149     YYACCEPT;
2150 
2151   YYDPRINTF ((stderr, "Shifting error token, "));
2152 
2153   *++yyvsp = yylval;
2154 
2155 
2156   yystate = yyn;
2157   goto yynewstate;
2158 
2159 
2160 /*-------------------------------------.
2161 | yyacceptlab -- YYACCEPT comes here.  |
2162 `-------------------------------------*/
2163 yyacceptlab:
2164   yyresult = 0;
2165   goto yyreturn;
2166 
2167 /*-----------------------------------.
2168 | yyabortlab -- YYABORT comes here.  |
2169 `-----------------------------------*/
2170 yyabortlab:
2171   yyresult = 1;
2172   goto yyreturn;
2173 
2174 #ifndef yyoverflow
2175 /*----------------------------------------------.
2176 | yyoverflowlab -- parser overflow comes here.  |
2177 `----------------------------------------------*/
2178 yyoverflowlab:
2179   yyerror ("parser stack overflow");
2180   yyresult = 2;
2181   /* Fall through.  */
2182 #endif
2183 
2184 yyreturn:
2185 #ifndef yyoverflow
2186   if (yyss != yyssa)
2187     YYSTACK_FREE (yyss);
2188 #endif
2189   return yyresult;
2190 }
2191 
2192 
2193 
2194 
2195 
2196 /* extern        FILE        *yyin, *yyout; */
2197 
2198 #ifdef __cplusplus
2199 /**/
2200 extern "C" {
2201 /**/
2202 #endif
2203 
2204 char        InputBuffer[ 512 ];
2205 int         InputBufferPtr = 0, InputBufferEnd = 0;
2206 char        OutputBuffer[ 512 ];
2207 int         OutputBufferPtr = 0;
2208 /* static int OutputBufferEnd = 511; */
2209 
2210 int
dice_yywrap(void)2211 dice_yywrap( void ) {
2212 
2213 return 1;
2214 }
2215 
2216 void
dice_yyerror(const char * string)2217 dice_yyerror( const char *string ) {
2218 fprintf(stderr, "XdmfExpr : %s \n", string);
2219 }
2220 
2221 int
XdmfExprFlexInput(char * buf,int maxlen)2222 XdmfExprFlexInput( char *buf, int maxlen ) {
2223 (void)maxlen;
2224 if ( InputBufferPtr < InputBufferEnd ){
2225         buf[0] = InputBuffer[ InputBufferPtr++ ];
2226         return(1);
2227 } else {
2228         buf[0] = '\n';
2229         return( 0 );
2230         }
2231 }
2232 
2233 int
XdmfExprInput(void)2234 XdmfExprInput( void ){
2235 
2236 if ( InputBufferPtr < InputBufferEnd ){
2237         return( InputBuffer[ InputBufferPtr++ ] );
2238 } else {
2239         return '\n';
2240         }
2241 }
2242 
2243 void
XdmfExprUnput(int c)2244 XdmfExprUnput( int c ) {
2245 if( InputBufferPtr > 0 ){
2246         InputBufferPtr--;
2247         InputBuffer[ InputBufferPtr ] = c;
2248         }
2249 }
2250 
2251 void
XdmfExprOutput(int c)2252 XdmfExprOutput( int c ) {
2253         /* printf("XdmfExprOutput Called\n"); */
2254         OutputBuffer[ OutputBufferPtr++ ] = c;
2255         OutputBuffer[ OutputBufferPtr ] = '\0';
2256         }
2257 
2258 XdmfExprSymbol
XdmfExprSymbolLookup(const char * Name)2259 *XdmfExprSymbolLookup( const char *Name ){
2260 
2261 XdmfExprSymbol        *Last = NULL, *Item = XdmfExprItemsTable;
2262 
2263 if( Name == NULL ) {
2264         /* Table Check  */
2265         return( XdmfExprItemsTable );
2266         }
2267 
2268 while( Item != NULL ) {
2269         if( strcmp( Item->Name, Name ) == 0 ) {
2270                 /* printf("Found Symbol %s\n", Name ); */
2271                 return( Item );
2272                 }
2273         Last = Item;
2274         Item = Item->Next;
2275 }
2276 /* Not Found : Create New One */
2277 Item = ( XdmfExprSymbol *)calloc( 1, sizeof( XdmfExprSymbol ));
2278 Item->Next = NULL;
2279 Item->Name = strdup( Name );
2280 Item->ClientData = NULL;
2281 Item->DoubleValue = 0;
2282 Item->DoubleFunctionPtr = NULL;
2283 if( XdmfExprItemsTable == NULL ) {
2284         XdmfExprItemsTable = Item;
2285         }
2286 if( Last != NULL ){
2287         Last->Next = Item;
2288         }
2289 /* printf("New Symbol for %s\n", Name ); */
2290 return( Item );
2291 }
2292 
2293 #ifdef __cplusplus
2294 /**/
2295 }
2296 /**/
2297 #endif
2298 
2299 xdmf2::XdmfArray *
XdmfExprParse(char * string)2300 XdmfExprParse( char *string ){
2301 
2302 XdmfExprSymbol        *Item;
2303 XdmfLength        CurrentTime;
2304 XdmfLength        TimeOfCreation;
2305 xdmf2::XdmfArray        *ap;
2306 
2307 /* Build the Symbol Table if Necessary */
2308 Item = XdmfExprSymbolLookup( NULL );
2309 if( Item == NULL ){
2310         /* printf("Creating Symbol Table\n"); */
2311         Item = XdmfExprSymbolLookup( "cos" );
2312         Item->DoubleFunctionPtr = cos;
2313         Item = XdmfExprSymbolLookup( "sin" );
2314         Item->DoubleFunctionPtr = sin;
2315         Item = XdmfExprSymbolLookup( "exp" );
2316         Item->DoubleFunctionPtr = exp;
2317         Item = XdmfExprSymbolLookup( "tan" );
2318         Item->DoubleFunctionPtr = tan;
2319         Item = XdmfExprSymbolLookup( "acos" );
2320         Item->DoubleFunctionPtr = acos;
2321         Item = XdmfExprSymbolLookup( "asin" );
2322         Item->DoubleFunctionPtr = asin;
2323         Item = XdmfExprSymbolLookup( "atan" );
2324         Item->DoubleFunctionPtr = atan;
2325         Item = XdmfExprSymbolLookup( "log" );
2326         Item->DoubleFunctionPtr = log;
2327         Item = XdmfExprSymbolLookup( "sqrt" );
2328         Item->DoubleFunctionPtr = sqrt;
2329         }
2330 /* Print Symbol Table */
2331 Item = XdmfExprSymbolLookup( NULL );
2332 while( Item != NULL ) {
2333         if( Item->ClientData != NULL ){
2334                 /* printf("Found Symbol %s\n", Item->Name ); */
2335                 }
2336         Item = Item->Next;
2337         }
2338 strcpy( InputBuffer, string );
2339 InputBufferEnd = strlen( InputBuffer );
2340 InputBufferPtr = OutputBufferPtr = 0;
2341 XdmfExprReturnValue = NULL;
2342 /* printf("XdmfExprParse Scanning <%s>\n", InputBuffer); */
2343  CurrentTime = xdmf2::GetCurrentArrayTime();
2344 if ( yyparse() != 0 ){
2345         /* Error */
2346         XdmfExprReturnValue = NULL;
2347         }
2348 Item = XdmfExprSymbolLookup( NULL );
2349 while( Item != NULL ) {
2350   XdmfExprSymbol *next = Item->Next;
2351   if ( Item->Name )
2352     {
2353     free(Item->Name);
2354     }
2355   free(Item);
2356         Item = next;
2357         }
2358 
2359 XdmfExprItemsTable = NULL;
2360 
2361 /* Remove All Arrays Older than when we started */
2362 /* printf("Cleaning up Temparary Arrays\n"); */
2363  while( ( ap = xdmf2::GetNextOlderArray( CurrentTime, &TimeOfCreation ) ) != NULL ){
2364         /* Don't remove the return value */
2365         if( ap != XdmfExprReturnValue ){
2366                 /* printf("Removing Temporary Array\n"); */
2367                 delete ap;
2368                 }
2369         CurrentTime = TimeOfCreation;
2370         }
2371 return( XdmfExprReturnValue );
2372 }
2373 
2374 
2375