IDA SDK
Public Attributes | Public Member Functions | List of all members
extlang_t Struct Reference

Detailed Description

External language (to support third party language interpreters)

Public Attributes

size_t size
 Size of this structure.
 
uint32 flags
 Language features.
 
int32 refcnt
 Reference count.
 
const char * name
 Language name.
 
const char * fileext
 File name extension for the language.
 
syntax_highlighter_thighlighter
 
bool(idaapicompile_expr )(const char *name, ea_t current_ea, const char *expr, qstring *errbuf)
 Compile an expression. More...
 
bool(idaapicompile_file )(const char *file, qstring *errbuf)
 Compile (load) a file. More...
 
bool(idaapicall_func )(idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
 Evaluate a previously compiled expression. More...
 
bool(idaapieval_expr )(idc_value_t *rv, ea_t current_ea, const char *expr, qstring *errbuf)
 Compile and evaluate an expression. More...
 
bool(idaapieval_snippet )(const char *str, qstring *errbuf)
 Compile and execute a string with statements. More...
 
bool(idaapicreate_object )(idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
 Create an object instance. More...
 
bool(idaapiget_attr )(idc_value_t *result, const idc_value_t *obj, const char *attr)
 Returns the attribute value of a given object from the global scope. More...
 
bool(idaapiset_attr )(idc_value_t *obj, const char *attr, const idc_value_t &value)
 Sets the attribute value of a given object in the global scope. More...
 
bool(idaapicall_method )(idc_value_t *result, const idc_value_t *obj, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)
 Calls a member function. More...
 
bool(idaapiload_procmod )(idc_value_t *procobj, const char *path, qstring *errbuf)
 Compile (load) a file with processor module. More...
 
bool(idaapiunload_procmod )(const char *path, qstring *errbuf)
 Unload previously loaded processor module. More...
 

Public Member Functions

bool is_idc (void) const
 
bool is_namespace_aware (void) const
 
void release (void)
 

Member Data Documentation

bool(idaapi * extlang_t::compile_expr) (const char *name, ea_t current_ea, const char *expr, qstring *errbuf)

Compile an expression.

Parameters
namename of the function which will hold the compiled expression
current_eacurrent address. if unknown then BADADDR
exprexpression to compile
[out]errbuferror message if compilation fails
Returns
success
bool(idaapi * extlang_t::compile_file) (const char *file, qstring *errbuf)

Compile (load) a file.

If an extlang_t object claims to be namespace-aware, it means its 'compile_file()' will have to create namespaces for _certain_ paths:

  • plugins,
  • loaders.

For example, if compile_file() receives a hypothetical path: .../loaders/myloader.py, the namespace-aware extlang_t handling 'py' files will have to create a namespace derived from the loader file name (without its extension), i.e., '__loaders__myloader', into which the file will be compiled.

Then, call_func() has to be prepared to receive a function name that is namespace-qualified: "__loaders__myloader.accept_file()".

compile_file() must handle the following 'special' paths, and create the following namespaces to compile them into: .../loaders/<filename> => '__loaders__<filename-noext>' .../plugins/<filename> => '__plugins__<filename-noext>'

Similarly, a namespace-aware extlang_t's load_procmod() will have to load the processor module in its own namespace: .../procs/<filename> => '__procs__<filename-noext>'

Parameters
filefile name
[out]errbuferror message if compilation fails
bool(idaapi * extlang_t::call_func) (idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Evaluate a previously compiled expression.

Parameters
[out]resultfunction result or exception
namefunction to call
nargsnumber of input arguments
argsinput arguments
[out]errbuferror message if evaluation fails
Returns
success
bool(idaapi * extlang_t::eval_expr) (idc_value_t *rv, ea_t current_ea, const char *expr, qstring *errbuf)

Compile and evaluate an expression.

Parameters
[out]rvexpression value or exception
current_eacurrent address. if unknown then BADADDR
exprexpression to evaluate
[out]errbuferror message if evaluation fails
Returns
success
bool(idaapi * extlang_t::eval_snippet) (const char *str, qstring *errbuf)

Compile and execute a string with statements.

(see also: eval_expr() which works with expressions)

Parameters
strinput string to execute
[out]errbuferror message
Returns
success
bool(idaapi * extlang_t::create_object) (idc_value_t *result, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Create an object instance.

Parameters
resultcreated object or exception
nameobject class name
argsinput arguments
nargsnumber of input arguments
errbuferror message if evaluation fails
Returns
success
bool(idaapi * extlang_t::get_attr) (idc_value_t *result, const idc_value_t *obj, const char *attr)

Returns the attribute value of a given object from the global scope.

Parameters
[out]resultattribute value
objobject (may be NULL)
attrattribute name. if NULL or empty string then the object instance name (i.e. class name) should be returned.
Returns
success
bool(idaapi * extlang_t::set_attr) (idc_value_t *obj, const char *attr, const idc_value_t &value)

Sets the attribute value of a given object in the global scope.

Parameters
objobject (may be NULL)
attrattribute name
valueattribute value
Returns
success
bool(idaapi * extlang_t::call_method) (idc_value_t *result, const idc_value_t *obj, const char *name, const idc_value_t args[], size_t nargs, qstring *errbuf)

Calls a member function.

Parameters
[out]resultfunction result or exception
objobject instance
namemethod name to call
argsinput arguments
nargsnumber of input arguments
[out]errbuferror message if evaluation fails
Returns
success
bool(idaapi * extlang_t::load_procmod) (idc_value_t *procobj, const char *path, qstring *errbuf)

Compile (load) a file with processor module.

See the note about namespace-awareness in compile_file()

Parameters
[out]procobjcreated object or exception
pathprocessor module file name
[out]errbuferror message if compilation fails
Return values
truesuccess
falseif errbuf is empty then file has been loaded (compiled) successfully but it doesn't contain processor module
bool(idaapi * extlang_t::unload_procmod) (const char *path, qstring *errbuf)

Unload previously loaded processor module.

Parameters
pathprocessor module file name
[out]errbufferror message if compilation fails
Returns
success

The documentation for this struct was generated from the following file: