Removee debug_msgs feature.

This commit is contained in:
Stephen Chung 2020-03-18 22:03:50 +08:00
parent 019e73bc7e
commit 0dc51f8e59
8 changed files with 6 additions and 52 deletions

View File

@ -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

View File

@ -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. |

View File

@ -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,

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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`.

View File

@ -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;