-nopgcpp commandline option

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9491 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-10-29 22:36:24 +00:00
commit 5dbc7f3dea
3 changed files with 22 additions and 6 deletions

View file

@ -71,6 +71,10 @@ The most notable differences to Java are the following:
When invoking SWIG use the <tt>-csharp</tt> command line option instead of <tt>-java</tt>. When invoking SWIG use the <tt>-csharp</tt> command line option instead of <tt>-java</tt>.
</li> </li>
<li>
The <tt>-nopgcpp</tt> command line option does not exist.
</li>
<li> <li>
The <tt>-package</tt> command line option does not exist. The <tt>-package</tt> command line option does not exist.
</li> </li>

View file

@ -268,8 +268,8 @@ swig -java -help
</tr> </tr>
<tr> <tr>
<td>-package &lt;name&gt;</td> <td>-nopgcpp</td>
<td>set name of the Java package to &lt;name&gt;</td> <td>suppress the premature garbage collection prevention parameter</td>
</tr> </tr>
<tr> <tr>
@ -277,6 +277,11 @@ swig -java -help
<td>generate the low-level functional interface instead of proxy classes </td> <td>generate the low-level functional interface instead of proxy classes </td>
</tr> </tr>
<tr>
<td>-package &lt;name&gt;</td>
<td>set name of the Java package to &lt;name&gt;</td>
</tr>
</table> </table>
<p> <p>
@ -2831,8 +2836,9 @@ and therefore there is no possibility of premature garbage collection. In practi
</p> </p>
<p> <p>
The premature garbage collection prevention parameter for proxy classes is generated by default. The premature garbage collection prevention parameter for proxy classes is generated by default whenever proxy classes are passed by value, reference or with a pointer.
It does impose a slight overhead and can be suppressed by specifying the 'nopgcpp' attribute in the "jnitype" <a href="#java_typemaps">Java typemap</a>. The additional parameters do impose a slight performance overhead and the parameter generation can be suppressed globally with the <tt>-nopgcpp</tt> commandline option.
More selective suppression is possible with the 'nopgcpp' attribute in the "jnitype" <a href="#java_typemaps">Java typemap</a>.
The attribute is a flag and so should be set to "1" to enable the suppression, or it can be omitted or set to "0" to disable. The attribute is a flag and so should be set to "1" to enable the suppression, or it can be omitted or set to "0" to disable.
For example: For example:
</p> </p>

View file

@ -34,6 +34,7 @@ class JAVA : public Language {
List *filenames_list; List *filenames_list;
bool proxy_flag; // Flag for generating proxy classes bool proxy_flag; // Flag for generating proxy classes
bool nopgcpp_flag; // Flag for suppressing the premature garbage collection prevention parameter
bool native_function_flag; // Flag for when wrapping a native function bool native_function_flag; // Flag for when wrapping a native function
bool enum_constant_flag; // Flag for when wrapping an enum or constant bool enum_constant_flag; // Flag for when wrapping an enum or constant
bool static_flag; // Flag for when wrapping a static functions or member variables bool static_flag; // Flag for when wrapping a static functions or member variables
@ -102,6 +103,7 @@ class JAVA : public Language {
filenames_list(NULL), filenames_list(NULL),
proxy_flag(true), proxy_flag(true),
nopgcpp_flag(false),
native_function_flag(false), native_function_flag(false),
enum_constant_flag(false), enum_constant_flag(false),
static_flag(false), static_flag(false),
@ -221,6 +223,9 @@ class JAVA : public Language {
} else if ((strcmp(argv[i],"-noproxy") == 0)) { } else if ((strcmp(argv[i],"-noproxy") == 0)) {
Swig_mark_arg(i); Swig_mark_arg(i);
proxy_flag = false; proxy_flag = false;
} else if (strcmp(argv[i],"-nopgcpp") == 0) {
Swig_mark_arg(i);
nopgcpp_flag = true;
} else if (strcmp(argv[i],"-oldvarnames") == 0) { } else if (strcmp(argv[i],"-oldvarnames") == 0) {
Swig_mark_arg(i); Swig_mark_arg(i);
old_variable_names = true; old_variable_names = true;
@ -2784,7 +2789,7 @@ class JAVA : public Language {
if (Cmp(jtype, "long") == 0) { if (Cmp(jtype, "long") == 0) {
if (proxy_flag) { if (proxy_flag) {
Node *n = classLookup(t); Node *n = classLookup(t);
if (n && !GetFlag(p, "tmap:jtype:nopgcpp")) { if (n && !GetFlag(p, "tmap:jtype:nopgcpp") && !nopgcpp_flag) {
return Getattr(n,"sym:name"); return Getattr(n,"sym:name");
} }
} }
@ -3936,9 +3941,10 @@ extern "C" Language * swig_java(void) {
const char *JAVA::usage = (char*)"\ const char *JAVA::usage = (char*)"\
Java Options (available with -java)\n\ Java Options (available with -java)\n\
-package <name> - set name of the Java package to <name>\n\ -nopgcpp - Suppress premature garbage collection prevention parameter\n\
-noproxy - Generate the low-level functional interface instead\n\ -noproxy - Generate the low-level functional interface instead\n\
of proxy classes\n\ of proxy classes\n\
-oldvarnames - old intermediary method names for variable wrappers\n\ -oldvarnames - old intermediary method names for variable wrappers\n\
-package <name> - set name of the Java package to <name>\n\
\n"; \n";