Merge branch 'master' of https://bitbucket.org/4coder/4coder
commit
cbd60d136c
|
@ -119,9 +119,9 @@ execute_standard_build_search(Application_Links *app, View_Summary *view,
|
|||
return(result);
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
// NOTE(allen): Build search rule for linux.
|
||||
// NOTE(allen): Build search rule for linux and mac.
|
||||
static int32_t
|
||||
execute_standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer, String *dir, String *command, bool32 perform_backup){
|
||||
char dir_space[512];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -252,11 +252,13 @@ load_project_from_config_data(Application_Links *app, Partition *part, char *con
|
|||
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
#define FKEY_COMMAND "fkey_command_win"
|
||||
# define FKEY_COMMAND "fkey_command_win"
|
||||
#elif defined(__linux__)
|
||||
#define FKEY_COMMAND "fkey_command_linux"
|
||||
# define FKEY_COMMAND "fkey_command_linux"
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
# define FKEY_COMMAND "fkey_command_mac"
|
||||
#else
|
||||
#error no project configuration names for this platform
|
||||
# error no project configuration names for this platform
|
||||
#endif
|
||||
|
||||
int32_t index = 0;
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
|
||||
# if defined(__gnu_linux__)
|
||||
# define IS_LINUX
|
||||
# else
|
||||
# elif defined(__APPLE__) && defined(__MACH__)
|
||||
# define IS_MAC
|
||||
#else
|
||||
# error This compiler/platform combo is not supported yet
|
||||
# endif
|
||||
|
||||
|
|
2
build.sh
2
build.sh
|
@ -5,7 +5,7 @@ if [ -z "$BUILD_MODE" ]; then
|
|||
BUILD_MODE="-DDEV_BUILD"
|
||||
fi
|
||||
|
||||
WARNINGS="-Wno-write-strings"
|
||||
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
||||
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
||||
|
||||
g++ $WARNINGS $FLAGS meta/build.cpp -g -o ../build/build
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# NOTE(allen): This code here is pulled from stack exchange, it could totally be wrong
|
||||
# but I just don't know. The goal is to get the path to the buildsuper.sh script so that
|
||||
# path can be used as an include path which allows a file in any folder to be built in place.
|
||||
SCRIPT_FILE=$(readlink -f "$0")
|
||||
echo "Building custom_4coders.so from $SOURCE ..."
|
||||
|
||||
# Find the code home folder
|
||||
|
||||
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
|
||||
TARGET_FILE="$0"
|
||||
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`
|
||||
SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
|
||||
CODE_HOME=$(dirname "$SCRIPT_FILE")
|
||||
|
||||
# Find the most reasonable candidate build file
|
||||
|
||||
SOURCE="$1"
|
||||
if [ -z "$SOURCE" ]; then
|
||||
SOURCE="$CODE_HOME/4coder_default_bindings.cpp"
|
||||
fi
|
||||
|
||||
echo "Building custom_4coders.so from $SOURCE ..."
|
||||
# NOTE(allen): Copied from stack exchange, hope it's reasonable -- readlink doesn't work on mac
|
||||
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
|
||||
|
||||
SOURCE=$(readlink -f "$SOURCE")
|
||||
|
||||
g++ -I"$CODE_HOME" -Wno-write-strings -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
||||
FLAGS="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings"
|
||||
g++ -I"$CODE_HOME" $FLAGS -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
||||
|
||||
|
|
|
@ -317,7 +317,6 @@ generate_style(){
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// Meta Parse Rules
|
||||
//
|
||||
|
|
|
@ -28,6 +28,13 @@ static char platform_correct_slash = '\\';
|
|||
#define SLASH "/"
|
||||
static char platform_correct_slash = '/';
|
||||
|
||||
#elif defined(IS_MAC)
|
||||
# define ONLY_WINDOWS(x) (void)0
|
||||
# define ONLY_LINUX(x) (void)0
|
||||
|
||||
#define SLASH "/"
|
||||
static char platform_correct_slash = '/';
|
||||
|
||||
#else
|
||||
# define ONLY_WINDOWS(x) (void)0
|
||||
# define ONLY_LINUX(x) (void)0
|
||||
|
@ -209,8 +216,7 @@ make_folder_if_missing(char *dir, char *folder){
|
|||
|
||||
static void
|
||||
clear_folder(char *folder){
|
||||
systemf("del /S /Q /F %s\\* & rmdir /S /Q %s & mkdir %s",
|
||||
folder, folder, folder);
|
||||
systemf("del /S /Q /F %s\\* & rmdir /S /Q %s & mkdir %s", folder, folder, folder);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -269,7 +275,7 @@ zip(char *parent, char *folder, char *dest){
|
|||
systemf("copy %s\\4tech_gobble.zip %s & del %s\\4tech_gobble.zip", cdir, dest, cdir);
|
||||
}
|
||||
|
||||
#elif defined(IS_LINUX)
|
||||
#elif defined(IS_LINUX) || defined(IS_MAC)
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
@ -281,8 +287,8 @@ pushdir(char *dir){
|
|||
int32_t chresult = chdir(dir);
|
||||
if (result == 0 || chresult != 0){
|
||||
printf("trying pushdir %s\n", dir);
|
||||
assert(result != 0);
|
||||
assert(chresult == 0);
|
||||
Assert(result != 0);
|
||||
Assert(chresult == 0);
|
||||
}
|
||||
return(temp);
|
||||
}
|
||||
|
@ -402,6 +408,7 @@ zip(char *parent, char *folder, char *file){
|
|||
Temp_Dir temp = pushdir(parent);
|
||||
printf("PARENT DIR: %s\n", parent);
|
||||
systemf("zip -r %s %s", file, folder);
|
||||
|
||||
popdir(temp);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#if defined(IS_WINDOWS)
|
||||
#define EXE ".exe"
|
||||
#elif defined(IS_LINUX)
|
||||
#elif defined(IS_LINUX) || defined(IS_MAC)
|
||||
#define EXE ""
|
||||
#else
|
||||
#error No EXE format specified for this OS
|
||||
|
@ -40,26 +40,26 @@
|
|||
|
||||
#if defined(IS_WINDOWS)
|
||||
#define PDB ".pdb"
|
||||
#elif defined(IS_LINUX)
|
||||
#elif defined(IS_LINUX) || defined(IS_MAC)
|
||||
#define PDB ""
|
||||
#else
|
||||
#error No EXE format specified for this OS
|
||||
#error No PDB format specified for this OS
|
||||
#endif
|
||||
|
||||
#if defined(IS_WINDOWS)
|
||||
#define DLL ".dll"
|
||||
#elif defined(IS_LINUX)
|
||||
#elif defined(IS_LINUX) || defined(IS_MAC)
|
||||
#define DLL ".so"
|
||||
#else
|
||||
#error No EXE format specified for this OS
|
||||
#error No DLL format specified for this OS
|
||||
#endif
|
||||
|
||||
#if defined(IS_WINDOWS)
|
||||
#define BAT ".bat"
|
||||
#elif defined(IS_LINUX)
|
||||
#elif defined(IS_LINUX) || defined(IS_MAC)
|
||||
#define BAT ".sh"
|
||||
#else
|
||||
#error No EXE format specified for this OS
|
||||
#error No BAT format specified for this OS
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -246,8 +246,10 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_
|
|||
}
|
||||
|
||||
|
||||
#define GCC_OPTS \
|
||||
"-Wno-write-strings -D_GNU_SOURCE -fPIC " \
|
||||
#define GCC_OPTS \
|
||||
"-Wno-write-strings -Wno-comment -Wno-switch " \
|
||||
"-Wno-null-dereference " \
|
||||
"-D_GNU_SOURCE -fPIC " \
|
||||
"-fno-threadsafe-statics -pthread"
|
||||
|
||||
#define GCC_X86 "-m32"
|
||||
|
@ -327,7 +329,8 @@ build_gcc(u32 flags, char *code_path, char *code_file, char *out_path, char *out
|
|||
build_ap(line, "-DFRED_KEEP_ASSERT");
|
||||
}
|
||||
|
||||
build_ap(line, "%s/%s", code_path, code_file);
|
||||
build_ap(line, "-I\"%s\"", code_path);
|
||||
build_ap(line, "\"%s/%s\"", code_path, code_file);
|
||||
|
||||
if (flags & LIBS){
|
||||
build_ap(line, GCC_LIBS);
|
||||
|
@ -380,6 +383,8 @@ buildsuper(char *code_path, char *out_path, char *filename, b32 x86_build){
|
|||
#define PLAT_LAYER "win32_4ed.cpp"
|
||||
#elif defined(IS_LINUX)
|
||||
#define PLAT_LAYER "linux_4ed.cpp"
|
||||
#elif defined(IS_MAC)
|
||||
#define PLAT_LAYER "mac_4ed.m"
|
||||
#else
|
||||
#error No platform layer defined for this OS.
|
||||
#endif
|
||||
|
@ -560,6 +565,8 @@ get_4coder_dist_name(String *zip_file, b32 OS_specific, char *folder, char *tier
|
|||
append_sc(zip_file, "-win");
|
||||
#elif defined(IS_LINUX) && defined(IS_64BIT)
|
||||
append_sc(zip_file, "-linux");
|
||||
#elif defined(IS_MAC) && defined(IS_64BIT)
|
||||
append_sc(zip_file, "-mac");
|
||||
#else
|
||||
#error No OS string for zips on this OS
|
||||
#endif
|
||||
|
|
|
@ -572,7 +572,7 @@ main_fsm(Cpp_Lex_FSM fsm, uint8_t pp_state, uint8_t c, bool32 ignore_string_deli
|
|||
|
||||
case LS_hex:
|
||||
{
|
||||
int is_hex = c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F' || c >= 128;
|
||||
int is_hex = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || c >= 128;
|
||||
if (!is_hex){
|
||||
fsm.emit_token = true;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
1
|
||||
0
|
||||
74
|
||||
86
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
||||
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive"
|
||||
|
||||
g++ $WARNINGS $FLAGS ../code/string/string_builder.cpp -g -o ../build/string_builder
|
||||
|
||||
pushd string
|
||||
../../build/string_builder
|
||||
popd
|
||||
|
|
@ -66,7 +66,7 @@ char_is_upper(char c)
|
|||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_upper_utf8(char c)
|
||||
/* DOC(If c is an uppercase letter this call returns true.) */{
|
||||
return (c >= 'A' && c <= 'Z' || c >= 128);
|
||||
return ((c >= 'A' && c <= 'Z') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
|
@ -78,7 +78,7 @@ char_is_lower(char c)
|
|||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_lower_utf8(u8_4tech c)
|
||||
/* DOC(If c is a lower letter this call returns true.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 128);
|
||||
return ((c >= 'a' && c <= 'z') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE char
|
||||
|
@ -102,61 +102,61 @@ char_is_whitespace(char c)
|
|||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_numeric(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_');
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_');
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_numeric_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character including underscore, or is a part of a UTF8 sequence outside of ASCII.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '_' || c >= 128);
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_numeric_true(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character no including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9');
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'));
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_numeric_true_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any alphanumeric character no including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c >= 128);
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character including underscore.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_');
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_');
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character including underscore, or is a part of a UTF8 sequence outside of ASCII.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_' || c >= 128);
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_true(char c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z');
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_alpha_true_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any alphabetic character, or is a part of a UTF8 sequence outside of ASCII.) */{
|
||||
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= 128);
|
||||
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_hex(char c)
|
||||
/* DOC(This call returns non-zero if c is any valid hexadecimal digit.) */{
|
||||
return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f');
|
||||
return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'));
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_hex_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any valid hexadecimal digit, or is a part of a UTF8 sequence outside of ASCII.) */{
|
||||
return (c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f' || c >= 128);
|
||||
return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
|
@ -168,7 +168,7 @@ char_is_numeric(char c)
|
|||
API_EXPORT_INLINE FSTRING_INLINE b32_4tech
|
||||
char_is_numeric_utf8(u8_4tech c)
|
||||
/* DOC(This call returns non-zero if c is any valid decimal digit, or is a part of a UTF8 sequence outside of ASCII.) */{
|
||||
return (c >= '0' && c <= '9' || c >= 128);
|
||||
return ((c >= '0' && c <= '9') || (unsigned char)c >= 128);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1452,17 +1452,11 @@ space in dest this call returns non-zero.) */{
|
|||
API_EXPORT FSTRING_LINK i32_4tech
|
||||
u64_to_str_size(uint64_t x)/*
|
||||
DOC(This call returns the number of bytes required to represent x as a string.) */{
|
||||
i32_4tech size;
|
||||
if (x < 0){
|
||||
size = 0;
|
||||
}
|
||||
else{
|
||||
size = 1;
|
||||
i32_4tech size = 1;
|
||||
x /= 10;
|
||||
while (x != 0){
|
||||
x /= 10;
|
||||
while (x != 0){
|
||||
x /= 10;
|
||||
++size;
|
||||
}
|
||||
++size;
|
||||
}
|
||||
return(size);
|
||||
}
|
||||
|
|
|
@ -425,9 +425,8 @@ int main(){
|
|||
|
||||
else if (token->type == CPP_PP_INCLUDE){
|
||||
token = get_next_token(&pcontext);
|
||||
|
||||
if (token && token->type == CPP_PP_INCLUDE_FILE){
|
||||
lexeme = get_lexeme(*token, pcontext.data);;
|
||||
lexeme = get_lexeme(*token, pcontext.data);
|
||||
lexeme.size -= 2;
|
||||
lexeme.str += 1;
|
||||
|
||||
|
@ -481,7 +480,7 @@ int main(){
|
|||
}
|
||||
|
||||
#define FTECH_FILE_MOVING_IMPLEMENTATION
|
||||
#include "..\meta\4tech_file_moving.h"
|
||||
#include "../meta/4tech_file_moving.h"
|
||||
|
||||
// BOTTOM
|
||||
|
||||
|
|
Loading…
Reference in New Issue