summaryrefslogtreecommitdiffstats
path: root/dimension/realize.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-12-17 03:12:34 -0500
committerTavian Barnes <tavianator@gmail.com>2009-12-17 03:12:34 -0500
commitc66148484cad66972348ffe850fd23bc9dca60f9 (patch)
treed4616778e980773a2ddb4e606f85193d51f4f71c /dimension/realize.c
parentfb8fb378dcce0564085eb6222053a0db57eb480c (diff)
downloaddimension-c66148484cad66972348ffe850fd23bc9dca60f9.tar.xz
Tokenize on-the-fly.
No more manual tokenization and parsing, giving a simpler interface. Also, this brings us closer to a dmnsn_realize_string() interface.
Diffstat (limited to 'dimension/realize.c')
-rw-r--r--dimension/realize.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/dimension/realize.c b/dimension/realize.c
index 1a42be9..7ca3ae2 100644
--- a/dimension/realize.c
+++ b/dimension/realize.c
@@ -536,8 +536,8 @@ dmnsn_realize_sphere(dmnsn_astnode astnode)
return sphere;
}
-dmnsn_scene *
-dmnsn_realize(const dmnsn_array *astree)
+static dmnsn_scene *
+dmnsn_realize_astree(const dmnsn_array *astree)
{
dmnsn_scene *scene = dmnsn_new_scene();
if (!scene) {
@@ -607,3 +607,13 @@ dmnsn_realize(const dmnsn_array *astree)
return scene;
}
+
+dmnsn_scene *
+dmnsn_realize(FILE *file, const char *filename)
+{
+ dmnsn_array *astree = dmnsn_parse(file, filename);
+ if (!astree) {
+ return NULL;
+ }
+ return dmnsn_realize_astree(astree);
+}