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