Removee debug_msgs
feature.
This commit is contained in:
parent
019e73bc7e
commit
0dc51f8e59
@ -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
|
||||
|
||||
|
@ -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. |
|
||||
|
14
src/api.rs
14
src/api.rs
@ -29,20 +29,6 @@ impl<'e> Engine<'e> {
|
||||
args: Option<Vec<TypeId>>,
|
||||
f: Box<FnAny>,
|
||||
) {
|
||||
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,
|
||||
|
@ -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.
|
||||
|
@ -165,16 +165,6 @@ impl Engine<'_> {
|
||||
def_val: Option<&Dynamic>,
|
||||
pos: Position,
|
||||
) -> Result<Dynamic, EvalAltResult> {
|
||||
debug_println!(
|
||||
"Calling function: {} ({})",
|
||||
fn_name,
|
||||
args.iter()
|
||||
.map(|x| (*x).type_name())
|
||||
.map(|name| self.map_type_name(name))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
);
|
||||
|
||||
// First search in script-defined functions (can override built-in)
|
||||
if let Ok(n) = self
|
||||
.script_functions
|
||||
|
@ -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.
|
||||
|
@ -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`.
|
||||
|
25
src/lib.rs
25
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;
|
||||
|
Loading…
Reference in New Issue
Block a user