+/*
+ * FML interpreter. Europagate, 1995
+ *
+ * $Log: fmlcalls.c,v $
+ * Revision 1.1 1995/02/09 16:06:07 adam
+ * FML can be called from the outside multiple times by the functions:
+ * fml_exec_call and fml_exec_call_str.
+ * An interactive parameter (-i) to fmltest starts a shell-like
+ * interface to FML by using the fml_exec_call_str function.
+ *
+ */
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "fmlp.h"
+
+static const char *str_ptr;
+static int eof_mark;
+static int str_reader (void)
+{
+ if (!*str_ptr)
+ return eof_mark;
+ return *str_ptr++;
+}
+
+void fml_exec_call_str (Fml fml, const char *str)
+{
+ int (*old_func)(void) = fml->read_func;
+
+ fml->read_func = str_reader;
+ str_ptr = str;
+ eof_mark = fml->eof_mark;
+ fml_exec_call (fml);
+ fml->read_func = old_func;
+}