(file) Return to moflexinc.c CVS log (file) (dir) Up to [OMI] / omi / mof

   1 mike  1.1 /*
   2           **==============================================================================
   3           **
   4           ** Open Management Infrastructure (OMI)
   5           **
   6           ** Copyright (c) Microsoft Corporation
   7           ** 
   8           ** Licensed under the Apache License, Version 2.0 (the "License"); you may not 
   9           ** use this file except in compliance with the License. You may obtain a copy 
  10           ** of the License at 
  11           **
  12           **     http://www.apache.org/licenses/LICENSE-2.0 
  13           **
  14           ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15           ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
  16           ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
  17           ** MERCHANTABLITY OR NON-INFRINGEMENT. 
  18           **
  19           ** See the Apache 2 License for the specific language governing permissions 
  20           ** and limitations under the License.
  21           **
  22 mike  1.1 **==============================================================================
  23           */
  24           
  25           /* A lexical scanner generated by flex */
  26           
  27           /* Scanner skeleton version:
  28            * $Header: /cvsroot/omi/mof/moflexinc.c,v 1.1 2012/05/23 00:34:43 mikbras Exp $
  29            */
  30           
  31           #define FLEX_SCANNER
  32           #define YY_FLEX_MAJOR_VERSION 2
  33           #define YY_FLEX_MINOR_VERSION 5
  34           
  35           #include <stdio.h>
  36           
  37           
  38           /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  39           #ifdef c_plusplus
  40           #ifndef __cplusplus
  41           #define __cplusplus
  42           #endif
  43 mike  1.1 #endif
  44           
  45           
  46           #ifdef __cplusplus
  47           
  48           #include <stdlib.h>
  49           #include <unistd.h>
  50           
  51           /* Use prototypes in function declarations. */
  52           #define YY_USE_PROTOS
  53           
  54           /* The "const" storage-class-modifier is valid. */
  55           #define YY_USE_CONST
  56           
  57           #else	/* ! __cplusplus */
  58           
  59           #if __STDC__
  60           
  61           #define YY_USE_PROTOS
  62           #define YY_USE_CONST
  63           
  64 mike  1.1 #endif	/* __STDC__ */
  65           #endif	/* ! __cplusplus */
  66           
  67           #ifdef __TURBOC__
  68            #pragma warn -rch
  69            #pragma warn -use
  70           #include <io.h>
  71           #include <stdlib.h>
  72           #define YY_USE_CONST
  73           #define YY_USE_PROTOS
  74           #endif
  75           
  76           #ifdef YY_USE_CONST
  77           #define yyconst const
  78           #else
  79           #define yyconst
  80           #endif
  81           
  82           
  83           #ifdef YY_USE_PROTOS
  84           #define YY_PROTO(proto) proto
  85 mike  1.1 #else
  86           #define YY_PROTO(proto) ()
  87           #endif
  88           
  89           /* Returned upon end-of-file. */
  90           #define YY_NULL 0
  91           
  92           /* Promotes a possibly negative, possibly signed char to an unsigned
  93            * integer for use as an array index.  If the signed char is negative,
  94            * we want to instead treat it as an 8-bit unsigned char, hence the
  95            * double cast.
  96            */
  97           #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  98           
  99           /* Enter a start condition.  This macro really ought to take a parameter,
 100            * but we do it the disgusting crufty way forced on us by the ()-less
 101            * definition of BEGIN.
 102            */
 103           #define BEGIN yy_start = 1 + 2 *
 104           
 105           /* Translate the current start state into a value that can be later handed
 106 mike  1.1  * to BEGIN to return to the state.  The YYSTATE alias is for lex
 107            * compatibility.
 108            */
 109           #define YY_START ((yy_start - 1) / 2)
 110           #define YYSTATE YY_START
 111           
 112           /* Action number for EOF rule of a given start state. */
 113           #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 114           
 115           /* Special action meaning "start processing a new file". */
 116           #define YY_NEW_FILE yyrestart( yyin )
 117           
 118           #define YY_END_OF_BUFFER_CHAR 0
 119           
 120           /* Size of default input buffer. */
 121           #define YY_BUF_SIZE 16384
 122           
 123           typedef struct yy_buffer_state *YY_BUFFER_STATE;
 124           
 125           extern int yyleng;
 126           extern FILE *yyin, *yyout;
 127 mike  1.1 
 128           #define EOB_ACT_CONTINUE_SCAN 0
 129           #define EOB_ACT_END_OF_FILE 1
 130           #define EOB_ACT_LAST_MATCH 2
 131           
 132           /* The funky do-while in the following #define is used to turn the definition
 133            * int a single C statement (which needs a semi-colon terminator).  This
 134            * avoids problems with code like:
 135            *
 136            * 	if ( condition_holds )
 137            *		yyless( 5 );
 138            *	else
 139            *		do_something_else();
 140            *
 141            * Prior to using the do-while the compiler would get upset at the
 142            * "else" because it interpreted the "if" statement as being all
 143            * done when it reached the ';' after the yyless() call.
 144            */
 145           
 146           /* Return all but the first 'n' matched characters back to the input stream. */
 147           
 148 mike  1.1 #define yyless(n) \
 149           	do \
 150           		{ \
 151           		/* Undo effects of setting up yytext. */ \
 152           		*yy_cp = yy_hold_char; \
 153           		YY_RESTORE_YY_MORE_OFFSET \
 154           		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
 155           		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
 156           		} \
 157           	while ( 0 )
 158           
 159           #define unput(c) yyunput( c, yytext_ptr )
 160           
 161           /* The following is because we cannot portably get our hands on size_t
 162            * (without autoconf's help, which isn't available because we want
 163            * flex-generated scanners to compile on their own).
 164            */
 165           typedef unsigned int yy_size_t;
 166           
 167           
 168           struct yy_buffer_state
 169 mike  1.1 	{
 170           	FILE *yy_input_file;
 171           
 172           	char *yy_ch_buf;		/* input buffer */
 173           	char *yy_buf_pos;		/* current position in input buffer */
 174           
 175           	/* Size of input buffer in bytes, not including room for EOB
 176           	 * characters.
 177           	 */
 178           	yy_size_t yy_buf_size;
 179           
 180           	/* Number of characters read into yy_ch_buf, not including EOB
 181           	 * characters.
 182           	 */
 183           	int yy_n_chars;
 184           
 185           	/* Whether we "own" the buffer - i.e., we know we created it,
 186           	 * and can realloc() it to grow it, and should free() it to
 187           	 * delete it.
 188           	 */
 189           	int yy_is_our_buffer;
 190 mike  1.1 
 191           	/* Whether this is an "interactive" input source; if so, and
 192           	 * if we're using stdio for input, then we want to use getc()
 193           	 * instead of fread(), to make sure we stop fetching input after
 194           	 * each newline.
 195           	 */
 196           	int yy_is_interactive;
 197           
 198           	/* Whether we're considered to be at the beginning of a line.
 199           	 * If so, '^' rules will be active on the next match, otherwise
 200           	 * not.
 201           	 */
 202           	int yy_at_bol;
 203           
 204           	/* Whether to try to fill the input buffer when we reach the
 205           	 * end of it.
 206           	 */
 207           	int yy_fill_buffer;
 208           
 209           	int yy_buffer_status;
 210           #define YY_BUFFER_NEW 0
 211 mike  1.1 #define YY_BUFFER_NORMAL 1
 212           	/* When an EOF's been seen but there's still some text to process
 213           	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
 214           	 * shouldn't try reading from the input source any more.  We might
 215           	 * still have a bunch of tokens to match, though, because of
 216           	 * possible backing-up.
 217           	 *
 218           	 * When we actually see the EOF, we change the status to "new"
 219           	 * (via yyrestart()), so that the user can continue scanning by
 220           	 * just pointing yyin at a new input file.
 221           	 */
 222           #define YY_BUFFER_EOF_PENDING 2
 223           	};
 224           
 225           static YY_BUFFER_STATE yy_current_buffer = 0;
 226           
 227           /* We provide macros for accessing buffer states in case in the
 228            * future we want to put the buffer states in a more general
 229            * "scanner state".
 230            */
 231           #define YY_CURRENT_BUFFER yy_current_buffer
 232 mike  1.1 
 233           
 234           /* yy_hold_char holds the character lost when yytext is formed. */
 235           static char yy_hold_char;
 236           
 237           static int yy_n_chars;		/* number of characters read into yy_ch_buf */
 238           
 239           
 240           int yyleng;
 241           
 242           /* Points to current character in buffer. */
 243           static char *yy_c_buf_p = (char *) 0;
 244           static int yy_init = 1;		/* whether we need to initialize */
 245           static int yy_start = 0;	/* start state number */
 246           
 247           /* Flag which is used to allow yywrap()'s to do buffer switches
 248            * instead of setting up a fresh yyin.  A bit of a hack ...
 249            */
 250           static int yy_did_buffer_switch_on_eof;
 251           
 252           void yyrestart YY_PROTO(( FILE *input_file ));
 253 mike  1.1 
 254           void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
 255           void yy_load_buffer_state YY_PROTO(( void ));
 256           YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
 257           void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
 258           void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
 259           void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
 260           #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
 261           
 262           YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
 263           YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
 264           YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
 265           
 266           static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
 267           static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
 268           static void yy_flex_free YY_PROTO(( void * ));
 269           
 270           #define yy_new_buffer yy_create_buffer
 271           
 272           #define yy_set_interactive(is_interactive) \
 273           	{ \
 274 mike  1.1 	if ( ! yy_current_buffer ) \
 275           		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
 276           	yy_current_buffer->yy_is_interactive = is_interactive; \
 277           	}
 278           
 279           #define yy_set_bol(at_bol) \
 280           	{ \
 281           	if ( ! yy_current_buffer ) \
 282           		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
 283           	yy_current_buffer->yy_at_bol = at_bol; \
 284           	}
 285           
 286           #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
 287           
 288           typedef unsigned char YY_CHAR;
 289           FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
 290           typedef int yy_state_type;
 291           extern char *yytext;
 292           #define yytext_ptr yytext
 293           
 294           static yy_state_type yy_get_previous_state YY_PROTO(( void ));
 295 mike  1.1 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
 296           static int yy_get_next_buffer YY_PROTO(( void ));
 297           static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
 298           
 299           /* Done after the current pattern has been matched and before the
 300            * corresponding action - sets up yytext.
 301            */
 302           #define YY_DO_BEFORE_ACTION \
 303           	yytext_ptr = yy_bp; \
 304           	yyleng = (int) (yy_cp - yy_bp); \
 305           	yy_hold_char = *yy_cp; \
 306           	*yy_cp = '\0'; \
 307           	yy_c_buf_p = yy_cp;
 308           
 309           #define YY_NUM_RULES 65
 310           #define YY_END_OF_BUFFER 66
 311           static yyconst short int yy_accept[273] =
 312               {   0,
 313                   0,    0,   66,   64,   63,   63,   41,   64,   64,   64,
 314                  54,   55,   64,   62,   64,   64,   45,   46,   46,   60,
 315                  61,   53,   51,   51,   51,   51,   51,   51,   51,   51,
 316 mike  1.1        51,   51,   51,   51,   51,   51,   51,   51,   51,   56,
 317                  57,   58,   59,   63,    0,   52,    0,    0,    0,   45,
 318                  46,   46,   47,   39,   40,   49,   49,    0,   50,    0,
 319                  46,   46,   51,   51,   37,   51,   51,   51,   51,   51,
 320                  51,   51,   51,   51,   51,   51,   36,   51,   51,   51,
 321                  51,   51,   51,   51,   51,   51,   51,    0,   52,   42,
 322                   0,   42,    0,    0,   48,   28,   51,   51,   51,   51,
 323           
 324                  51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
 325                  51,   51,   51,   18,   51,   51,   51,   51,   51,   51,
 326                  51,   51,    0,   43,    0,    0,   47,   51,   51,   51,
 327                  51,   51,   51,   51,   51,   51,   51,   51,   51,    3,
 328                  51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
 329                  51,    1,   51,    0,   44,   51,   51,   51,   20,   51,
 330                  51,   51,    2,   51,   51,   51,   51,   51,   51,   51,
 331                  51,   51,   51,   51,   19,   51,   51,   51,    5,   51,
 332                  51,   51,   51,   51,   51,    6,    0,   51,   51,   16,
 333                  51,   51,   51,   29,   51,   51,   26,   51,   51,   51,
 334           
 335                  13,   14,   51,   51,    7,    9,   11,   17,   51,   51,
 336                   8,   10,   12,    0,   51,    4,   51,   51,   51,   51,
 337 mike  1.1        51,   51,   51,   51,   51,   51,   51,   51,   38,   51,
 338                  15,   51,   51,   51,   35,   51,   24,   51,   51,   51,
 339                  51,   51,   51,   51,   51,   51,   27,   23,   25,   51,
 340                  51,   51,   51,   51,   51,   22,   32,   33,   51,   21,
 341                  51,   51,   51,   51,   51,   34,   51,   51,   51,   30,
 342                  31,    0
 343               } ;
 344           
 345           static yyconst int yy_ec[256] =
 346               {   0,
 347                   1,    1,    1,    1,    1,    1,    1,    2,    2,    3,
 348                   1,    2,    2,    1,    1,    1,    1,    1,    1,    1,
 349                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 350                   1,    4,    1,    5,    6,    7,    1,    1,    8,    9,
 351                  10,   11,   12,   13,   12,   14,   15,   16,   17,   18,
 352                  19,   20,   21,   22,   21,   23,   24,   25,   26,    1,
 353                  27,    1,    1,    1,   28,   29,   30,   31,   32,   33,
 354                  34,   35,   36,   37,   37,   38,   39,   40,   41,   42,
 355                  43,   44,   45,   46,   47,   48,   37,   49,   50,   37,
 356                  51,   52,   53,    1,   37,    1,   28,   54,   30,   31,
 357           
 358 mike  1.1        32,   55,   34,   35,   36,   37,   37,   38,   39,   56,
 359                  41,   42,   43,   57,   45,   58,   47,   48,   37,   49,
 360                  50,   37,   59,    1,   60,    1,    1,    1,    1,    1,
 361                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 362                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 363                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 364                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 365                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 366                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 367                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 368           
 369                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 370                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 371                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 372                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 373                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 374                   1,    1,    1,    1,    1
 375               } ;
 376           
 377           static yyconst int yy_meta[61] =
 378               {   0,
 379 mike  1.1         1,    1,    1,    1,    2,    1,    1,    3,    1,    1,
 380                   1,    4,    1,    5,    1,    6,    6,    6,    6,    6,
 381                   6,    6,    6,    6,    1,    1,    1,    7,    7,    7,
 382                   7,    7,    7,    8,    8,    8,    8,    8,    8,    8,
 383                   8,    8,    8,    8,    8,    8,    8,    8,    9,    8,
 384                   1,    2,    1,   10,   10,    9,    9,    9,    1,    1
 385               } ;
 386           
 387           static yyconst short int yy_base[284] =
 388               {   0,
 389                   0,    0,  408,  409,   59,   62,  409,  365,    0,  354,
 390                 409,  409,   53,  409,    0,   57,   59,  100,   73,  409,
 391                 409,  409,   47,  364,   36,   57,   44,   58,    0,   51,
 392                 372,  356,   71,   71,  355,  369,   95,   53,  364,  409,
 393                 409,  409,  409,  130,   54,    0,  391,   87,    0,    0,
 394                   0,    0,  366,  409,  409,  348,  121,  382,  409,    0,
 395                   0,    0,    0,  345,  349,  352,  364,  363,   84,  345,
 396                 361,  350,  359,  104,   93,  348,    0,   99,  344,  356,
 397                 112,  342,  104,  102,  337,  119,  108,  353,    0,  409,
 398                 372,  371,    0,  366,    0,    0,  336,  338,  108,  330,
 399           
 400 mike  1.1       342,  345,  126,  327,  323,  334,  115,  334,  330,  339,
 401                 324,  327,  326,  331,  116,  320,  123,  325,  313,  123,
 402                 327,  125,  324,  409,  349,  344,  343,  324,  321,  335,
 403                 306,  126,  139,  312,  317,  307,  317,  318,  304,    0,
 404                 305,  311,  306,   87,  132,  133,  309,  169,  138,  153,
 405                 295,    0,  178,  300,  409,  302,  309,  314,    0,  299,
 406                 296,  301,    0,  141,  304,  147,  300,  298,  152,  166,
 407                 311,  308,  295,  290,    0,  303,  306,  303,    0,  288,
 408                 291,  282,  297,  300,  297,    0,  288,  287,  162,    0,
 409                 275,  281,  271,    0,  158,  281,    0,  159,  162,  274,
 410           
 411                   0,    0,  166,  279,    0,    0,    0,    0,  270,  279,
 412                   0,    0,    0,  302,  165,    0,  273,  262,  252,  263,
 413                 263,  262,  237,  254,  255,  166,  256,  167,  409,  247,
 414                   0,  213,  221,  211,    0,  170,    0,  171,  219,  218,
 415                 204,  217,  202,  210,  175,  170,    0,    0,    0,  210,
 416                 195,  200,  190,  187,  190,    0,    0,    0,  201,    0,
 417                 191,  202,  205,  200,  202,    0,  127,   80,   73,    0,
 418                   0,  409,  248,  258,  264,   95,  265,  270,  279,  285,
 419                 286,  291,  298
 420               } ;
 421 mike  1.1 
 422           static yyconst short int yy_def[284] =
 423               {   0,
 424                 272,    1,  272,  272,  272,  272,  272,  272,  273,  274,
 425                 272,  272,  275,  272,  276,  272,  272,  272,   18,  272,
 426                 272,  272,  277,  277,  277,  277,  277,  277,  277,  277,
 427                 277,  277,  277,  277,  277,  277,  277,  277,  277,  272,
 428                 272,  272,  272,  272,  272,  278,  272,  279,  276,   17,
 429                  18,   19,  276,  272,  272,   17,   17,  280,  272,  281,
 430                  18,   19,  277,  277,  277,  277,  277,  277,  277,  277,
 431                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 432                 277,  277,  277,  277,  277,  277,  277,  272,  278,  272,
 433                 272,  272,  282,  283,  281,  277,  277,  277,  277,  277,
 434           
 435                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 436                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 437                 277,  277,  272,  272,  282,  283,  283,  277,  277,  277,
 438                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 439                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 440                 277,  277,  277,  272,  272,  277,  277,  277,  277,  277,
 441                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 442 mike  1.1       277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 443                 277,  277,  277,  277,  277,  277,  272,  277,  277,  277,
 444                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 445           
 446                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 447                 277,  277,  277,  272,  277,  277,  277,  277,  277,  277,
 448                 277,  277,  277,  277,  277,  277,  277,  277,  272,  277,
 449                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 450                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 451                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 452                 277,  277,  277,  277,  277,  277,  277,  277,  277,  277,
 453                 277,    0,  272,  272,  272,  272,  272,  272,  272,  272,
 454                 272,  272,  272
 455               } ;
 456           
 457           static yyconst short int yy_nxt[470] =
 458               {   0,
 459                   4,    5,    6,    5,    7,    8,    9,   10,   11,   12,
 460                   4,   13,   14,   15,   16,   17,   18,   19,   19,   19,
 461                  19,   19,   19,   19,   20,   21,   22,   23,   24,   25,
 462                  26,   27,   28,   29,   29,   30,   29,   29,   31,   32,
 463 mike  1.1        33,   34,   35,   36,   37,   38,   39,   29,   29,   29,
 464                  40,    4,   41,   24,   28,   32,   36,   38,   42,   43,
 465                  44,   44,   44,   44,   44,   44,   49,   54,   50,   51,
 466                  67,   55,   49,   68,   56,   56,   57,   57,   57,   57,
 467                  57,   58,   58,   71,   69,   72,   64,   59,   62,   62,
 468                  74,   65,   70,   85,   92,   73,   86,   88,   78,   71,
 469           
 470                  53,  272,   64,   77,  271,  171,   74,   60,  172,   86,
 471                  88,  270,   59,   49,   79,   61,   61,   62,   62,   62,
 472                  62,   62,   62,   62,   82,   77,  272,   79,   59,  101,
 473                  83,   44,   44,   44,  106,   93,   57,   57,  108,  113,
 474                  84,  101,  110,  117,  114,  118,  120,  122,  107,  272,
 475                 108,  130,   84,   59,  134,  110,  115,  269,  118,  117,
 476                 138,  146,  151,  122,  130,  121,  114,  161,  148,  272,
 477                 153,  160,  138,  146,  272,  173,  174,  180,  151,  134,
 478                 148,  181,  153,  160,  194,  176,  196,  177,  173,  174,
 479                 178,  179,  161,  180,  183,  199,  184,  194,  200,  185,
 480           
 481                 186,  216,  196,  220,  222,  225,  181,  223,  199,  256,
 482                 230,  240,  242,  247,  248,  220,  222,  216,  255,  223,
 483                 200,  225,  230,  240,  242,  256,  247,  248,  259,  260,
 484 mike  1.1       261,  255,  268,  262,  264,  267,  266,  265,  263,  258,
 485                 257,  254,  253,  261,  252,  260,  262,  264,  251,  250,
 486                 249,  246,  245,  259,   46,   46,   46,   46,   47,   47,
 487                 244,   47,   47,   47,   47,   47,   47,   47,   52,   52,
 488                  63,   63,   63,   63,   63,   89,   89,   89,   89,   89,
 489                  91,   91,  243,  241,  239,  238,  237,   91,   91,   58,
 490                  58,   95,   95,  236,  235,   95,  125,  125,  234,  233,
 491           
 492                 125,  127,  232,  127,  231,  229,  228,  227,  226,  224,
 493                 221,  219,  218,  217,  215,  214,  213,  212,  211,  210,
 494                 209,  208,  207,  206,  205,  204,  203,  202,  201,  198,
 495                 197,  195,  193,  192,  191,  190,  189,  188,  187,  182,
 496                 175,  170,  169,  168,  167,  166,  165,  164,  163,  162,
 497                 159,  158,  157,  156,  272,  272,  155,  154,  152,  150,
 498                 149,  147,  145,  144,  143,  142,  141,  140,  139,  137,
 499                 136,  135,  133,  132,  131,  129,  128,  126,  124,  124,
 500                 123,  119,  116,  112,  111,  109,  105,  104,  103,  102,
 501                 100,   99,   98,   97,   96,   49,  272,   94,   90,   87,
 502           
 503                  81,   80,   76,   75,   66,   48,   45,  272,    3,  272,
 504                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 505 mike  1.1       272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 506                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 507                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 508                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 509                 272,  272,  272,  272,  272,  272,  272,  272,  272
 510               } ;
 511           
 512           static yyconst short int yy_chk[470] =
 513               {   0,
 514                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 515                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 516                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 517                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 518                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 519                   1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 520                   5,    5,    5,    6,    6,    6,   13,   16,   13,   13,
 521                  25,   16,   17,   25,   17,   17,   17,   17,   17,   17,
 522                  17,   17,   17,   27,   26,   28,   23,   17,   19,   19,
 523                  30,   23,   26,   38,   48,   28,   38,   45,   34,   27,
 524           
 525                 276,   19,   23,   33,  269,  144,   30,   17,  144,   38,
 526 mike  1.1        45,  268,   17,   18,   34,   18,   18,   18,   18,   18,
 527                  18,   18,   18,   18,   37,   33,   19,   34,   18,   69,
 528                  37,   44,   44,   44,   74,   48,   57,   57,   75,   81,
 529                  37,   69,   78,   83,   81,   84,   86,   87,   74,   57,
 530                  75,   99,   37,   18,  103,   78,   81,  267,   84,   83,
 531                 107,  115,  120,   87,   99,   86,   81,  133,  117,   57,
 532                 122,  132,  107,  115,   57,  145,  146,  149,  120,  103,
 533                 117,  150,  122,  132,  164,  148,  166,  148,  145,  146,
 534                 148,  148,  133,  149,  153,  169,  153,  164,  170,  153,
 535           
 536                 153,  189,  166,  195,  198,  203,  150,  199,  169,  246,
 537                 215,  226,  228,  236,  238,  195,  198,  189,  245,  199,
 538                 170,  203,  215,  226,  228,  246,  236,  238,  252,  253,
 539                 254,  245,  265,  255,  261,  264,  263,  262,  259,  251,
 540                 250,  244,  243,  254,  242,  253,  255,  261,  241,  240,
 541                 239,  234,  233,  252,  273,  273,  273,  273,  274,  274,
 542                 232,  274,  274,  274,  274,  274,  274,  274,  275,  275,
 543                 277,  277,  277,  277,  277,  278,  278,  278,  278,  278,
 544                 279,  279,  230,  227,  225,  224,  223,  279,  279,  280,
 545                 280,  281,  281,  222,  221,  281,  282,  282,  220,  219,
 546           
 547 mike  1.1       282,  283,  218,  283,  217,  214,  210,  209,  204,  200,
 548                 196,  193,  192,  191,  188,  187,  185,  184,  183,  182,
 549                 181,  180,  178,  177,  176,  174,  173,  172,  171,  168,
 550                 167,  165,  162,  161,  160,  158,  157,  156,  154,  151,
 551                 147,  143,  142,  141,  139,  138,  137,  136,  135,  134,
 552                 131,  130,  129,  128,  127,  126,  125,  123,  121,  119,
 553                 118,  116,  114,  113,  112,  111,  110,  109,  108,  106,
 554                 105,  104,  102,  101,  100,   98,   97,   94,   92,   91,
 555                  88,   85,   82,   80,   79,   76,   73,   72,   71,   70,
 556                  68,   67,   66,   65,   64,   58,   56,   53,   47,   39,
 557           
 558                  36,   35,   32,   31,   24,   10,    8,    3,  272,  272,
 559                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 560                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 561                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 562                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 563                 272,  272,  272,  272,  272,  272,  272,  272,  272,  272,
 564                 272,  272,  272,  272,  272,  272,  272,  272,  272
 565               } ;
 566           
 567           static yy_state_type yy_last_accepting_state;
 568 mike  1.1 static char *yy_last_accepting_cpos;
 569           
 570           /* The intent behind this definition is that it'll catch
 571            * any uses of REJECT which flex missed.
 572            */
 573           #define REJECT reject_used_but_not_detected
 574           #define yymore() yymore_used_but_not_detected
 575           #define YY_MORE_ADJ 0
 576           #define YY_RESTORE_YY_MORE_OFFSET
 577           char *yytext;
 578           #line 1 "mof.l"
 579           #define INITIAL 0
 580           /*
 581           **==============================================================================
 582           **
 583           ** mof.lex
 584           **
 585           **     This file defines a lexigraphical analyzer for the Managed Object Format
 586           **     (MOF). See the BNF in the CIM Infrastructure Specification.
 587           **
 588           **==============================================================================
 589 mike  1.1 */
 590           #line 13 "mof.l"
 591           
 592           /* Do not read from standard input */
 593           #define YY_NEVER_INTERACTIVE 1
 594           #define MOF_STACK_SIZE 32
 595           
 596           #include "config.h"
 597           #include "mof.h"
 598           #include "types.h"
 599           #include "mofyacc.h"
 600           #include "buffer.h"
 601           #include "ptrarray.h"
 602           #include "state.h"
 603           #include <stdlib.h>
 604           #include <string.h>
 605           #include <stdarg.h>
 606           
 607           extern int yyparse();
 608           int closeIncludeFile();
 609           
 610 mike  1.1 struct _MOF_Parser
 611           {
 612               MOF_State state;
 613           };
 614           
 615           typedef struct _StackItem
 616           {
 617               char* file;
 618               unsigned int line;
 619               YY_BUFFER_STATE buffer;
 620           }
 621           StackItem;
 622           
 623           /* Stack of parser states for open nested MOF files */
 624           static StackItem s_stack[MOF_STACK_SIZE];
 625           
 626           /* Current size of stack s_stack[s_top-1] is the top */
 627           static size_t s_top = 0;
 628           
 629           /*
 630           **==============================================================================
 631 mike  1.1 **
 632           ** Case-insensitive keywords (see CIM Infrastructure specification).
 633           **
 634           **==============================================================================
 635           */
 636           /* True and false */
 637           /* Null value */
 638           /* Data types */
 639           /* Ref */
 640           /* Scope */
 641           /* Flavor */
 642           /* Instance of */
 643           /* Alias */
 644           /* #pragma */
 645           /*
 646           **==============================================================================
 647           **
 648           ** Literal productions (see CIM Infrastructure specification).
 649           **
 650           **==============================================================================
 651           */
 652 mike  1.1 /*
 653           **------------------------------------------------------------------------------
 654           **
 655           ** Lex productions:
 656           **
 657           **------------------------------------------------------------------------------
 658           */
 659           #line 636 "lex.yy.c"
 660           
 661           /* Macros after this point can all be overridden by user definitions in
 662            * section 1.
 663            */
 664           
 665           #ifndef YY_SKIP_YYWRAP
 666           #ifdef __cplusplus
 667           extern "C" int yywrap YY_PROTO(( void ));
 668           #else
 669           extern int yywrap YY_PROTO(( void ));
 670           #endif
 671           #endif
 672           
 673 mike  1.1 #ifndef YY_NO_UNPUT
 674           static void yyunput YY_PROTO(( int c, char *buf_ptr ));
 675           #endif
 676           
 677           #ifndef yytext_ptr
 678           static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
 679           #endif
 680           
 681           #ifdef YY_NEED_STRLEN
 682           static int yy_flex_strlen YY_PROTO(( yyconst char * ));
 683           #endif
 684           
 685           #ifndef YY_NO_INPUT
 686           #ifdef __cplusplus
 687           static int yyinput YY_PROTO(( void ));
 688           #else
 689           static int input YY_PROTO(( void ));
 690           #endif
 691           #endif
 692           
 693           #if YY_STACK_USED
 694 mike  1.1 static int yy_start_stack_ptr = 0;
 695           static int yy_start_stack_depth = 0;
 696           static int *yy_start_stack = 0;
 697           #ifndef YY_NO_PUSH_STATE
 698           static void yy_push_state YY_PROTO(( int new_state ));
 699           #endif
 700           #ifndef YY_NO_POP_STATE
 701           static void yy_pop_state YY_PROTO(( void ));
 702           #endif
 703           #ifndef YY_NO_TOP_STATE
 704           static int yy_top_state YY_PROTO(( void ));
 705           #endif
 706           
 707           #else
 708           #define YY_NO_PUSH_STATE 1
 709           #define YY_NO_POP_STATE 1
 710           #define YY_NO_TOP_STATE 1
 711           #endif
 712           
 713           #ifdef YY_MALLOC_DECL
 714           YY_MALLOC_DECL
 715 mike  1.1 #else
 716           #if __STDC__
 717           #ifndef __cplusplus
 718           #include <stdlib.h>
 719           #endif
 720           #else
 721           /* Just try to get by without declaring the routines.  This will fail
 722            * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
 723            * or sizeof(void*) != sizeof(int).
 724            */
 725           #endif
 726           #endif
 727           
 728           /* Amount of stuff to slurp up with each read. */
 729           #ifndef YY_READ_BUF_SIZE
 730           #define YY_READ_BUF_SIZE 8192
 731           #endif
 732           
 733           /* Copy whatever the last rule matched to the standard output. */
 734           
 735           #ifndef ECHO
 736 mike  1.1 /* This used to be an fputs(), but since the string might contain NUL's,
 737            * we now use fwrite().
 738            */
 739           #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
 740           #endif
 741           
 742           /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 743            * is returned in "result".
 744            */
 745           #ifndef YY_INPUT
 746           #define YY_INPUT(buf,result,max_size) \
 747           	if ( yy_current_buffer->yy_is_interactive ) \
 748           		{ \
 749           		int c = '*', n; \
 750           		for ( n = 0; n < max_size && \
 751           			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 752           			buf[n] = (char) c; \
 753           		if ( c == '\n' ) \
 754           			buf[n++] = (char) c; \
 755           		if ( c == EOF && ferror( yyin ) ) \
 756           			YY_FATAL_ERROR( "input in flex scanner failed" ); \
 757 mike  1.1 		result = n; \
 758           		} \
 759           	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
 760           		  && ferror( yyin ) ) \
 761           		YY_FATAL_ERROR( "input in flex scanner failed" );
 762           #endif
 763           
 764           /* No semi-colon after return; correct usage is to write "yyterminate();" -
 765            * we don't want an extra ';' after the "return" because that will cause
 766            * some compilers to complain about unreachable statements.
 767            */
 768           #ifndef yyterminate
 769           #define yyterminate() return YY_NULL
 770           #endif
 771           
 772           /* Number of entries by which start-condition stack grows. */
 773           #ifndef YY_START_STACK_INCR
 774           #define YY_START_STACK_INCR 25
 775           #endif
 776           
 777           /* Report a fatal error. */
 778 mike  1.1 #ifndef YY_FATAL_ERROR
 779           #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
 780           #endif
 781           
 782           /* Default declaration of generated scanner - a define so the user can
 783            * easily add parameters.
 784            */
 785           #ifndef YY_DECL
 786           #define YY_DECL int yylex YY_PROTO(( void ))
 787           #endif
 788           
 789           /* Code executed at the beginning of each rule, after yytext and yyleng
 790            * have been set up.
 791            */
 792           #ifndef YY_USER_ACTION
 793           #define YY_USER_ACTION
 794           #endif
 795           
 796           /* Code executed at the end of each rule. */
 797           #ifndef YY_BREAK
 798           #define YY_BREAK break;
 799 mike  1.1 #endif
 800           
 801           #define YY_RULE_SETUP \
 802           	YY_USER_ACTION
 803           
 804           YY_DECL
 805           	{
 806           	register yy_state_type yy_current_state;
 807           	register char *yy_cp, *yy_bp;
 808           	register int yy_act;
 809           
 810           #line 146 "mof.l"
 811           
 812           
 813           #line 790 "lex.yy.c"
 814           
 815           	if ( yy_init )
 816           		{
 817           		yy_init = 0;
 818           
 819           #ifdef YY_USER_INIT
 820 mike  1.1 		YY_USER_INIT;
 821           #endif
 822           
 823           		if ( ! yy_start )
 824           			yy_start = 1;	/* first start state */
 825           
 826           		if ( ! yyin )
 827           			yyin = stdin;
 828           
 829           		if ( ! yyout )
 830           			yyout = stdout;
 831           
 832           		if ( ! yy_current_buffer )
 833           			yy_current_buffer =
 834           				yy_create_buffer( yyin, YY_BUF_SIZE );
 835           
 836           		yy_load_buffer_state();
 837           		}
 838           
 839           	while ( 1 )		/* loops until end-of-file is reached */
 840           		{
 841 mike  1.1 		yy_cp = yy_c_buf_p;
 842           
 843           		/* Support of yytext. */
 844           		*yy_cp = yy_hold_char;
 845           
 846           		/* yy_bp points to the position in yy_ch_buf of the start of
 847           		 * the current run.
 848           		 */
 849           		yy_bp = yy_cp;
 850           
 851           		yy_current_state = yy_start;
 852           yy_match:
 853           		do
 854           			{
 855           			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 856           			if ( yy_accept[yy_current_state] )
 857           				{
 858           				yy_last_accepting_state = yy_current_state;
 859           				yy_last_accepting_cpos = yy_cp;
 860           				}
 861           			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 862 mike  1.1 				{
 863           				yy_current_state = (int) yy_def[yy_current_state];
 864           				if ( yy_current_state >= 273 )
 865           					yy_c = yy_meta[(unsigned int) yy_c];
 866           				}
 867           			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 868           			++yy_cp;
 869           			}
 870           		while ( yy_base[yy_current_state] != 409 );
 871           
 872           yy_find_action:
 873           		yy_act = yy_accept[yy_current_state];
 874           		if ( yy_act == 0 )
 875           			{ /* have to back up */
 876           			yy_cp = yy_last_accepting_cpos;
 877           			yy_current_state = yy_last_accepting_state;
 878           			yy_act = yy_accept[yy_current_state];
 879           			}
 880           
 881           		YY_DO_BEFORE_ACTION;
 882           
 883 mike  1.1 
 884           do_action:	/* This label is used only to access EOF actions. */
 885           
 886           
 887           		switch ( yy_act )
 888           	{ /* beginning of action switch */
 889           			case 0: /* must back up */
 890           			/* undo the effects of YY_DO_BEFORE_ACTION */
 891           			*yy_cp = yy_hold_char;
 892           			yy_cp = yy_last_accepting_cpos;
 893           			yy_current_state = yy_last_accepting_state;
 894           			goto yy_find_action;
 895           
 896           case YY_STATE_EOF(INITIAL):
 897           #line 148 "mof.l"
 898           {
 899               if (s_top == 0)
 900                   yyterminate();
 901               else
 902               {
 903                   if (closeIncludeFile() != 0)
 904 mike  1.1             return TOK_ERROR;
 905               }
 906           }
 907           	YY_BREAK
 908           case 1:
 909           YY_RULE_SETUP
 910           #line 158 "mof.l"
 911           {
 912               yylval.boolean = 1;
 913               return TOK_BOOLEAN_VALUE; 
 914           }
 915           	YY_BREAK
 916           case 2:
 917           YY_RULE_SETUP
 918           #line 163 "mof.l"
 919           {
 920               yylval.boolean = 0;
 921               return TOK_BOOLEAN_VALUE; 
 922           }
 923           	YY_BREAK
 924           case 3:
 925 mike  1.1 YY_RULE_SETUP
 926           #line 168 "mof.l"
 927           {
 928               return TOK_NULL; 
 929           }
 930           	YY_BREAK
 931           case 4:
 932           YY_RULE_SETUP
 933           #line 172 "mof.l"
 934           {
 935               return TOK_BOOLEAN; 
 936           }
 937           	YY_BREAK
 938           case 5:
 939           YY_RULE_SETUP
 940           #line 176 "mof.l"
 941           {
 942               return TOK_SINT8; 
 943           }
 944           	YY_BREAK
 945           case 6:
 946 mike  1.1 YY_RULE_SETUP
 947           #line 180 "mof.l"
 948           {
 949               return TOK_UINT8; 
 950           }
 951           	YY_BREAK
 952           case 7:
 953           YY_RULE_SETUP
 954           #line 184 "mof.l"
 955           {
 956               return TOK_SINT16; 
 957           }
 958           	YY_BREAK
 959           case 8:
 960           YY_RULE_SETUP
 961           #line 188 "mof.l"
 962           {
 963               return TOK_UINT16; 
 964           }
 965           	YY_BREAK
 966           case 9:
 967 mike  1.1 YY_RULE_SETUP
 968           #line 192 "mof.l"
 969           {
 970               return TOK_SINT32; 
 971           }
 972           	YY_BREAK
 973           case 10:
 974           YY_RULE_SETUP
 975           #line 196 "mof.l"
 976           {
 977               return TOK_UINT32; 
 978           }
 979           	YY_BREAK
 980           case 11:
 981           YY_RULE_SETUP
 982           #line 200 "mof.l"
 983           {
 984               return TOK_SINT64; 
 985           }
 986           	YY_BREAK
 987           case 12:
 988 mike  1.1 YY_RULE_SETUP
 989           #line 204 "mof.l"
 990           {
 991               return TOK_UINT64; 
 992           }
 993           	YY_BREAK
 994           case 13:
 995           YY_RULE_SETUP
 996           #line 208 "mof.l"
 997           {
 998               return TOK_REAL32; 
 999           }
1000           	YY_BREAK
1001           case 14:
1002           YY_RULE_SETUP
1003           #line 212 "mof.l"
1004           {
1005               return TOK_REAL64; 
1006           }
1007           	YY_BREAK
1008           case 15:
1009 mike  1.1 YY_RULE_SETUP
1010           #line 216 "mof.l"
1011           {
1012               return TOK_DATETIME; 
1013           }
1014           	YY_BREAK
1015           case 16:
1016           YY_RULE_SETUP
1017           #line 220 "mof.l"
1018           {
1019               return TOK_CHAR16; 
1020           }
1021           	YY_BREAK
1022           case 17:
1023           YY_RULE_SETUP
1024           #line 224 "mof.l"
1025           {
1026               return TOK_STRING; 
1027           }
1028           	YY_BREAK
1029           case 18:
1030 mike  1.1 YY_RULE_SETUP
1031           #line 228 "mof.l"
1032           {
1033               return TOK_REF; 
1034           }
1035           	YY_BREAK
1036           case 19:
1037           YY_RULE_SETUP
1038           #line 232 "mof.l"
1039           {
1040               return TOK_SCOPE; 
1041           }
1042           	YY_BREAK
1043           case 20:
1044           YY_RULE_SETUP
1045           #line 236 "mof.l"
1046           {
1047               return TOK_CLASS; 
1048           }
1049           	YY_BREAK
1050           case 21:
1051 mike  1.1 YY_RULE_SETUP
1052           #line 240 "mof.l"
1053           {
1054               return TOK_ASSOCIATION; 
1055           }
1056           	YY_BREAK
1057           case 22:
1058           YY_RULE_SETUP
1059           #line 244 "mof.l"
1060           {
1061               return TOK_INDICATION; 
1062           }
1063           	YY_BREAK
1064           case 23:
1065           YY_RULE_SETUP
1066           #line 248 "mof.l"
1067           {
1068               return TOK_QUALIFIER; 
1069           }
1070           	YY_BREAK
1071           case 24:
1072 mike  1.1 YY_RULE_SETUP
1073           #line 252 "mof.l"
1074           {
1075               return TOK_PROPERTY; 
1076           }
1077           	YY_BREAK
1078           case 25:
1079           YY_RULE_SETUP
1080           #line 256 "mof.l"
1081           {
1082               return TOK_REFERENCE; 
1083           }
1084           	YY_BREAK
1085           case 26:
1086           YY_RULE_SETUP
1087           #line 260 "mof.l"
1088           {
1089               return TOK_METHOD; 
1090           }
1091           	YY_BREAK
1092           case 27:
1093 mike  1.1 YY_RULE_SETUP
1094           #line 264 "mof.l"
1095           {
1096               return TOK_PARAMETER; 
1097           }
1098           	YY_BREAK
1099           case 28:
1100           YY_RULE_SETUP
1101           #line 268 "mof.l"
1102           {
1103               return TOK_ANY; 
1104           }
1105           	YY_BREAK
1106           case 29:
1107           YY_RULE_SETUP
1108           #line 272 "mof.l"
1109           {
1110               return TOK_FLAVOR;
1111           }
1112           	YY_BREAK
1113           case 30:
1114 mike  1.1 YY_RULE_SETUP
1115           #line 276 "mof.l"
1116           {
1117               return TOK_ENABLEOVERRIDE;
1118           }
1119           	YY_BREAK
1120           case 31:
1121           YY_RULE_SETUP
1122           #line 280 "mof.l"
1123           {
1124               return TOK_DISABLEOVERRIDE;
1125           }
1126           	YY_BREAK
1127           case 32:
1128           YY_RULE_SETUP
1129           #line 284 "mof.l"
1130           {
1131               return TOK_RESTRICTED;
1132           }
1133           	YY_BREAK
1134           case 33:
1135 mike  1.1 YY_RULE_SETUP
1136           #line 288 "mof.l"
1137           {
1138               return TOK_TOSUBCLASS;
1139           }
1140           	YY_BREAK
1141           case 34:
1142           YY_RULE_SETUP
1143           #line 292 "mof.l"
1144           {
1145               return TOK_TRANSLATABLE;
1146           }
1147           	YY_BREAK
1148           case 35:
1149           YY_RULE_SETUP
1150           #line 296 "mof.l"
1151           {
1152               return TOK_INSTANCE;
1153           }
1154           	YY_BREAK
1155           case 36:
1156 mike  1.1 YY_RULE_SETUP
1157           #line 300 "mof.l"
1158           {
1159               return TOK_OF;
1160           }
1161           	YY_BREAK
1162           case 37:
1163           YY_RULE_SETUP
1164           #line 304 "mof.l"
1165           {
1166               return TOK_AS;
1167           }
1168           	YY_BREAK
1169           case 38:
1170           YY_RULE_SETUP
1171           #line 308 "mof.l"
1172           {
1173               return TOK_PRAGMA;
1174           }
1175           	YY_BREAK
1176           case 39:
1177 mike  1.1 YY_RULE_SETUP
1178           #line 312 "mof.l"
1179           {
1180               /* C-sytle comments */
1181               int c;
1182               int prev;
1183           
1184               /* Discard C-style comments. Replace with a single space since
1185                * comments may function as token separators.
1186                */
1187           
1188               for (c = input(), prev = '\0'; EOF != c; prev = c, c = input())
1189               {
1190                   /* Check for closing comment */
1191                   if (prev == '*' && c == '/')
1192                       break;
1193           
1194                   /* Increment line counter on newlines */
1195                   if (c == '\n')
1196                       state.line++;
1197               }
1198 mike  1.1 
1199               /* Inject a blank character into input */
1200               unput(' ');
1201           }
1202           	YY_BREAK
1203           case 40:
1204           YY_RULE_SETUP
1205           #line 336 "mof.l"
1206           {
1207               /* C++-style comments */
1208               int c;
1209           
1210               /* Discard all characters on this comment line including the newline */
1211           
1212               for (c = input(); EOF != c; c = input())
1213               {
1214                   /* Increment line counter on newlines */
1215                   if (c == '\n')
1216                   {
1217                       state.line++;
1218                       break;
1219 mike  1.1         }
1220               }
1221           }
1222           	YY_BREAK
1223           case 41:
1224           YY_RULE_SETUP
1225           #line 353 "mof.l"
1226           {
1227               /* Read a string literal */
1228               int c;
1229               Buffer buf = BUFFER_INITIALIZER;
1230           
1231               /* Scan until the closing quote is found */
1232               for (;;)
1233               {
1234                   c = input();
1235           
1236                   if (EOF == c || c == '"')
1237                       break;
1238           
1239                   if (Buffer_AppendChar(&buf, (char)c) != 0)
1240 mike  1.1         {
1241                       yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1242                       return TOK_ERROR;
1243                   }
1244           
1245                   /* If backslash, get next character */
1246                   if (c == '\\')
1247                   {
1248                       c = input();
1249           
1250                       if (EOF == c)
1251                       {
1252                           yyerrorf(ID_UNTERMINATED_STRING_LITERAL, 
1253                               "unterminated string literal");
1254                           return TOK_ERROR;
1255                       }
1256           
1257                       if (Buffer_AppendChar(&buf, (char)c) != 0)
1258                       {
1259                           yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1260                           return TOK_ERROR;
1261 mike  1.1             }
1262                   }
1263               }
1264           
1265               /* Append zero-terminator */
1266               if (Buffer_AppendChar(&buf, '\0') != 0)
1267               {
1268                   yyerrorf(ID_OUT_OF_MEMORY, "out of memory");
1269                   return TOK_ERROR;
1270               }
1271           
1272               /* Return the string */
1273               yylval.string = buf.data;
1274               return TOK_STRING_VALUE;
1275           }
1276           	YY_BREAK
1277           case 42:
1278           YY_RULE_SETUP
1279           #line 404 "mof.l"
1280           {
1281               yylval.character = yytext[1];
1282 mike  1.1     return TOK_CHAR_VALUE;
1283           }
1284           	YY_BREAK
1285           case 43:
1286           YY_RULE_SETUP
1287           #line 409 "mof.l"
1288           {
1289           
1290               switch (yytext[2])
1291               {
1292           	case 'r':
1293           	    yylval.character = '\r';
1294           	    break;
1295           	case 'n':
1296           	    yylval.character = '\n';
1297           	    break;
1298           	case 't':
1299           	    yylval.character = '\t';
1300           	    break;
1301           	case 'f':
1302           	    yylval.character = '\f';
1303 mike  1.1 	    break;
1304           	case 'b':
1305           	    yylval.character = '\b';
1306           	    break;
1307           	case '\"':
1308           	    yylval.character = '"';
1309           	    break;
1310           	case '\'':
1311           	    yylval.character = '\'';
1312           	    break;
1313           	case '\\':
1314           	    yylval.character = '\\';
1315           	    break;
1316                   default:
1317                       yyerrorf(ID_INTERNAL_ERROR, "internal error");
1318                       return TOK_ERROR;
1319               }
1320           
1321               return TOK_CHAR_VALUE;
1322           }
1323           	YY_BREAK
1324 mike  1.1 case 44:
1325           YY_RULE_SETUP
1326           #line 445 "mof.l"
1327           {
1328               char* end;
1329           
1330               if (yyleng - 4 > 4)
1331               {
1332                   yyerrorf(ID_ILLEGAL_HEX_CHARACTER, "illegal hex character");
1333                   return TOK_ERROR;
1334               }
1335           
1336               yylval.character = (MI_Char16)strtoul(&yytext[3], &end, 16);
1337           
1338               if (*end != '\'')
1339               {
1340                   yyerrorf(ID_ILLEGAL_HEX_CHARACTER, "illegal hex character");
1341                   return TOK_ERROR;
1342               }
1343           
1344               return TOK_CHAR_VALUE;
1345 mike  1.1 }
1346           	YY_BREAK
1347           case 45:
1348           YY_RULE_SETUP
1349           #line 465 "mof.l"
1350           {
1351               yylval.integer = 0;
1352               return TOK_INTEGER_VALUE;
1353           }
1354           	YY_BREAK
1355           case 46:
1356           YY_RULE_SETUP
1357           #line 470 "mof.l"
1358           {
1359               errno = 0;
1360               if (yytext[0] == '-')
1361                   yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 10);
1362               else
1363                   yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 10);
1364               
1365               if (errno == ERANGE)
1366 mike  1.1     {
1367                   yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1368                   return TOK_ERROR;
1369               }
1370               return TOK_INTEGER_VALUE;
1371           }
1372           	YY_BREAK
1373           case 47:
1374           YY_RULE_SETUP
1375           #line 485 "mof.l"
1376           {
1377               yylval.real = (double)strtod(yytext, NULL);
1378               return TOK_REAL_VALUE;
1379           }
1380           	YY_BREAK
1381           case 48:
1382           YY_RULE_SETUP
1383           #line 490 "mof.l"
1384           {
1385               errno = 0;
1386               if (yytext[0] == '-')
1387 mike  1.1         yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 16);
1388               else
1389                   yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 16);
1390               
1391               if (errno == ERANGE)
1392               {
1393                   yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1394                   return TOK_ERROR;
1395               }
1396               return TOK_INTEGER_VALUE;
1397           }
1398           	YY_BREAK
1399           case 49:
1400           YY_RULE_SETUP
1401           #line 505 "mof.l"
1402           {
1403               errno = 0;
1404               if (yytext[0] == '-')
1405                   yylval.integer = (MI_Sint64)Strtoll(yytext, NULL, 8);
1406               else
1407                   yylval.integer = (MI_Sint64)Strtoull(yytext, NULL, 8);
1408 mike  1.1     
1409               if (errno == ERANGE)
1410               {
1411                   yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1412                   return TOK_ERROR;
1413               }
1414               return TOK_INTEGER_VALUE;
1415           }
1416           	YY_BREAK
1417           case 50:
1418           YY_RULE_SETUP
1419           #line 520 "mof.l"
1420           {
1421               char* end;
1422           
1423               if (yytext[0] == '-')
1424                   yylval.integer = (MI_Sint64)Strtoll(yytext, &end, 2);
1425               else
1426                   yylval.integer = (MI_Sint64)Strtoull(yytext, &end, 2);
1427           
1428               if (*end != 'B' && *end != 'b')
1429 mike  1.1     {
1430                   yyerrorf(ID_ILLEGAL_BINARY_LITERAL, "illegal binary literal");
1431                   return TOK_ERROR;
1432               }
1433               if (errno == ERANGE)
1434               {
1435                   yyerrorf(ID_INTEGER_OVERFLOW, "integer overflow");
1436                   return TOK_ERROR;
1437               }
1438           
1439               return TOK_INTEGER_VALUE;
1440           }
1441           	YY_BREAK
1442           case 51:
1443           YY_RULE_SETUP
1444           #line 542 "mof.l"
1445           {
1446               yylval.identifier = MOF_Strdup(&state.heap, yytext);
1447               return TOK_IDENT;
1448           }
1449           	YY_BREAK
1450 mike  1.1 case 52:
1451           YY_RULE_SETUP
1452           #line 547 "mof.l"
1453           {
1454               yylval.identifier = MOF_Strdup(&state.heap, yytext);
1455               return TOK_ALIAS_IDENTIFIER;
1456           }
1457           	YY_BREAK
1458           case 53:
1459           YY_RULE_SETUP
1460           #line 552 "mof.l"
1461           {
1462               return '=';
1463           }
1464           	YY_BREAK
1465           case 54:
1466           YY_RULE_SETUP
1467           #line 556 "mof.l"
1468           {
1469               return '(';
1470           }
1471 mike  1.1 	YY_BREAK
1472           case 55:
1473           YY_RULE_SETUP
1474           #line 560 "mof.l"
1475           {
1476               return ')';
1477           }
1478           	YY_BREAK
1479           case 56:
1480           YY_RULE_SETUP
1481           #line 564 "mof.l"
1482           {
1483               return '[';
1484           }
1485           	YY_BREAK
1486           case 57:
1487           YY_RULE_SETUP
1488           #line 568 "mof.l"
1489           {
1490               return ']';
1491           }
1492 mike  1.1 	YY_BREAK
1493           case 58:
1494           YY_RULE_SETUP
1495           #line 572 "mof.l"
1496           {
1497               return '{';
1498           }
1499           	YY_BREAK
1500           case 59:
1501           YY_RULE_SETUP
1502           #line 576 "mof.l"
1503           {
1504               return '}';
1505           }
1506           	YY_BREAK
1507           case 60:
1508           YY_RULE_SETUP
1509           #line 580 "mof.l"
1510           {
1511               return ':';
1512           }
1513 mike  1.1 	YY_BREAK
1514           case 61:
1515           YY_RULE_SETUP
1516           #line 584 "mof.l"
1517           {
1518              return ';';
1519           }
1520           	YY_BREAK
1521           case 62:
1522           YY_RULE_SETUP
1523           #line 588 "mof.l"
1524           {
1525               return ',';
1526           }
1527           	YY_BREAK
1528           case 63:
1529           YY_RULE_SETUP
1530           #line 592 "mof.l"
1531           {
1532               /* swallow whiteSpaceChar */
1533               int i;
1534 mike  1.1 
1535               for (i = 0; i < yyleng; i++)
1536               {
1537                   if (yytext[i] == '\n')
1538                       state.line++;
1539               }
1540           }
1541           	YY_BREAK
1542           case 64:
1543           YY_RULE_SETUP
1544           #line 603 "mof.l"
1545           {
1546               yyterminate();
1547           }
1548           	YY_BREAK
1549           case 65:
1550           YY_RULE_SETUP
1551           #line 607 "mof.l"
1552           ECHO;
1553           	YY_BREAK
1554           #line 1531 "lex.yy.c"
1555 mike  1.1 
1556           	case YY_END_OF_BUFFER:
1557           		{
1558           		/* Amount of text matched not including the EOB char. */
1559           		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1560           
1561           		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1562           		*yy_cp = yy_hold_char;
1563           		YY_RESTORE_YY_MORE_OFFSET
1564           
1565           		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1566           			{
1567           			/* We're scanning a new file or input source.  It's
1568           			 * possible that this happened because the user
1569           			 * just pointed yyin at a new source and called
1570           			 * yylex().  If so, then we have to assure
1571           			 * consistency between yy_current_buffer and our
1572           			 * globals.  Here is the right place to do so, because
1573           			 * this is the first action (other than possibly a
1574           			 * back-up) that will match for the new input source.
1575           			 */
1576 mike  1.1 			yy_n_chars = yy_current_buffer->yy_n_chars;
1577           			yy_current_buffer->yy_input_file = yyin;
1578           			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1579           			}
1580           
1581           		/* Note that here we test for yy_c_buf_p "<=" to the position
1582           		 * of the first EOB in the buffer, since yy_c_buf_p will
1583           		 * already have been incremented past the NUL character
1584           		 * (since all states make transitions on EOB to the
1585           		 * end-of-buffer state).  Contrast this with the test
1586           		 * in input().
1587           		 */
1588           		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1589           			{ /* This was really a NUL. */
1590           			yy_state_type yy_next_state;
1591           
1592           			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1593           
1594           			yy_current_state = yy_get_previous_state();
1595           
1596           			/* Okay, we're now positioned to make the NUL
1597 mike  1.1 			 * transition.  We couldn't have
1598           			 * yy_get_previous_state() go ahead and do it
1599           			 * for us because it doesn't know how to deal
1600           			 * with the possibility of jamming (and we don't
1601           			 * want to build jamming into it because then it
1602           			 * will run more slowly).
1603           			 */
1604           
1605           			yy_next_state = yy_try_NUL_trans( yy_current_state );
1606           
1607           			yy_bp = yytext_ptr + YY_MORE_ADJ;
1608           
1609           			if ( yy_next_state )
1610           				{
1611           				/* Consume the NUL. */
1612           				yy_cp = ++yy_c_buf_p;
1613           				yy_current_state = yy_next_state;
1614           				goto yy_match;
1615           				}
1616           
1617           			else
1618 mike  1.1 				{
1619           				yy_cp = yy_c_buf_p;
1620           				goto yy_find_action;
1621           				}
1622           			}
1623           
1624           		else switch ( yy_get_next_buffer() )
1625           			{
1626           			case EOB_ACT_END_OF_FILE:
1627           				{
1628           				yy_did_buffer_switch_on_eof = 0;
1629           
1630           				if ( yywrap() )
1631           					{
1632           					/* Note: because we've taken care in
1633           					 * yy_get_next_buffer() to have set up
1634           					 * yytext, we can now set up
1635           					 * yy_c_buf_p so that if some total
1636           					 * hoser (like flex itself) wants to
1637           					 * call the scanner after we return the
1638           					 * YY_NULL, it'll still work - another
1639 mike  1.1 					 * YY_NULL will get returned.
1640           					 */
1641           					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1642           
1643           					yy_act = YY_STATE_EOF(YY_START);
1644           					goto do_action;
1645           					}
1646           
1647           				else
1648           					{
1649           					if ( ! yy_did_buffer_switch_on_eof )
1650           						YY_NEW_FILE;
1651           					}
1652           				break;
1653           				}
1654           
1655           			case EOB_ACT_CONTINUE_SCAN:
1656           				yy_c_buf_p =
1657           					yytext_ptr + yy_amount_of_matched_text;
1658           
1659           				yy_current_state = yy_get_previous_state();
1660 mike  1.1 
1661           				yy_cp = yy_c_buf_p;
1662           				yy_bp = yytext_ptr + YY_MORE_ADJ;
1663           				goto yy_match;
1664           
1665           			case EOB_ACT_LAST_MATCH:
1666           				yy_c_buf_p =
1667           				&yy_current_buffer->yy_ch_buf[yy_n_chars];
1668           
1669           				yy_current_state = yy_get_previous_state();
1670           
1671           				yy_cp = yy_c_buf_p;
1672           				yy_bp = yytext_ptr + YY_MORE_ADJ;
1673           				goto yy_find_action;
1674           			}
1675           		break;
1676           		}
1677           
1678           	default:
1679           		YY_FATAL_ERROR(
1680           			"fatal flex scanner internal error--no action found" );
1681 mike  1.1 	} /* end of action switch */
1682           		} /* end of scanning one token */
1683           	} /* end of yylex */
1684           
1685           
1686           /* yy_get_next_buffer - try to read in a new buffer
1687            *
1688            * Returns a code representing an action:
1689            *	EOB_ACT_LAST_MATCH -
1690            *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1691            *	EOB_ACT_END_OF_FILE - end of file
1692            */
1693           
1694           static int yy_get_next_buffer()
1695           	{
1696           	register char *dest = yy_current_buffer->yy_ch_buf;
1697           	register char *source = yytext_ptr;
1698           	register int number_to_move, i;
1699           	int ret_val;
1700           
1701           	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1702 mike  1.1 		YY_FATAL_ERROR(
1703           		"fatal flex scanner internal error--end of buffer missed" );
1704           
1705           	if ( yy_current_buffer->yy_fill_buffer == 0 )
1706           		{ /* Don't try to fill the buffer, so this is an EOF. */
1707           		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1708           			{
1709           			/* We matched a single character, the EOB, so
1710           			 * treat this as a final EOF.
1711           			 */
1712           			return EOB_ACT_END_OF_FILE;
1713           			}
1714           
1715           		else
1716           			{
1717           			/* We matched some text prior to the EOB, first
1718           			 * process it.
1719           			 */
1720           			return EOB_ACT_LAST_MATCH;
1721           			}
1722           		}
1723 mike  1.1 
1724           	/* Try to read more data. */
1725           
1726           	/* First move last chars to start of buffer. */
1727           	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1728           
1729           	for ( i = 0; i < number_to_move; ++i )
1730           		*(dest++) = *(source++);
1731           
1732           	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1733           		/* don't do the read, it's not guaranteed to return an EOF,
1734           		 * just force an EOF
1735           		 */
1736           		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1737           
1738           	else
1739           		{
1740           		int num_to_read =
1741           			yy_current_buffer->yy_buf_size - number_to_move - 1;
1742           
1743           		while ( num_to_read <= 0 )
1744 mike  1.1 			{ /* Not enough room in the buffer - grow it. */
1745           #ifdef YY_USES_REJECT
1746           			YY_FATAL_ERROR(
1747           "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1748           #else
1749           
1750           			/* just a shorter name for the current buffer */
1751           			YY_BUFFER_STATE b = yy_current_buffer;
1752           
1753           			int yy_c_buf_p_offset =
1754           				(int) (yy_c_buf_p - b->yy_ch_buf);
1755           
1756           			if ( b->yy_is_our_buffer )
1757           				{
1758           				int new_size = b->yy_buf_size * 2;
1759           
1760           				if ( new_size <= 0 )
1761           					b->yy_buf_size += b->yy_buf_size / 8;
1762           				else
1763           					b->yy_buf_size *= 2;
1764           
1765 mike  1.1 				b->yy_ch_buf = (char *)
1766           					/* Include room in for 2 EOB chars. */
1767           					yy_flex_realloc( (void *) b->yy_ch_buf,
1768           							 b->yy_buf_size + 2 );
1769           				}
1770           			else
1771           				/* Can't grow it, we don't own it. */
1772           				b->yy_ch_buf = 0;
1773           
1774           			if ( ! b->yy_ch_buf )
1775           				YY_FATAL_ERROR(
1776           				"fatal error - scanner input buffer overflow" );
1777           
1778           			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1779           
1780           			num_to_read = yy_current_buffer->yy_buf_size -
1781           						number_to_move - 1;
1782           #endif
1783           			}
1784           
1785           		if ( num_to_read > YY_READ_BUF_SIZE )
1786 mike  1.1 			num_to_read = YY_READ_BUF_SIZE;
1787           
1788           		/* Read in more data. */
1789           		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1790           			yy_n_chars, num_to_read );
1791           
1792           		yy_current_buffer->yy_n_chars = yy_n_chars;
1793           		}
1794           
1795           	if ( yy_n_chars == 0 )
1796           		{
1797           		if ( number_to_move == YY_MORE_ADJ )
1798           			{
1799           			ret_val = EOB_ACT_END_OF_FILE;
1800           			yyrestart( yyin );
1801           			}
1802           
1803           		else
1804           			{
1805           			ret_val = EOB_ACT_LAST_MATCH;
1806           			yy_current_buffer->yy_buffer_status =
1807 mike  1.1 				YY_BUFFER_EOF_PENDING;
1808           			}
1809           		}
1810           
1811           	else
1812           		ret_val = EOB_ACT_CONTINUE_SCAN;
1813           
1814           	yy_n_chars += number_to_move;
1815           	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1816           	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1817           
1818           	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1819           
1820           	return ret_val;
1821           	}
1822           
1823           
1824           /* yy_get_previous_state - get the state just before the EOB char was reached */
1825           
1826           static yy_state_type yy_get_previous_state()
1827           	{
1828 mike  1.1 	register yy_state_type yy_current_state;
1829           	register char *yy_cp;
1830           
1831           	yy_current_state = yy_start;
1832           
1833           	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1834           		{
1835           		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1836           		if ( yy_accept[yy_current_state] )
1837           			{
1838           			yy_last_accepting_state = yy_current_state;
1839           			yy_last_accepting_cpos = yy_cp;
1840           			}
1841           		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1842           			{
1843           			yy_current_state = (int) yy_def[yy_current_state];
1844           			if ( yy_current_state >= 273 )
1845           				yy_c = yy_meta[(unsigned int) yy_c];
1846           			}
1847           		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1848           		}
1849 mike  1.1 
1850           	return yy_current_state;
1851           	}
1852           
1853           
1854           /* yy_try_NUL_trans - try to make a transition on the NUL character
1855            *
1856            * synopsis
1857            *	next_state = yy_try_NUL_trans( current_state );
1858            */
1859           
1860           #ifdef YY_USE_PROTOS
1861           static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1862           #else
1863           static yy_state_type yy_try_NUL_trans( yy_current_state )
1864           yy_state_type yy_current_state;
1865           #endif
1866           	{
1867           	register int yy_is_jam;
1868           	register char *yy_cp = yy_c_buf_p;
1869           
1870 mike  1.1 	register YY_CHAR yy_c = 1;
1871           	if ( yy_accept[yy_current_state] )
1872           		{
1873           		yy_last_accepting_state = yy_current_state;
1874           		yy_last_accepting_cpos = yy_cp;
1875           		}
1876           	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1877           		{
1878           		yy_current_state = (int) yy_def[yy_current_state];
1879           		if ( yy_current_state >= 273 )
1880           			yy_c = yy_meta[(unsigned int) yy_c];
1881           		}
1882           	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1883           	yy_is_jam = (yy_current_state == 272);
1884           
1885           	return yy_is_jam ? 0 : yy_current_state;
1886           	}
1887           
1888           
1889           #ifndef YY_NO_UNPUT
1890           #ifdef YY_USE_PROTOS
1891 mike  1.1 static void yyunput( int c, register char *yy_bp )
1892           #else
1893           static void yyunput( c, yy_bp )
1894           int c;
1895           register char *yy_bp;
1896           #endif
1897           	{
1898           	register char *yy_cp = yy_c_buf_p;
1899           
1900           	/* undo effects of setting up yytext */
1901           	*yy_cp = yy_hold_char;
1902           
1903           	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1904           		{ /* need to shift things up to make room */
1905           		/* +2 for EOB chars. */
1906           		register int number_to_move = yy_n_chars + 2;
1907           		register char *dest = &yy_current_buffer->yy_ch_buf[
1908           					yy_current_buffer->yy_buf_size + 2];
1909           		register char *source =
1910           				&yy_current_buffer->yy_ch_buf[number_to_move];
1911           
1912 mike  1.1 		while ( source > yy_current_buffer->yy_ch_buf )
1913           			*--dest = *--source;
1914           
1915           		yy_cp += (int) (dest - source);
1916           		yy_bp += (int) (dest - source);
1917           		yy_current_buffer->yy_n_chars =
1918           			yy_n_chars = yy_current_buffer->yy_buf_size;
1919           
1920           		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1921           			YY_FATAL_ERROR( "flex scanner push-back overflow" );
1922           		}
1923           
1924           	*--yy_cp = (char) c;
1925           
1926           
1927           	yytext_ptr = yy_bp;
1928           	yy_hold_char = *yy_cp;
1929           	yy_c_buf_p = yy_cp;
1930           	}
1931           #endif	/* ifndef YY_NO_UNPUT */
1932           
1933 mike  1.1 
1934           #ifdef __cplusplus
1935           static int yyinput()
1936           #else
1937           static int input()
1938           #endif
1939           	{
1940           	int c;
1941           
1942           	*yy_c_buf_p = yy_hold_char;
1943           
1944           	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1945           		{
1946           		/* yy_c_buf_p now points to the character we want to return.
1947           		 * If this occurs *before* the EOB characters, then it's a
1948           		 * valid NUL; if not, then we've hit the end of the buffer.
1949           		 */
1950           		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1951           			/* This was really a NUL. */
1952           			*yy_c_buf_p = '\0';
1953           
1954 mike  1.1 		else
1955           			{ /* need more input */
1956           			int offset = yy_c_buf_p - yytext_ptr;
1957           			++yy_c_buf_p;
1958           
1959           			switch ( yy_get_next_buffer() )
1960           				{
1961           				case EOB_ACT_LAST_MATCH:
1962           					/* This happens because yy_g_n_b()
1963           					 * sees that we've accumulated a
1964           					 * token and flags that we need to
1965           					 * try matching the token before
1966           					 * proceeding.  But for input(),
1967           					 * there's no matching to consider.
1968           					 * So convert the EOB_ACT_LAST_MATCH
1969           					 * to EOB_ACT_END_OF_FILE.
1970           					 */
1971           
1972           					/* Reset buffer status. */
1973           					yyrestart( yyin );
1974           
1975 mike  1.1 					/* fall through */
1976           
1977           				case EOB_ACT_END_OF_FILE:
1978           					{
1979           					if ( yywrap() )
1980           						return EOF;
1981           
1982           					if ( ! yy_did_buffer_switch_on_eof )
1983           						YY_NEW_FILE;
1984           #ifdef __cplusplus
1985           					return yyinput();
1986           #else
1987           					return input();
1988           #endif
1989           					}
1990           
1991           				case EOB_ACT_CONTINUE_SCAN:
1992           					yy_c_buf_p = yytext_ptr + offset;
1993           					break;
1994           				}
1995           			}
1996 mike  1.1 		}
1997           
1998           	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
1999           	*yy_c_buf_p = '\0';	/* preserve yytext */
2000           	yy_hold_char = *++yy_c_buf_p;
2001           
2002           
2003           	return c;
2004           	}
2005           
2006           
2007           #ifdef YY_USE_PROTOS
2008           void yyrestart( FILE *input_file )
2009           #else
2010           void yyrestart( input_file )
2011           FILE *input_file;
2012           #endif
2013           	{
2014           	if ( ! yy_current_buffer )
2015           		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2016           
2017 mike  1.1 	yy_init_buffer( yy_current_buffer, input_file );
2018           	yy_load_buffer_state();
2019           	}
2020           
2021           
2022           #ifdef YY_USE_PROTOS
2023           void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2024           #else
2025           void yy_switch_to_buffer( new_buffer )
2026           YY_BUFFER_STATE new_buffer;
2027           #endif
2028           	{
2029           	if ( yy_current_buffer == new_buffer )
2030           		return;
2031           
2032           	if ( yy_current_buffer )
2033           		{
2034           		/* Flush out information for old buffer. */
2035           		*yy_c_buf_p = yy_hold_char;
2036           		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2037           		yy_current_buffer->yy_n_chars = yy_n_chars;
2038 mike  1.1 		}
2039           
2040           	yy_current_buffer = new_buffer;
2041           	yy_load_buffer_state();
2042           
2043           	/* We don't actually know whether we did this switch during
2044           	 * EOF (yywrap()) processing, but the only time this flag
2045           	 * is looked at is after yywrap() is called, so it's safe
2046           	 * to go ahead and always set it.
2047           	 */
2048           	yy_did_buffer_switch_on_eof = 1;
2049           	}
2050           
2051           
2052           #ifdef YY_USE_PROTOS
2053           void yy_load_buffer_state( void )
2054           #else
2055           void yy_load_buffer_state()
2056           #endif
2057           	{
2058           	yy_n_chars = yy_current_buffer->yy_n_chars;
2059 mike  1.1 	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2060           	yyin = yy_current_buffer->yy_input_file;
2061           	yy_hold_char = *yy_c_buf_p;
2062           	}
2063           
2064           
2065           #ifdef YY_USE_PROTOS
2066           YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2067           #else
2068           YY_BUFFER_STATE yy_create_buffer( file, size )
2069           FILE *file;
2070           int size;
2071           #endif
2072           	{
2073           	YY_BUFFER_STATE b;
2074           
2075           	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2076           	if ( ! b )
2077           		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2078           
2079           	b->yy_buf_size = size;
2080 mike  1.1 
2081           	/* yy_ch_buf has to be 2 characters longer than the size given because
2082           	 * we need to put in 2 end-of-buffer characters.
2083           	 */
2084           	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2085           	if ( ! b->yy_ch_buf )
2086           		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2087           
2088           	b->yy_is_our_buffer = 1;
2089           
2090           	yy_init_buffer( b, file );
2091           
2092           	return b;
2093           	}
2094           
2095           
2096           #ifdef YY_USE_PROTOS
2097           void yy_delete_buffer( YY_BUFFER_STATE b )
2098           #else
2099           void yy_delete_buffer( b )
2100           YY_BUFFER_STATE b;
2101 mike  1.1 #endif
2102           	{
2103           	if ( ! b )
2104           		return;
2105           
2106           	if ( b == yy_current_buffer )
2107           		yy_current_buffer = (YY_BUFFER_STATE) 0;
2108           
2109           	if ( b->yy_is_our_buffer )
2110           		yy_flex_free( (void *) b->yy_ch_buf );
2111           
2112           	yy_flex_free( (void *) b );
2113           	}
2114           
2115           
2116           #ifndef YY_ALWAYS_INTERACTIVE
2117           #ifndef YY_NEVER_INTERACTIVE
2118           extern int isatty YY_PROTO(( int ));
2119           #endif
2120           #endif
2121           
2122 mike  1.1 #ifdef YY_USE_PROTOS
2123           void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2124           #else
2125           void yy_init_buffer( b, file )
2126           YY_BUFFER_STATE b;
2127           FILE *file;
2128           #endif
2129           
2130           
2131           	{
2132           	yy_flush_buffer( b );
2133           
2134           	b->yy_input_file = file;
2135           	b->yy_fill_buffer = 1;
2136           
2137           #if YY_ALWAYS_INTERACTIVE
2138           	b->yy_is_interactive = 1;
2139           #else
2140           #if YY_NEVER_INTERACTIVE
2141           	b->yy_is_interactive = 0;
2142           #else
2143 mike  1.1 	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2144           #endif
2145           #endif
2146           	}
2147           
2148           
2149           #ifdef YY_USE_PROTOS
2150           void yy_flush_buffer( YY_BUFFER_STATE b )
2151           #else
2152           void yy_flush_buffer( b )
2153           YY_BUFFER_STATE b;
2154           #endif
2155           
2156           	{
2157           	if ( ! b )
2158           		return;
2159           
2160           	b->yy_n_chars = 0;
2161           
2162           	/* We always need two end-of-buffer characters.  The first causes
2163           	 * a transition to the end-of-buffer state.  The second causes
2164 mike  1.1 	 * a jam in that state.
2165           	 */
2166           	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2167           	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2168           
2169           	b->yy_buf_pos = &b->yy_ch_buf[0];
2170           
2171           	b->yy_at_bol = 1;
2172           	b->yy_buffer_status = YY_BUFFER_NEW;
2173           
2174           	if ( b == yy_current_buffer )
2175           		yy_load_buffer_state();
2176           	}
2177           
2178           
2179           #ifndef YY_NO_SCAN_BUFFER
2180           #ifdef YY_USE_PROTOS
2181           YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2182           #else
2183           YY_BUFFER_STATE yy_scan_buffer( base, size )
2184           char *base;
2185 mike  1.1 yy_size_t size;
2186           #endif
2187           	{
2188           	YY_BUFFER_STATE b;
2189           
2190           	if ( size < 2 ||
2191           	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2192           	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2193           		/* They forgot to leave room for the EOB's. */
2194           		return 0;
2195           
2196           	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2197           	if ( ! b )
2198           		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2199           
2200           	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
2201           	b->yy_buf_pos = b->yy_ch_buf = base;
2202           	b->yy_is_our_buffer = 0;
2203           	b->yy_input_file = 0;
2204           	b->yy_n_chars = b->yy_buf_size;
2205           	b->yy_is_interactive = 0;
2206 mike  1.1 	b->yy_at_bol = 1;
2207           	b->yy_fill_buffer = 0;
2208           	b->yy_buffer_status = YY_BUFFER_NEW;
2209           
2210           	yy_switch_to_buffer( b );
2211           
2212           	return b;
2213           	}
2214           #endif
2215           
2216           
2217           #ifndef YY_NO_SCAN_STRING
2218           #ifdef YY_USE_PROTOS
2219           YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2220           #else
2221           YY_BUFFER_STATE yy_scan_string( yy_str )
2222           yyconst char *yy_str;
2223           #endif
2224           	{
2225           	int len;
2226           	for ( len = 0; yy_str[len]; ++len )
2227 mike  1.1 		;
2228           
2229           	return yy_scan_bytes( yy_str, len );
2230           	}
2231           #endif
2232           
2233           
2234           #ifndef YY_NO_SCAN_BYTES
2235           #ifdef YY_USE_PROTOS
2236           YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2237           #else
2238           YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2239           yyconst char *bytes;
2240           int len;
2241           #endif
2242           	{
2243           	YY_BUFFER_STATE b;
2244           	char *buf;
2245           	yy_size_t n;
2246           	int i;
2247           
2248 mike  1.1 	/* Get memory for full buffer, including space for trailing EOB's. */
2249           	n = len + 2;
2250           	buf = (char *) yy_flex_alloc( n );
2251           	if ( ! buf )
2252           		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2253           
2254           	for ( i = 0; i < len; ++i )
2255           		buf[i] = bytes[i];
2256           
2257           	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2258           
2259           	b = yy_scan_buffer( buf, n );
2260           	if ( ! b )
2261           		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2262           
2263           	/* It's okay to grow etc. this buffer, and we should throw it
2264           	 * away when we're done.
2265           	 */
2266           	b->yy_is_our_buffer = 1;
2267           
2268           	return b;
2269 mike  1.1 	}
2270           #endif
2271           
2272           
2273           #ifndef YY_NO_PUSH_STATE
2274           #ifdef YY_USE_PROTOS
2275           static void yy_push_state( int new_state )
2276           #else
2277           static void yy_push_state( new_state )
2278           int new_state;
2279           #endif
2280           	{
2281           	if ( yy_start_stack_ptr >= yy_start_stack_depth )
2282           		{
2283           		yy_size_t new_size;
2284           
2285           		yy_start_stack_depth += YY_START_STACK_INCR;
2286           		new_size = yy_start_stack_depth * sizeof( int );
2287           
2288           		if ( ! yy_start_stack )
2289           			yy_start_stack = (int *) yy_flex_alloc( new_size );
2290 mike  1.1 
2291           		else
2292           			yy_start_stack = (int *) yy_flex_realloc(
2293           					(void *) yy_start_stack, new_size );
2294           
2295           		if ( ! yy_start_stack )
2296           			YY_FATAL_ERROR(
2297           			"out of memory expanding start-condition stack" );
2298           		}
2299           
2300           	yy_start_stack[yy_start_stack_ptr++] = YY_START;
2301           
2302           	BEGIN(new_state);
2303           	}
2304           #endif
2305           
2306           
2307           #ifndef YY_NO_POP_STATE
2308           static void yy_pop_state()
2309           	{
2310           	if ( --yy_start_stack_ptr < 0 )
2311 mike  1.1 		YY_FATAL_ERROR( "start-condition stack underflow" );
2312           
2313           	BEGIN(yy_start_stack[yy_start_stack_ptr]);
2314           	}
2315           #endif
2316           
2317           
2318           #ifndef YY_NO_TOP_STATE
2319           static int yy_top_state()
2320           	{
2321           	return yy_start_stack[yy_start_stack_ptr - 1];
2322           	}
2323           #endif
2324           
2325           #ifndef YY_EXIT_FAILURE
2326           #define YY_EXIT_FAILURE 2
2327           #endif
2328           
2329           #ifdef YY_USE_PROTOS
2330           static void yy_fatal_error( yyconst char msg[] )
2331           #else
2332 mike  1.1 static void yy_fatal_error( msg )
2333           char msg[];
2334           #endif
2335           	{
2336           	(void) fprintf( stderr, "%s\n", msg );
2337           	exit( YY_EXIT_FAILURE );
2338           	}
2339           
2340           
2341           
2342           /* Redefine yyless() so it works in section 3 code. */
2343           
2344           #undef yyless
2345           #define yyless(n) \
2346           	do \
2347           		{ \
2348           		/* Undo effects of setting up yytext. */ \
2349           		yytext[yyleng] = yy_hold_char; \
2350           		yy_c_buf_p = yytext + n; \
2351           		yy_hold_char = *yy_c_buf_p; \
2352           		*yy_c_buf_p = '\0'; \
2353 mike  1.1 		yyleng = n; \
2354           		} \
2355           	while ( 0 )
2356           
2357           
2358           /* Internal utility routines. */
2359           
2360           #ifndef yytext_ptr
2361           #ifdef YY_USE_PROTOS
2362           static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2363           #else
2364           static void yy_flex_strncpy( s1, s2, n )
2365           char *s1;
2366           yyconst char *s2;
2367           int n;
2368           #endif
2369           	{
2370           	register int i;
2371           	for ( i = 0; i < n; ++i )
2372           		s1[i] = s2[i];
2373           	}
2374 mike  1.1 #endif
2375           
2376           #ifdef YY_NEED_STRLEN
2377           #ifdef YY_USE_PROTOS
2378           static int yy_flex_strlen( yyconst char *s )
2379           #else
2380           static int yy_flex_strlen( s )
2381           yyconst char *s;
2382           #endif
2383           	{
2384           	register int n;
2385           	for ( n = 0; s[n]; ++n )
2386           		;
2387           
2388           	return n;
2389           	}
2390           #endif
2391           
2392           
2393           #ifdef YY_USE_PROTOS
2394           static void *yy_flex_alloc( yy_size_t size )
2395 mike  1.1 #else
2396           static void *yy_flex_alloc( size )
2397           yy_size_t size;
2398           #endif
2399           	{
2400           	return (void *) malloc( size );
2401           	}
2402           
2403           #ifdef YY_USE_PROTOS
2404           static void *yy_flex_realloc( void *ptr, yy_size_t size )
2405           #else
2406           static void *yy_flex_realloc( ptr, size )
2407           void *ptr;
2408           yy_size_t size;
2409           #endif
2410           	{
2411           	/* The cast to (char *) in the following accommodates both
2412           	 * implementations that use char* generic pointers, and those
2413           	 * that use void* generic pointers.  It works with the latter
2414           	 * because both ANSI C and C++ allow castless assignment from
2415           	 * any pointer type to void*, and deal with argument conversions
2416 mike  1.1 	 * as though doing an assignment.
2417           	 */
2418           	return (void *) realloc( (char *) ptr, size );
2419           	}
2420           
2421           #ifdef YY_USE_PROTOS
2422           static void yy_flex_free( void *ptr )
2423           #else
2424           static void yy_flex_free( ptr )
2425           void *ptr;
2426           #endif
2427           	{
2428           	free( ptr );
2429           	}
2430           
2431           #if YY_MAIN
2432           int main()
2433           	{
2434           	yylex();
2435           	return 0;
2436           	}
2437 mike  1.1 #endif
2438           #line 607 "mof.l"
2439           
2440           
2441           /*
2442           **==============================================================================
2443           **
2444           ** Function definitions
2445           **
2446           **==============================================================================
2447           */
2448           
2449           int yywrap()
2450           {
2451               /* Return 1 to indicate the end of input */
2452               return 1;
2453           }
2454           
2455           static int exists(const char* path)
2456           {
2457               if (access(path, R_OK) != 0)
2458 mike  1.1         return -1;
2459           
2460               return 0;
2461           }
2462           
2463           static char* findIncludeFile(const char* path)
2464           {
2465               /* First attempt to locate the file relative to the one that included it */
2466               {
2467                   Buffer buf = BUFFER_INITIALIZER;
2468                   char* p;
2469           
2470                   p = strrchr(state.path, '/');
2471           
2472                   if (p)
2473                   {
2474                       if (Buffer_Append(&buf, state.path, p - state.path + 1) != 0)
2475                           return NULL;
2476                   }
2477           
2478                   if (Buffer_Append(&buf, path, strlen(path) + 1) != 0)
2479 mike  1.1             return NULL;
2480           
2481                   if (exists((const char*)buf.data) == 0)
2482                       return (char*)buf.data;
2483               }
2484           
2485               /* Attempt to open the file relative to the current directory */
2486               {
2487                   if (exists(path) == 0)
2488                       return MOF_Strdup(&state.heap, path);
2489               }
2490           
2491               /* Search for file using include path array */
2492               {
2493                   size_t i;
2494                   for (i = 0; i < state.paths.size; i++)
2495                   {
2496                       const char* p = (const char*)state.paths.data[i];
2497                       Buffer buf = BUFFER_INITIALIZER;
2498           
2499                       if (Buffer_Append(&buf, p, strlen(p)) != 0)
2500 mike  1.1                 return NULL;
2501           
2502                       if (Buffer_AppendChar(&buf, '/') != 0)
2503                           return NULL;
2504           
2505                       if (Buffer_Append(&buf, path, strlen(path) + 1) != 0)
2506                           return NULL;
2507           
2508                       if (exists((char*)buf.data) == 0)
2509                           return (char*)buf.data;
2510           
2511                       MOF_Free(&state.heap, buf.data);
2512                   }
2513               }
2514           
2515               /* Not found */
2516               return NULL;
2517           }
2518           
2519           int openIncludeFile(const char* path_)
2520           {
2521 mike  1.1     FILE* is;
2522               char* path;
2523           
2524               if ((path = findIncludeFile(path_)) == NULL)
2525               {
2526                   yyerrorf(ID_FAILED_TO_FIND_INCLUDE_FILE, 
2527                       "failed to find inlude file: \"%s\"", path_);
2528                   return -1;
2529               }
2530           
2531               /* Check for stack overflow. */
2532               if (s_top >= MOF_STACK_SIZE)
2533               {
2534                   yyerrorf(ID_MOF_STACK_OVERFLOW, "MOF file stack overflow");
2535                   return -1;
2536               }
2537           
2538               /* Open the file */
2539               if ((is = Fopen(path, "rb")) == NULL)
2540               {
2541                   yyerrorf(ID_FAILED_TO_OPEN_FILE, "failed to open file: \"%s\"", path);
2542 mike  1.1         return -1;
2543               }
2544           
2545               /* Push current state onto stack. */
2546               s_stack[s_top].file = state.path;
2547               s_stack[s_top].line = state.line;
2548               s_stack[s_top].buffer = YY_CURRENT_BUFFER;
2549               s_top++;
2550           
2551               /* Setup state for new file */
2552               yy_switch_to_buffer(yy_create_buffer(is, YY_BUF_SIZE));
2553               state.path = MOF_Strdup(&state.heap, path);
2554               state.line = 1;
2555           
2556               return 0;
2557           }
2558           
2559           int closeIncludeFile()
2560           {
2561               /* Check for stack underflow. */
2562               if (s_top == 0)
2563 mike  1.1     {
2564                   yyerrorf(ID_MOF_STACK_UNDERFLOW, "MOF file stack underflow");
2565                   return -1;
2566               }
2567           
2568               /* Release current state */
2569               MOF_Free(&state.heap, state.path);
2570               fclose(YY_CURRENT_BUFFER->yy_input_file);
2571               yy_delete_buffer(YY_CURRENT_BUFFER);
2572           
2573               /* Restore state from top of stack */
2574               s_top--;
2575               state.path = s_stack[s_top].file;
2576               state.line = s_stack[s_top].line;
2577               yy_switch_to_buffer(s_stack[s_top].buffer);
2578           
2579               return 0;
2580           }
2581           
2582           /*
2583           **==============================================================================
2584 mike  1.1 **
2585           ** MOF_Parser
2586           **
2587           **==============================================================================
2588           */
2589           
2590           MOF_Parser* MOF_Parser_New(
2591               const char* const* paths,
2592               size_t numPaths)
2593           {
2594               MOF_Parser* self = (MOF_Parser*)calloc(1, sizeof(MOF_Parser));
2595               size_t i;
2596               char* str;
2597           
2598               if (!self)
2599                   return NULL;
2600           
2601               for (i = 0; i < numPaths; i++)
2602               {
2603                   str = MOF_Strdup(&self->state.heap, paths[i]);
2604           
2605 mike  1.1         if (!str)
2606                   {
2607                       MOF_Release(&self->state.heap);
2608                       free(self);
2609                       return NULL;
2610                   }
2611           
2612                   /* PtrArray_Append() uses the global state's heap object to
2613                    * obtain memory, so install self->state as the global state
2614                    * object temporarily.
2615                    */
2616                   {
2617                       state = self->state;
2618                       PtrArray_Append(&state.paths, str);
2619                       self->state = state;
2620                       memset(&state, 0, sizeof(state));
2621                   }
2622               }
2623           
2624               return self;
2625           }
2626 mike  1.1 
2627           void MOF_Parser_SetErrorCallback(
2628               MOF_Parser* self, 
2629               void (*callback)(const char* msg, const wchar_t* wmsg, void* data),
2630               void* data)
2631           {
2632               if (self)
2633               {
2634                   self->state.errorCallback = callback;
2635                   self->state.errorCallbackData = data;
2636               }
2637           }
2638           
2639           void MOF_Parser_SetWarningCallback(
2640               MOF_Parser* self, 
2641               void (*callback)(const char* msg, const wchar_t* wmsg, void* data),
2642               void* data)
2643           {
2644               if (self)
2645               {
2646                   self->state.warningCallback = callback;
2647 mike  1.1         self->state.warningCallbackData = data;
2648               }
2649           }
2650           
2651           void MOF_Parser_SetPragmaCallback(
2652               MOF_Parser* self, 
2653               void (*callback)(const char* pragma, const char* value, void* data),
2654               void* data)
2655           {
2656               if (self)
2657               {
2658                   self->state.pragmaCallback = callback;
2659                   self->state.pragmaCallbackData = data;
2660               }
2661           }
2662           
2663           void MOF_Parser_SetClassDeclCallback(
2664               MOF_Parser* self, 
2665               void (*callback)(const MI_ClassDecl* decl, void* data),
2666               void* data)
2667           {
2668 mike  1.1     if (self)
2669               {
2670                   self->state.classDeclCallback = callback;
2671                   self->state.classDeclCallbackData = data;
2672               }
2673           }
2674           
2675           void MOF_Parser_SetInstanceDeclCallback(
2676               MOF_Parser* self, 
2677               void (*callback)(const MI_InstanceDecl* decl, void* data),
2678               void* data)
2679           {
2680               if (self)
2681               {
2682                   self->state.instanceDeclCallback = callback;
2683                   self->state.instanceDeclCallbackData = data;
2684               }
2685           }
2686           
2687           void MOF_Parser_SetQualifierDeclCallback(
2688               MOF_Parser* self, 
2689 mike  1.1     void (*callback)(const MI_QualifierDecl* decl, void* data),
2690               void* data)
2691           {
2692               if (self)
2693               {
2694                   self->state.qualifierDeclCallback = callback;
2695                   self->state.qualifierDeclCallbackData = data;
2696               }
2697           }
2698           
2699           void MOF_Parser_Delete(MOF_Parser* self)
2700           {
2701               if (self)
2702               {
2703                   MOF_Release(&self->state.heap);
2704                   free(self);
2705               }
2706           }
2707           
2708           /* Handle multiple calls to this function */
2709           int MOF_Parser_Parse(MOF_Parser* self, const char* path)
2710 mike  1.1 {
2711               /* Reject null parameters */
2712               if (!self || !path)
2713                   return -1;
2714           
2715               /* Clear stack */
2716               s_top = 0;
2717           
2718               /* Set global state */
2719               state = self->state;
2720           
2721               /* Open input */
2722               yyin = Fopen(path, "rb");
2723           
2724               if (!yyin)
2725               {
2726                   yyerrorf(ID_FAILED_TO_OPEN_FILE, "failed to open file: %s", path);
2727                   self->state = state;
2728                   memset(&state.heap, 0, sizeof(state));
2729                   return -1;
2730               }
2731 mike  1.1 
2732               /* Save path */
2733               state.path = MOF_Strdup(&state.heap, path);
2734           
2735               /* Set initialize line number */
2736               state.line = 1;
2737           
2738               /* Clear the parser state */
2739               yy_c_buf_p = 0;
2740               yy_last_accepting_cpos = 0;
2741               yy_init = 1;
2742           
2743               /* Run the parser */
2744               if (yyparse() != 0)
2745               {
2746                   fclose(yyin);
2747                   yy_delete_buffer(YY_CURRENT_BUFFER);
2748                   self->state = state;
2749                   memset(&state.heap, 0, sizeof(state));
2750                   return -1;
2751               }
2752 mike  1.1 
2753               /* Perform post processing (which requires first pass completion) */
2754               if (PerformPostProcessing() != 0)
2755               {
2756                   fclose(yyin);
2757                   yy_delete_buffer(YY_CURRENT_BUFFER);
2758                   self->state = state;
2759                   memset(&state.heap, 0, sizeof(state));
2760                   return -1;
2761               }
2762           
2763               /* Close stream and release parse buffer */
2764               fclose(yyin);
2765               yy_delete_buffer(YY_CURRENT_BUFFER);
2766           
2767               /* Restore state */
2768               self->state = state;
2769               memset(&state.heap, 0, sizeof(state));
2770           
2771               return 0;
2772           }
2773 mike  1.1 
2774           void MOF_Parser_Dump(MOF_Parser* self, FILE* file)
2775           {
2776               size_t i;
2777           
2778               for (i = 0; i < self->state.qualifierDecls.size; i++)
2779                   MOF_PrintQualifierDecl(self->state.qualifierDecls.data[i], file);
2780           
2781               for (i = 0; i < self->state.classDecls.size; i++)
2782                   MOF_PrintClassDecl(self->state.classDecls.data[i], file);
2783           
2784               for (i = 0; i < self->state.instanceDecls.size; i++)
2785                   MOF_PrintInstanceDecl(self->state.instanceDecls.data[i], file);
2786           }

ViewCVS 0.9.2