modules.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* classes: h_files */
  2. #ifndef SCM_MODULES_H
  3. #define SCM_MODULES_H
  4. /* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library 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 GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libguile/__scm.h"
  21. #include "libguile/validate.h"
  22. SCM_API int scm_module_system_booted_p;
  23. SCM_API scm_t_bits scm_module_tag;
  24. #define SCM_MODULEP(OBJ) \
  25. (!SCM_IMP (OBJ) && SCM_CELL_TYPE (OBJ) == scm_module_tag)
  26. #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, MODULEP, "module")
  27. /* NOTE: Indexes of module fields are dependent upon the definition of
  28. * module-type in boot-9.scm.
  29. */
  30. #define scm_module_index_obarray 0
  31. #define scm_module_index_uses 1
  32. #define scm_module_index_binder 2
  33. #define scm_module_index_eval_closure 3
  34. #define scm_module_index_transformer 4
  35. #define SCM_MODULE_OBARRAY(module) \
  36. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_obarray])
  37. #define SCM_MODULE_USES(module) \
  38. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_uses])
  39. #define SCM_MODULE_BINDER(module) \
  40. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_binder])
  41. #define SCM_MODULE_EVAL_CLOSURE(module) \
  42. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_eval_closure])
  43. #define SCM_MODULE_TRANSFORMER(module) \
  44. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_transformer])
  45. SCM_API scm_t_bits scm_tc16_eval_closure;
  46. #define SCM_EVAL_CLOSURE_P(x) SCM_TYP16_PREDICATE (scm_tc16_eval_closure, x)
  47. SCM_API SCM scm_current_module (void);
  48. SCM_API SCM scm_interaction_environment (void);
  49. SCM_API SCM scm_set_current_module (SCM module);
  50. SCM_API SCM scm_c_call_with_current_module (SCM module,
  51. SCM (*func)(void *), void *data);
  52. SCM_API void scm_dynwind_current_module (SCM module);
  53. SCM_API SCM scm_c_lookup (const char *name);
  54. SCM_API SCM scm_c_define (const char *name, SCM val);
  55. SCM_API SCM scm_lookup (SCM symbol);
  56. SCM_API SCM scm_define (SCM symbol, SCM val);
  57. SCM_API SCM scm_c_module_lookup (SCM module, const char *name);
  58. SCM_API SCM scm_c_module_define (SCM module, const char *name, SCM val);
  59. SCM_API SCM scm_module_lookup (SCM module, SCM symbol);
  60. SCM_API SCM scm_module_define (SCM module, SCM symbol, SCM val);
  61. SCM_API SCM scm_module_reverse_lookup (SCM module, SCM variable);
  62. SCM_API SCM scm_c_resolve_module (const char *name);
  63. SCM_API SCM scm_resolve_module (SCM name);
  64. SCM_API SCM scm_c_define_module (const char *name,
  65. void (*init)(void *), void *data);
  66. SCM_API void scm_c_use_module (const char *name);
  67. SCM_API void scm_c_export (const char *name, ...);
  68. SCM_API SCM scm_sym2var (SCM sym, SCM thunk, SCM definep);
  69. SCM_API SCM scm_module_import_interface (SCM module, SCM sym);
  70. SCM_API SCM scm_module_lookup_closure (SCM module);
  71. SCM_API SCM scm_module_transformer (SCM module);
  72. SCM_API SCM scm_current_module_lookup_closure (void);
  73. SCM_API SCM scm_current_module_transformer (void);
  74. SCM_API SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep);
  75. SCM_API SCM scm_standard_eval_closure (SCM module);
  76. SCM_API SCM scm_standard_interface_eval_closure (SCM module);
  77. SCM_API SCM scm_get_pre_modules_obarray (void);
  78. SCM_API SCM scm_lookup_closure_module (SCM proc);
  79. SCM_API SCM scm_env_top_level (SCM env);
  80. SCM_API SCM scm_env_module (SCM env);
  81. SCM_API SCM scm_top_level_env (SCM thunk);
  82. SCM_API SCM scm_system_module_env_p (SCM env);
  83. SCM_API void scm_modules_prehistory (void);
  84. SCM_API void scm_init_modules (void);
  85. #endif /* SCM_MODULES_H */
  86. /*
  87. Local Variables:
  88. c-file-style: "gnu"
  89. End:
  90. */