Commit | Line | Data |
---|---|---|
1ffa265b MD |
1 | /* classes: h_files */ |
2 | ||
729dbac3 DH |
3 | #ifndef SCM_MODULES_H |
4 | #define SCM_MODULES_H | |
8c494e99 | 5 | |
62e15979 | 6 | /* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc. |
8c494e99 | 7 | * |
73be1d9e | 8 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
9 | * modify it under the terms of the GNU Lesser General Public License |
10 | * as published by the Free Software Foundation; either version 3 of | |
11 | * the License, or (at your option) any later version. | |
8c494e99 | 12 | * |
53befeb7 NJ |
13 | * This library is distributed in the hope that it will be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
8c494e99 | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301 USA | |
73be1d9e | 22 | */ |
8c494e99 | 23 | |
1ffa265b MD |
24 | \f |
25 | ||
26 | #include "libguile/__scm.h" | |
27 | ||
b486ccc8 MD |
28 | #include "libguile/validate.h" |
29 | ||
1ffa265b MD |
30 | \f |
31 | ||
33b001fd MV |
32 | SCM_API int scm_module_system_booted_p; |
33 | SCM_API scm_t_bits scm_module_tag; | |
d02b98e9 | 34 | |
b486ccc8 | 35 | #define SCM_MODULEP(OBJ) \ |
729dbac3 | 36 | (!SCM_IMP (OBJ) && SCM_CELL_TYPE (OBJ) == scm_module_tag) |
b486ccc8 | 37 | |
6182ceac | 38 | #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, MODULEP, "module") |
b486ccc8 MD |
39 | |
40 | /* NOTE: Indexes of module fields are dependent upon the definition of | |
41 | * module-type in boot-9.scm. | |
42 | */ | |
43 | ||
44 | #define scm_module_index_obarray 0 | |
45 | #define scm_module_index_uses 1 | |
46 | #define scm_module_index_binder 2 | |
47 | #define scm_module_index_eval_closure 3 | |
55000e5f | 48 | #define scm_module_index_transformer 4 |
608860a5 LC |
49 | #define scm_module_index_duplicate_handlers 7 |
50 | #define scm_module_index_import_obarray 8 | |
b486ccc8 MD |
51 | |
52 | #define SCM_MODULE_OBARRAY(module) \ | |
53 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_obarray]) | |
54 | #define SCM_MODULE_USES(module) \ | |
55 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_uses]) | |
56 | #define SCM_MODULE_BINDER(module) \ | |
57 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_binder]) | |
58 | #define SCM_MODULE_EVAL_CLOSURE(module) \ | |
59 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_eval_closure]) | |
55000e5f MV |
60 | #define SCM_MODULE_TRANSFORMER(module) \ |
61 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_transformer]) | |
608860a5 LC |
62 | #define SCM_MODULE_DUPLICATE_HANDLERS(module) \ |
63 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_duplicate_handlers]) | |
64 | #define SCM_MODULE_IMPORT_OBARRAY(module) \ | |
65 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_import_obarray]) | |
b486ccc8 | 66 | |
33b001fd | 67 | SCM_API scm_t_bits scm_tc16_eval_closure; |
e841c3e0 KN |
68 | |
69 | #define SCM_EVAL_CLOSURE_P(x) SCM_TYP16_PREDICATE (scm_tc16_eval_closure, x) | |
fb43bf74 | 70 | |
b486ccc8 MD |
71 | \f |
72 | ||
33b001fd | 73 | SCM_API SCM scm_current_module (void); |
f39fc3b3 | 74 | SCM_API SCM scm_the_root_module (void); |
33b001fd MV |
75 | SCM_API SCM scm_interaction_environment (void); |
76 | SCM_API SCM scm_set_current_module (SCM module); | |
77 | ||
78 | SCM_API SCM scm_c_call_with_current_module (SCM module, | |
79 | SCM (*func)(void *), void *data); | |
661ae7ab | 80 | SCM_API void scm_dynwind_current_module (SCM module); |
33b001fd | 81 | |
62e15979 AW |
82 | SCM_API SCM scm_module_variable (SCM module, SCM sym); |
83 | SCM_API SCM scm_module_local_variable (SCM module, SCM sym); | |
84 | SCM_API SCM scm_module_ensure_local_variable (SCM module, SCM sym); | |
85 | ||
33b001fd MV |
86 | SCM_API SCM scm_c_lookup (const char *name); |
87 | SCM_API SCM scm_c_define (const char *name, SCM val); | |
88 | SCM_API SCM scm_lookup (SCM symbol); | |
89 | SCM_API SCM scm_define (SCM symbol, SCM val); | |
90 | ||
91 | SCM_API SCM scm_c_module_lookup (SCM module, const char *name); | |
92 | SCM_API SCM scm_c_module_define (SCM module, const char *name, SCM val); | |
93 | SCM_API SCM scm_module_lookup (SCM module, SCM symbol); | |
94 | SCM_API SCM scm_module_define (SCM module, SCM symbol, SCM val); | |
608860a5 | 95 | SCM_API SCM scm_module_export (SCM module, SCM symbol_list); |
33b001fd MV |
96 | SCM_API SCM scm_module_reverse_lookup (SCM module, SCM variable); |
97 | ||
ef8e9356 AW |
98 | SCM_API SCM scm_public_variable (SCM module_name, SCM name); |
99 | SCM_API SCM scm_private_variable (SCM module_name, SCM name); | |
100 | SCM_API SCM scm_c_public_variable (const char *module_name, const char *name); | |
101 | SCM_API SCM scm_c_private_variable (const char *module_name, const char *name); | |
102 | ||
103 | SCM_API SCM scm_public_lookup (SCM module_name, SCM name); | |
104 | SCM_API SCM scm_private_lookup (SCM module_name, SCM name); | |
105 | SCM_API SCM scm_c_public_lookup (const char *module_name, const char *name); | |
106 | SCM_API SCM scm_c_private_lookup (const char *module_name, const char *name); | |
107 | ||
108 | SCM_API SCM scm_public_ref (SCM module_name, SCM name); | |
109 | SCM_API SCM scm_private_ref (SCM module_name, SCM name); | |
110 | SCM_API SCM scm_c_public_ref (const char *module_name, const char *name); | |
111 | SCM_API SCM scm_c_private_ref (const char *module_name, const char *name); | |
112 | ||
33b001fd MV |
113 | SCM_API SCM scm_c_resolve_module (const char *name); |
114 | SCM_API SCM scm_resolve_module (SCM name); | |
115 | SCM_API SCM scm_c_define_module (const char *name, | |
116 | void (*init)(void *), void *data); | |
117 | SCM_API void scm_c_use_module (const char *name); | |
118 | SCM_API void scm_c_export (const char *name, ...); | |
119 | ||
dc68fdb9 | 120 | SCM_API SCM scm_module_public_interface (SCM module); |
109c2c9f | 121 | SCM_API SCM scm_module_import_interface (SCM module, SCM sym); |
33b001fd MV |
122 | SCM_API SCM scm_module_lookup_closure (SCM module); |
123 | SCM_API SCM scm_module_transformer (SCM module); | |
124 | SCM_API SCM scm_current_module_lookup_closure (void); | |
125 | SCM_API SCM scm_current_module_transformer (void); | |
126 | SCM_API SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep); | |
127 | SCM_API SCM scm_standard_eval_closure (SCM module); | |
128 | SCM_API SCM scm_standard_interface_eval_closure (SCM module); | |
daedb492 | 129 | SCM_API SCM scm_eval_closure_module (SCM eval_closure); /* deprecated already */ |
33b001fd MV |
130 | SCM_API SCM scm_get_pre_modules_obarray (void); |
131 | SCM_API SCM scm_lookup_closure_module (SCM proc); | |
132 | ||
102dbb6f LC |
133 | SCM_INTERNAL void scm_modules_prehistory (void); |
134 | SCM_INTERNAL void scm_init_modules (void); | |
1ffa265b | 135 | |
729dbac3 | 136 | #endif /* SCM_MODULES_H */ |
89e00824 ML |
137 | |
138 | /* | |
139 | Local Variables: | |
140 | c-file-style: "gnu" | |
141 | End: | |
142 | */ |