fcml
1.2.2
|
Experimental multiline load-and-go assembler implementation. More...
Go to the source code of this file.
Classes | |
struct | fcml_st_lag_assembler_result |
Result holder for load-and-go assembler. More... | |
struct | fcml_st_lag_assembler_context |
Load-and-go assembler runtime context. More... | |
Typedefs | |
typedef struct fcml_st_lag_assembler_result | fcml_st_lag_assembler_result |
Result holder for load-and-go assembler. More... | |
typedef struct fcml_st_lag_assembler_context | fcml_st_lag_assembler_context |
Load-and-go assembler runtime context. More... | |
Functions | |
LIB_EXPORT fcml_ceh_error LIB_CALL | fcml_fn_lag_assemble (fcml_st_lag_assembler_context *context, const fcml_string *source_code, fcml_st_lag_assembler_result *result) |
Multipass load-and-go assembler. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_lag_assembler_result_prepare (fcml_st_lag_assembler_result *result) |
Prepares reusable result holder for assembler. More... | |
LIB_EXPORT void LIB_CALL | fcml_fn_lag_assembler_result_free (fcml_st_lag_assembler_result *result) |
Cleans result holder. More... | |
Experimental multiline load-and-go assembler implementation.
typedef struct fcml_st_lag_assembler_context fcml_st_lag_assembler_context |
Load-and-go assembler runtime context.
typedef struct fcml_st_lag_assembler_result fcml_st_lag_assembler_result |
Result holder for load-and-go assembler.
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_lag_assemble | ( | fcml_st_lag_assembler_context * | context, |
const fcml_string * | source_code, | ||
fcml_st_lag_assembler_result * | result | ||
) |
Multipass load-and-go assembler.
Assembles all instructions given in the NULL terminated source_code array of strings. Every instruction has to be represented as one string in the source array. Like every multipass assembler implementation it passes through the source code multiple times in order to generate optimal code. Assembler also supports symbols that can be provided using symbol table available in the context. Context should be initialized the same way as in case of one line assembler. The only difference here is the symbol table itself which can be initialized using fcml_fn_symbol_table_alloc() function. Symbols can be also declared directly in the source code and accessed through the same symbols table when processing is done (Only if you provide valid symbol table through the context). Reusable result holder has to be prepared using fcml_fn_lag_assembler_result_prepare() function. As long as the context and the result holder are not shared across multiple calls function is thread safe.
context | Assembler context. |
source_code | NULL terminated array of the instructions. |
result | Reusable result holder. |
LIB_EXPORT void LIB_CALL fcml_fn_lag_assembler_result_free | ( | fcml_st_lag_assembler_result * | result | ) |
Cleans result holder.
Frees all memory blocks allocated by the assembler and held inside the result holder (Instructions, errors etc.). Notice that result holder itself is not freed and can be even safety reused after call to this function. In fact this function is also called internally by assembler in order to clean result holder before reusing it.
result | Result holder to clean. |
LIB_EXPORT void LIB_CALL fcml_fn_lag_assembler_result_prepare | ( | fcml_st_lag_assembler_result * | result | ) |
Prepares reusable result holder for assembler.
Every instance of fcml_st_lag_assembler_result structure is reusable from the assembler's point of view, so it has to be prepared in the right way in order to allow assembler to reuse it correctly. It is up to the library user to allocate space for the holder itself. This function is only responsible for cleaning the structure correctly and preparing it for first assembling process. Notice that assembler has to clean the result holder at the beginning so you can not pass an uninitialized memory block because it can even cause a crash due to illegal memory access.
result | Result holder instance to be prepared. |