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