Compare commits

..

No commits in common. "0e782cdf99a8c9d2c71dd696779a2a497fb48883" and "cb898595b09d276592aeb788c7b7586b952c1d9f" have entirely different histories.

8 changed files with 79 additions and 184 deletions

View File

@ -73,6 +73,8 @@ The base library itself does not use anything but C-like features to allow for g
Member function support or free-functions with reference object passing are wrapped in `! GEN_C_LIKE CPP` preprocess conditionals.
## C++ template usage
There are only 4 template definitions in the entire library (C++ versions). (`Array<Type>`, `Hashtable<Type>`, `swap<Type>`, and `tmpl_cast<CodeT>(CodeT code)`)

View File

@ -309,6 +309,18 @@ struct Code
Code& operator ++();
// TODO(Ed) : Remove this overload.
auto& operator*()
{
local_persist thread_local
Code NullRef = { nullptr };
if ( ast == nullptr )
return NullRef;
return *this;
}
#ifdef GEN_ENFORCE_STRONG_CODE_TYPES
# define operator explicit operator
#endif

View File

@ -440,6 +440,8 @@ bool array_set_capacity(Array<Type>* array, usize new_capacity)
#pragma endregion Array
// TODO(Ed) : This thing needs ALOT of work.
#pragma region HashTable
#define HashTable(Type) HashTable<Type>

View File

@ -1111,6 +1111,4 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
return output;
}
#undef _adt_fprintf
#pragma endregion CSV

View File

@ -29,6 +29,12 @@
# ifndef GEN_SYSTEM_MACOS
# define GEN_SYSTEM_MACOS 1
# endif
# include <TargetConditionals.h>
# if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
# ifndef GEN_SYSTEM_IOS
# define GEN_SYSTEM_IOS 1
# endif
# endif
#elif defined( __unix__ )
# ifndef GEN_SYSTEM_UNIX
# define GEN_SYSTEM_UNIX 1

View File

@ -1,5 +1,5 @@
// This undefines the macros used by the gen library
#undef GEN_TIME
#if GEN_TIME
// This undefines the macros used by the gen library but are not necessary for the user.
#undef GEN_ARCH_64_BIT
#undef GEN_ARCH_32_BIT
@ -18,116 +18,21 @@
#undef GEN_COMPILER_CLANG
#undef GEN_COMPILER_GCC
#undef GEN_COMPILER_MINGW
#undef GEN_COMPILER_MSVC
#undef GEN_HAS_ATTRIBUTE
#undef GEN_COMPILER_C
#undef GEN_COMPILER_CPP
#undef GEN_DONT_USE_NAMESPACE
#undef GEN_NS_PARSER_BEGIN
#undef GEN_NS_PARSER_END
#undef GEN_USING_NS_PARSER
#undef GEN_NS_PARSER
#undef GEN_NS
#undef GEN_NS_BEGIN
#undef GEN_NS_END
#undef GEN_C_LIKE_CPP
#undef forceinline
#undef neverinline
#undef global
#undef internal
#undef local_persist
#undef bit
#undef bitfield_is_equal
#undef cast
#undef ccast
#undef scast
#undef rcast
#undef pcast
#undef stringize
#undef do_once
#undef do_once_start
#undef do_once_end
#undef labeled_scope_start
#undef labeled_scope_end
#undef compiler_decorated_func_name
#undef num_args_impl
#undef num_args
#undef clamp
#undef count_of
#undef is_between
#undef size_of
#undef max
#undef min
#undef offset_of
#undef forceinline
#undef neverinline
#undef static_assert
#undef thread_local
#undef typeof
#undef GEN_API_C_BEGIN
#undef GEN_API_C_END
#undef enum_underlying
#undef nullptr
#undef GEN_PARAM_DEFAULT
#undef struct_init
#undef GEN_OPTIMIZE_MAPPINGS_BEGIN
#undef GEN_OPITMIZE_MAPPINGS_END
#undef GEN_U8_MIN
#undef GEN_U8_MAX
#undef GEN_I8_MIN
#undef GEN_I8_MAX
#undef GEN_U16_MIN
#undef GEN_U16_MAX
#undef GEN_I16_MIN
#undef GEN_I16_MAX
#undef GEN_U32_MIN
#undef GEN_U32_MAX
#undef GEN_I32_MIN
#undef GEN_I32_MAX
#undef GEN_U64_MIN
#undef GEN_U64_MAX
#undef GEN_I64_MIN
#undef GEN_I64_MAX
#undef GEN_USIZE_MIN
#undef GEN_USIZE_MAX
#undef GEN_ISIZE_MIN
#undef GEN_ISIZE_MAX
#undef GEN_USIZE_MIN
#undef GEN_USIZE_MAX
#undef GEN_ISIZE_MIN
#undef GEN_ISIZE_MAX
#undef GEN_F32_MIN
#undef GEN_F32_MAX
#undef GEN_F64_MIN
#undef GEN_F64_MAX
#undef to_uptr
#undef to_sptr
#undef to_mem_ptr
#undef to_mem_ptr_const
#undef kilobytes
#undef megabytes
#undef gigabytes
#undef terabytes
#undef GEN__ONES
#undef GEN__HIGHS
#undef GEN__HAS_ZERO
#undef GEN_DEFAULT_MEMORY_ALIGNMENT
#undef GEN_DEFAULT_ALLOCATOR_FLAGS
#undef zero_item
#undef zero_array
@ -137,67 +42,37 @@
#undef malloc
#undef mfree
#undef GEN_DEBUG_TRAP
#undef GEN_ASSERT
#undef GEN_ASSERT_MSG
#undef GEN_ASSERT_NOT_NULL
#undef GEN_PANIC
#undef GEN_FATAL
#undef GEN_FILE_OPEN_PROC
#undef GEN_FILE_READ_AT_PROC
#undef GEN_FILE_WRITE_AT_PROC
#undef GEN_FILE_SEEK_PROC
#undef GEN_FILE_CLOSE_PROC
#undef GEN_PRINTF_MAXLEN
#undef _strlen
#undef _printf_err
#undef _printf_err_va
#undef _strlen
#undef _printf_err
#undef _printf_err_va
#undef Array
#undef get_array_underlying_type
#undef HashTable
#undef get_hashtable_underlying_type
#undef count_of
#undef is_between
#undef min
#undef size_of
#undef swap
#undef bit
#undef bitfield_is_equal
#undef ccast
#undef scast
#undef rcast
#undef pcast
#undef do_once
#undef do_once_start
#undef do_once_end
#undef num_args
#undef num_args_impl
#undef stringize
#undef stringize
#undef stringize_va
#undef txt
#undef NOMINMAX
#undef VC_EXTRALEAN
#undef WIN32_LEAN_AND_MEAN
#undef WIN32_MEAN_AND_LEAN
#undef GEN_DEFINE_ATTRIBUTE_TOKENS
#undef GEN_AST_BODY_CLASS_UNALLOWED_TYPES
#undef GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
#undef GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
#undef GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
#undef GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
#undef GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
#undef GEN_GLOBAL_BUCKET_SIZE
#undef GEN_CODEPOOL_NUM_BLOCKS
#undef GEN_SIZE_PER_STRING_ARENA
#undef GEN_MAX_COMMENT_LINE_LENGTH
#undef GEN_MAX_NAME_LENGTH
#undef GEN_MAX_UNTYPED_STR_LENGTH
#undef TokenMap_FixedArena
#undef GEN_LEX_ALLOCATOR_SIZE
#undef GEN_BUILDER_STR_BUFFER_RESERVE
#undef log_failure
#undef GEN_TIME
#undef gen_main
#undef __
#undef name
#undef code
#undef args
#undef code_str
#undef code_fmt
#undef token_fmt
#undef parse_fmt
#undef token_fmt
// GEN_TIME
#endif

View File

@ -338,7 +338,7 @@ word CodeOperator, gen_CodeOperator
word CodeOpCast, gen_CodeOpCast
word CodePragma, gen_CodePragma
word CodeParams, gen_CodeParams
word CodePreprocessCond, gen_CodePreprocessCond
word CodePreprocessCo, gen_CodePreprocessCo
word CodeSpecifiers, gen_CodeSpecifiers
word CodeTemplate, gen_CodeTemplate
word CodeTypename, gen_CodeTypename