1#![allow(warnings)]
2#![feature(where_clause_attrs)]
3
4#[cfg(feature = "matrix")]
5extern crate nalgebra as na;
6#[macro_use]
7extern crate mech_core;
8
9use mech_core::*;
10#[cfg(feature = "matrix")]
11use mech_core::matrix::{Matrix, ToMatrix};
12use mech_core::kind::Kind;
13use mech_core::{Dictionary, Ref, Value, ValueKind, ValRef, ToValue};
14use mech_core::{hash_str, MResult, nodes::Kind as NodeKind, nodes::Matrix as Mat, nodes::*};
15#[cfg(feature = "map")]
16use mech_core::MechMap;
17#[cfg(feature = "record")]
18use mech_core::MechRecord;
19#[cfg(feature = "set")]
20use mech_core::MechSet;
21#[cfg(feature = "tuple")]
22use mech_core::MechTuple;
23#[cfg(feature = "enum")]
24use mech_core::MechEnum;
25#[cfg(feature = "table")]
26use mech_core::MechTable;
27#[cfg(feature = "complex")]
28use mech_core::C64;
29#[cfg(feature = "rational")]
30use mech_core::R64;
31#[cfg(feature = "functions")]
32use crate::functions::*;
33#[cfg(feature = "access")]
34use crate::stdlib::access::*;
35#[cfg(feature = "assign")]
36use crate::stdlib::assign::*;
37#[cfg(feature = "convert")]
38use crate::stdlib::convert::*;
39#[cfg(feature = "matrix_horzcat")]
40use crate::stdlib::horzcat::*;
41#[cfg(feature = "matrix_vertcat")]
42use crate::stdlib::vertcat::*;
43#[cfg(feature = "table")]
44use crate::stdlib::table_ops::*;
45#[cfg(feature = "combinatorics")]
46use mech_combinatorics::*;
47#[cfg(feature = "matrix")]
48use mech_matrix::*;
49#[cfg(feature = "stats")]
50use mech_stats::*;
51#[cfg(feature = "math")]
52use mech_math::*;
53#[cfg(feature = "logic")]
54use mech_logic::*;
55#[cfg(feature = "compare")]
56use mech_compare::*;
57#[cfg(feature = "range_inclusive")]
58use mech_range::inclusive::*;
59#[cfg(feature = "range_inclusive")]
60use mech_range::inclusive_increment::*;
61#[cfg(feature = "range_exclusive")]
62use mech_range::exclusive::*;
63#[cfg(feature = "range_exclusive")]
64use mech_range::exclusive_increment::*;
65#[cfg(feature = "set")]
66use mech_set::*;
67#[cfg(feature = "string")]
68use mech_string::*;
69
70#[cfg(feature = "matrix")]
71use na::DMatrix;
72#[cfg(feature = "set")]
73use indexmap::set::IndexSet;
74#[cfg(any(feature = "map", feature = "table", feature = "record"))]
75use indexmap::map::IndexMap;
76
77pub mod literals;
78pub mod structures;
79pub mod interpreter;
80pub mod stdlib;
81#[cfg(feature = "functions")]
82pub mod functions;
83pub mod statements;
84pub mod expressions;
85pub mod mechdown;
86#[cfg(feature = "functions")]
87pub mod frame;
88
89pub use mech_core::*;
90
91pub use crate::literals::*;
92pub use crate::interpreter::*;
93pub use crate::structures::*;
94#[cfg(feature = "functifons")]
95pub use crate::functions::*;
96pub use crate::statements::*;
97pub use crate::expressions::*;
98pub use crate::mechdown::*;
99#[cfg(feature = "functions")]
100pub use crate::frame::*;
101
102#[cfg(feature = "access")]
103pub use crate::stdlib::access::*;
104#[cfg(feature = "assign")]
105pub use crate::stdlib::assign::*;
106#[cfg(feature = "convert")]
107pub use crate::stdlib::convert::*;
108#[cfg(feature = "matrix_horzcat")]
109pub use crate::stdlib::horzcat::*;
110#[cfg(feature = "matrix_vertcat")]
111pub use crate::stdlib::vertcat::*;
112#[cfg(feature = "table")]
113pub use crate::stdlib::table_ops::*;
114#[cfg(feature = "combinatorics")]
115pub use mech_combinatorics::*;
116#[cfg(feature = "matrix")]
117pub use mech_matrix::*;
118#[cfg(feature = "stats")]
119pub use mech_stats::*;
120#[cfg(feature = "math")]
121pub use mech_math::*;
122#[cfg(feature = "logic")]
123pub use mech_logic::*;
124#[cfg(feature = "compare")]
125pub use mech_compare::*;
126#[cfg(feature = "set")]
127pub use mech_set::*;
128
129pub fn load_stdkinds(kinds: &mut KindTable) {
130 #[cfg(feature = "u8")]
131 kinds.insert(hash_str("u8"),ValueKind::U8);
132 #[cfg(feature = "u16")]
133 kinds.insert(hash_str("u16"),ValueKind::U16);
134 #[cfg(feature = "u32")]
135 kinds.insert(hash_str("u32"),ValueKind::U32);
136 #[cfg(feature = "u64")]
137 kinds.insert(hash_str("u64"),ValueKind::U64);
138 #[cfg(feature = "u128")]
139 kinds.insert(hash_str("u128"),ValueKind::U128);
140 #[cfg(feature = "i8")]
141 kinds.insert(hash_str("i8"),ValueKind::I8);
142 #[cfg(feature = "i16")]
143 kinds.insert(hash_str("i16"),ValueKind::I16);
144 #[cfg(feature = "i32")]
145 kinds.insert(hash_str("i32"),ValueKind::I32);
146 #[cfg(feature = "i64")]
147 kinds.insert(hash_str("i64"),ValueKind::I64);
148 #[cfg(feature = "i128")]
149 kinds.insert(hash_str("i128"),ValueKind::I128);
150 #[cfg(feature = "f32")]
151 kinds.insert(hash_str("f32"),ValueKind::F32);
152 #[cfg(feature = "f64")]
153 kinds.insert(hash_str("f64"),ValueKind::F64);
154 #[cfg(feature = "c64")]
155 kinds.insert(hash_str("c64"),ValueKind::C64);
156 #[cfg(feature = "r64")]
157 kinds.insert(hash_str("r64"),ValueKind::R64);
158 #[cfg(feature = "string")]
159 kinds.insert(hash_str("string"),ValueKind::String);
160 #[cfg(feature = "bool")]
161 kinds.insert(hash_str("bool"),ValueKind::Bool);
162}
163
164#[cfg(feature = "functions")]
165pub fn load_stdlib(fxns: &mut Functions) {
166
167 for fxn_desc in inventory::iter::<FunctionDescriptor> {
168 fxns.insert_function(fxn_desc.clone());
169 }
170
171 for fxn_comp in inventory::iter::<FunctionCompilerDescriptor> {
172 fxns.function_compilers.insert(hash_str(fxn_comp.name), fxn_comp.ptr);
173 }
174
175}