summaryrefslogtreecommitdiff
path: root/library/src/lib.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2023-01-30 21:04:34 +0100
committerMartin Haug <mhaug@live.de>2023-01-30 21:04:34 +0100
commit0287b98ef31172c6da4d5a4c76d8d88d1d5c9049 (patch)
tree000bd243993a5212ce52c08374cf20cd0f61bcf9 /library/src/lib.rs
parent1ea0a933254d866e00acb9034bba39a5f4790682 (diff)
Add calc module
Diffstat (limited to 'library/src/lib.rs')
-rw-r--r--library/src/lib.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/library/src/lib.rs b/library/src/lib.rs
index 08ff171a..a2f52549 100644
--- a/library/src/lib.rs
+++ b/library/src/lib.rs
@@ -19,12 +19,13 @@ use self::layout::LayoutRoot;
pub fn build() -> Library {
let sym = text::sym();
let math = math::module(&sym);
- let global = global(sym, math.clone());
+ let calc = compute::calc();
+ let global = global(sym, math.clone(), calc);
Library { global, math, styles: styles(), items: items() }
}
/// Construct the module with global definitions.
-fn global(sym: Module, math: Module) -> Module {
+fn global(sym: Module, math: Module, calc: Module) -> Module {
let mut global = Scope::deduplicating();
// Basics.
@@ -106,12 +107,6 @@ fn global(sym: Module, math: Module) -> Module {
global.def_func::<compute::LabelFunc>("label");
global.def_func::<compute::RegexFunc>("regex");
global.def_func::<compute::RangeFunc>("range");
- global.def_func::<compute::AbsFunc>("abs");
- global.def_func::<compute::MinFunc>("min");
- global.def_func::<compute::MaxFunc>("max");
- global.def_func::<compute::EvenFunc>("even");
- global.def_func::<compute::OddFunc>("odd");
- global.def_func::<compute::ModFunc>("mod");
global.def_func::<compute::ReadFunc>("read");
global.def_func::<compute::CsvFunc>("csv");
global.def_func::<compute::JsonFunc>("json");
@@ -119,6 +114,9 @@ fn global(sym: Module, math: Module) -> Module {
global.def_func::<compute::LoremFunc>("lorem");
global.def_func::<compute::NumberingFunc>("numbering");
+ // Calc.
+ global.define("calc", calc);
+
// Colors.
global.define("black", Color::BLACK);
global.define("gray", Color::GRAY);