"jni_type" : "jstring", "jni_name" : "n_%(n)s",\r
"jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); std::string n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)',\r
"suffix" : "Ljava_lang_String_2"},\r
+ "String" : { "j_type" : "java.lang.String", "jn_type" : "java.lang.String",\r
+ "jni_type" : "jstring", "jni_name" : "n_%(n)s",\r
+ "jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); String n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)',\r
+ "suffix" : "Ljava_lang_String_2"},\r
\r
}\r
\r
self.jn_code = StringIO()\r
self.cpp_code = StringIO()\r
self.ported_func_counter = 0\r
- self.func_counter = 0\r
+ self.ported_func_list = []\r
+ self.skipped_func_list = []\r
+ self.total_func_counter = 0\r
\r
def add_class(self, decl):\r
classinfo = ClassInfo(decl)\r
\r
self.save(output_path, module+".java", self.java_code)\r
self.save(output_path, module+".cpp", self.cpp_code)\r
+ # report\r
+ report = StringIO()\r
+ report.write("PORTED FUNCs LIST (%i of %i):\n\n" % \\r
+ (self.ported_func_counter, self.total_func_counter) \\r
+ )\r
+ report.write("\n".join(self.ported_func_list))\r
+ report.write("\n\nSKIPPED FUNCs LIST (%i of %i):\n\n" % \\r
+ (self.total_func_counter - self.ported_func_counter, self.total_func_counter) \\r
+ )\r
+ report.write("".join(self.skipped_func_list))\r
+ self.save(output_path, module+".txt", report)\r
\r
- print "Done %i of %i funcs." % (self.ported_func_counter, self.func_counter)\r
+ print "Done %i of %i funcs." % (self.ported_func_counter, self.total_func_counter)\r
\r
\r
def gen_consts(self):\r
\r
\r
def gen_func(self, fi, isoverload, jn_code):\r
- self.func_counter += 1\r
+ self.total_func_counter += 1\r
\r
# // C++: c_decl\r
# e.g:\r
type_info = type_dict.get(fi.ctype)\r
if not (type_info and type_info.get("jn_type")): # unsupported ret type\r
msg = "// Return type '%s' is not supported, skipping the function\n\n" % fi.ctype\r
+ self.skipped_func_list.append(c_decl + "\n" + msg)\r
self.java_code.write( indent + msg )\r
#self.cpp_code.write( msg )\r
print "SKIP:", c_decl, "\n\tdue to RET type", fi.ctype\r
for a in fi.args:\r
if a.ctype not in type_dict:\r
msg = "// Unknown type '%s', skipping the function\n\n" % a.ctype\r
+ self.skipped_func_list.append(c_decl + "\n" + msg)\r
self.java_code.write( indent + msg )\r
#self.cpp_code.write( msg )\r
print "SKIP:", c_decl, "\n\tdue to ARG type", a.ctype\r
return\r
if a.ctype != "Mat" and "jn_args" in type_dict[a.ctype] and a.out: # complex out args not yet supported\r
msg = "// Unsupported type '%s&', skipping the function\n\n" % a.ctype\r
+ self.skipped_func_list.append(c_decl + "\n" + msg)\r
self.java_code.write( indent + msg )\r
#self.cpp_code.write( msg )\r
print "SKIP:", c_decl, "\n\tdue to OUT ARG of type", a.ctype\r
return\r
\r
self.ported_func_counter += 1\r
+ self.ported_func_list.append(c_decl)\r
\r
# jn & cpp comment\r
jn_code.write( "\n%s// C++: %s\n" % (indent, c_decl) )\r