The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

modules.h File Reference

#include "lists.h"

Include dependency graph for modules.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

struct  module_t

Typedefs

typedef module_t module_t

Functions

void bind_module_var (module_t *, char *name)
module_tbindmodule (char *name)
void delete_module (module_t *)
hashdemand_rules (module_t *)
void enter_module (module_t *)
void exit_module (module_t *)
void import_module (LIST *module_names, module_t *target_module)
LISTimported_modules (module_t *module)
module_troot_module ()


Typedef Documentation

typedef struct module_t module_t
 

Definition at line 20 of file modules.h.


Function Documentation

void bind_module_var module_t ,
char *  name
 

module_t* bindmodule char *  name  ) 
 

Definition at line 31 of file modules.c.

References HASHDATA, hashenter, hashinit(), m, module_hash, module_t::name, newstr(), s, string_append(), string_free(), string_new(), string_push_back(), and string::value.

Referenced by builtin_delete_module(), builtin_export(), builtin_import(), builtin_import_module(), builtin_imported_modules(), builtin_instance(), builtin_rulenames(), builtin_varnames(), evaluate_in_module(), import_base_rules(), lookup_rule(), make_class_module(), root_module(), and type_check().

00032 {
00033     string s;
00034     module_t m_, *m = &m_;
00035 
00036     if( !module_hash )
00037         module_hash = hashinit( sizeof( module_t ), "modules" );
00038 
00039     string_new( &s );
00040     if (name)
00041     {
00042         string_append( &s, name );
00043         string_push_back( &s, '.' );
00044     }
00045         
00046     m->name = s.value;
00047     
00048     if ( hashenter( module_hash, (HASHDATA **)&m ) )
00049     {
00050         m->name = newstr( m->name );
00051         m->variables = 0;
00052         m->rules = 0;
00053         m->imported_modules = 0;
00054         m->class_module = 0;
00055     }
00056     string_free( &s );
00057     return m;
00058 }

Here is the call graph for this function:

void delete_module module_t  ) 
 

Definition at line 78 of file modules.c.

References delete_rule_(), hashdone(), hashenumerate(), m, module_t::rules, var_done(), var_hash_swap(), and module_t::variables.

Referenced by builtin_delete_module().

00079 {
00080     /* clear out all the rules */
00081     if ( m->rules )
00082     {
00083         hashenumerate( m->rules, delete_rule_, (void*)0 );
00084         hashdone( m->rules );
00085         m->rules = 0;
00086     }
00087 
00088     if ( m->variables )
00089     {
00090         var_hash_swap( &m->variables );
00091         var_done();
00092         var_hash_swap( &m->variables );
00093         m->variables = 0;
00094     }
00095 }

Here is the call graph for this function:

struct hash* demand_rules module_t  ) 
 

Definition at line 63 of file modules.c.

References hashinit(), m, new_module_str(), RULE, and module_t::rules.

Referenced by enter_rule().

00064 {
00065     if ( !m->rules )
00066         m->rules = hashinit( sizeof( RULE ), new_module_str( m, "rules" ) );
00067     return m->rules;
00068 }

Here is the call graph for this function:

void enter_module module_t  ) 
 

Definition at line 105 of file modules.c.

References m, var_hash_swap(), and module_t::variables.

Referenced by evaluate_in_module(), evaluate_rule(), make_class_module(), swap_settings(), and type_check().

00106 {
00107     var_hash_swap( &m->variables );
00108 }

Here is the call graph for this function:

void exit_module module_t  ) 
 

Definition at line 110 of file modules.c.

References m, var_hash_swap(), and module_t::variables.

Referenced by evaluate_in_module(), evaluate_rule(), make_class_module(), swap_settings(), and type_check().

00111 {
00112     var_hash_swap( &m->variables );
00113 }

Here is the call graph for this function:

void import_module LIST module_names,
module_t target_module
 

Definition at line 115 of file modules.c.

References HASHDATA, hashenter, hashinit(), module_t::imported_modules, LIST, _list::next, s, and _list::string.

Referenced by builtin_import_module(), and import_base_rules().

00116 { 
00117     struct hash* h;
00118 
00119     if (!target_module->imported_modules)
00120         target_module->imported_modules = hashinit( sizeof(char*), "imported");
00121     h = target_module->imported_modules;
00122 
00123     for(;module_names; module_names = module_names->next) {
00124         
00125         char* s = module_names->string;
00126         char** ss = &s;
00127         
00128         hashenter(h, (HASHDATA**)&ss);
00129     }
00130 }

Here is the call graph for this function:

LIST* imported_modules module_t module  ) 
 

Definition at line 140 of file modules.c.

References add_module_name(), hashenumerate(), module_t::imported_modules, and LIST.

Referenced by builtin_imported_modules(), and import_base_rules().

00141 {
00142     LIST *result = L0;
00143 
00144     if ( module->imported_modules )
00145         hashenumerate( module->imported_modules, add_module_name, &result );
00146 
00147     return result;
00148 }

Here is the call graph for this function:

module_t* root_module  ) 
 

Definition at line 97 of file modules.c.

References bindmodule().

Referenced by bind_builtin(), bindrule(), builtin_caller_module(), builtin_import_module(), duplicate_rule(), evaluate_in_module(), frame_init(), global_rule(), global_rule_name(), and swap_settings().

00098 {
00099     static module_t* root = 0;
00100     if ( !root )
00101         root = bindmodule(0);
00102     return root;
00103 }

Here is the call graph for this function:


Generated on Mon Nov 8 17:08:13 2004 for MPT by  doxygen 1.3.9.1