mirror of
https://github.com/Ed94/gencpp.git
synced 2025-02-24 06:08:37 -08:00
Fixes for GEN_API symbol exports necessary for dynamic linking
This commit is contained in:
parent
ce2be411d7
commit
eca538c6af
@ -21,11 +21,11 @@ using namespace gen;
|
|||||||
struct Builder;
|
struct Builder;
|
||||||
typedef struct Builder Builder;
|
typedef struct Builder Builder;
|
||||||
|
|
||||||
Builder builder_open ( char const* path );
|
GEN_API Builder builder_open ( char const* path );
|
||||||
void builder_pad_lines ( Builder* builder, s32 num );
|
GEN_API void builder_pad_lines ( Builder* builder, s32 num );
|
||||||
void builder_print ( Builder* builder, Code code );
|
GEN_API void builder_print ( Builder* builder, Code code );
|
||||||
void builder_print_fmt_va( Builder* builder, char const* fmt, va_list va );
|
GEN_API void builder_print_fmt_va( Builder* builder, char const* fmt, va_list va );
|
||||||
void builder_write ( Builder* builder );
|
GEN_API void builder_write ( Builder* builder );
|
||||||
|
|
||||||
forceinline void builder_print_fmt ( Builder* builder, char const* fmt, ... ) {
|
forceinline void builder_print_fmt ( Builder* builder, char const* fmt, ... ) {
|
||||||
va_list va;
|
va_list va;
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
// This is a simple file reader that reads the entire file into memory.
|
// This is a simple file reader that reads the entire file into memory.
|
||||||
// It has an extra option to skip the first few lines for undesired includes.
|
// It has an extra option to skip the first few lines for undesired includes.
|
||||||
// This is done so that includes can be kept in dependency and component files so that intellisense works.
|
// This is done so that includes can be kept in dependency and component files so that intellisense works.
|
||||||
Code scan_file( char const* path );
|
GEN_API Code scan_file( char const* path );
|
||||||
|
|
||||||
CodeBody parse_file( const char* path );
|
GEN_API CodeBody parse_file( const char* path );
|
||||||
|
|
||||||
// The follow is basic support for light csv parsing (use it as an example)
|
// The follow is basic support for light csv parsing (use it as an example)
|
||||||
// Make something robust if its more serious.
|
// Make something robust if its more serious.
|
||||||
@ -40,7 +40,7 @@ struct CSV_Columns2 {
|
|||||||
Array(ADT_Node) Col_2;
|
Array(ADT_Node) Col_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
CSV_Column parse_csv_one_column(AllocatorInfo allocator, char const* path);
|
GEN_API CSV_Column parse_csv_one_column (AllocatorInfo allocator, char const* path);
|
||||||
CSV_Columns2 parse_csv_two_columns(AllocatorInfo allocator, char const* path);
|
GEN_API CSV_Columns2 parse_csv_two_columns(AllocatorInfo allocator, char const* path);
|
||||||
|
|
||||||
#pragma endregion Scanner
|
#pragma endregion Scanner
|
||||||
|
@ -337,10 +337,10 @@ struct Code
|
|||||||
|
|
||||||
#pragma region Statics
|
#pragma region Statics
|
||||||
// Used to identify ASTs that should always be duplicated. (Global constant ASTs)
|
// Used to identify ASTs that should always be duplicated. (Global constant ASTs)
|
||||||
extern Code Code_Global;
|
GEN_API extern Code Code_Global;
|
||||||
|
|
||||||
// Used to identify invalid generated code.
|
// Used to identify invalid generated code.
|
||||||
extern Code Code_Invalid;
|
GEN_API extern Code Code_Invalid;
|
||||||
#pragma endregion Statics
|
#pragma endregion Statics
|
||||||
|
|
||||||
struct Code_POD
|
struct Code_POD
|
||||||
|
@ -6,83 +6,83 @@
|
|||||||
|
|
||||||
#pragma region Constants
|
#pragma region Constants
|
||||||
|
|
||||||
extern Macro enum_underlying_macro;
|
GEN_API extern Macro enum_underlying_macro;
|
||||||
|
|
||||||
extern Code access_public;
|
GEN_API extern Code access_public;
|
||||||
extern Code access_protected;
|
GEN_API extern Code access_protected;
|
||||||
extern Code access_private;
|
GEN_API extern Code access_private;
|
||||||
|
|
||||||
extern CodeAttributes attrib_api_export;
|
GEN_API extern CodeAttributes attrib_api_export;
|
||||||
extern CodeAttributes attrib_api_import;
|
GEN_API extern CodeAttributes attrib_api_import;
|
||||||
|
|
||||||
extern Code module_global_fragment;
|
GEN_API extern Code module_global_fragment;
|
||||||
extern Code module_private_fragment;
|
GEN_API extern Code module_private_fragment;
|
||||||
|
|
||||||
extern Code fmt_newline;
|
GEN_API extern Code fmt_newline;
|
||||||
|
|
||||||
extern CodePragma pragma_once;
|
GEN_API extern CodePragma pragma_once;
|
||||||
|
|
||||||
extern CodeParams param_varadic;
|
GEN_API extern CodeParams param_varadic;
|
||||||
|
|
||||||
extern CodePreprocessCond preprocess_else;
|
GEN_API extern CodePreprocessCond preprocess_else;
|
||||||
extern CodePreprocessCond preprocess_endif;
|
GEN_API extern CodePreprocessCond preprocess_endif;
|
||||||
|
|
||||||
extern CodeSpecifiers spec_const;
|
GEN_API extern CodeSpecifiers spec_const;
|
||||||
extern CodeSpecifiers spec_consteval;
|
GEN_API extern CodeSpecifiers spec_consteval;
|
||||||
extern CodeSpecifiers spec_constexpr;
|
GEN_API extern CodeSpecifiers spec_constexpr;
|
||||||
extern CodeSpecifiers spec_constinit;
|
GEN_API extern CodeSpecifiers spec_constinit;
|
||||||
extern CodeSpecifiers spec_extern_linkage;
|
GEN_API extern CodeSpecifiers spec_extern_linkage;
|
||||||
extern CodeSpecifiers spec_final;
|
GEN_API extern CodeSpecifiers spec_final;
|
||||||
extern CodeSpecifiers spec_forceinline;
|
GEN_API extern CodeSpecifiers spec_forceinline;
|
||||||
extern CodeSpecifiers spec_global;
|
GEN_API extern CodeSpecifiers spec_global;
|
||||||
extern CodeSpecifiers spec_inline;
|
GEN_API extern CodeSpecifiers spec_inline;
|
||||||
extern CodeSpecifiers spec_internal_linkage;
|
GEN_API extern CodeSpecifiers spec_internal_linkage;
|
||||||
extern CodeSpecifiers spec_local_persist;
|
GEN_API extern CodeSpecifiers spec_local_persist;
|
||||||
extern CodeSpecifiers spec_mutable;
|
GEN_API extern CodeSpecifiers spec_mutable;
|
||||||
extern CodeSpecifiers spec_neverinline;
|
GEN_API extern CodeSpecifiers spec_neverinline;
|
||||||
extern CodeSpecifiers spec_noexcept;
|
GEN_API extern CodeSpecifiers spec_noexcept;
|
||||||
extern CodeSpecifiers spec_override;
|
GEN_API extern CodeSpecifiers spec_override;
|
||||||
extern CodeSpecifiers spec_ptr;
|
GEN_API extern CodeSpecifiers spec_ptr;
|
||||||
extern CodeSpecifiers spec_pure;
|
GEN_API extern CodeSpecifiers spec_pure;
|
||||||
extern CodeSpecifiers spec_ref;
|
GEN_API extern CodeSpecifiers spec_ref;
|
||||||
extern CodeSpecifiers spec_register;
|
GEN_API extern CodeSpecifiers spec_register;
|
||||||
extern CodeSpecifiers spec_rvalue;
|
GEN_API extern CodeSpecifiers spec_rvalue;
|
||||||
extern CodeSpecifiers spec_static_member;
|
GEN_API extern CodeSpecifiers spec_static_member;
|
||||||
extern CodeSpecifiers spec_thread_local;
|
GEN_API extern CodeSpecifiers spec_thread_local;
|
||||||
extern CodeSpecifiers spec_virtual;
|
GEN_API extern CodeSpecifiers spec_virtual;
|
||||||
extern CodeSpecifiers spec_volatile;
|
GEN_API extern CodeSpecifiers spec_volatile;
|
||||||
|
|
||||||
extern CodeTypename t_empty; // Used with varaidc parameters. (Exposing just in case its useful for another circumstance)
|
GEN_API extern CodeTypename t_empty; // Used with varaidc parameters. (Exposing just in case its useful for another circumstance)
|
||||||
extern CodeTypename t_auto;
|
GEN_API extern CodeTypename t_auto;
|
||||||
extern CodeTypename t_void;
|
GEN_API extern CodeTypename t_void;
|
||||||
extern CodeTypename t_int;
|
GEN_API extern CodeTypename t_int;
|
||||||
extern CodeTypename t_bool;
|
GEN_API extern CodeTypename t_bool;
|
||||||
extern CodeTypename t_char;
|
GEN_API extern CodeTypename t_char;
|
||||||
extern CodeTypename t_wchar_t;
|
GEN_API extern CodeTypename t_wchar_t;
|
||||||
extern CodeTypename t_class;
|
GEN_API extern CodeTypename t_class;
|
||||||
extern CodeTypename t_typename;
|
GEN_API extern CodeTypename t_typename;
|
||||||
|
|
||||||
#ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
#ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||||
// Predefined typename codes. Are set to readonly and are setup during gen::init()
|
// Predefined typename codes. Are set to readonly and are setup during gen::init()
|
||||||
extern Context* _ctx;
|
GEN_API extern Context* _ctx;
|
||||||
|
|
||||||
extern CodeTypename t_b32;
|
GEN_API extern CodeTypename t_b32;
|
||||||
|
|
||||||
extern CodeTypename t_s8;
|
GEN_API extern CodeTypename t_s8;
|
||||||
extern CodeTypename t_s16;
|
GEN_API extern CodeTypename t_s16;
|
||||||
extern CodeTypename t_s32;
|
GEN_API extern CodeTypename t_s32;
|
||||||
extern CodeTypename t_s64;
|
GEN_API extern CodeTypename t_s64;
|
||||||
|
|
||||||
extern CodeTypename t_u8;
|
GEN_API extern CodeTypename t_u8;
|
||||||
extern CodeTypename t_u16;
|
GEN_API extern CodeTypename t_u16;
|
||||||
extern CodeTypename t_u32;
|
GEN_API extern CodeTypename t_u32;
|
||||||
extern CodeTypename t_u64;
|
GEN_API extern CodeTypename t_u64;
|
||||||
|
|
||||||
extern CodeTypename t_ssize;
|
GEN_API extern CodeTypename t_ssize;
|
||||||
extern CodeTypename t_usize;
|
GEN_API extern CodeTypename t_usize;
|
||||||
|
|
||||||
extern CodeTypename t_f32;
|
GEN_API extern CodeTypename t_f32;
|
||||||
extern CodeTypename t_f64;
|
GEN_API extern CodeTypename t_f64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma endregion Constants
|
#pragma endregion Constants
|
||||||
|
@ -181,7 +181,7 @@ enum EMacroFlags : u16
|
|||||||
// & it would allow UE_DEPRECATED, (UE_PROPERTY / UE_FUNCTION) to chain themselves as attributes of a resolved member function/variable definition
|
// & it would allow UE_DEPRECATED, (UE_PROPERTY / UE_FUNCTION) to chain themselves as attributes of a resolved member function/variable definition
|
||||||
MF_Allow_As_Attribute = bit(3),
|
MF_Allow_As_Attribute = bit(3),
|
||||||
|
|
||||||
// When a macro is encountered after attributs and specifiers while parsing a function, or variable:
|
// When a macro is encountered after attributes and specifiers while parsing a function, or variable:
|
||||||
// It will consume the macro and treat it as resolving the definition. (Yes this is for Unreal Engine)
|
// It will consume the macro and treat it as resolving the definition. (Yes this is for Unreal Engine)
|
||||||
// (MUST BE OF MT_Statement TYPE)
|
// (MUST BE OF MT_Statement TYPE)
|
||||||
MF_Allow_As_Definition = bit(4),
|
MF_Allow_As_Definition = bit(4),
|
||||||
|
@ -4,87 +4,87 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region StaticData
|
#pragma region StaticData
|
||||||
global Context* _ctx;
|
GEN_API global Context* _ctx;
|
||||||
global u32 context_counter;
|
GEN_API global u32 context_counter;
|
||||||
|
|
||||||
#pragma region Constants
|
#pragma region Constants
|
||||||
global Macro enum_underlying_macro;
|
GEN_API global Macro enum_underlying_macro;
|
||||||
|
|
||||||
global Code Code_Global;
|
GEN_API global Code Code_Global;
|
||||||
global Code Code_Invalid;
|
GEN_API global Code Code_Invalid;
|
||||||
|
|
||||||
global Code access_public;
|
GEN_API global Code access_public;
|
||||||
global Code access_protected;
|
GEN_API global Code access_protected;
|
||||||
global Code access_private;
|
GEN_API global Code access_private;
|
||||||
|
|
||||||
global CodeAttributes attrib_api_export;
|
GEN_API global CodeAttributes attrib_api_export;
|
||||||
global CodeAttributes attrib_api_import;
|
GEN_API global CodeAttributes attrib_api_import;
|
||||||
|
|
||||||
global Code module_global_fragment;
|
GEN_API global Code module_global_fragment;
|
||||||
global Code module_private_fragment;
|
GEN_API global Code module_private_fragment;
|
||||||
|
|
||||||
global Code fmt_newline;
|
GEN_API global Code fmt_newline;
|
||||||
|
|
||||||
global CodeParams param_varadic;
|
GEN_API global CodeParams param_varadic;
|
||||||
|
|
||||||
global CodePragma pragma_once;
|
GEN_API global CodePragma pragma_once;
|
||||||
|
|
||||||
global CodePreprocessCond preprocess_else;
|
GEN_API global CodePreprocessCond preprocess_else;
|
||||||
global CodePreprocessCond preprocess_endif;
|
GEN_API global CodePreprocessCond preprocess_endif;
|
||||||
|
|
||||||
global CodeSpecifiers spec_const;
|
GEN_API global CodeSpecifiers spec_const;
|
||||||
global CodeSpecifiers spec_consteval;
|
GEN_API global CodeSpecifiers spec_consteval;
|
||||||
global CodeSpecifiers spec_constexpr;
|
GEN_API global CodeSpecifiers spec_constexpr;
|
||||||
global CodeSpecifiers spec_constinit;
|
GEN_API global CodeSpecifiers spec_constinit;
|
||||||
global CodeSpecifiers spec_extern_linkage;
|
GEN_API global CodeSpecifiers spec_extern_linkage;
|
||||||
global CodeSpecifiers spec_final;
|
GEN_API global CodeSpecifiers spec_final;
|
||||||
global CodeSpecifiers spec_forceinline;
|
GEN_API global CodeSpecifiers spec_forceinline;
|
||||||
global CodeSpecifiers spec_global;
|
GEN_API global CodeSpecifiers spec_global;
|
||||||
global CodeSpecifiers spec_inline;
|
GEN_API global CodeSpecifiers spec_inline;
|
||||||
global CodeSpecifiers spec_internal_linkage;
|
GEN_API global CodeSpecifiers spec_internal_linkage;
|
||||||
global CodeSpecifiers spec_local_persist;
|
GEN_API global CodeSpecifiers spec_local_persist;
|
||||||
global CodeSpecifiers spec_mutable;
|
GEN_API global CodeSpecifiers spec_mutable;
|
||||||
global CodeSpecifiers spec_noexcept;
|
GEN_API global CodeSpecifiers spec_noexcept;
|
||||||
global CodeSpecifiers spec_neverinline;
|
GEN_API global CodeSpecifiers spec_neverinline;
|
||||||
global CodeSpecifiers spec_override;
|
GEN_API global CodeSpecifiers spec_override;
|
||||||
global CodeSpecifiers spec_ptr;
|
GEN_API global CodeSpecifiers spec_ptr;
|
||||||
global CodeSpecifiers spec_pure;
|
GEN_API global CodeSpecifiers spec_pure;
|
||||||
global CodeSpecifiers spec_ref;
|
GEN_API global CodeSpecifiers spec_ref;
|
||||||
global CodeSpecifiers spec_register;
|
GEN_API global CodeSpecifiers spec_register;
|
||||||
global CodeSpecifiers spec_rvalue;
|
GEN_API global CodeSpecifiers spec_rvalue;
|
||||||
global CodeSpecifiers spec_static_member;
|
GEN_API global CodeSpecifiers spec_static_member;
|
||||||
global CodeSpecifiers spec_thread_local;
|
GEN_API global CodeSpecifiers spec_thread_local;
|
||||||
global CodeSpecifiers spec_virtual;
|
GEN_API global CodeSpecifiers spec_virtual;
|
||||||
global CodeSpecifiers spec_volatile;
|
GEN_API global CodeSpecifiers spec_volatile;
|
||||||
|
|
||||||
global CodeTypename t_empty;
|
GEN_API global CodeTypename t_empty;
|
||||||
global CodeTypename t_auto;
|
GEN_API global CodeTypename t_auto;
|
||||||
global CodeTypename t_void;
|
GEN_API global CodeTypename t_void;
|
||||||
global CodeTypename t_int;
|
GEN_API global CodeTypename t_int;
|
||||||
global CodeTypename t_bool;
|
GEN_API global CodeTypename t_bool;
|
||||||
global CodeTypename t_char;
|
GEN_API global CodeTypename t_char;
|
||||||
global CodeTypename t_wchar_t;
|
GEN_API global CodeTypename t_wchar_t;
|
||||||
global CodeTypename t_class;
|
GEN_API global CodeTypename t_class;
|
||||||
global CodeTypename t_typename;
|
GEN_API global CodeTypename t_typename;
|
||||||
|
|
||||||
#ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
#ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||||
global CodeTypename t_b32;
|
GEN_API global CodeTypename t_b32;
|
||||||
|
|
||||||
global CodeTypename t_s8;
|
GEN_API global CodeTypename t_s8;
|
||||||
global CodeTypename t_s16;
|
GEN_API global CodeTypename t_s16;
|
||||||
global CodeTypename t_s32;
|
GEN_API global CodeTypename t_s32;
|
||||||
global CodeTypename t_s64;
|
GEN_API global CodeTypename t_s64;
|
||||||
|
|
||||||
global CodeTypename t_u8;
|
GEN_API global CodeTypename t_u8;
|
||||||
global CodeTypename t_u16;
|
GEN_API global CodeTypename t_u16;
|
||||||
global CodeTypename t_u32;
|
GEN_API global CodeTypename t_u32;
|
||||||
global CodeTypename t_u64;
|
GEN_API global CodeTypename t_u64;
|
||||||
|
|
||||||
global CodeTypename t_ssize;
|
GEN_API global CodeTypename t_ssize;
|
||||||
global CodeTypename t_usize;
|
GEN_API global CodeTypename t_usize;
|
||||||
|
|
||||||
global CodeTypename t_f32;
|
GEN_API global CodeTypename t_f32;
|
||||||
global CodeTypename t_f64;
|
GEN_API global CodeTypename t_f64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma endregion Constants
|
#pragma endregion Constants
|
||||||
|
@ -67,8 +67,8 @@
|
|||||||
while (0)
|
while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void assert_handler( char const* condition, char const* file, char const* function, s32 line, char const* msg, ... );
|
GEN_API void assert_handler( char const* condition, char const* file, char const* function, s32 line, char const* msg, ... );
|
||||||
s32 assert_crash( char const* condition );
|
GEN_API s32 assert_crash( char const* condition );
|
||||||
void process_exit( u32 code );
|
GEN_API void process_exit( u32 code );
|
||||||
|
|
||||||
#pragma endregion Debug
|
#pragma endregion Debug
|
||||||
|
@ -121,13 +121,13 @@ enum FileStandardType
|
|||||||
* @param std Check zpl_file_standard_type
|
* @param std Check zpl_file_standard_type
|
||||||
* @return File handle to standard I/O
|
* @return File handle to standard I/O
|
||||||
*/
|
*/
|
||||||
FileInfo* file_get_standard( FileStandardType std );
|
GEN_API FileInfo* file_get_standard( FileStandardType std );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the file
|
* Closes the file
|
||||||
* @param file
|
* @param file
|
||||||
*/
|
*/
|
||||||
FileError file_close( FileInfo* file );
|
GEN_API FileError file_close( FileInfo* file );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently opened file's name
|
* Returns the currently opened file's name
|
||||||
@ -144,7 +144,7 @@ inline
|
|||||||
* @param file
|
* @param file
|
||||||
* @param filename
|
* @param filename
|
||||||
*/
|
*/
|
||||||
FileError file_open( FileInfo* file, char const* filename );
|
GEN_API FileError file_open( FileInfo* file, char const* filename );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a file using a specified mode
|
* Opens a file using a specified mode
|
||||||
@ -152,7 +152,7 @@ FileError file_open( FileInfo* file, char const* filename );
|
|||||||
* @param mode Access mode to use
|
* @param mode Access mode to use
|
||||||
* @param filename
|
* @param filename
|
||||||
*/
|
*/
|
||||||
FileError file_open_mode( FileInfo* file, FileMode mode, char const* filename );
|
GEN_API FileError file_open_mode( FileInfo* file, FileMode mode, char const* filename );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads from a file
|
* Reads from a file
|
||||||
@ -200,14 +200,14 @@ constexpr b32 file_no_zero_terminate = false;
|
|||||||
* @param filepath Path to the file
|
* @param filepath Path to the file
|
||||||
* @return File contents data
|
* @return File contents data
|
||||||
*/
|
*/
|
||||||
FileContents file_read_contents( AllocatorInfo a, b32 zero_terminate, char const* filepath );
|
GEN_API FileContents file_read_contents( AllocatorInfo a, b32 zero_terminate, char const* filepath );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a size of the file
|
* Returns a size of the file
|
||||||
* @param file
|
* @param file
|
||||||
* @return File size
|
* @return File size
|
||||||
*/
|
*/
|
||||||
s64 file_size( FileInfo* file );
|
GEN_API s64 file_size( FileInfo* file );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seeks the file cursor from the beginning of file to a specific position
|
* Seeks the file cursor from the beginning of file to a specific position
|
||||||
@ -274,7 +274,7 @@ enum FileStreamFlags : u32
|
|||||||
* @param file
|
* @param file
|
||||||
* @param allocator
|
* @param allocator
|
||||||
*/
|
*/
|
||||||
b8 file_stream_new( FileInfo* file, AllocatorInfo allocator );
|
GEN_API b8 file_stream_new( FileInfo* file, AllocatorInfo allocator );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a memory stream over an existing buffer
|
* Opens a memory stream over an existing buffer
|
||||||
@ -284,14 +284,14 @@ b8 file_stream_new( FileInfo* file, AllocatorInfo allocator );
|
|||||||
* @param size Buffer's size
|
* @param size Buffer's size
|
||||||
* @param flags
|
* @param flags
|
||||||
*/
|
*/
|
||||||
b8 file_stream_open( FileInfo* file, AllocatorInfo allocator, u8* buffer, ssize size, FileStreamFlags flags );
|
GEN_API b8 file_stream_open( FileInfo* file, AllocatorInfo allocator, u8* buffer, ssize size, FileStreamFlags flags );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the stream's underlying buffer and buffer size.
|
* Retrieves the stream's underlying buffer and buffer size.
|
||||||
* @param file memory stream
|
* @param file memory stream
|
||||||
* @param size (Optional) buffer size
|
* @param size (Optional) buffer size
|
||||||
*/
|
*/
|
||||||
u8* file_stream_buf( FileInfo* file, ssize* size );
|
GEN_API u8* file_stream_buf( FileInfo* file, ssize* size );
|
||||||
|
|
||||||
extern FileOperations const memory_file_operations;
|
extern FileOperations const memory_file_operations;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#pragma region Hashing
|
#pragma region Hashing
|
||||||
|
|
||||||
u32 crc32( void const* data, ssize len );
|
GEN_API u32 crc32( void const* data, ssize len );
|
||||||
u64 crc64( void const* data, ssize len );
|
GEN_API u64 crc64( void const* data, ssize len );
|
||||||
|
|
||||||
#pragma endregion Hashing
|
#pragma endregion Hashing
|
||||||
|
@ -41,10 +41,10 @@ void const* pointer_add_const( void const* ptr, ssize bytes );
|
|||||||
ssize pointer_diff( void const* begin, void const* end );
|
ssize pointer_diff( void const* begin, void const* end );
|
||||||
|
|
||||||
//! Copy non-overlapping memory from source to destination.
|
//! Copy non-overlapping memory from source to destination.
|
||||||
void* mem_copy( void* dest, void const* source, ssize size );
|
GEN_API void* mem_copy( void* dest, void const* source, ssize size );
|
||||||
|
|
||||||
//! Search for a constant value within the size limit at memory location.
|
//! Search for a constant value within the size limit at memory location.
|
||||||
void const* mem_find( void const* data, u8 byte_value, ssize size );
|
GEN_API void const* mem_find( void const* data, u8 byte_value, ssize size );
|
||||||
|
|
||||||
//! Copy memory from source to destination.
|
//! Copy memory from source to destination.
|
||||||
void* mem_move( void* dest, void const* source, ssize size );
|
void* mem_move( void* dest, void const* source, ssize size );
|
||||||
@ -119,17 +119,17 @@ void* resize_align( AllocatorInfo a, void* ptr, ssize old_size, ssize new_size,
|
|||||||
/* define GEN_HEAP_ANALYSIS to enable this feature */
|
/* define GEN_HEAP_ANALYSIS to enable this feature */
|
||||||
/* call zpl_heap_stats_init at the beginning of the entry point */
|
/* call zpl_heap_stats_init at the beginning of the entry point */
|
||||||
/* you can call zpl_heap_stats_check near the end of the execution to validate any possible leaks */
|
/* you can call zpl_heap_stats_check near the end of the execution to validate any possible leaks */
|
||||||
void heap_stats_init( void );
|
GEN_API void heap_stats_init( void );
|
||||||
ssize heap_stats_used_memory( void );
|
GEN_API ssize heap_stats_used_memory( void );
|
||||||
ssize heap_stats_alloc_count( void );
|
GEN_API ssize heap_stats_alloc_count( void );
|
||||||
void heap_stats_check( void );
|
GEN_API void heap_stats_check( void );
|
||||||
|
|
||||||
//! Allocate/Resize memory using default options.
|
//! Allocate/Resize memory using default options.
|
||||||
|
|
||||||
//! Use this if you don't need a "fancy" resize allocation
|
//! Use this if you don't need a "fancy" resize allocation
|
||||||
void* default_resize_align( AllocatorInfo a, void* ptr, ssize old_size, ssize new_size, ssize alignment );
|
void* default_resize_align( AllocatorInfo a, void* ptr, ssize old_size, ssize new_size, ssize alignment );
|
||||||
|
|
||||||
void* heap_allocator_proc( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags );
|
GEN_API void* heap_allocator_proc( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags );
|
||||||
|
|
||||||
//! The heap allocator backed by operating system's memory manager.
|
//! The heap allocator backed by operating system's memory manager.
|
||||||
constexpr AllocatorInfo heap( void ) { AllocatorInfo allocator = { heap_allocator_proc, nullptr }; return allocator; }
|
constexpr AllocatorInfo heap( void ) { AllocatorInfo allocator = { heap_allocator_proc, nullptr }; return allocator; }
|
||||||
@ -147,25 +147,25 @@ struct VirtualMemory
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Initialize virtual memory from existing data.
|
//! Initialize virtual memory from existing data.
|
||||||
VirtualMemory vm_from_memory( void* data, ssize size );
|
GEN_API VirtualMemory vm_from_memory( void* data, ssize size );
|
||||||
|
|
||||||
//! Allocate virtual memory at address with size.
|
//! Allocate virtual memory at address with size.
|
||||||
|
|
||||||
//! @param addr The starting address of the region to reserve. If NULL, it lets operating system to decide where to allocate it.
|
//! @param addr The starting address of the region to reserve. If NULL, it lets operating system to decide where to allocate it.
|
||||||
//! @param size The size to serve.
|
//! @param size The size to serve.
|
||||||
VirtualMemory vm_alloc( void* addr, ssize size );
|
GEN_API VirtualMemory vm_alloc( void* addr, ssize size );
|
||||||
|
|
||||||
//! Release the virtual memory.
|
//! Release the virtual memory.
|
||||||
b32 vm_free( VirtualMemory vm );
|
GEN_API b32 vm_free( VirtualMemory vm );
|
||||||
|
|
||||||
//! Trim virtual memory.
|
//! Trim virtual memory.
|
||||||
VirtualMemory vm_trim( VirtualMemory vm, ssize lead_size, ssize size );
|
GEN_API VirtualMemory vm_trim( VirtualMemory vm, ssize lead_size, ssize size );
|
||||||
|
|
||||||
//! Purge virtual memory.
|
//! Purge virtual memory.
|
||||||
b32 vm_purge( VirtualMemory vm );
|
GEN_API b32 vm_purge( VirtualMemory vm );
|
||||||
|
|
||||||
//! Retrieve VM's page size and alignment.
|
//! Retrieve VM's page size and alignment.
|
||||||
ssize virtual_memory_page_size( ssize* alignment_out );
|
GEN_API ssize virtual_memory_page_size( ssize* alignment_out );
|
||||||
|
|
||||||
#pragma region Arena
|
#pragma region Arena
|
||||||
struct Arena;
|
struct Arena;
|
||||||
@ -173,7 +173,7 @@ struct Arena;
|
|||||||
AllocatorInfo arena_allocator_info( Arena* arena );
|
AllocatorInfo arena_allocator_info( Arena* arena );
|
||||||
|
|
||||||
// Remove static keyword and rename allocator_proc
|
// Remove static keyword and rename allocator_proc
|
||||||
void* arena_allocator_proc(void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags);
|
GEN_API void* arena_allocator_proc(void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags);
|
||||||
|
|
||||||
// Add these declarations after the Arena struct
|
// Add these declarations after the Arena struct
|
||||||
Arena arena_init_from_allocator(AllocatorInfo backing, ssize size);
|
Arena arena_init_from_allocator(AllocatorInfo backing, ssize size);
|
||||||
@ -382,12 +382,12 @@ using FixedArena_4MB = FixedArena< megabytes( 4 ) >;
|
|||||||
#pragma region Pool
|
#pragma region Pool
|
||||||
struct Pool;
|
struct Pool;
|
||||||
|
|
||||||
void* pool_allocator_proc(void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags);
|
GEN_API void* pool_allocator_proc(void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags);
|
||||||
|
|
||||||
Pool pool_init(AllocatorInfo backing, ssize num_blocks, ssize block_size);
|
Pool pool_init(AllocatorInfo backing, ssize num_blocks, ssize block_size);
|
||||||
Pool pool_init_align(AllocatorInfo backing, ssize num_blocks, ssize block_size, ssize block_align);
|
Pool pool_init_align(AllocatorInfo backing, ssize num_blocks, ssize block_size, ssize block_align);
|
||||||
AllocatorInfo pool_allocator_info(Pool* pool);
|
AllocatorInfo pool_allocator_info(Pool* pool);
|
||||||
void pool_clear(Pool* pool);
|
GEN_API void pool_clear(Pool* pool);
|
||||||
void pool_free(Pool* pool);
|
void pool_free(Pool* pool);
|
||||||
|
|
||||||
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
||||||
|
@ -122,7 +122,7 @@ struct ADT_Node
|
|||||||
* @param is_array
|
* @param is_array
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
u8 adt_make_branch( ADT_Node* node, AllocatorInfo backing, char const* name, b32 is_array );
|
GEN_API u8 adt_make_branch( ADT_Node* node, AllocatorInfo backing, char const* name, b32 is_array );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy an ADT branch and its descendants
|
* @brief Destroy an ADT branch and its descendants
|
||||||
@ -130,7 +130,7 @@ u8 adt_make_branch( ADT_Node* node, AllocatorInfo backing, char const* name, b32
|
|||||||
* @param node
|
* @param node
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
u8 adt_destroy_branch( ADT_Node* node );
|
GEN_API u8 adt_destroy_branch( ADT_Node* node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise an ADT leaf
|
* @brief Initialise an ADT leaf
|
||||||
@ -140,7 +140,7 @@ u8 adt_destroy_branch( ADT_Node* node );
|
|||||||
* @param type Node's type (use zpl_adt_make_branch for container nodes)
|
* @param type Node's type (use zpl_adt_make_branch for container nodes)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
u8 adt_make_leaf( ADT_Node* node, char const* name, ADT_Type type );
|
GEN_API u8 adt_make_leaf( ADT_Node* node, char const* name, ADT_Type type );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +160,7 @@ u8 adt_make_leaf( ADT_Node* node, char const* name, ADT_Type type );
|
|||||||
*
|
*
|
||||||
* @see code/apps/examples/json_get.c
|
* @see code/apps/examples/json_get.c
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_query( ADT_Node* node, char const* uri );
|
GEN_API ADT_Node* adt_query( ADT_Node* node, char const* uri );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Find a field node within an object by the given name.
|
* @brief Find a field node within an object by the given name.
|
||||||
@ -170,7 +170,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri );
|
|||||||
* @param deep_search Perform search recursively
|
* @param deep_search Perform search recursively
|
||||||
* @return zpl_adt_node * node
|
* @return zpl_adt_node * node
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
|
GEN_API ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocate an unitialised node within a container at a specified index.
|
* @brief Allocate an unitialised node within a container at a specified index.
|
||||||
@ -179,7 +179,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
|
|||||||
* @param index
|
* @param index
|
||||||
* @return zpl_adt_node * node
|
* @return zpl_adt_node * node
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
|
GEN_API ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocate an unitialised node within a container.
|
* @brief Allocate an unitialised node within a container.
|
||||||
@ -187,7 +187,7 @@ ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
|
|||||||
* @param parent
|
* @param parent
|
||||||
* @return zpl_adt_node * node
|
* @return zpl_adt_node * node
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_alloc( ADT_Node* parent );
|
GEN_API ADT_Node* adt_alloc( ADT_Node* parent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Move an existing node to a new container at a specified index.
|
* @brief Move an existing node to a new container at a specified index.
|
||||||
@ -197,7 +197,7 @@ ADT_Node* adt_alloc( ADT_Node* parent );
|
|||||||
* @param index
|
* @param index
|
||||||
* @return zpl_adt_node * node
|
* @return zpl_adt_node * node
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
|
GEN_API ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Move an existing node to a new container.
|
* @brief Move an existing node to a new container.
|
||||||
@ -206,7 +206,7 @@ ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
|
|||||||
* @param new_parent
|
* @param new_parent
|
||||||
* @return zpl_adt_node * node
|
* @return zpl_adt_node * node
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_move_node( ADT_Node* node, ADT_Node* new_parent );
|
GEN_API ADT_Node* adt_move_node( ADT_Node* node, ADT_Node* new_parent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Swap two nodes.
|
* @brief Swap two nodes.
|
||||||
@ -215,7 +215,7 @@ ADT_Node* adt_move_node( ADT_Node* node, ADT_Node* new_parent );
|
|||||||
* @param other_node
|
* @param other_node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node );
|
GEN_API void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove node from container.
|
* @brief Remove node from container.
|
||||||
@ -223,7 +223,7 @@ void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node );
|
|||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void adt_remove_node( ADT_Node* node );
|
GEN_API void adt_remove_node( ADT_Node* node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise a node as an object
|
* @brief Initialise a node as an object
|
||||||
@ -233,7 +233,7 @@ void adt_remove_node( ADT_Node* node );
|
|||||||
* @param backing
|
* @param backing
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
b8 adt_set_obj( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
GEN_API b8 adt_set_obj( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise a node as an array
|
* @brief Initialise a node as an array
|
||||||
@ -243,7 +243,7 @@ b8 adt_set_obj( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
|||||||
* @param backing
|
* @param backing
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
b8 adt_set_arr( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
GEN_API b8 adt_set_arr( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise a node as a string
|
* @brief Initialise a node as a string
|
||||||
@ -253,7 +253,7 @@ b8 adt_set_arr( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
b8 adt_set_str( ADT_Node* obj, char const* name, char const* value );
|
GEN_API b8 adt_set_str( ADT_Node* obj, char const* name, char const* value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise a node as a float
|
* @brief Initialise a node as a float
|
||||||
@ -263,7 +263,7 @@ b8 adt_set_str( ADT_Node* obj, char const* name, char const* value );
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
b8 adt_set_flt( ADT_Node* obj, char const* name, f64 value );
|
GEN_API b8 adt_set_flt( ADT_Node* obj, char const* name, f64 value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise a node as a signed integer
|
* @brief Initialise a node as a signed integer
|
||||||
@ -273,7 +273,7 @@ b8 adt_set_flt( ADT_Node* obj, char const* name, f64 value );
|
|||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
b8 adt_set_int( ADT_Node* obj, char const* name, s64 value );
|
GEN_API b8 adt_set_int( ADT_Node* obj, char const* name, s64 value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a new node to a container as an object
|
* @brief Append a new node to a container as an object
|
||||||
@ -282,7 +282,7 @@ b8 adt_set_int( ADT_Node* obj, char const* name, s64 value );
|
|||||||
* @param name
|
* @param name
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_append_obj( ADT_Node* parent, char const* name );
|
GEN_API ADT_Node* adt_append_obj( ADT_Node* parent, char const* name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a new node to a container as an array
|
* @brief Append a new node to a container as an array
|
||||||
@ -291,7 +291,7 @@ ADT_Node* adt_append_obj( ADT_Node* parent, char const* name );
|
|||||||
* @param name
|
* @param name
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_append_arr( ADT_Node* parent, char const* name );
|
GEN_API ADT_Node* adt_append_arr( ADT_Node* parent, char const* name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a new node to a container as a string
|
* @brief Append a new node to a container as a string
|
||||||
@ -301,7 +301,7 @@ ADT_Node* adt_append_arr( ADT_Node* parent, char const* name );
|
|||||||
* @param value
|
* @param value
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_append_str( ADT_Node* parent, char const* name, char const* value );
|
GEN_API ADT_Node* adt_append_str( ADT_Node* parent, char const* name, char const* value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a new node to a container as a float
|
* @brief Append a new node to a container as a float
|
||||||
@ -311,7 +311,7 @@ ADT_Node* adt_append_str( ADT_Node* parent, char const* name, char const* value
|
|||||||
* @param value
|
* @param value
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_append_flt( ADT_Node* parent, char const* name, f64 value );
|
GEN_API ADT_Node* adt_append_flt( ADT_Node* parent, char const* name, f64 value );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a new node to a container as a signed integer
|
* @brief Append a new node to a container as a signed integer
|
||||||
@ -321,7 +321,7 @@ ADT_Node* adt_append_flt( ADT_Node* parent, char const* name, f64 value );
|
|||||||
* @param value
|
* @param value
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
ADT_Node* adt_append_int( ADT_Node* parent, char const* name, s64 value );
|
GEN_API ADT_Node* adt_append_int( ADT_Node* parent, char const* name, s64 value );
|
||||||
|
|
||||||
/* parser helpers */
|
/* parser helpers */
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ ADT_Node* adt_append_int( ADT_Node* parent, char const* name, s64 value );
|
|||||||
* @param base
|
* @param base
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
char* adt_parse_number( ADT_Node* node, char* base );
|
GEN_API char* adt_parse_number( ADT_Node* node, char* base );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses a text and stores the result into an unitialised node.
|
* @brief Parses a text and stores the result into an unitialised node.
|
||||||
@ -342,7 +342,7 @@ char* adt_parse_number( ADT_Node* node, char* base );
|
|||||||
* @param base
|
* @param base
|
||||||
* @return*
|
* @return*
|
||||||
*/
|
*/
|
||||||
char* adt_parse_number_strict( ADT_Node* node, char* base_str );
|
GEN_API char* adt_parse_number_strict( ADT_Node* node, char* base_str );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses and converts an existing string node into a number.
|
* @brief Parses and converts an existing string node into a number.
|
||||||
@ -350,7 +350,7 @@ char* adt_parse_number_strict( ADT_Node* node, char* base_str );
|
|||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ADT_Error adt_c_str_to_number( ADT_Node* node );
|
GEN_API ADT_Error adt_c_str_to_number( ADT_Node* node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses and converts an existing string node into a number.
|
* @brief Parses and converts an existing string node into a number.
|
||||||
@ -359,7 +359,7 @@ ADT_Error adt_c_str_to_number( ADT_Node* node );
|
|||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ADT_Error adt_c_str_to_number_strict( ADT_Node* node );
|
GEN_API ADT_Error adt_c_str_to_number_strict( ADT_Node* node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints a number into a file stream.
|
* @brief Prints a number into a file stream.
|
||||||
@ -371,7 +371,7 @@ ADT_Error adt_c_str_to_number_strict( ADT_Node* node );
|
|||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ADT_Error adt_print_number( FileInfo* file, ADT_Node* node );
|
GEN_API ADT_Error adt_print_number( FileInfo* file, ADT_Node* node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints a string into a file stream.
|
* @brief Prints a string into a file stream.
|
||||||
@ -385,7 +385,7 @@ ADT_Error adt_print_number( FileInfo* file, ADT_Node* node );
|
|||||||
* @param escape_symbol
|
* @param escape_symbol
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ADT_Error adt_print_string( FileInfo* file, ADT_Node* node, char const* escaped_chars, char const* escape_symbol );
|
GEN_API ADT_Error adt_print_string( FileInfo* file, ADT_Node* node, char const* escaped_chars, char const* escape_symbol );
|
||||||
|
|
||||||
#pragma endregion ADT
|
#pragma endregion ADT
|
||||||
|
|
||||||
@ -402,13 +402,13 @@ enum CSV_Error : u32
|
|||||||
typedef ADT_Node CSV_Object;
|
typedef ADT_Node CSV_Object;
|
||||||
|
|
||||||
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
|
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
|
||||||
u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim );
|
GEN_API u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim );
|
||||||
void csv_free( CSV_Object* obj );
|
void csv_free( CSV_Object* obj );
|
||||||
|
|
||||||
void csv_write( FileInfo* file, CSV_Object* obj );
|
void csv_write( FileInfo* file, CSV_Object* obj );
|
||||||
StrBuilder csv_write_string( AllocatorInfo a, CSV_Object* obj );
|
StrBuilder csv_write_string( AllocatorInfo a, CSV_Object* obj );
|
||||||
void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delim );
|
GEN_API void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delim );
|
||||||
StrBuilder csv_write_strbuilder_delimiter( AllocatorInfo a, CSV_Object* obj, char delim );
|
GEN_API StrBuilder csv_write_strbuilder_delimiter( AllocatorInfo a, CSV_Object* obj, char delim );
|
||||||
|
|
||||||
/* inline */
|
/* inline */
|
||||||
|
|
||||||
|
@ -13,15 +13,15 @@ typedef struct FileInfo FileInfo;
|
|||||||
typedef char PrintF_Buffer[GEN_PRINTF_MAXLEN];
|
typedef char PrintF_Buffer[GEN_PRINTF_MAXLEN];
|
||||||
|
|
||||||
// NOTE: A locally persisting buffer is used internally
|
// NOTE: A locally persisting buffer is used internally
|
||||||
char* c_str_fmt_buf ( char const* fmt, ... );
|
GEN_API char* c_str_fmt_buf ( char const* fmt, ... );
|
||||||
char* c_str_fmt_buf_va ( char const* fmt, va_list va );
|
GEN_API char* c_str_fmt_buf_va ( char const* fmt, va_list va );
|
||||||
ssize c_str_fmt ( char* str, ssize n, char const* fmt, ... );
|
GEN_API ssize c_str_fmt ( char* str, ssize n, char const* fmt, ... );
|
||||||
ssize c_str_fmt_va ( char* str, ssize n, char const* fmt, va_list va );
|
GEN_API ssize c_str_fmt_va ( char* str, ssize n, char const* fmt, va_list va );
|
||||||
ssize c_str_fmt_out_va ( char const* fmt, va_list va );
|
GEN_API ssize c_str_fmt_out_va ( char const* fmt, va_list va );
|
||||||
ssize c_str_fmt_out_err ( char const* fmt, ... );
|
GEN_API ssize c_str_fmt_out_err ( char const* fmt, ... );
|
||||||
ssize c_str_fmt_out_err_va( char const* fmt, va_list va );
|
GEN_API ssize c_str_fmt_out_err_va( char const* fmt, va_list va );
|
||||||
ssize c_str_fmt_file ( FileInfo* f, char const* fmt, ... );
|
GEN_API ssize c_str_fmt_file ( FileInfo* f, char const* fmt, ... );
|
||||||
ssize c_str_fmt_file_va ( FileInfo* f, char const* fmt, va_list va );
|
GEN_API ssize c_str_fmt_file_va ( FileInfo* f, char const* fmt, va_list va );
|
||||||
|
|
||||||
constexpr
|
constexpr
|
||||||
char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
||||||
|
@ -33,10 +33,10 @@ char const* c_str_trim( char const* str, b32 catch_newline );
|
|||||||
void c_str_to_lower( char* str );
|
void c_str_to_lower( char* str );
|
||||||
void c_str_to_upper( char* str );
|
void c_str_to_upper( char* str );
|
||||||
|
|
||||||
s64 c_str_to_i64( const char* str, char** end_ptr, s32 base );
|
GEN_API s64 c_str_to_i64( const char* str, char** end_ptr, s32 base );
|
||||||
void i64_to_str( s64 value, char* string, s32 base );
|
GEN_API void i64_to_str( s64 value, char* string, s32 base );
|
||||||
void u64_to_str( u64 value, char* string, s32 base );
|
GEN_API void u64_to_str( u64 value, char* string, s32 base );
|
||||||
f64 c_str_to_f64( const char* str, char** end_ptr );
|
GEN_API f64 c_str_to_f64( const char* str, char** end_ptr );
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const char* char_first_occurence( const char* s, char c )
|
const char* char_first_occurence( const char* s, char c )
|
||||||
|
@ -122,10 +122,11 @@ struct StrBuilder;
|
|||||||
|
|
||||||
forceinline usize strbuilder_grow_formula(usize value);
|
forceinline usize strbuilder_grow_formula(usize value);
|
||||||
|
|
||||||
|
GEN_API StrBuilder strbuilder_make_reserve (AllocatorInfo allocator, ssize capacity);
|
||||||
|
GEN_API StrBuilder strbuilder_make_length (AllocatorInfo allocator, char const* str, ssize length);
|
||||||
|
|
||||||
StrBuilder strbuilder_make_c_str (AllocatorInfo allocator, char const* str);
|
StrBuilder strbuilder_make_c_str (AllocatorInfo allocator, char const* str);
|
||||||
StrBuilder strbuilder_make_str (AllocatorInfo allocator, Str str);
|
StrBuilder strbuilder_make_str (AllocatorInfo allocator, Str str);
|
||||||
StrBuilder strbuilder_make_reserve (AllocatorInfo allocator, ssize capacity);
|
|
||||||
StrBuilder strbuilder_make_length (AllocatorInfo allocator, char const* str, ssize length);
|
|
||||||
StrBuilder strbuilder_fmt (AllocatorInfo allocator, char* buf, ssize buf_size, char const* fmt, ...);
|
StrBuilder strbuilder_fmt (AllocatorInfo allocator, char* buf, ssize buf_size, char const* fmt, ...);
|
||||||
StrBuilder strbuilder_fmt_buf (AllocatorInfo allocator, char const* fmt, ...);
|
StrBuilder strbuilder_fmt_buf (AllocatorInfo allocator, char const* fmt, ...);
|
||||||
StrBuilder strbuilder_join (AllocatorInfo allocator, char const** parts, ssize num_parts, char const* glue);
|
StrBuilder strbuilder_join (AllocatorInfo allocator, char const** parts, ssize num_parts, char const* glue);
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
#ifdef GEN_BENCHMARK
|
#ifdef GEN_BENCHMARK
|
||||||
//! Return CPU timestamp.
|
//! Return CPU timestamp.
|
||||||
u64 read_cpu_time_stamp_counter( void );
|
GEN_API u64 read_cpu_time_stamp_counter( void );
|
||||||
|
|
||||||
//! Return relative time (in seconds) since the application start.
|
//! Return relative time (in seconds) since the application start.
|
||||||
f64 time_rel( void );
|
GEN_API f64 time_rel( void );
|
||||||
|
|
||||||
//! Return relative time since the application start.
|
//! Return relative time since the application start.
|
||||||
u64 time_rel_ms( void );
|
GEN_API u64 time_rel_ms( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma endregion Timing
|
#pragma endregion Timing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user