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