remove OSF1 support
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / schema / token.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* A lexical scanner generated by flex */
24
25 /* scanner skeleton version:
26  * $XConsortium: token.cc /main/4 1996/07/05 15:20:12 rws $
27  */
28
29 #define FLEX_SCANNER
30
31 #include <stdio.h>
32
33
34 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
35 #ifdef c_plusplus
36 #ifndef __cplusplus
37 #define __cplusplus
38 #endif
39 #endif
40
41
42 #ifdef __cplusplus
43
44 #include <stdlib.h>
45
46 #if defined(linux) || defined(CSRG_BASED) || defined(sun)
47 #include <unistd.h>
48 #else
49 #include <osfcn.h>
50 #endif
51
52 /* use prototypes in function declarations */
53 #define  schema_USE_PROTOS
54
55 /* the "const" storage-class-modifier is valid */
56 #define  schema_USE_CONST
57
58 #else   /* ! __cplusplus */
59
60 #ifdef __STDC__
61
62 #ifdef __GNUC__
63 #include <stddef.h>
64 void *malloc( size_t );
65 void free( void* );
66 #else
67 #include <stdlib.h>
68 #endif  /* __GNUC__ */
69
70 #define  schema_USE_PROTOS
71 #define  schema_USE_CONST
72
73 #endif  /* __STDC__ */
74 #endif  /* ! __cplusplus */
75
76
77 #ifdef __TURBOC__
78 #define  schema_USE_CONST
79 #endif
80
81
82 #ifndef  schema_USE_CONST
83 #define const
84 #endif
85
86
87 #ifdef  schema_USE_PROTOS
88 #define  schema_PROTO(proto) proto
89 #else
90 #define  schema_PROTO(proto) ()
91 /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
92  * so it's got to be a K&R compiler, and therefore there's no standard
93  * place from which to include these definitions
94  */
95 char *malloc();
96 int free();
97 int read();
98 #endif
99
100
101 /* amount of stuff to slurp up with each read */
102 #ifndef  schema_READ_BUF_SIZE
103 #define  schema_READ_BUF_SIZE 8192
104 #endif
105
106 /* returned upon end-of-file */
107 #define  schema_END_TOK 0
108
109 /* copy whatever the last rule matched to the standard output */
110
111 /* cast to (char *) is because for 8-bit chars,  schematext is (unsigned char *) */
112 /* this used to be an fputs(), but since the string might contain NUL's,
113  * we now use fwrite()
114  */
115 #define ECHO (void) fwrite( (char *)  schematext,  schemaleng, 1,  schemaout )
116
117 /* gets input and stuffs it into "buf".  number of characters read, or  schema_NULL,
118  * is returned in "result".
119  */
120 #define  schema_INPUT(buf,result,max_size) \
121         if ( (result = read( fileno( schemain), (char *) buf, max_size )) < 0 ) \
122              schema_FATAL_ERROR( "read() in flex scanner failed" );
123 #define  schema_NULL 0
124
125 /* no semi-colon after return; correct usage is to write " schematerminate();" -
126  * we don't want an extra ';' after the "return" because that will cause
127  * some compilers to complain about unreachable statements.
128  */
129 #define  schematerminate() return (  schema_NULL )
130
131 /* report a fatal error */
132
133 /* The funky do-while is used to turn this macro definition into
134  * a single C statement (which needs a semi-colon terminator).
135  * This avoids problems with code like:
136  *
137  *      if ( something_happens )
138  *               schema_FATAL_ERROR( "oops, the something happened" );
139  *      else
140  *              everything_okay();
141  *
142  * Prior to using the do-while the compiler would get upset at the
143  * "else" because it interpreted the "if" statement as being all
144  * done when it reached the ';' after the  schema_FATAL_ERROR() call.
145  */
146
147 #define  schema_FATAL_ERROR(msg) \
148         do \
149                 { \
150                 (void) fputs( msg, stderr ); \
151                 (void) putc( '\n', stderr ); \
152                 exit( 1 ); \
153                 } \
154         while ( 0 )
155
156 /* default  schemawrap function - always treat EOF as an EOF */
157 #define  schemawrap() 1
158
159 /* enter a start condition.  This macro really ought to take a parameter,
160  * but we do it the disgusting crufty way forced on us by the ()-less
161  * definition of BEGIN
162  */
163 #define BEGIN  schema_start = 1 + 2 *
164
165 /* action number for EOF rule of a given start state */
166 #define  schema_STATE_EOF(state) ( schema_END_OF_BUFFER + state + 1)
167
168 /* special action meaning "start processing a new file" */
169 #define  schema_NEW_FILE \
170         do \
171                 { \
172                  schema_init_buffer(  schema_current_buffer,  schemain ); \
173                  schema_load_buffer_state(); \
174                 } \
175         while ( 0 )
176
177 /* default declaration of generated scanner - a define so the user can
178  * easily add parameters
179  */
180 #define  schema_DECL int  schemalex  schema_PROTO(( void )) 
181
182 /* code executed at the end of each rule */
183 #define  schema_BREAK break;
184
185 #define  schema_END_OF_BUFFER_CHAR 0
186
187 #ifndef  schema_BUF_SIZE
188 #define  schema_BUF_SIZE ( schema_READ_BUF_SIZE * 2) /* size of default input buffer */
189 #endif
190
191 typedef struct  schema_buffer_state * schema_BUFFER_STATE;
192
193 #define  schema_CHAR unsigned char
194 #define INITIAL 0
195 /*
196 * $XConsortium: token.cc /main/4 1996/07/05 15:20:12 rws $
197 *
198 * Copyright (c) 1993 HAL Computer Systems International, Ltd.
199 * All rights reserved.  Unpublished -- rights reserved under
200 * the Copyright Laws of the United States.  USE OF A COPYRIGHT
201 * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
202 * OR DISCLOSURE.
203
204 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
205 * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
206 * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
207 * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
208 * INTERNATIONAL, LTD.
209
210 *                         RESTRICTED RIGHTS LEGEND
211 * Use, duplication, or disclosure by the Government is subject
212 * to the restrictions as set forth in subparagraph (c)(l)(ii)
213 * of the Rights in Technical Data and Computer Software clause
214 * at DFARS 252.227-7013.
215 *
216 *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
217 *                  1315 Dell Avenue
218 *                  Campbell, CA  95008
219
220 */
221 #include "store_desc.h"
222 #include "sheet.tab.h"
223 extern char replace_string[PATHSIZ];
224 extern int replace_string_len;
225
226 int linecount = 1;
227
228 /* done after the current pattern has been matched and before the
229  * corresponding action - sets up  schematext
230  */
231 #define  schema_DO_BEFORE_ACTION \
232          schematext =  schema_bp; \
233          schemaleng =  schema_cp -  schema_bp; \
234          schema_hold_char = * schema_cp; \
235         * schema_cp = '\0'; \
236          schema_c_buf_p =  schema_cp;
237
238 #define EOB_ACT_CONTINUE_SCAN 0
239 #define EOB_ACT_END_OF_FILE 1
240 #define EOB_ACT_LAST_MATCH 2
241
242 /* return all but the first 'n' matched characters back to the input stream */
243 #define  schemaless(n) \
244         do \
245                 { \
246                 /* undo effects of setting up  schematext */ \
247                 * schema_cp =  schema_hold_char; \
248                  schema_c_buf_p =  schema_cp =  schema_bp + n; \
249                  schema_DO_BEFORE_ACTION; /* set up  schematext again */ \
250                 } \
251         while ( 0 )
252
253 #define unput(c)  schemaunput( c,  schematext )
254
255
256 struct  schema_buffer_state
257     {
258     FILE * schema_input_file;
259
260      schema_CHAR * schema_ch_buf;               /* input buffer */
261      schema_CHAR * schema_buf_pos;      /* current position in input buffer */
262
263     /* size of input buffer in bytes, not including room for EOB characters*/
264     int  schema_buf_size;       
265
266     /* number of characters read into  schema_ch_buf, not including EOB characters */
267     int  schema_n_chars;
268
269     int  schema_eof_status;             /* whether we've seen an EOF on this buffer */
270 #define EOF_NOT_SEEN 0
271     /* "pending" happens when the EOF has been seen but there's still
272      * some text process
273      */
274 #define EOF_PENDING 1
275 #define EOF_DONE 2
276     };
277
278 static  schema_BUFFER_STATE  schema_current_buffer;
279
280 /* we provide macros for accessing buffer states in case in the
281  * future we want to put the buffer states in a more general
282  * "scanner state"
283  */
284 #define  schema_CURRENT_BUFFER  schema_current_buffer
285
286
287 /*  schema_hold_char holds the character lost when  schematext is formed */
288 static  schema_CHAR  schema_hold_char;
289
290 static int  schema_n_chars;             /* number of characters read into  schema_ch_buf */
291
292
293
294 #ifndef  schema_USER_ACTION
295 #define  schema_USER_ACTION
296 #endif
297
298 #ifndef  schema_USER_INIT
299 #define  schema_USER_INIT
300 #endif
301
302 extern  schema_CHAR * schematext;
303 extern int  schemaleng;
304 extern FILE * schemain, * schemaout;
305
306  schema_CHAR * schematext;
307 int  schemaleng;
308
309 FILE * schemain = (FILE *) 0, * schemaout = (FILE *) 0;
310
311 #define  schema_END_OF_BUFFER 37
312 typedef int  schema_state_type;
313 static const short int  schema_accept[164] =
314     {   0,
315         0,    0,   37,   36,   32,   31,   35,   34,   30,   29,
316        35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
317        35,   35,   33,   32,   31,   35,   34,   30,   30,   35,
318        35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
319        23,   35,   35,   35,   35,   35,   35,   33,   35,   35,
320        35,   35,   35,   35,   35,   35,   35,    5,   35,   35,
321        35,   35,   35,    2,   35,   35,   35,   35,   35,   35,
322        35,   35,   35,    8,   35,   35,   35,    3,   25,   10,
323        35,   35,   35,   35,   35,   35,   11,   35,   35,   35,
324        35,   35,   13,   35,   35,   35,   35,   12,   21,   24,
325
326        35,   35,   35,   35,   35,   35,   35,   35,   17,   35,
327        35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
328         7,   35,   35,   35,   35,   26,   35,   35,   35,   18,
329        35,   35,   35,    6,   35,   35,    4,   35,   35,   20,
330        35,   19,   35,   35,   35,    1,   35,   35,   35,   35,
331        35,   27,   35,   35,   14,   22,   35,   16,   35,    9,
332        15,   28,    0
333     } ;
334
335 static const  schema_CHAR  schema_ec[256] =
336     {   0,
337         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
338         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
339         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
340         1,    2,    1,    1,    4,    5,    1,    1,    1,    1,
341         1,    1,    1,    1,    5,    5,    1,    6,    6,    6,
342         6,    6,    6,    6,    6,    6,    6,    7,    1,    1,
343         8,    1,    1,    1,    5,    5,    5,    5,    5,    5,
344         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
345         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
346         1,    9,    1,    1,   10,    1,   11,   12,   13,   14,
347
348        15,   16,   17,   18,   19,    5,    5,   20,   21,   22,
349        23,   24,    5,   25,   26,   27,   28,   29,    5,   30,
350        31,   32,    1,    1,    1,    1,    1,    1,    1,    1,
351         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
352         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
353         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
354         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
355         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
356         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
357         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
358
359         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
360         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
361         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
362         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
363         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
364         1,    1,    1,    1,    1
365     } ;
366
367 static const  schema_CHAR  schema_meta[33] =
368     {   0,
369         1,    1,    2,    1,    3,    3,    1,    1,    1,    3,
370         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
371         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
372         3,    3
373     } ;
374
375 static const short int  schema_base[166] =
376     {   0,
377         0,  174,  177,  179,  174,  172,    0,  168,   30,  179,
378       156,    7,   24,  153,  143,  148,  150,   13,  147,   29,
379        27,  157,    0,  164,  162,    0,  158,  179,  160,  147,
380       136,  133,  146,   22,  145,  141,   27,  130,  141,  136,
381         0,  136,  126,  124,  126,  126,  125,    0,  125,  131,
382       130,  126,  119,  115,  114,  124,  124,  128,  110,  121,
383       119,  119,  114,    0,  114,  106,  111,  102,  113,  117,
384       111,  100,  113,    0,  102,   92,   99,    0,    0,  110,
385       109,   91,  101,  101,  101,  104,  103,   89,   97,   95,
386        90,   97,   97,   85,   86,   78,   84,   92,   91,    0,
387
388        78,   80,   73,   87,   70,   73,   72,   35,    0,   71,
389        18,   69,   72,   68,   68,   66,   73,   62,   59,   69,
390         0,   66,   61,   67,   57,    0,   57,   56,   56,    0,
391        62,   60,   63,    0,   48,   57,    0,   56,   45,    0,
392        55,    0,   53,   42,   49,    0,   43,   34,   48,   47,
393        31,    0,   44,   28,    0,    0,   23,    0,   25,    0,
394         0,    0,  179,   46,   57
395     } ;
396
397 static const short int  schema_def[166] =
398     {   0,
399       163,    1,  163,  163,  163,  163,  164,  164,  163,  163,
400       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
401       164,  164,  165,  163,  163,  164,  164,  163,  163,  164,
402       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
403       164,  164,  164,  164,  164,  164,  164,  165,  164,  164,
404       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
405       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
406       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
407       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
408       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
409
410       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
411       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
412       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
413       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
414       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
415       164,  164,  164,  164,  164,  164,  164,  164,  164,  164,
416       164,  164,    0,  163,  163
417     } ;
418
419 static const short int  schema_nxt[212] =
420     {   0,
421         4,    5,    6,    4,    7,    8,    9,   10,    4,    7,
422        11,   12,   13,   14,    7,    7,    7,   15,   16,   17,
423        18,   19,    7,   20,    7,   21,    7,    7,   22,    7,
424         7,    7,   28,   31,   33,   39,   40,   32,   29,   42,
425        57,   44,   53,   54,  125,  122,   34,   45,   26,  126,
426       162,   43,  161,   46,  160,   58,  123,   48,  159,   48,
427       158,  157,  156,  155,  154,  153,  152,  151,  150,  149,
428       148,  147,  146,  145,  144,  143,  142,  141,  140,  139,
429       138,  137,  136,  135,  134,  133,  132,  131,  130,  129,
430       128,  127,  124,  121,  120,  119,  118,  117,  116,  115,
431
432       114,  113,  112,  111,  110,  109,  108,  107,  106,  105,
433       104,  103,  102,  101,  100,   99,   98,   97,   96,   95,
434        94,   93,   92,   91,   90,   89,   88,   87,   86,   85,
435        84,   83,   82,   81,   80,   79,   78,   77,   76,   75,
436        74,   73,   72,   71,   70,   69,   68,   67,   66,   65,
437        64,   63,   62,   61,   60,   59,   56,   55,   52,   51,
438        50,   49,   28,   27,   25,   24,   47,   41,   38,   37,
439        36,   35,   30,   27,   25,   24,  163,   23,    3,  163,
440       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
441       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
442
443       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
444       163
445     } ;
446
447 static const short int  schema_chk[212] =
448     {   0,
449         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
450         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
451         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
452         1,    1,    9,   12,   13,   18,   18,   12,    9,   20,
453        37,   21,   34,   34,  111,  108,   13,   21,  164,  111,
454       159,   20,  157,   21,  154,   37,  108,  165,  153,  165,
455       151,  150,  149,  148,  147,  145,  144,  143,  141,  139,
456       138,  136,  135,  133,  132,  131,  129,  128,  127,  125,
457       124,  123,  122,  120,  119,  118,  117,  116,  115,  114,
458       113,  112,  110,  107,  106,  105,  104,  103,  102,  101,
459
460        99,   98,   97,   96,   95,   94,   93,   92,   91,   90,
461        89,   88,   87,   86,   85,   84,   83,   82,   81,   80,
462        77,   76,   75,   73,   72,   71,   70,   69,   68,   67,
463        66,   65,   63,   62,   61,   60,   59,   58,   57,   56,
464        55,   54,   53,   52,   51,   50,   49,   47,   46,   45,
465        44,   43,   42,   40,   39,   38,   36,   35,   33,   32,
466        31,   30,   29,   27,   25,   24,   22,   19,   17,   16,
467        15,   14,   11,    8,    6,    5,    3,    2,  163,  163,
468       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
469       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
470
471       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
472       163
473     } ;
474
475 static  schema_state_type  schema_last_accepting_state;
476 static  schema_CHAR * schema_last_accepting_cpos;
477
478 /* the intent behind this definition is that it'll catch
479  * any uses of REJECT which flex missed
480  */
481 #define REJECT reject_used_but_not_detected
482 #define  schemamore()  schemamore_used_but_not_detected
483 #define  schema_MORE_ADJ 0
484
485 /* these variables are all declared out here so that section 3 code can
486  * manipulate them
487  */
488 /* points to current character in buffer */
489 static  schema_CHAR * schema_c_buf_p = ( schema_CHAR *) 0;
490 static int  schema_init = 1;            /* whether we need to initialize */
491 static int  schema_start = 0;   /* start state number */
492
493 /* flag which is used to allow  schemawrap()'s to do buffer switches
494  * instead of setting up a fresh  schemain.  A bit of a hack ...
495  */
496 static int  schema_did_buffer_switch_on_eof;
497
498 static  schema_state_type  schema_get_previous_state  schema_PROTO(( void ));
499 static  schema_state_type  schema_try_NUL_trans  schema_PROTO((  schema_state_type current_state ));
500 static int  schema_get_next_buffer  schema_PROTO(( void ));
501 #if 0
502 static void  schemaunput  schema_PROTO((  schema_CHAR c,  schema_CHAR *buf_ptr ));
503 #endif
504 void  schemarestart  schema_PROTO(( FILE *input_file ));
505 void  schema_switch_to_buffer  schema_PROTO((  schema_BUFFER_STATE new_buffer ));
506 void  schema_load_buffer_state  schema_PROTO(( void ));
507  schema_BUFFER_STATE  schema_create_buffer  schema_PROTO(( FILE *file, int size ));
508 void  schema_delete_buffer  schema_PROTO((  schema_BUFFER_STATE b ));
509 void  schema_init_buffer  schema_PROTO((  schema_BUFFER_STATE b, FILE *file ));
510
511 #define  schema_new_buffer  schema_create_buffer
512
513 #if 0
514 #ifdef __cplusplus
515 static int  schemainput  schema_PROTO(( void ));
516 #else
517 static int input  schema_PROTO(( void ));
518 #endif
519 #endif
520
521  schema_DECL
522     {
523     register  schema_state_type  schema_current_state;
524     register  schema_CHAR * schema_cp, * schema_bp;
525     register int  schema_act;
526
527
528
529
530     if (  schema_init )
531         {
532          schema_USER_INIT;
533
534         if ( !  schema_start )
535              schema_start = 1;  /* first start state */
536
537         if ( !  schemain )
538              schemain = stdin;
539
540         if ( !  schemaout )
541              schemaout = stdout;
542
543         if (  schema_current_buffer )
544              schema_init_buffer(  schema_current_buffer,  schemain );
545         else
546              schema_current_buffer =  schema_create_buffer(  schemain,  schema_BUF_SIZE );
547
548          schema_load_buffer_state();
549
550          schema_init = 0;
551         }
552
553     while ( 1 )         /* loops until end-of-file is reached */
554         {
555          schema_cp =  schema_c_buf_p;
556
557         /* support of  schematext */
558         * schema_cp =  schema_hold_char;
559
560         /*  schema_bp points to the position in  schema_ch_buf of the start of the
561          * current run.
562          */
563          schema_bp =  schema_cp;
564
565          schema_current_state =  schema_start;
566         if (  schema_bp[-1] == '\n' )
567             ++ schema_current_state;
568  schema_match:
569         do
570             {
571             register  schema_CHAR  schema_c =  schema_ec[* schema_cp];
572             if (  schema_accept[ schema_current_state] )
573                 {
574                  schema_last_accepting_state =  schema_current_state;
575                  schema_last_accepting_cpos =  schema_cp;
576                 }
577             while (  schema_chk[ schema_base[ schema_current_state] +  schema_c] !=  schema_current_state )
578                 {
579                  schema_current_state =  schema_def[ schema_current_state];
580                 if (  schema_current_state >= 164 )
581                      schema_c =  schema_meta[ schema_c];
582                 }
583              schema_current_state =  schema_nxt[ schema_base[ schema_current_state] +  schema_c];
584             ++ schema_cp;
585             }
586         while (  schema_current_state != 163 );
587          schema_cp =  schema_last_accepting_cpos;
588          schema_current_state =  schema_last_accepting_state;
589
590  schema_find_action:
591          schema_act =  schema_accept[ schema_current_state];
592
593          schema_DO_BEFORE_ACTION;
594          schema_USER_ACTION;
595
596 do_action:      /* this label is used only to access EOF actions */
597
598
599         switch (  schema_act )
600             {
601             case 0: /* must backtrack */
602             /* undo the effects of  schema_DO_BEFORE_ACTION */
603             * schema_cp =  schema_hold_char;
604              schema_cp =  schema_last_accepting_cpos;
605              schema_current_state =  schema_last_accepting_state;
606             goto  schema_find_action;
607
608 case 1:
609 {
610          return(CONTAINER);
611         }
612          schema_BREAK
613 case 2:
614 {
615          return(SET);
616         }
617          schema_BREAK
618 case 3:
619 {
620          return(LIST);
621         }
622          schema_BREAK
623 case 4:
624 {
625          return(INDEX_NAME);
626         }
627          schema_BREAK
628 case 5:
629 {
630          return(INV);
631         }
632          schema_BREAK
633 case 6:
634 {
635          return(COMPRESS);
636         }
637          schema_BREAK
638 case 7:
639 {
640          return(HUFFMAN);
641         }
642          schema_BREAK
643 case 8:
644 {
645          return(DICT);
646         }
647          schema_BREAK
648 case 9:
649 {
650          return(INDEX_AGENT);
651         }
652          schema_BREAK
653 case 10:
654 {
655          return(MPHF);
656         }
657          schema_BREAK
658 case 11:
659 {
660          return(BTREE);
661         }
662          schema_BREAK
663 case 12:
664 {
665          return(SMPHF);
666         }
667          schema_BREAK
668 case 13:
669 {
670          return(INDEX);
671         }
672          schema_BREAK
673 case 14:
674 {
675          return(MPHF_INDEX);
676         }
677          schema_BREAK
678 case 15:
679 {
680          return(SMPHF_INDEX);
681         }
682          schema_BREAK
683 case 16:
684 {
685          return(BTREE_INDEX);
686         }
687          schema_BREAK
688 case 17:
689 {
690          return(INV_NAME);
691         }
692          schema_BREAK
693 case 18:
694 {
695          return(AGENT_NAME);
696         }
697          schema_BREAK
698 case 19:
699 {
700          return(STORE_NAME);
701         }
702          schema_BREAK
703 case 20:
704 {
705          return(POSITION);
706         }
707          schema_BREAK
708 case 21:
709 {
710          return(STORE);
711         }
712          schema_BREAK
713 case 22:
714 {
715          return(PAGE_STORE);
716         }
717          schema_BREAK
718 case 23:
719 {
720          return(NM);
721         }
722          schema_BREAK
723 case 24:
724 {
725          return(V_OID);
726         }
727          schema_BREAK
728 case 25:
729 {
730          return(MODE);
731         }
732          schema_BREAK
733 case 26:
734 {
735          return(PAGE_SZ);
736         }
737          schema_BREAK
738 case 27:
739 {
740          return(BYTE_ORDER);
741         }
742          schema_BREAK
743 case 28:
744 {
745          return(CACHED_PAGES);
746         }
747          schema_BREAK
748 case 29:
749 {
750          return(EQUAL);
751         }
752          schema_BREAK
753 case 30:
754 {
755          return(SEPARATOR);
756         }
757          schema_BREAK
758 case 31:
759
760            linecount++; 
761          }
762          schema_BREAK
763 case 32:
764 {
765         }
766          schema_BREAK
767 case 33:
768 {
769         }
770          schema_BREAK
771 case 34:
772 {
773           schemalval.integer = atoi((char*) schematext);
774          return (NUMBER);
775         }
776          schema_BREAK
777 case 35:
778 {
779          if ( replace_string[0] != 0 &&  schematext[0] == '$' ) {
780              int len = MIN(strlen((char*) schematext+1),
781                            (unsigned int)(PATHSIZ - replace_string_len - 1));
782              *((char *) memcpy(replace_string + replace_string_len,
783                                (char*) schematext+1, len) + len) = '\0';
784              schemalval.string = replace_string;
785          } else
786              schemalval.string = (char*) schematext;
787          return (TOKEN);
788         }
789          schema_BREAK
790 case 36:
791  schema_FATAL_ERROR( "flex scanner jammed" );
792          schema_BREAK
793 case  schema_STATE_EOF(INITIAL):
794      schematerminate();
795
796             case  schema_END_OF_BUFFER:
797                 {
798                 /* amount of text matched not including the EOB char */
799                 int  schema_amount_of_matched_text =  schema_cp -  schematext - 1;
800
801                 /* undo the effects of  schema_DO_BEFORE_ACTION */
802                 * schema_cp =  schema_hold_char;
803
804                 /* note that here we test for  schema_c_buf_p "<=" to the position
805                  * of the first EOB in the buffer, since  schema_c_buf_p will
806                  * already have been incremented past the NUL character
807                  * (since all states make transitions on EOB to the end-
808                  * of-buffer state).  Contrast this with the test in  schemainput().
809                  */
810                 if (  schema_c_buf_p <= & schema_current_buffer-> schema_ch_buf[ schema_n_chars] )
811                     /* this was really a NUL */
812                     {
813                      schema_state_type  schema_next_state;
814
815                      schema_c_buf_p =  schematext +  schema_amount_of_matched_text;
816
817                      schema_current_state =  schema_get_previous_state();
818
819                     /* okay, we're now positioned to make the
820                      * NUL transition.  We couldn't have
821                      *  schema_get_previous_state() go ahead and do it
822                      * for us because it doesn't know how to deal
823                      * with the possibility of jamming (and we
824                      * don't want to build jamming into it because
825                      * then it will run more slowly)
826                      */
827
828                      schema_next_state =  schema_try_NUL_trans(  schema_current_state );
829
830                      schema_bp =  schematext +  schema_MORE_ADJ;
831
832                     if (  schema_next_state )
833                         {
834                         /* consume the NUL */
835                          schema_cp = ++ schema_c_buf_p;
836                          schema_current_state =  schema_next_state;
837                         goto  schema_match;
838                         }
839
840                     else
841                         {
842                              schema_cp =  schema_last_accepting_cpos;
843                              schema_current_state =  schema_last_accepting_state;
844                         goto  schema_find_action;
845                         }
846                     }
847
848                 else switch (  schema_get_next_buffer() )
849                     {
850                     case EOB_ACT_END_OF_FILE:
851                         {
852                          schema_did_buffer_switch_on_eof = 0;
853
854                         if (  schemawrap() )
855                             {
856                             /* note: because we've taken care in
857                              *  schema_get_next_buffer() to have set up  schematext,
858                              * we can now set up  schema_c_buf_p so that if some
859                              * total hoser (like flex itself) wants
860                              * to call the scanner after we return the
861                              *  schema_NULL, it'll still work - another  schema_NULL
862                              * will get returned.
863                              */
864                              schema_c_buf_p =  schematext +  schema_MORE_ADJ;
865
866                              schema_act =  schema_STATE_EOF(( schema_start - 1) / 2);
867                             goto do_action;
868                             }
869
870                         else
871                             {
872                             if ( !  schema_did_buffer_switch_on_eof )
873                                  schema_NEW_FILE;
874                             }
875                         }
876                         break;
877
878                     case EOB_ACT_CONTINUE_SCAN:
879                          schema_c_buf_p =  schematext +  schema_amount_of_matched_text;
880
881                          schema_current_state =  schema_get_previous_state();
882
883                          schema_cp =  schema_c_buf_p;
884                          schema_bp =  schematext +  schema_MORE_ADJ;
885                         goto  schema_match;
886
887                     case EOB_ACT_LAST_MATCH:
888                          schema_c_buf_p =
889                             & schema_current_buffer-> schema_ch_buf[ schema_n_chars];
890
891                          schema_current_state =  schema_get_previous_state();
892
893                          schema_cp =  schema_c_buf_p;
894                          schema_bp =  schematext +  schema_MORE_ADJ;
895                         goto  schema_find_action;
896                     }
897                 break;
898                 }
899
900             default:
901 #ifdef FLEX_DEBUG
902                 printf( "action # %d\n",  schema_act );
903 #endif
904                  schema_FATAL_ERROR(
905                         "fatal flex scanner internal error--no action found" );
906             }
907         }
908     }
909
910
911 /*  schema_get_next_buffer - try to read in a new buffer
912  *
913  * synopsis
914  *     int  schema_get_next_buffer();
915  *     
916  * returns a code representing an action
917  *     EOB_ACT_LAST_MATCH - 
918  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
919  *     EOB_ACT_END_OF_FILE - end of file
920  */
921
922 static int  schema_get_next_buffer()
923
924     {
925     register  schema_CHAR *dest =  schema_current_buffer-> schema_ch_buf;
926     register  schema_CHAR *source =  schematext - 1; /* copy prev. char, too */
927     register int number_to_move, i;
928     int ret_val;
929
930     if (  schema_c_buf_p > & schema_current_buffer-> schema_ch_buf[ schema_n_chars + 1] )
931          schema_FATAL_ERROR(
932                 "fatal flex scanner internal error--end of buffer missed" );
933
934     /* try to read more data */
935
936     /* first move last chars to start of buffer */
937     number_to_move =  schema_c_buf_p -  schematext;
938
939     for ( i = 0; i < number_to_move; ++i )
940         *(dest++) = *(source++);
941
942     if (  schema_current_buffer-> schema_eof_status != EOF_NOT_SEEN )
943         /* don't do the read, it's not guaranteed to return an EOF,
944          * just force an EOF
945          */
946          schema_n_chars = 0;
947
948     else
949         {
950         int num_to_read =  schema_current_buffer-> schema_buf_size - number_to_move - 1;
951
952         if ( num_to_read >  schema_READ_BUF_SIZE )
953             num_to_read =  schema_READ_BUF_SIZE;
954
955         else if ( num_to_read <= 0 )
956              schema_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
957
958         /* read in more data */
959          schema_INPUT( (& schema_current_buffer-> schema_ch_buf[number_to_move]),
960                    schema_n_chars, num_to_read );
961         }
962
963     if (  schema_n_chars == 0 )
964         {
965         if ( number_to_move == 1 )
966             {
967             ret_val = EOB_ACT_END_OF_FILE;
968              schema_current_buffer-> schema_eof_status = EOF_DONE;
969             }
970
971         else
972             {
973             ret_val = EOB_ACT_LAST_MATCH;
974              schema_current_buffer-> schema_eof_status = EOF_PENDING;
975             }
976         }
977
978     else
979         ret_val = EOB_ACT_CONTINUE_SCAN;
980
981      schema_n_chars += number_to_move;
982      schema_current_buffer-> schema_ch_buf[ schema_n_chars] =  schema_END_OF_BUFFER_CHAR;
983      schema_current_buffer-> schema_ch_buf[ schema_n_chars + 1] =  schema_END_OF_BUFFER_CHAR;
984
985     /*  schematext begins at the second character in  schema_ch_buf; the first
986      * character is the one which preceded it before reading in the latest
987      * buffer; it needs to be kept around in case it's a newline, so
988      *  schema_get_previous_state() will have with '^' rules active
989      */
990
991      schematext = & schema_current_buffer-> schema_ch_buf[1];
992
993     return ( ret_val );
994     }
995
996
997 /*  schema_get_previous_state - get the state just before the EOB char was reached
998  *
999  * synopsis
1000  *      schema_state_type  schema_get_previous_state();
1001  */
1002
1003 static  schema_state_type  schema_get_previous_state()
1004
1005     {
1006     register  schema_state_type  schema_current_state;
1007     register  schema_CHAR * schema_cp;
1008
1009     register  schema_CHAR * schema_bp =  schematext;
1010
1011      schema_current_state =  schema_start;
1012     if (  schema_bp[-1] == '\n' )
1013         ++ schema_current_state;
1014
1015     for (  schema_cp =  schematext +  schema_MORE_ADJ;  schema_cp <  schema_c_buf_p; ++ schema_cp )
1016         {
1017         register  schema_CHAR  schema_c = (* schema_cp ?  schema_ec[* schema_cp] : 1);
1018         if (  schema_accept[ schema_current_state] )
1019             {
1020              schema_last_accepting_state =  schema_current_state;
1021              schema_last_accepting_cpos =  schema_cp;
1022             }
1023         while (  schema_chk[ schema_base[ schema_current_state] +  schema_c] !=  schema_current_state )
1024             {
1025              schema_current_state =  schema_def[ schema_current_state];
1026             if (  schema_current_state >= 164 )
1027                  schema_c =  schema_meta[ schema_c];
1028             }
1029          schema_current_state =  schema_nxt[ schema_base[ schema_current_state] +  schema_c];
1030         }
1031
1032     return (  schema_current_state );
1033     }
1034
1035
1036 /*  schema_try_NUL_trans - try to make a transition on the NUL character
1037  *
1038  * synopsis
1039  *     next_state =  schema_try_NUL_trans( current_state );
1040  */
1041
1042 #ifdef  schema_USE_PROTOS
1043 static  schema_state_type  schema_try_NUL_trans( register  schema_state_type  schema_current_state )
1044 #else
1045 static  schema_state_type  schema_try_NUL_trans(  schema_current_state )
1046 register  schema_state_type  schema_current_state;
1047 #endif
1048
1049     {
1050     register int  schema_is_jam;
1051     register  schema_CHAR * schema_cp =  schema_c_buf_p;
1052
1053     register  schema_CHAR  schema_c = 1;
1054     if (  schema_accept[ schema_current_state] )
1055         {
1056          schema_last_accepting_state =  schema_current_state;
1057          schema_last_accepting_cpos =  schema_cp;
1058         }
1059     while (  schema_chk[ schema_base[ schema_current_state] +  schema_c] !=  schema_current_state )
1060         {
1061          schema_current_state =  schema_def[ schema_current_state];
1062         if (  schema_current_state >= 164 )
1063              schema_c =  schema_meta[ schema_c];
1064         }
1065      schema_current_state =  schema_nxt[ schema_base[ schema_current_state] +  schema_c];
1066      schema_is_jam = ( schema_current_state == 163);
1067
1068     return (  schema_is_jam ? 0 :  schema_current_state );
1069     }
1070
1071
1072 #if 0
1073 #ifdef  schema_USE_PROTOS
1074 static void  schemaunput(  schema_CHAR c, register  schema_CHAR * schema_bp )
1075 #else
1076 static void  schemaunput( c,  schema_bp )
1077  schema_CHAR c;
1078 register  schema_CHAR * schema_bp;
1079 #endif
1080
1081     {
1082     register  schema_CHAR * schema_cp =  schema_c_buf_p;
1083
1084     /* undo effects of setting up  schematext */
1085     * schema_cp =  schema_hold_char;
1086
1087     if (  schema_cp <  schema_current_buffer-> schema_ch_buf + 2 )
1088         { /* need to shift things up to make room */
1089         register int number_to_move =  schema_n_chars + 2; /* +2 for EOB chars */
1090         register  schema_CHAR *dest =
1091             & schema_current_buffer-> schema_ch_buf[ schema_current_buffer-> schema_buf_size + 2];
1092         register  schema_CHAR *source =
1093             & schema_current_buffer-> schema_ch_buf[number_to_move];
1094
1095         while ( source >  schema_current_buffer-> schema_ch_buf )
1096             *--dest = *--source;
1097
1098          schema_cp += dest - source;
1099          schema_bp += dest - source;
1100          schema_n_chars =  schema_current_buffer-> schema_buf_size;
1101
1102         if (  schema_cp <  schema_current_buffer-> schema_ch_buf + 2 )
1103              schema_FATAL_ERROR( "flex scanner push-back overflow" );
1104         }
1105
1106     if (  schema_cp >  schema_bp &&  schema_cp[-1] == '\n' )
1107          schema_cp[-2] = '\n';
1108
1109     *-- schema_cp = c;
1110
1111     /* note: the formal parameter *must* be called " schema_bp" for this
1112      *       macro to now work correctly
1113      */
1114      schema_DO_BEFORE_ACTION; /* set up  schematext again */
1115     }
1116 #endif
1117
1118
1119 #if 0
1120 #ifdef __cplusplus
1121 static int  schemainput()
1122 #else
1123 static int input()
1124 #endif
1125
1126     {
1127     int c;
1128      schema_CHAR * schema_cp =  schema_c_buf_p;
1129
1130     * schema_cp =  schema_hold_char;
1131
1132     if ( * schema_c_buf_p ==  schema_END_OF_BUFFER_CHAR )
1133         {
1134         /*  schema_c_buf_p now points to the character we want to return.
1135          * If this occurs *before* the EOB characters, then it's a
1136          * valid NUL; if not, then we've hit the end of the buffer.
1137          */
1138         if (  schema_c_buf_p < & schema_current_buffer-> schema_ch_buf[ schema_n_chars] )
1139             /* this was really a NUL */
1140             * schema_c_buf_p = '\0';
1141
1142         else
1143             { /* need more input */
1144              schematext =  schema_c_buf_p;
1145             ++ schema_c_buf_p;
1146
1147             switch (  schema_get_next_buffer() )
1148                 {
1149                 case EOB_ACT_END_OF_FILE:
1150                     {
1151                     if (  schemawrap() )
1152                         {
1153                          schema_c_buf_p =  schematext +  schema_MORE_ADJ;
1154                         return ( EOF );
1155                         }
1156
1157                      schema_NEW_FILE;
1158
1159 #ifdef __cplusplus
1160                     return (  schemainput() );
1161 #else
1162                     return ( input() );
1163 #endif
1164                     }
1165                     break;
1166
1167                 case EOB_ACT_CONTINUE_SCAN:
1168                      schema_c_buf_p =  schematext +  schema_MORE_ADJ;
1169                     break;
1170
1171                 case EOB_ACT_LAST_MATCH:
1172 #ifdef __cplusplus
1173                      schema_FATAL_ERROR( "unexpected last match in  schemainput()" );
1174 #else
1175                      schema_FATAL_ERROR( "unexpected last match in input()" );
1176 #endif
1177                 }
1178             }
1179         }
1180
1181     c = * schema_c_buf_p;
1182      schema_hold_char = *++ schema_c_buf_p;
1183
1184     return ( c );
1185     }
1186 #endif
1187
1188
1189 #ifdef  schema_USE_PROTOS
1190 void  schemarestart( FILE *input_file )
1191 #else
1192 void  schemarestart( input_file )
1193 FILE *input_file;
1194 #endif
1195
1196     {
1197      schema_init_buffer(  schema_current_buffer, input_file );
1198      schema_load_buffer_state();
1199     }
1200
1201
1202 #ifdef  schema_USE_PROTOS
1203 void  schema_switch_to_buffer(  schema_BUFFER_STATE new_buffer )
1204 #else
1205 void  schema_switch_to_buffer( new_buffer )
1206  schema_BUFFER_STATE new_buffer;
1207 #endif
1208
1209     {
1210     if (  schema_current_buffer == new_buffer )
1211         return;
1212
1213     if (  schema_current_buffer )
1214         {
1215         /* flush out information for old buffer */
1216         * schema_c_buf_p =  schema_hold_char;
1217          schema_current_buffer-> schema_buf_pos =  schema_c_buf_p;
1218          schema_current_buffer-> schema_n_chars =  schema_n_chars;
1219         }
1220
1221      schema_current_buffer = new_buffer;
1222      schema_load_buffer_state();
1223
1224     /* we don't actually know whether we did this switch during
1225      * EOF ( schemawrap()) processing, but the only time this flag
1226      * is looked at is after  schemawrap() is called, so it's safe
1227      * to go ahead and always set it.
1228      */
1229      schema_did_buffer_switch_on_eof = 1;
1230     }
1231
1232
1233 #ifdef  schema_USE_PROTOS
1234 void  schema_load_buffer_state( void )
1235 #else
1236 void  schema_load_buffer_state()
1237 #endif
1238
1239     {
1240      schema_n_chars =  schema_current_buffer-> schema_n_chars;
1241      schematext =  schema_c_buf_p =  schema_current_buffer-> schema_buf_pos;
1242      schemain =  schema_current_buffer-> schema_input_file;
1243      schema_hold_char = * schema_c_buf_p;
1244     }
1245
1246
1247 #ifdef  schema_USE_PROTOS
1248  schema_BUFFER_STATE  schema_create_buffer( FILE *file, int size )
1249 #else
1250  schema_BUFFER_STATE  schema_create_buffer( file, size )
1251 FILE *file;
1252 int size;
1253 #endif
1254
1255     {
1256      schema_BUFFER_STATE b;
1257
1258     b = ( schema_BUFFER_STATE) malloc( sizeof( struct  schema_buffer_state ) );
1259
1260     if ( ! b )
1261          schema_FATAL_ERROR( "out of dynamic memory in  schema_create_buffer()" );
1262
1263     b-> schema_buf_size = size;
1264
1265     /*  schema_ch_buf has to be 2 characters longer than the size given because
1266      * we need to put in 2 end-of-buffer characters.
1267      */
1268     b-> schema_ch_buf = ( schema_CHAR *) malloc( (unsigned) (b-> schema_buf_size + 2) );
1269
1270     if ( ! b-> schema_ch_buf )
1271          schema_FATAL_ERROR( "out of dynamic memory in  schema_create_buffer()" );
1272
1273      schema_init_buffer( b, file );
1274
1275     return ( b );
1276     }
1277
1278
1279 #ifdef  schema_USE_PROTOS
1280 void  schema_delete_buffer(  schema_BUFFER_STATE b )
1281 #else
1282 void  schema_delete_buffer( b )
1283  schema_BUFFER_STATE b;
1284 #endif
1285
1286     {
1287     if ( b ==  schema_current_buffer )
1288          schema_current_buffer = ( schema_BUFFER_STATE) 0;
1289
1290     free( (char *) b-> schema_ch_buf );
1291     free( (char *) b );
1292     }
1293
1294
1295 #ifdef  schema_USE_PROTOS
1296 void  schema_init_buffer(  schema_BUFFER_STATE b, FILE *file )
1297 #else
1298 void  schema_init_buffer( b, file )
1299  schema_BUFFER_STATE b;
1300 FILE *file;
1301 #endif
1302
1303     {
1304     b-> schema_input_file = file;
1305
1306     /* we put in the '\n' and start reading from [1] so that an
1307      * initial match-at-newline will be true.
1308      */
1309
1310     b-> schema_ch_buf[0] = '\n';
1311     b-> schema_n_chars = 1;
1312
1313     /* we always need two end-of-buffer characters.  The first causes
1314      * a transition to the end-of-buffer state.  The second causes
1315      * a jam in that state.
1316      */
1317     b-> schema_ch_buf[1] =  schema_END_OF_BUFFER_CHAR;
1318     b-> schema_ch_buf[2] =  schema_END_OF_BUFFER_CHAR;
1319
1320     b-> schema_buf_pos = &b-> schema_ch_buf[1];
1321
1322     b-> schema_eof_status = EOF_NOT_SEEN;
1323     }
1324