Commit 8164bef 1 parent ef6fe96 commit 8164bef Copy full SHA for 8164bef
File tree 3 files changed +30
-19
lines changed
3 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,18 @@ let gen_class_header ctx tcpp_class h_file scriptable parents =
87
87
else h_file#add_include klass.cl_path
88
88
| _ -> () );
89
89
90
- (* And any interfaces ... *)
90
+ (* And any native interfaces ... *)
91
91
List. iter
92
- (fun imp ->
93
- let interface = fst imp in
92
+ (fun interface ->
94
93
let include_files =
95
- get_all_meta_string_path interface.cl_meta Meta. Include
94
+ get_all_meta_string_path interface.if_class. cl_meta Meta. Include
96
95
in
97
96
if List. length include_files > 0 then
98
97
List. iter
99
98
(fun inc -> h_file#add_include (path_of_string inc))
100
99
include_files
101
- else h_file#add_include interface.cl_path)
102
- (real_interfaces tcpp_class.tcl_class.cl_implements) ;
100
+ else h_file#add_include interface.if_class. cl_path)
101
+ tcpp_class.tcl_native_interfaces ;
103
102
104
103
(* Only need to forward-declare classes that are mentioned in the header file
105
104
(ie, not the implementation) *)
@@ -325,7 +324,7 @@ let generate_managed_header base_ctx tcpp_class =
325
324
let alreadyGlued = Hashtbl. create 0 in
326
325
List. iter
327
326
(fun src ->
328
- let rec check_interface ( interface :tcpp_interface ) =
327
+ let rec check_interface interface =
329
328
let check_field func =
330
329
let cast = cpp_tfun_signature false func.iff_args func.iff_return in
331
330
let class_implementation = find_class_implementation func tcpp_class
Original file line number Diff line number Diff line change @@ -32,21 +32,10 @@ let gen_function ctx interface func =
32
32
let output = ctx.ctx_output in
33
33
let argList = print_tfun_arg_list true func.iff_args in
34
34
let returnType = type_to_string func.iff_return in
35
- let returnStr = if returnType = " void" then " " else " return " in
36
35
let commaArgList = if argList = " " then argList else " ," ^ argList in
37
- let cast = Printf. sprintf " ::hx::interface_cast< ::%s_obj *>" (join_class_path_remap interface.if_class.cl_path " ::" ) in
38
36
39
37
Printf. sprintf " \t\t %s (::hx::Object :: *_hx_%s)(%s);\n " returnType func.iff_name argList |> output;
40
- Printf. sprintf " \t\t static inline %s %s( ::Dynamic _hx_%s ){\n " returnType func.iff_name commaArgList |> output;
41
- output " \t\t\t #ifdef HXCPP_CHECK_POINTER\n " ;
42
- output " \t\t\t if (::hx::IsNull(_hx_)) ::hx::NullReference(\" Object\" , false);\n " ;
43
- output " \t\t\t #ifdef HXCPP_GC_CHECK_POINTER\n " ;
44
- output " \t\t\t\t GCCheckPointer(_hx_.mPtr);\n " ;
45
- output " \t\t\t #endif\n " ;
46
- output " \t\t\t #endif\n " ;
47
- Printf. sprintf
48
- " \t\t\t %s( _hx_.mPtr->*( %s(_hx_.mPtr->_hx_getInterface(%s)))->_hx_%s )(%s);\n\t\t }\n "
49
- returnStr cast interface.if_hash func.iff_name (print_arg_names func.iff_args) |> output
38
+ Printf. sprintf " \t\t static %s %s( ::Dynamic _hx_%s );\n " returnType func.iff_name commaArgList |> output
50
39
51
40
let gen_includes h_file interface_def =
52
41
let add_class_includes cls =
Original file line number Diff line number Diff line change @@ -104,6 +104,29 @@ let generate_managed_interface base_ctx tcpp_interface =
104
104
begin_namespace output_cpp class_path;
105
105
output_cpp " \n " ;
106
106
107
+ let gen_function func =
108
+ let argList = print_tfun_arg_list true func.iff_args in
109
+ let returnType = type_to_string func.iff_return in
110
+ let returnStr = if returnType = " void" then " " else " return " in
111
+ let commaArgList = if argList = " " then argList else " ," ^ argList in
112
+ let cast = Printf. sprintf " ::hx::interface_cast< %s *>" tcpp_interface.if_name in
113
+
114
+ Printf. sprintf " %s %s::%s( ::Dynamic _hx_%s ) {\n " returnType tcpp_interface.if_name func.iff_name commaArgList |> output_cpp;
115
+ output_cpp " #ifdef HXCPP_CHECK_POINTER\n " ;
116
+ output_cpp " \t if (::hx::IsNull(_hx_)) ::hx::NullReference(\" Object\" , false);\n " ;
117
+ output_cpp " #ifdef HXCPP_GC_CHECK_POINTER\n " ;
118
+ output_cpp " \t GCCheckPointer(_hx_.mPtr);\n " ;
119
+ output_cpp " #endif\n " ;
120
+ output_cpp " #endif\n " ;
121
+ Printf. sprintf
122
+ " \t %s( _hx_.mPtr->*( %s(_hx_.mPtr->_hx_getInterface(%s)))->_hx_%s )(%s);\n }\n "
123
+ returnStr cast tcpp_interface.if_hash func.iff_name (print_arg_names func.iff_args) |> output_cpp
124
+ in
125
+
126
+ all_interface_functions tcpp_interface |> List. iter gen_function;
127
+
128
+ output_cpp " \n " ;
129
+
107
130
output_cpp (get_class_code tcpp_interface.if_class Meta. CppNamespaceCode );
108
131
109
132
output_cpp " \n " ;
You can’t perform that action at this time.
0 commit comments