Lines Matching refs:tnf
34 #define _GET_TAG(tnf, p) \ argument
35 _GET_REF32(tnf, p)
37 #define _GET_TAG_ARG(tnf, p) \ argument
38 _GET_REF16(tnf, p)
40 #define _GET_SELF_SIZE(tnf, p) \ argument
41 _GET_UINT32(tnf, &((struct tnf_array_hdr *)(p))->self_size)
43 #define _GET_NAME(tnf, p) \ argument
44 _GET_REF32(tnf, &((struct tnf_type_hdr *)(p))->name)
46 #define _GET_PROPERTIES(tnf, p) \ argument
47 _GET_REF32(tnf, &((struct tnf_type_hdr *)(p))->properties)
49 #define _GET_SLOT_TYPES(tnf, p) \ argument
50 _GET_REF32(tnf, &((struct tnf_struct_type_hdr *)(p))->slot_types)
52 #define _GET_TYPE_SIZE(tnf, p) \ argument
53 _GET_UINT32(tnf, &((struct tnf_struct_type_hdr *)(p))->type_size)
55 #define _GET_HEADER_SIZE(tnf, p) \ argument
56 _GET_UINT32(tnf, &((struct tnf_array_type_hdr *)(p))->header_size)
58 #define _GET_DERIVED_BASE(tnf, p) \ argument
59 _GET_REF32(tnf, &((struct tnf_derived_type_hdr *)(p))->derived_base)
72 _tnf_get_tag(TNF *tnf, tnf_ref32_t *record) in _tnf_get_tag() argument
74 return (_GET_TAG(tnf, record)); in _tnf_get_tag()
82 _tnf_get_tag_arg(TNF *tnf, tnf_ref32_t *record) in _tnf_get_tag_arg() argument
84 return (_GET_TAG_ARG(tnf, record)); in _tnf_get_tag_arg()
92 _tnf_get_self_size(TNF *tnf, tnf_ref32_t *array) in _tnf_get_self_size() argument
94 return (_GET_SELF_SIZE(tnf, array)); in _tnf_get_self_size()
102 _tnf_get_element_count(TNF *tnf, tnf_ref32_t *array, unsigned eltsize) in _tnf_get_element_count() argument
108 size = _tnf_get_self_size(tnf, array); in _tnf_get_element_count()
109 base_tag = _tnf_get_base_tag(tnf, _tnf_get_tag(tnf, array)); in _tnf_get_element_count()
110 hdrsize = _tnf_get_header_size(tnf, base_tag); in _tnf_get_element_count()
113 size = _tnf_get_self_size(tnf, array); in _tnf_get_element_count()
125 _tnf_get_elements(TNF *tnf, tnf_ref32_t *array) in _tnf_get_elements() argument
131 base_tag = _tnf_get_base_tag(tnf, _tnf_get_tag(tnf, array)); in _tnf_get_elements()
132 hdrsize = _tnf_get_header_size(tnf, base_tag); in _tnf_get_elements()
144 _tnf_get_chars(TNF *tnf, tnf_ref32_t *string) in _tnf_get_chars() argument
146 return ((char *)_tnf_get_elements(tnf, string)); in _tnf_get_chars()
154 _tnf_get_name(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_name() argument
156 return (_tnf_get_chars(tnf, _GET_NAME(tnf, tag))); in _tnf_get_name()
164 _tnf_get_properties(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_properties() argument
166 return (_GET_PROPERTIES(tnf, tag)); in _tnf_get_properties()
174 _tnf_get_slot_types(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_slot_types() argument
176 return (_GET_SLOT_TYPES(tnf, tag)); in _tnf_get_slot_types()
184 _tnf_get_header_size(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_header_size() argument
186 return (_GET_HEADER_SIZE(tnf, tag)); in _tnf_get_header_size()
194 _tnf_get_derived_base(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_derived_base() argument
196 return (_GET_DERIVED_BASE(tnf, tag)); in _tnf_get_derived_base()
205 _tnf_get_root_tag(TNF *tnf, tnf_ref32_t *record) in _tnf_get_root_tag() argument
207 if (tnf->root_tag) in _tnf_get_root_tag()
208 return (tnf->root_tag); in _tnf_get_root_tag()
212 while ((p2 = _tnf_get_tag(tnf, p1)) != p1) in _tnf_get_root_tag()
214 tnf->root_tag = p2; in _tnf_get_root_tag()
224 _tnf_get_element_named(TNF *tnf, tnf_ref32_t *array, char *name) in _tnf_get_element_named() argument
229 count = _tnf_get_element_count(tnf, array, sizeof (tnf_ref32_t)); in _tnf_get_element_named()
231 elts = (tnf_ref32_t *)_tnf_get_elements(tnf, array); in _tnf_get_element_named()
236 if ((type_elt = _GET_REF32(tnf, &elts[i])) == TNF_NULL) { in _tnf_get_element_named()
238 _tnf_error(tnf, TNF_ERR_BADTNF); in _tnf_get_element_named()
242 if (strcmp(name, _tnf_get_name(tnf, type_elt)) == 0) in _tnf_get_element_named()
255 _tnf_get_property(TNF *tnf, tnf_ref32_t *tag, char *name) in _tnf_get_property() argument
259 if (strcmp(name, _tnf_get_name(tnf, tag)) == 0) in _tnf_get_property()
263 if ((properties = _tnf_get_properties(tnf, tag)) == TNF_NULL) in _tnf_get_property()
267 if ((property = _tnf_get_element_named(tnf, properties, name)) in _tnf_get_property()
275 if (_tnf_get_element_named(tnf, properties, TNF_N_DERIVED) in _tnf_get_property()
280 base_tag = _tnf_get_derived_base(tnf, tag); in _tnf_get_property()
283 return (_tnf_get_property(tnf, base_tag, name)); in _tnf_get_property()
294 _tnf_get_base_tag(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_base_tag() argument
298 if ((properties = _tnf_get_properties(tnf, tag)) == TNF_NULL) in _tnf_get_base_tag()
302 if (_tnf_get_element_named(tnf, properties, TNF_N_DERIVED) in _tnf_get_base_tag()
306 if ((base_tag = _tnf_get_derived_base(tnf, tag)) != TNF_NULL) in _tnf_get_base_tag()
307 return (_tnf_get_base_tag(tnf, base_tag)); in _tnf_get_base_tag()
318 _tnf_get_ref_size(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_ref_size() argument
320 if (HAS_PROPERTY(tnf, tag, TNF_N_TAGGED)) { in _tnf_get_ref_size()
323 } else if (HAS_PROPERTY(tnf, tag, TNF_N_INLINE)) { in _tnf_get_ref_size()
325 return (_tnf_get_storage_size(tnf, tag)); in _tnf_get_ref_size()
328 _tnf_error(tnf, TNF_ERR_BADTNF); in _tnf_get_ref_size()
338 _tnf_get_storage_size(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_storage_size() argument
340 if (_tnf_get_tag(tnf, tag) == _tnf_get_root_tag(tnf, tag)) in _tnf_get_storage_size()
341 return (_GET_TYPE_SIZE(tnf, tag)); in _tnf_get_storage_size()
369 base_tag = _tnf_get_base_tag(tnf, tag); in _tnf_get_storage_size()
372 base_name = _tnf_get_name(tnf, base_tag); in _tnf_get_storage_size()
383 sizep = _tnf_get_slot_typed(tnf, base_tag, TNF_N_TYPE_SIZE); in _tnf_get_storage_size()
387 return (_GET_UINT32(tnf, (tnf_uint32_t *)sizep)); in _tnf_get_storage_size()
391 _tnf_get_slot_typed(tnf, base_tag, TNF_N_SLOT_TYPES); in _tnf_get_storage_size()
393 _tnf_get_element_named(tnf, slot_types, TNF_N_SELF_SIZE)) in _tnf_get_storage_size()
407 _tnf_get_align(TNF *tnf, tnf_ref32_t *tag) in _tnf_get_align() argument
409 if (HAS_PROPERTY(tnf, tag, TNF_N_SCALAR)) { in _tnf_get_align()
413 base_tag = _tnf_get_base_tag(tnf, tag); in _tnf_get_align()
414 alignp = _tnf_get_slot_typed(tnf, base_tag, TNF_N_ALIGN); in _tnf_get_align()
417 return (_GET_UINT32(tnf, (tnf_uint32_t *)alignp)); in _tnf_get_align()
430 _tnf_get_slot_typed(TNF *tnf, tnf_ref32_t *record, char *name) in _tnf_get_slot_typed() argument
437 tag = _tnf_get_tag(tnf, record); in _tnf_get_slot_typed()
438 base_tag = _tnf_get_base_tag(tnf, tag); in _tnf_get_slot_typed()
444 slot_types = _tnf_get_slot_types(tnf, base_tag); in _tnf_get_slot_typed()
445 count = _tnf_get_element_count(tnf, slot_types, sizeof (tnf_ref32_t)); in _tnf_get_slot_typed()
447 types = (tnf_ref32_t *)_tnf_get_elements(tnf, slot_types); in _tnf_get_slot_typed()
456 if ((type_elt = _GET_REF32(tnf, &types[i])) == TNF_NULL) { in _tnf_get_slot_typed()
458 _tnf_error(tnf, TNF_ERR_BADTNF); in _tnf_get_slot_typed()
465 ref_size = _tnf_get_ref_size(tnf, type_elt); in _tnf_get_slot_typed()
472 align = (ref_size == 4)? 4: _tnf_get_align(tnf, type_elt); in _tnf_get_slot_typed()
478 if (strcmp(name, _tnf_get_name(tnf, type_elt)) == 0) in _tnf_get_slot_typed()
480 return (fetch_slot(tnf, (caddr_t)record + offset, in _tnf_get_slot_typed()
495 _tnf_get_slot_named(TNF *tnf, tnf_ref32_t *record, char *name) in _tnf_get_slot_named() argument
502 tag = _tnf_get_tag(tnf, record); in _tnf_get_slot_named()
503 base_tag = _tnf_get_base_tag(tnf, tag); in _tnf_get_slot_named()
510 _tnf_get_slot_typed(tnf, base_tag, TNF_N_SLOT_NAMES); in _tnf_get_slot_named()
514 return (_tnf_get_slot_typed(tnf, record, name)); in _tnf_get_slot_named()
520 slot_types = _tnf_get_slot_types(tnf, base_tag); in _tnf_get_slot_named()
521 count = _tnf_get_element_count(tnf, slot_types, sizeof (tnf_ref32_t)); in _tnf_get_slot_named()
523 types = (tnf_ref32_t *)_tnf_get_elements(tnf, slot_types); in _tnf_get_slot_named()
525 names = (tnf_ref32_t *)_tnf_get_elements(tnf, slot_names); in _tnf_get_slot_named()
534 if ((type_elt = _GET_REF32(tnf, &types[i])) == TNF_NULL) { in _tnf_get_slot_named()
536 _tnf_error(tnf, TNF_ERR_BADTNF); in _tnf_get_slot_named()
543 ref_size = _tnf_get_ref_size(tnf, type_elt); in _tnf_get_slot_named()
550 align = (ref_size == 4)? 4: _tnf_get_align(tnf, type_elt); in _tnf_get_slot_named()
556 if ((((name_elt = _GET_REF32(tnf, &names[i])) != TNF_NULL) && in _tnf_get_slot_named()
557 (strcmp(name, _tnf_get_chars(tnf, name_elt)) == 0)) || in _tnf_get_slot_named()
558 (strcmp(name, _tnf_get_name(tnf, type_elt)) == 0)) in _tnf_get_slot_named()
560 return (fetch_slot(tnf, (caddr_t)record + offset, in _tnf_get_slot_named()
571 fetch_slot(TNF *tnf, caddr_t p, tnf_ref32_t *tag) in fetch_slot() argument
573 if (HAS_PROPERTY(tnf, tag, TNF_N_INLINE)) in fetch_slot()
577 return ((caddr_t)_GET_REF32(tnf, (tnf_ref32_t *)p)); in fetch_slot()