Indicator field moved to 'struct iso2709_dir' from 'struct
[egate.git] / fml / fml.c
index b2eb160..d5f5af3 100644 (file)
--- a/fml/fml.c
+++ b/fml/fml.c
@@ -2,7 +2,18 @@
  * FML interpreter. Europagate, 1995
  *
  * $Log: fml.c,v $
- * Revision 1.5  1995/02/09 14:33:36  adam
+ * 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
+ * interface to FML by using the fml_exec_call_str function.
+ *
+ * Revision 1.5  1995/02/09  14:33:36  adam
  * Split source fml.c and define relevant build-in functions in separate
  * files. New operators mult, div, not, llen implemented.
  *
@@ -256,8 +267,6 @@ struct fml_node *fml_expr_term (Fml fml, struct fml_node **lp,
     return fn;
 }
 
-static struct fml_node *fml_exec_group (struct fml_node *list, Fml fml);
-
 void fml_lr_values (Fml fml, struct fml_node *l, int *left_val,
                            struct fml_node *r, int *right_val)
 {
@@ -277,7 +286,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;
 }
 
@@ -354,7 +366,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]);
@@ -383,7 +395,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);
@@ -563,8 +574,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)
     {
@@ -724,7 +736,7 @@ static void fml_emit_expr (Fml fml, struct fml_node **lp, struct token *tp)
     fml_node_delete (fml, fn);
 }
 
-static struct fml_node *fml_exec_group (struct fml_node *list, Fml fml)
+struct fml_node *fml_exec_group (struct fml_node *list, Fml fml)
 {
     struct token token;
     struct fml_sym_info *info;
@@ -862,9 +874,6 @@ static struct fml_node *fml_exec_group (struct fml_node *list, Fml fml)
             }
             break;
         case 't':
-#if 0
-            printf ("<token.tokenbuf=%s>", token.tokenbuf);
-#endif
             if (token.separate && !first)
                 putchar (' ');
             first = 0;
@@ -883,5 +892,5 @@ void fml_exec (Fml fml)
     fml_node_stat (fml);
     fml_exec_group (fml->list, fml);
     if (fml->debug & 1)
-        printf ("\n");
+        putchar ('\n');
 }