mirror of
https://github.com/opencv/opencv.git
synced 2025-06-13 04:52:53 +08:00
Objective-C wrapper header fix-ups to avoid clashes with system macros
This commit is contained in:
parent
92312fbc0c
commit
9ce0e51305
@ -78,6 +78,26 @@
|
|||||||
"(void)divide:(double)scale src2:(Mat*)src2 dst:(Mat*)dst dtype:(int)dtype" : { "src2" : {"name" : "src"} }
|
"(void)divide:(double)scale src2:(Mat*)src2 dst:(Mat*)dst dtype:(int)dtype" : { "src2" : {"name" : "src"} }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"header_fix" : {
|
||||||
|
"Core": {
|
||||||
|
"pow" : {
|
||||||
|
"prolog" : "#pragma push_macro(\"pow\")\n#undef pow",
|
||||||
|
"epilog" : "#pragma pop_macro(\"pow\")"
|
||||||
|
},
|
||||||
|
"sqrt" : {
|
||||||
|
"prolog" : "#pragma push_macro(\"sqrt\")\n#undef sqrt",
|
||||||
|
"epilog" : "#pragma pop_macro(\"sqrt\")"
|
||||||
|
},
|
||||||
|
"exp" : {
|
||||||
|
"prolog" : "#pragma push_macro(\"exp\")\n#undef exp",
|
||||||
|
"epilog" : "#pragma pop_macro(\"exp\")"
|
||||||
|
},
|
||||||
|
"log" : {
|
||||||
|
"prolog" : "#pragma push_macro(\"log\")\n#undef log",
|
||||||
|
"epilog" : "#pragma pop_macro(\"log\")"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"type_dict" : {
|
"type_dict" : {
|
||||||
"Algorithm": {
|
"Algorithm": {
|
||||||
"objc_type": "Algorithm*"
|
"objc_type": "Algorithm*"
|
||||||
|
@ -82,6 +82,9 @@ ManualFuncs = {}
|
|||||||
# { class : { func : { arg_name : {"ctype" : ctype, "attrib" : [attrib]} } } }
|
# { class : { func : { arg_name : {"ctype" : ctype, "attrib" : [attrib]} } } }
|
||||||
func_arg_fix = {}
|
func_arg_fix = {}
|
||||||
|
|
||||||
|
# { class : { func : { prolog : "", epilog : "" } } }
|
||||||
|
header_fix = {}
|
||||||
|
|
||||||
# { class : { enum: fixed_enum } }
|
# { class : { enum: fixed_enum } }
|
||||||
enum_fix = {}
|
enum_fix = {}
|
||||||
|
|
||||||
@ -479,6 +482,9 @@ class FuncInfo(GeneralInfo):
|
|||||||
self.ctype = re.sub(r"^CvTermCriteria", "TermCriteria", decl[1] or "")
|
self.ctype = re.sub(r"^CvTermCriteria", "TermCriteria", decl[1] or "")
|
||||||
self.args = []
|
self.args = []
|
||||||
func_fix_map = func_arg_fix.get(self.classname or module, {}).get(self.objc_name, {})
|
func_fix_map = func_arg_fix.get(self.classname or module, {}).get(self.objc_name, {})
|
||||||
|
header_fixes = header_fix.get(self.classname or module, {}).get(self.objc_name, {})
|
||||||
|
self.prolog = header_fixes.get('prolog', None)
|
||||||
|
self.epilog = header_fixes.get('epilog', None)
|
||||||
for a in decl[3]:
|
for a in decl[3]:
|
||||||
arg = a[:]
|
arg = a[:]
|
||||||
arg_fix_map = func_fix_map.get(arg[1], {})
|
arg_fix_map = func_fix_map.get(arg[1], {})
|
||||||
@ -1170,6 +1176,9 @@ class ObjectiveCWrapperGenerator(object):
|
|||||||
objc_name = fi.objc_name if not constructor else ("init" + ("With" + (args[0].name[0].upper() + args[0].name[1:]) if len(args) > 0 else ""))
|
objc_name = fi.objc_name if not constructor else ("init" + ("With" + (args[0].name[0].upper() + args[0].name[1:]) if len(args) > 0 else ""))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if fi.prolog is not None:
|
||||||
|
method_declarations.write("\n%s\n\n" % fi.prolog)
|
||||||
|
|
||||||
method_declarations.write( Template(
|
method_declarations.write( Template(
|
||||||
"""$prototype$swift_name$deprecation_decl;
|
"""$prototype$swift_name$deprecation_decl;
|
||||||
|
|
||||||
@ -1181,6 +1190,9 @@ class ObjectiveCWrapperGenerator(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if fi.epilog is not None:
|
||||||
|
method_declarations.write("%s\n\n" % fi.epilog)
|
||||||
|
|
||||||
method_implementations.write( Template(
|
method_implementations.write( Template(
|
||||||
"""$prototype {$prologue
|
"""$prototype {$prologue
|
||||||
$ret_val$obj_deref$cv_name($cv_args)$tail;$epilogue$ret
|
$ret_val$obj_deref$cv_name($cv_args)$tail;$epilogue$ret
|
||||||
@ -1646,6 +1658,7 @@ if __name__ == "__main__":
|
|||||||
AdditionalImports[module] = gen_type_dict.get("AdditionalImports", {})
|
AdditionalImports[module] = gen_type_dict.get("AdditionalImports", {})
|
||||||
ManualFuncs.update(gen_type_dict.get("ManualFuncs", {}))
|
ManualFuncs.update(gen_type_dict.get("ManualFuncs", {}))
|
||||||
func_arg_fix.update(gen_type_dict.get("func_arg_fix", {}))
|
func_arg_fix.update(gen_type_dict.get("func_arg_fix", {}))
|
||||||
|
header_fix.update(gen_type_dict.get("header_fix", {}))
|
||||||
enum_fix.update(gen_type_dict.get("enum_fix", {}))
|
enum_fix.update(gen_type_dict.get("enum_fix", {}))
|
||||||
const_fix.update(gen_type_dict.get("const_fix", {}))
|
const_fix.update(gen_type_dict.get("const_fix", {}))
|
||||||
namespaces_dict.update(gen_type_dict.get("namespaces_dict", {}))
|
namespaces_dict.update(gen_type_dict.get("namespaces_dict", {}))
|
||||||
|
Loading…
Reference in New Issue
Block a user