fcml  1.2.2
fcml_symbols.h
Go to the documentation of this file.
1 /*
2  * FCML - Free Code Manipulation Library.
3  * Copyright (C) 2010-2020 Slawomir Wojtasiak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
27 #ifndef FCML_SYMBOLS_H_
28 #define FCML_SYMBOLS_H_
29 
30 #include "fcml_lib_export.h"
31 #include "fcml_common.h"
32 #include "fcml_errors.h"
33 
35 typedef fcml_ptr fcml_st_symbol_table;
36 
37 /*********************************
38  * Symbols.
39  *********************************/
40 
42 typedef struct fcml_st_symbol {
43  /* The symbol name. */
44  fcml_string symbol;
45  /* The symbol value. */
46  fcml_int64_t value;
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
59 LIB_EXPORT fcml_st_symbol* LIB_CALL fcml_fn_symbol_alloc(
60  const fcml_string symbol, fcml_int64_t value);
61 
66 LIB_EXPORT void LIB_CALL fcml_fn_symbol_free(fcml_st_symbol *symbol);
67 
73 
90 LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_symbol_add_raw(
91  fcml_st_symbol_table symbol_table, const fcml_string symbol,
92  fcml_int64_t value);
93 
106 LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_symbol_add(
107  fcml_st_symbol_table symbol_table, const fcml_st_symbol *symbol);
108 
115 LIB_EXPORT void LIB_CALL fcml_fn_symbol_remove(
116  fcml_st_symbol_table symbol_table, const fcml_string symbol);
117 
125 LIB_EXPORT fcml_st_symbol* LIB_CALL fcml_fn_symbol_get(
126  fcml_st_symbol_table symbol_table, const fcml_string symbol);
127 
134 LIB_EXPORT void LIB_CALL fcml_fn_symbol_remove_all(
135  fcml_st_symbol_table symbol_table);
136 
142 LIB_EXPORT void LIB_CALL fcml_fn_symbol_table_free(
143  fcml_st_symbol_table symbol_table);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* FCML_SYMBOLS_H_ */
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_symbol_add(fcml_st_symbol_table symbol_table, const fcml_st_symbol *symbol)
Adds existing symbol to the symbol table.
fcml_ptr fcml_st_symbol_table
Type for symbol tables.
Definition: fcml_symbols.h:35
LIB_EXPORT void LIB_CALL fcml_fn_symbol_table_free(fcml_st_symbol_table symbol_table)
Frees a symbol table.
LIB_EXPORT fcml_st_symbol *LIB_CALL fcml_fn_symbol_alloc(const fcml_string symbol, fcml_int64_t value)
Allocates new symbol on FCML library heap.
Definitions of common structures used by FCML components.
Handles Win32 DLL symbols importing/exporting.
LIB_EXPORT void LIB_CALL fcml_fn_symbol_free(fcml_st_symbol *symbol)
Frees symbol allocated by FCML library.
LIB_EXPORT void LIB_CALL fcml_fn_symbol_remove(fcml_st_symbol_table symbol_table, const fcml_string symbol)
Removes the symbol from the symbol table.
LIB_EXPORT fcml_st_symbol *LIB_CALL fcml_fn_symbol_get(fcml_st_symbol_table symbol_table, const fcml_string symbol)
Gets the symbol with the given name from the symbol table.
LIB_EXPORT fcml_st_symbol_table LIB_CALL fcml_fn_symbol_table_alloc()
Allocates new symbol table.
Represents one named symbol with associated value.
Definition: fcml_symbols.h:42
LIB_EXPORT fcml_ceh_error LIB_CALL fcml_fn_symbol_add_raw(fcml_st_symbol_table symbol_table, const fcml_string symbol, fcml_int64_t value)
Adds new symbol to the symbol table.
Global error handling related declarations.
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition: fcml_errors.h:156
struct fcml_st_symbol fcml_st_symbol
Represents one named symbol with associated value.
LIB_EXPORT void LIB_CALL fcml_fn_symbol_remove_all(fcml_st_symbol_table symbol_table)
Removes all symbols from the symbol table.