Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Macros | Functions
symtab.cpp File Reference
#include <portability.h>
#include <stdlib.h>
#include "symtab.h"
#include "mem.h"
#include "kernel.h"
#include "agent.h"
#include "production.h"
#include "init_soar.h"
#include "print.h"
#include "xml.h"
#include <ctype.h>

Go to the source code of this file.

Macros

#define GENERATE_NEW_SYM_CONSTANT_BUFFER_SIZE   2000 /* that ought to be long enough! */

Functions

uint32_t compress (uint32_t h, short num_bits)
void create_predefined_symbols (agent *thisAgent)
void deallocate_symbol (agent *thisAgent, Symbol *sym)
Symbolfind_float_constant (agent *thisAgent, double value)
Symbolfind_identifier (agent *thisAgent, char name_letter, uint64_t name_number)
Symbolfind_int_constant (agent *thisAgent, int64_t value)
Symbolfind_sym_constant (agent *thisAgent, const char *name)
Symbolfind_variable (agent *thisAgent, const char *name)
Symbolgenerate_new_sym_constant (agent *thisAgent, const char *prefix, uint64_t *counter)
uint32_t get_next_symbol_hash_id (agent *thisAgent)
uint32_t hash_float_constant (void *item, short num_bits)
uint32_t hash_float_constant_raw_info (double value, short num_bits)
uint32_t hash_identifier (void *item, short num_bits)
uint32_t hash_identifier_raw_info (char name_letter, uint64_t name_number, short num_bits)
uint32_t hash_int_constant (void *item, short num_bits)
uint32_t hash_int_constant_raw_info (int64_t value, short num_bits)
uint32_t hash_string (const char *s)
uint32_t hash_sym_constant (void *item, short num_bits)
uint32_t hash_sym_constant_raw_info (const char *name, short num_bits)
uint32_t hash_variable (void *item, short num_bits)
uint32_t hash_variable_raw_info (const char *name, short num_bits)
void init_symbol_tables (agent *thisAgent)
Symbolmake_float_constant (agent *thisAgent, double value)
Symbolmake_int_constant (agent *thisAgent, int64_t value)
Symbolmake_new_identifier (agent *thisAgent, char name_letter, goal_stack_level level, uint64_t name_number)
Symbolmake_sym_constant (agent *thisAgent, char const *name)
Symbolmake_variable (agent *thisAgent, const char *name)
Bool print_identifier_ref_info (agent *thisAgent, void *item, void *userdata)
void print_internal_symbols (agent *thisAgent)
Bool print_sym (agent *thisAgent, void *item, void *)
void release_helper (agent *thisAgent, Symbol **sym)
void release_predefined_symbols (agent *thisAgent)
Bool reset_gensym_number (agent *, void *item, void *)
void reset_id_and_variable_tc_numbers (agent *thisAgent)
bool reset_id_counters (agent *thisAgent)
Bool reset_tc_num (agent *, void *item, void *)
void reset_variable_gensym_numbers (agent *thisAgent)

Macro Definition Documentation

#define GENERATE_NEW_SYM_CONSTANT_BUFFER_SIZE   2000 /* that ought to be long enough! */

Function Documentation

uint32_t compress ( uint32_t  h,
short  num_bits 
)

Definition at line 62 of file symtab.cpp.

References masks_for_n_low_order_bits, and uint32_t().

Referenced by hash_float_constant(), hash_float_constant_raw_info(), hash_identifier(), hash_identifier_raw_info(), hash_int_constant(), hash_int_constant_raw_info(), hash_sym_constant(), hash_sym_constant_raw_info(), hash_variable(), and hash_variable_raw_info().

{
uint32_t result;
if (num_bits < 16) h = (h & 0xFFFF) ^ (h >> 16);
if (num_bits < 8) h = (h & 0xFF) ^ (h >> 8);
result = 0;
while (h) {
result ^= (h & masks_for_n_low_order_bits[num_bits]);
h = h >> num_bits;
}
return result;
}
void create_predefined_symbols ( agent thisAgent)

Definition at line 660 of file symtab.cpp.

References agent_struct::attribute_symbol, agent_struct::choices_symbol, agent_struct::conflict_symbol, agent_struct::constraint_failure_symbol, agent_struct::epmem_sym, agent_struct::epmem_sym_after, agent_struct::epmem_sym_bad_cmd, agent_struct::epmem_sym_before, agent_struct::epmem_sym_cmd, agent_struct::epmem_sym_cue_size, agent_struct::epmem_sym_current, agent_struct::epmem_sym_failure, agent_struct::epmem_sym_graph_match, agent_struct::epmem_sym_graph_match_mapping, agent_struct::epmem_sym_graph_match_mapping_cue, agent_struct::epmem_sym_graph_match_mapping_node, agent_struct::epmem_sym_match_cardinality, agent_struct::epmem_sym_match_score, agent_struct::epmem_sym_memory_id, agent_struct::epmem_sym_negquery, agent_struct::epmem_sym_next, agent_struct::epmem_sym_no, agent_struct::epmem_sym_no_memory, agent_struct::epmem_sym_normalized_match_score, agent_struct::epmem_sym_present_id, agent_struct::epmem_sym_prev, agent_struct::epmem_sym_prohibit, agent_struct::epmem_sym_query, agent_struct::epmem_sym_result, agent_struct::epmem_sym_retrieve, agent_struct::epmem_sym_retrieved, agent_struct::epmem_sym_status, agent_struct::epmem_sym_success, agent_struct::epmem_sym_yes, agent_struct::goal_symbol, agent_struct::impasse_symbol, agent_struct::input_link_symbol, agent_struct::io_symbol, agent_struct::item_count_symbol, agent_struct::item_symbol, make_sym_constant(), make_variable(), agent_struct::multiple_symbol, agent_struct::name_symbol, agent_struct::nil_symbol, agent_struct::no_change_symbol, agent_struct::non_numeric_count_symbol, agent_struct::non_numeric_symbol, agent_struct::none_symbol, agent_struct::o_context_variable, agent_struct::object_symbol, agent_struct::operator_symbol, agent_struct::output_link_symbol, agent_struct::problem_space_symbol, agent_struct::quiescence_symbol, agent_struct::rl_sym_reward, agent_struct::rl_sym_reward_link, agent_struct::rl_sym_value, agent_struct::s_context_variable, agent_struct::smem_sym, agent_struct::smem_sym_bad_cmd, agent_struct::smem_sym_cmd, agent_struct::smem_sym_failure, agent_struct::smem_sym_negquery, agent_struct::smem_sym_prohibit, agent_struct::smem_sym_query, agent_struct::smem_sym_result, agent_struct::smem_sym_retrieve, agent_struct::smem_sym_retrieved, agent_struct::smem_sym_status, agent_struct::smem_sym_store, agent_struct::smem_sym_success, agent_struct::so_context_variable, agent_struct::ss_context_variable, agent_struct::sso_context_variable, agent_struct::sss_context_variable, agent_struct::state_symbol, agent_struct::superstate_symbol, agent_struct::t_symbol, agent_struct::tie_symbol, agent_struct::to_context_variable, agent_struct::ts_context_variable, agent_struct::type_symbol, and agent_struct::wait_symbol.

Referenced by init_soar_agent().

{
thisAgent->problem_space_symbol = make_sym_constant (thisAgent, "problem-space");
thisAgent->state_symbol = make_sym_constant (thisAgent, "state");
thisAgent->operator_symbol = make_sym_constant (thisAgent, "operator");
thisAgent->superstate_symbol = make_sym_constant (thisAgent, "superstate");
thisAgent->io_symbol = make_sym_constant (thisAgent, "io");
thisAgent->object_symbol = make_sym_constant (thisAgent, "object");
thisAgent->attribute_symbol = make_sym_constant (thisAgent, "attribute");
thisAgent->impasse_symbol = make_sym_constant (thisAgent, "impasse");
thisAgent->choices_symbol = make_sym_constant (thisAgent, "choices");
thisAgent->none_symbol = make_sym_constant (thisAgent, "none");
thisAgent->constraint_failure_symbol = make_sym_constant (thisAgent, "constraint-failure");
thisAgent->no_change_symbol = make_sym_constant (thisAgent, "no-change");
thisAgent->multiple_symbol = make_sym_constant (thisAgent, "multiple");
// SBW 5/07
thisAgent->item_count_symbol = make_sym_constant (thisAgent, "item-count");
// NLD 11/11
thisAgent->non_numeric_count_symbol = make_sym_constant( thisAgent, "non-numeric-count" );
thisAgent->conflict_symbol = make_sym_constant (thisAgent, "conflict");
thisAgent->tie_symbol = make_sym_constant (thisAgent, "tie");
thisAgent->item_symbol = make_sym_constant (thisAgent, "item");
thisAgent->non_numeric_symbol = make_sym_constant (thisAgent, "non-numeric");
thisAgent->quiescence_symbol = make_sym_constant (thisAgent, "quiescence");
thisAgent->t_symbol = make_sym_constant (thisAgent, "t");
thisAgent->nil_symbol = make_sym_constant (thisAgent, "nil");
thisAgent->type_symbol = make_sym_constant (thisAgent, "type");
thisAgent->goal_symbol = make_sym_constant (thisAgent, "goal");
thisAgent->name_symbol = make_sym_constant (thisAgent, "name");
thisAgent->ts_context_variable = make_variable (thisAgent, "<ts>");
thisAgent->to_context_variable = make_variable (thisAgent, "<to>");
thisAgent->sss_context_variable = make_variable (thisAgent, "<sss>");
thisAgent->sso_context_variable = make_variable (thisAgent, "<sso>");
thisAgent->ss_context_variable = make_variable (thisAgent, "<ss>");
thisAgent->so_context_variable = make_variable (thisAgent, "<so>");
thisAgent->s_context_variable = make_variable (thisAgent, "<s>");
thisAgent->o_context_variable = make_variable (thisAgent, "<o>");
/* REW: begin 10.24.97 */
thisAgent->wait_symbol = make_variable (thisAgent, "wait");
/* REW: end 10.24.97 */
/* RPM 9/06 begin */
thisAgent->input_link_symbol = make_sym_constant(thisAgent, "input-link");
thisAgent->output_link_symbol = make_sym_constant(thisAgent, "output-link");
/* RPM 9/06 end */
thisAgent->rl_sym_reward_link = make_sym_constant( thisAgent, "reward-link" );
thisAgent->rl_sym_reward = make_sym_constant( thisAgent, "reward" );
thisAgent->rl_sym_value = make_sym_constant( thisAgent, "value" );
thisAgent->epmem_sym = make_sym_constant( thisAgent, "epmem" );
thisAgent->epmem_sym_cmd = make_sym_constant( thisAgent, "command" );
thisAgent->epmem_sym_result = make_sym_constant( thisAgent, "result" );
thisAgent->epmem_sym_retrieved = make_sym_constant( thisAgent, "retrieved" );
thisAgent->epmem_sym_status = make_sym_constant( thisAgent, "status" );
thisAgent->epmem_sym_match_score = make_sym_constant( thisAgent, "match-score" );
thisAgent->epmem_sym_cue_size = make_sym_constant( thisAgent, "cue-size" );
thisAgent->epmem_sym_normalized_match_score = make_sym_constant( thisAgent, "normalized-match-score" );
thisAgent->epmem_sym_match_cardinality = make_sym_constant( thisAgent, "match-cardinality" );
thisAgent->epmem_sym_memory_id = make_sym_constant( thisAgent, "memory-id" );
thisAgent->epmem_sym_present_id = make_sym_constant( thisAgent, "present-id" );
thisAgent->epmem_sym_no_memory = make_sym_constant( thisAgent, "no-memory" );
thisAgent->epmem_sym_graph_match = make_sym_constant( thisAgent, "graph-match" );
thisAgent->epmem_sym_graph_match_mapping = make_sym_constant( thisAgent, "mapping" );
thisAgent->epmem_sym_graph_match_mapping_node = make_sym_constant( thisAgent, "node" );
thisAgent->epmem_sym_graph_match_mapping_cue = make_sym_constant( thisAgent, "cue" );
thisAgent->epmem_sym_success = make_sym_constant( thisAgent, "success" );
thisAgent->epmem_sym_failure = make_sym_constant( thisAgent, "failure" );
thisAgent->epmem_sym_bad_cmd = make_sym_constant( thisAgent, "bad-cmd" );
thisAgent->epmem_sym_retrieve = make_sym_constant( thisAgent, "retrieve" );
thisAgent->epmem_sym_next = make_sym_constant( thisAgent, "next" );
thisAgent->epmem_sym_prev = make_sym_constant( thisAgent, "previous" );
thisAgent->epmem_sym_query = make_sym_constant( thisAgent, "query" );
thisAgent->epmem_sym_negquery = make_sym_constant( thisAgent, "neg-query" );
thisAgent->epmem_sym_before = make_sym_constant( thisAgent, "before" );
thisAgent->epmem_sym_after = make_sym_constant( thisAgent, "after" );
thisAgent->epmem_sym_prohibit = make_sym_constant( thisAgent, "prohibit" );
thisAgent->epmem_sym_current = make_sym_constant( thisAgent, "current" );
thisAgent->epmem_sym_yes = make_sym_constant( thisAgent, "yes" );
thisAgent->epmem_sym_no = make_sym_constant( thisAgent, "no" );
thisAgent->smem_sym = make_sym_constant( thisAgent, "smem" );
thisAgent->smem_sym_cmd = make_sym_constant( thisAgent, "command" );
thisAgent->smem_sym_result = make_sym_constant( thisAgent, "result" );
thisAgent->smem_sym_retrieved = make_sym_constant( thisAgent, "retrieved" );
thisAgent->smem_sym_status = make_sym_constant( thisAgent, "status" );
thisAgent->smem_sym_success = make_sym_constant( thisAgent, "success" );
thisAgent->smem_sym_failure = make_sym_constant( thisAgent, "failure" );
thisAgent->smem_sym_bad_cmd = make_sym_constant( thisAgent, "bad-cmd" );
thisAgent->smem_sym_retrieve = make_sym_constant( thisAgent, "retrieve" );
thisAgent->smem_sym_query = make_sym_constant( thisAgent, "query" );
thisAgent->smem_sym_negquery = make_sym_constant( thisAgent, "neg-query" );
thisAgent->smem_sym_prohibit = make_sym_constant( thisAgent, "prohibit" );
thisAgent->smem_sym_store = make_sym_constant( thisAgent, "store" );
}
void deallocate_symbol ( agent thisAgent,
Symbol sym 
)

Definition at line 451 of file symtab.cpp.

References abort_with_fatal_error(), BUFFER_MSG_SIZE, agent_struct::float_constant_hash_table, agent_struct::float_constant_pool, FLOAT_CONSTANT_SYMBOL_TYPE, free_memory_block_for_string(), agent_struct::identifier_hash_table, agent_struct::identifier_pool, IDENTIFIER_SYMBOL_TYPE, agent_struct::int_constant_hash_table, agent_struct::int_constant_pool, INT_CONSTANT_SYMBOL_TYPE, sym_constant_struct::name, variable_struct::name, print_with_symbols(), remove_from_hash_table(), symbol_union::sc, agent_struct::sym_constant_hash_table, agent_struct::sym_constant_pool, SYM_CONSTANT_SYMBOL_TYPE, symbol_union::var, agent_struct::variable_hash_table, agent_struct::variable_pool, and VARIABLE_SYMBOL_TYPE.

Referenced by symbol_remove_ref().

{
#ifdef DEBUG_SYMBOLS
print_with_symbols (thisAgent, "\nDeallocating Symbol %y", sym);
#endif
switch (sym->common.symbol_type) {
remove_from_hash_table (thisAgent, thisAgent->variable_hash_table, sym);
free_with_pool (&thisAgent->variable_pool, sym);
break;
remove_from_hash_table (thisAgent, thisAgent->identifier_hash_table, sym);
free_with_pool (&thisAgent->identifier_pool, sym);
break;
remove_from_hash_table (thisAgent, thisAgent->sym_constant_hash_table, sym);
free_with_pool (&thisAgent->sym_constant_pool, sym);
break;
remove_from_hash_table (thisAgent, thisAgent->int_constant_hash_table, sym);
free_with_pool (&thisAgent->int_constant_pool, sym);
break;
remove_from_hash_table (thisAgent, thisAgent->float_constant_hash_table, sym);
free_with_pool (&thisAgent->float_constant_pool, sym);
break;
default:
{ char msg[BUFFER_MSG_SIZE];
strncpy (msg, "Internal error: called deallocate_symbol on non-symbol.\n", BUFFER_MSG_SIZE);
msg[BUFFER_MSG_SIZE - 1] = 0; /* ensure null termination */
abort_with_fatal_error(thisAgent, msg);
}
}
}
Symbol* find_float_constant ( agent thisAgent,
double  value 
)

Definition at line 245 of file symtab.cpp.

References hash_table_struct::buckets, symbol_union::fc, agent_struct::float_constant_hash_table, hash_float_constant_raw_info(), hash_table_struct::log2size, NIL, uint32_t(), and float_constant_struct::value.

Referenced by make_float_constant().

{
uint32_t hash_value;
Symbol *sym;
hash_value = hash_float_constant_raw_info (value,
sym = reinterpret_cast<Symbol *>(*(thisAgent->float_constant_hash_table->buckets + hash_value));
for ( ; sym!=NIL; sym = sym->common.next_in_hash_table) {
if (value==sym->fc.value) return sym;
}
return NIL;
}
Symbol* find_identifier ( agent thisAgent,
char  name_letter,
uint64_t  name_number 
)

Definition at line 205 of file symtab.cpp.

References hash_table_struct::buckets, hash_identifier_raw_info(), symbol_union::id, agent_struct::identifier_hash_table, hash_table_struct::log2size, identifier_struct::name_letter, identifier_struct::name_number, NIL, and uint32_t().

Referenced by get_io_identifier(), read_id_or_context_var_from_string(), read_identifier_or_context_variable(), smem_lti_soar_make(), and smem_parse_chunks().

{
uint32_t hash_value;
Symbol *sym;
hash_value = hash_identifier_raw_info (name_letter,name_number,
sym = reinterpret_cast<Symbol *>(*(thisAgent->identifier_hash_table->buckets + hash_value));
for ( ; sym!=NIL; sym = sym->common.next_in_hash_table) {
if ((name_letter==sym->id.name_letter) &&
(name_number==sym->id.name_number)) return sym;
}
return NIL;
}
Symbol* find_int_constant ( agent thisAgent,
int64_t  value 
)

Definition at line 232 of file symtab.cpp.

References hash_table_struct::buckets, hash_int_constant_raw_info(), symbol_union::ic, agent_struct::int_constant_hash_table, hash_table_struct::log2size, NIL, uint32_t(), and int_constant_struct::value.

Referenced by make_int_constant().

{
uint32_t hash_value;
Symbol *sym;
hash_value = hash_int_constant_raw_info (value,
sym = reinterpret_cast<Symbol *>(*(thisAgent->int_constant_hash_table->buckets + hash_value));
for ( ; sym!=NIL; sym = sym->common.next_in_hash_table) {
if (value==sym->ic.value) return sym;
}
return NIL;
}
Symbol* find_sym_constant ( agent thisAgent,
const char *  name 
)
Symbol* find_variable ( agent thisAgent,
const char *  name 
)

Definition at line 193 of file symtab.cpp.

References hash_table_struct::buckets, hash_variable_raw_info(), hash_table_struct::log2size, variable_struct::name, NIL, uint32_t(), symbol_union::var, and agent_struct::variable_hash_table.

Referenced by get_context_var_info(), and make_variable().

{
uint32_t hash_value;
Symbol *sym;
hash_value = hash_variable_raw_info (name,thisAgent->variable_hash_table->log2size);
sym = reinterpret_cast<Symbol *>(*(thisAgent->variable_hash_table->buckets + hash_value));
for ( ; sym!=NIL; sym = sym->common.next_in_hash_table) {
if (!strcmp(sym->var.name,name)) return sym;
}
return NIL;
}
Symbol* generate_new_sym_constant ( agent thisAgent,
const char *  prefix,
uint64_t *  counter 
)

Definition at line 640 of file symtab.cpp.

References find_sym_constant(), GENERATE_NEW_SYM_CONSTANT_BUFFER_SIZE, make_sym_constant(), and TRUE.

Referenced by chunk_instantiation(), generate_chunk_name_sym_constant(), and make_constant_symbol_rhs_function_code().

{
#define GENERATE_NEW_SYM_CONSTANT_BUFFER_SIZE 2000 /* that ought to be long enough! */
Symbol *New;
while (TRUE) {
SNPRINTF (name,GENERATE_NEW_SYM_CONSTANT_BUFFER_SIZE, "%s%lu", prefix, static_cast<long unsigned int>((*counter)++));
if (! find_sym_constant (thisAgent, name)) break;
}
New = make_sym_constant (thisAgent, name);
return New;
}
uint32_t get_next_symbol_hash_id ( agent thisAgent)
inline
uint32_t hash_float_constant ( void *  item,
short  num_bits 
)

Definition at line 140 of file symtab.cpp.

References compress(), and float_constant_struct::value.

Referenced by init_symbol_tables().

{
fc = static_cast<float_constant_struct *>(item);
return compress (static_cast<uint32_t>(fc->value),num_bits);
}
uint32_t hash_float_constant_raw_info ( double  value,
short  num_bits 
)

Definition at line 108 of file symtab.cpp.

References compress().

Referenced by find_float_constant().

{
return compress (static_cast<uint32_t>(value), num_bits);
}
uint32_t hash_identifier ( void *  item,
short  num_bits 
)

Definition at line 122 of file symtab.cpp.

References compress(), identifier_struct::name_letter, and identifier_struct::name_number.

Referenced by init_symbol_tables().

{
id = static_cast<identifier_struct *>(item);
return compress (static_cast<uint32_t>(id->name_number) ^ (static_cast<uint32_t>(id->name_letter) << 24), num_bits); // FIXME: cast from 64 to 32 bits
}
uint32_t hash_identifier_raw_info ( char  name_letter,
uint64_t  name_number,
short  num_bits 
)

Definition at line 94 of file symtab.cpp.

References compress().

Referenced by find_identifier().

{
return compress (static_cast<uint32_t>(name_number) ^ (static_cast<uint32_t>(name_letter) << 24), num_bits); // FIXME: cast from 64 to 32 bits
}
uint32_t hash_int_constant ( void *  item,
short  num_bits 
)

Definition at line 134 of file symtab.cpp.

References compress(), and int_constant_struct::value.

Referenced by init_symbol_tables().

{
ic = static_cast<int_constant_struct *>(item);
return compress (static_cast<uint32_t>(ic->value),num_bits);
}
uint32_t hash_int_constant_raw_info ( int64_t  value,
short  num_bits 
)

Definition at line 104 of file symtab.cpp.

References compress().

Referenced by find_int_constant().

{
return compress (static_cast<uint32_t>(value), num_bits);
}
uint32_t hash_string ( const char *  s)

Definition at line 75 of file symtab.cpp.

References uint32_t().

Referenced by hash_sym_constant(), hash_sym_constant_raw_info(), hash_variable(), and hash_variable_raw_info().

{ /* AGR 600 */
h = 0;
while (*s != 0) {
h = ((h << 8) | (h >> 24)) ^ (*s);
s++;
}
return h;
}
uint32_t hash_sym_constant ( void *  item,
short  num_bits 
)

Definition at line 128 of file symtab.cpp.

References compress(), hash_string(), and sym_constant_struct::name.

Referenced by init_symbol_tables().

{
sc = static_cast<sym_constant_struct *>(item);
return compress (hash_string(sc->name),num_bits);
}
uint32_t hash_sym_constant_raw_info ( const char *  name,
short  num_bits 
)

Definition at line 100 of file symtab.cpp.

References compress(), and hash_string().

Referenced by find_sym_constant().

{
return compress (hash_string(name), num_bits);
}
uint32_t hash_variable ( void *  item,
short  num_bits 
)

Definition at line 116 of file symtab.cpp.

References compress(), hash_string(), and variable_struct::name.

Referenced by init_symbol_tables().

{
variable *var;
var = static_cast<variable_struct *>(item);
return compress (hash_string(var->name),num_bits);
}
uint32_t hash_variable_raw_info ( const char *  name,
short  num_bits 
)

Definition at line 90 of file symtab.cpp.

References compress(), and hash_string().

Referenced by find_variable().

{
return compress (hash_string(name), num_bits);
}
void init_symbol_tables ( agent thisAgent)

Definition at line 158 of file symtab.cpp.

References agent_struct::float_constant_hash_table, agent_struct::float_constant_pool, hash_float_constant(), hash_identifier(), hash_int_constant(), hash_sym_constant(), hash_variable(), agent_struct::identifier_hash_table, agent_struct::identifier_pool, init_memory_pool(), agent_struct::int_constant_hash_table, agent_struct::int_constant_pool, make_hash_table(), reset_id_counters(), agent_struct::sym_constant_hash_table, agent_struct::sym_constant_pool, agent_struct::variable_hash_table, and agent_struct::variable_pool.

Referenced by init_soar_agent().

{
thisAgent->variable_hash_table = make_hash_table (thisAgent, 0, hash_variable);
init_memory_pool (thisAgent, &thisAgent->variable_pool, sizeof(variable), "variable");
init_memory_pool (thisAgent, &thisAgent->identifier_pool, sizeof(identifier), "identifier");
init_memory_pool (thisAgent, &thisAgent->sym_constant_pool, sizeof(sym_constant), "sym constant");
init_memory_pool (thisAgent, &thisAgent->int_constant_pool, sizeof(int_constant), "int constant");
init_memory_pool (thisAgent, &thisAgent->float_constant_pool, sizeof(float_constant),
"float constant");
reset_id_counters( thisAgent );
}
Symbol* make_float_constant ( agent thisAgent,
double  value 
)

Definition at line 419 of file symtab.cpp.

References add_to_hash_table(), FALSE, symbol_union::fc, find_float_constant(), agent_struct::float_constant_hash_table, agent_struct::float_constant_pool, FLOAT_CONSTANT_SYMBOL_TYPE, get_next_symbol_hash_id(), symbol_add_ref(), symbol_to_string(), and float_constant_struct::value.

Referenced by abs_rhs_function_code(), atan2_rhs_function_code(), cos_rhs_function_code(), dice_prob_rhs_function_code(), epmem_install_memory(), epmem_process_query(), float_rhs_function_code(), fp_divide_rhs_function_code(), get_io_float_constant(), make_symbol_for_current_lexeme(), minus_rhs_function_code(), plus_rhs_function_code(), rand_float_rhs_function_code(), reteload_all_symbols(), rl_perform_update(), round_off_air_rhs_function_code(), round_off_heading_air_rhs_function_code(), sin_rhs_function_code(), smem_parse_chunk(), smem_parse_constant_attr(), smem_reverse_hash(), sqrt_rhs_function_code(), and times_rhs_function_code().

{
Symbol *sym;
sym = find_float_constant(thisAgent, value);
if (sym) {
} else {
allocate_with_pool (thisAgent, &thisAgent->float_constant_pool, &sym);
sym->common.symbol_type = FLOAT_CONSTANT_SYMBOL_TYPE;
sym->common.reference_count = 1;
sym->common.hash_id = get_next_symbol_hash_id(thisAgent);
sym->common.epmem_hash = 0;
sym->common.epmem_valid = 0;
sym->common.smem_hash = 0;
sym->common.smem_valid = 0;
sym->fc.value = value;
add_to_hash_table (thisAgent, thisAgent->float_constant_hash_table, sym);
#ifdef DEBUG_SYMBOL_REFCOUNTS
char buf[64];
OutputDebugString(symbol_to_string(thisAgent, sym, FALSE, buf, 64));
OutputDebugString(":+ \n");
#endif // DEBUG_SYMBOL_REFCOUNTS
}
return sym;
}
Symbol* make_int_constant ( agent thisAgent,
int64_t  value 
)

Definition at line 393 of file symtab.cpp.

References add_to_hash_table(), FALSE, find_int_constant(), get_next_symbol_hash_id(), symbol_union::ic, agent_struct::int_constant_hash_table, agent_struct::int_constant_pool, INT_CONSTANT_SYMBOL_TYPE, symbol_add_ref(), symbol_to_string(), and int_constant_struct::value.

Referenced by abs_rhs_function_code(), compute_heading_rhs_function_code(), compute_range_rhs_function_code(), create_new_impasse(), div_rhs_function_code(), epmem_install_memory(), epmem_new_episode(), epmem_process_query(), get_io_int_constant(), int_rhs_function_code(), make_symbol_for_current_lexeme(), minus_rhs_function_code(), mod_rhs_function_code(), plus_rhs_function_code(), rand_int_rhs_function_code(), reteload_all_symbols(), round_off_air_rhs_function_code(), round_off_heading_air_rhs_function_code(), smem_parse_chunk(), smem_parse_constant_attr(), smem_reverse_hash(), strlen_rhs_function_code(), times_rhs_function_code(), and update_impasse_items().

{
Symbol *sym;
sym = find_int_constant(thisAgent, value);
if (sym) {
} else {
allocate_with_pool (thisAgent, &thisAgent->int_constant_pool, &sym);
sym->common.symbol_type = INT_CONSTANT_SYMBOL_TYPE;
sym->common.reference_count = 1;
sym->common.hash_id = get_next_symbol_hash_id(thisAgent);
sym->common.epmem_hash = 0;
sym->common.epmem_valid = 0;
sym->common.smem_hash = 0;
sym->common.smem_valid = 0;
sym->ic.value = value;
add_to_hash_table (thisAgent, thisAgent->int_constant_hash_table, sym);
#ifdef DEBUG_SYMBOL_REFCOUNTS
char buf[64];
OutputDebugString(symbol_to_string(thisAgent, sym, FALSE, buf, 64));
OutputDebugString(":+ \n");
#endif // DEBUG_SYMBOL_REFCOUNTS
}
return sym;
}
Symbol* make_new_identifier ( agent thisAgent,
char  name_letter,
goal_stack_level  level,
uint64_t  name_number 
)

Definition at line 283 of file symtab.cpp.

References add_to_hash_table(), identifier_struct::associated_output_links, identifier_struct::could_be_a_link_from_below, identifier_struct::epmem_cmd_header, identifier_struct::epmem_header, identifier_struct::epmem_id, EPMEM_MEMID_NONE, EPMEM_NODEID_BAD, identifier_struct::epmem_result_header, identifier_struct::epmem_time_wme, identifier_struct::epmem_valid, FALSE, identifier_struct::gds, get_next_symbol_hash_id(), identifier_struct::higher_goal, symbol_union::id, agent_struct::id_counter, agent_struct::identifier_hash_table, agent_struct::identifier_pool, IDENTIFIER_SYMBOL_TYPE, identifier_struct::impasse_wmes, identifier_struct::input_wmes, identifier_struct::isa_goal, identifier_struct::isa_impasse, identifier_struct::isa_operator, identifier_struct::level, identifier_struct::link_count, identifier_struct::lower_goal, identifier_struct::ms_i_assertions, identifier_struct::ms_o_assertions, identifier_struct::ms_retractions, identifier_struct::name_letter, identifier_struct::name_number, NIL, NO_SAVED_PRODS, identifier_struct::operator_slot, identifier_struct::preferences_from_goal, identifier_struct::promotion_level, identifier_struct::reward_header, identifier_struct::rl_info, identifier_struct::saved_firing_type, identifier_struct::slots, identifier_struct::smem_cmd_header, identifier_struct::smem_header, identifier_struct::smem_lti, identifier_struct::smem_result_header, identifier_struct::smem_time_id, identifier_struct::smem_valid, symbol_to_string(), identifier_struct::tc_num, and identifier_struct::unknown_level.

Referenced by _epmem_install_id_wme(), create_new_impasse(), deep_copy_rhs_function_code(), epmem_install_memory(), epmem_process_query(), get_io_identifier(), get_new_io_identifier(), instantiate_rhs_value(), recursive_wme_copy(), and smem_lti_soar_make().

{
Symbol *sym;
if (isalpha(name_letter)) {
if (islower(name_letter)) name_letter = static_cast<char>(toupper(name_letter));
} else {
name_letter = 'I';
}
allocate_with_pool (thisAgent, &thisAgent->identifier_pool, &sym);
sym->common.symbol_type = IDENTIFIER_SYMBOL_TYPE;
sym->common.reference_count = 1;
sym->common.hash_id = get_next_symbol_hash_id(thisAgent);
sym->id.name_letter = name_letter;
// NLD: modified for long-term identifiers
if ( name_number == NIL )
{
name_number = thisAgent->id_counter[name_letter-'A']++;
}
else
{
uint64_t *current_number = &( thisAgent->id_counter[ name_letter - 'A' ] );
if ( name_number >= (*current_number) )
{
(*current_number) = ( name_number + 1 );
}
}
sym->id.name_number = name_number;
sym->id.level = level;
sym->id.promotion_level = level;
sym->id.slots = NIL;
sym->id.isa_goal = FALSE;
sym->id.isa_operator = 0;
sym->id.link_count = 0;
sym->id.higher_goal = NIL;
/* REW: begin 09.15.96 */
sym->id.gds = NIL;
/* REW: end 09.15.96 */
/* REW: begin 08.20.97 */
/* REW: end 08.20.97 */
sym->id.lower_goal = NIL;
sym->id.tc_num = 0;
sym->id.input_wmes = NIL;
sym->id.rl_info = NIL;
sym->id.epmem_valid = NIL;
sym->id.smem_header = NIL;
sym->id.smem_lti = NIL;
sym->id.smem_valid = NIL;
add_to_hash_table (thisAgent, thisAgent->identifier_hash_table, sym);
#ifdef DEBUG_SYMBOL_REFCOUNTS
char buf[64];
OutputDebugString(symbol_to_string(thisAgent, sym, FALSE, buf, 64));
OutputDebugString(":+ \n");
#endif // DEBUG_SYMBOL_REFCOUNTS
return sym;
}
Symbol* make_sym_constant ( agent thisAgent,
char const *  name 
)

Definition at line 366 of file symtab.cpp.

References add_to_hash_table(), FALSE, find_sym_constant(), get_next_symbol_hash_id(), make_memory_block_for_string(), sym_constant_struct::name, NIL, sym_constant_struct::production, symbol_union::sc, agent_struct::sym_constant_hash_table, agent_struct::sym_constant_pool, SYM_CONSTANT_SYMBOL_TYPE, symbol_add_ref(), and symbol_to_string().

Referenced by capitalize_symbol_rhs_function_code(), create_predefined_symbols(), crlf_rhs_function_code(), deep_copy_rhs_function_code(), epmem_install_memory(), generate_chunk_name_sym_constant(), generate_new_sym_constant(), get_io_sym_constant(), soar_module::sym_set_param::in_set(), init_built_in_rhs_functions(), init_built_in_rhs_math_functions(), init_soar_agent(), make_constant_symbol_rhs_function_code(), make_symbol_for_current_lexeme(), parse_attribute_path_in_brackets(), parse_production(), reteload_all_symbols(), rl_build_template_instantiation(), soar_module::sym_set_param::set_value(), smem_parse_chunk(), smem_parse_constant_attr(), smem_reverse_hash(), timestamp_rhs_function_code(), and trim_rhs_function_code().

{
Symbol *sym;
sym = find_sym_constant(thisAgent, name);
if (sym) {
} else {
allocate_with_pool (thisAgent, &thisAgent->sym_constant_pool, &sym);
sym->common.symbol_type = SYM_CONSTANT_SYMBOL_TYPE;
sym->common.reference_count = 1;
sym->common.hash_id = get_next_symbol_hash_id(thisAgent);
sym->common.epmem_hash = 0;
sym->common.epmem_valid = 0;
sym->common.smem_hash = 0;
sym->common.smem_valid = 0;
sym->sc.name = make_memory_block_for_string (thisAgent, name);
sym->sc.production = NIL;
add_to_hash_table (thisAgent, thisAgent->sym_constant_hash_table, sym);
#ifdef DEBUG_SYMBOL_REFCOUNTS
char buf[64];
OutputDebugString(symbol_to_string(thisAgent, sym, FALSE, buf, 64));
OutputDebugString(":+ \n");
#endif // DEBUG_SYMBOL_REFCOUNTS
}
return sym;
}
Symbol* make_variable ( agent thisAgent,
const char *  name 
)

Definition at line 258 of file symtab.cpp.

References add_to_hash_table(), FALSE, find_variable(), variable_struct::gensym_number, get_next_symbol_hash_id(), make_memory_block_for_string(), variable_struct::name, NIL, variable_struct::rete_binding_locations, symbol_add_ref(), symbol_to_string(), variable_struct::tc_num, symbol_union::var, agent_struct::variable_hash_table, agent_struct::variable_pool, and VARIABLE_SYMBOL_TYPE.

Referenced by create_predefined_symbols(), generate_new_variable(), make_placeholder_var(), make_symbol_for_current_lexeme(), parse_rhs_action(), and reteload_all_symbols().

{
Symbol *sym;
sym = find_variable(thisAgent, name);
if (sym) {
} else {
allocate_with_pool (thisAgent, &thisAgent->variable_pool, &sym);
sym->common.symbol_type = VARIABLE_SYMBOL_TYPE;
sym->common.reference_count = 1;
sym->common.hash_id = get_next_symbol_hash_id(thisAgent);
sym->var.name = make_memory_block_for_string (thisAgent, name);
sym->var.gensym_number = 0;
sym->var.tc_num = 0;
add_to_hash_table (thisAgent, thisAgent->variable_hash_table, sym);
#ifdef DEBUG_SYMBOL_REFCOUNTS
char buf[64];
OutputDebugString(symbol_to_string(thisAgent, sym, FALSE, buf, 64));
OutputDebugString(":+ \n");
#endif // DEBUG_SYMBOL_REFCOUNTS
}
return sym;
}
Bool print_identifier_ref_info ( agent thisAgent,
void *  item,
void *  userdata 
)

Definition at line 513 of file symtab.cpp.

References FALSE, symbol_union::id, IDENTIFIER_SYMBOL_TYPE, identifier_struct::name_letter, identifier_struct::name_number, NIL, print(), identifier_struct::smem_lti, TRUE, and xml_generate_warning().

Referenced by reset_id_counters().

{
Symbol* sym;
char msg[256];
sym = static_cast<symbol_union *>(item);
FILE* f = reinterpret_cast<FILE*>(userdata);
if ( sym->common.symbol_type == IDENTIFIER_SYMBOL_TYPE ) {
if ( sym->common.reference_count > 0 ) {
if ( sym->id.smem_lti != NIL )
{
SNPRINTF( msg, 256,
"\t@%c%llu --> %llu\n",
sym->id.name_letter,
static_cast<long long unsigned>(sym->id.name_number),
static_cast<long long unsigned>(sym->common.reference_count));
}
else
{
SNPRINTF( msg, 256,
"\t%c%llu --> %llu\n",
sym->id.name_letter,
static_cast<long long unsigned>(sym->id.name_number),
static_cast<long long unsigned>(sym->common.reference_count));
}
msg[255] = 0; /* ensure null termination */
print (thisAgent, msg);
xml_generate_warning(thisAgent, msg);
if (f) {
fprintf(f, "%s", msg) ;
}
}
} else {
print (thisAgent, "\tERROR: HASHTABLE ITEM IS NOT AN IDENTIFIER!\n");
return TRUE;
}
return FALSE;
}
void print_internal_symbols ( agent thisAgent)

Definition at line 627 of file symtab.cpp.

References do_for_all_items_in_hash_table(), agent_struct::float_constant_hash_table, agent_struct::identifier_hash_table, agent_struct::int_constant_hash_table, print_string(), print_sym(), agent_struct::sym_constant_hash_table, and agent_struct::variable_hash_table.

{
print_string (thisAgent, "\n--- Symbolic Constants: ---\n");
print_string (thisAgent, "\n--- Integer Constants: ---\n");
print_string (thisAgent, "\n--- Floating-Point Constants: ---\n");
print_string (thisAgent, "\n--- Identifiers: ---\n");
print_string (thisAgent, "\n--- Variables: ---\n");
}
Bool print_sym ( agent thisAgent,
void *  item,
void *   
)

Definition at line 621 of file symtab.cpp.

References FALSE, NIL, print_string(), symbol_to_string(), and TRUE.

Referenced by print_internal_symbols().

{
print_string (thisAgent, symbol_to_string (thisAgent, static_cast<symbol_union *>(item), TRUE, NIL, 0));
print_string (thisAgent, "\n");
return FALSE;
}
void release_helper ( agent thisAgent,
Symbol **  sym 
)

Definition at line 765 of file symtab.cpp.

References symbol_remove_ref().

Referenced by release_predefined_symbols().

{
symbol_remove_ref(thisAgent,*sym);
*sym = 0;
}
void release_predefined_symbols ( agent thisAgent)

Definition at line 770 of file symtab.cpp.

References agent_struct::attribute_symbol, agent_struct::choices_symbol, agent_struct::conflict_symbol, agent_struct::constraint_failure_symbol, agent_struct::epmem_sym, agent_struct::epmem_sym_after, agent_struct::epmem_sym_bad_cmd, agent_struct::epmem_sym_before, agent_struct::epmem_sym_cmd, agent_struct::epmem_sym_cue_size, agent_struct::epmem_sym_current, agent_struct::epmem_sym_failure, agent_struct::epmem_sym_graph_match, agent_struct::epmem_sym_graph_match_mapping, agent_struct::epmem_sym_graph_match_mapping_cue, agent_struct::epmem_sym_graph_match_mapping_node, agent_struct::epmem_sym_match_cardinality, agent_struct::epmem_sym_match_score, agent_struct::epmem_sym_memory_id, agent_struct::epmem_sym_negquery, agent_struct::epmem_sym_next, agent_struct::epmem_sym_no, agent_struct::epmem_sym_no_memory, agent_struct::epmem_sym_normalized_match_score, agent_struct::epmem_sym_present_id, agent_struct::epmem_sym_prev, agent_struct::epmem_sym_prohibit, agent_struct::epmem_sym_query, agent_struct::epmem_sym_result, agent_struct::epmem_sym_retrieve, agent_struct::epmem_sym_retrieved, agent_struct::epmem_sym_status, agent_struct::epmem_sym_success, agent_struct::epmem_sym_yes, agent_struct::goal_symbol, agent_struct::impasse_symbol, agent_struct::input_link_symbol, agent_struct::io_symbol, agent_struct::item_count_symbol, agent_struct::item_symbol, agent_struct::multiple_symbol, agent_struct::name_symbol, agent_struct::nil_symbol, agent_struct::no_change_symbol, agent_struct::non_numeric_count_symbol, agent_struct::non_numeric_symbol, agent_struct::none_symbol, agent_struct::o_context_variable, agent_struct::object_symbol, agent_struct::operator_symbol, agent_struct::output_link_symbol, agent_struct::problem_space_symbol, agent_struct::quiescence_symbol, release_helper(), agent_struct::rl_sym_reward, agent_struct::rl_sym_reward_link, agent_struct::rl_sym_value, agent_struct::s_context_variable, agent_struct::smem_sym, agent_struct::smem_sym_bad_cmd, agent_struct::smem_sym_cmd, agent_struct::smem_sym_failure, agent_struct::smem_sym_negquery, agent_struct::smem_sym_prohibit, agent_struct::smem_sym_query, agent_struct::smem_sym_result, agent_struct::smem_sym_retrieve, agent_struct::smem_sym_retrieved, agent_struct::smem_sym_status, agent_struct::smem_sym_store, agent_struct::smem_sym_success, agent_struct::so_context_variable, agent_struct::ss_context_variable, agent_struct::sso_context_variable, agent_struct::sss_context_variable, agent_struct::state_symbol, agent_struct::superstate_symbol, agent_struct::t_symbol, agent_struct::tie_symbol, agent_struct::to_context_variable, agent_struct::ts_context_variable, agent_struct::type_symbol, and agent_struct::wait_symbol.

Referenced by destroy_soar_agent().

{
release_helper(thisAgent,&(thisAgent->problem_space_symbol));
release_helper(thisAgent,&(thisAgent->state_symbol));
release_helper(thisAgent,&(thisAgent->operator_symbol));
release_helper(thisAgent,&(thisAgent->superstate_symbol));
release_helper(thisAgent,&(thisAgent->io_symbol));
release_helper(thisAgent,&(thisAgent->object_symbol));
release_helper(thisAgent,&(thisAgent->attribute_symbol));
release_helper(thisAgent,&(thisAgent->impasse_symbol));
release_helper(thisAgent,&(thisAgent->choices_symbol));
release_helper(thisAgent,&(thisAgent->none_symbol));
release_helper(thisAgent,&(thisAgent->constraint_failure_symbol));
release_helper(thisAgent,&(thisAgent->no_change_symbol));
release_helper(thisAgent,&(thisAgent->multiple_symbol));
release_helper(thisAgent,&(thisAgent->conflict_symbol));
release_helper(thisAgent,&(thisAgent->tie_symbol));
release_helper(thisAgent,&(thisAgent->item_symbol));
release_helper(thisAgent,&(thisAgent->non_numeric_symbol));
release_helper(thisAgent,&(thisAgent->quiescence_symbol));
release_helper(thisAgent,&(thisAgent->t_symbol));
release_helper(thisAgent,&(thisAgent->nil_symbol));
release_helper(thisAgent,&(thisAgent->type_symbol));
release_helper(thisAgent,&(thisAgent->goal_symbol));
release_helper(thisAgent,&(thisAgent->name_symbol));
release_helper(thisAgent,&(thisAgent->ts_context_variable));
release_helper(thisAgent,&(thisAgent->to_context_variable));
release_helper(thisAgent,&(thisAgent->sss_context_variable));
release_helper(thisAgent,&(thisAgent->sso_context_variable));
release_helper(thisAgent,&(thisAgent->ss_context_variable));
release_helper(thisAgent,&(thisAgent->so_context_variable));
release_helper(thisAgent,&(thisAgent->s_context_variable));
release_helper(thisAgent,&(thisAgent->o_context_variable));
// SBW 5/07
release_helper(thisAgent,&(thisAgent->item_count_symbol));
// NLD 11/11
release_helper(thisAgent,&(thisAgent->non_numeric_count_symbol));
/* REW: begin 10.24.97 */
release_helper(thisAgent,&(thisAgent->wait_symbol));
/* REW: end 10.24.97 */
/* RPM 9/06 begin */
release_helper(thisAgent,&(thisAgent->input_link_symbol));
release_helper(thisAgent,&(thisAgent->output_link_symbol));
/* RPM 9/06 end */
release_helper( thisAgent, &( thisAgent->rl_sym_reward_link ) );
release_helper( thisAgent, &( thisAgent->rl_sym_reward ) );
release_helper( thisAgent, &( thisAgent->rl_sym_value ) );
release_helper( thisAgent, &( thisAgent->epmem_sym ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_cmd ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_result ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_retrieved ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_status ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_match_score ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_cue_size ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_normalized_match_score ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_match_cardinality ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_memory_id ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_present_id ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_no_memory ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_graph_match ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_graph_match_mapping ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_graph_match_mapping_node ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_graph_match_mapping_cue ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_success ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_failure ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_bad_cmd ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_retrieve ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_next ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_prev ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_query ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_negquery ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_before ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_after ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_prohibit ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_current ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_yes ) );
release_helper( thisAgent, &( thisAgent->epmem_sym_no ) );
release_helper( thisAgent, &( thisAgent->smem_sym ) );
release_helper( thisAgent, &( thisAgent->smem_sym_cmd ) );
release_helper( thisAgent, &( thisAgent->smem_sym_result ) );
release_helper( thisAgent, &( thisAgent->smem_sym_retrieved ) );
release_helper( thisAgent, &( thisAgent->smem_sym_status ) );
release_helper( thisAgent, &( thisAgent->smem_sym_success ) );
release_helper( thisAgent, &( thisAgent->smem_sym_failure ) );
release_helper( thisAgent, &( thisAgent->smem_sym_bad_cmd ) );
release_helper( thisAgent, &( thisAgent->smem_sym_retrieve ) );
release_helper( thisAgent, &( thisAgent->smem_sym_query ) );
release_helper( thisAgent, &( thisAgent->smem_sym_negquery ) );
release_helper( thisAgent, &( thisAgent->smem_sym_prohibit ) );
release_helper( thisAgent, &( thisAgent->smem_sym_store ) );
}
Bool reset_gensym_number ( agent ,
void *  item,
void *   
)

Definition at line 609 of file symtab.cpp.

References FALSE, variable_struct::gensym_number, and symbol_union::var.

Referenced by reset_variable_gensym_numbers().

{
Symbol *sym;
sym = static_cast<symbol_union *>(item);
sym->var.gensym_number = 0;
return FALSE;
}
void reset_id_and_variable_tc_numbers ( agent thisAgent)
bool reset_id_counters ( agent thisAgent)

Definition at line 554 of file symtab.cpp.

References soar_module::connected, hash_table_struct::count, do_for_all_items_in_hash_table(), soar_module::status_object< T >::get_status(), agent_struct::id_counter, agent_struct::identifier_hash_table, print(), print_identifier_ref_info(), smem_count_ltis(), agent_struct::smem_db, smem_reset_id_counters(), and xml_generate_warning().

Referenced by init_symbol_tables(), and reinitialize_soar().

{
int i;
if (thisAgent->identifier_hash_table->count != 0) {
// As long as all of the existing identifiers are long term identifiers (lti), there's no problem
uint64_t ltis = 0;
if (static_cast<uint64_t>(thisAgent->identifier_hash_table->count) != ltis) {
print (thisAgent, "Internal warning: wanted to reset identifier generator numbers, but\n");
print (thisAgent, "there are still some identifiers allocated. (Probably a memory leak.)\n");
print (thisAgent, "(Leaving identifier numbers alone.)\n");
xml_generate_warning(thisAgent, "Internal warning: wanted to reset identifier generator numbers, but\nthere are still some identifiers allocated. (Probably a memory leak.)\n(Leaving identifier numbers alone.)");
/* RDF 01272003: Added this to improve the output from this error message */
//TODO: append this to previous XML string or generate separate output?
// Also dump the ids to a txt file
FILE *ids = fopen("leaked-ids.txt", "w") ;
if (ids)
{
do_for_all_items_in_hash_table( thisAgent, thisAgent->identifier_hash_table, print_identifier_ref_info, reinterpret_cast<void*>(ids));
fclose(ids) ;
}
return false;
}
// Getting here means that there are still identifiers but that
// they are all long-term and (hopefully) exist only in production memory.
}
for (i=0; i<26; i++) thisAgent->id_counter[i]=1;
if ( thisAgent->smem_db->get_status() == soar_module::connected )
{
smem_reset_id_counters( thisAgent );
}
return true ;
}
Bool reset_tc_num ( agent ,
void *  item,
void *   
)

Definition at line 595 of file symtab.cpp.

References FALSE, symbol_union::id, IDENTIFIER_SYMBOL_TYPE, variable_struct::tc_num, identifier_struct::tc_num, symbol_union::var, and VARIABLE_SYMBOL_TYPE.

Referenced by reset_id_and_variable_tc_numbers().

{
Symbol *sym;
sym = static_cast<symbol_union *>(item);
if (sym->common.symbol_type==IDENTIFIER_SYMBOL_TYPE) sym->id.tc_num = 0;
else if (sym->common.symbol_type==VARIABLE_SYMBOL_TYPE) sym->var.tc_num = 0;
return FALSE;
}
void reset_variable_gensym_numbers ( agent thisAgent)