Add:Core:Added support for evaluating semicolon separated commands
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 5 Feb 2009 10:25:29 +0000 (10:25 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 5 Feb 2009 10:25:29 +0000 (10:25 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2011 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/command.c
navit/command.h

index bdaf4ee..2a84998 100644 (file)
@@ -626,7 +626,6 @@ command_evaluate_to_void(struct attr *attr, char *expr)
 {
        struct result res;
        struct context ctx;
-       dbg(0,"command=%s attr.type=%s\n", expr, attr_to_name(attr->type));
        memset(&res, 0, sizeof(res));
        memset(&ctx, 0, sizeof(ctx));
        ctx.attr=attr;
@@ -636,6 +635,27 @@ command_evaluate_to_void(struct attr *attr, char *expr)
        resolve(&ctx, &res, NULL);
 }
 
+void
+command_evaluate(struct attr *attr, char *expr)
+{
+       struct result res;
+       struct context ctx;
+       memset(&res, 0, sizeof(res));
+       memset(&ctx, 0, sizeof(ctx));
+       ctx.attr=attr;
+       ctx.error=0;
+       ctx.expr=expr;
+       for (;;) {
+               eval_comma(&ctx,&res);
+               if (ctx.error)
+                       return;
+               resolve(&ctx, &res, NULL);
+               if (ctx.error)
+                       return;
+               if (!get_op(&ctx,0,";",NULL)) return;
+       }
+}
+
 #if 0
 void
 command_interpreter(struct attr *attr)
index 992115a..cecfbd1 100644 (file)
@@ -7,5 +7,6 @@ struct command_table {
 #define command_cast(x) (int (*)(void *, char *, struct attr **, struct attr ***))(x)
 
 void command_evaluate_to_void(struct attr *attr, char *expr);
+void command_evaluate(struct attr *attr, char *expr);
 void command_add_table(struct callback_list *cbl, struct command_table *table, int count, void *data);