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
use crate::bindings::{Context, Space};
use libc::uintptr_t;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
pub struct FixedBox {
pub ptr: uintptr_t,
}
extern "C" {
fn isl_fixed_box_get_ctx(box_: uintptr_t) -> uintptr_t;
fn isl_fixed_box_get_space(box_: uintptr_t) -> uintptr_t;
fn isl_fixed_box_is_valid(box_: uintptr_t) -> i32;
fn isl_fixed_box_copy(box_: uintptr_t) -> uintptr_t;
fn isl_fixed_box_free(box_: uintptr_t) -> uintptr_t;
fn isl_fixed_box_to_str(box_: uintptr_t) -> *const c_char;
fn isl_fixed_box_dump(box_: uintptr_t);
}
impl FixedBox {
pub fn get_ctx(&self) -> Context {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_get_ctx(box_) };
let isl_rs_result = Context { ptr: isl_rs_result };
isl_rs_result
}
pub fn get_space(&self) -> Space {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_get_space(box_) };
let isl_rs_result = Space { ptr: isl_rs_result };
isl_rs_result
}
pub fn is_valid(&self) -> bool {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_is_valid(box_) };
let isl_rs_result = match isl_rs_result {
0 => false,
1 => true,
_ => panic!("Got isl_bool = -1"),
};
isl_rs_result
}
pub fn copy(&self) -> FixedBox {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_copy(box_) };
let isl_rs_result = FixedBox { ptr: isl_rs_result };
isl_rs_result
}
pub fn free(self) -> FixedBox {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_free(box_) };
let isl_rs_result = FixedBox { ptr: isl_rs_result };
isl_rs_result
}
pub fn to_str(&self) -> &str {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_to_str(box_) };
let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
let isl_rs_result = isl_rs_result.to_str().unwrap();
isl_rs_result
}
pub fn dump(&self) {
let box_ = self;
let box_ = box_.ptr;
let isl_rs_result = unsafe { isl_fixed_box_dump(box_) };
isl_rs_result
}
}
impl Drop for FixedBox {
fn drop(&mut self) {
unsafe {
isl_fixed_box_free(self.ptr);
}
}
}