Commit 12cc6da0 authored by William Bundy's avatar William Bundy

rituals build 94

parent e8318da1
git add --all
git commit -m "rituals build 93"
git commit -m "rituals build 94"
git push
git push github
92
1475268944.481566
93
1475268954.752398
......@@ -282,7 +282,7 @@ int main(int argc, char** argv)
}
} while(head = head->next);
Proc_Prototype* p = find_proc_prototypes(start, Work_Arena);
Proc_Prototype* p = find_proc_prototypes(&lex, start, Work_Arena);
Struct_Def* structdef = find_struct_defs(&lex, start, Work_Arena);
......
......@@ -111,6 +111,10 @@ struct Lexer_File
Lexer_Location location;
char* start;
char* head;
isize structs_count;
isize procedures_count;
};
void init_lexer_file(Lexer_File* file, char* filename, char* prev_path, isize prev_path_len, Memory_Arena* arena)
......@@ -557,7 +561,7 @@ void parse_sing(Token* t, int32 brace_level)
}
}
Proc_Prototype* find_proc_prototypes(Token* start, Memory_Arena* arena)
Proc_Prototype* find_proc_prototypes(Lexer* lex, Token* start, Memory_Arena* arena)
{
//NOTE(will) will not find C-style "struct Type function() {"
Token* head = start;
......@@ -696,6 +700,7 @@ Proc_Prototype* find_proc_prototypes(Token* start, Memory_Arena* arena)
proc.end = head;
*proc_head = proc;
proc_head->next = arena_push_struct(arena, Proc_Prototype);
lex->procedures_count++;
proc_head = proc_head->next;
break;
}
......@@ -903,7 +908,7 @@ void print_struct(Struct_Def* def, bool as_member_struct = false, int32 indent =
// unsigned short**** thinga[400], **thingb, **thingc, a, b, c, d[3], e[44][55], f[44][22][44];
Token* parse_struct_member(Struct_Def* parent, Token* start, Memory_Arena* arena)
Token* parse_struct_member(Lexer* lex, Struct_Def* parent, Token* start, Memory_Arena* arena)
{
Hash structhash = hash_literal("struct");
Hash unionhash = hash_literal("union");
......@@ -915,6 +920,7 @@ Token* parse_struct_member(Struct_Def* parent, Token* start, Memory_Arena* arena
if(head->kind == Token_Identifier) {
if(head->hash == structhash || head->hash == unionhash) {
lex->structs_count++;
if(head->hash == unionhash) {
*kind = StructKind_Union;
} else {
......@@ -930,7 +936,7 @@ Token* parse_struct_member(Struct_Def* parent, Token* start, Memory_Arena* arena
def.member_kinds = arena_push_array(arena, Struct_Kind, StructMemberCapacity);
def.kind = *kind;
do {
head = parse_struct_member(&def, head, arena);
head = parse_struct_member(lex, &def, head, arena);
head = head->next;
} while(head->kind != Token_CloseBrace);
......@@ -943,6 +949,7 @@ Token* parse_struct_member(Struct_Def* parent, Token* start, Memory_Arena* arena
var->array_levels = 0;
var->array_sizes = NULL;
parent->member_count++;
return head;
} else {
fprintf(stderr, "ERROR: wanted identifier, got %d:[%.*s] \n",
......@@ -1120,10 +1127,12 @@ Struct_Def* find_struct_defs(Lexer* lex, Token* start, Memory_Arena* arena)
subhead = subhead->next;
do {
subhead = parse_struct_member(&def, subhead, arena);
subhead = parse_struct_member(lex, &def, subhead, arena);
subhead = subhead->next;
} while(subhead->kind != Token_CloseBrace);
lex->structs_count++;
*def_head = def;
def_head->next = arena_push_struct(arena, Struct_Def);
def_head = def_head->next;
......@@ -1135,7 +1144,28 @@ Struct_Def* find_struct_defs(Lexer* lex, Token* start, Memory_Arena* arena)
/* Serialization "what is this thing" rules
* - If something is a pointer
* - if this is the only pointer in the 'class'
* - assume any member named count, len, length, capacity, size
* could be the number.
* - when initializing, if something has the name
* "pointer(s)_{capacity, size}
* - Assume this is the size to allocate
* - if something has the name
* "pointer(s)_{count, length}"
* - Assume this is the number of things to (de)serialize
* - if $(tag, pointername:length) is present, use that, ignore
* heuristic rules
* - If something is a union
* - if something matches the name
* "unionname_{kind,type}"
* use this to index sub-structs in the union
* - If a union has a base-level array that is the same size
* as the union, and no kind/type variable is present,
* (de)serialize that
*
*/
/*
struct Meta_Member_Definition
......
......@@ -1207,7 +1207,7 @@ StructKind_Member src/metaprogram/metaprogram_parser.cpp /^ StructKind_Member$/;
StructKind_None src/metaprogram/metaprogram_parser.cpp /^ StructKind_None,$/;" e enum:Struct_Kind file:
StructKind_Struct src/metaprogram/metaprogram_parser.cpp /^ StructKind_Struct,$/;" e enum:Struct_Kind file:
StructKind_Union src/metaprogram/metaprogram_parser.cpp /^ StructKind_Union,$/;" e enum:Struct_Kind file:
StructMemberCapacity src/metaprogram/metaprogram_parser.cpp 747;" d file:
StructMemberCapacity src/metaprogram/metaprogram_parser.cpp 752;" d file:
Struct_Def src/metaprogram/metaprogram_parser.cpp /^struct Struct_Def$/;" s file:
Struct_Kind src/metaprogram/metaprogram_parser.cpp /^enum Struct_Kind$/;" g file:
Struct_Member src/metaprogram/metaprogram_parser.cpp /^typedef union Struct_Member Struct_Member;$/;" t typeref:union:Struct_Member file:
......@@ -1684,7 +1684,7 @@ files src/metaprogram/metaprogram_parser.cpp /^ Lexer_File* files;$/;" m struct:
files_capacity src/metaprogram/metaprogram_parser.cpp /^ isize files_count, files_capacity;$/;" m struct:Lexer file:
files_count src/metaprogram/metaprogram_parser.cpp /^ isize files_count, files_capacity;$/;" m struct:Lexer file:
finalize_game_registry src/rituals_game_registry.cpp /^void finalize_game_registry()$/;" f
find_proc_prototypes src/metaprogram/metaprogram_parser.cpp /^Proc_Prototype* find_proc_prototypes(Token* start, Memory_Arena* arena)$/;" f
find_proc_prototypes src/metaprogram/metaprogram_parser.cpp /^Proc_Prototype* find_proc_prototypes(Lexer* lex, Token* start, Memory_Arena* arena)$/;" f
find_struct_defs src/metaprogram/metaprogram_parser.cpp /^Struct_Def* find_struct_defs(Lexer* lex, Token* start, Memory_Arena* arena)$/;" f
first src/thirdparty/stb_image.h /^ stbi_uc first;$/;" m struct:__anon16
first_row_filter src/thirdparty/stb_image.h /^static stbi_uc first_row_filter[5] =$/;" v
......@@ -2368,8 +2368,8 @@ next_random_double src/rituals_random.cpp /^real64 next_random_double(Random* r)
next_random_float src/rituals_game.cpp /^real32 next_random_float()$/;" f
next_random_float src/rituals_random.cpp /^real32 next_random_float(Random* r)$/;" f
next_random_uint64 src/rituals_random.cpp /^uint64 next_random_uint64(Random* r)$/;" f
nextchar src/metaprogram/metaprogram_parser.cpp 194;" d file:
nextchar src/metaprogram/metaprogram_parser.cpp 420;" d file:
nextchar src/metaprogram/metaprogram_parser.cpp 198;" d file:
nextchar src/metaprogram/metaprogram_parser.cpp 424;" d file:
night_amount src/rituals_renderer.cpp /^ real night_amount;$/;" m struct:Render_Group file:
night_amount src/wtb_sprite_renderer.h /^ real night_amount;$/;" m struct:Render_Group
night_cutoff src/rituals_renderer.cpp /^ real night_cutoff;$/;" m struct:Render_Group file:
......@@ -2439,7 +2439,7 @@ parse_number_tokens src/metaprogram/metaprogram_parser.cpp /^void parse_number_t
parse_sing src/metaprogram/metaprogram_parser.cpp /^void parse_sing(Token* t, int32 brace_level) $/;" f
parse_spritefont_rectangles rituals_gui.cpp /^Rect* parse_spritefont_rectangles(char* glyphs_file, Memory_Arena* arena, int32 offsetx, int32 offsety, int32* w, int32* h)$/;" f
parse_spritefont_rectangles src/rituals_gui.cpp /^Rect2* parse_spritefont_rectangles(char* glyphs_file, Memory_Arena* arena, int32 offsetx, int32 offsety, int32* w, int32* h)$/;" f
parse_struct_member src/metaprogram/metaprogram_parser.cpp /^Token* parse_struct_member(Struct_Def* parent, Token* start, Memory_Arena* arena)$/;" f
parse_struct_member src/metaprogram/metaprogram_parser.cpp /^Token* parse_struct_member(Lexer* lex, Struct_Def* parent, Token* start, Memory_Arena* arena)$/;" f
particles src/rituals_particles.cpp /^ Particle* particles;$/;" m struct:Emitter file:
particles_capacity src/rituals_particles.cpp /^ isize particles_count, particles_capacity;$/;" m struct:Emitter file:
particles_count src/rituals_particles.cpp /^ isize particles_count, particles_capacity;$/;" m struct:Emitter file:
......@@ -2473,6 +2473,7 @@ print_reflection_data src/metaprogram/metaprogram_parser.cpp /^void print_reflec
print_struct src/metaprogram/metaprogram_parser.cpp /^void print_struct(Struct_Def* def, bool as_member_struct = false, int32 indent = 0)$/;" f
print_struct_names src/metaprogram/metaprogram_parser.cpp /^void print_struct_names(Struct_Def* def, isize index, char* prefix, isize prefix_len, isize* counter, Memory_Arena* arena)$/;" f
print_token src/metaprogram/metaprogram_parser.cpp /^void print_token(Token* t, Token* start)$/;" f
procedures_count src/metaprogram/metaprogram_parser.cpp /^ isize procedures_count;$/;" m struct:Lexer_File file:
progressive src/thirdparty/stb_image.h /^ int progressive;$/;" m struct:__anon6
prop src/rituals_game_info.cpp /^ } prop;$/;" m union:Rituals_Entity_Userdata typeref:struct:Rituals_Entity_Userdata::__anon1 file:
ptr src/rituals_game_info.cpp /^ void* ptr;$/;" m struct:Rituals_Entity_Userdata::__anon12 file:
......@@ -2940,6 +2941,7 @@ stbi_zlib_decode_noheader_buffer src/thirdparty/stb_image.h /^STBIDEF int stbi_z
stbi_zlib_decode_noheader_malloc src/thirdparty/stb_image.h /^STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)$/;" f
step src/thirdparty/stb_image.h /^ int parse, step;$/;" m struct:__anon17
stop_state src/rituals_main.cpp /^void stop_state()$/;" f
structs_count src/metaprogram/metaprogram_parser.cpp /^ isize structs_count;$/;" m struct:Lexer_File file:
stub src/rituals_world_area.cpp /^ World_Area_Stub* stub;$/;" m struct:World_Area file:
style_index src/rituals_particles.cpp /^ int32 style_index;$/;" m struct:Particle file:
styles src/rituals_particles.cpp /^ Particle_Style* styles;$/;" m struct:Emitter file:
......@@ -3069,8 +3071,8 @@ v3 src/rituals_math.cpp /^static inline Vec3 v3(Vec2 a)$/;" f file:
v3 src/rituals_math.cpp /^static inline Vec3 v3(Vec2 a, real z)$/;" f file:
v3 src/rituals_math.cpp /^static inline Vec3 v3(real x, real y, real z)$/;" f file:
v4 src/rituals_math.cpp /^static inline Vec4 v4(real x, real y, real z, real w)$/;" f file:
valid src/metaprogram/metaprogram_parser.cpp 204;" d file:
valid src/metaprogram/metaprogram_parser.cpp 421;" d file:
valid src/metaprogram/metaprogram_parser.cpp 208;" d file:
valid src/metaprogram/metaprogram_parser.cpp 425;" d file:
validate_uint32 src/thirdparty/stb_image.h /^typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];$/;" t
value helping_gb.cpp /^ T value;$/;" m struct:MapEntry file:
value src/thirdparty/stb_image.h /^ stbi__uint16 value[288];$/;" m struct:__anon9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment