Merged in chr-fix-linux (pull request #3)
4coder build scripts working on Linux x64 Approved-by: Allen Webster <editor@4coder.net>master
commit
0e9fcaee05
|
@ -373,8 +373,8 @@ buffer_chunks_clamp(List_String_Const_u8 *chunks, Interval_i64 range){
|
||||||
next = node->next;
|
next = node->next;
|
||||||
Interval_i64 node_range = Ii64(p, p + node->string.size);
|
Interval_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;
|
||||||
String_Const_u8 s = string_prefix(node->string, one_past_last);
|
String_Const_u8 s = string_prefix(node->string, one_past_last);
|
||||||
node->string = string_skip(s, first);
|
node->string = string_skip(s, first);
|
||||||
sll_queue_push(list.first, list.last, node);
|
sll_queue_push(list.first, list.last, node);
|
||||||
|
|
|
@ -453,15 +453,15 @@ edit_batch(Thread_Context *tctx, Models *models, Editing_File *file,
|
||||||
String_Const_u8 insert_string = edit->edit.text;
|
String_Const_u8 insert_string = edit->edit.text;
|
||||||
|
|
||||||
Range_i64 edit_range = edit->edit.range;
|
Range_i64 edit_range = edit->edit.range;
|
||||||
old_range.min = min(old_range.min, edit_range.min);
|
old_range.min = Min(old_range.min, edit_range.min);
|
||||||
old_range.max = max(old_range.max, edit_range.max);
|
old_range.max = Max(old_range.max, edit_range.max);
|
||||||
|
|
||||||
edit_range.first += shift;
|
edit_range.first += shift;
|
||||||
edit_range.one_past_last += shift;
|
edit_range.one_past_last += shift;
|
||||||
|
|
||||||
new_range.min = min(new_range.min, edit_range.min);
|
new_range.min = Min(new_range.min, edit_range.min);
|
||||||
i64 new_max = (i64)(edit_range.min + insert_string.size);
|
i64 new_max = (i64)(edit_range.min + insert_string.size);
|
||||||
new_range.max = max(new_range.max, new_max);
|
new_range.max = Max(new_range.max, new_max);
|
||||||
|
|
||||||
i64 size = buffer_size(buffer);
|
i64 size = buffer_size(buffer);
|
||||||
if (0 <= edit_range.first &&
|
if (0 <= edit_range.first &&
|
||||||
|
|
|
@ -331,7 +331,7 @@ ft__font_make_face(Arena *arena, Face_Description *description, f32 scale_factor
|
||||||
met->hex_digit_advance =
|
met->hex_digit_advance =
|
||||||
font_get_max_glyph_advance_range(advance_map, met, 'A', 'F');
|
font_get_max_glyph_advance_range(advance_map, met, 'A', 'F');
|
||||||
met->hex_digit_advance =
|
met->hex_digit_advance =
|
||||||
max(met->hex_digit_advance, met->decimal_digit_advance);
|
Max(met->hex_digit_advance, met->decimal_digit_advance);
|
||||||
met->byte_sub_advances[0] =
|
met->byte_sub_advances[0] =
|
||||||
font_get_glyph_advance(advance_map, met, '\\');
|
font_get_glyph_advance(advance_map, met, '\\');
|
||||||
met->byte_sub_advances[1] = met->hex_digit_advance;
|
met->byte_sub_advances[1] = met->hex_digit_advance;
|
||||||
|
|
|
@ -158,7 +158,7 @@ draw_rectangle_outline(Render_Target *target, Rect_f32 rect, f32 roundness, f32
|
||||||
internal void
|
internal void
|
||||||
draw_rectangle(Render_Target *target, Rect_f32 rect, f32 roundness, u32 color){
|
draw_rectangle(Render_Target *target, Rect_f32 rect, f32 roundness, u32 color){
|
||||||
Vec2_f32 dim = rect_dim(rect);
|
Vec2_f32 dim = rect_dim(rect);
|
||||||
draw_rectangle_outline(target, rect, roundness, max(dim.x, dim.y), color);
|
draw_rectangle_outline(target, rect, roundness, Max(dim.x, dim.y), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
function void
|
function void
|
||||||
search_list_add_path__inner(Arena *arena, Path_Search_List *list, String_Const_u8 path){
|
search_list_add_path__inner(Arena *arena, Path_Search_List *list, String_Const_u8 path){
|
||||||
string_list_push(arena, &list->list, path);
|
string_list_push(arena, &list->list, path);
|
||||||
list->max_member_length = max(list->max_member_length, path.size);
|
list->max_member_length = Max(list->max_member_length, path.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
|
|
|
@ -84,6 +84,11 @@ find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
||||||
|
|
||||||
i32 jump_back_code = 0;
|
i32 jump_back_code = 0;
|
||||||
|
|
||||||
|
u8 c = 0;
|
||||||
|
u64 n = 0;
|
||||||
|
u8 needle_c = 0;
|
||||||
|
u64 jump = 0;
|
||||||
|
|
||||||
if (false){
|
if (false){
|
||||||
iterate_forward:
|
iterate_forward:
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -107,9 +112,9 @@ find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;node != 0;){
|
for (;node != 0;){
|
||||||
u8 c = node->string.str[chunk_pos];
|
c = node->string.str[chunk_pos];
|
||||||
u64 n = i - j;
|
n = i - j;
|
||||||
u8 needle_c = needle.str[n];
|
needle_c = needle.str[n];
|
||||||
if (character_to_upper(c) == character_to_upper(needle_c)){
|
if (character_to_upper(c) == character_to_upper(needle_c)){
|
||||||
if (c != needle_c){
|
if (c != needle_c){
|
||||||
last_insensitive = i;
|
last_insensitive = i;
|
||||||
|
@ -145,14 +150,14 @@ find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
||||||
if (list.count >= maximum_output_count){
|
if (list.count >= maximum_output_count){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
u64 jump = jump_table.vals[n + 1];
|
jump = jump_table.vals[n + 1];
|
||||||
current_l = character_predicate_check_character(*predicate, needle.str[jump - 1]);
|
current_l = character_predicate_check_character(*predicate, needle.str[jump - 1]);
|
||||||
j += jump;
|
j += jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
u64 jump = jump_table.vals[n];
|
jump = jump_table.vals[n];
|
||||||
if (jump == 0){
|
if (jump == 0){
|
||||||
current_l = character_predicate_check_character(*predicate, c);
|
current_l = character_predicate_check_character(*predicate, c);
|
||||||
|
|
||||||
|
@ -197,6 +202,11 @@ find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
|
|
||||||
i32 jump_back_code = 0;
|
i32 jump_back_code = 0;
|
||||||
|
|
||||||
|
u8 c = 0;
|
||||||
|
u64 n = 0;
|
||||||
|
u8 needle_c = 0;
|
||||||
|
u64 jump = 0;
|
||||||
|
|
||||||
if (false){
|
if (false){
|
||||||
iterate_backward:
|
iterate_backward:
|
||||||
i -= 1;
|
i -= 1;
|
||||||
|
@ -222,9 +232,9 @@ find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;node != 0;){
|
for (;node != 0;){
|
||||||
u8 c = node->string.str[chunk_pos];
|
c = node->string.str[chunk_pos];
|
||||||
u64 n = j - i;
|
n = j - i;
|
||||||
u8 needle_c = needle.str[needle.size - 1 - n];
|
needle_c = needle.str[needle.size - 1 - n];
|
||||||
if (character_to_upper(c) == character_to_upper(needle_c)){
|
if (character_to_upper(c) == character_to_upper(needle_c)){
|
||||||
if (c != needle_c){
|
if (c != needle_c){
|
||||||
last_insensitive = i;
|
last_insensitive = i;
|
||||||
|
@ -260,7 +270,7 @@ find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
if (list.count >= maximum_output_count){
|
if (list.count >= maximum_output_count){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
u64 jump = jump_table.vals[n + 1];
|
jump = jump_table.vals[n + 1];
|
||||||
u64 m = needle.size - jump;
|
u64 m = needle.size - jump;
|
||||||
u8 needle_m = needle.str[m];
|
u8 needle_m = needle.str[m];
|
||||||
current_r = character_predicate_check_character(*predicate, needle_m);
|
current_r = character_predicate_check_character(*predicate, needle_m);
|
||||||
|
@ -269,7 +279,7 @@ find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
u64 jump = jump_table.vals[n];
|
jump = jump_table.vals[n];
|
||||||
if (jump == 0){
|
if (jump == 0){
|
||||||
current_r = character_predicate_check_character(*predicate, c);
|
current_r = character_predicate_check_character(*predicate, c);
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ FOREIGN "/x86/libfreetype-mac.a"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
|
build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
|
||||||
Build_Line line;
|
Build_Line line;
|
||||||
fm_init_build_line(&line);
|
fm_init_build_line(&line);
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files,
|
||||||
fm_add_to_line(line, "-m32");
|
fm_add_to_line(line, "-m32");
|
||||||
fm_add_to_line(line, "-DFTECH_32_BIT"); break;
|
fm_add_to_line(line, "-DFTECH_32_BIT"); break;
|
||||||
|
|
||||||
default: InvalidCodePath;
|
default: InvalidPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & OPTS){
|
if (flags & OPTS){
|
||||||
|
@ -344,7 +344,7 @@ build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files,
|
||||||
fm_add_to_line(line, "-I%s", code_path);
|
fm_add_to_line(line, "-I%s", code_path);
|
||||||
if (inc_folders != 0){
|
if (inc_folders != 0){
|
||||||
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
||||||
char *str = fm_str(part, code_path, "/", inc_folders[i]);
|
char *str = fm_str(arena, code_path, "/", inc_folders[i]);
|
||||||
fm_add_to_line(line, "-I%s", str);
|
fm_add_to_line(line, "-I%s", str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files,
|
||||||
|
|
||||||
if (defines != 0){
|
if (defines != 0){
|
||||||
for (u32 i = 0; defines[i]; ++i){
|
for (u32 i = 0; defines[i]; ++i){
|
||||||
char *define_flag = fm_str(part, "-D", defines[i]);
|
char *define_flag = fm_str(arena, "-D", defines[i]);
|
||||||
fm_add_to_line(line, "%s", define_flag);
|
fm_add_to_line(line, "%s", define_flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Store the real CWD
|
# If any command errors, stop the script
|
||||||
REAL_PWD="$PWD"
|
set -e
|
||||||
|
|
||||||
# Find the code home folder
|
# Set up directories (mirrors build.bat)
|
||||||
TARGET_FILE="$0"
|
ME="$(readlink -f "$0")"
|
||||||
cd `dirname $TARGET_FILE`
|
LOCATION="$(dirname "$ME")"
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
SRC_ROOT="$(dirname "$LOCATION")"
|
||||||
while [ -L "$TARGET_FILE" ]
|
PROJECT_ROOT="$(dirname "$SRC_ROOT")"
|
||||||
do
|
if [ ! -d "$PROJECT_ROOT/build" ]; then
|
||||||
TARGET_FILE=`readlink $TARGET_FILE`
|
mkdir "$PROJECT_ROOT/build"
|
||||||
cd `dirname $TARGET_FILE`
|
fi
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
BUILD_ROOT="$PROJECT_ROOT/build"
|
||||||
done
|
BIN_ROOT="$SRC_ROOT/bin"
|
||||||
PHYS_DIR=`pwd -P`
|
CUSTOM_ROOT="$SRC_ROOT/custom"
|
||||||
SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
|
CUSTOM_BIN="$CUSTOM_ROOT/bin"
|
||||||
CODE_HOME=$(dirname "$SCRIPT_FILE")
|
|
||||||
|
|
||||||
# Restore the PWD
|
|
||||||
cd "$REAL_PWD"
|
|
||||||
|
|
||||||
# Get the build mode
|
# Get the build mode
|
||||||
BUILD_MODE="$1"
|
BUILD_MODE="$1"
|
||||||
|
@ -27,20 +23,20 @@ if [ -z "$BUILD_MODE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the OS specific flags
|
# Get the OS specific flags
|
||||||
chmod 777 detect_os.sh
|
chmod +rx "$BIN_ROOT/detect_os.sh"
|
||||||
os=$("./detect_os.sh")
|
os=$("$BIN_ROOT/detect_os.sh")
|
||||||
|
|
||||||
if [[ "$os" == "linux" ]]; then
|
if [[ "$os" == "linux" ]]; then
|
||||||
WARNINGS="-Wno-write-strings -Wno-comment "
|
WARNINGS="-Wno-write-strings -Wno-comment"
|
||||||
elif [[ "$os" == "mac" ]]; then
|
elif [[ "$os" == "mac" ]]; then
|
||||||
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
||||||
|
INCLUDES="-I$SRC_ROOT -I$CUSTOM_ROOT"
|
||||||
|
|
||||||
# Execute
|
# Execute
|
||||||
g++ $WARNINGS $FLAGS $CODE_HOME/meta/4ed_build.cpp -g -o ../build/build
|
g++ $WARNINGS $FLAGS $INCLUDES "$BIN_ROOT/4ed_build.cpp" -g -o "$BUILD_ROOT/build"
|
||||||
../build/build
|
pushd "$SRC_ROOT"
|
||||||
|
"$BUILD_ROOT/build"
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
os="unknown"
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
echo "mac"
|
||||||
|
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||||
|
echo "linux"
|
||||||
|
fi
|
||||||
|
|
|
@ -208,7 +208,7 @@ block_fill_ones(Data data){
|
||||||
block_fill_ones(data.data, data.size);
|
block_fill_ones(data.data, data.size);
|
||||||
}
|
}
|
||||||
internal void
|
internal void
|
||||||
block_copy(void *dst, void *src, umem size){
|
block_copy(void *dst, const void *src, umem size){
|
||||||
u8 *d = (u8*)dst;
|
u8 *d = (u8*)dst;
|
||||||
u8 *s = (u8*)src;
|
u8 *s = (u8*)src;
|
||||||
if (d < s){
|
if (d < s){
|
||||||
|
@ -1941,7 +1941,7 @@ internal Interval_i32
|
||||||
range_intersect(Interval_i32 a, Interval_i32 b){
|
range_intersect(Interval_i32 a, Interval_i32 b){
|
||||||
Interval_i32 result = {};
|
Interval_i32 result = {};
|
||||||
if (range_overlap(a, b)){
|
if (range_overlap(a, b)){
|
||||||
result = Ii32(max(a.min, b.min), min(a.max, b.max));
|
result = Ii32(Max(a.min, b.min), Min(a.max, b.max));
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -1949,7 +1949,7 @@ internal Interval_i64
|
||||||
range_intersect(Interval_i64 a, Interval_i64 b){
|
range_intersect(Interval_i64 a, Interval_i64 b){
|
||||||
Interval_i64 result = {};
|
Interval_i64 result = {};
|
||||||
if (range_overlap(a, b)){
|
if (range_overlap(a, b)){
|
||||||
result = Ii64(max(a.min, b.min), min(a.max, b.max));
|
result = Ii64(Max(a.min, b.min), Min(a.max, b.max));
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -1957,7 +1957,7 @@ internal Interval_u64
|
||||||
range_intersect(Interval_u64 a, Interval_u64 b){
|
range_intersect(Interval_u64 a, Interval_u64 b){
|
||||||
Interval_u64 result = {};
|
Interval_u64 result = {};
|
||||||
if (range_overlap(a, b)){
|
if (range_overlap(a, b)){
|
||||||
result = Iu64(max(a.min, b.min), min(a.max, b.max));
|
result = Iu64(Max(a.min, b.min), Min(a.max, b.max));
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -1965,26 +1965,26 @@ internal Interval_f32
|
||||||
range_intersect(Interval_f32 a, Interval_f32 b){
|
range_intersect(Interval_f32 a, Interval_f32 b){
|
||||||
Interval_f32 result = {};
|
Interval_f32 result = {};
|
||||||
if (range_overlap(a, b)){
|
if (range_overlap(a, b)){
|
||||||
result = If32(max(a.min, b.min), min(a.max, b.max));
|
result = If32(Max(a.min, b.min), Min(a.max, b.max));
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Interval_i32
|
internal Interval_i32
|
||||||
range_union(Interval_i32 a, Interval_i32 b){
|
range_union(Interval_i32 a, Interval_i32 b){
|
||||||
return(Ii32(min(a.min, b.min), max(a.max, b.max)));
|
return(Ii32(Min(a.min, b.min), Max(a.max, b.max)));
|
||||||
}
|
}
|
||||||
internal Interval_i64
|
internal Interval_i64
|
||||||
range_union(Interval_i64 a, Interval_i64 b){
|
range_union(Interval_i64 a, Interval_i64 b){
|
||||||
return(Ii64(min(a.min, b.min), max(a.max, b.max)));
|
return(Ii64(Min(a.min, b.min), Max(a.max, b.max)));
|
||||||
}
|
}
|
||||||
internal Interval_u64
|
internal Interval_u64
|
||||||
range_union(Interval_u64 a, Interval_u64 b){
|
range_union(Interval_u64 a, Interval_u64 b){
|
||||||
return(Iu64(min(a.min, b.min), max(a.max, b.max)));
|
return(Iu64(Min(a.min, b.min), Max(a.max, b.max)));
|
||||||
}
|
}
|
||||||
internal Interval_f32
|
internal Interval_f32
|
||||||
range_union(Interval_f32 a, Interval_f32 b){
|
range_union(Interval_f32 a, Interval_f32 b){
|
||||||
return(If32(min(a.min, b.min), max(a.max, b.max)));
|
return(If32(Min(a.min, b.min), Max(a.max, b.max)));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
|
@ -2942,7 +2942,7 @@ SCany(String_Const_u32 str){
|
||||||
#define string_expand(s) (i32)(s).size, (char*)(s).str
|
#define string_expand(s) (i32)(s).size, (char*)(s).str
|
||||||
|
|
||||||
internal String_Const_char string_empty = {"", 0};
|
internal String_Const_char string_empty = {"", 0};
|
||||||
internal String_Const_u8 string_u8_empty = {"", 0};
|
internal String_Const_u8 string_u8_empty = {(u8*)"", 0};
|
||||||
|
|
||||||
#define file_name_line_number_lit_u8 string_u8_litexpr(file_name_line_number)
|
#define file_name_line_number_lit_u8 string_u8_litexpr(file_name_line_number)
|
||||||
|
|
||||||
|
@ -5705,7 +5705,7 @@ string_split(Arena *arena, String_Const_char string, char *split_characters, i32
|
||||||
for (i32 j = 0; j < split_character_count; j += 1){
|
for (i32 j = 0; j < split_character_count; j += 1){
|
||||||
umem pos = string_find_first(prefix, split_characters[j]);
|
umem pos = string_find_first(prefix, split_characters[j]);
|
||||||
prefix = string_prefix(prefix, pos);
|
prefix = string_prefix(prefix, pos);
|
||||||
i = min(i, pos);
|
i = Min(i, pos);
|
||||||
}
|
}
|
||||||
if (prefix.size > 0){
|
if (prefix.size > 0){
|
||||||
string_list_push(arena, &list, prefix);
|
string_list_push(arena, &list, prefix);
|
||||||
|
@ -5726,7 +5726,7 @@ string_split(Arena *arena, String_Const_u8 string, u8 *split_characters, i32 spl
|
||||||
for (i32 j = 0; j < split_character_count; j += 1){
|
for (i32 j = 0; j < split_character_count; j += 1){
|
||||||
umem pos = string_find_first(prefix, split_characters[j]);
|
umem pos = string_find_first(prefix, split_characters[j]);
|
||||||
prefix = string_prefix(prefix, pos);
|
prefix = string_prefix(prefix, pos);
|
||||||
i = min(i, pos);
|
i = Min(i, pos);
|
||||||
}
|
}
|
||||||
if (prefix.size > 0){
|
if (prefix.size > 0){
|
||||||
string_list_push(arena, &list, prefix);
|
string_list_push(arena, &list, prefix);
|
||||||
|
@ -5747,7 +5747,7 @@ string_split(Arena *arena, String_Const_u16 string, u16 *split_characters, i32 s
|
||||||
for (i32 j = 0; j < split_character_count; j += 1){
|
for (i32 j = 0; j < split_character_count; j += 1){
|
||||||
umem pos = string_find_first(prefix, split_characters[j]);
|
umem pos = string_find_first(prefix, split_characters[j]);
|
||||||
prefix = string_prefix(prefix, pos);
|
prefix = string_prefix(prefix, pos);
|
||||||
i = min(i, pos);
|
i = Min(i, pos);
|
||||||
}
|
}
|
||||||
if (prefix.size > 0){
|
if (prefix.size > 0){
|
||||||
string_list_push(arena, &list, prefix);
|
string_list_push(arena, &list, prefix);
|
||||||
|
@ -5768,7 +5768,7 @@ string_split(Arena *arena, String_Const_u32 string, u32 *split_characters, i32 s
|
||||||
for (i32 j = 0; j < split_character_count; j += 1){
|
for (i32 j = 0; j < split_character_count; j += 1){
|
||||||
umem pos = string_find_first(prefix, split_characters[j]);
|
umem pos = string_find_first(prefix, split_characters[j]);
|
||||||
prefix = string_prefix(prefix, pos);
|
prefix = string_prefix(prefix, pos);
|
||||||
i = min(i, pos);
|
i = Min(i, pos);
|
||||||
}
|
}
|
||||||
if (prefix.size > 0){
|
if (prefix.size > 0){
|
||||||
string_list_push(arena, &list, prefix);
|
string_list_push(arena, &list, prefix);
|
||||||
|
|
|
@ -179,6 +179,10 @@ enum{
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
|
|
||||||
|
#if COMPILER_CL
|
||||||
|
#define __VA_OPT__(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define function static
|
#define function static
|
||||||
#define api(x)
|
#define api(x)
|
||||||
|
|
||||||
|
|
|
@ -696,6 +696,7 @@ map_set_binding_l(Mapping *mapping, Command_Map *map,
|
||||||
#define ParentMap(ID) map_set_parent(m, map, (ID))
|
#define ParentMap(ID) map_set_parent(m, map, (ID))
|
||||||
#define BindTextInput(F) map_set_binding_text_input(map, (F))
|
#define BindTextInput(F) map_set_binding_text_input(map, (F))
|
||||||
// TODO(allen): detect compiler and apply va args extensions correctly
|
// TODO(allen): detect compiler and apply va args extensions correctly
|
||||||
|
#if COMPILER_CL
|
||||||
#define Bind(F, K, ...) \
|
#define Bind(F, K, ...) \
|
||||||
map_set_binding_l(m, map, (F), InputEventKind_KeyStroke, (K), __VA_ARGS__, 0)
|
map_set_binding_l(m, map, (F), InputEventKind_KeyStroke, (K), __VA_ARGS__, 0)
|
||||||
#define BindRelease(F, K, ...) \
|
#define BindRelease(F, K, ...) \
|
||||||
|
@ -710,6 +711,24 @@ map_set_binding_l(m, map, (F), InputEventKind_MouseWheel, 0, __VA_ARGS__, 0)
|
||||||
map_set_binding_l(m, map, (F), InputEventKind_MouseMove, 0, __VA_ARGS__, 0)
|
map_set_binding_l(m, map, (F), InputEventKind_MouseMove, 0, __VA_ARGS__, 0)
|
||||||
#define BindCore(F, K, ...) \
|
#define BindCore(F, K, ...) \
|
||||||
map_set_binding_l(m, map, (F), InputEventKind_Core, (K), __VA_ARGS__, 0)
|
map_set_binding_l(m, map, (F), InputEventKind_Core, (K), __VA_ARGS__, 0)
|
||||||
|
#elif COMPILER_GCC
|
||||||
|
#define Bind(F, K, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_KeyStroke, (K), ##__VA_ARGS__, 0)
|
||||||
|
#define BindRelease(F, K, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_KeyRelease, (K), ##__VA_ARGS__, 0)
|
||||||
|
#define BindMouse(F, K, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_MouseButton, (K), ##__VA_ARGS__, 0)
|
||||||
|
#define BindMouseRelease(F, K, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_MouseButtonRelease, (K), ##__VA_ARGS__, 0)
|
||||||
|
#define BindMouseWheel(F, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_MouseWheel, 0, ##__VA_ARGS__, 0)
|
||||||
|
#define BindMouseMove(F, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_MouseMove, 0, ##__VA_ARGS__, 0)
|
||||||
|
#define BindCore(F, K, ...) \
|
||||||
|
map_set_binding_l(m, map, (F), InputEventKind_Core, (K), ##__VA_ARGS__, 0)
|
||||||
|
#else
|
||||||
|
#error "Unsupported compiler"
|
||||||
|
#endif
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
||||||
|
|
|
@ -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));
|
umem 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ setup_default_mapping(Mapping *mapping){
|
||||||
SelectMapping(mapping);
|
SelectMapping(mapping);
|
||||||
|
|
||||||
SelectMap(mapid_global);
|
SelectMap(mapid_global);
|
||||||
BindCore(default_startup , CoreCode_Startup);
|
BindCore(default_startup, CoreCode_Startup);
|
||||||
BindCore(default_try_exit, CoreCode_TryExit);
|
BindCore(default_try_exit, CoreCode_TryExit);
|
||||||
Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Control);
|
Bind(keyboard_macro_start_recording , KeyCode_U, KeyCode_Control);
|
||||||
Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Control, KeyCode_Shift);
|
Bind(keyboard_macro_finish_recording, KeyCode_U, KeyCode_Control, KeyCode_Shift);
|
||||||
|
|
|
@ -567,7 +567,7 @@ get_fancy_string_height__inner(Application_Links *app, Face_ID face, Fancy_Strin
|
||||||
if (string->face != 0){
|
if (string->face != 0){
|
||||||
Face_ID use_face = string->face;
|
Face_ID use_face = string->face;
|
||||||
Face_Metrics metrics = get_face_metrics(app, use_face);
|
Face_Metrics metrics = get_face_metrics(app, use_face);
|
||||||
result = max(result, metrics.line_height);
|
result = Max(result, metrics.line_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
@ -585,7 +585,7 @@ get_fancy_string_text_height__inner(Application_Links *app, Face_ID face, Fancy_
|
||||||
if (string->face != 0){
|
if (string->face != 0){
|
||||||
Face_ID use_face = string->face;
|
Face_ID use_face = string->face;
|
||||||
Face_Metrics metrics = get_face_metrics(app, use_face);
|
Face_Metrics metrics = get_face_metrics(app, use_face);
|
||||||
result = max(result, metrics.text_height);
|
result = Max(result, metrics.text_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
@ -603,7 +603,7 @@ draw_fancy_string__inner(Application_Links *app, Face_ID face, FColor fore, Fanc
|
||||||
}
|
}
|
||||||
if (use_face != 0){
|
if (use_face != 0){
|
||||||
Face_Metrics metrics = get_face_metrics(app, use_face);
|
Face_Metrics metrics = get_face_metrics(app, use_face);
|
||||||
base_line = max(base_line, metrics.ascent);
|
base_line = Max(base_line, metrics.ascent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ get_fancy_block_width(Application_Links *app, Face_ID face, Fancy_Block *block){
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
f32 w = get_fancy_line_width(app, face, node);
|
f32 w = get_fancy_line_width(app, face, node);
|
||||||
width = max(width, w);
|
width = Max(width, w);
|
||||||
}
|
}
|
||||||
return(width);
|
return(width);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,10 @@ typedef TCHAR Filename_Character;
|
||||||
//// WINDOWS END ////
|
//// WINDOWS END ////
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# error 4coder file not defined
|
#include <dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#define SLASH '/'
|
||||||
|
typedef char Filename_Character;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct Cross_Platform_File_Info{
|
struct Cross_Platform_File_Info{
|
||||||
|
@ -293,10 +296,12 @@ static b32
|
||||||
match_pattern(Filename_Character *name, Filename_Character *pattern){
|
match_pattern(Filename_Character *name, Filename_Character *pattern){
|
||||||
b32 match = false;
|
b32 match = false;
|
||||||
if (sizeof(*name) == 1){
|
if (sizeof(*name) == 1){
|
||||||
Absolutes absolutes = {};
|
String_Const_u8 name_str = SCu8(name);
|
||||||
String pattern_str = make_string_slowly(pattern);
|
String_Const_u8 pattern_str = SCu8(pattern);
|
||||||
get_absolutes(pattern_str, &absolutes, false, false);
|
List_String_Const_u8 list = {};
|
||||||
match = wildcard_match_c(&absolutes, name, false);
|
Node_String_Const_u8 node = { NULL, name_str };
|
||||||
|
string_list_push(&list, &node);
|
||||||
|
match = string_wildcard_match(list, pattern_str, StringMatch_Exact);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fprintf(stdout, "fatal error: wide characters not supported!\n");
|
fprintf(stdout, "fatal error: wide characters not supported!\n");
|
||||||
|
@ -306,9 +311,9 @@ match_pattern(Filename_Character *name, Filename_Character *pattern){
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cross_Platform_File_List
|
static Cross_Platform_File_List
|
||||||
get_file_list(Partition *part, Filename_Character *pattern, File_Filter *filter){
|
get_file_list(Arena *arena, Filename_Character *pattern, File_Filter *filter){
|
||||||
if (part == 0){
|
if (arena == 0){
|
||||||
fprintf(stdout, "fatal error: NULL part passed to %s\n", __FUNCTION__);
|
fprintf(stdout, "fatal error: NULL arena passed to %s\n", __FUNCTION__);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (pattern == 0){
|
if (pattern == 0){
|
||||||
|
@ -340,7 +345,7 @@ get_file_list(Partition *part, Filename_Character *pattern, File_Filter *filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
Filename_Character path_name[4096];
|
Filename_Character path_name[4096];
|
||||||
int32_t path_length = str_size(pattern);
|
int32_t path_length = cstring_length(pattern);
|
||||||
if (path_length + 1 > sizeof(path_name)){
|
if (path_length + 1 > sizeof(path_name)){
|
||||||
fprintf(stdout, "fatal error: path name too long for local buffer\n");
|
fprintf(stdout, "fatal error: path name too long for local buffer\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -380,11 +385,11 @@ get_file_list(Partition *part, Filename_Character *pattern, File_Filter *filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
Cross_Platform_File_List list = {};
|
Cross_Platform_File_List list = {};
|
||||||
Temp_Memory part_reset = begin_temp_memory(part);
|
Temp_Memory part_reset = begin_temp(arena);
|
||||||
|
|
||||||
int32_t rounded_char_size = (character_count*sizeof(Filename_Character) + 7)&(~7);
|
int32_t rounded_char_size = (character_count*sizeof(Filename_Character) + 7)&(~7);
|
||||||
int32_t memsize = rounded_char_size + file_count*sizeof(Cross_Platform_File_Info);
|
int32_t memsize = rounded_char_size + file_count*sizeof(Cross_Platform_File_Info);
|
||||||
void *mem = push_array(part, uint8_t, memsize);
|
void *mem = push_array(arena, uint8_t, memsize);
|
||||||
if (mem == 0){
|
if (mem == 0){
|
||||||
fprintf(stdout, "fatal error: not enough memory on the partition for a file list.\n");
|
fprintf(stdout, "fatal error: not enough memory on the partition for a file list.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -426,7 +431,7 @@ get_file_list(Partition *part, Filename_Character *pattern, File_Filter *filter)
|
||||||
if (name[0] != '.' && (is_folder || filter(name, size))){
|
if (name[0] != '.' && (is_folder || filter(name, size))){
|
||||||
if (info_ptr + 1 > info_ptr_end || char_ptr + size + 1 > char_ptr_end){
|
if (info_ptr + 1 > info_ptr_end || char_ptr + size + 1 > char_ptr_end){
|
||||||
memset(&list, 0, sizeof(list));
|
memset(&list, 0, sizeof(list));
|
||||||
end_temp_memory(part_reset);
|
end_temp(part_reset);
|
||||||
closedir(dir_handle);
|
closedir(dir_handle);
|
||||||
return(list);
|
return(list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ internal void fm__swap_ptr(char **A, char **B);
|
||||||
#elif COMPILER_GCC
|
#elif COMPILER_GCC
|
||||||
|
|
||||||
#define fm_add_to_line(line, str, ...) do{ \
|
#define fm_add_to_line(line, str, ...) do{ \
|
||||||
snprintf(line.build_options, line.build_max, "%s "str, \
|
snprintf(line.build_options, line.build_max, "%s " str, \
|
||||||
line.build_options_prev, ##__VA_ARGS__); \
|
line.build_options_prev, ##__VA_ARGS__); \
|
||||||
fm__swap_ptr(&line.build_options, &line.build_options_prev); \
|
fm__swap_ptr(&line.build_options, &line.build_options_prev); \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
@ -434,7 +434,7 @@ fm_popdir(Temp_Dir temp){
|
||||||
chdir(temp.dir);
|
chdir(temp.dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Partition
|
internal Arena
|
||||||
fm_init_system(){
|
fm_init_system(){
|
||||||
return(fm__init_memory());
|
return(fm__init_memory());
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ internal void
|
||||||
fm_slash_fix(char *path){}
|
fm_slash_fix(char *path){}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
fm_make_folder_if_missing(Partition *part, char *dir){
|
fm_make_folder_if_missing(Arena *arena, char *dir){
|
||||||
systemf("mkdir -p %s", dir);
|
systemf("mkdir -p %s", dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,15 +508,9 @@ fm_copy_file(char *file, char *newname){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
fm_copy_all(char *source, char *tag, char *folder){
|
fm_copy_all(char *source, char *folder){
|
||||||
if (source){
|
fprintf(stdout, "copy %s to %s\n", source, folder);
|
||||||
fprintf(stdout, "copy %s/%s to %s\n", source, tag, folder);
|
systemf("cp -rf %s %s > /dev/null", source, folder);
|
||||||
systemf("cp -f %s/%s %s > /dev/null", source, tag, folder);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
fprintf(stdout, "copy %s to %s\n", tag, folder);
|
|
||||||
systemf("cp -f %s %s > /dev/null", tag, folder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|
|
@ -42,7 +42,7 @@ layout_nearest_pos_to_xy(Layout_Item_List list, Vec2_f32 p){
|
||||||
// NOTE(allen): One of dist0 and dist1 are negative, but certainly not both.
|
// NOTE(allen): One of dist0 and dist1 are negative, but certainly not both.
|
||||||
// 1. Take the negative one.
|
// 1. Take the negative one.
|
||||||
// 2. If the negative distance is larger than closest_x, then this is closer.
|
// 2. If the negative distance is larger than closest_x, then this is closer.
|
||||||
f32 neg_dist = min(dist0, dist1);
|
f32 neg_dist = Min(dist0, dist1);
|
||||||
if (closest_x < neg_dist){
|
if (closest_x < neg_dist){
|
||||||
closest_x = neg_dist;
|
closest_x = neg_dist;
|
||||||
closest_match = item->index;
|
closest_match = item->index;
|
||||||
|
|
|
@ -80,8 +80,8 @@ layout_write(Arena *arena, Layout_Item_List *list, i64 index, u32 codepoint, Lay
|
||||||
}
|
}
|
||||||
|
|
||||||
list->item_count += 1;
|
list->item_count += 1;
|
||||||
list->manifested_index_range.min = min(list->manifested_index_range.min, index);
|
list->manifested_index_range.min = Min(list->manifested_index_range.min, index);
|
||||||
list->manifested_index_range.max = max(list->manifested_index_range.max, index);
|
list->manifested_index_range.max = Max(list->manifested_index_range.max, index);
|
||||||
|
|
||||||
if (!HasFlag(flags, LayoutItemFlag_Ghost_Character)){
|
if (!HasFlag(flags, LayoutItemFlag_Ghost_Character)){
|
||||||
block->character_count += 1;
|
block->character_count += 1;
|
||||||
|
@ -92,7 +92,7 @@ layout_write(Arena *arena, Layout_Item_List *list, i64 index, u32 codepoint, Lay
|
||||||
item->codepoint = codepoint;
|
item->codepoint = codepoint;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
item->rect = rect;
|
item->rect = rect;
|
||||||
list->height = max(list->height, rect.y1);
|
list->height = Max(list->height, rect.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
|
@ -90,8 +90,8 @@ profile_parse_record(Arena *arena, Profile_Inspection *insp,
|
||||||
slot = profile_parse_get_slot(arena, insp, location, name);
|
slot = profile_parse_get_slot(arena, insp, location, name);
|
||||||
node->time.max = record->time;
|
node->time.max = record->time;
|
||||||
node->closed = true;
|
node->closed = true;
|
||||||
total_time_range->min = min(total_time_range->min, node->time.min);
|
total_time_range->min = Min(total_time_range->min, node->time.min);
|
||||||
total_time_range->max = max(total_time_range->max, node->time.max);
|
total_time_range->max = Max(total_time_range->max, node->time.max);
|
||||||
record = record->next;
|
record = record->next;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -304,7 +304,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
|
||||||
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
|
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
|
||||||
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
|
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
|
||||||
f32 w = get_fancy_string_width(app, face_id, fstr);
|
f32 w = get_fancy_string_width(app, face_id, fstr);
|
||||||
nav_bar_w = max(nav_bar_w, w);
|
nav_bar_w = Max(nav_bar_w, w);
|
||||||
}
|
}
|
||||||
y.min += line_height + 2.f;
|
y.min += line_height + 2.f;
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
|
||||||
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
|
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
|
||||||
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
|
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
|
||||||
f32 w = get_fancy_string_width(app, face_id, fstr);
|
f32 w = get_fancy_string_width(app, face_id, fstr);
|
||||||
nav_bar_w = max(nav_bar_w, w);
|
nav_bar_w = Max(nav_bar_w, w);
|
||||||
}
|
}
|
||||||
y.min += line_height + 2.f;
|
y.min += line_height + 2.f;
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
|
|
||||||
static String_Const_char
|
static String_Const_char
|
||||||
push_stringfv(Arena *arena, char *format, va_list args){
|
push_stringfv(Arena *arena, char *format, va_list args){
|
||||||
|
va_list args2;
|
||||||
|
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, args);
|
vsnprintf(result.str, result.size, format, args2);
|
||||||
result.size -= 1;
|
result.size -= 1;
|
||||||
result.str[result.size] = 0;
|
result.str[result.size] = 0;
|
||||||
return(result);
|
return(result);
|
||||||
|
|
|
@ -114,7 +114,7 @@ tutorial_render(Application_Links *app, Frame_Info frame_info, View_ID view_id){
|
||||||
|
|
||||||
f32 h0 = get_fancy_line_height(app, 0, &slide.short_details);
|
f32 h0 = get_fancy_line_height(app, 0, &slide.short_details);
|
||||||
f32 h1 = get_fancy_line_height(app, 0, slide.long_details.first);
|
f32 h1 = get_fancy_line_height(app, 0, slide.long_details.first);
|
||||||
f32 title_height = max(h0, h1);
|
f32 title_height = Max(h0, h1);
|
||||||
|
|
||||||
////////
|
////////
|
||||||
|
|
||||||
|
|
|
@ -1,51 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Store the real CWD
|
# If any command errors, stop the script
|
||||||
REAL_PWD="$PWD"
|
set -e
|
||||||
|
|
||||||
# Find the code home folder
|
# Store the real CWD
|
||||||
TARGET_FILE="$0"
|
ME="$(readlink -f "$0")"
|
||||||
cd `dirname $TARGET_FILE`
|
LOCATION="$(dirname "$ME")"
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
CODE_HOME="$(dirname "$LOCATION")"
|
||||||
while [ -L "$TARGET_FILE" ]
|
|
||||||
do
|
|
||||||
TARGET_FILE=`readlink $TARGET_FILE`
|
|
||||||
cd `dirname $TARGET_FILE`
|
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
|
||||||
done
|
|
||||||
PHYS_DIR=`pwd -P`
|
|
||||||
SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
|
|
||||||
code_home=$(dirname "$SCRIPT_FILE")
|
|
||||||
|
|
||||||
# Find the most reasonable candidate build file
|
# Find the most reasonable candidate build file
|
||||||
SOURCE="$1"
|
SOURCE="$1"
|
||||||
if [ -z "$SOURCE" ]; then
|
if [ -z "$SOURCE" ]; then
|
||||||
SOURCE="$code_home/4coder_default_bindings.cpp"
|
SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TARGET_FILE="$SOURCE"
|
|
||||||
cd `dirname $TARGET_FILE`
|
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
|
||||||
while [ -L "$TARGET_FILE" ]
|
|
||||||
do
|
|
||||||
TARGET_FILE=`readlink $TARGET_FILE`
|
|
||||||
cd `dirname $TARGET_FILE`
|
|
||||||
TARGET_FILE=`basename $TARGET_FILE`
|
|
||||||
done
|
|
||||||
PHYS_DIR=`pwd -P`
|
|
||||||
SOURCE=$PHYS_DIR/$TARGET_FILE
|
|
||||||
|
|
||||||
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g"
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g"
|
||||||
arch=-m64
|
arch=-m64
|
||||||
|
|
||||||
cd "$REAL_PWD"
|
|
||||||
preproc_file=4coder_command_metadata.i
|
preproc_file=4coder_command_metadata.i
|
||||||
meta_macros="-DMETA_PASS"
|
meta_macros="-DMETA_PASS"
|
||||||
g++ -I"$code_home" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file
|
g++ -I"$CODE_HOME" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file
|
||||||
g++ -I"$code_home" $opts $debug -std=gnu++0x "$code_home/4coder_metadata_generator.cpp" -o metadata_generator
|
g++ -I"$CODE_HOME" $opts $debug -std=gnu++0x "$CODE_HOME/4coder_metadata_generator.cpp" -o "$CODE_HOME/metadata_generator"
|
||||||
./metadata_generator -R "$code_home" "$PWD/$preproc_file"
|
"$CODE_HOME/metadata_generator" -R "$CODE_HOME" "$PWD/$preproc_file"
|
||||||
|
|
||||||
g++ -I"$code_home" $arch $opts $debug -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
g++ -I"$CODE_HOME" $arch $opts $debug -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
||||||
|
|
||||||
rm metadata_generator
|
rm "$CODE_HOME/metadata_generator"
|
||||||
rm $preproc_file
|
rm $preproc_file
|
||||||
|
|
|
@ -112,7 +112,7 @@ out vec4 out_color;
|
||||||
|
|
||||||
float rectangle_sd(vec2 p, vec2 b){
|
float rectangle_sd(vec2 p, vec2 b){
|
||||||
vec2 d = abs(p) - b;
|
vec2 d = abs(p) - b;
|
||||||
return(length(max(d, vec2(0.0, 0.0))) + min(max(d.x, d.y), 0.0));
|
return(length(Max(d, vec2(0.0, 0.0))) + Min(max(d.x, d.y), 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
|
|
Loading…
Reference in New Issue