Format/Parse/Print type information.
|
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...
|
|
|
idaman int ida_export | h2ti (til_t *ti, lexer_t *lx, const char *input, int flags=HTI_HIGH, h2ti_type_cb *type_cb=nullptr, h2ti_type_cb *var_cb=nullptr, printer_t *print_cb=nullptr, void *_cb_data=nullptr, abs_t _isabs=ABS_UNK) |
| Convert declarations to type_t*. More...
|
|
THREAD_SAFE int | convert_pt_flags_to_hti (int pt_flags) |
| Convert Type parsing flags to Type formatting flags. More...
|
|
idaman bool ida_export | parse_decl (tinfo_t *out_tif, qstring *out_name, til_t *til, const char *decl, int pt_flags) |
| Parse ONE declaration. 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...
|
|
◆ h2ti_type_cb
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
-
name | var/func/type name |
tif | type info |
cmt | main comment |
value | symbol value |
cb_data | data passed to callback |
- Return values
-
T_CBBRKDEF | the type declaration won't be saved in the til |
◆ printer_t
typedef int printer_t(const char *format,...) |
◆ h2ti()
Convert declarations to type_t*.
This is a low level function - use parse_decls() or parse_decl()
- Parameters
-
ti | type info library |
lx | input lexer. may be nullptr. always destroyed by h2ti() |
input | file name or C declaration |
flags | combination of Type formatting flags |
type_cb | callback - for each type |
var_cb | callback - for each var |
print_cb | may pass msg() here |
_cb_data | data passed to callbacks |
_isabs | the expected abstracness of the type declaration(s) |
- Returns
- number of errors (they are displayed using print_cb). zero means ok
◆ convert_pt_flags_to_hti()
THREAD_SAFE int convert_pt_flags_to_hti |
( |
int |
pt_flags | ) |
|
|
inline |
◆ parse_decl()
idaman bool ida_export parse_decl |
( |
tinfo_t * |
out_tif, |
|
|
qstring * |
out_name, |
|
|
til_t * |
til, |
|
|
const char * |
decl, |
|
|
int |
pt_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 & tif may be empty after the call!
- Parameters
-
[out] | out_tif | type info |
[out] | out_name | declared name |
| til | type library to use. may be nullptr |
| decl | C declaration to parse |
| pt_flags | combination of Type parsing flags bits |
- Return values
-
true | ok |
false | declaration is bad, the error message is displayed if !PT_SIL |
◆ parse_decls()
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
-
til | type library to store the result |
input | input string or file name (see hti_flags) |
printer | function to output error messages (use msg or nullptr or your own callback) |
hti_flags | combination of Type formatting flags |
- Returns
- number of errors, 0 means ok.
◆ print_type()
idaman bool ida_export print_type |
( |
qstring * |
out, |
|
|
ea_t |
ea, |
|
|
int |
prtype_flags |
|
) |
| |
Get type declaration for the specified address.
- Parameters
-
- Returns
- success