Răsfoiți Sursa

ncd: move arg_value to NCDInterpValue

ambrop7 13 ani în urmă
părinte
comite
540a8d7acd
4 a modificat fișierele cu 302 adăugiri și 263 ștergeri
  1. 1 0
      ncd/CMakeLists.txt
  2. 221 0
      ncd/NCDInterpValue.c
  3. 66 0
      ncd/NCDInterpValue.h
  4. 14 263
      ncd/ncd.c

+ 1 - 0
ncd/CMakeLists.txt

@@ -70,6 +70,7 @@ add_executable(badvpn-ncd
     NCDSugar.c
     NCDInterpBlock.c
     NCDInterpProg.c
+    NCDInterpValue.c
     BEventLock.c
     modules/command_template.c
     modules/event_template.c

+ 221 - 0
ncd/NCDInterpValue.c

@@ -0,0 +1,221 @@
+/**
+ * @file NCDInterpValue.c
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
+ * 
+ * @section LICENSE
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the
+ *    names of its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+#include <misc/offset.h>
+#include <misc/split_string.h>
+#include <base/BLog.h>
+
+#include "NCDInterpValue.h"
+
+#include <generated/blog_channel_ncd.h>
+
+static int NCDInterpValue_InitString (NCDInterpValue *o, const char *string, size_t len);
+static int NCDInterpValue_InitVar (NCDInterpValue *o, const char *name);
+static void NCDInterpValue_InitList (NCDInterpValue *o);
+static int NCDInterpValue_ListAppend (NCDInterpValue *o, NCDInterpValue v);
+static void NCDInterpValue_InitMap (NCDInterpValue *o);
+static int NCDInterpValue_MapAppend (NCDInterpValue *o, NCDInterpValue key, NCDInterpValue val);
+
+int NCDInterpValue_Init (NCDInterpValue *o, NCDValue *val_ast)
+{
+    switch (NCDValue_Type(val_ast)) {
+        case NCDVALUE_STRING: {
+            return NCDInterpValue_InitString(o, NCDValue_StringValue(val_ast), NCDValue_StringLength(val_ast));
+        } break;
+        
+        case NCDVALUE_VAR: {
+            return NCDInterpValue_InitVar(o, NCDValue_VarName(val_ast));
+        } break;
+        
+        case NCDVALUE_LIST: {
+            NCDInterpValue_InitList(o);
+            
+            for (NCDValue *ve = NCDValue_ListFirst(val_ast); ve; ve = NCDValue_ListNext(val_ast, ve)) {
+                NCDInterpValue e;
+                
+                if (!NCDInterpValue_Init(&e, ve)) {
+                    goto fail_list;
+                }
+                
+                if (!NCDInterpValue_ListAppend(o, e)) {
+                    NCDInterpValue_Free(&e);
+                    goto fail_list;
+                }
+            }
+            
+            return 1;
+            
+        fail_list:
+            NCDInterpValue_Free(o);
+            return 0;
+        } break;
+        
+        case NCDVALUE_MAP: {
+            NCDInterpValue_InitMap(o);
+            
+            for (NCDValue *ekey = NCDValue_MapFirstKey(val_ast); ekey; ekey = NCDValue_MapNextKey(val_ast, ekey)) {
+                NCDValue *eval = NCDValue_MapKeyValue(val_ast, ekey);
+                
+                NCDInterpValue key;
+                NCDInterpValue val;
+                
+                if (!NCDInterpValue_Init(&key, ekey)) {
+                    goto fail_map;
+                }
+                
+                if (!NCDInterpValue_Init(&val, eval)) {
+                    NCDInterpValue_Free(&key);
+                    goto fail_map;
+                }
+                
+                if (!NCDInterpValue_MapAppend(o, key, val)) {
+                    NCDInterpValue_Free(&key);
+                    NCDInterpValue_Free(&val);
+                    goto fail_map;
+                }
+            }
+            
+            return 1;
+            
+        fail_map:
+            NCDInterpValue_Free(o);
+            return 0;
+        } break;
+        
+        default:
+            ASSERT(0);
+            return 0;
+    }
+}
+
+void NCDInterpValue_Free (NCDInterpValue *o)
+{
+    switch (o->type) {
+        case NCDVALUE_STRING: {
+            free(o->string);
+        } break;
+        
+        case NCDVALUE_VAR: {
+            free_strings(o->variable_names);
+        } break;
+        
+        case NCDVALUE_LIST: {
+            while (!LinkedList1_IsEmpty(&o->list)) {
+                struct NCDInterpValueListElem *elem = UPPER_OBJECT(LinkedList1_GetFirst(&o->list), struct NCDInterpValueListElem, list_node);
+                NCDInterpValue_Free(&elem->value);
+                LinkedList1_Remove(&o->list, &elem->list_node);
+                free(elem);
+            }
+        } break;
+        
+        case NCDVALUE_MAP: {
+            while (!LinkedList1_IsEmpty(&o->maplist)) {
+                struct NCDInterpValueMapElem *elem = UPPER_OBJECT(LinkedList1_GetFirst(&o->maplist), struct NCDInterpValueMapElem, maplist_node);
+                NCDInterpValue_Free(&elem->key);
+                NCDInterpValue_Free(&elem->val);
+                LinkedList1_Remove(&o->maplist, &elem->maplist_node);
+                free(elem);
+            }
+        } break;
+        
+        default: ASSERT(0);
+    }
+}
+
+int NCDInterpValue_InitString (NCDInterpValue *o, const char *string, size_t len)
+{
+    o->type = NCDVALUE_STRING;
+    
+    if (!(o->string = malloc(len))) {
+        BLog(BLOG_ERROR, "malloc failed");
+        return 0;
+    }
+    memcpy(o->string, string, len);
+    
+    o->string_len = len;
+    
+    return 1;
+}
+
+int NCDInterpValue_InitVar (NCDInterpValue *o, const char *name)
+{
+    ASSERT(name)
+    
+    o->type = NCDVALUE_VAR;
+    if (!(o->variable_names = split_string(name, '.'))) {
+        return 0;
+    }
+    
+    return 1;
+}
+
+void NCDInterpValue_InitList (NCDInterpValue *o)
+{
+    o->type = NCDVALUE_LIST;
+    LinkedList1_Init(&o->list);
+}
+
+int NCDInterpValue_ListAppend (NCDInterpValue *o, NCDInterpValue v)
+{
+    ASSERT(o->type == NCDVALUE_LIST)
+    
+    struct NCDInterpValueListElem *elem = malloc(sizeof(*elem));
+    if (!elem) {
+        BLog(BLOG_ERROR, "malloc failed");
+        return 0;
+    }
+    LinkedList1_Append(&o->list, &elem->list_node);
+    elem->value = v;
+    
+    return 1;
+}
+
+void NCDInterpValue_InitMap (NCDInterpValue *o)
+{
+    o->type = NCDVALUE_MAP;
+    LinkedList1_Init(&o->maplist);
+}
+
+int NCDInterpValue_MapAppend (NCDInterpValue *o, NCDInterpValue key, NCDInterpValue val)
+{
+    ASSERT(o->type == NCDVALUE_MAP)
+    
+    struct NCDInterpValueMapElem *elem = malloc(sizeof(*elem));
+    if (!elem) {
+        BLog(BLOG_ERROR, "malloc failed");
+        return 0;
+    }
+    LinkedList1_Append(&o->maplist, &elem->maplist_node);
+    elem->key = key;
+    elem->val = val;
+    
+    return 1;
+}

+ 66 - 0
ncd/NCDInterpValue.h

@@ -0,0 +1,66 @@
+/**
+ * @file NCDInterpValue.h
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
+ * 
+ * @section LICENSE
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the
+ *    names of its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BADVPN_NCDINTERPVALUE_H
+#define BADVPN_NCDINTERPVALUE_H
+
+#include <stddef.h>
+
+#include <misc/debug.h>
+#include <structure/LinkedList1.h>
+#include <ncd/NCDValue.h>
+
+typedef struct {
+    int type;
+    union {
+        struct {
+            char *string;
+            size_t string_len;
+        };
+        char **variable_names;
+        LinkedList1 list;
+        LinkedList1 maplist;
+    };
+} NCDInterpValue;
+
+struct NCDInterpValueListElem {
+    LinkedList1Node list_node;
+    NCDInterpValue value;
+};
+
+struct NCDInterpValueMapElem {
+    LinkedList1Node maplist_node;
+    NCDInterpValue key;
+    NCDInterpValue val;
+};
+
+int NCDInterpValue_Init (NCDInterpValue *o, NCDValue *val_ast) WARN_UNUSED;
+void NCDInterpValue_Free (NCDInterpValue *o);
+
+#endif

+ 14 - 263
ncd/ncd.c

@@ -56,6 +56,7 @@
 #include <ncd/NCDModuleIndex.h>
 #include <ncd/NCDSugar.h>
 #include <ncd/NCDInterpProg.h>
+#include <ncd/NCDInterpValue.h>
 #include <ncd/modules/modules.h>
 
 #include <ncd/ncd.h>
@@ -66,11 +67,6 @@
 #define LOGGER_STDERR 2
 #define LOGGER_SYSLOG 3
 
-#define ARG_VALUE_TYPE_STRING 1
-#define ARG_VALUE_TYPE_VARIABLE 2
-#define ARG_VALUE_TYPE_LIST 3
-#define ARG_VALUE_TYPE_MAP 4
-
 #define SSTATE_CHILD 1
 #define SSTATE_ADULT 2
 #define SSTATE_DYING 3
@@ -81,30 +77,6 @@
 #define PSTATE_WAITING 3
 #define PSTATE_TERMINATING 4
 
-struct arg_value {
-    int type;
-    union {
-        struct {
-            char *string;
-            size_t string_len;
-        };
-        char **variable_names;
-        LinkedList1 list;
-        LinkedList1 maplist;
-    };
-};
-
-struct arg_list_elem {
-    LinkedList1Node list_node;
-    struct arg_value value;
-};
-
-struct arg_map_elem {
-    LinkedList1Node maplist_node;
-    struct arg_value key;
-    struct arg_value val;
-};
-
 struct process {
     NCDProcess *proc_ast;
     NCDInterpBlock *iblock;
@@ -123,7 +95,7 @@ struct process {
 struct process_statement {
     struct process *p;
     size_t i;
-    struct arg_value args;
+    NCDInterpValue args;
     int state;
     int have_error;
     btime_t error_until;
@@ -181,18 +153,7 @@ static void print_version (void);
 static int parse_arguments (int argc, char *argv[]);
 static void signal_handler (void *unused);
 static void start_terminate (int exit_code);
-static int arg_value_init_string (struct arg_value *o, const char *string, size_t len);
-static int arg_value_init_variable (struct arg_value *o, const char *name);
-static void arg_value_init_list (struct arg_value *o);
-static int arg_value_list_append (struct arg_value *o, struct arg_value v);
-static void arg_value_init_map (struct arg_value *o);
-static int arg_value_map_append (struct arg_value *o, struct arg_value key, struct arg_value val);
-static void arg_value_free (struct arg_value *o);
-static int build_arg_from_ast (struct arg_value *o, NCDValue *val_ast);
-static char ** names_new (const char *name);
-static size_t names_count (char **names);
 static char * names_tostring (char **names);
-static void names_free (char **names);
 static int process_new (NCDProcess *proc_ast, NCDInterpBlock *iblock, NCDModuleProcess *module_process);
 static void process_free (struct process *p);
 static void process_start_terminating (struct process *p);
@@ -211,7 +172,7 @@ static int process_resolve_variable_expr (struct process *p, size_t pos, char **
 static void process_statement_logfunc (struct process_statement *ps);
 static void process_statement_log (struct process_statement *ps, int level, const char *fmt, ...);
 static void process_statement_set_error (struct process_statement *ps);
-static int process_statement_resolve_argument (struct process_statement *ps, struct arg_value *arg, NCDValue *out);
+static int process_statement_resolve_argument (struct process_statement *ps, NCDInterpValue *arg, NCDValue *out);
 static void process_statement_instance_func_event (struct process_statement *ps, int event);
 static int process_statement_instance_func_getobj (struct process_statement *ps, const char *objname, NCDObject *out_object);
 static int process_statement_instance_func_initprocess (struct process_statement *ps, NCDModuleProcess *mp, const char *template_name);
@@ -659,203 +620,6 @@ void start_terminate (int exit_code)
     }
 }
 
-int arg_value_init_string (struct arg_value *o, const char *string, size_t len)
-{
-    o->type = ARG_VALUE_TYPE_STRING;
-    
-    if (!(o->string = malloc(len))) {
-        BLog(BLOG_ERROR, "malloc failed");
-        return 0;
-    }
-    memcpy(o->string, string, len);
-    
-    o->string_len = len;
-    
-    return 1;
-}
-
-int arg_value_init_variable (struct arg_value *o, const char *name)
-{
-    ASSERT(name)
-    
-    o->type = ARG_VALUE_TYPE_VARIABLE;
-    if (!(o->variable_names = names_new(name))) {
-        return 0;
-    }
-    
-    return 1;
-}
-
-void arg_value_init_list (struct arg_value *o)
-{
-    o->type = ARG_VALUE_TYPE_LIST;
-    LinkedList1_Init(&o->list);
-}
-
-int arg_value_list_append (struct arg_value *o, struct arg_value v)
-{
-    ASSERT(o->type == ARG_VALUE_TYPE_LIST)
-    
-    struct arg_list_elem *elem = malloc(sizeof(*elem));
-    if (!elem) {
-        BLog(BLOG_ERROR, "malloc failed");
-        return 0;
-    }
-    LinkedList1_Append(&o->list, &elem->list_node);
-    elem->value = v;
-    
-    return 1;
-}
-
-void arg_value_init_map (struct arg_value *o)
-{
-    o->type = ARG_VALUE_TYPE_MAP;
-    LinkedList1_Init(&o->maplist);
-}
-
-int arg_value_map_append (struct arg_value *o, struct arg_value key, struct arg_value val)
-{
-    ASSERT(o->type == ARG_VALUE_TYPE_MAP)
-    
-    struct arg_map_elem *elem = malloc(sizeof(*elem));
-    if (!elem) {
-        BLog(BLOG_ERROR, "malloc failed");
-        return 0;
-    }
-    LinkedList1_Append(&o->maplist, &elem->maplist_node);
-    elem->key = key;
-    elem->val = val;
-    
-    return 1;
-}
-
-void arg_value_free (struct arg_value *o)
-{
-    switch (o->type) {
-        case ARG_VALUE_TYPE_STRING: {
-            free(o->string);
-        } break;
-        
-        case ARG_VALUE_TYPE_VARIABLE: {
-            names_free(o->variable_names);
-        } break;
-        
-        case ARG_VALUE_TYPE_LIST: {
-            while (!LinkedList1_IsEmpty(&o->list)) {
-                struct arg_list_elem *elem = UPPER_OBJECT(LinkedList1_GetFirst(&o->list), struct arg_list_elem, list_node);
-                arg_value_free(&elem->value);
-                LinkedList1_Remove(&o->list, &elem->list_node);
-                free(elem);
-            }
-        } break;
-        
-        case ARG_VALUE_TYPE_MAP: {
-            while (!LinkedList1_IsEmpty(&o->maplist)) {
-                struct arg_map_elem *elem = UPPER_OBJECT(LinkedList1_GetFirst(&o->maplist), struct arg_map_elem, maplist_node);
-                arg_value_free(&elem->key);
-                arg_value_free(&elem->val);
-                LinkedList1_Remove(&o->maplist, &elem->maplist_node);
-                free(elem);
-            }
-        } break;
-        
-        default: ASSERT(0);
-    }
-}
-
-int build_arg_from_ast (struct arg_value *o, NCDValue *val_ast)
-{
-    switch (NCDValue_Type(val_ast)) {
-        case NCDVALUE_STRING: {
-            if (!arg_value_init_string(o, NCDValue_StringValue(val_ast), NCDValue_StringLength(val_ast))) {
-                return 0;
-            }
-        } break;
-        
-        case NCDVALUE_VAR: {
-            if (!arg_value_init_variable(o, NCDValue_VarName(val_ast))) {
-                return 0;
-            }
-        } break;
-        
-        case NCDVALUE_LIST: {
-            arg_value_init_list(o);
-            
-            for (NCDValue *ve = NCDValue_ListFirst(val_ast); ve; ve = NCDValue_ListNext(val_ast, ve)) {
-                struct arg_value e;
-                
-                if (!build_arg_from_ast(&e, ve)) {
-                    goto fail_list;
-                }
-                
-                if (!arg_value_list_append(o, e)) {
-                    arg_value_free(&e);
-                    goto fail_list;
-                }
-            }
-            
-            break;
-            
-        fail_list:
-            arg_value_free(o);
-            return 0;
-        } break;
-        
-        case NCDVALUE_MAP: {
-            arg_value_init_map(o);
-            
-            for (NCDValue *ekey = NCDValue_MapFirstKey(val_ast); ekey; ekey = NCDValue_MapNextKey(val_ast, ekey)) {
-                NCDValue *eval = NCDValue_MapKeyValue(val_ast, ekey);
-                
-                struct arg_value key;
-                struct arg_value val;
-                
-                if (!build_arg_from_ast(&key, ekey)) {
-                    goto fail_map;
-                }
-                
-                if (!build_arg_from_ast(&val, eval)) {
-                    arg_value_free(&key);
-                    goto fail_map;
-                }
-                
-                if (!arg_value_map_append(o, key, val)) {
-                    arg_value_free(&key);
-                    arg_value_free(&val);
-                    goto fail_map;
-                }
-            }
-            
-            break;
-            
-        fail_map:
-            arg_value_free(o);
-            return 0;
-        } break;
-        
-        default: ASSERT(0);
-    }
-    
-    return 1;
-}
-
-static char ** names_new (const char *name)
-{
-    ASSERT(name)
-    
-    return split_string(name, '.');
-}
-
-static size_t names_count (char **names)
-{
-    ASSERT(names)
-    
-    size_t i;
-    for (i = 0; names[i]; i++);
-    
-    return i;
-}
-
 static char * names_tostring (char **names)
 {
     ASSERT(names)
@@ -882,19 +646,6 @@ fail0:
     return NULL;
 }
 
-static void names_free (char **names)
-{
-    ASSERT(names)
-    
-    size_t i = names_count(names);
-    
-    while (i-- > 0) {
-        free(names[i]);
-    }
-    
-    BFree(names);
-}
-
 static int process_new (NCDProcess *proc_ast, NCDInterpBlock *iblock, NCDModuleProcess *module_process)
 {
     // allocate strucure
@@ -935,7 +686,7 @@ static int process_new (NCDProcess *proc_ast, NCDInterpBlock *iblock, NCDModuleP
         ps->state = SSTATE_FORGOTTEN;
         ps->have_error = 0;
         
-        if (!build_arg_from_ast(&ps->args, NCDStatement_RegArgs(st))) {
+        if (!NCDInterpValue_Init(&ps->args, NCDStatement_RegArgs(st))) {
             BLog(BLOG_ERROR, "build_arg_from_ast failed");
             goto fail3;
         }
@@ -1031,7 +782,7 @@ void process_free_statements (struct process *p)
 {
     // free statments
     while (p->num_statements > 0) {
-        arg_value_free(&p->statements[p->num_statements - 1].args);
+        NCDInterpValue_Free(&p->statements[p->num_statements - 1].args);
         p->num_statements--;
     }
     
@@ -1363,7 +1114,7 @@ int process_resolve_object_expr (struct process *p, size_t pos, char **names, NC
 {
     ASSERT(pos <= p->num_statements)
     ASSERT(names)
-    ASSERT(names_count(names) > 0)
+    ASSERT(count_strings(names) > 0)
     ASSERT(out_object)
     
     NCDObject object;
@@ -1388,7 +1139,7 @@ int process_resolve_variable_expr (struct process *p, size_t pos, char **names,
 {
     ASSERT(pos <= p->num_statements)
     ASSERT(names)
-    ASSERT(names_count(names) > 0)
+    ASSERT(count_strings(names) > 0)
     ASSERT(out_value)
     
     NCDObject object;
@@ -1431,31 +1182,31 @@ void process_statement_set_error (struct process_statement *ps)
     ps->error_until = btime_add(btime_gettime(), options.retry_time);
 }
 
-int process_statement_resolve_argument (struct process_statement *ps, struct arg_value *arg, NCDValue *out)
+int process_statement_resolve_argument (struct process_statement *ps, NCDInterpValue *arg, NCDValue *out)
 {
     ASSERT(ps->i <= process_rap(ps->p))
     ASSERT(arg)
     ASSERT(out)
     
     switch (arg->type) {
-        case ARG_VALUE_TYPE_STRING: {
+        case NCDVALUE_STRING: {
             if (!NCDValue_InitStringBin(out, (uint8_t *)arg->string, arg->string_len)) {
                 process_statement_log(ps, BLOG_ERROR, "NCDValue_InitStringBin failed");
                 return 0;
             }
         } break;
         
-        case ARG_VALUE_TYPE_VARIABLE: {
+        case NCDVALUE_VAR: {
             if (!process_resolve_variable_expr(ps->p, ps->i, arg->variable_names, out)) {
                 return 0;
             }
         } break;
         
-        case ARG_VALUE_TYPE_LIST: do {
+        case NCDVALUE_LIST: do {
             NCDValue_InitList(out);
             
             for (LinkedList1Node *n = LinkedList1_GetFirst(&arg->list); n; n = LinkedList1Node_Next(n)) {
-                struct arg_list_elem *elem = UPPER_OBJECT(n, struct arg_list_elem, list_node);
+                struct NCDInterpValueListElem *elem = UPPER_OBJECT(n, struct NCDInterpValueListElem, list_node);
                 
                 NCDValue v;
                 if (!process_statement_resolve_argument(ps, &elem->value, &v)) {
@@ -1476,11 +1227,11 @@ int process_statement_resolve_argument (struct process_statement *ps, struct arg
             return 0;
         } while (0); break;
         
-        case ARG_VALUE_TYPE_MAP: do {
+        case NCDVALUE_MAP: do {
             NCDValue_InitMap(out);
             
             for (LinkedList1Node *n = LinkedList1_GetFirst(&arg->maplist); n; n = LinkedList1Node_Next(n)) {
-                struct arg_map_elem *elem = UPPER_OBJECT(n, struct arg_map_elem, maplist_node);
+                struct NCDInterpValueMapElem *elem = UPPER_OBJECT(n, struct NCDInterpValueMapElem, maplist_node);
                 
                 NCDValue key;
                 NCDValue val;