1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
28 #ifndef YY_ALWAYS_INTERACTIVE
29 #ifndef YY_NEVER_INTERACTIVE
30 extern int isatty YY_PROTO(( int ));
35 /* Use prototypes in function declarations. */
38 /* The "const" storage-class-modifier is valid. */
41 #else /* ! __cplusplus */
49 #endif /* ! __cplusplus */
68 #define YY_PROTO(proto) proto
70 #define YY_PROTO(proto) ()
73 /* Returned upon end-of-file. */
76 /* Promotes a possibly negative, possibly signed char to an unsigned
77 * integer for use as an array index. If the signed char is negative,
78 * we want to instead treat it as an 8-bit unsigned char, hence the
81 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
83 /* Enter a start condition. This macro really ought to take a parameter,
84 * but we do it the disgusting crufty way forced on us by the ()-less
85 * definition of BEGIN.
87 #define BEGIN yy_start = 1 + 2 *
89 /* Translate the current start state into a value that can be later handed
90 * to BEGIN to return to the state. The YYSTATE alias is for lex
93 #define YY_START ((yy_start - 1) / 2)
94 #define YYSTATE YY_START
96 /* Action number for EOF rule of a given start state. */
97 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
99 /* Special action meaning "start processing a new file". */
100 #define YY_NEW_FILE yyrestart( yyin )
102 #define YY_END_OF_BUFFER_CHAR 0
104 /* Size of default input buffer. */
105 #define YY_BUF_SIZE 16384
107 typedef struct yy_buffer_state *YY_BUFFER_STATE;
110 extern FILE *yyin, *yyout;
112 #define EOB_ACT_CONTINUE_SCAN 0
113 #define EOB_ACT_END_OF_FILE 1
114 #define EOB_ACT_LAST_MATCH 2
116 /* The funky do-while in the following #define is used to turn the definition
117 * int a single C statement (which needs a semi-colon terminator). This
118 * avoids problems with code like:
120 * if ( condition_holds )
123 * do_something_else();
125 * Prior to using the do-while the compiler would get upset at the
126 * "else" because it interpreted the "if" statement as being all
127 * done when it reached the ';' after the yyless() call.
130 /* Return all but the first 'n' matched characters back to the input stream. */
135 /* Undo effects of setting up yytext. */ \
136 *yy_cp = yy_hold_char; \
137 YY_RESTORE_YY_MORE_OFFSET \
138 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
139 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
143 #define unput(c) yyunput( c, yytext_ptr )
145 /* The following is because we cannot portably get our hands on size_t
146 * (without autoconf's help, which isn't available because we want
147 * flex-generated scanners to compile on their own).
149 typedef unsigned int yy_size_t;
152 struct yy_buffer_state
156 char *yy_ch_buf; /* input buffer */
157 char *yy_buf_pos; /* current position in input buffer */
159 /* Size of input buffer in bytes, not including room for EOB
162 yy_size_t yy_buf_size;
164 /* Number of characters read into yy_ch_buf, not including EOB
169 /* Whether we "own" the buffer - i.e., we know we created it,
170 * and can realloc() it to grow it, and should free() it to
173 int yy_is_our_buffer;
175 /* Whether this is an "interactive" input source; if so, and
176 * if we're using stdio for input, then we want to use getc()
177 * instead of fread(), to make sure we stop fetching input after
180 int yy_is_interactive;
182 /* Whether we're considered to be at the beginning of a line.
183 * If so, '^' rules will be active on the next match, otherwise
188 /* Whether to try to fill the input buffer when we reach the
193 int yy_buffer_status;
194 #define YY_BUFFER_NEW 0
195 #define YY_BUFFER_NORMAL 1
196 /* When an EOF's been seen but there's still some text to process
197 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
198 * shouldn't try reading from the input source any more. We might
199 * still have a bunch of tokens to match, though, because of
200 * possible backing-up.
202 * When we actually see the EOF, we change the status to "new"
203 * (via yyrestart()), so that the user can continue scanning by
204 * just pointing yyin at a new input file.
206 #define YY_BUFFER_EOF_PENDING 2
209 static YY_BUFFER_STATE yy_current_buffer = 0;
211 /* We provide macros for accessing buffer states in case in the
212 * future we want to put the buffer states in a more general
215 #define YY_CURRENT_BUFFER yy_current_buffer
218 /* yy_hold_char holds the character lost when yytext is formed. */
219 static char yy_hold_char;
221 static int yy_n_chars; /* number of characters read into yy_ch_buf */
226 /* Points to current character in buffer. */
227 static char *yy_c_buf_p = (char *) 0;
228 static int yy_init = 1; /* whether we need to initialize */
229 static int yy_start = 0; /* start state number */
231 /* Flag which is used to allow yywrap()'s to do buffer switches
232 * instead of setting up a fresh yyin. A bit of a hack ...
234 static int yy_did_buffer_switch_on_eof;
236 void yyrestart YY_PROTO(( FILE *input_file ));
238 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
239 void yy_load_buffer_state YY_PROTO(( void ));
240 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
241 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
242 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
243 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
244 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
246 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
247 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
248 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
250 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
251 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
252 static void yy_flex_free YY_PROTO(( void * ));
254 #define yy_new_buffer yy_create_buffer
256 #define yy_set_interactive(is_interactive) \
258 if ( ! yy_current_buffer ) \
259 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
260 yy_current_buffer->yy_is_interactive = is_interactive; \
263 #define yy_set_bol(at_bol) \
265 if ( ! yy_current_buffer ) \
266 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
267 yy_current_buffer->yy_at_bol = at_bol; \
270 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
272 typedef unsigned char YY_CHAR;
273 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
274 typedef int yy_state_type;
276 #define yytext_ptr yytext
278 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
279 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
280 static int yy_get_next_buffer YY_PROTO(( void ));
281 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
283 /* Done after the current pattern has been matched and before the
284 * corresponding action - sets up yytext.
286 #define YY_DO_BEFORE_ACTION \
287 yytext_ptr = yy_bp; \
288 yyleng = (int) (yy_cp - yy_bp); \
289 yy_hold_char = *yy_cp; \
293 #define YY_NUM_RULES 21
294 #define YY_END_OF_BUFFER 22
295 static yyconst short int yy_accept[123] =
297 0, 0, 22, 7, 7, 7, 7, 0, 0, 0,
298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
300 0, 0, 0, 0, 0, 0, 10, 0, 0, 12,
301 0, 14, 0, 0, 4, 0, 0, 0, 0, 0,
302 6, 0, 0, 0, 0, 0, 0, 0, 3, 0,
303 0, 0, 0, 0, 11, 15, 0, 0, 0, 0,
304 0, 0, 0, 0, 18, 0, 5, 8, 0, 0,
305 16, 0, 0, 0, 0, 0, 0, 9, 0, 0,
306 0, 0, 0, 0, 0, 0, 0, 0, 19, 0,
308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
309 20, 2, 0, 0, 0, 17, 0, 0, 13, 0,
313 static yyconst int yy_ec[256] =
315 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
318 1, 3, 1, 4, 1, 1, 1, 1, 1, 1,
319 1, 1, 1, 1, 1, 1, 5, 6, 6, 6,
320 6, 6, 6, 6, 6, 6, 6, 1, 1, 7,
321 8, 9, 1, 1, 10, 11, 12, 13, 14, 15,
322 1, 1, 16, 1, 1, 17, 18, 19, 20, 1,
323 1, 21, 22, 23, 24, 25, 1, 26, 1, 1,
324 1, 1, 1, 1, 1, 1, 27, 28, 29, 30,
326 31, 32, 1, 1, 33, 1, 1, 34, 1, 35,
327 36, 37, 1, 38, 39, 40, 41, 42, 1, 1,
328 43, 1, 1, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
335 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 static yyconst int yy_meta[44] =
347 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 static yyconst short int yy_base[127] =
356 0, 1, 152, 153, 38, 115, 112, 0, 129, 132,
357 137, 122, 131, 124, 0, 112, 0, 109, 105, 109,
358 0, 113, 120, 114, 119, 114, 113, 95, 0, 96,
359 88, 122, 99, 2, 112, 105, 153, 115, 1, 153,
360 102, 153, 91, 89, 153, 87, 84, 116, 76, 84,
361 153, 91, 93, 102, 1, 95, 0, 86, 153, 73,
362 80, 0, 101, 100, 153, 153, 98, 85, 87, 92,
363 2, 76, 63, 94, 0, 44, 153, 153, 87, 78,
364 153, 72, 64, 59, 92, 55, 55, 153, 71, 59,
365 61, 83, 84, 46, 67, 46, 77, 81, 78, 46,
367 58, 50, 71, 62, 73, 47, 65, 68, 64, 42,
368 55, 153, 31, 48, 13, 153, 0, 18, 0, 2,
369 153, 153, 71, 5, 73, 0
372 static yyconst short int yy_def[127] =
374 123, 123, 122, 122, 122, 122, 122, 122, 122, 122,
375 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
376 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
377 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
378 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
379 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
380 122, 124, 122, 122, 122, 122, 122, 122, 122, 122,
381 122, 122, 122, 122, 124, 122, 122, 122, 122, 122,
382 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
383 122, 122, 122, 122, 122, 122, 125, 122, 122, 122,
385 122, 122, 125, 122, 122, 122, 122, 122, 122, 122,
386 122, 122, 122, 122, 122, 122, 126, 122, 126, 122,
387 122, 0, 122, 122, 122, 122
390 static yyconst short int yy_nxt[197] =
392 119, 71, 71, 71, 71, 75, 5, 5, 122, 27,
393 68, 30, 55, 122, 35, 122, 56, 122, 36, 122,
394 69, 122, 31, 122, 122, 122, 28, 19, 44, 20,
395 50, 45, 122, 51, 6, 6, 122, 122, 122, 122,
396 7, 7, 8, 82, 121, 86, 86, 120, 118, 9,
397 87, 117, 10, 116, 11, 12, 86, 86, 13, 14,
398 111, 87, 15, 109, 109, 109, 109, 16, 110, 115,
399 110, 4, 4, 103, 103, 114, 113, 112, 111, 104,
400 108, 107, 106, 99, 105, 104, 102, 101, 100, 99,
401 98, 97, 96, 95, 94, 93, 92, 91, 90, 89,
403 88, 85, 84, 83, 81, 80, 79, 78, 77, 76,
404 74, 73, 72, 70, 67, 66, 65, 64, 63, 62,
405 61, 60, 59, 58, 57, 54, 53, 52, 49, 48,
406 47, 46, 43, 42, 41, 40, 39, 38, 37, 34,
407 33, 32, 29, 26, 25, 24, 23, 22, 21, 18,
408 17, 122, 3, 122, 122, 122, 122, 122, 122, 122,
409 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
410 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
411 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
412 122, 122, 122, 122, 122, 122
416 static yyconst short int yy_chk[197] =
418 126, 57, 57, 71, 71, 124, 1, 2, 0, 15,
419 55, 17, 39, 0, 21, 0, 39, 0, 21, 0,
420 55, 0, 17, 0, 0, 0, 15, 8, 29, 8,
421 34, 29, 0, 34, 1, 2, 0, 0, 0, 0,
422 1, 2, 5, 71, 120, 76, 76, 118, 115, 5,
423 76, 114, 5, 113, 5, 5, 86, 86, 5, 5,
424 111, 86, 5, 104, 104, 109, 109, 5, 104, 110,
425 109, 123, 123, 125, 125, 108, 107, 106, 105, 103,
426 102, 101, 100, 99, 98, 97, 96, 95, 94, 93,
427 92, 91, 90, 89, 87, 85, 84, 83, 82, 80,
429 79, 74, 73, 72, 70, 69, 68, 67, 64, 63,
430 61, 60, 58, 56, 54, 53, 52, 50, 49, 48,
431 47, 46, 44, 43, 41, 38, 36, 35, 33, 32,
432 31, 30, 28, 27, 26, 25, 24, 23, 22, 20,
433 19, 18, 16, 14, 13, 12, 11, 10, 9, 7,
434 6, 3, 122, 122, 122, 122, 122, 122, 122, 122,
435 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
436 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
437 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
438 122, 122, 122, 122, 122, 122
442 static yy_state_type yy_last_accepting_state;
443 static char *yy_last_accepting_cpos;
445 /* The intent behind this definition is that it'll catch
446 * any uses of REJECT which flex missed.
448 #define REJECT reject_used_but_not_detected
449 #define yymore() yymore_used_but_not_detected
450 #define YY_MORE_ADJ 0
451 #define YY_RESTORE_YY_MORE_OFFSET
455 /******************************************************************/
456 /* Copyright (C) 2000, HELM Team */
458 /* This file is part of HELM, an Hypertextual, Electronic */
459 /* Library of Mathematics, developed at the Computer Science */
460 /* Department, University of Bologna, Italy. */
462 /* HELM is free software; you can redistribute it and/or */
463 /* modify it under the terms of the GNU General Public License */
464 /* as published by the Free Software Foundation; either version */
465 /* 2 of the License, or (at your option) any later version. */
467 /* HELM is distributed in the hope that it will be useful, */
468 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
469 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
470 /* GNU General Public License for more details. */
472 /* You should have received a copy of the GNU General Public */
473 /* License along with HELM; if not, write to the Free Software */
474 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, */
475 /* MA 02111-1307, USA. */
477 /* For details, see the HELM World-Wide-Web page, */
478 /* http://cs.unibo.it/helm/. */
479 /******************************************************************/
480 /***************************************************************/
482 /* Automatic Metadata Extractor */
483 /* First draft 11/12/2001, by Andrea Asperti */
484 /* more bugs added by domenico lordi on mon 12/17/2001 */
485 /***************************************************************/
486 /***************************************************************/
487 /* 1. Inclusion of header files. */
488 /***************************************************************/
489 #line 39 "meta_lex.l"
492 #include <sys/stat.h>
493 #include "sthandler.h"
494 /***************************************************************/
495 /* 2. Constants and Variables Definitions */
496 /***************************************************************/
497 #line 50 "meta_lex.l"
501 #define MUTCONSTRUCT 3
517 int found = NOTFOUND;
518 int position = INBODY;
519 int first_child = HERE;
520 int skip = 0; // boolean to skip the insertion of a URI
521 int no_open_source =0;
526 char *xpointer = "#xpointer(1/";
529 /***************************************************************/
530 /* 3. Regular definitions. */
531 /***************************************************************/
532 /***************************************************************/
534 /***************************************************************/
537 /* Macros after this point can all be overridden by user definitions in
541 #ifndef YY_SKIP_YYWRAP
543 extern "C" int yywrap YY_PROTO(( void ));
545 extern int yywrap YY_PROTO(( void ));
550 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
554 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
557 #ifdef YY_NEED_STRLEN
558 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
563 static int yyinput YY_PROTO(( void ));
565 static int input YY_PROTO(( void ));
570 static int yy_start_stack_ptr = 0;
571 static int yy_start_stack_depth = 0;
572 static int *yy_start_stack = 0;
573 #ifndef YY_NO_PUSH_STATE
574 static void yy_push_state YY_PROTO(( int new_state ));
576 #ifndef YY_NO_POP_STATE
577 static void yy_pop_state YY_PROTO(( void ));
579 #ifndef YY_NO_TOP_STATE
580 static int yy_top_state YY_PROTO(( void ));
584 #define YY_NO_PUSH_STATE 1
585 #define YY_NO_POP_STATE 1
586 #define YY_NO_TOP_STATE 1
589 #ifdef YY_MALLOC_DECL
597 /* Just try to get by without declaring the routines. This will fail
598 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
599 * or sizeof(void*) != sizeof(int).
604 /* Amount of stuff to slurp up with each read. */
605 #ifndef YY_READ_BUF_SIZE
606 #define YY_READ_BUF_SIZE 8192
609 /* Copy whatever the last rule matched to the standard output. */
612 /* This used to be an fputs(), but since the string might contain NUL's,
613 * we now use fwrite().
615 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
618 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
619 * is returned in "result".
622 #define YY_INPUT(buf,result,max_size) \
623 if ( yy_current_buffer->yy_is_interactive ) \
626 for ( n = 0; n < max_size && \
627 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
630 buf[n++] = (char) c; \
631 if ( c == EOF && ferror( yyin ) ) \
632 YY_FATAL_ERROR( "input in flex scanner failed" ); \
638 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
640 if( errno != EINTR) \
642 YY_FATAL_ERROR( "input in flex scanner failed" ); \
651 /* No semi-colon after return; correct usage is to write "yyterminate();" -
652 * we don't want an extra ';' after the "return" because that will cause
653 * some compilers to complain about unreachable statements.
656 #define yyterminate() return YY_NULL
659 /* Number of entries by which start-condition stack grows. */
660 #ifndef YY_START_STACK_INCR
661 #define YY_START_STACK_INCR 25
664 /* Report a fatal error. */
665 #ifndef YY_FATAL_ERROR
666 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
669 /* Default declaration of generated scanner - a define so the user can
670 * easily add parameters.
673 #define YY_DECL int yylex YY_PROTO(( void ))
676 /* Code executed at the beginning of each rule, after yytext and yyleng
679 #ifndef YY_USER_ACTION
680 #define YY_USER_ACTION
683 /* Code executed at the end of each rule. */
685 #define YY_BREAK break;
688 #define YY_RULE_SETUP \
693 register yy_state_type yy_current_state;
694 register char *yy_cp, *yy_bp;
697 #line 96 "meta_lex.l"
711 yy_start = 1; /* first start state */
719 if ( ! yy_current_buffer )
721 yy_create_buffer( yyin, YY_BUF_SIZE );
723 yy_load_buffer_state();
726 while ( 1 ) /* loops until end-of-file is reached */
730 /* Support of yytext. */
731 *yy_cp = yy_hold_char;
733 /* yy_bp points to the position in yy_ch_buf of the start of
738 yy_current_state = yy_start;
742 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
743 if ( yy_accept[yy_current_state] )
745 yy_last_accepting_state = yy_current_state;
746 yy_last_accepting_cpos = yy_cp;
748 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
750 yy_current_state = (int) yy_def[yy_current_state];
751 if ( yy_current_state >= 123 )
752 yy_c = yy_meta[(unsigned int) yy_c];
754 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
757 while ( yy_base[yy_current_state] != 153 );
760 yy_act = yy_accept[yy_current_state];
762 { /* have to back up */
763 yy_cp = yy_last_accepting_cpos;
764 yy_current_state = yy_last_accepting_state;
765 yy_act = yy_accept[yy_current_state];
771 do_action: /* This label is used only to access EOF actions. */
775 { /* beginning of action switch */
776 case 0: /* must back up */
777 /* undo the effects of YY_DO_BEFORE_ACTION */
778 *yy_cp = yy_hold_char;
779 yy_cp = yy_last_accepting_cpos;
780 yy_current_state = yy_last_accepting_state;
785 #line 98 "meta_lex.l"
787 position = INBODY; // Variables have both a body and a type
792 #line 102 "meta_lex.l"
794 position = INTYPE; // Variables have both a body and a type
798 #line 107 "meta_lex.l"
801 #line 107 "meta_lex.l"
803 if (position == INTYPE)
805 else if (position == MAINHYP)
811 #line 116 "meta_lex.l"
814 #line 116 "meta_lex.l"
816 if (position == INHYP)
819 if (no_open_source == 0)
826 else if (position == MAINHYP)
837 #line 137 "meta_lex.l"
842 #line 141 "meta_lex.l"
844 #line 142 "meta_lex.l"
846 #line 143 "meta_lex.l"
849 #line 143 "meta_lex.l"
856 #line 147 "meta_lex.l"
858 if (((position == INTYPE) | (position == MAINHYP)) &&
859 (first_child == HERE))
861 if (position == INTYPE) /* REL on the spine */
864 search("Rel",first_child,position,spine_depth);
866 else search("Rel",first_child,position,depth);
873 #line 161 "meta_lex.l"
875 if (((position == INTYPE) | (position == MAINHYP)) &&
876 (first_child == HERE))
878 tmp=(char *)malloc((sizeof('a')*200));
881 if (position == INTYPE) /* SORT on the spine */
884 search(tmp,first_child,position,spine_depth);
886 else search(tmp,first_child,position,depth);
893 #line 178 "meta_lex.l"
901 #line 183 "meta_lex.l"
903 if (position == INTYPE) /* CONST on the spine */
910 #line 189 "meta_lex.l"
912 if (position == INTYPE) /* MUTIND on the spine */
919 #line 195 "meta_lex.l"
921 if (position == INTYPE) /* MUTCONSTRUCT on the spine */
923 where = MUTCONSTRUCT;
928 #line 201 "meta_lex.l"
931 uri=(char *)malloc((sizeof('a')*200));
936 if (position == INCONCL)
937 search(uri,first_child,position,spine_depth);
938 else search(uri,first_child,position,depth);
948 #line 218 "meta_lex.l"
950 if ((where == MUTIND) || (where == MUTCONSTRUCT))
951 { strsep(&yytext,&sep);
952 tmp=(char *)malloc((sizeof(sep)*(strlen(yytext)+1)));
955 sprintf(tmp,"%d",tmp_n);
956 strcat(uri,"#xpointer(1/");
962 if (position == INCONCL)
963 search(uri,first_child,position,spine_depth);
964 else search(uri,first_child,position,depth);
968 first_child = AFTER;};
973 #line 240 "meta_lex.l"
975 if (where == MUTCONSTRUCT)
976 { strsep(&yytext,&sep);
977 tmp=(char *)malloc((sizeof(sep)*(strlen(yytext)+1)));
982 if (position == INCONCL)
983 search(uri,first_child,position,spine_depth);
984 else search(uri,first_child,position,depth);
988 first_child = AFTER;};
993 #line 259 "meta_lex.l"
997 case YY_STATE_EOF(INITIAL):
1000 case YY_END_OF_BUFFER:
1002 /* Amount of text matched not including the EOB char. */
1003 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1005 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1006 *yy_cp = yy_hold_char;
1007 YY_RESTORE_YY_MORE_OFFSET
1009 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1011 /* We're scanning a new file or input source. It's
1012 * possible that this happened because the user
1013 * just pointed yyin at a new source and called
1014 * yylex(). If so, then we have to assure
1015 * consistency between yy_current_buffer and our
1016 * globals. Here is the right place to do so, because
1017 * this is the first action (other than possibly a
1018 * back-up) that will match for the new input source.
1020 yy_n_chars = yy_current_buffer->yy_n_chars;
1021 yy_current_buffer->yy_input_file = yyin;
1022 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1025 /* Note that here we test for yy_c_buf_p "<=" to the position
1026 * of the first EOB in the buffer, since yy_c_buf_p will
1027 * already have been incremented past the NUL character
1028 * (since all states make transitions on EOB to the
1029 * end-of-buffer state). Contrast this with the test
1032 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1033 { /* This was really a NUL. */
1034 yy_state_type yy_next_state;
1036 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1038 yy_current_state = yy_get_previous_state();
1040 /* Okay, we're now positioned to make the NUL
1041 * transition. We couldn't have
1042 * yy_get_previous_state() go ahead and do it
1043 * for us because it doesn't know how to deal
1044 * with the possibility of jamming (and we don't
1045 * want to build jamming into it because then it
1046 * will run more slowly).
1049 yy_next_state = yy_try_NUL_trans( yy_current_state );
1051 yy_bp = yytext_ptr + YY_MORE_ADJ;
1053 if ( yy_next_state )
1055 /* Consume the NUL. */
1056 yy_cp = ++yy_c_buf_p;
1057 yy_current_state = yy_next_state;
1064 goto yy_find_action;
1068 else switch ( yy_get_next_buffer() )
1070 case EOB_ACT_END_OF_FILE:
1072 yy_did_buffer_switch_on_eof = 0;
1076 /* Note: because we've taken care in
1077 * yy_get_next_buffer() to have set up
1078 * yytext, we can now set up
1079 * yy_c_buf_p so that if some total
1080 * hoser (like flex itself) wants to
1081 * call the scanner after we return the
1082 * YY_NULL, it'll still work - another
1083 * YY_NULL will get returned.
1085 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1087 yy_act = YY_STATE_EOF(YY_START);
1093 if ( ! yy_did_buffer_switch_on_eof )
1099 case EOB_ACT_CONTINUE_SCAN:
1101 yytext_ptr + yy_amount_of_matched_text;
1103 yy_current_state = yy_get_previous_state();
1106 yy_bp = yytext_ptr + YY_MORE_ADJ;
1109 case EOB_ACT_LAST_MATCH:
1111 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1113 yy_current_state = yy_get_previous_state();
1116 yy_bp = yytext_ptr + YY_MORE_ADJ;
1117 goto yy_find_action;
1124 "fatal flex scanner internal error--no action found" );
1125 } /* end of action switch */
1126 } /* end of scanning one token */
1127 } /* end of yylex */
1130 /* yy_get_next_buffer - try to read in a new buffer
1132 * Returns a code representing an action:
1133 * EOB_ACT_LAST_MATCH -
1134 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1135 * EOB_ACT_END_OF_FILE - end of file
1138 static int yy_get_next_buffer()
1140 register char *dest = yy_current_buffer->yy_ch_buf;
1141 register char *source = yytext_ptr;
1142 register int number_to_move, i;
1145 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1147 "fatal flex scanner internal error--end of buffer missed" );
1149 if ( yy_current_buffer->yy_fill_buffer == 0 )
1150 { /* Don't try to fill the buffer, so this is an EOF. */
1151 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1153 /* We matched a single character, the EOB, so
1154 * treat this as a final EOF.
1156 return EOB_ACT_END_OF_FILE;
1161 /* We matched some text prior to the EOB, first
1164 return EOB_ACT_LAST_MATCH;
1168 /* Try to read more data. */
1170 /* First move last chars to start of buffer. */
1171 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1173 for ( i = 0; i < number_to_move; ++i )
1174 *(dest++) = *(source++);
1176 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1177 /* don't do the read, it's not guaranteed to return an EOF,
1180 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1185 yy_current_buffer->yy_buf_size - number_to_move - 1;
1187 while ( num_to_read <= 0 )
1188 { /* Not enough room in the buffer - grow it. */
1189 #ifdef YY_USES_REJECT
1191 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1194 /* just a shorter name for the current buffer */
1195 YY_BUFFER_STATE b = yy_current_buffer;
1197 int yy_c_buf_p_offset =
1198 (int) (yy_c_buf_p - b->yy_ch_buf);
1200 if ( b->yy_is_our_buffer )
1202 int new_size = b->yy_buf_size * 2;
1204 if ( new_size <= 0 )
1205 b->yy_buf_size += b->yy_buf_size / 8;
1207 b->yy_buf_size *= 2;
1209 b->yy_ch_buf = (char *)
1210 /* Include room in for 2 EOB chars. */
1211 yy_flex_realloc( (void *) b->yy_ch_buf,
1212 b->yy_buf_size + 2 );
1215 /* Can't grow it, we don't own it. */
1218 if ( ! b->yy_ch_buf )
1220 "fatal error - scanner input buffer overflow" );
1222 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1224 num_to_read = yy_current_buffer->yy_buf_size -
1229 if ( num_to_read > YY_READ_BUF_SIZE )
1230 num_to_read = YY_READ_BUF_SIZE;
1232 /* Read in more data. */
1233 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1234 yy_n_chars, num_to_read );
1236 yy_current_buffer->yy_n_chars = yy_n_chars;
1239 if ( yy_n_chars == 0 )
1241 if ( number_to_move == YY_MORE_ADJ )
1243 ret_val = EOB_ACT_END_OF_FILE;
1249 ret_val = EOB_ACT_LAST_MATCH;
1250 yy_current_buffer->yy_buffer_status =
1251 YY_BUFFER_EOF_PENDING;
1256 ret_val = EOB_ACT_CONTINUE_SCAN;
1258 yy_n_chars += number_to_move;
1259 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1260 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1262 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1268 /* yy_get_previous_state - get the state just before the EOB char was reached */
1270 static yy_state_type yy_get_previous_state()
1272 register yy_state_type yy_current_state;
1273 register char *yy_cp;
1275 yy_current_state = yy_start;
1277 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1279 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1280 if ( yy_accept[yy_current_state] )
1282 yy_last_accepting_state = yy_current_state;
1283 yy_last_accepting_cpos = yy_cp;
1285 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1287 yy_current_state = (int) yy_def[yy_current_state];
1288 if ( yy_current_state >= 123 )
1289 yy_c = yy_meta[(unsigned int) yy_c];
1291 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1294 return yy_current_state;
1298 /* yy_try_NUL_trans - try to make a transition on the NUL character
1301 * next_state = yy_try_NUL_trans( current_state );
1304 #ifdef YY_USE_PROTOS
1305 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1307 static yy_state_type yy_try_NUL_trans( yy_current_state )
1308 yy_state_type yy_current_state;
1311 register int yy_is_jam;
1312 register char *yy_cp = yy_c_buf_p;
1314 register YY_CHAR yy_c = 1;
1315 if ( yy_accept[yy_current_state] )
1317 yy_last_accepting_state = yy_current_state;
1318 yy_last_accepting_cpos = yy_cp;
1320 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1322 yy_current_state = (int) yy_def[yy_current_state];
1323 if ( yy_current_state >= 123 )
1324 yy_c = yy_meta[(unsigned int) yy_c];
1326 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1327 yy_is_jam = (yy_current_state == 122);
1329 return yy_is_jam ? 0 : yy_current_state;
1334 #ifdef YY_USE_PROTOS
1335 static void yyunput( int c, register char *yy_bp )
1337 static void yyunput( c, yy_bp )
1339 register char *yy_bp;
1342 register char *yy_cp = yy_c_buf_p;
1344 /* undo effects of setting up yytext */
1345 *yy_cp = yy_hold_char;
1347 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1348 { /* need to shift things up to make room */
1349 /* +2 for EOB chars. */
1350 register int number_to_move = yy_n_chars + 2;
1351 register char *dest = &yy_current_buffer->yy_ch_buf[
1352 yy_current_buffer->yy_buf_size + 2];
1353 register char *source =
1354 &yy_current_buffer->yy_ch_buf[number_to_move];
1356 while ( source > yy_current_buffer->yy_ch_buf )
1357 *--dest = *--source;
1359 yy_cp += (int) (dest - source);
1360 yy_bp += (int) (dest - source);
1361 yy_current_buffer->yy_n_chars =
1362 yy_n_chars = yy_current_buffer->yy_buf_size;
1364 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1365 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1368 *--yy_cp = (char) c;
1372 yy_hold_char = *yy_cp;
1375 #endif /* ifndef YY_NO_UNPUT */
1379 static int yyinput()
1386 *yy_c_buf_p = yy_hold_char;
1388 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1390 /* yy_c_buf_p now points to the character we want to return.
1391 * If this occurs *before* the EOB characters, then it's a
1392 * valid NUL; if not, then we've hit the end of the buffer.
1394 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1395 /* This was really a NUL. */
1399 { /* need more input */
1400 int offset = yy_c_buf_p - yytext_ptr;
1403 switch ( yy_get_next_buffer() )
1405 case EOB_ACT_LAST_MATCH:
1406 /* This happens because yy_g_n_b()
1407 * sees that we've accumulated a
1408 * token and flags that we need to
1409 * try matching the token before
1410 * proceeding. But for input(),
1411 * there's no matching to consider.
1412 * So convert the EOB_ACT_LAST_MATCH
1413 * to EOB_ACT_END_OF_FILE.
1416 /* Reset buffer status. */
1421 case EOB_ACT_END_OF_FILE:
1426 if ( ! yy_did_buffer_switch_on_eof )
1435 case EOB_ACT_CONTINUE_SCAN:
1436 yy_c_buf_p = yytext_ptr + offset;
1442 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1443 *yy_c_buf_p = '\0'; /* preserve yytext */
1444 yy_hold_char = *++yy_c_buf_p;
1451 #ifdef YY_USE_PROTOS
1452 void yyrestart( FILE *input_file )
1454 void yyrestart( input_file )
1458 if ( ! yy_current_buffer )
1459 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1461 yy_init_buffer( yy_current_buffer, input_file );
1462 yy_load_buffer_state();
1466 #ifdef YY_USE_PROTOS
1467 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1469 void yy_switch_to_buffer( new_buffer )
1470 YY_BUFFER_STATE new_buffer;
1473 if ( yy_current_buffer == new_buffer )
1476 if ( yy_current_buffer )
1478 /* Flush out information for old buffer. */
1479 *yy_c_buf_p = yy_hold_char;
1480 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1481 yy_current_buffer->yy_n_chars = yy_n_chars;
1484 yy_current_buffer = new_buffer;
1485 yy_load_buffer_state();
1487 /* We don't actually know whether we did this switch during
1488 * EOF (yywrap()) processing, but the only time this flag
1489 * is looked at is after yywrap() is called, so it's safe
1490 * to go ahead and always set it.
1492 yy_did_buffer_switch_on_eof = 1;
1496 #ifdef YY_USE_PROTOS
1497 void yy_load_buffer_state( void )
1499 void yy_load_buffer_state()
1502 yy_n_chars = yy_current_buffer->yy_n_chars;
1503 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1504 yyin = yy_current_buffer->yy_input_file;
1505 yy_hold_char = *yy_c_buf_p;
1509 #ifdef YY_USE_PROTOS
1510 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1512 YY_BUFFER_STATE yy_create_buffer( file, size )
1519 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1521 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1523 b->yy_buf_size = size;
1525 /* yy_ch_buf has to be 2 characters longer than the size given because
1526 * we need to put in 2 end-of-buffer characters.
1528 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1529 if ( ! b->yy_ch_buf )
1530 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1532 b->yy_is_our_buffer = 1;
1534 yy_init_buffer( b, file );
1540 #ifdef YY_USE_PROTOS
1541 void yy_delete_buffer( YY_BUFFER_STATE b )
1543 void yy_delete_buffer( b )
1550 if ( b == yy_current_buffer )
1551 yy_current_buffer = (YY_BUFFER_STATE) 0;
1553 if ( b->yy_is_our_buffer )
1554 yy_flex_free( (void *) b->yy_ch_buf );
1556 yy_flex_free( (void *) b );
1563 #ifndef YY_ALWAYS_INTERACTIVE
1564 #ifndef YY_NEVER_INTERACTIVE
1565 extern int isatty YY_PROTO(( int ));
1570 #ifdef YY_USE_PROTOS
1571 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1573 void yy_init_buffer( b, file )
1580 yy_flush_buffer( b );
1582 b->yy_input_file = file;
1583 b->yy_fill_buffer = 1;
1585 #if YY_ALWAYS_INTERACTIVE
1586 b->yy_is_interactive = 1;
1588 #if YY_NEVER_INTERACTIVE
1589 b->yy_is_interactive = 0;
1591 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1597 #ifdef YY_USE_PROTOS
1598 void yy_flush_buffer( YY_BUFFER_STATE b )
1600 void yy_flush_buffer( b )
1610 /* We always need two end-of-buffer characters. The first causes
1611 * a transition to the end-of-buffer state. The second causes
1612 * a jam in that state.
1614 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1615 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1617 b->yy_buf_pos = &b->yy_ch_buf[0];
1620 b->yy_buffer_status = YY_BUFFER_NEW;
1622 if ( b == yy_current_buffer )
1623 yy_load_buffer_state();
1627 #ifndef YY_NO_SCAN_BUFFER
1628 #ifdef YY_USE_PROTOS
1629 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1631 YY_BUFFER_STATE yy_scan_buffer( base, size )
1639 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1640 base[size-1] != YY_END_OF_BUFFER_CHAR )
1641 /* They forgot to leave room for the EOB's. */
1644 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1646 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1648 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1649 b->yy_buf_pos = b->yy_ch_buf = base;
1650 b->yy_is_our_buffer = 0;
1651 b->yy_input_file = 0;
1652 b->yy_n_chars = b->yy_buf_size;
1653 b->yy_is_interactive = 0;
1655 b->yy_fill_buffer = 0;
1656 b->yy_buffer_status = YY_BUFFER_NEW;
1658 yy_switch_to_buffer( b );
1665 #ifndef YY_NO_SCAN_STRING
1666 #ifdef YY_USE_PROTOS
1667 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1669 YY_BUFFER_STATE yy_scan_string( yy_str )
1670 yyconst char *yy_str;
1674 for ( len = 0; yy_str[len]; ++len )
1677 return yy_scan_bytes( yy_str, len );
1682 #ifndef YY_NO_SCAN_BYTES
1683 #ifdef YY_USE_PROTOS
1684 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1686 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1687 yyconst char *bytes;
1696 /* Get memory for full buffer, including space for trailing EOB's. */
1698 buf = (char *) yy_flex_alloc( n );
1700 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1702 for ( i = 0; i < len; ++i )
1705 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1707 b = yy_scan_buffer( buf, n );
1709 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1711 /* It's okay to grow etc. this buffer, and we should throw it
1712 * away when we're done.
1714 b->yy_is_our_buffer = 1;
1721 #ifndef YY_NO_PUSH_STATE
1722 #ifdef YY_USE_PROTOS
1723 static void yy_push_state( int new_state )
1725 static void yy_push_state( new_state )
1729 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1733 yy_start_stack_depth += YY_START_STACK_INCR;
1734 new_size = yy_start_stack_depth * sizeof( int );
1736 if ( ! yy_start_stack )
1737 yy_start_stack = (int *) yy_flex_alloc( new_size );
1740 yy_start_stack = (int *) yy_flex_realloc(
1741 (void *) yy_start_stack, new_size );
1743 if ( ! yy_start_stack )
1745 "out of memory expanding start-condition stack" );
1748 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1755 #ifndef YY_NO_POP_STATE
1756 static void yy_pop_state()
1758 if ( --yy_start_stack_ptr < 0 )
1759 YY_FATAL_ERROR( "start-condition stack underflow" );
1761 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1766 #ifndef YY_NO_TOP_STATE
1767 static int yy_top_state()
1769 return yy_start_stack[yy_start_stack_ptr - 1];
1773 #ifndef YY_EXIT_FAILURE
1774 #define YY_EXIT_FAILURE 2
1777 #ifdef YY_USE_PROTOS
1778 static void yy_fatal_error( yyconst char msg[] )
1780 static void yy_fatal_error( msg )
1784 (void) fprintf( stderr, "%s\n", msg );
1785 exit( YY_EXIT_FAILURE );
1790 /* Redefine yyless() so it works in section 3 code. */
1796 /* Undo effects of setting up yytext. */ \
1797 yytext[yyleng] = yy_hold_char; \
1798 yy_c_buf_p = yytext + n; \
1799 yy_hold_char = *yy_c_buf_p; \
1800 *yy_c_buf_p = '\0'; \
1806 /* Internal utility routines. */
1809 #ifdef YY_USE_PROTOS
1810 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1812 static void yy_flex_strncpy( s1, s2, n )
1819 for ( i = 0; i < n; ++i )
1824 #ifdef YY_NEED_STRLEN
1825 #ifdef YY_USE_PROTOS
1826 static int yy_flex_strlen( yyconst char *s )
1828 static int yy_flex_strlen( s )
1833 for ( n = 0; s[n]; ++n )
1841 #ifdef YY_USE_PROTOS
1842 static void *yy_flex_alloc( yy_size_t size )
1844 static void *yy_flex_alloc( size )
1848 return (void *) malloc( size );
1851 #ifdef YY_USE_PROTOS
1852 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1854 static void *yy_flex_realloc( ptr, size )
1859 /* The cast to (char *) in the following accommodates both
1860 * implementations that use char* generic pointers, and those
1861 * that use void* generic pointers. It works with the latter
1862 * because both ANSI C and C++ allow castless assignment from
1863 * any pointer type to void*, and deal with argument conversions
1864 * as though doing an assignment.
1866 return (void *) realloc( (char *) ptr, size );
1869 #ifdef YY_USE_PROTOS
1870 static void yy_flex_free( void *ptr )
1872 static void yy_flex_free( ptr )
1886 #line 259 "meta_lex.l"
1889 /***************************************************************/
1890 /* 6. Auxiliary functions. */
1891 /***************************************************************/
1893 main(int argc, char *argv[])
1896 FILE *outrel, *outsort;
1898 init_symbol_table();
1899 if (!(outrel = fopen("forward_rel.rdf","a")))
1901 fprintf(stderr, "error in openinf file forward_rel.rdf\n");
1904 if (!(outsort = fopen("forward_sort.rdf","a")))
1906 fprintf(stderr, "error in openinf file forward_rel.rdf\n");
1909 // We process the body
1910 if (!stat("tmp/body.xml",&buf)) {
1911 yyin = fopen("tmp/body.xml", "r");
1917 // We process the type
1918 yyin = fopen("tmp/type.xml", "r");
1926 printf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n");
1927 printf("<!DOCTYPE rdf:RDF [
1928 <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
1929 <!ENTITY hthns 'http://www.cs.unibo.it/helm/schemas/schema-helmth#'>
1930 <!ENTITY hns 'http://www.cs.unibo.it/helm/schemas/schema-helm#'>
1934 printf("<rdf:RDF xml:lang=\"en\" xmlns:rdf=\"&rdfns;\" xmlns:h=\"&hns;\" xmlns:hth=\"&hthns;\">\n");
1935 printf("\t<h:Object rdf:about=\"");
1936 printf("%s",argv[1]);
1938 print_all(argv[1],outrel,outsort);
1939 printf("\t</h:Object>\n");
1940 printf("</rdf:RDF>\n");
1944 search(uri,first_child,position,depth)
1949 if (position == MAINHYP)
1951 if (first_child == HERE)
1952 found = search_bucket(uri,MAINHYP,depth);
1954 found = search_bucket(uri,INHYP,0);
1956 else if (position == INCONCL)
1958 if (first_child == HERE)
1959 found = search_bucket(uri,MAINCONCL,depth);
1961 found = search_bucket(uri,INCONCL,0);
1965 found = search_bucket(uri,position,depth);
1966 /* if (found == NOTFOUND)
1967 fprintf(stderr,"pos = %d, uri = %s\n", position, uri); */
1970 (first_child == HERE)
1972 if (position == MAINHYP)
1973 found = search_bucket(uri,MAINHYP,depth);
1974 else if (position == INCONCL)
1975 found = search_bucket(uri,MAINCONCL,0);
1976 else if (position == INHYP)
1977 found = search_bucket(uri,INHYP,0);
1978 if (found == NOTFOUND)
1979 printf( "pos = %d, uri = %s\n", MAINCONCL, uri);
1981 else if ((position == MAINHYP) && (first_child == AFTER))
1982 found = search_bucket(uri,INHYP,0);
1983 else found = search_bucket(uri,position,0);
1984 if (found == NOTFOUND)
1985 printf( "pos = %d, uri = %s\n", position, uri);