IDA SDK

- Main Page
- Header Files
- Classes
- Modules

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_decl2 (til_t *til, const char *decl, qstring *out, tinfo_t *tif, 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_type3 (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

  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

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_decl2()

Parameters

  ti | type info library
  lx | input lexer. may be NULL. 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 | abstractness

Returns
  number of errors (they are displayed using print_cb). zero means ok

idaman bool ida_export parse_decl2 | ( | til_t * | til,
|  | const char * | decl,
|  | qstring * | out,
|  | tinfo_t * | tif,
|  | 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

  | til | type library to use
  | decl | C declaration to parse
  [out] | out | declared name
  [out] | tif | type info
  | flags | combination of Type parsing flags

Return values

  true | ok
  false | declaration 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

  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 NULL or your own callback)
  hti_flags | combination of Type formatting flags

Returns
  number of errors, 0 means ok.

idaman bool ida_export print_type3 | ( | qstring * | out,
|  | ea_t | ea,
|  | int | prtype_flags
| ) |  |

Get type declaration for the specified address.

Parameters

  out | output buffer
  ea | address
  prtype_flags | combination of Type printing flags

Returns
  success