Skip to content

Commit 878bc4c

Browse files
authored
Merge pull request #72 from Ed94/dev
Changes involved with getting gencpp-odin setup
2 parents 13ebd10 + ec8dd1e commit 878bc4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+833
-686
lines changed

Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ These build up a code AST to then serialize with a file builder, or can be trave
1111
This code base attempts follow the [handmade philosophy](https://handmade.network/manifesto).
1212
Its not meant to be a black box metaprogramming utility, it should be easy to integrate into a user's project domain.
1313

14+
## Langauge Bindings
15+
16+
* [gencpp-odin](https://github.com/Ed94/gencpp-odin): Bindings for the odin programming language.
17+
18+
## Utility Libraries
19+
20+
* [UnrealGencpp](https://github.com/Ed94/UnrealGencpp): Setup as a plugin to integrate into Unreal Engine or Unreal Projects.
21+
1422
## Documentation
1523

1624
* [docs - General](./docs/Readme.md): Overview and additional docs

base/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ These require the following to be handled to the equivalent extent as the other
191191
4. [ast.cpp](./components/ast.cpp): Need to review
192192
* `code_debug_str`
193193
* `code_is_equal`
194-
* `code_to_strbuilder_ptr`
194+
* `code_to_strbuilder_ref`
195195
* `code_validate_body`
196196
5. [code_serialization.cpp](./components/code_serialization.cpp): Define serialization here.
197197
6. [inlines.hpp](./components/inlines.hpp): Any inline definitions for the `struct Code<Name>` are defined here.

base/auxiliary/builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# include "builder.hpp"
33
#endif
44

base/auxiliary/builder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# pragma once
33
# include "helpers/push_ignores.inline.hpp"
44
# include "components/header_start.hpp"

base/auxiliary/gen_template.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# pragma once
33
# include "helpers/push_ignores.inline.hpp"
44
# include "components/header_start.hpp"

base/auxiliary/scanner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# include "scanner.hpp"
33
#endif
44

@@ -24,7 +24,7 @@ Code scan_file( char const* path )
2424
file_read( & file, str, fsize );
2525
strbuilder_get_header(str)->Length = fsize;
2626

27-
// Skip GEN_INTELLISENSE_DIRECTIVES preprocessor blocks
27+
// Skip INTELLISENSE_DIRECTIVES preprocessor blocks
2828
// Its designed so that the directive should be the first thing in the file.
2929
// Anything that comes before it will also be omitted.
3030
{
@@ -33,7 +33,7 @@ Code scan_file( char const* path )
3333
#define move_fwd() do { ++ scanner; -- left; } while (0)
3434
const Str directive_start = txt( "ifdef" );
3535
const Str directive_end = txt( "endif" );
36-
const Str def_intellisense = txt("GEN_INTELLISENSE_DIRECTIVES" );
36+
const Str def_intellisense = txt("INTELLISENSE_DIRECTIVES" );
3737

3838
bool found_directive = false;
3939
char const* scanner = (char const*)str;

base/auxiliary/scanner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# pragma once
33
# include "helpers/push_ignores.inline.hpp"
44
# include "components/header_start.hpp"

base/base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int gen_main()
3030
gen::init( & ctx);
3131

3232
CodeBody gen_component_header = def_global_body( args(
33-
def_preprocess_cond( PreprocessCond_IfDef, txt("GEN_INTELLISENSE_DIRECTIVES") ),
33+
def_preprocess_cond( PreprocessCond_IfDef, txt("INTELLISENSE_DIRECTIVES") ),
3434
pragma_once,
3535
def_include(txt("components/types.hpp")),
3636
preprocess_endif,

base/components/ast.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
#pragma once
33
#include "static_data.cpp"
44
#endif
@@ -379,11 +379,11 @@ Code code_duplicate(Code self)
379379
StrBuilder code_to_strbuilder(Code self)
380380
{
381381
StrBuilder result = strbuilder_make_str( _ctx->Allocator_Temp, txt("") );
382-
code_to_strbuilder_ptr( self, & result );
382+
code_to_strbuilder_ref( self, & result );
383383
return result;
384384
}
385385

386-
void code_to_strbuilder_ptr( Code self, StrBuilder* result )
386+
void code_to_strbuilder_ref( Code self, StrBuilder* result )
387387
{
388388
GEN_ASSERT(self != nullptr);
389389
local_persist thread_local

base/components/ast.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
#pragma once
33
#include "types.hpp"
44
#include "gen/ecode.hpp"
@@ -193,6 +193,7 @@ typedef AST_Stmt_If* CodeStmt_If;
193193
typedef AST_Stmt_For* CodeStmt_For;
194194
typedef AST_Stmt_Goto* CodeStmt_Goto;
195195
typedef AST_Stmt_Label* CodeStmt_Label;
196+
typedef AST_Stmt_Lambda* CodeStmt_Lambda;
196197
typedef AST_Stmt_Switch* CodeStmt_Switch;
197198
typedef AST_Stmt_While* CodeStmt_While;
198199
#else
@@ -208,6 +209,7 @@ struct CodeStmt_If;
208209
struct CodeStmt_For;
209210
struct CodeStmt_Goto;
210211
struct CodeStmt_Label;
212+
struct CodeStmt_Lambda;
211213
struct CodeStmt_Switch;
212214
struct CodeStmt_While;
213215
#endif
@@ -239,18 +241,18 @@ template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast(
239241

240242
#pragma region Code C-Interface
241243

242-
GEN_API void code_append (Code code, Code other );
244+
void code_append (Code code, Code other );
243245
GEN_API Str code_debug_str (Code code);
244246
GEN_API Code code_duplicate (Code code);
245-
GEN_API Code* code_entry (Code code, u32 idx );
246-
GEN_API bool code_has_entries (Code code);
247-
GEN_API bool code_is_body (Code code);
247+
Code* code_entry (Code code, u32 idx );
248+
bool code_has_entries (Code code);
249+
bool code_is_body (Code code);
248250
GEN_API bool code_is_equal (Code code, Code other);
249-
GEN_API bool code_is_valid (Code code);
250-
GEN_API void code_set_global (Code code);
251+
bool code_is_valid (Code code);
252+
void code_set_global (Code code);
251253
GEN_API StrBuilder code_to_strbuilder (Code self );
252-
GEN_API void code_to_strbuilder_ptr(Code self, StrBuilder* result );
253-
GEN_API Str code_type_str (Code self );
254+
GEN_API void code_to_strbuilder_ref(Code self, StrBuilder* result );
255+
Str code_type_str (Code self );
254256
GEN_API bool code_validate_body (Code self );
255257

256258
#pragma endregion Code C-Interface
@@ -287,7 +289,7 @@ struct Code
287289
forceinline Code* entry(u32 idx) { return code_entry(* this, idx); }
288290
forceinline bool has_entries() { return code_has_entries(* this); }
289291
forceinline StrBuilder to_strbuilder() { return code_to_strbuilder(* this); }
290-
forceinline void to_strbuilder(StrBuilder& result) { return code_to_strbuilder_ptr(* this, & result); }
292+
forceinline void to_strbuilder(StrBuilder& result) { return code_to_strbuilder_ref(* this, & result); }
291293
forceinline Str type_str() { return code_type_str(* this); }
292294
forceinline bool validate_body() { return code_validate_body(*this); }
293295
#endif
@@ -399,7 +401,7 @@ struct AST
399401
Code Value; // Parameter, Variable
400402
};
401403
union {
402-
Code NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value )
404+
Code NextVar; // Variable
403405
Code SuffixSpecs; // Typename, Function (Thanks Unreal)
404406
Code PostNameMacro; // Only used with parameters for specifically UE_REQUIRES (Thanks Unreal)
405407
};

base/components/ast_types.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef GEN_INTELLISENSE_DIRECTIVES
1+
#ifdef INTELLISENSE_DIRECTIVES
22
# pragma once
33
# include "code_types.hpp"
44
#endif
@@ -227,7 +227,7 @@ struct AST_Enum
227227
Code Parent;
228228
CodeType Type;
229229
ModuleFlag ModuleFlags;
230-
char _PAD_UNUSED_[ sizeof(ModuleFlag) + sizeof(u32) ];
230+
char _PAD_UNUSED_[ sizeof(u32) ];
231231
};
232232
static_assert( sizeof(AST_Enum) == sizeof(AST), "ERROR: AST_Enum is not the same size as AST");
233233

@@ -738,8 +738,8 @@ static_assert( sizeof(AST_PreprocessCond) == sizeof(AST), "ERROR: AST_Preprocess
738738
struct AST_Specifiers
739739
{
740740
Specifier ArrSpecs[ AST_ArrSpecs_Cap ];
741-
StrCached Name;
742741
CodeSpecifiers NextSpecs;
742+
StrCached Name;
743743
Code Prev;
744744
Code Next;
745745
Token* Tok;
@@ -1056,7 +1056,7 @@ struct AST_Typename
10561056
CodeSpecifiers SpecsFuncSuffix; // Only used for function signatures
10571057
};
10581058
};
1059-
StrCached Name;
1059+
StrCached Name;
10601060
Code Prev;
10611061
Code Next;
10621062
Token* Tok;
@@ -1082,7 +1082,7 @@ struct AST_Typedef
10821082
char _PAD_PROPERTIES_2_[ sizeof(AST*) * 3 ];
10831083
};
10841084
};
1085-
StrCached Name;
1085+
StrCached Name;
10861086
Code Prev;
10871087
Code Next;
10881088
Token* Tok;

0 commit comments

Comments
 (0)