remove rvalue {}, update file load stuff in linux
This commit is contained in:
parent
db058ea6d7
commit
d8d6834d26
|
@ -39,6 +39,11 @@ typedef struct Key_Event_Data{
|
||||||
|
|
||||||
char modifiers[MDFR_INDEX_COUNT];
|
char modifiers[MDFR_INDEX_COUNT];
|
||||||
} Key_Event_Data;
|
} Key_Event_Data;
|
||||||
|
inline Key_Event_Data
|
||||||
|
key_event_data_zero(){
|
||||||
|
Key_Event_Data data={0};
|
||||||
|
return(data);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct Mouse_State{
|
typedef struct Mouse_State{
|
||||||
char l, r;
|
char l, r;
|
||||||
|
@ -279,6 +284,11 @@ struct Buffer_Summary{
|
||||||
int is_lexed;
|
int is_lexed;
|
||||||
int map_id;
|
int map_id;
|
||||||
};
|
};
|
||||||
|
inline Buffer_Summary
|
||||||
|
buffer_summary_zero(){
|
||||||
|
Buffer_Summary summary={0};
|
||||||
|
return(summary);
|
||||||
|
}
|
||||||
|
|
||||||
struct View_Summary{
|
struct View_Summary{
|
||||||
int exists;
|
int exists;
|
||||||
|
@ -293,6 +303,11 @@ struct View_Summary{
|
||||||
int line_height;
|
int line_height;
|
||||||
int unwrapped_lines;
|
int unwrapped_lines;
|
||||||
};
|
};
|
||||||
|
inline View_Summary
|
||||||
|
view_summary_zero(){
|
||||||
|
View_Summary summary={0};
|
||||||
|
return(summary);
|
||||||
|
}
|
||||||
|
|
||||||
#define UserInputKey 0
|
#define UserInputKey 0
|
||||||
#define UserInputMouse 1
|
#define UserInputMouse 1
|
||||||
|
|
|
@ -230,7 +230,7 @@ struct Buffer_Rect{
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef Swap
|
#ifndef Swap
|
||||||
#define Swap(a,b) do{ auto t = a; a = b; b = t; } while(0)
|
#define Swap(T,a,b) do{ T t = a; a = b; b = t; } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline Buffer_Rect
|
inline Buffer_Rect
|
||||||
|
@ -244,10 +244,10 @@ get_rect(View_Summary *view){
|
||||||
rect.line1 = view->cursor.line;
|
rect.line1 = view->cursor.line;
|
||||||
|
|
||||||
if (rect.line0 > rect.line1){
|
if (rect.line0 > rect.line1){
|
||||||
Swap(rect.line0, rect.line1);
|
Swap(int, rect.line0, rect.line1);
|
||||||
}
|
}
|
||||||
if (rect.char0 > rect.char1){
|
if (rect.char0 > rect.char1){
|
||||||
Swap(rect.char0, rect.char1);
|
Swap(int, rect.char0, rect.char1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(rect);
|
return(rect);
|
||||||
|
|
|
@ -64,6 +64,7 @@ inline bool char_is_alpha_numeric(char c) { return (c >= 'a' && c <= 'z' || c >=
|
||||||
inline bool char_is_hex(char c) { return c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f'; }
|
inline bool char_is_hex(char c) { return c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f'; }
|
||||||
inline bool char_is_basic(char c) { return c >= ' ' && c <= '~'; }
|
inline bool char_is_basic(char c) { return c >= ' ' && c <= '~'; }
|
||||||
|
|
||||||
|
inline String string_zero();
|
||||||
inline String make_string(void *s, int size, int mem_size);
|
inline String make_string(void *s, int size, int mem_size);
|
||||||
inline String make_string(void *s, int size);
|
inline String make_string(void *s, int size);
|
||||||
|
|
||||||
|
@ -194,6 +195,11 @@ FCPP_LINK bool remove_last_folder(String *str);
|
||||||
FCPP_LINK void replace_char(String str, char replace, char with);
|
FCPP_LINK void replace_char(String str, char replace, char with);
|
||||||
FCPP_LINK void replace_char(char *str, char replace, char with);
|
FCPP_LINK void replace_char(char *str, char replace, char with);
|
||||||
|
|
||||||
|
inline String string_zero(){
|
||||||
|
String str={0};
|
||||||
|
return(str);
|
||||||
|
}
|
||||||
|
|
||||||
inline String make_string(void *str, int size, int mem_size){
|
inline String make_string(void *str, int size, int mem_size){
|
||||||
String result;
|
String result;
|
||||||
result.str = (char*)str;
|
result.str = (char*)str;
|
||||||
|
|
|
@ -139,11 +139,14 @@ FCPP_LINK Cpp_Token_Merge cpp_attempt_token_merge(Cpp_Token prev, Cpp_Token next
|
||||||
FCPP_LINK bool cpp_push_token_no_merge(Cpp_Token_Stack *stack, Cpp_Token token);
|
FCPP_LINK bool cpp_push_token_no_merge(Cpp_Token_Stack *stack, Cpp_Token token);
|
||||||
FCPP_LINK bool cpp_push_token_nonalloc(Cpp_Token_Stack *stack, Cpp_Token token);
|
FCPP_LINK bool cpp_push_token_nonalloc(Cpp_Token_Stack *stack, Cpp_Token token);
|
||||||
|
|
||||||
|
inline Cpp_Lex_Data cpp_lex_data_zero() { Cpp_Lex_Data data = {(Cpp_Preprocessor_State)0}; return(data); }
|
||||||
|
inline Cpp_Token_Stack cpp_token_stack_zero() { Cpp_Token_Stack stack={0}; return(stack); }
|
||||||
|
|
||||||
FCPP_LINK Cpp_Read_Result cpp_lex_step(Cpp_File file, Cpp_Lex_Data *lex);
|
FCPP_LINK Cpp_Read_Result cpp_lex_step(Cpp_File file, Cpp_Lex_Data *lex);
|
||||||
|
|
||||||
FCPP_LINK int cpp_lex_file_token_count(Cpp_File file);
|
FCPP_LINK int cpp_lex_file_token_count(Cpp_File file);
|
||||||
FCPP_LINK Cpp_Lex_Data cpp_lex_file_nonalloc(Cpp_File file, Cpp_Token_Stack *stack, Cpp_Lex_Data data);
|
FCPP_LINK Cpp_Lex_Data cpp_lex_file_nonalloc(Cpp_File file, Cpp_Token_Stack *stack, Cpp_Lex_Data data);
|
||||||
inline Cpp_Lex_Data cpp_lex_file_nonalloc(Cpp_File file, Cpp_Token_Stack *stack) { return cpp_lex_file_nonalloc(file, stack, {}); }
|
inline Cpp_Lex_Data cpp_lex_file_nonalloc(Cpp_File file, Cpp_Token_Stack *stack) { return cpp_lex_file_nonalloc(file, stack, cpp_lex_data_zero()); }
|
||||||
|
|
||||||
FCPP_LINK Cpp_Get_Token_Result cpp_get_token(Cpp_Token_Stack *stack, int pos);
|
FCPP_LINK Cpp_Get_Token_Result cpp_get_token(Cpp_Token_Stack *stack, int pos);
|
||||||
|
|
||||||
|
|
38
4ed.cpp
38
4ed.cpp
|
@ -1820,7 +1820,7 @@ globalvar Command_Function command_table[cmdid_count];
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
fill_buffer_summary(Buffer_Summary *buffer, Editing_File *file, Working_Set *working_set){
|
fill_buffer_summary(Buffer_Summary *buffer, Editing_File *file, Working_Set *working_set){
|
||||||
*buffer = {};
|
*buffer = buffer_summary_zero();
|
||||||
if (!file->state.is_dummy){
|
if (!file->state.is_dummy){
|
||||||
buffer->exists = 1;
|
buffer->exists = 1;
|
||||||
buffer->ready = file_is_ready(file);
|
buffer->ready = file_is_ready(file);
|
||||||
|
@ -1843,7 +1843,7 @@ internal void
|
||||||
fill_view_summary(View_Summary *view, View *vptr, Live_Views *live_set, Working_Set *working_set){
|
fill_view_summary(View_Summary *view, View *vptr, Live_Views *live_set, Working_Set *working_set){
|
||||||
i32 lock_level;
|
i32 lock_level;
|
||||||
int buffer_id;
|
int buffer_id;
|
||||||
*view = {};
|
*view = view_summary_zero();
|
||||||
|
|
||||||
if (vptr->in_use){
|
if (vptr->in_use){
|
||||||
view->exists = 1;
|
view->exists = 1;
|
||||||
|
@ -1969,7 +1969,7 @@ extern "C"{
|
||||||
fill_buffer_summary(buffer, file, working_set);
|
fill_buffer_summary(buffer, file, working_set);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
*buffer = {};
|
*buffer = buffer_summary_zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2259,11 +2259,11 @@ extern "C"{
|
||||||
fill_view_summary(view, panel->view, &cmd->vars->live_set, &cmd->models->working_set);
|
fill_view_summary(view, panel->view, &cmd->vars->live_set, &cmd->models->working_set);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
*view = {};
|
*view = view_summary_zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
*view = {};
|
*view = view_summary_zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2529,7 +2529,7 @@ command_caller(Coroutine *coroutine){
|
||||||
|
|
||||||
// TODO(allen): this isn't really super awesome, could have issues if
|
// TODO(allen): this isn't really super awesome, could have issues if
|
||||||
// the file view get's change out under us.
|
// the file view get's change out under us.
|
||||||
view->next_mode = {};
|
view->next_mode = view_mode_zero();
|
||||||
cmd_in->bind.function(cmd->system, cmd, cmd_in->bind);
|
cmd_in->bind.function(cmd->system, cmd, cmd_in->bind);
|
||||||
view->mode = view->next_mode;
|
view->mode = view->next_mode;
|
||||||
}
|
}
|
||||||
|
@ -3032,12 +3032,18 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline App_Vars
|
||||||
|
app_vars_zero(){
|
||||||
|
App_Vars vars={0};
|
||||||
|
return(vars);
|
||||||
|
}
|
||||||
|
|
||||||
internal App_Vars*
|
internal App_Vars*
|
||||||
app_setup_memory(Application_Memory *memory){
|
app_setup_memory(Application_Memory *memory){
|
||||||
Partition _partition = partition_open(memory->vars_memory, memory->vars_memory_size);
|
Partition _partition = partition_open(memory->vars_memory, memory->vars_memory_size);
|
||||||
App_Vars *vars = push_struct(&_partition, App_Vars);
|
App_Vars *vars = push_struct(&_partition, App_Vars);
|
||||||
Assert(vars);
|
Assert(vars);
|
||||||
*vars = {};
|
*vars = app_vars_zero();
|
||||||
vars->models.mem.part = _partition;
|
vars->models.mem.part = _partition;
|
||||||
|
|
||||||
general_memory_open(&vars->models.mem.general, memory->target_memory, memory->target_memory_size);
|
general_memory_open(&vars->models.mem.general, memory->target_memory, memory->target_memory_size);
|
||||||
|
@ -3061,6 +3067,12 @@ execute_special_tool(void *memory, i32 size, Command_Line_Parameters clparams){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline App_Settings
|
||||||
|
app_settings_zero(){
|
||||||
|
App_Settings settings={0};
|
||||||
|
return(settings);
|
||||||
|
}
|
||||||
|
|
||||||
App_Read_Command_Line_Sig(app_read_command_line){
|
App_Read_Command_Line_Sig(app_read_command_line){
|
||||||
App_Vars *vars;
|
App_Vars *vars;
|
||||||
App_Settings *settings;
|
App_Settings *settings;
|
||||||
|
@ -3073,7 +3085,7 @@ App_Read_Command_Line_Sig(app_read_command_line){
|
||||||
vars = app_setup_memory(memory);
|
vars = app_setup_memory(memory);
|
||||||
|
|
||||||
settings = &vars->models.settings;
|
settings = &vars->models.settings;
|
||||||
*settings = {};
|
*settings = app_settings_zero();
|
||||||
settings->font_size = 16;
|
settings->font_size = 16;
|
||||||
|
|
||||||
if (clparams.argc > 1){
|
if (clparams.argc > 1){
|
||||||
|
@ -3637,12 +3649,12 @@ App_Step_Sig(app_step){
|
||||||
|
|
||||||
cmd->screen_width = target->width;
|
cmd->screen_width = target->width;
|
||||||
cmd->screen_height = target->height;
|
cmd->screen_height = target->height;
|
||||||
|
|
||||||
cmd->key = {};
|
cmd->key = key_event_data_zero();
|
||||||
|
|
||||||
Temp_Memory param_stack_temp = begin_temp_memory(&models->mem.part);
|
Temp_Memory param_stack_temp = begin_temp_memory(&models->mem.part);
|
||||||
cmd->part = partition_sub_part(&models->mem.part, 16 << 10);
|
cmd->part = partition_sub_part(&models->mem.part, 16 << 10);
|
||||||
|
|
||||||
if (first_step){
|
if (first_step){
|
||||||
General_Memory *general = &models->mem.general;
|
General_Memory *general = &models->mem.general;
|
||||||
Editing_File *file = working_set_alloc_always(&models->working_set, general);
|
Editing_File *file = working_set_alloc_always(&models->working_set, general);
|
||||||
|
@ -4456,7 +4468,7 @@ App_Step_Sig(app_step){
|
||||||
general_memory_free(general, string.str);
|
general_memory_free(general, string.str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Swap(models->delay1, models->delay2);
|
Swap(Delay, models->delay1, models->delay2);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_temp_memory(param_stack_temp);
|
end_temp_memory(param_stack_temp);
|
||||||
|
|
5
4ed.h
5
4ed.h
|
@ -30,6 +30,11 @@ struct Key_Input_Data{
|
||||||
i32 press_count;
|
i32 press_count;
|
||||||
i32 hold_count;
|
i32 hold_count;
|
||||||
};
|
};
|
||||||
|
inline Key_Input_Data
|
||||||
|
key_input_data_zero(){
|
||||||
|
Key_Input_Data data={0};
|
||||||
|
return(data);
|
||||||
|
}
|
||||||
|
|
||||||
struct Key_Summary{
|
struct Key_Summary{
|
||||||
i32 count;
|
i32 count;
|
||||||
|
|
|
@ -110,13 +110,19 @@ map_drop(Command_Map *map, u16 event_code, u8 modifiers){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Command_Binding
|
||||||
|
command_binding_zero(){
|
||||||
|
Command_Binding binding = {0};
|
||||||
|
return(binding);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
map_init(Command_Map *commands, Partition *part, i32 max, Command_Map *parent){
|
map_init(Command_Map *commands, Partition *part, i32 max, Command_Map *parent){
|
||||||
max = ((max < 6)?(6):(max));
|
max = ((max < 6)?(6):(max));
|
||||||
commands->parent = parent;
|
commands->parent = parent;
|
||||||
commands->commands = push_array(part, Command_Binding, max);
|
commands->commands = push_array(part, Command_Binding, max);
|
||||||
memset(commands->commands, 0, max*sizeof(*commands->commands));
|
memset(commands->commands, 0, max*sizeof(*commands->commands));
|
||||||
commands->vanilla_keyboard_default = {};
|
commands->vanilla_keyboard_default = command_binding_zero();
|
||||||
commands->max = max;
|
commands->max = max;
|
||||||
commands->count = 0;
|
commands->count = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,14 @@ str_alloc_copy(General_Memory *general, String str){
|
||||||
result.str = (char*)general_memory_allocate(general, result.memory_size, 0);
|
result.str = (char*)general_memory_allocate(general, result.memory_size, 0);
|
||||||
memcpy(result.str, str.str, str.size);
|
memcpy(result.str, str.str, str.size);
|
||||||
result.str[result.size] = 0;
|
result.str[result.size] = 0;
|
||||||
return(result);}
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Delayed_Action
|
||||||
|
delayed_action_zero(){
|
||||||
|
Delayed_Action action={(Action_Type)0};
|
||||||
|
return(action);
|
||||||
|
}
|
||||||
|
|
||||||
inline Delayed_Action*
|
inline Delayed_Action*
|
||||||
delayed_action_(Delay *delay, Action_Type type){
|
delayed_action_(Delay *delay, Action_Type type){
|
||||||
|
@ -45,7 +52,8 @@ delayed_action_(Delay *delay, Action_Type type){
|
||||||
delay->acts = (Delayed_Action*)general_memory_reallocate(delay->general, delay->acts, delay->count*sizeof(Delayed_Action), delay->max*sizeof(Delayed_Action), 0);
|
delay->acts = (Delayed_Action*)general_memory_reallocate(delay->general, delay->acts, delay->count*sizeof(Delayed_Action), delay->max*sizeof(Delayed_Action), 0);
|
||||||
}
|
}
|
||||||
result = delay->acts + delay->count++;
|
result = delay->acts + delay->count++;
|
||||||
*result = {};
|
|
||||||
|
*result = delayed_action_zero();
|
||||||
result->type = type;
|
result->type = type;
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
28
4ed_file.cpp
28
4ed_file.cpp
|
@ -263,6 +263,12 @@ working_set_extend_memory(Working_Set *working_set, Editing_File *new_space, i16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Editing_File
|
||||||
|
editing_file_zero(){
|
||||||
|
Editing_File file = {0};
|
||||||
|
return(file);
|
||||||
|
}
|
||||||
|
|
||||||
internal Editing_File*
|
internal Editing_File*
|
||||||
working_set_alloc(Working_Set *working_set){
|
working_set_alloc(Working_Set *working_set){
|
||||||
Editing_File *result = 0;
|
Editing_File *result = 0;
|
||||||
|
@ -278,7 +284,7 @@ working_set_alloc(Working_Set *working_set){
|
||||||
// NOTE(allen): What I really want to do here is clear everything
|
// NOTE(allen): What I really want to do here is clear everything
|
||||||
// except id, but writing that out will be a pain to maintain.
|
// except id, but writing that out will be a pain to maintain.
|
||||||
id = result->id;
|
id = result->id;
|
||||||
*result = {};
|
*result = editing_file_zero();
|
||||||
result->id = id;
|
result->id = id;
|
||||||
dll_insert(&working_set->used_sentinel, node);
|
dll_insert(&working_set->used_sentinel, node);
|
||||||
++working_set->file_count;
|
++working_set->file_count;
|
||||||
|
@ -504,11 +510,11 @@ hot_directory_quick_partition(File_Info *infos, i32 start, i32 pivot){
|
||||||
comp = p->folder - a->folder;
|
comp = p->folder - a->folder;
|
||||||
if (comp == 0) comp = compare(a->filename, p->filename);
|
if (comp == 0) comp = compare(a->filename, p->filename);
|
||||||
if (comp < 0){
|
if (comp < 0){
|
||||||
Swap(*a, infos[start]);
|
Swap(File_Info, *a, infos[start]);
|
||||||
++start;
|
++start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Swap(*p, infos[start]);
|
Swap(File_Info, *p, infos[start]);
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,10 +645,22 @@ file_is_ready(Editing_File *file){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Editing_File_State
|
||||||
|
editing_file_state_zero(){
|
||||||
|
Editing_File_State state={0};
|
||||||
|
return(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Editing_File_Settings
|
||||||
|
editing_file_settings_zero(){
|
||||||
|
Editing_File_Settings settings={0};
|
||||||
|
return(settings);
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
file_set_to_loading(Editing_File *file){
|
file_set_to_loading(Editing_File *file){
|
||||||
file->state = {};
|
file->state = editing_file_state_zero();
|
||||||
file->settings = {};
|
file->settings = editing_file_settings_zero();
|
||||||
file->state.is_loading = 1;
|
file->state.is_loading = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,11 @@ enum Interactive_Interaction{
|
||||||
struct View_Mode{
|
struct View_Mode{
|
||||||
i32 rewrite;
|
i32 rewrite;
|
||||||
};
|
};
|
||||||
|
inline View_Mode
|
||||||
|
view_mode_zero(){
|
||||||
|
View_Mode mode={0};
|
||||||
|
return(mode);
|
||||||
|
}
|
||||||
|
|
||||||
enum View_Widget_Type{
|
enum View_Widget_Type{
|
||||||
FWIDG_NONE,
|
FWIDG_NONE,
|
||||||
|
@ -79,6 +84,11 @@ struct File_Viewing_Data{
|
||||||
i32 line_count, line_max;
|
i32 line_count, line_max;
|
||||||
f32 *line_wrap_y;
|
f32 *line_wrap_y;
|
||||||
};
|
};
|
||||||
|
inline File_Viewing_Data
|
||||||
|
file_viewing_data_zero(){
|
||||||
|
File_Viewing_Data data={0};
|
||||||
|
return(data);
|
||||||
|
}
|
||||||
|
|
||||||
struct View{
|
struct View{
|
||||||
View *next, *prev;
|
View *next, *prev;
|
||||||
|
@ -515,7 +525,7 @@ file_create_from_string(System_Functions *system, Models *models,
|
||||||
Buffer_Init_Type init;
|
Buffer_Init_Type init;
|
||||||
i32 page_size, scratch_size, init_success;
|
i32 page_size, scratch_size, init_success;
|
||||||
|
|
||||||
file->state = {};
|
file->state = editing_file_state_zero();
|
||||||
|
|
||||||
init = buffer_begin_init(&file->state.buffer, val.str, val.size);
|
init = buffer_begin_init(&file->state.buffer, val.str, val.size);
|
||||||
for (; buffer_init_need_more(&init); ){
|
for (; buffer_init_need_more(&init); ){
|
||||||
|
@ -581,16 +591,14 @@ file_create_from_string(System_Functions *system, Models *models,
|
||||||
internal b32
|
internal b32
|
||||||
file_create_empty(System_Functions *system,
|
file_create_empty(System_Functions *system,
|
||||||
Models *models, Editing_File *file, char *filename){
|
Models *models, Editing_File *file, char *filename){
|
||||||
|
file_create_from_string(system, models, file, filename, string_zero());
|
||||||
file_create_from_string(system, models, file, filename, {});
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
file_create_read_only(System_Functions *system,
|
file_create_read_only(System_Functions *system,
|
||||||
Models *models, Editing_File *file, char *filename){
|
Models *models, Editing_File *file, char *filename){
|
||||||
|
file_create_from_string(system, models, file, filename, string_zero(), 1);
|
||||||
file_create_from_string(system, models, file, filename, {}, 1);
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,7 +715,7 @@ file_kill_tokens(System_Functions *system,
|
||||||
general_memory_free(general, file->state.token_stack.tokens);
|
general_memory_free(general, file->state.token_stack.tokens);
|
||||||
}
|
}
|
||||||
file->state.tokens_complete = 0;
|
file->state.tokens_complete = 0;
|
||||||
file->state.token_stack = {};
|
file->state.token_stack = cpp_token_stack_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
#if BUFFER_EXPERIMENT_SCALPEL <= 0
|
||||||
|
@ -1270,7 +1278,7 @@ view_set_file(
|
||||||
|
|
||||||
// NOTE(allen): Stuff that doesn't assume file exists.
|
// NOTE(allen): Stuff that doesn't assume file exists.
|
||||||
// TODO(allen): Use a proper file changer here.
|
// TODO(allen): Use a proper file changer here.
|
||||||
view->file_data = {0};
|
view->file_data = file_viewing_data_zero();;
|
||||||
view->file_data.file = file;
|
view->file_data.file = file;
|
||||||
|
|
||||||
// NOTE(allen): Stuff that does assume file exists.
|
// NOTE(allen): Stuff that does assume file exists.
|
||||||
|
@ -1812,6 +1820,7 @@ file_replace_range(System_Functions *system, Models *models, Editing_File *file,
|
||||||
spec.step.type = ED_NORMAL;
|
spec.step.type = ED_NORMAL;
|
||||||
spec.step.edit.start = start;
|
spec.step.edit.start = start;
|
||||||
spec.step.edit.end = end;
|
spec.step.edit.end = end;
|
||||||
|
|
||||||
spec.step.edit.len = len;
|
spec.step.edit.len = len;
|
||||||
spec.step.pre_pos = file->state.cursor_pos;
|
spec.step.pre_pos = file->state.cursor_pos;
|
||||||
spec.step.post_pos = next_cursor;
|
spec.step.post_pos = next_cursor;
|
||||||
|
@ -2580,7 +2589,7 @@ file_view_nullify_file(View *view){
|
||||||
if (view->file_data.line_wrap_y){
|
if (view->file_data.line_wrap_y){
|
||||||
general_memory_free(general, view->file_data.line_wrap_y);
|
general_memory_free(general, view->file_data.line_wrap_y);
|
||||||
}
|
}
|
||||||
view->file_data = {0};
|
view->file_data = file_viewing_data_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -2861,7 +2870,7 @@ file_step(View *view, i32_Rect region, Input_Summary *user_input, b32 is_active)
|
||||||
view_set_widget(view, FWIDG_NONE);
|
view_set_widget(view, FWIDG_NONE);
|
||||||
if (rx >= 0 && rx < max_x && ry >= 0 && ry < max_visible_y){
|
if (rx >= 0 && rx < max_x && ry >= 0 && ry < max_visible_y){
|
||||||
view_cursor_move(view, rx + scroll_vars.scroll_x, ry + scroll_vars.scroll_y, 1);
|
view_cursor_move(view, rx + scroll_vars.scroll_x, ry + scroll_vars.scroll_y, 1);
|
||||||
view->mode = {};
|
view->mode = view_mode_zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2938,7 +2947,7 @@ get_exhaustive_info(System_Functions *system, Working_Set *working_set, Exhausti
|
||||||
result.name_match = (filename_match(loop->front_name, &loop->absolutes, result.info->filename, 0) != 0);
|
result.name_match = (filename_match(loop->front_name, &loop->absolutes, result.info->filename, 0) != 0);
|
||||||
result.is_loaded = (file != 0 && file_is_ready(file));
|
result.is_loaded = (file != 0 && file_is_ready(file));
|
||||||
|
|
||||||
result.message = {0};
|
result.message = string_zero();
|
||||||
if (result.is_loaded){
|
if (result.is_loaded){
|
||||||
switch (buffer_get_sync(file)){
|
switch (buffer_get_sync(file)){
|
||||||
case SYNC_GOOD: result.message = message_loaded; break;
|
case SYNC_GOOD: result.message = message_loaded; break;
|
||||||
|
@ -3577,7 +3586,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
||||||
file = (Editing_File*)node;
|
file = (Editing_File*)node;
|
||||||
Assert(!file->state.is_dummy);
|
Assert(!file->state.is_dummy);
|
||||||
|
|
||||||
message = {0};
|
message = string_zero();
|
||||||
switch (buffer_get_sync(file)){
|
switch (buffer_get_sync(file)){
|
||||||
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
||||||
case SYNC_UNSAVED: message = message_unsaved; break;
|
case SYNC_UNSAVED: message = message_unsaved; break;
|
||||||
|
@ -3688,12 +3697,12 @@ click_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *user
|
||||||
}
|
}
|
||||||
if (user_input->mouse.release_l && gui_id_eq(target->mouse_hot, b->id)){
|
if (user_input->mouse.release_l && gui_id_eq(target->mouse_hot, b->id)){
|
||||||
target->active = b->id;
|
target->active = b->id;
|
||||||
target->mouse_hot = {0};
|
target->mouse_hot = gui_id_zero();
|
||||||
*is_animating = 1;
|
*is_animating = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gui_id_eq(target->hover, b->id)){
|
else if (gui_id_eq(target->hover, b->id)){
|
||||||
target->hover = {0};
|
target->hover = gui_id_zero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3714,7 +3723,7 @@ scroll_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gui_id_eq(target->hover, id)){
|
else if (gui_id_eq(target->hover, id)){
|
||||||
target->hover = {0};
|
target->hover = gui_id_zero();
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -3733,7 +3742,7 @@ do_input_file_view(System_Functions *system, Exchange *exchange,
|
||||||
|
|
||||||
gui_session_init(&gui_session, rect, view->font_height);
|
gui_session_init(&gui_session, rect, view->font_height);
|
||||||
|
|
||||||
target->active = {0};
|
target->active = gui_id_zero();
|
||||||
|
|
||||||
for (h = (GUI_Header*)target->push.base;
|
for (h = (GUI_Header*)target->push.base;
|
||||||
h->type;
|
h->type;
|
||||||
|
@ -3751,7 +3760,7 @@ do_input_file_view(System_Functions *system, Exchange *exchange,
|
||||||
GUI_Interactive *b = (GUI_Interactive*)h;
|
GUI_Interactive *b = (GUI_Interactive*)h;
|
||||||
|
|
||||||
if (interpret_result.auto_activate){
|
if (interpret_result.auto_activate){
|
||||||
target->auto_hot = {0};
|
target->auto_hot = gui_id_zero();
|
||||||
target->active = b->id;
|
target->active = b->id;
|
||||||
is_animating = 1;
|
is_animating = 1;
|
||||||
}
|
}
|
||||||
|
@ -3844,7 +3853,7 @@ do_input_file_view(System_Functions *system, Exchange *exchange,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gui_id_eq(target->hover, id)){
|
else if (gui_id_eq(target->hover, id)){
|
||||||
target->hover = {0};
|
target->hover = gui_id_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gui_id_eq(target->mouse_hot, id)){
|
if (gui_id_eq(target->mouse_hot, id)){
|
||||||
|
@ -3910,7 +3919,7 @@ do_input_file_view(System_Functions *system, Exchange *exchange,
|
||||||
|
|
||||||
if (!user_input->mouse.l){
|
if (!user_input->mouse.l){
|
||||||
if (!gui_id_is_null(target->mouse_hot)){
|
if (!gui_id_is_null(target->mouse_hot)){
|
||||||
target->mouse_hot = {0};
|
target->mouse_hot = gui_id_zero();
|
||||||
is_animating = 1;
|
is_animating = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4297,7 +4306,7 @@ draw_color_button(GUI_Target *gui_target, Render_Target *target, View *view,
|
||||||
i16 font_id = models->global_font.font_id;
|
i16 font_id = models->global_font.font_id;
|
||||||
|
|
||||||
if (active_level > 0){
|
if (active_level > 0){
|
||||||
Swap(back, fore);
|
Swap(u32, back, fore);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_rectangle(target, rect, back);
|
draw_rectangle(target, rect, back);
|
||||||
|
|
|
@ -40,6 +40,12 @@ font__remove(Font_Slot *slot){
|
||||||
n->prev = p;
|
n->prev = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Font_Slot
|
||||||
|
font_slot_zero(){
|
||||||
|
Font_Slot slot = {};
|
||||||
|
return(slot);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
font_set_init(Font_Set *set, Partition *partition, i32 max, i16 live_max){
|
font_set_init(Font_Set *set, Partition *partition, i32 max, i16 live_max){
|
||||||
partition_align(partition, 8);
|
partition_align(partition, 8);
|
||||||
|
@ -52,8 +58,8 @@ font_set_init(Font_Set *set, Partition *partition, i32 max, i16 live_max){
|
||||||
partition_align(partition, 8);
|
partition_align(partition, 8);
|
||||||
set->font_block = push_block(partition, live_max*(sizeof(Render_Font) + sizeof(Font_Slot)));
|
set->font_block = push_block(partition, live_max*(sizeof(Render_Font) + sizeof(Font_Slot)));
|
||||||
|
|
||||||
set->free_slots = {};
|
set->free_slots = font_slot_zero();
|
||||||
set->used_slots = {};
|
set->used_slots = font_slot_zero();
|
||||||
|
|
||||||
dll_init_sentinel(&set->free_slots);
|
dll_init_sentinel(&set->free_slots);
|
||||||
dll_init_sentinel(&set->used_slots);
|
dll_init_sentinel(&set->used_slots);
|
||||||
|
|
13
4ed_gui.cpp
13
4ed_gui.cpp
|
@ -115,6 +115,11 @@ super_color_post_byte(Super_Color *color, i32 channel, u8 byte){
|
||||||
struct GUI_id{
|
struct GUI_id{
|
||||||
u64 id[2];
|
u64 id[2];
|
||||||
};
|
};
|
||||||
|
inline GUI_id
|
||||||
|
gui_id_zero(){
|
||||||
|
GUI_id id = {0};
|
||||||
|
return(id);
|
||||||
|
}
|
||||||
|
|
||||||
struct GUI_Scroll_Vars{
|
struct GUI_Scroll_Vars{
|
||||||
f32 scroll_y;
|
f32 scroll_y;
|
||||||
|
@ -736,11 +741,17 @@ gui_session_get_current_top(GUI_Session *session){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline GUI_Session
|
||||||
|
gui_session_zero(){
|
||||||
|
GUI_Session session={0};
|
||||||
|
return(session);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
gui_session_init(GUI_Session *session, i32_Rect full_rect, i32 line_height){
|
gui_session_init(GUI_Session *session, i32_Rect full_rect, i32 line_height){
|
||||||
GUI_Section *section;
|
GUI_Section *section;
|
||||||
|
|
||||||
*session = {0};
|
*session = gui_session_zero();
|
||||||
session->full_rect = full_rect;
|
session->full_rect = full_rect;
|
||||||
session->line_height = line_height;
|
session->line_height = line_height;
|
||||||
session->scroll_bar_w = GUIScrollbarWidth;
|
session->scroll_bar_w = GUIScrollbarWidth;
|
||||||
|
|
|
@ -75,15 +75,21 @@ panel_init(Panel *panel){
|
||||||
panel->view = 0;
|
panel->view = 0;
|
||||||
panel->parent = -1;
|
panel->parent = -1;
|
||||||
panel->which_child = 0;
|
panel->which_child = 0;
|
||||||
panel->screen_region.full = {};
|
panel->screen_region.full = i32_rect_zero();
|
||||||
panel->screen_region.inner = {};
|
panel->screen_region.inner = i32_rect_zero();
|
||||||
panel->screen_region.prev_inner = {};
|
panel->screen_region.prev_inner = i32_rect_zero();
|
||||||
panel->l_margin = 3;
|
panel->l_margin = 3;
|
||||||
panel->r_margin = 3;
|
panel->r_margin = 3;
|
||||||
panel->t_margin = 3;
|
panel->t_margin = 3;
|
||||||
panel->b_margin = 3;
|
panel->b_margin = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Panel_Divider
|
||||||
|
panel_divider_zero(){
|
||||||
|
Panel_Divider divider={0};
|
||||||
|
return(divider);
|
||||||
|
}
|
||||||
|
|
||||||
internal Divider_And_ID
|
internal Divider_And_ID
|
||||||
layout_alloc_divider(Editing_Layout *layout){
|
layout_alloc_divider(Editing_Layout *layout){
|
||||||
Divider_And_ID result;
|
Divider_And_ID result;
|
||||||
|
@ -92,7 +98,7 @@ layout_alloc_divider(Editing_Layout *layout){
|
||||||
result.divider = layout->free_divider;
|
result.divider = layout->free_divider;
|
||||||
layout->free_divider = result.divider->next;
|
layout->free_divider = result.divider->next;
|
||||||
|
|
||||||
*result.divider = {};
|
*result.divider = panel_divider_zero();
|
||||||
result.divider->parent = -1;
|
result.divider->parent = -1;
|
||||||
result.divider->child1 = -1;
|
result.divider->child1 = -1;
|
||||||
result.divider->child2 = -1;
|
result.divider->child2 = -1;
|
||||||
|
|
12
4ed_math.cpp
12
4ed_math.cpp
|
@ -108,6 +108,18 @@ struct f32_Rect{
|
||||||
f32 x1, y1;
|
f32 x1, y1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline i32_Rect
|
||||||
|
i32_rect_zero(){
|
||||||
|
i32_Rect rect={0};
|
||||||
|
return(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline f32_Rect
|
||||||
|
f32_rect_zero(){
|
||||||
|
f32_Rect rect={0};
|
||||||
|
return(rect);
|
||||||
|
}
|
||||||
|
|
||||||
inline i32_Rect
|
inline i32_Rect
|
||||||
i32R(i32 l, i32 t, i32 r, i32 b){
|
i32R(i32 l, i32 t, i32 r, i32 b){
|
||||||
i32_Rect rect;
|
i32_Rect rect;
|
||||||
|
|
|
@ -99,7 +99,7 @@ _OutDbgStr(u8*);
|
||||||
#define OffsetOfStruct(S,c) ((i64)(& ((S*)0)->c ))
|
#define OffsetOfStruct(S,c) ((i64)(& ((S*)0)->c ))
|
||||||
#define OffsetOfPtr(s,c) ((i64)((char*)(&(s)->c) - (char*)(s)))
|
#define OffsetOfPtr(s,c) ((i64)((char*)(&(s)->c) - (char*)(s)))
|
||||||
|
|
||||||
#define Swap(a,b) {auto t = a; a = b; b = t;}
|
#define Swap(T,a,b) do{ T t = a; a = b; b = t; } while(0)
|
||||||
|
|
||||||
#ifndef literal
|
#ifndef literal
|
||||||
#define literal(s) s, (sizeof(s)-1)
|
#define literal(s) s, (sizeof(s)-1)
|
||||||
|
|
10
4ed_system.h
10
4ed_system.h
|
@ -133,6 +133,11 @@ struct Thread_Memory{
|
||||||
i32 size;
|
i32 size;
|
||||||
i32 id;
|
i32 id;
|
||||||
};
|
};
|
||||||
|
inline Thread_Memory
|
||||||
|
thread_memory_zero(){
|
||||||
|
Thread_Memory memory={0};
|
||||||
|
return(memory);
|
||||||
|
}
|
||||||
|
|
||||||
struct Thread_Exchange;
|
struct Thread_Exchange;
|
||||||
struct System_Functions;
|
struct System_Functions;
|
||||||
|
@ -255,6 +260,11 @@ struct File_Slot{
|
||||||
i32 filename_len;
|
i32 filename_len;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
};
|
};
|
||||||
|
inline File_Slot
|
||||||
|
file_slot_zero(){
|
||||||
|
File_Slot slot={0};
|
||||||
|
return(slot);
|
||||||
|
}
|
||||||
|
|
||||||
enum File_Exchange_Flag{
|
enum File_Exchange_Flag{
|
||||||
FEx_Request = 0x1,
|
FEx_Request = 0x1,
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -7,10 +7,10 @@ FLAGS := -fPIC -fno-threadsafe-statics -pthread -I../foreign -g -O0
|
||||||
all: ../4ed_app.so ../4ed
|
all: ../4ed_app.so ../4ed
|
||||||
|
|
||||||
../4ed_app.so: $(CPP_FILES) $(H_FILES)
|
../4ed_app.so: $(CPP_FILES) $(H_FILES)
|
||||||
g++ $(WARNINGS) $(FLAGS) -std=gnu++0x -shared 4ed_app_target.cpp -iquoteforeign -o $@
|
g++ $(WARNINGS) $(FLAGS) -shared 4ed_app_target.cpp -iquoteforeign -o $@
|
||||||
|
|
||||||
../4ed: $(CPP_FILES) $(H_FILES)
|
../4ed: $(CPP_FILES) $(H_FILES)
|
||||||
g++ $(WARNINGS) $(FLAGS) -std=gnu++0x linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@
|
g++ $(WARNINGS) $(FLAGS) linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -f ../4ed_app.so ../4ed
|
$(RM) -f ../4ed_app.so ../4ed
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
#include "4ed_meta.h"
|
#include "4ed_meta.h"
|
||||||
|
|
||||||
|
#if (__cplusplus <= 199711L)
|
||||||
|
#define static_assert(x, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FCPP_FORBID_MALLOC
|
#define FCPP_FORBID_MALLOC
|
||||||
|
|
||||||
#include "4cpp_types.h"
|
#include "4cpp_types.h"
|
||||||
|
@ -934,7 +938,7 @@ Sys_File_Can_Be_Made(system_file_can_be_made){
|
||||||
|
|
||||||
internal
|
internal
|
||||||
Sys_Load_File_Sig(system_load_file){
|
Sys_Load_File_Sig(system_load_file){
|
||||||
Data result = {};
|
File_Data result = {};
|
||||||
struct stat info = {};
|
struct stat info = {};
|
||||||
int fd;
|
int fd;
|
||||||
u8 *ptr, *read_ptr;
|
u8 *ptr, *read_ptr;
|
||||||
|
@ -986,8 +990,9 @@ Sys_Load_File_Sig(system_load_file){
|
||||||
}
|
}
|
||||||
} while(bytes_to_read);
|
} while(bytes_to_read);
|
||||||
|
|
||||||
result.size = info.st_size;
|
result.data.size = info.st_size;
|
||||||
result.data = ptr;
|
result.data.data = ptr;
|
||||||
|
result.got_file = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(fd >= 0) close(fd);
|
if(fd >= 0) close(fd);
|
||||||
|
@ -1574,6 +1579,11 @@ struct Init_Input_Result{
|
||||||
XIMStyle best_style;
|
XIMStyle best_style;
|
||||||
XIC xic;
|
XIC xic;
|
||||||
};
|
};
|
||||||
|
inline Init_Input_Result
|
||||||
|
init_input_result_zero(){
|
||||||
|
Init_Input_Result result={0};
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(inso): doesn't actually use XInput anymore, i should change the name...
|
// NOTE(inso): doesn't actually use XInput anymore, i should change the name...
|
||||||
internal Init_Input_Result
|
internal Init_Input_Result
|
||||||
|
@ -1626,12 +1636,12 @@ InitializeXInput(Display *dpy, Window XWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
result = {};
|
result = init_input_result_zero();
|
||||||
fputs("Could not get minimum required input style.\n", stderr);
|
fputs("Could not get minimum required input style.\n", stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
result = {};
|
result = init_input_result_zero();
|
||||||
fputs("Could not open X Input Method.\n", stderr);
|
fputs("Could not open X Input Method.\n", stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2214,7 +2224,7 @@ main(int argc, char **argv)
|
||||||
thread->id = i + 1;
|
thread->id = i + 1;
|
||||||
|
|
||||||
Thread_Memory *memory = linuxvars.thread_memory + i;
|
Thread_Memory *memory = linuxvars.thread_memory + i;
|
||||||
*memory = {};
|
*memory = thread_memory_zero();
|
||||||
memory->id = thread->id;
|
memory->id = thread->id;
|
||||||
|
|
||||||
thread->queue = &exchange_vars.thread.queues[BACKGROUND_THREADS];
|
thread->queue = &exchange_vars.thread.queues[BACKGROUND_THREADS];
|
||||||
|
@ -2619,7 +2629,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
linuxvars.first = 0;
|
linuxvars.first = 0;
|
||||||
linuxvars.redraw = 0;
|
linuxvars.redraw = 0;
|
||||||
linuxvars.key_data = {};
|
linuxvars.key_data = key_input_data_zero();
|
||||||
linuxvars.mouse_data.press_l = 0;
|
linuxvars.mouse_data.press_l = 0;
|
||||||
linuxvars.mouse_data.release_l = 0;
|
linuxvars.mouse_data.release_l = 0;
|
||||||
linuxvars.mouse_data.press_r = 0;
|
linuxvars.mouse_data.press_r = 0;
|
||||||
|
@ -2647,14 +2657,14 @@ main(int argc, char **argv)
|
||||||
if (file->flags & FEx_Request){
|
if (file->flags & FEx_Request){
|
||||||
Assert((file->flags & FEx_Save) == 0);
|
Assert((file->flags & FEx_Save) == 0);
|
||||||
file->flags &= (~FEx_Request);
|
file->flags &= (~FEx_Request);
|
||||||
Data sysfile = system_load_file(file->filename);
|
File_Data sysfile = system_load_file(file->filename);
|
||||||
if (sysfile.data == 0){
|
if (!sysfile.got_file){
|
||||||
file->flags |= FEx_Not_Exist;
|
file->flags |= FEx_Not_Exist;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
file->flags |= FEx_Ready;
|
file->flags |= FEx_Ready;
|
||||||
file->data = sysfile.data;
|
file->data = sysfile.data.data;
|
||||||
file->size = sysfile.size;
|
file->size = sysfile.data.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxScheduleStep();
|
LinuxScheduleStep();
|
||||||
|
|
|
@ -80,15 +80,15 @@ sysshared_init_file_exchange(
|
||||||
i32 i;
|
i32 i;
|
||||||
|
|
||||||
exchange->file.max = max;
|
exchange->file.max = max;
|
||||||
exchange->file.available = {};
|
exchange->file.available = file_slot_zero();
|
||||||
exchange->file.available.next = &exchange->file.available;
|
exchange->file.available.next = &exchange->file.available;
|
||||||
exchange->file.available.prev = &exchange->file.available;
|
exchange->file.available.prev = &exchange->file.available;
|
||||||
|
|
||||||
exchange->file.active = {};
|
exchange->file.active = file_slot_zero();
|
||||||
exchange->file.active.next = &exchange->file.active;
|
exchange->file.active.next = &exchange->file.active;
|
||||||
exchange->file.active.prev = &exchange->file.active;
|
exchange->file.active.prev = &exchange->file.active;
|
||||||
|
|
||||||
exchange->file.free_list = {};
|
exchange->file.free_list = file_slot_zero();
|
||||||
exchange->file.free_list.next = &exchange->file.free_list;
|
exchange->file.free_list.next = &exchange->file.free_list;
|
||||||
exchange->file.free_list.prev = &exchange->file.free_list;
|
exchange->file.free_list.prev = &exchange->file.free_list;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue