modules.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* classes: h_files */
  2. #ifndef SCM_MODULES_H
  3. #define SCM_MODULES_H
  4. /* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2011, 2012 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 License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * 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
  19. * 02110-1301 USA
  20. */
  21. #include "libguile/__scm.h"
  22. #include "libguile/validate.h"
  23. SCM_API int scm_module_system_booted_p;
  24. SCM_API scm_t_bits scm_module_tag;
  25. #define SCM_MODULEP(OBJ) \
  26. (!SCM_IMP (OBJ) && SCM_CELL_TYPE (OBJ) == scm_module_tag)
  27. #define SCM_VALIDATE_MODULE(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, MODULEP, "module")
  28. /* NOTE: Indexes of module fields are dependent upon the definition of
  29. * module-type in boot-9.scm.
  30. */
  31. #define scm_module_index_obarray 0
  32. #define scm_module_index_uses 1
  33. #define scm_module_index_binder 2
  34. #define scm_module_index_eval_closure 3
  35. #define scm_module_index_transformer 4
  36. #define scm_module_index_duplicate_handlers 7
  37. #define scm_module_index_import_obarray 8
  38. #define SCM_MODULE_OBARRAY(module) \
  39. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_obarray])
  40. #define SCM_MODULE_USES(module) \
  41. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_uses])
  42. #define SCM_MODULE_BINDER(module) \
  43. SCM_PACK (SCM_STRUCT_DATA (module) [scm_module_index_binder])
  44. #define SCM_MODULE_EVAL_CLOSURE(module) \
  45. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_eval_closure])
  46. #define SCM_MODULE_TRANSFORMER(module) \
  47. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_transformer])
  48. #define SCM_MODULE_DUPLICATE_HANDLERS(module) \
  49. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_duplicate_handlers])
  50. #define SCM_MODULE_IMPORT_OBARRAY(module) \
  51. SCM_PACK (SCM_STRUCT_DATA (module)[scm_module_index_import_obarray])
  52. SCM_API SCM scm_current_module (void);
  53. SCM_API SCM scm_the_root_module (void);
  54. SCM_API SCM scm_interaction_environment (void);
  55. SCM_API SCM scm_set_current_module (SCM module);
  56. SCM_API SCM scm_c_call_with_current_module (SCM module,
  57. SCM (*func)(void *), void *data);
  58. SCM_API void scm_dynwind_current_module (SCM module);
  59. SCM_API SCM scm_module_variable (SCM module, SCM sym);
  60. SCM_API SCM scm_module_local_variable (SCM module, SCM sym);
  61. SCM_API SCM scm_module_ensure_local_variable (SCM module, SCM sym);
  62. SCM_API SCM scm_c_lookup (const char *name);
  63. SCM_API SCM scm_c_define (const char *name, SCM val);
  64. SCM_API SCM scm_lookup (SCM symbol);
  65. SCM_API SCM scm_define (SCM symbol, SCM val);
  66. SCM_API SCM scm_c_module_lookup (SCM module, const char *name);
  67. SCM_API SCM scm_c_module_define (SCM module, const char *name, SCM val);
  68. SCM_API SCM scm_module_lookup (SCM module, SCM symbol);
  69. SCM_API SCM scm_module_define (SCM module, SCM symbol, SCM val);
  70. SCM_API SCM scm_module_export (SCM module, SCM symbol_list);
  71. SCM_API SCM scm_module_reverse_lookup (SCM module, SCM variable);
  72. SCM_API SCM scm_public_variable (SCM module_name, SCM name);
  73. SCM_API SCM scm_private_variable (SCM module_name, SCM name);
  74. SCM_API SCM scm_c_public_variable (const char *module_name, const char *name);
  75. SCM_API SCM scm_c_private_variable (const char *module_name, const char *name);
  76. SCM_API SCM scm_public_lookup (SCM module_name, SCM name);
  77. SCM_API SCM scm_private_lookup (SCM module_name, SCM name);
  78. SCM_API SCM scm_c_public_lookup (const char *module_name, const char *name);
  79. SCM_API SCM scm_c_private_lookup (const char *module_name, const char *name);
  80. SCM_API SCM scm_public_ref (SCM module_name, SCM name);
  81. SCM_API SCM scm_private_ref (SCM module_name, SCM name);
  82. SCM_API SCM scm_c_public_ref (const char *module_name, const char *name);
  83. SCM_API SCM scm_c_private_ref (const char *module_name, const char *name);
  84. SCM_API SCM scm_c_resolve_module (const char *name);
  85. SCM_API SCM scm_resolve_module (SCM name);
  86. SCM_API SCM scm_c_define_module (const char *name,
  87. void (*init)(void *), void *data);
  88. SCM_API void scm_c_use_module (const char *name);
  89. SCM_API void scm_c_export (const char *name, ...);
  90. SCM_API SCM scm_module_public_interface (SCM module);
  91. SCM_API SCM scm_module_import_interface (SCM module, SCM sym);
  92. SCM_API SCM scm_module_transformer (SCM module);
  93. SCM_API SCM scm_current_module_transformer (void);
  94. SCM_API SCM scm_get_pre_modules_obarray (void);
  95. SCM_INTERNAL void scm_modules_prehistory (void);
  96. SCM_INTERNAL void scm_init_modules (void);
  97. #endif /* SCM_MODULES_H */
  98. /*
  99. Local Variables:
  100. c-file-style: "gnu"
  101. End:
  102. */