PageRenderTime 18ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/bools.i

#
Swig | 47 lines | 39 code | 8 blank | 0 comment | 0 complexity | 760581f92630e3ddf36be17e243dc333 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1// bool typemaps check
 2%module bools
 3
 4%warnfilter(801) constbool;         /* Ruby, wrong class name */
 5
 6// bool constant
 7%constant bool constbool=false;
 8
 9%inline %{
10
11// bool variables
12bool bool1 = true;
13bool bool2 = false;
14bool* pbool = &bool1;
15bool& rbool = bool2;
16const bool* const_pbool = pbool;
17const bool& const_rbool = rbool;
18
19static int eax()
20{
21  return 1024;  // NOTE: any number > 255 should do
22}
23
24// bool functions
25bool bo(bool b) {
26  eax();
27  return b;
28}
29bool& rbo(bool& b) {
30    return b;
31}
32bool* pbo(bool* b) {
33    return b;
34}
35const bool& const_rbo(const bool& b) {
36    return b;
37}
38const bool* const_pbo(const bool* b) {
39    return b;
40}
41
42// helper function
43bool value(bool* b) {
44    return *b;
45}
46%}
47