Lines Matching refs:tnf

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