initial
[prop.git] / include / propdefs.h
blobb8eb6fcd65cf0c62bfc8f4a16bcdddbd42e27a16
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are welcomed to incorporate any part of ADLib and Prop into
9 // your programs.
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
16 // code.
18 // This software is still under development and we welcome(read crave for)
19 // any suggestions and help from the users.
21 // Allen Leung (leunga@cs.nyu.edu)
22 // 1994-1997
23 //////////////////////////////////////////////////////////////////////////////
25 //////////////////////////////////////////////////////////////////////////////
26 // Version 2.3.2
27 // This file provides linkage to various runtime support for code
28 // generated using Prop.
29 //////////////////////////////////////////////////////////////////////////////
31 // Notice that by writing code that assumes the type bool is defined
32 // may make it difficult to port code to other plaforms.
33 // #define PROP_BOOL_IS_IMPLEMENTED
35 #ifdef PROP_REFERENCE_COUNTING_USED
36 // Reference counting support
37 # include <AD/memory/constref.h> // reference countable object base class
38 #endif
40 #ifdef PROP_GARBAGE_COLLECTION_USED
41 // Garbage collection support
42 # include <AD/gc/gcobject.h> // garbage collectable object base class
43 #endif
45 #ifdef PROP_HASH_CONSING_USED
46 // Hash consing support
47 # include <AD/hash/lhash.h> // linear probing hash table
48 #endif
50 #ifdef PROP_LEXER_USED
51 // Lexer support
52 # include <AD/automata/scanner.h>
53 #endif
55 #ifdef PROP_PARSER_USED
56 // Parser support
57 # include <AD/automata/lrparser.h>
58 #endif
60 #ifdef PROP_INFERENCE_USED
61 // Inference support
62 # include <AD/rete/rete.h> // Rete network driver
63 #endif
65 #ifdef PROP_REWRITING_USED
66 // Rewriting support
67 # include <AD/automata/treetab.h> // compressed tree automata tables
68 # include <AD/automata/dfatable.h> // compressed dfa tables
69 # include <AD/rewrite/termobj.h> // rewritable object base class
70 # include <AD/rewrite/burs.h> // rewriting base class
71 # define PROP_REWRITE_STACK_SIZE 1024
72 #endif
74 #ifdef PROP_UNIFICATION_USED
75 // Unification/constraint satisfaction support
76 // # include <AD/csp/logicalterm.h> // logical(unifiable) term
77 #endif
79 #ifdef PROP_REGEXP_MATCHING_USED
80 // regular expression string matching support
81 # include <AD/automata/regexmat.h> // Regular expression string matcher
82 #endif
84 #ifdef PROP_PRINTER_USED
85 // pretty printing support
86 # include <AD/pretty/postream.h> // pretty printer routines
87 #endif
89 #if defined(PROP_STRCMP_USED) || defined(PROP_EQUALITY_USED)
90 // strcmp() support
91 # include <string.h> // standard string support
92 #endif
94 #ifdef PROP_PERSISTENCE_USED
95 // Persistence used
96 # include <AD/persist/pobject.h> // persistent object base class
97 # include <AD/persist/pstream.h> // persistent streams
98 # include <AD/persist/pfactory.h> // persistent object factories
99 #endif
101 #ifdef PROP_DYNAMIC_MESSAGING
102 // Dynamic messaging object base class
103 # include <AD/objc/objc.h> // base class to dynamic messaging objects
104 # include <AD/objc/class.h> // meta class and other stuff
105 #endif
107 #ifdef PROP_VECTOR_USED
108 # include <new.h>
109 // Template for calling the constructor
110 // (without allocating any memory)
111 template <class T>
112 inline void * operator new (size_t, T * p) { return p; }
114 // Allocate extra memory
115 inline void * operator new (size_t, size_t n) { return ::operator new(n); }
116 #endif
118 #ifdef PROP_QUARK_USED
119 # include <AD/strings/quark.h>
120 #endif
122 #ifdef PROP_BIGINT_USED
123 # include <AD/numeric/bigint.h>
124 #endif
126 #ifdef PROP_GRAPHTYPE_USED
127 # include <AD/graphtype/graphtype.h>
128 #endif
130 // Does your compiler support the type bool.
131 // If it does, uncomment out the following.
132 // Comparison primitives
133 #ifndef PROP_MISC_EQUALITY_DEFINED
134 #define PROP_MISC_EQUALITY_DEFINED
135 #define _equal_integer(x,y) ((x) == (y))
136 #define _equal_real(x,y) ((x) == (y))
137 #define _equal_character(x,y) ((x) == (y))
138 #define _equal_boolean(x,y) ((x) == (y))
139 #define _equal_string(x,y) (strcmp(x,y) == 0)
140 #define _less_integer(x,y) ((x) < (y))
141 #define _less_real(x,y) ((x) < (y))
142 #define _less_character(x,y) ((x) < (y))
143 #define _less_boolean(x,y) ((x) < (y))
144 #define _less_string(x,y) (strcmp(x,y) < 0)
145 #endif
147 #ifdef PROP_EQUALITY_USED
148 #ifndef PROP_EQUALITY_DEFINED
149 #define PROP_EQUALITY_DEFINED
150 inline int equality_of(char x, char y) { return x == y; }
151 inline int equality_of(unsigned char x, unsigned char y) { return x == y; }
152 inline int equality_of(int x, int y) { return x == y; }
153 inline int equality_of(unsigned int x, unsigned int y) { return x == y; }
154 inline int equality_of(short x, short y) { return x == y; }
155 inline int equality_of(unsigned short x, unsigned short y) { return x == y; }
156 inline int equality_of(long x, long y) { return x == y; }
157 inline int equality_of(unsigned long x, unsigned long y) { return x == y; }
158 inline int equality_of(double x, double y) { return x == y; }
159 inline int equality_of(const char * x, const char * y)
160 { return strcmp(x,y) == 0;}
161 #endif
162 #endif
164 #ifdef PROP_TRACE_ON
165 # define PROP_TRACE(msg,file,line) prop_trace(msg,file,line)
166 # include <AD/prop/trace.h> // tracing
167 #endif
169 #ifdef PROP_TUPLE2_USED
170 # include <AD/prop/tuple2.h>
171 #endif
172 #ifdef PROP_TUPLE3_USED
173 # include <AD/prop/tuple3.h>
174 #endif
175 #ifdef PROP_TUPLE4_USED
176 # include <AD/prop/tuple4.h>
177 #endif
178 #ifdef PROP_TUPLE5_USED
179 # include <AD/prop/tuple5.h>
180 #endif
181 #ifdef PROP_TUPLE6_USED
182 # include <AD/prop/tuple6.h>
183 #endif
184 #ifdef PROP_TUPLE7_USED
185 # include <AD/prop/tuple7.h>
186 #endif
187 #ifdef PROP_TUPLE8_USED
188 # include <AD/prop/tuple8.h>
189 #endif
190 #ifdef PROP_TUPLE9_USED
191 # include <AD/prop/tuple9.h>
192 #endif
193 #ifdef PROP_TUPLE10_USED
194 # include <AD/prop/tuple10.h>
195 #endif
196 #ifdef PROP_TUPLE11_USED
197 # include <AD/prop/tuple11.h>
198 #endif
199 #ifdef PROP_TUPLE12_USED
200 # include <AD/prop/tuple12.h>
201 #endif