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