IDA SDK
Modules | Typedefs | Functions
Type parsing

Detailed Description

Format/Parse/Print type information.

Modules

 Type formatting flags
 
 Type parsing flags
 
 Type printing flags
 

Typedefs

typedef int idaapi h2ti_type_cb(const char *name, const tinfo_t &tif, const char *cmt, const uint64 *value, void *cb_data)
 This callback will be called for each type/variable declaration. More...
 
typedef int printer_t(const char *format,...)
 Specify a printing callback when parsing types. More...
 

Functions

idaman int ida_export h2ti (til_t *ti, lexer_t *lx, const char *input, int flags=HTI_HIGH, h2ti_type_cb *type_cb=NULL, h2ti_type_cb *var_cb=NULL, printer_t *print_cb=NULL, void *_cb_data=NULL, abs_t _isabs=abs_unk)
 Convert declarations to type_t*. More...
 
idaman bool ida_export parse_decl (tinfo_t *tif, qstring *out, til_t *til, const char *decl, int flags)
 Parse ONE declaration. More...
 
int convert_pt_flags_to_hti (int pt_flags)
 Convert Type parsing flags to Type formatting flags. More...
 
idaman int ida_export parse_decls (til_t *til, const char *input, printer_t *printer, int hti_flags)
 Parse many declarations and store them in a til. More...
 
idaman bool ida_export print_type (qstring *out, ea_t ea, int prtype_flags)
 Get type declaration for the specified address. More...
 

Typedef Documentation

typedef int idaapi h2ti_type_cb(const char *name, const tinfo_t &tif, const char *cmt, const uint64 *value, void *cb_data)

This callback will be called for each type/variable declaration.

Parameters
namevar/func/type name
tiftype info
cmtmain comment
valuesymbol value
cb_datadata passed to callback
Return values
T_CBBRKDEFthe type declaration won't be saved in the til
typedef int printer_t(const char *format,...)

Specify a printing callback when parsing types.

See h2ti() and parse_decls().

Function Documentation

idaman int ida_export h2ti ( til_t ti,
lexer_t *  lx,
const char *  input,
int  flags = HTI_HIGH,
h2ti_type_cb type_cb = NULL,
h2ti_type_cb var_cb = NULL,
printer_t print_cb = NULL,
void *  _cb_data = NULL,
abs_t  _isabs = abs_unk 
)

Convert declarations to type_t*.

This is a low level function - use parse_decls() or parse_decl()

Parameters
titype info library
lxinput lexer. may be NULL. always destroyed by h2ti()
inputfile name or C declaration
flagscombination of Type formatting flags
type_cbcallback - for each type
var_cbcallback - for each var
print_cbmay pass msg() here
_cb_datadata passed to callbacks
_isabsabstractness
Returns
number of errors (they are displayed using print_cb). zero means ok
idaman bool ida_export parse_decl ( tinfo_t tif,
qstring out,
til_t til,
const char *  decl,
int  flags 
)

Parse ONE declaration.

If the input string contains more than one declaration, the first complete type declaration (PT_TYP) or the last variable declaration (PT_VAR) will be used.

Note
name & type & fields might be empty after the call!
Parameters
[out]tiftype info
[out]outdeclared name
tiltype library to use
declC declaration to parse
flagscombination of Type parsing flags
Return values
trueok
falsedeclaration is bad, the error message is displayed
int convert_pt_flags_to_hti ( int  pt_flags)
inline

Convert Type parsing flags to Type formatting flags.

Type parsing flags lesser than 0x10 don't have stable meaning and will be ignored (more on these flags can be seen in idc.idc)

idaman int ida_export parse_decls ( til_t til,
const char *  input,
printer_t printer,
int  hti_flags 
)

Parse many declarations and store them in a til.

If there are any errors, they will be printed using 'printer'. This function uses default include path and predefined macros from the database settings. It always uses the HTI_DCL bit.

Parameters
tiltype library to store the result
inputinput string or file name (see hti_flags)
printerfunction to output error messages (use msg or NULL or your own callback)
hti_flagscombination of Type formatting flags
Returns
number of errors, 0 means ok.
idaman bool ida_export print_type ( qstring out,
ea_t  ea,
int  prtype_flags 
)

Get type declaration for the specified address.

Parameters
outoutput buffer
eaaddress
prtype_flagscombination of Type printing flags
Returns
success