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