Merge branch 'v1.1-fixes'
This commit is contained in:
@@ -177,6 +177,8 @@ macro_rules! reg_functions {
|
||||
}
|
||||
|
||||
def_package!(crate:ArithmeticPackage:"Basic arithmetic", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "int", int_functions);
|
||||
reg_functions!(lib += signed_basic; INT);
|
||||
|
||||
|
@@ -9,6 +9,8 @@ use std::prelude::v1::*;
|
||||
use std::{any::TypeId, cmp::Ordering, mem};
|
||||
|
||||
def_package!(crate:BasicArrayPackage:"Basic array utilities.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "array", array_functions);
|
||||
|
||||
// Register array iterator
|
||||
|
@@ -4,6 +4,8 @@ use crate::{def_package, FnPtr, ImmutableString, NativeCallContext};
|
||||
use std::prelude::v1::*;
|
||||
|
||||
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "FnPtr", fn_ptr_functions);
|
||||
});
|
||||
|
||||
|
@@ -298,6 +298,8 @@ macro_rules! reg_range {
|
||||
}
|
||||
|
||||
def_package!(crate:BasicIteratorPackage:"Basic range iterators.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
reg_range!(lib | "range" => INT);
|
||||
|
||||
#[cfg(not(feature = "only_i32"))]
|
||||
|
@@ -43,5 +43,7 @@ mod core_functions {
|
||||
}
|
||||
|
||||
def_package!(crate:LanguageCorePackage:"Language core functions.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "language_core", core_functions);
|
||||
});
|
||||
|
@@ -38,6 +38,8 @@ macro_rules! reg_functions {
|
||||
}
|
||||
|
||||
def_package!(crate:LogicPackage:"Logical operators.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
#[cfg(not(feature = "only_i32"))]
|
||||
#[cfg(not(feature = "only_i64"))]
|
||||
{
|
||||
|
@@ -10,6 +10,8 @@ use std::prelude::v1::*;
|
||||
use crate::Array;
|
||||
|
||||
def_package!(crate:BasicMapPackage:"Basic object map utilities.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "map", map_functions);
|
||||
});
|
||||
|
||||
|
@@ -62,6 +62,8 @@ macro_rules! reg_functions {
|
||||
}
|
||||
|
||||
def_package!(crate:BasicMathPackage:"Basic mathematic functions.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
// Integer functions
|
||||
combine_with_exported_module!(lib, "int", int_functions);
|
||||
|
||||
|
@@ -10,6 +10,8 @@ use std::prelude::v1::*;
|
||||
use crate::def_package;
|
||||
|
||||
def_package!(crate:CorePackage:"_Core_ package containing basic facilities.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
LanguageCorePackage::init(lib);
|
||||
ArithmeticPackage::init(lib);
|
||||
LogicPackage::init(lib);
|
||||
|
@@ -13,6 +13,8 @@ use std::prelude::v1::*;
|
||||
use crate::def_package;
|
||||
|
||||
def_package!(crate:StandardPackage:"_Standard_ package containing all built-in features.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
CorePackage::init(lib);
|
||||
BasicMathPackage::init(lib);
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
|
@@ -16,6 +16,8 @@ pub const FUNC_TO_STRING: &str = "to_string";
|
||||
pub const FUNC_TO_DEBUG: &str = "to_debug";
|
||||
|
||||
def_package!(crate:BasicStringPackage:"Basic string utilities, including printing.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "print_debug", print_debug_functions);
|
||||
combine_with_exported_module!(lib, "number_formatting", number_formatting);
|
||||
});
|
||||
|
@@ -9,6 +9,8 @@ use std::{any::TypeId, mem};
|
||||
use super::string_basic::{print_with_func, FUNC_TO_STRING};
|
||||
|
||||
def_package!(crate:MoreStringPackage:"Additional string utilities, including string building.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
combine_with_exported_module!(lib, "string", string_functions);
|
||||
});
|
||||
|
||||
@@ -45,19 +47,28 @@ mod string_functions {
|
||||
s
|
||||
}
|
||||
|
||||
#[rhai_fn(name = "append")]
|
||||
#[rhai_fn(name = "+", name = "append")]
|
||||
pub fn add_append_str(string1: ImmutableString, string2: ImmutableString) -> ImmutableString {
|
||||
string1 + string2
|
||||
}
|
||||
#[rhai_fn(name = "append")]
|
||||
#[rhai_fn(name = "+", name = "append")]
|
||||
pub fn add_append_char(string: ImmutableString, character: char) -> ImmutableString {
|
||||
string + character
|
||||
}
|
||||
#[rhai_fn(name = "append")]
|
||||
#[rhai_fn(name = "+")]
|
||||
pub fn add_prepend_char(character: char, string: ImmutableString) -> ImmutableString {
|
||||
format!("{}{}", character, string).into()
|
||||
}
|
||||
|
||||
#[rhai_fn(name = "+", name = "append")]
|
||||
pub fn add_append_unit(string: ImmutableString, item: ()) -> ImmutableString {
|
||||
let _item = item;
|
||||
string
|
||||
}
|
||||
#[rhai_fn(name = "+")]
|
||||
pub fn add_prepend_unit(_item: (), string: ImmutableString) -> ImmutableString {
|
||||
string
|
||||
}
|
||||
|
||||
#[rhai_fn(name = "len", get = "len")]
|
||||
pub fn len(string: &str) -> INT {
|
||||
|
@@ -16,6 +16,8 @@ use std::time::{Duration, Instant};
|
||||
use instant::{Duration, Instant};
|
||||
|
||||
def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
|
||||
lib.standard = true;
|
||||
|
||||
// Register date/time functions
|
||||
combine_with_exported_module!(lib, "time", time_functions);
|
||||
});
|
||||
|
Reference in New Issue
Block a user