C:/Users/Dennis/src/lang/Life_start/Life/life-1.02/source/modules.c File Reference

#include "extern.h"
#include "modules.h"
#include "trees.h"
#include "copy.h"
#include "token.h"
#include "built_ins.h"

Go to the source code of this file.

Defines

#define MAKE_PUBLIC   1
#define MAKE_PRIVATE   2
#define MAKE_FEATURE_PRIVATE   3

Functions

void init_modules ()
ptr_module find_module (char *module)
ptr_module create_module (char *module)
ptr_module set_current_module (ptr_module module)
ptr_module extract_module_from_name (char *str)
char * strip_module_name (char *str)
char * string_val (ptr_psi_term term)
char * make_module_token (ptr_module module, char *str)
ptr_definition new_definition (ptr_keyword key)
ptr_definition update_symbol (ptr_module module, char *symbol)
char * print_symbol (ptr_keyword k)
void pretty_symbol (ptr_keyword k)
void pretty_quote_symbol (ptr_keyword k)
long c_set_module ()
long c_open_module ()
 open_module_tree (ptr_node n, int *onefailed)
 open_module_one (ptr_psi_term t, int *onefailed)
long make_public (ptr_psi_term term, long bool)
 traverse_tree (ptr_node n, int flag)
long c_public ()
long c_private ()
long c_display_modules ()
long c_display_persistent ()
long c_trace_input ()
void rec_replace ()
void replace_attr ()
int replace (ptr_definition old, ptr_definition new, ptr_psi_term term)
void rec_replace (ptr_definition old, ptr_definition new, ptr_psi_term term)
void replace_attr (ptr_node old_attr, ptr_psi_term term, ptr_definition old, ptr_definition new)
long c_replace ()
long c_current_module ()
long c_module_access ()
int global_unify_attr ()
int global_unify (ptr_psi_term u, ptr_psi_term v)
int global_unify_attr (ptr_node u, ptr_node v)
long c_alias ()
int get_module (ptr_psi_term psi, ptr_module *module)
int make_feature_private (ptr_psi_term term)
long c_private_feature ()
ptr_definition update_feature (ptr_module module, char *feature)
int all_public_symbols ()

Variables

static char vcid [] = "$Id: modules.c,v 1.3 1994/12/15 22:05:39 duchier Exp $"
ptr_node module_table = NULL
ptr_module current_module = NULL
string module_buffer
ptr_module no_module = NULL
ptr_module bi_module = NULL
ptr_module user_module
ptr_module syntax_module = NULL
ptr_module x_module
ptr_module sys_module = NULL
long display_modules = TRUE
ptr_goal resid_aim


Define Documentation

#define MAKE_FEATURE_PRIVATE   3

Definition at line 654 of file modules.c.

Referenced by c_private_feature(), and traverse_tree().

#define MAKE_PRIVATE   2

Definition at line 653 of file modules.c.

Referenced by c_private(), and traverse_tree().

#define MAKE_PUBLIC   1

Definition at line 652 of file modules.c.

Referenced by c_public(), and traverse_tree().


Function Documentation

int all_public_symbols (  ) 

Definition at line 1367 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, wl_goal::b, deref_ptr, first_definition, get_module(), get_two_args(), wl_definition::keyword, wl_keyword::module, wl_definition::next, NULL, wl_keyword::public, push_goal(), stack_cons(), stack_nil(), stack_psi_term(), TRUE, wl_psi_term::type, and unify.

Referenced by init_built_in_types().

long c_alias (  ) 

Definition at line 1182 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, wl_keyword::combined_name, wl_keyword::definition, deref_ptr, Errorline(), FALSE, get_two_args(), hash_lookup(), wl_definition::keyword, wl_module::module_name, wl_keyword::symbol, wl_module::symbol_table, TRUE, wl_psi_term::type, and Warningline.

Referenced by init_built_in_types().

long c_current_module (  ) 

Definition at line 975 of file modules.c.

References wl_goal::a, aim, wl_goal::b, deref_ptr, heap_copy_string(), wl_module::module_name, NULL, push_goal(), quoted_string, stack_psi_term(), TRUE, wl_psi_term::type, unify, and wl_psi_term::value.

Referenced by init_built_in_types().

long c_display_modules (  ) 

Definition at line 742 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, display_modules, Errorline(), FALSE, get_two_args(), TRUE, and wl_psi_term::type.

Referenced by init_built_in_types().

long c_display_persistent (  ) 

Definition at line 778 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, display_persistent, Errorline(), FALSE, get_two_args(), TRUE, and wl_psi_term::type.

Referenced by init_built_in_types().

long c_module_access (  ) 

Definition at line 1012 of file modules.c.

References wl_goal::a, aim, deref_ptr, FALSE, and Warningline.

long c_open_module (  ) 

Definition at line 532 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, and open_module_tree().

Referenced by init_built_in_types().

long c_private (  ) 

Definition at line 716 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_PRIVATE, traverse_tree(), and TRUE.

Referenced by init_built_in_types().

long c_private_feature (  ) 

Definition at line 1306 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_FEATURE_PRIVATE, traverse_tree(), and TRUE.

Referenced by init_built_in_types().

long c_public (  ) 

Definition at line 690 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, MAKE_PUBLIC, traverse_tree(), and TRUE.

Referenced by init_built_in_types().

long c_replace (  ) 

Definition at line 936 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, wl_node::data, deref_ptr, Errorline(), FALSE, featcmp(), find(), get_two_args(), NULL, replace(), three, TRUE, and wl_psi_term::type.

Referenced by init_built_in_types().

long c_set_module (  ) 

Definition at line 501 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, create_module(), deref_ptr, Errorline(), FALSE, get_two_args(), set_current_module(), string_val(), and TRUE.

Referenced by init_built_in_types().

long c_trace_input (  ) 

Definition at line 814 of file modules.c.

References wl_goal::a, aim, wl_psi_term::attr_list, deref_ptr, Errorline(), FALSE, get_two_args(), trace_input, TRUE, and wl_psi_term::type.

Referenced by init_built_in_types().

ptr_module create_module ( char *  module  ) 

Definition at line 84 of file modules.c.

References find_module(), hash_create(), HEAP_ALLOC, heap_copy_string(), heap_insert(), input_file_name, and NULL.

Referenced by c_set_module(), extract_module_from_name(), init_modules(), and read_name().

ptr_module extract_module_from_name ( char *  str  ) 

Definition at line 129 of file modules.c.

References create_module(), legal_in_name(), and NULL.

Referenced by do_pretty_attr(), make_module_token(), update_feature(), and update_symbol().

ptr_module find_module ( char *  module  ) 

Definition at line 65 of file modules.c.

References wl_node::data, find(), and NULL.

Referenced by create_module(), get_module(), load_aim(), and open_module_one().

int get_module ( ptr_psi_term  psi,
ptr_module module 
)

Definition at line 1225 of file modules.c.

References deref_ptr, Errorline(), FALSE, find_module(), NULL, overlap_type(), quoted_string, and TRUE.

Referenced by all_public_symbols(), c_feature_values(), c_features(), and c_string2psi().

int global_unify ( ptr_psi_term  u,
ptr_psi_term  v 
)

Definition at line 1053 of file modules.c.

References wl_psi_term::attr_list, c_abort(), deref_ptr, Errorline(), FALSE, glb(), global_unify_attr(), heap_pointer, overlap_type(), push_psi_ptr_value(), quoted_string, REAL, real, release_resid(), Traceline, TRUE, wl_psi_term::type, and wl_psi_term::value.

int global_unify_attr ( ptr_node  u,
ptr_node  v 
)

Definition at line 1135 of file modules.c.

References wl_node::data, dummy_printf(), FALSE, featcmp(), global_unify(), global_unify_attr(), wl_node::key, wl_node::left, NULL, wl_node::right, and TRUE.

int global_unify_attr (  ) 

void init_modules (  ) 

Definition at line 47 of file modules.c.

References create_module(), and set_current_module().

Referenced by main(), and WFInit().

int make_feature_private ( ptr_psi_term  term  ) 

Definition at line 1257 of file modules.c.

References wl_keyword::combined_name, wl_keyword::definition, deref_ptr, hash_lookup(), wl_definition::keyword, wl_keyword::private_feature, wl_keyword::public, wl_module::symbol_table, TRUE, update_symbol(), and Warningline.

Referenced by traverse_tree().

char* make_module_token ( ptr_module  module,
char *  str 
)

Definition at line 203 of file modules.c.

References extract_module_from_name(), and module_buffer.

Referenced by import_symbol_internal(), and update_symbol().

long make_public ( ptr_psi_term  term,
long  bool 
)

Definition at line 619 of file modules.c.

References wl_keyword::combined_name, wl_keyword::definition, deref_ptr, hash_lookup(), wl_definition::keyword, wl_keyword::module, new_definition(), wl_keyword::public, wl_keyword::symbol, wl_module::symbol_table, TRUE, update_symbol(), and Warningline.

Referenced by traverse_tree().

ptr_definition new_definition ( ptr_keyword  key  ) 

Definition at line 233 of file modules.c.

References wl_definition::already_loaded, wl_definition::always_check, wl_definition::children, wl_definition::code, wl_definition::date, wl_definition::evaluate_args, FALSE, first_definition, wl_definition::global_value, HEAP_ALLOC, wl_definition::init_value, wl_definition::keyword, wl_definition::next, NOT_CODED, NULL, wl_definition::op_data, wl_definition::parents, wl_definition::properties, wl_definition::protected, wl_definition::rule, TRUE, wl_definition::type, and undef.

Referenced by make_public(), and update_symbol().

open_module_one ( ptr_psi_term  t,
int *  onefailed 
)

Definition at line 569 of file modules.c.

References wl_keyword::combined_name, wl_keyword::definition, Errorline(), FALSE, find_module(), hash_lookup(), HEAP_ALLOC, wl_int_list::next, wl_module::open_modules, wl_keyword::public, string_val(), wl_keyword::symbol, wl_module::symbol_table, TRUE, and wl_int_list::value.

Referenced by open_module_tree().

open_module_tree ( ptr_node  n,
int *  onefailed 
)

Definition at line 552 of file modules.c.

References open_module_one().

Referenced by c_open_module().

void pretty_quote_symbol ( ptr_keyword  k  ) 

Definition at line 482 of file modules.c.

References display_modules, prettyf(), and prettyf_quote().

Referenced by pretty_psi_term(), and pretty_psi_with_ops().

void pretty_symbol ( ptr_keyword  k  ) 

Definition at line 464 of file modules.c.

References display_modules, and prettyf().

Referenced by pretty_list(), and pretty_psi_term().

char* print_symbol ( ptr_keyword  k  ) 

OBSOLETE ptr_psi_term get_function_value(module,symbol)

ptr_module module; char *symbol;

{ ptr_node n; ptr_definition def; ptr_psi_term result=NULL; ptr_pair_list rule;

n=find(strcmp,make_module_token(module,symbol),symbol_table); if(n) { def=(ptr_definition)n->data; if(def && def->type==function) { rule=def->rule; while (rule && (!rule->a || !rule->b)) rule=rule->next; if(rule) { result=(ptr_psi_term)rule->b; deref_ptr(result); } } }

if(!result) Errorline("error in definition of '%s'\n",module_buffer);

return result; }

Definition at line 447 of file modules.c.

References display_modules.

void rec_replace ( ptr_definition  old,
ptr_definition  new,
ptr_psi_term  term 
)

Definition at line 865 of file modules.c.

References wl_psi_term::attr_list, def_ptr, deref_ptr, insert_translation(), int_ptr, NULL, push_ptr_value(), replace_attr(), translate(), wl_psi_term::type, and wl_psi_term::value.

void rec_replace (  ) 

Referenced by replace(), and replace_attr().

int replace ( ptr_definition  old,
ptr_definition  new,
ptr_psi_term  term 
)

Definition at line 853 of file modules.c.

References clear_copy(), and rec_replace().

Referenced by c_replace().

void replace_attr ( ptr_node  old_attr,
ptr_psi_term  term,
ptr_definition  old,
ptr_definition  new 
)

Definition at line 894 of file modules.c.

References wl_psi_term::attr_list, wl_keyword::combined_name, wl_node::data, featcmp(), wl_node::key, wl_definition::keyword, wl_node::left, wl_keyword::private_feature, rec_replace(), replace_attr(), wl_node::right, stack_insert(), and wl_keyword::symbol.

void replace_attr (  ) 

Referenced by rec_replace(), and replace_attr().

ptr_module set_current_module ( ptr_module  module  ) 

Definition at line 113 of file modules.c.

Referenced by c_set_module(), init_built_in_types(), init_modules(), insert_sys_builtins(), load_aim(), main(), new_built_in(), and WFInit().

char* string_val ( ptr_psi_term  term  ) 

Definition at line 182 of file modules.c.

References deref_ptr, and quoted_string.

Referenced by c_set_module(), and open_module_one().

char* strip_module_name ( char *  str  ) 

Definition at line 157 of file modules.c.

References legal_in_name().

Referenced by do_pretty_attr(), and update_symbol().

traverse_tree ( ptr_node  n,
int  flag 
)

Definition at line 659 of file modules.c.

References deref_ptr, FALSE, make_feature_private(), MAKE_FEATURE_PRIVATE, MAKE_PRIVATE, make_public(), MAKE_PUBLIC, and TRUE.

Referenced by c_private(), c_private_feature(), and c_public().

ptr_definition update_feature ( ptr_module  module,
char *  feature 
)

Definition at line 1333 of file modules.c.

References wl_keyword::definition, extract_module_from_name(), hash_lookup(), NULL, wl_keyword::private_feature, and update_symbol().

Referenced by make_feature_list().

ptr_definition update_symbol ( ptr_module  module,
char *  symbol 
)

Definition at line 282 of file modules.c.

References wl_keyword::combined_name, wl_keyword::definition, error_psi_term, Errorline(), extract_module_from_name(), FALSE, hash_insert(), hash_lookup(), HEAP_ALLOC, heap_copy_string(), make_module_token(), wl_keyword::module, new_definition(), wl_int_list::next, NULL, wl_keyword::private_feature, wl_keyword::public, strip_module_name(), wl_keyword::symbol, wl_module::symbol_table, wl_psi_term::type, wl_int_list::value, and Warningline.

Referenced by c_parse(), c_read(), c_string2psi(), init_built_in_types(), insert_sys_builtins(), make_feature_private(), make_public(), new_built_in(), op_declare(), read_name(), read_string(), set_parse_queryflag(), and update_feature().


Variable Documentation

ptr_module bi_module = NULL

Definition at line 31 of file modules.c.

Referenced by c_parse(), c_read(), check(), init_built_in_types(), insert_math_builtins(), insert_sys_builtins(), insert_type_builtins(), raw_setup_builtins(), and set_parse_queryflag().

ptr_module current_module = NULL

Definition at line 26 of file modules.c.

Referenced by add_rule(), c_feature_values(), c_features(), c_string2psi(), check(), import_symbol_internal(), init_system(), insert_sys_builtins(), new_built_in(), new_state(), read_psi_term(), and what_next_aim().

long display_modules = TRUE

Definition at line 37 of file modules.c.

Referenced by c_display_modules(), do_pretty_attr(), pretty_quote_symbol(), pretty_symbol(), and print_symbol().

string module_buffer

Definition at line 28 of file modules.c.

Referenced by make_module_token().

ptr_node module_table = NULL

Definition at line 25 of file modules.c.

Referenced by check().

ptr_module no_module = NULL

Definition at line 30 of file modules.c.

Referenced by check(), and init_built_in_types().

ptr_goal resid_aim

Definition at line 20 of file lefun.c.

Referenced by backtrack(), c_call(), c_children(), c_cond(), c_diff_address(), c_disj(), c_eval(), c_eval_disjunction(), c_eval_inplace(), c_feature_values(), c_features(), c_freeze_inner(), c_glb(), c_is_function(), c_is_predicate(), c_is_sort(), c_lub(), c_nonvar(), c_parents(), c_rootsort(), c_same_address(), c_strip(), c_such_that(), c_var(), call_once_internal(), check(), init_system(), main_prove(), and prove_aim().

ptr_module syntax_module = NULL

Definition at line 33 of file modules.c.

Referenced by check(), init_built_in_types(), insert_math_builtins(), and insert_type_builtins().

ptr_module sys_module = NULL

Definition at line 35 of file modules.c.

Referenced by check(), insert_dbm_builtins(), and insert_sys_builtins().

ptr_module user_module

Definition at line 32 of file modules.c.

Referenced by check(), init_system(), main(), WFInit(), and what_next_aim().

char vcid[] = "$Id: modules.c,v 1.3 1994/12/15 22:05:39 duchier Exp $" [static]

Definition at line 11 of file modules.c.

ptr_module x_module

Definition at line 34 of file modules.c.

Referenced by check().


Generated on Sat Jan 26 08:48:09 2008 for WildLife by  doxygen 1.5.4