* fix conffiles
[navit-package] / navit / command.c
index 1258fc5..6872522 100644 (file)
@@ -17,7 +17,7 @@
 #include "navit_nls.h"
 
 /*
-gui.fullscreen()
+gui.fullscreen=!gui.fullscreen
 gui.menu()
 gui.get_data() 
 zoom_in() 
@@ -269,9 +269,16 @@ eval_value(struct context *ctx, struct result *res) {
        if ((op[0] >= 'a' && op[0] <= 'z') || op[0] == '_') {
                res->attr.type=attr_none;
                res->var=op;
-               while ((op[0] >= 'a' && op[0] <= 'z') || op[0] == '_') {
-                       res->varlen++;
-                       op++;
+               for (;;) {
+                       while ((op[0] >= 'a' && op[0] <= 'z') || op[0] == '_') {
+                               res->varlen++;
+                               op++;
+                       }
+                       if (res->varlen == 3 && !strncmp(res->var,"new",3) && op[0] == ' ') {
+                               res->varlen++;
+                               op++;
+                       } else
+                               break;
                }
                ctx->expr=op;
                return;
@@ -377,13 +384,28 @@ command_call_function(struct context *ctx, struct result *res)
                res->attr.type=list[0]->type;
                res->attr.u.str=g_strdup(gettext(list[0]->u.str));      
                
+       } else if (!strncmp(function,"new ",4)) {
+               enum attr_type attr_type=attr_from_name(function+4);
+               if (attr_type != attr_none) {
+                       struct object_func *func=object_func_lookup(attr_type);
+                       if (func && func->new) {
+                               res->attr.type=attr_type;
+                               res->attr.u.data=func->new(NULL, list);
+                       }
+               }
        } else {
                if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) {
                        int valid;
+                       struct attr **out=NULL;
                        dbg(1,"function call %s from %s\n",function, attr_to_name(res->attr.type));
-                       callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, NULL, &valid);
-               }
-               res->attr.type=attr_none;
+                       callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid);
+                       if (out && out[0]) {
+                               attr_dup_content(out[0], &res->attr);
+                               attr_list_free(out);
+                       } else
+                               res->attr.type=attr_none;
+               } else
+                       res->attr.type=attr_none;
        }
        res->var=NULL;
        res->varlen=0;