Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Macros | Typedefs | Functions | Variables
trace.h File Reference

Go to the source code of this file.

Macros

#define FOR_ANYTHING_TF   0 /* format applies to any object */
#define FOR_OPERATORS_TF   2 /* format applies only to operators */
#define FOR_STATES_TF   1 /* format applies only to states */

Typedefs

typedef struct agent_struct agent
typedef char Bool
typedef union symbol_union Symbol

Functions

Bool add_trace_format (agent *thisAgent, Bool stack_trace, int type_restriction, Symbol *name_restriction, const char *format_string)
void init_tracing (agent *thisAgent)
void print_all_trace_formats (agent *thisAgent, Bool stack_trace)
void print_all_trace_formats_tcl (Bool stack_trace)
void print_object_trace (agent *thisAgent, Symbol *object)
void print_stack_trace (agent *thisAgent, Symbol *object, Symbol *state, int slot_type, Bool allow_cycle_counts)
Bool remove_trace_format (agent *thisAgent, Bool stack_trace, int type_restriction, Symbol *name_restriction)

Variables

char * help_on_trace_format_escapes []

Macro Definition Documentation

#define FOR_ANYTHING_TF   0 /* format applies to any object */
#define FOR_OPERATORS_TF   2 /* format applies only to operators */
#define FOR_STATES_TF   1 /* format applies only to states */

Typedef Documentation

typedef struct agent_struct agent

Definition at line 53 of file trace.h.

typedef char Bool

Definition at line 52 of file trace.h.

typedef union symbol_union Symbol

Definition at line 54 of file trace.h.

Function Documentation

Bool add_trace_format ( agent thisAgent,
Bool  stack_trace,
int  type_restriction,
Symbol name_restriction,
const char *  format_string 
)

Definition at line 727 of file trace.cpp.

References add_to_hash_table(), allocate_memory(), FALSE, tracing_rule_struct::format, MISCELLANEOUS_MEM_USAGE, tracing_rule_struct::name_restriction, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, parse_format_string(), remove_trace_format(), agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, symbol_add_ref(), TRUE, and tracing_rule_struct::type_restriction.

Referenced by init_soar_agent(), set_print_trace_formats(), and set_tagged_trace_formats().

{
trace_format *new_tf;
/* --- parse the format string into a trace_format --- */
new_tf = parse_format_string (thisAgent, format_string);
if (!new_tf) return FALSE;
/* --- first remove any existing trace format with same conditions --- */
remove_trace_format (thisAgent, stack_trace, type_restriction, name_restriction);
/* --- now add the new one --- */
if (name_restriction) {
symbol_add_ref (name_restriction);
if (stack_trace)
ht = thisAgent->stack_tr_ht[type_restriction];
else
ht = thisAgent->object_tr_ht[type_restriction];
tr = static_cast<tracing_rule_struct *>(allocate_memory (thisAgent, sizeof(tracing_rule),
tr->type_restriction = type_restriction;
tr->name_restriction = name_restriction;
tr->format = new_tf;
add_to_hash_table (thisAgent, ht, tr);
return TRUE;
}
/* --- no name restriction --- */
if (stack_trace)
thisAgent->stack_tf_for_anything[type_restriction] = new_tf;
else
thisAgent->object_tf_for_anything[type_restriction] = new_tf;
return TRUE;
}
void init_tracing ( agent thisAgent)
void print_all_trace_formats ( agent thisAgent,
Bool  stack_trace 
)
void print_all_trace_formats_tcl ( Bool  stack_trace)
void print_object_trace ( agent thisAgent,
Symbol object 
)
void print_stack_trace ( agent thisAgent,
Symbol object,
Symbol state,
int  slot_type,
Bool  allow_cycle_counts 
)
Bool remove_trace_format ( agent thisAgent,
Bool  stack_trace,
int  type_restriction,
Symbol name_restriction 
)

Definition at line 691 of file trace.cpp.

References hash_table_struct::buckets, deallocate_trace_format_list(), FALSE, format, tracing_rule_struct::format, free_memory(), hash_name_restriction(), hash_table_struct::log2size, MISCELLANEOUS_MEM_USAGE, tracing_rule_struct::name_restriction, tracing_rule_struct::next_in_hash_bucket, NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, remove_from_hash_table(), agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, symbol_remove_ref(), TRUE, tracing_rule_struct::type_restriction, and uint32_t().

Referenced by add_trace_format(), and destroy_soar_agent().

{
uint32_t hash_value;
if (name_restriction) {
if (stack_trace)
ht = thisAgent->stack_tr_ht[type_restriction];
else
ht = thisAgent->object_tr_ht[type_restriction];
hash_value = hash_name_restriction (name_restriction, ht->log2size);
tr = reinterpret_cast<tracing_rule *>(*(ht->buckets + hash_value));
for ( ; tr!=NIL; tr = tr->next_in_hash_bucket)
if (tr->name_restriction==name_restriction) break;
if (! tr) return FALSE;
remove_from_hash_table (thisAgent, ht, tr);
symbol_remove_ref (thisAgent, name_restriction);
return TRUE;
}
/* --- no name restriction --- */
if (stack_trace)
format = &(thisAgent->stack_tf_for_anything[type_restriction]);
else
format = &(thisAgent->object_tf_for_anything[type_restriction]);
if (! *format) return FALSE;
deallocate_trace_format_list (thisAgent, *format);
*format = NIL;
return TRUE;
}

Variable Documentation

char* help_on_trace_format_escapes[]