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