A program handle refers to a memory representation of a plain or compound assembler program.
This is a type for a program handle.
It is a pointer, so variables of this type can be NULL.
The functions qsmm_prg_create, qsmm_node_disasm, qsmm_parse_asm_source_buf, qsmm_parse_asm_source_stream, and qsmm_parse_asm_source_file allocate a new program handle.
The function qsmm_prg_destroy frees an existing program handle.
You can pass a program handle to API functions taking an argument of qsmm_prg_t type until freeing the handle.
Use the following function if you need to create a memory representation of a compound assembler program for subsequent adding memory representations of plain assembler programs to it.
int qsmm_prg_create (qsmm_prg_t *prg_p) ¶This function creates an empty memory representation of an assembler program and stores its allocated program handle to *prg_p.
If prg_p is NULL, the function has no effect.
The function returns a non-negative value on success or negative error code QSMM_ERR_NOMEM on out of memory error.
Use the following function to destroy a memory representation of a plain or compound assembler program.
void qsmm_prg_destroy (qsmm_prg_t prg) ¶This function destroys a memory representation of an assembler program specified by a handle prg.
You must not use the handle after destroying the memory representation.
If prg is NULL, the function has no effect.
Use the function described below to add a memory representation of a plain assembler program to a memory representation of a compound assembler program, for example, created by qsmm_prg_create.
int qsmm_prg_add_nested (qsmm_prg_t prg_compound, const char *nested_name, qsmm_prg_t prg_nested) ¶This function adds a memory representation of a plain assembler program prg_nested to a memory representation of a compound assembler program prg_compound as an assembler procedure named nested_name.
The compound assembler program becomes the owner of the plain assembler program, so destroying prg_nested happens on destroying prg_compound, and you must not destroy prg_nested by passing it to qsmm_prg_destroy.
The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.
QSMM_ERR_UNTIMELYThe handle prg_compound refers to a memory representation of a plain assembler program, or the handle prg_nested refers to a memory representation of a compound assembler program.
QSMM_ERR_NOMEMThere was not enough memory to perform the operation.
QSMM provides limited capabilities for working with assembler instructions contained in a memory representation of a plain assembler program. An instruction handle refers to an assembler instruction.
This is a type for an instruction handle.
It is a pointer, so variables of this type can be NULL.
The functions qsmm_get_prg_instr and qsmm_get_instr_nested (see Inspecting an Assembler Program) return the handle of an existing instruction.