utils

olib.c

Go to the documentation of this file.
00001 
00002 #line 3 "olib.c"
00003 
00004 #define  YY_INT_ALIGNED short int
00005 
00006 /* A lexical scanner generated by flex */
00007 
00008 #define FLEX_SCANNER
00009 #define YY_FLEX_MAJOR_VERSION 2
00010 #define YY_FLEX_MINOR_VERSION 5
00011 #define YY_FLEX_SUBMINOR_VERSION 35
00012 #if YY_FLEX_SUBMINOR_VERSION > 0
00013 #define FLEX_BETA
00014 #endif
00015 
00016 /* First, we deal with  platform-specific or compiler-specific issues. */
00017 
00018 /* begin standard C headers. */
00019 #include <stdio.h>
00020 #include <string.h>
00021 #include <errno.h>
00022 #include <stdlib.h>
00023 
00024 /* end standard C headers. */
00025 
00026 /* flex integer type definitions */
00027 
00028 #ifndef FLEXINT_H
00029 #define FLEXINT_H
00030 
00031 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00032 
00033 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00034 
00035 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00036  * if you want the limit (max/min) macros for int types. 
00037  */
00038 #ifndef __STDC_LIMIT_MACROS
00039 #define __STDC_LIMIT_MACROS 1
00040 #endif
00041 
00042 #include <inttypes.h>
00043 typedef int8_t flex_int8_t;
00044 typedef uint8_t flex_uint8_t;
00045 typedef int16_t flex_int16_t;
00046 typedef uint16_t flex_uint16_t;
00047 typedef int32_t flex_int32_t;
00048 typedef uint32_t flex_uint32_t;
00049 #else
00050 typedef signed char flex_int8_t;
00051 typedef short int flex_int16_t;
00052 typedef int flex_int32_t;
00053 typedef unsigned char flex_uint8_t; 
00054 typedef unsigned short int flex_uint16_t;
00055 typedef unsigned int flex_uint32_t;
00056 #endif /* ! C99 */
00057 
00058 /* Limits of integral types. */
00059 #ifndef INT8_MIN
00060 #define INT8_MIN               (-128)
00061 #endif
00062 #ifndef INT16_MIN
00063 #define INT16_MIN              (-32767-1)
00064 #endif
00065 #ifndef INT32_MIN
00066 #define INT32_MIN              (-2147483647-1)
00067 #endif
00068 #ifndef INT8_MAX
00069 #define INT8_MAX               (127)
00070 #endif
00071 #ifndef INT16_MAX
00072 #define INT16_MAX              (32767)
00073 #endif
00074 #ifndef INT32_MAX
00075 #define INT32_MAX              (2147483647)
00076 #endif
00077 #ifndef UINT8_MAX
00078 #define UINT8_MAX              (255U)
00079 #endif
00080 #ifndef UINT16_MAX
00081 #define UINT16_MAX             (65535U)
00082 #endif
00083 #ifndef UINT32_MAX
00084 #define UINT32_MAX             (4294967295U)
00085 #endif
00086 
00087 #endif /* ! FLEXINT_H */
00088 
00089 #ifdef __cplusplus
00090 
00091 /* The "const" storage-class-modifier is valid. */
00092 #define YY_USE_CONST
00093 
00094 #else   /* ! __cplusplus */
00095 
00096 /* C99 requires __STDC__ to be defined as 1. */
00097 #if defined (__STDC__)
00098 
00099 #define YY_USE_CONST
00100 
00101 #endif  /* defined (__STDC__) */
00102 #endif  /* ! __cplusplus */
00103 
00104 #ifdef YY_USE_CONST
00105 #define yyconst const
00106 #else
00107 #define yyconst
00108 #endif
00109 
00110 /* Returned upon end-of-file. */
00111 #define YY_NULL 0
00112 
00113 /* Promotes a possibly negative, possibly signed char to an unsigned
00114  * integer for use as an array index.  If the signed char is negative,
00115  * we want to instead treat it as an 8-bit unsigned char, hence the
00116  * double cast.
00117  */
00118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00119 
00120 /* Enter a start condition.  This macro really ought to take a parameter,
00121  * but we do it the disgusting crufty way forced on us by the ()-less
00122  * definition of BEGIN.
00123  */
00124 #define BEGIN (yy_start) = 1 + 2 *
00125 
00126 /* Translate the current start state into a value that can be later handed
00127  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00128  * compatibility.
00129  */
00130 #define YY_START (((yy_start) - 1) / 2)
00131 #define YYSTATE YY_START
00132 
00133 /* Action number for EOF rule of a given start state. */
00134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00135 
00136 /* Special action meaning "start processing a new file". */
00137 #define YY_NEW_FILE yyrestart(yyin  )
00138 
00139 #define YY_END_OF_BUFFER_CHAR 0
00140 
00141 /* Size of default input buffer. */
00142 #ifndef YY_BUF_SIZE
00143 #define YY_BUF_SIZE 16384
00144 #endif
00145 
00146 /* The state buf must be large enough to hold one state per character in the main buffer.
00147  */
00148 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00149 
00150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00151 #define YY_TYPEDEF_YY_BUFFER_STATE
00152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00153 #endif
00154 
00155 extern int yyleng;
00156 
00157 extern FILE *yyin, *yyout;
00158 
00159 #define EOB_ACT_CONTINUE_SCAN 0
00160 #define EOB_ACT_END_OF_FILE 1
00161 #define EOB_ACT_LAST_MATCH 2
00162 
00163     #define YY_LESS_LINENO(n)
00164     
00165 /* Return all but the first "n" matched characters back to the input stream. */
00166 #define yyless(n) \
00167     do \
00168         { \
00169         /* Undo effects of setting up yytext. */ \
00170         int yyless_macro_arg = (n); \
00171         YY_LESS_LINENO(yyless_macro_arg);\
00172         *yy_cp = (yy_hold_char); \
00173         YY_RESTORE_YY_MORE_OFFSET \
00174         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00175         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00176         } \
00177     while ( 0 )
00178 
00179 #define unput(c) yyunput( c, (yytext_ptr)  )
00180 
00181 #ifndef YY_TYPEDEF_YY_SIZE_T
00182 #define YY_TYPEDEF_YY_SIZE_T
00183 typedef size_t yy_size_t;
00184 #endif
00185 
00186 #ifndef YY_STRUCT_YY_BUFFER_STATE
00187 #define YY_STRUCT_YY_BUFFER_STATE
00188 struct yy_buffer_state
00189     {
00190     FILE *yy_input_file;
00191 
00192     char *yy_ch_buf;        /* input buffer */
00193     char *yy_buf_pos;       /* current position in input buffer */
00194 
00195     /* Size of input buffer in bytes, not including room for EOB
00196      * characters.
00197      */
00198     yy_size_t yy_buf_size;
00199 
00200     /* Number of characters read into yy_ch_buf, not including EOB
00201      * characters.
00202      */
00203     int yy_n_chars;
00204 
00205     /* Whether we "own" the buffer - i.e., we know we created it,
00206      * and can realloc() it to grow it, and should free() it to
00207      * delete it.
00208      */
00209     int yy_is_our_buffer;
00210 
00211     /* Whether this is an "interactive" input source; if so, and
00212      * if we're using stdio for input, then we want to use getc()
00213      * instead of fread(), to make sure we stop fetching input after
00214      * each newline.
00215      */
00216     int yy_is_interactive;
00217 
00218     /* Whether we're considered to be at the beginning of a line.
00219      * If so, '^' rules will be active on the next match, otherwise
00220      * not.
00221      */
00222     int yy_at_bol;
00223 
00224     int yy_bs_lineno; 
00225     int yy_bs_column; 
00227     /* Whether to try to fill the input buffer when we reach the
00228      * end of it.
00229      */
00230     int yy_fill_buffer;
00231 
00232     int yy_buffer_status;
00233 
00234 #define YY_BUFFER_NEW 0
00235 #define YY_BUFFER_NORMAL 1
00236     /* When an EOF's been seen but there's still some text to process
00237      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00238      * shouldn't try reading from the input source any more.  We might
00239      * still have a bunch of tokens to match, though, because of
00240      * possible backing-up.
00241      *
00242      * When we actually see the EOF, we change the status to "new"
00243      * (via yyrestart()), so that the user can continue scanning by
00244      * just pointing yyin at a new input file.
00245      */
00246 #define YY_BUFFER_EOF_PENDING 2
00247 
00248     };
00249 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00250 
00251 /* Stack of input buffers. */
00252 static size_t yy_buffer_stack_top = 0; 
00253 static size_t yy_buffer_stack_max = 0; 
00254 static YY_BUFFER_STATE * yy_buffer_stack = 0; 
00256 /* We provide macros for accessing buffer states in case in the
00257  * future we want to put the buffer states in a more general
00258  * "scanner state".
00259  *
00260  * Returns the top of the stack, or NULL.
00261  */
00262 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00263                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00264                           : NULL)
00265 
00266 /* Same as previous macro, but useful when we know that the buffer stack is not
00267  * NULL or when we need an lvalue. For internal use only.
00268  */
00269 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00270 
00271 /* yy_hold_char holds the character lost when yytext is formed. */
00272 static char yy_hold_char;
00273 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
00274 int yyleng;
00275 
00276 /* Points to current character in buffer. */
00277 static char *yy_c_buf_p = (char *) 0;
00278 static int yy_init = 0;     /* whether we need to initialize */
00279 static int yy_start = 0;    /* start state number */
00280 
00281 /* Flag which is used to allow yywrap()'s to do buffer switches
00282  * instead of setting up a fresh yyin.  A bit of a hack ...
00283  */
00284 static int yy_did_buffer_switch_on_eof;
00285 
00286 void yyrestart (FILE *input_file  );
00287 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
00288 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
00289 void yy_delete_buffer (YY_BUFFER_STATE b  );
00290 void yy_flush_buffer (YY_BUFFER_STATE b  );
00291 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
00292 void yypop_buffer_state (void );
00293 
00294 static void yyensure_buffer_stack (void );
00295 static void yy_load_buffer_state (void );
00296 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
00297 
00298 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
00299 
00300 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
00301 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
00302 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
00303 
00304 void *yyalloc (yy_size_t  );
00305 void *yyrealloc (void *,yy_size_t  );
00306 void yyfree (void *  );
00307 
00308 #define yy_new_buffer yy_create_buffer
00309 
00310 #define yy_set_interactive(is_interactive) \
00311     { \
00312     if ( ! YY_CURRENT_BUFFER ){ \
00313         yyensure_buffer_stack (); \
00314         YY_CURRENT_BUFFER_LVALUE =    \
00315             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00316     } \
00317     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00318     }
00319 
00320 #define yy_set_bol(at_bol) \
00321     { \
00322     if ( ! YY_CURRENT_BUFFER ){\
00323         yyensure_buffer_stack (); \
00324         YY_CURRENT_BUFFER_LVALUE =    \
00325             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00326     } \
00327     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00328     }
00329 
00330 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00331 
00332 /* Begin user sect3 */
00333 
00334 typedef unsigned char YY_CHAR;
00335 
00336 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
00337 
00338 typedef int yy_state_type;
00339 
00340 extern int yylineno;
00341 
00342 int yylineno = 1;
00343 
00344 extern char *yytext;
00345 #define yytext_ptr yytext
00346 
00347 static yy_state_type yy_get_previous_state (void );
00348 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
00349 static int yy_get_next_buffer (void );
00350 static void yy_fatal_error (yyconst char msg[]  );
00351 
00352 /* Done after the current pattern has been matched and before the
00353  * corresponding action - sets up yytext.
00354  */
00355 #define YY_DO_BEFORE_ACTION \
00356     (yytext_ptr) = yy_bp; \
00357     yyleng = (size_t) (yy_cp - yy_bp); \
00358     (yy_hold_char) = *yy_cp; \
00359     *yy_cp = '\0'; \
00360     (yy_c_buf_p) = yy_cp;
00361 
00362 #define YY_NUM_RULES 68
00363 #define YY_END_OF_BUFFER 69
00364 /* This struct is not used in this scanner,
00365    but its presence is necessary. */
00366 struct yy_trans_info
00367     {
00368     flex_int32_t yy_verify;
00369     flex_int32_t yy_nxt;
00370     };
00371 static yyconst flex_int16_t yy_accept[327] =
00372     {   0,
00373         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00374         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00375         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00376         0,    0,    0,    0,    0,    0,   69,   68,   67,   68,
00377        68,   66,   68,   68,   68,   68,   68,   68,   68,   68,
00378        68,   68,   68,   68,    9,   68,   68,   68,   10,   68,
00379        12,   68,   68,   68,   68,   68,   68,   49,   68,   68,
00380        68,   68,   68,   68,   68,   61,   63,   63,   64,   63,
00381        65,   65,   68,   68,   68,   68,   68,   68,   68,   68,
00382        68,   68,   68,   68,   68,   68,   32,   68,   68,   30,
00383 
00384        29,   32,   68,   68,   68,   68,   67,   37,   68,   37,
00385        68,    0,    0,    1,    0,    0,    0,    0,    0,    0,
00386         0,    0,    0,    0,    0,    0,    9,    0,    0,   10,
00387        12,    0,    0,   47,    0,    0,   49,    0,    0,    0,
00388        53,   56,   57,    0,    0,    0,    0,    0,   62,    0,
00389         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00390         0,    0,    0,    0,    0,   30,   29,   30,    0,   36,
00391         0,    0,   37,    0,    1,    0,    0,    5,    0,    0,
00392         0,    0,    0,    0,    0,    0,    0,    0,    4,    0,
00393         8,    0,    0,   48,   47,    0,    0,   51,   50,   60,
00394 
00395        54,   58,   55,    0,   59,   23,   26,    0,    0,    0,
00396         0,   33,    0,    0,    0,    0,    0,    0,    0,    0,
00397        31,   35,   36,    0,    7,    0,    0,   18,   13,    0,
00398         0,    0,    0,   21,    0,    0,    0,    0,    0,    3,
00399         0,    0,   47,    0,    0,    0,    0,   27,   24,   28,
00400         0,   44,    0,    0,    0,   39,    0,    0,    0,    0,
00401        36,    0,    0,    0,    0,    0,    0,   19,    0,   17,
00402         0,   16,    0,    0,    0,   47,    0,    0,   52,    0,
00403         0,    0,    0,   45,    0,   43,    0,   42,    0,   36,
00404         0,    2,    0,    0,    0,    0,    0,    0,   22,   25,
00405 
00406         0,    0,    0,   38,    0,   20,    0,    0,   14,    0,
00407         0,   34,    0,   46,    0,    0,   40,    0,   15,    0,
00408         0,    0,   41,    6,   11,    0
00409     } ;
00410 
00411 static yyconst flex_int32_t yy_ec[256] =
00412     {   0,
00413         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00414         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00415         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00416         1,    2,    1,    4,    1,    1,    1,    1,    5,    1,
00417         1,    1,    6,    1,    6,    7,    8,    9,    9,    9,
00418         9,    9,    9,    9,    9,    9,    9,    1,    1,    1,
00419         1,    1,    1,    1,   10,   11,   12,   13,   14,   15,
00420        16,   17,   18,    1,   19,   20,    1,   21,   22,   23,
00421         1,   24,   25,   26,   27,   28,   29,   30,   31,   32,
00422         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00423 
00424         1,    1,    1,   33,   34,    1,    1,    1,    1,    1,
00425         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00426         1,    1,   35,    1,   36,    1,    1,    1,    1,    1,
00427         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00428         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00429         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00430         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00431         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00432         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00433         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00434 
00435         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00436         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00437         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00438         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00439         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00440         1,    1,    1,    1,    1
00441     } ;
00442 
00443 static yyconst flex_int32_t yy_meta[37] =
00444     {   0,
00445         1,    1,    2,    1,    3,    1,    1,    1,    1,    1,
00446         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00447         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00448         1,    1,    1,    1,    1,    1
00449     } ;
00450 
00451 static yyconst flex_int16_t yy_base[359] =
00452     {   0,
00453         0,   34,    3,    5,   12,   68,   24,   73,  107,  141,
00454        26,  175,   82,   84,  209,  491,   29,   48,   63,   92,
00455        97,   99,  102,  104,  243,    6,  119,  276,  303,  337,
00456       123,  368,  127,  133,  146,  150,  493,  495,  495,  468,
00457       455,  495,    0,  466,  480,   34,  467,  469,    4,    2,
00458       472,  464,    0,  475,  474,    0,  468,  472,  471,  470,
00459       469,  453,    0,  467,  453,  460,  464,  463,  451,  448,
00460         4,  106,   14,  452,  382,  495,  495,  495,  402,  359,
00461       495,  495,    0,  369,  373,  372,  371,  373,  365,  361,
00462        93,  363,  365,  364,  367,  366,  495,    0,   71,  369,
00463 
00464       105,  495,    0,  368,  362,  372,  371,  495,  128,  495,
00465         0,  357,  334,  495,  364,  356,  358,  342,  344,  351,
00466       343,  341,  331,  348,  346,  353,  348,  351,  340,  345,
00467       344,  334,  346,  341,  328,  336,  338,  326,  315,  315,
00468       495,  495,  495,  310,  310,  310,  311,  300,  495,  326,
00469       318,  305,  308,  306,  296,  312,  312,  299,  301,  308,
00470       300,  298,  288,  305,  311,  306,  131,  305,  308,  302,
00471       295,  300,  495,  138,  298,  295,  284,  495,  295,  294,
00472       156,  283,  266,  290,  272,  275,  261,  259,  495,  281,
00473       495,  269,  269,  495,  272,  252,  251,  495,  495,  495,
00474 
00475       495,  495,  495,  252,  495,  495,  495,  263,  254,  259,
00476       246,  495,  268,  258,  240,  264,  246,  251,  238,  236,
00477       495,  495,  252,  234,  495,  241,  254,  495,  495,  157,
00478       236,  240,  249,  495,  248,  247,  246,  225,  240,  495,
00479       217,  230,  230,  224,  215,  210,  215,  495,  495,  495,
00480       230,  495,  210,  215,  225,  495,  223,  222,  221,  201,
00481       211,  197,  188,  214,  202,  191,  211,  495,  210,  495,
00482       206,  495,  184,  193,  182,  495,  181,  180,  495,  188,
00483       186,  174,  194,  495,  193,  495,  191,  495,  169,  495,
00484       168,  495,  188,  164,  186,  167,  160,  157,  495,  495,
00485 
00486       179,  153,  172,  495,  170,  495,  169,  168,  495,  158,
00487       159,  495,  164,  495,  160,  158,  495,  153,  495,  132,
00488       114,   86,  495,  495,  495,  495,  396,  399,  402,  405,
00489        80,   71,   62,   54,   41,   40,    3,  408,  411,    0,
00490       414,  417,  420,  423,  426,  429,  432,  435,  438,  441,
00491       444,  447,  450,  453,  456,  459,  462,  465
00492     } ;
00493 
00494 static yyconst flex_int16_t yy_def[359] =
00495     {   0,
00496       327,  327,  327,  327,  327,  327,  327,  327,  327,  327,
00497       327,  327,  327,  327,  327,   15,  327,  327,  328,  328,
00498       327,  327,  327,  327,  327,   25,  327,   25,  327,  327,
00499       327,   12,  329,  329,  327,  327,  326,  326,  326,  326,
00500       330,  326,  331,  326,  326,  326,  326,  326,  326,  326,
00501       326,  326,  332,  326,  326,  333,  326,  326,  326,  326,
00502       326,  326,  334,  326,  326,  326,  326,  326,  326,  326,
00503       326,  326,  326,  326,  326,  326,  326,  326,  326,  330,
00504       326,  326,  335,  326,  326,  326,  326,  326,  326,  326,
00505       326,  326,  326,  326,  326,  326,  326,  336,  326,  326,
00506 
00507       326,  326,  337,  326,  326,  338,  338,  326,  339,  326,
00508       340,  326,  330,  326,  331,  326,  341,  326,  326,  326,
00509       326,  326,  326,  326,  326,  332,  326,  333,  326,  326,
00510       326,  326,  334,  326,  326,  326,  326,  326,  326,  326,
00511       326,  326,  326,  326,  326,  326,  326,  326,  326,  335,
00512       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00513       326,  326,  326,  326,  336,  326,  326,  326,  337,  326,
00514       326,  338,  326,  339,  338,  340,  326,  326,  342,  341,
00515       341,  326,  326,  343,  326,  326,  326,  326,  326,  344,
00516       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00517 
00518       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00519       326,  326,  345,  326,  326,  346,  326,  326,  326,  326,
00520       326,  326,  326,  326,  326,  326,  342,  326,  326,  341,
00521       326,  326,  343,  326,  347,  348,  349,  326,  344,  326,
00522       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00523       345,  326,  326,  326,  346,  326,  350,  351,  352,  326,
00524       326,  326,  326,  341,  326,  326,  347,  326,  348,  326,
00525       349,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00526       326,  326,  350,  326,  351,  326,  352,  326,  326,  326,
00527       326,  326,  353,  326,  354,  326,  326,  326,  326,  326,
00528 
00529       355,  326,  356,  326,  353,  326,  357,  354,  326,  326,
00530       326,  326,  355,  326,  358,  356,  326,  357,  326,  326,
00531       326,  358,  326,  326,  326,    0,  326,  326,  326,  326,
00532       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00533       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00534       326,  326,  326,  326,  326,  326,  326,  326
00535     } ;
00536 
00537 static yyconst flex_int16_t yy_nxt[532] =
00538     {   0,
00539       176,   39,   39,  169,   39,   39,   39,   42,   42,   53,
00540       117,  140,  117,   39,   39,  123,   52,   54,   52,   89,
00541        55,  122,   40,  145,  141,   39,   39,   39,   39,   58,
00542        39,   39,   59,   76,   41,   39,   42,   41,   43,   41,
00543       165,  150,  146,   44,   45,   46,   41,   47,   48,   39,
00544        42,  118,   76,   49,  133,  119,   40,   45,   41,   50,
00545        41,   51,  128,   41,   78,   39,   38,   79,   41,   39,
00546        42,  126,   56,   54,   39,   42,   55,  166,   58,  167,
00547       115,   59,   41,   39,   39,   39,   42,   67,  323,   67,
00548        68,   57,   68,   78,   42,   38,   79,   80,   39,   39,
00549 
00550        39,   42,   41,   39,   81,   39,   82,   41,   39,   39,
00551       158,  166,   60,  167,  159,   61,   41,  142,   41,  143,
00552        39,   39,   62,   83,   39,   39,   80,  103,  107,  108,
00553       173,   41,  144,   41,  107,  110,   41,  166,   41,  167,
00554       173,   41,   39,   42,  325,  324,   60,   39,   39,   61,
00555       111,   39,   42,   41,  111,  319,   62,   41,  229,  229,
00556       317,  109,  323,  175,  230,  264,  314,  109,  321,  320,
00557       309,  319,  306,  175,  317,   41,   39,   42,  315,   63,
00558        41,  314,  312,  311,   41,   64,   65,  310,  309,  307,
00559       306,  304,  303,  288,   64,  286,  284,  302,   64,  301,
00560 
00561        64,  300,   66,  299,  298,  297,  296,  295,  272,   41,
00562        39,   39,  270,  268,  294,  293,  229,  292,  291,  290,
00563        69,   70,  289,  288,  286,  284,   71,  256,  282,  281,
00564        72,   73,  252,   74,  280,  279,  278,  277,  276,  275,
00565       274,   75,  240,   41,   39,   39,  273,   83,  272,  270,
00566       268,  234,   84,  266,   85,  265,  228,   86,  263,  262,
00567       261,  260,   87,  259,  258,  257,  256,  254,   88,  253,
00568       252,  250,  249,  248,  247,  246,  245,   41,   42,  244,
00569       243,  242,  241,  240,  238,   90,  237,   91,  236,   92,
00570        93,  235,  234,  232,  231,   94,  229,  228,  226,  225,
00571 
00572       173,   95,  173,   96,   39,   97,  224,   98,   99,  100,
00573       223,  101,  222,  168,  168,  221,  220,  219,  218,  217,
00574       216,  215,  214,  213,  212,  211,  210,  209,  208,  207,
00575       206,  205,  204,  203,  202,  201,  200,   41,   39,  102,
00576       199,   98,   99,  100,  198,  101,  137,  197,  196,  195,
00577       194,  193,  131,  130,  192,  191,  127,  190,  189,  188,
00578       187,  186,  185,  184,  183,  182,  181,  179,  178,  114,
00579       177,   41,  103,  173,  173,  171,  170,  168,  104,  164,
00580       163,  162,  161,  160,  157,  156,  155,  104,  154,  153,
00581       152,  104,  151,  104,  114,  105,   38,   38,   38,   77,
00582 
00583        77,   77,  106,  106,  106,  113,  149,  113,  172,  172,
00584       172,  174,  174,  174,  180,  148,  180,  227,  227,  227,
00585       233,  233,  233,  239,  239,  239,  251,  251,  251,  255,
00586       255,  255,  267,  267,  267,  269,  269,  269,  271,  271,
00587       271,  283,  283,  283,  285,  285,  285,  287,  287,  287,
00588       305,  305,  305,  308,  308,  308,  313,  313,  313,  316,
00589       316,  316,  318,  318,  318,  322,  322,  322,  147,  139,
00590       138,  137,  137,  136,  135,  134,  132,  131,  131,  130,
00591       130,  129,  127,  127,  125,  124,  121,  120,  117,  116,
00592       114,  112,  326,   42,   37,  326,  326,  326,  326,  326,
00593 
00594       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00595       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00596       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00597       326
00598     } ;
00599 
00600 static yyconst flex_int16_t yy_chk[532] =
00601     {   0,
00602       340,    1,    1,  337,    3,    3,    4,    4,   26,    4,
00603        50,   71,   49,    5,    5,   50,    3,    5,    4,   26,
00604         5,   49,    1,   73,   71,    7,    7,   11,   11,    7,
00605        17,   17,    7,   17,    1,    2,    2,    3,    2,    4,
00606       336,  335,   73,    2,    2,    2,    5,    2,    2,   18,
00607        18,   46,   18,    2,  334,   46,    2,    2,    7,    2,
00608        11,    2,  333,   17,   19,   19,   19,   19,    2,    6,
00609         6,  332,    6,    6,    8,    8,    6,   99,    8,   99,
00610       331,    8,   18,   13,   13,   14,   14,   13,  322,   14,
00611        13,    6,   14,   20,   20,   20,   20,   19,   21,   21,
00612 
00613        22,   22,    6,   23,   23,   24,   24,    8,    9,    9,
00614        91,  101,    9,  101,   91,    9,   13,   72,   14,   72,
00615        27,   27,    9,   27,   31,   31,   20,   31,   33,   33,
00616       109,   21,   72,   22,   34,   34,   23,  167,   24,  167,
00617       174,    9,   10,   10,  321,  320,   10,   35,   35,   10,
00618        35,   36,   36,   27,   36,  318,   10,   31,  181,  230,
00619       316,   33,  315,  109,  181,  230,  313,   34,  311,  310,
00620       308,  307,  305,  174,  303,   10,   12,   12,  302,   12,
00621        35,  301,  298,  297,   36,   12,   12,  296,  295,  294,
00622       293,  291,  289,  287,   12,  285,  283,  282,   12,  281,
00623 
00624        12,  280,   12,  278,  277,  275,  274,  273,  271,   12,
00625        15,   15,  269,  267,  266,  265,  264,  263,  262,  261,
00626        15,   15,  260,  259,  258,  257,   15,  255,  254,  253,
00627        15,   15,  251,   15,  247,  246,  245,  244,  243,  242,
00628       241,   15,  239,   15,   25,   25,  238,   25,  237,  236,
00629       235,  233,   25,  232,   25,  231,  227,   25,  226,  224,
00630       223,  220,   25,  219,  218,  217,  216,  215,   25,  214,
00631       213,  211,  210,  209,  208,  204,  197,   25,   28,  196,
00632       195,  193,  192,  190,  188,   28,  187,   28,  186,   28,
00633        28,  185,  184,  183,  182,   28,  180,  179,  177,  176,
00634 
00635       175,   28,  172,   28,   29,   29,  171,   29,   29,   29,
00636       170,   29,  169,  168,  166,  165,  164,  163,  162,  161,
00637       160,  159,  158,  157,  156,  155,  154,  153,  152,  151,
00638       150,  148,  147,  146,  145,  144,  140,   29,   30,   30,
00639       139,   30,   30,   30,  138,   30,  137,  136,  135,  134,
00640       133,  132,  131,  130,  129,  128,  127,  126,  125,  124,
00641       123,  122,  121,  120,  119,  118,  117,  116,  115,  113,
00642       112,   30,   32,  107,  106,  105,  104,  100,   32,   96,
00643        95,   94,   93,   92,   90,   89,   88,   32,   87,   86,
00644        85,   32,   84,   32,   80,   32,  327,  327,  327,  328,
00645 
00646       328,  328,  329,  329,  329,  330,   79,  330,  338,  338,
00647       338,  339,  339,  339,  341,   75,  341,  342,  342,  342,
00648       343,  343,  343,  344,  344,  344,  345,  345,  345,  346,
00649       346,  346,  347,  347,  347,  348,  348,  348,  349,  349,
00650       349,  350,  350,  350,  351,  351,  351,  352,  352,  352,
00651       353,  353,  353,  354,  354,  354,  355,  355,  355,  356,
00652       356,  356,  357,  357,  357,  358,  358,  358,   74,   70,
00653        69,   68,   67,   66,   65,   64,   62,   61,   60,   59,
00654        58,   57,   55,   54,   52,   51,   48,   47,   45,   44,
00655        41,   40,   37,   16,  326,  326,  326,  326,  326,  326,
00656 
00657       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00658       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00659       326,  326,  326,  326,  326,  326,  326,  326,  326,  326,
00660       326
00661     } ;
00662 
00663 static yy_state_type yy_last_accepting_state;
00664 static char *yy_last_accepting_cpos;
00665 
00666 extern int yy_flex_debug;
00667 int yy_flex_debug = 0;
00668 
00669 /* The intent behind this definition is that it'll catch
00670  * any uses of REJECT which flex missed.
00671  */
00672 #define REJECT reject_used_but_not_detected
00673 #define yymore() yymore_used_but_not_detected
00674 #define YY_MORE_ADJ 0
00675 #define YY_RESTORE_YY_MORE_OFFSET
00676 char *yytext;
00677 #line 1 "olib.l"
00678 #line 2 "olib.l"
00679 /*  $Id$
00680 
00681     olib.lex - Orcad to gEDA lib converter
00682     Copyright (C) 2002 Mario Pascucci <m.pas@libero.it>
00683 
00684     This program is free software; you can redistribute it and/or modify
00685     it under the terms of the GNU General Public License as published by
00686     the Free Software Foundation; either version 2 of the License, or
00687     (at your option) any later version.
00688 
00689     This program is distributed in the hope that it will be useful,
00690     but WITHOUT ANY WARRANTY; without even the implied warranty of
00691     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00692     GNU General Public License for more details.
00693 
00694     You should have received a copy of the GNU General Public License
00695     along with this program; if not, write to the Free Software
00696     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00697     or
00698     visit the URL http://www.fsf.org/
00699 
00700 */
00701 
00702 #include <unistd.h>
00703 #include <stdlib.h>
00704 #include <string.h>
00705 #include <stdio.h>
00706 #include <ctype.h>
00707 #include <limits.h>
00708 #include <math.h>
00709 
00710 /* gEDA file version: change NEW version as soon as available */
00711 #define EDA_VERSION_OLD   "20020209"
00712 #define EDA_VERSION_NEW   "20020825"
00713 
00714 
00715 /* defines for flags and types */
00716 #define PIN_DOTFLAG 0x0001
00717 #define PIN_SHORTFLAG   0x0002
00718 #define PIN_CLKFLAG 0x0004
00719 
00720 #define PIN_TYPE_IO 1
00721 #define PIN_TYPE_IN 2
00722 #define PIN_TYPE_OUT    3
00723 #define PIN_TYPE_PWR    4
00724 #define PIN_TYPE_PAS    5
00725 #define PIN_TYPE_OC 6
00726 #define PIN_TYPE_HIZ    7
00727 #define PIN_TYPE_OE 8
00728 
00729 
00730 #ifndef GCC_VERSION
00731 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
00732 #endif /* GCC_VERSION */
00733 
00734 #if GCC_VERSION > 2007
00735 #define ATTRIBUTE_UNUSED __attribute__((unused)) 
00736 #else
00737 #define ATTRIBUTE_UNUSED
00738 #endif 
00739 
00740 static const ATTRIBUTE_UNUSED char *mp_name = "OrCAD to gEDA lib converter";
00741 static const ATTRIBUTE_UNUSED char *mp_license = "Copyright (c) 2002 Mario Pascucci <m.pas@libero.it>";
00742 
00743 static char fnsym[512];     /* gEDA symbol file name */
00744 static FILE *fsym;      /* FILE* to gEDA symbol file */
00745 static int aliascount = 0;    /* alias count */
00746 static char part_aliases[200][50];     /* store for aliases of part */
00747 static char sym_prefix[50]; /* prefix for .sym file */
00748 
00749 /* gEDA symbol file version */
00750 static char sym_version[10];
00751 static int use_old_version;   /* flag for old format */
00752 
00753 /* pin name options */
00754 static int pin_name_hidden;
00755 
00756 static char buff[512];
00757 
00758 static int sizex,sizey,partspp;   /* size and number of part per package */
00759 
00760 static int pincount;        /* pin definitions found until now */
00761 
00762 struct pin_def {    /* pin definition struct */
00763   char  pos;      /* position: L,T,R,B */
00764   short num;      /* number in side, 0 mean virtual pin */
00765   short pin;      /* real pin number */
00766   short flags;    /* DOT, CLK and SHORT flags */
00767   short type;     /* I/O, IN, OUT, PWR, PASS, OC */
00768   char  name[50]; /* simbolic name of pin */
00769 };
00770 
00771 
00772 /* REFERENCE handling */
00773 static char ref_str[20];
00774 
00775 
00776 /* VECTOR handling */
00777 static int vector_count;    /* number of vector found */
00778 
00779 struct vector_def {
00780   char  type;       /* line, arc, circle, box */
00781   float p[12];      /* parameters for element drawing */
00782   char *str;        /* string for "TEXT" statement */
00783 };
00784 
00785 static int paramcount;  /* vector param number count */
00786 
00787 static struct vector_def part_vectors[100];   /* draw list */
00788 
00789 static int vector_found;
00790 
00791 
00792 /* type of pin */
00793 static char *pintypestr[] = {
00794   "???",
00795   "I/O",
00796   "IN",
00797   "OUT",
00798   "PWR",
00799   "PAS",
00800   "OC",
00801   "hiZ",
00802   "OE"
00803 };
00804 
00805 
00806 static char *edapintype[] = {
00807   "???",
00808   "io",
00809   "in",
00810   "out",
00811   "pwr",
00812   "pas",
00813   "oc",
00814   "tri",
00815   "oe"
00816 };
00817 
00818 
00819  /* pin definition database */
00820 static struct pin_def pinlist[200];
00821 
00822 
00823 /* generic counter */
00824 static int ii;
00825 
00826 
00827 
00828 /* strip filename-aware chars from part name,
00829     leave only '.' '-' or '_' and changes space
00830     in '_' */
00831 char *strip_invalid(char *str)
00832 {
00833   char *p;
00834 
00835   p = buff;
00836   while (*str)
00837   {
00838     if (isalnum((int) *str) || strchr("-_. ",*str))
00839     {
00840       if (*str == ' ')
00841     *p = '_';
00842       else
00843     *p = *str;
00844       p++;
00845     }
00846     str++;
00847   }
00848   *p = 0;
00849   return buff;
00850 }
00851 
00852 
00853 /* trim leading and trailing ' in ident */
00854 char *strip_quotes(char *str)
00855 {
00856   char *p;
00857 
00858   p = buff;
00859   str++;
00860   while (*str != '\'')
00861   {
00862     *p = *str;
00863     p++;
00864     str++;
00865   }
00866   *p = 0;
00867   return buff;
00868 }
00869 
00870 
00871 
00872 /* symbol write function in gEDA .sym format */
00873 #include "geda_sym_format.h"
00874 
00875 
00876 /* decimal integer */
00877 /* floating point decimal, like 123.234 */
00878 /* string name, like 'abcd' */
00879 /* comment, like { comment } */
00880 /* pin identifier, example T3 L12 R3 .... */
00881  
00882 
00883 
00884 #line 885 "olib.c"
00885 
00886 #define INITIAL 0
00887 #define wait_END 1
00888 #define wait_sizex 2
00889 #define wait_sizey 3
00890 #define wait_parts 4
00891 #define pin_list 5
00892 #define pinrealnum 6
00893 #define pindata 7
00894 #define waitnamestart 8
00895 #define in_name 9
00896 #define waitnameend 10
00897 #define waitpinend 11
00898 #define vector_list 12
00899 #define vector_ignore 13
00900 #define param_list 14
00901 #define convert 15
00902 #define convert_ignore_pin 16
00903 #define reference 17
00904 
00905 #ifndef YY_NO_UNISTD_H
00906 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00907  * down here because we want the user's section 1 to have been scanned first.
00908  * The user has a chance to override it with an option.
00909  */
00910 #include <unistd.h>
00911 #endif
00912 
00913 #ifndef YY_EXTRA_TYPE
00914 #define YY_EXTRA_TYPE void *
00915 #endif
00916 
00917 static int yy_init_globals (void );
00918 
00919 /* Accessor methods to globals.
00920    These are made visible to non-reentrant scanners for convenience. */
00921 
00922 int yylex_destroy (void );
00923 
00924 int yyget_debug (void );
00925 
00926 void yyset_debug (int debug_flag  );
00927 
00928 YY_EXTRA_TYPE yyget_extra (void );
00929 
00930 void yyset_extra (YY_EXTRA_TYPE user_defined  );
00931 
00932 FILE *yyget_in (void );
00933 
00934 void yyset_in  (FILE * in_str  );
00935 
00936 FILE *yyget_out (void );
00937 
00938 void yyset_out  (FILE * out_str  );
00939 
00940 int yyget_leng (void );
00941 
00942 char *yyget_text (void );
00943 
00944 int yyget_lineno (void );
00945 
00946 void yyset_lineno (int line_number  );
00947 
00948 /* Macros after this point can all be overridden by user definitions in
00949  * section 1.
00950  */
00951 
00952 #ifndef YY_SKIP_YYWRAP
00953 #ifdef __cplusplus
00954 extern "C" int yywrap (void );
00955 #else
00956 extern int yywrap (void );
00957 #endif
00958 #endif
00959 
00960     static void yyunput (int c,char *buf_ptr  );
00961     
00962 #ifndef yytext_ptr
00963 static void yy_flex_strncpy (char *,yyconst char *,int );
00964 #endif
00965 
00966 #ifdef YY_NEED_STRLEN
00967 static int yy_flex_strlen (yyconst char * );
00968 #endif
00969 
00970 #ifndef YY_NO_INPUT
00971 
00972 #ifdef __cplusplus
00973 static int yyinput (void );
00974 #else
00975 static int input (void );
00976 #endif
00977 
00978 #endif
00979 
00980 /* Amount of stuff to slurp up with each read. */
00981 #ifndef YY_READ_BUF_SIZE
00982 #define YY_READ_BUF_SIZE 8192
00983 #endif
00984 
00985 /* Copy whatever the last rule matched to the standard output. */
00986 #ifndef ECHO
00987 /* This used to be an fputs(), but since the string might contain NUL's,
00988  * we now use fwrite().
00989  */
00990 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00991 #endif
00992 
00993 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00994  * is returned in "result".
00995  */
00996 #ifndef YY_INPUT
00997 #define YY_INPUT(buf,result,max_size) \
00998     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00999         { \
01000         int c = '*'; \
01001         unsigned n; \
01002         for ( n = 0; n < max_size && \
01003                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
01004             buf[n] = (char) c; \
01005         if ( c == '\n' ) \
01006             buf[n++] = (char) c; \
01007         if ( c == EOF && ferror( yyin ) ) \
01008             YY_FATAL_ERROR( "input in flex scanner failed" ); \
01009         result = n; \
01010         } \
01011     else \
01012         { \
01013         errno=0; \
01014         while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
01015             { \
01016             if( errno != EINTR) \
01017                 { \
01018                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
01019                 break; \
01020                 } \
01021             errno=0; \
01022             clearerr(yyin); \
01023             } \
01024         }\
01025 \
01026 
01027 #endif
01028 
01029 /* No semi-colon after return; correct usage is to write "yyterminate();" -
01030  * we don't want an extra ';' after the "return" because that will cause
01031  * some compilers to complain about unreachable statements.
01032  */
01033 #ifndef yyterminate
01034 #define yyterminate() return YY_NULL
01035 #endif
01036 
01037 /* Number of entries by which start-condition stack grows. */
01038 #ifndef YY_START_STACK_INCR
01039 #define YY_START_STACK_INCR 25
01040 #endif
01041 
01042 /* Report a fatal error. */
01043 #ifndef YY_FATAL_ERROR
01044 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
01045 #endif
01046 
01047 /* end tables serialization structures and prototypes */
01048 
01049 /* Default declaration of generated scanner - a define so the user can
01050  * easily add parameters.
01051  */
01052 #ifndef YY_DECL
01053 #define YY_DECL_IS_OURS 1
01054 
01055 extern int yylex (void);
01056 
01057 #define YY_DECL int yylex (void)
01058 #endif /* !YY_DECL */
01059 
01060 /* Code executed at the beginning of each rule, after yytext and yyleng
01061  * have been set up.
01062  */
01063 #ifndef YY_USER_ACTION
01064 #define YY_USER_ACTION
01065 #endif
01066 
01067 /* Code executed at the end of each rule. */
01068 #ifndef YY_BREAK
01069 #define YY_BREAK break;
01070 #endif
01071 
01072 #define YY_RULE_SETUP \
01073     if ( yyleng > 0 ) \
01074         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
01075                 (yytext[yyleng - 1] == '\n'); \
01076     YY_USER_ACTION
01077 
01080 YY_DECL
01081 {
01082     register yy_state_type yy_current_state;
01083     register char *yy_cp, *yy_bp;
01084     register int yy_act;
01085     
01086 #line 225 "olib.l"
01087 
01088 
01089 
01090   /*******************************************
01091   handling of:
01092   PREFIX
01093   'prefix1'
01094   'prefix2'
01095   ...
01096   ...
01097   END
01098   *******************************************/
01099 
01100 
01101 #line 1102 "olib.c"
01102 
01103     if ( !(yy_init) )
01104         {
01105         (yy_init) = 1;
01106 
01107 #ifdef YY_USER_INIT
01108         YY_USER_INIT;
01109 #endif
01110 
01111         if ( ! (yy_start) )
01112             (yy_start) = 1; /* first start state */
01113 
01114         if ( ! yyin )
01115             yyin = stdin;
01116 
01117         if ( ! yyout )
01118             yyout = stdout;
01119 
01120         if ( ! YY_CURRENT_BUFFER ) {
01121             yyensure_buffer_stack ();
01122             YY_CURRENT_BUFFER_LVALUE =
01123                 yy_create_buffer(yyin,YY_BUF_SIZE );
01124         }
01125 
01126         yy_load_buffer_state( );
01127         }
01128 
01129     while ( 1 )     /* loops until end-of-file is reached */
01130         {
01131         yy_cp = (yy_c_buf_p);
01132 
01133         /* Support of yytext. */
01134         *yy_cp = (yy_hold_char);
01135 
01136         /* yy_bp points to the position in yy_ch_buf of the start of
01137          * the current run.
01138          */
01139         yy_bp = yy_cp;
01140 
01141         yy_current_state = (yy_start);
01142         yy_current_state += YY_AT_BOL();
01143 yy_match:
01144         do
01145             {
01146             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
01147             if ( yy_accept[yy_current_state] )
01148                 {
01149                 (yy_last_accepting_state) = yy_current_state;
01150                 (yy_last_accepting_cpos) = yy_cp;
01151                 }
01152             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01153                 {
01154                 yy_current_state = (int) yy_def[yy_current_state];
01155                 if ( yy_current_state >= 327 )
01156                     yy_c = yy_meta[(unsigned int) yy_c];
01157                 }
01158             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01159             ++yy_cp;
01160             }
01161         while ( yy_base[yy_current_state] != 495 );
01162 
01163 yy_find_action:
01164         yy_act = yy_accept[yy_current_state];
01165         if ( yy_act == 0 )
01166             { /* have to back up */
01167             yy_cp = (yy_last_accepting_cpos);
01168             yy_current_state = (yy_last_accepting_state);
01169             yy_act = yy_accept[yy_current_state];
01170             }
01171 
01172         YY_DO_BEFORE_ACTION;
01173 
01174 do_action:  /* This label is used only to access EOF actions. */
01175 
01176         switch ( yy_act )
01177     { /* beginning of action switch */
01178             case 0: /* must back up */
01179             /* undo the effects of YY_DO_BEFORE_ACTION */
01180             *yy_cp = (yy_hold_char);
01181             yy_cp = (yy_last_accepting_cpos);
01182             yy_current_state = (yy_last_accepting_state);
01183             goto yy_find_action;
01184 
01185 case 1:
01186 YY_RULE_SETUP
01187 #line 239 "olib.l"
01188 {
01189   /* ignore comments */
01190   fprintf(stderr,"Ignore comment: %s\n",yytext);
01191  }
01192     YY_BREAK
01193 case 2:
01194 YY_RULE_SETUP
01195 #line 245 "olib.l"
01196 {
01197   /* shortcuts for parts name: ignored */
01198   fprintf(stderr,"Found PREFIX\n");
01199   BEGIN(wait_END);
01200  }
01201     YY_BREAK
01202 case 3:
01203 /* rule 3 can match eol */
01204 YY_RULE_SETUP
01205 #line 252 "olib.l"
01206 {
01207   fprintf(stderr,"Shorthand found, ignored\n");
01208   /* ignore shortcut list */
01209  }
01210     YY_BREAK
01211 case 4:
01212 YY_RULE_SETUP
01213 #line 258 "olib.l"
01214 {
01215   /* founds shortcut list end */
01216   fprintf(stderr,"Found END for shorthands\n");
01217   BEGIN(INITIAL);
01218  }
01219     YY_BREAK
01220 
01221 
01222   /*******************************************
01223   handling of:
01224   'IDENT'
01225   'IDENT'
01226   ...
01227   *******************************************/
01228 
01229 case 5:
01230 YY_RULE_SETUP
01231 #line 274 "olib.l"
01232 {
01233   /* founds first part identifier */
01234   strcpy(part_aliases[0],strip_invalid(yytext));
01235   snprintf(fnsym,511,"%s-%s-1.sym",sym_prefix,part_aliases[0]);
01236   fprintf(stderr,"New part name: %s (%s)\n",part_aliases[0],yytext);
01237   fprintf(stderr,"New .sym name: %s\n",fnsym);
01238   BEGIN(wait_sizex);
01239   aliascount = 1;
01240   pincount = 0;
01241   vector_found = 0;
01242   ref_str[0] = 'U';
01243   ref_str[1] = 0;
01244  }
01245     YY_BREAK
01246 case 6:
01247 YY_RULE_SETUP
01248 #line 289 "olib.l"
01249 {
01250   /* REFERENCE statement found */
01251   BEGIN(reference);
01252  }
01253     YY_BREAK
01254 case 7:
01255 YY_RULE_SETUP
01256 #line 295 "olib.l"
01257 {
01258   /* get an IDENT, i.e. reference id */
01259   strcpy(ref_str,strip_quotes(yytext));
01260   fprintf(stderr,"REFERENCE: %s\n",yytext);
01261   BEGIN(wait_sizex);
01262  }
01263     YY_BREAK
01264 case 8:
01265 YY_RULE_SETUP
01266 #line 303 "olib.l"
01267 {
01268   /* found an alias for the part name 
01269       store alias for future use */
01270   fprintf(stderr,"Found an alias: %s\n",yytext);
01271   strcpy(part_aliases[aliascount], strip_invalid(yytext));
01272   aliascount++;
01273  }
01274     YY_BREAK
01275 
01276   /*******************************************
01277   handling of:
01278   {X Size =} x      {Y Size =} y      {Parts per Package =} n
01279   *******************************************/
01280 
01281 case 9:
01282 YY_RULE_SETUP
01283 #line 319 "olib.l"
01284 {
01285   /* trovata la dimansione X */
01286   sizex = atoi(yytext);
01287   fprintf(stderr,"Found X size: %d (%s)\n",sizex,yytext);
01288   BEGIN(wait_sizey);
01289  }
01290     YY_BREAK
01291 case 10:
01292 YY_RULE_SETUP
01293 #line 327 "olib.l"
01294 {
01295   /* trovata la dimansione y */
01296   sizey = atoi(yytext);
01297   fprintf(stderr,"Found Y size: %d (%s)\n",sizey,yytext);
01298   BEGIN(wait_parts);
01299  }
01300     YY_BREAK
01301 case 11:
01302 YY_RULE_SETUP
01303 #line 335 "olib.l"
01304 {
01305   /* found a PGA component, unsupported */
01306   fprintf(stderr,"Found a GRIDARRAY: unsupported\n");
01307   BEGIN(INITIAL);
01308  }
01309     YY_BREAK
01310 case 12:
01311 YY_RULE_SETUP
01312 #line 342 "olib.l"
01313 {
01314   /* trovato il parts-per-package */
01315   /* per ora supportato solo 1 part-per-package */
01316   partspp = atoi(yytext);
01317   if (partspp > 1)
01318   {
01319     fprintf(stderr,"Found parts per package > 1\n");
01320     BEGIN(INITIAL);
01321   }
01322   else
01323   {
01324     fprintf(stderr,"Found parts per package: %d (%s)\n",partspp,yytext);
01325     BEGIN(pin_list);
01326     /* size of symbol body */
01327     sizex = sizex * PIN_SPACE;
01328     sizey = sizey * PIN_SPACE;
01329   }
01330  }
01331     YY_BREAK
01332 case 13:
01333 /* rule 13 can match eol */
01334 #line 363 "olib.l"
01335 case 14:
01336 /* rule 14 can match eol */
01337 #line 364 "olib.l"
01338 case 15:
01339 /* rule 15 can match eol */
01340 #line 365 "olib.l"
01341 case 16:
01342 /* rule 16 can match eol */
01343 #line 366 "olib.l"
01344 case 17:
01345 /* rule 17 can match eol */
01346 #line 367 "olib.l"
01347 case 18:
01348 /* rule 18 can match eol */
01349 #line 368 "olib.l"
01350 case 19:
01351 /* rule 19 can match eol */
01352 #line 369 "olib.l"
01353 case 20:
01354 /* rule 20 can match eol */
01355 #line 370 "olib.l"
01356 case 21:
01357 /* rule 21 can match eol */
01358 YY_RULE_SETUP
01359 #line 370 "olib.l"
01360 {
01361   /* ignored */
01362   fprintf(stderr,"Ignored: %s",yytext);
01363  }
01364     YY_BREAK
01365 
01366   /*******************************************
01367   handling of:
01368   VECTOR 'IDENT'  (unsupported)
01369   or
01370   VECTOR
01371   LINE x y x1 y1
01372   ARC x y dxs dys dxe dye r
01373   CIRCLE x y r
01374   FILL x y    (unsupported)
01375   TEXT x y size 'text'  (partially supported)
01376   END
01377   *******************************************/
01378 
01379 case 22:
01380 YY_RULE_SETUP
01381 #line 391 "olib.l"
01382 {
01383   /* components isn't a simple "box", but it's drawed */
01384   BEGIN(vector_list);
01385   vector_count = 0;
01386   vector_found = -1;
01387   fprintf(stderr,"Found: VECTOR\n");
01388  }
01389     YY_BREAK
01390 case 23:
01391 YY_RULE_SETUP
01392 #line 400 "olib.l"
01393 {
01394   /* the component shape is identical to a previous one 
01395       unsupported at the moment */
01396   BEGIN(pin_list);
01397   fprintf(stderr,"Found unsupported: VECTOR 'IDENT'\n");
01398  }
01399     YY_BREAK
01400 case 24:
01401 YY_RULE_SETUP
01402 #line 408 "olib.l"
01403 {
01404   /* found LINE vector statement */
01405   part_vectors[vector_count].type = 'L';
01406   BEGIN(param_list);
01407   paramcount = 0;
01408   fprintf(stderr,"Found: LINE params:");
01409  }
01410     YY_BREAK
01411 case 25:
01412 YY_RULE_SETUP
01413 #line 417 "olib.l"
01414 {
01415   /* found CIRCLE vector statement */
01416   part_vectors[vector_count].type = 'V';
01417   BEGIN(param_list);
01418   paramcount = 0;
01419   fprintf(stderr,"Found: CIRCLE params:");
01420  }
01421     YY_BREAK
01422 case 26:
01423 YY_RULE_SETUP
01424 #line 426 "olib.l"
01425 {
01426   /* found ARC vector statement */
01427   part_vectors[vector_count].type = 'A';
01428   BEGIN(param_list);
01429   paramcount = 0;
01430   fprintf(stderr,"Found: ARC params:");
01431  }
01432     YY_BREAK
01433 case 27:
01434 YY_RULE_SETUP
01435 #line 435 "olib.l"
01436 {
01437   /* found FILL vector statement */
01438   /* no counterpart in gEDA */
01439   part_vectors[vector_count].type = 'f';
01440   BEGIN(param_list);
01441   paramcount = 0;
01442   fprintf(stderr,"Found unsupported: FILL params:");
01443  }
01444     YY_BREAK
01445 case 28:
01446 YY_RULE_SETUP
01447 #line 445 "olib.l"
01448 {
01449   /* found ARC vector statement */
01450   part_vectors[vector_count].type = 'T';
01451   BEGIN(param_list);
01452   paramcount = 0;
01453   fprintf(stderr,"Found: TEXT params:");
01454  }
01455     YY_BREAK
01456 case 29:
01457 YY_RULE_SETUP
01458 #line 454 "olib.l"
01459 {
01460   /* found a param */
01461   part_vectors[vector_count].p[paramcount] = (float) atof(yytext);
01462   paramcount++;
01463   BEGIN(param_list);
01464   fprintf(stderr," %s",yytext);
01465  }
01466     YY_BREAK
01467 case 30:
01468 YY_RULE_SETUP
01469 #line 463 "olib.l"
01470 {
01471   /* found a param */
01472   part_vectors[vector_count].p[paramcount] = (float) atof(yytext);
01473   paramcount++;
01474   BEGIN(param_list);
01475   fprintf(stderr," %s",yytext);
01476  }
01477     YY_BREAK
01478 case 31:
01479 YY_RULE_SETUP
01480 #line 472 "olib.l"
01481 {
01482   /* found a string */
01483   if (part_vectors[vector_count].type == 'T')
01484     part_vectors[vector_count].str = strdup(strip_quotes(yytext));
01485   else
01486     fprintf(stderr,"Text param found in non text VECTOR instr: %s\n",yytext);
01487   paramcount++;
01488   BEGIN(param_list);
01489   fprintf(stderr," %s",yytext);
01490  }
01491     YY_BREAK
01492 case 32:
01493 /* rule 32 can match eol */
01494 YY_RULE_SETUP
01495 #line 484 "olib.l"
01496 {
01497   /* end of params */
01498   fprintf(stderr,"\n");
01499   switch (part_vectors[vector_count].type)
01500   {
01501     case 'L':
01502       /* line */
01503       if (paramcount != 4)
01504       {
01505     fprintf(stderr,"LINE: wrong parameters number: %d\n",paramcount);
01506     BEGIN(vector_list);
01507       }
01508       break;
01509     case 'V':
01510       /* circle */
01511       if (paramcount != 3)
01512       {
01513     fprintf(stderr,"CIRCLE: wrong parameters number: %d\n",paramcount);
01514     BEGIN(vector_list);
01515       }
01516       break;
01517     case 'A':
01518       /* arc */
01519       if (paramcount != 7)
01520       {
01521     fprintf(stderr,"ARC: wrong parameters number: %d\n",paramcount);
01522     BEGIN(vector_list);
01523       }
01524       break;
01525     case 'f':
01526       /* fill (ignored) */
01527       if (paramcount != 2)
01528       {
01529     fprintf(stderr,"FILL: wrong parameters number: %d\n",paramcount);
01530     BEGIN(vector_list);
01531       }
01532       break;
01533     case 'T':
01534       /* text */
01535       if (paramcount != 4)
01536       {
01537     fprintf(stderr,"TEXT: wrong parameters number: %d\n",paramcount);
01538     BEGIN(vector_list);
01539       }
01540       break;
01541   }
01542   vector_count++;
01543   BEGIN(vector_list);
01544  }
01545     YY_BREAK
01546 case 33:
01547 YY_RULE_SETUP
01548 #line 535 "olib.l"
01549 {
01550   /* end of vector list */
01551   BEGIN(pin_list);
01552   fprintf(stderr,"Found: END of VECTOR list\n");
01553  }
01554     YY_BREAK
01555 
01556   /*******************************************
01557   handling of:
01558   CONVERT 'IDENT'
01559   or
01560   CONVERT
01561   pin_def
01562   pin_def
01563   ...
01564   *******************************************/
01565 
01566 case 34:
01567 YY_RULE_SETUP
01568 #line 554 "olib.l"
01569 {
01570   /* alternate part drawing */
01571   /* unsupported */
01572   BEGIN(convert);
01573  }
01574     YY_BREAK
01575 case 35:
01576 YY_RULE_SETUP
01577 #line 561 "olib.l"
01578 {
01579   /* CONVERT 'part' unsupported */
01580   BEGIN(pin_list);
01581  }
01582     YY_BREAK
01583 case 36:
01584 YY_RULE_SETUP
01585 #line 567 "olib.l"
01586 {
01587   /* ignore PIN list in CONVERT */
01588   BEGIN(convert_ignore_pin);
01589  }
01590     YY_BREAK
01591 case 37:
01592 /* rule 37 can match eol */
01593 YY_RULE_SETUP
01594 #line 573 "olib.l"
01595 {
01596   /* ignore line */
01597   BEGIN(convert);
01598  }
01599     YY_BREAK
01600 case 38:
01601 YY_RULE_SETUP
01602 #line 579 "olib.l"
01603 {
01604   /* found VECTOR list in CONVERT */
01605   if (vector_found)
01606     BEGIN(vector_ignore);
01607   else
01608   {
01609     BEGIN(vector_list);
01610     vector_count = 0;
01611     vector_found = -1;
01612   }
01613  }
01614     YY_BREAK
01615 case 39:
01616 /* rule 39 can match eol */
01617 YY_RULE_SETUP
01618 #line 592 "olib.l"
01619 {
01620   /* end of ignore */
01621   BEGIN(pin_list);
01622  }
01623     YY_BREAK
01624 case 40:
01625 /* rule 40 can match eol */
01626 #line 597 "olib.l"
01627 case 41:
01628 /* rule 41 can match eol */
01629 #line 598 "olib.l"
01630 case 42:
01631 /* rule 42 can match eol */
01632 #line 599 "olib.l"
01633 case 43:
01634 /* rule 43 can match eol */
01635 #line 600 "olib.l"
01636 case 44:
01637 /* rule 44 can match eol */
01638 #line 601 "olib.l"
01639 case 45:
01640 /* rule 45 can match eol */
01641 #line 602 "olib.l"
01642 case 46:
01643 /* rule 46 can match eol */
01644 YY_RULE_SETUP
01645 #line 602 "olib.l"
01646 {
01647   /* ignored */
01648   fprintf(stderr,"Ignored VECTOR: %s",yytext);
01649  }
01650     YY_BREAK
01651 
01652   /*******************************************
01653   handling of:
01654   pin_def
01655   pin_def
01656   ...
01657   *******************************************/
01658 
01659 case 47:
01660 YY_RULE_SETUP
01661 #line 617 "olib.l"
01662 {
01663   /* trovato un pin */
01664   pinlist[pincount].pos = yytext[0];    /* pin side */
01665   pinlist[pincount].num = atoi(yytext+1);   /* gets pin number */
01666   pinlist[pincount].flags = 0;
01667   pinlist[pincount].type = 0;
01668   fprintf(stderr,"Found pin ID: %c-%d (%s)\n",pinlist[pincount].pos,pinlist[pincount].num,yytext);
01669   if (partspp == 0)   /* handling of parts without pin number */
01670   {
01671     /* assign number to a unnumbered pin from the pin count */
01672     pinlist[pincount].pin = pincount + 1;
01673     BEGIN(pindata);
01674   }
01675   else
01676     BEGIN(pinrealnum);
01677  }
01678     YY_BREAK
01679 case 48:
01680 YY_RULE_SETUP
01681 #line 635 "olib.l"
01682 {
01683   /* found a part name after pinlist, this mean that part definition ends,
01684       and starts a new part definition */
01685   fprintf(stderr,"Writing down new symbol: %s pin: %d  vectors: %d\n",part_aliases[0],pincount,vector_count);
01686   write_sym();      /* write the .sym gEDA symbol definition */
01687   /* restore initial condition */
01688   ref_str[0] = 'U';
01689   ref_str[1] = 0;
01690   pincount = 0;
01691   aliascount = 1;
01692   vector_found = 0;
01693   vector_count = 0;
01694   strcpy(part_aliases[0],strip_invalid(yytext));
01695   snprintf(fnsym,511,"%s-%s-1.sym",sym_prefix,part_aliases[0]);
01696   fprintf(stderr,"New part name: %s (%s)\n",part_aliases[0],yytext);
01697   fprintf(stderr,"New .sym name: %s\n",fnsym);
01698   BEGIN(wait_sizex);
01699  }
01700     YY_BREAK
01701 case 49:
01702 YY_RULE_SETUP
01703 #line 656 "olib.l"
01704 {
01705   /* reads real pin number */
01706   pinlist[pincount].pin = atoi(yytext);
01707   fprintf(stderr,"Found pin num: %d (%s)\n",pinlist[pincount].pin,yytext);
01708   BEGIN(pindata);
01709  }
01710     YY_BREAK
01711 case 50:
01712 YY_RULE_SETUP
01713 #line 664 "olib.l"
01714 {
01715   /* DOT flag found, boolean negate */
01716   pinlist[pincount].flags |= PIN_DOTFLAG;
01717   fprintf(stderr,"Found DOT flag\n");
01718  }
01719     YY_BREAK
01720 case 51:
01721 YY_RULE_SETUP
01722 #line 671 "olib.l"
01723 {
01724   /* CLK flag found, clock input */
01725   pinlist[pincount].flags |= PIN_CLKFLAG;
01726   fprintf(stderr,"Found CLK flag\n");
01727  }
01728     YY_BREAK
01729 case 52:
01730 YY_RULE_SETUP
01731 #line 678 "olib.l"
01732 {
01733   /* SHORT flag found, short terminal */
01734   pinlist[pincount].flags |= PIN_SHORTFLAG;
01735   fprintf(stderr,"Found SHORT flag\n");
01736  }
01737     YY_BREAK
01738 case 53:
01739 YY_RULE_SETUP
01740 #line 685 "olib.l"
01741 {
01742   /* pin type IN */
01743   pinlist[pincount].type = PIN_TYPE_IN;
01744   BEGIN(waitnamestart);
01745   fprintf(stderr,"Pin type IN\n");
01746  }
01747     YY_BREAK
01748 case 54:
01749 YY_RULE_SETUP
01750 #line 693 "olib.l"
01751 {
01752   /* pin type OUT */
01753   pinlist[pincount].type = PIN_TYPE_OUT;
01754   BEGIN(waitnamestart);
01755   fprintf(stderr,"Pin type OUT\n");
01756  }
01757     YY_BREAK
01758 case 55:
01759 YY_RULE_SETUP
01760 #line 701 "olib.l"
01761 {
01762   /* pin type PWR */
01763   pinlist[pincount].type = PIN_TYPE_PWR;
01764   BEGIN(waitnamestart);
01765   fprintf(stderr,"Pin type PWR\n");
01766  }
01767     YY_BREAK
01768 case 56:
01769 YY_RULE_SETUP
01770 #line 709 "olib.l"
01771 {
01772   /* pin type OC */
01773   pinlist[pincount].type = PIN_TYPE_OC;
01774   BEGIN(waitnamestart);
01775   fprintf(stderr,"Pin type OC\n");
01776  }
01777     YY_BREAK
01778 case 57:
01779 YY_RULE_SETUP
01780 #line 717 "olib.l"
01781 {
01782   /* pin type OE */
01783   pinlist[pincount].type = PIN_TYPE_OE;
01784   BEGIN(waitnamestart);
01785   fprintf(stderr,"Pin type OE\n");
01786  }
01787     YY_BREAK
01788 case 58:
01789 YY_RULE_SETUP
01790 #line 725 "olib.l"
01791 {
01792   /* pin type PAS */
01793   pinlist[pincount].type = PIN_TYPE_PAS;
01794   BEGIN(waitnamestart);
01795   fprintf(stderr,"Pin type PAS\n");
01796  }
01797     YY_BREAK
01798 case 59:
01799 YY_RULE_SETUP
01800 #line 733 "olib.l"
01801 {
01802   /* pin type hiZ */
01803   pinlist[pincount].type = PIN_TYPE_HIZ;
01804   BEGIN(waitnamestart);
01805   fprintf(stderr,"Pin type hiZ\n");
01806  }
01807     YY_BREAK
01808 case 60:
01809 YY_RULE_SETUP
01810 #line 741 "olib.l"
01811 {
01812   /* pin type I/O */
01813   pinlist[pincount].type = PIN_TYPE_IO;
01814   BEGIN(waitnamestart);
01815   fprintf(stderr,"Pin type I/O\n");
01816  }
01817     YY_BREAK
01818 case 61:
01819 YY_RULE_SETUP
01820 #line 749 "olib.l"
01821 {
01822   /* found initial quote */
01823   ii = 0;
01824   BEGIN(in_name);
01825  }
01826     YY_BREAK
01827 case 62:
01828 YY_RULE_SETUP
01829 #line 756 "olib.l"
01830 {
01831   /* found a ' in pin name */
01832   pinlist[pincount].name[ii++] = '\'';
01833  }
01834     YY_BREAK
01835 case 63:
01836 YY_RULE_SETUP
01837 #line 762 "olib.l"
01838 {
01839   /* get a char from the pin symbolic name */
01840   pinlist[pincount].name[ii++] = *yytext;
01841  }
01842     YY_BREAK
01843 case 64:
01844 YY_RULE_SETUP
01845 #line 768 "olib.l"
01846 {
01847   /* all ok, waiting for new pin definition */
01848   pinlist[pincount].name[ii] = 0;
01849   fprintf(stderr,"Pin label: %s\n",pinlist[pincount].name);
01850   BEGIN(waitpinend);
01851  }
01852     YY_BREAK
01853 case 65:
01854 /* rule 65 can match eol */
01855 YY_RULE_SETUP
01856 #line 776 "olib.l"
01857 {
01858   /* ok, found a newline, pin definition ends */
01859   fprintf(stderr,"Pin: %c%d %d %x %s %s\n",pinlist[pincount].pos,pinlist[pincount].num,
01860     pinlist[pincount].pin, pinlist[pincount].flags, pintypestr[pinlist[pincount].type],
01861     pinlist[pincount].name);
01862   pincount++;
01863   BEGIN(pin_list);
01864  }
01865     YY_BREAK
01866 
01867   /* 
01868    * we don't need to use <*> to match any state, we just don't
01869    * specify a state
01870    */
01871 
01872 case 66:
01873 /* rule 66 can match eol */
01874 YY_RULE_SETUP
01875 #line 793 "olib.l"
01876 { /* empty lines ignored */ }
01877     YY_BREAK
01878 case 67:
01879 /* rule 67 can match eol */
01880 YY_RULE_SETUP
01881 #line 796 "olib.l"
01882 { /* ignored, the \r char is for "DOS" ASCII files */ }
01883     YY_BREAK
01884 case 68:
01885 YY_RULE_SETUP
01886 #line 802 "olib.l"
01887 ECHO;
01888     YY_BREAK
01889 #line 1890 "olib.c"
01890 case YY_STATE_EOF(INITIAL):
01891 case YY_STATE_EOF(wait_END):
01892 case YY_STATE_EOF(wait_sizex):
01893 case YY_STATE_EOF(wait_sizey):
01894 case YY_STATE_EOF(wait_parts):
01895 case YY_STATE_EOF(pin_list):
01896 case YY_STATE_EOF(pinrealnum):
01897 case YY_STATE_EOF(pindata):
01898 case YY_STATE_EOF(waitnamestart):
01899 case YY_STATE_EOF(in_name):
01900 case YY_STATE_EOF(waitnameend):
01901 case YY_STATE_EOF(waitpinend):
01902 case YY_STATE_EOF(vector_list):
01903 case YY_STATE_EOF(vector_ignore):
01904 case YY_STATE_EOF(param_list):
01905 case YY_STATE_EOF(convert):
01906 case YY_STATE_EOF(convert_ignore_pin):
01907 case YY_STATE_EOF(reference):
01908     yyterminate();
01909 
01910     case YY_END_OF_BUFFER:
01911         {
01912         /* Amount of text matched not including the EOB char. */
01913         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
01914 
01915         /* Undo the effects of YY_DO_BEFORE_ACTION. */
01916         *yy_cp = (yy_hold_char);
01917         YY_RESTORE_YY_MORE_OFFSET
01918 
01919         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01920             {
01921             /* We're scanning a new file or input source.  It's
01922              * possible that this happened because the user
01923              * just pointed yyin at a new source and called
01924              * yylex().  If so, then we have to assure
01925              * consistency between YY_CURRENT_BUFFER and our
01926              * globals.  Here is the right place to do so, because
01927              * this is the first action (other than possibly a
01928              * back-up) that will match for the new input source.
01929              */
01930             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01931             YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01932             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01933             }
01934 
01935         /* Note that here we test for yy_c_buf_p "<=" to the position
01936          * of the first EOB in the buffer, since yy_c_buf_p will
01937          * already have been incremented past the NUL character
01938          * (since all states make transitions on EOB to the
01939          * end-of-buffer state).  Contrast this with the test
01940          * in input().
01941          */
01942         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01943             { /* This was really a NUL. */
01944             yy_state_type yy_next_state;
01945 
01946             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
01947 
01948             yy_current_state = yy_get_previous_state(  );
01949 
01950             /* Okay, we're now positioned to make the NUL
01951              * transition.  We couldn't have
01952              * yy_get_previous_state() go ahead and do it
01953              * for us because it doesn't know how to deal
01954              * with the possibility of jamming (and we don't
01955              * want to build jamming into it because then it
01956              * will run more slowly).
01957              */
01958 
01959             yy_next_state = yy_try_NUL_trans( yy_current_state );
01960 
01961             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01962 
01963             if ( yy_next_state )
01964                 {
01965                 /* Consume the NUL. */
01966                 yy_cp = ++(yy_c_buf_p);
01967                 yy_current_state = yy_next_state;
01968                 goto yy_match;
01969                 }
01970 
01971             else
01972                 {
01973                 yy_cp = (yy_c_buf_p);
01974                 goto yy_find_action;
01975                 }
01976             }
01977 
01978         else switch ( yy_get_next_buffer(  ) )
01979             {
01980             case EOB_ACT_END_OF_FILE:
01981                 {
01982                 (yy_did_buffer_switch_on_eof) = 0;
01983 
01984                 if ( yywrap( ) )
01985                     {
01986                     /* Note: because we've taken care in
01987                      * yy_get_next_buffer() to have set up
01988                      * yytext, we can now set up
01989                      * yy_c_buf_p so that if some total
01990                      * hoser (like flex itself) wants to
01991                      * call the scanner after we return the
01992                      * YY_NULL, it'll still work - another
01993                      * YY_NULL will get returned.
01994                      */
01995                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
01996 
01997                     yy_act = YY_STATE_EOF(YY_START);
01998                     goto do_action;
01999                     }
02000 
02001                 else
02002                     {
02003                     if ( ! (yy_did_buffer_switch_on_eof) )
02004                         YY_NEW_FILE;
02005                     }
02006                 break;
02007                 }
02008 
02009             case EOB_ACT_CONTINUE_SCAN:
02010                 (yy_c_buf_p) =
02011                     (yytext_ptr) + yy_amount_of_matched_text;
02012 
02013                 yy_current_state = yy_get_previous_state(  );
02014 
02015                 yy_cp = (yy_c_buf_p);
02016                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
02017                 goto yy_match;
02018 
02019             case EOB_ACT_LAST_MATCH:
02020                 (yy_c_buf_p) =
02021                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
02022 
02023                 yy_current_state = yy_get_previous_state(  );
02024 
02025                 yy_cp = (yy_c_buf_p);
02026                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
02027                 goto yy_find_action;
02028             }
02029         break;
02030         }
02031 
02032     default:
02033         YY_FATAL_ERROR(
02034             "fatal flex scanner internal error--no action found" );
02035     } /* end of action switch */
02036         } /* end of scanning one token */
02037 } /* end of yylex */
02038 
02039 /* yy_get_next_buffer - try to read in a new buffer
02040  *
02041  * Returns a code representing an action:
02042  *  EOB_ACT_LAST_MATCH -
02043  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
02044  *  EOB_ACT_END_OF_FILE - end of file
02045  */
02046 static int yy_get_next_buffer (void)
02047 {
02048         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
02049     register char *source = (yytext_ptr);
02050     register int number_to_move, i;
02051     int ret_val;
02052 
02053     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
02054         YY_FATAL_ERROR(
02055         "fatal flex scanner internal error--end of buffer missed" );
02056 
02057     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
02058         { /* Don't try to fill the buffer, so this is an EOF. */
02059         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
02060             {
02061             /* We matched a single character, the EOB, so
02062              * treat this as a final EOF.
02063              */
02064             return EOB_ACT_END_OF_FILE;
02065             }
02066 
02067         else
02068             {
02069             /* We matched some text prior to the EOB, first
02070              * process it.
02071              */
02072             return EOB_ACT_LAST_MATCH;
02073             }
02074         }
02075 
02076     /* Try to read more data. */
02077 
02078     /* First move last chars to start of buffer. */
02079     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
02080 
02081     for ( i = 0; i < number_to_move; ++i )
02082         *(dest++) = *(source++);
02083 
02084     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
02085         /* don't do the read, it's not guaranteed to return an EOF,
02086          * just force an EOF
02087          */
02088         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
02089 
02090     else
02091         {
02092             int num_to_read =
02093             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
02094 
02095         while ( num_to_read <= 0 )
02096             { /* Not enough room in the buffer - grow it. */
02097 
02098             /* just a shorter name for the current buffer */
02099             YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
02100 
02101             int yy_c_buf_p_offset =
02102                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
02103 
02104             if ( b->yy_is_our_buffer )
02105                 {
02106                 int new_size = b->yy_buf_size * 2;
02107 
02108                 if ( new_size <= 0 )
02109                     b->yy_buf_size += b->yy_buf_size / 8;
02110                 else
02111                     b->yy_buf_size *= 2;
02112 
02113                 b->yy_ch_buf = (char *)
02114                     /* Include room in for 2 EOB chars. */
02115                     yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
02116                 }
02117             else
02118                 /* Can't grow it, we don't own it. */
02119                 b->yy_ch_buf = 0;
02120 
02121             if ( ! b->yy_ch_buf )
02122                 YY_FATAL_ERROR(
02123                 "fatal error - scanner input buffer overflow" );
02124 
02125             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
02126 
02127             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
02128                         number_to_move - 1;
02129 
02130             }
02131 
02132         if ( num_to_read > YY_READ_BUF_SIZE )
02133             num_to_read = YY_READ_BUF_SIZE;
02134 
02135         /* Read in more data. */
02136         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
02137             (yy_n_chars), (size_t) num_to_read );
02138 
02139         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
02140         }
02141 
02142     if ( (yy_n_chars) == 0 )
02143         {
02144         if ( number_to_move == YY_MORE_ADJ )
02145             {
02146             ret_val = EOB_ACT_END_OF_FILE;
02147             yyrestart(yyin  );
02148             }
02149 
02150         else
02151             {
02152             ret_val = EOB_ACT_LAST_MATCH;
02153             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
02154                 YY_BUFFER_EOF_PENDING;
02155             }
02156         }
02157 
02158     else
02159         ret_val = EOB_ACT_CONTINUE_SCAN;
02160 
02161     if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
02162         /* Extend the array by 50%, plus the number we really need. */
02163         yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
02164         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
02165         if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
02166             YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
02167     }
02168 
02169     (yy_n_chars) += number_to_move;
02170     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
02171     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
02172 
02173     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
02174 
02175     return ret_val;
02176 }
02177 
02178 /* yy_get_previous_state - get the state just before the EOB char was reached */
02179 
02180     static yy_state_type yy_get_previous_state (void)
02181 {
02182     register yy_state_type yy_current_state;
02183     register char *yy_cp;
02184     
02185     yy_current_state = (yy_start);
02186     yy_current_state += YY_AT_BOL();
02187 
02188     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
02189         {
02190         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
02191         if ( yy_accept[yy_current_state] )
02192             {
02193             (yy_last_accepting_state) = yy_current_state;
02194             (yy_last_accepting_cpos) = yy_cp;
02195             }
02196         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
02197             {
02198             yy_current_state = (int) yy_def[yy_current_state];
02199             if ( yy_current_state >= 327 )
02200                 yy_c = yy_meta[(unsigned int) yy_c];
02201             }
02202         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
02203         }
02204 
02205     return yy_current_state;
02206 }
02207 
02208 /* yy_try_NUL_trans - try to make a transition on the NUL character
02209  *
02210  * synopsis
02211  *  next_state = yy_try_NUL_trans( current_state );
02212  */
02213     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
02214 {
02215     register int yy_is_jam;
02216         register char *yy_cp = (yy_c_buf_p);
02217 
02218     register YY_CHAR yy_c = 1;
02219     if ( yy_accept[yy_current_state] )
02220         {
02221         (yy_last_accepting_state) = yy_current_state;
02222         (yy_last_accepting_cpos) = yy_cp;
02223         }
02224     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
02225         {
02226         yy_current_state = (int) yy_def[yy_current_state];
02227         if ( yy_current_state >= 327 )
02228             yy_c = yy_meta[(unsigned int) yy_c];
02229         }
02230     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
02231     yy_is_jam = (yy_current_state == 326);
02232 
02233     return yy_is_jam ? 0 : yy_current_state;
02234 }
02235 
02236     static void yyunput (int c, register char * yy_bp )
02237 {
02238     register char *yy_cp;
02239     
02240     yy_cp = (yy_c_buf_p);
02241 
02242     /* undo effects of setting up yytext */
02243     *yy_cp = (yy_hold_char);
02244 
02245     if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
02246         { /* need to shift things up to make room */
02247         /* +2 for EOB chars. */
02248         register int number_to_move = (yy_n_chars) + 2;
02249         register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
02250                     YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
02251         register char *source =
02252                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
02253 
02254         while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
02255             *--dest = *--source;
02256 
02257         yy_cp += (int) (dest - source);
02258         yy_bp += (int) (dest - source);
02259         YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
02260             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
02261 
02262         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
02263             YY_FATAL_ERROR( "flex scanner push-back overflow" );
02264         }
02265 
02266     *--yy_cp = (char) c;
02267 
02268     (yytext_ptr) = yy_bp;
02269     (yy_hold_char) = *yy_cp;
02270     (yy_c_buf_p) = yy_cp;
02271 }
02272 
02273 #ifndef YY_NO_INPUT
02274 #ifdef __cplusplus
02275     static int yyinput (void)
02276 #else
02277     static int input  (void)
02278 #endif
02279 
02280 {
02281     int c;
02282     
02283     *(yy_c_buf_p) = (yy_hold_char);
02284 
02285     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
02286         {
02287         /* yy_c_buf_p now points to the character we want to return.
02288          * If this occurs *before* the EOB characters, then it's a
02289          * valid NUL; if not, then we've hit the end of the buffer.
02290          */
02291         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
02292             /* This was really a NUL. */
02293             *(yy_c_buf_p) = '\0';
02294 
02295         else
02296             { /* need more input */
02297             int offset = (yy_c_buf_p) - (yytext_ptr);
02298             ++(yy_c_buf_p);
02299 
02300             switch ( yy_get_next_buffer(  ) )
02301                 {
02302                 case EOB_ACT_LAST_MATCH:
02303                     /* This happens because yy_g_n_b()
02304                      * sees that we've accumulated a
02305                      * token and flags that we need to
02306                      * try matching the token before
02307                      * proceeding.  But for input(),
02308                      * there's no matching to consider.
02309                      * So convert the EOB_ACT_LAST_MATCH
02310                      * to EOB_ACT_END_OF_FILE.
02311                      */
02312 
02313                     /* Reset buffer status. */
02314                     yyrestart(yyin );
02315 
02316                     /*FALLTHROUGH*/
02317 
02318                 case EOB_ACT_END_OF_FILE:
02319                     {
02320                     if ( yywrap( ) )
02321                         return EOF;
02322 
02323                     if ( ! (yy_did_buffer_switch_on_eof) )
02324                         YY_NEW_FILE;
02325 #ifdef __cplusplus
02326                     return yyinput();
02327 #else
02328                     return input();
02329 #endif
02330                     }
02331 
02332                 case EOB_ACT_CONTINUE_SCAN:
02333                     (yy_c_buf_p) = (yytext_ptr) + offset;
02334                     break;
02335                 }
02336             }
02337         }
02338 
02339     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
02340     *(yy_c_buf_p) = '\0';   /* preserve yytext */
02341     (yy_hold_char) = *++(yy_c_buf_p);
02342 
02343     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
02344 
02345     return c;
02346 }
02347 #endif  /* ifndef YY_NO_INPUT */
02348 
02354     void yyrestart  (FILE * input_file )
02355 {
02356     
02357     if ( ! YY_CURRENT_BUFFER ){
02358         yyensure_buffer_stack ();
02359         YY_CURRENT_BUFFER_LVALUE =
02360             yy_create_buffer(yyin,YY_BUF_SIZE );
02361     }
02362 
02363     yy_init_buffer(YY_CURRENT_BUFFER,input_file );
02364     yy_load_buffer_state( );
02365 }
02366 
02371     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
02372 {
02373     
02374     /* TODO. We should be able to replace this entire function body
02375      * with
02376      *      yypop_buffer_state();
02377      *      yypush_buffer_state(new_buffer);
02378      */
02379     yyensure_buffer_stack ();
02380     if ( YY_CURRENT_BUFFER == new_buffer )
02381         return;
02382 
02383     if ( YY_CURRENT_BUFFER )
02384         {
02385         /* Flush out information for old buffer. */
02386         *(yy_c_buf_p) = (yy_hold_char);
02387         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
02388         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
02389         }
02390 
02391     YY_CURRENT_BUFFER_LVALUE = new_buffer;
02392     yy_load_buffer_state( );
02393 
02394     /* We don't actually know whether we did this switch during
02395      * EOF (yywrap()) processing, but the only time this flag
02396      * is looked at is after yywrap() is called, so it's safe
02397      * to go ahead and always set it.
02398      */
02399     (yy_did_buffer_switch_on_eof) = 1;
02400 }
02401 
02402 static void yy_load_buffer_state  (void)
02403 {
02404         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
02405     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
02406     yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
02407     (yy_hold_char) = *(yy_c_buf_p);
02408 }
02409 
02416     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
02417 {
02418     YY_BUFFER_STATE b;
02419     
02420     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
02421     if ( ! b )
02422         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
02423 
02424     b->yy_buf_size = size;
02425 
02426     /* yy_ch_buf has to be 2 characters longer than the size given because
02427      * we need to put in 2 end-of-buffer characters.
02428      */
02429     b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
02430     if ( ! b->yy_ch_buf )
02431         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
02432 
02433     b->yy_is_our_buffer = 1;
02434 
02435     yy_init_buffer(b,file );
02436 
02437     return b;
02438 }
02439 
02444     void yy_delete_buffer (YY_BUFFER_STATE  b )
02445 {
02446     
02447     if ( ! b )
02448         return;
02449 
02450     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
02451         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
02452 
02453     if ( b->yy_is_our_buffer )
02454         yyfree((void *) b->yy_ch_buf  );
02455 
02456     yyfree((void *) b  );
02457 }
02458 
02459 #ifndef __cplusplus
02460 extern int isatty (int );
02461 #endif /* __cplusplus */
02462     
02463 /* Initializes or reinitializes a buffer.
02464  * This function is sometimes called more than once on the same buffer,
02465  * such as during a yyrestart() or at EOF.
02466  */
02467     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
02468 
02469 {
02470     int oerrno = errno;
02471     
02472     yy_flush_buffer(b );
02473 
02474     b->yy_input_file = file;
02475     b->yy_fill_buffer = 1;
02476 
02477     /* If b is the current buffer, then yy_init_buffer was _probably_
02478      * called from yyrestart() or through yy_get_next_buffer.
02479      * In that case, we don't want to reset the lineno or column.
02480      */
02481     if (b != YY_CURRENT_BUFFER){
02482         b->yy_bs_lineno = 1;
02483         b->yy_bs_column = 0;
02484     }
02485 
02486         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
02487     
02488     errno = oerrno;
02489 }
02490 
02495     void yy_flush_buffer (YY_BUFFER_STATE  b )
02496 {
02497         if ( ! b )
02498         return;
02499 
02500     b->yy_n_chars = 0;
02501 
02502     /* We always need two end-of-buffer characters.  The first causes
02503      * a transition to the end-of-buffer state.  The second causes
02504      * a jam in that state.
02505      */
02506     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
02507     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
02508 
02509     b->yy_buf_pos = &b->yy_ch_buf[0];
02510 
02511     b->yy_at_bol = 1;
02512     b->yy_buffer_status = YY_BUFFER_NEW;
02513 
02514     if ( b == YY_CURRENT_BUFFER )
02515         yy_load_buffer_state( );
02516 }
02517 
02524 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
02525 {
02526         if (new_buffer == NULL)
02527         return;
02528 
02529     yyensure_buffer_stack();
02530 
02531     /* This block is copied from yy_switch_to_buffer. */
02532     if ( YY_CURRENT_BUFFER )
02533         {
02534         /* Flush out information for old buffer. */
02535         *(yy_c_buf_p) = (yy_hold_char);
02536         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
02537         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
02538         }
02539 
02540     /* Only push if top exists. Otherwise, replace top. */
02541     if (YY_CURRENT_BUFFER)
02542         (yy_buffer_stack_top)++;
02543     YY_CURRENT_BUFFER_LVALUE = new_buffer;
02544 
02545     /* copied from yy_switch_to_buffer. */
02546     yy_load_buffer_state( );
02547     (yy_did_buffer_switch_on_eof) = 1;
02548 }
02549 
02554 void yypop_buffer_state (void)
02555 {
02556         if (!YY_CURRENT_BUFFER)
02557         return;
02558 
02559     yy_delete_buffer(YY_CURRENT_BUFFER );
02560     YY_CURRENT_BUFFER_LVALUE = NULL;
02561     if ((yy_buffer_stack_top) > 0)
02562         --(yy_buffer_stack_top);
02563 
02564     if (YY_CURRENT_BUFFER) {
02565         yy_load_buffer_state( );
02566         (yy_did_buffer_switch_on_eof) = 1;
02567     }
02568 }
02569 
02570 /* Allocates the stack if it does not exist.
02571  *  Guarantees space for at least one push.
02572  */
02573 static void yyensure_buffer_stack (void)
02574 {
02575     int num_to_alloc;
02576     
02577     if (!(yy_buffer_stack)) {
02578 
02579         /* First allocation is just for 2 elements, since we don't know if this
02580          * scanner will even need a stack. We use 2 instead of 1 to avoid an
02581          * immediate realloc on the next call.
02582          */
02583         num_to_alloc = 1;
02584         (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
02585                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
02586                                 );
02587         if ( ! (yy_buffer_stack) )
02588             YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
02589                                   
02590         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
02591                 
02592         (yy_buffer_stack_max) = num_to_alloc;
02593         (yy_buffer_stack_top) = 0;
02594         return;
02595     }
02596 
02597     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
02598 
02599         /* Increase the buffer to prepare for a possible push. */
02600         int grow_size = 8 /* arbitrary grow size */;
02601 
02602         num_to_alloc = (yy_buffer_stack_max) + grow_size;
02603         (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
02604                                 ((yy_buffer_stack),
02605                                 num_to_alloc * sizeof(struct yy_buffer_state*)
02606                                 );
02607         if ( ! (yy_buffer_stack) )
02608             YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
02609 
02610         /* zero only the new slots.*/
02611         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
02612         (yy_buffer_stack_max) = num_to_alloc;
02613     }
02614 }
02615 
02622 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
02623 {
02624     YY_BUFFER_STATE b;
02625     
02626     if ( size < 2 ||
02627          base[size-2] != YY_END_OF_BUFFER_CHAR ||
02628          base[size-1] != YY_END_OF_BUFFER_CHAR )
02629         /* They forgot to leave room for the EOB's. */
02630         return 0;
02631 
02632     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
02633     if ( ! b )
02634         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
02635 
02636     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
02637     b->yy_buf_pos = b->yy_ch_buf = base;
02638     b->yy_is_our_buffer = 0;
02639     b->yy_input_file = 0;
02640     b->yy_n_chars = b->yy_buf_size;
02641     b->yy_is_interactive = 0;
02642     b->yy_at_bol = 1;
02643     b->yy_fill_buffer = 0;
02644     b->yy_buffer_status = YY_BUFFER_NEW;
02645 
02646     yy_switch_to_buffer(b  );
02647 
02648     return b;
02649 }
02650 
02659 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
02660 {
02661     
02662     return yy_scan_bytes(yystr,strlen(yystr) );
02663 }
02664 
02672 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
02673 {
02674     YY_BUFFER_STATE b;
02675     char *buf;
02676     yy_size_t n;
02677     int i;
02678     
02679     /* Get memory for full buffer, including space for trailing EOB's. */
02680     n = _yybytes_len + 2;
02681     buf = (char *) yyalloc(n  );
02682     if ( ! buf )
02683         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
02684 
02685     for ( i = 0; i < _yybytes_len; ++i )
02686         buf[i] = yybytes[i];
02687 
02688     buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
02689 
02690     b = yy_scan_buffer(buf,n );
02691     if ( ! b )
02692         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
02693 
02694     /* It's okay to grow etc. this buffer, and we should throw it
02695      * away when we're done.
02696      */
02697     b->yy_is_our_buffer = 1;
02698 
02699     return b;
02700 }
02701 
02702 #ifndef YY_EXIT_FAILURE
02703 #define YY_EXIT_FAILURE 2
02704 #endif
02705 
02706 static void yy_fatal_error (yyconst char* msg )
02707 {
02708         (void) fprintf( stderr, "%s\n", msg );
02709     exit( YY_EXIT_FAILURE );
02710 }
02711 
02712 /* Redefine yyless() so it works in section 3 code. */
02713 
02714 #undef yyless
02715 #define yyless(n) \
02716     do \
02717         { \
02718         /* Undo effects of setting up yytext. */ \
02719         int yyless_macro_arg = (n); \
02720         YY_LESS_LINENO(yyless_macro_arg);\
02721         yytext[yyleng] = (yy_hold_char); \
02722         (yy_c_buf_p) = yytext + yyless_macro_arg; \
02723         (yy_hold_char) = *(yy_c_buf_p); \
02724         *(yy_c_buf_p) = '\0'; \
02725         yyleng = yyless_macro_arg; \
02726         } \
02727     while ( 0 )
02728 
02729 /* Accessor  methods (get/set functions) to struct members. */
02730 
02734 int yyget_lineno  (void)
02735 {
02736         
02737     return yylineno;
02738 }
02739 
02743 FILE *yyget_in  (void)
02744 {
02745         return yyin;
02746 }
02747 
02751 FILE *yyget_out  (void)
02752 {
02753         return yyout;
02754 }
02755 
02759 int yyget_leng  (void)
02760 {
02761         return yyleng;
02762 }
02763 
02768 char *yyget_text  (void)
02769 {
02770         return yytext;
02771 }
02772 
02777 void yyset_lineno (int  line_number )
02778 {
02779     
02780     yylineno = line_number;
02781 }
02782 
02789 void yyset_in (FILE *  in_str )
02790 {
02791         yyin = in_str ;
02792 }
02793 
02794 void yyset_out (FILE *  out_str )
02795 {
02796         yyout = out_str ;
02797 }
02798 
02799 int yyget_debug  (void)
02800 {
02801         return yy_flex_debug;
02802 }
02803 
02804 void yyset_debug (int  bdebug )
02805 {
02806         yy_flex_debug = bdebug ;
02807 }
02808 
02809 static int yy_init_globals (void)
02810 {
02811         /* Initialization is the same as for the non-reentrant scanner.
02812      * This function is called from yylex_destroy(), so don't allocate here.
02813      */
02814 
02815     (yy_buffer_stack) = 0;
02816     (yy_buffer_stack_top) = 0;
02817     (yy_buffer_stack_max) = 0;
02818     (yy_c_buf_p) = (char *) 0;
02819     (yy_init) = 0;
02820     (yy_start) = 0;
02821 
02822 /* Defined in main.c */
02823 #ifdef YY_STDINIT
02824     yyin = stdin;
02825     yyout = stdout;
02826 #else
02827     yyin = (FILE *) 0;
02828     yyout = (FILE *) 0;
02829 #endif
02830 
02831     /* For future reference: Set errno on error, since we are called by
02832      * yylex_init()
02833      */
02834     return 0;
02835 }
02836 
02837 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
02838 int yylex_destroy  (void)
02839 {
02840     
02841     /* Pop the buffer stack, destroying each element. */
02842     while(YY_CURRENT_BUFFER){
02843         yy_delete_buffer(YY_CURRENT_BUFFER  );
02844         YY_CURRENT_BUFFER_LVALUE = NULL;
02845         yypop_buffer_state();
02846     }
02847 
02848     /* Destroy the stack itself. */
02849     yyfree((yy_buffer_stack) );
02850     (yy_buffer_stack) = NULL;
02851 
02852     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02853      * yylex() is called, initialization will occur. */
02854     yy_init_globals( );
02855 
02856     return 0;
02857 }
02858 
02859 /*
02860  * Internal utility routines.
02861  */
02862 
02863 #ifndef yytext_ptr
02864 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
02865 {
02866     register int i;
02867     for ( i = 0; i < n; ++i )
02868         s1[i] = s2[i];
02869 }
02870 #endif
02871 
02872 #ifdef YY_NEED_STRLEN
02873 static int yy_flex_strlen (yyconst char * s )
02874 {
02875     register int n;
02876     for ( n = 0; s[n]; ++n )
02877         ;
02878 
02879     return n;
02880 }
02881 #endif
02882 
02883 void *yyalloc (yy_size_t  size )
02884 {
02885     return (void *) malloc( size );
02886 }
02887 
02888 void *yyrealloc  (void * ptr, yy_size_t  size )
02889 {
02890     /* The cast to (char *) in the following accommodates both
02891      * implementations that use char* generic pointers, and those
02892      * that use void* generic pointers.  It works with the latter
02893      * because both ANSI C and C++ allow castless assignment from
02894      * any pointer type to void*, and deal with argument conversions
02895      * as though doing an assignment.
02896      */
02897     return (void *) realloc( (char *) ptr, size );
02898 }
02899 
02900 void yyfree (void * ptr )
02901 {
02902     free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
02903 }
02904 
02905 #define YYTABLES_NAME "yytables"
02906 
02907 #line 802 "olib.l"
02908 
02909 
02910 
02911 
02912 void usage(void)
02913 {
02914   fprintf(stderr,"Usage:\n");
02915   fprintf(stderr,"\tolib [options] libname prefix\n");
02916   fprintf(stderr,"\nWhere:\n\tlibname is the path to OrCAD(TM) library to convert\n");
02917   fprintf(stderr,"\tprefix is the prefix for the .sym files extracted\n");
02918   fprintf(stderr,"Options are:\n\t-h\tprint this help and exit\n");
02919   fprintf(stderr,"\t-o\tuse old format (v 20020209) for .sym file\n");
02920   fprintf(stderr,"\t\telse use 'v 20020825' as version string in .sym file\n");
02921   fprintf(stderr,"\t-n\thides pin name if symbol is VECTOR drawed\n");
02922 }
02923 
02924 int yywrap()
02925 {
02926   /* found a part name after pinlist, this mean that part definition ends,
02927       and starts a new part definition */
02928   fprintf(stderr,"Writing down new symbol: %s pin: %d  vectors: %d\n",part_aliases[0],pincount,vector_count);      
02929   write_sym();      /* write the .sym gEDA symbol definition */
02930   /* restore initial condition */
02931   fprintf(stderr,"End of lib file\n");
02932 
02933   return 1;
02934 }
02935 
02936 
02937 int main (int argc, char *argv[])
02938 {
02939 
02940   FILE  *flib;
02941   char  fnlib[PATH_MAX];
02942   int   i;
02943 
02944   strcpy(sym_version,EDA_VERSION_NEW);    /* handle new gEDA version by default */
02945   use_old_version = 0;        /* old version flag */
02946   pin_name_hidden = 0;        /* hides pin name on VECTOR drawed symbols */
02947   opterr = 0;   /* do NOT print default error message for getopt */
02948   do
02949   {
02950     i = getopt(argc,argv,"hon");
02951     switch (i)
02952     {
02953       case 'h':
02954     usage();
02955     exit(0);
02956       case 'o':
02957     strcpy(sym_version,EDA_VERSION_OLD);
02958     fprintf(stderr,"Use old (%s) format.\n",sym_version);
02959     use_old_version = -1;
02960     break;
02961       case 'n':
02962     pin_name_hidden = -1;
02963     break;
02964       case '?':
02965     fprintf(stderr,"Unknown or illegal option :%c\n",(char)optopt);
02966     usage();
02967     exit(1);
02968       case ':':
02969     fprintf(stderr,"Parameter wrong for option: %c\n",(char)optopt);
02970     usage();
02971     exit(1);
02972     }
02973   }
02974   while (i != -1);
02975   if ((argc - optind) != 2)
02976   {
02977     fprintf(stderr,"Library name and prefix are mandatory.\n");
02978     usage();
02979     return 1;
02980   }
02981   strcpy(fnlib,argv[optind]);
02982   if (!(flib = fopen(fnlib,"r")))
02983   {
02984     perror("lib file");
02985     return 1;
02986   }
02987   strcpy(sym_prefix,argv[optind+1]);
02988   yyin = flib;
02989   yylex();
02990   fclose(flib);
02991   return 0;  
02992 }
02993 
02994 
02995 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines