modules.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* classes: h_files */
  2. #ifndef SCM_MODULES_H
  3. #define SCM_MODULES_H
  4. /* Copyright (C) 1998,2000,2001 Free Software Foundation, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this software; see the file COPYING. If not, write to
  18. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301 USA
  20. *
  21. * As a special exception, the Free Software Foundation gives permission
  22. * for additional uses of the text contained in its release of GUILE.
  23. *
  24. * The exception is that, if you link the GUILE library with other files
  25. * to produce an executable, this does not by itself cause the
  26. * resulting executable to be covered by the GNU General Public License.
  27. * Your use of that executable is in no way restricted on account of
  28. * linking the GUILE library code into it.
  29. *
  30. * This exception does not however invalidate any other reasons why
  31. * the executable file might be covered by the GNU General Public License.
  32. *
  33. * This exception applies only to the code released by the
  34. * Free Software Foundation under the name GUILE. If you copy
  35. * code from other Free Software Foundation releases into a copy of
  36. * GUILE, as the General Public License permits, the exception does
  37. * not apply to the code that you add in this way. To avoid misleading
  38. * anyone as to the status of such modified files, you must delete
  39. * this exception notice from them.
  40. *
  41. * If you write modifications of your own for GUILE, it is your choice
  42. * whether to permit this exception to apply to your modifications.
  43. * If you do not wish that, delete this exception notice. */
  44. #include "libguile/__scm.h"
  45. #include "libguile/validate.h"
  46. extern int scm_module_system_booted_p;
  47. extern scm_t_bits scm_module_tag;
  48. #define SCM_MODULEP(OBJ) \
  49. (!SCM_IMP (OBJ) && SCM_CELL_TYPE (OBJ) == scm_module_tag)
  50. #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE (pos, scm, MODULEP)
  51. /* NOTE: Indexes of module fields are dependent upon the definition of
  52. * module-type in boot-9.scm.
  53. */
  54. #define scm_module_index_obarray 0
  55. #define scm_module_index_uses 1
  56. #define scm_module_index_binder 2
  57. #define scm_module_index_eval_closure 3
  58. #define scm_module_index_transformer 4
  59. #define SCM_MODULE_OBARRAY(module) \
  60. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_obarray])
  61. #define SCM_MODULE_USES(module) \
  62. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_uses])
  63. #define SCM_MODULE_BINDER(module) \
  64. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_binder])
  65. #define SCM_MODULE_EVAL_CLOSURE(module) \
  66. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_eval_closure])
  67. #define SCM_MODULE_TRANSFORMER(module) \
  68. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_transformer])
  69. extern scm_t_bits scm_tc16_eval_closure;
  70. #define SCM_EVAL_CLOSURE_P(x) SCM_TYP16_PREDICATE (scm_tc16_eval_closure, x)
  71. extern SCM scm_current_module (void);
  72. extern SCM scm_interaction_environment (void);
  73. extern SCM scm_set_current_module (SCM module);
  74. extern SCM scm_c_call_with_current_module (SCM module,
  75. SCM (*func)(void *), void *data);
  76. extern SCM scm_c_lookup (const char *name);
  77. extern SCM scm_c_define (const char *name, SCM val);
  78. extern SCM scm_lookup (SCM symbol);
  79. extern SCM scm_define (SCM symbol, SCM val);
  80. extern SCM scm_c_module_lookup (SCM module, const char *name);
  81. extern SCM scm_c_module_define (SCM module, const char *name, SCM val);
  82. extern SCM scm_module_lookup (SCM module, SCM symbol);
  83. extern SCM scm_module_define (SCM module, SCM symbol, SCM val);
  84. extern SCM scm_module_reverse_lookup (SCM module, SCM variable);
  85. extern SCM scm_c_resolve_module (const char *name);
  86. extern SCM scm_resolve_module (SCM name);
  87. extern SCM scm_c_define_module (const char *name,
  88. void (*init)(void *), void *data);
  89. extern void scm_c_use_module (const char *name);
  90. extern void scm_c_export (const char *name, ...);
  91. extern SCM scm_sym2var (SCM sym, SCM thunk, SCM definep);
  92. extern SCM scm_module_lookup_closure (SCM module);
  93. extern SCM scm_module_transformer (SCM module);
  94. extern SCM scm_current_module_lookup_closure (void);
  95. extern SCM scm_current_module_transformer (void);
  96. extern SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep);
  97. extern SCM scm_standard_eval_closure (SCM module);
  98. extern SCM scm_standard_interface_eval_closure (SCM module);
  99. extern SCM scm_get_pre_modules_obarray (void);
  100. extern SCM scm_lookup_closure_module (SCM proc);
  101. extern SCM scm_env_top_level (SCM env);
  102. extern SCM scm_env_module (SCM env);
  103. extern SCM scm_top_level_env (SCM thunk);
  104. extern SCM scm_system_module_env_p (SCM env);
  105. extern void scm_modules_prehistory (void);
  106. extern void scm_init_modules (void);
  107. #if SCM_DEBUG_DEPRECATED == 0
  108. extern SCM scm_the_root_module (void);
  109. extern SCM scm_make_module (SCM name);
  110. extern SCM scm_ensure_user_module (SCM name);
  111. extern SCM scm_load_scheme_module (SCM name);
  112. #endif
  113. #endif /* SCM_MODULES_H */
  114. /*
  115. Local Variables:
  116. c-file-style: "gnu"
  117. End:
  118. */