Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

mem.c File Reference

Go to the source code of this file.

Functions

void * allocate_memory (unsigned long size, int usage_code)
void * allocate_memory_and_zerofill (unsigned long size, int usage_code)
void free_memory (void *mem, int usage_code)
char * make_memory_block_for_string (const char *s)
void free_memory_block_for_string (char *p)
growable_string make_blank_growable_string (void)
void add_to_growable_string (growable_string *gs, char *string_to_add)
void free_growable_string (growable_string gs)
void add_block_to_memory_pool (memory_pool *p)
void init_memory_pool (memory_pool *p, long item_size, char *name)
consdestructively_reverse_list (cons *c)
bool member_of_list (void *item, list *the_list)
listadd_if_not_member (void *item, list *old_list)
void free_list (list *the_list)
listextract_list_elements (list **header, cons_test_fn f)
dl_listextract_dl_list_elements (dl_list **header, dl_cons_test_fn f)
hash_table_structmake_hash_table (short minimum_log2size, hash_function h)
void resize_hash_table (hash_table *ht, short new_log2size)
void remove_from_hash_table (struct hash_table_struct *ht, void *item)
void add_to_hash_table (struct hash_table_struct *ht, void *item)
void do_for_all_items_in_hash_table (struct hash_table_struct *ht, hash_table_callback_fn f)
void do_for_all_items_in_hash_bucket (struct hash_table_struct *ht, hash_table_callback_fn f, unsigned long hash_value)
void init_memory_utilities (void)

Variables

unsigned long masks_for_n_low_order_bits [33]


Function Documentation

void add_block_to_memory_pool memory_pool p  ) 
 

Definition at line 226 of file mem.c.

References allocate_memory(), memory_pool_struct::first_block, memory_pool_struct::free_list, memory_pool_struct::item_size, memory_pool_struct::items_per_block, memory_pool, and memory_pool_struct::num_blocks.

Referenced by allocate_with_pool_fn().

list* add_if_not_member void *  item,
list old_list
 

Definition at line 340 of file mem.c.

References cons, cons_struct::first, list, and cons_struct::rest.

Referenced by collect_vars_tested_by_test_that_are_bound().

void add_to_growable_string growable_string gs,
char *  string_to_add
 

Definition at line 170 of file mem.c.

References allocate_memory(), free_memory(), and growable_string.

Referenced by add_trace_for_attribute_path(), add_trace_for_wme(), add_values_of_attribute_path(), object_to_trace_string(), and trace_format_list_to_string().

void add_to_hash_table struct hash_table_struct ht,
void *  item
 

Definition at line 531 of file mem.c.

References hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, item_in_hash_table, hash_table_struct::log2size, item_in_hash_table_struct::next, resize_hash_table(), and hash_table_struct::size.

Referenced by add_trace_format(), find_or_make_alpha_mem(), make_float_constant(), make_int_constant(), make_new_identifier(), make_sym_constant(), and make_variable().

void* allocate_memory unsigned long  size,
int  usage_code
 

Definition at line 60 of file mem.c.

References abort_with_fatal_error().

Referenced by add_block_to_memory_pool(), add_rhs_function(), add_to_growable_string(), add_trace_format(), allocate_memory_and_zerofill(), get_augs_of_id(), make_blank_growable_string(), make_hash_table(), make_memory_block_for_string(), parse_item_from_format_string(), print_match_set(), read_rest_of_floating_point_number(), reteload_all_symbols(), reteload_alpha_memories(), run_preference_semantics(), soar_cLoadReteNet(), soar_cMultiAttributes(), soar_cSaveReteNet(), soar_ecAddWmeFilter(), soar_ecPrintMemories(), soar_ecPrintTopProductionFirings(), soar_ecReplayInput(), start_lex_from_file(), and symbols_are_equal_with_bindings().

void* allocate_memory_and_zerofill unsigned long  size,
int  usage_code
 

Definition at line 91 of file mem.c.

References allocate_memory().

Referenced by init_rete(), make_hash_table(), resize_hash_table(), and update_max_rhs_unbound_variables().

cons* destructively_reverse_list cons c  ) 
 

Definition at line 315 of file mem.c.

References cons, and cons_struct::rest.

void do_for_all_items_in_hash_bucket struct hash_table_struct ht,
hash_table_callback_fn  f,
unsigned long  hash_value
 

Definition at line 558 of file mem.c.

References hash_table_struct::buckets, hash_table_callback_fn, item_in_hash_table, hash_table_struct::log2size, masks_for_n_low_order_bits, and item_in_hash_table_struct::next.

void do_for_all_items_in_hash_table struct hash_table_struct ht,
hash_table_callback_fn  f
 

Definition at line 545 of file mem.c.

References hash_table_struct::buckets, hash_table_callback_fn, item_in_hash_table, item_in_hash_table_struct::next, and hash_table_struct::size.

Referenced by print_all_trace_formats(), reset_id_and_variable_tc_numbers(), reset_variable_gensym_numbers(), retesave_alpha_memories(), retesave_symbol_table(), and soar_ecPrintInternalSymbols().

dl_list* extract_dl_list_elements dl_list **  header,
dl_cons_test_fn  f
 

Definition at line 394 of file mem.c.

References dl_cons, dl_cons_test_fn, dl_list, dl_cons_struct::next, and dl_cons_struct::prev.

Referenced by print().

list* extract_list_elements list **  header,
cons_test_fn  f
 

Definition at line 364 of file mem.c.

References cons, cons_test_fn, list, and cons_struct::rest.

Referenced by remove_pwatch().

void free_growable_string growable_string  gs  ) 
 

Definition at line 192 of file mem.c.

References free_memory(), and growable_string.

Referenced by add_trace_for_attribute_path(), add_trace_for_wme(), add_values_of_attribute_path(), print_object_trace(), print_object_trace_using_provided_format_string(), print_stack_trace(), and trace_format_list_to_string().

void free_list list the_list  ) 
 

Definition at line 353 of file mem.c.

References cons, list, and cons_struct::rest.

Referenced by backtrace_through_instantiation(), calculate_compile_time_o_support(), chunk_instantiation(), deallocate_instantiation(), deallocate_rhs_value(), find_compile_time_match_goal(), find_thing_off_goal(), free_binding_list(), instantiate_rhs_value(), remove_pwatch(), remove_vars_requiring_bindings(), reorder_lhs(), reorder_simplified_conditions(), reset_variable_generator(), second_stage_chunk_instantiation(), soar_Print(), and soar_ProductionFind().

void free_memory void *  mem,
int  usage_code
 

Definition at line 100 of file mem.c.

Referenced by add_to_growable_string(), deallocate_trace_format_list(), free_binding_list(), free_growable_string(), free_memory_block_for_string(), print_augs_of_id(), print_match_set(), remove_rhs_function(), remove_trace_format(), remove_wme_from_wm(), reset_old_binding_point(), resize_hash_table(), reteload_free_am_table(), reteload_free_symbol_table(), run_preference_semantics(), soar_cLoadReteNet(), soar_cSaveReteNet(), soar_ecPrintMemories(), soar_ecPrintTopProductionFirings(), soar_ecRemoveWmeFilter(), soar_ecResetWmeFilters(), stop_lex_from_file(), and update_max_rhs_unbound_variables().

void free_memory_block_for_string char *  p  ) 
 

Definition at line 152 of file mem.c.

References free_memory().

Referenced by deallocate_production(), deallocate_symbol(), deallocate_trace_format_list(), parse_production(), read_rest_of_floating_point_number(), stop_lex_from_file(), and stop_log_file().

void init_memory_pool memory_pool p,
long  item_size,
char *  name
 

Definition at line 258 of file mem.c.

References abort_with_fatal_error(), memory_pool_struct::first_block, memory_pool_struct::free_list, memory_pool_struct::item_size, memory_pool_struct::items_per_block, memory_pool, memory_pool_struct::name, memory_pool_struct::next, memory_pool_struct::num_blocks, and memory_pool_struct::used_count.

Referenced by init_chunker(), init_firer(), init_memory_utilities(), init_production_utilities(), init_reorderer(), init_rete(), init_soar_io(), init_symbol_tables(), and run_preference_semantics().

void init_memory_utilities void   ) 
 

Definition at line 577 of file mem.c.

References cons, dl_cons, and init_memory_pool().

Referenced by init_soar_agent().

growable_string make_blank_growable_string void   ) 
 

Definition at line 159 of file mem.c.

References allocate_memory(), and growable_string.

Referenced by add_trace_for_attribute_path(), object_to_trace_string(), selection_to_trace_string(), and trace_format_list_to_string().

struct hash_table_struct* make_hash_table short  minimum_log2size,
hash_function  h
 

Definition at line 464 of file mem.c.

References allocate_memory(), allocate_memory_and_zerofill(), hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, hash_table, hash_table_struct::log2size, hash_table_struct::minimum_log2size, and hash_table_struct::size.

Referenced by init_rete(), init_symbol_tables(), and init_tracing().

char* make_memory_block_for_string const char *  s  ) 
 

Definition at line 140 of file mem.c.

References allocate_memory().

Referenced by make_sym_constant(), make_variable(), parse_item_from_format_string(), parse_production(), reteload_node_and_children(), soar_ecSp(), start_lex_from_file(), and start_log_file().

bool member_of_list void *  item,
list the_list
 

Definition at line 330 of file mem.c.

References cons_struct::first, list, and cons_struct::rest.

Referenced by chunk_instantiation(), dont_learn_rhs_function_code(), find_compile_time_match_goal(), force_learn_rhs_function_code(), test_covered_by_bound_vars(), test_is_for_symbol(), and test_tests_for_root().

void remove_from_hash_table struct hash_table_struct ht,
void *  item
 

Definition at line 507 of file mem.c.

References hash_table_struct::buckets, hash_table_struct::count, hash_table_struct::h, item_in_hash_table, hash_table_struct::log2size, hash_table_struct::minimum_log2size, item_in_hash_table_struct::next, resize_hash_table(), and hash_table_struct::size.

Referenced by deallocate_symbol(), remove_ref_to_alpha_mem(), and remove_trace_format().

void resize_hash_table hash_table ht,
short  new_log2size
 

Definition at line 480 of file mem.c.

References allocate_memory_and_zerofill(), bucket_array, hash_table_struct::buckets, free_memory(), hash_table_struct::h, hash_table, item_in_hash_table, hash_table_struct::log2size, item_in_hash_table_struct::next, and hash_table_struct::size.

Referenced by add_to_hash_table(), and remove_from_hash_table().


Variable Documentation

unsigned long masks_for_n_low_order_bits[33]
 

Initial value:

 { 0x00000000,
    0x00000001, 0x00000003, 0x00000007, 0x0000000F,
    0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
    0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF,
    0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF,
    0x0001FFFF, 0x0003FFFF, 0x0007FFFF, 0x000FFFFF,
    0x001FFFFF, 0x003FFFFF, 0x007FFFFF, 0x00FFFFFF,
    0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, 0x0FFFFFFF,
    0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF
}

Definition at line 453 of file mem.c.

Referenced by add_wme_to_aht(), compress(), do_for_all_items_in_hash_bucket(), and make_chunk_cond_for_condition().


Generated on Thu Dec 11 13:00:27 2003 for Soar Kernel by doxygen 1.3.5