summaryrefslogtreecommitdiffstats
path: root/dimension/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-09 00:14:42 -0500
committerTavian Barnes <tavianator@gmail.com>2010-03-09 00:14:42 -0500
commit2afc9be712c69a66833de75683cdbaa3886379f1 (patch)
treead1b8adedbfded210d9389739b0edab05313ba79 /dimension/parse.c
parent66b9177cce4e186bf3572443af2436d7a9d0f162 (diff)
downloaddimension-2afc9be712c69a66833de75683cdbaa3886379f1.tar.xz
Implement unit vectors.
Diffstat (limited to 'dimension/parse.c')
-rw-r--r--dimension/parse.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/dimension/parse.c b/dimension/parse.c
index a4a4c43..5756659 100644
--- a/dimension/parse.c
+++ b/dimension/parse.c
@@ -76,6 +76,58 @@ dmnsn_new_ast_float(double value)
}
dmnsn_astnode
+dmnsn_new_ast_ivector(long x, long y, long z, long f, long t)
+{
+ dmnsn_astnode astnode = dmnsn_new_astnode(DMNSN_AST_VECTOR);
+ astnode.children = dmnsn_new_array(sizeof(dmnsn_astnode));
+
+ dmnsn_astnode comp;
+
+ comp = dmnsn_new_ast_integer(x);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_integer(y);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_integer(z);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_integer(f);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_integer(t);
+ dmnsn_array_push(astnode.children, &comp);
+
+ return astnode;
+}
+
+dmnsn_astnode
+dmnsn_new_ast_vector(double x, double y, double z, double f, double t)
+{
+ dmnsn_astnode astnode = dmnsn_new_astnode(DMNSN_AST_VECTOR);
+ astnode.children = dmnsn_new_array(sizeof(dmnsn_astnode));
+
+ dmnsn_astnode comp;
+
+ comp = dmnsn_new_ast_float(x);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_float(y);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_float(z);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_float(f);
+ dmnsn_array_push(astnode.children, &comp);
+
+ comp = dmnsn_new_ast_float(t);
+ dmnsn_array_push(astnode.children, &comp);
+
+ return astnode;
+}
+
+dmnsn_astnode
dmnsn_new_ast_string(const char *value)
{
dmnsn_astnode astnode = dmnsn_new_astnode(DMNSN_AST_STRING);