From 0f458a37259a53adc7b50b66a5944ecc3668ffda Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 27 Nov 2009 23:12:35 +0100 Subject: factor copy-tree and cons-source out of eval.[ch] * libguile.h: * libguile/Makefile.am * libguile/init.c (scm_i_init_guile): Add trees.[ch] to the build. * libguile/eval.c: * libguile/eval.h: Remove scm_copy_tree and scm_cons_source... * libguile/trees.h: * libguile/trees.c: * libguile/srcprop.h: * libguile/srcprop.c: ... factoring them out here and here, respectively. * test-suite/tests/eval.test ("memoization"): Change expected exception for circular data structures, given new copy-tree location. --- libguile/srcprop.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libguile/srcprop.c') diff --git a/libguile/srcprop.c b/libguile/srcprop.c index 77430bd82..b2e4ff322 100644 --- a/libguile/srcprop.c +++ b/libguile/srcprop.c @@ -383,6 +383,24 @@ SCM_DEFINE (scm_set_source_property_x, "set-source-property!", 3, 0, 0, #undef FUNC_NAME +SCM_DEFINE (scm_cons_source, "cons-source", 3, 0, 0, + (SCM xorig, SCM x, SCM y), + "Create and return a new pair whose car and cdr are @var{x} and @var{y}.\n" + "Any source properties associated with @var{xorig} are also associated\n" + "with the new pair.") +#define FUNC_NAME s_scm_cons_source +{ + SCM p, z; + z = scm_cons (x, y); + /* Copy source properties possibly associated with xorig. */ + p = scm_whash_lookup (scm_source_whash, xorig); + if (scm_is_true (p)) + scm_whash_insert (scm_source_whash, z, p); + return z; +} +#undef FUNC_NAME + + void scm_init_srcprop () { -- cgit v1.2.3