eval.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /* classes: h_files */
  2. #ifndef SCM_EVAL_H
  3. #define SCM_EVAL_H
  4. /* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003,2004
  5. * Free Software Foundation, Inc.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "libguile/__scm.h"
  22. #include "libguile/struct.h"
  23. /* {Options}
  24. */
  25. SCM_API scm_t_option scm_eval_opts[];
  26. #define SCM_EVAL_STACK scm_eval_opts[0].val
  27. #define SCM_N_EVAL_OPTIONS 1
  28. SCM_API long scm_eval_stack;
  29. SCM_API scm_t_option scm_evaluator_trap_table[];
  30. SCM_API SCM scm_eval_options_interface (SCM setting);
  31. #define SCM_TRAPS_P scm_evaluator_trap_table[0].val
  32. #define SCM_ENTER_FRAME_P scm_evaluator_trap_table[1].val
  33. #define SCM_APPLY_FRAME_P scm_evaluator_trap_table[2].val
  34. #define SCM_EXIT_FRAME_P scm_evaluator_trap_table[3].val
  35. #define SCM_ENTER_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[4].val))
  36. #define SCM_APPLY_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[5].val))
  37. #define SCM_EXIT_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[6].val))
  38. #define SCM_N_EVALUATOR_TRAPS 7
  39. /* {Ilocs}
  40. *
  41. * Ilocs are relative pointers into local environment structures.
  42. *
  43. */
  44. #define SCM_ILOCP(n) (SCM_ITAG8(n)==scm_tc8_iloc)
  45. /* {Promises}
  46. */
  47. #define SCM_F_PROMISE_COMPUTED (1L << 0)
  48. #define SCM_PROMISE_COMPUTED_P(promise) \
  49. (SCM_F_PROMISE_COMPUTED & SCM_SMOB_FLAGS (promise))
  50. #define SCM_SET_PROMISE_COMPUTED(promise) \
  51. SCM_SET_SMOB_FLAGS ((promise), SCM_F_PROMISE_COMPUTED)
  52. #define SCM_PROMISE_MUTEX SCM_SMOB_OBJECT_2
  53. #define SCM_PROMISE_DATA SCM_SMOB_OBJECT
  54. #define SCM_SET_PROMISE_DATA SCM_SET_SMOB_OBJECT
  55. SCM_API scm_t_bits scm_tc16_promise;
  56. /* {Evaluator}
  57. */
  58. typedef SCM (*scm_t_trampoline_0) (SCM proc);
  59. typedef SCM (*scm_t_trampoline_1) (SCM proc, SCM arg1);
  60. typedef SCM (*scm_t_trampoline_2) (SCM proc, SCM arg1, SCM arg2);
  61. #define SCM_EXTEND_ENV scm_acons
  62. /*fixme* This should probably be removed throught the code. */
  63. #define SCM_TOP_LEVEL_LOOKUP_CLOSURE (scm_current_module_lookup_closure())
  64. SCM_API SCM scm_sym_and;
  65. SCM_API SCM scm_sym_begin;
  66. SCM_API SCM scm_sym_case;
  67. SCM_API SCM scm_sym_cond;
  68. SCM_API SCM scm_sym_define;
  69. SCM_API SCM scm_sym_do;
  70. SCM_API SCM scm_sym_if;
  71. SCM_API SCM scm_sym_lambda;
  72. SCM_API SCM scm_sym_let;
  73. SCM_API SCM scm_sym_letstar;
  74. SCM_API SCM scm_sym_letrec;
  75. SCM_API SCM scm_sym_quote;
  76. SCM_API SCM scm_sym_quasiquote;
  77. SCM_API SCM scm_sym_unquote;
  78. SCM_API SCM scm_sym_uq_splicing;
  79. SCM_API SCM scm_sym_atapply;
  80. SCM_API SCM scm_sym_atcall_cc;
  81. SCM_API SCM scm_sym_at_call_with_values;
  82. SCM_API SCM scm_sym_delay;
  83. SCM_API SCM scm_sym_arrow;
  84. SCM_API SCM scm_sym_else;
  85. SCM_API SCM scm_sym_apply;
  86. SCM_API SCM scm_sym_set_x;
  87. SCM_API SCM scm_sym_args;
  88. SCM_API SCM * scm_ilookup (SCM iloc, SCM env);
  89. SCM_API SCM * scm_lookupcar (SCM vloc, SCM genv, int check);
  90. SCM_API SCM scm_eval_car (SCM pair, SCM env);
  91. SCM_API SCM scm_eval_body (SCM code, SCM env);
  92. SCM_API SCM scm_eval_args (SCM i, SCM env, SCM proc);
  93. SCM_API SCM scm_m_quote (SCM xorig, SCM env);
  94. SCM_API SCM scm_m_begin (SCM xorig, SCM env);
  95. SCM_API SCM scm_m_if (SCM xorig, SCM env);
  96. SCM_API SCM scm_m_set_x (SCM xorig, SCM env);
  97. SCM_API SCM scm_m_vref (SCM xorig, SCM env);
  98. SCM_API SCM scm_m_vset (SCM xorig, SCM env);
  99. SCM_API SCM scm_m_and (SCM xorig, SCM env);
  100. SCM_API SCM scm_m_or (SCM xorig, SCM env);
  101. SCM_API SCM scm_m_case (SCM xorig, SCM env);
  102. SCM_API SCM scm_m_cond (SCM xorig, SCM env);
  103. SCM_API SCM scm_m_lambda (SCM xorig, SCM env);
  104. SCM_API SCM scm_m_letstar (SCM xorig, SCM env);
  105. SCM_API SCM scm_m_do (SCM xorig, SCM env);
  106. SCM_API SCM scm_m_quasiquote (SCM xorig, SCM env);
  107. SCM_API SCM scm_m_delay (SCM xorig, SCM env);
  108. SCM_API SCM scm_m_generalized_set_x (SCM xorig, SCM env);
  109. SCM_API SCM scm_m_future (SCM xorig, SCM env);
  110. SCM_API SCM scm_m_define (SCM x, SCM env);
  111. SCM_API SCM scm_m_letrec (SCM xorig, SCM env);
  112. SCM_API SCM scm_m_let (SCM xorig, SCM env);
  113. SCM_API SCM scm_m_apply (SCM xorig, SCM env);
  114. SCM_API SCM scm_m_cont (SCM xorig, SCM env);
  115. #if SCM_ENABLE_ELISP
  116. SCM_API SCM scm_m_nil_cond (SCM xorig, SCM env);
  117. SCM_API SCM scm_m_atfop (SCM xorig, SCM env);
  118. #endif /* SCM_ENABLE_ELISP */
  119. SCM_API SCM scm_m_atbind (SCM xorig, SCM env);
  120. SCM_API SCM scm_m_atslot_ref (SCM xorig, SCM env);
  121. SCM_API SCM scm_m_atslot_set_x (SCM xorig, SCM env);
  122. SCM_API SCM scm_m_atdispatch (SCM xorig, SCM env);
  123. SCM_API SCM scm_m_at_call_with_values (SCM xorig, SCM env);
  124. SCM_API int scm_badargsp (SCM formals, SCM args);
  125. SCM_API SCM scm_call_0 (SCM proc);
  126. SCM_API SCM scm_call_1 (SCM proc, SCM arg1);
  127. SCM_API SCM scm_call_2 (SCM proc, SCM arg1, SCM arg2);
  128. SCM_API SCM scm_call_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3);
  129. SCM_API SCM scm_call_4 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM arg4);
  130. SCM_API SCM scm_apply_0 (SCM proc, SCM args);
  131. SCM_API SCM scm_apply_1 (SCM proc, SCM arg1, SCM args);
  132. SCM_API SCM scm_apply_2 (SCM proc, SCM arg1, SCM arg2, SCM args);
  133. SCM_API SCM scm_apply_3 (SCM proc, SCM arg1, SCM arg2, SCM arg3, SCM args);
  134. SCM_API SCM scm_i_call_closure_0 (SCM proc);
  135. SCM_API scm_t_trampoline_0 scm_trampoline_0 (SCM proc);
  136. SCM_API scm_t_trampoline_1 scm_trampoline_1 (SCM proc);
  137. SCM_API scm_t_trampoline_2 scm_trampoline_2 (SCM proc);
  138. SCM_API SCM scm_nconc2last (SCM lst);
  139. SCM_API SCM scm_apply (SCM proc, SCM arg1, SCM args);
  140. SCM_API SCM scm_dapply (SCM proc, SCM arg1, SCM args);
  141. SCM_API SCM scm_map (SCM proc, SCM arg1, SCM args);
  142. SCM_API SCM scm_for_each (SCM proc, SCM arg1, SCM args);
  143. SCM_API SCM scm_closure (SCM code, SCM env);
  144. SCM_API SCM scm_makprom (SCM code);
  145. SCM_API SCM scm_force (SCM x);
  146. SCM_API SCM scm_promise_p (SCM x);
  147. SCM_API SCM scm_cons_source (SCM xorig, SCM x, SCM y);
  148. SCM_API SCM scm_copy_tree (SCM obj);
  149. SCM_API SCM scm_i_eval_x (SCM exp, SCM env);
  150. SCM_API SCM scm_i_eval (SCM exp, SCM env);
  151. SCM_API SCM scm_primitive_eval (SCM exp);
  152. SCM_API SCM scm_primitive_eval_x (SCM exp);
  153. SCM_API SCM scm_eval (SCM exp, SCM module);
  154. SCM_API SCM scm_eval_x (SCM exp, SCM module);
  155. SCM_API void scm_i_print_iloc (SCM /*iloc*/, SCM /*port*/);
  156. SCM_API void scm_i_print_isym (SCM /*isym*/, SCM /*port*/);
  157. SCM_API SCM scm_i_unmemocopy_expr (SCM expr, SCM env);
  158. SCM_API SCM scm_i_unmemocopy_body (SCM forms, SCM env);
  159. SCM_API void scm_init_eval (void);
  160. #if (SCM_ENABLE_DEPRECATED == 1)
  161. SCM_API SCM scm_m_undefine (SCM x, SCM env);
  162. /* Deprecated in guile 1.7.0 on 2003-11-09. */
  163. SCM_API SCM scm_m_expand_body (SCM xorig, SCM env);
  164. /* Deprecated in guile 1.7.0 on 2003-11-16. */
  165. SCM_API SCM scm_unmemocar (SCM form, SCM env);
  166. SCM_API SCM scm_macroexp (SCM x, SCM env);
  167. /* Deprecated in guile 1.7.0 on 2004-03-29. */
  168. SCM_API SCM scm_ceval (SCM x, SCM env);
  169. SCM_API SCM scm_deval (SCM x, SCM env);
  170. SCM_API SCM (*scm_ceval_ptr) (SCM x, SCM env);
  171. #endif
  172. #endif /* SCM_EVAL_H */
  173. /*
  174. Local Variables:
  175. c-file-style: "gnu"
  176. End:
  177. */