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