Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kernel.h
Go to the documentation of this file.
1 /*************************************************************************
2  * PLEASE SEE THE FILE "license.txt" (INCLUDED WITH THIS SOFTWARE PACKAGE)
3  * FOR LICENSE AND COPYRIGHT INFORMATION.
4  *************************************************************************/
5 
6 /* kernel.h */
7 
8 #ifndef KERNEL_H
9 #define KERNEL_H
10 
11 #ifdef __cplusplus
12 //extern "C"
13 //{
14 #endif
15 
16 /* When the Soar Kernel was moved to a C++ compiler, the
17  * C precompiler macros were converted to inline functions
18  * The macros still work, but can make it confusing to step
19  * through a debugger during code execution. However it's
20  * possible that some compilers on some operating systems
21  * would not inline the code properly, making Soar slower
22  * and consuming more memory. To use the precompiler macros
23  * instead of the inline functions, define the variable below.
24  */
25 //#define USE_MACROS
26 
27 /* -------------------------------------------------- */
28 /* Names of Rete Structures */
29 /* (only pointers to these are used outside the rete) */
30 /* -------------------------------------------------- */
31 
32 struct token_struct;
33 struct rete_node_struct;
34 
35 /* REW: begin 08.20.97 */
36 /* The ms_change_struct is exported to the entire system
37  (for better or worse) so
38  this restricted definition is no longer necessary. */
39 /* struct ms_change_struct; */
40 /* REW: end 08.20.97 */
41 
42 /* -------------------------------------------------------------------- */
43 /* */
44 /* Macros for handling multi-agent switching in Soar. */
45 
46 //#ifdef USE_X_DISPLAY
47 //#include <X11/Xlib.h>
48 //#include <X11/Xutil.h>
49 //
50 //typedef struct x_info_struct {
51 // Window parent_window;
52 // Window window;
53 // GC gc;
54 // XFontStruct * font_struct;
55 // int char_height;
56 // char input_buffer[2000];
57 // int input_buffer_index;
58 // int window_x;
59 // int window_y;
60 // int width;
61 // int height;
62 // uint64_t foreground;
63 // uint64_t background;
64 // int borderwidth;
65 // Symbol * last_op_id; /* Used in monitors */
66 //} x_info;
67 //#endif
68 
69 
70 /* These functions define the protocol functions for the X interface to */
71 /* Soar. */
72 
73 //#ifdef USE_X_DISPLAY
74 // extern char * x_input_buffer;
75 // extern int x_input_buffer_index;
76 // extern Bool waiting_for_command;
77 // extern void create_agent_window (agent *, char * agent_class);
78 // extern void create_monitor_window (agent *, char * command);
79 // extern void handle_soar_x_events (void);
80 // extern void refresh_monitor_window (agent *);
81 // extern void destroy_soar_display (void);
82 //
83 // extern Bool text_io_mode;
84 //
85 //#ifdef USE_STDARGS
86 // extern void print_x_format_string (x_info * window, char *format, ... );
87 //#else
88 // extern void print_x_format_string ();
89 //#endif
90 //
91 //#endif /* USE_X_DISPLAY */
92 //
93 /* This is deprecated. -AJC (8/9/02) */
94 //extern char * c_interrupt_msg;
95 
96 
97 #ifdef __cplusplus
98 //#define extern extern "C"
99 #endif
100 
101 /* necessary for function prototypes below */
102 typedef union symbol_union Symbol;
103 
104 /* Uncomment the following line to debug memory usage */
105 /* #define DEBUG_MEMORY */
106 /* #define DEBUG_SYMBOL_REFCOUNTS */
107 
108 /* Comment out the following line to avoid the overhead of keeping statistics
109  on memory pool usage */
110 //#define MEMORY_POOL_STATS
111 
112 /* Uncomment the following line to eliminate all timing statistics.
113  The "stats" command will have much shorter output as well. */
114 //#define NO_TIMING_STUFF
115 
116 /* Comment out the following line to avoid the overhead of keeping statistics
117  on how much time is spent in various parts of the system. If you
118  have DETAILED_TIMING_STATS defined, you must NOT define NO_TIMING_STUFF */
119 #ifndef NO_TIMING_STUFF
120 //#define DETAILED_TIMING_STATS
121 #endif // NO_TIMING_STUFF
122 
123 /* UNcomment the following line to have Soar maintain reference counts
124  on wmes and prefs at the top level. This can result in larger
125  memory growth due to top-level objects that never get deallocated
126  because the ref counts never drop to 0. The default for Soar v6 - v8.6.1
127  was to maintain the ref cts. It's possible that in your particular
128  application, weird things could happen if you don't do these ref cts,
129  but if you are trying to improve performance and reduce memory, it's
130  worth testing your system with the top-level-ref-cts turned off.
131  Soar will be much more efficient. See comments in recmem.cpp */
132 /* #define DO_TOP_LEVEL_REF_CTS */
133 
134 /* UNcomment the following line to get some marginally useful msgs
135  about creating chunk names. */
136 /* #define DEBUG_CHUNK_NAMES */
137 
138 /* UnComment the following lines if you want to use X windows rather */
139 /* than standard I/O and are not using Tcl. */
140 /* #ifndef USE_TCL */
141 /* #define USE_X_DISPLAY */
142 /* #endif */ /* #ifndef USE_TCL */
143 
144 /* Possible modes for numeric indifference */
145 enum ni_mode {
148 };
149 
150 /* Comment the following line to disable workaround for bug 139 */
151 #define BUG_139_WORKAROUND
152 
153 /* UnComment the following to print a warning whenever we
154  are ignoring a situation when there's no instance to retract for a justification */
155 /*#define BUG_139_WORKAROUND_WARNING*/
156 
157 /* UnComment the following to enable Soar to deal with certain productions in a more
158  intuitive manner. In particular, productions that modify a wme value by reject
159  its current value and asserting its new value need to ensure that the current and
160  new values differ. This option may add a small run time cost, since two loops are made
161  through the preferences list. */
162 #define O_REJECTS_FIRST
163 
173 //#define AGRESSIVE_ONC
174 
175 /* --------------------------- */
176 /* Current Soar version number */
177 /* --------------------------- */
178 
179 #define BUFFER_MSG_SIZE 128
180 
181 //extern char * soar_version_string;
182 //extern char * soar_news_string;
183 
184 /* REW: begin 05.05.97 */
185 #define OPERAND2_MODE_NAME "Operand2/Waterfall"
186 /* REW: end 05.05.97 */
187 
188 /* --------------------------------------------------------- */
189 /* Line width of terminal (used for neatly formatted output) */
190 /* --------------------------------------------------------- */
191 
192 #define COLUMNS_PER_LINE 80
193 
194 /* ------------------------------ */
195 /* Global type declarations, etc. */
196 /* ------------------------------ */
197 
198 /* ----------------- */
199 /* Goal Stack Levels */
200 /* ----------------- */
201 
202 typedef signed short goal_stack_level;
203 #define TOP_GOAL_LEVEL 1
204 #define ATTRIBUTE_IMPASSE_LEVEL 32767
205 #define LOWEST_POSSIBLE_GOAL_LEVEL 32767
206 
207 /* --------------------------------------------------------------------
208  Transitive Closure Numbers
209 
210  In many places, we do transitive closures or some similar process in
211  which we mark identifiers and/or variables so as not to repeat them
212  later. Marking is done by setting the "tc_num" field of the symbol
213  to the "current transitive closure number". We don't have to go
214  back and unmark stuff when done--we just increment the current
215  transitive closure number next time. Whenever we need to start a
216  new marking, we call get_new_tc_number() (see production.cpp
217  comments below).
218 -------------------------------------------------------------------- */
219 
220 typedef char Bool;
221 typedef uint64_t tc_number;
222 typedef unsigned char byte;
223 typedef struct agent_struct agent;
224 
225 /*typedef char bool;
226 #ifndef __cplusplus
227 #define bool char
228 #endif*/
229 
230 /* Some compilers define these. */
231 #ifndef TRUE
232 #define TRUE (1)
233 #endif
234 #ifndef FALSE
235 #define FALSE (0)
236 #endif
237 
238 #define NIL (0)
239 
240 /* functions defined in Soar\kernel that are not prototyped in any other header */
241 
242 /*
243 static char *xmalloc (agent* thisAgent, int bytes);
244 static char *xrealloc (agent* thisAgent, char *pointer, int bytes);
245 void print (char *format, ... );
246 */
247 
248 /*void Soar_LogAndPrint (agent* thisAgent, agent * the_agent, char * str);*/
249 
250 /* This is defined in the Soar interface. */
251 /*extern void do_print_for_identifier (Symbol *id, int depth, Bool internal);*/
252 
253 #ifdef __cplusplus
254 //#undef extern
255 #endif
256 
257 #ifdef __cplusplus
258 //}
259 #endif
260 
261 #endif
262