]> ocean-lang.org Git - ocean/commitdiff
oceani: prepare for adding new types with new syntax.
authorNeilBrown <neil@brown.name>
Wed, 1 May 2019 08:22:38 +0000 (18:22 +1000)
committerNeilBrown <neil@brown.name>
Wed, 1 May 2019 09:00:39 +0000 (19:00 +1000)
1/ 'Variable' now returns an 'exec', so other things returning
   and 'exec' can be the LHS of an assignment.
2/ provide forward-decls of generic functions so that
   new type functions can use them to work with
   components of the types.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani.mdc

index 68e5b603038a94b4ab27bbd739f671e12bf104de..9ab456a629badad65780a72cc1d10e366cd29ced 100644 (file)
@@ -580,6 +580,17 @@ which are often passed around by value.
                return rv;
        }
 
+###### forward decls
+
+       static void free_value(struct value v);
+       static int type_compat(struct type *require, struct type *have, int rules);
+       static void type_print(struct type *type, FILE *f);
+       static struct value val_init(struct type *type);
+       static struct value dup_value(struct value v);
+       static int value_cmp(struct value left, struct value right);
+       static void print_value(struct value v);
+       static struct value parse_value(struct type *type, char *arg);
+
 ###### free context types
 
        while (context.typelist) {
@@ -1732,6 +1743,7 @@ link to find the primary instance.
                }
        } }$
 
+       $*exec
        Variable -> IDENTIFIER ${ {
                struct variable *v = var_ref(config2context(config), $1.txt);
                $0 = new_pos(var, $1);
@@ -1744,7 +1756,7 @@ link to find the primary instance.
                                v->where_set = $0;
                        }
                }
-               $0->var = v;
+               cast(var, $0)->var = v;
        } }$
 
        $*type