/home/coin/SVN-release/OS-2.0.1/OS/src/OSParsers/OSParseosil.tab.cpp

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.3.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with yy or YY, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define YYBISON 1
00048 
00049 /* Bison version.  */
00050 #define YYBISON_VERSION "2.3"
00051 
00052 /* Skeleton name.  */
00053 #define YYSKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define YYPURE 1
00057 
00058 /* Using locations.  */
00059 #define YYLSP_NEEDED 1
00060 
00061 /* Substitute the variable and function names.  */
00062 #define yyparse osilparse
00063 #define yylex   osillex
00064 #define yyerror osilerror
00065 #define yylval  osillval
00066 #define yychar  osilchar
00067 #define yydebug osildebug
00068 #define yynerrs osilnerrs
00069 #define yylloc osillloc
00070 
00071 /* Tokens.  */
00072 #ifndef YYTOKENTYPE
00073 # define YYTOKENTYPE
00074    /* Put the tokens into the symbol table, so that GDB and other debuggers
00075       know about them.  */
00076    enum yytokentype {
00077      QUOTE = 258,
00078      ATTRIBUTETEXT = 259,
00079      INTEGER = 260,
00080      DOUBLE = 261,
00081      OSILEND = 262,
00082      INSTANCEDATAEND = 263,
00083      VALUEATT = 264,
00084      NUMBEROFNONLINEAREXPRESSIONS = 265,
00085      IDXONEATT = 266,
00086      IDXTWOATT = 267,
00087      COEFATT = 268,
00088      IDATT = 269,
00089      TIMESSTART = 270,
00090      TIMESEND = 271,
00091      NUMBERSTART = 272,
00092      NUMBEREND = 273,
00093      NUMBEROFQTERMSATT = 274,
00094      IDXATT = 275,
00095      TYPEATT = 276,
00096      QTERMSTART = 277,
00097      QTERMEND = 278,
00098      QUADRATICCOEFFICIENTSSTART = 279,
00099      QUADRATICCOEFFICIENTSEND = 280,
00100      NONLINEAREXPRESSIONSSTART = 281,
00101      NONLINEAREXPRESSIONSEND = 282,
00102      NLSTART = 283,
00103      NLEND = 284,
00104      POWERSTART = 285,
00105      POWEREND = 286,
00106      PLUSSTART = 287,
00107      PLUSEND = 288,
00108      MINUSSTART = 289,
00109      MINUSEND = 290,
00110      DIVIDESTART = 291,
00111      DIVIDEEND = 292,
00112      LNSTART = 293,
00113      LNEND = 294,
00114      SQRTSTART = 295,
00115      SQRTEND = 296,
00116      SUMSTART = 297,
00117      SUMEND = 298,
00118      PRODUCTSTART = 299,
00119      PRODUCTEND = 300,
00120      ENDOFELEMENT = 301,
00121      EXPSTART = 302,
00122      EXPEND = 303,
00123      NEGATESTART = 304,
00124      NEGATEEND = 305,
00125      IFSTART = 306,
00126      IFEND = 307,
00127      SQUARESTART = 308,
00128      SQUAREEND = 309,
00129      COSSTART = 310,
00130      COSEND = 311,
00131      SINSTART = 312,
00132      SINEND = 313,
00133      GREATERTHAN = 314,
00134      VARIABLESTART = 315,
00135      VARIABLEEND = 316,
00136      ABSSTART = 317,
00137      ABSEND = 318,
00138      ERFSTART = 319,
00139      ERFEND = 320,
00140      MAXSTART = 321,
00141      MAXEND = 322,
00142      ALLDIFFSTART = 323,
00143      ALLDIFFEND = 324,
00144      MINSTART = 325,
00145      MINEND = 326,
00146      ESTART = 327,
00147      EEND = 328,
00148      PISTART = 329,
00149      PIEND = 330,
00150      TIMEDOMAINSTART = 331,
00151      TIMEDOMAINEND = 332,
00152      STAGESSTART = 333,
00153      STAGESEND = 334,
00154      STAGESTART = 335,
00155      STAGEEND = 336,
00156      NAMEATT = 337,
00157      NUMBEROFSTAGESATT = 338,
00158      HORIZONATT = 339,
00159      STARTATT = 340,
00160      VARIABLESSTART = 341,
00161      CONSTRAINTSSTART = 342,
00162      OBJECTIVESSTART = 343,
00163      VARIABLESEND = 344,
00164      CONSTRAINTSEND = 345,
00165      OBJECTIVESEND = 346,
00166      NUMBEROFVARIABLESATT = 347,
00167      NUMBEROFCONSTRAINTSATT = 348,
00168      NUMBEROFOBJECTIVESATT = 349,
00169      STARTIDXATT = 350,
00170      VARSTART = 351,
00171      VAREND = 352,
00172      CONSTART = 353,
00173      CONEND = 354,
00174      OBJSTART = 355,
00175      OBJEND = 356,
00176      INTERVALSTART = 357,
00177      INTERVALEND = 358
00178    };
00179 #endif
00180 /* Tokens.  */
00181 #define QUOTE 258
00182 #define ATTRIBUTETEXT 259
00183 #define INTEGER 260
00184 #define DOUBLE 261
00185 #define OSILEND 262
00186 #define INSTANCEDATAEND 263
00187 #define VALUEATT 264
00188 #define NUMBEROFNONLINEAREXPRESSIONS 265
00189 #define IDXONEATT 266
00190 #define IDXTWOATT 267
00191 #define COEFATT 268
00192 #define IDATT 269
00193 #define TIMESSTART 270
00194 #define TIMESEND 271
00195 #define NUMBERSTART 272
00196 #define NUMBEREND 273
00197 #define NUMBEROFQTERMSATT 274
00198 #define IDXATT 275
00199 #define TYPEATT 276
00200 #define QTERMSTART 277
00201 #define QTERMEND 278
00202 #define QUADRATICCOEFFICIENTSSTART 279
00203 #define QUADRATICCOEFFICIENTSEND 280
00204 #define NONLINEAREXPRESSIONSSTART 281
00205 #define NONLINEAREXPRESSIONSEND 282
00206 #define NLSTART 283
00207 #define NLEND 284
00208 #define POWERSTART 285
00209 #define POWEREND 286
00210 #define PLUSSTART 287
00211 #define PLUSEND 288
00212 #define MINUSSTART 289
00213 #define MINUSEND 290
00214 #define DIVIDESTART 291
00215 #define DIVIDEEND 292
00216 #define LNSTART 293
00217 #define LNEND 294
00218 #define SQRTSTART 295
00219 #define SQRTEND 296
00220 #define SUMSTART 297
00221 #define SUMEND 298
00222 #define PRODUCTSTART 299
00223 #define PRODUCTEND 300
00224 #define ENDOFELEMENT 301
00225 #define EXPSTART 302
00226 #define EXPEND 303
00227 #define NEGATESTART 304
00228 #define NEGATEEND 305
00229 #define IFSTART 306
00230 #define IFEND 307
00231 #define SQUARESTART 308
00232 #define SQUAREEND 309
00233 #define COSSTART 310
00234 #define COSEND 311
00235 #define SINSTART 312
00236 #define SINEND 313
00237 #define GREATERTHAN 314
00238 #define VARIABLESTART 315
00239 #define VARIABLEEND 316
00240 #define ABSSTART 317
00241 #define ABSEND 318
00242 #define ERFSTART 319
00243 #define ERFEND 320
00244 #define MAXSTART 321
00245 #define MAXEND 322
00246 #define ALLDIFFSTART 323
00247 #define ALLDIFFEND 324
00248 #define MINSTART 325
00249 #define MINEND 326
00250 #define ESTART 327
00251 #define EEND 328
00252 #define PISTART 329
00253 #define PIEND 330
00254 #define TIMEDOMAINSTART 331
00255 #define TIMEDOMAINEND 332
00256 #define STAGESSTART 333
00257 #define STAGESEND 334
00258 #define STAGESTART 335
00259 #define STAGEEND 336
00260 #define NAMEATT 337
00261 #define NUMBEROFSTAGESATT 338
00262 #define HORIZONATT 339
00263 #define STARTATT 340
00264 #define VARIABLESSTART 341
00265 #define CONSTRAINTSSTART 342
00266 #define OBJECTIVESSTART 343
00267 #define VARIABLESEND 344
00268 #define CONSTRAINTSEND 345
00269 #define OBJECTIVESEND 346
00270 #define NUMBEROFVARIABLESATT 347
00271 #define NUMBEROFCONSTRAINTSATT 348
00272 #define NUMBEROFOBJECTIVESATT 349
00273 #define STARTIDXATT 350
00274 #define VARSTART 351
00275 #define VAREND 352
00276 #define CONSTART 353
00277 #define CONEND 354
00278 #define OBJSTART 355
00279 #define OBJEND 356
00280 #define INTERVALSTART 357
00281 #define INTERVALEND 358
00282 
00283 
00284 
00285 
00286 /* Copy the first part of user declarations.  */
00287 
00288 
00289 
00290 #include <string>
00291 #include <iostream>
00292 #include <sstream>  
00293  
00294 #include "OSInstance.h" 
00295 #include "OSnLNode.h"
00296 #include "OSErrorClass.h"
00297 #include "OSParameters.h"
00298 #include "OSiLParserData.h"
00299 #include "OSBase64.h"
00300 #include "OSMathUtil.h"
00301 
00302 #include "OSConfig.h"
00303 
00304 
00305 
00306 #ifdef HAVE_CTIME
00307 # include <ctime>
00308 #else
00309 # ifdef HAVE_TIME_H
00310 #  include <time.h>
00311 # else
00312 #  error "don't have header file for time"
00313 # endif
00314 #endif
00315 
00316 #ifdef HAVE_CSTRING
00317 # include <cstring>
00318 #else
00319 # ifdef HAVE_STRING_H
00320 #  include <string.h>
00321 # else
00322 #  error "don't have header file for string"
00323 # endif
00324 #endif
00325 
00326 #ifdef HAVE_CSTDIO
00327 # include <cstdio>
00328 #else
00329 # ifdef HAVE_STDIO_H
00330 #  include <stdio.h>
00331 # else
00332 #  error "don't have header file for stdio"
00333 # endif
00334 #endif
00335 
00336 using std::cout;
00337 using std::endl;
00338 using std::ostringstream;
00339 
00340 
00341 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00342 YY_BUFFER_STATE osil_scan_string (const char *yy_str , void* yyscanner  );
00343 int osillex_init(void** ptr_yy_globals);
00344 int osillex_destroy (void* yyscanner );
00345 void osilset_extra (OSiLParserData* parserData , void* yyscanner );
00346 int osilget_lineno( void* yyscanner);
00347 char *osilget_text (void* yyscanner );
00348 void osilset_lineno (int line_number , void* yyscanner );
00349 void yygetOSInstance(const char *osil, OSInstance* osinstance, OSiLParserData *parserData) throw(ErrorClass);
00350 //
00351 
00352 double atofmod1(int* osillineno, const char *ch1, const char *ch2 );
00353 int atoimod1(int* osillineno, const char *ch1, const char *ch2);
00354 // we distinguish a newline from other whitespace
00355 // since we need to know when we hit a new line
00356 void osilerror_wrapper( const char* ch, int* osillineno, const char* errormsg);
00357 bool isnewline(char c, int* osillineno);
00358 bool parseVariables(const char **pchar, OSInstance *osinstance ,int* osillineno);
00359 bool parseObjectives(const char **pchar, OSInstance *osinstance ,int* osillineno);
00360 bool parseObjCoef(const char **pchar, int objcount, OSInstance *osinstance ,int* osillineno);
00361 bool parseConstraints(const char **pchar, OSInstance *osinstance ,int* osillineno);
00362 bool parseLinearConstraintCoefficients(const char **pchar, OSInstance *osinstance ,int* osillineno);
00363 bool parseStart(const char **pchar, OSInstance *osinstance ,int* osillineno);
00364 bool parseRowIdx(const char **pchar, OSInstance *osinstance ,int* osillineno);
00365 bool parseColIdx(const char **pchar, OSInstance *osinstance ,int* osillineno);
00366 bool parseValue(const char **pchar, OSInstance *osinstance ,int* osillineno);
00367 bool parseInstanceHeader(const char **pchar, OSInstance *osinstance ,int* osillineno);
00368 bool parseInstanceData( const char **pchar, OSInstance *osinstance, int* osillineno);
00369 char *parseBase64( const char **p, int *dataSize ,int* osillineno);
00370 
00371 #define ISWHITESPACE( char_) ((char_) == ' ' || \
00372                      (char_) == '\t' ||  (char_) == '\r')
00373 
00374 #define ISDIGIT(_c) ((_c) >= '0' && (_c) <= '9')
00375 
00376 #define GETATTRIBUTETEXT        \
00377         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
00378         if( *ch != '=') {  osilerror_wrapper( ch, osillineno, "found an attribute not defined"); return false;}  \
00379         ch++; \
00380         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;       \
00381         if(*ch == '\"'){ \
00382                 ch++; \
00383             for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
00384             *p = ch; \
00385             for( ; *ch != '\"'; ch++); \
00386         }\
00387         else{\
00388             if(*ch == '\'') { \
00389                 ch++; \
00390                 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
00391                 *p = ch; \
00392                 for( ; *ch != '\''; ch++); \
00393             } \
00394             else {  osilerror_wrapper( ch, osillineno,"missing quote on attribute"); return false;} \
00395         }\
00396         numChar = ch - *p; \
00397         attText = new char[numChar + 1]; \
00398         for(ki = 0; ki < numChar; ki++) attText[ki] = *((*p)++); \
00399         attText[ki] = '\0'; \
00400         attTextEnd = &attText[ki]; 
00401         
00402 #define GAIL printf("GAIL ANN HONDA\n")
00403 
00404 
00405         
00406 #define ECHOCHECK \
00407         GAIL; \
00408         printf("%c", ch[-2]); \
00409         printf("%c", ch[-1]); \
00410         printf("%c", ch[0]); \
00411         printf("%c", ch[1]); \
00412         printf("%c", ch[2]); \
00413         printf("%c", ch[3]); \
00414         printf("%c", ch[4]); \
00415         printf("%c", ch[5]); \
00416         printf("%c \n", ch[6]); \
00417         GAIL;
00418 
00419 
00420 /* Enabling traces.  */
00421 #ifndef YYDEBUG
00422 # define YYDEBUG 0
00423 #endif
00424 
00425 /* Enabling verbose error messages.  */
00426 #ifdef YYERROR_VERBOSE
00427 # undef YYERROR_VERBOSE
00428 # define YYERROR_VERBOSE 1
00429 #else
00430 # define YYERROR_VERBOSE 1
00431 #endif
00432 
00433 /* Enabling the token table.  */
00434 #ifndef YYTOKEN_TABLE
00435 # define YYTOKEN_TABLE 0
00436 #endif
00437 
00438 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00439 typedef union YYSTYPE
00440 
00441 {
00442         double dval;
00443         int ival;
00444         char* sval;
00445         
00446 }
00447 /* Line 187 of yacc.c.  */
00448 
00449         YYSTYPE;
00450 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00451 # define YYSTYPE_IS_DECLARED 1
00452 # define YYSTYPE_IS_TRIVIAL 1
00453 #endif
00454 
00455 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
00456 typedef struct YYLTYPE
00457 {
00458   int first_line;
00459   int first_column;
00460   int last_line;
00461   int last_column;
00462 } YYLTYPE;
00463 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
00464 # define YYLTYPE_IS_DECLARED 1
00465 # define YYLTYPE_IS_TRIVIAL 1
00466 #endif
00467 
00468 
00469 /* Copy the second part of user declarations.  */
00470 
00471 
00472 int osillex(YYSTYPE* lvalp,  YYLTYPE* llocp, void* scanner );
00473 void osilerror(YYLTYPE* type, OSInstance *osintance,  OSiLParserData *parserData ,const char* errormsg );
00474 
00475  
00476 #define scanner parserData->scanner
00477 
00478 
00479 /* Line 216 of yacc.c.  */
00480 
00481 
00482 #ifdef short
00483 # undef short
00484 #endif
00485 
00486 #ifdef YYTYPE_UINT8
00487 typedef YYTYPE_UINT8 yytype_uint8;
00488 #else
00489 typedef unsigned char yytype_uint8;
00490 #endif
00491 
00492 #ifdef YYTYPE_INT8
00493 typedef YYTYPE_INT8 yytype_int8;
00494 #elif (defined __STDC__ || defined __C99__FUNC__ \
00495      || defined __cplusplus || defined _MSC_VER)
00496 typedef signed char yytype_int8;
00497 #else
00498 typedef short int yytype_int8;
00499 #endif
00500 
00501 #ifdef YYTYPE_UINT16
00502 typedef YYTYPE_UINT16 yytype_uint16;
00503 #else
00504 typedef unsigned short int yytype_uint16;
00505 #endif
00506 
00507 #ifdef YYTYPE_INT16
00508 typedef YYTYPE_INT16 yytype_int16;
00509 #else
00510 typedef short int yytype_int16;
00511 #endif
00512 
00513 #ifndef YYSIZE_T
00514 # ifdef __SIZE_TYPE__
00515 #  define YYSIZE_T __SIZE_TYPE__
00516 # elif defined size_t
00517 #  define YYSIZE_T size_t
00518 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00519      || defined __cplusplus || defined _MSC_VER)
00520 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00521 #  define YYSIZE_T size_t
00522 # else
00523 #  define YYSIZE_T unsigned int
00524 # endif
00525 #endif
00526 
00527 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00528 
00529 #ifndef YY_
00530 # if YYENABLE_NLS
00531 #  if ENABLE_NLS
00532 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00533 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00534 #  endif
00535 # endif
00536 # ifndef YY_
00537 #  define YY_(msgid) msgid
00538 # endif
00539 #endif
00540 
00541 /* Suppress unused-variable warnings by "using" E.  */
00542 #if ! defined lint || defined __GNUC__
00543 # define YYUSE(e) ((void) (e))
00544 #else
00545 # define YYUSE(e) /* empty */
00546 #endif
00547 
00548 /* Identity function, used to suppress warnings about constant conditions.  */
00549 #ifndef lint
00550 # define YYID(n) (n)
00551 #else
00552 #if (defined __STDC__ || defined __C99__FUNC__ \
00553      || defined __cplusplus || defined _MSC_VER)
00554 static int
00555 YYID (int i)
00556 #else
00557 static int
00558 YYID (i)
00559     int i;
00560 #endif
00561 {
00562   return i;
00563 }
00564 #endif
00565 
00566 #if ! defined yyoverflow || YYERROR_VERBOSE
00567 
00568 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00569 
00570 # ifdef YYSTACK_USE_ALLOCA
00571 #  if YYSTACK_USE_ALLOCA
00572 #   ifdef __GNUC__
00573 #    define YYSTACK_ALLOC __builtin_alloca
00574 #   elif defined __BUILTIN_VA_ARG_INCR
00575 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00576 #   elif defined _AIX
00577 #    define YYSTACK_ALLOC __alloca
00578 #   elif defined _MSC_VER
00579 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00580 #    define alloca _alloca
00581 #   else
00582 #    define YYSTACK_ALLOC alloca
00583 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00584      || defined __cplusplus || defined _MSC_VER)
00585 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00586 #     ifndef _STDLIB_H
00587 #      define _STDLIB_H 1
00588 #     endif
00589 #    endif
00590 #   endif
00591 #  endif
00592 # endif
00593 
00594 # ifdef YYSTACK_ALLOC
00595    /* Pacify GCC's `empty if-body' warning.  */
00596 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00597 #  ifndef YYSTACK_ALLOC_MAXIMUM
00598     /* The OS might guarantee only one guard page at the bottom of the stack,
00599        and a page size can be as small as 4096 bytes.  So we cannot safely
00600        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00601        to allow for a few compiler-allocated temporary stack slots.  */
00602 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00603 #  endif
00604 # else
00605 #  define YYSTACK_ALLOC YYMALLOC
00606 #  define YYSTACK_FREE YYFREE
00607 #  ifndef YYSTACK_ALLOC_MAXIMUM
00608 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00609 #  endif
00610 #  if (defined __cplusplus && ! defined _STDLIB_H \
00611        && ! ((defined YYMALLOC || defined malloc) \
00612              && (defined YYFREE || defined free)))
00613 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00614 #   ifndef _STDLIB_H
00615 #    define _STDLIB_H 1
00616 #   endif
00617 #  endif
00618 #  ifndef YYMALLOC
00619 #   define YYMALLOC malloc
00620 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00621      || defined __cplusplus || defined _MSC_VER)
00622 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00623 #   endif
00624 #  endif
00625 #  ifndef YYFREE
00626 #   define YYFREE free
00627 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00628      || defined __cplusplus || defined _MSC_VER)
00629 void free (void *); /* INFRINGES ON USER NAME SPACE */
00630 #   endif
00631 #  endif
00632 # endif
00633 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00634 
00635 
00636 #if (! defined yyoverflow \
00637      && (! defined __cplusplus \
00638          || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
00639              && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00640 
00641 /* A type that is properly aligned for any stack member.  */
00642 union yyalloc
00643 {
00644   yytype_int16 yyss;
00645   YYSTYPE yyvs;
00646     YYLTYPE yyls;
00647 };
00648 
00649 /* The size of the maximum gap between one aligned stack and the next.  */
00650 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00651 
00652 /* The size of an array large to enough to hold all stacks, each with
00653    N elements.  */
00654 # define YYSTACK_BYTES(N) \
00655      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
00656       + 2 * YYSTACK_GAP_MAXIMUM)
00657 
00658 /* Copy COUNT objects from FROM to TO.  The source and destination do
00659    not overlap.  */
00660 # ifndef YYCOPY
00661 #  if defined __GNUC__ && 1 < __GNUC__
00662 #   define YYCOPY(To, From, Count) \
00663       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00664 #  else
00665 #   define YYCOPY(To, From, Count)              \
00666       do                                        \
00667         {                                       \
00668           YYSIZE_T yyi;                         \
00669           for (yyi = 0; yyi < (Count); yyi++)   \
00670             (To)[yyi] = (From)[yyi];            \
00671         }                                       \
00672       while (YYID (0))
00673 #  endif
00674 # endif
00675 
00676 /* Relocate STACK from its old location to the new one.  The
00677    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00678    elements in the stack, and YYPTR gives the new location of the
00679    stack.  Advance YYPTR to a properly aligned location for the next
00680    stack.  */
00681 # define YYSTACK_RELOCATE(Stack)                                        \
00682     do                                                                  \
00683       {                                                                 \
00684         YYSIZE_T yynewbytes;                                            \
00685         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00686         Stack = &yyptr->Stack;                                          \
00687         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00688         yyptr += yynewbytes / sizeof (*yyptr);                          \
00689       }                                                                 \
00690     while (YYID (0))
00691 
00692 #endif
00693 
00694 /* YYFINAL -- State number of the termination state.  */
00695 #define YYFINAL  6
00696 /* YYLAST -- Last index in YYTABLE.  */
00697 #define YYLAST   401
00698 
00699 /* YYNTOKENS -- Number of terminals.  */
00700 #define YYNTOKENS  104
00701 /* YYNNTS -- Number of nonterminals.  */
00702 #define YYNNTS  145
00703 /* YYNRULES -- Number of rules.  */
00704 #define YYNRULES  227
00705 /* YYNRULES -- Number of states.  */
00706 #define YYNSTATES  403
00707 
00708 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00709 #define YYUNDEFTOK  2
00710 #define YYMAXUTOK   358
00711 
00712 #define YYTRANSLATE(YYX)                                                \
00713   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00714 
00715 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00716 static const yytype_uint8 yytranslate[] =
00717 {
00718        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00719        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00720        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00721        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00722        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00723        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00724        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00725        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00726        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00727        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00728        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00729        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00730        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00731        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00732        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00733        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00734        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00735        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00736        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00737        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00738        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00739        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00740        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00741        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00742        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00743        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00744        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00745       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00746       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
00747       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
00748       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
00749       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
00750       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
00751       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
00752       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
00753       95,    96,    97,    98,    99,   100,   101,   102,   103
00754 };
00755 
00756 #if YYDEBUG
00757 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00758    YYRHS.  */
00759 static const yytype_uint16 yyprhs[] =
00760 {
00761        0,     0,     3,     9,    10,    15,    21,    23,    26,    27,
00762       32,    34,    37,    38,    41,    43,    45,    47,    49,    54,
00763       59,    64,    69,    74,    75,    80,    86,    87,    88,    96,
00764      101,   103,   105,   107,   109,   111,   113,   115,   117,   119,
00765      121,   123,   125,   127,   129,   131,   133,   135,   137,   139,
00766      141,   143,   145,   147,   149,   150,   156,   157,   163,   164,
00767      170,   171,   176,   177,   183,   184,   190,   191,   196,   198,
00768      201,   202,   207,   209,   212,   213,   218,   220,   223,   224,
00769      229,   231,   234,   235,   240,   242,   245,   246,   251,   252,
00770      257,   258,   263,   264,   269,   270,   275,   276,   281,   282,
00771      287,   288,   293,   294,   301,   302,   306,   308,   311,   312,
00772      316,   318,   321,   322,   327,   329,   332,   333,   336,   338,
00773      340,   342,   343,   348,   349,   354,   359,   364,   365,   370,
00774      372,   373,   378,   381,   382,   385,   387,   389,   394,   399,
00775      404,   405,   408,   410,   411,   413,   417,   421,   423,   426,
00776      431,   433,   439,   441,   444,   445,   450,   451,   455,   457,
00777      461,   465,   466,   470,   471,   474,   476,   478,   483,   488,
00778      490,   494,   496,   499,   501,   504,   505,   510,   515,   517,
00779      520,   521,   525,   526,   529,   531,   533,   538,   543,   545,
00780      549,   551,   554,   556,   559,   560,   565,   570,   572,   575,
00781      576,   580,   581,   584,   586,   588,   593,   598,   600,   604,
00782      606,   609,   611,   614,   615,   620,   625,   627,   630,   631,
00783      636,   638,   641,   642,   645,   647,   649,   654
00784 };
00785 
00786 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00787 static const yytype_int16 yyrhs[] =
00788 {
00789      105,     0,    -1,   106,   118,   193,     8,     7,    -1,    -1,
00790       24,   107,   108,    25,    -1,    19,     3,     5,     3,    59,
00791       -1,   109,    -1,   108,   109,    -1,    -1,   110,    22,   112,
00792      111,    -1,    46,    -1,    59,    23,    -1,    -1,   112,   113,
00793       -1,   114,    -1,   115,    -1,   116,    -1,   117,    -1,    11,
00794        3,     5,     3,    -1,    12,     3,     5,     3,    -1,    13,
00795        3,     6,     3,    -1,    13,     3,     5,     3,    -1,    20,
00796        3,     5,     3,    -1,    -1,    26,   119,   120,    27,    -1,
00797       10,     3,     5,     3,    59,    -1,    -1,    -1,   120,    28,
00798      122,    59,   123,   121,    29,    -1,    20,     3,     5,     3,
00799       -1,   175,    -1,   185,    -1,   124,    -1,   126,    -1,   136,
00800       -1,   128,    -1,   130,    -1,   132,    -1,   134,    -1,   148,
00801       -1,   151,    -1,   153,    -1,   155,    -1,   159,    -1,   157,
00802       -1,   161,    -1,   167,    -1,   163,    -1,   165,    -1,   142,
00803       -1,   145,    -1,   169,    -1,   172,    -1,   139,    -1,    -1,
00804       15,   125,   123,   123,    16,    -1,    -1,    32,   127,   123,
00805      123,    33,    -1,    -1,    34,   129,   123,   123,    35,    -1,
00806       -1,    49,   131,   123,    50,    -1,    -1,    36,   133,   123,
00807      123,    37,    -1,    -1,    30,   135,   123,   123,    31,    -1,
00808       -1,    42,   137,   138,    43,    -1,   123,    -1,   138,   123,
00809       -1,    -1,    68,   140,   141,    69,    -1,   123,    -1,   141,
00810      123,    -1,    -1,    66,   143,   144,    67,    -1,   123,    -1,
00811      144,   123,    -1,    -1,    70,   146,   147,    71,    -1,   123,
00812       -1,   147,   123,    -1,    -1,    44,   149,   150,    45,    -1,
00813      123,    -1,   150,   123,    -1,    -1,    38,   152,   123,    39,
00814       -1,    -1,    40,   154,   123,    41,    -1,    -1,    53,   156,
00815      123,    54,    -1,    -1,    55,   158,   123,    56,    -1,    -1,
00816       57,   160,   123,    58,    -1,    -1,    47,   162,   123,    48,
00817       -1,    -1,    62,   164,   123,    63,    -1,    -1,    64,   166,
00818      123,    65,    -1,    -1,    51,   168,   123,   123,   123,    52,
00819       -1,    -1,    72,   170,   171,    -1,    46,    -1,    59,    73,
00820       -1,    -1,    74,   173,   174,    -1,    46,    -1,    59,    75,
00821       -1,    -1,    17,   176,   178,   177,    -1,    46,    -1,    59,
00822       18,    -1,    -1,   178,   179,    -1,   180,    -1,   184,    -1,
00823      182,    -1,    -1,    21,     4,   181,     3,    -1,    -1,    14,
00824        4,   183,     3,    -1,     9,     3,     6,     3,    -1,     9,
00825        3,     5,     3,    -1,    -1,    60,   186,   189,   187,    -1,
00826       46,    -1,    -1,    59,   123,   188,    61,    -1,    59,    61,
00827       -1,    -1,   189,   190,    -1,   191,    -1,   192,    -1,    13,
00828        3,     6,     3,    -1,    13,     3,     5,     3,    -1,    20,
00829        3,     5,     3,    -1,    -1,   194,   195,    -1,    76,    -1,
00830       -1,   196,    -1,    59,   197,    77,    -1,    59,   242,    77,
00831       -1,    46,    -1,    59,    77,    -1,   198,   199,   200,    79,
00832       -1,    78,    -1,    83,     3,     5,     3,    59,    -1,   201,
00833       -1,   200,   201,    -1,    -1,   202,    80,   203,   204,    -1,
00834       -1,    82,     4,     3,    -1,    46,    -1,    59,   205,    81,
00835       -1,   206,   218,   230,    -1,    -1,    86,   207,   211,    -1,
00836       -1,   207,   208,    -1,   209,    -1,   210,    -1,    92,     3,
00837        5,     3,    -1,    95,     3,     5,     3,    -1,   212,    -1,
00838       59,   213,    89,    -1,    46,    -1,    59,    89,    -1,   214,
00839       -1,   213,   214,    -1,    -1,   215,    96,   216,   217,    -1,
00840       20,     3,     5,     3,    -1,    46,    -1,    59,    97,    -1,
00841       -1,    87,   219,   223,    -1,    -1,   219,   220,    -1,   221,
00842       -1,   222,    -1,    93,     3,     5,     3,    -1,    95,     3,
00843        5,     3,    -1,   224,    -1,    59,   225,    90,    -1,    46,
00844       -1,    59,    90,    -1,   226,    -1,   225,   226,    -1,    -1,
00845      227,    98,   228,   229,    -1,    20,     3,     5,     3,    -1,
00846       46,    -1,    59,    99,    -1,    -1,    88,   231,   235,    -1,
00847       -1,   231,   232,    -1,   233,    -1,   234,    -1,    94,     3,
00848        5,     3,    -1,    95,     3,     5,     3,    -1,   236,    -1,
00849       59,   237,    91,    -1,    46,    -1,    59,    91,    -1,   238,
00850       -1,   237,   238,    -1,    -1,   239,   100,   240,   241,    -1,
00851       20,     3,     5,     3,    -1,    46,    -1,    59,   101,    -1,
00852       -1,   243,   102,   245,   244,    -1,    46,    -1,    59,   103,
00853       -1,    -1,   245,   246,    -1,   247,    -1,   248,    -1,    84,
00854        3,     6,     3,    -1,    85,     3,     6,     3,    -1
00855 };
00856 
00857 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00858 static const yytype_uint16 yyrline[] =
00859 {
00860        0,   227,   227,   233,   234,   239,   246,   247,   249,   249,
00861      261,   262,   265,   266,   270,   273,   276,   279,   285,   292,
00862      299,   301,   305,   308,   309,   313,   319,   321,   320,   328,
00863      343,   344,   345,   346,   347,   348,   349,   350,   351,   352,
00864      353,   354,   355,   356,   357,   358,   359,   360,   361,   362,
00865      363,   364,   365,   366,   369,   369,   374,   374,   379,   379,
00866      384,   384,   389,   389,   394,   394,   399,   399,   409,   410,
00867      415,   415,   427,   428,   431,   431,   442,   443,   445,   445,
00868      456,   457,   460,   460,   470,   471,   474,   474,   479,   479,
00869      484,   484,   489,   489,   494,   494,   501,   501,   506,   506,
00870      514,   514,   522,   522,   529,   529,   532,   533,   535,   535,
00871      538,   539,   541,   541,   546,   547,   549,   550,   552,   554,
00872      556,   560,   560,   564,   564,   568,   571,   575,   575,   580,
00873      581,   581,   585,   587,   588,   590,   592,   596,   599,   603,
00874      611,   611,   613,   615,   616,   617,   618,   620,   621,   623,
00875      674,   676,   690,   691,   693,   693,   717,   718,   721,   722,
00876      724,   726,   727,   731,   732,   734,   735,   737,   753,   761,
00877      768,   773,   774,   776,   777,   779,   779,   782,   791,   792,
00878      794,   795,   799,   800,   802,   803,   805,   821,   829,   836,
00879      841,   842,   844,   845,   847,   847,   850,   859,   860,   862,
00880      872,   876,   877,   879,   880,   882,   898,   906,   913,   918,
00881      919,   921,   922,   924,   924,   927,   936,   937,   942,   942,
00882      950,   951,   953,   954,   956,   960,   965,   969
00883 };
00884 #endif
00885 
00886 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00887 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00888    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00889 static const char *const yytname[] =
00890 {
00891   "$end", "error", "$undefined", "QUOTE", "ATTRIBUTETEXT", "INTEGER",
00892   "DOUBLE", "OSILEND", "INSTANCEDATAEND", "VALUEATT",
00893   "NUMBEROFNONLINEAREXPRESSIONS", "IDXONEATT", "IDXTWOATT", "COEFATT",
00894   "IDATT", "TIMESSTART", "TIMESEND", "NUMBERSTART", "NUMBEREND",
00895   "NUMBEROFQTERMSATT", "IDXATT", "TYPEATT", "QTERMSTART", "QTERMEND",
00896   "QUADRATICCOEFFICIENTSSTART", "QUADRATICCOEFFICIENTSEND",
00897   "NONLINEAREXPRESSIONSSTART", "NONLINEAREXPRESSIONSEND", "NLSTART",
00898   "NLEND", "POWERSTART", "POWEREND", "PLUSSTART", "PLUSEND", "MINUSSTART",
00899   "MINUSEND", "DIVIDESTART", "DIVIDEEND", "LNSTART", "LNEND", "SQRTSTART",
00900   "SQRTEND", "SUMSTART", "SUMEND", "PRODUCTSTART", "PRODUCTEND",
00901   "ENDOFELEMENT", "EXPSTART", "EXPEND", "NEGATESTART", "NEGATEEND",
00902   "IFSTART", "IFEND", "SQUARESTART", "SQUAREEND", "COSSTART", "COSEND",
00903   "SINSTART", "SINEND", "GREATERTHAN", "VARIABLESTART", "VARIABLEEND",
00904   "ABSSTART", "ABSEND", "ERFSTART", "ERFEND", "MAXSTART", "MAXEND",
00905   "ALLDIFFSTART", "ALLDIFFEND", "MINSTART", "MINEND", "ESTART", "EEND",
00906   "PISTART", "PIEND", "TIMEDOMAINSTART", "TIMEDOMAINEND", "STAGESSTART",
00907   "STAGESEND", "STAGESTART", "STAGEEND", "NAMEATT", "NUMBEROFSTAGESATT",
00908   "HORIZONATT", "STARTATT", "VARIABLESSTART", "CONSTRAINTSSTART",
00909   "OBJECTIVESSTART", "VARIABLESEND", "CONSTRAINTSEND", "OBJECTIVESEND",
00910   "NUMBEROFVARIABLESATT", "NUMBEROFCONSTRAINTSATT",
00911   "NUMBEROFOBJECTIVESATT", "STARTIDXATT", "VARSTART", "VAREND", "CONSTART",
00912   "CONEND", "OBJSTART", "OBJEND", "INTERVALSTART", "INTERVALEND",
00913   "$accept", "osildoc", "quadraticcoefficients", "quadnumberatt",
00914   "qTermlist", "qterm", "@1", "qtermend", "anotherqTermATT", "qtermatt",
00915   "qtermidxOneatt", "qtermidxTwoatt", "qtermcoefatt", "qtermidxatt",
00916   "nonlinearExpressions", "nlnumberatt", "nlnodes", "@2", "nlIdxATT",
00917   "nlnode", "times", "@3", "plus", "@4", "minus", "@5", "negate", "@6",
00918   "divide", "@7", "power", "@8", "sum", "@9", "anothersumnlnode",
00919   "allDiff", "@10", "anotherallDiffnlnode", "max", "@11",
00920   "anothermaxnlnode", "min", "@12", "anotherminnlnode", "product", "@13",
00921   "anotherproductnlnode", "ln", "@14", "sqrt", "@15", "square", "@16",
00922   "cos", "@17", "sin", "@18", "exp", "@19", "abs", "@20", "erf", "@21",
00923   "if", "@22", "E", "@23", "eend", "PI", "@24", "piend", "number", "@25",
00924   "numberend", "anotherNumberATT", "numberATT", "numbertypeATT", "@26",
00925   "numberidATT", "@27", "numbervalueATT", "variable", "@28", "variableend",
00926   "@29", "anotherVariableATT", "variableATT", "variablecoefATT",
00927   "variableidxATT", "timeDomain", "timedomainstart", "timedomain",
00928   "timedomainend", "stages", "stagesstart", "numberofstagesatt",
00929   "stagelist", "stage", "@30", "stagenameATT", "stageend", "stagecontent",
00930   "stagevariables", "anotherstagevarATT", "stagevaratt",
00931   "numberofstagevariablesatt", "stagevarstartidxATT",
00932   "restofstagevariables", "emptyvarlist", "stagevarlist", "stagevar",
00933   "@31", "stagevaridxATT", "stagevarend", "stageconstraints",
00934   "anotherstageconATT", "stageconatt", "numberofstageconstraintsatt",
00935   "stageconstartidxATT", "restofstageconstraints", "emptyconlist",
00936   "stageconlist", "stagecon", "@32", "stageconidxATT", "stageconend",
00937   "stageobjectives", "anotherstageobjATT", "stageobjatt",
00938   "numberofstageobjectivesatt", "stageobjstartidxATT",
00939   "restofstageobjectives", "emptyobjlist", "stageobjlist", "stageobj",
00940   "@33", "stageobjidxATT", "stageobjend", "interval", "@34", "intervalend",
00941   "anotherIntervalATT", "intervalatt", "intervalhorizonatt",
00942   "intervalstartatt", 0
00943 };
00944 #endif
00945 
00946 # ifdef YYPRINT
00947 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00948    token YYLEX-NUM.  */
00949 static const yytype_uint16 yytoknum[] =
00950 {
00951        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00952      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00953      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
00954      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
00955      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
00956      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
00957      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
00958      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
00959      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
00960      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
00961      355,   356,   357,   358
00962 };
00963 # endif
00964 
00965 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00966 static const yytype_uint8 yyr1[] =
00967 {
00968        0,   104,   105,   106,   106,   107,   108,   108,   110,   109,
00969      111,   111,   112,   112,   113,   113,   113,   113,   114,   115,
00970      116,   116,   117,   118,   118,   119,   120,   121,   120,   122,
00971      123,   123,   123,   123,   123,   123,   123,   123,   123,   123,
00972      123,   123,   123,   123,   123,   123,   123,   123,   123,   123,
00973      123,   123,   123,   123,   125,   124,   127,   126,   129,   128,
00974      131,   130,   133,   132,   135,   134,   137,   136,   138,   138,
00975      140,   139,   141,   141,   143,   142,   144,   144,   146,   145,
00976      147,   147,   149,   148,   150,   150,   152,   151,   154,   153,
00977      156,   155,   158,   157,   160,   159,   162,   161,   164,   163,
00978      166,   165,   168,   167,   170,   169,   171,   171,   173,   172,
00979      174,   174,   176,   175,   177,   177,   178,   178,   179,   179,
00980      179,   181,   180,   183,   182,   184,   184,   186,   185,   187,
00981      188,   187,   187,   189,   189,   190,   190,   191,   191,   192,
00982      193,   193,   194,   195,   195,   195,   195,   196,   196,   197,
00983      198,   199,   200,   200,   202,   201,   203,   203,   204,   204,
00984      205,   206,   206,   207,   207,   208,   208,   209,   210,   211,
00985      211,   212,   212,   213,   213,   215,   214,   216,   217,   217,
00986      218,   218,   219,   219,   220,   220,   221,   222,   223,   223,
00987      224,   224,   225,   225,   227,   226,   228,   229,   229,   230,
00988      230,   231,   231,   232,   232,   233,   234,   235,   235,   236,
00989      236,   237,   237,   239,   238,   240,   241,   241,   243,   242,
00990      244,   244,   245,   245,   246,   246,   247,   248
00991 };
00992 
00993 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00994 static const yytype_uint8 yyr2[] =
00995 {
00996        0,     2,     5,     0,     4,     5,     1,     2,     0,     4,
00997        1,     2,     0,     2,     1,     1,     1,     1,     4,     4,
00998        4,     4,     4,     0,     4,     5,     0,     0,     7,     4,
00999        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01000        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01001        1,     1,     1,     1,     0,     5,     0,     5,     0,     5,
01002        0,     4,     0,     5,     0,     5,     0,     4,     1,     2,
01003        0,     4,     1,     2,     0,     4,     1,     2,     0,     4,
01004        1,     2,     0,     4,     1,     2,     0,     4,     0,     4,
01005        0,     4,     0,     4,     0,     4,     0,     4,     0,     4,
01006        0,     4,     0,     6,     0,     3,     1,     2,     0,     3,
01007        1,     2,     0,     4,     1,     2,     0,     2,     1,     1,
01008        1,     0,     4,     0,     4,     4,     4,     0,     4,     1,
01009        0,     4,     2,     0,     2,     1,     1,     4,     4,     4,
01010        0,     2,     1,     0,     1,     3,     3,     1,     2,     4,
01011        1,     5,     1,     2,     0,     4,     0,     3,     1,     3,
01012        3,     0,     3,     0,     2,     1,     1,     4,     4,     1,
01013        3,     1,     2,     1,     2,     0,     4,     4,     1,     2,
01014        0,     3,     0,     2,     1,     1,     4,     4,     1,     3,
01015        1,     2,     1,     2,     0,     4,     4,     1,     2,     0,
01016        3,     0,     2,     1,     1,     4,     4,     1,     3,     1,
01017        2,     1,     2,     0,     4,     4,     1,     2,     0,     4,
01018        1,     2,     0,     2,     1,     1,     4,     4
01019 };
01020 
01021 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
01022    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
01023    means the default is an error.  */
01024 static const yytype_uint8 yydefact[] =
01025 {
01026        3,     0,     0,    23,     0,     8,     1,     0,   140,     0,
01027        8,     6,     0,     0,    26,   142,     0,   143,     0,     4,
01028        7,    12,     0,     0,     0,   147,   218,   141,   144,     0,
01029        0,     0,    24,     0,     2,   148,   150,     0,     0,     0,
01030        0,     5,     0,     0,     0,     0,    10,     0,     9,    13,
01031       14,    15,    16,    17,     0,     0,     0,   145,     0,   154,
01032      146,   222,     0,     0,     0,     0,    11,    25,     0,     0,
01033        0,   154,   152,     0,     0,     0,     0,     0,     0,     0,
01034        0,    54,   112,    64,    56,    58,    62,    86,    88,    66,
01035       82,    96,    60,   102,    90,    92,    94,   127,    98,   100,
01036       74,    70,    78,   104,   108,    27,    32,    33,    35,    36,
01037       37,    38,    34,    53,    49,    50,    39,    40,    41,    42,
01038       44,    43,    45,    47,    48,    46,    51,    52,    30,    31,
01039        0,   149,   153,   156,   220,     0,     0,     0,   219,   223,
01040      224,   225,    18,    19,    21,    20,    22,    29,     0,   116,
01041        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01042        0,     0,     0,     0,   133,     0,     0,     0,     0,     0,
01043        0,     0,     0,     0,     0,     0,   221,     0,     0,     0,
01044        0,     0,     0,     0,     0,     0,     0,    68,     0,    84,
01045        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01046       76,     0,    72,     0,    80,     0,   106,     0,   105,   110,
01047        0,   109,    28,   151,     0,   158,   161,   155,     0,     0,
01048        0,     0,     0,     0,   114,     0,   113,   117,   118,   120,
01049      119,     0,     0,     0,     0,    87,    89,    67,    69,    83,
01050       85,    97,    61,     0,    91,    93,    95,     0,     0,   129,
01051        0,   128,   134,   135,   136,    99,   101,    75,    77,    71,
01052       73,    79,    81,   107,   111,   157,   163,     0,   180,   226,
01053      227,    55,     0,   123,   121,   115,    65,    57,    59,    63,
01054        0,     0,     0,   132,   130,     0,   159,   182,   199,     0,
01055        0,     0,     0,   103,     0,     0,     0,     0,   171,   175,
01056        0,     0,   164,   165,   166,   162,   169,     0,   201,   160,
01057      126,   125,   124,   122,   138,   137,   139,   131,   172,   175,
01058      173,     0,     0,     0,   190,   194,     0,     0,   183,   184,
01059      185,   181,   188,     0,   170,   174,     0,     0,     0,   191,
01060      194,   192,     0,     0,     0,   209,   213,     0,     0,   202,
01061      203,   204,   200,   207,     0,     0,   167,   168,   189,   193,
01062        0,     0,     0,   210,   213,   211,     0,     0,     0,     0,
01063      178,     0,   176,     0,     0,   186,   187,   208,   212,     0,
01064        0,     0,     0,   179,     0,   197,     0,   195,     0,     0,
01065      205,   206,   177,     0,   198,     0,   216,     0,   214,   196,
01066        0,   217,   215
01067 };
01068 
01069 /* YYDEFGOTO[NTERM-NUM].  */
01070 static const yytype_int16 yydefgoto[] =
01071 {
01072       -1,     2,     3,     5,    10,    11,    12,    48,    30,    49,
01073       50,    51,    52,    53,     8,    14,    23,   172,    56,   105,
01074      106,   148,   107,   151,   108,   152,   109,   159,   110,   153,
01075      111,   150,   112,   156,   188,   113,   168,   203,   114,   167,
01076      201,   115,   169,   205,   116,   157,   190,   117,   154,   118,
01077      155,   119,   161,   120,   162,   121,   163,   122,   158,   123,
01078      165,   124,   166,   125,   160,   126,   170,   208,   127,   171,
01079      211,   128,   149,   226,   180,   227,   228,   292,   229,   291,
01080      230,   129,   164,   251,   297,   197,   252,   253,   254,    16,
01081       17,    27,    28,    37,    38,    59,    71,    72,    73,   175,
01082      217,   267,   268,   285,   302,   303,   304,   305,   306,   319,
01083      320,   321,   355,   372,   288,   307,   328,   329,   330,   331,
01084      332,   340,   341,   342,   374,   387,   309,   333,   349,   350,
01085      351,   352,   353,   364,   365,   366,   389,   398,    39,    40,
01086      138,    74,   139,   140,   141
01087 };
01088 
01089 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
01090    STATE-NUM.  */
01091 #define YYPACT_NINF -149
01092 static const yytype_int16 yypact[] =
01093 {
01094      -23,     5,    32,    18,    44,  -149,  -149,    39,   -25,    63,
01095       51,  -149,    59,    84,  -149,  -149,    85,   -30,    94,  -149,
01096     -149,  -149,    98,    -5,   100,  -149,   -51,  -149,  -149,    46,
01097      330,   106,  -149,    93,  -149,  -149,  -149,    38,    43,    76,
01098       26,  -149,   152,   154,   161,   165,  -149,   147,  -149,  -149,
01099     -149,  -149,  -149,  -149,   122,   180,   126,  -149,   184,  -149,
01100     -149,  -149,   189,   191,    95,   193,  -149,  -149,   198,   264,
01101      202,   110,  -149,   129,   146,   187,   208,   217,   219,   221,
01102      223,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01103     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01104     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01105     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01106     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01107      225,  -149,  -149,   151,  -149,   132,   234,   236,  -149,  -149,
01108     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,   264,  -149,
01109      264,   264,   264,   264,   264,   264,   264,   264,   264,   264,
01110      264,   264,   264,   264,  -149,   264,   264,   264,   264,   264,
01111      -18,   -16,   212,   195,   239,     0,  -149,   238,   244,   264,
01112      326,   264,   264,   264,   264,   213,   227,  -149,    22,  -149,
01113       74,   210,   214,   264,   206,   216,   204,    65,   203,   205,
01114     -149,   105,  -149,   144,  -149,   185,  -149,   201,  -149,  -149,
01115      215,  -149,  -149,  -149,   273,  -149,   197,  -149,   274,   282,
01116      271,   286,   303,   305,  -149,   292,  -149,  -149,  -149,  -149,
01117     -149,   281,   283,   279,   285,  -149,  -149,  -149,  -149,  -149,
01118     -149,  -149,  -149,   264,  -149,  -149,  -149,   315,   317,  -149,
01119      231,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01120     -149,  -149,  -149,  -149,  -149,  -149,  -149,   242,   240,  -149,
01121     -149,  -149,   127,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01122      277,   145,   320,  -149,  -149,    71,  -149,  -149,   243,   334,
01123      336,   341,   342,  -149,   343,   345,   346,   272,  -149,   262,
01124      349,   350,  -149,  -149,  -149,  -149,  -149,   -21,  -149,  -149,
01125     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,   265,
01126     -149,   259,   351,   352,  -149,   268,   356,   357,  -149,  -149,
01127     -149,  -149,  -149,     4,  -149,  -149,   344,   358,   359,  -149,
01128      275,  -149,   269,   361,   363,  -149,   278,   360,   367,  -149,
01129     -149,  -149,  -149,  -149,   368,     2,  -149,  -149,  -149,  -149,
01130      353,   371,   372,  -149,   287,  -149,   280,   374,   376,   377,
01131     -149,   289,  -149,   380,    21,  -149,  -149,  -149,  -149,   364,
01132      384,   385,   387,  -149,   386,  -149,   293,  -149,   390,    24,
01133     -149,  -149,  -149,   391,  -149,   392,  -149,   276,  -149,  -149,
01134      393,  -149,  -149
01135 };
01136 
01137 /* YYPGOTO[NTERM-NUM].  */
01138 static const yytype_int16 yypgoto[] =
01139 {
01140     -149,  -149,  -149,  -149,  -149,   388,  -149,  -149,  -149,  -149,
01141     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -148,
01142     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01143     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01144     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01145     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01146     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01147     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01148     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01149     -149,  -149,  -149,  -149,  -149,  -149,  -149,   324,  -149,  -149,
01150     -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01151       80,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01152     -149,  -149,    60,  -149,  -149,  -149,  -149,  -149,  -149,  -149,
01153     -149,  -149,  -149,  -149,    37,  -149,  -149,  -149,  -149,  -149,
01154     -149,  -149,  -149,  -149,  -149
01155 };
01156 
01157 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
01158    positive, shift that token.  If negative, reduce the rule which
01159    number is the opposite.  If zero, do what YYDEFACT says.
01160    If YYTABLE_NINF, syntax error.  */
01161 #define YYTABLE_NINF -1
01162 static const yytype_uint16 yytable[] =
01163 {
01164      179,     1,   181,   182,   183,   184,   185,   186,   187,   189,
01165      191,   192,   193,   194,   195,   196,    25,   198,   199,   200,
01166      202,   204,    32,    33,     4,   324,    35,    36,   206,    26,
01167      209,   220,     6,   231,   232,   233,   234,    81,   325,    82,
01168      238,   207,   240,   210,     7,   243,   215,     9,   370,    13,
01169      345,    15,    83,   258,    84,   260,    85,   262,    86,   216,
01170       87,   371,    88,   346,    89,   237,    90,   385,    18,    91,
01171      396,    92,   326,    93,   327,    94,    19,    95,   247,    96,
01172      386,    21,    97,   397,    98,   248,    99,    22,   100,    81,
01173      101,    82,   102,    24,   103,   280,   104,    29,   347,   348,
01174       77,    78,   284,    31,    83,    41,    84,    34,    85,    54,
01175       86,   249,    87,    55,    88,    57,    89,   298,    90,   239,
01176       81,    91,    82,    92,   250,    93,    58,    94,    61,    95,
01177      299,    96,   289,   290,    97,    83,    98,    84,    99,    85,
01178      100,    86,   101,    87,   102,    88,   103,    89,   104,    90,
01179      294,   295,    91,    60,    92,    62,    93,    63,    94,    81,
01180       95,    82,    96,   300,    64,    97,   301,    98,    65,    99,
01181       66,   100,   257,   101,    83,   102,    84,   103,    85,   104,
01182       86,    67,    87,    68,    88,    69,    89,    70,    90,   131,
01183      142,    91,   134,    92,    75,    93,    76,    94,    79,    95,
01184       81,    96,    82,    80,    97,   135,    98,   130,    99,   133,
01185      100,   143,   101,   259,   102,    83,   103,    84,   104,    85,
01186      144,    86,   145,    87,   146,    88,   147,    89,   173,    90,
01187      136,   137,    91,   174,    92,   176,    93,   177,    94,   178,
01188       95,   212,    96,   214,   218,    97,    81,    98,    82,    99,
01189      219,   100,   235,   101,   213,   102,   261,   103,   241,   104,
01190      244,    83,   246,    84,   242,    85,   255,    86,   236,    87,
01191      256,    88,   245,    89,   263,    90,   265,   269,    91,    81,
01192       92,    82,    93,   266,    94,   270,    95,   271,    96,   272,
01193      264,    97,   283,    98,    83,    99,    84,   100,    85,   101,
01194       86,   102,    87,   103,    88,   104,    89,   273,    90,   274,
01195      275,    91,   276,    92,   278,    93,   277,    94,   281,    95,
01196      282,    96,   279,   286,    97,   296,    98,   287,    99,   293,
01197      100,   308,   101,   317,   102,   221,   103,   310,   104,   311,
01198      222,    42,    43,    44,   312,   313,   314,   223,   315,   316,
01199       45,   318,   322,   323,   334,   336,   337,   338,   339,   343,
01200      344,   356,   357,   367,   354,   358,   361,   360,   362,   363,
01201      368,   369,   224,   373,   375,   376,    46,   401,   377,   380,
01202      379,   381,   382,   384,   388,   225,   383,   390,   391,    47,
01203      392,   393,   394,   395,   399,   132,   402,   400,    20,   335,
01204      359,   378
01205 };
01206 
01207 static const yytype_uint16 yycheck[] =
01208 {
01209      148,    24,   150,   151,   152,   153,   154,   155,   156,   157,
01210      158,   159,   160,   161,   162,   163,    46,   165,   166,   167,
01211      168,   169,    27,    28,    19,    46,    77,    78,    46,    59,
01212       46,   179,     0,   181,   182,   183,   184,    15,    59,    17,
01213      188,    59,   190,    59,    26,   193,    46,     3,    46,    10,
01214       46,    76,    30,   201,    32,   203,    34,   205,    36,    59,
01215       38,    59,    40,    59,    42,    43,    44,    46,     5,    47,
01216       46,    49,    93,    51,    95,    53,    25,    55,    13,    57,
01217       59,    22,    60,    59,    62,    20,    64,     3,    66,    15,
01218       68,    17,    70,     8,    72,   243,    74,     3,    94,    95,
01219        5,     6,   250,     5,    30,    59,    32,     7,    34,     3,
01220       36,    46,    38,    20,    40,    77,    42,    46,    44,    45,
01221       15,    47,    17,    49,    59,    51,    83,    53,   102,    55,
01222       59,    57,     5,     6,    60,    30,    62,    32,    64,    34,
01223       66,    36,    68,    38,    70,    40,    72,    42,    74,    44,
01224        5,     6,    47,    77,    49,     3,    51,     3,    53,    15,
01225       55,    17,    57,    92,     3,    60,    95,    62,     3,    64,
01226       23,    66,    67,    68,    30,    70,    32,    72,    34,    74,
01227       36,    59,    38,     3,    40,    59,    42,     3,    44,    79,
01228        3,    47,    46,    49,     5,    51,     5,    53,     5,    55,
01229       15,    57,    17,     5,    60,    59,    62,     5,    64,    80,
01230       66,     3,    68,    69,    70,    30,    72,    32,    74,    34,
01231        3,    36,     3,    38,     3,    40,     3,    42,     3,    44,
01232       84,    85,    47,    82,    49,   103,    51,     3,    53,     3,
01233       55,    29,    57,     4,     6,    60,    15,    62,    17,    64,
01234        6,    66,    39,    68,    59,    70,    71,    72,    48,    74,
01235       54,    30,    58,    32,    50,    34,    63,    36,    41,    38,
01236       65,    40,    56,    42,    73,    44,     3,     3,    47,    15,
01237       49,    17,    51,    86,    53,     3,    55,    16,    57,     3,
01238       75,    60,    61,    62,    30,    64,    32,    66,    34,    68,
01239       36,    70,    38,    72,    40,    74,    42,     4,    44,     4,
01240       18,    47,    31,    49,    35,    51,    33,    53,     3,    55,
01241        3,    57,    37,    81,    60,     5,    62,    87,    64,    52,
01242       66,    88,    68,    61,    70,     9,    72,     3,    74,     3,
01243       14,    11,    12,    13,     3,     3,     3,    21,     3,     3,
01244       20,    89,     3,     3,    89,    96,     5,     5,    90,     3,
01245        3,     3,     3,     3,    20,    90,     5,    98,     5,    91,
01246        3,     3,    46,    20,     3,     3,    46,   101,    91,     5,
01247      100,     5,     5,     3,    20,    59,    97,     3,     3,    59,
01248        3,     5,    99,     3,     3,    71,     3,     5,    10,   319,
01249      340,   364
01250 };
01251 
01252 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
01253    symbol of state STATE-NUM.  */
01254 static const yytype_uint8 yystos[] =
01255 {
01256        0,    24,   105,   106,    19,   107,     0,    26,   118,     3,
01257      108,   109,   110,    10,   119,    76,   193,   194,     5,    25,
01258      109,    22,     3,   120,     8,    46,    59,   195,   196,     3,
01259      112,     5,    27,    28,     7,    77,    78,   197,   198,   242,
01260      243,    59,    11,    12,    13,    20,    46,    59,   111,   113,
01261      114,   115,   116,   117,     3,    20,   122,    77,    83,   199,
01262       77,   102,     3,     3,     3,     3,    23,    59,     3,    59,
01263        3,   200,   201,   202,   245,     5,     5,     5,     6,     5,
01264        5,    15,    17,    30,    32,    34,    36,    38,    40,    42,
01265       44,    47,    49,    51,    53,    55,    57,    60,    62,    64,
01266       66,    68,    70,    72,    74,   123,   124,   126,   128,   130,
01267      132,   134,   136,   139,   142,   145,   148,   151,   153,   155,
01268      157,   159,   161,   163,   165,   167,   169,   172,   175,   185,
01269        5,    79,   201,    80,    46,    59,    84,    85,   244,   246,
01270      247,   248,     3,     3,     3,     3,     3,     3,   125,   176,
01271      135,   127,   129,   133,   152,   154,   137,   149,   162,   131,
01272      168,   156,   158,   160,   186,   164,   166,   143,   140,   146,
01273      170,   173,   121,     3,    82,   203,   103,     3,     3,   123,
01274      178,   123,   123,   123,   123,   123,   123,   123,   138,   123,
01275      150,   123,   123,   123,   123,   123,   123,   189,   123,   123,
01276      123,   144,   123,   141,   123,   147,    46,    59,   171,    46,
01277       59,   174,    29,    59,     4,    46,    59,   204,     6,     6,
01278      123,     9,    14,    21,    46,    59,   177,   179,   180,   182,
01279      184,   123,   123,   123,   123,    39,    41,    43,   123,    45,
01280      123,    48,    50,   123,    54,    56,    58,    13,    20,    46,
01281       59,   187,   190,   191,   192,    63,    65,    67,   123,    69,
01282      123,    71,   123,    73,    75,     3,    86,   205,   206,     3,
01283        3,    16,     3,     4,     4,    18,    31,    33,    35,    37,
01284      123,     3,     3,    61,   123,   207,    81,    87,   218,     5,
01285        6,   183,   181,    52,     5,     6,     5,   188,    46,    59,
01286       92,    95,   208,   209,   210,   211,   212,   219,    88,   230,
01287        3,     3,     3,     3,     3,     3,     3,    61,    89,   213,
01288      214,   215,     3,     3,    46,    59,    93,    95,   220,   221,
01289      222,   223,   224,   231,    89,   214,    96,     5,     5,    90,
01290      225,   226,   227,     3,     3,    46,    59,    94,    95,   232,
01291      233,   234,   235,   236,    20,   216,     3,     3,    90,   226,
01292       98,     5,     5,    91,   237,   238,   239,     3,     3,     3,
01293       46,    59,   217,    20,   228,     3,     3,    91,   238,   100,
01294        5,     5,     5,    97,     3,    46,    59,   229,    20,   240,
01295        3,     3,     3,     5,    99,     3,    46,    59,   241,     3,
01296        5,   101,     3
01297 };
01298 
01299 #define yyerrok         (yyerrstatus = 0)
01300 #define yyclearin       (yychar = YYEMPTY)
01301 #define YYEMPTY         (-2)
01302 #define YYEOF           0
01303 
01304 #define YYACCEPT        goto yyacceptlab
01305 #define YYABORT         goto yyabortlab
01306 #define YYERROR         goto yyerrorlab
01307 
01308 
01309 /* Like YYERROR except do call yyerror.  This remains here temporarily
01310    to ease the transition to the new meaning of YYERROR, for GCC.
01311    Once GCC version 2 has supplanted version 1, this can go.  */
01312 
01313 #define YYFAIL          goto yyerrlab
01314 
01315 #define YYRECOVERING()  (!!yyerrstatus)
01316 
01317 #define YYBACKUP(Token, Value)                                  \
01318 do                                                              \
01319   if (yychar == YYEMPTY && yylen == 1)                          \
01320     {                                                           \
01321       yychar = (Token);                                         \
01322       yylval = (Value);                                         \
01323       yytoken = YYTRANSLATE (yychar);                           \
01324       YYPOPSTACK (1);                                           \
01325       goto yybackup;                                            \
01326     }                                                           \
01327   else                                                          \
01328     {                                                           \
01329       yyerror (&yylloc, osinstance, parserData, YY_("syntax error: cannot back up")); \
01330       YYERROR;                                                  \
01331     }                                                           \
01332 while (YYID (0))
01333 
01334 
01335 #define YYTERROR        1
01336 #define YYERRCODE       256
01337 
01338 
01339 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
01340    If N is 0, then set CURRENT to the empty location which ends
01341    the previous symbol: RHS[0] (always defined).  */
01342 
01343 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
01344 #ifndef YYLLOC_DEFAULT
01345 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
01346     do                                                                  \
01347       if (YYID (N))                                                    \
01348         {                                                               \
01349           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
01350           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
01351           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
01352           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
01353         }                                                               \
01354       else                                                              \
01355         {                                                               \
01356           (Current).first_line   = (Current).last_line   =              \
01357             YYRHSLOC (Rhs, 0).last_line;                                \
01358           (Current).first_column = (Current).last_column =              \
01359             YYRHSLOC (Rhs, 0).last_column;                              \
01360         }                                                               \
01361     while (YYID (0))
01362 #endif
01363 
01364 
01365 /* YY_LOCATION_PRINT -- Print the location on the stream.
01366    This macro was not mandated originally: define only if we know
01367    we won't break user code: when these are the locations we know.  */
01368 
01369 #ifndef YY_LOCATION_PRINT
01370 # if YYLTYPE_IS_TRIVIAL
01371 #  define YY_LOCATION_PRINT(File, Loc)                  \
01372      fprintf (File, "%d.%d-%d.%d",                      \
01373               (Loc).first_line, (Loc).first_column,     \
01374               (Loc).last_line,  (Loc).last_column)
01375 # else
01376 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
01377 # endif
01378 #endif
01379 
01380 
01381 /* YYLEX -- calling `yylex' with the right arguments.  */
01382 
01383 #ifdef YYLEX_PARAM
01384 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
01385 #else
01386 # define YYLEX yylex (&yylval, &yylloc, scanner)
01387 #endif
01388 
01389 /* Enable debugging if requested.  */
01390 #if YYDEBUG
01391 
01392 # ifndef YYFPRINTF
01393 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
01394 #  define YYFPRINTF fprintf
01395 # endif
01396 
01397 # define YYDPRINTF(Args)                        \
01398 do {                                            \
01399   if (yydebug)                                  \
01400     YYFPRINTF Args;                             \
01401 } while (YYID (0))
01402 
01403 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
01404 do {                                                                      \
01405   if (yydebug)                                                            \
01406     {                                                                     \
01407       YYFPRINTF (stderr, "%s ", Title);                                   \
01408       yy_symbol_print (stderr,                                            \
01409                   Type, Value, Location, osinstance, parserData); \
01410       YYFPRINTF (stderr, "\n");                                           \
01411     }                                                                     \
01412 } while (YYID (0))
01413 
01414 
01415 /*--------------------------------.
01416 | Print this symbol on YYOUTPUT.  |
01417 `--------------------------------*/
01418 
01419 /*ARGSUSED*/
01420 #if (defined __STDC__ || defined __C99__FUNC__ \
01421      || defined __cplusplus || defined _MSC_VER)
01422 static void
01423 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, OSInstance *osinstance, OSiLParserData *parserData)
01424 #else
01425 static void
01426 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, osinstance, parserData)
01427     FILE *yyoutput;
01428     int yytype;
01429     YYSTYPE const * const yyvaluep;
01430     YYLTYPE const * const yylocationp;
01431     OSInstance *osinstance;
01432     OSiLParserData *parserData;
01433 #endif
01434 {
01435   if (!yyvaluep)
01436     return;
01437   YYUSE (yylocationp);
01438   YYUSE (osinstance);
01439   YYUSE (parserData);
01440 # ifdef YYPRINT
01441   if (yytype < YYNTOKENS)
01442     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
01443 # else
01444   YYUSE (yyoutput);
01445 # endif
01446   switch (yytype)
01447     {
01448       default:
01449         break;
01450     }
01451 }
01452 
01453 
01454 /*--------------------------------.
01455 | Print this symbol on YYOUTPUT.  |
01456 `--------------------------------*/
01457 
01458 #if (defined __STDC__ || defined __C99__FUNC__ \
01459      || defined __cplusplus || defined _MSC_VER)
01460 static void
01461 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, OSInstance *osinstance, OSiLParserData *parserData)
01462 #else
01463 static void
01464 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, osinstance, parserData)
01465     FILE *yyoutput;
01466     int yytype;
01467     YYSTYPE const * const yyvaluep;
01468     YYLTYPE const * const yylocationp;
01469     OSInstance *osinstance;
01470     OSiLParserData *parserData;
01471 #endif
01472 {
01473   if (yytype < YYNTOKENS)
01474     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
01475   else
01476     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
01477 
01478   YY_LOCATION_PRINT (yyoutput, *yylocationp);
01479   YYFPRINTF (yyoutput, ": ");
01480   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, osinstance, parserData);
01481   YYFPRINTF (yyoutput, ")");
01482 }
01483 
01484 /*------------------------------------------------------------------.
01485 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
01486 | TOP (included).                                                   |
01487 `------------------------------------------------------------------*/
01488 
01489 #if (defined __STDC__ || defined __C99__FUNC__ \
01490      || defined __cplusplus || defined _MSC_VER)
01491 static void
01492 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
01493 #else
01494 static void
01495 yy_stack_print (bottom, top)
01496     yytype_int16 *bottom;
01497     yytype_int16 *top;
01498 #endif
01499 {
01500   YYFPRINTF (stderr, "Stack now");
01501   for (; bottom <= top; ++bottom)
01502     YYFPRINTF (stderr, " %d", *bottom);
01503   YYFPRINTF (stderr, "\n");
01504 }
01505 
01506 # define YY_STACK_PRINT(Bottom, Top)                            \
01507 do {                                                            \
01508   if (yydebug)                                                  \
01509     yy_stack_print ((Bottom), (Top));                           \
01510 } while (YYID (0))
01511 
01512 
01513 /*------------------------------------------------.
01514 | Report that the YYRULE is going to be reduced.  |
01515 `------------------------------------------------*/
01516 
01517 #if (defined __STDC__ || defined __C99__FUNC__ \
01518      || defined __cplusplus || defined _MSC_VER)
01519 static void
01520 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, OSInstance *osinstance, OSiLParserData *parserData)
01521 #else
01522 static void
01523 yy_reduce_print (yyvsp, yylsp, yyrule, osinstance, parserData)
01524     YYSTYPE *yyvsp;
01525     YYLTYPE *yylsp;
01526     int yyrule;
01527     OSInstance *osinstance;
01528     OSiLParserData *parserData;
01529 #endif
01530 {
01531   int yynrhs = yyr2[yyrule];
01532   int yyi;
01533   unsigned long int yylno = yyrline[yyrule];
01534   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01535              yyrule - 1, yylno);
01536   /* The symbols being reduced.  */
01537   for (yyi = 0; yyi < yynrhs; yyi++)
01538     {
01539       fprintf (stderr, "   $%d = ", yyi + 1);
01540       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
01541                        &(yyvsp[(yyi + 1) - (yynrhs)])
01542                        , &(yylsp[(yyi + 1) - (yynrhs)])                , osinstance, parserData);
01543       fprintf (stderr, "\n");
01544     }
01545 }
01546 
01547 # define YY_REDUCE_PRINT(Rule)          \
01548 do {                                    \
01549   if (yydebug)                          \
01550     yy_reduce_print (yyvsp, yylsp, Rule, osinstance, parserData); \
01551 } while (YYID (0))
01552 
01553 /* Nonzero means print parse trace.  It is left uninitialized so that
01554    multiple parsers can coexist.  */
01555 int yydebug;
01556 #else /* !YYDEBUG */
01557 # define YYDPRINTF(Args)
01558 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01559 # define YY_STACK_PRINT(Bottom, Top)
01560 # define YY_REDUCE_PRINT(Rule)
01561 #endif /* !YYDEBUG */
01562 
01563 
01564 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01565 #ifndef YYINITDEPTH
01566 # define YYINITDEPTH 200
01567 #endif
01568 
01569 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01570    if the built-in stack extension method is used).
01571 
01572    Do not make this value too large; the results are undefined if
01573    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01574    evaluated with infinite-precision integer arithmetic.  */
01575 
01576 #ifndef YYMAXDEPTH
01577 # define YYMAXDEPTH 10000
01578 #endif
01579 
01580 
01581 
01582 #if YYERROR_VERBOSE
01583 
01584 # ifndef yystrlen
01585 #  if defined __GLIBC__ && defined _STRING_H
01586 #   define yystrlen strlen
01587 #  else
01588 /* Return the length of YYSTR.  */
01589 #if (defined __STDC__ || defined __C99__FUNC__ \
01590      || defined __cplusplus || defined _MSC_VER)
01591 static YYSIZE_T
01592 yystrlen (const char *yystr)
01593 #else
01594 static YYSIZE_T
01595 yystrlen (yystr)
01596     const char *yystr;
01597 #endif
01598 {
01599   YYSIZE_T yylen;
01600   for (yylen = 0; yystr[yylen]; yylen++)
01601     continue;
01602   return yylen;
01603 }
01604 #  endif
01605 # endif
01606 
01607 # ifndef yystpcpy
01608 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01609 #   define yystpcpy stpcpy
01610 #  else
01611 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01612    YYDEST.  */
01613 #if (defined __STDC__ || defined __C99__FUNC__ \
01614      || defined __cplusplus || defined _MSC_VER)
01615 static char *
01616 yystpcpy (char *yydest, const char *yysrc)
01617 #else
01618 static char *
01619 yystpcpy (yydest, yysrc)
01620     char *yydest;
01621     const char *yysrc;
01622 #endif
01623 {
01624   char *yyd = yydest;
01625   const char *yys = yysrc;
01626 
01627   while ((*yyd++ = *yys++) != '\0')
01628     continue;
01629 
01630   return yyd - 1;
01631 }
01632 #  endif
01633 # endif
01634 
01635 # ifndef yytnamerr
01636 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01637    quotes and backslashes, so that it's suitable for yyerror.  The
01638    heuristic is that double-quoting is unnecessary unless the string
01639    contains an apostrophe, a comma, or backslash (other than
01640    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
01641    null, do not copy; instead, return the length of what the result
01642    would have been.  */
01643 static YYSIZE_T
01644 yytnamerr (char *yyres, const char *yystr)
01645 {
01646   if (*yystr == '"')
01647     {
01648       YYSIZE_T yyn = 0;
01649       char const *yyp = yystr;
01650 
01651       for (;;)
01652         switch (*++yyp)
01653           {
01654           case '\'':
01655           case ',':
01656             goto do_not_strip_quotes;
01657 
01658           case '\\':
01659             if (*++yyp != '\\')
01660               goto do_not_strip_quotes;
01661             /* Fall through.  */
01662           default:
01663             if (yyres)
01664               yyres[yyn] = *yyp;
01665             yyn++;
01666             break;
01667 
01668           case '"':
01669             if (yyres)
01670               yyres[yyn] = '\0';
01671             return yyn;
01672           }
01673     do_not_strip_quotes: ;
01674     }
01675 
01676   if (! yyres)
01677     return yystrlen (yystr);
01678 
01679   return yystpcpy (yyres, yystr) - yyres;
01680 }
01681 # endif
01682 
01683 /* Copy into YYRESULT an error message about the unexpected token
01684    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
01685    including the terminating null byte.  If YYRESULT is null, do not
01686    copy anything; just return the number of bytes that would be
01687    copied.  As a special case, return 0 if an ordinary "syntax error"
01688    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
01689    size calculation.  */
01690 static YYSIZE_T
01691 yysyntax_error (char *yyresult, int yystate, int yychar)
01692 {
01693   int yyn = yypact[yystate];
01694 
01695   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01696     return 0;
01697   else
01698     {
01699       int yytype = YYTRANSLATE (yychar);
01700       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01701       YYSIZE_T yysize = yysize0;
01702       YYSIZE_T yysize1;
01703       int yysize_overflow = 0;
01704       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01705       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01706       int yyx;
01707 
01708 # if 0
01709       /* This is so xgettext sees the translatable formats that are
01710          constructed on the fly.  */
01711       YY_("syntax error, unexpected %s");
01712       YY_("syntax error, unexpected %s, expecting %s");
01713       YY_("syntax error, unexpected %s, expecting %s or %s");
01714       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01715       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01716 # endif
01717       char *yyfmt;
01718       char const *yyf;
01719       static char const yyunexpected[] = "syntax error, unexpected %s";
01720       static char const yyexpecting[] = ", expecting %s";
01721       static char const yyor[] = " or %s";
01722       char yyformat[sizeof yyunexpected
01723                     + sizeof yyexpecting - 1
01724                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01725                        * (sizeof yyor - 1))];
01726       char const *yyprefix = yyexpecting;
01727 
01728       /* Start YYX at -YYN if negative to avoid negative indexes in
01729          YYCHECK.  */
01730       int yyxbegin = yyn < 0 ? -yyn : 0;
01731 
01732       /* Stay within bounds of both yycheck and yytname.  */
01733       int yychecklim = YYLAST - yyn + 1;
01734       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01735       int yycount = 1;
01736 
01737       yyarg[0] = yytname[yytype];
01738       yyfmt = yystpcpy (yyformat, yyunexpected);
01739 
01740       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01741         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01742           {
01743             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01744               {
01745                 yycount = 1;
01746                 yysize = yysize0;
01747                 yyformat[sizeof yyunexpected - 1] = '\0';
01748                 break;
01749               }
01750             yyarg[yycount++] = yytname[yyx];
01751             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01752             yysize_overflow |= (yysize1 < yysize);
01753             yysize = yysize1;
01754             yyfmt = yystpcpy (yyfmt, yyprefix);
01755             yyprefix = yyor;
01756           }
01757 
01758       yyf = YY_(yyformat);
01759       yysize1 = yysize + yystrlen (yyf);
01760       yysize_overflow |= (yysize1 < yysize);
01761       yysize = yysize1;
01762 
01763       if (yysize_overflow)
01764         return YYSIZE_MAXIMUM;
01765 
01766       if (yyresult)
01767         {
01768           /* Avoid sprintf, as that infringes on the user's name space.
01769              Don't have undefined behavior even if the translation
01770              produced a string with the wrong number of "%s"s.  */
01771           char *yyp = yyresult;
01772           int yyi = 0;
01773           while ((*yyp = *yyf) != '\0')
01774             {
01775               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01776                 {
01777                   yyp += yytnamerr (yyp, yyarg[yyi++]);
01778                   yyf += 2;
01779                 }
01780               else
01781                 {
01782                   yyp++;
01783                   yyf++;
01784                 }
01785             }
01786         }
01787       return yysize;
01788     }
01789 }
01790 #endif /* YYERROR_VERBOSE */
01791 
01792 
01793 /*-----------------------------------------------.
01794 | Release the memory associated to this symbol.  |
01795 `-----------------------------------------------*/
01796 
01797 /*ARGSUSED*/
01798 #if (defined __STDC__ || defined __C99__FUNC__ \
01799      || defined __cplusplus || defined _MSC_VER)
01800 static void
01801 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, OSInstance *osinstance, OSiLParserData *parserData)
01802 #else
01803 static void
01804 yydestruct (yymsg, yytype, yyvaluep, yylocationp, osinstance, parserData)
01805     const char *yymsg;
01806     int yytype;
01807     YYSTYPE *yyvaluep;
01808     YYLTYPE *yylocationp;
01809     OSInstance *osinstance;
01810     OSiLParserData *parserData;
01811 #endif
01812 {
01813   YYUSE (yyvaluep);
01814   YYUSE (yylocationp);
01815   YYUSE (osinstance);
01816   YYUSE (parserData);
01817 
01818   if (!yymsg)
01819     yymsg = "Deleting";
01820   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01821 
01822   switch (yytype)
01823     {
01824 
01825       default:
01826         break;
01827     }
01828 }
01829 
01830 
01831 /* Prevent warnings from -Wmissing-prototypes.  */
01832 
01833 #ifdef YYPARSE_PARAM
01834 #if defined __STDC__ || defined __cplusplus
01835 int yyparse (void *YYPARSE_PARAM);
01836 #else
01837 int yyparse ();
01838 #endif
01839 #else /* ! YYPARSE_PARAM */
01840 #if defined __STDC__ || defined __cplusplus
01841 int yyparse (OSInstance *osinstance, OSiLParserData *parserData);
01842 #else
01843 int yyparse ();
01844 #endif
01845 #endif /* ! YYPARSE_PARAM */
01846 
01847 
01848 
01849 
01850 
01851 
01852 /*----------.
01853 | yyparse.  |
01854 `----------*/
01855 
01856 #ifdef YYPARSE_PARAM
01857 #if (defined __STDC__ || defined __C99__FUNC__ \
01858      || defined __cplusplus || defined _MSC_VER)
01859 int
01860 yyparse (void *YYPARSE_PARAM)
01861 #else
01862 int
01863 yyparse (YYPARSE_PARAM)
01864     void *YYPARSE_PARAM;
01865 #endif
01866 #else /* ! YYPARSE_PARAM */
01867 #if (defined __STDC__ || defined __C99__FUNC__ \
01868      || defined __cplusplus || defined _MSC_VER)
01869 int
01870 yyparse (OSInstance *osinstance, OSiLParserData *parserData)
01871 #else
01872 int
01873 yyparse (osinstance, parserData)
01874     OSInstance *osinstance;
01875     OSiLParserData *parserData;
01876 #endif
01877 #endif
01878 {
01879   /* The look-ahead symbol.  */
01880 int yychar;
01881 
01882 /* The semantic value of the look-ahead symbol.  */
01883 YYSTYPE yylval;
01884 
01885 /* Number of syntax errors so far.  */
01886 int yynerrs;
01887 /* Location data for the look-ahead symbol.  */
01888 YYLTYPE yylloc;
01889 
01890   int yystate;
01891   int yyn;
01892   int yyresult;
01893   /* Number of tokens to shift before error messages enabled.  */
01894   int yyerrstatus;
01895   /* Look-ahead token as an internal (translated) token number.  */
01896   int yytoken = 0;
01897 #if YYERROR_VERBOSE
01898   /* Buffer for error messages, and its allocated size.  */
01899   char yymsgbuf[128];
01900   char *yymsg = yymsgbuf;
01901   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01902 #endif
01903 
01904   /* Three stacks and their tools:
01905      `yyss': related to states,
01906      `yyvs': related to semantic values,
01907      `yyls': related to locations.
01908 
01909      Refer to the stacks thru separate pointers, to allow yyoverflow
01910      to reallocate them elsewhere.  */
01911 
01912   /* The state stack.  */
01913   yytype_int16 yyssa[YYINITDEPTH];
01914   yytype_int16 *yyss = yyssa;
01915   yytype_int16 *yyssp;
01916 
01917   /* The semantic value stack.  */
01918   YYSTYPE yyvsa[YYINITDEPTH];
01919   YYSTYPE *yyvs = yyvsa;
01920   YYSTYPE *yyvsp;
01921 
01922   /* The location stack.  */
01923   YYLTYPE yylsa[YYINITDEPTH];
01924   YYLTYPE *yyls = yylsa;
01925   YYLTYPE *yylsp;
01926   /* The locations where the error started and ended.  */
01927   YYLTYPE yyerror_range[2];
01928 
01929 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
01930 
01931   YYSIZE_T yystacksize = YYINITDEPTH;
01932 
01933   /* The variables used to return semantic value and location from the
01934      action routines.  */
01935   YYSTYPE yyval;
01936   YYLTYPE yyloc;
01937 
01938   /* The number of symbols on the RHS of the reduced rule.
01939      Keep to zero when no symbol should be popped.  */
01940   int yylen = 0;
01941 
01942   YYDPRINTF ((stderr, "Starting parse\n"));
01943 
01944   yystate = 0;
01945   yyerrstatus = 0;
01946   yynerrs = 0;
01947   yychar = YYEMPTY;             /* Cause a token to be read.  */
01948 
01949   /* Initialize stack pointers.
01950      Waste one element of value and location stack
01951      so that they stay on the same level as the state stack.
01952      The wasted elements are never initialized.  */
01953 
01954   yyssp = yyss;
01955   yyvsp = yyvs;
01956   yylsp = yyls;
01957 #if YYLTYPE_IS_TRIVIAL
01958   /* Initialize the default location before parsing starts.  */
01959   yylloc.first_line   = yylloc.last_line   = 1;
01960   yylloc.first_column = yylloc.last_column = 0;
01961 #endif
01962 
01963   goto yysetstate;
01964 
01965 /*------------------------------------------------------------.
01966 | yynewstate -- Push a new state, which is found in yystate.  |
01967 `------------------------------------------------------------*/
01968  yynewstate:
01969   /* In all cases, when you get here, the value and location stacks
01970      have just been pushed.  So pushing a state here evens the stacks.  */
01971   yyssp++;
01972 
01973  yysetstate:
01974   *yyssp = yystate;
01975 
01976   if (yyss + yystacksize - 1 <= yyssp)
01977     {
01978       /* Get the current used size of the three stacks, in elements.  */
01979       YYSIZE_T yysize = yyssp - yyss + 1;
01980 
01981 #ifdef yyoverflow
01982       {
01983         /* Give user a chance to reallocate the stack.  Use copies of
01984            these so that the &'s don't force the real ones into
01985            memory.  */
01986         YYSTYPE *yyvs1 = yyvs;
01987         yytype_int16 *yyss1 = yyss;
01988         YYLTYPE *yyls1 = yyls;
01989 
01990         /* Each stack pointer address is followed by the size of the
01991            data in use in that stack, in bytes.  This used to be a
01992            conditional around just the two extra args, but that might
01993            be undefined if yyoverflow is a macro.  */
01994         yyoverflow (YY_("memory exhausted"),
01995                     &yyss1, yysize * sizeof (*yyssp),
01996                     &yyvs1, yysize * sizeof (*yyvsp),
01997                     &yyls1, yysize * sizeof (*yylsp),
01998                     &yystacksize);
01999         yyls = yyls1;
02000         yyss = yyss1;
02001         yyvs = yyvs1;
02002       }
02003 #else /* no yyoverflow */
02004 # ifndef YYSTACK_RELOCATE
02005       goto yyexhaustedlab;
02006 # else
02007       /* Extend the stack our own way.  */
02008       if (YYMAXDEPTH <= yystacksize)
02009         goto yyexhaustedlab;
02010       yystacksize *= 2;
02011       if (YYMAXDEPTH < yystacksize)
02012         yystacksize = YYMAXDEPTH;
02013 
02014       {
02015         yytype_int16 *yyss1 = yyss;
02016         union yyalloc *yyptr =
02017           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
02018         if (! yyptr)
02019           goto yyexhaustedlab;
02020         YYSTACK_RELOCATE (yyss);
02021         YYSTACK_RELOCATE (yyvs);
02022         YYSTACK_RELOCATE (yyls);
02023 #  undef YYSTACK_RELOCATE
02024         if (yyss1 != yyssa)
02025           YYSTACK_FREE (yyss1);
02026       }
02027 # endif
02028 #endif /* no yyoverflow */
02029 
02030       yyssp = yyss + yysize - 1;
02031       yyvsp = yyvs + yysize - 1;
02032       yylsp = yyls + yysize - 1;
02033 
02034       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
02035                   (unsigned long int) yystacksize));
02036 
02037       if (yyss + yystacksize - 1 <= yyssp)
02038         YYABORT;
02039     }
02040 
02041   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
02042 
02043   goto yybackup;
02044 
02045 /*-----------.
02046 | yybackup.  |
02047 `-----------*/
02048 yybackup:
02049 
02050   /* Do appropriate processing given the current state.  Read a
02051      look-ahead token if we need one and don't already have one.  */
02052 
02053   /* First try to decide what to do without reference to look-ahead token.  */
02054   yyn = yypact[yystate];
02055   if (yyn == YYPACT_NINF)
02056     goto yydefault;
02057 
02058   /* Not known => get a look-ahead token if don't already have one.  */
02059 
02060   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
02061   if (yychar == YYEMPTY)
02062     {
02063       YYDPRINTF ((stderr, "Reading a token: "));
02064       yychar = YYLEX;
02065     }
02066 
02067   if (yychar <= YYEOF)
02068     {
02069       yychar = yytoken = YYEOF;
02070       YYDPRINTF ((stderr, "Now at end of input.\n"));
02071     }
02072   else
02073     {
02074       yytoken = YYTRANSLATE (yychar);
02075       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
02076     }
02077 
02078   /* If the proper action on seeing token YYTOKEN is to reduce or to
02079      detect an error, take that action.  */
02080   yyn += yytoken;
02081   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
02082     goto yydefault;
02083   yyn = yytable[yyn];
02084   if (yyn <= 0)
02085     {
02086       if (yyn == 0 || yyn == YYTABLE_NINF)
02087         goto yyerrlab;
02088       yyn = -yyn;
02089       goto yyreduce;
02090     }
02091 
02092   if (yyn == YYFINAL)
02093     YYACCEPT;
02094 
02095   /* Count tokens shifted since error; after three, turn off error
02096      status.  */
02097   if (yyerrstatus)
02098     yyerrstatus--;
02099 
02100   /* Shift the look-ahead token.  */
02101   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
02102 
02103   /* Discard the shifted token unless it is eof.  */
02104   if (yychar != YYEOF)
02105     yychar = YYEMPTY;
02106 
02107   yystate = yyn;
02108   *++yyvsp = yylval;
02109   *++yylsp = yylloc;
02110   goto yynewstate;
02111 
02112 
02113 /*-----------------------------------------------------------.
02114 | yydefault -- do the default action for the current state.  |
02115 `-----------------------------------------------------------*/
02116 yydefault:
02117   yyn = yydefact[yystate];
02118   if (yyn == 0)
02119     goto yyerrlab;
02120   goto yyreduce;
02121 
02122 
02123 /*-----------------------------.
02124 | yyreduce -- Do a reduction.  |
02125 `-----------------------------*/
02126 yyreduce:
02127   /* yyn is the number of a rule to reduce with.  */
02128   yylen = yyr2[yyn];
02129 
02130   /* If YYLEN is nonzero, implement the default value of the action:
02131      `$$ = $1'.
02132 
02133      Otherwise, the following line sets YYVAL to garbage.
02134      This behavior is undocumented and Bison
02135      users should not rely upon it.  Assigning to YYVAL
02136      unconditionally makes the parser a bit smaller, and it avoids a
02137      GCC warning that YYVAL may be used uninitialized.  */
02138   yyval = yyvsp[1-yylen];
02139 
02140   /* Default location.  */
02141   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
02142   YY_REDUCE_PRINT (yyn);
02143   switch (yyn)
02144     {
02145         case 4:
02146 
02147     {if(osinstance->instanceData->quadraticCoefficients->numberOfQuadraticTerms > parserData->qtermcount ) 
02148         osilerror( NULL, osinstance, parserData, "actual number of qterms less than numberOfQuadraticTerms");}
02149     break;
02150 
02151   case 5:
02152 
02153     { 
02154 if ( *(yyvsp[(2) - (5)].sval) != *(yyvsp[(4) - (5)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02155 osinstance->instanceData->quadraticCoefficients->numberOfQuadraticTerms = (yyvsp[(3) - (5)].ival);  
02156 if(osinstance->instanceData->quadraticCoefficients->numberOfQuadraticTerms > 0 ) 
02157 osinstance->instanceData->quadraticCoefficients->qTerm = new QuadraticTerm*[ (yyvsp[(3) - (5)].ival) ];
02158 for(int i = 0; i < (yyvsp[(3) - (5)].ival); i++) osinstance->instanceData->quadraticCoefficients->qTerm[i] = new QuadraticTerm();}
02159     break;
02160 
02161   case 8:
02162 
02163     {if(osinstance->instanceData->quadraticCoefficients->numberOfQuadraticTerms <= parserData->qtermcount )
02164  osilerror( NULL, osinstance, parserData, "too many QuadraticTerms");}
02165     break;
02166 
02167   case 9:
02168 
02169     {parserData->qtermcount++; 
02170 if(!parserData->qtermidxattON)  osilerror( NULL, osinstance, parserData, "the qTerm attribute idx is required"); 
02171 if(!parserData->qtermidxOneattON)  osilerror( NULL, osinstance, parserData, "the qTerm attribute idxOne is required"); 
02172 if(!parserData->qtermidxTwoattON)  osilerror( NULL, osinstance, parserData, "the qTerm attribute idxTwo is required"); 
02173 parserData->qtermidattON = false; 
02174 parserData->qtermidxattON = false; 
02175 parserData->qtermidxOneattON = false; 
02176 parserData->qtermidxTwoattON = false;
02177 parserData->qtermcoefattON = false;}
02178     break;
02179 
02180   case 14:
02181 
02182     { if(parserData->qtermidxOneattON) osilerror( NULL, osinstance, parserData, "too many qTerm idxOne attributes"); 
02183                         parserData->qtermidxOneattON = true;  }
02184     break;
02185 
02186   case 15:
02187 
02188     { if(parserData->qtermidxTwoattON) osilerror( NULL, osinstance, parserData, "too many qTerm idxTwo attributes"); 
02189                         parserData->qtermidxTwoattON = true;  }
02190     break;
02191 
02192   case 16:
02193 
02194     { if(parserData->qtermcoefattON) osilerror( NULL, osinstance, parserData, "too many qTerm coef attributes"); 
02195                         parserData->qtermcoefattON = true;  }
02196     break;
02197 
02198   case 17:
02199 
02200     { if(parserData->qtermidxattON) osilerror( NULL, osinstance, parserData, "too many qTerm idx attributes"); 
02201                         parserData->qtermidxattON = true;  }
02202     break;
02203 
02204   case 18:
02205 
02206     {  if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02207 osinstance->instanceData->quadraticCoefficients->qTerm[parserData->qtermcount]->idxOne = (yyvsp[(3) - (4)].ival);
02208         if( (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->variables->numberOfVariables){
02209                 osilerror( NULL, osinstance, parserData, "variable index exceeds number of variables");
02210          }
02211 }
02212     break;
02213 
02214   case 19:
02215 
02216     { if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02217 osinstance->instanceData->quadraticCoefficients->qTerm[parserData->qtermcount]->idxTwo = (yyvsp[(3) - (4)].ival);
02218         if( (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->variables->numberOfVariables){
02219                 osilerror( NULL, osinstance, parserData, "variable index exceeds number of variables");
02220          }
02221 }
02222     break;
02223 
02224   case 20:
02225 
02226     {if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02227 osinstance->instanceData->quadraticCoefficients->qTerm[parserData->qtermcount]->coef = (yyvsp[(3) - (4)].dval);}
02228     break;
02229 
02230   case 21:
02231 
02232     { 
02233 osinstance->instanceData->quadraticCoefficients->qTerm[parserData->qtermcount]->coef = (yyvsp[(3) - (4)].ival);}
02234     break;
02235 
02236   case 22:
02237 
02238     {  if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02239 osinstance->instanceData->quadraticCoefficients->qTerm[parserData->qtermcount]->idx = (yyvsp[(3) - (4)].ival);}
02240     break;
02241 
02242   case 24:
02243 
02244     {  if(parserData->nlnodecount <  parserData->tmpnlcount)  osilerror( NULL, osinstance, parserData, "actual number of nl terms less than number attribute");   }
02245     break;
02246 
02247   case 25:
02248 
02249     { if ( *(yyvsp[(2) - (5)].sval) != *(yyvsp[(4) - (5)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02250 parserData->tmpnlcount = (yyvsp[(3) - (5)].ival);
02251 osinstance->instanceData->nonlinearExpressions->numberOfNonlinearExpressions = (yyvsp[(3) - (5)].ival);  
02252 if(osinstance->instanceData->nonlinearExpressions->numberOfNonlinearExpressions > 0 ) osinstance->instanceData->nonlinearExpressions->nl = new Nl*[ (yyvsp[(3) - (5)].ival) ];
02253 }
02254     break;
02255 
02256   case 27:
02257 
02258     {
02259         // IMPORTANT -- HERE IS WHERE WE CREATE THE EXPRESSION TREE
02260         osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->m_treeRoot = 
02261         parserData->nlNodeVec[ 0]->createExpressionTreeFromPrefix( parserData->nlNodeVec);
02262         parserData->nlnodecount++;
02263 }
02264     break;
02265 
02266   case 29:
02267 
02268     { if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02269 osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount] = new Nl();
02270 osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->idx = (yyvsp[(3) - (4)].ival);
02271 osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree = new OSExpressionTree();
02272 if(parserData->nlnodecount > parserData->tmpnlcount) osilerror( NULL, osinstance, parserData, "actual number of nl terms greater than number attribute");
02273 // clear the vectors of pointers
02274 parserData->nlNodeVec.clear();
02275 parserData->sumVec.clear();
02276 //parserData->allDiffVec.clear();
02277 parserData->maxVec.clear();
02278 parserData->minVec.clear();
02279 parserData->productVec.clear();
02280 }
02281     break;
02282 
02283   case 54:
02284 
02285     {
02286         parserData->nlNodePoint = new OSnLNodeTimes();
02287         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02288 }
02289     break;
02290 
02291   case 56:
02292 
02293     {
02294         parserData->nlNodePoint = new OSnLNodePlus();
02295         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02296 }
02297     break;
02298 
02299   case 58:
02300 
02301     {
02302         parserData->nlNodePoint = new OSnLNodeMinus();
02303         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02304 }
02305     break;
02306 
02307   case 60:
02308 
02309     {
02310         parserData->nlNodePoint = new OSnLNodeNegate();
02311         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02312 }
02313     break;
02314 
02315   case 62:
02316 
02317     { 
02318         parserData->nlNodePoint = new OSnLNodeDivide();
02319         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02320 }
02321     break;
02322 
02323   case 64:
02324 
02325     {
02326         parserData->nlNodePoint = new OSnLNodePower();
02327         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02328 }
02329     break;
02330 
02331   case 66:
02332 
02333     {
02334         parserData->nlNodePoint = new OSnLNodeSum();
02335         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02336         parserData->sumVec.push_back( parserData->nlNodePoint);
02337 }
02338     break;
02339 
02340   case 67:
02341 
02342     {
02343         parserData->sumVec.back()->m_mChildren = new OSnLNode*[ parserData->sumVec.back()->inumberOfChildren];
02344         parserData->sumVec.pop_back();
02345 }
02346     break;
02347 
02348   case 68:
02349 
02350     {   parserData->sumVec.back()->inumberOfChildren++; }
02351     break;
02352 
02353   case 69:
02354 
02355     {   parserData->sumVec.back()->inumberOfChildren++; }
02356     break;
02357 
02358   case 70:
02359 
02360     {
02361         
02362         parserData->nlNodePoint =   new OSnLNodeAllDiff ();
02363         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02364         parserData->allDiffVec.push_back( parserData->nlNodePoint);
02365 }
02366     break;
02367 
02368   case 71:
02369 
02370     {
02371         parserData->allDiffVec.back()->m_mChildren = new OSnLNode*[ parserData->allDiffVec.back()->inumberOfChildren];
02372         parserData->allDiffVec.pop_back();
02373         osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02374 }
02375     break;
02376 
02377   case 72:
02378 
02379     {   parserData->allDiffVec.back()->inumberOfChildren++; }
02380     break;
02381 
02382   case 73:
02383 
02384     {   parserData->allDiffVec.back()->inumberOfChildren++; }
02385     break;
02386 
02387   case 74:
02388 
02389     {
02390         parserData->nlNodePoint = new OSnLNodeMax();
02391         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02392         parserData->maxVec.push_back( parserData->nlNodePoint);
02393 }
02394     break;
02395 
02396   case 75:
02397 
02398     {
02399         parserData->maxVec.back()->m_mChildren = new OSnLNode*[ parserData->maxVec.back()->inumberOfChildren];
02400         parserData->maxVec.pop_back();
02401         osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02402 }
02403     break;
02404 
02405   case 76:
02406 
02407     {   parserData->maxVec.back()->inumberOfChildren++; }
02408     break;
02409 
02410   case 77:
02411 
02412     {   parserData->maxVec.back()->inumberOfChildren++; }
02413     break;
02414 
02415   case 78:
02416 
02417     {
02418         parserData->nlNodePoint = new OSnLNodeMin();
02419         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02420         parserData->minVec.push_back( parserData->nlNodePoint);
02421 }
02422     break;
02423 
02424   case 79:
02425 
02426     {
02427         parserData->minVec.back()->m_mChildren = new OSnLNode*[ parserData->minVec.back()->inumberOfChildren];
02428         parserData->minVec.pop_back();
02429         osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02430 }
02431     break;
02432 
02433   case 80:
02434 
02435     {   parserData->minVec.back()->inumberOfChildren++; }
02436     break;
02437 
02438   case 81:
02439 
02440     {   parserData->minVec.back()->inumberOfChildren++; }
02441     break;
02442 
02443   case 82:
02444 
02445     {
02446         parserData->nlNodePoint = new OSnLNodeProduct();
02447         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02448         parserData->productVec.push_back( parserData->nlNodePoint);
02449 }
02450     break;
02451 
02452   case 83:
02453 
02454     {
02455         parserData->productVec.back()->m_mChildren = new OSnLNode*[ parserData->productVec.back()->inumberOfChildren];
02456         parserData->productVec.pop_back();
02457 }
02458     break;
02459 
02460   case 84:
02461 
02462     {   parserData->productVec.back()->inumberOfChildren++; }
02463     break;
02464 
02465   case 85:
02466 
02467     {   parserData->productVec.back()->inumberOfChildren++; }
02468     break;
02469 
02470   case 86:
02471 
02472     {
02473         parserData->nlNodePoint = new OSnLNodeLn();
02474         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02475 }
02476     break;
02477 
02478   case 88:
02479 
02480     {
02481         parserData->nlNodePoint = new OSnLNodeSqrt();
02482         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02483 }
02484     break;
02485 
02486   case 90:
02487 
02488     {
02489         parserData->nlNodePoint = new OSnLNodeSquare();
02490         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02491 }
02492     break;
02493 
02494   case 92:
02495 
02496     {
02497         parserData->nlNodePoint = new OSnLNodeCos();
02498         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02499 }
02500     break;
02501 
02502   case 94:
02503 
02504     {
02505         parserData->nlNodePoint = new OSnLNodeSin();
02506         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02507 }
02508     break;
02509 
02510   case 96:
02511 
02512     {
02513         parserData->nlNodePoint = new OSnLNodeExp();
02514         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02515 }
02516     break;
02517 
02518   case 98:
02519 
02520     {
02521         parserData->nlNodePoint = new OSnLNodeAbs();
02522         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02523 }
02524     break;
02525 
02526   case 99:
02527 
02528     {
02529 osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02530 }
02531     break;
02532 
02533   case 100:
02534 
02535     {
02536         parserData->nlNodePoint = new OSnLNodeErf();
02537         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02538 }
02539     break;
02540 
02541   case 101:
02542 
02543     {
02544 //osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02545 }
02546     break;
02547 
02548   case 102:
02549 
02550     {
02551         parserData->nlNodePoint = new OSnLNodeIf();
02552         parserData->nlNodeVec.push_back( parserData->nlNodePoint);
02553 }
02554     break;
02555 
02556   case 103:
02557 
02558     {
02559 osinstance->instanceData->nonlinearExpressions->nl[ parserData->nlnodecount]->osExpressionTree->bADMustReTape = true;
02560 }
02561     break;
02562 
02563   case 104:
02564 
02565     {   parserData->nlNodePoint = new OSnLNodeE();
02566         parserData->nlNodeVec.push_back( parserData->nlNodePoint);}
02567     break;
02568 
02569   case 108:
02570 
02571     {   parserData->nlNodePoint = new OSnLNodePI();
02572         parserData->nlNodeVec.push_back( parserData->nlNodePoint);}
02573     break;
02574 
02575   case 112:
02576 
02577     {
02578         parserData->nlNodeNumberPoint = new OSnLNodeNumber();
02579         parserData->nlNodeVec.push_back( parserData->nlNodeNumberPoint);
02580 }
02581     break;
02582 
02583   case 113:
02584 
02585     {parserData->numbervalueattON = false; parserData->numbertypeattON = false; parserData->numberidattON = false;}
02586     break;
02587 
02588   case 118:
02589 
02590     {if(parserData->numbertypeattON) osilerror( NULL, osinstance, parserData, "too many number type attributes"); 
02591                         parserData->numbertypeattON = true; }
02592     break;
02593 
02594   case 119:
02595 
02596     {if(parserData->numbervalueattON) osilerror( NULL, osinstance, parserData, "too many number value attributes"); 
02597                         parserData->numbervalueattON = true; }
02598     break;
02599 
02600   case 120:
02601 
02602     {if(parserData->numberidattON) osilerror( NULL, osinstance, parserData,"too many number id attributes"); 
02603                         parserData->numberidattON = true; }
02604     break;
02605 
02606   case 121:
02607 
02608     {
02609         parserData->nlNodeNumberPoint->type = (yyvsp[(2) - (2)].sval);
02610 }
02611     break;
02612 
02613   case 123:
02614 
02615     {
02616         parserData->nlNodeNumberPoint->id = (yyvsp[(2) - (2)].sval);
02617 }
02618     break;
02619 
02620   case 125:
02621 
02622     {if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02623         parserData->nlNodeNumberPoint->value = (yyvsp[(3) - (4)].dval);
02624 }
02625     break;
02626 
02627   case 126:
02628 
02629     {if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02630         parserData->nlNodeNumberPoint->value = (yyvsp[(3) - (4)].ival);
02631 }
02632     break;
02633 
02634   case 127:
02635 
02636     {
02637         parserData->nlNodeVariablePoint = new OSnLNodeVariable();
02638         parserData->nlNodeVec.push_back( parserData->nlNodeVariablePoint);
02639 }
02640     break;
02641 
02642   case 128:
02643 
02644     {parserData->variablecoefattON = false; parserData->variableidxattON = false;}
02645     break;
02646 
02647   case 130:
02648 
02649     {
02650         parserData->nlNodeVariablePoint->inumberOfChildren = 1;
02651         parserData->nlNodeVariablePoint->m_mChildren = new OSnLNode*[ 1];
02652 }
02653     break;
02654 
02655   case 135:
02656 
02657     {if(parserData->variablecoefattON) osilerror( NULL, osinstance, parserData, "too many variable coef attributes"); 
02658                         parserData->variablecoefattON = true; }
02659     break;
02660 
02661   case 136:
02662 
02663     {if(parserData->variableidxattON) osilerror( NULL, osinstance, parserData, "too many variable idx attributes"); 
02664                         parserData->variableidxattON = true; 
02665                         }
02666     break;
02667 
02668   case 137:
02669 
02670     { if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02671         parserData->nlNodeVariablePoint->coef = (yyvsp[(3) - (4)].dval);
02672 }
02673     break;
02674 
02675   case 138:
02676 
02677     { if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02678         parserData->nlNodeVariablePoint->coef = (yyvsp[(3) - (4)].ival);                
02679 }
02680     break;
02681 
02682   case 139:
02683 
02684     { if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02685         parserData->nlNodeVariablePoint->idx = (yyvsp[(3) - (4)].ival);
02686         if( (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->variables->numberOfVariables){
02687                 osilerror( NULL, osinstance, parserData, "variable index exceeds number of variables");
02688          }
02689 }
02690     break;
02691 
02692   case 142:
02693 
02694     {osinstance->instanceData->timeDomain = new TimeDomain();}
02695     break;
02696 
02697   case 149:
02698 
02699     {
02700         if( osinstance->instanceData->timeDomain->stages->numberOfStages > parserData->stagecount )
02701                 osilerror( NULL, osinstance, parserData, "actual number of stages less than numberOfStages");
02702  /* After stages have been processed, make sure that all variables and constraints have been assigned
02703   * to a stage (uniquely) and all objectives have been assigned as well (possibly more than once).
02704   * For future reference also record the stage to which each variable and constaint belongs. 
02705   */
02706         parserData->m_miVarStageInfo = new int [ osinstance->instanceData->variables->numberOfVariables ];
02707         parserData->m_miObjStageInfo = new int [ osinstance->instanceData->objectives->numberOfObjectives ];
02708         parserData->m_miConStageInfo = new int [ osinstance->instanceData->constraints->numberOfConstraints ];
02709         parserData->nvarcovered = 0;
02710         for (int i = 0; i < osinstance->instanceData->variables->numberOfVariables; i++)
02711                  parserData->m_miVarStageInfo[i] = -1;
02712         for (int i = 0; i < osinstance->instanceData->objectives->numberOfObjectives; i++)
02713                  parserData->m_miObjStageInfo[i] = -1;
02714         for (int i = 0; i < osinstance->instanceData->constraints->numberOfConstraints; i++)
02715                  parserData->m_miConStageInfo[i] = -1;
02716         for (int k = 0; k < osinstance->instanceData->timeDomain->stages->numberOfStages; k++)
02717                 {for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[k]->variables->numberOfVariables; i++)
02718                         {                       
02719                         if (parserData->m_miVarStageInfo[ osinstance->instanceData->timeDomain->stages->stage[k]->variables->var[i]->idx ] != -1)
02720                                         osilerror (NULL, osinstance, parserData, "variable belongs to two stages");
02721                                 parserData->m_miVarStageInfo[ osinstance->instanceData->timeDomain->stages->stage[k]->variables->var[i]->idx ] = k;
02722                         };
02723                  parserData->nvarcovered += osinstance->instanceData->timeDomain->stages->stage[k]->variables->numberOfVariables;
02724                 };
02725         if (parserData->nvarcovered != osinstance->instanceData->variables->numberOfVariables)
02726                 osilerror (NULL, osinstance, parserData, "some variables not assigned to any stage");
02727         parserData->nconcovered = 0;
02728         for (int k = 0; k < osinstance->instanceData->timeDomain->stages->numberOfStages; k++)
02729                 {for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[k]->constraints->numberOfConstraints; i++)
02730                         {if (parserData->m_miConStageInfo[ osinstance->instanceData->timeDomain->stages->stage[k]->constraints->con[i]->idx ] != -1)
02731                                 osilerror (NULL, osinstance, parserData, "constraint belongs to two stages");
02732                                  parserData->m_miConStageInfo[ osinstance->instanceData->timeDomain->stages->stage[k]->constraints->con[i]->idx ] = k;
02733                         };
02734                  parserData->nconcovered += osinstance->instanceData->timeDomain->stages->stage[k]->constraints->numberOfConstraints;
02735                 };
02736         if (parserData->nconcovered != osinstance->instanceData->constraints->numberOfConstraints)
02737                 osilerror (NULL, osinstance, parserData, "some constraints not assigned to any stage");
02738         for (int k = 0; k < osinstance->instanceData->timeDomain->stages->numberOfStages; k++)
02739                 { for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[k]->objectives->numberOfObjectives; i++)
02740                         { if (parserData->m_miObjStageInfo[ -osinstance->instanceData->timeDomain->stages->stage[k]->objectives->obj[i]->idx-1 ] == -1)
02741                                   parserData->m_miObjStageInfo[ -osinstance->instanceData->timeDomain->stages->stage[k]->objectives->obj[i]->idx-1 ] = k;
02742                         };
02743                 };
02744         for (int i = 0; i < osinstance->instanceData->objectives->numberOfObjectives; i++)
02745                 if (parserData->m_miObjStageInfo[i] == -1)
02746                         osilerror (NULL, osinstance, parserData, "some objectives not assigned to any stage");
02747 }
02748     break;
02749 
02750   case 150:
02751 
02752     {osinstance->instanceData->timeDomain->stages = new TimeDomainStages();}
02753     break;
02754 
02755   case 151:
02756 
02757     {
02758         if ( *(yyvsp[(2) - (5)].sval) != *(yyvsp[(4) - (5)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
02759         if ((yyvsp[(3) - (5)].ival) < 1) osilerror (NULL, osinstance, parserData, "number of stages must be positive");
02760         osinstance->instanceData->timeDomain->stages->numberOfStages = (yyvsp[(3) - (5)].ival);
02761         if (osinstance->instanceData->timeDomain->stages->numberOfStages > 0 )
02762                 osinstance->instanceData->timeDomain->stages->stage = new TimeDomainStage*[ (yyvsp[(3) - (5)].ival) ];
02763         for(int i = 0; i < (yyvsp[(3) - (5)].ival); i++) 
02764         {       osinstance->instanceData->timeDomain->stages->stage[i] = new TimeDomainStage();
02765                 osinstance->instanceData->timeDomain->stages->stage[i]->variables   = new TimeDomainStageVariables();
02766                 osinstance->instanceData->timeDomain->stages->stage[i]->constraints = new TimeDomainStageConstraints();
02767                 osinstance->instanceData->timeDomain->stages->stage[i]->objectives  = new TimeDomainStageObjectives();
02768         }
02769 }
02770     break;
02771 
02772   case 154:
02773 
02774     {
02775         if( osinstance->instanceData->timeDomain->stages->numberOfStages <= parserData->stagecount)
02776                 osilerror( NULL, osinstance, parserData, "too many stages");
02777         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables = 0;
02778         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints = 0;
02779         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives = 0;
02780 }
02781     break;
02782 
02783   case 155:
02784 
02785     { /* set defaults for next stage */
02786         parserData->stagenameON = false;
02787         parserData->stageVariablesON = false;
02788         parserData->stageObjectivesON = false;
02789         parserData->stageConstraintsON = false;
02790         parserData->stageVariablesOrdered = false;
02791         parserData->stageObjectivesOrdered = false;
02792         parserData->stageConstraintsOrdered = false;
02793         parserData->stageVariableStartIdx = 0;
02794         parserData->stageObjectiveStartIdx = 0;
02795         parserData->stageConstraintStartIdx = 0;
02796         parserData->stagevarcount = 0;
02797         parserData->stageconcount = 0;
02798         parserData->stageobjcount = 0;
02799         parserData->stagecount++;
02800 }
02801     break;
02802 
02803   case 157:
02804 
02805     {
02806                   osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->name = (yyvsp[(2) - (3)].sval);}
02807     break;
02808 
02809   case 162:
02810 
02811     {
02812         parserData->stageVariablesON = true;
02813         }
02814     break;
02815 
02816   case 167:
02817 
02818     {
02819         if ((yyvsp[(3) - (4)].ival) < 0) osilerror (NULL, osinstance, parserData, "number of variables cannot be negative");
02820         if ((yyvsp[(3) - (4)].ival) > osinstance->instanceData->variables->numberOfVariables)
02821                 osilerror (NULL, osinstance, parserData, "too many variables in this stage");            
02822         if ((yyvsp[(3) - (4)].ival) > 0) {
02823                 if (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables > 0)
02824                         osilerror( NULL, osinstance, parserData, "duplicate attribute numberOfVariables");
02825                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables = (yyvsp[(3) - (4)].ival);
02826                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->var = new TimeDomainStageVar*[ (yyvsp[(3) - (4)].ival) ];
02827                 for (int i = 0; i < (yyvsp[(3) - (4)].ival); i++) 
02828                 {       osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->var[i] = new TimeDomainStageVar;
02829                         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->var[i]->idx = 0; 
02830                 }
02831         };
02832 }
02833     break;
02834 
02835   case 168:
02836 
02837     {
02838         if (parserData->stageVariablesOrdered == true) osilerror (NULL, osinstance, parserData, "duplicate attribute");
02839         if ((yyvsp[(3) - (4)].ival) < 0 && (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->variables->numberOfVariables)
02840                 osilerror (NULL, osinstance, parserData, "variable index out of range");
02841         parserData->stageVariablesOrdered = true;
02842         parserData->stageVariableStartIdx = (yyvsp[(3) - (4)].ival);
02843 }
02844     break;
02845 
02846   case 169:
02847 
02848     {
02849         if ((parserData->stageVariablesOrdered != true) && 
02850                  (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables > 0) ) 
02851                   osilerror (NULL, osinstance, parserData, "varlist missing");
02852         for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables; i++)
02853                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->var[i]->idx = parserData->stageVariableStartIdx + i;
02854         }
02855     break;
02856 
02857   case 170:
02858 
02859     {
02860           if (parserData->stagevarcount < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables)
02861               osilerror (NULL, osinstance, parserData, "too few variables supplied");
02862           }
02863     break;
02864 
02865   case 175:
02866 
02867     {if (parserData->stageVariablesOrdered == true) osilerror (NULL, osinstance, parserData, "no varlist expected");}
02868     break;
02869 
02870   case 177:
02871 
02872     {
02873         if ((yyvsp[(3) - (4)].ival) < 0 && (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->variables->numberOfVariables)
02874                 osilerror (NULL, osinstance, parserData, "variable index out of range");                 
02875         if (parserData->stagevarcount >= osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->numberOfVariables) 
02876             osilerror (NULL, osinstance, parserData, "too many variables in this stage");
02877         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->variables->var[parserData->stagevarcount]->idx = (yyvsp[(3) - (4)].ival);
02878         parserData->stagevarcount++;
02879 }
02880     break;
02881 
02882   case 181:
02883 
02884     {
02885         parserData->stageConstraintsON = true;
02886         }
02887     break;
02888 
02889   case 186:
02890 
02891     {
02892         if ((yyvsp[(3) - (4)].ival) < 0) osilerror (NULL, osinstance, parserData, "number of constraints cannot be negative");
02893         if ((yyvsp[(3) - (4)].ival) > osinstance->instanceData->constraints->numberOfConstraints)
02894                 osilerror (NULL, osinstance, parserData, "too many constraints in this stage");          
02895         if ((yyvsp[(3) - (4)].ival) > 0) {
02896                 if (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints > 0)
02897                         osilerror( NULL, osinstance, parserData, "duplicate attribute numberOfConstraints");
02898                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints = (yyvsp[(3) - (4)].ival);
02899                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->con = new TimeDomainStageCon*[ (yyvsp[(3) - (4)].ival) ];
02900                 for (int i = 0; i < (yyvsp[(3) - (4)].ival); i++) 
02901                 {       osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->con[i] = new TimeDomainStageCon;
02902                         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->con[i]->idx = 0; 
02903                 }
02904         };
02905 }
02906     break;
02907 
02908   case 187:
02909 
02910     {
02911         if (parserData->stageConstraintsOrdered == true) osilerror (NULL, osinstance, parserData, "duplicate attribute");
02912         if ((yyvsp[(3) - (4)].ival) < 0 && (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->constraints->numberOfConstraints)
02913                 osilerror (NULL, osinstance, parserData, "constraint index out of range");
02914         parserData->stageConstraintsOrdered = true;
02915         parserData->stageConstraintStartIdx = (yyvsp[(3) - (4)].ival);
02916 }
02917     break;
02918 
02919   case 188:
02920 
02921     {
02922         if ((parserData->stageConstraintsOrdered != true) && 
02923                  (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints > 0) ) 
02924                   osilerror (NULL, osinstance, parserData, "conlist missing");
02925         for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints; i++)
02926                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->con[i]->idx = parserData->stageConstraintStartIdx + i;
02927         }
02928     break;
02929 
02930   case 189:
02931 
02932     {
02933           if (parserData->stageconcount < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints)
02934               osilerror (NULL, osinstance, parserData, "too few constraints supplied");
02935           }
02936     break;
02937 
02938   case 194:
02939 
02940     {if (parserData->stageConstraintsOrdered == true) osilerror (NULL, osinstance, parserData, "no conlist expected");}
02941     break;
02942 
02943   case 196:
02944 
02945     {
02946         if ((yyvsp[(3) - (4)].ival) < 0 && (yyvsp[(3) - (4)].ival) >= osinstance->instanceData->constraints->numberOfConstraints)
02947                 osilerror (NULL, osinstance, parserData, "constraint index out of range");               
02948         if (parserData->stageconcount >= osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->numberOfConstraints) 
02949             osilerror (NULL, osinstance, parserData, "too many constraints in this stage");
02950         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->constraints->con[parserData->stageconcount]->idx = (yyvsp[(3) - (4)].ival);
02951         parserData->stageconcount++;
02952 }
02953     break;
02954 
02955   case 199:
02956 
02957     { /* By default, an objective belongs to every stage */
02958                         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives = 
02959                                 osinstance->instanceData->objectives->numberOfObjectives;
02960                         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj = 
02961                                 new TimeDomainStageObj*[ osinstance->instanceData->objectives->numberOfObjectives ];
02962                         for (int i = 0; i < osinstance->instanceData->objectives->numberOfObjectives; i++) 
02963                         {       osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[i] = new TimeDomainStageObj;
02964                                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[i]->idx = -(i+1); 
02965                         }
02966         }
02967     break;
02968 
02969   case 200:
02970 
02971     {
02972           parserData->stageObjectivesON = true;
02973         }
02974     break;
02975 
02976   case 205:
02977 
02978     {
02979         if ((yyvsp[(3) - (4)].ival) < 0) osilerror (NULL, osinstance, parserData, "number of objectives cannot be negative");
02980         if ((yyvsp[(3) - (4)].ival) > osinstance->instanceData->objectives->numberOfObjectives)
02981                 osilerror (NULL, osinstance, parserData, "too many objectives in this stage");           
02982         if ((yyvsp[(3) - (4)].ival) > 0) {
02983                 if (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives > 0)
02984                         osilerror( NULL, osinstance, parserData, "duplicate attribute numberOfObjectives");
02985                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives = (yyvsp[(3) - (4)].ival);
02986                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj = new TimeDomainStageObj*[ (yyvsp[(3) - (4)].ival) ];
02987                 for (int i = 0; i < (yyvsp[(3) - (4)].ival); i++) 
02988                 {       osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[i] = new TimeDomainStageObj;
02989                         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[i]->idx = 0; 
02990                 }
02991         };
02992 }
02993     break;
02994 
02995   case 206:
02996 
02997     {
02998         if (parserData->stageObjectivesOrdered == true) osilerror (NULL, osinstance, parserData, "duplicate attribute");
02999         if ((yyvsp[(3) - (4)].ival) >= 0 && (yyvsp[(3) - (4)].ival) <= -osinstance->instanceData->objectives->numberOfObjectives - 1)
03000                 osilerror (NULL, osinstance, parserData, "objective index out of range");
03001         parserData->stageObjectivesOrdered = true;
03002         parserData->stageObjectiveStartIdx = (yyvsp[(3) - (4)].ival);
03003 }
03004     break;
03005 
03006   case 207:
03007 
03008     {
03009         if ((parserData->stageObjectivesOrdered != true) && 
03010                  (osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives > 0) ) 
03011                   osilerror (NULL, osinstance, parserData, "objlist missing");
03012         for (int i = 0; i < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives; i++)
03013                 osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[i]->idx = parserData->stageObjectiveStartIdx - i;
03014         }
03015     break;
03016 
03017   case 208:
03018 
03019     {
03020           if (parserData->stageobjcount < osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives)
03021               osilerror (NULL, osinstance, parserData, "too few objectives supplied");
03022         }
03023     break;
03024 
03025   case 213:
03026 
03027     {if (parserData->stageObjectivesOrdered == true) osilerror (NULL, osinstance, parserData, "no objlist expected");}
03028     break;
03029 
03030   case 215:
03031 
03032     {
03033         if ((yyvsp[(3) - (4)].ival) >= 0 && (yyvsp[(3) - (4)].ival) >= -osinstance->instanceData->objectives->numberOfObjectives - 1)
03034                 osilerror (NULL, osinstance, parserData, "objective index out of range");                
03035         if (parserData->stageobjcount >= osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->numberOfObjectives) 
03036             osilerror (NULL, osinstance, parserData, "too many objectives in this stage");
03037         osinstance->instanceData->timeDomain->stages->stage[parserData->stagecount]->objectives->obj[parserData->stageobjcount]->idx = (yyvsp[(3) - (4)].ival);
03038         parserData->stageobjcount++;
03039 }
03040     break;
03041 
03042   case 218:
03043 
03044     {osinstance->instanceData->timeDomain->interval = new TimeDomainInterval();
03045         }
03046     break;
03047 
03048   case 219:
03049 
03050     {
03051                 parserData->intervalhorizonON = false;
03052                 parserData->intervalstartON = false;
03053                 printf("Interval not yet supported.\n\n");
03054 }
03055     break;
03056 
03057   case 224:
03058 
03059     { if(parserData->intervalhorizonON) 
03060        osilerror( NULL, osinstance, parserData, "too many interval horizon attributes");
03061                 parserData->intervalhorizonON = true; }
03062     break;
03063 
03064   case 225:
03065 
03066     { if(parserData->intervalstartON) 
03067        osilerror( NULL, osinstance, parserData, "too many interval start attributes");
03068                 parserData->intervalstartON = true; }
03069     break;
03070 
03071   case 226:
03072 
03073     {
03074                 if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
03075                 parserData->intervalhorizon = (yyvsp[(3) - (4)].dval);}
03076     break;
03077 
03078   case 227:
03079 
03080     {
03081                 if ( *(yyvsp[(2) - (4)].sval) != *(yyvsp[(4) - (4)].sval) ) osilerror( NULL, osinstance, parserData, "start and end quotes are not the same");
03082                 parserData->intervalstart = (yyvsp[(3) - (4)].dval);}
03083     break;
03084 
03085 
03086 /* Line 1267 of yacc.c.  */
03087 
03088       default: break;
03089     }
03090   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
03091 
03092   YYPOPSTACK (yylen);
03093   yylen = 0;
03094   YY_STACK_PRINT (yyss, yyssp);
03095 
03096   *++yyvsp = yyval;
03097   *++yylsp = yyloc;
03098 
03099   /* Now `shift' the result of the reduction.  Determine what state
03100      that goes to, based on the state we popped back to and the rule
03101      number reduced by.  */
03102 
03103   yyn = yyr1[yyn];
03104 
03105   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
03106   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
03107     yystate = yytable[yystate];
03108   else
03109     yystate = yydefgoto[yyn - YYNTOKENS];
03110 
03111   goto yynewstate;
03112 
03113 
03114 /*------------------------------------.
03115 | yyerrlab -- here on detecting error |
03116 `------------------------------------*/
03117 yyerrlab:
03118   /* If not already recovering from an error, report this error.  */
03119   if (!yyerrstatus)
03120     {
03121       ++yynerrs;
03122 #if ! YYERROR_VERBOSE
03123       yyerror (&yylloc, osinstance, parserData, YY_("syntax error"));
03124 #else
03125       {
03126         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
03127         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
03128           {
03129             YYSIZE_T yyalloc = 2 * yysize;
03130             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
03131               yyalloc = YYSTACK_ALLOC_MAXIMUM;
03132             if (yymsg != yymsgbuf)
03133               YYSTACK_FREE (yymsg);
03134             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
03135             if (yymsg)
03136               yymsg_alloc = yyalloc;
03137             else
03138               {
03139                 yymsg = yymsgbuf;
03140                 yymsg_alloc = sizeof yymsgbuf;
03141               }
03142           }
03143 
03144         if (0 < yysize && yysize <= yymsg_alloc)
03145           {
03146             (void) yysyntax_error (yymsg, yystate, yychar);
03147             yyerror (&yylloc, osinstance, parserData, yymsg);
03148           }
03149         else
03150           {
03151             yyerror (&yylloc, osinstance, parserData, YY_("syntax error"));
03152             if (yysize != 0)
03153               goto yyexhaustedlab;
03154           }
03155       }
03156 #endif
03157     }
03158 
03159   yyerror_range[0] = yylloc;
03160 
03161   if (yyerrstatus == 3)
03162     {
03163       /* If just tried and failed to reuse look-ahead token after an
03164          error, discard it.  */
03165 
03166       if (yychar <= YYEOF)
03167         {
03168           /* Return failure if at end of input.  */
03169           if (yychar == YYEOF)
03170             YYABORT;
03171         }
03172       else
03173         {
03174           yydestruct ("Error: discarding",
03175                       yytoken, &yylval, &yylloc, osinstance, parserData);
03176           yychar = YYEMPTY;
03177         }
03178     }
03179 
03180   /* Else will try to reuse look-ahead token after shifting the error
03181      token.  */
03182   goto yyerrlab1;
03183 
03184 
03185 /*---------------------------------------------------.
03186 | yyerrorlab -- error raised explicitly by YYERROR.  |
03187 `---------------------------------------------------*/
03188 yyerrorlab:
03189 
03190   /* Pacify compilers like GCC when the user code never invokes
03191      YYERROR and the label yyerrorlab therefore never appears in user
03192      code.  */
03193   if (/*CONSTCOND*/ 0)
03194      goto yyerrorlab;
03195 
03196   yyerror_range[0] = yylsp[1-yylen];
03197   /* Do not reclaim the symbols of the rule which action triggered
03198      this YYERROR.  */
03199   YYPOPSTACK (yylen);
03200   yylen = 0;
03201   YY_STACK_PRINT (yyss, yyssp);
03202   yystate = *yyssp;
03203   goto yyerrlab1;
03204 
03205 
03206 /*-------------------------------------------------------------.
03207 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
03208 `-------------------------------------------------------------*/
03209 yyerrlab1:
03210   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
03211 
03212   for (;;)
03213     {
03214       yyn = yypact[yystate];
03215       if (yyn != YYPACT_NINF)
03216         {
03217           yyn += YYTERROR;
03218           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
03219             {
03220               yyn = yytable[yyn];
03221               if (0 < yyn)
03222                 break;
03223             }
03224         }
03225 
03226       /* Pop the current state because it cannot handle the error token.  */
03227       if (yyssp == yyss)
03228         YYABORT;
03229 
03230       yyerror_range[0] = *yylsp;
03231       yydestruct ("Error: popping",
03232                   yystos[yystate], yyvsp, yylsp, osinstance, parserData);
03233       YYPOPSTACK (1);
03234       yystate = *yyssp;
03235       YY_STACK_PRINT (yyss, yyssp);
03236     }
03237 
03238   if (yyn == YYFINAL)
03239     YYACCEPT;
03240 
03241   *++yyvsp = yylval;
03242 
03243   yyerror_range[1] = yylloc;
03244   /* Using YYLLOC is tempting, but would change the location of
03245      the look-ahead.  YYLOC is available though.  */
03246   YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
03247   *++yylsp = yyloc;
03248 
03249   /* Shift the error token.  */
03250   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
03251 
03252   yystate = yyn;
03253   goto yynewstate;
03254 
03255 
03256 /*-------------------------------------.
03257 | yyacceptlab -- YYACCEPT comes here.  |
03258 `-------------------------------------*/
03259 yyacceptlab:
03260   yyresult = 0;
03261   goto yyreturn;
03262 
03263 /*-----------------------------------.
03264 | yyabortlab -- YYABORT comes here.  |
03265 `-----------------------------------*/
03266 yyabortlab:
03267   yyresult = 1;
03268   goto yyreturn;
03269 
03270 #ifndef yyoverflow
03271 /*-------------------------------------------------.
03272 | yyexhaustedlab -- memory exhaustion comes here.  |
03273 `-------------------------------------------------*/
03274 yyexhaustedlab:
03275   yyerror (&yylloc, osinstance, parserData, YY_("memory exhausted"));
03276   yyresult = 2;
03277   /* Fall through.  */
03278 #endif
03279 
03280 yyreturn:
03281   if (yychar != YYEOF && yychar != YYEMPTY)
03282      yydestruct ("Cleanup: discarding lookahead",
03283                  yytoken, &yylval, &yylloc, osinstance, parserData);
03284   /* Do not reclaim the symbols of the rule which action triggered
03285      this YYABORT or YYACCEPT.  */
03286   YYPOPSTACK (yylen);
03287   YY_STACK_PRINT (yyss, yyssp);
03288   while (yyssp != yyss)
03289     {
03290       yydestruct ("Cleanup: popping",
03291                   yystos[*yyssp], yyvsp, yylsp, osinstance, parserData);
03292       YYPOPSTACK (1);
03293     }
03294 #ifndef yyoverflow
03295   if (yyss != yyssa)
03296     YYSTACK_FREE (yyss);
03297 #endif
03298 #if YYERROR_VERBOSE
03299   if (yymsg != yymsgbuf)
03300     YYSTACK_FREE (yymsg);
03301 #endif
03302   /* Make sure YYID is used.  */
03303   return YYID (yyresult);
03304 }
03305 
03306 
03307 
03308 
03309 
03310 
03311 // user defined functions
03312 
03313 void osilerror(YYLTYPE* mytype, OSInstance *osinstance, OSiLParserData* parserData, const char* errormsg ) {
03314         std::ostringstream outStr;
03315         std::string error = errormsg;
03316         error = "PARSER ERROR:  Input is either not valid or well formed: "  + error;
03317         outStr << error << endl;
03318         outStr << endl; 
03319         outStr << "See line number: " << osilget_lineno( scanner) << endl; 
03320         outStr << "The offending text is: " << osilget_text ( scanner ) << endl; 
03321         error = outStr.str();
03322         //osillex_destroy(scanner);
03323         throw ErrorClass( error);
03324 }//end osilerror() 
03325 
03326 
03327 void  yygetOSInstance( const char *osil, OSInstance* osinstance, OSiLParserData *parserData) throw (ErrorClass) {
03328         try {
03329                 parseInstanceHeader( &osil, osinstance, &parserData->osillineno);
03330                 parseInstanceData( &osil, osinstance, &parserData->osillineno); 
03336                 osil_scan_string( osil, scanner );
03337                 osilset_lineno (parserData->osillineno , scanner );
03338                 //
03339                 // call the Bison parser
03340                 //
03341                 if(  osilparse( osinstance,  parserData) != 0) {
03342                         throw ErrorClass(  "Error parsing the OSiL");
03343                 }
03344         }
03345         catch(const ErrorClass& eclass){
03346                 throw ErrorClass(  eclass.errormsg); 
03347         }
03348 }//end yygetOSInstance
03349 
03350 bool isnewline(char c, int* osillineno){
03351         if(c != '\n') return false;
03352         (*osillineno)++;
03353         return true;
03354 }//end isnewline()
03355 
03356 bool parseInstanceHeader( const char **p, OSInstance *osinstance, int* osillineno){
03357         //
03358         *osillineno = 1;
03359         const char *pchar = *p;
03360         // create a char array that holds the instance header information
03361         const char *startInstanceHeader = "<instanceHeader";
03362         const char *endInstanceHeader = "</instanceHeader";
03363         const char *startName = "<name";
03364         const char *endName = "</name";
03365         const char *startSource = "<source";
03366         const char *endSource = "</source";
03367         const char *startDescription = "<description";
03368         const char *endDescription = "</description";
03369         const char *pinstanceHeadStart = strstr(pchar, startInstanceHeader);
03370         char *pelementText = NULL;
03371         const char *ptemp = NULL;
03372         int elementSize;
03373         if(pinstanceHeadStart == NULL) {  osilerror_wrapper( pchar,osillineno,"<instanceHeader> element missing"); return false;}
03374         // increment the line number counter if there are any newlines between the start of
03375         // the osil string and pinstanceHeadStart
03376         int     kount = pinstanceHeadStart - pchar;
03377         while( kount-- > 0) if(*(pchar++) == '\n')      (*osillineno)++;
03378         // important! pchar now points to the '<' in <instanceHeader
03379         // that is both pinstanceHeadStart and pchar point to the same thing
03380         // 
03381         // move to the end of <instanceHeader
03382         pchar+=15;
03383         // burn any whitespace
03384         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03385         // pchar better be pointing to the '>' in the <instanceHeader> element
03386         // or to /> if we have <instanceHeader />
03387         if( *pchar == '/'){
03388                 pchar++;
03389                 // better point to a '>'
03390                 if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <instanceHeader> element"); return false;}
03391                 // there is no instanceHeader data
03392                 pchar++;
03393                 return true;
03394         }
03395         else{
03396                 // pchar better be '>' or there is an error
03397                 if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <instanceHeader> element"); return false;}
03398         }
03399         pchar++;
03400         // we are pointing to the character after <instanceHeader>
03401         //
03402         //
03403         //
03404         // process the <name> element which is optional
03405         //
03406         // first burn any whitespace
03407         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03408         // if, present we should be pointing to <name element if there -- it is not required
03409         //remember where we are
03410         *p = pchar;
03411         while(*startName++  == *pchar) pchar++;
03412         if( (pchar - *p)  != 5) {
03413                 //reset pchar
03414                 pchar = *p;
03415         }
03416         else{
03417         // we have a name element, process the text
03418         // burn the whitespace
03419                 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03420                 if( *pchar == '/'){
03421                         pchar++;
03422                         // better point to a '>'
03423                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <name> element"); return false;}
03424                 }
03425                 else{
03426                         // pchar better be '>' or there is an error
03427                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <name> element"); return false;}
03428                         pchar++;
03429                         // proces <name> element text
03430                         // there better be a </name
03431                         ptemp = strstr( pchar, endName);
03432                         if( ptemp == NULL) {  osilerror_wrapper( pchar,osillineno,"improperly formed </name> element"); return false;}
03433                         elementSize = ptemp - pchar;
03434                         pelementText = new char[ elementSize + 1];
03435                         strncpy(pelementText, pchar, elementSize);
03436                         pelementText[ elementSize] = '\0';
03437                         osinstance->instanceHeader->name = pelementText;
03438                         //garbage collection
03439                         delete [] pelementText;
03440                         // move pchar up to the end of </name
03441                         while(elementSize-- > 0){
03442                                 if(*pchar++ == '\n') (*osillineno)++;
03443                         }
03444                         // pchar should now be pointing to the start of </name
03445                         // move to first char after </name
03446                         pchar += 6;
03447                         // get rid of the whitespace
03448                         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03449                         // we better have the '>' for the end of name
03450                         if(*pchar++ != '>'){  osilerror_wrapper( pchar,osillineno,"improperly formed </name> element"); return false;}
03451                 }
03452         }// end of else after discovering a name element
03453         //done processing name element
03454         //
03455         //
03456         // process the <source> element which is optional
03457         //
03458         // first burn any whitespace
03459         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03460         // if, present we should be pointing to <source element if there -- it is not required
03461         *p = pchar;
03462         while(*startSource++  == *pchar) pchar++;
03463         if(pchar - *p != 7) {
03464                 //reset pchar
03465                 pchar = *p;
03466         }
03467         else{
03468         // we have a source element, process the text
03469         // burn the whitespace
03470                 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03471                 if( *pchar == '/'){
03472                         pchar++;
03473                         // better point to a '>'
03474                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <source> element"); return false;}
03475                 }
03476                 else{
03477                         // pchar better be '>' or there is an error
03478                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <source> element"); return false;}
03479                         pchar++;
03480                         // proces <source> element text
03481                         // there better be a </source
03482                         ptemp = strstr( pchar, endSource);
03483                         if( ptemp == NULL) {  osilerror_wrapper( pchar,osillineno,"improperly formed </source> element"); return false;}
03484                         elementSize = ptemp - pchar;
03485                         pelementText = new char[ elementSize + 1];
03486                         strncpy(pelementText, pchar, elementSize);
03487                         pelementText[ elementSize] = '\0';
03488                         osinstance->instanceHeader->source = pelementText;
03489                         //garbage collection
03490                         delete [] pelementText;
03491                         // move pchar up to the end of </source
03492                         while(elementSize-- > 0){
03493                                 if(*pchar++ == '\n') (*osillineno)++;
03494                         }
03495                         // pchar should now be pointing to the start of </source
03496                         // move to first char after </source
03497                         pchar += 8;
03498                         // get rid of the whitespace
03499                         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03500                         // we better have the '>' for the end of source
03501                         if(*pchar++ != '>'){  osilerror_wrapper( pchar,osillineno,"improperly formed </source> element"); return false;}
03502                 }
03503         }// end of else after discovering a source element
03504         //done processing <source> element
03505         //
03506         //
03507         //process the <description> element
03508         //
03509         // first burn any whitespace
03510         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03511         // if, present we should be pointing to <description element if there -- it is not required
03512         *p = pchar;
03513         while(*startDescription++  == *pchar) pchar++;
03514         if( (pchar - *p) != 12) {
03515                 //reset pchar
03516                 pchar = *p;
03517         }
03518         else{
03519         // we have a description element, process the text
03520         // burn the whitespace
03521                 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03522                 if( *pchar == '/'){
03523                         pchar++;
03524                         // better point to a '>'
03525                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <description> element"); return false;}
03526                 }
03527                 else{
03528                         // pchar better be '>' or there is an error
03529                         if(*pchar != '>') {  osilerror_wrapper( pchar,osillineno,"improperly formed <description> element"); return false;}
03530                         pchar++;
03531                         // proces <source> element text
03532                         // there better be a </description
03533                         ptemp = strstr( pchar, endDescription);
03534                         if( ptemp == NULL) {  osilerror_wrapper( pchar,osillineno,"improperly formed </description> element"); return false;}
03535                         elementSize = ptemp - pchar;
03536                         pelementText = new char[ elementSize + 1];
03537                         strncpy(pelementText, pchar, elementSize);
03538                         pelementText[ elementSize] = '\0';
03539                         osinstance->instanceHeader->description = pelementText;
03540                         //garbage collection
03541                         delete [] pelementText;
03542                         // move pchar up to the end of </description
03543                         while(elementSize-- > 0){
03544                                 if(*pchar++ == '\n') (*osillineno)++;
03545                         }
03546                         // pchar should now be pointing to the start of </description
03547                         // move to first char after </description
03548                         pchar += 13;
03549                         // get rid of the whitespace
03550                         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03551                         // we better have the '>' for the end of </description>
03552                         if(*pchar++ != '>'){  osilerror_wrapper( pchar,osillineno,"improperly formed </description> element"); return false;}
03553                 }
03554         }// end of else after discovering a description element
03555         //done processing <description> element
03556         //
03557         // if we are here there must be an </instanceHeader > element
03558         // burn the whitespace
03559         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03560         // we should be pointing to </instanceHeader
03561         *p = pchar;
03562         while(*endInstanceHeader++  == *pchar) pchar++;
03563         if( (pchar - *p) != 16) {  osilerror_wrapper( pchar,osillineno,"improperly formed </instanceHeader> element"); return false;}   
03564         // pchar now points to the first character after </instanceHeader
03565         // get rid of white space
03566         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03567         // pchar must point to '>' or there is an error
03568         if(*pchar != '>'){  osilerror_wrapper( pchar,osillineno,"improperly formed </instanceHeader> element"); return false;}  
03569         pchar++;
03570         *p = pchar;
03571         return true;
03572 }//end parseInstanceHeader
03573 
03574 
03575 bool parseInstanceData( const char **p, OSInstance *osinstance, int* osillineno){
03576         //
03577         const char *pchar = *p;
03578         const char *startInstanceData = "<instanceData";
03579         // at this point *pchar should be pointing to the first char after the > in </instanceHeader>
03580         // burn the white space
03581         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03582         // pchar should be point to a '<', if not there is an error
03583         if(*pchar != '<'){  osilerror_wrapper( pchar,osillineno,"improperly formed <instanceData element"); return false;}
03584         // make sure the element is <instanceData       
03585         *p = pchar;
03586         while(*startInstanceData++  == *pchar) pchar++;
03587         if( (pchar - *p) != 13) {  osilerror_wrapper( pchar,osillineno,"improperly formed <instanceData> element"); return false;}      
03588         // now burn whitespace
03589         // pchar must point to '>' or there is an error
03590         if(*pchar != '>'){  osilerror_wrapper( pchar,osillineno,"improperly formed <instanceData> element"); return false;}     
03591         pchar++;
03592         // we are now pointing to the first char after <instanceData>
03593         // burn any whitespace
03594         for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;     
03595         // we should be pointing to the '<' char in <variables>
03596         *p = pchar;
03597         if( parseVariables( p, osinstance, osillineno) != true) {throw ErrorClass("error in parse variables");}
03598         if( parseObjectives( p, osinstance, osillineno) != true)  throw ErrorClass("error in parse objectives");
03599         if( parseConstraints( p, osinstance, osillineno) != true) throw ErrorClass("error in parse Constraints");
03600         if( parseLinearConstraintCoefficients( p, osinstance, osillineno) != true) throw ErrorClass("error in parse ConstraintCoefficients");
03601         
03602         //
03603         return true;
03604 }// end parseInstanceData
03605 
03606 
03607 bool parseVariables( const char **p,  OSInstance *osinstance, int* osillineno){
03608         clock_t start, finish;
03609         //double duration;
03610         int ki, numChar;
03611         char *attTextEnd;
03612         const char *ch = *p;
03613         start = clock(); 
03614         const char *c_numberOfVariables = "numberOfVariables";
03615         const char *startVariables = "<variables";
03616         const char *endVariables = "</variables";
03617         const char *startVar = "<var";
03618         const char *endVar = "</var";
03619         // the attributes
03620         char *attText = NULL;
03621         const char *name = "name";
03622         //const char *initString = "initString";
03623         const char *type = "type";
03624         const char *mult = "mult";
03625         // others
03626         int i;
03627         int varcount = 0;
03628         int numberOfVariables = 0;
03629 // variable attribute boolean variables
03630         bool varlbattON  = false;
03631         bool varubattON = false ;
03632         bool vartypeattON  = false;
03633         bool varnameattON = false ;
03634         //bool varinitattON = false ;
03635         //bool varinitStringattON = false ;
03636         bool varmultattON = false;
03637         bool foundVar = false;
03638         //
03639         // start parsing
03640         *p = ch;
03641         while(*startVariables++  == *ch) ch++;
03642         if( (ch - *p) != 10) {  osilerror_wrapper( ch,osillineno,"incorrect <variables tag>"); return false;}
03643         // find numberOfVariables attribute
03644         // eat the white space
03645         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03646         *p = ch;
03647         while(*c_numberOfVariables++  == *ch) ch++;
03648         if( (ch - *p) != 17) {  osilerror_wrapper( ch,osillineno,"incorrect numberOfVariables attribute in <variables tag>"); return false;}    
03649         // buf_index should be pointing to the first character after numberOfVariables
03650         GETATTRIBUTETEXT;
03651         ch++;
03652         numberOfVariables = atoimod1( osillineno, attText, attTextEnd);
03653         delete [] attText;
03654         if(numberOfVariables <= 0) {
03655                 osilerror_wrapper( ch,osillineno,"there must be at least one variable"); return false;
03656         }
03657         osinstance->instanceData->variables->numberOfVariables = numberOfVariables;
03658         osinstance->instanceData->variables->var = new Variable*[ numberOfVariables];
03659         for(i = 0; i < numberOfVariables; i++){
03660                 osinstance->instanceData->variables->var[ i] = new Variable();
03661         } 
03662         // get rid of white space after the numberOfVariables element
03663         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ )                     
03664         // since there must be at least one variable,  this element must end with > 
03665         // better have an > sign or not valid
03666         if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"variables element does not have a proper closing >"); return false;}
03667         ch++;
03668         // get rid of white space
03669         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03670         // now loop over the var elements, there must be at least one var element
03671         *p = ch;                                            
03672         while(*startVar++  == *ch) ch++;
03673         if( (ch - *p) ==  4) foundVar = true;
03674                 else {  osilerror_wrapper( ch,osillineno,"there must be at least one <var> element"); return false;}
03675         startVar -= 5;
03676         while(foundVar){
03677                 varlbattON  = false;
03678                 varubattON = false ;
03679                 vartypeattON  = false;
03680                 varnameattON = false ;
03681                 //varinitattON = false ; 
03682                 //varinitStringattON = false ;
03683                 varmultattON = false;
03684                 foundVar = false;
03685                 // assume we are pointing to the first character after the r in <var
03686                 // it should be whitespace
03687                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03688                 while(*ch != '/' && *ch != '>'){
03689                         switch (*ch) {
03690                         case 'n':
03691                                 *p = ch;
03692                                 while(*name++  == *ch) ch++;
03693                                 if( (ch - *p) != 4 ) {  osilerror_wrapper( ch,osillineno,"error in variables name attribute"); return false;}
03694                                 name -= 5;
03695                                 if(varnameattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable name attributes"); return false;}
03696                                 varnameattON = true;
03697                                 GETATTRIBUTETEXT;
03698                                 osinstance->instanceData->variables->var[varcount]->name=attText;
03699                                 delete [] attText;
03700                                 //printf("ATTRIBUTE = %s\n", attText);
03701                                 break;
03702                                 /*
03703                         case 'i':
03704                                 *p = ch;
03705                                 while(*initString++  == *ch) ch++;
03706                                 // if i < 4 there is an error
03707                                 // if i = 4 we matched init
03708                                 // if i = 10 we matched initString
03709                                 if( ( (ch - *p) != 4)  && ( (ch - *p) != 10)) {  osilerror_wrapper( ch,osillineno,"error in variables init or initString attribute"); return false;}
03710                                 if((ch - *p) == 4){
03711                                         if(varinitattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable init attributes"); return false;}
03712                                         varinitattON = true;
03713                                         GETATTRIBUTETEXT;
03714                                         //printf("ATTRIBUTE = %s\n", attText);
03715                                         osinstance->instanceData->variables->var[varcount]->init=atofmod1( osillineno,attText, attTextEnd);
03716                                         delete [] attText;
03717                                         initString -= 5;
03718                                 }
03719                                 else{
03720                                         if(varinitStringattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable initString attributes"); return false;}
03721                                         varinitStringattON = true;
03722                                         GETATTRIBUTETEXT;
03723                                         //printf("ATTRIBUTE = %s\n", attText);
03724                                         osinstance->instanceData->variables->var[varcount]->initString=attText;
03725                                         delete [] attText;
03726                                         initString -= 11;
03727                                 }
03728                                 break;
03729                                 */
03730                         case 't':
03731                                 *p = ch;
03732                                 while(*type++  == *ch) ch++;
03733                                 if( (ch - *p) != 4) {  osilerror_wrapper( ch,osillineno,"error in variables type attribute"); return false;}
03734                                 type -= 5;
03735                                 if(vartypeattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable type attributes"); return false;}
03736                                 vartypeattON = true;
03737                                 GETATTRIBUTETEXT;
03738                                 if( strchr("CBIS", attText[0]) == NULL ) {  osilerror_wrapper( ch,osillineno,"variable type not C,B,I, or S"); return false;}
03739                                 osinstance->instanceData->variables->var[varcount]->type = attText[0];
03740                                 if (strchr("B",    attText[0]) != NULL) osinstance->instanceData->variables->var[varcount]->ub = 1.0;
03741                                 delete [] attText;
03742                                 break;
03743                         case 'l':
03744                                 ch++;
03745                                 if(*ch++ != 'b') {  osilerror_wrapper( ch,osillineno,"error in variables lower bound attribute"); return false;}
03746                                 if(varlbattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable lb attributes"); return false;}
03747                                 varlbattON = true;
03748                                 GETATTRIBUTETEXT;
03749                                 osinstance->instanceData->variables->var[varcount]->lb = atofmod1( osillineno,attText, attTextEnd);
03750                                 delete [] attText;
03751                                 //printf("ATTRIBUTE = %s\n", attText);
03752                                 break;
03753                         case 'u':
03754                                 ch++;
03755                                 if(*ch++ != 'b') {  osilerror_wrapper( ch,osillineno,"error in variables upper bound attribute"); return false;}
03756                                 if(varubattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable ub attributes"); return false;}
03757                                 varubattON = true;
03758                                 GETATTRIBUTETEXT;
03759                                 osinstance->instanceData->variables->var[varcount]->ub = atofmod1( osillineno,attText, attTextEnd);
03760                                 delete [] attText;
03761                                 //printf("ATTRIBUTE = %s\n", attText);
03762                                 break;
03763                         case 'm':
03764                                 *p = ch;
03765                                 while(*mult++  == *ch) ch++;
03766                                 if( (ch - *p) != 4) {  osilerror_wrapper( ch,osillineno,"error in variables mult attribute"); return false;}
03767                                 mult -= 5;
03768                                 if(varmultattON == true) {  osilerror_wrapper( ch,osillineno,"error too many variable mult attributes"); return false;}
03769                                 varmultattON = true;
03770                                 GETATTRIBUTETEXT;
03771                                 delete [] attText;
03772                                 //printf("ATTRIBUTE = %s\n", attText);
03773                                 break;
03774                         case ' ':
03775                                 break;
03776                         case '\n':
03777                                 (*osillineno)++;
03778                                 break;
03779                         case '\t':
03780                                 break;
03781                         case '\r':
03782                                 break;
03783                         default:
03784                                 {  osilerror_wrapper( ch,osillineno,"invalid attribute character"); return false;}
03785                                 break;
03786                         }
03787                         ch++;
03788                 }
03789                 //
03790                 // assume all the attributes have been processed
03791                 // must have either /> or > and then whitespace and </var whitespace>
03792                 if( *ch != '/' && *ch != '>') {  osilerror_wrapper( ch,osillineno,"incorrect end of <var> element"); return false;}
03793                 if(*ch == '/'){
03794                         ch++;
03795                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"incorrect end of <var> element"); return false;}
03796                         // get rid of whitespace
03797                         ch++;
03798                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03799                         // either have another <var> element or foundVar = false;
03800                         *p = ch;
03801                         while(*startVar++  == *ch) ch++;
03802                         if( (ch - *p) == 4) {
03803                                 foundVar = true;
03804                                 startVar -= 5;
03805                         }
03806                         else {
03807                                 foundVar = false;
03808                                 ch = *p;
03809                         }
03810                 }
03811                 else{
03812                         // the buf_index is the > at the end of the var element 
03813                         // double check to make sure it really is a >
03814                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improper ending to a <var> element"); return false;}
03815                         // look for </var
03816                         // fist get rid of white space
03817                         ch++;
03818                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03819                         // we should be at </var or there is an error
03820                         *p = ch;
03821                         while(*endVar++  == *ch) ch++;
03822                         endVar -= 6;
03823                         if( (ch - *p) != 5) {  osilerror_wrapper( ch,osillineno,"</var> element missing"); return false;}
03824                         // burn off the whitespace
03825                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03826                         // better have an > to end </var
03827                         if(*ch++ != '>') {  osilerror_wrapper( ch,osillineno,"</var> element missing >"); return false;}
03828                         // look for a new <var> element
03829                         // get rid of whitespace
03830                         ch++;
03831                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03832                         // either have another <var> element or foundVar = false;
03833                         *p = ch;
03834                         while(*startVar++  == *ch) ch++;
03835                         if( (ch - *p) == 4) {
03836                                 foundVar = true;
03837                                 startVar -= 5;
03838                         }
03839                         else {
03840                                 foundVar = false;
03841                                 ch = *p;
03842                         }
03843                 }
03844                 if( (varcount == numberOfVariables - 1) && (foundVar == true) ) {   osilerror_wrapper( ch,osillineno,"attribute numberOfVariables is less than actual number found");  return false;}
03845                 varcount++;
03846         }
03847         if(varcount < numberOfVariables) {  osilerror_wrapper( ch,osillineno,"attribute numberOfVariables is greater than actual number found");   return false;}
03848         // get the </variables> tag
03849         *p = ch;
03850         while(*endVariables++  == *ch) ch++;
03851         if( (ch - *p) != 11) {   osilerror_wrapper( ch,osillineno,"cannot find </varialbes> tag"); return false;}
03852         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
03853         // better have >
03854         if(*ch != '>') {   osilerror_wrapper( ch,osillineno,"improperly formed </variables> tag"); return false;}
03855         ch++;
03856         finish = clock();
03857         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
03858         //printf("TIME TO PARSE VARIABLES = %f\n", duration);
03859         *p = ch;
03860         return true;
03861 }//end parseVariables
03862 
03863 
03864 bool parseObjectives( const char **p, OSInstance *osinstance, int* osillineno){
03865         clock_t start, finish;
03866         //double duration;
03867         int ki, numChar;
03868         char *attTextEnd;
03869         const char *ch = *p;
03870         start = clock();
03871         const char *c_numberOfObjectives = "numberOfObjectives";
03872         const char *startObjectives = "<objectives";
03873         const char *endObjectives = "</objectives";
03874         const char *startObj = "<obj";
03875         const char *endObj = "</obj";
03876         // attributes
03877         char *attText = NULL;
03878         const char *constant = "constant";
03879         const char *maxOrMin = "maxOrMin";
03880         const char *numberOfObjCoef = "numberOfObjCoeff";
03881         const char *weight = "weight";
03882         const char *name = "name";
03883         const char *mult = "mult";
03884         // others
03885         int i;
03886         // objective function attribute boolean variables
03887         bool objmaxOrMinattON = false;
03888         bool objnameattON = false;
03889         bool objconstantattON = false;
03890         bool objweightattON = false;
03891         bool objmultattON = false;
03892         bool objnumberOfObjCoefattON = false;
03893         int objcount = 0;
03894         int numberOfObjectives;
03895         bool foundObj;
03896         // start parsing
03897         // burn white space
03898         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03899         // if, present we should be pointing to <objectives element if there -- it is not required
03900         *p = ch;
03901         while( *startObjectives++  == *ch) ch++;
03902         if( (ch - *p) != 11) {
03903                 //  note if we are here even though ch > *p we want to return *p
03904                 return true;
03905         }
03906         // find numberOfObjectives attribute -- it is valid for this attribute to be missing. 
03907         // However if the  number attribute is missing assume it is     1 
03908         // eat the white space
03909         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03910         // we just ate the white space. If numberOfObjectives is missing we assume it is 1
03911         // we therefore must have > char
03912         if(*ch == '>'){
03913                 numberOfObjectives = 1;
03914                 //ch++;
03915         }
03916         else{
03917                 *p = ch;
03918                 while( *c_numberOfObjectives++  == *ch) ch++;
03919                 if( (ch - *p) != 18) {  osilerror_wrapper( ch,osillineno,"incorrect numberOfObjectives attribute in <objectives> tag"); return false;}  
03920                 GETATTRIBUTETEXT;
03921                 numberOfObjectives = atoimod1( osillineno, attText, attTextEnd);
03922                 delete [] attText;
03923                 ch++;
03924         }
03925         if(numberOfObjectives > 0){
03926                 // get rid of white space after the numberOfObjectives attribute
03927                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03928                 // we must have an >
03929                 /*if(*ch == '/'){
03930                         ch++;
03931                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"the objectives element does not have a proper closing"); return false; }
03932                         else{
03933                                 if(numberOfObjectives > 0){   osilerror_wrapper( ch,osillineno,"numberOfObjectives positive but there are no objectives"); return false;}
03934                                 return false;
03935                         }
03936                 }*/
03937                 //  we better have an > 
03938                 if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"the objectives element does not have a proper closing"); return false;} 
03939                 osinstance->instanceData->objectives->numberOfObjectives = numberOfObjectives;
03940                 osinstance->instanceData->objectives->obj = new Objective*[ numberOfObjectives];
03941                 for(i = 0; i < numberOfObjectives; i++){
03942                         osinstance->instanceData->objectives->obj[ i] = new Objective();
03943                 }       
03944         // get rid of white space after the <objectives> element
03945         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03946         // now loop over the obj elements, there must be at least one obj element
03947         *p = ch;
03948         while( *startObj++  == *ch) ch++;
03949         if( (ch - *p) == 4) foundObj = true;
03950                 else {  osilerror_wrapper( ch,osillineno,"there must be at least one <obj> element"); return false;}
03951         startObj -= 5;
03952         start = clock();        
03953         while(foundObj){
03954                 objmaxOrMinattON = false;
03955                 objnameattON = false;
03956                 objconstantattON = false;
03957                 objweightattON = false;
03958                 objmultattON = false;
03959                 objnumberOfObjCoefattON = false;
03960                 // assume we are pointing to the first character after the r in <obj
03961                 // it should be a space so let's increment ch
03962                 ch++;
03963                 while(*ch != '/' && *ch != '>'){
03964                         switch (*ch) {
03965                         case 'n':
03966                                 if( *(ch+1) == 'u'){
03967                                         *p = ch;
03968                                         while( *numberOfObjCoef++  == *ch) ch++;
03969                                         numberOfObjCoef -= 16;
03970                                         if( ( (ch - *p) != 15)  ) {  osilerror_wrapper( ch,osillineno,"error in objective numberOfObjCoef attribute"); return false;}
03971                                         else{
03972                                                 if(objnumberOfObjCoefattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj numberOfObjCoefatt attributes"); return false;}
03973                                                 objnumberOfObjCoefattON = true;
03974                                                 GETATTRIBUTETEXT;
03975                                                 //printf("ATTRIBUTE = %s\n", attText);
03976                                                 osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef=atoimod1( osillineno,attText, attTextEnd);
03977                                                 osinstance->instanceData->objectives->obj[objcount]->coef = new ObjCoef*[osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef];
03978                                                 for(int i = 0; i < osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef; i++)osinstance->instanceData->objectives->obj[objcount]->coef[i] = new ObjCoef();
03979                                                 delete [] attText;
03980                                         }
03981                                 }
03982                                 else{
03983                                         *p = ch;
03984                                         while( *name++  == *ch) ch++;
03985                                         name -= 5;
03986                                         if( ( (ch - *p) != 4)  ) {  osilerror_wrapper( ch,osillineno,"error in objective name attribute"); return false;}
03987                                         else{
03988                                                 if(objnameattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj name attributes"); return false;}
03989                                                 objnameattON = true;
03990                                                 GETATTRIBUTETEXT;
03991                                                 //printf("ATTRIBUTE = %s\n", attText);
03992                                                 osinstance->instanceData->objectives->obj[objcount]->name=attText;
03993                                                 delete [] attText;
03994                                         }
03995                                 }
03996                                 break;
03997                         case 'c':
03998                                 *p = ch;
03999                                 while( *constant++  == *ch) ch++;
04000                                 constant -= 9;  
04001                                 if( ( (ch - *p) != 8)  ) {  osilerror_wrapper( ch,osillineno,"error in objective constant attribute"); return false;}
04002                                 else{
04003                                         if(objconstantattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj constant attributes"); return false;}
04004                                         objconstantattON = true;
04005                                         GETATTRIBUTETEXT;
04006                                         //printf("ATTRIBUTE = %s\n", attText);
04007                                         osinstance->instanceData->objectives->obj[objcount]->constant=atofmod1( osillineno,attText, attTextEnd);
04008                                         delete [] attText;
04009                                 }
04010                                 break;
04011                         case 'w':
04012                                 *p = ch;
04013                                 while( *weight++  == *ch) ch++;
04014                                 weight -= 7;
04015                                 if( ( (ch - *p) != 6)  ) {  osilerror_wrapper( ch,osillineno,"error in objective weight attribute"); return false;}
04016                                 else{
04017                                         if(objweightattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj weight attributes"); return false;}
04018                                         objweightattON = true;
04019                                         GETATTRIBUTETEXT;
04020                                         //printf("ATTRIBUTE = %s\n", attText);
04021                                         osinstance->instanceData->objectives->obj[objcount]->weight=atofmod1( osillineno,attText, attTextEnd);
04022                                         delete [] attText;
04023                                 }
04024                                 break;
04025                         case 'm':
04026                                 if(*(ch+1) == 'a'){
04027                                         *p = ch;
04028                                         while( *maxOrMin++  == *ch) ch++;
04029                                         maxOrMin -= 9;
04030                                         if( ( ( ch - *p)  != 8)  ) {  osilerror_wrapper( ch,osillineno,"error in objective maxOrMin attribute"); return false;}
04031                                         else{
04032                                                 if(objmaxOrMinattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj maxOrMin attributes"); return false;}
04033                                                 objmaxOrMinattON = true;
04034                                                 GETATTRIBUTETEXT;
04035                                                 //printf("ATTRIBUTE = %s\n", attText);
04036                                                 if( (strcmp("max", attText) != 0 ) && (strcmp("min", attText) != 0 ) ){osilerror_wrapper( ch,osillineno,"maxOrMin attribute in objective must be a max or min"); return false;}
04037                                                 osinstance->instanceData->objectives->obj[objcount]->maxOrMin = attText;
04038                                                 delete [] attText;
04039                                         }
04040                                 }
04041                                 else{
04042                                         *p = ch;
04043                                         while( *mult++  == *ch) ch++;
04044                                         mult -= 5;
04045                                         if( ( (ch - *p) != 4)  ) {  osilerror_wrapper( ch,osillineno,"error in objective mult attribute"); return false;}
04046                                         else{
04047                                                 if(objmultattON == true) {  osilerror_wrapper( ch,osillineno,"error too many obj mult attributes"); return false;}
04048                                                 objmultattON = true;
04049                                                 GETATTRIBUTETEXT;
04050                                                 //printf("ATTRIBUTE = %s\n", attText);
04051                                                 //osinstance->instanceData->objectives->obj[objcount]->name=attText;
04052                                                 delete [] attText;
04053                                         }
04054                                 }
04055                                 break;
04056                         // come back and do multiplicity
04057                         case ' ':
04058                                 break;
04059                         case '\n':
04060                                 (*osillineno)++;
04061                                 break;
04062                         case '\t':
04063                                 break;
04064                         case '\r':
04065                                 break;
04066                         default:
04067                                  
04068                                 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04069                                 return false;
04070                                 break;
04071                         }
04072                         ch++;
04073                 }
04074                 //
04075                 // assume all the attributes have been processed
04076                 // must have either /> or > and then whitespace and </obj whitespace>
04077                 if( *ch != '/' && *ch != '>') {   osilerror_wrapper( ch,osillineno,"incorrect end of <obj> element"); return false;}
04078                 if(*ch == '/'){
04079                         ch++;
04080                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"incorrect end of <obj> element"); return false;}
04081                         // get rid of whitespace
04082                         ch++;
04083                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04084                         // either have another <obj> element or foundObj = false;
04085                         for(i = 0; startObj[i]  == *ch; i++, ch++);
04086                         if(i == 4) foundObj = true;
04087                                 else foundObj = false;
04088                 }
04089                 else{
04090                         // the ch is the > at the end of the obj element
04091                         // double check to make sure it really is a >
04092                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improper ending to a <obj> element"); return false;}
04093                         // look for </obj
04094                         // fist get rid of white space
04095                         ch++;
04096                         // first get the <coef> elements
04097                         parseObjCoef(&ch,  objcount, osinstance, osillineno);
04098                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04099                         // we should be at </obj or there is an error
04100                         for(i = 0; endObj[i]  == *ch; i++, ch++);
04101                         if(i != 5) {  osilerror_wrapper( ch,osillineno,"</obj> element missing"); return false;}
04102                         // burn off the whitespace
04103                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04104                         // better have an > to end </obj
04105                         if(*ch++ != '>'){   osilerror_wrapper( ch,osillineno,"</obj> element missing >"); return false;}
04106                         // look for a new <obj> element
04107                         // get rid of whitespace
04108                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04109                         // either have another <obj> element or foundObj = false;
04110                         for(i = 0; startObj[i]  == *ch; i++, ch++);
04111                         if(i == 4) foundObj = true;
04112                                 else foundObj = false;
04113                 }
04114                 if( (objcount == numberOfObjectives - 1) && (foundObj == true)) {  osilerror_wrapper( ch,osillineno,"attribute numberOfObjectives is less than actual number found"); return false;}
04115                 objcount++;
04116         }
04117         if(objcount < numberOfObjectives) {  osilerror_wrapper( ch,osillineno,"attribute numberOfObjectives is greater than actual number found"); return false;}
04118         ch -= i;
04119         // get the </objectives> tag
04120         for(i = 0; endObjectives[i]  == *ch; i++, ch++);
04121         if(i != 12) {  osilerror_wrapper( ch,osillineno, "cannot find </objectives> tag"); return false; }
04122         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04123         // better have >
04124         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </objectives> tag"); return false;}       
04125         ch++;
04126         } // finish the (if numberOfObjectives > 0)
04127         else{
04128                 // error if the number is negative
04129                 if(numberOfObjectives < 0) {  osilerror_wrapper( ch,osillineno,"cannot have a negative number of objectives"); return false;}
04130                 // if we are here we have exactly 0 objectives 
04131                 // must close with /> or </objectives>
04132                 // get rid of white space
04133                 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04134                 if( *ch == '/'){
04135                         // better have a >
04136                         ch++;
04137                         if( *ch  != '>') {  osilerror_wrapper( ch,osillineno,"improperly closed objectives tag"); return false;}
04138                         ch++;
04139                 }
04140                 else{
04141                         // if we are here we must have an '>' and then  </objectives> tag
04142                         if( *ch  != '>') {  osilerror_wrapper( ch,osillineno,"improperly closed objectives tag"); return false;}
04143                         ch++;
04144                         // burn white space
04145                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04146                         for(i = 0; endObjectives[i]  == *ch; i++, ch++);
04147                         if(i != 12) {  osilerror_wrapper( ch,osillineno, "cannot find </objectives> tag"); return false; }
04148                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04149                         // better have >
04150                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </objectives> tag"); return false;}       
04151                         ch++;
04152                 }
04153         }
04154         finish = clock();
04155         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04156         //printf("TIME TO PARSE OBJECTIVES = %f\n", duration);
04157         *p = ch;
04158         return true;
04159 }//end parseObjectives
04160 
04161 bool parseConstraints( const char **p, OSInstance *osinstance, int* osillineno){
04162         clock_t start, finish;
04163         //double duration;
04164         int ki, numChar;
04165         char *attTextEnd;
04166         const char *ch = *p;
04167         start = clock();        
04168         const char *c_numberOfConstraints = "numberOfConstraints";
04169         const char *startConstraints = "<constraints";
04170         const char *endConstraints = "</constraints";
04171         const char *startCon = "<con";
04172         const char *endCon = "</con";
04173         // attributes
04174         char *attText = NULL;
04175         const char *name = "name";
04176         const char *constant = "constant";
04177         const char *mult = "mult";
04178         // others
04179         int i; 
04180         int concount = 0;
04181         int numberOfConstraints = 0;
04182         // constraint attribute boolean variables
04183         bool conlbattON = false ;
04184         bool conubattON  = false;
04185         bool connameattON = false;
04186         bool conconstantattON  = false;
04187         bool conmultattON = false;
04188         bool foundCon = false;
04189         // start parsing
04190         // burn white space
04191         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04192         // if, present we should be pointing to <constraints element if there -- it is not required
04193         *p = ch;
04194         for(i = 0; startConstraints[i]  == *ch; i++, ch++);
04195         while( *startConstraints++  == *ch) ch++;
04196         if( (ch - *p) != 12) {
04197                 //  *p is the correct value for the pointer
04198                 return true;
04199         }
04200         // find numberOfConstraints attribute
04201         // eat the white space
04202         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04203         *p = ch;
04204         while( *c_numberOfConstraints++  == *ch) ch++;
04205         if( (ch - *p) != 19) {  osilerror_wrapper( ch,osillineno,"incorrect numberOfConstraints attribute in <constraints> tag"); return false;}        
04206         // ch should be pointing to the first character after numberOfConstraints
04207         GETATTRIBUTETEXT;
04208         ch++;
04209         numberOfConstraints = atoimod1( osillineno, attText, attTextEnd);
04210         delete [] attText;
04211         // key if
04212         //
04213         if(numberOfConstraints > 0){
04214                 osinstance->instanceData->constraints->numberOfConstraints = numberOfConstraints;
04215                 osinstance->instanceData->constraints->con = new Constraint*[ numberOfConstraints];
04216                 for(i = 0; i < numberOfConstraints; i++){
04217                         osinstance->instanceData->constraints->con[ i] = new Constraint();
04218                 } 
04219         // get rid of white space after the numberOfConstraints element
04220         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04221         //  we better have an > 
04222         if( *ch++ != '>') {   osilerror_wrapper( ch,osillineno,"the constraints element does not have a proper closing"); return false;} 
04223         // get rid of white space after the <constraints> element
04224         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04225         // now loop over the con elements, there must be at least one con element
04226         *p = ch;
04227         while( *startCon++  == *ch) ch++;
04228         if( (ch - *p) == 4) foundCon = true;
04229                 else {  osilerror_wrapper( ch,osillineno,"there must be at least one <con> element"); return false;}
04230         startCon -= 5;
04231         while(foundCon){
04232                 conlbattON = false ;
04233                 conubattON  = false;
04234                 connameattON = false;
04235                 conconstantattON  = false;
04236                 conmultattON = false;
04237                 // assume we are pointing to the first character after the n in <con
04238                 // it should be a space so let's increment ch
04239                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04240                 while(*ch != '/' && *ch != '>'){
04241                         switch (*ch) {
04242                         case 'n':
04243                                 *p = ch;
04244                                 while( *name++  == *ch) ch++;
04245                                 if( (ch - *p) != 4) {  osilerror_wrapper( ch,osillineno,"error in constraints name attribute"); return false;}
04246                                 if(connameattON == true) {  osilerror_wrapper( ch,osillineno,"error too many con name attributes"); return false;}
04247                                 name -= 5;
04248                                 connameattON = true;
04249                                 GETATTRIBUTETEXT;
04250                                 osinstance->instanceData->constraints->con[concount]->name=attText;
04251                                 delete [] attText;
04252                                 //printf("ATTRIBUTE = %s\n", attText);
04253                                 break;
04254                         case 'c':
04255                                 *p = ch;
04256                                 while( *constant++  == *ch) ch++;
04257                                 if( ((ch - *p)  != 8)  ) {  osilerror_wrapper( ch,osillineno,"error in constraint constant attribute"); return false;}
04258                                 if(conconstantattON == true) {  osilerror_wrapper( ch,osillineno,"error too many con constant attributes"); return false;}
04259                                 constant -= 9;
04260                                 conconstantattON = true;
04261                                 GETATTRIBUTETEXT;
04262                                 //printf("ATTRIBUTE = %s\n", attText);
04263                                 osinstance->instanceData->constraints->con[concount]->constant=atofmod1( osillineno,attText, attTextEnd);
04264                                 delete [] attText;
04265                                 break;
04266                         case 'l':
04267                                 ch++;
04268                                 if(*ch++ != 'b') {   osilerror_wrapper( ch,osillineno,"error in constraint lb attribute"); return false;}
04269                                 if(conlbattON == true) {  osilerror_wrapper( ch,osillineno,"error too many con lb attributes"); return false;}
04270                                 conlbattON = true;
04271                                 GETATTRIBUTETEXT;
04272                                 osinstance->instanceData->constraints->con[concount]->lb = atofmod1( osillineno,attText, attTextEnd);
04273                                 delete [] attText;
04274                                 //printf("ATTRIBUTE = %s\n", attText);
04275                                 break;
04276                         case 'u':
04277                                 ch++;
04278                                 if(*ch++ != 'b') {  osilerror_wrapper( ch,osillineno,"error in constraint ub attribute"); return false;}
04279                                 if(conubattON == true) {  osilerror_wrapper( ch,osillineno,"error too many con ub attributes"); return false;}
04280                                 conubattON = true;
04281                                 GETATTRIBUTETEXT;
04282                                 osinstance->instanceData->constraints->con[concount]->ub = atofmod1( osillineno,attText, attTextEnd);
04283                                 delete [] attText;
04284                                 //printf("ATTRIBUTE = %s\n", attText);
04285                                 break;
04286                         case 'm':
04287                                 *p = ch;
04288                                 while( *mult++  == *ch) ch++;
04289                                 if( (ch - *p) != 4) {  osilerror_wrapper( ch,osillineno,"error in constraints mult attribute"); return false;}
04290                                 if(conmultattON == true) {  osilerror_wrapper( ch,osillineno,"error too many con mult attributes"); return false;}
04291                                 mult -= 5;
04292                                 conmultattON = true;
04293                                 GETATTRIBUTETEXT;
04294                                 delete [] attText;
04295                                 //printf("ATTRIBUTE = %s\n", attText);
04296                                 break;
04297                         case ' ':
04298                                 break;
04299                         case '\n':
04300                                 (*osillineno)++;
04301                                 break;
04302                         case '\t':
04303                                 break;
04304                         case '\r':
04305                                 break;
04306                         default:
04307                                  
04308                                 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04309                                 return false;
04310                                 break;
04311                         }
04312                         ch++;
04313                 }
04314                 //
04315                 // assume all the attributes have been processed
04316                 // must have either /> or > and then whitespace and </con whitespace>
04317                 if( *ch != '/' && *ch != '>') {  osilerror_wrapper( ch,osillineno,"incorrect end of <con> element"); return false;}
04318                 if(*ch == '/'){
04319                         ch++;
04320                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"incorrect end of <con> element"); return false;}
04321                         // get rid of whitespace
04322                         ch++;
04323                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04324                         // either have another <con> element or foundCon = false;
04325                         *p = ch;
04326                         while( *startCon++  == *ch) ch++;
04327                         if( (ch - *p) == 4){
04328                                 foundCon = true;
04329                                 startCon -= 5;
04330                         }
04331                         else{
04332                                 foundCon = false;
04333                                 ch = *p;
04334                         }
04335                 }
04336                 else{
04337                         // the ch is the > at the end of the con element 
04338                         // double check to make sure it really is a >
04339                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improper ending to a <obj> element"); return false;}
04340                         // look for </con
04341                         // fist get rid of white space
04342                         ch++;
04343                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04344                         // we should be at </con or there is an error
04345                         *p = ch;
04346                         while( *endCon++  == *ch) ch++;
04347                         if( (ch - *p) != 5) {  osilerror_wrapper( ch,osillineno,"</con> element missing"); return false;}
04348                         endCon -= 6;
04349                         // burn off the whitespace
04350                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04351                         // better have an > to end </con
04352                         if(*ch++ != '>') {  osilerror_wrapper( ch,osillineno,"</con> element missing >"); return false;}
04353                         // look for a new <con> element
04354                         // get rid of whitespace
04355                         ch++;
04356                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04357                         // either have another <con> element or foundVar = false;
04358                         *p = ch;
04359                         while( *startCon++  == *ch) ch++;
04360                         if( (ch - *p) == 4){
04361                                 foundCon = true;
04362                                 startCon -= 5;
04363                         }
04364                         else{
04365                                 foundCon = false;
04366                                 ch = *p;
04367                         }
04368                 }
04369                 if( (concount == numberOfConstraints - 1) && (foundCon == true) ) {  osilerror_wrapper( ch,osillineno,"attribute numberOfConstraints is less than actual number found"); return false;}
04370                 concount++;
04371         }
04372         if(concount < numberOfConstraints) {  osilerror_wrapper( ch,osillineno,"attribute numberOfConstraints is greater than actual number found"); return false;}
04373         // get the </constraints> tag
04374         *p = ch;
04375         while( *endConstraints++  == *ch) ch++;
04376         if( (ch - *p) != 13) {  osilerror_wrapper( ch,osillineno, "cannot find </constraints> tag"); return false;}
04377         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04378         // better have >
04379         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </constraints> tag");     return false;}
04380         ch++;
04381         }// end if(numberOfConstraints > 0)
04382         else{
04383                 // error if the number is negative
04384                 if(numberOfConstraints < 0) {  osilerror_wrapper( ch,osillineno,"cannot have a negative number of constraints"); return false;}
04385                 // if we are here we have numberOfConstraints = 0
04386                 // must close with /> or </constraints>
04387                 // get rid of white space
04388                 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04389                 if( *ch == '/'){
04390                         // better have a >
04391                         ch++;
04392                         if( *ch  != '>') {  osilerror_wrapper( ch,osillineno,"improperly closed constraints tag"); return false;}
04393                         ch++;
04394                 }
04395                 else{
04396                         // if we are here we must have an '>' and then  </constraints> tag
04397                         if( *ch  != '>') {  osilerror_wrapper( ch,osillineno,"improperly closed constraints tag"); return false;}
04398                         ch++;
04399                         // burn white space
04400                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04401                         *p = ch;
04402                         while( *endConstraints++  == *ch) ch++;
04403                         if( (ch - *p) != 13) {  osilerror_wrapper( ch,osillineno, "cannot find </constraints> tag"); return false; }
04404                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04405                         // better have >
04406                         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </constraints> tag"); return false;}      
04407                         ch++;
04408                 }
04409         }
04410         finish = clock();
04411         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04412         //printf("TIME TO PARSE CONSTRAINTS = %f\n", duration);
04413         *p = ch;
04414         return true;
04415 }//end parseConstraints
04416 
04417 bool parseLinearConstraintCoefficients( const char **p, OSInstance *osinstance, int* osillineno){;
04418         int ki, numChar;
04419         char *attTextEnd;
04420         const char *ch = *p;    
04421         const char *c_numberOfValues = "numberOfValues";
04422         const char *startlinearConstraintCoefficients = "<linearConstraintCoefficients";
04423         const char *endlinearConstraintCoefficients = "</linearConstraintCoefficients";
04424         // attributes
04425         char *attText = NULL;
04426         // others
04427         int numberOfValues;
04428         // start parsing
04429         // burn white space
04430         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04431         // if, present we should be pointing to <linearConstraintCoefficients element if there -- it is not required
04432         *p = ch;
04433         while( *startlinearConstraintCoefficients++  == *ch) ch++;
04434         if( (ch - *p) != 29) {
04435                 //reset ch
04436                 ch = *p;
04437                 return true;
04438         }
04439         // find numberOfValues attribute
04440         // eat the white space
04441         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04442         *p = ch;
04443         while( *c_numberOfValues++  == *ch) ch++;
04444         if( (ch - *p) != 14) {  osilerror_wrapper( ch,osillineno,"incorrect numberOfValues attribute in <linearConstraintCoefficients> tag"); return false;}
04445         // ch should be pointing to the first character after numberOfValues
04446         GETATTRIBUTETEXT;
04447         ch++;
04448         numberOfValues = atoimod1( osillineno, attText, attTextEnd);
04449         delete [] attText;
04450         if(numberOfValues <= 0) {  osilerror_wrapper( ch,osillineno,"the number of nonlinear nozeros must be positive"); return false;}
04451         osinstance->instanceData->linearConstraintCoefficients->numberOfValues = numberOfValues;
04452         // get rid of white space after the numberOfConstraints element
04453         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04454         // we should have either an />  OR an >
04455         if(*ch == '/'){
04456                 ch++;
04457                 if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"the linearConstraintCoefficients element does not have a proper closing"); return false;} 
04458                 else{
04459                         if(numberOfValues > 0) {  osilerror_wrapper( ch,osillineno,"numberOfValues positive, but there are no objectives"); return false;}
04460                         return false;
04461                 }               
04462         }
04463         //  we better have an > 
04464         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"the <linearConstraintCoefficients> element does not have a proper closing"); return false;}
04465         // get rid of white space after the <linearConstraintCoefficients> element
04466         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04467         if( parseStart( &ch, osinstance, osillineno) != true) return false;
04468         if( (parseColIdx( &ch, osinstance, osillineno) != true) && ( parseRowIdx( &ch, osinstance, osillineno) != true)) return false;
04469         if( (parseColIdx( &ch, osinstance, osillineno) == true) && (parseRowIdx( &ch, osinstance, osillineno) == true) ){  osilerror_wrapper( ch,osillineno,"cannot store by both row and column"); return false;}
04470         if( parseValue( &ch, osinstance, osillineno) != true) return false;
04471         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04472         // get the </linearConstraintCoefficients> tag
04473         *p = ch;
04474         while( *endlinearConstraintCoefficients++  == *ch) ch++;
04475         if( (ch - *p) != 30) {  osilerror_wrapper( ch,osillineno, "cannot find </linearConstraintCoefficients> tag"); return false;}
04476         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04477         // better have >
04478         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </linearConstraintCoefficients> tag"); return false;}
04479         ch++;   
04480         *p = ch;
04481         return true;
04482 }//end parseLinearConstraintCoefficients
04483 
04484 bool parseStart(const char **p, OSInstance *osinstance, int* osillineno){
04485         clock_t start, finish;
04486         //double duration;
04487         const char *ch = *p;
04488         start = clock(); 
04489         const char* startStart = "<start";
04490         const char* endStart = "</start";
04491         const char* startEl = "<el";
04492         const char* endEl = "</el";
04493         int kount = 0;
04494         int i;
04495         bool foundEl = false;
04496         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04497         // if, present we should be pointing to <start element 
04498         *p = ch;
04499         while( *startStart++  == *ch) ch++;
04500         if( (ch - *p) != 6) {
04501                 //reset ch
04502                 ch = *p;
04503                 return false;
04504         }
04505         // get rid of white space after <start
04506         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04507         // we should have either an >
04508         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <start> element"); return false;}
04509         ch++;
04510         // get rid of white space
04511         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04512         // look for an <el> -- if none present must have b64 data
04513         *p = ch;
04514         while( *startEl++  == *ch) ch++;
04515         startEl -= 4;
04516         if( (ch - *p) != 3) {
04517                 //reset ch
04518                 ch = *p;
04519                 // call base64 parse here
04520                 int dataSize = 0;
04521                 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04522                 if( b64string == NULL) {  osilerror_wrapper( ch,osillineno,"<start> must have children or base64 data"); return false;}
04523                 std::string base64decodeddata = Base64::decodeb64( b64string );
04524                 int base64decodeddatalength = base64decodeddata.length();
04525                 int *intvec = NULL;
04526                 osinstance->instanceData->linearConstraintCoefficients->start->el = new int[(base64decodeddatalength/dataSize) ];
04527                 intvec = (int*)&base64decodeddata[0];
04528                 for(i = 0; i < (base64decodeddatalength/dataSize); i++){
04529                         osinstance->instanceData->linearConstraintCoefficients->start->el[ i] = *(intvec++);
04530                 }
04531                 delete [] b64string;
04532         }
04533         else{
04534                 foundEl = true;
04535                 osinstance->instanceData->linearConstraintCoefficients->start->el = 
04536                 new int[ std::max( osinstance->instanceData->constraints->numberOfConstraints,
04537                 osinstance->instanceData->variables->numberOfVariables) + 1];
04538                 while(foundEl){
04539                         // start eating white space until an '>' is found,
04540                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04541                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04542                         // eat white space again,
04543                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04544                         // okay we better have a number, we will check later
04545                         *p = ch;
04546                         // find the end of the number, it better be an </el>
04547                         // find </el
04548                         while( *ch != '<' && *ch  != EOF){
04549                                 ch++;
04550                         }
04551                         // we better have a <, or not valid
04552                         if(*ch != '<') {  osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04553                         osinstance->instanceData->linearConstraintCoefficients->start->el[ kount++] = 
04554                         atoimod1( osillineno, *p, ch);
04555                         //printf("number = %s\n", *p);
04556                         // we are pointing to <, make sure there is /el
04557                         *p = ch;
04558                         while( *endEl++  == *ch) ch++;
04559                         endEl -= 5;
04560                         if( (ch - *p) != 4 ) {  osilerror_wrapper( ch,osillineno,"cannot fine an </el>"); return false;}
04561                         // start eating white space until an '>' is found for </el>,
04562                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04563                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04564                         // eat white space again,
04565                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04566                         // either have another <el> element or foundEl = false;
04567                         *p = ch;
04568                         while( *startEl++  == *ch) ch++;
04569                         if( (ch - *p)  == 3){
04570                                  foundEl = true;
04571                                  startEl -= 4;
04572                         }
04573                         else{
04574                                 foundEl = false;
04575                                 ch = *p;
04576                         }
04577                 }               
04578         }
04579         // get the </start> tag
04580         *p = ch;
04581         while( *endStart++  == *ch) ch++;
04582         if( (ch - *p) != 7) {  osilerror_wrapper( ch,osillineno, "cannot find </start> tag"); return false;}
04583         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04584         // better have >
04585         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </start> tag");   return false;}
04586         ch++;   
04587         // get the end element
04588         finish = clock();
04589         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04590         //printf("TIME TO PARSE STARTS  = %f\n", duration);
04591         *p = ch;
04592         osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements = kount;
04593         return true;
04594 }//end parseSart
04595 
04596 bool parseRowIdx( const char **p, OSInstance *osinstance, int* osillineno){
04597         clock_t start, finish;
04598         //double duration;
04599         const char *ch = *p;
04600         start = clock(); 
04601         const char* startRowIdx = "<rowIdx";
04602         const char* endRowIdx = "</rowIdx";
04603         const char* startEl = "<el";
04604         const char* endEl = "</el";
04605         int kount = 0;
04606         int i;
04607         bool foundEl = false;
04608         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04609         // if, present we should be pointing to <rowIdx element 
04610         *p = ch;
04611         while( *startRowIdx++  == *ch) ch++;
04612         if( (ch - *p) != 7) {
04613                 //reset ch
04614                 ch = *p;
04615                 return false;
04616         }
04617         // get rid of white space after <rowIdx
04618         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04619         // we should have either an >
04620         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <rowIdx> element"); return false;}
04621         ch++;
04622         // get rid of white space
04623         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04624         // look for an <el> -- if none present must have b64 data
04625         *p = ch;
04626         while( *startEl++  == *ch) ch++;
04627         startEl -= 4;
04628         if( (ch - *p) != 3) {
04629                 //reset ch
04630                 ch = *p;
04631                 // call base64 parse here
04632                 int dataSize = 0;
04633                 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04634                 if( b64string == NULL)  {  osilerror_wrapper( ch,osillineno,"<rowIdx> must have children or base64 data"); return false;}
04635                 std::string base64decodeddata = Base64::decodeb64( b64string );
04636                 int base64decodeddatalength = base64decodeddata.length();
04637                 int *intvec = NULL;
04638                 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = new int[(base64decodeddatalength/dataSize) ];
04639                 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = NULL;
04640                 intvec = (int*)&base64decodeddata[0];
04641                 for(i = 0; i < (base64decodeddatalength/dataSize); i++){
04642                         osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ i] = *(intvec++);
04643                         kount++;
04644                 }
04645                 delete [] b64string;
04646         }
04647         else{
04648                 foundEl = true;
04649                 // if we are here we are storing the problem by column
04650                 // this means the number of start elements must equal the number of columns + 1
04651                 if( osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements != osinstance->instanceData->variables->numberOfVariables  + 1)
04652                 osilerror_wrapper( ch, osillineno,"we are storing in column major format, but number of start elements not equal number of variables + 1");
04653                 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = new int[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
04654                 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = NULL;
04655                 while(foundEl){
04656                         // start munging white space until an '>' is found,
04657                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04658                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04659                         // mung white space again,
04660                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04661                         // okay we better have a number, we will check later
04662                         *p = ch;
04663                         // find the end of the number, it better be an </el>
04664                         // find </el
04665                         while( *ch != '<' && *ch  != EOF){
04666                                 ch++;
04667                         }
04668                         // we better have a <, or not valid
04669                         if(*ch != '<') {   osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04670                         osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ kount++] = 
04671                         atoimod1( osillineno, *p, ch);
04672                         //printf("number = %s\n", *p);
04673                         // we are pointing to <, make sure there is /el
04674                         *p = ch;
04675                         while( *endEl++  == *ch) ch++;
04676                         endEl -= 5;
04677                         if( (ch - *p)  != 4 ) {  osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04678                         // start munging white space until an '>' is found for </el>,
04679                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04680                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04681                         // eat white space again,
04682                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04683                         // either have another <el> element or foundEl = false;
04684                         *p = ch;
04685                         while( *startEl++  == *ch) ch++;
04686                         if( (ch - *p) == 3){
04687                                 foundEl = true;
04688                                 startEl -= 4;
04689                         }
04690                         else{
04691                                 foundEl = false;
04692                                 ch = *p;
04693                         }
04694                 }
04695         }
04696         // get the </rowIdx> tag
04697         *p = ch;
04698         while( *endRowIdx++  == *ch) ch++;
04699         if( (ch - *p) != 8) {  osilerror_wrapper( ch,osillineno, "cannot find </rowIdx> tag"); return false;}
04700         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04701         // better have >
04702         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </rowIdx> tag");} 
04703         ch++;   
04704         if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute less than number of row indices found"); return false;}
04705         if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute greater than number of row indices found"); return false;}
04706         finish = clock();
04707         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04708         //printf("TIME TO PARSE ROW INDEXES = %f\n", duration);
04709         *p = ch;
04710         return true;
04711 }//end parseRowIdx
04712 
04713 
04714 bool parseColIdx( const char **p, OSInstance *osinstance, int* osillineno){
04715         clock_t start, finish;
04716         //double duration;
04717         const char *ch = *p;
04718         start = clock(); 
04719         const char* startColIdx = "<colIdx";
04720         const char* endColIdx = "</colIdx";
04721         const char* startEl = "<el";
04722         const char* endEl = "</el";
04723         int kount = 0;
04724         int i;
04725         bool foundEl = false;
04726         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04727         // if, present we should be pointing to <colIdx element 
04728         *p = ch;
04729         while( *startColIdx++  == *ch) ch++;
04730         if( (ch - *p) != 7) {
04731                 //reset ch
04732                 ch = *p;
04733                 return false;
04734         }
04735         // get rid of white space after <colIdx
04736         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04737         // we should have either an >
04738         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <colIdx> element"); return false;}
04739         ch++;
04740         // get rid of white space
04741         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04742         // look for an <el> -- if none present must have b64 data
04743         *p = ch;
04744         while( *startEl++  == *ch) ch++;
04745         startEl -= 4;
04746         if( (ch - *p) != 3) {
04747                 //reset ch
04748                 ch = *p;
04749                 // call base64 parse here
04750                 int dataSize = 0;
04751                 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04752                 if( b64string == NULL)  {  osilerror_wrapper( ch,osillineno,"<colIdx> must have children or base64 data"); return false;}
04753                 std::string base64decodeddata = Base64::decodeb64( b64string );
04754                 int base64decodeddatalength = base64decodeddata.length();
04755                 int *intvec = NULL;
04756                 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = new int[(base64decodeddatalength/dataSize) ];
04757                 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = NULL;
04758                 intvec = (int*)&base64decodeddata[0];
04759                 for(i = 0; i < (base64decodeddatalength/dataSize); i++){
04760                         osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ i] = *(intvec++);
04761                         kount++;
04762                 }
04763                 delete [] b64string;
04764         }
04765         else{
04766                 foundEl = true;
04767                 // if we are here we are storing the problem by row
04768                 // this means the number of start elements must equal the number of rows
04769                 if(osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements != osinstance->instanceData->constraints->numberOfConstraints  + 1)
04770                 osilerror_wrapper( ch, osillineno,"we are storing in row major format, but number of start elements not equal number of rows + 1");
04771                 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = new int[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
04772                 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = NULL;
04773                 while(foundEl){
04774                         // start eating white space until an '>' is found,
04775                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04776                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04777                         // eat white space again,
04778                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04779                         // okay we better have a number, we will check later
04780                         *p = ch;
04781                         // find the end of the number, it better be an </el>
04782                         // find </el
04783                         while( *ch != '<' && *ch  != EOF){
04784                                 ch++;
04785                         }
04786                         // we better have a <, or not valid
04787                         if(*ch != '<') {  osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04788                         osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ kount] = 
04789                         atoimod1( osillineno, *p, ch);
04790                         if(osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ kount]  >= osinstance->instanceData->variables->numberOfVariables){
04791                                 osilerror_wrapper( ch, osillineno, "variable index exceeds number of variables");
04792                         }
04793                         kount++;
04794                         //printf("number = %s\n", *p);
04795                         // we are pointing to <, make sure there is /el
04796                         *p = ch;
04797                         while( *endEl++  == *ch) ch++;
04798                         endEl -= 5;
04799                         if( (ch - *p) != 4 ) {  osilerror_wrapper( ch,osillineno,"cannot fine an </el>"); return false;}
04800                         // start eating white space until an '>' is found for </el>,
04801                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04802                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04803                         // eat white space again,
04804                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04805                         // either have another <el> element or foundEl = false;
04806                         *p = ch;
04807                         while( *startEl++  == *ch) ch++;
04808                         if( (ch - *p) == 3){
04809                                 foundEl = true;
04810                                 startEl -= 4;
04811                         }
04812                         else{
04813                                 foundEl = false;
04814                                 ch = *p;
04815                         }
04816                 }
04817         }
04818         // get the </colIdx> tag
04819         *p = ch;
04820         while( *endColIdx++  == *ch) ch++;              
04821         if( (ch - *p) != 8) {  osilerror_wrapper( ch,osillineno, "cannot find </colIdx> tag"); return false;}
04822         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );        
04823         // better have >
04824         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </colIdx> tag"); return false;}   
04825         ch++;   
04826         if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues) {  osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute less than number of column indices found"); return false;}
04827         if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues) {  osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute greater than number of column indices found"); return false;}
04828         finish = clock();
04829         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04830         //printf("TIME TO PARSE COLUMN INDEXES = %f\n", duration);
04831         *p = ch;
04832         return true;
04833 }//end parseColIdx
04834 
04835 
04836 bool parseValue( const char **p, OSInstance *osinstance, int* osillineno){
04837         clock_t start, finish;
04838         //double duration;
04839         const char *ch = *p;
04840         start = clock(); 
04841         const char* startValue = "<value";
04842         const char* endValue = "</value";
04843         const char* startEl = "<el";
04844         const char* endEl = "</el";
04845         int kount = 0;
04846         int i;
04847         bool foundEl = false;
04848         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
04849         // if present we should be pointing to <value element 
04850         *p = ch;
04851         while( *startValue++  == *ch) ch++;
04852         if( (ch - *p) != 6) {
04853                 //reset ch
04854                 ch = *p;
04855                 return false;
04856         }
04857         // get rid of white space after <value
04858         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
04859         // we should have either an >
04860         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <value> element"); return false;}
04861         ch++;
04862         // get rid of white space
04863         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
04864         // look for an <el> -- if none present must have b64 data
04865         *p = ch;
04866         while( *startEl++  == *ch) ch++;
04867         startEl -= 4;
04868         if( (ch - *p) != 3) {
04869                 //reset ch
04870                 ch = *p;
04871                 // call base64 parse here
04872                 int dataSize = 0;
04873                 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04874                 if( b64string == NULL)  {  osilerror_wrapper( ch,osillineno,"<start> must have children or base64 data"); return false;};
04875                 std::string base64decodeddata = Base64::decodeb64( b64string );
04876                 int base64decodeddatalength = base64decodeddata.length();
04877                 osinstance->instanceData->linearConstraintCoefficients->value->el = new double[(base64decodeddatalength/dataSize) ];
04878                 int kountChar = 0;
04879                 int kj;
04880                 /* Take care of Lou's memory alignment problem */
04881                 /* dataSize had better equal sizeof( double) or we need to abandon ship */
04882                 if( sizeof( double)  != dataSize ) {  
04883                         osilerror_wrapper( ch, osillineno, 
04884                                 "base 64 encoded with a size of double different than on this machine"); 
04885                         return false;
04886                 }       
04887                 union doubleBuffer{
04888                         char memAlign[sizeof(double)];
04889                         double dble;
04890                 };
04891                 doubleBuffer dbuf;
04892                 for(i = 0; i < (base64decodeddatalength/dataSize); i++){
04893                         for(kj = 0; kj < dataSize; kj++){
04894                                 dbuf.memAlign[ kj] = base64decodeddata[kountChar];
04895                                 kountChar++;
04896                         }
04897                         osinstance->instanceData->linearConstraintCoefficients->value->el[ i] = dbuf.dble;
04898                         std::cout << dbuf.dble << std::endl;
04899                         kount++;
04900                 }
04901                 delete [] b64string;
04902         }
04903         else{
04904                 foundEl = true;
04905                 osinstance->instanceData->linearConstraintCoefficients->value->el = 
04906                         new double[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
04907                 while( foundEl){
04908                         // start eat white space until an '>' is found,
04909                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
04910                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04911                         // eat white space again,
04912                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
04913                         *p = ch;
04914                         // find the end of the number, it better be an </el>
04915                         // find the < which begins the </el
04916                         while( *ch != '<' && *ch != EOF){
04917                                 ch++;
04918                         }
04919                         // we better have a <, or not valid
04920                         if(*ch != '<') {  osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04921                         osinstance->instanceData->linearConstraintCoefficients->value->el[ kount++] = 
04922                         atofmod1( osillineno, *p, ch);
04923                         //printf("number = %s\n", *p);
04924                         // we are pointing to <, make sure there is /el
04925                         *p = ch;
04926                         while( *endEl++  == *ch) ch++;
04927                         endEl -= 5;
04928                         if( (ch - *p) != 4 ) {  osilerror_wrapper( ch,osillineno,"cannot fine an </el>"); return false;}
04929                         // start eating white space until an '>' is found for </el>,
04930                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
04931                         if( *ch++ != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04932                         // eat white space again,
04933                         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
04934                         // either have another <el> element or foundEl = false;
04935                         *p = ch;
04936                         while( *startEl++  == *ch) ch++;
04937                         if( (ch - *p) == 3){
04938                                 foundEl = true;
04939                                 startEl -= 4;
04940                         }
04941                         else{
04942                                 foundEl = false;
04943                                 ch = *p;
04944                         }
04945                 }       
04946         }
04947         // get the </value> tag
04948         *p = ch;
04949         while( *endValue++  == *ch) ch++;
04950         if( (ch - *p) != 7) {  osilerror_wrapper( ch,osillineno, "cannot find </value> tag"); return false;}
04951         for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );       
04952         // better have >
04953         if(*ch != '>') {  osilerror_wrapper( ch,osillineno,"improperly formed </value> tag");    return false;}
04954         ch++;   
04955         if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues){  osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients greater than number of values found"); return false;}
04956         if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues){  osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients less than the number of values found"); return false;}
04957         finish = clock();
04958         //duration = (double) (finish - start) / CLOCKS_PER_SEC; 
04959         //printf("TIME TO PARSE VALUES = %f\n", duration);
04960         *p = ch;
04961         return true;
04962 }//end parseValue
04963 
04964 bool parseObjCoef( const char **p, int objcount, OSInstance *osinstance, int* osillineno){
04965         int ki, numChar;
04966         char *attTextEnd;
04967         const char *ch = *p;
04968         const char* startCoef = "<coef";
04969         const char* endCoef = "</coef";
04970         const char* c_idx = "idx";
04971         char *attText = NULL;
04972         int k;
04973         int numberOfObjCoef = 0; 
04974         if( osinstance->instanceData->objectives->numberOfObjectives <= 0)  {  osilerror_wrapper( ch,osillineno,"we can't have objective function coefficients without an objective function"); return false;}
04975         numberOfObjCoef = osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef;
04976         if(numberOfObjCoef > 0) {
04977         for(k = 0; k < numberOfObjCoef; k++){
04978                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04979                 // if, present we should be pointing to <coef element 
04980                 *p = ch;
04981                 while( *startCoef++  == *ch) ch++;
04982                 if( (ch - *p) != 5) {  osilerror_wrapper( ch,osillineno,"improper <coef> element"); return false;}
04983                 startCoef -= 6;
04984                 // get the idx attribute
04985                 // eat the white space after <coef
04986                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04987                 *p = ch;
04988                 while( *c_idx++  == *ch) ch++;
04989                 if( (ch - *p) != 3) {  osilerror_wrapper( ch,osillineno,"incorrect idx attribute in objective function <idx> tag"); return false;}      
04990                 c_idx -= 4;
04991                 // ch should be pointing to the first character after idx attribute
04992                 GETATTRIBUTETEXT;
04993                 osinstance->instanceData->objectives->obj[objcount]->coef[ k]->idx  = atoimod1( osillineno, attText, attTextEnd);
04994                 delete [] attText;
04995                 ch++;   
04996                 // eat white space
04997                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04998                 // if we don't have a > there is an error
04999                 if(*ch++ != '>') {  osilerror_wrapper( ch,osillineno,"incorrect <coef> element")        ; return false;}        
05000                 // we should be pointing to first character after <coef>
05001                 *p = ch;
05002                 // eat characters until we find <
05003                 for(; *ch != '<' && *ch != EOF; ch++); 
05004                 // put back here
05005 
05006                 // we should be pointing to a < in the </coef> tag      
05007                 if(*ch != '<') {  osilerror_wrapper( ch,osillineno,"improper </coef> tag"); return false;}
05008                 osinstance->instanceData->objectives->obj[objcount]->coef[ k]->value  = atofmod1( osillineno, *p, ch);
05009                 *p = ch;
05010                 while( *endCoef++  == *ch) ch++;
05011                 if( (ch - *p) != 6)  {  osilerror_wrapper( ch,osillineno,"improper </coef> element"); return false;}
05012                 endCoef -= 7;
05013                 // get rid of white space after </coef
05014                 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05015                 // if we don't have a > there is an error
05016                 if(*ch++ != '>') {  osilerror_wrapper( ch,osillineno,"incorrect </coef> element")       ; return false;}
05017         }
05018         }// end if(numberOfObjCoef > 0)
05019         *p = ch;
05020         return true;
05021 }//end parseObjCoef
05022 
05023 char *parseBase64(const char **p, int *dataSize, int* osillineno ){
05024         int ki, numChar;
05025         char *attTextEnd;
05026         const char *ch = *p;
05027         const char *sizeOf = "sizeOf";
05028         //char *numericType = "numericType";
05029         const char *startBase64BinaryData = "<base64BinaryData";
05030         const char *endBase64BinaryData = "</base64BinaryData";
05031         char *attText = NULL;
05032         char *b64string = NULL;
05033         int i;
05034         // start parsing
05035         for(i = 0; startBase64BinaryData[i]  == *ch; i++, ch++);
05036         if(i != 17) {
05037                 ch -= i;
05038                 *p = ch;
05039                 return b64string;
05040         }
05041         // find sizeOf attribute
05042         // eat the white space
05043         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05044         for(i = 0; sizeOf[i]  == *ch; i++, ch++);
05045         if(i != 6) {  osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return false;}      
05046         // ch should be pointing to the first character after sizeOf
05047         GETATTRIBUTETEXT;
05048         ch++;
05049         *dataSize = atoimod1( osillineno, attText, attTextEnd);
05050         delete [] attText;
05051         // since the element must contain b64 data,  this element must end with > 
05052         // eat the white space
05053         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05054         // better have an > sign or not valid
05055         if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return false;}
05056         ch++;
05057         // we are now pointing start of the data
05058         const char *b64textstart = ch;
05059         // eat characters until we get to the </base64BinaryData element
05060         for(; *ch != '<' && *ch != EOF; ch++);
05061         const char *b64textend = ch;
05062         // we should be pointing to </base64BinaryData>
05063         for(i = 0; endBase64BinaryData[i]  == *ch; i++, ch++);
05064         if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return false;}
05065         int b64len = b64textend - b64textstart;
05066         b64string = new char[ b64len + 1]; 
05067         for(ki = 0; ki < b64len; ki++) b64string[ki] = b64textstart[ ki]; 
05068         b64string[ki] = '\0';   
05069         // burn the white space
05070         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05071         // better have an > sign or not valid
05072         if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return false;}
05073         ch++;
05074         for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05075         *p = ch;
05076         return b64string;
05077 }
05078 
05079 
05080 double atofmod1(int* osillineno, const char *number, const char *numberend){
05081         double val;
05082         char *pEnd;
05083         val = os_strtod_wrap(number, &pEnd);
05084         // pEnd should now point to the first character after the number;
05085         // burn off any white space     
05086         for( ; ISWHITESPACE( *pEnd) || isnewline( *pEnd, osillineno); pEnd++ ) ;
05087         // pEnd should now point to numberend, if not we have an error
05088         if(pEnd != numberend) osilerror_wrapper( pEnd,   osillineno, "error in parsing an XSD:double");
05089         return val;
05170 }//end atofmod
05171 
05172 
05173 
05174 int atoimod1(int* osillineno, const char *number, const char *numberend){
05175         // modified atoi from Kernighan and Ritchie
05176         int ival;
05177         int i, sign;
05178         int endWhiteSpace;
05179         for(i = 0; ISWHITESPACE( number[ i]) || isnewline( number[ i], osillineno) ; i++);
05180         endWhiteSpace = i;
05181         sign = (number[ i] == '-') ? -1 : 1;
05182         if (number[ i] == '+' || number[ i] == '-') i++;
05183         for(ival = 0; ISDIGIT( number[ i]); i++){
05184                 ival = 10*ival + (number[ i] - '0') ;
05185         }
05186         if(i == endWhiteSpace) {  osilerror_wrapper( number,osillineno, "error in parsing an XSD:int" );        }
05187         // if we are here we should having nothing but white space until the end of the number
05188         for( ; ISWHITESPACE( number[ i]) || isnewline( number[ i], osillineno) ; i++);
05189         if(number[i] == *numberend){
05190                 return sign*ival;
05191         }
05192         else {  osilerror_wrapper( number,osillineno, "error in parsing an XSD:int"); return OSINT_MAX; }
05193 }//end atoimod1
05194 
05195 void osilerror_wrapper( const char* ch, int* osillineno, const char* errormsg){
05196         const int numErrorChar = 20;
05197         char errorArray[100] = "";
05198         strncpy(errorArray, ch, numErrorChar);
05199         std::ostringstream outStr;
05200         std::string error = errormsg;
05201         error = "PARSER ERROR:  Input is either not valid or well formed: "  + error;
05202         outStr << error << endl;
05203         outStr << "Here are " ;
05204         outStr << numErrorChar ;
05205         outStr << " characters currently being pointed to in the input string: ";
05206         outStr << errorArray;
05207         outStr << endl;
05208         outStr << "See line number: " << *osillineno << endl;  
05209         error = outStr.str();
05210         //osillex_destroy(scanner);
05211         throw ErrorClass( error);
05212 }//end osilerror_wrapper
05213 
05214 
05215 

Generated on Thu Oct 8 03:03:00 2009 by  doxygen 1.4.7