cuoo/type.h: Operations and Dynamically Typed Objects
[cuoo: Dynamic Objects and Operations]

Data Structures

struct  cuoo_type

Types



cuoo_type_t cuooP_type_type
cuoo_type_t cuoo_type_type ()
cu_bool_t cuex_meta_is_type (cuex_meta_t meta)
cu_bool_t cuoo_is_type (cuex_t e)
cuoo_type_t cuoo_type_from_ex (cuex_t e)
cuex_t cuoo_type_as_expr (cuoo_type_t t)
cuoo_shape_t cuoo_type_shape (cuoo_type_t type)
cu_bool_t cuoo_type_is_hctype (cuoo_type_t type)
cu_bool_t cuoo_type_is_metatype (cuoo_type_t type)
cu_bool_t cuoo_type_is_inltype (cuoo_type_t type)
cu_bool_t cuoo_type_is_nonptr_inltype (cuoo_type_t type)
cu_bool_t cuoo_type_is_proto (cuoo_type_t type)
void cuoo_type_init_general (cuoo_type_t type, cuoo_shape_t shape, cuoo_impl_t impl, cuex_t atype)
void cuoo_type_init_general_hcs (cuoo_type_t type, cuoo_shape_t shape, cuoo_impl_t impl, cuex_t atype, size_t key_size)
void cuoo_type_init_general_hcv (cuoo_type_t type, cuoo_shape_t shape, cuoo_impl_t impl, cuex_t atype)
void cuoo_type_init_opaque (cuoo_type_t type, cuoo_impl_t impl)
void cuoo_type_init_opaque_hcs (cuoo_type_t type, cuoo_impl_t impl, size_t key_size)
void cuoo_type_init_opaque_hcv (cuoo_type_t type, cuoo_impl_t impl)
cuoo_type_t cuoo_type_new_opaque (cuoo_impl_t impl)
cuoo_type_t cuoo_type_new_opaque_hcs (cuoo_impl_t impl, size_t key_size)
cuoo_type_t cuoo_type_new_opaque_hcv (cuoo_impl_t impl)
cuoo_type_t cuoo_type_new_metatype (cuoo_impl_t impl)
cuoo_type_t cuoo_type_new_metatype_hce (cuoo_impl_t impl)
cuoo_type_t cuoo_type_new_metatype_hcs (cuoo_impl_t impl, size_t key_size)
cu_str_t cuoo_type_to_str_default (cuex_t type)
#define cuoo_type_impl(type,...)   ((type)->impl(__VA_ARGS__))
#define cuoo_type_impl_ptr(type,...)   cu_unbox_ptr(void *, (type)->impl(__VA_ARGS__))
#define cuoo_type_impl_fptr(T, type,...)   cu_unbox_fptr(T, (type)->impl(__VA_ARGS__))

Type Shapes

The shape of a type is the major classification to determine the representation of objects of that type.



char const * cuoo_shape_name (cuoo_shape_t shape)
size_t cuoo_shape_valsize (cuoo_shape_t shape)
cu_bool_t cuoo_shape_is_opaque (cuoo_shape_t shape)
cu_bool_t cuoo_shape_is_scalar (cuoo_shape_t shape)
cu_bool_t cuoo_shape_is_scalar_int (cuoo_shape_t shape)
cu_bool_t cuoo_shape_is_scalar_fp (cuoo_shape_t shape)
cu_bool_t cuoo_shape_is_singleton (cuoo_shape_t shape)
#define CUOO_SHAPEFLAG_HCV   UINT16_C(0x8000)
#define CUOO_SHAPEFLAG_FIN   UINT16_C(0x4000)
#define CUOO_SHAPEFLAG_MASK   UINT16_C(0xc000)
#define CUOO_SHAPE_NONE   0x00
#define CUOO_SHAPE_OPAQUE   0x01
#define CUOO_SHAPE_OPAQUE_HCV   (CUOO_SHAPE_OPAQUE|CUOO_SHAPEFLAG_HCV)
#define CUOO_SHAPE_METATYPE   0x02
#define CUOO_SHAPE_TVAR   0x03
#define CUOO_SHAPE_PROTO   0x04
#define CUOO_SHAPE_CTORTYPE   0x05
#define CUOO_SHAPE_BY_EXPR   0x06
#define CUOO_SHAPE_PTRTYPE   0x08
#define CUOO_SHAPE_ARRTYPE   0x09
#define CUOO_SHAPE_TUPTYPE   0x0a
#define CUOO_SHAPE_UNIT   0x0f
#define CUOO_SHAPE_SCALAR_BOOL   0x10
#define CUOO_SHAPE_SCALAR_CHAR   0x11
#define CUOO_SHAPE_SCALAR_METAINT   0x12
#define CUOO_SHAPE_SCALAR_UINT8   0x16
#define CUOO_SHAPE_SCALAR_INT8   0x17
#define CUOO_SHAPE_SCALAR_UINT16   0x18
#define CUOO_SHAPE_SCALAR_INT16   0x19
#define CUOO_SHAPE_SCALAR_UINT32   0x1a
#define CUOO_SHAPE_SCALAR_INT32   0x1b
#define CUOO_SHAPE_SCALAR_UINT64   0x1c
#define CUOO_SHAPE_SCALAR_INT64   0x1d
#define CUOO_SHAPE_SCALAR_FLOAT   0x1e
#define CUOO_SHAPE_SCALAR_DOUBLE   0x1f
#define CUOO_SHAPE_MIN_SCALAR_INT   CUOO_SHAPE_SCALAR_UINT8
#define CUOO_SHAPE_MAX_SCALAR_INT   CUOO_SHAPE_SCALAR_INT64
#define CUOO_SHAPE_MIN_SCALAR_FP   CUOO_SHAPE_SCALAR_FLOAT
#define CUOO_SHAPE_MAX_SCALAR_FP   CUOO_SHAPE_SCALAR_DOUBLE
#define CUOO_SHAPE_MIN_SCALAR   CUOO_SHAPE_SCALAR_BOOL
#define CUOO_SHAPE_MAX_SCALAR   CUOO_SHAPE_MAX_SCALAR_FP
#define CUOO_SHAPE_CULIBS_END   0x100

Type-Related Functions on Objects



void * cuoo_impl_ptr (cuex_t obj, cu_word_t intf)
cu_hash_t cuex_key_hash (void *obj)

Define Documentation

#define CUOO_SHAPEFLAG_FIN   UINT16_C(0x4000)

Or-ed into shapes of types which may define finalisers.

#define CUOO_SHAPEFLAG_HCV   UINT16_C(0x8000)

To be or-ed into shapes for types which use a custom hash function in place of a fixed size.

#define CUOO_SHAPEFLAG_MASK   UINT16_C(0xc000)

Mask of all the above flags.


Function Documentation

cu_bool_t cuex_meta_is_type ( cuex_meta_t  meta  ) 

If true then meta is a type and can be converted with cuoo_type_from_meta.

cu_bool_t cuoo_is_type ( cuex_t  e  ) 

True iff e is a type.

cu_bool_t cuoo_shape_is_opaque ( cuoo_shape_t  shape  ) 

True if shape indicates an opaque struct.

cu_bool_t cuoo_shape_is_scalar ( cuoo_shape_t  shape  ) 

True if shape indicates a scalar type.

cu_bool_t cuoo_shape_is_scalar_fp ( cuoo_shape_t  shape  ) 

True if shape indicates a floating point type.

cu_bool_t cuoo_shape_is_scalar_int ( cuoo_shape_t  shape  ) 

True if shape indicates an integer type, excluding bool and char.

cu_bool_t cuoo_shape_is_singleton ( cuoo_shape_t  shape  ) 

True iff there is exactly one type for this shape.

char const* cuoo_shape_name ( cuoo_shape_t  shape  ) 

A textual name for shape, or NULL if unimplemented. Mainly useful for the scalar types where the returned string corresponds with the C type name, other cases may be unimplemented.

size_t cuoo_shape_valsize ( cuoo_shape_t  shape  ) 

The size of values of types with shape shape, or (size_t)-1 if unknown. This is defined for scalar shapes.

cuex_t cuoo_type_as_expr ( cuoo_type_t  t  ) 

The analytic type of t. For elementary and opaque types, the type itself.

cuoo_type_t cuoo_type_from_ex ( cuex_t  e  ) 

Cast e to a cuoo_type_t, assuming cuoo_is_type(e) is true.

void cuoo_type_init_general ( cuoo_type_t  type,
cuoo_shape_t  shape,
cuoo_impl_t  impl,
cuex_t  atype 
)

Initialise type to be used for non-hash-consed objects. shape is a tag indicating the encoding of objects of this type. atype is an optional analytic type of the stored objects.

void cuoo_type_init_general_hcs ( cuoo_type_t  type,
cuoo_shape_t  shape,
cuoo_impl_t  impl,
cuex_t  atype,
size_t  key_size 
)

Initialise type to be used for hash-consed objects of size key_size, excluding the CU_HCOBJ header.

void cuoo_type_init_general_hcv ( cuoo_type_t  type,
cuoo_shape_t  shape,
cuoo_impl_t  impl,
cuex_t  atype 
)

Initialise type to be used for hash-consed objects with hash function key_hash_fn.

void cuoo_type_init_opaque ( cuoo_type_t  type,
cuoo_impl_t  impl 
)

Construct type as an opaque type for non-hash-consed objects.

void cuoo_type_init_opaque_hcs ( cuoo_type_t  type,
cuoo_impl_t  impl,
size_t  key_size 
)

Construct type as an opaque type for hash-consed objects of key size key_size.

void cuoo_type_init_opaque_hcv ( cuoo_type_t  type,
cuoo_impl_t  impl 
)

Construct type as an opaque type for hash-consed object with hash function key_hash_fn.

cuoo_type_t cuoo_type_new_metatype ( cuoo_impl_t  impl  ) 

A new type of non-hash-consed types.

cuoo_type_t cuoo_type_new_metatype_hce ( cuoo_impl_t  impl  ) 

A new type of types which are hash-consed based on the analytic expression of the type.

cuoo_type_t cuoo_type_new_metatype_hcs ( cuoo_impl_t  impl,
size_t  key_size 
)

A new type of types which are hash-consed with key size key_size.

cuoo_type_t cuoo_type_new_opaque ( cuoo_impl_t  impl  ) 

Creates a type for non-hash-consed objects.

cuoo_type_t cuoo_type_new_opaque_hcs ( cuoo_impl_t  impl,
size_t  key_size 
)

Creates a type for hash-consed objects of size key_size, excluding the CU_HCOBJ header.

cuoo_type_t cuoo_type_new_opaque_hcv ( cuoo_impl_t  impl  ) 

Creates a type for hash-consed objects of with hash function key_hash_fn.

cuoo_shape_t cuoo_type_shape ( cuoo_type_t  type  ) 

Returns the shape of type.

cu_str_t cuoo_type_to_str_default ( cuex_t  type  ) 

A default implementation of CUOO_INTF_TO_STR_FN for types.

cuoo_type_t cuoo_type_type (  ) 

The type of types.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.