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