diff --git a/Cargo.toml b/Cargo.toml index a8faf087..593091cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,13 @@ num-traits = "0.2.11" [features] #default = ["no_function", "no_index", "no_float", "only_i32", "no_stdlib", "unchecked", "no_optimize"] default = [] -debug_msgs = [] # print debug messages on function registrations and calls unchecked = [] # unchecked arithmetic no_stdlib = [] # no standard library of utility functions no_index = [] # no arrays and indexing no_float = [] # no floating-point no_function = [] # no script-defined functions no_optimize = [] # no script optimizer -optimize_full = [] # set optimization level to Full (default is Simple) - this is a feature used only to simply testing +optimize_full = [] # set optimization level to Full (default is Simple) - this is a feature used only to simplify testing only_i32 = [] # set INT=i32 (useful for 32-bit systems) only_i64 = [] # set INT=i64 (default) and disable support for all other integer types diff --git a/README.md b/README.md index 98bca82a..9b50bf3f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ Optional features | Feature | Description | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `debug_msgs` | Print debug messages to stdout related to function registrations and calls. | | `no_stdlib` | Exclude the standard library of utility functions in the build, and only include the minimum necessary functionalities. Standard types are not affected. | | `unchecked` | Exclude arithmetic checking (such as overflows and division by zero). Beware that a bad script may panic the entire system! | | `no_function` | Disable script-defined functions if not needed. | diff --git a/src/api.rs b/src/api.rs index 1bdf34e0..ad12218f 100644 --- a/src/api.rs +++ b/src/api.rs @@ -29,20 +29,6 @@ impl<'e> Engine<'e> { args: Option>, f: Box, ) { - debug_println!( - "Register function: {} with {}", - fn_name, - if let Some(a) = &args { - format!( - "{} parameter{}", - a.len(), - if a.len() > 1 { "s" } else { "" } - ) - } else { - "no parameter".to_string() - } - ); - let spec = FnSpec { name: fn_name.to_string().into(), args, diff --git a/src/call.rs b/src/call.rs index 5c06e8a9..cf7356fe 100644 --- a/src/call.rs +++ b/src/call.rs @@ -3,11 +3,12 @@ #![allow(non_snake_case)] use crate::any::{Any, Dynamic}; -use crate::stdlib::{string::String, vec, vec::Vec}; #[cfg(not(feature = "no_index"))] use crate::engine::Array; +use crate::stdlib::{string::String, vec, vec::Vec}; + /// Trait that represent arguments to a function call. pub trait FuncArgs { /// Convert to a `Vec` of `Dynamic` arguments. diff --git a/src/engine.rs b/src/engine.rs index 5985108f..0689dbb5 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -165,16 +165,6 @@ impl Engine<'_> { def_val: Option<&Dynamic>, pos: Position, ) -> Result { - debug_println!( - "Calling function: {} ({})", - fn_name, - args.iter() - .map(|x| (*x).type_name()) - .map(|name| self.map_type_name(name)) - .collect::>() - .join(", ") - ); - // First search in script-defined functions (can override built-in) if let Ok(n) = self .script_functions diff --git a/src/error.rs b/src/error.rs index 59816e96..87e2e2d5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,7 @@ //! Module containing error definitions for the parsing process. use crate::parser::Position; + use crate::stdlib::{char, error::Error, fmt, string::String}; /// Error when tokenizing the script text. diff --git a/src/fn_register.rs b/src/fn_register.rs index 065dac0f..53c646a0 100644 --- a/src/fn_register.rs +++ b/src/fn_register.rs @@ -6,6 +6,7 @@ use crate::any::{Any, Dynamic}; use crate::engine::{Engine, FnCallArgs}; use crate::parser::Position; use crate::result::EvalAltResult; + use crate::stdlib::{any::TypeId, boxed::Box, string::ToString, vec}; /// A trait to register custom functions with the `Engine`. diff --git a/src/lib.rs b/src/lib.rs index 67190112..5293982c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,30 +43,6 @@ #[cfg(feature = "no_std")] extern crate alloc; -// needs to be here, because order matters for macros -macro_rules! debug_println { - () => ( - #[cfg(feature = "debug_msgs")] - { - print!("\n"); - } - ); - ($fmt:expr) => ( - #[cfg(feature = "debug_msgs")] - { - print!(concat!($fmt, "\n")); - } - ); - ($fmt:expr, $($arg:tt)*) => ( - #[cfg(feature = "debug_msgs")] - { - print!(concat!($fmt, "\n"), $($arg)*); - } - ); -} - -#[macro_use] -mod stdlib; mod any; mod api; mod builtin; @@ -78,6 +54,7 @@ mod optimize; mod parser; mod result; mod scope; +mod stdlib; pub use any::{Any, AnyExt, Dynamic, Variant}; pub use call::FuncArgs;