PageRenderTime 36ms CodeModel.GetById 13ms 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. %warnfilter(801) constbool; /* Ruby, wrong class name */
  4. // bool constant
  5. %constant bool constbool=false;
  6. %inline %{
  7. // bool variables
  8. bool bool1 = true;
  9. bool bool2 = false;
  10. bool* pbool = &bool1;
  11. bool& rbool = bool2;
  12. const bool* const_pbool = pbool;
  13. const bool& const_rbool = rbool;
  14. static int eax()
  15. {
  16. return 1024; // NOTE: any number > 255 should do
  17. }
  18. // bool functions
  19. bool bo(bool b) {
  20. eax();
  21. return b;
  22. }
  23. bool& rbo(bool& b) {
  24. return b;
  25. }
  26. bool* pbo(bool* b) {
  27. return b;
  28. }
  29. const bool& const_rbo(const bool& b) {
  30. return b;
  31. }
  32. const bool* const_pbo(const bool* b) {
  33. return b;
  34. }
  35. // helper function
  36. bool value(bool* b) {
  37. return *b;
  38. }
  39. %}