1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
use core;
use value::Value;
use std::ffi::CString;
pub fn hash_variant<S: AsRef<str>>(name: S) -> Value {
unsafe {
Value::new(core::mlvalues::caml_hash_variant(name.as_ref().as_ptr()))
}
}
pub fn release_runtime_system() {
unsafe {
core::memory::caml_enter_blocking_section()
}
}
pub fn acquire_runtime_system() {
unsafe {
core::memory::caml_leave_blocking_section()
}
}
pub fn failwith<S: AsRef<str>>(arg: S) {
let s = CString::new(arg.as_ref()).unwrap();
unsafe {
core::fail::caml_failwith(s.as_ptr())
}
}
pub fn failwith_value(msg: Value) {
unsafe {
core::fail::caml_failwith_value(msg.value())
}
}
pub fn invalid_argument<S: AsRef<str>>(arg: S) {
let s = CString::new(arg.as_ref()).unwrap();
unsafe {
core::fail::caml_invalid_argument(s.as_ptr())
}
}
pub fn invalid_argument_value(msg: Value) {
unsafe {
core::fail::caml_invalid_argument_value(msg.value())
}
}
pub fn raise(bucket: Value){
unsafe {
core::fail::caml_raise(bucket.value())
}
}
pub fn raise_constant(tag: Value) {
unsafe {
core::fail::caml_raise_constant(tag.value())
}
}
pub fn raise_with_arg(tag: Value, arg: Value) {
unsafe {
core::fail::caml_raise_with_arg(tag.value(), arg.value())
}
}
pub fn raise_with_string<S: AsRef<str>>(tag: Value, msg: S) {
let s = CString::new(msg.as_ref()).unwrap();
unsafe {
core::fail::caml_raise_with_string(tag.value(), s.as_ptr())
}
}
pub fn raise_out_of_memory(){
unsafe {
core::fail::caml_raise_out_of_memory()
}
}
pub fn raise_stack_overflow(){
unsafe {
core::fail::caml_raise_stack_overflow()
}
}
pub fn raise_sys_error(arg1: Value){
unsafe {
core::fail::caml_raise_sys_error(arg1.value())
}
}
pub fn raise_end_of_file(){
unsafe {
core::fail::caml_raise_end_of_file()
}
}
pub fn raise_zero_divide(){
unsafe {
core::fail::caml_raise_zero_divide()
}
}
pub fn raise_not_found(){
unsafe {
core::fail::caml_raise_not_found()
}
}
pub fn array_bound_error(){
unsafe {
core::fail::caml_array_bound_error()
}
}
pub fn raise_sys_blocked_io(){
unsafe {
core::fail::caml_raise_sys_blocked_io()
}
}