Skip to content

Commit

Permalink
Make macros private
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaq committed Sep 6, 2024
1 parent 806e980 commit ada9ba9
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 86 deletions.
4 changes: 2 additions & 2 deletions build/instructions_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3281,14 +3281,14 @@ pub fn generate_instructions_rs() -> TokenStream {
}
}

#[macro_export]
macro_rules! _instr {
#(
#instr_macro_arms
);*
}

pub use _instr as instr; // https://github.com/rust-lang/rust/pull/52234#issuecomment-976702997
// https://github.com/rust-lang/rust/pull/52234#issuecomment-976702997
pub(crate) use _instr as instr;
}
}

Expand Down
1 change: 0 additions & 1 deletion build/static_string_indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ pub fn index_static_strings(instruction_rs_path: &std::path::Path) -> TokenStrea
)*
];

#[macro_export]
macro_rules! atom {
#((#static_strs) => { Atom { index: #indices_iter } };)*
}
Expand Down
2 changes: 0 additions & 2 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ use std::ptr::addr_of_mut;
use std::ptr::NonNull;
use std::sync::RwLock;

#[macro_export]
macro_rules! arena_alloc {
($e:expr, $arena:expr) => {{
let result = $e;
$crate::arena::AllocateInArena::arena_allocate(result, $arena)
}};
}

#[macro_export]
macro_rules! float_alloc {
($e:expr, $arena:expr) => {{
let result = $e;
Expand Down
1 change: 0 additions & 1 deletion src/atom_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ impl Hash for Atom {
}
}

#[macro_export]
macro_rules! is_char {
($s:expr) => {
!$s.is_empty() && $s.chars().nth(1).is_none()
Expand Down
2 changes: 0 additions & 2 deletions src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ use crate::instructions::*;
use crate::iterators::*;
use crate::parser::ast::*;
use crate::targets::*;
use crate::temp_v;
use crate::types::*;
use crate::variable_records::*;

use crate::instr;
use crate::machine::disjuncts::*;
use crate::machine::machine_errors::*;

Expand Down
5 changes: 0 additions & 5 deletions src/heap_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ use crate::parser::ast::*;
use crate::parser::dashu::base::RemEuclid;
use crate::parser::dashu::integer::Sign;
use crate::parser::dashu::{ibig, Integer, Rational};
use crate::{
alpha_numeric_char, capital_letter_char, cut_char, decimal_digit_char, graphic_token_char,
semicolon_char, sign_char, single_quote_char, small_letter_char, solo_char,
variable_indicator_char,
};

use crate::forms::*;
use crate::heap_iter::*;
Expand Down
3 changes: 0 additions & 3 deletions src/machine/arithmetic_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ use crate::parser::ast::*;
use crate::parser::dashu::{Integer, Rational};
use crate::types::*;

use crate::fixnum;

use ordered_float::{Float, OrderedFloat};

use std::cmp;
use std::convert::TryFrom;
use std::f64;
use std::mem;

#[macro_export]
macro_rules! try_numeric_result {
($e: expr, $stub_gen: expr) => {
match $e {
Expand Down
1 change: 0 additions & 1 deletion src/machine/attributed_variables.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::heap_iter::*;
use crate::machine::*;
use crate::parser::ast::*;
use crate::temp_v;
use crate::types::*;

use indexmap::IndexSet;
Expand Down
2 changes: 0 additions & 2 deletions src/machine/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use crate::machine::machine_state::*;
use crate::machine::*;
use crate::types::*;

use crate::try_numeric_result;

use fxhash::FxBuildHasher;

macro_rules! step_or_fail {
Expand Down
1 change: 0 additions & 1 deletion src/machine/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ impl PredicateQueue {
}
}

#[macro_export]
macro_rules! predicate_queue {
[$($v:expr),*] => (
PredicateQueue {
Expand Down
1 change: 1 addition & 0 deletions src/machine/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod args;
#[macro_use]
pub mod arithmetic_ops;
pub mod attributed_variables;
pub mod code_walker;
Expand Down
2 changes: 0 additions & 2 deletions src/machine/term_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use crate::parser::ast::*;
use crate::parser::parser::*;
use crate::read::devour_whitespace;

use crate::predicate_queue;

use fxhash::FxBuildHasher;
use indexmap::IndexSet;

Expand Down
1 change: 0 additions & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ macro_rules! stack_loc_as_cell {
};
}

#[macro_export]
macro_rules! heap_loc_as_cell {
($h:expr) => {
HeapCellValue::build_with(HeapCellValueTag::Var, $h as u64)
Expand Down
13 changes: 0 additions & 13 deletions src/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ pub const BTERM: u32 = 0x11000;

pub const NEGATIVE_SIGN: u32 = 0x0200;

#[macro_export]
macro_rules! fixnum {
($wrapper:tt, $n:expr, $arena:expr) => {
Fixnum::build_with_checked($n)
Expand Down Expand Up @@ -180,21 +179,18 @@ macro_rules! is_negate {
};
}

#[macro_export]
macro_rules! is_prefix {
($x:expr) => {
$x as u32 & ($crate::parser::ast::FX as u32 | $crate::parser::ast::FY as u32) != 0
};
}

#[macro_export]
macro_rules! is_postfix {
($x:expr) => {
$x as u32 & ($crate::parser::ast::XF as u32 | $crate::parser::ast::YF as u32) != 0
};
}

#[macro_export]
macro_rules! is_infix {
($x:expr) => {
($x as u32
Expand All @@ -205,48 +201,41 @@ macro_rules! is_infix {
};
}

#[macro_export]
macro_rules! is_xfx {
($x:expr) => {
($x as u32 & $crate::parser::ast::XFX as u32) != 0
};
}

#[macro_export]
macro_rules! is_xfy {
($x:expr) => {
($x as u32 & $crate::parser::ast::XFY as u32) != 0
};
}

#[macro_export]
macro_rules! is_yfx {
($x:expr) => {
($x as u32 & $crate::parser::ast::YFX as u32) != 0
};
}
#[macro_export]
macro_rules! is_yf {
($x:expr) => {
($x as u32 & $crate::parser::ast::YF as u32) != 0
};
}

#[macro_export]
macro_rules! is_xf {
($x:expr) => {
($x as u32 & $crate::parser::ast::XF as u32) != 0
};
}

#[macro_export]
macro_rules! is_fx {
($x:expr) => {
($x as u32 & $crate::parser::ast::FX as u32) != 0
};
}

#[macro_export]
macro_rules! is_fy {
($x:expr) => {
($x as u32 & $crate::parser::ast::FY as u32) != 0
Expand Down Expand Up @@ -317,14 +306,12 @@ impl Default for VarReg {
}
}

#[macro_export]
macro_rules! temp_v {
($x:expr) => {
$crate::parser::ast::RegType::Temp($x)
};
}

#[macro_export]
macro_rules! perm_v {
($x:expr) => {
$crate::parser::ast::RegType::Perm($x)
Expand Down
Loading

0 comments on commit ada9ba9

Please sign in to comment.