fcml  1.2.2
Classes | Typedefs | Functions
fcml_lag_assembler.h File Reference

Experimental multiline load-and-go assembler implementation. More...

#include "fcml_symbols.h"
#include "fcml_assembler.h"
Include dependency graph for fcml_lag_assembler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


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...


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...


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...

Detailed Description

Experimental multiline load-and-go assembler implementation.

Typedef Documentation

◆ fcml_st_lag_assembler_context

Load-and-go assembler runtime context.

◆ fcml_st_lag_assembler_result

Result holder for load-and-go assembler.

Function Documentation

◆ fcml_fn_lag_assemble()

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.

contextAssembler context.
source_codeNULL terminated array of the instructions.
resultReusable result holder.
Error code or FCML_CEH_GEC_NO_ERROR.
This is an experimental implementation and it still needs some testing.
See also

◆ fcml_fn_lag_assembler_result_free()

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.

resultResult holder to clean.

◆ fcml_fn_lag_assembler_result_prepare()

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.

resultResult holder instance to be prepared.