Final type fixups; package and build stuff straightened out

master
Allen Webster 2019-12-17 19:38:08 -08:00
parent 27a2a45f59
commit 4817510c5d
71 changed files with 852 additions and 910 deletions

View File

@ -363,7 +363,7 @@ buffer_seek_string(Application_Links *app, Buffer_ID buffer, String_Const_u8 nee
Gap_Buffer *gap_buffer = &file->state.buffer; Gap_Buffer *gap_buffer = &file->state.buffer;
i64 size = buffer_size(gap_buffer); i64 size = buffer_size(gap_buffer);
List_String_Const_u8 chunks = buffer_get_chunks(scratch, gap_buffer); List_String_Const_u8 chunks = buffer_get_chunks(scratch, gap_buffer);
Interval_i64 range = {}; Range_i64 range = {};
if (direction == Scan_Forward){ if (direction == Scan_Forward){
i64 adjusted_pos = start_pos + 1; i64 adjusted_pos = start_pos + 1;
start_pos = clamp_top(adjusted_pos, size); start_pos = clamp_top(adjusted_pos, size);
@ -1979,7 +1979,7 @@ managed_id_get(Application_Links *app, String_Const_u8 group, String_Const_u8 na
} }
api(custom) function void* api(custom) function void*
managed_scope_get_attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, umem size){ managed_scope_get_attachment(Application_Links *app, Managed_Scope scope, Managed_ID id, u64 size){
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope); Dynamic_Workspace *workspace = get_dynamic_workspace(models, scope);
void *result = 0; void *result = 0;
@ -2283,7 +2283,7 @@ set_custom_hook(Application_Links *app, Hook_ID hook_id, Void_Func *func_ptr){
} }
api(custom) function b32 api(custom) function b32
set_custom_hook_memory_size(Application_Links *app, Hook_ID hook_id, umem size){ set_custom_hook_memory_size(Application_Links *app, Hook_ID hook_id, u64 size){
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
b32 result = true; b32 result = true;
switch (hook_id){ switch (hook_id){
@ -2738,8 +2738,8 @@ set_window_title(Application_Links *app, String_Const_u8 title)
{ {
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
models->has_new_title = true; models->has_new_title = true;
umem cap_before_null = (umem)(models->title_capacity - 1); u64 cap_before_null = (u64)(models->title_capacity - 1);
umem copy_size = clamp_top(title.size, cap_before_null); u64 copy_size = clamp_top(title.size, cap_before_null);
block_copy(models->title_space, title.str, copy_size); block_copy(models->title_space, title.str, copy_size);
models->title_space[copy_size] = 0; models->title_space[copy_size] = 0;
} }
@ -2824,8 +2824,8 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
y = next_y; y = next_y;
} }
Interval_i64 visible_line_number_range = Ii64(buffer_point.line_number, line_number); Range_i64 visible_line_number_range = Ii64(buffer_point.line_number, line_number);
Interval_i64 visible_range = Ii64(buffer_get_first_pos_from_line_number(buffer, visible_line_number_range.min), Range_i64 visible_range = Ii64(buffer_get_first_pos_from_line_number(buffer, visible_line_number_range.min),
buffer_get_last_pos_from_line_number(buffer, visible_line_number_range.max)); buffer_get_last_pos_from_line_number(buffer, visible_line_number_range.max));
i64 item_count = range_size_inclusive(visible_range); i64 item_count = range_size_inclusive(visible_range);
@ -2978,8 +2978,7 @@ text_layout_character_on_screen(Application_Links *app, Text_Layout_ID layout_id
} }
api(custom) function void api(custom) function void
paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64 range, paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color){
ARGB_Color color){
Models *models = (Models*)app->cmd_context; Models *models = (Models*)app->cmd_context;
Rect_f32 result = {}; Rect_f32 result = {};
Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id); Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id);

View File

@ -63,7 +63,7 @@ struct Models{
Tick_Function *tick; Tick_Function *tick;
Render_Caller_Function *render_caller; Render_Caller_Function *render_caller;
Delta_Rule_Function *delta_rule; Delta_Rule_Function *delta_rule;
umem delta_rule_memory_size; u64 delta_rule_memory_size;
Hook_Function *buffer_viewer_update; Hook_Function *buffer_viewer_update;
Custom_Command_Function *view_event_handler; Custom_Command_Function *view_event_handler;

View File

@ -278,12 +278,12 @@ buffer_line_count(Gap_Buffer *buffer){
} }
internal void internal void
buffer_init(Gap_Buffer *buffer, u8 *data, umem size, Base_Allocator *allocator){ buffer_init(Gap_Buffer *buffer, u8 *data, u64 size, Base_Allocator *allocator){
block_zero_struct(buffer); block_zero_struct(buffer);
buffer->allocator = allocator; buffer->allocator = allocator;
umem capacity = round_up_umem(size*2, KB(4)); u64 capacity = round_up_u64(size*2, KB(4));
Data memory = base_allocate(allocator, capacity); Data memory = base_allocate(allocator, capacity);
buffer->data = (u8*)memory.data; buffer->data = (u8*)memory.data;
buffer->size1 = size/2; buffer->size1 = size/2;
@ -357,21 +357,21 @@ buffer_get_chunks(Arena *arena, Gap_Buffer *buffer){
string_list_push(arena, &list, SCu8(buffer->data, buffer->size1)); string_list_push(arena, &list, SCu8(buffer->data, buffer->size1));
} }
if (buffer->size2 > 0){ if (buffer->size2 > 0){
umem gap_2_pos = buffer->size1 + buffer->gap_size; u64 gap_2_pos = buffer->size1 + buffer->gap_size;
string_list_push(arena, &list, SCu8(buffer->data + gap_2_pos, buffer->size2)); string_list_push(arena, &list, SCu8(buffer->data + gap_2_pos, buffer->size2));
} }
return(list); return(list);
} }
internal void internal void
buffer_chunks_clamp(List_String_Const_u8 *chunks, Interval_i64 range){ buffer_chunks_clamp(List_String_Const_u8 *chunks, Range_i64 range){
i64 p = 0; i64 p = 0;
List_String_Const_u8 list = {}; List_String_Const_u8 list = {};
for (Node_String_Const_u8 *node = chunks->first, *next = 0; for (Node_String_Const_u8 *node = chunks->first, *next = 0;
node != 0; node != 0;
node = next){ node = next){
next = node->next; next = node->next;
Interval_i64 node_range = Ii64(p, p + node->string.size); Range_i64 node_range = Ii64(p, p + node->string.size);
if (range_overlap(range, node_range)){ if (range_overlap(range, node_range)){
i64 first = Max(node_range.first, range.first) - node_range.first; i64 first = Max(node_range.first, range.first) - node_range.first;
i64 one_past_last = Min(node_range.one_past_last, range.one_past_last) - node_range.first; i64 one_past_last = Min(node_range.one_past_last, range.one_past_last) - node_range.first;
@ -387,17 +387,17 @@ buffer_chunks_clamp(List_String_Const_u8 *chunks, Interval_i64 range){
} }
internal String_Const_u8 internal String_Const_u8
buffer_stringify(Arena *arena, Gap_Buffer *buffer, Interval_i64 range){ buffer_stringify(Arena *arena, Gap_Buffer *buffer, Range_i64 range){
List_String_Const_u8 list = buffer_get_chunks(arena, buffer); List_String_Const_u8 list = buffer_get_chunks(arena, buffer);
buffer_chunks_clamp(&list, range); buffer_chunks_clamp(&list, range);
return(string_list_flatten(arena, list, StringFill_NullTerminate)); return(string_list_flatten(arena, list, StringFill_NullTerminate));
} }
internal String_Const_u8 internal String_Const_u8
buffer_eol_convert_out(Arena *arena, Gap_Buffer *buffer, Interval_i64 range){ buffer_eol_convert_out(Arena *arena, Gap_Buffer *buffer, Range_i64 range){
List_String_Const_u8 list = buffer_get_chunks(arena, buffer); List_String_Const_u8 list = buffer_get_chunks(arena, buffer);
buffer_chunks_clamp(&list, range); buffer_chunks_clamp(&list, range);
umem cap = list.total_size*2; u64 cap = list.total_size*2;
u8 *memory = push_array(arena, u8, cap); u8 *memory = push_array(arena, u8, cap);
u8 *memory_opl = memory + cap; u8 *memory_opl = memory + cap;
u8 *ptr = memory; u8 *ptr = memory;
@ -549,7 +549,7 @@ push_line_move(Arena *arena, Line_Move *moves, i64 new_line_first,
function i64 function i64
count_lines(String_Const_u8 string){ count_lines(String_Const_u8 string){
i64 result = 0; i64 result = 0;
for (umem i = 0; i < string.size; i += 1){ for (u64 i = 0; i < string.size; i += 1){
if (string.str[i] == '\n'){ if (string.str[i] == '\n'){
result += 1; result += 1;
} }
@ -560,7 +560,7 @@ count_lines(String_Const_u8 string){
function void function void
fill_line_starts(i64 *lines_starts, String_Const_u8 string, i64 text_base){ fill_line_starts(i64 *lines_starts, String_Const_u8 string, i64 text_base){
i64 *ptr = lines_starts; i64 *ptr = lines_starts;
for (umem i = 0; i < string.size; i += 1){ for (u64 i = 0; i < string.size; i += 1){
if (string.str[i] == '\n'){ if (string.str[i] == '\n'){
*ptr = text_base + i + 1; *ptr = text_base + i + 1;
ptr += 1; ptr += 1;
@ -693,9 +693,9 @@ buffer_remeasure_starts(Arena *scratch, Gap_Buffer *buffer,
} }
#endif #endif
internal Interval_i64 internal Range_i64
buffer_get_pos_range_from_line_number(Gap_Buffer *buffer, i64 line_number){ buffer_get_pos_range_from_line_number(Gap_Buffer *buffer, i64 line_number){
Interval_i64 result = {}; Range_i64 result = {};
if (1 <= line_number && line_number < buffer->line_start_count){ if (1 <= line_number && line_number < buffer->line_start_count){
result.first = buffer->line_starts[line_number - 1]; result.first = buffer->line_starts[line_number - 1];
result.one_past_last = buffer->line_starts[line_number]; result.one_past_last = buffer->line_starts[line_number];
@ -815,7 +815,7 @@ buffer_get_chunk_position(String_Const_u8_Array chunks, i64 buffer_size, i64 rea
pos.real_pos = real_pos; pos.real_pos = real_pos;
pos.chunk_pos = real_pos; pos.chunk_pos = real_pos;
if (pos.real_pos != buffer_size){ if (pos.real_pos != buffer_size){
for (;(imem)(chunks.vals[pos.chunk_index].size) <= pos.chunk_pos;){ for (;(i64)(chunks.vals[pos.chunk_index].size) <= pos.chunk_pos;){
Assert(pos.chunk_index < chunks.count); Assert(pos.chunk_index < chunks.count);
pos.chunk_pos -= (i32)chunks.vals[pos.chunk_index].size; pos.chunk_pos -= (i32)chunks.vals[pos.chunk_index].size;
pos.chunk_index += 1; pos.chunk_index += 1;
@ -842,7 +842,7 @@ buffer_chunk_position_iterate(String_Const_u8_Array chunks, Buffer_Chunk_Positio
pos->chunk_pos = (i32)chunks.vals[pos->chunk_index].size - 1; pos->chunk_pos = (i32)chunks.vals[pos->chunk_index].size - 1;
} }
} }
else if (pos->chunk_pos >= (imem)(chunks.vals[pos->chunk_index].size)){ else if (pos->chunk_pos >= (i64)(chunks.vals[pos->chunk_index].size)){
pos->chunk_index += 1; pos->chunk_index += 1;
if (pos->chunk_index == chunks.count){ if (pos->chunk_index == chunks.count){
past_end = 1; past_end = 1;

View File

@ -97,7 +97,7 @@ dynamic_variable_block_init(Base_Allocator *allocator, Dynamic_Variable_Block *b
} }
internal Data internal Data
dynamic_variable_get(Dynamic_Variable_Block *block, Managed_ID id, umem size){ dynamic_variable_get(Dynamic_Variable_Block *block, Managed_ID id, u64 size){
Data result = {}; Data result = {};
Table_Lookup lookup = table_lookup(&block->id_to_data_table, id); Table_Lookup lookup = table_lookup(&block->id_to_data_table, id);
if (lookup.found_match){ if (lookup.found_match){
@ -425,7 +425,7 @@ lifetime_get_or_create_intersection_key(Lifetime_Allocator *lifetime_allocator,
} }
// Initialize // Initialize
umem new_memory_size = sizeof(Lifetime_Object*)*count; u64 new_memory_size = sizeof(Lifetime_Object*)*count;
Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size); Data new_memory = base_allocate(lifetime_allocator->allocator, new_memory_size);
new_key->members = (Lifetime_Object**)new_memory.data; new_key->members = (Lifetime_Object**)new_memory.data;
block_copy_dynamic_array(new_key->members, object_ptr_array, count); block_copy_dynamic_array(new_key->members, object_ptr_array, count);

View File

@ -9,12 +9,12 @@
// TOP // TOP
internal void function void
pre_edit_state_change(Models *models, Editing_File *file){ pre_edit_state_change(Models *models, Editing_File *file){
file_add_dirty_flag(file, DirtyState_UnsavedChanges); file_add_dirty_flag(file, DirtyState_UnsavedChanges);
} }
internal void function void
pre_edit_history_prep(Editing_File *file, Edit_Behaviors behaviors){ pre_edit_history_prep(Editing_File *file, Edit_Behaviors behaviors){
if (!behaviors.do_not_post_to_history){ if (!behaviors.do_not_post_to_history){
history_dump_records_after_index(&file->state.history, history_dump_records_after_index(&file->state.history,
@ -22,9 +22,9 @@ pre_edit_history_prep(Editing_File *file, Edit_Behaviors behaviors){
} }
} }
internal void function void
post_edit_call_hook(Thread_Context *tctx, Models *models, Editing_File *file, post_edit_call_hook(Thread_Context *tctx, Models *models, Editing_File *file,
Range_i64 new_range, umem original_size){ Range_i64 new_range, u64 original_size){
// NOTE(allen): edit range hook // NOTE(allen): edit range hook
if (models->buffer_edit_range != 0){ if (models->buffer_edit_range != 0){
Application_Links app = {}; Application_Links app = {};
@ -34,7 +34,7 @@ post_edit_call_hook(Thread_Context *tctx, Models *models, Editing_File *file,
} }
} }
internal void function void
edit_fix_markers__write_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id, edit_fix_markers__write_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id,
Cursor_With_Index *cursors, Cursor_With_Index *r_cursors, Cursor_With_Index *cursors, Cursor_With_Index *r_cursors,
i32 *cursor_count, i32 *r_cursor_count){ i32 *cursor_count, i32 *r_cursor_count){
@ -56,7 +56,7 @@ edit_fix_markers__write_workspace_markers(Dynamic_Workspace *workspace, Buffer_I
} }
} }
internal void function void
edit_fix_markers__read_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id, edit_fix_markers__read_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID buffer_id,
Cursor_With_Index *cursors, Cursor_With_Index *r_cursors, i32 *cursor_count, i32 *r_cursor_count){ Cursor_With_Index *cursors, Cursor_With_Index *r_cursors, i32 *cursor_count, i32 *r_cursor_count){
for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first; for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first;
@ -77,19 +77,19 @@ edit_fix_markers__read_workspace_markers(Dynamic_Workspace *workspace, Buffer_ID
} }
} }
internal f32 function f32
edit_fix_markers__compute_scroll_y(i32 line_height, f32 old_y_val, f32 new_y_val_aligned){ edit_fix_markers__compute_scroll_y(i32 line_height, f32 old_y_val, f32 new_y_val_aligned){
f32 y_offset = mod_f32(old_y_val, line_height); f32 y_offset = mod_f32(old_y_val, line_height);
f32 y_position = new_y_val_aligned + y_offset; f32 y_position = new_y_val_aligned + y_offset;
return(y_position); return(y_position);
} }
internal i32 function i32
edit_fix_markers__compute_scroll_y(i32 line_height, i32 old_y_val, f32 new_y_val_aligned){ edit_fix_markers__compute_scroll_y(i32 line_height, i32 old_y_val, f32 new_y_val_aligned){
return((i32)edit_fix_markers__compute_scroll_y(line_height, (f32)old_y_val, new_y_val_aligned)); return((i32)edit_fix_markers__compute_scroll_y(line_height, (f32)old_y_val, new_y_val_aligned));
} }
internal void function void
edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file, edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file,
Batch_Edit *batch){ Batch_Edit *batch){
Layout *layout = &models->layout; Layout *layout = &models->layout;
@ -200,7 +200,7 @@ edit_fix_markers(Thread_Context *tctx, Models *models, Editing_File *file,
} }
} }
internal void function void
file_end_file(Thread_Context *tctx, Models *models, Editing_File *file){ file_end_file(Thread_Context *tctx, Models *models, Editing_File *file){
if (models->end_buffer != 0){ if (models->end_buffer != 0){
Application_Links app = {}; Application_Links app = {};
@ -213,9 +213,8 @@ file_end_file(Thread_Context *tctx, Models *models, Editing_File *file){
file->lifetime_object = lifetime_alloc_object(lifetime_allocator, DynamicWorkspace_Buffer, file); file->lifetime_object = lifetime_alloc_object(lifetime_allocator, DynamicWorkspace_Buffer, file);
} }
internal void function void
edit__apply(Thread_Context *tctx, Models *models, Editing_File *file, edit__apply(Thread_Context *tctx, Models *models, Editing_File *file, Range_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){
Interval_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){
Edit edit = {}; Edit edit = {};
edit.text = string; edit.text = string;
edit.range = range; edit.range = range;
@ -241,7 +240,7 @@ edit__apply(Thread_Context *tctx, Models *models, Editing_File *file,
} }
} }
internal void function void
edit_single(Thread_Context *tctx, Models *models, Editing_File *file, edit_single(Thread_Context *tctx, Models *models, Editing_File *file,
Range_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){ Range_i64 range, String_Const_u8 string, Edit_Behaviors behaviors){
pre_edit_state_change(models, file); pre_edit_state_change(models, file);
@ -261,7 +260,7 @@ edit_single(Thread_Context *tctx, Models *models, Editing_File *file,
Ii64_size(range.first, string.size), range_size(range)); Ii64_size(range.first, string.size), range_size(range));
} }
internal void function void
edit__apply_record_forward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ edit__apply_record_forward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){
// NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen):
// Whenever you change this also change the backward version! // Whenever you change this also change the backward version!
@ -270,7 +269,7 @@ edit__apply_record_forward(Thread_Context *tctx, Models *models, Editing_File *f
case RecordKind_Single: case RecordKind_Single:
{ {
String_Const_u8 str = record->single.forward_text; String_Const_u8 str = record->single.forward_text;
Interval_i64 range = Ii64(record->single.first, record->single.first + record->single.backward_text.size); Range_i64 range = Ii64(record->single.first, record->single.first + record->single.backward_text.size);
edit_single(tctx, models, file, range, str, behaviors_prototype); edit_single(tctx, models, file, range, str, behaviors_prototype);
}break; }break;
@ -292,7 +291,7 @@ edit__apply_record_forward(Thread_Context *tctx, Models *models, Editing_File *f
} }
} }
internal void function void
edit__apply_record_backward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){ edit__apply_record_backward(Thread_Context *tctx, Models *models, Editing_File *file, Record *record, Edit_Behaviors behaviors_prototype){
// NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen): // NOTE(allen):
// Whenever you change this also change the forward version! // Whenever you change this also change the forward version!
@ -301,7 +300,7 @@ edit__apply_record_backward(Thread_Context *tctx, Models *models, Editing_File *
case RecordKind_Single: case RecordKind_Single:
{ {
String_Const_u8 str = record->single.backward_text; String_Const_u8 str = record->single.backward_text;
Interval_i64 range = Ii64(record->single.first, record->single.first + record->single.forward_text.size); Range_i64 range = Ii64(record->single.first, record->single.first + record->single.forward_text.size);
edit_single(tctx, models, file, range, str, behaviors_prototype); edit_single(tctx, models, file, range, str, behaviors_prototype);
}break; }break;
@ -323,7 +322,7 @@ edit__apply_record_backward(Thread_Context *tctx, Models *models, Editing_File *
} }
} }
internal void function void
edit_change_current_history_state(Thread_Context *tctx, Models *models, Editing_File *file, i32 target_index){ edit_change_current_history_state(Thread_Context *tctx, Models *models, Editing_File *file, i32 target_index){
History *history = &file->state.history; History *history = &file->state.history;
if (history->activated && file->state.current_record_index != target_index){ if (history->activated && file->state.current_record_index != target_index){
@ -358,7 +357,7 @@ edit_change_current_history_state(Thread_Context *tctx, Models *models, Editing_
} }
} }
internal b32 function b32
edit_merge_history_range(Thread_Context *tctx, Models *models, Editing_File *file, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags){ edit_merge_history_range(Thread_Context *tctx, Models *models, Editing_File *file, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags){
b32 result = false; b32 result = false;
History *history = &file->state.history; History *history = &file->state.history;
@ -419,7 +418,7 @@ edit_batch_check(Thread_Context *tctx, Profile_Global_List *list, Batch_Edit *ba
return(result); return(result);
} }
internal b32 function b32
edit_batch(Thread_Context *tctx, Models *models, Editing_File *file, edit_batch(Thread_Context *tctx, Models *models, Editing_File *file,
Batch_Edit *batch, Edit_Behaviors behaviors){ Batch_Edit *batch, Edit_Behaviors behaviors){
b32 result = true; b32 result = true;
@ -502,7 +501,7 @@ edit_batch(Thread_Context *tctx, Models *models, Editing_File *file,
//////////////////////////////// ////////////////////////////////
internal Editing_File* function Editing_File*
create_file(Thread_Context *tctx, Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags){ create_file(Thread_Context *tctx, Models *models, String_Const_u8 file_name, Buffer_Create_Flag flags){
Editing_File *result = 0; Editing_File *result = 0;

View File

@ -111,7 +111,7 @@ file_clear_dirty_flags(Editing_File *file){
internal void internal void
file_name_terminate(Editing_File_Name *name){ file_name_terminate(Editing_File_Name *name){
umem size = name->name_size; u64 size = name->name_size;
size = clamp_top(size, sizeof(name->name_space) - 1); size = clamp_top(size, sizeof(name->name_space) - 1);
name->name_space[size] = 0; name->name_space[size] = 0;
name->name_size = size; name->name_size = size;
@ -395,7 +395,7 @@ file_line_y_difference(Thread_Context *tctx, Models *models, Editing_File *file,
i64 line_a, i64 line_b){ i64 line_a, i64 line_b){
f32 result = 0.f; f32 result = 0.f;
if (line_a != line_b){ if (line_a != line_b){
Interval_i64 line_range = Ii64(line_a, line_b); Range_i64 line_range = Ii64(line_a, line_b);
for (i64 i = line_range.min; i < line_range.max; i += 1){ for (i64 i = line_range.min; i < line_range.max; i += 1){
Layout_Item_List line = file_get_line_layout(tctx, models, file, layout_func, width, face, i); Layout_Item_List line = file_get_line_layout(tctx, models, file, layout_func, width, face, i);
result += line.height; result += line.height;
@ -522,7 +522,7 @@ internal i64
file_line_character_difference(Thread_Context *tctx, Models *models, Editing_File *file, Layout_Function *layout_func, f32 width, Face *face, i64 line_a, i64 line_b){ file_line_character_difference(Thread_Context *tctx, Models *models, Editing_File *file, Layout_Function *layout_func, f32 width, Face *face, i64 line_a, i64 line_b){
i64 result = 0; i64 result = 0;
if (line_a != line_b){ if (line_a != line_b){
Interval_i64 line_range = Ii64(line_a, line_b); Range_i64 line_range = Ii64(line_a, line_b);
for (i64 i = line_range.min; i < line_range.max; i += 1){ for (i64 i = line_range.min; i < line_range.max; i += 1){
Layout_Item_List line = file_get_line_layout(tctx, models, file, layout_func, width, face, i); Layout_Item_List line = file_get_line_layout(tctx, models, file, layout_func, width, face, i);
result += line.character_count; result += line.character_count;

View File

@ -79,7 +79,7 @@ struct Editing_File_State{
struct Editing_File_Name{ struct Editing_File_Name{
u8 name_space[256]; u8 name_space[256];
umem name_size; u64 name_size;
}; };
struct Editing_File{ struct Editing_File{

View File

@ -348,8 +348,8 @@ layout_get_absolute_position_of_split(Panel *panel){
return(pos); return(pos);
} }
internal Range internal Range_i32
layout__get_limiting_range_on_split_children(i32 mid, b32 vertical_split, Panel *panel, Range range){ layout__get_limiting_range_on_split_children(i32 mid, b32 vertical_split, Panel *panel, Range_i32 range){
if (panel->kind == PanelKind_Intermediate){ if (panel->kind == PanelKind_Intermediate){
if (vertical_split == panel->vertical_split){ if (vertical_split == panel->vertical_split){
i32 pos = layout_get_absolute_position_of_split(panel); i32 pos = layout_get_absolute_position_of_split(panel);
@ -366,10 +366,10 @@ layout__get_limiting_range_on_split_children(i32 mid, b32 vertical_split, Panel
return(range); return(range);
} }
internal Range internal Range_i32
layout_get_limiting_range_on_split(Layout *layout, Panel *panel){ layout_get_limiting_range_on_split(Layout *layout, Panel *panel){
// root level min max // root level min max
Range range = {}; Range_i32 range = {};
if (panel->vertical_split){ if (panel->vertical_split){
range.max = layout->full_dim.x; range.max = layout->full_dim.x;
} }

View File

@ -12,25 +12,25 @@
#if 0 #if 0
internal void internal void
block_zero(void *a, umem size){ block_zero(void *a, u64 size){
for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){ for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){
*ptr = 0; *ptr = 0;
} }
} }
internal void internal void
block_fill_ones(void *a, umem size){ block_fill_ones(void *a, u64 size){
for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){ for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){
*ptr = 0xFF; *ptr = 0xFF;
} }
} }
internal void internal void
block_copy(void *dst, void *src, umem size){ block_copy(void *dst, void *src, u64 size){
for (u8 *d = (u8*)dst, *s = (u8*)src, *e = s + size; s < e; d += 1, s += 1){ for (u8 *d = (u8*)dst, *s = (u8*)src, *e = s + size; s < e; d += 1, s += 1){
*d = *s; *d = *s;
} }
} }
internal i32 internal i32
block_compare(void *a, void *b, umem size){ block_compare(void *a, void *b, u64 size){
for (u8 *aptr = (u8*)a, *bptr = (u8*)b, *e = bptr + size; bptr < e; aptr += 1, bptr += 1){ for (u8 *aptr = (u8*)a, *bptr = (u8*)b, *e = bptr + size; bptr < e; aptr += 1, bptr += 1){
i32 dif = (i32)*aptr - (i32)*bptr; i32 dif = (i32)*aptr - (i32)*bptr;
if (dif != 0){ if (dif != 0){
@ -40,31 +40,31 @@ block_compare(void *a, void *b, umem size){
return(0); return(0);
} }
internal void internal void
block_fill_u8(void *a, umem size, u8 val){ block_fill_u8(void *a, u64 size, u8 val){
for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){ for (u8 *ptr = (u8*)a, *e = ptr + size; ptr < e; ptr += 1){
*ptr = val; *ptr = val;
} }
} }
internal void internal void
block_fill_u16(void *a, umem size, u16 val){ block_fill_u16(void *a, u64 size, u16 val){
Assert(size%sizeof(u16) == 0); Assert(size%sizeof(u16) == 0);
umem count = size/sizeof(u16); u64 count = size/sizeof(u16);
for (u16 *ptr = (u16*)a, *e = ptr + count; ptr < e; ptr += 1){ for (u16 *ptr = (u16*)a, *e = ptr + count; ptr < e; ptr += 1){
*ptr = val; *ptr = val;
} }
} }
internal void internal void
block_fill_u32(void *a, umem size, u32 val){ block_fill_u32(void *a, u64 size, u32 val){
Assert(size%sizeof(u32) == 0); Assert(size%sizeof(u32) == 0);
umem count = size/sizeof(u32); u64 count = size/sizeof(u32);
for (u32 *ptr = (u32*)a, *e = ptr + count; ptr < e; ptr += 1){ for (u32 *ptr = (u32*)a, *e = ptr + count; ptr < e; ptr += 1){
*ptr = val; *ptr = val;
} }
} }
internal void internal void
block_fill_u64(void *a, umem size, u64 val){ block_fill_u64(void *a, u64 size, u64 val){
Assert(size%sizeof(u64) == 0); Assert(size%sizeof(u64) == 0);
umem count = size/sizeof(u64); u64 count = size/sizeof(u64);
for (u64 *ptr = (u64*)a, *e = ptr + count; ptr < e; ptr += 1){ for (u64 *ptr = (u64*)a, *e = ptr + count; ptr < e; ptr += 1){
*ptr = val; *ptr = val;
} }

View File

@ -29,7 +29,7 @@ function String_Const_u8
get_full_path(Arena *arena, Path_Search_List *search_list, String_Const_u8 relative){ get_full_path(Arena *arena, Path_Search_List *search_list, String_Const_u8 relative){
String_Const_u8 result = {}; String_Const_u8 result = {};
Temp_Memory restore_point = begin_temp(arena); Temp_Memory restore_point = begin_temp(arena);
umem buffer_cap = search_list->max_member_length + relative.size + 1; u64 buffer_cap = search_list->max_member_length + relative.size + 1;
u8 *buffer = push_array(arena, u8, buffer_cap); u8 *buffer = push_array(arena, u8, buffer_cap);
u8 *opl = buffer + buffer_cap; u8 *opl = buffer + buffer_cap;
u8 *relative_base = opl - 1 - relative.size; u8 *relative_base = opl - 1 - relative.size;
@ -38,7 +38,7 @@ get_full_path(Arena *arena, Path_Search_List *search_list, String_Const_u8 relat
for (Node_String_Const_u8 *node = search_list->list.first; for (Node_String_Const_u8 *node = search_list->list.first;
node != 0; node != 0;
node = node->next){ node = node->next){
umem node_size = node->string.size; u64 node_size = node->string.size;
u8 *path_base = relative_base - node_size; u8 *path_base = relative_base - node_size;
block_copy(path_base, node->string.str, node_size); block_copy(path_base, node->string.str, node_size);
String_Const_u8 name = SCu8(path_base, opl); String_Const_u8 name = SCu8(path_base, opl);

View File

@ -14,7 +14,7 @@
struct Path_Search_List{ struct Path_Search_List{
List_String_Const_u8 list; List_String_Const_u8 list;
umem max_member_length; u64 max_member_length;
}; };
#endif #endif

View File

@ -229,21 +229,21 @@ api_call(arena, api, "condition_variable_make",
{ {
API_Call *call = api_call(arena, api, "memory_allocate", "void*"); API_Call *call = api_call(arena, api, "memory_allocate", "void*");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
api_param(arena, call, "String_Const_u8", "location"); api_param(arena, call, "String_Const_u8", "location");
} }
{ {
API_Call *call = api_call(arena, api, "memory_set_protection", "b32"); API_Call *call = api_call(arena, api, "memory_set_protection", "b32");
api_param(arena, call, "void*", "ptr"); api_param(arena, call, "void*", "ptr");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
api_param(arena, call, "u32", "flags"); api_param(arena, call, "u32", "flags");
} }
{ {
API_Call *call = api_call(arena, api, "memory_free", "void"); API_Call *call = api_call(arena, api, "memory_free", "void");
api_param(arena, call, "void*", "ptr"); api_param(arena, call, "void*", "ptr");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
} }
{ {

View File

@ -18,8 +18,8 @@ union Text_Layout{
Arena *arena; Arena *arena;
Buffer_ID buffer_id; Buffer_ID buffer_id;
Buffer_Point point; Buffer_Point point;
Interval_i64 visible_range; Range_i64 visible_range;
Interval_i64 visible_line_number_range; Range_i64 visible_line_number_range;
Rect_f32 rect; Rect_f32 rect;
ARGB_Color *item_colors; ARGB_Color *item_colors;
Layout_Function *layout_func; Layout_Function *layout_func;

View File

@ -207,7 +207,7 @@ get_file_from_identifier(Working_Set *working_set, Buffer_Identifier buffer){
// TODO(allen): Bring the clipboard fully to the custom side. // TODO(allen): Bring the clipboard fully to the custom side.
internal String_Const_u8* internal String_Const_u8*
working_set_next_clipboard_string(Heap *heap, Working_Set *working, umem str_size){ working_set_next_clipboard_string(Heap *heap, Working_Set *working, u64 str_size){
i32 clipboard_current = working->clipboard_current; i32 clipboard_current = working->clipboard_current;
if (working->clipboard_size == 0){ if (working->clipboard_size == 0){
clipboard_current = 0; clipboard_current = 0;
@ -276,7 +276,7 @@ internal b32
get_canon_name(Arena *scratch, String_Const_u8 file_name, Editing_File_Name *canon_name){ get_canon_name(Arena *scratch, String_Const_u8 file_name, Editing_File_Name *canon_name){
Temp_Memory temp = begin_temp(scratch); Temp_Memory temp = begin_temp(scratch);
String_Const_u8 canonical = system_get_canonical(scratch, file_name); String_Const_u8 canonical = system_get_canonical(scratch, file_name);
umem size = Min(sizeof(canon_name->name_space), canonical.size); u64 size = Min(sizeof(canon_name->name_space), canonical.size);
block_copy(canon_name->name_space, canonical.str, size); block_copy(canon_name->name_space, canonical.str, size);
canon_name->name_size = size; canon_name->name_size = size;
end_temp(temp); end_temp(temp);
@ -288,7 +288,7 @@ internal void
file_bind_file_name(Working_Set *working_set, Editing_File *file, String_Const_u8 canon_file_name){ file_bind_file_name(Working_Set *working_set, Editing_File *file, String_Const_u8 canon_file_name){
Assert(file->unique_name.name_size == 0); Assert(file->unique_name.name_size == 0);
Assert(file->canon.name_size == 0); Assert(file->canon.name_size == 0);
umem size = canon_file_name.size; u64 size = canon_file_name.size;
size = clamp_top(size, sizeof(file->canon.name_space) - 1); size = clamp_top(size, sizeof(file->canon.name_space) - 1);
file->canon.name_size = size; file->canon.name_size = size;
block_copy(file->canon.name_space, canon_file_name.str, size); block_copy(file->canon.name_space, canon_file_name.str, size);
@ -323,11 +323,11 @@ buffer_name_has_conflict(Working_Set *working_set, String_Const_u8 base_name){
internal void internal void
buffer_resolve_name_low_level(Arena *scratch, Working_Set *working_set, Editing_File_Name *name, String_Const_u8 base_name){ buffer_resolve_name_low_level(Arena *scratch, Working_Set *working_set, Editing_File_Name *name, String_Const_u8 base_name){
umem size = base_name.size; u64 size = base_name.size;
size = clamp_top(size, sizeof(name->name_space)); size = clamp_top(size, sizeof(name->name_space));
block_copy(name->name_space, base_name.str, size); block_copy(name->name_space, base_name.str, size);
String_u8 string = Su8(name->name_space, size, sizeof(name->name_space)); String_u8 string = Su8(name->name_space, size, sizeof(name->name_space));
umem original_size = string.size; u64 original_size = string.size;
u64 file_x = 0; u64 file_x = 0;
for (b32 hit_conflict = true; hit_conflict;){ for (b32 hit_conflict = true; hit_conflict;){
hit_conflict = buffer_name_has_conflict(working_set, string.string); hit_conflict = buffer_name_has_conflict(working_set, string.string);
@ -354,14 +354,14 @@ buffer_bind_name_low_level(Arena *scratch, Working_Set *working_set, Editing_Fil
buffer_resolve_name_low_level(scratch, working_set, &new_name, name); buffer_resolve_name_low_level(scratch, working_set, &new_name, name);
{ {
umem size = base_name.size; u64 size = base_name.size;
size = clamp_top(size, sizeof(file->base_name.name_space)); size = clamp_top(size, sizeof(file->base_name.name_space));
block_copy(file->base_name.name_space, base_name.str, size); block_copy(file->base_name.name_space, base_name.str, size);
file->base_name.name_size = size; file->base_name.name_size = size;
} }
{ {
umem size = new_name.name_size; u64 size = new_name.name_size;
block_copy(file->unique_name.name_space, new_name.name_space, size); block_copy(file->unique_name.name_space, new_name.name_space, size);
file->unique_name.name_size = size; file->unique_name.name_size = size;
} }
@ -431,7 +431,7 @@ buffer_bind_name(Thread_Context *tctx, Models *models, Arena *scratch, Working_S
if (i > 0){ if (i > 0){
b = string_from_file_name(&file_ptr->unique_name); b = string_from_file_name(&file_ptr->unique_name);
} }
umem unique_name_capacity = 256; u64 unique_name_capacity = 256;
u8 *unique_name_buffer = push_array(scratch, u8, unique_name_capacity); u8 *unique_name_buffer = push_array(scratch, u8, unique_name_capacity);
Assert(b.size <= unique_name_capacity); Assert(b.size <= unique_name_capacity);
block_copy(unique_name_buffer, b.str, b.size); block_copy(unique_name_buffer, b.str, b.size);

View File

@ -137,14 +137,14 @@ enum{
OPTIMIZATION = 0x20, OPTIMIZATION = 0x20,
SUPER = 0x40, SUPER = 0x40,
INTERNAL = 0x80, INTERNAL = 0x80,
KEEP_ASSERT = 0x100, SHIP = 0x100,
}; };
internal char** internal char**
get_defines_from_flags(Arena *arena, u32 flags){ get_defines_from_flags(Arena *arena, u32 flags){
char **result = 0; char **result = 0;
if (HasFlag(flags, KEEP_ASSERT)){ if (HasFlag(flags, SHIP)){
result = fm_list(arena, fm_list_one_item(arena, "FRED_KEEP_ASSERT"), result); result = fm_list(arena, fm_list_one_item(arena, "SHIP_MODE"), result);
} }
if (HasFlag(flags, INTERNAL)){ if (HasFlag(flags, INTERNAL)){
result = fm_list(arena, fm_list_one_item(arena, "FRED_INTERNAL"), result); result = fm_list(arena, fm_list_one_item(arena, "FRED_INTERNAL"), result);
@ -270,6 +270,7 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
fm_finish_build_line(&line); fm_finish_build_line(&line);
//printf("%s\n", line.build_options);
systemf("%s", line.build_options); systemf("%s", line.build_options);
fm_popdir(temp); fm_popdir(temp);
@ -419,25 +420,6 @@ build_and_run(Arena *arena, char *cdir, char *filename, char *name, u32 flags){
} }
} }
internal void
string_build(Arena *arena, char *cdir){
char *dir = fm_str(arena, BUILD_DIR);
{
char *file = fm_str(arena, "string/4ed_string_builder.cpp");
BEGIN_TIME_SECTION();
build(arena, OPTS | DEBUG_INFO, Arch_X64, cdir, file, dir, "string_builder", 0, 0, includes);
END_TIME_SECTION("build string_builder");
}
if (prev_error == 0){
char *cmd = fm_str(arena, cdir, "/", dir, "/string_builder");
BEGIN_TIME_SECTION();
fm_execute_in_dir(fm_str(arena, cdir, "/string"), cmd, 0);
END_TIME_SECTION("run string_builder");
}
}
internal void internal void
buildsuper(Arena *arena, char *cdir, char *file, u32 arch){ buildsuper(Arena *arena, char *cdir, char *file, u32 arch){
printf("BUILDSUPER: cdir: %s; file: %s; arch: %u\n", cdir, file, arch); printf("BUILDSUPER: cdir: %s; file: %s; arch: %u\n", cdir, file, arch);
@ -458,29 +440,6 @@ buildsuper(Arena *arena, char *cdir, char *file, u32 arch){
fflush(stdout); fflush(stdout);
} }
// TODO(allen): Remove this
internal i32
get_freetype_include(char *out, u32 max){
i32 size = 0;
#if 0
#if OS_LINUX
char freetype_include[512];
FILE *file = popen("pkg-config --cflags freetype2", "r");
if (file != 0){
fgets(freetype_include, sizeof(freetype_include), file);
size = strlen(freetype_include);
memcpy(out, freetype_include, size);
pclose(file);
}
#elif OS_MAC
char *freetype_include = "/usr/local/include/freetype2";
size = strlen(freetype_include);
memcpy(out, freetype_include, size);
#endif
#endif
return(size);
}
internal void internal void
build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch){ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch){
char *dir = fm_str(arena, BUILD_DIR); char *dir = fm_str(arena, BUILD_DIR);
@ -491,14 +450,6 @@ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch
char **build_includes = includes; char **build_includes = includes;
char ft_include[512];
i32 ft_size = get_freetype_include(ft_include, sizeof(ft_include) - 1);
if (ft_size > 0){
ft_include[ft_size] = 0;
fprintf(stdout, "FREETYPE: %s\n", ft_include);
build_includes = fm_list(arena, build_includes, fm_list_one_item(arena, ft_include));
}
BEGIN_TIME_SECTION(); BEGIN_TIME_SECTION();
build(arena, OPTS | SHARED_CODE | flags, arch, cdir, file, dir, "4ed_app" DLL, get_defines_from_flags(arena, flags), exports, build_includes); build(arena, OPTS | SHARED_CODE | flags, arch, cdir, file, dir, "4ed_app" DLL, get_defines_from_flags(arena, flags), exports, build_includes);
END_TIME_SECTION("build 4ed_app"); END_TIME_SECTION("build 4ed_app");
@ -564,7 +515,7 @@ package(Arena *arena, char *cdir){
fflush(stdout); fflush(stdout);
char *tier_names[] = { "demo", "super", }; char *tier_names[] = { "demo", "super", };
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO; u32 base_flags = SHIP | DEBUG_INFO | OPTIMIZATION;
u32 tier_flags[] = { 0, SUPER, }; u32 tier_flags[] = { 0, SUPER, };
fm_make_folder_if_missing(arena, pack_dir); fm_make_folder_if_missing(arena, pack_dir);
@ -633,16 +584,20 @@ int main(int argc, char **argv){
Assert(n < sizeof(cdir)); Assert(n < sizeof(cdir));
END_TIME_SECTION("current directory"); END_TIME_SECTION("current directory");
#if defined(DEV_BUILD) || defined(OPT_BUILD) || defined(DEV_BUILD_X86) u32 flags = SUPER;
u32 flags = DEBUG_INFO | SUPER | INTERNAL;
u32 arch = Arch_X64; u32 arch = Arch_X64;
#if defined(OPT_BUILD) #if defined(DEV_BUILD) || defined(DEV_BUILD_X86)
flags |= OPTIMIZATION; flags |= DEBUG_INFO | INTERNAL;
#endif #endif
#if defined(DEV_BUILD_X86) #if defined(OPT_BUILD) || defined(OPT_BUILD_X86)
flags |= OPTIMIZATION;
#endif
#if defined(DEV_BUILD_X86) || defined(OPT_BUILD_X86)
arch = Arch_X86; arch = Arch_X86;
#endif #endif
standard_build(&arena, cdir, flags, arch);
#if defined(DEV_BUILD) || defined(OPT_BUILD) || defined(DEV_BUILD_X86)
standard_build(&arena, cdir, flags, arch);
#elif defined(PACKAGE) #elif defined(PACKAGE)
package(&arena, cdir); package(&arena, cdir);

View File

@ -15,13 +15,13 @@ Scratch_Block::Scratch_Block(Application_Links *app){
//////////////////////////////// ////////////////////////////////
internal Arena* internal Arena*
reserve_arena(Application_Links *app, umem chunk_size, umem align){ reserve_arena(Application_Links *app, u64 chunk_size, u64 align){
Thread_Context *tctx = get_thread_context(app); Thread_Context *tctx = get_thread_context(app);
return(reserve_arena(tctx, chunk_size, align)); return(reserve_arena(tctx, chunk_size, align));
} }
internal Arena* internal Arena*
reserve_arena(Application_Links *app, umem chunk_size){ reserve_arena(Application_Links *app, u64 chunk_size){
Thread_Context *tctx = get_thread_context(app); Thread_Context *tctx = get_thread_context(app);
return(reserve_arena(tctx, chunk_size)); return(reserve_arena(tctx, chunk_size));
} }

View File

@ -26,7 +26,7 @@ make_batch_from_indentations(Application_Links *app, Arena *arena, Buffer_ID buf
} }
if (correct_indentation != indent_info.indent_pos){ if (correct_indentation != indent_info.indent_pos){
umem str_size = 0; u64 str_size = 0;
u8 *str = 0; u8 *str = 0;
if (HasFlag(flags, Indent_UseTab)){ if (HasFlag(flags, Indent_UseTab)){
i64 tab_count = correct_indentation/tab_width; i64 tab_count = correct_indentation/tab_width;
@ -399,7 +399,7 @@ CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if a
String_Const_u8 insert = to_writable(&in); String_Const_u8 insert = to_writable(&in);
if (insert.str != 0 && insert.size > 0){ if (insert.str != 0 && insert.size > 0){
b32 do_auto_indent = false; b32 do_auto_indent = false;
for (umem i = 0; !do_auto_indent && i < insert.size; i += 1){ for (u64 i = 0; !do_auto_indent && i < insert.size; i += 1){
switch (insert.str[i]){ switch (insert.str[i]){
case ';': case ':': case ';': case ':':
case '{': case '}': case '{': case '}':

View File

@ -588,8 +588,8 @@ CUSTOM_DOC("Removes trailing whitespace from all lines in the current buffer.")
String_Const_u8 text = push_whole_buffer(app, scratch, buffer); String_Const_u8 text = push_whole_buffer(app, scratch, buffer);
umem whitespace_start = 0; u64 whitespace_start = 0;
for (umem i = 0; i < text.size; i += 1){ for (u64 i = 0; i < text.size; i += 1){
u8 v = string_get_character(text, i); u8 v = string_get_character(text, i);
if (v == '\n' || i + 1 == text.size){ if (v == '\n' || i + 1 == text.size){
if (whitespace_start < i){ if (whitespace_start < i){
@ -752,7 +752,7 @@ CUSTOM_DOC("Queries the user for a number, and jumps the cursor to the correspon
u8 string_space[256]; u8 string_space[256];
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = string_u8_litexpr("Goto Line: "); bar.prompt = string_u8_litexpr("Goto Line: ");
bar.string = SCu8(string_space, (umem)0); bar.string = SCu8(string_space, (u64)0);
bar.string_capacity = sizeof(string_space); bar.string_capacity = sizeof(string_space);
if (query_user_number(app, &bar)){ if (query_user_number(app, &bar)){
i32 line_number = (i32)string_to_integer(bar.string, 10); i32 line_number = (i32)string_to_integer(bar.string, 10);
@ -797,7 +797,7 @@ isearch(Application_Links *app, Scan_Direction start_scan, i64 first_pos,
String_Const_u8 isearch_str = string_u8_litexpr("I-Search: "); String_Const_u8 isearch_str = string_u8_litexpr("I-Search: ");
String_Const_u8 rsearch_str = string_u8_litexpr("Reverse-I-Search: "); String_Const_u8 rsearch_str = string_u8_litexpr("Reverse-I-Search: ");
umem match_size = bar.string.size; u64 match_size = bar.string.size;
User_Input in = {}; User_Input in = {};
for (;;){ for (;;){
@ -830,7 +830,7 @@ isearch(Application_Links *app, Scan_Direction start_scan, i64 first_pos,
block_copy(bar.string.str, previous_isearch_query, bar.string.size); block_copy(bar.string.str, previous_isearch_query, bar.string.size);
} }
else{ else{
umem size = bar.string.size; u64 size = bar.string.size;
size = clamp_top(size, sizeof(previous_isearch_query) - 1); size = clamp_top(size, sizeof(previous_isearch_query) - 1);
block_copy(previous_isearch_query, bar.string.str, size); block_copy(previous_isearch_query, bar.string.str, size);
previous_isearch_query[size] = 0; previous_isearch_query[size] = 0;
@ -845,7 +845,7 @@ isearch(Application_Links *app, Scan_Direction start_scan, i64 first_pos,
} }
else if (match_key_code(&in, KeyCode_Backspace)){ else if (match_key_code(&in, KeyCode_Backspace)){
if (is_unmodified_key(&in.event)){ if (is_unmodified_key(&in.event)){
umem old_bar_string_size = bar.string.size; u64 old_bar_string_size = bar.string.size;
bar.string = backspace_utf8(bar.string); bar.string = backspace_utf8(bar.string);
string_change = (bar.string.size < old_bar_string_size); string_change = (bar.string.size < old_bar_string_size);
} }
@ -940,7 +940,7 @@ isearch(Application_Links *app, Scan_Direction start_scan, i64 first_pos,
view_disable_highlight_range(app, view); view_disable_highlight_range(app, view);
if (in.abort){ if (in.abort){
umem size = bar.string.size; u64 size = bar.string.size;
size = clamp_top(size, sizeof(previous_isearch_query) - 1); size = clamp_top(size, sizeof(previous_isearch_query) - 1);
block_copy(previous_isearch_query, bar.string.str, size); block_copy(previous_isearch_query, bar.string.str, size);
previous_isearch_query[size] = 0; previous_isearch_query[size] = 0;
@ -1008,13 +1008,13 @@ query_user_replace_pair(Application_Links *app, Arena *arena){
Query_Bar *replace = push_array(arena, Query_Bar, 1); Query_Bar *replace = push_array(arena, Query_Bar, 1);
u8 *replace_space = push_array(arena, u8, KB(1)); u8 *replace_space = push_array(arena, u8, KB(1));
replace->prompt = string_u8_litexpr("Replace: "); replace->prompt = string_u8_litexpr("Replace: ");
replace->string = SCu8(replace_space, (umem)0); replace->string = SCu8(replace_space, (u64)0);
replace->string_capacity = KB(1); replace->string_capacity = KB(1);
Query_Bar *with = push_array(arena, Query_Bar, 1); Query_Bar *with = push_array(arena, Query_Bar, 1);
u8 *with_space = push_array(arena, u8, KB(1)); u8 *with_space = push_array(arena, u8, KB(1));
with->prompt = string_u8_litexpr("With: "); with->prompt = string_u8_litexpr("With: ");
with->string = SCu8(with_space, (umem)0); with->string = SCu8(with_space, (u64)0);
with->string_capacity = KB(1); with->string_capacity = KB(1);
String_Pair result = {}; String_Pair result = {};
@ -1127,7 +1127,7 @@ query_replace_parameter(Application_Links *app, String_Const_u8 replace_str, i64
Query_Bar with = {}; Query_Bar with = {};
u8 with_space[1024]; u8 with_space[1024];
with.prompt = string_u8_litexpr("With: "); with.prompt = string_u8_litexpr("With: ");
with.string = SCu8(with_space, (umem)0); with.string = SCu8(with_space, (u64)0);
with.string_capacity = sizeof(with_space); with.string_capacity = sizeof(with_space);
if (query_user_string(app, &with)){ if (query_user_string(app, &with)){
@ -1156,7 +1156,7 @@ CUSTOM_DOC("Queries the user for two strings, and incrementally replaces every o
Query_Bar replace = {}; Query_Bar replace = {};
u8 replace_space[1024]; u8 replace_space[1024];
replace.prompt = string_u8_litexpr("Replace: "); replace.prompt = string_u8_litexpr("Replace: ");
replace.string = SCu8(replace_space, (umem)0); replace.string = SCu8(replace_space, (u64)0);
replace.string_capacity = sizeof(replace_space); replace.string_capacity = sizeof(replace_space);
if (query_user_string(app, &replace)){ if (query_user_string(app, &replace)){
if (replace.string.size > 0){ if (replace.string.size > 0){
@ -1276,7 +1276,7 @@ CUSTOM_DOC("Queries the user for a file name and saves the contents of the curre
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = push_u8_stringf(scratch, "Save '%.*s' to: ", string_expand(buffer_name)); bar.prompt = push_u8_stringf(scratch, "Save '%.*s' to: ", string_expand(buffer_name));
bar.string = SCu8(name_space, (umem)0); bar.string = SCu8(name_space, (u64)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (query_user_string(app, &bar)){ if (query_user_string(app, &bar)){
if (bar.string.size != 0){ if (bar.string.size != 0){
@ -1311,7 +1311,7 @@ CUSTOM_DOC("Queries the user for a new name and renames the file of the current
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = push_u8_stringf(scratch, "Rename '%.*s' to: ", string_expand(front)); bar.prompt = push_u8_stringf(scratch, "Rename '%.*s' to: ", string_expand(front));
bar.string = SCu8(name_space, (umem)0); bar.string = SCu8(name_space, (u64)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (query_user_string(app, &bar)){ if (query_user_string(app, &bar)){
if (bar.string.size != 0){ if (bar.string.size != 0){
@ -1345,7 +1345,7 @@ CUSTOM_DOC("Queries the user for a name and creates a new directory with the giv
u8 name_space[4096]; u8 name_space[4096];
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = push_u8_stringf(scratch, "Make directory at '%.*s': ", string_expand(hot)); bar.prompt = push_u8_stringf(scratch, "Make directory at '%.*s': ", string_expand(hot));
bar.string = SCu8(name_space, (umem)0); bar.string = SCu8(name_space, (u64)0);
bar.string_capacity = sizeof(name_space); bar.string_capacity = sizeof(name_space);
if (!query_user_string(app, &bar)) return; if (!query_user_string(app, &bar)) return;

File diff suppressed because it is too large Load Diff

View File

@ -104,6 +104,9 @@
#if !defined(SHIP_MODE) #if !defined(SHIP_MODE)
#define SHIP_MODE 0 #define SHIP_MODE 0
#else
#undef SHIP_MODE
#define SHIP_MODE 1
#endif #endif
//////////////////////////////// ////////////////////////////////
@ -154,14 +157,6 @@ typedef i8 b8;
typedef i32 b32; typedef i32 b32;
typedef i64 b64; typedef i64 b64;
#if ARCH_32BIT
typedef u32 umem;
typedef i32 imem;
#else
typedef u64 umem;
typedef i64 imem;
#endif
typedef float f32; typedef float f32;
typedef double f64; typedef double f64;
@ -722,12 +717,6 @@ union Range_f32{
}; };
}; };
typedef Range_i32 Interval_i32;
typedef Range_i64 Interval_i64;
typedef Range_u64 Interval_u64;
typedef Range_f32 Interval_f32;
typedef Range_i32 Range;
struct Range_i32_Array{ struct Range_i32_Array{
Range_i32 *ranges; Range_i32 *ranges;
i32 count; i32 count;
@ -744,7 +733,6 @@ struct Range_f32_Array{
Range_f32 *ranges; Range_f32 *ranges;
i32 count; i32 count;
}; };
typedef Range_i32_Array Range_Array;
union Rect_i32{ union Rect_i32{
struct{ struct{
@ -848,7 +836,7 @@ enum{
struct String_Const_char{ struct String_Const_char{
char *str; char *str;
u64 size; u64 size;
}; };
struct String_Const_u8{ struct String_Const_u8{
union{ union{
@ -936,25 +924,25 @@ struct Node_String_Const_u32{
struct List_String_Const_char{ struct List_String_Const_char{
Node_String_Const_char *first; Node_String_Const_char *first;
Node_String_Const_char *last; Node_String_Const_char *last;
u64 total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };
struct List_String_Const_u8{ struct List_String_Const_u8{
Node_String_Const_u8 *first; Node_String_Const_u8 *first;
Node_String_Const_u8 *last; Node_String_Const_u8 *last;
u64 total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };
struct List_String_Const_u16{ struct List_String_Const_u16{
Node_String_Const_u16 *first; Node_String_Const_u16 *first;
Node_String_Const_u16 *last; Node_String_Const_u16 *last;
u64 total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };
struct List_String_Const_u32{ struct List_String_Const_u32{
Node_String_Const_u32 *first; Node_String_Const_u32 *first;
Node_String_Const_u32 *last; Node_String_Const_u32 *last;
u64 total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };
@ -965,7 +953,7 @@ struct Node_String_Const_Any{
struct List_String_Const_Any{ struct List_String_Const_Any{
Node_String_Const_Any *first; Node_String_Const_Any *first;
Node_String_Const_Any *last; Node_String_Const_Any *last;
u64 total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };
@ -974,40 +962,40 @@ struct String_char{
String_Const_char string; String_Const_char string;
struct{ struct{
char *str; char *str;
umem size; u64 size;
}; };
}; };
umem cap; u64 cap;
}; };
struct String_u8{ struct String_u8{
union{ union{
String_Const_u8 string; String_Const_u8 string;
struct{ struct{
u8 *str; u8 *str;
umem size; u64 size;
}; };
}; };
umem cap; u64 cap;
}; };
struct String_u16{ struct String_u16{
union{ union{
String_Const_u16 string; String_Const_u16 string;
struct{ struct{
u16 *str; u16 *str;
umem size; u64 size;
}; };
}; };
umem cap; u64 cap;
}; };
struct String_u32{ struct String_u32{
union{ union{
String_Const_u32 string; String_Const_u32 string;
struct{ struct{
u32 *str; u32 *str;
umem size; u64 size;
}; };
}; };
umem cap; u64 cap;
}; };
struct String_Any{ struct String_Any{
@ -1015,8 +1003,8 @@ struct String_Any{
union{ union{
struct{ struct{
void *str; void *str;
umem size; u64 size;
umem cap; u64 cap;
}; };
String_char s_char; String_char s_char;
String_u8 s_u8; String_u8 s_u8;
@ -1045,7 +1033,7 @@ global u32 nonchar_max = 0xFDEF;
struct Data{ struct Data{
u8 *data; u8 *data;
umem size; u64 size;
}; };
//////////////////////////////// ////////////////////////////////
@ -1087,11 +1075,11 @@ enum{
//////////////////////////////// ////////////////////////////////
typedef void *Base_Allocator_Reserve_Signature(void *user_data, umem size, umem *size_out, String_Const_u8 location); typedef void *Base_Allocator_Reserve_Signature(void *user_data, u64 size, u64 *size_out, String_Const_u8 location);
typedef void Base_Allocator_Commit_Signature(void *user_data, void *ptr, umem size); typedef void Base_Allocator_Commit_Signature(void *user_data, void *ptr, u64 size);
typedef void Base_Allocator_Uncommit_Signature(void *user_data, void *ptr, umem size); typedef void Base_Allocator_Uncommit_Signature(void *user_data, void *ptr, u64 size);
typedef void Base_Allocator_Free_Signature(void *user_data, void *ptr); typedef void Base_Allocator_Free_Signature(void *user_data, void *ptr);
typedef void Base_Allocator_Set_Access_Signature(void *user_data, void *ptr, umem size, Access_Flag flags); typedef void Base_Allocator_Set_Access_Signature(void *user_data, void *ptr, u64 size, Access_Flag flags);
struct Base_Allocator{ struct Base_Allocator{
Base_Allocator_Reserve_Signature *reserve; Base_Allocator_Reserve_Signature *reserve;
Base_Allocator_Commit_Signature *commit; Base_Allocator_Commit_Signature *commit;
@ -1103,12 +1091,12 @@ struct Base_Allocator{
struct Cursor{ struct Cursor{
u8 *base; u8 *base;
umem pos; u64 pos;
umem cap; u64 cap;
}; };
struct Temp_Memory_Cursor{ struct Temp_Memory_Cursor{
Cursor *cursor; Cursor *cursor;
umem pos; u64 pos;
}; };
struct Cursor_Node{ struct Cursor_Node{
union{ union{
@ -1120,13 +1108,13 @@ struct Cursor_Node{
struct Arena{ struct Arena{
Base_Allocator *base_allocator; Base_Allocator *base_allocator;
Cursor_Node *cursor_node; Cursor_Node *cursor_node;
umem chunk_size; u64 chunk_size;
umem alignment; u64 alignment;
}; };
struct Temp_Memory_Arena{ struct Temp_Memory_Arena{
Arena *arena; Arena *arena;
Cursor_Node *cursor_node; Cursor_Node *cursor_node;
umem pos; u64 pos;
}; };
typedef i32 Linear_Allocator_Kind; typedef i32 Linear_Allocator_Kind;
enum{ enum{
@ -1243,7 +1231,7 @@ struct Heap_Node{
struct{ struct{
Heap_Basic_Node order; Heap_Basic_Node order;
Heap_Basic_Node alloc; Heap_Basic_Node alloc;
umem size; u64 size;
}; };
u8 force_size__[64]; u8 force_size__[64];
}; };
@ -1254,8 +1242,8 @@ struct Heap{
Arena *arena; Arena *arena;
Heap_Basic_Node in_order; Heap_Basic_Node in_order;
Heap_Basic_Node free_nodes; Heap_Basic_Node free_nodes;
umem used_space; u64 used_space;
umem total_space; u64 total_space;
}; };
#endif #endif

View File

@ -26,19 +26,19 @@ CUSTOM_DOC("Queries for an output buffer name and system command, runs the syste
Query_Bar bar_out = {}; Query_Bar bar_out = {};
bar_out.prompt = string_u8_litexpr("Output Buffer: "); bar_out.prompt = string_u8_litexpr("Output Buffer: ");
bar_out.string = SCu8(out_buffer_space, (umem)0); bar_out.string = SCu8(out_buffer_space, (u64)0);
bar_out.string_capacity = sizeof(out_buffer_space); bar_out.string_capacity = sizeof(out_buffer_space);
if (!query_user_string(app, &bar_out)) return; if (!query_user_string(app, &bar_out)) return;
Query_Bar bar_cmd = {}; Query_Bar bar_cmd = {};
bar_cmd.prompt = string_u8_litexpr("Command: "); bar_cmd.prompt = string_u8_litexpr("Command: ");
bar_cmd.string = SCu8(command_space, (umem)0); bar_cmd.string = SCu8(command_space, (u64)0);
bar_cmd.string_capacity = sizeof(command_space); bar_cmd.string_capacity = sizeof(command_space);
if (!query_user_string(app, &bar_cmd)) return; if (!query_user_string(app, &bar_cmd)) return;
String_Const_u8 hot = push_hot_directory(app, scratch); String_Const_u8 hot = push_hot_directory(app, scratch);
{ {
umem size = clamp_top(hot.size, sizeof(hot_directory_space)); u64 size = clamp_top(hot.size, sizeof(hot_directory_space));
block_copy(hot_directory_space, hot.str, size); block_copy(hot_directory_space, hot.str, size);
hot_directory_space[hot.size] = 0; hot_directory_space[hot.size] = 0;
} }

View File

@ -278,7 +278,7 @@ CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){
Query_Bar_Group group(app); Query_Bar_Group group(app);
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = string_u8_litexpr("How Many Slots To Paste: "); bar.prompt = string_u8_litexpr("How Many Slots To Paste: ");
bar.string = SCu8(string_space, (umem)0); bar.string = SCu8(string_space, (u64)0);
bar.string_capacity = sizeof(string_space); bar.string_capacity = sizeof(string_space);
query_user_number(app, &bar); query_user_number(app, &bar);

View File

@ -157,7 +157,7 @@ code_index_get_nest(Code_Index_File *file, i64 pos){
} }
function void function void
index_shift(i64 *ptr, Range_i64 old_range, umem new_size){ index_shift(i64 *ptr, Range_i64 old_range, u64 new_size){
i64 i = *ptr; i64 i = *ptr;
if (old_range.min <= i && i < old_range.max){ if (old_range.min <= i && i < old_range.max){
*ptr = old_range.first; *ptr = old_range.first;
@ -169,7 +169,7 @@ index_shift(i64 *ptr, Range_i64 old_range, umem new_size){
function void function void
code_index_shift(Code_Index_Nest_Ptr_Array *array, code_index_shift(Code_Index_Nest_Ptr_Array *array,
Range_i64 old_range, umem new_size){ Range_i64 old_range, u64 new_size){
i32 count = array->count; i32 count = array->count;
Code_Index_Nest **nest_ptr = array->ptrs; Code_Index_Nest **nest_ptr = array->ptrs;
for (i32 i = 0; i < count; i += 1, nest_ptr += 1){ for (i32 i = 0; i < count; i += 1, nest_ptr += 1){
@ -185,7 +185,7 @@ code_index_shift(Code_Index_Nest_Ptr_Array *array,
} }
function void function void
code_index_shift(Code_Index_File *file, Range_i64 old_range, umem new_size){ code_index_shift(Code_Index_File *file, Range_i64 old_range, u64 new_size){
code_index_shift(&file->nest_array, old_range, new_size); code_index_shift(&file->nest_array, old_range, new_size);
} }
@ -841,7 +841,7 @@ layout_index_x_shift(Application_Links *app, Layout_Reflex *reflex, Code_Index_F
function void function void
layout_index__emit_chunk(LefRig_TopBot_Layout_Vars *pos_vars, Face_ID face, Arena *arena, u8 *text_str, i64 range_first, u8 *ptr, u8 *end, Layout_Item_List *list){ layout_index__emit_chunk(LefRig_TopBot_Layout_Vars *pos_vars, Face_ID face, Arena *arena, u8 *text_str, i64 range_first, u8 *ptr, u8 *end, Layout_Item_List *list){
for (;ptr < end;){ for (;ptr < end;){
Character_Consume_Result consume = utf8_consume(ptr, (umem)(end - ptr)); Character_Consume_Result consume = utf8_consume(ptr, (u64)(end - ptr));
if (consume.codepoint != '\r'){ if (consume.codepoint != '\r'){
i64 index = layout_index_from_ptr(ptr, text_str, range_first); i64 index = layout_index_from_ptr(ptr, text_str, range_first);
if (consume.codepoint != max_u32){ if (consume.codepoint != max_u32){
@ -961,7 +961,7 @@ layout_index__inner(Application_Links *app, Arena *arena, Buffer_ID buffer, Rang
f32 word_advance = 0.f; f32 word_advance = 0.f;
ptr = word.str; ptr = word.str;
for (;ptr < word_end;){ for (;ptr < word_end;){
Character_Consume_Result consume = utf8_consume(ptr, (umem)(word_end - ptr)); Character_Consume_Result consume = utf8_consume(ptr, (u64)(word_end - ptr));
if (consume.codepoint != max_u32){ if (consume.codepoint != max_u32){
word_advance += lr_tb_advance(&pos_vars, face, consume.codepoint); word_advance += lr_tb_advance(&pos_vars, face, consume.codepoint);
} }

View File

@ -9,7 +9,7 @@ parse_extension_line_to_extension_list(Application_Links *app,
Arena *arena, String_Const_u8 str){ Arena *arena, String_Const_u8 str){
ProfileScope(app, "parse extension line to extension list"); ProfileScope(app, "parse extension line to extension list");
i32 count = 0; i32 count = 0;
for (umem i = 0; i < str.size; i += 1){ for (u64 i = 0; i < str.size; i += 1){
if (str.str[i] == '.'){ if (str.str[i] == '.'){
count += 1; count += 1;
} }
@ -22,7 +22,7 @@ parse_extension_line_to_extension_list(Application_Links *app,
push_align(arena, 1); push_align(arena, 1);
str = string_skip(str, string_find_first(str, '.') + 1); str = string_skip(str, string_find_first(str, '.') + 1);
for (i32 i = 0; i < count; i += 1){ for (i32 i = 0; i < count; i += 1){
umem next_period = string_find_first(str, '.'); u64 next_period = string_find_first(str, '.');
String_Const_u8 extension = string_prefix(str, next_period); String_Const_u8 extension = string_prefix(str, next_period);
str = string_skip(str, next_period + 1); str = string_skip(str, next_period + 1);
array.strings[i] = push_string_copy(arena, extension); array.strings[i] = push_string_copy(arena, extension);
@ -748,11 +748,11 @@ config_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8
} }
function b32 function b32
config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript, String_Const_u8* var_out, u8 *space, u64 space_size){
Config_Get_Result result = config_var(config, var_name, subscript); Config_Get_Result result = config_var(config, var_name, subscript);
b32 success = (result.success && result.type == ConfigRValueType_String); b32 success = (result.success && result.type == ConfigRValueType_String);
if (success){ if (success){
umem size = result.string.size; u64 size = result.string.size;
size = clamp_top(size, space_size); size = clamp_top(size, space_size);
block_copy(space, result.string.str, size); block_copy(space, result.string.str, size);
*var_out = SCu8(space, size); *var_out = SCu8(space, size);
@ -761,7 +761,7 @@ config_placed_string_var(Config *config, String_Const_u8 var_name, i32 subscript
} }
function b32 function b32
config_placed_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out, u8 *space, umem space_size){ config_placed_string_var(Config *config, char *var_name, i32 subscript, String_Const_u8* var_out, u8 *space, u64 space_size){
return(config_placed_string_var(config, SCu8(var_name), subscript, var_out, space, space_size)); return(config_placed_string_var(config, SCu8(var_name), subscript, var_out, space, space_size));
} }
@ -879,11 +879,11 @@ config_compound_string_member(Config *config, Config_Compound *compound,
function b32 function b32
config_compound_placed_string_member(Config *config, Config_Compound *compound, config_compound_placed_string_member(Config *config, Config_Compound *compound,
String_Const_u8 var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ String_Const_u8 var_name, i32 index, String_Const_u8* var_out, u8 *space, u64 space_size){
Config_Get_Result result = config_compound_member(config, compound, var_name, index); Config_Get_Result result = config_compound_member(config, compound, var_name, index);
b32 success = (result.success && result.type == ConfigRValueType_String); b32 success = (result.success && result.type == ConfigRValueType_String);
if (success){ if (success){
umem size = result.string.size; u64 size = result.string.size;
size = clamp_top(size, space_size); size = clamp_top(size, space_size);
block_copy(space, result.string.str, size); block_copy(space, result.string.str, size);
*var_out = SCu8(space, size); *var_out = SCu8(space, size);
@ -893,7 +893,7 @@ config_compound_placed_string_member(Config *config, Config_Compound *compound,
function b32 function b32
config_compound_placed_string_member(Config *config, Config_Compound *compound, config_compound_placed_string_member(Config *config, Config_Compound *compound,
char *var_name, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ char *var_name, i32 index, String_Const_u8* var_out, u8 *space, u64 space_size){
return(config_compound_placed_string_member(config, compound, SCu8(var_name), index, var_out, space, space_size)); return(config_compound_placed_string_member(config, compound, SCu8(var_name), index, var_out, space, space_size));
} }
@ -978,11 +978,11 @@ typed_string_array_iteration_step(Config *config, Config_Compound *compound, i32
} }
function Iteration_Step_Result function Iteration_Step_Result
typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out, u8 *space, umem space_size){ typed_placed_string_array_iteration_step(Config *config, Config_Compound *compound, i32 index, String_Const_u8* var_out, u8 *space, u64 space_size){
Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index); Config_Iteration_Step_Result result = typed_array_iteration_step(config, compound, ConfigRValueType_String, index);
b32 success = (result.step == Iteration_Good); b32 success = (result.step == Iteration_Good);
if (success){ if (success){
umem size = result.get.string.size; u64 size = result.get.string.size;
size = clamp_top(size, space_size); size = clamp_top(size, space_size);
block_copy(space, result.get.string.str, size); block_copy(space, result.get.string.str, size);
*var_out = SCu8(space, size); *var_out = SCu8(space, size);
@ -1192,11 +1192,11 @@ config_from_text(Application_Links *app, Arena *arena, String_Const_u8 file_name
function void function void
config_init_default(Config_Data *config){ config_init_default(Config_Data *config){
config->user_name = SCu8(config->user_name_space, (umem)0); config->user_name = SCu8(config->user_name_space, (u64)0);
block_zero_struct(&config->code_exts); block_zero_struct(&config->code_exts);
config->mode = SCu8(config->mode_space, (umem)0); config->mode = SCu8(config->mode_space, (u64)0);
config->use_scroll_bars = false; config->use_scroll_bars = false;
config->use_file_bars = true; config->use_file_bars = true;
@ -1226,19 +1226,19 @@ config_init_default(Config_Data *config){
block_copy(config->default_theme_name.str, "4coder", config->default_theme_name.size); block_copy(config->default_theme_name.str, "4coder", config->default_theme_name.size);
config->highlight_line_at_cursor = true; config->highlight_line_at_cursor = true;
config->default_font_name = SCu8(config->default_font_name_space, (umem)0); config->default_font_name = SCu8(config->default_font_name_space, (u64)0);
config->default_font_size = 16; config->default_font_size = 16;
config->default_font_hinting = false; config->default_font_hinting = false;
config->default_compiler_bat = SCu8(config->default_compiler_bat_space, 2); config->default_compiler_bat = SCu8(config->default_compiler_bat_space, 2);
block_copy(config->default_compiler_bat.str, "cl", 2); block_copy(config->default_compiler_bat.str, "cl", 2);
config->default_flags_bat = SCu8(config->default_flags_bat_space, (umem)0); config->default_flags_bat = SCu8(config->default_flags_bat_space, (u64)0);
config->default_compiler_sh = SCu8(config->default_compiler_sh_space, 3); config->default_compiler_sh = SCu8(config->default_compiler_sh_space, 3);
block_copy(config->default_compiler_sh.str, "g++", 3); block_copy(config->default_compiler_sh.str, "g++", 3);
config->default_flags_sh = SCu8(config->default_flags_sh_space, (umem)0); config->default_flags_sh = SCu8(config->default_flags_sh_space, (u64)0);
config->lalt_lctrl_is_altgr = false; config->lalt_lctrl_is_altgr = false;
} }
@ -1484,7 +1484,7 @@ load_config_and_apply(Application_Links *app, Arena *out_arena, Config_Data *con
print_message(app, string_u8_litexpr("Using default config:\n")); print_message(app, string_u8_litexpr("Using default config:\n"));
Face_Description description = get_face_description(app, 0); Face_Description description = get_face_description(app, 0);
if (description.font.file_name.str != 0){ if (description.font.file_name.str != 0){
umem size = Min(description.font.file_name.size, sizeof(config->default_font_name_space)); u64 size = Min(description.font.file_name.size, sizeof(config->default_font_name_space));
block_copy(config->default_font_name_space, description.font.file_name.str, size); block_copy(config->default_font_name_space, description.font.file_name.str, size);
config->default_font_name.size = size; config->default_font_name.size = size;
} }

View File

@ -482,7 +482,7 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){
i32 conflict_index = unresolved[i]; i32 conflict_index = unresolved[i];
Buffer_Name_Conflict_Entry *conflict = &conflicts[conflict_index]; Buffer_Name_Conflict_Entry *conflict = &conflicts[conflict_index];
umem size = conflict->base_name.size; u64 size = conflict->base_name.size;
size = clamp_top(size, conflict->unique_name_capacity); size = clamp_top(size, conflict->unique_name_capacity);
conflict->unique_name_len_in_out = size; conflict->unique_name_len_in_out = size;
block_copy(conflict->unique_name_in_out, conflict->base_name.str, size); block_copy(conflict->unique_name_in_out, conflict->base_name.str, size);
@ -1031,9 +1031,9 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){
i64 token_index_resync = relex.first_resync_index; i64 token_index_resync = relex.first_resync_index;
Interval_i64 head = Ii64(0, token_index_first); Range_i64 head = Ii64(0, token_index_first);
Interval_i64 replaced = Ii64(token_index_first, token_index_resync); Range_i64 replaced = Ii64(token_index_first, token_index_resync);
Interval_i64 tail = Ii64(token_index_resync, ptr->count); Range_i64 tail = Ii64(token_index_resync, ptr->count);
i64 resynced_count = (token_index_resync_guess + 1) - token_index_resync; i64 resynced_count = (token_index_resync_guess + 1) - token_index_resync;
i64 relexed_count = relex_list.total_count - resynced_count; i64 relexed_count = relex_list.total_count - resynced_count;
i64 tail_shift = relexed_count - (token_index_resync - token_index_first); i64 tail_shift = relexed_count - (token_index_resync - token_index_first);

View File

@ -4,8 +4,8 @@
// TOP // TOP
function umem function u64
delta_ctx_size(umem base_size){ delta_ctx_size(u64 base_size){
return(base_size + sizeof(Delta_Context_Header)); return(base_size + sizeof(Delta_Context_Header));
} }
@ -175,12 +175,12 @@ DELTA_RULE_SIG(original_delta){
*velocity = V2f32(step_x.v, step_y.v); *velocity = V2f32(step_x.v, step_y.v);
return(V2f32(step_x.p, step_y.p)); return(V2f32(step_x.p, step_y.p));
} }
global_const umem original_delta_memory_size = sizeof(Vec2_f32); global_const u64 original_delta_memory_size = sizeof(Vec2_f32);
DELTA_RULE_SIG(snap_delta){ DELTA_RULE_SIG(snap_delta){
return(pending); return(pending);
} }
global_const umem snap_delta_memory_size = 0; global_const u64 snap_delta_memory_size = 0;
function f32 function f32
cubic_reinterpolate(f32 t){ cubic_reinterpolate(f32 t){
@ -212,7 +212,7 @@ DELTA_RULE_SIG(fixed_time_cubic_delta){
} }
return(result); return(result);
} }
global_const umem fixed_time_cubic_delta_memory_size = sizeof(f32); global_const u64 fixed_time_cubic_delta_memory_size = sizeof(f32);
// BOTTOM // BOTTOM

View File

@ -97,7 +97,7 @@ struct Doc_Content{
struct Doc_Content_List{ struct Doc_Content_List{
Doc_Content *first; Doc_Content *first;
Doc_Content *last; Doc_Content *last;
umem total_size; u64 total_size;
i32 node_count; i32 node_count;
}; };

View File

@ -340,7 +340,7 @@ draw_line_number_margin(Application_Links *app, View_ID view_id, Buffer_ID buffe
Rect_f32 prev_clip = draw_set_clip(app, margin); Rect_f32 prev_clip = draw_set_clip(app, margin);
draw_rectangle_fcolor(app, margin, 0.f, fcolor_id(defcolor_line_numbers_back)); draw_rectangle_fcolor(app, margin, 0.f, fcolor_id(defcolor_line_numbers_back));
Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
FColor line_color = fcolor_id(defcolor_line_numbers_text); FColor line_color = fcolor_id(defcolor_line_numbers_text);
@ -391,13 +391,13 @@ draw_fps_hud(Application_Links *app, Frame_Info frame_info,
Scratch_Block scratch(app); Scratch_Block scratch(app);
Range ranges[2]; Range_i32 ranges[2] = {};
ranges[0].first = wrapped_index; ranges[0].first = wrapped_index;
ranges[0].one_past_last = -1; ranges[0].one_past_last = -1;
ranges[1].first = fps_history_depth - 1; ranges[1].first = fps_history_depth - 1;
ranges[1].one_past_last = wrapped_index; ranges[1].one_past_last = wrapped_index;
for (i32 i = 0; i < 2; i += 1){ for (i32 i = 0; i < 2; i += 1){
Range r = ranges[i]; Range_i32 r = ranges[i];
for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += line_height){ for (i32 j = r.first; j > r.one_past_last; j -= 1, p.y += line_height){
f32 dts[2]; f32 dts[2];
dts[0] = history_literal_dt[j]; dts[0] = history_literal_dt[j];
@ -482,7 +482,7 @@ get_token_color_cpp(Token token){
function void function void
draw_cpp_token_colors(Application_Links *app, Text_Layout_ID text_layout_id, Token_Array *array){ draw_cpp_token_colors(Application_Links *app, Text_Layout_ID text_layout_id, Token_Array *array){
Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
i64 first_index = token_index_from_pos(array, visible_range.first); i64 first_index = token_index_from_pos(array, visible_range.first);
Token_Iterator_Array it = token_iterator_index(0, array, first_index); Token_Iterator_Array it = token_iterator_index(0, array, first_index);
for (;;){ for (;;){
@ -503,7 +503,7 @@ function void
draw_comment_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id, draw_comment_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
Token_Array *array, Comment_Highlight_Pair *pairs, i32 pair_count){ Token_Array *array, Comment_Highlight_Pair *pairs, i32 pair_count){
Scratch_Block scratch(app); Scratch_Block scratch(app);
Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id); Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
i64 first_index = token_index_from_pos(array, visible_range.first); i64 first_index = token_index_from_pos(array, visible_range.first);
Token_Iterator_Array it = token_iterator_index(buffer, array, first_index); Token_Iterator_Array it = token_iterator_index(buffer, array, first_index);
for (;;){ for (;;){
@ -519,7 +519,7 @@ draw_comment_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID
tail = string_skip(tail, 1), index += 1){ tail = string_skip(tail, 1), index += 1){
Comment_Highlight_Pair *pair = pairs; Comment_Highlight_Pair *pair = pairs;
for (i32 i = 0; i < pair_count; i += 1, pair += 1){ for (i32 i = 0; i < pair_count; i += 1, pair += 1){
umem needle_size = pair->needle.size; u64 needle_size = pair->needle.size;
if (needle_size == 0){ if (needle_size == 0){
continue; continue;
} }

View File

@ -335,9 +335,9 @@ stringize_keyboard_event(Arena *arena, Input_Event *event){
case InputEventKind_TextInsert: case InputEventKind_TextInsert:
{ {
string_list_push(arena, &list, string_u8_litexpr("t")); string_list_push(arena, &list, string_u8_litexpr("t"));
umem size = event->text.string.size; u64 size = event->text.string.size;
u8 *ptr = event->text.string.str; u8 *ptr = event->text.string.str;
for (umem i = 0; i < size; i += 1, ptr += 1){ for (u64 i = 0; i < size; i += 1, ptr += 1){
string_list_pushf(arena, &list, "%02X", (i32)(*ptr)); string_list_pushf(arena, &list, "%02X", (i32)(*ptr));
} }
string_list_push(arena, &list, string_u8_litexpr("\n")); string_list_push(arena, &list, string_u8_litexpr("\n"));
@ -369,14 +369,14 @@ stringize_keyboard_event(Arena *arena, Input_Event *event){
function Input_Event function Input_Event
parse_keyboard_event(Arena *arena, String_Const_u8 text){ parse_keyboard_event(Arena *arena, String_Const_u8 text){
Input_Event result = {}; Input_Event result = {};
umem pos = 0; u64 pos = 0;
Range_i64 range = {}; Range_i64 range = {};
if (pos < text.size && text.str[pos] == 't'){ if (pos < text.size && text.str[pos] == 't'){
pos += 1; pos += 1;
result.kind = InputEventKind_TextInsert; result.kind = InputEventKind_TextInsert;
umem max_size = text.size/2; u64 max_size = text.size/2;
result.text.string.str = push_array(arena, u8, max_size); result.text.string.str = push_array(arena, u8, max_size);
for (; pos + 1 < text.size; pos += 2){ for (; pos + 1 < text.size; pos += 2){
if (character_is_base16(text.str[pos]) && if (character_is_base16(text.str[pos]) &&

View File

@ -14,7 +14,7 @@
function String_Const_u8 function String_Const_u8
file_load_all(Arena *arena, FILE *file){ file_load_all(Arena *arena, FILE *file){
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
umem size = ftell(file); u64 size = ftell(file);
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
u8 *buffer = push_array(arena, u8, size + 1); u8 *buffer = push_array(arena, u8, size + 1);
fread(buffer, 1, size, file); fread(buffer, 1, size, file);

View File

@ -477,7 +477,7 @@ file_dump(Arena *arena, char *name){
fprintf(stdout, "fatal error: not enough memory in partition for file dumping"); fprintf(stdout, "fatal error: not enough memory in partition for file dumping");
exit(1); exit(1);
} }
fread(text.str, 1, text.size, file); fread(text.str, 1, (size_t)text.size, file);
text.str[text.size] = 0; text.str[text.size] = 0;
fclose(file); fclose(file);
} }

View File

@ -546,7 +546,7 @@ fm_copy_folder(Arena *arena, char *src_dir, char *dst_dir, char *src_folder){
// List Helpers // List Helpers
internal i32 internal i32
listsize(void *p, umem item_size){ listsize(void *p, u64 item_size){
u64 zero = 0; u64 zero = 0;
u8 *ptr = (u8*)p; u8 *ptr = (u8*)p;
for (;memcmp(ptr, &zero, (size_t)item_size) != 0; ptr += item_size); for (;memcmp(ptr, &zero, (size_t)item_size) != 0; ptr += item_size);

View File

@ -13,7 +13,7 @@
#define FCODER_HASH_FUNCTIONS_CPP #define FCODER_HASH_FUNCTIONS_CPP
static u64 static u64
table_hash_u8(u8 *v, umem size){ table_hash_u8(u8 *v, u64 size){
u64 hash = 0; u64 hash = 0;
for (u8 *p = v, *e = v + size; p < e; p += 1){ for (u8 *p = v, *e = v + size; p < e; p += 1){
u8 k = *p; u8 k = *p;
@ -26,7 +26,7 @@ table_hash_u8(u8 *v, umem size){
return(hash); return(hash);
} }
static u64 static u64
table_hash_u16(u16 *v, umem size){ table_hash_u16(u16 *v, u64 size){
u64 hash = 0; u64 hash = 0;
for (u16 *p = v, *e = v + size; p < e; p += 1){ for (u16 *p = v, *e = v + size; p < e; p += 1){
u16 k = *p; u16 k = *p;
@ -39,7 +39,7 @@ table_hash_u16(u16 *v, umem size){
return(hash); return(hash);
} }
static u64 static u64
table_hash_u32(u32 *v, umem size){ table_hash_u32(u32 *v, u64 size){
u64 hash = 0; u64 hash = 0;
for (u32 *p = v, *e = v + size; p < e; p += 1){ for (u32 *p = v, *e = v + size; p < e; p += 1){
u32 k = *p; u32 k = *p;
@ -52,7 +52,7 @@ table_hash_u32(u32 *v, umem size){
return(hash); return(hash);
} }
static u64 static u64
table_hash_u64(u64 *v, umem size){ table_hash_u64(u64 *v, u64 size){
u64 hash = 0; u64 hash = 0;
for (u64 *p = v, *e = v + size; p < e; p += 1){ for (u64 *p = v, *e = v + size; p < e; p += 1){
u64 k = *p; u64 k = *p;
@ -65,7 +65,7 @@ table_hash_u64(u64 *v, umem size){
return(hash); return(hash);
} }
static u64 static u64
table_hash(void *v, i32 it_size, umem size){ table_hash(void *v, i32 it_size, u64 size){
u64 hash = 0; u64 hash = 0;
switch (it_size){ switch (it_size){
case 1: case 1:

View File

@ -1136,7 +1136,7 @@ line_is_blank(Application_Links *app, Buffer_ID buffer, i64 line_number){
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number); String_Const_u8 line = push_buffer_line(app, scratch, buffer, line_number);
b32 is_blank = true; b32 is_blank = true;
for (umem i = 0; i < line.size; i += 1){ for (u64 i = 0; i < line.size; i += 1){
if (!character_is_whitespace(line.str[i])){ if (!character_is_whitespace(line.str[i])){
is_blank = false; is_blank = false;
break; break;
@ -1206,7 +1206,7 @@ get_indent_info_range(Application_Links *app, Buffer_ID buffer, Range_i64 range,
info.first_char_pos = range.end; info.first_char_pos = range.end;
info.is_blank = true; info.is_blank = true;
info.all_space = true; info.all_space = true;
for (umem i = 0; i < s.size; i += 1){ for (u64 i = 0; i < s.size; i += 1){
u8 c = s.str[i]; u8 c = s.str[i];
if (!character_is_whitespace(c)){ if (!character_is_whitespace(c)){
info.is_blank = false; info.is_blank = false;
@ -1262,7 +1262,7 @@ replace_in_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, Stri
i64 new_pos = 0; i64 new_pos = 0;
seek_string_forward(app, buffer, pos, range.end, needle, &new_pos); seek_string_forward(app, buffer, pos, range.end, needle, &new_pos);
i64 shift = replace_range_shift(needle.size, string.size); i64 shift = replace_range_shift(needle.size, string.size);
for (; new_pos + (imem)needle.size <= range.end;){ for (; new_pos + (i64)needle.size <= range.end;){
Range_i64 needle_range = Ii64(new_pos, new_pos + (i32)needle.size); Range_i64 needle_range = Ii64(new_pos, new_pos + (i32)needle.size);
buffer_replace_range(app, buffer, needle_range, string); buffer_replace_range(app, buffer, needle_range, string);
range.end += shift; range.end += shift;
@ -1399,7 +1399,7 @@ match_core_code(User_Input *in, Key_Code core_code){
internal String_Const_u8 internal String_Const_u8
backspace_utf8(String_Const_u8 string){ backspace_utf8(String_Const_u8 string){
if (string.size > 0){ if (string.size > 0){
umem i = string.size - 1; u64 i = string.size - 1;
for (; i > 0; --i){ for (; i > 0; --i){
if (string.str[i] <= 0x7F || string.str[i] >= 0xC0){ if (string.str[i] <= 0x7F || string.str[i] >= 0xC0){
break; break;
@ -1773,7 +1773,7 @@ view_look_at_region(Application_Links *app, View_ID view, i64 major_pos, i64 min
Rect_f32 region = view_get_buffer_region(app, view); Rect_f32 region = view_get_buffer_region(app, view);
f32 view_height = rect_height(region); f32 view_height = rect_height(region);
f32 skirt_height = view_height*.1f; f32 skirt_height = view_height*.1f;
Interval_f32 acceptable_y = If32(skirt_height, view_height*.9f); Range_f32 acceptable_y = If32(skirt_height, view_height*.9f);
f32 target_height = view_line_y_difference(app, view, bottom.line + 1, top.line); f32 target_height = view_line_y_difference(app, view, bottom.line + 1, top.line);
@ -1868,7 +1868,7 @@ get_query_string(Application_Links *app, char *query_str, u8 *string_space, i32
Query_Bar_Group group(app); Query_Bar_Group group(app);
Query_Bar bar = {}; Query_Bar bar = {};
bar.prompt = SCu8((u8*)query_str); bar.prompt = SCu8((u8*)query_str);
bar.string = SCu8(string_space, (umem)0); bar.string = SCu8(string_space, (u64)0);
bar.string_capacity = space_size; bar.string_capacity = space_size;
if (!query_user_string(app, &bar)){ if (!query_user_string(app, &bar)){
bar.string.size = 0; bar.string.size = 0;
@ -1897,7 +1897,7 @@ push_token_or_word_under_pos(Application_Links *app, Arena *arena, Buffer_ID buf
String_Const_u8 result = {}; String_Const_u8 result = {};
Token *token = get_token_from_pos(app, buffer, pos); Token *token = get_token_from_pos(app, buffer, pos);
if (token != 0 && token->size > 0 && token->kind != TokenBaseKind_Whitespace){ if (token != 0 && token->size > 0 && token->kind != TokenBaseKind_Whitespace){
Interval_i64 range = Ii64(token->pos, token->pos + token->size); Range_i64 range = Ii64(token->pos, token->pos + token->size);
result = push_buffer_range(app, arena, buffer, range); result = push_buffer_range(app, arena, buffer, range);
} }
return(result); return(result);
@ -1939,11 +1939,11 @@ dump_file_handle(Arena *arena, FILE *file){
Data result = {}; Data result = {};
if (file != 0){ if (file != 0){
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
umem size = ftell(file); u64 size = ftell(file);
char *mem = push_array(arena, char, size); char *mem = push_array(arena, char, size);
if (mem != 0){ if (mem != 0){
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
fread(mem, 1, size, file); fread(mem, 1, (size_t)size, file);
result = make_data(mem, size); result = make_data(mem, size);
} }
} }
@ -2053,10 +2053,10 @@ sort_pairs_by_key(Sort_Pair_i32 *pairs, i32 count){
sort_pairs_by_key__quick(pairs, 0, count); sort_pairs_by_key__quick(pairs, 0, count);
} }
internal Range_Array internal Range_i32_Array
get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){ get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){
Range_Array result = {}; Range_i32_Array result = {};
result.ranges = push_array(arena, Range, count); result.ranges = push_array(arena, Range_i32, count);
u8 *ptr = (u8*)keys; u8 *ptr = (u8*)keys;
i32 start_i = 0; i32 start_i = 0;
for (i32 i = 1; i <= count; i += 1){ for (i32 i = 1; i <= count; i += 1){
@ -2068,13 +2068,13 @@ get_ranges_of_duplicate_keys(Arena *arena, i32 *keys, i32 stride, i32 count){
is_end = true; is_end = true;
} }
if (is_end){ if (is_end){
Range *new_range = &result.ranges[result.count++]; Range_i32 *new_range = &result.ranges[result.count++];
new_range->first = start_i; new_range->first = start_i;
new_range->one_past_last = i; new_range->one_past_last = i;
start_i = i; start_i = i;
} }
} }
pop_array(arena, Range, count - result.count); pop_array(arena, Range_i32, count - result.count);
return(result); return(result);
} }
@ -2371,7 +2371,7 @@ select_scope(Application_Links *app, View_ID view, Range_i64 range){
function Line_Ending_Kind function Line_Ending_Kind
guess_line_ending_kind_from_buffer(Application_Links *app, Buffer_ID buffer){ guess_line_ending_kind_from_buffer(Application_Links *app, Buffer_ID buffer){
umem size = buffer_get_size(app, buffer); u64 size = buffer_get_size(app, buffer);
size = clamp_top(size, KB(8)); size = clamp_top(size, KB(8));
Scratch_Block scratch(app); Scratch_Block scratch(app);
String_Const_u8 string = push_buffer_range(app, scratch, buffer, Ii64(0, size)); String_Const_u8 string = push_buffer_range(app, scratch, buffer, Ii64(0, size));

View File

@ -23,7 +23,7 @@ begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id,
} }
function Buffer_Insertion function Buffer_Insertion
begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id, i64 at, Arena *buffer_memory, umem buffer_memory_size){ begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id, i64 at, Arena *buffer_memory, u64 buffer_memory_size){
Cursor *cursor = push_array(buffer_memory, Cursor, 1); Cursor *cursor = push_array(buffer_memory, Cursor, 1);
*cursor = make_cursor(push_array(buffer_memory, u8, buffer_memory_size), buffer_memory_size); *cursor = make_cursor(push_array(buffer_memory, u8, buffer_memory_size), buffer_memory_size);
return(begin_buffer_insertion_at_buffered(app, buffer_id, at, cursor)); return(begin_buffer_insertion_at_buffered(app, buffer_id, at, cursor));
@ -47,14 +47,14 @@ insert_string__no_buffering(Buffer_Insertion *insertion, String_Const_u8 string)
static void static void
insert__flush(Buffer_Insertion *insertion){ insert__flush(Buffer_Insertion *insertion){
Cursor *cursor = insertion->cursor; Cursor *cursor = insertion->cursor;
umem pos = insertion->temp.temp_memory_cursor.pos; u64 pos = insertion->temp.temp_memory_cursor.pos;
String_Const_u8 string = SCu8(cursor->base + pos, cursor->pos - pos); String_Const_u8 string = SCu8(cursor->base + pos, cursor->pos - pos);
insert_string__no_buffering(insertion, string); insert_string__no_buffering(insertion, string);
end_temp(insertion->temp); end_temp(insertion->temp);
} }
static char* static char*
insert__reserve(Buffer_Insertion *insertion, umem size){ insert__reserve(Buffer_Insertion *insertion, u64 size){
char *space = push_array(insertion->cursor, char, size); char *space = push_array(insertion->cursor, char, size);
if (space == 0){ if (space == 0){
insert__flush(insertion); insert__flush(insertion);
@ -86,7 +86,7 @@ insert_string(Buffer_Insertion *insertion, String_Const_u8 string){
} }
} }
static umem static u64
insertf(Buffer_Insertion *insertion, char *format, ...){ insertf(Buffer_Insertion *insertion, char *format, ...){
Scratch_Block scratch(insertion->app); Scratch_Block scratch(insertion->app);
va_list args; va_list args;

View File

@ -106,14 +106,14 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
Scratch_Block scratch(app); Scratch_Block scratch(app);
Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer); Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer);
Range_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), jumps.count); Range_i32_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), jumps.count);
Sort_Pair_i32 *range_index_buffer_id_pairs = push_array(scratch, Sort_Pair_i32, buffer_ranges.count); Sort_Pair_i32 *range_index_buffer_id_pairs = push_array(scratch, Sort_Pair_i32, buffer_ranges.count);
for (i32 i = 0; i < buffer_ranges.count; i += 1){ for (i32 i = 0; i < buffer_ranges.count; i += 1){
range_index_buffer_id_pairs[i].index = i; range_index_buffer_id_pairs[i].index = i;
range_index_buffer_id_pairs[i].key = jumps.jumps[buffer_ranges.ranges[i].first].jump_buffer_id; range_index_buffer_id_pairs[i].key = jumps.jumps[buffer_ranges.ranges[i].first].jump_buffer_id;
} }
sort_pairs_by_key(range_index_buffer_id_pairs, buffer_ranges.count); sort_pairs_by_key(range_index_buffer_id_pairs, buffer_ranges.count);
Range_Array scoped_buffer_ranges = get_ranges_of_duplicate_keys(scratch, Range_i32_Array scoped_buffer_ranges = get_ranges_of_duplicate_keys(scratch,
&range_index_buffer_id_pairs->key, &range_index_buffer_id_pairs->key,
sizeof(*range_index_buffer_id_pairs), sizeof(*range_index_buffer_id_pairs),
buffer_ranges.count); buffer_ranges.count);
@ -124,14 +124,14 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
scope_array[0] = buffer_get_managed_scope(app, buffer); scope_array[0] = buffer_get_managed_scope(app, buffer);
for (i32 i = 0; i < scoped_buffer_ranges.count; i += 1){ for (i32 i = 0; i < scoped_buffer_ranges.count; i += 1){
Range buffer_range_indices = scoped_buffer_ranges.ranges[i]; Range_i32 buffer_range_indices = scoped_buffer_ranges.ranges[i];
u32 total_jump_count = 0; u32 total_jump_count = 0;
for (i32 j = buffer_range_indices.first; for (i32 j = buffer_range_indices.first;
j < buffer_range_indices.one_past_last; j < buffer_range_indices.one_past_last;
j += 1){ j += 1){
i32 range_index = range_index_buffer_id_pairs[j].index; i32 range_index = range_index_buffer_id_pairs[j].index;
Range range = buffer_ranges.ranges[range_index]; Range_i32 range = buffer_ranges.ranges[range_index];
total_jump_count += range_size(range); total_jump_count += range_size(range);
} }
@ -143,7 +143,7 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
j < buffer_range_indices.one_past_last; j < buffer_range_indices.one_past_last;
j += 1){ j += 1){
i32 range_index = range_index_buffer_id_pairs[j].index; i32 range_index = range_index_buffer_id_pairs[j].index;
Range range = buffer_ranges.ranges[range_index]; Range_i32 range = buffer_ranges.ranges[range_index];
if (target_buffer_id == 0){ if (target_buffer_id == 0){
target_buffer_id = jumps.jumps[range.first].jump_buffer_id; target_buffer_id = jumps.jumps[range.first].jump_buffer_id;
} }

View File

@ -5,7 +5,7 @@
// TOP // TOP
function b32 function b32
ms_style_verify(String_Const_u8 line, umem left_paren_pos, umem right_paren_pos){ ms_style_verify(String_Const_u8 line, u64 left_paren_pos, u64 right_paren_pos){
i32 result = false; i32 result = false;
String_Const_u8 line_part = string_skip(line, right_paren_pos); String_Const_u8 line_part = string_skip(line, right_paren_pos);
if (string_match(string_prefix(line_part, 4), string_u8_litexpr(") : "))){ if (string_match(string_prefix(line_part, 4), string_u8_litexpr(") : "))){
@ -18,7 +18,7 @@ ms_style_verify(String_Const_u8 line, umem left_paren_pos, umem right_paren_pos)
String_Const_u8 number = string_skip(string_prefix(line, right_paren_pos - 1), left_paren_pos + 1); String_Const_u8 number = string_skip(string_prefix(line, right_paren_pos - 1), left_paren_pos + 1);
if (!string_is_integer(number, 10)){ if (!string_is_integer(number, 10)){
result = false; result = false;
umem comma_pos = string_find_first(number, ','); u64 comma_pos = string_find_first(number, ',');
if (comma_pos < number.size){ if (comma_pos < number.size){
String_Const_u8 sub_number0 = string_prefix(number, comma_pos); String_Const_u8 sub_number0 = string_prefix(number, comma_pos);
String_Const_u8 sub_number1 = string_skip(number, comma_pos + 1); String_Const_u8 sub_number1 = string_skip(number, comma_pos + 1);
@ -31,24 +31,24 @@ ms_style_verify(String_Const_u8 line, umem left_paren_pos, umem right_paren_pos)
return(result); return(result);
} }
function umem function u64
try_skip_rust_arrow(String_Const_u8 line){ try_skip_rust_arrow(String_Const_u8 line){
umem pos = 0; u64 pos = 0;
if (string_match(string_prefix(line, 3), string_u8_litexpr("-->"))){ if (string_match(string_prefix(line, 3), string_u8_litexpr("-->"))){
String_Const_u8 sub = string_skip(line, 3); String_Const_u8 sub = string_skip(line, 3);
sub = string_skip_chop_whitespace(sub); sub = string_skip_chop_whitespace(sub);
pos = (umem)(sub.str - line.str); pos = (u64)(sub.str - line.str);
} }
return(pos); return(pos);
} }
function b32 function b32
check_is_note(String_Const_u8 line, umem colon_pos){ check_is_note(String_Const_u8 line, u64 colon_pos){
b32 is_note = false; b32 is_note = false;
umem note_pos = colon_pos + string_find_first(string_skip(line, colon_pos), string_u8_litexpr("note")); u64 note_pos = colon_pos + string_find_first(string_skip(line, colon_pos), string_u8_litexpr("note"));
if (note_pos < line.size){ if (note_pos < line.size){
b32 is_all_whitespace = true; b32 is_all_whitespace = true;
for (umem i = colon_pos + 1; i < note_pos; i += 1){ for (u64 i = colon_pos + 1; i < note_pos; i += 1){
if (!character_is_whitespace(line.str[i])){ if (!character_is_whitespace(line.str[i])){
is_all_whitespace = false; is_all_whitespace = false;
break; break;
@ -67,11 +67,11 @@ parse_jump_location(String_Const_u8 line){
jump.sub_jump_indented = (string_get_character(line, 0) == ' '); jump.sub_jump_indented = (string_get_character(line, 0) == ' ');
String_Const_u8 reduced_line = string_skip_chop_whitespace(line); String_Const_u8 reduced_line = string_skip_chop_whitespace(line);
umem whitespace_length = (umem)(reduced_line.str - line.str); u64 whitespace_length = (u64)(reduced_line.str - line.str);
line = reduced_line; line = reduced_line;
umem left_paren_pos = string_find_first(line, '('); u64 left_paren_pos = string_find_first(line, '(');
umem right_paren_pos = left_paren_pos + string_find_first(string_skip(line, left_paren_pos), ')'); u64 right_paren_pos = left_paren_pos + string_find_first(string_skip(line, left_paren_pos), ')');
for (;!jump.is_ms_style && right_paren_pos < line.size;){ for (;!jump.is_ms_style && right_paren_pos < line.size;){
if (ms_style_verify(line, left_paren_pos, right_paren_pos)){ if (ms_style_verify(line, left_paren_pos, right_paren_pos)){
jump.is_ms_style = true; jump.is_ms_style = true;
@ -96,7 +96,7 @@ parse_jump_location(String_Const_u8 line){
line_number = string_skip_chop_whitespace(line_number); line_number = string_skip_chop_whitespace(line_number);
if (line_number.size > 0){ if (line_number.size > 0){
umem comma_pos = string_find_first(line_number, ','); u64 comma_pos = string_find_first(line_number, ',');
if (comma_pos < line_number.size){ if (comma_pos < line_number.size){
String_Const_u8 column_number = string_skip(line_number, comma_pos + 1); String_Const_u8 column_number = string_skip(line_number, comma_pos + 1);
line_number = string_prefix(line_number, comma_pos); line_number = string_prefix(line_number, comma_pos);
@ -127,15 +127,15 @@ parse_jump_location(String_Const_u8 line){
jump.has_rust_arrow = true; jump.has_rust_arrow = true;
} }
umem colon_pos1 = string_find_first(string_skip(line, start), ':') + start; u64 colon_pos1 = string_find_first(string_skip(line, start), ':') + start;
if (line.size > colon_pos1 + 1){ if (line.size > colon_pos1 + 1){
if (character_is_slash(string_get_character(line, colon_pos1 + 1))){ if (character_is_slash(string_get_character(line, colon_pos1 + 1))){
colon_pos1 = string_find_first(string_skip(line, colon_pos1 + 1), ':') + colon_pos1 + 1; colon_pos1 = string_find_first(string_skip(line, colon_pos1 + 1), ':') + colon_pos1 + 1;
} }
} }
umem colon_pos2 = string_find_first(string_skip(line, colon_pos1 + 1), ':') + colon_pos1 + 1; u64 colon_pos2 = string_find_first(string_skip(line, colon_pos1 + 1), ':') + colon_pos1 + 1;
umem colon_pos3 = string_find_first(string_skip(line, colon_pos2 + 1), ':') + colon_pos2 + 1; u64 colon_pos3 = string_find_first(string_skip(line, colon_pos2 + 1), ':') + colon_pos2 + 1;
if (colon_pos3 < line.size){ if (colon_pos3 < line.size){
if (check_is_note(line, colon_pos3)){ if (check_is_note(line, colon_pos3)){

View File

@ -301,7 +301,7 @@ layout_unwrapped_small_blank_lines(Application_Links *app, Arena *arena, Buffer_
Newline_Layout_Vars newline_vars = get_newline_layout_vars(); Newline_Layout_Vars newline_vars = get_newline_layout_vars();
b32 all_whitespace = true; b32 all_whitespace = true;
for (umem i = 0; i < text.size; i += 1){ for (u64 i = 0; i < text.size; i += 1){
if (!character_is_whitespace(text.str[i])){ if (!character_is_whitespace(text.str[i])){
all_whitespace = false; all_whitespace = false;
break; break;
@ -315,7 +315,7 @@ layout_unwrapped_small_blank_lines(Application_Links *app, Arena *arena, Buffer_
u8 *ptr = text.str; u8 *ptr = text.str;
u8 *end_ptr = ptr + text.size; u8 *end_ptr = ptr + text.size;
for (;ptr < end_ptr;){ for (;ptr < end_ptr;){
Character_Consume_Result consume = utf8_consume(ptr, (umem)(end_ptr - ptr)); Character_Consume_Result consume = utf8_consume(ptr, (u64)(end_ptr - ptr));
i64 index = layout_index_from_ptr(ptr, text.str, range.first); i64 index = layout_index_from_ptr(ptr, text.str, range.first);
switch (consume.codepoint){ switch (consume.codepoint){
@ -396,7 +396,7 @@ layout_wrap_anywhere(Application_Links *app, Arena *arena, Buffer_ID buffer, Ran
u8 *ptr = text.str; u8 *ptr = text.str;
u8 *end_ptr = ptr + text.size; u8 *end_ptr = ptr + text.size;
for (;ptr < end_ptr;){ for (;ptr < end_ptr;){
Character_Consume_Result consume = utf8_consume(ptr, (umem)(end_ptr - ptr)); Character_Consume_Result consume = utf8_consume(ptr, (u64)(end_ptr - ptr));
i64 index = layout_index_from_ptr(ptr, text.str, range.first); i64 index = layout_index_from_ptr(ptr, text.str, range.first);
switch (consume.codepoint){ switch (consume.codepoint){
default: default:
@ -469,7 +469,7 @@ layout_unwrapped__inner(Application_Links *app, Arena *arena, Buffer_ID buffer,
u8 *ptr = text.str; u8 *ptr = text.str;
u8 *end_ptr = ptr + text.size; u8 *end_ptr = ptr + text.size;
for (;ptr < end_ptr;){ for (;ptr < end_ptr;){
Character_Consume_Result consume = utf8_consume(ptr, (umem)(end_ptr - ptr)); Character_Consume_Result consume = utf8_consume(ptr, (u64)(end_ptr - ptr));
i64 index = layout_index_from_ptr(ptr, text.str, range.first); i64 index = layout_index_from_ptr(ptr, text.str, range.first);
switch (consume.codepoint){ switch (consume.codepoint){
@ -572,7 +572,7 @@ layout_wrap_whitespace__inner(Application_Links *app, Arena *arena, Buffer_ID bu
ptr = word.str; ptr = word.str;
for (;ptr < word_end;){ for (;ptr < word_end;){
Character_Consume_Result consume = Character_Consume_Result consume =
utf8_consume(ptr, (umem)(word_end - ptr)); utf8_consume(ptr, (u64)(word_end - ptr));
if (consume.codepoint != max_u32){ if (consume.codepoint != max_u32){
total_advance += lr_tb_advance(&pos_vars, face, consume.codepoint); total_advance += lr_tb_advance(&pos_vars, face, consume.codepoint);
} }
@ -591,7 +591,7 @@ layout_wrap_whitespace__inner(Application_Links *app, Arena *arena, Buffer_ID bu
for (;ptr < word_end;){ for (;ptr < word_end;){
Character_Consume_Result consume = Character_Consume_Result consume =
utf8_consume(ptr, (umem)(word_end - ptr)); utf8_consume(ptr, (u64)(word_end - ptr));
i64 index = layout_index_from_ptr(ptr, text.str, range.first); i64 index = layout_index_from_ptr(ptr, text.str, range.first);
if (consume.codepoint != max_u32){ if (consume.codepoint != max_u32){

View File

@ -684,7 +684,7 @@ lister_begin_new_item_set(Application_Links *app, Lister *lister){
} }
function void* function void*
lister_add_item(Lister *lister, Lister_Prealloced_String string, Lister_Prealloced_String status, void *user_data, umem extra_space){ lister_add_item(Lister *lister, Lister_Prealloced_String string, Lister_Prealloced_String status, void *user_data, u64 extra_space){
void *base_memory = push_array(lister->arena, u8, sizeof(Lister_Node) + extra_space); void *base_memory = push_array(lister->arena, u8, sizeof(Lister_Node) + extra_space);
Lister_Node *node = (Lister_Node*)base_memory; Lister_Node *node = (Lister_Node*)base_memory;
node->string = string.string; node->string = string.string;
@ -699,17 +699,17 @@ lister_add_item(Lister *lister, Lister_Prealloced_String string, Lister_Prealloc
function void* function void*
lister_add_item(Lister *lister, Lister_Prealloced_String string, String_Const_u8 status, lister_add_item(Lister *lister, Lister_Prealloced_String string, String_Const_u8 status,
void *user_data, umem extra_space){ void *user_data, u64 extra_space){
return(lister_add_item(lister, string, lister_prealloced(push_string_copy(lister->arena, status)), user_data, extra_space)); return(lister_add_item(lister, string, lister_prealloced(push_string_copy(lister->arena, status)), user_data, extra_space));
} }
function void* function void*
lister_add_item(Lister *lister, String_Const_u8 string, Lister_Prealloced_String status, void *user_data, umem extra_space){ lister_add_item(Lister *lister, String_Const_u8 string, Lister_Prealloced_String status, void *user_data, u64 extra_space){
return(lister_add_item(lister, lister_prealloced(push_string_copy(lister->arena, string)), status, user_data, extra_space)); return(lister_add_item(lister, lister_prealloced(push_string_copy(lister->arena, string)), status, user_data, extra_space));
} }
function void* function void*
lister_add_item(Lister *lister, String_Const_u8 string, String_Const_u8 status, void *user_data, umem extra_space){ lister_add_item(Lister *lister, String_Const_u8 string, String_Const_u8 status, void *user_data, u64 extra_space){
return(lister_add_item(lister, return(lister_add_item(lister,
lister_prealloced(push_string_copy(lister->arena, string)), lister_prealloced(push_string_copy(lister->arena, string)),
lister_prealloced(push_string_copy(lister->arena, status)), lister_prealloced(push_string_copy(lister->arena, status)),
@ -895,7 +895,7 @@ get_choice_from_user(Application_Links *app, String_Const_u8 query,
for (Lister_Choice *choice = list.first; for (Lister_Choice *choice = list.first;
choice != 0; choice != 0;
choice = choice->next){ choice = choice->next){
umem code_size = sizeof(choice->key_code); u64 code_size = sizeof(choice->key_code);
void *extra = lister_add_item(lister, choice->string, choice->status, void *extra = lister_add_item(lister, choice->string, choice->status,
choice, code_size); choice, code_size);
block_copy(extra, &choice->key_code, code_size); block_copy(extra, &choice->key_code, code_size);

View File

@ -173,7 +173,7 @@ make_log_parse(Arena *arena, String_Const_u8 source){
parse.id_to_string_table = make_table_u64_Data(arena->base_allocator, 500); parse.id_to_string_table = make_table_u64_Data(arena->base_allocator, 500);
for (;source.size > 0;){ for (;source.size > 0;){
umem end_of_line = string_find_first(source, '\n'); u64 end_of_line = string_find_first(source, '\n');
String_Const_u8 line = string_prefix(source, end_of_line); String_Const_u8 line = string_prefix(source, end_of_line);
line = string_skip_chop_whitespace(line); line = string_skip_chop_whitespace(line);
source = string_skip(source, end_of_line + 1); source = string_skip(source, end_of_line + 1);
@ -185,11 +185,11 @@ make_log_parse(Arena *arena, String_Const_u8 source){
String_Const_u8 whole_line = line; String_Const_u8 whole_line = line;
{ {
umem colon1 = string_find_first(line, ':'); u64 colon1 = string_find_first(line, ':');
src_file_name = string_prefix(line, colon1); src_file_name = string_prefix(line, colon1);
line = string_skip(line, colon1 + 1); line = string_skip(line, colon1 + 1);
umem colon2 = string_find_first(line, ':'); u64 colon2 = string_find_first(line, ':');
src_line_number = string_prefix(line, colon2); src_line_number = string_prefix(line, colon2);
line = string_skip(line, colon2 + 1); line = string_skip(line, colon2 + 1);
@ -201,12 +201,12 @@ make_log_parse(Arena *arena, String_Const_u8 source){
if (!got_source_position){ if (!got_source_position){
line = whole_line; line = whole_line;
umem colon0 = string_find_first(line, ':'); u64 colon0 = string_find_first(line, ':');
umem colon1 = string_find_first(line, colon0 + 1, ':'); u64 colon1 = string_find_first(line, colon0 + 1, ':');
src_file_name = string_prefix(line, colon1); src_file_name = string_prefix(line, colon1);
line = string_skip(line, colon1 + 1); line = string_skip(line, colon1 + 1);
umem colon2 = string_find_first(line, ':'); u64 colon2 = string_find_first(line, ':');
src_line_number = string_prefix(line, colon2); src_line_number = string_prefix(line, colon2);
line = string_skip(line, colon2 + 1); line = string_skip(line, colon2 + 1);
@ -216,7 +216,7 @@ make_log_parse(Arena *arena, String_Const_u8 source){
} }
if (got_source_position){ if (got_source_position){
umem bracket_open = string_find_first(line, '['); u64 bracket_open = string_find_first(line, '[');
String_Const_u8 event_name = string_prefix(line, bracket_open); String_Const_u8 event_name = string_prefix(line, bracket_open);
event_name = string_skip_chop_whitespace(event_name); event_name = string_skip_chop_whitespace(event_name);
line = string_skip(line, bracket_open + 1); line = string_skip(line, bracket_open + 1);
@ -225,13 +225,13 @@ make_log_parse(Arena *arena, String_Const_u8 source){
src_file_name, src_line_number, event_name); src_file_name, src_line_number, event_name);
for (;line.size > 0;){ for (;line.size > 0;){
umem bracket_close = string_find_first(line, ']'); u64 bracket_close = string_find_first(line, ']');
String_Const_u8 tag = string_prefix(line, bracket_close); String_Const_u8 tag = string_prefix(line, bracket_close);
line = string_skip(line, bracket_close + 1); line = string_skip(line, bracket_close + 1);
bracket_open = string_find_first(line, '['); bracket_open = string_find_first(line, '[');
line = string_skip(line, bracket_open + 1); line = string_skip(line, bracket_open + 1);
umem equal_sign = string_find_first(tag, '='); u64 equal_sign = string_find_first(tag, '=');
String_Const_u8 tag_name = string_prefix(tag, equal_sign); String_Const_u8 tag_name = string_prefix(tag, equal_sign);
String_Const_u8 tag_contents = string_skip(tag, equal_sign + 1); String_Const_u8 tag_contents = string_skip(tag, equal_sign + 1);

View File

@ -8,9 +8,9 @@
#include <malloc.h> #include <malloc.h>
internal void* internal void*
base_reserve__malloc(void *user_data, umem size, umem *size_out, String_Const_u8 location){ base_reserve__malloc(void *user_data, u64 size, u64 *size_out, String_Const_u8 location){
*size_out = size; *size_out = size;
return(malloc(size)); return(malloc((size_t)size));
} }
internal void internal void
@ -35,13 +35,13 @@ get_allocator_malloc(void){
} }
internal Arena internal Arena
make_arena_malloc(umem chunk_size, umem align){ make_arena_malloc(u64 chunk_size, u64 align){
Base_Allocator *allocator = get_allocator_malloc(); Base_Allocator *allocator = get_allocator_malloc();
return(make_arena(allocator, chunk_size, align)); return(make_arena(allocator, chunk_size, align));
} }
internal Arena internal Arena
make_arena_malloc(umem chunk_size){ make_arena_malloc(u64 chunk_size){
return(make_arena_malloc(chunk_size, 8)); return(make_arena_malloc(chunk_size, 8));
} }

View File

@ -150,7 +150,7 @@ get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i64 pos, Miblo
String_Const_u8 string = push_buffer_range(app, scratch, buffer, time_stamp_range); String_Const_u8 string = push_buffer_range(app, scratch, buffer, time_stamp_range);
if (string.size > 0){ if (string.size > 0){
i32 count_colons = 0; i32 count_colons = 0;
for (umem i = 0; i < string.size; ++i){ for (u64 i = 0; i < string.size; ++i){
if (string.str[i] == ':'){ if (string.str[i] == ':'){
count_colons += 1; count_colons += 1;
} }

View File

@ -94,7 +94,7 @@ struct Memory_Bucket{
Memory_Bucket *next; Memory_Bucket *next;
Memory_Annotation annotation; Memory_Annotation annotation;
String_Const_u8 location; String_Const_u8 location;
umem total_memory; u64 total_memory;
}; };
#endif #endif

View File

@ -948,7 +948,7 @@ project_key_strings_query_user(Application_Links *app,
if (get_script_file){ if (get_script_file){
script_file_bar.prompt = string_u8_litexpr("Script Name: "); script_file_bar.prompt = string_u8_litexpr("Script Name: ");
script_file_bar.string = SCu8(script_file_space, (umem)0); script_file_bar.string = SCu8(script_file_space, (u64)0);
script_file_bar.string_capacity = script_file_cap; script_file_bar.string_capacity = script_file_cap;
if (!query_user_string(app, &script_file_bar)) return(keys); if (!query_user_string(app, &script_file_bar)) return(keys);
if (script_file_bar.string.size == 0) return(keys); if (script_file_bar.string.size == 0) return(keys);
@ -956,14 +956,14 @@ project_key_strings_query_user(Application_Links *app,
if (get_code_file){ if (get_code_file){
code_file_bar.prompt = string_u8_litexpr("Build Target: "); code_file_bar.prompt = string_u8_litexpr("Build Target: ");
code_file_bar.string = SCu8(code_file_space, (umem)0); code_file_bar.string = SCu8(code_file_space, (u64)0);
code_file_bar.string_capacity = code_file_cap; code_file_bar.string_capacity = code_file_cap;
if (!query_user_string(app, &code_file_bar)) return(keys); if (!query_user_string(app, &code_file_bar)) return(keys);
if (code_file_bar.string.size == 0) return(keys); if (code_file_bar.string.size == 0) return(keys);
} }
output_dir_bar.prompt = string_u8_litexpr("Output Directory: "); output_dir_bar.prompt = string_u8_litexpr("Output Directory: ");
output_dir_bar.string = SCu8(output_dir_space, (umem)0); output_dir_bar.string = SCu8(output_dir_space, (u64)0);
output_dir_bar.string_capacity = output_dir_cap; output_dir_bar.string_capacity = output_dir_cap;
if (!query_user_string(app, &output_dir_bar)) return(keys); if (!query_user_string(app, &output_dir_bar)) return(keys);
if (output_dir_bar.string.size == 0 && output_dir_cap > 0){ if (output_dir_bar.string.size == 0 && output_dir_cap > 0){
@ -972,7 +972,7 @@ project_key_strings_query_user(Application_Links *app,
} }
binary_file_bar.prompt = string_u8_litexpr("Binary Output: "); binary_file_bar.prompt = string_u8_litexpr("Binary Output: ");
binary_file_bar.string = SCu8(binary_file_space, (umem)0); binary_file_bar.string = SCu8(binary_file_space, (u64)0);
binary_file_bar.string_capacity = binary_file_cap; binary_file_bar.string_capacity = binary_file_cap;
if (!query_user_string(app, &binary_file_bar)) return(keys); if (!query_user_string(app, &binary_file_bar)) return(keys);
if (binary_file_bar.string.size == 0) return(keys); if (binary_file_bar.string.size == 0) return(keys);

View File

@ -16,7 +16,7 @@ push_stringfv(Arena *arena, char *format, va_list args){
va_copy(args2, args); va_copy(args2, args);
i32 size = vsnprintf(0, 0, format, args); i32 size = vsnprintf(0, 0, format, args);
String_Const_char result = string_const_char_push(arena, size + 1); String_Const_char result = string_const_char_push(arena, size + 1);
vsnprintf(result.str, result.size, format, args2); vsnprintf(result.str, (size_t)result.size, format, args2);
result.size -= 1; result.size -= 1;
result.str[result.size] = 0; result.str[result.size] = 0;
return(result); return(result);
@ -45,8 +45,8 @@ push_u8_stringf(Arena *arena, char *format, ...){
static void static void
string_list_pushfv(Arena *arena, List_String_Const_char *list, char *format, va_list args){ string_list_pushfv(Arena *arena, List_String_Const_char *list, char *format, va_list args){
String_Const_char string = push_stringfv(arena, format, args); String_Const_char string = push_stringfv(arena, format, args);
if (arena->alignment < sizeof(umem)){ if (arena->alignment < sizeof(u64)){
push_align(arena, sizeof(umem)); push_align(arena, sizeof(u64));
} }
string_list_push(arena, list, string); string_list_push(arena, list, string);
} }
@ -60,8 +60,8 @@ string_list_pushf(Arena *arena, List_String_Const_char *list, char *format, ...)
static void static void
string_list_pushfv(Arena *arena, List_String_Const_u8 *list, char *format, va_list args){ string_list_pushfv(Arena *arena, List_String_Const_u8 *list, char *format, va_list args){
String_Const_u8 string = push_u8_stringfv(arena, format, args); String_Const_u8 string = push_u8_stringfv(arena, format, args);
if (arena->alignment < sizeof(umem)){ if (arena->alignment < sizeof(u64)){
push_align(arena, sizeof(umem)); push_align(arena, sizeof(u64));
} }
string_list_push(arena, list, string); string_list_push(arena, list, string);
} }

View File

@ -5,29 +5,28 @@
// TOP // TOP
internal void* internal void*
base_reserve__system(void *user_data, umem size, umem *size_out, String_Const_u8 location){ base_reserve__system(void *user_data, u64 size, u64 *size_out, String_Const_u8 location){
umem extra_size = 128; u64 extra_size = 128;
umem increased_size = size + extra_size; u64 increased_size = size + extra_size;
size = round_up_umem(increased_size, KB(4)); size = round_up_u64(increased_size, KB(4));
*size_out = size - extra_size; *size_out = size - extra_size;
void *ptr = system_memory_allocate(size, location); void *ptr = system_memory_allocate(size, location);
*(umem*)ptr = size; *(u64*)ptr = size;
ptr = (u8*)ptr + extra_size; ptr = (u8*)ptr + extra_size;
return(ptr); return(ptr);
} }
internal void internal void
base_free__system(void *user_data, void *ptr){ base_free__system(void *user_data, void *ptr){
umem extra_size = 128; u64 extra_size = 128;
ptr = (u8*)ptr - extra_size; ptr = (u8*)ptr - extra_size;
umem size = *(umem*)ptr; u64 size = *(u64*)ptr;
system_memory_free(ptr, size); system_memory_free(ptr, size);
} }
internal Base_Allocator internal Base_Allocator
make_base_allocator_system(void){ make_base_allocator_system(void){
return(make_base_allocator(base_reserve__system, 0, 0, return(make_base_allocator(base_reserve__system, 0, 0, base_free__system, 0, 0));
base_free__system, 0, 0));
} }
global Base_Allocator base_allocator_system = {}; global Base_Allocator base_allocator_system = {};
@ -41,12 +40,12 @@ get_base_allocator_system(void){
} }
internal Arena internal Arena
make_arena_system(umem chunk_size, umem align){ make_arena_system(u64 chunk_size, u64 align){
return(make_arena(get_base_allocator_system(), chunk_size, align)); return(make_arena(get_base_allocator_system(), chunk_size, align));
} }
internal Arena internal Arena
make_arena_system(umem chunk_size){ make_arena_system(u64 chunk_size){
return(make_arena_system(chunk_size, 8)); return(make_arena_system(chunk_size, 8));
} }

View File

@ -35,7 +35,7 @@ struct Memory_Annotation_Node{
Memory_Annotation_Node *next; Memory_Annotation_Node *next;
String_Const_u8 location; String_Const_u8 location;
void *address; void *address;
umem size; u64 size;
}; };
struct Memory_Annotation{ struct Memory_Annotation{

View File

@ -4,7 +4,7 @@
// TOP // TOP
function Interval_i64 function Range_i64
Ii64(Token *token){ Ii64(Token *token){
return(Ii64_size(token->pos, token->size)); return(Ii64_size(token->pos, token->size));
} }

View File

@ -475,7 +475,7 @@ api(custom)
struct Query_Bar{ struct Query_Bar{
String_Const_u8 prompt; String_Const_u8 prompt;
String_Const_u8 string; String_Const_u8 string;
umem string_capacity; u64 string_capacity;
}; };
api(custom) api(custom)
@ -554,7 +554,7 @@ struct Face_Advance_Map{
api(custom) api(custom)
struct Edit{ struct Edit{
String_Const_u8 text; String_Const_u8 text;
Interval_i64 range; Range_i64 range;
}; };
api(custom) api(custom)
@ -660,8 +660,8 @@ struct Buffer_Name_Conflict_Entry{
String_Const_u8 file_name; String_Const_u8 file_name;
String_Const_u8 base_name; String_Const_u8 base_name;
u8 *unique_name_in_out; u8 *unique_name_in_out;
umem unique_name_len_in_out; u64 unique_name_len_in_out;
umem unique_name_capacity; u64 unique_name_capacity;
}; };
api(custom) api(custom)
@ -674,8 +674,8 @@ typedef i32 Buffer_Hook_Function(Application_Links *app, Buffer_ID buffer_id);
api(custom) api(custom)
typedef i32 Buffer_Edit_Range_Function(Application_Links *app, Buffer_ID buffer_id, typedef i32 Buffer_Edit_Range_Function(Application_Links *app, Buffer_ID buffer_id,
Range_i64 new_range, umem original_size); Range_i64 new_range, u64 original_size);
#define BUFFER_EDIT_RANGE_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id, Interval_i64 new_range, umem original_size) #define BUFFER_EDIT_RANGE_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id, Range_i64 new_range, u64 original_size)
api(custom) api(custom)
typedef Vec2_f32 Delta_Rule_Function(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data); typedef Vec2_f32 Delta_Rule_Function(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data);
@ -738,7 +738,7 @@ api(custom)
struct View_Context{ struct View_Context{
Render_Caller_Function *render_caller; Render_Caller_Function *render_caller;
Delta_Rule_Function *delta_rule; Delta_Rule_Function *delta_rule;
umem delta_rule_memory_size; u64 delta_rule_memory_size;
b32 hides_buffer; b32 hides_buffer;
struct Mapping *mapping; struct Mapping *mapping;
i64 map_id; i64 map_id;

View File

@ -1,9 +1,5 @@
@echo off @echo off
REM (allen): quit early if we already have cl
where /q cl
IF %ERRORLEVEL% == 0 (EXIT /b)
SET "LIB=" SET "LIB="
SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0 SET VC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0

View File

@ -1,5 +1,9 @@
@echo off @echo off
REM (allen): quit early if we already have cl
where /q cl
IF %ERRORLEVEL% == 0 (EXIT /b)
SET SCRIPTS_PATH=%~dp0 SET SCRIPTS_PATH=%~dp0
%SCRIPTS_PATH%\setup_cl_generic.bat amd64 %SCRIPTS_PATH%\setup_cl_generic.bat amd64

View File

@ -104,7 +104,7 @@
#define custom_managed_id_group_highest_id_sig() u64 custom_managed_id_group_highest_id(Application_Links* app, String_Const_u8 group) #define custom_managed_id_group_highest_id_sig() u64 custom_managed_id_group_highest_id(Application_Links* app, String_Const_u8 group)
#define custom_managed_id_declare_sig() Managed_ID custom_managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name) #define custom_managed_id_declare_sig() Managed_ID custom_managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name)
#define custom_managed_id_get_sig() Managed_ID custom_managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name) #define custom_managed_id_get_sig() Managed_ID custom_managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name)
#define custom_managed_scope_get_attachment_sig() void* custom_managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size) #define custom_managed_scope_get_attachment_sig() void* custom_managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size)
#define custom_managed_scope_attachment_erase_sig() b32 custom_managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id) #define custom_managed_scope_attachment_erase_sig() b32 custom_managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id)
#define custom_alloc_managed_memory_in_scope_sig() Managed_Object custom_alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count) #define custom_alloc_managed_memory_in_scope_sig() Managed_Object custom_alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count)
#define custom_alloc_buffer_markers_on_buffer_sig() Managed_Object custom_alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope) #define custom_alloc_buffer_markers_on_buffer_sig() Managed_Object custom_alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope)
@ -122,7 +122,7 @@
#define custom_set_current_input_sig() void custom_set_current_input(Application_Links* app, User_Input* input) #define custom_set_current_input_sig() void custom_set_current_input(Application_Links* app, User_Input* input)
#define custom_leave_current_input_unhandled_sig() void custom_leave_current_input_unhandled(Application_Links* app) #define custom_leave_current_input_unhandled_sig() void custom_leave_current_input_unhandled(Application_Links* app)
#define custom_set_custom_hook_sig() void custom_set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr) #define custom_set_custom_hook_sig() void custom_set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr)
#define custom_set_custom_hook_memory_size_sig() b32 custom_set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, umem size) #define custom_set_custom_hook_memory_size_sig() b32 custom_set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size)
#define custom_get_mouse_state_sig() Mouse_State custom_get_mouse_state(Application_Links* app) #define custom_get_mouse_state_sig() Mouse_State custom_get_mouse_state(Application_Links* app)
#define custom_get_active_query_bars_sig() b32 custom_get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out) #define custom_get_active_query_bars_sig() b32 custom_get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out)
#define custom_start_query_bar_sig() b32 custom_start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags) #define custom_start_query_bar_sig() b32 custom_start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags)
@ -164,7 +164,7 @@
#define custom_text_layout_get_visible_range_sig() Range_i64 custom_text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id) #define custom_text_layout_get_visible_range_sig() Range_i64 custom_text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_text_layout_line_on_screen_sig() Range_f32 custom_text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number) #define custom_text_layout_line_on_screen_sig() Range_f32 custom_text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number)
#define custom_text_layout_character_on_screen_sig() Rect_f32 custom_text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos) #define custom_text_layout_character_on_screen_sig() Rect_f32 custom_text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos)
#define custom_paint_text_color_sig() void custom_paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color) #define custom_paint_text_color_sig() void custom_paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color)
#define custom_text_layout_free_sig() b32 custom_text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id) #define custom_text_layout_free_sig() b32 custom_text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_draw_text_layout_sig() void custom_draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color) #define custom_draw_text_layout_sig() void custom_draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color)
#define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker) #define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
@ -278,7 +278,7 @@ typedef Base_Allocator* custom_managed_scope_allocator_type(Application_Links* a
typedef u64 custom_managed_id_group_highest_id_type(Application_Links* app, String_Const_u8 group); typedef u64 custom_managed_id_group_highest_id_type(Application_Links* app, String_Const_u8 group);
typedef Managed_ID custom_managed_id_declare_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name); typedef Managed_ID custom_managed_id_declare_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
typedef Managed_ID custom_managed_id_get_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name); typedef Managed_ID custom_managed_id_get_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
typedef void* custom_managed_scope_get_attachment_type(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size); typedef void* custom_managed_scope_get_attachment_type(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
typedef b32 custom_managed_scope_attachment_erase_type(Application_Links* app, Managed_Scope scope, Managed_ID id); typedef b32 custom_managed_scope_attachment_erase_type(Application_Links* app, Managed_Scope scope, Managed_ID id);
typedef Managed_Object custom_alloc_managed_memory_in_scope_type(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count); typedef Managed_Object custom_alloc_managed_memory_in_scope_type(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
typedef Managed_Object custom_alloc_buffer_markers_on_buffer_type(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope); typedef Managed_Object custom_alloc_buffer_markers_on_buffer_type(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
@ -296,7 +296,7 @@ typedef User_Input custom_get_current_input_type(Application_Links* app);
typedef void custom_set_current_input_type(Application_Links* app, User_Input* input); typedef void custom_set_current_input_type(Application_Links* app, User_Input* input);
typedef void custom_leave_current_input_unhandled_type(Application_Links* app); typedef void custom_leave_current_input_unhandled_type(Application_Links* app);
typedef void custom_set_custom_hook_type(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr); typedef void custom_set_custom_hook_type(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
typedef b32 custom_set_custom_hook_memory_size_type(Application_Links* app, Hook_ID hook_id, umem size); typedef b32 custom_set_custom_hook_memory_size_type(Application_Links* app, Hook_ID hook_id, u64 size);
typedef Mouse_State custom_get_mouse_state_type(Application_Links* app); typedef Mouse_State custom_get_mouse_state_type(Application_Links* app);
typedef b32 custom_get_active_query_bars_type(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out); typedef b32 custom_get_active_query_bars_type(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
typedef b32 custom_start_query_bar_type(Application_Links* app, Query_Bar* bar, u32 flags); typedef b32 custom_start_query_bar_type(Application_Links* app, Query_Bar* bar, u32 flags);
@ -338,7 +338,7 @@ typedef Buffer_ID custom_text_layout_get_buffer_type(Application_Links* app, Tex
typedef Range_i64 custom_text_layout_get_visible_range_type(Application_Links* app, Text_Layout_ID text_layout_id); typedef Range_i64 custom_text_layout_get_visible_range_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef Range_f32 custom_text_layout_line_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 line_number); typedef Range_f32 custom_text_layout_line_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
typedef Rect_f32 custom_text_layout_character_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 pos); typedef Rect_f32 custom_text_layout_character_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color); typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
typedef b32 custom_text_layout_free_type(Application_Links* app, Text_Layout_ID text_layout_id); typedef b32 custom_text_layout_free_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color); typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
typedef void custom_open_color_picker_type(Application_Links* app, Color_Picker* picker); typedef void custom_open_color_picker_type(Application_Links* app, Color_Picker* picker);
@ -629,7 +629,7 @@ internal Base_Allocator* managed_scope_allocator(Application_Links* app, Managed
internal u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group); internal u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
internal Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name); internal Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
internal Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name); internal Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
internal void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size); internal void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
internal b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id); internal b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
internal Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count); internal Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
internal Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope); internal Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
@ -647,7 +647,7 @@ internal User_Input get_current_input(Application_Links* app);
internal void set_current_input(Application_Links* app, User_Input* input); internal void set_current_input(Application_Links* app, User_Input* input);
internal void leave_current_input_unhandled(Application_Links* app); internal void leave_current_input_unhandled(Application_Links* app);
internal void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr); internal void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
internal b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, umem size); internal b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size);
internal Mouse_State get_mouse_state(Application_Links* app); internal Mouse_State get_mouse_state(Application_Links* app);
internal b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out); internal b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
internal b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags); internal b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
@ -689,7 +689,7 @@ internal Buffer_ID text_layout_get_buffer(Application_Links* app, Text_Layout_ID
internal Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id); internal Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
internal Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number); internal Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
internal Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos); internal Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color); internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
internal b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id); internal b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color); internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
internal void open_color_picker(Application_Links* app, Color_Picker* picker); internal void open_color_picker(Application_Links* app, Color_Picker* picker);

View File

@ -632,7 +632,7 @@ API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("manage
api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "Application_Links*", "app");
api_param(arena, call, "Managed_Scope", "scope"); api_param(arena, call, "Managed_Scope", "scope");
api_param(arena, call, "Managed_ID", "id"); api_param(arena, call, "Managed_ID", "id");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("managed_scope_attachment_erase"), string_u8_litexpr("b32"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("managed_scope_attachment_erase"), string_u8_litexpr("b32"), string_u8_litexpr(""));
@ -733,7 +733,7 @@ api_param(arena, call, "Void_Func*", "func_ptr");
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_custom_hook_memory_size"), string_u8_litexpr("b32"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_custom_hook_memory_size"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Application_Links*", "app"); api_param(arena, call, "Application_Links*", "app");
api_param(arena, call, "Hook_ID", "hook_id"); api_param(arena, call, "Hook_ID", "hook_id");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_mouse_state"), string_u8_litexpr("Mouse_State"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_mouse_state"), string_u8_litexpr("Mouse_State"), string_u8_litexpr(""));

View File

@ -104,7 +104,7 @@ api(custom) function Base_Allocator* managed_scope_allocator(Application_Links*
api(custom) function u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group); api(custom) function u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
api(custom) function Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name); api(custom) function Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
api(custom) function Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name); api(custom) function Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
api(custom) function void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size); api(custom) function void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
api(custom) function b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id); api(custom) function b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
api(custom) function Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count); api(custom) function Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
api(custom) function Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope); api(custom) function Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
@ -122,7 +122,7 @@ api(custom) function User_Input get_current_input(Application_Links* app);
api(custom) function void set_current_input(Application_Links* app, User_Input* input); api(custom) function void set_current_input(Application_Links* app, User_Input* input);
api(custom) function void leave_current_input_unhandled(Application_Links* app); api(custom) function void leave_current_input_unhandled(Application_Links* app);
api(custom) function void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr); api(custom) function void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
api(custom) function b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, umem size); api(custom) function b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size);
api(custom) function Mouse_State get_mouse_state(Application_Links* app); api(custom) function Mouse_State get_mouse_state(Application_Links* app);
api(custom) function b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out); api(custom) function b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
api(custom) function b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags); api(custom) function b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
@ -164,7 +164,7 @@ api(custom) function Buffer_ID text_layout_get_buffer(Application_Links* app, Te
api(custom) function Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id); api(custom) function Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number); api(custom) function Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
api(custom) function Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos); api(custom) function Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color); api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
api(custom) function b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id); api(custom) function b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color); api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
api(custom) function void open_color_picker(Application_Links* app, Color_Picker* picker); api(custom) function void open_color_picker(Application_Links* app, Color_Picker* picker);

View File

@ -2,9 +2,9 @@
#define FCODER_LEX_GEN_HAND_WRITTEN #define FCODER_LEX_GEN_HAND_WRITTEN
internal u64 internal u64
lexeme_hash(u64 seed, u8 *ptr, umem size){ lexeme_hash(u64 seed, u8 *ptr, u64 size){
u64 result = 0; u64 result = 0;
for (umem i = 0; i < size; i += 1, ptr += 1){ for (u64 i = 0; i < size; i += 1, ptr += 1){
result ^= ((*ptr) ^ result*59) + seed; result ^= ((*ptr) ^ result*59) + seed;
} }
return(result); return(result);
@ -13,7 +13,7 @@ lexeme_hash(u64 seed, u8 *ptr, umem size){
internal Lexeme_Table_Lookup internal Lexeme_Table_Lookup
lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array, lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array,
Lexeme_Table_Value *value_array, i32 slot_count, u64 seed, Lexeme_Table_Value *value_array, i32 slot_count, u64 seed,
u8 *ptr, umem size){ u8 *ptr, u64 size){
Lexeme_Table_Lookup result = {}; Lexeme_Table_Lookup result = {};
u64 hash = lexeme_hash(seed, ptr, size); u64 hash = lexeme_hash(seed, ptr, size);
u64 comparison_hash = hash | 1; u64 comparison_hash = hash | 1;
@ -3698,8 +3698,8 @@ goto state_label_47; // raw_string_try_delim
} }
{ {
state_label_47: // raw_string_try_delim state_label_47: // raw_string_try_delim
umem delim_length = state.delim_one_past_last - state.delim_first; u64 delim_length = state.delim_one_past_last - state.delim_first;
umem parse_length = 0; u64 parse_length = 0;
for (;;){ for (;;){
if (parse_length == delim_length){ if (parse_length == delim_length){
goto state_label_48; // raw_string_try_quote goto state_label_48; // raw_string_try_quote

View File

@ -37,9 +37,9 @@
#define system_condition_variable_wait_sig() void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex) #define system_condition_variable_wait_sig() void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex)
#define system_condition_variable_signal_sig() void system_condition_variable_signal(System_Condition_Variable cv) #define system_condition_variable_signal_sig() void system_condition_variable_signal(System_Condition_Variable cv)
#define system_condition_variable_free_sig() void system_condition_variable_free(System_Condition_Variable cv) #define system_condition_variable_free_sig() void system_condition_variable_free(System_Condition_Variable cv)
#define system_memory_allocate_sig() void* system_memory_allocate(umem size, String_Const_u8 location) #define system_memory_allocate_sig() void* system_memory_allocate(u64 size, String_Const_u8 location)
#define system_memory_set_protection_sig() b32 system_memory_set_protection(void* ptr, umem size, u32 flags) #define system_memory_set_protection_sig() b32 system_memory_set_protection(void* ptr, u64 size, u32 flags)
#define system_memory_free_sig() void system_memory_free(void* ptr, umem size) #define system_memory_free_sig() void system_memory_free(void* ptr, u64 size)
#define system_memory_annotation_sig() Memory_Annotation system_memory_annotation(Arena* arena) #define system_memory_annotation_sig() Memory_Annotation system_memory_annotation(Arena* arena)
#define system_show_mouse_cursor_sig() void system_show_mouse_cursor(i32 show) #define system_show_mouse_cursor_sig() void system_show_mouse_cursor(i32 show)
#define system_set_fullscreen_sig() b32 system_set_fullscreen(b32 full_screen) #define system_set_fullscreen_sig() b32 system_set_fullscreen(b32 full_screen)
@ -84,9 +84,9 @@ typedef System_Condition_Variable system_condition_variable_make_type(void);
typedef void system_condition_variable_wait_type(System_Condition_Variable cv, System_Mutex mutex); typedef void system_condition_variable_wait_type(System_Condition_Variable cv, System_Mutex mutex);
typedef void system_condition_variable_signal_type(System_Condition_Variable cv); typedef void system_condition_variable_signal_type(System_Condition_Variable cv);
typedef void system_condition_variable_free_type(System_Condition_Variable cv); typedef void system_condition_variable_free_type(System_Condition_Variable cv);
typedef void* system_memory_allocate_type(umem size, String_Const_u8 location); typedef void* system_memory_allocate_type(u64 size, String_Const_u8 location);
typedef b32 system_memory_set_protection_type(void* ptr, umem size, u32 flags); typedef b32 system_memory_set_protection_type(void* ptr, u64 size, u32 flags);
typedef void system_memory_free_type(void* ptr, umem size); typedef void system_memory_free_type(void* ptr, u64 size);
typedef Memory_Annotation system_memory_annotation_type(Arena* arena); typedef Memory_Annotation system_memory_annotation_type(Arena* arena);
typedef void system_show_mouse_cursor_type(i32 show); typedef void system_show_mouse_cursor_type(i32 show);
typedef b32 system_set_fullscreen_type(b32 full_screen); typedef b32 system_set_fullscreen_type(b32 full_screen);
@ -181,9 +181,9 @@ internal System_Condition_Variable system_condition_variable_make(void);
internal void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex); internal void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex);
internal void system_condition_variable_signal(System_Condition_Variable cv); internal void system_condition_variable_signal(System_Condition_Variable cv);
internal void system_condition_variable_free(System_Condition_Variable cv); internal void system_condition_variable_free(System_Condition_Variable cv);
internal void* system_memory_allocate(umem size, String_Const_u8 location); internal void* system_memory_allocate(u64 size, String_Const_u8 location);
internal b32 system_memory_set_protection(void* ptr, umem size, u32 flags); internal b32 system_memory_set_protection(void* ptr, u64 size, u32 flags);
internal void system_memory_free(void* ptr, umem size); internal void system_memory_free(void* ptr, u64 size);
internal Memory_Annotation system_memory_annotation(Arena* arena); internal Memory_Annotation system_memory_annotation(Arena* arena);
internal void system_show_mouse_cursor(i32 show); internal void system_show_mouse_cursor(i32 show);
internal b32 system_set_fullscreen(b32 full_screen); internal b32 system_set_fullscreen(b32 full_screen);

View File

@ -181,19 +181,19 @@ api_param(arena, call, "System_Condition_Variable", "cv");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_allocate"), string_u8_litexpr("void*"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_allocate"), string_u8_litexpr("void*"), string_u8_litexpr(""));
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
api_param(arena, call, "String_Const_u8", "location"); api_param(arena, call, "String_Const_u8", "location");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_set_protection"), string_u8_litexpr("b32"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_set_protection"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "void*", "ptr"); api_param(arena, call, "void*", "ptr");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
api_param(arena, call, "u32", "flags"); api_param(arena, call, "u32", "flags");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_free"), string_u8_litexpr("void"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_free"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "void*", "ptr"); api_param(arena, call, "void*", "ptr");
api_param(arena, call, "umem", "size"); api_param(arena, call, "u64", "size");
} }
{ {
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_annotation"), string_u8_litexpr("Memory_Annotation"), string_u8_litexpr("")); API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_annotation"), string_u8_litexpr("Memory_Annotation"), string_u8_litexpr(""));

View File

@ -37,9 +37,9 @@ api(system) function System_Condition_Variable condition_variable_make(void);
api(system) function void condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex); api(system) function void condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex);
api(system) function void condition_variable_signal(System_Condition_Variable cv); api(system) function void condition_variable_signal(System_Condition_Variable cv);
api(system) function void condition_variable_free(System_Condition_Variable cv); api(system) function void condition_variable_free(System_Condition_Variable cv);
api(system) function void* memory_allocate(umem size, String_Const_u8 location); api(system) function void* memory_allocate(u64 size, String_Const_u8 location);
api(system) function b32 memory_set_protection(void* ptr, umem size, u32 flags); api(system) function b32 memory_set_protection(void* ptr, u64 size, u32 flags);
api(system) function void memory_free(void* ptr, umem size); api(system) function void memory_free(void* ptr, u64 size);
api(system) function Memory_Annotation memory_annotation(Arena* arena); api(system) function Memory_Annotation memory_annotation(Arena* arena);
api(system) function void show_mouse_cursor(i32 show); api(system) function void show_mouse_cursor(i32 show);
api(system) function b32 set_fullscreen(b32 full_screen); api(system) function b32 set_fullscreen(b32 full_screen);

View File

@ -2,9 +2,9 @@
#define FCODER_LEX_GEN_HAND_WRITTEN #define FCODER_LEX_GEN_HAND_WRITTEN
internal u64 internal u64
lexeme_hash(u64 seed, u8 *ptr, umem size){ lexeme_hash(u64 seed, u8 *ptr, u64 size){
u64 result = 0; u64 result = 0;
for (umem i = 0; i < size; i += 1, ptr += 1){ for (u64 i = 0; i < size; i += 1, ptr += 1){
result ^= ((*ptr) ^ result*59) + seed; result ^= ((*ptr) ^ result*59) + seed;
} }
return(result); return(result);
@ -13,7 +13,7 @@ lexeme_hash(u64 seed, u8 *ptr, umem size){
internal Lexeme_Table_Lookup internal Lexeme_Table_Lookup
lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array, lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array,
Lexeme_Table_Value *value_array, i32 slot_count, u64 seed, Lexeme_Table_Value *value_array, i32 slot_count, u64 seed,
u8 *ptr, umem size){ u8 *ptr, u64 size){
Lexeme_Table_Lookup result = {}; Lexeme_Table_Lookup result = {};
u64 hash = lexeme_hash(seed, ptr, size); u64 hash = lexeme_hash(seed, ptr, size);
u64 comparison_hash = hash | 1; u64 comparison_hash = hash | 1;

View File

@ -921,7 +921,7 @@ smi_input_set_construct(Arena *arena, String_Const_u8 characters){
Input_Set result = {}; Input_Set result = {};
result.count = (i32)characters.size; result.count = (i32)characters.size;
result.inputs = push_array_zero(arena, u16, result.count); result.inputs = push_array_zero(arena, u16, result.count);
for (umem i = 0; i < characters.size; i += 1){ for (u64 i = 0; i < characters.size; i += 1){
result.inputs[i] = (u16)characters.str[i]; result.inputs[i] = (u16)characters.str[i];
} }
return(result); return(result);
@ -1270,7 +1270,7 @@ internal b32
sm_op(char *lexeme){ sm_op(char *lexeme){
String_Const_u8 l = SCu8(lexeme); String_Const_u8 l = SCu8(lexeme);
List_String_Const_u8 name_list = {}; List_String_Const_u8 name_list = {};
for (umem i = 0; i < l.size; i += 1){ for (u64 i = 0; i < l.size; i += 1){
Table_Lookup lookup = table_lookup(&helper_ctx.char_to_name, l.str[i]); Table_Lookup lookup = table_lookup(&helper_ctx.char_to_name, l.str[i]);
// If this fails first check that all the characters in the lexeme are named! // If this fails first check that all the characters in the lexeme are named!
Assert(lookup.found_match); Assert(lookup.found_match);
@ -1681,7 +1681,7 @@ smo_remove_ops_without_prefix(Operator_Set *set, char *prefix){
} }
internal void internal void
smo_ops_string_skip(Operator_Set *set, umem size){ smo_ops_string_skip(Operator_Set *set, u64 size){
Operator_Set new_set = {}; Operator_Set new_set = {};
new_set.lexeme_to_ptr = make_table_Data_u64(helper_ctx.primary_ctx.allocator, set->count*2); new_set.lexeme_to_ptr = make_table_Data_u64(helper_ctx.primary_ctx.allocator, set->count*2);
@ -1756,7 +1756,7 @@ smo_op_set_lexer_root(Operator_Set *set, State *machine_root, String_Const_u8 fa
node != 0; node != 0;
node = node->next){ node = node->next){
String_Const_u8 lexeme = node->op; String_Const_u8 lexeme = node->op;
for (umem i = 1; i < lexeme.size; i += 1){ for (u64 i = 1; i < lexeme.size; i += 1){
String_Const_u8 prefix = string_prefix(lexeme, i); String_Const_u8 prefix = string_prefix(lexeme, i);
Table_Lookup lookup = table_lookup(&string_to_state, make_data(prefix.str, prefix.size)); Table_Lookup lookup = table_lookup(&string_to_state, make_data(prefix.str, prefix.size));
if (!lookup.found_match){ if (!lookup.found_match){
@ -1833,7 +1833,7 @@ smo_op_set_lexer_root(Operator_Set *set, State *machine_root, String_Const_u8 fa
node != 0; node != 0;
node = node->next){ node = node->next){
String_Const_u8 lexeme = node->op; String_Const_u8 lexeme = node->op;
for (umem i = 1; i < lexeme.size; i += 1){ for (u64 i = 1; i < lexeme.size; i += 1){
String_Const_u8 prefix = string_prefix(lexeme, i); String_Const_u8 prefix = string_prefix(lexeme, i);
Table_Lookup lookup = table_lookup(&string_to_state, make_data(prefix.str, prefix.size)); Table_Lookup lookup = table_lookup(&string_to_state, make_data(prefix.str, prefix.size));
Assert(lookup.found_match); Assert(lookup.found_match);
@ -1924,9 +1924,9 @@ smh_typical_tokens(void){
internal String_Const_u8 internal String_Const_u8
string_char_subtract(String_Const_u8 a, String_Const_u8 b){ string_char_subtract(String_Const_u8 a, String_Const_u8 b){
for (umem i = 0; i < b.size; i += 1){ for (u64 i = 0; i < b.size; i += 1){
u8 c = b.str[i]; u8 c = b.str[i];
for (umem j = 0; j < a.size;){ for (u64 j = 0; j < a.size;){
if (a.str[j] == c){ if (a.str[j] == c){
a.str[j] = a.str[a.size - 1]; a.str[j] = a.str[a.size - 1];
a.size -= 1; a.size -= 1;
@ -3201,7 +3201,7 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
fprintf(out, "u8 %.*s_key_array_%d[] = {", fprintf(out, "u8 %.*s_key_array_%d[] = {",
string_expand(keywords.pretty_name), i); string_expand(keywords.pretty_name), i);
String_Const_u8 lexeme = key_layout.slots[i]->lexeme; String_Const_u8 lexeme = key_layout.slots[i]->lexeme;
for (umem j = 0; j < lexeme.size; j += 1){ for (u64 j = 0; j < lexeme.size; j += 1){
fprintf(out, "0x%02x,", lexeme.str[j]); fprintf(out, "0x%02x,", lexeme.str[j]);
} }
fprintf(out, "};\n"); fprintf(out, "};\n");
@ -3744,8 +3744,8 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M
Transition *failure_trans = trans->next; Transition *failure_trans = trans->next;
Assert(failure_trans->condition.kind == TransitionCaseKind_DelimMatchFail); Assert(failure_trans->condition.kind == TransitionCaseKind_DelimMatchFail);
fprintf(out, "umem delim_length = state.delim_one_past_last - state.delim_first;\n"); fprintf(out, "u64 delim_length = state.delim_one_past_last - state.delim_first;\n");
fprintf(out, "umem parse_length = 0;\n"); fprintf(out, "u64 parse_length = 0;\n");
fprintf(out, "for (;;){\n"); fprintf(out, "for (;;){\n");
{ {
fprintf(out, "if (parse_length == delim_length){\n"); fprintf(out, "if (parse_length == delim_length){\n");

View File

@ -22,9 +22,9 @@ make_doc_function(Arena *arena, Doc_Cluster *cluster, API_Call *call){
string_expand(call->return_type), string_expand(call->return_type),
string_expand(call->name)); string_expand(call->name));
umem indent_size = call->name.size + 1; u64 indent_size = call->name.size + 1;
u8 *buffer = push_array(arena, u8, indent_size); u8 *buffer = push_array(arena, u8, indent_size);
for (umem i = 0; i < indent_size; i += 1){ for (u64 i = 0; i < indent_size; i += 1){
buffer[i] = ' '; buffer[i] = ' ';
} }
String_Const_u8 indent = SCu8(buffer, indent_size); String_Const_u8 indent = SCu8(buffer, indent_size);

View File

@ -224,7 +224,7 @@ typedef void GL_Debug_Function(GLenum src,
void *user_data); void *user_data);
typedef GL_Debug_Function *GLDEBUGPROC; typedef GL_Debug_Function *GLDEBUGPROC;
#define GL_FUNC(N,R,P) typedef R (N##_Function)P; N##_Function *N = 0; #define GL_FUNC(N,R,P) typedef R (CALL_CONVENTION N##_Function)P; N##_Function *N = 0;
#include "4ed_opengl_funcs.h" #include "4ed_opengl_funcs.h"
#endif #endif

View File

@ -55,7 +55,7 @@ gl__fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 di
return(result); return(result);
} }
internal void CALL_CONVENTION internal void
gl__error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, char *message, void *userParam){ gl__error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, char *message, void *userParam){
switch (id){ switch (id){
case 131218: case 131218:
@ -189,7 +189,7 @@ gl__make_program(char *header, char *vertex, char *fragment){
glGetShaderInfoLog(fragment_shader, sizeof(fragment_errors), &ignore, fragment_errors); glGetShaderInfoLog(fragment_shader, sizeof(fragment_errors), &ignore, fragment_errors);
glGetProgramInfoLog(program, sizeof(program_errors), &ignore, program_errors); glGetProgramInfoLog(program, sizeof(program_errors), &ignore, program_errors);
#if SHIP_MODE #if SHIP_MODE
os_popup_window(string_u8_litexpr("Error"), string_u8_litexpr("Shader compilation failed.")); os_popup_error("Error", "Shader compilation failed.");
#endif #endif
InvalidPath; InvalidPath;
} }

View File

@ -512,13 +512,13 @@ osx_get_loadable_fonts(Partition *part, Font_Setup_List *list){
#include "4ed_shared_init_logic.cpp" #include "4ed_shared_init_logic.cpp"
external void* external void*
osx_allocate(umem size){ osx_allocate(u64 size){
void *result = system_memory_allocate(size); void *result = system_memory_allocate(size);
return(result); return(result);
} }
external void external void
osx_free(void *ptr, umem size){ osx_free(void *ptr, u64 size){
system_memory_free(ptr, size); system_memory_free(ptr, size);
} }

View File

@ -49,7 +49,7 @@ typedef struct OSX_Objective_C_Vars{
b32 just_posted_to_clipboard; b32 just_posted_to_clipboard;
char *clipboard_space; char *clipboard_space;
umem clipboard_space_max; u64 clipboard_space_max;
b32 full_screen; b32 full_screen;
b32 do_toggle; b32 do_toggle;
@ -73,10 +73,10 @@ typedef struct OSX_Font_Match{
extern OSX_Objective_C_Vars osx_objc; extern OSX_Objective_C_Vars osx_objc;
external void* external void*
osx_allocate(umem size); osx_allocate(u64 size);
external void external void
osx_free(void *ptr, umem size); osx_free(void *ptr, u64 size);
external void external void
osx_resize(int width, int height); osx_resize(int width, int height);

View File

@ -48,7 +48,7 @@ Sys_File_Can_Be_Made_Sig(system_file_can_be_made){
// //
internal void* internal void*
system_memory_allocate_extended(void *base, umem size){ system_memory_allocate_extended(void *base, u64 size){
// NOTE(allen): This must return the exact base of the vpage. // NOTE(allen): This must return the exact base of the vpage.
// We will count on the user to keep track of size themselves. // We will count on the user to keep track of size themselves.
void *result = mmap(base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); void *result = mmap(base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

View File

@ -595,6 +595,12 @@ system_cli_end_update_sig(){
return(close_me); return(close_me);
} }
function void
os_popup_error(char *title, char *message){
MessageBoxA(0, title, message, MB_OK);
ExitProcess(1);
}
#include "4ed_font_provider_freetype.h" #include "4ed_font_provider_freetype.h"
#include "4ed_font_provider_freetype.cpp" #include "4ed_font_provider_freetype.cpp"
@ -815,7 +821,7 @@ system_sleep_sig(){
//////////////////////////////// ////////////////////////////////
internal DWORD internal DWORD CALL_CONVENTION
win32_thread_wrapper(void *ptr){ win32_thread_wrapper(void *ptr){
Win32_Object *object = (Win32_Object*)ptr; Win32_Object *object = (Win32_Object*)ptr;
Thread_Function *proc = object->thread.proc; Thread_Function *proc = object->thread.proc;
@ -947,7 +953,7 @@ system_condition_variable_free_sig(){
//////////////////////////////// ////////////////////////////////
internal LRESULT internal LRESULT CALL_CONVENTION
win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
LRESULT result = 0; LRESULT result = 0;
Scratch_Block scratch(win32vars.tctx); Scratch_Block scratch(win32vars.tctx);
@ -1320,7 +1326,7 @@ win32_gl_create_window(HWND *wnd_out, HGLRC *context_out, DWORD style, RECT rect
{ {
String_Const_u8 s = string_skip_whitespace(extensions); String_Const_u8 s = string_skip_whitespace(extensions);
for (;s.size > 0;){ for (;s.size > 0;){
umem end = string_find_first_whitespace(s); u64 end = string_find_first_whitespace(s);
String_Const_u8 m = string_prefix(s, end); String_Const_u8 m = string_prefix(s, end);
if (string_match(m, string_u8_litexpr("WGL_EXT_framebuffer_sRGB")) || if (string_match(m, string_u8_litexpr("WGL_EXT_framebuffer_sRGB")) ||
string_match(m, string_u8_litexpr("WGL_ARB_framebuffer_sRGB"))){ string_match(m, string_u8_litexpr("WGL_ARB_framebuffer_sRGB"))){

View File

@ -28,7 +28,7 @@ struct Memory_Annotation_Tracker_Node{
Memory_Annotation_Tracker_Node *next; Memory_Annotation_Tracker_Node *next;
Memory_Annotation_Tracker_Node *prev; Memory_Annotation_Tracker_Node *prev;
String_Const_u8 location; String_Const_u8 location;
umem size; u64 size;
}; };
struct Memory_Annotation_Tracker{ struct Memory_Annotation_Tracker{
@ -41,9 +41,9 @@ global Memory_Annotation_Tracker memory_tracker = {};
global CRITICAL_SECTION memory_tracker_mutex; global CRITICAL_SECTION memory_tracker_mutex;
internal void* internal void*
win32_memory_allocate_extended(void *base, umem size, String_Const_u8 location){ win32_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){
umem adjusted_size = size + 64; u64 adjusted_size = size + 64;
void *result = VirtualAlloc(base, adjusted_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); void *result = VirtualAlloc(base, (SIZE_T)adjusted_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)result; Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)result;
EnterCriticalSection(&memory_tracker_mutex); EnterCriticalSection(&memory_tracker_mutex);
zdll_push_back(memory_tracker.first, memory_tracker.last, node); zdll_push_back(memory_tracker.first, memory_tracker.last, node);
@ -89,7 +89,7 @@ system_memory_set_protection_sig(){
node -= 1; node -= 1;
DWORD old_protect = 0; DWORD old_protect = 0;
b32 result = VirtualProtect(node, size, protect, &old_protect); b32 result = VirtualProtect(node, (SIZE_T)size, protect, &old_protect);
return(result); return(result);
} }
@ -167,13 +167,13 @@ win32_remove_unc_prefix_characters(String_Const_u8 path){
// ? // ?
#endif #endif
path.size -= 7; path.size -= 7;
memmove(path.str, path.str + 7, path.size); block_copy(path.str, path.str + 7, path.size);
path.str[0] = '\\'; path.str[0] = '\\';
} }
else if (string_match(string_prefix(path, 4), string_u8_litexpr("\\\\?\\"))){ else if (string_match(string_prefix(path, 4), string_u8_litexpr("\\\\?\\"))){
// TODO(allen): Same questions essentially. // TODO(allen): Same questions essentially.
path.size -= 4; path.size -= 4;
memmove(path.str, path.str + 4, path.size); block_copy(path.str, path.str + 4, path.size);
} }
return(path); return(path);
} }

View File

@ -24,7 +24,9 @@ load_paths = {
}; };
build_x64_win32 = "echo build: x64 & bin\\build.bat"; build_x64_win32 = "echo build: x64 & bin\\build.bat";
build_x86_win32 = "echo build: x86 & bin\\build.bat /DDEV_BUILD_X86";
build_x64_unix = "echo build: x64 & bin/build.sh"; build_x64_unix = "echo build: x64 & bin/build.sh";
build_x86_unix = "echo build: x86 & bin/build.sh -DDEV_BUILD_X86";
command_list = { command_list = {
{ .name = "build x64", { .name = "build x64",
@ -33,6 +35,12 @@ command_list = {
{build_x64_unix , .os = "linux"}, {build_x64_unix , .os = "linux"},
{build_x64_unix , .os = "mac" }, }, }, {build_x64_unix , .os = "mac" }, }, },
{ .name = "build x86",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { {build_x86_win32, .os = "win" },
{build_x86_unix , .os = "linux"},
{build_x86_unix , .os = "mac" }, }, },
{ .name = "package", { .name = "package",
.out = "*compilation*", .footer_panel = false, .save_dirty_files = true, .out = "*compilation*", .footer_panel = false, .save_dirty_files = true,
.cmd = { {"echo package & bin\\package.bat", .os = "win" }, .cmd = { {"echo package & bin\\package.bat", .os = "win" },

View File

@ -45,6 +45,7 @@ char html_header[] = R"HTMLFOO(
<html lang="en-US"> <html lang="en-US">
<head> <head>
<meta charset="UTF-8">
<link rel='shortcut icon' type='image/x-icon' href='https://4coder.net/4coder_icon.ico' /> <link rel='shortcut icon' type='image/x-icon' href='https://4coder.net/4coder_icon.ico' />
<link href="https://fonts.googleapis.com/css?family=Inconsolata:700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Inconsolata:700&display=swap" rel="stylesheet">
<script src="search.js"></script> <script src="search.js"></script>
@ -416,7 +417,7 @@ int main(){
Thread_Context *tctx = &tctx_; Thread_Context *tctx = &tctx_;
String_Const_u8 self = string_u8_litexpr(__FILE__); String_Const_u8 self = string_u8_litexpr(__FILE__);
umem code_pos = string_find_first(self, string_u8_litexpr("code")); u64 code_pos = string_find_first(self, string_u8_litexpr("code"));
String_Const_u8 root = string_prefix(self, code_pos + 5); String_Const_u8 root = string_prefix(self, code_pos + 5);
String_Const_u8 outside_root = string_prefix(self, code_pos); String_Const_u8 outside_root = string_prefix(self, code_pos);
String_Const_u8 build_root = push_u8_stringf(&arena, "%.*sbuild/", String_Const_u8 build_root = push_u8_stringf(&arena, "%.*sbuild/",

View File

@ -1,6 +1,7 @@
<html lang="en-US"> <html lang="en-US">
<head> <head>
<meta charset="UTF-8">
<link rel='shortcut icon' type='image/x-icon' href='4coder_icon.ico' /> <link rel='shortcut icon' type='image/x-icon' href='4coder_icon.ico' />
<link href="https://fonts.googleapis.com/css?family=Inconsolata:700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Inconsolata:700&display=swap" rel="stylesheet">
<title>4coder</title> <title>4coder</title>