Skip to content

Commit

Permalink
Remove ocaml-sys macros
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Feb 18, 2021
1 parent 3e4d49c commit e52a231
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,6 @@

pub type Char = cty::c_char;

#[macro_export]
/// Registers OCaml parameters with the GC
macro_rules! caml_param {
($($n:expr),*) => {
let mut caml_roots = $crate::CamlRootsBlock::default();

let mut n = 0isize;
$(
if n == 5 {
n = 0;
}

if n == 0 {
caml_roots = $crate::CamlRootsBlock::default();
#[allow(unused_unsafe)]
unsafe {
caml_roots.next = $crate::local_roots();
$crate::set_local_roots(&mut caml_roots);
};
caml_roots.nitems = 1;
}

caml_roots.tables[n as usize] = &$n as *const _ as *mut _;

n += 1;
caml_roots.ntables = n;
)*
}
}

#[macro_export]
macro_rules! caml_body {
($(($($param:expr),*))? $code:block) => {
{
#[allow(unused_unsafe)]
let caml_frame = unsafe { $crate::local_roots() };
$(
$crate::caml_param!($($param),*);
)?
#[allow(unused_mut)]
let mut res = || $code;
let res = res();
#[allow(unused_unsafe)]
unsafe { $crate::set_local_roots(caml_frame) };
res
}
}
}

#[cfg(not(feature = "without-ocamlopt"))]
pub const VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/ocaml_version"));

Expand Down

0 comments on commit e52a231

Please sign in to comment.