/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "libtnf.h"
/*
* Operations based on ABI bootstrap assumptions
*/
_GET_REF32(tnf, p)
_GET_REF16(tnf, p)
/*
* Static declarations
*/
/*
* retrieve tag slot from a record
*/
{
}
/*
* Retrieve tag_arg from tag slot of a record
*/
{
}
/*
* Retrieve the self_size slot of an ABI array record
*/
{
}
/*
* Calculate the number of elements in ABI array record
*/
unsigned
{
#ifdef INFINITE_RECURSION_ARRAY
#else
hdrsize = sizeof (struct tnf_array_hdr);
#endif
}
/*
* Retrieve the base pointer of an ABI array record
*/
/* ARGSUSED */
{
#ifdef INFINITE_RECURSION_ARRAY
#else
#endif
}
/*
* Retrieve the chars in an ABI string record
*/
char *
{
}
/*
* Retrieve the string in the name slot of a type record
*/
char *
{
}
/*
* Retrieve the properties array slot of a type record
*/
{
}
/*
* Retrieve the slot_types slot of struct_type or array_type record
*/
{
}
/*
* Retrieve the header_size slot of an array_type record
*/
{
}
/*
* Retrieve the derived_base slot of a derived_type record
*/
{
}
/*
* Find the root (self-tagged) type record
*/
{
else {
return (p2);
}
}
/*
* Search ABI type array for a type named name
*/
{
unsigned count, i;
/* LINTED pointer cast may result in improper alignment */
for (i = 0; i < count; i++) {
/* Can't have missing type records */
return (TNF_NULL);
}
/* Found a type record named name */
return (type_elt);
}
return (TNF_NULL);
}
/*
* Look in type record's properties for named type.
* Recursively look at derived_base properties as well.
*/
{
/* name is type name */
return (tag);
/* no properties */
return (TNF_NULL);
!= TNF_NULL)
/* found property named name */
return (property);
/*
* Recursively check base type of derived types
*/
!= TNF_NULL) {
/* tag is a derived type: check its derived_base */
/* tnf_derived has derived_base == TNF_NULL */
}
return (TNF_NULL);
}
/*
* Get the ultimate base type of a type record
*/
{
/* no properties */
return (tag);
!= TNF_NULL) {
}
return (tag);
}
/*
* Calculate the reference size of an object with type==tag
*/
{
/* Tagged objects occupy 4 bytes for reference */
return ((sizeof (tnf_ref32_t)));
/* Inline slots cannot be self sized */
} else {
/* Illegal to have references to abstract objects */
return ((0));
}
}
/*
* Calculate storage size of an object with type==tag
*/
{
else {
#ifndef INFINITE_RECURSION_SIZE
char *base_name;
static struct n2s {
char *name;
} n2s[] = {
{ TNF_N_CHAR, sizeof (tnf_char_t) },
{ TNF_N_INT8, sizeof (tnf_int8_t) },
{ TNF_N_INT16, sizeof (tnf_int16_t) },
{ TNF_N_INT32, sizeof (tnf_int32_t) },
{ TNF_N_UINT8, sizeof (tnf_uint8_t) },
{ TNF_N_UINT16, sizeof (tnf_uint16_t) },
{ TNF_N_UINT32, sizeof (tnf_uint32_t) },
{ TNF_N_INT64, sizeof (tnf_int64_t) },
{ TNF_N_UINT64, sizeof (tnf_uint64_t) },
{ TNF_N_FLOAT32, sizeof (tnf_float32_t) },
{ TNF_N_FLOAT64, sizeof (tnf_float64_t) },
{ NULL, 0 }
};
struct n2s *p;
#endif
#ifndef INFINITE_RECURSION_SIZE
/* XXX Why are we in this mess? */
p = n2s;
while (p->name) {
return (p->size);
p++;
}
#endif
if (sizep)
/* Type sized */
/* LINTED pointer cast may result in improper alignment */
slot_types = (tnf_ref32_t *)
/* LINTED pointer cast may result in improper alignment */
if (slot_types &&
/* Self sized */
return ((size_t)-1);
else
/* Abstract */
return (0);
}
}
/*
* Return the alignment restriction for any tag
*/
unsigned
{
if (alignp)
/* LINTED pointer cast may result in improper alignment */
}
/* default: word alignment */
return ((4));
}
/*
* Only works for records
* Doesn't check for slot_names in tag
* Tag records, for example, never have named slots
*/
{
unsigned count, i;
unsigned offset;
/*
* The position of slot_types is ABI fixed
* XXX Assume it is present in tag
*/
/* LINTED pointer cast may result in improper alignment */
offset = 0;
for (i = 0; i < count; i++) {
/* Find the type record for slot */
/* Can't have missing type records */
}
/* See similar hack in init_slots() */
/* Calculate reference size */
/*
* Calculate alignment
* XXX Prevent infinite recursion by assuming that
* a reference size of 4 implies word alignment
*/
/* Adjust offset to account for alignment, if needed */
/* Check whether name corresponds to type name */
/* Found the slot */
type_elt));
/* Bump offset by reference size */
}
}
/*
* Only works for records
*/
{
unsigned count, i;
unsigned offset;
/*
* slot_names are optional
*/
slot_names = (tnf_ref32_t *)
/* LINTED pointer cast may result in improper alignment */
/* no slot_names; use _tnf_get_slot_typed() */
if (slot_names == TNF_NULL)
/*
* The position of slot_types is ABI fixed
* XXX Assume it is present in tag
*/
/* LINTED pointer cast may result in improper alignment */
/* LINTED pointer cast may result in improper alignment */
offset = 0;
for (i = 0; i < count; i++) {
/* Find the type record for slot */
/* Can't have missing type records */
}
/* XXX Keep consistent with init_slots() */
/* Calculate reference size */
/*
* Calculate alignment
* XXX Prevent infinite recursion by assuming that
* a reference size of 4 implies word alignment
*/
/* Adjust offset to account for alignment, if needed */
/* First check slot name, then type name */
/* Found slot */
type_elt));
/* Bump offset by reference size */
}
}
static caddr_t
{
return (p);
else /* XXX assume tagged */
/* LINTED pointer cast may result in improper alignment */
}