Minor changes to Makefile.
[egate.git] / fml / fml.c
index 9423b95..371d2b4 100644 (file)
--- a/fml/fml.c
+++ b/fml/fml.c
@@ -2,7 +2,16 @@
  * FML interpreter. Europagate, 1995
  *
  * $Log: fml.c,v $
- * Revision 1.6  1995/02/09 16:06:06  adam
+ * Revision 1.8  1995/02/10 18:15:52  adam
+ * FML function 'strcmp' implemented. This function can be used to
+ * test for existence of MARC fields.
+ *
+ * Revision 1.7  1995/02/10  15:50:54  adam
+ * MARC interface implemented. Minor bugs fixed. fmltest can
+ * be used to format single MARC records. New function '\list'
+ * implemented.
+ *
+ * Revision 1.6  1995/02/09  16:06:06  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
@@ -121,6 +130,7 @@ Fml fml_open (void)
     fml_list_init (fml);
     fml_arit_init (fml);
     fml_rel_init (fml);
+    fml_str_init (fml);
 
     sym_info = fml_sym_add (fml->sym_tab, "s");
     sym_info->kind = FML_CPREFIX;
@@ -281,7 +291,10 @@ static struct fml_node *fml_exec_space (Fml fml, struct fml_node **lp,
                                         struct token *tp)
 {
     fml_cmd_lex (lp, tp);
-    putchar ('_');
+    if (fml->debug & 1)
+        putchar ('_');
+    else
+        putchar (' ');
     return NULL;
 }
 
@@ -358,7 +371,7 @@ static void fml_emit (struct fml_node *list)
                 printf (" ");
             s++;
             for (a = list->p[0]; a; a=a->next)
-                printf ("%s", a->buf);
+                printf ("%.*s", FML_ATOM_BUF, a->buf);
         }
         else
             fml_emit (list->p[0]);
@@ -387,7 +400,6 @@ static struct fml_node *fml_sub2 (Fml fml, struct fml_node **lp,
             break;
         case FML_CPREFIX:
             fn = (*info->prefix) (fml, lp, tp);
-            fml_cmd_lex (lp, tp);
             break;
         default:
             fml_cmd_lex (lp, tp);
@@ -567,8 +579,9 @@ static struct fml_node *fml_exec_foreach (struct fml_sym_info *info, Fml fml,
     }
     else
     {
-        fml_node_delete (fml, info->body);
-        info->body = NULL;
+        if (info_var->kind == FML_VAR)
+            fml_node_delete (fml, info_var->body);
+        info_var->body = NULL;
     }
     if (fml->debug & 1)
     {