Use bitflags.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, Position, RhaiError, RhaiResultOf, ERR, INT};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -192,7 +193,7 @@ macro_rules! reg_functions {
|
||||
def_package! {
|
||||
/// Basic arithmetic package.
|
||||
pub ArithmeticPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "int", int_functions);
|
||||
reg_functions!(lib += signed_basic; INT);
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
use crate::engine::OP_EQUALS;
|
||||
use crate::eval::{calc_index, calc_offset_len};
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{
|
||||
def_package, Array, Dynamic, ExclusiveRange, FnPtr, InclusiveRange, NativeCallContext,
|
||||
@@ -14,7 +15,7 @@ use std::{any::TypeId, cmp::Ordering, mem};
|
||||
def_package! {
|
||||
/// Package of basic array utilities.
|
||||
pub BasicArrayPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "array", array_functions);
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use crate::eval::calc_index;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{
|
||||
def_package, ExclusiveRange, InclusiveRange, Position, RhaiResultOf, ERR, INT, INT_BITS,
|
||||
@@ -10,7 +11,7 @@ use std::prelude::v1::*;
|
||||
def_package! {
|
||||
/// Package of basic bit-field utilities.
|
||||
pub BitFieldPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "bit_field", bit_field_functions);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#![cfg(not(feature = "no_index"))]
|
||||
|
||||
use crate::eval::{calc_index, calc_offset_len};
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{
|
||||
def_package, Array, Blob, Dynamic, ExclusiveRange, InclusiveRange, NativeCallContext, Position,
|
||||
@@ -16,7 +17,7 @@ use crate::{FLOAT, FLOAT_BYTES};
|
||||
def_package! {
|
||||
/// Package of basic BLOB utilities.
|
||||
pub BasicBlobPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "blob", blob_functions);
|
||||
combine_with_exported_module!(lib, "parse_int", parse_int_functions);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#![cfg(feature = "debugging")]
|
||||
|
||||
use crate::def_package;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -17,7 +18,7 @@ use crate::Map;
|
||||
def_package! {
|
||||
/// Package of basic debugging utilities.
|
||||
pub DebuggingPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "debugging", debugging_functions);
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, FnPtr, ImmutableString, NativeCallContext};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -6,7 +7,7 @@ use std::prelude::v1::*;
|
||||
def_package! {
|
||||
/// Package of basic function pointer utilities.
|
||||
pub BasicFnPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "FnPtr", fn_ptr_functions);
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use crate::eval::calc_index;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{
|
||||
def_package, ExclusiveRange, InclusiveRange, RhaiResultOf, INT, INT_BITS, MAX_USIZE_INT,
|
||||
@@ -329,7 +330,7 @@ macro_rules! reg_range {
|
||||
def_package! {
|
||||
/// Package of basic range iterators
|
||||
pub BasicIteratorPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
reg_range!(lib | "range" => INT);
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use crate::def_package;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::types::dynamic::Tag;
|
||||
use crate::{Dynamic, RhaiResultOf, ERR, INT};
|
||||
@@ -8,7 +9,7 @@ use std::prelude::v1::*;
|
||||
def_package! {
|
||||
/// Package of core language features.
|
||||
pub LanguageCorePackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "core", core_functions);
|
||||
|
||||
@@ -277,7 +278,8 @@ fn collect_fn_metadata(
|
||||
&mut ns,
|
||||
"{namespace}{}{name}",
|
||||
crate::tokenizer::Token::DoubleColon.literal_syntax()
|
||||
);
|
||||
)
|
||||
.unwrap();
|
||||
scan_module(dict, list, &ns, &**m, filter);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use crate::def_package;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
#[cfg(feature = "no_std")]
|
||||
use std::prelude::v1::*;
|
||||
@@ -38,7 +39,7 @@ macro_rules! reg_functions {
|
||||
def_package! {
|
||||
/// Package of basic logic operators.
|
||||
pub LogicPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
#[cfg(not(feature = "only_i32"))]
|
||||
#[cfg(not(feature = "only_i64"))]
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#![cfg(not(feature = "no_object"))]
|
||||
|
||||
use crate::engine::OP_EQUALS;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, Dynamic, ImmutableString, Map, NativeCallContext, RhaiResultOf, INT};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -12,7 +13,7 @@ use crate::Array;
|
||||
def_package! {
|
||||
/// Package of basic object map utilities.
|
||||
pub BasicMapPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "map", map_functions);
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, Position, RhaiResultOf, ERR, INT};
|
||||
#[cfg(feature = "no_std")]
|
||||
@@ -54,7 +55,7 @@ macro_rules! reg_functions {
|
||||
def_package! {
|
||||
/// Basic mathematical package.
|
||||
pub BasicMathPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
// Integer functions
|
||||
combine_with_exported_module!(lib, "int", int_functions);
|
||||
|
@@ -3,6 +3,7 @@ use std::prelude::v1::*;
|
||||
|
||||
use super::*;
|
||||
use crate::def_package;
|
||||
use crate::module::ModuleFlags;
|
||||
|
||||
def_package! {
|
||||
/// Core package containing basic facilities.
|
||||
@@ -23,6 +24,6 @@ def_package! {
|
||||
BasicFnPackage,
|
||||
#[cfg(feature = "debugging")] DebuggingPackage
|
||||
{
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ use std::prelude::v1::*;
|
||||
|
||||
use super::*;
|
||||
use crate::def_package;
|
||||
use crate::module::ModuleFlags;
|
||||
|
||||
def_package! {
|
||||
/// Standard package containing all built-in features.
|
||||
@@ -29,6 +30,6 @@ def_package! {
|
||||
#[cfg(not(feature = "no_time"))] BasicTimePackage,
|
||||
MoreStringPackage
|
||||
{
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, FnPtr, SmartString, INT};
|
||||
use std::any::TypeId;
|
||||
@@ -17,7 +18,7 @@ pub const FUNC_TO_DEBUG: &str = "to_debug";
|
||||
def_package! {
|
||||
/// Package of basic string utilities (e.g. printing)
|
||||
pub BasicStringPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "print_debug", print_debug_functions);
|
||||
combine_with_exported_module!(lib, "number_formatting", number_formatting);
|
||||
|
@@ -1,3 +1,4 @@
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{
|
||||
def_package, Dynamic, ExclusiveRange, InclusiveRange, RhaiResultOf, StaticVec, INT,
|
||||
@@ -12,7 +13,7 @@ use super::string_basic::{print_with_func, FUNC_TO_STRING};
|
||||
def_package! {
|
||||
/// Package of additional string utilities over [`BasicStringPackage`][super::BasicStringPackage]
|
||||
pub MoreStringPackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
combine_with_exported_module!(lib, "string", string_functions);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#![cfg(not(feature = "no_time"))]
|
||||
|
||||
use super::arithmetic::make_err as make_arithmetic_err;
|
||||
use crate::module::ModuleFlags;
|
||||
use crate::plugin::*;
|
||||
use crate::{def_package, Dynamic, RhaiResult, RhaiResultOf, INT};
|
||||
|
||||
@@ -16,7 +17,7 @@ use instant::{Duration, Instant};
|
||||
def_package! {
|
||||
/// Package of basic timing utilities.
|
||||
pub BasicTimePackage(lib) {
|
||||
lib.standard = true;
|
||||
lib.flags |= ModuleFlags::STANDARD_LIB;
|
||||
|
||||
// Register date/time functions
|
||||
combine_with_exported_module!(lib, "time", time_functions);
|
||||
|
Reference in New Issue
Block a user