summaryrefslogtreecommitdiff
path: root/libguile/ports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-11-28 16:15:38 +0100
committerAndy Wingo <wingo@pobox.com>2013-11-28 16:15:38 +0100
commit9b95f3ced4f4cc4c7d0ffa59c530a2e1a17a19fc (patch)
tree93c10f0a6fa6c224df9e76df63d32cc3ac2d65ca /libguile/ports.c
parent6683f204ba95321f2cf904d0508117b027f2f2fc (diff)
parenta38024baaa32d1a6d91fdc81388c88bbb926c3ae (diff)
downloadguile-9b95f3ced4f4cc4c7d0ffa59c530a2e1a17a19fc.tar.gz
Merge commit 'a38024baaa32d1a6d91fdc81388c88bbb926c3ae'
Conflicts: libguile/ports.h
Diffstat (limited to 'libguile/ports.c')
-rw-r--r--libguile/ports.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/libguile/ports.c b/libguile/ports.c
index 960dfa8e7..61bd57739 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -60,6 +60,7 @@
#include "libguile/weak-set.h"
#include "libguile/fluids.h"
#include "libguile/eq.h"
+#include "libguile/alist.h"
#ifdef HAVE_STRING_H
#include <string.h>
@@ -342,17 +343,29 @@ scm_i_clear_pending_eof (SCM port)
SCM_PORT_GET_INTERNAL (port)->pending_eof = 0;
}
-SCM
-scm_i_port_alist (SCM port)
+SCM_DEFINE (scm_i_port_property, "%port-property", 2, 0, 0,
+ (SCM port, SCM key),
+ "Return the property of @var{port} associated with @var{key}.")
+#define FUNC_NAME s_scm_i_port_property
{
- return SCM_PORT_GET_INTERNAL (port)->alist;
+ SCM_VALIDATE_OPPORT (1, port);
+ return scm_assq_ref (SCM_PORT_GET_INTERNAL (port)->alist, key);
}
+#undef FUNC_NAME
-void
-scm_i_set_port_alist_x (SCM port, SCM alist)
+SCM_DEFINE (scm_i_set_port_property_x, "%set-port-property!", 3, 0, 0,
+ (SCM port, SCM key, SCM value),
+ "Set the property of @var{port} associated with @var{key} to @var{value}.")
+#define FUNC_NAME s_scm_i_set_port_property_x
{
- SCM_PORT_GET_INTERNAL (port)->alist = alist;
+ scm_t_port_internal *pti;
+
+ SCM_VALIDATE_OPPORT (1, port);
+ pti = SCM_PORT_GET_INTERNAL (port);
+ pti->alist = scm_assq_set_x (pti->alist, key, value);
+ return SCM_UNSPECIFIED;
}
+#undef FUNC_NAME