Removed all string.h dependencies from core and win32
This commit is contained in:
parent
8a66a157d3
commit
19034b7887
9
4ed.cpp
9
4ed.cpp
|
@ -190,10 +190,9 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
||||||
|
|
||||||
// Initialize Table and User Maps in Temp Buffer
|
// Initialize Table and User Maps in Temp Buffer
|
||||||
new_mapping.map_id_table = push_array(scratch, i32, user_map_count);
|
new_mapping.map_id_table = push_array(scratch, i32, user_map_count);
|
||||||
memset(new_mapping.map_id_table, -1, user_map_count*sizeof(i32));
|
block_fill_u32(new_mapping.map_id_table, user_map_count*sizeof(i32), (u32)(-1));
|
||||||
|
|
||||||
new_mapping.user_maps = push_array(scratch, Command_Map, user_map_count);
|
new_mapping.user_maps = push_array_zero(scratch, Command_Map, user_map_count);
|
||||||
memset(new_mapping.user_maps, 0, user_map_count*sizeof(Command_Map));
|
|
||||||
|
|
||||||
// Find the Size of Each Map
|
// Find the Size of Each Map
|
||||||
for (++unit; unit < end; ++unit){
|
for (++unit; unit < end; ++unit){
|
||||||
|
@ -271,12 +270,12 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
||||||
// Move ID Table Memory and Pointer
|
// Move ID Table Memory and Pointer
|
||||||
i32 *old_table = new_mapping.map_id_table;
|
i32 *old_table = new_mapping.map_id_table;
|
||||||
new_mapping.map_id_table = push_array(&local_cursor, i32, user_map_count);
|
new_mapping.map_id_table = push_array(&local_cursor, i32, user_map_count);
|
||||||
memmove(new_mapping.map_id_table, old_table, map_id_table_memsize);
|
block_copy(new_mapping.map_id_table, old_table, map_id_table_memsize);
|
||||||
|
|
||||||
// Move User Maps Memory and Pointer
|
// Move User Maps Memory and Pointer
|
||||||
Command_Map *old_maps = new_mapping.user_maps;
|
Command_Map *old_maps = new_mapping.user_maps;
|
||||||
new_mapping.user_maps = push_array(&local_cursor, Command_Map, user_map_count);
|
new_mapping.user_maps = push_array(&local_cursor, Command_Map, user_map_count);
|
||||||
memmove(new_mapping.user_maps, old_maps, user_maps_memsize);
|
block_copy(new_mapping.user_maps, old_maps, user_maps_memsize);
|
||||||
|
|
||||||
// Fill in Command Maps
|
// Fill in Command Maps
|
||||||
unit = (Binding_Unit*)buffer;
|
unit = (Binding_Unit*)buffer;
|
||||||
|
|
|
@ -2092,7 +2092,7 @@ Managed_Object_Store_Data(Application_Links *app, Managed_Object object, u32 fir
|
||||||
u32 item_count = object_ptrs.header->count;
|
u32 item_count = object_ptrs.header->count;
|
||||||
if (0 <= first_index && first_index + count <= item_count){
|
if (0 <= first_index && first_index + count <= item_count){
|
||||||
u32 item_size = object_ptrs.header->item_size;
|
u32 item_size = object_ptrs.header->item_size;
|
||||||
memcpy(ptr + first_index*item_size, mem, count*item_size);
|
block_copy(ptr + first_index*item_size, mem, count*item_size);
|
||||||
heap_assert_good(&object_ptrs.workspace->heap);
|
heap_assert_good(&object_ptrs.workspace->heap);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -2111,7 +2111,7 @@ Managed_Object_Load_Data(Application_Links *app, Managed_Object object, u32 firs
|
||||||
u32 item_count = object_ptrs.header->count;
|
u32 item_count = object_ptrs.header->count;
|
||||||
if (0 <= first_index && first_index + count <= item_count){
|
if (0 <= first_index && first_index + count <= item_count){
|
||||||
u32 item_size = object_ptrs.header->item_size;
|
u32 item_size = object_ptrs.header->item_size;
|
||||||
memcpy(mem_out, ptr + first_index*item_size, count*item_size);
|
block_copy(mem_out, ptr + first_index*item_size, count*item_size);
|
||||||
heap_assert_good(&object_ptrs.workspace->heap);
|
heap_assert_good(&object_ptrs.workspace->heap);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
|
|
||||||
#define REMOVE_OLD_STRING
|
#define REMOVE_OLD_STRING
|
||||||
|
|
||||||
// TODO(allen): get away from string.h
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "api/4coder_custom.h"
|
#include "api/4coder_custom.h"
|
||||||
|
|
||||||
#include "4coder_base_types.h"
|
#include "4coder_base_types.h"
|
||||||
|
|
|
@ -112,19 +112,19 @@ eol_convert_in(char *dest, char *src, i32 size){
|
||||||
i32 k = 0;
|
i32 k = 0;
|
||||||
|
|
||||||
for (; j < size && src[j] != '\r'; ++j);
|
for (; j < size && src[j] != '\r'; ++j);
|
||||||
memcpy(dest, src, j);
|
block_copy(dest, src, j);
|
||||||
|
|
||||||
if (j < size){
|
if (j < size){
|
||||||
k = 1;
|
k = 1;
|
||||||
++j;
|
++j;
|
||||||
for (i = j; i < size; ++i){
|
for (i = j; i < size; ++i){
|
||||||
if (src[i] == '\r'){
|
if (src[i] == '\r'){
|
||||||
memcpy(dest + j - k, src + j, i - j);
|
block_copy(dest + j - k, src + j, i - j);
|
||||||
++k;
|
++k;
|
||||||
j = i+1;
|
j = i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(dest + j - k, src + j, i - j);
|
block_copy(dest + j - k, src + j, i - j);
|
||||||
j = i - k;
|
j = i - k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +144,12 @@ eol_in_place_convert_in(char *data, i32 size){
|
||||||
++j;
|
++j;
|
||||||
for (i = j; i < size; ++i){
|
for (i = j; i < size; ++i){
|
||||||
if (data[i] == '\r'){
|
if (data[i] == '\r'){
|
||||||
memmove(data + j - k, data + j, i - j);
|
block_copy(data + j - k, data + j, i - j);
|
||||||
++k;
|
++k;
|
||||||
j = i+1;
|
j = i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memmove(data + j - k, data + j, i - j);
|
block_copy(data + j - k, data + j, i - j);
|
||||||
j = i - k;
|
j = i - k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ eol_in_place_convert_out(char *data, i32 size, i32 max, i32 *size_out){
|
||||||
|
|
||||||
for (; i < size; ++i){
|
for (; i < size; ++i){
|
||||||
if (data[i] == '\n'){
|
if (data[i] == '\n'){
|
||||||
memmove(data + i + 1, data + i, size - i);
|
block_copy(data + i + 1, data + i, size - i);
|
||||||
data[i] = '\r';
|
data[i] = '\r';
|
||||||
++i;
|
++i;
|
||||||
++size;
|
++size;
|
||||||
|
|
|
@ -161,12 +161,10 @@ map_init(Command_Map *map, Cursor *cursor, i32 max, i32 parent){
|
||||||
Assert(max >= 6);
|
Assert(max >= 6);
|
||||||
Assert(map->commands == 0);
|
Assert(map->commands == 0);
|
||||||
map->parent = parent;
|
map->parent = parent;
|
||||||
map->commands = push_array(cursor, Command_Binding, max);
|
map->commands = push_array_zero(cursor, Command_Binding, max);
|
||||||
map->count = 0;
|
map->count = 0;
|
||||||
map->max = max;
|
map->max = max;
|
||||||
|
block_zero_array(map->vanilla_keyboard_default);
|
||||||
memset(map->commands, 0, max*sizeof(*map->commands));
|
|
||||||
memset(map->vanilla_keyboard_default, 0, sizeof(map->vanilla_keyboard_default));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "4coder_table.h"
|
#include "4coder_table.h"
|
||||||
#include "api/4coder_version.h"
|
#include "api/4coder_version.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if defined(FRED_SUPER)
|
#if defined(FRED_SUPER)
|
||||||
# include "api/4coder_keycodes.h"
|
# include "api/4coder_keycodes.h"
|
||||||
# include "api/4coder_default_colors.h"
|
# include "api/4coder_default_colors.h"
|
||||||
|
@ -1500,19 +1498,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
||||||
i32 argc = __argc;
|
i32 argc = __argc;
|
||||||
char **argv = __argv;
|
char **argv = __argv;
|
||||||
|
|
||||||
//
|
// NOTE(allen): link
|
||||||
// System Linkage
|
|
||||||
//
|
|
||||||
|
|
||||||
sysfunc.font_make_face = ft__font_make_face;
|
sysfunc.font_make_face = ft__font_make_face;
|
||||||
sysfunc.get_texture = gl__get_texture;
|
sysfunc.get_texture = gl__get_texture;
|
||||||
sysfunc.fill_texture = gl__fill_texture;
|
sysfunc.fill_texture = gl__fill_texture;
|
||||||
link_system_code();
|
link_system_code();
|
||||||
|
|
||||||
//
|
// NOTE(allen): memory
|
||||||
// Memory init
|
|
||||||
//
|
|
||||||
|
|
||||||
Thread_Context _tctx = {};
|
Thread_Context _tctx = {};
|
||||||
thread_ctx_init(&_tctx, get_base_allocator_system(&sysfunc));
|
thread_ctx_init(&_tctx, get_base_allocator_system(&sysfunc));
|
||||||
|
|
||||||
|
@ -1522,11 +1514,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
||||||
// TODO(allen): *arena;
|
// TODO(allen): *arena;
|
||||||
target.arena = make_arena_system(&sysfunc);
|
target.arena = make_arena_system(&sysfunc);
|
||||||
|
|
||||||
memset(&plat_settings, 0, sizeof(plat_settings));
|
block_zero_struct(&plat_settings);
|
||||||
|
|
||||||
memset(&libraries, 0, sizeof(libraries));
|
block_zero_struct(&libraries);
|
||||||
memset(&app, 0, sizeof(app));
|
block_zero_struct(&app);
|
||||||
memset(&custom_api, 0, sizeof(custom_api));
|
block_zero_struct(&custom_api);
|
||||||
|
|
||||||
win32vars.cursor_show = MouseCursorShow_Always;
|
win32vars.cursor_show = MouseCursorShow_Always;
|
||||||
win32vars.prev_cursor_show = MouseCursorShow_Always;
|
win32vars.prev_cursor_show = MouseCursorShow_Always;
|
||||||
|
|
Loading…
Reference in New Issue