changed -fdirectors option to %module option
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4445 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
375592a285
commit
47710c7dda
6 changed files with 149 additions and 84 deletions
|
|
@ -1599,12 +1599,6 @@ int Language::classDeclaration(Node *n) {
|
|||
}
|
||||
Setattr(n,"classtype", SwigType_namestr(ClassType));
|
||||
|
||||
/*
|
||||
if (CPlusPlus) {
|
||||
classDirector(n);
|
||||
}
|
||||
*/
|
||||
|
||||
InClass = 1;
|
||||
CurrentClass = n;
|
||||
|
||||
|
|
@ -1616,7 +1610,7 @@ int Language::classDeclaration(Node *n) {
|
|||
|
||||
/* Call classHandler() here */
|
||||
if (!ImportMode) {
|
||||
if (CPlusPlus && directorsEnabled()) {
|
||||
if (directorsEnabled()) {
|
||||
classDirector(n);
|
||||
}
|
||||
classHandler(n);
|
||||
|
|
@ -2105,7 +2099,7 @@ void Language::allow_directors(int val) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Language::directorsEnabled() const {
|
||||
return directors;
|
||||
return directors && CPlusPlus;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ static char *usage = (char*)"\
|
|||
-swiglib - Report location of SWIG library and exit\n\
|
||||
-v - Run in verbose mode\n\
|
||||
-fcompact - Compile in compact mode\n\
|
||||
-fdirectors - Enable C++ directors\n\
|
||||
-fvirtual - Compile in virtual elimination mode\n\
|
||||
-small - Compile in virtual elimination & compact mode\n\
|
||||
-version - Print SWIG version number\n\
|
||||
|
|
@ -190,7 +189,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
int dump_classes = 0;
|
||||
int werror = 0;
|
||||
int depend = 0;
|
||||
int directors = 0;
|
||||
|
||||
DOH *libfiles = 0;
|
||||
DOH *cpps = 0 ;
|
||||
|
|
@ -287,9 +285,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
} else if (strcmp(temp, "-small") == 0) {
|
||||
Wrapper_compact_print_mode_set(1);
|
||||
Wrapper_virtual_elimination_mode_set(1);
|
||||
} else if (strcmp(temp, "-fdirectors") == 0) {
|
||||
directors = 1;
|
||||
lang->allow_directors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -329,10 +324,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
Wrapper_compact_print_mode_set(1);
|
||||
Wrapper_virtual_elimination_mode_set(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-fdirectors") == 0) {
|
||||
directors = 1;
|
||||
lang->allow_directors();
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-c") == 0) {
|
||||
NoInclude=1;
|
||||
Preprocessor_define((DOH *) "SWIG_NOINCLUDE 1", 0);
|
||||
|
|
@ -543,9 +534,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (lang_config) {
|
||||
Printf(fs,"\n%%include \"%s\"\n", lang_config);
|
||||
}
|
||||
if (directors) {
|
||||
Printf(fs,"\n%%include \"director.swg\"\n");
|
||||
}
|
||||
Printf(fs,"%%include \"%s\"\n", Swig_last_file());
|
||||
for (i = 0; i < Len(libfiles); i++) {
|
||||
Printf(fs,"\n%%include \"%s\"\n", Getitem(libfiles,i));
|
||||
|
|
|
|||
|
|
@ -376,6 +376,26 @@ public:
|
|||
|
||||
virtual int top(Node *n) {
|
||||
|
||||
/* check if directors are enabled for this module. note: this
|
||||
* is a "master" switch, without which no director code will be
|
||||
* emitted. %feature("director") statements are also required
|
||||
* to enable directors for individual classes or methods.
|
||||
*
|
||||
* use %module(directors="1") modulename at the start of the
|
||||
* interface file to enable director generation.
|
||||
*/
|
||||
{
|
||||
Node *module = Getattr(n, "module");
|
||||
if (module) {
|
||||
Node *options = Getattr(module, "options");
|
||||
if (options) {
|
||||
if (Getattr(options, "directors")) {
|
||||
allow_directors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize all of the output files */
|
||||
String *outfile = Getattr(n,"outfile");
|
||||
String *outfile_h = Getattr(n, "outfile_h");
|
||||
|
|
@ -386,7 +406,7 @@ public:
|
|||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (CPlusPlus && directorsEnabled()) {
|
||||
if (directorsEnabled()) {
|
||||
f_runtime_h = NewFile(outfile_h,"w");
|
||||
if (!f_runtime_h) {
|
||||
Printf(stderr,"*** Can't open '%s'\n", outfile_h);
|
||||
|
|
@ -422,11 +442,12 @@ public:
|
|||
module = Copy(Getattr(n,"name"));
|
||||
mainmodule = Getattr(n,"name");
|
||||
|
||||
if (CPlusPlus) {
|
||||
if (directorsEnabled()) {
|
||||
Swig_banner(f_directors_h);
|
||||
Printf(f_directors_h, "#ifndef __%s_WRAP_H__\n", module);
|
||||
Printf(f_directors_h, "#define __%s_WRAP_H__\n\n", module);
|
||||
Printf(f_directors_h, "class __DIRECTOR__;\n\n");
|
||||
Swig_insert_file("director.swg", f_directors);
|
||||
Printf(f_directors, "\n\n");
|
||||
Printf(f_directors, "/* ---------------------------------------------------\n");
|
||||
Printf(f_directors, " * C++ director class methods\n");
|
||||
|
|
@ -548,7 +569,7 @@ public:
|
|||
/* Close all of the files */
|
||||
Dump(f_header,f_runtime);
|
||||
|
||||
if (CPlusPlus && directorsEnabled()) {
|
||||
if (directorsEnabled()) {
|
||||
Dump(f_directors, f_runtime);
|
||||
Dump(f_directors_h, f_runtime_h);
|
||||
Printf(f_runtime_h, "\n");
|
||||
|
|
@ -844,7 +865,7 @@ public:
|
|||
// (the smart-pointer) and the director object (the "pointee") are
|
||||
// distinct.
|
||||
|
||||
if (CPlusPlus && directorsEnabled()) {
|
||||
if (directorsEnabled()) {
|
||||
if (!is_smart_pointer()) {
|
||||
if (/*directorbase &&*/ hasVirtual && !constructor && isVirtual) {
|
||||
Wrapper_add_local(f, "director", "__DIRECTOR__ *director = 0");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue