diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-11-22 19:49:18 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-11-22 19:49:18 +0000 |
commit | f9a07d67e1bee689b47c434c74e3a859a7f3a1ee (patch) | |
tree | 7a9a78b2184aa367fce0847569e099cbbcb017ee /navit/command.c | |
parent | 4c2389229f7d6e35870562d5391383f7b95986c7 (diff) | |
download | navit-svn-f9a07d67e1bee689b47c434c74e3a859a7f3a1ee.tar.gz |
Add:core:Implement new in command.c
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2790 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/command.c')
-rw-r--r-- | navit/command.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/navit/command.c b/navit/command.c index 1258fc5d..8c9397d5 100644 --- a/navit/command.c +++ b/navit/command.c @@ -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,6 +384,15 @@ 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)); + } 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; |