summaryrefslogtreecommitdiff
path: root/libguile/srcprop.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-11-27 23:12:35 +0100
committerAndy Wingo <wingo@pobox.com>2009-12-01 21:00:26 +0100
commit0f458a37259a53adc7b50b66a5944ecc3668ffda (patch)
tree60fc9556922c7469d11f65d83c162cfcb5951216 /libguile/srcprop.c
parent504864b79fcdaf1c24785327b84190a041c30c0c (diff)
downloadguile-0f458a37259a53adc7b50b66a5944ecc3668ffda.tar.gz
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.
Diffstat (limited to 'libguile/srcprop.c')
-rw-r--r--libguile/srcprop.c18
1 files changed, 18 insertions, 0 deletions
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 ()
{