mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 15:54:45 -08:00
fixes on containers (compiles but still verifying parity with c++ templates
I'm going to have to change some c++ templates to match the init interfaces as they must not be in the return type
This commit is contained in:
parent
a3407c14d5
commit
8bb2bc7b1b
@ -9,7 +9,9 @@
|
|||||||
#include "helpers/helper.hpp"
|
#include "helpers/helper.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
GEN_NS_BEGIN
|
||||||
|
#include "helpers/push_container_defines.inline.hpp"
|
||||||
#include "dependencies/parsing.cpp"
|
#include "dependencies/parsing.cpp"
|
||||||
|
#include "helpers/pop_container_defines.inline.hpp"
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
|
||||||
#include "auxillary/builder.hpp"
|
#include "auxillary/builder.hpp"
|
||||||
@ -373,7 +375,6 @@ int gen_main()
|
|||||||
{
|
{
|
||||||
CodeBody ht = gen_hashtable(txt("StrC"), name_string_table);
|
CodeBody ht = gen_hashtable(txt("StrC"), name_string_table);
|
||||||
strings.append(ht);
|
strings.append(ht);
|
||||||
strings.append(td);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strings.append(td);
|
strings.append(td);
|
||||||
|
@ -41,23 +41,24 @@ CodeBody gen_array( StrC type, StrC array_name )
|
|||||||
, stringize(
|
, stringize(
|
||||||
typedef <type>* <array_type>;
|
typedef <type>* <array_type>;
|
||||||
|
|
||||||
void <fn>_init ( <array_type>* self, AllocatorInfo allocator );
|
void <fn>_init ( <array_type>* self, AllocatorInfo allocator );
|
||||||
void <fn>_init_reserve ( <array_type>* self, AllocatorInfo allocator, usize capacity );
|
void <fn>_init_reserve ( <array_type>* self, AllocatorInfo allocator, usize capacity );
|
||||||
bool <fn>_append_array ( <array_type>* self, <array_type> other );
|
bool <fn>_append_array ( <array_type>* self, <array_type> other );
|
||||||
bool <fn>_append ( <array_type>* self, <type> value );
|
bool <fn>_append ( <array_type>* self, <type> value );
|
||||||
bool <fn>_append_items ( <array_type>* self, <type>* items, usize item_num );
|
bool <fn>_append_items ( <array_type>* self, <type>* items, usize item_num );
|
||||||
bool <fn>_append_at ( <array_type>* self, <type> item, usize idx );
|
bool <fn>_append_at ( <array_type>* self, <type> item, usize idx );
|
||||||
bool <fn>_append_items_at( <array_type>* self, <type>* items, usize item_num, usize idx );
|
bool <fn>_append_items_at( <array_type>* self, <type>* items, usize item_num, usize idx );
|
||||||
<type>* <fn>_back ( <array_type> self );
|
<type>* <fn>_back ( <array_type> self );
|
||||||
void <fn>_clear ( <array_type> self );
|
void <fn>_clear ( <array_type> self );
|
||||||
bool <fn>_fill ( <array_type> self, usize begin, usize end, <type> value );
|
bool <fn>_fill ( <array_type> self, usize begin, usize end, <type> value );
|
||||||
void <fn>_free ( <array_type> self );
|
void <fn>_free ( <array_type>* self );
|
||||||
bool <fn>_grow ( <array_type>* self, usize min_capacity );
|
bool <fn>_grow ( <array_type>* self, usize min_capacity );
|
||||||
usize <fn>_num ( <array_type> self );
|
usize <fn>_num ( <array_type> self );
|
||||||
<type> <fn>_pop ( <array_type> self );
|
<type> <fn>_pop ( <array_type> self );
|
||||||
bool <fn>_reserve ( <array_type>* self, usize new_capacity );
|
void <fn>_remove_at ( <array_type> self, usize idx );
|
||||||
bool <fn>_resize ( <array_type>* self, usize num );
|
bool <fn>_reserve ( <array_type>* self, usize new_capacity );
|
||||||
bool <fn>_set_capacity ( <array_type>* self, usize new_capacity );
|
bool <fn>_resize ( <array_type>* self, usize num );
|
||||||
|
bool <fn>_set_capacity ( <array_type>* self, usize new_capacity );
|
||||||
|
|
||||||
void <fn>_init( <array_type>* self, AllocatorInfo allocator )
|
void <fn>_init( <array_type>* self, AllocatorInfo allocator )
|
||||||
{
|
{
|
||||||
@ -202,9 +203,9 @@ CodeBody gen_array( StrC type, StrC array_name )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void <fn>_free( <array_type> self )
|
void <fn>_free( <array_type>* self )
|
||||||
{
|
{
|
||||||
ArrayHeader* header = array_get_header( self );
|
ArrayHeader* header = array_get_header( * self );
|
||||||
allocator_free( header->Allocator, header );
|
allocator_free( header->Allocator, header );
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ CodeBody gen_array( StrC type, StrC array_name )
|
|||||||
if ( new_capacity < min_capacity )
|
if ( new_capacity < min_capacity )
|
||||||
new_capacity = min_capacity;
|
new_capacity = min_capacity;
|
||||||
|
|
||||||
return array_set_capacity( * self, new_capacity );
|
return array_set_capacity( self, new_capacity );
|
||||||
}
|
}
|
||||||
|
|
||||||
usize <fn>_num( <array_type> self )
|
usize <fn>_num( <array_type> self )
|
||||||
@ -249,7 +250,7 @@ CodeBody gen_array( StrC type, StrC array_name )
|
|||||||
ArrayHeader* header = array_get_header( * self );
|
ArrayHeader* header = array_get_header( * self );
|
||||||
|
|
||||||
if ( header->Capacity < new_capacity )
|
if ( header->Capacity < new_capacity )
|
||||||
return array_set_capacity( * self, new_capacity );
|
return array_set_capacity( self, new_capacity );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -311,12 +312,14 @@ R"(#define GENERIC_SLOT_<slot>__array_init <type_delimiter>, <type_deli
|
|||||||
#define GENERIC_SLOT_<slot>__array_back <type_delimiter>, <type_delimiter>_back
|
#define GENERIC_SLOT_<slot>__array_back <type_delimiter>, <type_delimiter>_back
|
||||||
#define GENERIC_SLOT_<slot>__array_clear <type_delimiter>, <type_delimiter>_clear
|
#define GENERIC_SLOT_<slot>__array_clear <type_delimiter>, <type_delimiter>_clear
|
||||||
#define GENERIC_SLOT_<slot>__array_fill <type_delimiter>, <type_delimiter>_fill
|
#define GENERIC_SLOT_<slot>__array_fill <type_delimiter>, <type_delimiter>_fill
|
||||||
|
#define GENERIC_SLOT_<slot>__array_free <type_delimiter>, <type_delimiter>_free
|
||||||
#define GENERIC_SLOT_<slot>__array_grow <type_delimiter>*, <type_delimiter>_grow
|
#define GENERIC_SLOT_<slot>__array_grow <type_delimiter>*, <type_delimiter>_grow
|
||||||
#define GENERIC_SLOT_<slot>__array_num <type_delimiter>, <type_delimiter>_num
|
#define GENERIC_SLOT_<slot>__array_num <type_delimiter>, <type_delimiter>_num
|
||||||
#define GENERIC_SLOT_<slot>__array_pop <type_delimiter>, <type_delimiter>_pop
|
#define GENERIC_SLOT_<slot>__array_pop <type_delimiter>, <type_delimiter>_pop
|
||||||
|
#define GENERIC_SLOT_<slot>__array_remove_at <type_delimiter>, <type_delimiter>_remove_at
|
||||||
#define GENERIC_SLOT_<slot>__array_reserve <type_delimiter>, <type_delimiter>_reserve
|
#define GENERIC_SLOT_<slot>__array_reserve <type_delimiter>, <type_delimiter>_reserve
|
||||||
#define GENERIC_SLOT_<slot>__array_resize <type_delimiter>, <type_delimiter>_resize
|
#define GENERIC_SLOT_<slot>__array_resize <type_delimiter>, <type_delimiter>_resize
|
||||||
#define GENERIC_SLOT_<slot>__array_set_capacity <type_delimiter>, <type_delimiter>_set_capacity
|
#define GENERIC_SLOT_<slot>__array_set_capacity <type_delimiter>*, <type_delimiter>_set_capacity
|
||||||
)"
|
)"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -387,12 +390,12 @@ CodeBody gen_array_generic_selection_interface()
|
|||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_back")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_back")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_clear")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_clear")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_fill")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_fill")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_free")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_free"), array_by_ref) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_grow")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_grow")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_num")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_num")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("arary_pop")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("arary_pop")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("arary_remove_at")) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_remove_at")) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("arary_reserve"), array_by_ref) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("arary_reserve"), array_by_ref) );
|
||||||
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_set_capacity"), array_by_ref) );
|
interface_defines.append( gen_array_generic_selection_function_macro(txt("array_set_capacity")) );
|
||||||
return interface_defines;
|
return interface_defines;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
"tbl_name", (StrC) hashtable_name,
|
"tbl_name", (StrC) hashtable_name,
|
||||||
"tbl_type", (StrC) tbl_type,
|
"tbl_type", (StrC) tbl_type,
|
||||||
stringize(
|
stringize(
|
||||||
typedef struct <tbl_type> <tbl_type>;
|
typedef struct HashTable_<type> <tbl_type>;
|
||||||
typedef struct HTE_<tbl_name> HTE_<tbl_name>;
|
typedef struct HTE_<tbl_name> HTE_<tbl_name>;
|
||||||
struct HTE_<tbl_name>
|
struct HTE_<tbl_name>
|
||||||
{
|
{
|
||||||
@ -72,8 +72,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
"array_entry", (StrC) entry_array_name,
|
"array_entry", (StrC) entry_array_name,
|
||||||
"fn_array", (StrC) entry_array_fn_ns,
|
"fn_array", (StrC) entry_array_fn_ns,
|
||||||
stringize(
|
stringize(
|
||||||
typedef struct <tbl_type> <tbl_type>;
|
struct HashTable_<type>
|
||||||
struct <tbl_type>
|
|
||||||
{
|
{
|
||||||
Array_ssize Hashes;
|
Array_ssize Hashes;
|
||||||
<array_entry> Entries;
|
<array_entry> Entries;
|
||||||
@ -120,19 +119,19 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
|
|
||||||
void <fn>_clear( <tbl_type> self )
|
void <fn>_clear( <tbl_type> self )
|
||||||
{
|
{
|
||||||
for ( ssize idx = 0; idx < array_header( self.Hashes )->Num; idx++ )
|
for ( ssize idx = 0; idx < array_get_header( self.Hashes )->Num; idx++ )
|
||||||
self.Hashes[idx] = -1;
|
self.Hashes[idx] = -1;
|
||||||
|
|
||||||
array_ssize_clear( self.Hashes );
|
array_clear( self.Hashes );
|
||||||
<fn_array>_clear( self.Entries );
|
array_clear( self.Entries );
|
||||||
}
|
}
|
||||||
|
|
||||||
void <fn>_destroy( <tbl_type> self )
|
void <fn>_destroy( <tbl_type> self )
|
||||||
{
|
{
|
||||||
if ( self.Hashes && self.Entries )
|
if ( self.Hashes && self.Entries )
|
||||||
{
|
{
|
||||||
array_ssize_free( self.Hashes );
|
array_free( self.Hashes );
|
||||||
<fn_array>_free( self.Entries );
|
array_free( self.Entries );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +148,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
{
|
{
|
||||||
GEN_ASSERT_NOT_NULL( map_proc );
|
GEN_ASSERT_NOT_NULL( map_proc );
|
||||||
|
|
||||||
for ( ssize idx = 0; idx < array_header( self.Entries )->Num; idx++ )
|
for ( ssize idx = 0; idx < array_get_header( self.Entries )->Num; idx++ )
|
||||||
{
|
{
|
||||||
map_proc( self, self.Entries[idx].Key, self.Entries[idx].Value );
|
map_proc( self, self.Entries[idx].Key, self.Entries[idx].Value );
|
||||||
}
|
}
|
||||||
@ -159,7 +158,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
{
|
{
|
||||||
GEN_ASSERT_NOT_NULL( map_proc );
|
GEN_ASSERT_NOT_NULL( map_proc );
|
||||||
|
|
||||||
for ( ssize idx = 0; idx < array_header( self.Entries )->Num; idx++ )
|
for ( ssize idx = 0; idx < array_get_header( self.Entries )->Num; idx++ )
|
||||||
{
|
{
|
||||||
map_proc( self, self.Entries[idx].Key, & self.Entries[idx].Value );
|
map_proc( self, self.Entries[idx].Key, & self.Entries[idx].Value );
|
||||||
}
|
}
|
||||||
@ -167,7 +166,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
|
|
||||||
void <fn>_grow( <tbl_type>* self )
|
void <fn>_grow( <tbl_type>* self )
|
||||||
{
|
{
|
||||||
ssize new_num = array_grow_formula( array_header( self->Entries )->Num );
|
ssize new_num = array_grow_formula( array_get_header( self->Entries )->Num );
|
||||||
<fn>_rehash( self, new_num );
|
<fn>_rehash( self, new_num );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,12 +175,12 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
ssize idx;
|
ssize idx;
|
||||||
ssize last_added_index;
|
ssize last_added_index;
|
||||||
|
|
||||||
ArrayHeader* old_hash_header = array_header( self->Hashes );
|
ArrayHeader* old_hash_header = array_get_header( self->Hashes );
|
||||||
ArrayHeader* old_entries_header = array_header( self->Entries );
|
ArrayHeader* old_entries_header = array_get_header( self->Entries );
|
||||||
|
|
||||||
<tbl_type> new_tbl = <fn>_make_reserve( old_hash_header->Allocator, old_hash_header->Num );
|
<tbl_type> new_tbl = <fn>_make_reserve( old_hash_header->Allocator, old_hash_header->Num );
|
||||||
|
|
||||||
ArrayHeader* new_hash_header = array_header( new_tbl.Hashes );
|
ArrayHeader* new_hash_header = array_get_header( new_tbl.Hashes );
|
||||||
|
|
||||||
for ( idx = 0; idx < new_hash_header->Num; idx++ )
|
for ( idx = 0; idx < new_hash_header->Num; idx++ )
|
||||||
new_tbl.Hashes[idx] = -1;
|
new_tbl.Hashes[idx] = -1;
|
||||||
@ -215,13 +214,13 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
{
|
{
|
||||||
ssize idx;
|
ssize idx;
|
||||||
|
|
||||||
for ( idx = 0; idx < array_header( self.Entries )->Num; idx++ )
|
for ( idx = 0; idx < array_get_header( self.Entries )->Num; idx++ )
|
||||||
self.Entries[ idx ].Next = -1;
|
self.Entries[ idx ].Next = -1;
|
||||||
|
|
||||||
for ( idx = 0; idx < array_header( self.Hashes )->Num; idx++ )
|
for ( idx = 0; idx < array_get_header( self.Hashes )->Num; idx++ )
|
||||||
self.Hashes[ idx ] = -1;
|
self.Hashes[ idx ] = -1;
|
||||||
|
|
||||||
for ( idx = 0; idx < array_header( self.Entries )->Num; idx++ )
|
for ( idx = 0; idx < array_get_header( self.Entries )->Num; idx++ )
|
||||||
{
|
{
|
||||||
<entry_type>* entry;
|
<entry_type>* entry;
|
||||||
HT_FindResult find_result;
|
HT_FindResult find_result;
|
||||||
@ -242,22 +241,22 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
|
|
||||||
if ( find_result.EntryIndex >= 0 )
|
if ( find_result.EntryIndex >= 0 )
|
||||||
{
|
{
|
||||||
<fn_array>_remove_at( self.Entries, find_result.EntryIndex );
|
array_remove_at( self.Entries, find_result.EntryIndex );
|
||||||
<fn>_rehash_fast( self );
|
<fn>_rehash_fast( self );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void <fn>_remove_entry( <tbl_type> self, ssize idx )
|
void <fn>_remove_entry( <tbl_type> self, ssize idx )
|
||||||
{
|
{
|
||||||
<fn_array>_remove_at( self.Entries, idx );
|
array_remove_at( self.Entries, idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
void <fn>_set( <tbl_type>* self, u64 key, <type> value )
|
void <fn>_set( <tbl_type>* self, u64 key, <type> value )
|
||||||
{
|
{
|
||||||
ssize idx;
|
ssize idx;
|
||||||
HT_FindResult find_result;
|
HT_FindResult find_result;
|
||||||
|
|
||||||
if ( array_header( self->Hashes )->Num == 0 )
|
if ( array_get_header( self->Hashes )->Num == 0 )
|
||||||
<fn>_grow( self );
|
<fn>_grow( self );
|
||||||
|
|
||||||
find_result = <fn>__find( * self, key );
|
find_result = <fn>__find( * self, key );
|
||||||
@ -288,7 +287,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
|
|
||||||
ssize <fn>_slot( <tbl_type> self, u64 key )
|
ssize <fn>_slot( <tbl_type> self, u64 key )
|
||||||
{
|
{
|
||||||
for ( ssize idx = 0; idx < array_header( self.Hashes )->Num; ++idx )
|
for ( ssize idx = 0; idx < array_get_header( self.Hashes )->Num; ++idx )
|
||||||
if ( self.Hashes[ idx ] == key )
|
if ( self.Hashes[ idx ] == key )
|
||||||
return idx;
|
return idx;
|
||||||
|
|
||||||
@ -300,8 +299,8 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
ssize idx;
|
ssize idx;
|
||||||
<entry_type> entry = { key, -1 };
|
<entry_type> entry = { key, -1 };
|
||||||
|
|
||||||
idx = array_header( self.Entries )->Num;
|
idx = array_get_header( self.Entries )->Num;
|
||||||
<fn_array>_append( & self.Entries, entry );
|
array_append( self.Entries, entry );
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +308,7 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
{
|
{
|
||||||
HT_FindResult result = { -1, -1, -1 };
|
HT_FindResult result = { -1, -1, -1 };
|
||||||
|
|
||||||
ArrayHeader* hash_header = array_header( self.Hashes );
|
ArrayHeader* hash_header = array_get_header( self.Hashes );
|
||||||
|
|
||||||
if ( hash_header->Num > 0 )
|
if ( hash_header->Num > 0 )
|
||||||
{
|
{
|
||||||
@ -331,8 +330,8 @@ CodeBody gen_hashtable( StrC type, StrC hashtable_name )
|
|||||||
|
|
||||||
b32 <fn>__full( <tbl_type> self )
|
b32 <fn>__full( <tbl_type> self )
|
||||||
{
|
{
|
||||||
ArrayHeader* hash_header = array_header( self.Hashes );
|
ArrayHeader* hash_header = array_get_header( self.Hashes );
|
||||||
ArrayHeader* entries_header = array_header( self.Entries );
|
ArrayHeader* entries_header = array_get_header( self.Entries );
|
||||||
|
|
||||||
return 0.75f * hash_header->Num < entries_header->Num;
|
return 0.75f * hash_header->Num < entries_header->Num;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
#include "helpers/helper.hpp"
|
#include "helpers/helper.hpp"
|
||||||
|
|
||||||
GEN_NS_BEGIN
|
GEN_NS_BEGIN
|
||||||
|
#include "helpers/push_container_defines.inline.hpp"
|
||||||
#include "dependencies/parsing.cpp"
|
#include "dependencies/parsing.cpp"
|
||||||
|
#include "helpers/pop_container_defines.inline.hpp"
|
||||||
GEN_NS_END
|
GEN_NS_END
|
||||||
|
|
||||||
#include "auxillary/builder.hpp"
|
#include "auxillary/builder.hpp"
|
||||||
|
@ -73,11 +73,11 @@ struct Array
|
|||||||
forceinline static Array init_reserve(AllocatorInfo allocator, ssize capacity) { return GEN_NS array_init_reserve<Type>(allocator, capacity); }
|
forceinline static Array init_reserve(AllocatorInfo allocator, ssize capacity) { return GEN_NS array_init_reserve<Type>(allocator, capacity); }
|
||||||
forceinline static usize grow_formula(ssize value) { return GEN_NS array_grow_formula<Type>(value); }
|
forceinline static usize grow_formula(ssize value) { return GEN_NS array_grow_formula<Type>(value); }
|
||||||
|
|
||||||
forceinline bool append(Array other) { return GEN_NS array_append<Type>(this, other); }
|
forceinline bool append(Array other) { return GEN_NS array_append_array<Type>(this, other); }
|
||||||
forceinline bool append(Type value) { return GEN_NS array_append<Type>(this, value); }
|
forceinline bool append(Type value) { return GEN_NS array_append<Type>(this, value); }
|
||||||
forceinline bool append(Type* items, usize item_num) { return GEN_NS array_append<Type>(this, items, item_num); }
|
forceinline bool append(Type* items, usize item_num) { return GEN_NS array_append_items<Type>(this, items, item_num); }
|
||||||
forceinline bool append_at(Type item, usize idx) { return GEN_NS array_append_at<Type>(this, item, idx); }
|
forceinline bool append_at(Type item, usize idx) { return GEN_NS array_append_at<Type>(this, item, idx); }
|
||||||
forceinline bool append_at(Type* items, usize item_num, usize idx) { return GEN_NS array_append_at<Type>(this, items, item_num, idx); }
|
forceinline bool append_at(Type* items, usize item_num, usize idx) { return GEN_NS array_append_items_at<Type>(this, items, item_num, idx); }
|
||||||
forceinline Type* back() { return GEN_NS array_back<Type>(* this); }
|
forceinline Type* back() { return GEN_NS array_back<Type>(* this); }
|
||||||
forceinline void clear() { GEN_NS array_clear<Type>(* this); }
|
forceinline void clear() { GEN_NS array_clear<Type>(* this); }
|
||||||
forceinline bool fill(usize begin, usize end, Type value) { return GEN_NS array_fill<Type>(* this, begin, end, value); }
|
forceinline bool fill(usize begin, usize end, Type value) { return GEN_NS array_fill<Type>(* this, begin, end, value); }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
# pragma once
|
# pragma once
|
||||||
|
# include "parsing.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region ADT
|
#pragma region ADT
|
||||||
@ -42,7 +43,7 @@ u8 adt_destroy_branch( ADT_Node* node )
|
|||||||
adt_destroy_branch( node->nodes + i );
|
adt_destroy_branch( node->nodes + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
array_free(& node->nodes);
|
array_free(node->nodes);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index )
|
|||||||
|
|
||||||
ADT_Node o = { 0 };
|
ADT_Node o = { 0 };
|
||||||
o.parent = parent;
|
o.parent = parent;
|
||||||
if ( ! array_append_at( & parent->nodes, o, index ) )
|
if ( ! array_append_at( parent->nodes, o, index ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ADT_Node* node = & parent->nodes[index];
|
ADT_Node* node = & parent->nodes[index];
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#undef array_init
|
#undef array_init
|
||||||
#undef array_init_reserve
|
#undef array_init_reserve
|
||||||
#undef array_append_array
|
#undef array_append_array
|
||||||
#undef array_append_value
|
#undef array_append
|
||||||
#undef array_append_items
|
#undef array_append_items
|
||||||
#undef array_append_at
|
#undef array_append_at
|
||||||
#undef array_append_at
|
#undef array_append_items_at
|
||||||
#undef array_back
|
#undef array_back
|
||||||
#undef array_clear
|
#undef array_clear
|
||||||
#undef array_fill
|
#undef array_fill
|
||||||
|
Loading…
Reference in New Issue
Block a user