* strports.c (scm_eval_0str): New function.
authorJim Blandy <jimb@red-bean.com>
Tue, 29 Oct 1996 03:06:26 +0000 (03:06 +0000)
committerJim Blandy <jimb@red-bean.com>
Tue, 29 Oct 1996 03:06:26 +0000 (03:06 +0000)
#include "read.h", to get prototype for scm_read.
* Makefile.in (strports.o): Update dependencies.
* strports.h: New prototype.

libguile/Makefile.in
libguile/strports.c
libguile/strports.h

index ac6f6bc..18c1d03 100644 (file)
@@ -800,7 +800,7 @@ strports.o: strports.c _scm.h __scm.h scmconfig.h \
  tags.h error.h __scm.h print.h \
  options.h pairs.h list.h gc.h gsubr.h procs.h numbers.h \
  symbols.h boolean.h strings.h vectors.h root.h ports.h async.h unif.h \
- eval.h strports.h strports.x
+ eval.h read.h strports.h strports.x
 struct.o: struct.c _scm.h __scm.h scmconfig.h \
  tags.h error.h __scm.h print.h \
  options.h pairs.h list.h gc.h gsubr.h procs.h numbers.h \
index ae9e53e..48d5c08 100644 (file)
@@ -44,6 +44,7 @@
 #include "_scm.h"
 #include "unif.h"
 #include "eval.h"
+#include "read.h"
 
 #include "strports.h"
 
@@ -227,6 +228,27 @@ scm_call_with_input_string (str, proc)
 }
 
 
+
+/* Given a null-terminated string EXPR containing Scheme program text,
+   evaluate it, and discard the result.  */
+void
+scm_eval_0str (expr)
+     char *expr;
+{
+  SCM port = scm_mkstrport (SCM_MAKINUM (0),
+                           scm_makfrom0str (expr),
+                           SCM_OPN | SCM_RDNG,
+                           "scm_eval_0str");
+  SCM form;
+
+  /* Read expressions from that port; ignore the values.  */
+  while ((form = scm_read (port, SCM_BOOL_F, SCM_BOOL_F)) != SCM_EOF_VAL)
+    scm_eval_x (form);
+
+  scm_close_port (port);
+}
+
+
 static int noop0 SCM_P ((SCM stream));
 
 static int 
index 48e15e6..4e0598f 100644 (file)
@@ -54,6 +54,7 @@ extern SCM scm_mkstrport SCM_P ((SCM pos, SCM str, long modes, char * caller));
 extern SCM scm_call_with_output_string SCM_P ((SCM proc));
 extern SCM scm_strprint_obj SCM_P ((SCM obj));
 extern SCM scm_call_with_input_string SCM_P ((SCM str, SCM proc));
+extern void scm_eval_0str SCM_P ((char *expr));
 extern void scm_init_strports SCM_P ((void));
 
 #endif  /* STRPORTSH */