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