Back to index

tetex-bin  3.0
routines.h
Go to the documentation of this file.
00001 /* routines.h: Generating the finite state automaton
00002 
00003 This file is part of Omega,
00004 which is based on the web2c distribution of TeX,
00005 
00006 Copyright (c) 1994--2001 John Plaice and Yannis Haralambous
00007 
00008 Omega is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 Omega is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with Omega; if not, write to the Free Software Foundation, Inc.,
00020 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00021 
00022 */
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027 #ifdef KPATHSEA
00028 #include <kpathsea/config.h>
00029 #include <kpathsea/c-memstr.h>
00030 #include <kpathsea/c-std.h>
00031 #else /* !KPATHSEA */
00032 #include <stdio.h>
00033 #include <string.h>
00034 #ifdef __STDC__
00035 #include <stdlib.h>
00036 #else
00037 extern void exit();
00038 #endif
00039 #endif /* KPATHSEA */
00040 
00041 #define nil 0
00042 
00043 #define WILDCARD 0
00044 #define STRINGLEFT 1
00045 #define SINGLELEFT 2
00046 #define DOUBLELEFT 3
00047 #define CHOICELEFT 4
00048 #define NOTCHOICELEFT 5
00049 #define PLUSLEFT 6
00050 #define COMPLETELEFT 7
00051 #define BEGINNINGLEFT 8
00052 #define ENDLEFT 9
00053 
00054 extern int yyparse();
00055 extern int yylex();
00056 
00057 extern int line_number;
00058 typedef struct cell_struct {struct cell_struct *ptr;
00059         int val; } cell;
00060 typedef cell *list;
00061 
00062 typedef struct left_cell {
00063        int kind;
00064        int val1, val2;
00065        char *valstr;
00066         struct lcell_struct *more_lefts;
00067        struct left_cell *one_left;
00068 } lft_cell;
00069 typedef lft_cell *left;
00070 
00071 typedef struct lcell_struct {struct lcell_struct *ptr;
00072         left val; } lcell;
00073 typedef lcell *llist;
00074 
00075 extern list cons();
00076 extern list list1();
00077 extern list list2();
00078 extern list append();
00079 extern list append1();
00080 
00081 extern llist lcons();
00082 extern llist llist1 P1H(left);
00083 extern llist llist2();
00084 extern llist lappend P2H(llist,llist);
00085 extern llist lappend1 P2H(llist,left);
00086 
00087 extern left WildCard();
00088 extern left SingleLeft P1H(int);
00089 extern left StringLeft P1H(char *);
00090 extern left DoubleLeft P2H(int,int);
00091 extern left ChoiceLeft P1H(llist);
00092 extern left NotChoiceLeft P1H(llist);
00093 extern left PlusLeft P2H(left,int);
00094 extern left CompleteLeft P3H(left,int,int);
00095 extern left BeginningLeft();
00096 extern left EndLeft();
00097 extern list gen_left();
00098 extern void fill_in_left();
00099 extern void out_left P1H(llist);
00100 extern int no_lefts;
00101 
00102 extern void store_alias P2H(string, left);
00103 extern left lookup_alias P1H(string);
00104 
00105 #define ARRAY_SIZE 10000
00106 typedef struct {
00107        int length;
00108        char * str;
00109        int table[ARRAY_SIZE];
00110 } table_type;
00111 
00112 extern int no_tables;
00113 extern int cur_table;
00114 extern int room_for_tables;
00115 extern table_type tables[];
00116 extern void add_to_table P1H(int);
00117 
00118 typedef struct {
00119        int length;
00120        char * str;
00121        int no_exprs;
00122        int instrs[ARRAY_SIZE];
00123 } state_type;
00124 
00125 extern int no_states;
00126 extern int cur_state;
00127 extern int room_for_states;
00128 extern state_type states[];
00129 extern void add_to_state P1H(int);
00130 
00131 extern void fill_in P1H(list);
00132 extern void right_int();
00133 extern void out_int P2H(int,int);
00134 extern void out_right P2H(int,int);
00135 
00136 extern void store_state P1H(string);
00137 extern int lookup_state P1H(string);
00138 extern void store_table P2H(string, int);
00139 extern int lookup_table P1H(string);
00140 
00141 typedef struct { char * str; left left_val; } alias_pair;
00142 
00143 extern alias_pair aliases[];
00144 
00145 extern int right_offset;
00146 extern int input_bytes;
00147 extern int output_bytes;
00148