summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
Diffstat (limited to 'libguile')
-rw-r--r--libguile/srcprop.c18
-rw-r--r--libguile/srcprop.h4
2 files changed, 21 insertions, 1 deletions
diff --git a/libguile/srcprop.c b/libguile/srcprop.c
index c43acdf95..c632bb0c5 100644
--- a/libguile/srcprop.c
+++ b/libguile/srcprop.c
@@ -94,6 +94,14 @@ static SCM scm_srcprops_to_alist (SCM obj);
scm_t_bits scm_tc16_srcprops;
+
+static int
+supports_source_props (SCM obj)
+{
+ return SCM_NIMP (obj) && !scm_is_symbol (obj) && !scm_is_keyword (obj);
+}
+
+
static int
srcprops_print (SCM obj, SCM port, scm_print_state *pstate)
{
@@ -160,6 +168,16 @@ scm_srcprops_to_alist (SCM obj)
return alist;
}
+SCM_DEFINE (scm_supports_source_properties_p, "supports-source-properties?", 1, 0, 0,
+ (SCM obj),
+ "Return #t if @var{obj} supports adding source properties,\n"
+ "otherwise return #f.")
+#define FUNC_NAME s_scm_supports_source_properties_p
+{
+ return scm_from_bool (supports_source_props (obj));
+}
+#undef FUNC_NAME
+
SCM_DEFINE (scm_source_properties, "source-properties", 1, 0, 0,
(SCM obj),
"Return the source property association list of @var{obj}.")
diff --git a/libguile/srcprop.h b/libguile/srcprop.h
index 250756dcc..0252e54a1 100644
--- a/libguile/srcprop.h
+++ b/libguile/srcprop.h
@@ -3,7 +3,8 @@
#ifndef SCM_SRCPROP_H
#define SCM_SRCPROP_H
-/* Copyright (C) 1995,1996,2000,2001, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 2000, 2001, 2006, 2008, 2009, 2010,
+ * 2011, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -41,6 +42,7 @@ SCM_API SCM scm_sym_column;
+SCM_API SCM scm_supports_source_properties_p (SCM obj);
SCM_API SCM scm_make_srcprops (long line, int col, SCM fname, SCM copy, SCM plist);
SCM_API SCM scm_source_property (SCM obj, SCM key);
SCM_API SCM scm_set_source_property_x (SCM obj, SCM key, SCM datum);