From b4934f5b70e4474e9f2628fe36ade936baf91e56 Mon Sep 17 00:00:00 2001 From: Tiger Feng Date: Sun, 16 Feb 2003 21:07:57 +0000 Subject: [PATCH] -fcompact -fvirtual -small SWIG_FEATURES git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4328 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/main.cxx | 42 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 55ea30f82..cf37e2661 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -71,7 +71,9 @@ static char *usage = (char*)"\ -o outfile - Set name of the output file.\n\ -swiglib - Report location of SWIG library and exit\n\ -v - Run in verbose mode\n\ - -compact - Compile in compact mode\n\ + -fcompact - Compile in compact mode\n\ + -fvirtual - Compile in virtual elimination mode\n\ + -small - Compile in virtual elimination & compact mode\n\ -version - Print SWIG version number\n\ -Wall - Enable all warning messages\n\ -wn - Suppress warning number n\n\ @@ -165,6 +167,7 @@ void SWIG_config_cppext(const char *ext) { extern "C" Node *Swig_cparse(File *); extern "C" void Swig_cparse_cplusplus(int); extern "C" void Swig_cparse_debug_templates(int); +extern void Wrapper_virtual_elimination_mode_set(int); int SWIG_main(int argc, char *argv[], Language *l) { int i; @@ -262,6 +265,30 @@ int SWIG_main(int argc, char *argv[], Language *l) { libfiles = NewList(); + /* Check for SWIG_FEATURES environment variable */ + if (c = getenv("SWIG_FEATURES")) { + while (*c!='\0') { + while ((*c)==' ') { + c++; + } + i = 0; + while ((*c!='\0') && (*c!=' ')) { + temp[i] = *c; + c++; i++; + } + temp[i]='\0'; + + if (strcmp(temp, "-fcompact") == 0) { + Wrapper_compact_print_mode_set(1); + } else if (strcmp(temp, "-fvirtual") == 0) { + Wrapper_virtual_elimination_mode_set(1); + } else if (strcmp(temp, "-small") == 0) { + Wrapper_compact_print_mode_set(1); + Wrapper_virtual_elimination_mode_set(1); + } + } + } + // Get options for (i = 1; i < argc; i++) { if (argv[i]) { @@ -282,14 +309,21 @@ int SWIG_main(int argc, char *argv[], Language *l) { (strcmp(argv[i],"-v") == 0)) { Verbose = 1; Swig_mark_arg(i); - } else if (strcmp(argv[i],"-compact") == 0) { - Wrapper_compact_print_mode_set(1); - Swig_mark_arg(i); } else if (strcmp(argv[i],"-c++") == 0) { CPlusPlus=1; Preprocessor_define((DOH *) "__cplusplus 1", 0); Swig_cparse_cplusplus(1); Swig_mark_arg(i); + } else if (strcmp(argv[i],"-fcompact") == 0) { + Wrapper_compact_print_mode_set(1); + Swig_mark_arg(i); + } else if (strcmp(argv[i],"-fvirtual") == 0) { + Wrapper_virtual_elimination_mode_set(1); + Swig_mark_arg(i); + } else if (strcmp(argv[i],"-small") == 0) { + Wrapper_compact_print_mode_set(1); + Wrapper_virtual_elimination_mode_set(1); + Swig_mark_arg(i); } else if (strcmp(argv[i],"-c") == 0) { NoInclude=1; Preprocessor_define((DOH *) "SWIG_NOINCLUDE 1", 0);