Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7432fc1d
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7432fc1d
编写于
7月 07, 2011
作者:
A
Andrey Pavlenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 'String' (that is synonym of std::string) is added
- report generation added (<module>.txt)
上级
ed8a2af9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
3 deletion
+24
-3
modules/java/gen_java.py
modules/java/gen_java.py
+24
-3
未找到文件。
modules/java/gen_java.py
浏览文件 @
7432fc1d
...
...
@@ -56,6 +56,10 @@ type_dict = {
"jni_type"
:
"jstring"
,
"jni_name"
:
"n_%(n)s"
,
"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)'
,
"suffix"
:
"Ljava_lang_String_2"
},
"String"
:
{
"j_type"
:
"java.lang.String"
,
"jn_type"
:
"java.lang.String"
,
"jni_type"
:
"jstring"
,
"jni_name"
:
"n_%(n)s"
,
"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)'
,
"suffix"
:
"Ljava_lang_String_2"
},
}
...
...
@@ -153,7 +157,9 @@ class JavaWrapperGenerator(object):
self
.
jn_code
=
StringIO
()
self
.
cpp_code
=
StringIO
()
self
.
ported_func_counter
=
0
self
.
func_counter
=
0
self
.
ported_func_list
=
[]
self
.
skipped_func_list
=
[]
self
.
total_func_counter
=
0
def
add_class
(
self
,
decl
):
classinfo
=
ClassInfo
(
decl
)
...
...
@@ -309,8 +315,19 @@ class JavaWrapperGenerator(object):
self
.
save
(
output_path
,
module
+
".java"
,
self
.
java_code
)
self
.
save
(
output_path
,
module
+
".cpp"
,
self
.
cpp_code
)
# report
report
=
StringIO
()
report
.
write
(
"PORTED FUNCs LIST (%i of %i):
\n\n
"
%
\
(
self
.
ported_func_counter
,
self
.
total_func_counter
)
\
)
report
.
write
(
"
\n
"
.
join
(
self
.
ported_func_list
))
report
.
write
(
"
\n\n
SKIPPED FUNCs LIST (%i of %i):
\n\n
"
%
\
(
self
.
total_func_counter
-
self
.
ported_func_counter
,
self
.
total_func_counter
)
\
)
report
.
write
(
""
.
join
(
self
.
skipped_func_list
))
self
.
save
(
output_path
,
module
+
".txt"
,
report
)
print
"Done %i of %i funcs."
%
(
self
.
ported_func_counter
,
self
.
func_counter
)
print
"Done %i of %i funcs."
%
(
self
.
ported_func_counter
,
self
.
total_
func_counter
)
def
gen_consts
(
self
):
...
...
@@ -324,7 +341,7 @@ class JavaWrapperGenerator(object):
def
gen_func
(
self
,
fi
,
isoverload
,
jn_code
):
self
.
func_counter
+=
1
self
.
total_
func_counter
+=
1
# // C++: c_decl
# e.g:
...
...
@@ -341,6 +358,7 @@ class JavaWrapperGenerator(object):
type_info
=
type_dict
.
get
(
fi
.
ctype
)
if
not
(
type_info
and
type_info
.
get
(
"jn_type"
)):
# unsupported ret type
msg
=
"// Return type '%s' is not supported, skipping the function
\n\n
"
%
fi
.
ctype
self
.
skipped_func_list
.
append
(
c_decl
+
"
\n
"
+
msg
)
self
.
java_code
.
write
(
indent
+
msg
)
#self.cpp_code.write( msg )
print
"SKIP:"
,
c_decl
,
"
\n\t
due to RET type"
,
fi
.
ctype
...
...
@@ -348,18 +366,21 @@ class JavaWrapperGenerator(object):
for
a
in
fi
.
args
:
if
a
.
ctype
not
in
type_dict
:
msg
=
"// Unknown type '%s', skipping the function
\n\n
"
%
a
.
ctype
self
.
skipped_func_list
.
append
(
c_decl
+
"
\n
"
+
msg
)
self
.
java_code
.
write
(
indent
+
msg
)
#self.cpp_code.write( msg )
print
"SKIP:"
,
c_decl
,
"
\n\t
due to ARG type"
,
a
.
ctype
return
if
a
.
ctype
!=
"Mat"
and
"jn_args"
in
type_dict
[
a
.
ctype
]
and
a
.
out
:
# complex out args not yet supported
msg
=
"// Unsupported type '%s&', skipping the function
\n\n
"
%
a
.
ctype
self
.
skipped_func_list
.
append
(
c_decl
+
"
\n
"
+
msg
)
self
.
java_code
.
write
(
indent
+
msg
)
#self.cpp_code.write( msg )
print
"SKIP:"
,
c_decl
,
"
\n\t
due to OUT ARG of type"
,
a
.
ctype
return
self
.
ported_func_counter
+=
1
self
.
ported_func_list
.
append
(
c_decl
)
# jn & cpp comment
jn_code
.
write
(
"
\n
%s// C++: %s
\n
"
%
(
indent
,
c_decl
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录