Add combine_with_exported_module.

This commit is contained in:
Stephen Chung
2020-09-13 22:12:11 +08:00
committed by J Henry Waugh
parent aed70db303
commit 848bdf3f01
16 changed files with 64 additions and 17 deletions

View File

@@ -185,7 +185,7 @@ macro_rules! gen_signed_functions {
macro_rules! reg_functions {
($mod_name:ident += $root:ident ; $($arg_type:ident),+ ) => { $(
$mod_name.combine_flatten(exported_module!($root::$arg_type::functions));
combine_with_exported_module!($mod_name, "arithmetic", $root::$arg_type::functions);
)* }
}
@@ -208,8 +208,8 @@ def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, {
// Basic arithmetic for floating-point
#[cfg(not(feature = "no_float"))]
{
lib.combine_flatten(exported_module!(f32_functions));
lib.combine_flatten(exported_module!(f64_functions));
combine_with_exported_module!(lib, "f32", f32_functions);
combine_with_exported_module!(lib, "f64", f64_functions);
}
});

View File

@@ -58,7 +58,7 @@ macro_rules! reg_functions {
}
def_package!(crate:BasicArrayPackage:"Basic array utilities.", lib, {
lib.combine_flatten(exported_module!(array_functions));
combine_with_exported_module!(lib, "array", array_functions);
reg_functions!(lib += basic; INT, bool, char, ImmutableString, FnPtr, Array, Unit);

View File

@@ -5,7 +5,7 @@ use crate::plugin::*;
use crate::result::EvalAltResult;
def_package!(crate:EvalPackage:"Disable 'eval'.", lib, {
lib.combine_flatten(exported_module!(eval_override));
combine_with_exported_module!(lib, "eval", eval_override);
});
#[export_module]

View File

@@ -3,7 +3,7 @@ use crate::fn_native::FnPtr;
use crate::plugin::*;
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
lib.combine_flatten(exported_module!(fn_ptr_functions));
combine_with_exported_module!(lib, "FnPtr", fn_ptr_functions);
});
#[export_module]

View File

@@ -45,7 +45,7 @@ macro_rules! gen_cmp_functions {
macro_rules! reg_functions {
($mod_name:ident += $root:ident ; $($arg_type:ident),+) => { $(
$mod_name.combine_flatten(exported_module!($root::$arg_type::functions));
combine_with_exported_module!($mod_name, "logic", $root::$arg_type::functions);
)* }
}

View File

@@ -9,7 +9,7 @@ use crate::plugin::*;
use crate::stdlib::vec::Vec;
def_package!(crate:BasicMapPackage:"Basic object map utilities.", lib, {
lib.combine_flatten(exported_module!(map_functions));
combine_with_exported_module!(lib, "map", map_functions);
});
#[export_module]

View File

@@ -48,10 +48,10 @@ def_package!(crate:BasicMathPackage:"Basic mathematic functions.", lib, {
#[cfg(not(feature = "no_float"))]
{
// Floating point functions
lib.combine_flatten(exported_module!(float_functions));
combine_with_exported_module!(lib, "float", float_functions);
// Trig functions
lib.combine_flatten(exported_module!(trig_functions));
combine_with_exported_module!(lib, "trig", trig_functions);
reg_functions!(lib += basic_to_float::to_float(INT));

View File

@@ -57,7 +57,7 @@ def_package!(crate:MoreStringPackage:"Additional string utilities, including str
#[cfg(not(feature = "no_float"))]
reg_functions!(lib += float; f32, f64);
lib.combine_flatten(exported_module!(string_functions));
combine_with_exported_module!(lib, "string", string_functions);
lib.set_raw_fn(
"pad",

View File

@@ -21,7 +21,7 @@ use instant::Instant;
def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
// Register date/time functions
lib.combine_flatten(exported_module!(time_functions));
combine_with_exported_module!(lib, "time", time_functions);
});
#[export_module]