## type-util.api
# Compiled by:
#
src/lib/c-kit/src/ast/ast.sublibstipulate
Type_Util(X) = tables::Tidtab -> raw_syntax::Ctype -> X;
Type_Mem_Util(X) = tables::Tidtab -> (raw_syntax::Ctype, raw_syntax::Member) -> X;
Type_Type_Util(X) = tables::Tidtab -> (raw_syntax::Ctype, raw_syntax::Ctype) -> X;
herein
api Type_Util {
exception TYPE_ERROR raw_syntax::Ctype;
has_known_storage_size: Type_Util( Bool );
# Check if type has known storage size
/*
my fixArrayType: raw_syntax::tidtab -> { n: one_word_int::Int, type: raw_syntax::ctype } -> { err: Bool, type: raw_syntax::ctype }
# fix up rw_vector type using initializer info e::g. int x[] = { 1, 2, 3 };
*/
get_core_type: Type_Util( raw_syntax::Ctype );
is_pointer: Type_Util( Bool );
# Check if a type can be considered to be a pointer type
is_const: Type_Util( Bool );
# Check if a type contains the const qualifier
is_number_or_pointer: Type_Util( Bool );
# Check if a type can be considered to be a number or pointer type
is_number: Type_Util( Bool );
# Check if a type can be considered to be a number type
is_array: Type_Util( Bool );
# Check if a type can be considered to be an rw_vector
is_integral: Type_Util( Bool );
# Check if a type can be considered to be an rw_vector
deref: Type_Util( Null_Or( raw_syntax::Ctype ) );
# if type can be considered a pointer then returns dereferenced type;
# and otherwise returns NULL.
check_qualifiers: Type_Util { redundant_const: Bool, redundant_volatile: Bool };
# Check for redundant qualifiers
get_quals: Type_Util { const: Bool, volatile: Bool, type: raw_syntax::Ctype };
# Check for redundant qualifiers
is_function: Type_Util( Bool );
# Check if a type can be considered to be a function type
is_function_prototype: Type_Util( Bool );
# Check if a type is a function prototype
is_non_pointer_function: Type_Util( Bool );
# Check if a type is a function (but not a function pointer)
get_function: Type_Util( Null_Or( (raw_syntax::Ctype, List( (raw_syntax::Ctype, Null_Or( raw_syntax::Id ))))));
# if type can be considered a function then returns return type and
# list of argument types;
# and otherwise returns NULL.
is_struct_or_union: Type_Util( Null_Or( raw_syntax::Tid ) );
# if type is a struct or union then returns tid of that type,
# and otherwise returns NULL.
is_enum: Type_Mem_Util( Bool );
# TRUE iff type can be considered an enumerated type and pid is a
# member of that enum
lookup_enum: Type_Mem_Util( Null_Or( large_int::Int ) );
# if type can be considered an enumerated type and id is a member of
# that enum, return the value of that member;
# otherwise raise a type error
is_assignable: tables::Tidtab
-> { lhs: raw_syntax::Ctype, rhs: raw_syntax::Ctype, rhs_expr0: Bool }
-> Bool;
# type checking: expr of type rhs can be assigned to lval of type lhs
is_equable: tables::Tidtab
-> { type1: raw_syntax::Ctype, expression1zero: Bool,
type2: raw_syntax::Ctype, expression2zero: Bool }
-> Null_Or( raw_syntax::Ctype );
conditional_expression: tables::Tidtab
-> { type1: raw_syntax::Ctype, expression1zero: Bool,
type2: raw_syntax::Ctype, expression2zero: Bool }
-> Null_Or( raw_syntax::Ctype );
is_comparable: tables::Tidtab
-> { type1: raw_syntax::Ctype, type2: raw_syntax::Ctype }
-> Null_Or( raw_syntax::Ctype );
is_addable: tables::Tidtab
-> { type1: raw_syntax::Ctype, type2: raw_syntax::Ctype }
-> Null_Or { type1: raw_syntax::Ctype, type2: raw_syntax::Ctype, result_type: raw_syntax::Ctype };
is_subtractable: tables::Tidtab
-> { type1: raw_syntax::Ctype, type2: raw_syntax::Ctype }
-> Null_Or { type1: raw_syntax::Ctype, type2: raw_syntax::Ctype, result_type: raw_syntax::Ctype };
check_fn: tables::Tidtab
-> (raw_syntax::Ctype, List( raw_syntax::Ctype ), List( Bool ))
-> (raw_syntax::Ctype, List( String ), # For type error messages.
List( raw_syntax::Ctype ));
# type checking: function applied to args is well formed
types_are_equal: Type_Type_Util( Bool );
# type equality
compatible: Type_Type_Util( Bool );
# type compatibility
function_arg_conv: Type_Util( raw_syntax::Ctype );
composite: tables::Tidtab
-> (raw_syntax::Ctype, raw_syntax::Ctype)
-> (Null_Or( raw_syntax::Ctype ), List( String )); # for type error messages
is_scalar: Type_Util( Bool );
# is type numeric
usual_binary_cnv: Type_Type_Util( Null_Or (raw_syntax::Ctype ) );
# Combine binary operation types
usual_unary_cnv: Type_Util( raw_syntax::Ctype );
# process unary operation type
pre_arg_conv: Type_Util( raw_syntax::Ctype );
# Converts arrays and functions to pointers
cnv_function_to_pointer2function: Type_Util( raw_syntax::Ctype );
# Converts functions to pointers
std_int: raw_syntax::Ctype;
}; # Api TYPE_UTIL
end; # local
## Copyright (c) 1998 by Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.