Simple patch to allow fragments to include other fragments:
%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
This commit is contained in:
parent
c429cdb9fc
commit
6dceec6fdb
5 changed files with 64 additions and 16 deletions
|
|
@ -461,10 +461,7 @@ int Language::constantDirective(Node *n) {
|
|||
* ---------------------------------------------------------------------- */
|
||||
|
||||
int Language::fragmentDirective(Node *n) {
|
||||
String *name = Getattr(n,"name");
|
||||
String *code = Getattr(n,"code");
|
||||
String *section = Getattr(n,"section");
|
||||
Swig_fragment_register(name,section,code);
|
||||
Swig_fragment_register(n);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue