isl_rs/bindings/
space.rs

1// Automatically generated by isl_bindings_generator.
2// LICENSE: MIT
3
4use crate::bindings::{Context, DimType, Id};
5use libc::uintptr_t;
6use std::ffi::{CStr, CString};
7use std::os::raw::c_char;
8
9/// Wraps `isl_space`.
10pub struct Space {
11    pub ptr: uintptr_t,
12    pub should_free_on_drop: bool,
13}
14
15extern "C" {
16
17    fn isl_space_get_ctx(space: uintptr_t) -> uintptr_t;
18
19    fn isl_space_unit(ctx: uintptr_t) -> uintptr_t;
20
21    fn isl_space_alloc(ctx: uintptr_t, nparam: u32, n_in: u32, n_out: u32) -> uintptr_t;
22
23    fn isl_space_set_alloc(ctx: uintptr_t, nparam: u32, dim: u32) -> uintptr_t;
24
25    fn isl_space_params_alloc(ctx: uintptr_t, nparam: u32) -> uintptr_t;
26
27    fn isl_space_copy(space: uintptr_t) -> uintptr_t;
28
29    fn isl_space_free(space: uintptr_t) -> uintptr_t;
30
31    fn isl_space_is_params(space: uintptr_t) -> i32;
32
33    fn isl_space_is_set(space: uintptr_t) -> i32;
34
35    fn isl_space_is_map(space: uintptr_t) -> i32;
36
37    fn isl_space_add_param_id(space: uintptr_t, id: uintptr_t) -> uintptr_t;
38
39    fn isl_space_set_tuple_name(space: uintptr_t, type_: DimType, s: *const c_char) -> uintptr_t;
40
41    fn isl_space_has_tuple_name(space: uintptr_t, type_: DimType) -> i32;
42
43    fn isl_space_get_tuple_name(space: uintptr_t, type_: DimType) -> *const c_char;
44
45    fn isl_space_set_domain_tuple_id(space: uintptr_t, id: uintptr_t) -> uintptr_t;
46
47    fn isl_space_set_range_tuple_id(space: uintptr_t, id: uintptr_t) -> uintptr_t;
48
49    fn isl_space_set_tuple_id(space: uintptr_t, type_: DimType, id: uintptr_t) -> uintptr_t;
50
51    fn isl_space_reset_tuple_id(space: uintptr_t, type_: DimType) -> uintptr_t;
52
53    fn isl_space_has_domain_tuple_id(space: uintptr_t) -> i32;
54
55    fn isl_space_has_range_tuple_id(space: uintptr_t) -> i32;
56
57    fn isl_space_has_tuple_id(space: uintptr_t, type_: DimType) -> i32;
58
59    fn isl_space_get_domain_tuple_id(space: uintptr_t) -> uintptr_t;
60
61    fn isl_space_get_range_tuple_id(space: uintptr_t) -> uintptr_t;
62
63    fn isl_space_get_tuple_id(space: uintptr_t, type_: DimType) -> uintptr_t;
64
65    fn isl_space_reset_user(space: uintptr_t) -> uintptr_t;
66
67    fn isl_space_set_dim_id(space: uintptr_t, type_: DimType, pos: u32, id: uintptr_t)
68                            -> uintptr_t;
69
70    fn isl_space_has_dim_id(space: uintptr_t, type_: DimType, pos: u32) -> i32;
71
72    fn isl_space_get_dim_id(space: uintptr_t, type_: DimType, pos: u32) -> uintptr_t;
73
74    fn isl_space_find_dim_by_id(space: uintptr_t, type_: DimType, id: uintptr_t) -> i32;
75
76    fn isl_space_find_dim_by_name(space: uintptr_t, type_: DimType, name: *const c_char) -> i32;
77
78    fn isl_space_has_dim_name(space: uintptr_t, type_: DimType, pos: u32) -> i32;
79
80    fn isl_space_set_dim_name(space: uintptr_t, type_: DimType, pos: u32, name: *const c_char)
81                              -> uintptr_t;
82
83    fn isl_space_get_dim_name(space: uintptr_t, type_: DimType, pos: u32) -> *const c_char;
84
85    fn isl_space_extend(space: uintptr_t, nparam: u32, n_in: u32, n_out: u32) -> uintptr_t;
86
87    fn isl_space_add_dims(space: uintptr_t, type_: DimType, n: u32) -> uintptr_t;
88
89    fn isl_space_move_dims(space: uintptr_t, dst_type: DimType, dst_pos: u32, src_type: DimType,
90                           src_pos: u32, n: u32)
91                           -> uintptr_t;
92
93    fn isl_space_insert_dims(space: uintptr_t, type_: DimType, pos: u32, n: u32) -> uintptr_t;
94
95    fn isl_space_join(left: uintptr_t, right: uintptr_t) -> uintptr_t;
96
97    fn isl_space_product(left: uintptr_t, right: uintptr_t) -> uintptr_t;
98
99    fn isl_space_domain_product(left: uintptr_t, right: uintptr_t) -> uintptr_t;
100
101    fn isl_space_range_product(left: uintptr_t, right: uintptr_t) -> uintptr_t;
102
103    fn isl_space_factor_domain(space: uintptr_t) -> uintptr_t;
104
105    fn isl_space_factor_range(space: uintptr_t) -> uintptr_t;
106
107    fn isl_space_domain_factor_domain(space: uintptr_t) -> uintptr_t;
108
109    fn isl_space_domain_factor_range(space: uintptr_t) -> uintptr_t;
110
111    fn isl_space_range_factor_domain(space: uintptr_t) -> uintptr_t;
112
113    fn isl_space_range_factor_range(space: uintptr_t) -> uintptr_t;
114
115    fn isl_space_domain_wrapped_domain(space: uintptr_t) -> uintptr_t;
116
117    fn isl_space_domain_wrapped_range(space: uintptr_t) -> uintptr_t;
118
119    fn isl_space_range_wrapped_domain(space: uintptr_t) -> uintptr_t;
120
121    fn isl_space_range_wrapped_range(space: uintptr_t) -> uintptr_t;
122
123    fn isl_space_map_from_set(space: uintptr_t) -> uintptr_t;
124
125    fn isl_space_map_from_domain_and_range(domain: uintptr_t, range: uintptr_t) -> uintptr_t;
126
127    fn isl_space_reverse(space: uintptr_t) -> uintptr_t;
128
129    fn isl_space_range_reverse(space: uintptr_t) -> uintptr_t;
130
131    fn isl_space_drop_dims(space: uintptr_t, type_: DimType, first: u32, num: u32) -> uintptr_t;
132
133    fn isl_space_drop_inputs(space: uintptr_t, first: u32, n: u32) -> uintptr_t;
134
135    fn isl_space_drop_outputs(space: uintptr_t, first: u32, n: u32) -> uintptr_t;
136
137    fn isl_space_drop_all_params(space: uintptr_t) -> uintptr_t;
138
139    fn isl_space_domain(space: uintptr_t) -> uintptr_t;
140
141    fn isl_space_from_domain(space: uintptr_t) -> uintptr_t;
142
143    fn isl_space_range(space: uintptr_t) -> uintptr_t;
144
145    fn isl_space_from_range(space: uintptr_t) -> uintptr_t;
146
147    fn isl_space_domain_map(space: uintptr_t) -> uintptr_t;
148
149    fn isl_space_range_map(space: uintptr_t) -> uintptr_t;
150
151    fn isl_space_params(space: uintptr_t) -> uintptr_t;
152
153    fn isl_space_add_unnamed_tuple_ui(space: uintptr_t, dim: u32) -> uintptr_t;
154
155    fn isl_space_add_named_tuple_id_ui(space: uintptr_t, tuple_id: uintptr_t, dim: u32)
156                                       -> uintptr_t;
157
158    fn isl_space_set_from_params(space: uintptr_t) -> uintptr_t;
159
160    fn isl_space_align_params(space1: uintptr_t, space2: uintptr_t) -> uintptr_t;
161
162    fn isl_space_is_wrapping(space: uintptr_t) -> i32;
163
164    fn isl_space_domain_is_wrapping(space: uintptr_t) -> i32;
165
166    fn isl_space_range_is_wrapping(space: uintptr_t) -> i32;
167
168    fn isl_space_is_product(space: uintptr_t) -> i32;
169
170    fn isl_space_wrap(space: uintptr_t) -> uintptr_t;
171
172    fn isl_space_unwrap(space: uintptr_t) -> uintptr_t;
173
174    fn isl_space_can_zip(space: uintptr_t) -> i32;
175
176    fn isl_space_zip(space: uintptr_t) -> uintptr_t;
177
178    fn isl_space_can_curry(space: uintptr_t) -> i32;
179
180    fn isl_space_curry(space: uintptr_t) -> uintptr_t;
181
182    fn isl_space_can_range_curry(space: uintptr_t) -> i32;
183
184    fn isl_space_range_curry(space: uintptr_t) -> uintptr_t;
185
186    fn isl_space_can_uncurry(space: uintptr_t) -> i32;
187
188    fn isl_space_uncurry(space: uintptr_t) -> uintptr_t;
189
190    fn isl_space_is_domain(space1: uintptr_t, space2: uintptr_t) -> i32;
191
192    fn isl_space_is_range(space1: uintptr_t, space2: uintptr_t) -> i32;
193
194    fn isl_space_is_equal(space1: uintptr_t, space2: uintptr_t) -> i32;
195
196    fn isl_space_has_equal_params(space1: uintptr_t, space2: uintptr_t) -> i32;
197
198    fn isl_space_has_equal_tuples(space1: uintptr_t, space2: uintptr_t) -> i32;
199
200    fn isl_space_tuple_is_equal(space1: uintptr_t, type1: DimType, space2: uintptr_t,
201                                type2: DimType)
202                                -> i32;
203
204    fn isl_space_match(space1: uintptr_t, type1: DimType, space2: uintptr_t, type2: DimType)
205                       -> i32;
206
207    fn isl_space_dim(space: uintptr_t, type_: DimType) -> i32;
208
209    fn isl_space_flatten_domain(space: uintptr_t) -> uintptr_t;
210
211    fn isl_space_flatten_range(space: uintptr_t) -> uintptr_t;
212
213    fn isl_space_read_from_str(ctx: uintptr_t, str_: *const c_char) -> uintptr_t;
214
215    fn isl_space_to_str(space: uintptr_t) -> *const c_char;
216
217    fn isl_space_dump(space: uintptr_t);
218
219}
220
221impl Space {
222    /// Wraps `isl_space_get_ctx`.
223    pub fn get_ctx(&self) -> Context {
224        let space = self;
225        let space = space.ptr;
226        let isl_rs_result = unsafe { isl_space_get_ctx(space) };
227        let isl_rs_result = Context { ptr: isl_rs_result,
228                                      should_free_on_drop: true };
229        let mut isl_rs_result = isl_rs_result;
230        isl_rs_result.do_not_free_on_drop();
231        isl_rs_result
232    }
233
234    /// Wraps `isl_space_unit`.
235    pub fn unit(ctx: &Context) -> Space {
236        let ctx = ctx.ptr;
237        let isl_rs_result = unsafe { isl_space_unit(ctx) };
238        let isl_rs_result = Space { ptr: isl_rs_result,
239                                    should_free_on_drop: true };
240        isl_rs_result
241    }
242
243    /// Wraps `isl_space_alloc`.
244    pub fn alloc(ctx: &Context, nparam: u32, n_in: u32, n_out: u32) -> Space {
245        let ctx = ctx.ptr;
246        let isl_rs_result = unsafe { isl_space_alloc(ctx, nparam, n_in, n_out) };
247        let isl_rs_result = Space { ptr: isl_rs_result,
248                                    should_free_on_drop: true };
249        isl_rs_result
250    }
251
252    /// Wraps `isl_space_set_alloc`.
253    pub fn set_alloc(ctx: &Context, nparam: u32, dim: u32) -> Space {
254        let ctx = ctx.ptr;
255        let isl_rs_result = unsafe { isl_space_set_alloc(ctx, nparam, dim) };
256        let isl_rs_result = Space { ptr: isl_rs_result,
257                                    should_free_on_drop: true };
258        isl_rs_result
259    }
260
261    /// Wraps `isl_space_params_alloc`.
262    pub fn params_alloc(ctx: &Context, nparam: u32) -> Space {
263        let ctx = ctx.ptr;
264        let isl_rs_result = unsafe { isl_space_params_alloc(ctx, nparam) };
265        let isl_rs_result = Space { ptr: isl_rs_result,
266                                    should_free_on_drop: true };
267        isl_rs_result
268    }
269
270    /// Wraps `isl_space_copy`.
271    pub fn copy(&self) -> Space {
272        let space = self;
273        let space = space.ptr;
274        let isl_rs_result = unsafe { isl_space_copy(space) };
275        let isl_rs_result = Space { ptr: isl_rs_result,
276                                    should_free_on_drop: true };
277        isl_rs_result
278    }
279
280    /// Wraps `isl_space_free`.
281    pub fn free(self) -> Space {
282        let space = self;
283        let mut space = space;
284        space.do_not_free_on_drop();
285        let space = space.ptr;
286        let isl_rs_result = unsafe { isl_space_free(space) };
287        let isl_rs_result = Space { ptr: isl_rs_result,
288                                    should_free_on_drop: true };
289        isl_rs_result
290    }
291
292    /// Wraps `isl_space_is_params`.
293    pub fn is_params(&self) -> bool {
294        let space = self;
295        let space = space.ptr;
296        let isl_rs_result = unsafe { isl_space_is_params(space) };
297        let isl_rs_result = match isl_rs_result {
298            0 => false,
299            1 => true,
300            _ => panic!("Got isl_bool = -1"),
301        };
302        isl_rs_result
303    }
304
305    /// Wraps `isl_space_is_set`.
306    pub fn is_set(&self) -> bool {
307        let space = self;
308        let space = space.ptr;
309        let isl_rs_result = unsafe { isl_space_is_set(space) };
310        let isl_rs_result = match isl_rs_result {
311            0 => false,
312            1 => true,
313            _ => panic!("Got isl_bool = -1"),
314        };
315        isl_rs_result
316    }
317
318    /// Wraps `isl_space_is_map`.
319    pub fn is_map(&self) -> bool {
320        let space = self;
321        let space = space.ptr;
322        let isl_rs_result = unsafe { isl_space_is_map(space) };
323        let isl_rs_result = match isl_rs_result {
324            0 => false,
325            1 => true,
326            _ => panic!("Got isl_bool = -1"),
327        };
328        isl_rs_result
329    }
330
331    /// Wraps `isl_space_add_param_id`.
332    pub fn add_param_id(self, id: Id) -> Space {
333        let space = self;
334        let mut space = space;
335        space.do_not_free_on_drop();
336        let space = space.ptr;
337        let mut id = id;
338        id.do_not_free_on_drop();
339        let id = id.ptr;
340        let isl_rs_result = unsafe { isl_space_add_param_id(space, id) };
341        let isl_rs_result = Space { ptr: isl_rs_result,
342                                    should_free_on_drop: true };
343        isl_rs_result
344    }
345
346    /// Wraps `isl_space_set_tuple_name`.
347    pub fn set_tuple_name(self, type_: DimType, s: &str) -> Space {
348        let space = self;
349        let mut space = space;
350        space.do_not_free_on_drop();
351        let space = space.ptr;
352        let s = CString::new(s).unwrap();
353        let s = s.as_ptr();
354        let isl_rs_result = unsafe { isl_space_set_tuple_name(space, type_, s) };
355        let isl_rs_result = Space { ptr: isl_rs_result,
356                                    should_free_on_drop: true };
357        isl_rs_result
358    }
359
360    /// Wraps `isl_space_has_tuple_name`.
361    pub fn has_tuple_name(&self, type_: DimType) -> bool {
362        let space = self;
363        let space = space.ptr;
364        let isl_rs_result = unsafe { isl_space_has_tuple_name(space, type_) };
365        let isl_rs_result = match isl_rs_result {
366            0 => false,
367            1 => true,
368            _ => panic!("Got isl_bool = -1"),
369        };
370        isl_rs_result
371    }
372
373    /// Wraps `isl_space_get_tuple_name`.
374    pub fn get_tuple_name(&self, type_: DimType) -> &str {
375        let space = self;
376        let space = space.ptr;
377        let isl_rs_result = unsafe { isl_space_get_tuple_name(space, type_) };
378        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
379        let isl_rs_result = isl_rs_result.to_str().unwrap();
380        isl_rs_result
381    }
382
383    /// Wraps `isl_space_set_domain_tuple_id`.
384    pub fn set_domain_tuple_id(self, id: Id) -> Space {
385        let space = self;
386        let mut space = space;
387        space.do_not_free_on_drop();
388        let space = space.ptr;
389        let mut id = id;
390        id.do_not_free_on_drop();
391        let id = id.ptr;
392        let isl_rs_result = unsafe { isl_space_set_domain_tuple_id(space, id) };
393        let isl_rs_result = Space { ptr: isl_rs_result,
394                                    should_free_on_drop: true };
395        isl_rs_result
396    }
397
398    /// Wraps `isl_space_set_range_tuple_id`.
399    pub fn set_range_tuple_id(self, id: Id) -> Space {
400        let space = self;
401        let mut space = space;
402        space.do_not_free_on_drop();
403        let space = space.ptr;
404        let mut id = id;
405        id.do_not_free_on_drop();
406        let id = id.ptr;
407        let isl_rs_result = unsafe { isl_space_set_range_tuple_id(space, id) };
408        let isl_rs_result = Space { ptr: isl_rs_result,
409                                    should_free_on_drop: true };
410        isl_rs_result
411    }
412
413    /// Wraps `isl_space_set_tuple_id`.
414    pub fn set_tuple_id(self, type_: DimType, id: Id) -> Space {
415        let space = self;
416        let mut space = space;
417        space.do_not_free_on_drop();
418        let space = space.ptr;
419        let mut id = id;
420        id.do_not_free_on_drop();
421        let id = id.ptr;
422        let isl_rs_result = unsafe { isl_space_set_tuple_id(space, type_, id) };
423        let isl_rs_result = Space { ptr: isl_rs_result,
424                                    should_free_on_drop: true };
425        isl_rs_result
426    }
427
428    /// Wraps `isl_space_reset_tuple_id`.
429    pub fn reset_tuple_id(self, type_: DimType) -> Space {
430        let space = self;
431        let mut space = space;
432        space.do_not_free_on_drop();
433        let space = space.ptr;
434        let isl_rs_result = unsafe { isl_space_reset_tuple_id(space, type_) };
435        let isl_rs_result = Space { ptr: isl_rs_result,
436                                    should_free_on_drop: true };
437        isl_rs_result
438    }
439
440    /// Wraps `isl_space_has_domain_tuple_id`.
441    pub fn has_domain_tuple_id(&self) -> bool {
442        let space = self;
443        let space = space.ptr;
444        let isl_rs_result = unsafe { isl_space_has_domain_tuple_id(space) };
445        let isl_rs_result = match isl_rs_result {
446            0 => false,
447            1 => true,
448            _ => panic!("Got isl_bool = -1"),
449        };
450        isl_rs_result
451    }
452
453    /// Wraps `isl_space_has_range_tuple_id`.
454    pub fn has_range_tuple_id(&self) -> bool {
455        let space = self;
456        let space = space.ptr;
457        let isl_rs_result = unsafe { isl_space_has_range_tuple_id(space) };
458        let isl_rs_result = match isl_rs_result {
459            0 => false,
460            1 => true,
461            _ => panic!("Got isl_bool = -1"),
462        };
463        isl_rs_result
464    }
465
466    /// Wraps `isl_space_has_tuple_id`.
467    pub fn has_tuple_id(&self, type_: DimType) -> bool {
468        let space = self;
469        let space = space.ptr;
470        let isl_rs_result = unsafe { isl_space_has_tuple_id(space, type_) };
471        let isl_rs_result = match isl_rs_result {
472            0 => false,
473            1 => true,
474            _ => panic!("Got isl_bool = -1"),
475        };
476        isl_rs_result
477    }
478
479    /// Wraps `isl_space_get_domain_tuple_id`.
480    pub fn get_domain_tuple_id(&self) -> Id {
481        let space = self;
482        let space = space.ptr;
483        let isl_rs_result = unsafe { isl_space_get_domain_tuple_id(space) };
484        let isl_rs_result = Id { ptr: isl_rs_result,
485                                 should_free_on_drop: true };
486        isl_rs_result
487    }
488
489    /// Wraps `isl_space_get_range_tuple_id`.
490    pub fn get_range_tuple_id(&self) -> Id {
491        let space = self;
492        let space = space.ptr;
493        let isl_rs_result = unsafe { isl_space_get_range_tuple_id(space) };
494        let isl_rs_result = Id { ptr: isl_rs_result,
495                                 should_free_on_drop: true };
496        isl_rs_result
497    }
498
499    /// Wraps `isl_space_get_tuple_id`.
500    pub fn get_tuple_id(&self, type_: DimType) -> Id {
501        let space = self;
502        let space = space.ptr;
503        let isl_rs_result = unsafe { isl_space_get_tuple_id(space, type_) };
504        let isl_rs_result = Id { ptr: isl_rs_result,
505                                 should_free_on_drop: true };
506        isl_rs_result
507    }
508
509    /// Wraps `isl_space_reset_user`.
510    pub fn reset_user(self) -> Space {
511        let space = self;
512        let mut space = space;
513        space.do_not_free_on_drop();
514        let space = space.ptr;
515        let isl_rs_result = unsafe { isl_space_reset_user(space) };
516        let isl_rs_result = Space { ptr: isl_rs_result,
517                                    should_free_on_drop: true };
518        isl_rs_result
519    }
520
521    /// Wraps `isl_space_set_dim_id`.
522    pub fn set_dim_id(self, type_: DimType, pos: u32, id: Id) -> Space {
523        let space = self;
524        let mut space = space;
525        space.do_not_free_on_drop();
526        let space = space.ptr;
527        let mut id = id;
528        id.do_not_free_on_drop();
529        let id = id.ptr;
530        let isl_rs_result = unsafe { isl_space_set_dim_id(space, type_, pos, id) };
531        let isl_rs_result = Space { ptr: isl_rs_result,
532                                    should_free_on_drop: true };
533        isl_rs_result
534    }
535
536    /// Wraps `isl_space_has_dim_id`.
537    pub fn has_dim_id(&self, type_: DimType, pos: u32) -> bool {
538        let space = self;
539        let space = space.ptr;
540        let isl_rs_result = unsafe { isl_space_has_dim_id(space, type_, pos) };
541        let isl_rs_result = match isl_rs_result {
542            0 => false,
543            1 => true,
544            _ => panic!("Got isl_bool = -1"),
545        };
546        isl_rs_result
547    }
548
549    /// Wraps `isl_space_get_dim_id`.
550    pub fn get_dim_id(&self, type_: DimType, pos: u32) -> Id {
551        let space = self;
552        let space = space.ptr;
553        let isl_rs_result = unsafe { isl_space_get_dim_id(space, type_, pos) };
554        let isl_rs_result = Id { ptr: isl_rs_result,
555                                 should_free_on_drop: true };
556        isl_rs_result
557    }
558
559    /// Wraps `isl_space_find_dim_by_id`.
560    pub fn find_dim_by_id(&self, type_: DimType, id: &Id) -> i32 {
561        let space = self;
562        let space = space.ptr;
563        let id = id.ptr;
564        let isl_rs_result = unsafe { isl_space_find_dim_by_id(space, type_, id) };
565        isl_rs_result
566    }
567
568    /// Wraps `isl_space_find_dim_by_name`.
569    pub fn find_dim_by_name(&self, type_: DimType, name: &str) -> i32 {
570        let space = self;
571        let space = space.ptr;
572        let name = CString::new(name).unwrap();
573        let name = name.as_ptr();
574        let isl_rs_result = unsafe { isl_space_find_dim_by_name(space, type_, name) };
575        isl_rs_result
576    }
577
578    /// Wraps `isl_space_has_dim_name`.
579    pub fn has_dim_name(&self, type_: DimType, pos: u32) -> bool {
580        let space = self;
581        let space = space.ptr;
582        let isl_rs_result = unsafe { isl_space_has_dim_name(space, type_, pos) };
583        let isl_rs_result = match isl_rs_result {
584            0 => false,
585            1 => true,
586            _ => panic!("Got isl_bool = -1"),
587        };
588        isl_rs_result
589    }
590
591    /// Wraps `isl_space_set_dim_name`.
592    pub fn set_dim_name(self, type_: DimType, pos: u32, name: &str) -> Space {
593        let space = self;
594        let mut space = space;
595        space.do_not_free_on_drop();
596        let space = space.ptr;
597        let name = CString::new(name).unwrap();
598        let name = name.as_ptr();
599        let isl_rs_result = unsafe { isl_space_set_dim_name(space, type_, pos, name) };
600        let isl_rs_result = Space { ptr: isl_rs_result,
601                                    should_free_on_drop: true };
602        isl_rs_result
603    }
604
605    /// Wraps `isl_space_get_dim_name`.
606    pub fn get_dim_name(&self, type_: DimType, pos: u32) -> &str {
607        let space = self;
608        let space = space.ptr;
609        let isl_rs_result = unsafe { isl_space_get_dim_name(space, type_, pos) };
610        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
611        let isl_rs_result = isl_rs_result.to_str().unwrap();
612        isl_rs_result
613    }
614
615    /// Wraps `isl_space_extend`.
616    pub fn extend(self, nparam: u32, n_in: u32, n_out: u32) -> Space {
617        let space = self;
618        let mut space = space;
619        space.do_not_free_on_drop();
620        let space = space.ptr;
621        let isl_rs_result = unsafe { isl_space_extend(space, nparam, n_in, n_out) };
622        let isl_rs_result = Space { ptr: isl_rs_result,
623                                    should_free_on_drop: true };
624        isl_rs_result
625    }
626
627    /// Wraps `isl_space_add_dims`.
628    pub fn add_dims(self, type_: DimType, n: u32) -> Space {
629        let space = self;
630        let mut space = space;
631        space.do_not_free_on_drop();
632        let space = space.ptr;
633        let isl_rs_result = unsafe { isl_space_add_dims(space, type_, n) };
634        let isl_rs_result = Space { ptr: isl_rs_result,
635                                    should_free_on_drop: true };
636        isl_rs_result
637    }
638
639    /// Wraps `isl_space_move_dims`.
640    pub fn move_dims(self, dst_type: DimType, dst_pos: u32, src_type: DimType, src_pos: u32,
641                     n: u32)
642                     -> Space {
643        let space = self;
644        let mut space = space;
645        space.do_not_free_on_drop();
646        let space = space.ptr;
647        let isl_rs_result =
648            unsafe { isl_space_move_dims(space, dst_type, dst_pos, src_type, src_pos, n) };
649        let isl_rs_result = Space { ptr: isl_rs_result,
650                                    should_free_on_drop: true };
651        isl_rs_result
652    }
653
654    /// Wraps `isl_space_insert_dims`.
655    pub fn insert_dims(self, type_: DimType, pos: u32, n: u32) -> Space {
656        let space = self;
657        let mut space = space;
658        space.do_not_free_on_drop();
659        let space = space.ptr;
660        let isl_rs_result = unsafe { isl_space_insert_dims(space, type_, pos, n) };
661        let isl_rs_result = Space { ptr: isl_rs_result,
662                                    should_free_on_drop: true };
663        isl_rs_result
664    }
665
666    /// Wraps `isl_space_join`.
667    pub fn join(self, right: Space) -> Space {
668        let left = self;
669        let mut left = left;
670        left.do_not_free_on_drop();
671        let left = left.ptr;
672        let mut right = right;
673        right.do_not_free_on_drop();
674        let right = right.ptr;
675        let isl_rs_result = unsafe { isl_space_join(left, right) };
676        let isl_rs_result = Space { ptr: isl_rs_result,
677                                    should_free_on_drop: true };
678        isl_rs_result
679    }
680
681    /// Wraps `isl_space_product`.
682    pub fn product(self, right: Space) -> Space {
683        let left = self;
684        let mut left = left;
685        left.do_not_free_on_drop();
686        let left = left.ptr;
687        let mut right = right;
688        right.do_not_free_on_drop();
689        let right = right.ptr;
690        let isl_rs_result = unsafe { isl_space_product(left, right) };
691        let isl_rs_result = Space { ptr: isl_rs_result,
692                                    should_free_on_drop: true };
693        isl_rs_result
694    }
695
696    /// Wraps `isl_space_domain_product`.
697    pub fn domain_product(self, right: Space) -> Space {
698        let left = self;
699        let mut left = left;
700        left.do_not_free_on_drop();
701        let left = left.ptr;
702        let mut right = right;
703        right.do_not_free_on_drop();
704        let right = right.ptr;
705        let isl_rs_result = unsafe { isl_space_domain_product(left, right) };
706        let isl_rs_result = Space { ptr: isl_rs_result,
707                                    should_free_on_drop: true };
708        isl_rs_result
709    }
710
711    /// Wraps `isl_space_range_product`.
712    pub fn range_product(self, right: Space) -> Space {
713        let left = self;
714        let mut left = left;
715        left.do_not_free_on_drop();
716        let left = left.ptr;
717        let mut right = right;
718        right.do_not_free_on_drop();
719        let right = right.ptr;
720        let isl_rs_result = unsafe { isl_space_range_product(left, right) };
721        let isl_rs_result = Space { ptr: isl_rs_result,
722                                    should_free_on_drop: true };
723        isl_rs_result
724    }
725
726    /// Wraps `isl_space_factor_domain`.
727    pub fn factor_domain(self) -> Space {
728        let space = self;
729        let mut space = space;
730        space.do_not_free_on_drop();
731        let space = space.ptr;
732        let isl_rs_result = unsafe { isl_space_factor_domain(space) };
733        let isl_rs_result = Space { ptr: isl_rs_result,
734                                    should_free_on_drop: true };
735        isl_rs_result
736    }
737
738    /// Wraps `isl_space_factor_range`.
739    pub fn factor_range(self) -> Space {
740        let space = self;
741        let mut space = space;
742        space.do_not_free_on_drop();
743        let space = space.ptr;
744        let isl_rs_result = unsafe { isl_space_factor_range(space) };
745        let isl_rs_result = Space { ptr: isl_rs_result,
746                                    should_free_on_drop: true };
747        isl_rs_result
748    }
749
750    /// Wraps `isl_space_domain_factor_domain`.
751    pub fn domain_factor_domain(self) -> Space {
752        let space = self;
753        let mut space = space;
754        space.do_not_free_on_drop();
755        let space = space.ptr;
756        let isl_rs_result = unsafe { isl_space_domain_factor_domain(space) };
757        let isl_rs_result = Space { ptr: isl_rs_result,
758                                    should_free_on_drop: true };
759        isl_rs_result
760    }
761
762    /// Wraps `isl_space_domain_factor_range`.
763    pub fn domain_factor_range(self) -> Space {
764        let space = self;
765        let mut space = space;
766        space.do_not_free_on_drop();
767        let space = space.ptr;
768        let isl_rs_result = unsafe { isl_space_domain_factor_range(space) };
769        let isl_rs_result = Space { ptr: isl_rs_result,
770                                    should_free_on_drop: true };
771        isl_rs_result
772    }
773
774    /// Wraps `isl_space_range_factor_domain`.
775    pub fn range_factor_domain(self) -> Space {
776        let space = self;
777        let mut space = space;
778        space.do_not_free_on_drop();
779        let space = space.ptr;
780        let isl_rs_result = unsafe { isl_space_range_factor_domain(space) };
781        let isl_rs_result = Space { ptr: isl_rs_result,
782                                    should_free_on_drop: true };
783        isl_rs_result
784    }
785
786    /// Wraps `isl_space_range_factor_range`.
787    pub fn range_factor_range(self) -> Space {
788        let space = self;
789        let mut space = space;
790        space.do_not_free_on_drop();
791        let space = space.ptr;
792        let isl_rs_result = unsafe { isl_space_range_factor_range(space) };
793        let isl_rs_result = Space { ptr: isl_rs_result,
794                                    should_free_on_drop: true };
795        isl_rs_result
796    }
797
798    /// Wraps `isl_space_domain_wrapped_domain`.
799    pub fn domain_wrapped_domain(self) -> Space {
800        let space = self;
801        let mut space = space;
802        space.do_not_free_on_drop();
803        let space = space.ptr;
804        let isl_rs_result = unsafe { isl_space_domain_wrapped_domain(space) };
805        let isl_rs_result = Space { ptr: isl_rs_result,
806                                    should_free_on_drop: true };
807        isl_rs_result
808    }
809
810    /// Wraps `isl_space_domain_wrapped_range`.
811    pub fn domain_wrapped_range(self) -> Space {
812        let space = self;
813        let mut space = space;
814        space.do_not_free_on_drop();
815        let space = space.ptr;
816        let isl_rs_result = unsafe { isl_space_domain_wrapped_range(space) };
817        let isl_rs_result = Space { ptr: isl_rs_result,
818                                    should_free_on_drop: true };
819        isl_rs_result
820    }
821
822    /// Wraps `isl_space_range_wrapped_domain`.
823    pub fn range_wrapped_domain(self) -> Space {
824        let space = self;
825        let mut space = space;
826        space.do_not_free_on_drop();
827        let space = space.ptr;
828        let isl_rs_result = unsafe { isl_space_range_wrapped_domain(space) };
829        let isl_rs_result = Space { ptr: isl_rs_result,
830                                    should_free_on_drop: true };
831        isl_rs_result
832    }
833
834    /// Wraps `isl_space_range_wrapped_range`.
835    pub fn range_wrapped_range(self) -> Space {
836        let space = self;
837        let mut space = space;
838        space.do_not_free_on_drop();
839        let space = space.ptr;
840        let isl_rs_result = unsafe { isl_space_range_wrapped_range(space) };
841        let isl_rs_result = Space { ptr: isl_rs_result,
842                                    should_free_on_drop: true };
843        isl_rs_result
844    }
845
846    /// Wraps `isl_space_map_from_set`.
847    pub fn map_from_set(self) -> Space {
848        let space = self;
849        let mut space = space;
850        space.do_not_free_on_drop();
851        let space = space.ptr;
852        let isl_rs_result = unsafe { isl_space_map_from_set(space) };
853        let isl_rs_result = Space { ptr: isl_rs_result,
854                                    should_free_on_drop: true };
855        isl_rs_result
856    }
857
858    /// Wraps `isl_space_map_from_domain_and_range`.
859    pub fn map_from_domain_and_range(self, range: Space) -> Space {
860        let domain = self;
861        let mut domain = domain;
862        domain.do_not_free_on_drop();
863        let domain = domain.ptr;
864        let mut range = range;
865        range.do_not_free_on_drop();
866        let range = range.ptr;
867        let isl_rs_result = unsafe { isl_space_map_from_domain_and_range(domain, range) };
868        let isl_rs_result = Space { ptr: isl_rs_result,
869                                    should_free_on_drop: true };
870        isl_rs_result
871    }
872
873    /// Wraps `isl_space_reverse`.
874    pub fn reverse(self) -> Space {
875        let space = self;
876        let mut space = space;
877        space.do_not_free_on_drop();
878        let space = space.ptr;
879        let isl_rs_result = unsafe { isl_space_reverse(space) };
880        let isl_rs_result = Space { ptr: isl_rs_result,
881                                    should_free_on_drop: true };
882        isl_rs_result
883    }
884
885    /// Wraps `isl_space_range_reverse`.
886    pub fn range_reverse(self) -> Space {
887        let space = self;
888        let mut space = space;
889        space.do_not_free_on_drop();
890        let space = space.ptr;
891        let isl_rs_result = unsafe { isl_space_range_reverse(space) };
892        let isl_rs_result = Space { ptr: isl_rs_result,
893                                    should_free_on_drop: true };
894        isl_rs_result
895    }
896
897    /// Wraps `isl_space_drop_dims`.
898    pub fn drop_dims(self, type_: DimType, first: u32, num: u32) -> Space {
899        let space = self;
900        let mut space = space;
901        space.do_not_free_on_drop();
902        let space = space.ptr;
903        let isl_rs_result = unsafe { isl_space_drop_dims(space, type_, first, num) };
904        let isl_rs_result = Space { ptr: isl_rs_result,
905                                    should_free_on_drop: true };
906        isl_rs_result
907    }
908
909    /// Wraps `isl_space_drop_inputs`.
910    pub fn drop_inputs(self, first: u32, n: u32) -> Space {
911        let space = self;
912        let mut space = space;
913        space.do_not_free_on_drop();
914        let space = space.ptr;
915        let isl_rs_result = unsafe { isl_space_drop_inputs(space, first, n) };
916        let isl_rs_result = Space { ptr: isl_rs_result,
917                                    should_free_on_drop: true };
918        isl_rs_result
919    }
920
921    /// Wraps `isl_space_drop_outputs`.
922    pub fn drop_outputs(self, first: u32, n: u32) -> Space {
923        let space = self;
924        let mut space = space;
925        space.do_not_free_on_drop();
926        let space = space.ptr;
927        let isl_rs_result = unsafe { isl_space_drop_outputs(space, first, n) };
928        let isl_rs_result = Space { ptr: isl_rs_result,
929                                    should_free_on_drop: true };
930        isl_rs_result
931    }
932
933    /// Wraps `isl_space_drop_all_params`.
934    pub fn drop_all_params(self) -> Space {
935        let space = self;
936        let mut space = space;
937        space.do_not_free_on_drop();
938        let space = space.ptr;
939        let isl_rs_result = unsafe { isl_space_drop_all_params(space) };
940        let isl_rs_result = Space { ptr: isl_rs_result,
941                                    should_free_on_drop: true };
942        isl_rs_result
943    }
944
945    /// Wraps `isl_space_domain`.
946    pub fn domain(self) -> Space {
947        let space = self;
948        let mut space = space;
949        space.do_not_free_on_drop();
950        let space = space.ptr;
951        let isl_rs_result = unsafe { isl_space_domain(space) };
952        let isl_rs_result = Space { ptr: isl_rs_result,
953                                    should_free_on_drop: true };
954        isl_rs_result
955    }
956
957    /// Wraps `isl_space_from_domain`.
958    pub fn from_domain(self) -> Space {
959        let space = self;
960        let mut space = space;
961        space.do_not_free_on_drop();
962        let space = space.ptr;
963        let isl_rs_result = unsafe { isl_space_from_domain(space) };
964        let isl_rs_result = Space { ptr: isl_rs_result,
965                                    should_free_on_drop: true };
966        isl_rs_result
967    }
968
969    /// Wraps `isl_space_range`.
970    pub fn range(self) -> Space {
971        let space = self;
972        let mut space = space;
973        space.do_not_free_on_drop();
974        let space = space.ptr;
975        let isl_rs_result = unsafe { isl_space_range(space) };
976        let isl_rs_result = Space { ptr: isl_rs_result,
977                                    should_free_on_drop: true };
978        isl_rs_result
979    }
980
981    /// Wraps `isl_space_from_range`.
982    pub fn from_range(self) -> Space {
983        let space = self;
984        let mut space = space;
985        space.do_not_free_on_drop();
986        let space = space.ptr;
987        let isl_rs_result = unsafe { isl_space_from_range(space) };
988        let isl_rs_result = Space { ptr: isl_rs_result,
989                                    should_free_on_drop: true };
990        isl_rs_result
991    }
992
993    /// Wraps `isl_space_domain_map`.
994    pub fn domain_map(self) -> Space {
995        let space = self;
996        let mut space = space;
997        space.do_not_free_on_drop();
998        let space = space.ptr;
999        let isl_rs_result = unsafe { isl_space_domain_map(space) };
1000        let isl_rs_result = Space { ptr: isl_rs_result,
1001                                    should_free_on_drop: true };
1002        isl_rs_result
1003    }
1004
1005    /// Wraps `isl_space_range_map`.
1006    pub fn range_map(self) -> Space {
1007        let space = self;
1008        let mut space = space;
1009        space.do_not_free_on_drop();
1010        let space = space.ptr;
1011        let isl_rs_result = unsafe { isl_space_range_map(space) };
1012        let isl_rs_result = Space { ptr: isl_rs_result,
1013                                    should_free_on_drop: true };
1014        isl_rs_result
1015    }
1016
1017    /// Wraps `isl_space_params`.
1018    pub fn params(self) -> Space {
1019        let space = self;
1020        let mut space = space;
1021        space.do_not_free_on_drop();
1022        let space = space.ptr;
1023        let isl_rs_result = unsafe { isl_space_params(space) };
1024        let isl_rs_result = Space { ptr: isl_rs_result,
1025                                    should_free_on_drop: true };
1026        isl_rs_result
1027    }
1028
1029    /// Wraps `isl_space_add_unnamed_tuple_ui`.
1030    pub fn add_unnamed_tuple_ui(self, dim: u32) -> Space {
1031        let space = self;
1032        let mut space = space;
1033        space.do_not_free_on_drop();
1034        let space = space.ptr;
1035        let isl_rs_result = unsafe { isl_space_add_unnamed_tuple_ui(space, dim) };
1036        let isl_rs_result = Space { ptr: isl_rs_result,
1037                                    should_free_on_drop: true };
1038        isl_rs_result
1039    }
1040
1041    /// Wraps `isl_space_add_named_tuple_id_ui`.
1042    pub fn add_named_tuple_id_ui(self, tuple_id: Id, dim: u32) -> Space {
1043        let space = self;
1044        let mut space = space;
1045        space.do_not_free_on_drop();
1046        let space = space.ptr;
1047        let mut tuple_id = tuple_id;
1048        tuple_id.do_not_free_on_drop();
1049        let tuple_id = tuple_id.ptr;
1050        let isl_rs_result = unsafe { isl_space_add_named_tuple_id_ui(space, tuple_id, dim) };
1051        let isl_rs_result = Space { ptr: isl_rs_result,
1052                                    should_free_on_drop: true };
1053        isl_rs_result
1054    }
1055
1056    /// Wraps `isl_space_set_from_params`.
1057    pub fn set_from_params(self) -> Space {
1058        let space = self;
1059        let mut space = space;
1060        space.do_not_free_on_drop();
1061        let space = space.ptr;
1062        let isl_rs_result = unsafe { isl_space_set_from_params(space) };
1063        let isl_rs_result = Space { ptr: isl_rs_result,
1064                                    should_free_on_drop: true };
1065        isl_rs_result
1066    }
1067
1068    /// Wraps `isl_space_align_params`.
1069    pub fn align_params(self, space2: Space) -> Space {
1070        let space1 = self;
1071        let mut space1 = space1;
1072        space1.do_not_free_on_drop();
1073        let space1 = space1.ptr;
1074        let mut space2 = space2;
1075        space2.do_not_free_on_drop();
1076        let space2 = space2.ptr;
1077        let isl_rs_result = unsafe { isl_space_align_params(space1, space2) };
1078        let isl_rs_result = Space { ptr: isl_rs_result,
1079                                    should_free_on_drop: true };
1080        isl_rs_result
1081    }
1082
1083    /// Wraps `isl_space_is_wrapping`.
1084    pub fn is_wrapping(&self) -> bool {
1085        let space = self;
1086        let space = space.ptr;
1087        let isl_rs_result = unsafe { isl_space_is_wrapping(space) };
1088        let isl_rs_result = match isl_rs_result {
1089            0 => false,
1090            1 => true,
1091            _ => panic!("Got isl_bool = -1"),
1092        };
1093        isl_rs_result
1094    }
1095
1096    /// Wraps `isl_space_domain_is_wrapping`.
1097    pub fn domain_is_wrapping(&self) -> bool {
1098        let space = self;
1099        let space = space.ptr;
1100        let isl_rs_result = unsafe { isl_space_domain_is_wrapping(space) };
1101        let isl_rs_result = match isl_rs_result {
1102            0 => false,
1103            1 => true,
1104            _ => panic!("Got isl_bool = -1"),
1105        };
1106        isl_rs_result
1107    }
1108
1109    /// Wraps `isl_space_range_is_wrapping`.
1110    pub fn range_is_wrapping(&self) -> bool {
1111        let space = self;
1112        let space = space.ptr;
1113        let isl_rs_result = unsafe { isl_space_range_is_wrapping(space) };
1114        let isl_rs_result = match isl_rs_result {
1115            0 => false,
1116            1 => true,
1117            _ => panic!("Got isl_bool = -1"),
1118        };
1119        isl_rs_result
1120    }
1121
1122    /// Wraps `isl_space_is_product`.
1123    pub fn is_product(&self) -> bool {
1124        let space = self;
1125        let space = space.ptr;
1126        let isl_rs_result = unsafe { isl_space_is_product(space) };
1127        let isl_rs_result = match isl_rs_result {
1128            0 => false,
1129            1 => true,
1130            _ => panic!("Got isl_bool = -1"),
1131        };
1132        isl_rs_result
1133    }
1134
1135    /// Wraps `isl_space_wrap`.
1136    pub fn wrap(self) -> Space {
1137        let space = self;
1138        let mut space = space;
1139        space.do_not_free_on_drop();
1140        let space = space.ptr;
1141        let isl_rs_result = unsafe { isl_space_wrap(space) };
1142        let isl_rs_result = Space { ptr: isl_rs_result,
1143                                    should_free_on_drop: true };
1144        isl_rs_result
1145    }
1146
1147    /// Wraps `isl_space_unwrap`.
1148    pub fn unwrap(self) -> Space {
1149        let space = self;
1150        let mut space = space;
1151        space.do_not_free_on_drop();
1152        let space = space.ptr;
1153        let isl_rs_result = unsafe { isl_space_unwrap(space) };
1154        let isl_rs_result = Space { ptr: isl_rs_result,
1155                                    should_free_on_drop: true };
1156        isl_rs_result
1157    }
1158
1159    /// Wraps `isl_space_can_zip`.
1160    pub fn can_zip(&self) -> bool {
1161        let space = self;
1162        let space = space.ptr;
1163        let isl_rs_result = unsafe { isl_space_can_zip(space) };
1164        let isl_rs_result = match isl_rs_result {
1165            0 => false,
1166            1 => true,
1167            _ => panic!("Got isl_bool = -1"),
1168        };
1169        isl_rs_result
1170    }
1171
1172    /// Wraps `isl_space_zip`.
1173    pub fn zip(self) -> Space {
1174        let space = self;
1175        let mut space = space;
1176        space.do_not_free_on_drop();
1177        let space = space.ptr;
1178        let isl_rs_result = unsafe { isl_space_zip(space) };
1179        let isl_rs_result = Space { ptr: isl_rs_result,
1180                                    should_free_on_drop: true };
1181        isl_rs_result
1182    }
1183
1184    /// Wraps `isl_space_can_curry`.
1185    pub fn can_curry(&self) -> bool {
1186        let space = self;
1187        let space = space.ptr;
1188        let isl_rs_result = unsafe { isl_space_can_curry(space) };
1189        let isl_rs_result = match isl_rs_result {
1190            0 => false,
1191            1 => true,
1192            _ => panic!("Got isl_bool = -1"),
1193        };
1194        isl_rs_result
1195    }
1196
1197    /// Wraps `isl_space_curry`.
1198    pub fn curry(self) -> Space {
1199        let space = self;
1200        let mut space = space;
1201        space.do_not_free_on_drop();
1202        let space = space.ptr;
1203        let isl_rs_result = unsafe { isl_space_curry(space) };
1204        let isl_rs_result = Space { ptr: isl_rs_result,
1205                                    should_free_on_drop: true };
1206        isl_rs_result
1207    }
1208
1209    /// Wraps `isl_space_can_range_curry`.
1210    pub fn can_range_curry(&self) -> bool {
1211        let space = self;
1212        let space = space.ptr;
1213        let isl_rs_result = unsafe { isl_space_can_range_curry(space) };
1214        let isl_rs_result = match isl_rs_result {
1215            0 => false,
1216            1 => true,
1217            _ => panic!("Got isl_bool = -1"),
1218        };
1219        isl_rs_result
1220    }
1221
1222    /// Wraps `isl_space_range_curry`.
1223    pub fn range_curry(self) -> Space {
1224        let space = self;
1225        let mut space = space;
1226        space.do_not_free_on_drop();
1227        let space = space.ptr;
1228        let isl_rs_result = unsafe { isl_space_range_curry(space) };
1229        let isl_rs_result = Space { ptr: isl_rs_result,
1230                                    should_free_on_drop: true };
1231        isl_rs_result
1232    }
1233
1234    /// Wraps `isl_space_can_uncurry`.
1235    pub fn can_uncurry(&self) -> bool {
1236        let space = self;
1237        let space = space.ptr;
1238        let isl_rs_result = unsafe { isl_space_can_uncurry(space) };
1239        let isl_rs_result = match isl_rs_result {
1240            0 => false,
1241            1 => true,
1242            _ => panic!("Got isl_bool = -1"),
1243        };
1244        isl_rs_result
1245    }
1246
1247    /// Wraps `isl_space_uncurry`.
1248    pub fn uncurry(self) -> Space {
1249        let space = self;
1250        let mut space = space;
1251        space.do_not_free_on_drop();
1252        let space = space.ptr;
1253        let isl_rs_result = unsafe { isl_space_uncurry(space) };
1254        let isl_rs_result = Space { ptr: isl_rs_result,
1255                                    should_free_on_drop: true };
1256        isl_rs_result
1257    }
1258
1259    /// Wraps `isl_space_is_domain`.
1260    pub fn is_domain(&self, space2: &Space) -> bool {
1261        let space1 = self;
1262        let space1 = space1.ptr;
1263        let space2 = space2.ptr;
1264        let isl_rs_result = unsafe { isl_space_is_domain(space1, space2) };
1265        let isl_rs_result = match isl_rs_result {
1266            0 => false,
1267            1 => true,
1268            _ => panic!("Got isl_bool = -1"),
1269        };
1270        isl_rs_result
1271    }
1272
1273    /// Wraps `isl_space_is_range`.
1274    pub fn is_range(&self, space2: &Space) -> bool {
1275        let space1 = self;
1276        let space1 = space1.ptr;
1277        let space2 = space2.ptr;
1278        let isl_rs_result = unsafe { isl_space_is_range(space1, space2) };
1279        let isl_rs_result = match isl_rs_result {
1280            0 => false,
1281            1 => true,
1282            _ => panic!("Got isl_bool = -1"),
1283        };
1284        isl_rs_result
1285    }
1286
1287    /// Wraps `isl_space_is_equal`.
1288    pub fn is_equal(&self, space2: &Space) -> bool {
1289        let space1 = self;
1290        let space1 = space1.ptr;
1291        let space2 = space2.ptr;
1292        let isl_rs_result = unsafe { isl_space_is_equal(space1, space2) };
1293        let isl_rs_result = match isl_rs_result {
1294            0 => false,
1295            1 => true,
1296            _ => panic!("Got isl_bool = -1"),
1297        };
1298        isl_rs_result
1299    }
1300
1301    /// Wraps `isl_space_has_equal_params`.
1302    pub fn has_equal_params(&self, space2: &Space) -> bool {
1303        let space1 = self;
1304        let space1 = space1.ptr;
1305        let space2 = space2.ptr;
1306        let isl_rs_result = unsafe { isl_space_has_equal_params(space1, space2) };
1307        let isl_rs_result = match isl_rs_result {
1308            0 => false,
1309            1 => true,
1310            _ => panic!("Got isl_bool = -1"),
1311        };
1312        isl_rs_result
1313    }
1314
1315    /// Wraps `isl_space_has_equal_tuples`.
1316    pub fn has_equal_tuples(&self, space2: &Space) -> bool {
1317        let space1 = self;
1318        let space1 = space1.ptr;
1319        let space2 = space2.ptr;
1320        let isl_rs_result = unsafe { isl_space_has_equal_tuples(space1, space2) };
1321        let isl_rs_result = match isl_rs_result {
1322            0 => false,
1323            1 => true,
1324            _ => panic!("Got isl_bool = -1"),
1325        };
1326        isl_rs_result
1327    }
1328
1329    /// Wraps `isl_space_tuple_is_equal`.
1330    pub fn tuple_is_equal(&self, type1: DimType, space2: &Space, type2: DimType) -> bool {
1331        let space1 = self;
1332        let space1 = space1.ptr;
1333        let space2 = space2.ptr;
1334        let isl_rs_result = unsafe { isl_space_tuple_is_equal(space1, type1, space2, type2) };
1335        let isl_rs_result = match isl_rs_result {
1336            0 => false,
1337            1 => true,
1338            _ => panic!("Got isl_bool = -1"),
1339        };
1340        isl_rs_result
1341    }
1342
1343    /// Wraps `isl_space_match`.
1344    pub fn match_(&self, type1: DimType, space2: &Space, type2: DimType) -> bool {
1345        let space1 = self;
1346        let space1 = space1.ptr;
1347        let space2 = space2.ptr;
1348        let isl_rs_result = unsafe { isl_space_match(space1, type1, space2, type2) };
1349        let isl_rs_result = match isl_rs_result {
1350            0 => false,
1351            1 => true,
1352            _ => panic!("Got isl_bool = -1"),
1353        };
1354        isl_rs_result
1355    }
1356
1357    /// Wraps `isl_space_dim`.
1358    pub fn dim(&self, type_: DimType) -> i32 {
1359        let space = self;
1360        let space = space.ptr;
1361        let isl_rs_result = unsafe { isl_space_dim(space, type_) };
1362        isl_rs_result
1363    }
1364
1365    /// Wraps `isl_space_flatten_domain`.
1366    pub fn flatten_domain(self) -> Space {
1367        let space = self;
1368        let mut space = space;
1369        space.do_not_free_on_drop();
1370        let space = space.ptr;
1371        let isl_rs_result = unsafe { isl_space_flatten_domain(space) };
1372        let isl_rs_result = Space { ptr: isl_rs_result,
1373                                    should_free_on_drop: true };
1374        isl_rs_result
1375    }
1376
1377    /// Wraps `isl_space_flatten_range`.
1378    pub fn flatten_range(self) -> Space {
1379        let space = self;
1380        let mut space = space;
1381        space.do_not_free_on_drop();
1382        let space = space.ptr;
1383        let isl_rs_result = unsafe { isl_space_flatten_range(space) };
1384        let isl_rs_result = Space { ptr: isl_rs_result,
1385                                    should_free_on_drop: true };
1386        isl_rs_result
1387    }
1388
1389    /// Wraps `isl_space_read_from_str`.
1390    pub fn read_from_str(ctx: &Context, str_: &str) -> Space {
1391        let ctx = ctx.ptr;
1392        let str_ = CString::new(str_).unwrap();
1393        let str_ = str_.as_ptr();
1394        let isl_rs_result = unsafe { isl_space_read_from_str(ctx, str_) };
1395        let isl_rs_result = Space { ptr: isl_rs_result,
1396                                    should_free_on_drop: true };
1397        isl_rs_result
1398    }
1399
1400    /// Wraps `isl_space_to_str`.
1401    pub fn to_str(&self) -> &str {
1402        let space = self;
1403        let space = space.ptr;
1404        let isl_rs_result = unsafe { isl_space_to_str(space) };
1405        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
1406        let isl_rs_result = isl_rs_result.to_str().unwrap();
1407        isl_rs_result
1408    }
1409
1410    /// Wraps `isl_space_dump`.
1411    pub fn dump(&self) {
1412        let space = self;
1413        let space = space.ptr;
1414        let isl_rs_result = unsafe { isl_space_dump(space) };
1415        isl_rs_result
1416    }
1417
1418    /// Does not call isl_xxx_free() on being dropped. (For internal use only.)
1419    pub fn do_not_free_on_drop(&mut self) {
1420        self.should_free_on_drop = false;
1421    }
1422}
1423
1424impl Drop for Space {
1425    fn drop(&mut self) {
1426        if self.should_free_on_drop {
1427            unsafe {
1428                isl_space_free(self.ptr);
1429            }
1430        }
1431    }
1432}