1 //////////////////////////////////////////////////////////////////////////////
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
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
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)
23 //////////////////////////////////////////////////////////////////////////////
25 //////////////////////////////////////////////////////////////////////////////
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
40 #ifdef PROP_GARBAGE_COLLECTION_USED
41 // Garbage collection support
42 # include <AD/gc/gcobject.h> // garbage collectable object base class
45 #ifdef PROP_HASH_CONSING_USED
46 // Hash consing support
47 # include <AD/hash/lhash.h> // linear probing hash table
50 #ifdef PROP_LEXER_USED
52 # include <AD/automata/scanner.h>
55 #ifdef PROP_PARSER_USED
57 # include <AD/automata/lrparser.h>
60 #ifdef PROP_INFERENCE_USED
62 # include <AD/rete/rete.h> // Rete network driver
65 #ifdef PROP_REWRITING_USED
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
74 #ifdef PROP_UNIFICATION_USED
75 // Unification/constraint satisfaction support
76 // # include <AD/csp/logicalterm.h> // logical(unifiable) term
79 #ifdef PROP_REGEXP_MATCHING_USED
80 // regular expression string matching support
81 # include <AD/automata/regexmat.h> // Regular expression string matcher
84 #ifdef PROP_PRINTER_USED
85 // pretty printing support
86 # include <AD/pretty/postream.h> // pretty printer routines
89 #if defined(PROP_STRCMP_USED) || defined(PROP_EQUALITY_USED)
91 # include <string.h> // standard string support
94 #ifdef PROP_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
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
107 #ifdef PROP_VECTOR_USED
109 // Template for calling the constructor
110 // (without allocating any memory)
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
); }
118 #ifdef PROP_QUARK_USED
119 # include <AD/strings/quark.h>
122 #ifdef PROP_BIGINT_USED
123 # include <AD/numeric/bigint.h>
126 #ifdef PROP_GRAPHTYPE_USED
127 # include <AD/graphtype/graphtype.h>
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)
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;}
165 # define PROP_TRACE(msg,file,line) prop_trace(msg,file,line)
166 # include <AD/prop/trace.h> // tracing
169 #ifdef PROP_TUPLE2_USED
170 # include <AD/prop/tuple2.h>
172 #ifdef PROP_TUPLE3_USED
173 # include <AD/prop/tuple3.h>
175 #ifdef PROP_TUPLE4_USED
176 # include <AD/prop/tuple4.h>
178 #ifdef PROP_TUPLE5_USED
179 # include <AD/prop/tuple5.h>
181 #ifdef PROP_TUPLE6_USED
182 # include <AD/prop/tuple6.h>
184 #ifdef PROP_TUPLE7_USED
185 # include <AD/prop/tuple7.h>
187 #ifdef PROP_TUPLE8_USED
188 # include <AD/prop/tuple8.h>
190 #ifdef PROP_TUPLE9_USED
191 # include <AD/prop/tuple9.h>
193 #ifdef PROP_TUPLE10_USED
194 # include <AD/prop/tuple10.h>
196 #ifdef PROP_TUPLE11_USED
197 # include <AD/prop/tuple11.h>
199 #ifdef PROP_TUPLE12_USED
200 # include <AD/prop/tuple12.h>