new typemap: javaconstruct. This typemap contains the code that goes into the proxy constructor.
The javaconstruct_director typemap is used instead when directors are enabled. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6921 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
eaeada5bcc
commit
7a9a0e9dff
1 changed files with 19 additions and 16 deletions
|
|
@ -1983,8 +1983,8 @@ class JAVA : public Language {
|
||||||
String *tm;
|
String *tm;
|
||||||
Parm *p;
|
Parm *p;
|
||||||
int i;
|
int i;
|
||||||
Node *parentNode = parentNode(n);
|
String *function_code = NewString("");
|
||||||
bool feature_director = (parentNode && Swig_directorclass(n));
|
bool feature_director = (parentNode(n) && Swig_directorclass(n));
|
||||||
|
|
||||||
Language::constructorHandler(n);
|
Language::constructorHandler(n);
|
||||||
|
|
||||||
|
|
@ -1999,8 +1999,8 @@ class JAVA : public Language {
|
||||||
|
|
||||||
const String *methodmods = Getattr(n,"feature:java:methodmodifiers");
|
const String *methodmods = Getattr(n,"feature:java:methodmodifiers");
|
||||||
methodmods = methodmods ? methodmods : (!is_public(n) ? protected_string : public_string);
|
methodmods = methodmods ? methodmods : (!is_public(n) ? protected_string : public_string);
|
||||||
Printf(proxy_class_code, " %s %s(", methodmods, proxy_class_name);
|
Printf(function_code, " %s %s(", methodmods, proxy_class_name);
|
||||||
Printv(imcall, "this(", imclass_name, ".", mangled_overname, "(", NIL);
|
Printv(imcall, imclass_name, ".", mangled_overname, "(", NIL);
|
||||||
|
|
||||||
/* Attach the non-standard typemaps to the parameter list */
|
/* Attach the non-standard typemaps to the parameter list */
|
||||||
Swig_typemap_attach_parms("in", l, NULL);
|
Swig_typemap_attach_parms("in", l, NULL);
|
||||||
|
|
@ -2010,7 +2010,6 @@ class JAVA : public Language {
|
||||||
emit_mark_varargs(l);
|
emit_mark_varargs(l);
|
||||||
|
|
||||||
int gencomma = 0;
|
int gencomma = 0;
|
||||||
int ctor_arg_cnt = 0;
|
|
||||||
|
|
||||||
/* Output each parameter */
|
/* Output each parameter */
|
||||||
for (i = 0, p=l; p; i++) {
|
for (i = 0, p=l; p; i++) {
|
||||||
|
|
@ -2057,22 +2056,26 @@ class JAVA : public Language {
|
||||||
|
|
||||||
/* Add parameter to proxy function */
|
/* Add parameter to proxy function */
|
||||||
if(gencomma)
|
if(gencomma)
|
||||||
Printf(proxy_class_code, ", ");
|
Printf(function_code, ", ");
|
||||||
Printf(proxy_class_code, "%s %s", param_type, arg);
|
Printf(function_code, "%s %s", param_type, arg);
|
||||||
++gencomma;
|
++gencomma;
|
||||||
ctor_arg_cnt++;
|
|
||||||
|
|
||||||
Delete(arg);
|
Delete(arg);
|
||||||
Delete(param_type);
|
Delete(param_type);
|
||||||
p = Getattr(p,"tmap:in:next");
|
p = Getattr(p,"tmap:in:next");
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(imcall, "), true);\n");
|
Printf(imcall, ")");
|
||||||
|
|
||||||
Printf(proxy_class_code, ")");
|
Printf(function_code, ")");
|
||||||
generateThrowsClause(n, proxy_class_code);
|
generateThrowsClause(n, function_code);
|
||||||
Printf(proxy_class_code, " {\n");
|
if (feature_director) {
|
||||||
Printf(proxy_class_code, " %s", imcall);
|
Printv(function_code, " ", typemapLookup("javaconstruct_director", Getattr(n,"name"), WARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF), NIL);
|
||||||
|
} else {
|
||||||
|
Printv(function_code, " ", typemapLookup("javaconstruct", Getattr(n,"name"), WARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF), NIL);
|
||||||
|
}
|
||||||
|
Printf(function_code, "\n");
|
||||||
|
Replaceall(function_code, "$imcall", imcall);
|
||||||
|
|
||||||
/* Add director connection call if this class has directors. */
|
/* Add director connection call if this class has directors. */
|
||||||
|
|
||||||
|
|
@ -2081,7 +2084,7 @@ class JAVA : public Language {
|
||||||
String *norm_name = SwigType_namestr(Getattr(n, "name"));
|
String *norm_name = SwigType_namestr(Getattr(n, "name"));
|
||||||
|
|
||||||
String *swig_director_connect = NewStringf("%s_director_connect", proxy_class_name);
|
String *swig_director_connect = NewStringf("%s_director_connect", proxy_class_name);
|
||||||
Printv(proxy_class_code, " ", imclass_name, ".", swig_director_connect, "(this, swigCPtr);\n", NIL);
|
// Printv(function_code, " ", imclass_name, ".", swig_director_connect, "(this, swigCPtr);\n", NIL);
|
||||||
|
|
||||||
if (!emitted_connect) {
|
if (!emitted_connect) {
|
||||||
String *swig_director_connect_jni = makeValidJniName(swig_director_connect);
|
String *swig_director_connect_jni = makeValidJniName(swig_director_connect);
|
||||||
|
|
@ -2113,9 +2116,9 @@ class JAVA : public Language {
|
||||||
Delete(swig_director_connect);
|
Delete(swig_director_connect);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(proxy_class_code, " }\n\n");
|
Printv(proxy_class_code, function_code, "\n", NIL);
|
||||||
|
|
||||||
if(!ctor_arg_cnt) // We must have a default constructor
|
if(!gencomma) // We must have a default constructor
|
||||||
have_default_constructor_flag = true;
|
have_default_constructor_flag = true;
|
||||||
|
|
||||||
Delete(overloaded_name);
|
Delete(overloaded_name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue