diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 2e5074e8..6f7376c7 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -3213,26 +3213,16 @@ execute_standard_build_search(Application_Links *app, View_Summary *view, // NOTE(allen): Build search rule for linux. static int32_t -execute_standard_build_search(Application_Links *app, View_Summary *view, - Buffer_Summary *active_buffer, - String *dir, String *command, int32_t perform_backup){ +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]; String dir_copy = make_fixed_width_string(dir_space); copy(&dir_copy, *dir); - int32_t result = standard_build_search(app, view, - active_buffer, - dir, command, false, true, - make_lit_string("build.sh"), - make_lit_string("build.sh")); + int32_t result = standard_build_search(app, view, active_buffer, dir, command, 0, 1, make_lit_string("build.sh"), make_lit_string("build.sh")); if (!result){ - result = standard_build_search(app, view, - active_buffer, - &dir_copy, command, perform_backup, false, - make_lit_string("Makefile"), - make_lit_string("make")); + result = standard_build_search(app, view, active_buffer, &dir_copy, command, perform_backup, 0, make_lit_string("Makefile"), make_lit_string("make")); } return(result); diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index a49b2218..efc77e53 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -1773,9 +1773,6 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file, else if (x_left_over <= x_gain_threshold){ this_score = 1; } - else{ - this_score += FLOOR32(0.5f*x_shift_adjusted); - } if (this_score > best_score){ best_score = this_score; diff --git a/Makefile b/Makefile deleted file mode 100755 index 6a9abd02..00000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CPP_FILES := $(wildcard *.cpp) $(wildcard **/*.cpp) -C_FILES := $(wildcard *.c) $(wildcard **/*.c) -H_FILES := $(wildcard *.h) $(wildcard **/*.h) - -WARNINGS := -Wno-write-strings -FLAGS := -D_GNU_SOURCE -fPIC -fpermissive - -debug: FLAGS += -DDEV_BUILD -debug: ../build/build - -package: FLAGS += -DPACKAGE -package: ../build/build - -site: FLAGS += -DSITE_BUILD -site: ../build/build - -../build/build: $(CPP_FILES) $(C_FILES) $(H_FILES) - g++ $(WARNINGS) $(FLAGS) build.cpp -g -o $@ - ../build/build - -clean: - $(RM) ../build/build ../build/fsmgen ../build/metagen ../build/4ed_app.so ../build/4ed - - - diff --git a/build.cpp b/build.cpp index 27ec3229..ff5fde4a 100644 --- a/build.cpp +++ b/build.cpp @@ -83,6 +83,13 @@ static void copy_file(char *path, char *file, char *folder1, char *folder2, char static void copy_all(char *source, char *tag, char *folder); static void zip(char *parent, char *folder, char *dest); +typedef struct Temp_Dir{ + char dir[512]; +} Temp_Dir; + +static Temp_Dir pushdir(char *dir); +static void popdir(Temp_Dir temp); + #if defined(IS_WINDOWS) typedef uint32_t DWORD; @@ -116,6 +123,12 @@ extern "C" BOOL WINAPI CopyFileA(_In_ LPCTSTR lpExistingFileName, _In_ LPCTSTR l static uint64_t perf_frequency; +static Temp_Dir +pushdir(char *dir){} + +static void +popdir(Temp_Dir temp){} + static void init_time_system(){ LARGE_INTEGER lint; @@ -262,12 +275,8 @@ zip(char *parent, char *folder, char *dest){ #include #include -typedef struct Temp_Dir{ - char dir[512]; -} Temp_Dir; - static Temp_Dir -linux_pushd(char *dir){ +pushdir(char *dir){ Temp_Dir temp; char *result = getcwd(temp.dir, sizeof(temp.dir)); int32_t chresult = chdir(dir); @@ -280,7 +289,7 @@ linux_pushd(char *dir){ } static void -linux_popd(Temp_Dir temp){ +popdir(Temp_Dir temp){ chdir(temp.dir); } @@ -312,14 +321,14 @@ static void execute(char *dir, char *str, char *args){ if (dir){ if (args){ - Temp_Dir temp = linux_pushd(dir); + Temp_Dir temp = pushdir(dir); systemf("%s %s", str, args); - linux_popd(temp); + popdir(temp); } else{ - Temp_Dir temp = linux_pushd(dir); + Temp_Dir temp = pushdir(dir); systemf("%s", str); - linux_popd(temp); + popdir(temp); } } else{ @@ -386,9 +395,9 @@ copy_all(char *source, char *tag, char *folder){ static void zip(char *parent, char *folder, char *file){ - Temp_Dir temp = linux_pushd(parent); + Temp_Dir temp = pushdir(parent); systemf("zip -r %s %s", file, folder); - linux_popd(temp); + popdir(temp); } #else @@ -588,7 +597,7 @@ build_cl(uint32_t flags, char *code_path, char *code_file, char *out_path, char "-fno-threadsafe-statics -pthread" #define GCC_INCLUDES \ -"-I../foreign" +"-I../foreign -I../code" #define GCC_SITE_INCLUDES \ "-I../../code" @@ -659,12 +668,9 @@ build_gcc(uint32_t flags, char *code_path, char *code_file, char *out_path, char swap_ptr(&line.build_options, &line.build_options_prev); - // TODO(allen): Abstract this out. -#if defined(IS_LINUX) - Temp_Dir temp = linux_pushd(out_path); + Temp_Dir temp = pushdir(out_path); systemf("g++ %s -o %s", line.build_options, out_file); - linux_popd(temp); -#endif + popdir(temp); } static void @@ -690,12 +696,12 @@ buildsuper(char *code_path, char *out_path, char *filename){ #elif defined(IS_GCC) - Temp_Dir temp = linux_pushd(out_path); + Temp_Dir temp = pushdir(out_path); systemf("\"%s/buildsuper.sh\" %s", code_path, filename); - linux_popd(temp); + popdir(temp); #else #error The build rule for this compiler is not ready @@ -706,7 +712,7 @@ buildsuper(char *code_path, char *out_path, char *filename){ #define D_META_FSM_DIR "../meta/fsmgen" #define D_META_GEN_DIR "../meta/metagen" #define D_BUILD_DIR "../build" -#define D_BUILD_SITE_DIR "../build/site" +#define D_BUILD_SITE_DIR "../../build/site" #define D_SITE_GEN_DIR "../../build/site/sitegen" #define D_SITE_DIR "../site" @@ -749,7 +755,7 @@ init_global_strings(){ int32_t size = (1 << 12); char *base = (char*)malloc(size); String builder = make_string_cap(base, 0, size); - String term = make_string("\0", 1); + String term = make_string((void*)"\0", 1); META_DIR = get_head(builder); append_sc(&builder, D_META_DIR); @@ -844,7 +850,7 @@ static void metagen(char *cdir){ { BEGIN_TIME_SECTION(); - build(OPTS | DEBUG_INFO, cdir, "4ed_metagen.cpp", META_DIR, "metagen", 0); + build(OPTS | INCLUDES | DEBUG_INFO, cdir, "4ed_metagen.cpp", META_DIR, "metagen", 0); END_TIME_SECTION("build metagen"); } @@ -910,7 +916,7 @@ static void site_build(char *cdir, uint32_t flags){ { BEGIN_TIME_SECTION(); - build(OPTS | SITE_INCLUDES | flags, cdir, "site/sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0); + build(OPTS | SITE_INCLUDES | flags, cdir, "sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0); END_TIME_SECTION("build sitegen"); } @@ -918,9 +924,9 @@ site_build(char *cdir, uint32_t flags){ BEGIN_TIME_SECTION(); #if defined(IS_WINDOWS) - systemf("pushd %s\\site & ..\\..\\build\\site\\sitegen .. source_material ..\\..\\site", cdir); + systemf("..\\..\\build\\site\\sitegen .. source_material ..\\..\\site"); #else - systemf("pushd %s/site & ../../build/site/sitegen .. source_material ../../site", cdir); + systemf("../../build/site/sitegen .. source_material ../../site"); #endif END_TIME_SECTION("run sitegen"); diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..f7880837 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +WARNINGS="-Wno-write-strings" +FLAGS="-D_GNU_SOURCE -fPIC -fpermissive -DDEV_BUILD" + +g++ $WARNINGS $FLAGS build.cpp -g -o ../build/build +../build/build + + + diff --git a/original.Makefile b/original.Makefile index a98ca7ea..52d97b2f 100644 --- a/original.Makefile +++ b/original.Makefile @@ -1,63 +1,22 @@ CPP_FILES := $(wildcard *.cpp) $(wildcard **/*.cpp) C_FILES := $(wildcard *.c) $(wildcard **/*.c) H_FILES := $(wildcard *.h) $(wildcard **/*.h) + WARNINGS := -Wno-write-strings -PLAT_LINKS := -L/usr/local/lib -lX11 -lpthread -lm -lrt -lGL -ldl -lXfixes -lfreetype -lfontconfig -FLAGS := -D_GNU_SOURCE -fPIC -fno-threadsafe-statics -pthread -I../foreign $(shell pkg-config --cflags freetype2) +FLAGS := -D_GNU_SOURCE -fPIC -fpermissive -# main stuff +debug: FLAGS += -DDEV_BUILD +debug: ../build/build -debug: FLAGS += -DFRED_INTERNAL=1 -DFRED_SUPER=1 -g -O0 -debug: ../4ed_app.so ../4ed +package: FLAGS += -DPACKAGE +package: ../build/build -../metagen: $(CPP_FILES) $(C_FILES) $(H_FILES) - g++ $(WARNINGS) $(FLAGS) 4ed_metagen.cpp -iquoteforeign -o $@ +site: FLAGS += -DSITE_BUILD +site: ../build/build -../4ed_app.so: $(CPP_FILES) $(C_FILES) $(H_FILES) - g++ $(WARNINGS) $(FLAGS) -shared 4ed_app_target.cpp -iquoteforeign -o $@ - -../4ed: $(CPP_FILES) $(C_FILES) $(H_FILES) - g++ $(WARNINGS) $(FLAGS) linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@ +../build/build: $(CPP_FILES) $(C_FILES) $(H_FILES) + g++ $(WARNINGS) $(FLAGS) build.cpp -g -o $@ + ../build/build clean: - $(RM) ../4ed_app.so ../4ed - -# releases - -alpha: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,--wrap=memcpy linux_release_compat.c -Wl,-s -alpha: ../4ed_app.so ../4ed - strip -R .comment $^ - -alpha32: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,-s -m32 -alpha32: ../4ed_app.so ../4ed - strip -R .comment $^ - -super: FLAGS += -DFRED_SUPER=1 -super: alpha - -super32: FLAGS += -DFRED_SUPER=1 -super32: alpha32 - -# packaging - -PACKAGE_FILES := ../4ed ../4ed_app.so README.txt TODO.txt - -../4coder_super.zip: PACKAGE_FILES += 4coder_*.h 4coder_*.cpp buildsuper.sh -../4coder_super32.zip: PACKAGE_FILES += 4coder_*.h 4coder_*.cpp buildsuper.sh - -../4coder_%.zip: % - zip -j $@ $(PACKAGE_FILES) - (cd ../release_template && zip -g -r $@ .) - $(MAKE) clean - -package: clean - @echo -e "\e[1;32m ==== Creating Alpha package ==== \e[0m" - $(MAKE) ../4coder_alpha.zip - @echo -e "\e[1;32m ==== Creating Super package ==== \e[0m" - $(MAKE) ../4coder_super.zip -# $(MAKE) ../4coder_alpha32.zip -# $(MAKE) ../4coder_super32.zip - -.PHONY: debug alpha alpha32 super super32 package clean - - + $(RM) ../build/build ../build/fsmgen ../build/metagen ../build/4ed_app.so ../build/4ed diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index ac4c6536..c429e47b 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -44,9 +44,7 @@ CUSTOM_COMMAND_SIG(kill_rect){ } static void -pad_buffer_line(Application_Links *app, Partition *part, - Buffer_Summary *buffer, int line, - char padchar, int target){ +pad_buffer_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, int line, char padchar, int target){ Partial_Cursor start = {0}; Partial_Cursor end = {0}; @@ -679,7 +677,7 @@ get_bindings(void *data, int size){ begin_map(context, mapid_file); bind(context, 'k', MDFR_ALT, kill_rect); - bind(context, ' ', MDFR_ALT, multi_line_edit); + bind(context, ' ', MDFR_ALT | MDFR_CTRL, multi_line_edit); bind(context, key_page_up, MDFR_ALT, miblo_increment_time_stamp); bind(context, key_page_down, MDFR_ALT, miblo_decrement_time_stamp); diff --git a/site/abstract_document.cpp b/site/abstract_document.cpp index c1bb57ed..064c029d 100644 --- a/site/abstract_document.cpp +++ b/site/abstract_document.cpp @@ -442,6 +442,8 @@ write_enriched_text_html(String *out, Enriched_Text *text, Section_Counter *sect Cmd_EndItem, Cmd_BoldFace, Cmd_Section, + Cmd_BeginLink, + Cmd_EndLink, // never below this Cmd_COUNT, }; @@ -458,6 +460,8 @@ write_enriched_text_html(String *out, Enriched_Text *text, Section_Counter *sect enriched_commands[Cmd_EndItem] = make_lit_string("END_ITEM"); enriched_commands[Cmd_BoldFace] = make_lit_string("BOLD_FACE"); enriched_commands[Cmd_Section] = make_lit_string("SECTION"); + enriched_commands[Cmd_BeginLink] = make_lit_string("BEGIN_LINK"); + enriched_commands[Cmd_EndLink] = make_lit_string("END_LINK"); i = command_end; @@ -523,6 +527,24 @@ write_enriched_text_html(String *out, Enriched_Text *text, Section_Counter *sect ++section_counter->counter[section_counter->nest_level]; } }break; + + case Cmd_BeginLink: + { + int32_t body_start = 0, body_end = 0; + int32_t has_body = extract_command_body(out, l, &i, &body_start, &body_end, command_string); + if (has_body){ + String body_text = substr(l, body_start, body_end - body_start); + + append_sc(out, ""); + } + }break; + + case Cmd_EndLink: + { + append_sc(out, ""); + }break; } } else{ diff --git a/site/build.bat b/site/build.bat index f25451fe..fed59b45 100644 --- a/site/build.bat +++ b/site/build.bat @@ -12,9 +12,7 @@ cl %OPTS% ..\code\build.cpp /Zi /Febuild /DSITE_BUILD if %ERRORLEVEL% neq 0 (set FirstError=1) popd -pushd .. -..\build\build -popd +..\..\build\build if %ERRORLEVEL% neq 0 (set FirstError=1) call "ctime" -end 4ed_site.ctm %FirstError% \ No newline at end of file diff --git a/site/build.sh b/site/build.sh index 4048cb1d..f3077a71 100755 --- a/site/build.sh +++ b/site/build.sh @@ -1,6 +1,10 @@ #!/bin/bash +WARNINGS="-Wno-write-strings" +FLAGS="-D_GNU_SOURCE -fPIC -fpermissive -DSITE_BUILD" + pushd .. -make clean -make site -popd \ No newline at end of file +BASEDIR="$PWD" +g++ $WARNINGS $FLAGS $BASEDIR/build.cpp -g -o ../build/build +popd +../../build/build diff --git a/site/sitegen.cpp b/site/sitegen.cpp index 7e521f58..c7a5d8eb 100644 --- a/site/sitegen.cpp +++ b/site/sitegen.cpp @@ -75,22 +75,22 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){ int32_t do_print = 0; int32_t nest_level = 0; - int32_t finish = false; - int32_t do_whitespace_print = false; + int32_t finish = 0; + int32_t do_whitespace_print = 0; for (; (token = get_token(context)) != 0; get_next_token(context)){ if (do_whitespace_print){ pstr = str_start_end(context->data, start, token->start); append_ss(out, pstr); } else{ - do_whitespace_print = true; + do_whitespace_print = 1; } - do_print = true; + do_print = 1; if (token->type == CPP_TOKEN_COMMENT){ lexeme = get_lexeme(*token, context->data); if (check_and_fix_docs(&lexeme)){ - do_print = false; + do_print = 0; } } else if (token->type == CPP_TOKEN_BRACE_OPEN){ @@ -99,7 +99,7 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){ else if (token->type == CPP_TOKEN_BRACE_CLOSE){ --nest_level; if (nest_level == 0){ - finish = true; + finish = 1; } } @@ -153,8 +153,6 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){ static Abstract_Document* generate_4coder_API(Partition *part, char *code_directory, char *src_directory, char *dst_directory){ -#define API_DOC "4coder_API.html" - static Meta_Keywords meta_keywords[] = { {make_lit_string("API_EXPORT") , Item_Function } , {make_lit_string("API_EXPORT_INLINE") , Item_Function } , @@ -224,7 +222,7 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){ // NOTE(allen): Put together the abstract document memset(doc, 0, sizeof(*doc)); begin_document_description(doc, part, "4coder API Docs"); - set_document_name(doc, API_DOC); + set_document_name(doc, "custom_API.html"); add_table_of_contents(doc); @@ -318,7 +316,7 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){ // NOTE(allen): Put together the abstract document memset(doc, 0, sizeof(*doc)); begin_document_description(doc, part, "4coder Feature List"); - set_document_name(doc, "4coder_features.html"); + set_document_name(doc, "features.html"); add_enriched_text(doc, feature_list); diff --git a/site/source_material/feature_list.txt b/site/source_material/feature_list.txt index a9eb6290..33104c46 100644 --- a/site/source_material/feature_list.txt +++ b/site/source_material/feature_list.txt @@ -1,4 +1,6 @@ +This page is meant to provide a list of available features for anyone trying to decide whether 4coder is the right editor for them. If a feature is missing here you should check out the \LINK_BEGIN{roadmap.html} roadmap \LINK_END page to see what is coming in the future. If the feature you want is on neither, you should contact \CODE_STYLE{editor@4coder.net}. Some features that are already in 4coder might be missing from this list, and they will be added as they are discovered. + \SECTION{Text Editing} \BEGIN_LIST \BEGIN_ITEM Cursor and mark editing paradigm \END_ITEM @@ -20,11 +22,28 @@ \END_LIST \SECTION{The Customization API} + These features are included in the alpha builds at the $5 tier and above. \BEGIN_LIST \BEGIN_ITEM Easy key rebinding \END_ITEM \BEGIN_ITEM Create custom commands \END_ITEM \BEGIN_ITEM Buffer reading and editing \END_ITEM \BEGIN_ITEM Buffer reading and editing \END_ITEM \BEGIN_ITEM View opening, closing, positioning \END_ITEM + \BEGIN_ITEM Access to the code intelligence engine \END_ITEM \END_LIST +\SECTION{The Experimental Features} + These features are included in the alpha builds at the $10 tier and above and are generally only partially implemented, hence not being fully upgraded to the standard build. + \BEGIN_LIST + \BEGIN_ITEM Moving cursor and mark to surrounding and matching braces + \BEGIN_ITEM Rectangular delete + \BEGIN_ITEM Multi-line editing + \BEGIN_ITEM Rename a parameter + \BEGIN_ITEM Write in explicit enum values from 0 to n + \END_LIST + +\SECTION{Transition From Emacs} +4coder's current setup and editing paradigm is modeled after emacs, so it is very natural to transition to 4coder from emacs for many users. 4coder customization is quite different from emacs though, so anyone who wants to keep their current keybinds will have to take the time to rewrite the keybinding code. Once the initial transition is done, any user who prefers C++ to Lisp will have a much better time in their 4coder configuration code. + +\SECTION{Transition From Vim} +Many vim users are resistant to any transition because of how unique the vim editing paradigm is. For them the