PageRenderTime 43ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/modula3/enum/example.i

#
Swig | 72 lines | 52 code | 18 blank | 2 comment | 0 complexity | 8f72d9649c1f1d78053dd732219a2ab5 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.i */
  2. %module Example
  3. %{
  4. #include "example.h"
  5. %}
  6. %include "example_const.i"
  7. // such features are generated by the following pragmas
  8. #if 0
  9. %feature("modula3:enumitem:enum","Days") DAY_MONDAY;
  10. %feature("modula3:enumitem:name","monday") DAY_MONDAY;
  11. %feature("modula3:enumitem:conv","int:int") DAY_MONDAY;
  12. %feature("modula3:enumitem:enum","Month") MTHB_JANUARY;
  13. %feature("modula3:enumitem:name","january") MTHB_JANUARY;
  14. %feature("modula3:enumitem:conv","set:int") MTHB_JANUARY;
  15. //%feature("modula3:constset:type","MonthSet") MTHB_JANUARY; /*type in the constant definition*/
  16. %feature("modula3:constset:set", "MonthSet") MTHB_JANUARY; /*remarks that the 'type' is a set type*/
  17. %feature("modula3:constset:base","Month") MTHB_JANUARY;
  18. %feature("modula3:constset:name","monthsJanuary") MTHB_JANUARY;
  19. %feature("modula3:constset:conv","set:set") MTHB_JANUARY; /*conversion of the bit pattern: no change*/
  20. %feature("modula3:enumitem:enum","Color") BLUE;
  21. %feature("modula3:enumitem:name","blue") BLUE;
  22. %feature("modula3:enumitem:conv","int:int") BLUE;
  23. %feature("modula3:constint:type","INTEGER") Foo::IMPULSE;
  24. %feature("modula3:constint:name","impulse") Foo::IMPULSE;
  25. %feature("modula3:constint:conv","int:int") Foo::IMPULSE;
  26. #endif
  27. %rename(pi) PI;
  28. %pragma(modula3) enumitem="prefix=DAY_;int;srcstyle=underscore;Day";
  29. %pragma(modula3) enumitem="enum=color;int;srcstyle=underscore;Color";
  30. %pragma(modula3) makesetofenum="Color";
  31. %pragma(modula3) constset="prefix=CLB_;set;srcstyle=underscore,prefix=clb;ColorSet,Color";
  32. %pragma(modula3) enumitem="prefix=MTHB_,enum=calendar;set;srcstyle=underscore;Month";
  33. %pragma(modula3) makesetofenum="Month";
  34. %pragma(modula3) constset="prefix=MTHB_,enum=calendar;set;srcstyle=underscore,prefix=monthset;MonthSet,Month";
  35. %pragma(modula3) constint="prefix=Answer::Foo::,enum=Answer::Foo::speed;int;srcstyle=underscore,prefix=speed;INTEGER";
  36. %pragma(modula3) constint="prefix=Answer::,enum=Answer::;int;srcstyle=underscore,prefix=answer;CARDINAL";
  37. %rename(AnswerFoo) Answer::Foo;
  38. %typemap("m3rawrettype") Answer::Foo * %{AnswerFoo%}
  39. %typemap("m3rawintype") Answer::Foo * %{AnswerFoo%}
  40. %typemap("m3rawinmode") Answer::Foo * %{%}
  41. %typemap("m3wraprettype") Answer::Foo * %{AnswerFoo%}
  42. %typemap("m3wrapintype") Answer::Foo * %{AnswerFoo%}
  43. %typemap("m3wrapinmode") Answer::Foo * %{%}
  44. %typemap("m3wrapargraw") Answer::Foo * %{self.cxxObj%}
  45. %typemap("m3wrapretvar") Answer::Foo * %{cxxObj : ExampleRaw.AnswerFoo;%}
  46. %typemap("m3wrapretraw") Answer::Foo * %{cxxObj%}
  47. %typemap("m3wrapretconv") Answer::Foo * %{NEW(AnswerFoo,cxxObj:=cxxObj)%}
  48. %typemap("m3rawintype") Answer::Foo::speed %{C.int%};
  49. %typemap("m3rawintype:import") Answer::Foo::speed %{Ctypes AS C%};
  50. %typemap("m3wrapintype") Answer::Foo::speed %{[-2..3]%};
  51. %typemap("m3wrapintype") color %{Color%};
  52. %typemap("m3wrapargraw") color %{ORD($1_name)%};
  53. /* Let's just grab the original header file here */
  54. %include "example.h"