%fragment("Hello","header") "..."
%fragment("Hi","header",fragment="Hello") "..."
the latter fragment will include the first one if is invoked.
more than one fragment can be included at the time, just
keep adding fragment="f1",fragment="f2", etc.
this is used to emulate typemaps reuse, where all the
reusable typemap code is put in a fragment static method,
and then it can be included from another fragment typemap
as needed.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5690 626c5289-ae23-0410-ae9c-e8d60b6d4f22
36 lines
398 B
OpenEdge ABL
36 lines
398 B
OpenEdge ABL
%module fragments
|
|
|
|
|
|
%fragment("Hello","header") %{
|
|
/* hello!!! */
|
|
int foobar(int a)
|
|
{
|
|
return a;
|
|
}
|
|
%}
|
|
|
|
/*
|
|
this fragment include the previous fragment if needed.
|
|
*/
|
|
|
|
%fragment("Hi","header",fragment="Hello") %{
|
|
/* hi!!! */
|
|
int bar(int a)
|
|
{
|
|
return foobar(a);
|
|
}
|
|
%}
|
|
|
|
%typemap(in,fragment="Hi") int hola "$1 = 123;";
|
|
|
|
|
|
%inline %{
|
|
|
|
int bar(int a);
|
|
|
|
int foo(int hola)
|
|
{
|
|
return bar(hola);
|
|
}
|
|
|
|
%}
|