Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
trace.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 /* ======================================================================
7  trace.h
8 
9  Object and stack trace formats are managed by this module.
10 
11  Init_tracing() initializes the tables; at this point, there are no trace
12  formats for anything. This routine should be called at startup time.
13 
14  Trace formats are changed by calls to add_trace_format() and
15  remove_trace_format(). Add_trace_format() returns TRUE if the
16  format was successfully added, or FALSE if the format string didn't
17  parse right. Remove_trace_format() returns TRUE if a trace format
18  was actually removed, or FALSE if there was no such trace format for
19  the given type/name restrictions. These routines take a "stack_trace"
20  argument, which should be TRUE if the stack trace format is intended,
21  or FALSE if the object trace format is intended. Their
22  "type_restriction" argument should be one of FOR_ANYTHING_TF, ...,
23  FOR_OPERATORS_TF. The "name_restriction" argument should be either
24  a pointer to a symbol, if the trace format is restricted to apply
25  to objects with that name, or NIL if the format can apply to any object.
26 
27  Print_all_trace_formats() prints out either all existing stack trace
28  or object trace formats.
29 
30  Print_object_trace() takes an object (any symbol). It prints the
31  trace for that object. Print_stack_trace() takes a (context)
32  object (the state or op), the current state, the "slot_type"
33  (one of FOR_OPERATORS_TF, etc.), and a flag indicating whether to
34  allow %dc and %ec escapes (this flag should normally be TRUE for
35  watch 0 traces but FALSE during a "print -stack" command). It prints
36  the stack trace for that context object.
37 ====================================================================== */
38 
39 #ifndef TRACE_H
40 #define TRACE_H
41 
42 #ifdef __cplusplus
43 //extern "C"
44 //{
45 #endif
46 
47 /* trace format type restrictions */
48 #define FOR_ANYTHING_TF 0 /* format applies to any object */
49 #define FOR_STATES_TF 1 /* format applies only to states */
50 #define FOR_OPERATORS_TF 2 /* format applies only to operators */
51 
52 typedef char Bool;
53 typedef struct agent_struct agent;
54 typedef union symbol_union Symbol;
55 
56 extern void init_tracing (agent* thisAgent);
57 extern Bool add_trace_format (agent* thisAgent, Bool stack_trace, int type_restriction,
58  Symbol *name_restriction, const char *format_string);
59 extern Bool remove_trace_format (agent* thisAgent, Bool stack_trace, int type_restriction,
60  Symbol *name_restriction);
61 extern void print_all_trace_formats (agent* thisAgent, Bool stack_trace);
62 //#ifdef USE_TCL
63 extern void print_all_trace_formats_tcl (Bool stack_trace);
64 //#endif /* USE_TCL */
65 extern void print_object_trace (agent* thisAgent, Symbol *object);
66 extern void print_stack_trace (agent* thisAgent, Symbol *object, Symbol *state, int slot_type,
67  Bool allow_cycle_counts);
68 
69 extern char * help_on_trace_format_escapes[];
70 
71 #ifdef __cplusplus
72 //}
73 #endif
74 
75 #endif
76