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. Member function support or free-functions with reference object passing are wrapped in `! GEN_C_LIKE CPP` preprocess conditionals.
## C++ template usage ## 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)`) 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 ++(); 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 #ifdef GEN_ENFORCE_STRONG_CODE_TYPES
# define operator explicit operator # define operator explicit operator
#endif #endif

View File

@ -440,6 +440,8 @@ bool array_set_capacity(Array<Type>* array, usize new_capacity)
#pragma endregion Array #pragma endregion Array
// TODO(Ed) : This thing needs ALOT of work.
#pragma region HashTable #pragma region HashTable
#define HashTable(Type) HashTable<Type> #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; return output;
} }
#undef _adt_fprintf
#pragma endregion CSV #pragma endregion CSV

View File

@ -29,6 +29,12 @@
# ifndef GEN_SYSTEM_MACOS # ifndef GEN_SYSTEM_MACOS
# define GEN_SYSTEM_MACOS 1 # define GEN_SYSTEM_MACOS 1
# endif # 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__ ) #elif defined( __unix__ )
# ifndef GEN_SYSTEM_UNIX # ifndef GEN_SYSTEM_UNIX
# define GEN_SYSTEM_UNIX 1 # define GEN_SYSTEM_UNIX 1

View File

@ -1,5 +1,5 @@
// This undefines the macros used by the gen library #if GEN_TIME
#undef 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_64_BIT
#undef GEN_ARCH_32_BIT #undef GEN_ARCH_32_BIT
@ -18,116 +18,21 @@
#undef GEN_COMPILER_CLANG #undef GEN_COMPILER_CLANG
#undef GEN_COMPILER_GCC #undef GEN_COMPILER_GCC
#undef GEN_COMPILER_MINGW
#undef GEN_COMPILER_MSVC #undef GEN_COMPILER_MSVC
#undef GEN_HAS_ATTRIBUTE #undef forceinline
#undef neverinline
#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 global #undef global
#undef internal #undef internal
#undef local_persist #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 kilobytes
#undef megabytes #undef megabytes
#undef gigabytes #undef gigabytes
#undef terabytes #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_item
#undef zero_array #undef zero_array
@ -137,67 +42,37 @@
#undef malloc #undef malloc
#undef mfree #undef mfree
#undef GEN_DEBUG_TRAP #undef count_of
#undef GEN_ASSERT #undef is_between
#undef GEN_ASSERT_MSG #undef min
#undef GEN_ASSERT_NOT_NULL #undef size_of
#undef GEN_PANIC #undef swap
#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 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 txt
#undef NOMINMAX #undef GEN_TIME
#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_main #undef gen_main
#undef __
#undef name #undef name
#undef code #undef code
#undef args #undef args
#undef code_str #undef code_str
#undef code_fmt #undef code_fmt
#undef token_fmt #undef token_fmt
#undef parse_fmt
#undef token_fmt // GEN_TIME
#endif

View File

@ -319,33 +319,33 @@ namespace AST_, gen_AST_
word Code, gen_Code word Code, gen_Code
word Token, gen_Token word Token, gen_Token
word CodeBody, gen_CodeBody word CodeBody, gen_CodeBody
word CodeAttributes, gen_CodeAttributes word CodeAttributes, gen_CodeAttributes
word CodeComment, gen_CodeComment word CodeComment, gen_CodeComment
word CodeClass, gen_CodeClass word CodeClass, gen_CodeClass
word CodeConstructor, gen_CodeConstructor word CodeConstructor, gen_CodeConstructor
word CodeDefine, gen_CodeDefine word CodeDefine, gen_CodeDefine
word CodeDestructor, gen_CodeDestructor word CodeDestructor, gen_CodeDestructor
word CodeEnum, gen_CodeEnum word CodeEnum, gen_CodeEnum
word CodeExec, gen_CodeExec word CodeExec, gen_CodeExec
word CodeExtern, gen_CodeExtern word CodeExtern, gen_CodeExtern
word CodeInclude, gen_CodeInclude word CodeInclude, gen_CodeInclude
word CodeFriend, gen_CodeFriend word CodeFriend, gen_CodeFriend
word CodeFn, gen_CodeFn word CodeFn, gen_CodeFn
word CodeModule, gen_CodeModule word CodeModule, gen_CodeModule
word CodeNS, gen_CodeNS word CodeNS, gen_CodeNS
word CodeOperator, gen_CodeOperator word CodeOperator, gen_CodeOperator
word CodeOpCast, gen_CodeOpCast word CodeOpCast, gen_CodeOpCast
word CodePragma, gen_CodePragma word CodePragma, gen_CodePragma
word CodeParams, gen_CodeParams word CodeParams, gen_CodeParams
word CodePreprocessCond, gen_CodePreprocessCond word CodePreprocessCo, gen_CodePreprocessCo
word CodeSpecifiers, gen_CodeSpecifiers word CodeSpecifiers, gen_CodeSpecifiers
word CodeTemplate, gen_CodeTemplate word CodeTemplate, gen_CodeTemplate
word CodeTypename, gen_CodeTypename word CodeTypename, gen_CodeTypename
word CodeTypedef, gen_CodeTypedef word CodeTypedef, gen_CodeTypedef
word CodeUnion, gen_CodeUnion word CodeUnion, gen_CodeUnion
word CodeUsing, gen_CodeUsing word CodeUsing, gen_CodeUsing
word CodeVar, gen_CodeVar word CodeVar, gen_CodeVar
// Code Interface // Code Interface