Commit | Line | Data |
---|---|---|
1ffa265b MD |
1 | /* classes: h_files */ |
2 | ||
729dbac3 DH |
3 | #ifndef SCM_MODULES_H |
4 | #define SCM_MODULES_H | |
8c494e99 | 5 | |
2b829bbb | 6 | /* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. |
8c494e99 | 7 | * |
73be1d9e MV |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
8c494e99 | 12 | * |
73be1d9e | 13 | * This library is distributed in the hope that it will be useful, |
1ffa265b | 14 | * but 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 | |
92205699 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
73be1d9e | 21 | */ |
8c494e99 | 22 | |
1ffa265b MD |
23 | \f |
24 | ||
25 | #include "libguile/__scm.h" | |
26 | ||
b486ccc8 MD |
27 | #include "libguile/validate.h" |
28 | ||
1ffa265b MD |
29 | \f |
30 | ||
33b001fd MV |
31 | SCM_API int scm_module_system_booted_p; |
32 | SCM_API scm_t_bits scm_module_tag; | |
d02b98e9 | 33 | |
b486ccc8 | 34 | #define SCM_MODULEP(OBJ) \ |
729dbac3 | 35 | (!SCM_IMP (OBJ) && SCM_CELL_TYPE (OBJ) == scm_module_tag) |
b486ccc8 | 36 | |
6182ceac | 37 | #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, MODULEP, "module") |
b486ccc8 MD |
38 | |
39 | /* NOTE: Indexes of module fields are dependent upon the definition of | |
40 | * module-type in boot-9.scm. | |
41 | */ | |
42 | ||
43 | #define scm_module_index_obarray 0 | |
44 | #define scm_module_index_uses 1 | |
45 | #define scm_module_index_binder 2 | |
46 | #define scm_module_index_eval_closure 3 | |
55000e5f | 47 | #define scm_module_index_transformer 4 |
b486ccc8 MD |
48 | |
49 | #define SCM_MODULE_OBARRAY(module) \ | |
50 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_obarray]) | |
51 | #define SCM_MODULE_USES(module) \ | |
52 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_uses]) | |
53 | #define SCM_MODULE_BINDER(module) \ | |
54 | SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_binder]) | |
55 | #define SCM_MODULE_EVAL_CLOSURE(module) \ | |
56 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_eval_closure]) | |
55000e5f MV |
57 | #define SCM_MODULE_TRANSFORMER(module) \ |
58 | SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_transformer]) | |
b486ccc8 | 59 | |
33b001fd | 60 | SCM_API scm_t_bits scm_tc16_eval_closure; |
e841c3e0 KN |
61 | |
62 | #define SCM_EVAL_CLOSURE_P(x) SCM_TYP16_PREDICATE (scm_tc16_eval_closure, x) | |
fb43bf74 | 63 | |
b486ccc8 MD |
64 | \f |
65 | ||
33b001fd MV |
66 | SCM_API SCM scm_current_module (void); |
67 | SCM_API SCM scm_interaction_environment (void); | |
68 | SCM_API SCM scm_set_current_module (SCM module); | |
69 | ||
70 | SCM_API SCM scm_c_call_with_current_module (SCM module, | |
71 | SCM (*func)(void *), void *data); | |
661ae7ab | 72 | SCM_API void scm_dynwind_current_module (SCM module); |
33b001fd MV |
73 | |
74 | SCM_API SCM scm_c_lookup (const char *name); | |
75 | SCM_API SCM scm_c_define (const char *name, SCM val); | |
76 | SCM_API SCM scm_lookup (SCM symbol); | |
77 | SCM_API SCM scm_define (SCM symbol, SCM val); | |
78 | ||
79 | SCM_API SCM scm_c_module_lookup (SCM module, const char *name); | |
80 | SCM_API SCM scm_c_module_define (SCM module, const char *name, SCM val); | |
81 | SCM_API SCM scm_module_lookup (SCM module, SCM symbol); | |
82 | SCM_API SCM scm_module_define (SCM module, SCM symbol, SCM val); | |
83 | SCM_API SCM scm_module_reverse_lookup (SCM module, SCM variable); | |
84 | ||
85 | SCM_API SCM scm_c_resolve_module (const char *name); | |
86 | SCM_API SCM scm_resolve_module (SCM name); | |
87 | SCM_API SCM scm_c_define_module (const char *name, | |
88 | void (*init)(void *), void *data); | |
89 | SCM_API void scm_c_use_module (const char *name); | |
90 | SCM_API void scm_c_export (const char *name, ...); | |
91 | ||
92 | SCM_API SCM scm_sym2var (SCM sym, SCM thunk, SCM definep); | |
93 | ||
109c2c9f | 94 | SCM_API SCM scm_module_import_interface (SCM module, SCM sym); |
33b001fd MV |
95 | SCM_API SCM scm_module_lookup_closure (SCM module); |
96 | SCM_API SCM scm_module_transformer (SCM module); | |
97 | SCM_API SCM scm_current_module_lookup_closure (void); | |
98 | SCM_API SCM scm_current_module_transformer (void); | |
99 | SCM_API SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep); | |
100 | SCM_API SCM scm_standard_eval_closure (SCM module); | |
101 | SCM_API SCM scm_standard_interface_eval_closure (SCM module); | |
102 | SCM_API SCM scm_get_pre_modules_obarray (void); | |
103 | SCM_API SCM scm_lookup_closure_module (SCM proc); | |
104 | ||
105 | SCM_API SCM scm_env_top_level (SCM env); | |
106 | SCM_API SCM scm_env_module (SCM env); | |
107 | SCM_API SCM scm_top_level_env (SCM thunk); | |
108 | SCM_API SCM scm_system_module_env_p (SCM env); | |
109 | ||
110 | SCM_API void scm_modules_prehistory (void); | |
111 | SCM_API void scm_init_modules (void); | |
1ffa265b | 112 | |
729dbac3 | 113 | #endif /* SCM_MODULES_H */ |
89e00824 ML |
114 | |
115 | /* | |
116 | Local Variables: | |
117 | c-file-style: "gnu" | |
118 | End: | |
119 | */ |