memoize.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef SCM_MEMOIZE_H
  2. #define SCM_MEMOIZE_H
  3. /* Copyright 1995-1996,1998-2002,2004,2008-2011,2013-2014,2018
  4. Free Software Foundation, Inc.
  5. This file is part of Guile.
  6. Guile is free software: you can redistribute it and/or modify it
  7. under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Guile is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  13. License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with Guile. If not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include "libguile/scm.h"
  18. SCM_API SCM scm_sym_and;
  19. SCM_API SCM scm_sym_begin;
  20. SCM_API SCM scm_sym_case;
  21. SCM_API SCM scm_sym_cond;
  22. SCM_API SCM scm_sym_define;
  23. SCM_API SCM scm_sym_do;
  24. SCM_API SCM scm_sym_if;
  25. SCM_API SCM scm_sym_lambda;
  26. SCM_API SCM scm_sym_let;
  27. SCM_API SCM scm_sym_letstar;
  28. SCM_API SCM scm_sym_letrec;
  29. SCM_API SCM scm_sym_quote;
  30. SCM_API SCM scm_sym_quasiquote;
  31. SCM_API SCM scm_sym_unquote;
  32. SCM_API SCM scm_sym_uq_splicing;
  33. SCM_API SCM scm_sym_at;
  34. SCM_API SCM scm_sym_atat;
  35. SCM_API SCM scm_sym_delay;
  36. SCM_API SCM scm_sym_eval_when;
  37. SCM_API SCM scm_sym_arrow;
  38. SCM_API SCM scm_sym_else;
  39. SCM_API SCM scm_sym_apply;
  40. SCM_API SCM scm_sym_set_x;
  41. SCM_API SCM scm_sym_args;
  42. /* {Memoized Source}
  43. */
  44. #define SCM_MEMOIZED_TAG(x) (scm_to_uint16 (scm_car (x)))
  45. #define SCM_MEMOIZED_ARGS(x) (scm_cdr (x))
  46. enum
  47. {
  48. SCM_M_SEQ,
  49. SCM_M_IF,
  50. SCM_M_LAMBDA,
  51. SCM_M_CAPTURE_ENV,
  52. SCM_M_LET,
  53. SCM_M_QUOTE,
  54. SCM_M_CAPTURE_MODULE,
  55. SCM_M_APPLY,
  56. SCM_M_CONT,
  57. SCM_M_CALL_WITH_VALUES,
  58. SCM_M_CALL,
  59. SCM_M_LEXICAL_REF,
  60. SCM_M_LEXICAL_SET,
  61. SCM_M_BOX_REF,
  62. SCM_M_BOX_SET,
  63. SCM_M_RESOLVE,
  64. SCM_M_CALL_WITH_PROMPT
  65. };
  66. SCM_INTERNAL SCM scm_memoize_expression (SCM exp);
  67. SCM_INTERNAL SCM scm_unmemoize_expression (SCM memoized);
  68. SCM_INTERNAL SCM scm_memoized_typecode (SCM sym);
  69. SCM_INTERNAL SCM scm_sys_resolve_variable (SCM loc, SCM module);
  70. SCM_INTERNAL void scm_init_memoize (void);
  71. #endif /* SCM_MEMOIZE_H */