@@ -27,15 +27,15 @@ from templates import helper as th
27
27
28
28
<%def name = "member(iname , itype , loop ) ">
29
29
% if iname == " pNext" :
30
- ${ x } _print:: printStruct(os, ${ caller.body()} );
30
+ printStruct(os, ${ caller.body()} );
31
31
% elif th.type_traits.is_flags(itype):
32
- ${ x } _print:: printFlag<${ th.type_traits.get_flag_type(itype)} >(os, ${ caller.body()} );
32
+ printFlag<${ th.type_traits.get_flag_type(itype)} >(os, ${ caller.body()} );
33
33
% elif not loop and th.type_traits.is_pointer(itype):
34
- ${ x } _print:: printPtr(os, ${ caller.body()} );
34
+ printPtr(os, ${ caller.body()} );
35
35
% elif loop and th.type_traits.is_pointer_to_pointer(itype):
36
- ${ x } _print:: printPtr(os, ${ caller.body()} );
36
+ printPtr(os, ${ caller.body()} );
37
37
% elif th.type_traits.is_handle(itype):
38
- ${ x } _print:: printPtr(os, ${ caller.body()} );
38
+ printPtr(os, ${ caller.body()} );
39
39
% elif iname and iname.startswith(" pfn" ):
40
40
os << reinterpret_cast<void * >(${ caller.body()} );
41
41
% else :
@@ -83,7 +83,7 @@ def findMemberType(_item):
83
83
os << "}";
84
84
% elif findMemberType(item) is not None and findMemberType(item)[' type' ] == " union" :
85
85
os << ".${ iname} = ";
86
- ${ x } _print:: printUnion(os, ${ deref} (params${ access}${ item[' name' ]} ), params${ access}${ th.param_traits.tagged_member(item)} );
86
+ printUnion(os, ${ deref} (params${ access}${ item[' name' ]} ), params${ access}${ th.param_traits.tagged_member(item)} );
87
87
% elif th.type_traits.is_array(item[' type' ]):
88
88
os << ".${ iname} = {";
89
89
for(auto i = 0; i < ${ th.type_traits.get_array_length(item[' type' ])} ; i++){
@@ -97,7 +97,7 @@ def findMemberType(_item):
97
97
os << "}";
98
98
% elif typename is not None :
99
99
os << ".${ iname} = ";
100
- ${ x } _print:: printTagged(os, ${ deref} (params${ access}${ pname} ), ${ deref} (params${ access}${ prefix}${ typename} ), ${ deref} (params${ access}${ prefix}${ typename_size} ));
100
+ printTagged(os, ${ deref} (params${ access}${ pname} ), ${ deref} (params${ access}${ prefix}${ typename} ), ${ deref} (params${ access}${ prefix}${ typename_size} ));
101
101
% else :
102
102
os << ".${ iname} = ";
103
103
<%call expr = "member(iname, itype, False )">
@@ -147,7 +147,6 @@ template <typename T> inline void printTagged(std::ostream &os, const void *ptr,
147
147
%endif
148
148
%endfor # obj in spec['objects']
149
149
%endfor
150
- } // namespace ${ x} _print
151
150
152
151
% for spec in specs:
153
152
% for obj in spec[' objects' ]:
@@ -188,7 +187,6 @@ template <typename T> inline void printTagged(std::ostream &os, const void *ptr,
188
187
}
189
188
%endif
190
189
% if obj.get(' typed_etors' , False ) is True :
191
- namespace ${ x} _print {
192
190
template <>
193
191
inline void printTagged(std::ostream &os, const void *ptr, ${ th.make_enum_name(n, tags, obj)} value, size_t size) {
194
192
if (ptr == NULL) {
@@ -248,12 +246,11 @@ template <typename T> inline void printTagged(std::ostream &os, const void *ptr,
248
246
break;
249
247
}
250
248
}
251
- }
249
+
252
250
% elif " structure_type" in obj[' name' ]:
253
- namespace ${ x} _print {
254
251
inline void printStruct(std::ostream &os, const void *ptr) {
255
252
if (ptr == NULL) {
256
- ${ x } _print:: printPtr(os, ptr);
253
+ printPtr(os, ptr);
257
254
return;
258
255
}
259
256
@@ -266,18 +263,16 @@ template <typename T> inline void printTagged(std::ostream &os, const void *ptr,
266
263
%>
267
264
case ${ ename} : {
268
265
const ${ th.subt(n, tags, item[' desc' ])} *pstruct = (const ${ th.subt(n, tags, item[' desc' ])} *)ptr;
269
- ${ x } _print:: printPtr(os, pstruct);
266
+ printPtr(os, pstruct);
270
267
} break;
271
268
%endfor
272
269
default:
273
270
os << "unknown enumerator";
274
271
break;
275
272
}
276
273
}
277
- } // namespace ${ x} _print
278
274
%endif
279
275
% if th.type_traits.is_flags(obj[' name' ]):
280
- namespace ${ x} _print {
281
276
282
277
template<>
283
278
inline void printFlag<${ th.make_enum_name(n, tags, obj)} >(std::ostream &os, uint32_t flag) {
@@ -310,7 +305,6 @@ inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint
310
305
os << "0";
311
306
}
312
307
}
313
- } // namespace ${ x} _print
314
308
%endif
315
309
## STRUCT/UNION ###############################################################
316
310
% elif re.match(r " struct" , obj[' type' ]):
@@ -332,7 +326,7 @@ inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make
332
326
}
333
327
% elif re.match(r " union" , obj[' type' ]) and obj[' name' ]:
334
328
<% tag = findUnionTag(obj) %>
335
- inline void ${ x } _print:: printUnion(
329
+ inline void printUnion(
336
330
std::ostream &os,
337
331
const ${ obj[' type' ]} ${ th.make_type_name(n, tags, obj)} params,
338
332
const ${ tag[' type' ]} ${ th.make_type_name(n, tags, tag)} tag
@@ -381,8 +375,6 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
381
375
%endfor
382
376
%endfor
383
377
384
- namespace ${ x} _print {
385
-
386
378
template <typename T > inline void printPtr(std::ostream &os, const T *ptr) {
387
379
if (ptr == nullptr) {
388
380
os << "nullptr";
0 commit comments