diff options
author | Marius Kintel <marius@kintel.net> | 2011-11-05 16:04:09 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-11-05 16:04:09 (GMT) |
commit | 5466efe7ef89bb2e9925f8fccd6c752e3475bd93 (patch) | |
tree | 9fcec9fe4dcfce54764dc448e56744aaf7425bd9 /src/context.cc | |
parent | 04bc3ed890451de881034fee9f000761c4f0e068 (diff) |
bugfix: PI constant didn't work in cmd-line mode. refactored away duplicate code
Diffstat (limited to 'src/context.cc')
-rw-r--r-- | src/context.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/context.cc b/src/context.cc index b4983f6..47b8a78 100644 --- a/src/context.cc +++ b/src/context.cc @@ -193,3 +193,23 @@ std::string Context::getAbsolutePath(const std::string &filename) const return filename; } } + +void register_builtin(Context &ctx) +{ + ctx.functions_p = &builtin_functions; + ctx.modules_p = &builtin_modules; + ctx.set_variable("$fn", Value(0.0)); + ctx.set_variable("$fs", Value(1.0)); + ctx.set_variable("$fa", Value(12.0)); + ctx.set_variable("$t", Value(0.0)); + + Value zero3; + zero3.type = Value::VECTOR; + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); + ctx.set_variable("$vpt", zero3); + ctx.set_variable("$vpr", zero3); + + ctx.set_constant("PI",Value(M_PI)); +} |