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 }
03432 else{
03433
03434 if(*pchar != '>') { osilerror_wrapper( pchar,osillineno,"improperly formed <name> element"); return false;}
03435 pchar++;
03436
03437
03438 ptemp = strstr( pchar, endName);
03439 if( ptemp == NULL) { osilerror_wrapper( pchar,osillineno,"improperly formed </name> element"); return false;}
03440 elementSize = ptemp - pchar;
03441 pelementText = new char[ elementSize + 1];
03442 strncpy(pelementText, pchar, elementSize);
03443 pelementText[ elementSize] = '\0';
03444 osinstance->instanceHeader->name = pelementText;
03445
03446 delete [] pelementText;
03447
03448 while(elementSize-- > 0){
03449 if(*pchar++ == '\n') (*osillineno)++;
03450 }
03451
03452
03453 pchar += 6;
03454
03455 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03456
03457 if(*pchar++ != '>'){ osilerror_wrapper( pchar,osillineno,"improperly formed </name> element"); return false;}
03458 }
03459 }
03460
03461
03462
03463
03464
03465
03466 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03467
03468 *p = pchar;
03469 while(*startSource++ == *pchar) pchar++;
03470 if(pchar - *p != 7) {
03471
03472 pchar = *p;
03473 }
03474 else{
03475
03476
03477 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03478 if( *pchar == '/'){
03479 pchar++;
03480
03481 if(*pchar != '>') { osilerror_wrapper( pchar,osillineno,"improperly formed <source> element"); return false;}
03482 }
03483 else{
03484
03485 if(*pchar != '>') { osilerror_wrapper( pchar,osillineno,"improperly formed <source> element"); return false;}
03486 pchar++;
03487
03488
03489 ptemp = strstr( pchar, endSource);
03490 if( ptemp == NULL) { osilerror_wrapper( pchar,osillineno,"improperly formed </source> element"); return false;}
03491 elementSize = ptemp - pchar;
03492 pelementText = new char[ elementSize + 1];
03493 strncpy(pelementText, pchar, elementSize);
03494 pelementText[ elementSize] = '\0';
03495 osinstance->instanceHeader->source = pelementText;
03496
03497 delete [] pelementText;
03498
03499 while(elementSize-- > 0){
03500 if(*pchar++ == '\n') (*osillineno)++;
03501 }
03502
03503
03504 pchar += 8;
03505
03506 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03507
03508 if(*pchar++ != '>'){ osilerror_wrapper( pchar,osillineno,"improperly formed </source> element"); return false;}
03509 }
03510 }
03511
03512
03513
03514
03515
03516
03517 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03518
03519 *p = pchar;
03520 while(*startDescription++ == *pchar) pchar++;
03521 if( (pchar - *p) != 12) {
03522
03523 pchar = *p;
03524 }
03525 else{
03526
03527
03528 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03529 if( *pchar == '/'){
03530 pchar++;
03531
03532 if(*pchar != '>') { osilerror_wrapper( pchar,osillineno,"improperly formed <description> element"); return false;}
03533 }
03534 else{
03535
03536 if(*pchar != '>') { osilerror_wrapper( pchar,osillineno,"improperly formed <description> element"); return false;}
03537 pchar++;
03538
03539
03540 ptemp = strstr( pchar, endDescription);
03541 if( ptemp == NULL) { osilerror_wrapper( pchar,osillineno,"improperly formed </description> element"); return false;}
03542 elementSize = ptemp - pchar;
03543 pelementText = new char[ elementSize + 1];
03544 strncpy(pelementText, pchar, elementSize);
03545 pelementText[ elementSize] = '\0';
03546 osinstance->instanceHeader->description = pelementText;
03547
03548 delete [] pelementText;
03549
03550 while(elementSize-- > 0){
03551 if(*pchar++ == '\n') (*osillineno)++;
03552 }
03553
03554
03555 pchar += 13;
03556
03557 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03558
03559 if(*pchar++ != '>'){ osilerror_wrapper( pchar,osillineno,"improperly formed </description> element"); return false;}
03560 }
03561 }
03562
03563
03564
03565
03566 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03567
03568 *p = pchar;
03569 while(*endInstanceHeader++ == *pchar) pchar++;
03570 if( (pchar - *p) != 16) { osilerror_wrapper( pchar,osillineno,"improperly formed </instanceHeader> element"); return false;}
03571
03572
03573 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03574
03575 if(*pchar != '>'){ osilerror_wrapper( pchar,osillineno,"improperly formed </instanceHeader> element"); return false;}
03576 pchar++;
03577 *p = pchar;
03578 return true;
03579 }
03580
03581
03582 bool parseInstanceData( const char **p, OSInstance *osinstance, int* osillineno){
03583
03584 const char *pchar = *p;
03585 const char *startInstanceData = "<instanceData";
03586
03587
03588 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03589
03590 if(*pchar != '<'){ osilerror_wrapper( pchar,osillineno,"improperly formed <instanceData element"); return false;}
03591
03592 *p = pchar;
03593 while(*startInstanceData++ == *pchar) pchar++;
03594 if( (pchar - *p) != 13) { osilerror_wrapper( pchar,osillineno,"improperly formed <instanceData> element"); return false;}
03595
03596 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03597
03598 if(*pchar == '>'){
03599 pchar++;
03600
03601
03602 for( ; ISWHITESPACE( *pchar) || isnewline( *pchar, osillineno); pchar++ ) ;
03603
03604 *p = pchar;
03605 if( parseVariables( p, osinstance, osillineno) != true) {throw ErrorClass("error in parseVariables");}
03606 if( parseObjectives( p, osinstance, osillineno) != true) throw ErrorClass("error in parseObjectives");
03607 if( parseConstraints( p, osinstance, osillineno) != true) throw ErrorClass("error in parseConstraints");
03608 if( parseLinearConstraintCoefficients( p, osinstance, osillineno) != true) throw ErrorClass("error in parseLinearConstraintCoefficients");
03609 }else{
03610
03611 return true;
03612 }
03613
03614
03615
03616 return true;
03617 }
03618
03619
03620 bool parseVariables( const char **p, OSInstance *osinstance, int* osillineno){
03621 clock_t start, finish;
03622 #ifdef CHECK_PARSE_TIME
03623 double duration;
03624 #endif
03625 int ki, numChar;
03626 char *attTextEnd;
03627 const char *ch = *p;
03628 start = clock();
03629 const char *c_numberOfVariables = "numberOfVariables";
03630 const char *startVariables = "<variables";
03631 const char *endVariables = "</variables";
03632 const char *startVar = "<var";
03633 const char *endVar = "</var";
03634
03635 char *attText = NULL;
03636 const char *name = "name";
03637
03638 const char *type = "type";
03639 const char *mult = "mult";
03640
03641 int i;
03642 int varcount = 0;
03643 int vt;
03644 int numberOfVariables = 0;
03645
03646 bool varlbattON = false;
03647 bool varubattON = false ;
03648 bool vartypeattON = false;
03649 bool varnameattON = false ;
03650
03651
03652 bool varmultattON = false;
03653 bool foundVar = false;
03654 int varmult;
03655
03656
03657
03658 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03659 *p = ch;
03660 while(*startVariables++ == *ch) ch++;
03661
03662 if( (ch - *p) != 10) { return true;}
03663
03664
03665 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03666 *p = ch;
03667 while(*c_numberOfVariables++ == *ch) ch++;
03668 if( (ch - *p) != 17) { osilerror_wrapper( ch,osillineno,"incorrect numberOfVariables attribute in <variables tag>"); return false;}
03669
03670 GETATTRIBUTETEXT;
03671 ch++;
03672 numberOfVariables = atoimod1( osillineno, attText, attTextEnd);
03673 delete [] attText;
03674 if(numberOfVariables < 0) {
03675 osilerror_wrapper( ch,osillineno,"there must be a nonnegative number of variables"); return false;
03676 }
03677 osinstance->instanceData->variables->numberOfVariables = numberOfVariables;
03678 if(numberOfVariables > 0){
03679 osinstance->instanceData->variables->var = new Variable*[ numberOfVariables];
03680 for(i = 0; i < numberOfVariables; i++){
03681 osinstance->instanceData->variables->var[ i] = new Variable();
03682 }
03683 }
03684
03685 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03686
03687 if(numberOfVariables > 0){
03688
03689 if(*ch != '>' ) { osilerror_wrapper( ch,osillineno,"variables element does not have a proper closing >"); return false;}
03690 ch++;
03691
03692 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03693
03694 *p = ch;
03695 while(*startVar++ == *ch) ch++;
03696 if( (ch - *p) == 4) foundVar = true;
03697 else { osilerror_wrapper( ch,osillineno,"there must be at least one <var> element"); return false;}
03698 startVar -= 5;
03699 while(foundVar){
03700 varlbattON = false;
03701 varubattON = false ;
03702 vartypeattON = false;
03703 varnameattON = false ;
03704
03705
03706 varmultattON = false;
03707 varmult = 1;
03708 foundVar = false;
03709
03710
03711 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03712 while(*ch != '/' && *ch != '>'){
03713 switch (*ch) {
03714 case 'n':
03715 *p = ch;
03716 while(*name++ == *ch) ch++;
03717 if( (ch - *p) != 4 ) { osilerror_wrapper( ch,osillineno,"error in variables name attribute"); return false;}
03718 name -= 5;
03719 if(varnameattON == true) { osilerror_wrapper( ch,osillineno,"too many variable name attributes"); return false;}
03720 varnameattON = true;
03721 GETATTRIBUTETEXT;
03722 osinstance->instanceData->variables->var[varcount]->name=attText;
03723 delete [] attText;
03724
03725 break;
03726
03727
03728
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 case 't':
03755 *p = ch;
03756 while(*type++ == *ch) ch++;
03757 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in variables type attribute"); return false;}
03758 type -= 5;
03759 if(vartypeattON == true) { osilerror_wrapper( ch,osillineno,"too many variable type attributes"); return false;}
03760 vartypeattON = true;
03761 GETATTRIBUTETEXT;
03762 vt = returnVarType(attText[0]);
03763 if( vt == 0 ) { osilerror_wrapper( ch,osillineno,"variable type not recognized"); return false;}
03764 osinstance->instanceData->variables->var[varcount]->type = attText[0];
03765 if (vt == ENUM_VARTYPE_BINARY) osinstance->instanceData->variables->var[varcount]->ub = 1.0;
03766 delete [] attText;
03767 break;
03768 case 'l':
03769 ch++;
03770 if(*ch++ != 'b') { osilerror_wrapper( ch,osillineno,"error in variables lower bound attribute"); return false;}
03771 if(varlbattON == true) { osilerror_wrapper( ch,osillineno,"too many variable lb attributes"); return false;}
03772 varlbattON = true;
03773 GETATTRIBUTETEXT;
03774 osinstance->instanceData->variables->var[varcount]->lb = atofmod1( osillineno,attText, attTextEnd);
03775 delete [] attText;
03776
03777 break;
03778 case 'u':
03779 ch++;
03780 if(*ch++ != 'b') { osilerror_wrapper( ch,osillineno,"error in variables upper bound attribute"); return false;}
03781 if(varubattON == true) { osilerror_wrapper( ch,osillineno,"too many variable ub attributes"); return false;}
03782 varubattON = true;
03783 GETATTRIBUTETEXT;
03784 osinstance->instanceData->variables->var[varcount]->ub = atofmod1( osillineno,attText, attTextEnd);
03785 delete [] attText;
03786
03787 break;
03788 case 'm':
03789 *p = ch;
03790 while(*mult++ == *ch) ch++;
03791 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in variables mult attribute"); return false;}
03792 mult -= 5;
03793 if(varmultattON == true) { osilerror_wrapper( ch,osillineno,"too many variable mult attributes"); return false;}
03794 varmultattON = true;
03795 GETATTRIBUTETEXT;
03796 varmult = atoimod1( osillineno,attText, attTextEnd);
03797 delete [] attText;
03798
03799 break;
03800 case ' ':
03801 break;
03802 case '\n':
03803 (*osillineno)++;
03804 break;
03805 case '\t':
03806 break;
03807 case '\r':
03808 break;
03809 default:
03810 osilerror_wrapper( ch,osillineno,"invalid attribute character");
03811 return false;
03812 break;
03813 }
03814 ch++;
03815 }
03816
03817
03818
03819 if( *ch != '/' && *ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <var> element"); return false;}
03820 if(*ch == '/'){
03821 ch++;
03822 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <var> element"); return false;}
03823
03824 ch++;
03825 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03826
03827 *p = ch;
03828 while(*startVar++ == *ch) ch++;
03829 if( (ch - *p) == 4) {
03830 foundVar = true;
03831 startVar -= 5;
03832 }
03833 else {
03834 foundVar = false;
03835 ch = *p;
03836 }
03837 }
03838 else{
03839
03840
03841 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improper ending to a <var> element"); return false;}
03842
03843
03844 ch++;
03845 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03846
03847 *p = ch;
03848 while(*endVar++ == *ch) ch++;
03849 endVar -= 6;
03850 if( (ch - *p) != 5) { osilerror_wrapper( ch,osillineno,"</var> element missing"); return false;}
03851
03852 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03853
03854 if(*ch++ != '>') { osilerror_wrapper( ch,osillineno,"</var> element missing >"); return false;}
03855
03856
03857 ch++;
03858 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03859
03860 *p = ch;
03861 while(*startVar++ == *ch) ch++;
03862 if( (ch - *p) == 4) {
03863 foundVar = true;
03864 startVar -= 5;
03865 }
03866 else {
03867 foundVar = false;
03868 ch = *p;
03869 }
03870 }
03871 if( ((varcount+varmult) == numberOfVariables) && (foundVar == true) ) { osilerror_wrapper( ch,osillineno,"attribute numberOfVariables is less than actual number found"); return false;}
03872 for (int k=1; k < varmult; k++)
03873 {
03874 osinstance->instanceData->variables->var[varcount+k]->name
03875 = osinstance->instanceData->variables->var[varcount]->name;
03876 osinstance->instanceData->variables->var[varcount+k]->type
03877 = osinstance->instanceData->variables->var[varcount]->type;
03878 osinstance->instanceData->variables->var[varcount+k]->lb
03879 = osinstance->instanceData->variables->var[varcount]->lb;
03880 osinstance->instanceData->variables->var[varcount+k]->ub
03881 = osinstance->instanceData->variables->var[varcount]->ub;
03882 }
03883 varcount += varmult;
03884 }
03885 if(varcount < numberOfVariables) { osilerror_wrapper( ch,osillineno,"attribute numberOfVariables is greater than actual number found"); return false;}
03886
03887 *p = ch;
03888 while(*endVariables++ == *ch) ch++;
03889 if( (ch - *p) != 11) { osilerror_wrapper( ch,osillineno,"cannot find </variables> tag"); return false;}
03890 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03891
03892 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </variables> tag"); return false;}
03893 ch++;
03894 }else {
03895
03896 if(numberOfVariables < 0) { osilerror_wrapper( ch,osillineno,"cannot have a negative number of variables"); return false;}
03897
03898
03899
03900 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03901 if( *ch == '/'){
03902
03903 ch++;
03904 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed variables tag"); return false;}
03905 ch++;
03906 }
03907 else{
03908
03909 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed variables tag"); return false;}
03910 ch++;
03911
03912 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03913 *p = ch;
03914 while( *endVariables++ == *ch) ch++;
03915 if( (ch - *p) != 11) { osilerror_wrapper( ch,osillineno, "cannot find </variables> tag"); return false; }
03916 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
03917
03918 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </variables> tag"); return false;}
03919 ch++;
03920 }
03921
03922 }
03923 finish = clock();
03924 #ifdef CHECK_PARSE_TIME
03925 duration = (double) (finish - start) / CLOCKS_PER_SEC;
03926 printf("TIME TO PARSE VARIABLES = %f\n", duration);
03927 #endif
03928 *p = ch;
03929 return true;
03930 }
03931
03932
03933 bool parseObjectives( const char **p, OSInstance *osinstance, int* osillineno){
03934 clock_t start, finish;
03935 #ifdef CHECK_PARSE_TIME
03936 double duration;
03937 #endif
03938 int ki, numChar;
03939 char *attTextEnd;
03940 const char *ch = *p;
03941 start = clock();
03942 const char *c_numberOfObjectives = "numberOfObjectives";
03943 const char *startObjectives = "<objectives";
03944 const char *endObjectives = "</objectives";
03945 const char *startObj = "<obj";
03946 const char *endObj = "</obj";
03947
03948 char *attText = NULL;
03949 const char *constant = "constant";
03950 const char *maxOrMin = "maxOrMin";
03951 const char *numberOfObjCoef = "numberOfObjCoeff";
03952 const char *weight = "weight";
03953 const char *name = "name";
03954 const char *mult = "mult";
03955
03956 int i;
03957
03958 bool objmaxOrMinattON = false;
03959 bool objnameattON = false;
03960 bool objconstantattON = false;
03961 bool objweightattON = false;
03962 bool objmultattON = false;
03963 bool objnumberOfObjCoefattON = false;
03964 int objcount = 0;
03965 int numberOfObjectives;
03966 bool foundObj;
03967 int objmult;
03968
03969
03970 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03971
03972 *p = ch;
03973 while( *startObjectives++ == *ch) ch++;
03974 if( (ch - *p) != 11) {
03975
03976 return true;
03977 }
03978
03979
03980
03981 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
03982
03983
03984 if(*ch == '>'){
03985 numberOfObjectives = 1;
03986
03987 }
03988 else{
03989 *p = ch;
03990 while( *c_numberOfObjectives++ == *ch) ch++;
03991 if( (ch - *p) != 18) { osilerror_wrapper( ch,osillineno,"incorrect numberOfObjectives attribute in <objectives> tag"); return false;}
03992 GETATTRIBUTETEXT;
03993 numberOfObjectives = atoimod1( osillineno, attText, attTextEnd);
03994 delete [] attText;
03995 ch++;
03996 }
03997 if(numberOfObjectives > 0){
03998
03999 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04000
04001
04002
04003
04004
04005
04006
04007
04008
04009
04010 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"the objectives element does not have a proper closing"); return false;}
04011 osinstance->instanceData->objectives->numberOfObjectives = numberOfObjectives;
04012 osinstance->instanceData->objectives->obj = new Objective*[ numberOfObjectives];
04013 for(i = 0; i < numberOfObjectives; i++){
04014 osinstance->instanceData->objectives->obj[ i] = new Objective();
04015 }
04016
04017 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04018
04019 *p = ch;
04020 while( *startObj++ == *ch) ch++;
04021 if( (ch - *p) == 4) foundObj = true;
04022 else { osilerror_wrapper( ch,osillineno,"there must be at least one <obj> element"); return false;}
04023 startObj -= 5;
04024 start = clock();
04025 while(foundObj){
04026 objmaxOrMinattON = false;
04027 objnameattON = false;
04028 objconstantattON = false;
04029 objweightattON = false;
04030 objmultattON = false;
04031 objnumberOfObjCoefattON = false;
04032 objmult = 1;
04033
04034
04035 ch++;
04036 while(*ch != '/' && *ch != '>'){
04037 switch (*ch) {
04038 case 'n':
04039 if( *(ch+1) == 'u'){
04040 *p = ch;
04041 while( *numberOfObjCoef++ == *ch) ch++;
04042 numberOfObjCoef -= 16;
04043 if( ( (ch - *p) != 15) ) { osilerror_wrapper( ch,osillineno,"error in objective numberOfObjCoef attribute"); return false;}
04044 else{
04045 if(objnumberOfObjCoefattON == true) { osilerror_wrapper( ch,osillineno,"too many obj numberOfObjCoefatt attributes"); return false;}
04046 objnumberOfObjCoefattON = true;
04047 GETATTRIBUTETEXT;
04048
04049 osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef=atoimod1( osillineno,attText, attTextEnd);
04050 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;}
04051 osinstance->instanceData->objectives->obj[objcount]->coef = new ObjCoef*[osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef];
04052 for(int i = 0; i < osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef; i++)osinstance->instanceData->objectives->obj[objcount]->coef[i] = new ObjCoef();
04053 delete [] attText;
04054 }
04055 }
04056 else{
04057 *p = ch;
04058 while( *name++ == *ch) ch++;
04059 name -= 5;
04060 if( ( (ch - *p) != 4) ) { osilerror_wrapper( ch,osillineno,"error in objective name attribute"); return false;}
04061 else{
04062 if(objnameattON == true) { osilerror_wrapper( ch,osillineno,"too many obj name attributes"); return false;}
04063 objnameattON = true;
04064 GETATTRIBUTETEXT;
04065
04066 osinstance->instanceData->objectives->obj[objcount]->name=attText;
04067 delete [] attText;
04068 }
04069 }
04070 break;
04071 case 'c':
04072 *p = ch;
04073 while( *constant++ == *ch) ch++;
04074 constant -= 9;
04075 if( ( (ch - *p) != 8) ) { osilerror_wrapper( ch,osillineno,"error in objective constant attribute"); return false;}
04076 else{
04077 if(objconstantattON == true) { osilerror_wrapper( ch,osillineno,"too many obj constant attributes"); return false;}
04078 objconstantattON = true;
04079 GETATTRIBUTETEXT;
04080
04081 osinstance->instanceData->objectives->obj[objcount]->constant=atofmod1( osillineno,attText, attTextEnd);
04082 delete [] attText;
04083 }
04084 break;
04085 case 'w':
04086 *p = ch;
04087 while( *weight++ == *ch) ch++;
04088 weight -= 7;
04089 if( ( (ch - *p) != 6) ) { osilerror_wrapper( ch,osillineno,"error in objective weight attribute"); return false;}
04090 else{
04091 if(objweightattON == true) { osilerror_wrapper( ch,osillineno,"too many obj weight attributes"); return false;}
04092 objweightattON = true;
04093 GETATTRIBUTETEXT;
04094
04095 osinstance->instanceData->objectives->obj[objcount]->weight=atofmod1( osillineno,attText, attTextEnd);
04096 delete [] attText;
04097 }
04098 break;
04099 case 'm':
04100 if(*(ch+1) == 'a'){
04101 *p = ch;
04102 while( *maxOrMin++ == *ch) ch++;
04103 maxOrMin -= 9;
04104 if( ( ( ch - *p) != 8) ) { osilerror_wrapper( ch,osillineno,"error in objective maxOrMin attribute"); return false;}
04105 else{
04106 if(objmaxOrMinattON == true) { osilerror_wrapper( ch,osillineno,"too many obj maxOrMin attributes"); return false;}
04107 objmaxOrMinattON = true;
04108 GETATTRIBUTETEXT;
04109
04110 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;}
04111 osinstance->instanceData->objectives->obj[objcount]->maxOrMin = attText;
04112 delete [] attText;
04113 }
04114 }
04115 else{
04116 *p = ch;
04117 while( *mult++ == *ch) ch++;
04118 mult -= 5;
04119 if( ( (ch - *p) != 4) ) { osilerror_wrapper( ch,osillineno,"error in objective mult attribute"); return false;}
04120 else{
04121 if(objmultattON == true) { osilerror_wrapper( ch,osillineno,"too many obj mult attributes"); return false;}
04122 objmultattON = true;
04123 GETATTRIBUTETEXT;
04124 objmult = atoimod1( osillineno,attText, attTextEnd);
04125
04126
04127 delete [] attText;
04128 }
04129 }
04130 break;
04131
04132 case ' ':
04133 break;
04134 case '\n':
04135 (*osillineno)++;
04136 break;
04137 case '\t':
04138 break;
04139 case '\r':
04140 break;
04141 default:
04142
04143 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04144 return false;
04145 break;
04146 }
04147 ch++;
04148 }
04149
04150
04151
04152 if( *ch != '/' && *ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <obj> element"); return false;}
04153 if(*ch == '/'){
04154 ch++;
04155 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <obj> element"); return false;}
04156
04157 ch++;
04158 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04159
04160 for(i = 0; startObj[i] == *ch; i++, ch++);
04161 if(i == 4) foundObj = true;
04162 else foundObj = false;
04163 }
04164 else{
04165
04166
04167 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improper ending to a <obj> element"); return false;}
04168
04169
04170 ch++;
04171
04172 parseObjCoef(&ch, objcount, osinstance, osillineno);
04173 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04174
04175 for(i = 0; endObj[i] == *ch; i++, ch++);
04176 if(i != 5) { osilerror_wrapper( ch,osillineno,"</obj> element missing"); return false;}
04177
04178 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04179
04180 if(*ch++ != '>'){ osilerror_wrapper( ch,osillineno,"</obj> element missing"); return false;}
04181
04182
04183 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04184
04185 for(i = 0; startObj[i] == *ch; i++, ch++);
04186 if(i == 4) foundObj = true;
04187 else foundObj = false;
04188 }
04189 if( ((objcount+objmult) == numberOfObjectives) && (foundObj == true)) { osilerror_wrapper( ch,osillineno,"attribute numberOfObjectives is less than actual number found"); return false;}
04190 for (int k=1; k < objmult; k++)
04191 {
04192 osinstance->instanceData->objectives->obj[objcount+k]->name
04193 = osinstance->instanceData->objectives->obj[objcount]->name;
04194 osinstance->instanceData->objectives->obj[objcount+k]->maxOrMin
04195 = osinstance->instanceData->objectives->obj[objcount]->maxOrMin;
04196 osinstance->instanceData->objectives->obj[objcount+k]->constant
04197 = osinstance->instanceData->objectives->obj[objcount]->constant;
04198 osinstance->instanceData->objectives->obj[objcount+k]->weight
04199 = osinstance->instanceData->objectives->obj[objcount]->weight;
04200 osinstance->instanceData->objectives->obj[objcount+k]->numberOfObjCoef
04201 = osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef;
04202 if (osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef > 0)
04203 {
04204 osinstance->instanceData->objectives->obj[objcount+k]->coef = new ObjCoef*[osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef];
04205 for(int i = 0; i < osinstance->instanceData->objectives->obj[ objcount]->numberOfObjCoef; i++)
04206 {
04207 osinstance->instanceData->objectives->obj[objcount+k]->coef[i] = new ObjCoef();
04208 osinstance->instanceData->objectives->obj[objcount+k]->coef[i]->idx =
04209 osinstance->instanceData->objectives->obj[objcount]->coef[i]->idx;
04210 osinstance->instanceData->objectives->obj[objcount+k]->coef[i]->value =
04211 osinstance->instanceData->objectives->obj[objcount]->coef[i]->value;
04212 }
04213 }
04214 }
04215 objcount += objmult;
04216 }
04217 if(objcount < numberOfObjectives) { osilerror_wrapper( ch,osillineno,"attribute numberOfObjectives is greater than actual number found"); return false;}
04218 ch -= i;
04219
04220 for(i = 0; endObjectives[i] == *ch; i++, ch++);
04221 if(i != 12) { osilerror_wrapper( ch,osillineno, "cannot find </objectives> tag"); return false; }
04222 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04223
04224 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </objectives> tag"); return false;}
04225 ch++;
04226 }
04227 else{
04228
04229 if(numberOfObjectives < 0) { osilerror_wrapper( ch,osillineno,"cannot have a negative number of objectives"); return false;}
04230
04231
04232
04233 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04234 if( *ch == '/'){
04235
04236 ch++;
04237 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed objectives tag"); return false;}
04238 ch++;
04239 }
04240 else{
04241
04242 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed objectives tag"); return false;}
04243 ch++;
04244
04245 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04246 for(i = 0; endObjectives[i] == *ch; i++, ch++);
04247 if(i != 12) { osilerror_wrapper( ch,osillineno, "cannot find </objectives> tag"); return false; }
04248 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04249
04250 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </objectives> tag"); return false;}
04251 ch++;
04252 }
04253 }
04254 finish = clock();
04255 #ifdef CHECK_PARSE_TIME
04256 duration = (double) (finish - start) / CLOCKS_PER_SEC;
04257 printf("TIME TO PARSE OBJECTIVES = %f\n", duration);
04258 #endif
04259 *p = ch;
04260 return true;
04261 }
04262
04263 bool parseConstraints( const char **p, OSInstance *osinstance, int* osillineno){
04264 clock_t start, finish;
04265 #ifdef CHECK_PARSE_TIME
04266 double duration;
04267 #endif
04268 int ki, numChar;
04269 char *attTextEnd;
04270 const char *ch = *p;
04271 start = clock();
04272 const char *c_numberOfConstraints = "numberOfConstraints";
04273 const char *startConstraints = "<constraints";
04274 const char *endConstraints = "</constraints";
04275 const char *startCon = "<con";
04276 const char *endCon = "</con";
04277
04278 char *attText = NULL;
04279 const char *name = "name";
04280 const char *constant = "constant";
04281 const char *mult = "mult";
04282
04283 int i;
04284 int concount = 0;
04285 int numberOfConstraints = 0;
04286
04287 bool conlbattON = false ;
04288 bool conubattON = false;
04289 bool connameattON = false;
04290 bool conconstantattON = false;
04291 bool conmultattON = false;
04292 bool foundCon = false;
04293 int conmult;
04294
04295
04296
04297 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04298
04299 *p = ch;
04300 for(i = 0; startConstraints[i] == *ch; i++, ch++);
04301 while( *startConstraints++ == *ch) ch++;
04302 if( (ch - *p) != 12) {
04303
04304 return true;
04305 }
04306
04307
04308 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04309 *p = ch;
04310 while( *c_numberOfConstraints++ == *ch) ch++;
04311 if( (ch - *p) != 19) { osilerror_wrapper( ch,osillineno,"incorrect numberOfConstraints attribute in <constraints> tag"); return false;}
04312
04313 GETATTRIBUTETEXT;
04314 ch++;
04315 numberOfConstraints = atoimod1( osillineno, attText, attTextEnd);
04316 delete [] attText;
04317
04318
04319 if(numberOfConstraints > 0){
04320 osinstance->instanceData->constraints->numberOfConstraints = numberOfConstraints;
04321 osinstance->instanceData->constraints->con = new Constraint*[ numberOfConstraints];
04322 for(i = 0; i < numberOfConstraints; i++){
04323 osinstance->instanceData->constraints->con[ i] = new Constraint();
04324 }
04325
04326 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04327
04328 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"the constraints element does not have a proper closing"); return false;}
04329
04330 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04331
04332 *p = ch;
04333 while( *startCon++ == *ch) ch++;
04334 if( (ch - *p) == 4) foundCon = true;
04335 else { osilerror_wrapper( ch,osillineno,"there must be at least one <con> element"); return false;}
04336 startCon -= 5;
04337 while(foundCon){
04338 conlbattON = false ;
04339 conubattON = false;
04340 connameattON = false;
04341 conconstantattON = false;
04342 conmultattON = false;
04343 conmult = 1;
04344
04345
04346
04347 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04348 while(*ch != '/' && *ch != '>'){
04349 switch (*ch) {
04350 case 'n':
04351 *p = ch;
04352 while( *name++ == *ch) ch++;
04353 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in constraints name attribute"); return false;}
04354 if(connameattON == true) { osilerror_wrapper( ch,osillineno,"too many con name attributes"); return false;}
04355 name -= 5;
04356 connameattON = true;
04357 GETATTRIBUTETEXT;
04358 osinstance->instanceData->constraints->con[concount]->name=attText;
04359 delete [] attText;
04360
04361 break;
04362 case 'c':
04363 *p = ch;
04364 while( *constant++ == *ch) ch++;
04365 if( ((ch - *p) != 8) ) { osilerror_wrapper( ch,osillineno,"error in constraint constant attribute"); return false;}
04366 if(conconstantattON == true) { osilerror_wrapper( ch,osillineno,"too many con constant attributes"); return false;}
04367 constant -= 9;
04368 conconstantattON = true;
04369 GETATTRIBUTETEXT;
04370
04371 osinstance->instanceData->constraints->con[concount]->constant=atofmod1( osillineno,attText, attTextEnd);
04372 delete [] attText;
04373 break;
04374 case 'l':
04375 ch++;
04376 if(*ch++ != 'b') { osilerror_wrapper( ch,osillineno,"error in constraint lb attribute"); return false;}
04377 if(conlbattON == true) { osilerror_wrapper( ch,osillineno,"too many con lb attributes"); return false;}
04378 conlbattON = true;
04379 GETATTRIBUTETEXT;
04380 osinstance->instanceData->constraints->con[concount]->lb = atofmod1( osillineno,attText, attTextEnd);
04381 delete [] attText;
04382
04383 break;
04384 case 'u':
04385 ch++;
04386 if(*ch++ != 'b') { osilerror_wrapper( ch,osillineno,"error in constraint ub attribute"); return false;}
04387 if(conubattON == true) { osilerror_wrapper( ch,osillineno,"too many con ub attributes"); return false;}
04388 conubattON = true;
04389 GETATTRIBUTETEXT;
04390 osinstance->instanceData->constraints->con[concount]->ub = atofmod1( osillineno,attText, attTextEnd);
04391 delete [] attText;
04392
04393 break;
04394 case 'm':
04395 *p = ch;
04396 while( *mult++ == *ch) ch++;
04397 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in constraints mult attribute"); return false;}
04398 if(conmultattON == true) { osilerror_wrapper( ch,osillineno,"too many con mult attributes"); return false;}
04399 mult -= 5;
04400 conmultattON = true;
04401 GETATTRIBUTETEXT;
04402 conmult = atoimod1( osillineno,attText, attTextEnd);
04403 delete [] attText;
04404
04405 break;
04406 case ' ':
04407 break;
04408 case '\n':
04409 (*osillineno)++;
04410 break;
04411 case '\t':
04412 break;
04413 case '\r':
04414 break;
04415 default:
04416 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04417 return false;
04418 break;
04419 }
04420 ch++;
04421 }
04422
04423
04424
04425 if( *ch != '/' && *ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <con> element"); return false;}
04426 if(*ch == '/'){
04427 ch++;
04428 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"incorrect end of <con> element"); return false;}
04429
04430 ch++;
04431 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04432
04433 *p = ch;
04434 while( *startCon++ == *ch) ch++;
04435 if( (ch - *p) == 4){
04436 foundCon = true;
04437 startCon -= 5;
04438 }
04439 else{
04440 foundCon = false;
04441 ch = *p;
04442 }
04443 }
04444 else{
04445
04446
04447 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improper ending to a <con> element"); return false;}
04448
04449
04450 ch++;
04451 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04452
04453 *p = ch;
04454 while( *endCon++ == *ch) ch++;
04455 if( (ch - *p) != 5) { osilerror_wrapper( ch,osillineno,"</con> element missing"); return false;}
04456 endCon -= 6;
04457
04458 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04459
04460 if(*ch++ != '>') { osilerror_wrapper( ch,osillineno,"</con> element missing >"); return false;}
04461
04462
04463 ch++;
04464 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04465
04466 *p = ch;
04467 while( *startCon++ == *ch) ch++;
04468 if( (ch - *p) == 4){
04469 foundCon = true;
04470 startCon -= 5;
04471 }
04472 else{
04473 foundCon = false;
04474 ch = *p;
04475 }
04476 }
04477 if( ((concount+conmult) == numberOfConstraints) && (foundCon == true) ) { osilerror_wrapper( ch,osillineno,"attribute numberOfConstraints is less than actual number found"); return false;}
04478 for (int k=1; k < conmult; k++)
04479 {
04480 osinstance->instanceData->constraints->con[concount+k]->name
04481 = osinstance->instanceData->constraints->con[concount]->name ;
04482 osinstance->instanceData->constraints->con[concount+k]->constant
04483 = osinstance->instanceData->constraints->con[concount]->constant ;
04484 osinstance->instanceData->constraints->con[concount+k]->lb
04485 = osinstance->instanceData->constraints->con[concount]->lb ;
04486 osinstance->instanceData->constraints->con[concount+k]->ub
04487 = osinstance->instanceData->constraints->con[concount]->ub ;
04488 }
04489 concount += conmult;
04490 }
04491 if(concount < numberOfConstraints) { osilerror_wrapper( ch,osillineno,"attribute numberOfConstraints is greater than actual number found"); return false;}
04492
04493 *p = ch;
04494 while( *endConstraints++ == *ch) ch++;
04495 if( (ch - *p) != 13) { osilerror_wrapper( ch,osillineno, "cannot find </constraints> tag"); return false;}
04496 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04497
04498 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </constraints> tag"); return false;}
04499 ch++;
04500 }
04501 else{
04502
04503 if(numberOfConstraints < 0) { osilerror_wrapper( ch,osillineno,"cannot have a negative number of constraints"); return false;}
04504
04505
04506
04507 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04508 if( *ch == '/'){
04509
04510 ch++;
04511 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed constraints tag"); return false;}
04512 ch++;
04513 }
04514 else{
04515
04516 if( *ch != '>') { osilerror_wrapper( ch,osillineno,"improperly closed constraints tag"); return false;}
04517 ch++;
04518
04519 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04520 *p = ch;
04521 while( *endConstraints++ == *ch) ch++;
04522 if( (ch - *p) != 13) { osilerror_wrapper( ch,osillineno, "cannot find </constraints> tag"); return false; }
04523 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04524
04525 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </constraints> tag"); return false;}
04526 ch++;
04527 }
04528 }
04529 finish = clock();
04530 #ifdef CHECK_PARSE_TIME
04531 duration = (double) (finish - start) / CLOCKS_PER_SEC;
04532 printf("TIME TO PARSE CONSTRAINTS = %f\n", duration);
04533 #endif
04534 *p = ch;
04535 return true;
04536 }
04537
04538 bool parseLinearConstraintCoefficients( const char **p, OSInstance *osinstance, int* osillineno){;
04539 int ki, numChar;
04540 char *attTextEnd;
04541 const char *ch = *p;
04542 const char *c_numberOfValues = "numberOfValues";
04543 const char *startlinearConstraintCoefficients = "<linearConstraintCoefficients";
04544 const char *endlinearConstraintCoefficients = "</linearConstraintCoefficients";
04545
04546 char *attText = NULL;
04547
04548 int numberOfValues;
04549
04550
04551 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04552
04553 *p = ch;
04554 while( *startlinearConstraintCoefficients++ == *ch) ch++;
04555 if( (ch - *p) != 29) {
04556
04557 ch = *p;
04558 return true;
04559 }
04560
04561
04562 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04563 *p = ch;
04564 while( *c_numberOfValues++ == *ch) ch++;
04565 if( (ch - *p) != 14) { osilerror_wrapper( ch,osillineno,"incorrect numberOfValues attribute in <linearConstraintCoefficients> tag"); return false;}
04566
04567 GETATTRIBUTETEXT;
04568 ch++;
04569 numberOfValues = atoimod1( osillineno, attText, attTextEnd);
04570 if(numberOfValues > 0 && osinstance->instanceData->variables->numberOfVariables == 0){ osilerror_wrapper( ch,osillineno,"we have zero variables, but A matrix coefficients"); return false;}
04571 delete [] attText;
04572 if(numberOfValues <= 0) { osilerror_wrapper( ch,osillineno,"the number of nonlinear nonzeros must be positive"); return false;}
04573 osinstance->instanceData->linearConstraintCoefficients->numberOfValues = numberOfValues;
04574
04575 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04576
04577 if(*ch == '/'){
04578 ch++;
04579 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"the linearConstraintCoefficients element does not have a proper closing"); return false;}
04580 else{
04581 if(numberOfValues > 0) { osilerror_wrapper( ch,osillineno,"numberOfValues positive, but there are no values"); return false;}
04582 return false;
04583 }
04584 }
04585
04586 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"the <linearConstraintCoefficients> element does not have a proper closing"); return false;}
04587
04588 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04589 if( parseStart( &ch, osinstance, osillineno) != true) {osilerror_wrapper( ch,osillineno,"error processing <start> element"); return false;}
04590
04591
04592
04593 if( parseColIdx( &ch, osinstance, osillineno) == true)
04594 {
04595 if( parseRowIdx( &ch, osinstance, osillineno) == true)
04596 {
04597 osilerror_wrapper( ch,osillineno,"cannot store by both row and column");
04598 return false;
04599 }
04600 }
04601 else
04602 {
04603 if( parseRowIdx( &ch, osinstance, osillineno) != true)
04604 {
04605 osilerror_wrapper( ch,osillineno,"must have either RowIdx or ColIdx");
04606 return false;
04607 }
04608 else
04609 {
04610 if ( parseColIdx( &ch, osinstance, osillineno) == true )
04611 {
04612 osilerror_wrapper( ch,osillineno,"cannot store by both row and column");
04613 return false;
04614 }
04615 }
04616 }
04617
04618 if( parseValue( &ch, osinstance, osillineno) != true) {osilerror_wrapper( ch,osillineno, "could not parse <value> element"); return false;}
04619 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04620
04621 *p = ch;
04622 while( *endlinearConstraintCoefficients++ == *ch) ch++;
04623 if( (ch - *p) != 30) { osilerror_wrapper( ch,osillineno, "cannot find </linearConstraintCoefficients> tag"); return false;}
04624 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04625
04626 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </linearConstraintCoefficients> tag"); return false;}
04627 ch++;
04628 *p = ch;
04629 return true;
04630 }
04631
04632 bool parseStart(const char **p, OSInstance *osinstance, int* osillineno){
04633 clock_t start, finish;
04634 #ifdef CHECK_PARSE_TIME
04635 double duration;
04636 #endif
04637 int ki, numChar;
04638 char *attTextEnd;
04639 const char *ch = *p;
04640 start = clock();
04641 const char* startStart = "<start";
04642 const char* endStart = "</start";
04643 const char* startEl = "<el";
04644 const char* endEl = "</el";
04645
04646 char *attText = NULL;
04647 const char *incr = "incr";
04648 const char *mult = "mult";
04649 int kount = 0;
04650 int i;
04651
04652 bool elmultattON = false ;
04653 bool elincrattON = false;
04654 bool foundEl = false;
04655 int elmult;
04656 int elincr;
04657 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04658
04659 *p = ch;
04660 while( *startStart++ == *ch) ch++;
04661 if( (ch - *p) != 6) {
04662
04663 ch = *p;
04664 return false;
04665 }
04666
04667 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04668
04669 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <start> element"); return false;}
04670 ch++;
04671
04672 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04673
04674 *p = ch;
04675 while( *startEl++ == *ch) ch++;
04676 startEl -= 4;
04677 if( (ch - *p) != 3) {
04678
04679 ch = *p;
04680
04681 int dataSize = 0;
04682 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04683 if( b64string == NULL) { osilerror_wrapper( ch,osillineno,"<start> must have children or base64 data"); return false;}
04684 std::string base64decodeddata = Base64::decodeb64( b64string );
04685 int base64decodeddatalength = base64decodeddata.length();
04686 int *intvec = NULL;
04687 osinstance->instanceData->linearConstraintCoefficients->start->el = new int[(base64decodeddatalength/dataSize) ];
04688 intvec = (int*)&base64decodeddata[0];
04689 for (int i = 0; i < (base64decodeddatalength/dataSize); i++){
04690 osinstance->instanceData->linearConstraintCoefficients->start->el[ i] = *(intvec++);
04691 }
04692 delete [] b64string;
04693 }
04694 else{
04695 foundEl = true;
04696 osinstance->instanceData->linearConstraintCoefficients->start->el =
04697 new int[ std::max( osinstance->instanceData->constraints->numberOfConstraints,
04698 osinstance->instanceData->variables->numberOfVariables) + 1];
04699 while(foundEl){
04700
04701 elmultattON = false ;
04702 elincrattON = false;
04703 elmult = 1;
04704 elincr = 0;
04705
04706
04707
04708 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04709 while(*ch != '/' && *ch != '>'){
04710 switch (*ch) {
04711 case 'i':
04712 *p = ch;
04713 while( *incr++ == *ch) ch++;
04714 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in starts incr attribute"); return false;}
04715 if(elincrattON == true) { osilerror_wrapper( ch,osillineno,"too many el incr attributes"); return false;}
04716 incr -= 5;
04717 elincrattON = true;
04718 GETATTRIBUTETEXT;
04719 elincr = atoimod1( osillineno,attText, attTextEnd);
04720 delete [] attText;
04721
04722 break;
04723 case 'm':
04724 *p = ch;
04725 while( *mult++ == *ch) ch++;
04726 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in starts mult attribute"); return false;}
04727 if(elmultattON == true) { osilerror_wrapper( ch,osillineno,"too many el mult attributes"); return false;}
04728 mult -= 5;
04729 elmultattON = true;
04730 GETATTRIBUTETEXT;
04731 elmult = atoimod1( osillineno,attText, attTextEnd);
04732 delete [] attText;
04733
04734 break;
04735 case ' ':
04736 break;
04737 case '\n':
04738 (*osillineno)++;
04739 break;
04740 case '\t':
04741 break;
04742 case '\r':
04743 break;
04744 default:
04745 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04746 return false;
04747 break;
04748 }
04749 ch++;
04750 }
04751
04752
04753 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04754 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04755
04756 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04757
04758 *p = ch;
04759
04760
04761 while( *ch != '<' && *ch != EOF){
04762 ch++;
04763 }
04764
04765 if(*ch != '<') { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04766
04767
04768 if(kount +elmult > std::max(osinstance->instanceData->constraints->numberOfConstraints,
04769 osinstance->instanceData->variables->numberOfVariables) + 1 )
04770 {
04771 osilerror_wrapper( ch, osillineno,"number of start elements exceeds the maximum number of rows or columns plus 1");
04772 }
04773 osinstance->instanceData->linearConstraintCoefficients->start->el[kount] = atoimod1( osillineno, *p, ch);
04774 for (int k=1; k < elmult; k++)
04775 {
04776 osinstance->instanceData->linearConstraintCoefficients->start->el[ kount+k]
04777 = osinstance->instanceData->linearConstraintCoefficients->start->el[ kount] + k*elincr;
04778 }
04779 kount += elmult;
04780
04781
04782 *p = ch;
04783 while( *endEl++ == *ch) ch++;
04784 endEl -= 5;
04785 if( (ch - *p) != 4 ) { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04786
04787 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04788 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04789
04790 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04791
04792 *p = ch;
04793 while( *startEl++ == *ch) ch++;
04794 if( (ch - *p) == 3){
04795 foundEl = true;
04796 startEl -= 4;
04797 }
04798 else{
04799 foundEl = false;
04800 ch = *p;
04801 }
04802 }
04803
04804 if(osinstance->instanceData->linearConstraintCoefficients->start->el[ kount - 1 ] !=
04805 osinstance->instanceData->linearConstraintCoefficients->numberOfValues )
04806 osilerror_wrapper( ch, osillineno,"the value of the last start element is not equal to numberOfValues");
04807 }
04808
04809 *p = ch;
04810 while( *endStart++ == *ch) ch++;
04811 if( (ch - *p) != 7) { osilerror_wrapper( ch,osillineno, "cannot find </start> tag"); return false;}
04812 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04813
04814 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </start> tag"); return false;}
04815 ch++;
04816
04817 finish = clock();
04818 #ifdef CHECK_PARSE_TIME
04819 duration = (double) (finish - start) / CLOCKS_PER_SEC;
04820 printf("TIME TO PARSE STARTS = %f\n", duration);
04821 #endif
04822 *p = ch;
04823 osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements = kount;
04824
04825 return true;
04826 }
04827
04828 bool parseRowIdx( const char **p, OSInstance *osinstance, int* osillineno){
04829 clock_t start, finish;
04830 #ifdef CHECK_PARSE_TIME
04831 double duration;
04832 #endif
04833 int ki, numChar;
04834 char *attTextEnd;
04835 const char *ch = *p;
04836 start = clock();
04837 const char* startRowIdx = "<rowIdx";
04838 const char* endRowIdx = "</rowIdx";
04839 const char* startEl = "<el";
04840 const char* endEl = "</el";
04841
04842 char *attText = NULL;
04843 const char *incr = "incr";
04844 const char *mult = "mult";
04845 int kount = 0;
04846 int i;
04847
04848 bool elmultattON = false ;
04849 bool elincrattON = false;
04850 bool foundEl = false;
04851 int elmult;
04852 int elincr;
04853 int numberOfEl;
04854
04855 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04856
04857 *p = ch;
04858 while( *startRowIdx++ == *ch) ch++;
04859 if( (ch - *p) != 7) {
04860
04861 ch = *p;
04862 return false;
04863 }
04864
04865 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04866
04867 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <rowIdx> element"); return false;}
04868 ch++;
04869
04870 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04871
04872 *p = ch;
04873 while( *startEl++ == *ch) ch++;
04874 startEl -= 4;
04875 if( (ch - *p) != 3) {
04876
04877 ch = *p;
04878
04879 int dataSize = 0;
04880 char* b64string = parseBase64(&ch, &dataSize, osillineno );
04881 if( b64string == NULL) { osilerror_wrapper( ch,osillineno,"<rowIdx> must have children or base64 data"); return false;}
04882 std::string base64decodeddata = Base64::decodeb64( b64string );
04883 int base64decodeddatalength = base64decodeddata.length();
04884 int *intvec = NULL;
04885 numberOfEl = (base64decodeddatalength/dataSize);
04886 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = new int[numberOfEl ];
04887 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = NULL;
04888 osinstance->instanceData->linearConstraintCoefficients->rowIdx->numberOfEl = numberOfEl;
04889 osinstance->instanceData->linearConstraintCoefficients->colIdx->numberOfEl = 0;
04890 osinstance->instanceData->linearConstraintCoefficients->start->numberOfEl = osinstance->instanceData->variables->numberOfVariables + 1;
04891 intvec = (int*)&base64decodeddata[0];
04892 for(i = 0; i < numberOfEl; i++){
04893 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ i] = *(intvec++);
04894 kount++;
04895 }
04896 delete [] b64string;
04897 }
04898 else{
04899 foundEl = true;
04900
04901
04902 if( osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements != osinstance->instanceData->variables->numberOfVariables + 1)
04903 osilerror_wrapper( ch, osillineno,"we are storing in column major format, but number of start elements not equal number of variables + 1");
04904 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = new int[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
04905 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = NULL;
04906 osinstance->instanceData->linearConstraintCoefficients->rowIdx->numberOfEl = osinstance->instanceData->linearConstraintCoefficients->numberOfValues;
04907 osinstance->instanceData->linearConstraintCoefficients->colIdx->numberOfEl = 0;
04908 osinstance->instanceData->linearConstraintCoefficients->start->numberOfEl = osinstance->instanceData->variables->numberOfVariables + 1;
04909 while(foundEl){
04910
04911 elmultattON = false ;
04912 elincrattON = false;
04913 elmult = 1;
04914 elincr = 0;
04915
04916
04917
04918 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04919 while(*ch != '/' && *ch != '>'){
04920 switch (*ch) {
04921 case 'i':
04922 *p = ch;
04923 while( *incr++ == *ch) ch++;
04924 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in rowIdx incr attribute"); return false;}
04925 if(elincrattON == true) { osilerror_wrapper( ch,osillineno,"too many el incr attributes"); return false;}
04926 incr -= 5;
04927 elincrattON = true;
04928 GETATTRIBUTETEXT;
04929 elincr = atoimod1( osillineno,attText, attTextEnd);
04930 delete [] attText;
04931
04932 break;
04933 case 'm':
04934 *p = ch;
04935 while( *mult++ == *ch) ch++;
04936 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in rowIdx mult attribute"); return false;}
04937 if(elmultattON == true) { osilerror_wrapper( ch,osillineno,"too many el mult attributes"); return false;}
04938 mult -= 5;
04939 elmultattON = true;
04940 GETATTRIBUTETEXT;
04941 elmult = atoimod1( osillineno,attText, attTextEnd);
04942 delete [] attText;
04943
04944 break;
04945 case ' ':
04946 break;
04947 case '\n':
04948 (*osillineno)++;
04949 break;
04950 case '\t':
04951 break;
04952 case '\r':
04953 break;
04954 default:
04955 osilerror_wrapper( ch,osillineno,"invalid attribute character");
04956 return false;
04957 break;
04958 }
04959 ch++;
04960 }
04961
04962
04963 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04964 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
04965
04966 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
04967
04968 *p = ch;
04969
04970
04971 while( *ch != '<' && *ch != EOF){
04972 ch++;
04973 }
04974
04975 if(*ch != '<') { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04976
04977
04978 if(kount + elmult > osinstance->instanceData->linearConstraintCoefficients->numberOfValues)
04979 {
04980 osilerror_wrapper( ch, osillineno,"number of rowIdx elements exceeds the number declared");
04981 }
04982 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ kount] = atoimod1( osillineno, *p, ch);
04983 for (int k=1; k < elmult; k++)
04984 {
04985 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ kount+k]
04986 = osinstance->instanceData->linearConstraintCoefficients->rowIdx->el[ kount] + k*elincr;
04987 }
04988 kount += elmult;
04989
04990
04991 *p = ch;
04992 while( *endEl++ == *ch) ch++;
04993 endEl -= 5;
04994 if( (ch - *p) != 4 ) { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
04995
04996 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
04997 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
04998
04999 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05000
05001 *p = ch;
05002 while( *startEl++ == *ch) ch++;
05003 if( (ch - *p) == 3){
05004 foundEl = true;
05005 startEl -= 4;
05006 }
05007 else{
05008 foundEl = false;
05009 ch = *p;
05010 }
05011 }
05012 }
05013
05014 *p = ch;
05015 while( *endRowIdx++ == *ch) ch++;
05016 if( (ch - *p) != 8) { osilerror_wrapper( ch,osillineno, "cannot find </rowIdx> tag"); return false;}
05017 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05018
05019 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </rowIdx> tag");}
05020 ch++;
05021 if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute less than number of row indices found"); return false;}
05022 if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute greater than number of row indices found"); return false;}
05023 finish = clock();
05024 #ifdef CHECK_PARSE_TIME
05025 duration = (double) (finish - start) / CLOCKS_PER_SEC;
05026 printf("TIME TO PARSE ROW INDEXES = %f\n", duration);
05027 #endif
05028 *p = ch;
05029 return true;
05030 }
05031
05032
05033 bool parseColIdx( const char **p, OSInstance *osinstance, int* osillineno){
05034 clock_t start, finish;
05035 #ifdef CHECK_PARSE_TIME
05036 double duration;
05037 #endif
05038 int ki, numChar;
05039 char *attTextEnd;
05040 const char *ch = *p;
05041 start = clock();
05042 const char* startColIdx = "<colIdx";
05043 const char* endColIdx = "</colIdx";
05044 const char* startEl = "<el";
05045 const char* endEl = "</el";
05046
05047 char *attText = NULL;
05048 const char *incr = "incr";
05049 const char *mult = "mult";
05050 int kount = 0;
05051 int i;
05052
05053 bool elmultattON = false ;
05054 bool elincrattON = false;
05055 bool foundEl = false;
05056 int elmult;
05057 int elincr;
05058 int numberOfEl;
05059
05060 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05061
05062 *p = ch;
05063 while( *startColIdx++ == *ch) ch++;
05064 if( (ch - *p) != 7) {
05065
05066 ch = *p;
05067 return false;
05068 }
05069
05070 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05071
05072 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <colIdx> element"); return false;}
05073 ch++;
05074
05075 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05076
05077 *p = ch;
05078 while( *startEl++ == *ch) ch++;
05079 startEl -= 4;
05080 if( (ch - *p) != 3) {
05081
05082 ch = *p;
05083
05084 int dataSize = 0;
05085 char* b64string = parseBase64(&ch, &dataSize, osillineno );
05086 if( b64string == NULL) { osilerror_wrapper( ch,osillineno,"<colIdx> must have children or base64 data"); return false;}
05087 std::string base64decodeddata = Base64::decodeb64( b64string );
05088 int base64decodeddatalength = base64decodeddata.length();
05089 int *intvec = NULL;
05090 numberOfEl = (base64decodeddatalength/dataSize);
05091 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = new int[numberOfEl ];
05092 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = NULL;
05093 osinstance->instanceData->linearConstraintCoefficients->colIdx->numberOfEl = numberOfEl;
05094 osinstance->instanceData->linearConstraintCoefficients->rowIdx->numberOfEl = 0;
05095 osinstance->instanceData->linearConstraintCoefficients->start->numberOfEl = osinstance->instanceData->constraints->numberOfConstraints + 1;
05096 intvec = (int*)&base64decodeddata[0];
05097 for(i = 0; i < numberOfEl; i++){
05098 osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ i] = *(intvec++);
05099 kount++;
05100 }
05101 delete [] b64string;
05102 }
05103 else{
05104 foundEl = true;
05105
05106
05107 if(osinstance->instanceData->linearConstraintCoefficients->iNumberOfStartElements != osinstance->instanceData->constraints->numberOfConstraints + 1)
05108 osilerror_wrapper( ch, osillineno,"we are storing in row major format, but number of start elements not equal number of rows + 1");
05109 osinstance->instanceData->linearConstraintCoefficients->colIdx->el = new int[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
05110 osinstance->instanceData->linearConstraintCoefficients->rowIdx->el = NULL;
05111 osinstance->instanceData->linearConstraintCoefficients->colIdx->numberOfEl = osinstance->instanceData->linearConstraintCoefficients->numberOfValues;
05112 osinstance->instanceData->linearConstraintCoefficients->rowIdx->numberOfEl = 0;
05113 osinstance->instanceData->linearConstraintCoefficients->start->numberOfEl = osinstance->instanceData->constraints->numberOfConstraints + 1;
05114 while(foundEl){
05115
05116 elmultattON = false ;
05117 elincrattON = false;
05118 elmult = 1;
05119 elincr = 0;
05120
05121
05122
05123 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05124 while(*ch != '/' && *ch != '>'){
05125 switch (*ch) {
05126 case 'i':
05127 *p = ch;
05128 while( *incr++ == *ch) ch++;
05129 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in colIdx incr attribute"); return false;}
05130 if(elincrattON == true) { osilerror_wrapper( ch,osillineno,"too many el incr attributes"); return false;}
05131 incr -= 5;
05132 elincrattON = true;
05133 GETATTRIBUTETEXT;
05134 elincr = atoimod1( osillineno,attText, attTextEnd);
05135 delete [] attText;
05136
05137 break;
05138 case 'm':
05139 *p = ch;
05140 while( *mult++ == *ch) ch++;
05141 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in colIdx mult attribute"); return false;}
05142 if(elmultattON == true) { osilerror_wrapper( ch,osillineno,"too many el mult attributes"); return false;}
05143 mult -= 5;
05144 elmultattON = true;
05145 GETATTRIBUTETEXT;
05146 elmult = atoimod1( osillineno,attText, attTextEnd);
05147 delete [] attText;
05148
05149 break;
05150 case ' ':
05151 break;
05152 case '\n':
05153 (*osillineno)++;
05154 break;
05155 case '\t':
05156 break;
05157 case '\r':
05158 break;
05159 default:
05160 osilerror_wrapper( ch,osillineno,"invalid attribute character");
05161 return false;
05162 break;
05163 }
05164 ch++;
05165 }
05166
05167
05168 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05169 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
05170
05171 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05172
05173 *p = ch;
05174
05175
05176 while( *ch != '<' && *ch != EOF){
05177 ch++;
05178 }
05179
05180 if(*ch != '<') { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
05181
05182 if(kount + elmult > osinstance->instanceData->linearConstraintCoefficients->numberOfValues)
05183 {
05184 osilerror_wrapper( ch, osillineno,"number of colIdx elements exceeds the number declared");
05185 }
05186 osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ kount] = atoimod1( osillineno, *p, ch);
05187 for (int k=1; k < elmult; k++)
05188 {
05189 osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ kount+k]
05190 = osinstance->instanceData->linearConstraintCoefficients->colIdx->el[ kount] + k*elincr;
05191 }
05192 kount += elmult;
05193
05194
05195 *p = ch;
05196 while( *endEl++ == *ch) ch++;
05197 endEl -= 5;
05198 if( (ch - *p) != 4 ) { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
05199
05200 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05201 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
05202
05203 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05204
05205 *p = ch;
05206 while( *startEl++ == *ch) ch++;
05207 if( (ch - *p) == 3){
05208 foundEl = true;
05209 startEl -= 4;
05210 }
05211 else{
05212 foundEl = false;
05213 ch = *p;
05214 }
05215 }
05216 }
05217
05218 *p = ch;
05219 while( *endColIdx++ == *ch) ch++;
05220 if( (ch - *p) != 8) { osilerror_wrapper( ch,osillineno, "cannot find </colIdx> tag"); return false;}
05221 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05222
05223 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </colIdx> tag"); return false;}
05224 ch++;
05225 if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute less than number of column indices found"); return false;}
05226 if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues) { osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients attribute greater than number of column indices found"); return false;}
05227 finish = clock();
05228 #ifdef CHECK_PARSE_TIME
05229 duration = (double) (finish - start) / CLOCKS_PER_SEC;
05230 printf("TIME TO PARSE COLUMN INDEXES = %f\n", duration);
05231 #endif
05232 *p = ch;
05233 return true;
05234 }
05235
05236
05237 bool parseValue( const char **p, OSInstance *osinstance, int* osillineno){
05238 clock_t start, finish;
05239 #ifdef CHECK_PARSE_TIME
05240 double duration;
05241 #endif
05242 int ki, numChar;
05243 char *attTextEnd;
05244 const char *ch = *p;
05245 start = clock();
05246 const char* startValue = "<value";
05247 const char* endValue = "</value";
05248 const char* startEl = "<el";
05249 const char* endEl = "</el";
05250
05251 char *attText = NULL;
05252 const char *incr = "incr";
05253 const char *mult = "mult";
05254 int kount = 0;
05255 int i;
05256
05257 bool elmultattON = false ;
05258 bool elincrattON = false;
05259 bool foundEl = false;
05260 int elmult;
05261 double elincr;
05262 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
05263
05264 *p = ch;
05265 while( *startValue++ == *ch) ch++;
05266 if( (ch - *p) != 6) {
05267
05268 ch = *p;
05269 return false;
05270 }
05271
05272 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
05273
05274 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <value> element"); return false;}
05275 ch++;
05276
05277 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
05278
05279 *p = ch;
05280 while( *startEl++ == *ch) ch++;
05281 startEl -= 4;
05282 if( (ch - *p) != 3) {
05283
05284 ch = *p;
05285
05286 int dataSize = 0;
05287 char* b64string = parseBase64(&ch, &dataSize, osillineno );
05288 if( b64string == NULL) { osilerror_wrapper( ch,osillineno,"<start> must have children or base64 data"); return false;};
05289 std::string base64decodeddata = Base64::decodeb64( b64string );
05290 int base64decodeddatalength = base64decodeddata.length();
05291 osinstance->instanceData->linearConstraintCoefficients->value->el = new double[(base64decodeddatalength/dataSize) ];
05292 int kountChar = 0;
05293 int kj;
05294
05295
05296 if( sizeof( double) != dataSize ) {
05297 osilerror_wrapper( ch, osillineno,
05298 "base 64 encoded with a size of double different than on this machine");
05299 return false;
05300 }
05301 union doubleBuffer{
05302 char memAlign[sizeof(double)];
05303 double dble;
05304 };
05305 doubleBuffer dbuf;
05306 for(i = 0; i < (base64decodeddatalength/dataSize); i++){
05307 for(kj = 0; kj < dataSize; kj++){
05308 dbuf.memAlign[ kj] = base64decodeddata[kountChar];
05309 kountChar++;
05310 }
05311 osinstance->instanceData->linearConstraintCoefficients->value->el[ i] = dbuf.dble;
05312 std::cout << dbuf.dble << std::endl;
05313 kount++;
05314 }
05315 delete [] b64string;
05316 }
05317 else{
05318 foundEl = true;
05319 osinstance->instanceData->linearConstraintCoefficients->value->el =
05320 new double[ osinstance->instanceData->linearConstraintCoefficients->numberOfValues];
05321 while( foundEl){
05322
05323 elmultattON = false ;
05324 elincrattON = false;
05325 elmult = 1;
05326 elincr = 0;
05327
05328
05329
05330 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ );
05331 while(*ch != '/' && *ch != '>'){
05332 switch (*ch) {
05333 case 'i':
05334 *p = ch;
05335 while( *incr++ == *ch) ch++;
05336 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in values incr attribute"); return false;}
05337 if(elincrattON == true) { osilerror_wrapper( ch,osillineno,"too many el incr attributes"); return false;}
05338 incr -= 5;
05339 elincrattON = true;
05340 GETATTRIBUTETEXT;
05341 elincr = atofmod1( osillineno,attText, attTextEnd);
05342 delete [] attText;
05343
05344 break;
05345 case 'm':
05346 *p = ch;
05347 while( *mult++ == *ch) ch++;
05348 if( (ch - *p) != 4) { osilerror_wrapper( ch,osillineno,"error in values mult attribute"); return false;}
05349 if(elmultattON == true) { osilerror_wrapper( ch,osillineno,"too many el mult attributes"); return false;}
05350 mult -= 5;
05351 elmultattON = true;
05352 GETATTRIBUTETEXT;
05353 elmult = atoimod1( osillineno,attText, attTextEnd);
05354 delete [] attText;
05355
05356 break;
05357 case ' ':
05358 break;
05359 case '\n':
05360 (*osillineno)++;
05361 break;
05362 case '\t':
05363 break;
05364 case '\r':
05365 break;
05366 default:
05367 osilerror_wrapper( ch,osillineno,"invalid attribute character");
05368 return false;
05369 break;
05370 }
05371 ch++;
05372 }
05373
05374
05375 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
05376 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed <el> tag"); return false;}
05377
05378 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ ) ;
05379 *p = ch;
05380
05381
05382 while( *ch != '<' && *ch != EOF){
05383 ch++;
05384 }
05385
05386 if(*ch != '<') { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
05387
05388 if(kount + elmult > osinstance->instanceData->linearConstraintCoefficients->numberOfValues)
05389 {
05390 osilerror_wrapper( ch, osillineno,"number of nonzero elements exceeds the number declared");
05391 }
05392 osinstance->instanceData->linearConstraintCoefficients->value->el[ kount] = atofmod1( osillineno, *p, ch);
05393 for (int k=1; k < elmult; k++)
05394 {
05395 osinstance->instanceData->linearConstraintCoefficients->value->el[ kount+k]
05396 = osinstance->instanceData->linearConstraintCoefficients->value->el[ kount] + k*elincr;
05397 }
05398 kount += elmult;
05399
05400
05401 *p = ch;
05402 while( *endEl++ == *ch) ch++;
05403 endEl -= 5;
05404 if( (ch - *p) != 4 ) { osilerror_wrapper( ch,osillineno,"cannot find an </el>"); return false;}
05405
05406 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
05407 if( *ch++ != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </el> tag"); return false;}
05408
05409 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
05410
05411 *p = ch;
05412 while( *startEl++ == *ch) ch++;
05413 if( (ch - *p) == 3){
05414 foundEl = true;
05415 startEl -= 4;
05416 }
05417 else{
05418 foundEl = false;
05419 ch = *p;
05420 }
05421 }
05422 }
05423 osinstance->instanceData->linearConstraintCoefficients->value->numberOfEl = osinstance->instanceData->linearConstraintCoefficients->numberOfValues;
05424
05425
05426 *p = ch;
05427 while( *endValue++ == *ch) ch++;
05428 if( (ch - *p) != 7) { osilerror_wrapper( ch,osillineno, "cannot find </value> tag"); return false;}
05429 for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno) ; ch++ );
05430
05431 if(*ch != '>') { osilerror_wrapper( ch,osillineno,"improperly formed </value> tag"); return false;}
05432 ch++;
05433 if(kount < osinstance->instanceData->linearConstraintCoefficients->numberOfValues){ osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients greater than number of values found"); return false;}
05434 if(kount > osinstance->instanceData->linearConstraintCoefficients->numberOfValues){ osilerror_wrapper( ch,osillineno,"numberOfLinearCoefficients less than the number of values found"); return false;}
05435 finish = clock();
05436 #ifdef CHECK_PARSE_TIME
05437 duration = (double) (finish - start) / CLOCKS_PER_SEC;
05438 printf("TIME TO PARSE VALUES = %f\n", duration);
05439 #endif
05440 *p = ch;
05441 return true;
05442 }
05443
05444 bool parseObjCoef( const char **p, int objcount, OSInstance *osinstance, int* osillineno){
05445 int ki, numChar;
05446 char *attTextEnd;
05447 const char *ch = *p;
05448 const char* startCoef = "<coef";
05449 const char* endCoef = "</coef";
05450 const char* c_idx = "idx";
05451 char *attText = NULL;
05452 int k;
05453 int numberOfObjCoef = 0;
05454 if( osinstance->instanceData->objectives->numberOfObjectives <= 0) { osilerror_wrapper( ch,osillineno,"we can't have objective function coefficients without an objective function"); return false;}
05455 numberOfObjCoef = osinstance->instanceData->objectives->obj[objcount]->numberOfObjCoef;
05456 if(numberOfObjCoef > 0) {
05457 for(k = 0; k < numberOfObjCoef; k++){
05458 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05459
05460 *p = ch;
05461 while( *startCoef++ == *ch) ch++;
05462 if( (ch - *p) != 5) { osilerror_wrapper( ch,osillineno,"improper <coef> element"); return false;}
05463 startCoef -= 6;
05464
05465
05466 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05467 *p = ch;
05468 while( *c_idx++ == *ch) ch++;
05469 if( (ch - *p) != 3) { osilerror_wrapper( ch,osillineno,"incorrect idx attribute in objective function <idx> tag"); return false;}
05470 c_idx -= 4;
05471
05472 GETATTRIBUTETEXT;
05473 osinstance->instanceData->objectives->obj[objcount]->coef[ k]->idx = atoimod1( osillineno, attText, attTextEnd);
05474 delete [] attText;
05475 ch++;
05476
05477 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05478
05479 if(*ch++ != '>') { osilerror_wrapper( ch,osillineno,"incorrect <coef> element") ; return false;}
05480
05481 *p = ch;
05482
05483 for(; *ch != '<' && *ch != EOF; ch++);
05484
05485
05486
05487 if(*ch != '<') { osilerror_wrapper( ch,osillineno,"improper </coef> tag"); return false;}
05488 osinstance->instanceData->objectives->obj[objcount]->coef[ k]->value = atofmod1( osillineno, *p, ch);
05489 *p = ch;
05490 while( *endCoef++ == *ch) ch++;
05491 if( (ch - *p) != 6) { osilerror_wrapper( ch,osillineno,"improper </coef> element"); return false;}
05492 endCoef -= 7;
05493
05494 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05495
05496 if(*ch++ != '>') { osilerror_wrapper( ch,osillineno,"incorrect </coef> element") ; return false;}
05497 }
05498 }
05499 *p = ch;
05500 return true;
05501 }
05502
05503 char *parseBase64(const char **p, int *dataSize, int* osillineno ){
05504 int ki, numChar;
05505 char *attTextEnd;
05506 const char *ch = *p;
05507 const char *sizeOf = "sizeOf";
05508
05509 const char *startBase64BinaryData = "<base64BinaryData";
05510 const char *endBase64BinaryData = "</base64BinaryData";
05511 char *attText = NULL;
05512 char *b64string = NULL;
05513 int i;
05514
05515 for(i = 0; startBase64BinaryData[i] == *ch; i++, ch++);
05516 if(i != 17) {
05517 ch -= i;
05518 *p = ch;
05519 return b64string;
05520 }
05521
05522
05523 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05524 for(i = 0; sizeOf[i] == *ch; i++, ch++);
05525 if(i != 6) { osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return false;}
05526
05527 GETATTRIBUTETEXT;
05528 ch++;
05529 *dataSize = atoimod1( osillineno, attText, attTextEnd);
05530 delete [] attText;
05531
05532
05533 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05534
05535 if(*ch != '>' ) { osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return false;}
05536 ch++;
05537
05538 const char *b64textstart = ch;
05539
05540 for(; *ch != '<' && *ch != EOF; ch++);
05541 const char *b64textend = ch;
05542
05543 for(i = 0; endBase64BinaryData[i] == *ch; i++, ch++);
05544 if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return false;}
05545 int b64len = b64textend - b64textstart;
05546 b64string = new char[ b64len + 1];
05547 for(ki = 0; ki < b64len; ki++) b64string[ki] = b64textstart[ ki];
05548 b64string[ki] = '\0';
05549
05550 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05551
05552 if(*ch != '>' ) { osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return false;}
05553 ch++;
05554 for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
05555 *p = ch;
05556 return b64string;
05557 }
05558
05559
05560 double atofmod1(int* osillineno, const char *number, const char *numberend){
05561
05562 std::string strINF ("INF");
05563 if(strINF.compare(0, 3, number, numberend - number) == 0) return OSDBL_MAX;
05564 double val;
05565 char *pEnd;
05566 val = os_strtod_wrap(number, &pEnd);
05567
05568
05569 for( ; ISWHITESPACE( *pEnd) || isnewline( *pEnd, osillineno); pEnd++ ) ;
05570
05571 if(pEnd != numberend) osilerror_wrapper( pEnd, osillineno, "error in parsing an XSD:double");
05572 return val;
05653 }
05654
05655
05656
05657 int atoimod1(int* osillineno, const char *number, const char *numberend){
05658
05659 int ival;
05660 int i, sign;
05661 int endWhiteSpace;
05662 for(i = 0; ISWHITESPACE( number[ i]) || isnewline( number[ i], osillineno) ; i++);
05663 endWhiteSpace = i;
05664 sign = (number[ i] == '-') ? -1 : 1;
05665 if (number[ i] == '+' || number[ i] == '-') i++;
05666 for(ival = 0; ISDIGIT( number[ i]); i++){
05667 ival = 10*ival + (number[ i] - '0') ;
05668 }
05669 if(i == endWhiteSpace) { osilerror_wrapper( number,osillineno, "error in parsing an XSD:int" ); }
05670
05671 for( ; ISWHITESPACE( number[ i]) || isnewline( number[ i], osillineno) ; i++);
05672 if(number[i] == *numberend){
05673 return sign*ival;
05674 }
05675 else { osilerror_wrapper( number,osillineno, "error in parsing an XSD:int"); return OSINT_MAX; }
05676 }
05677
05678 void osilerror_wrapper( const char* ch, int* osillineno, const char* errormsg){
05679 const int numErrorChar = 20;
05680 char errorArray[100] = "";
05681 strncpy(errorArray, ch, numErrorChar);
05682 std::ostringstream outStr;
05683 std::string error = errormsg;
05684 error = "PARSER ERROR: Input is either not valid or well formed: " + error;
05685 outStr << error << endl;
05686 outStr << "Here are " ;
05687 outStr << numErrorChar ;
05688 outStr << " characters currently being pointed to in the input string: ";
05689 outStr << errorArray;
05690 outStr << endl;
05691 outStr << "See line number: " << *osillineno << endl;
05692 error = outStr.str();
05693
05694 throw ErrorClass( error);
05695 }
05696
05697
05698