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