Type string related declarations

Type related functions and class. More...

Classes

struct  typestring
 Type string. More...

Functions

const type_t * remove_typedef (const type_t *type, const p_list **fields=NULL)
 Resolve a typedef.
bool is_type_correct (const type_t *ptr)
 Verify a type string.
bool is_type_integral (const type_t *type)
 Is integral type?
bool is_type_small_struni (const type_t *ptr)
 Is a small structure or union?
bool is_ptr_or_array (type_t t)
 Is a pointer or array type?
bool is_paf (type_t t)
 Is a pointer, array, or function type?
const type_t * skip_ptr_or_array_header (const type_t *t)
 Skip pointer or array type header.
int partial_type_num (const type_t *type)
 Calculate number of partial subtypes.
type_t get_float_bit (int width)
 Get a type byte for a floating point value.
typestring get_int_type_by_width_and_sign (int srcwidth, type_sign_t sign)
 Create a type string by width and sign.
typestring get_unk_type (int size)
 Create a partial type string by width.
typestring dummy_ptrtype (int ptrsize, bool isfp)
 Generate a dummy pointer type.
bool get_member_type (const member_t *mptr, typestring *type, qtype *fields=NULL)
 Get type of a structure field.
typestring make_array (const type_t *type, int nelems)
 Create an array type.
typestring make_pointer (const typestring &type)
 Create a pointer type.
typestring create_typedef (const char *name)
 Create a reference to a named type.
typestring remove_pointer (const typestring &type)
 Get pointed object type.
bool cnv_array_to_ptr (typestring &type)
 Convert array type into pointer type.

Detailed Description

Type related functions and class.


Function Documentation

bool cnv_array_to_ptr ( typestring type  ) 

Convert array type into pointer type.

This function performs the following conversion: "type[]" -> "type *"

Parameters:
type array type.

Definition at line 4086 of file hexrays.hpp.

References hexdsp.

typestring create_typedef ( const char *  name  ) 

Create a reference to a named type.

Parameters:
name type name
Returns:
type which refers to the specified name. For example, if name is "DWORD", the type string which refers to "DWORD" is created.

Definition at line 4070 of file hexrays.hpp.

References hexdsp.

typestring dummy_ptrtype ( int  ptrsize,
bool  isfp 
)

Generate a dummy pointer type.

Parameters:
buf output buffer
bufsize size of output buffer. must be bigger than 4 bytes (at least)
ptrsize size of pointed object
isfp is floating point object?

Definition at line 4040 of file hexrays.hpp.

References hexdsp.

type_t get_float_bit ( int  width  ) 

Get a type byte for a floating point value.

Returns:
BT_FLOAT or'ed with the right modifier.
Parameters:
width width of the desired type

Definition at line 3992 of file hexrays.hpp.

References hexdsp.

typestring get_int_type_by_width_and_sign ( int  srcwidth,
type_sign_t  sign 
)

Create a type string by width and sign.

Returns a simple type (examples: int, short) with the given width and sign.

Parameters:
srcwidth size of the type in bytes
sign sign of the type

Definition at line 4024 of file hexrays.hpp.

References hexdsp.

bool get_member_type ( const member_t *  mptr,
typestring type,
qtype *  fields = NULL 
)

Get type of a structure field.

This function performs validity checks of the field type. Wrong types are rejected.

Parameters:
mptr structure field
type pointer to the variable where the type is returned. This parameter can be NULL.
fields pointer to the variable where the fields are returned. This parameter can be NULL.
Returns:
false if failed

Definition at line 4048 of file hexrays.hpp.

References hexdsp.

typestring get_unk_type ( int  size  ) 

Create a partial type string by width.

Returns a partially defined type (examples: _DWORD, _BYTE) with the given width.

Parameters:
size size of the type in bytes

Definition at line 4032 of file hexrays.hpp.

References hexdsp.

bool is_type_correct ( const type_t *  ptr  ) 

Verify a type string.

Returns:
true if type string is correct

Definition at line 3968 of file hexrays.hpp.

References hexdsp.

bool is_type_integral ( const type_t *  type  ) 

Is integral type?

Returns:
true if the type is an integer type

Definition at line 3974 of file hexrays.hpp.

References hexdsp.

bool is_type_small_struni ( const type_t *  ptr  ) 

Is a small structure or union?

Returns:
true if the type ia small s UDT (user defined type). Small UDTs fit into a register (or pair or registers) as a rule.

Definition at line 3980 of file hexrays.hpp.

References hexdsp.

typestring make_array ( const type_t *  type,
int  nelems 
)

Create an array type.

This function performs the following conversion: "type" -> "type[N]"

Parameters:
type array element type.
nelems number of array elements. zero represents unknown array dimensions.

Definition at line 4054 of file hexrays.hpp.

References hexdsp.

typestring make_pointer ( const typestring type  ) 

Create a pointer type.

This function performs the following conversion: "type" -> "type*"

Parameters:
type object type.
Returns:
"type*". for example, if 'char' is passed as the argument,

Definition at line 4062 of file hexrays.hpp.

References hexdsp.

int partial_type_num ( const type_t *  type  ) 

Calculate number of partial subtypes.

Returns:
number of partial subtypes. The bigger is this number, the uglier is the type.

Definition at line 3986 of file hexrays.hpp.

References hexdsp.

typestring remove_pointer ( const typestring type  ) 

Get pointed object type.

This function performs the following conversion: "type*" -> "type"

Parameters:
type this parameter should be of a pointer type. The function will return the pointed type. If the parameter is not a pointer, then it is returned as is.

Definition at line 4078 of file hexrays.hpp.

References hexdsp.

const type_t * remove_typedef ( const type_t *  type,
const p_list **  fields = NULL 
)

Resolve a typedef.

This function never returns NULL. If an invalid type is encountered, it throws vd_failure_t with MERR_UNKTYPE

Returns:
pointer to resolved type string. The pointer is valid until a type is modified in IDA kernel. The pointer might also point to the input type if the input type was not a typedef.
Parameters:
type type string to resolve
fields ptr to ptr to the accompanying fields string

Definition at line 3962 of file hexrays.hpp.

References hexdsp.

const type_t* skip_ptr_or_array_header ( const type_t *  t  ) 

Skip pointer or array type header.

Returns:
pointer to the pointed object or array element.

Definition at line 244 of file hexrays.hpp.