diff --git a/4coder_API.html b/4coder_API.html index ab990ab1..b4e705e6 100644 --- a/4coder_API.html +++ b/4coder_API.html @@ -15,16 +15,18 @@ li:before { content: "4"; color: #005000; font-family:"Webdings"; } -
+

4coder API

§1 Introduction

-This is the documentation for alpha 4.0.9 super! The documentation has been made as accurate as possible but there may be errors. If you have questions or discover errors please contact editor@4coder.net.

+This is the documentation for alpha 4.0.9 super! The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections.

-

+If you have questions or discover errors please contact editor@4coder.net or to get help from community members you can post on the 4coder forums hosted on handmade.network at 4coder.handmade.network

§2 4coder Systems

+
+Coming Soon

§3 Types and Functions

§3.1 Function List

    @@ -1630,12 +1632,12 @@ int id;
    Description
    Buffer_Identifier acts as a loosely typed description of a buffer that can either be a name or an id. If the
    Fields
    name
    -
    This field is the name of the buffer, need not be null terminated. - If id is specified this should be NULL.
    +
    This field is the name of the buffer; it need not be null terminated. + If id is specified this pointer should be NULL.
    name_len
    -
    This field is specifies the length of the name string.
    +
    This field specifies the length of the name string.
    id
    diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 82e6fb04..36b22175 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -1391,6 +1391,7 @@ get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_ int len = app->directory_get_hot(app, dir_out->str, dir_out->memory_size - dir_out->size); if (len + dir_out->size < dir_out->memory_size){ + dir_out->size += len; result = true; } } @@ -1398,6 +1399,49 @@ get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_ return(result); } +static void +execute_standard_build(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer){ + int old_size = 0; + int size = app->memory_size/2; + + String dir = make_string(app->memory, 0, size); + get_build_directory(app, active_buffer, &dir); + + String command = make_string((char*)app->memory + size, 0, size); + + for(;;){ + old_size = dir.size; + append(&dir, "build.bat"); + + if (app->file_exists(app, dir.str, dir.size)){ + dir.size = old_size; + append(&command, '"'); + append(&command, dir); + append(&command, "build\""); + + app->exec_system_command(app, view, + buffer_identifier(literal("*compilation*")), + dir.str, dir.size, + command.str, command.size, + CLI_OverlapWithConflict); + + break; + } + dir.size = old_size; + + if (app->directory_cd(app, dir.str, &dir.size, dir.memory_size, literal("..")) == 0){ + dir.size = app->directory_get_hot(app, dir.str, dir.memory_size); + command = make_lit_string("echo couldn't find build.bat"); + app->exec_system_command(app, view, + buffer_identifier(literal("*compilation*")), + dir.str, dir.size, + command.str, command.size, + CLI_OverlapWithConflict); + break; + } + } +} + CUSTOM_COMMAND_SIG(build_search_regular){ // NOTE(allen|a3.3): An example of traversing the filesystem through parent // directories looking for a file, in this case a batch file to execute. @@ -1434,49 +1478,10 @@ CUSTOM_COMMAND_SIG(build_search_regular){ // This doesn't actually change the hot directory of 4coder, it's only effect is to // modify the string you passed in to reflect the change in directory if that change was possible. - int old_size = 0; - int size = app->memory_size/2; - unsigned int access = AccessAll; View_Summary view = app->get_active_view(app, access); Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, access); - - String dir = make_string(app->memory, 0, size); - get_build_directory(app, &buffer, &dir); - - String command = make_string((char*)app->memory + size, 0, size); - - for(;;){ - old_size = dir.size; - append(&dir, "build.bat"); - - if (app->file_exists(app, dir.str, dir.size)){ - dir.size = old_size; - append(&command, '"'); - append(&command, dir); - append(&command, "build\""); - - app->exec_system_command(app, &view, - buffer_identifier(literal("*compilation*")), - dir.str, dir.size, - command.str, command.size, - CLI_OverlapWithConflict); - - break; - } - dir.size = old_size; - - if (app->directory_cd(app, dir.str, &dir.size, dir.memory_size, literal("..")) == 0){ - dir.size = app->directory_get_hot(app, dir.str, dir.memory_size); - command = make_lit_string("echo couldn't find build.bat"); - app->exec_system_command(app, &view, - buffer_identifier(literal("*compilation*")), - dir.str, dir.size, - command.str, command.size, - CLI_OverlapWithConflict); - break; - } - } + execute_standard_build(app, &view, &buffer); } // TODO(allen): This is a bit nasty. I want a system for picking diff --git a/4coder_types.h b/4coder_types.h index 5579eaf8..c8f21370 100644 --- a/4coder_types.h +++ b/4coder_types.h @@ -414,12 +414,12 @@ can either be a name or an id. If the ) */ struct Buffer_Identifier{ /* DOC( - This field is the name of the buffer, need not be null terminated. - If id is specified this should be NULL. + This field is the name of the buffer; it need not be null terminated. + If id is specified this pointer should be NULL. ) */ char *name; - /* DOC(This field is specifies the length of the name string.) */ + /* DOC(This field specifies the length of the name string.) */ int name_len; /* DOC(This field is the id of the buffer. If name is specified this should be 0.) */ diff --git a/4ed_metagen.cpp b/4ed_metagen.cpp index 3c92980f..6a9346a4 100644 --- a/4ed_metagen.cpp +++ b/4ed_metagen.cpp @@ -1769,7 +1769,7 @@ generate_custom_headers(){ "\n" "\n" "
    \n" + "width: 800px; text-align: justify; line-height: 1.25;'>\n" "

    4coder API

    \n" ); @@ -1780,12 +1780,18 @@ generate_custom_headers(){ "
    \n" "

    \n" - "This is the documentation for " VERSION " The documentation has been made as " - "accurate as possible but there may be errors. If you have questions or " - "discover errors please contact editor@4coder.net." + "This is the documentation for " VERSION " The documentation is still under " + "construction so some of the links are linking to sections that have not " + "been written yet. What is here should be correct and I suspect useful " + "even without some of the other sections. " "

    \n" "

    \n" + "If you have questions or discover errors please contact " + "editor@4coder.net or " + "to get help from community members you can post on the " + "4coder forums hosted on handmade.network at " + "4coder.handmade.network" "

    \n" "
    \n"); @@ -1795,7 +1801,10 @@ generate_custom_headers(){ // TODO(allen): Write the 4coder system descriptions. fprintf(file, "

    §"MAJOR_SECTION" 4coder Systems

    \n"); { - + fprintf(file, + "
    \n" + "Coming Soon" + "
    \n"); } #undef MAJOR_SECTION diff --git a/README.txt b/README.txt index 7eb0a060..da695193 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Distribution Date: 30.6.2016 (dd.mm.yyyy) +Distribution Date: 2.7.2016 (dd.mm.yyyy) Thank you for contributing to the 4coder project! diff --git a/SUPERREADME.txt b/SUPERREADME.txt index dd2ffca9..bd977855 100644 --- a/SUPERREADME.txt +++ b/SUPERREADME.txt @@ -1,4 +1,4 @@ -Distribution Date: 30.6.2016 (dd.mm.yyyy) +Distribution Date: 2.7.2016 (dd.mm.yyyy) Thank you for contributing to the 4coder project! diff --git a/power/4coder_default_building.cpp b/power/4coder_default_building.cpp index bd721579..0f3113a0 100644 --- a/power/4coder_default_building.cpp +++ b/power/4coder_default_building.cpp @@ -9,6 +9,7 @@ #include "4coder_helper.h" + // // Basic Build Behavior // @@ -24,7 +25,10 @@ CUSTOM_COMMAND_SIG(build_in_build_panel){ Buffer_Summary buffer = app->get_buffer_by_name(app, literal("*compilation*"), AccessAll); View_Summary build_view = {0}; + View_Summary original_view = app->get_active_view(app, AccessAll); + Buffer_Summary original_buffer = + app->get_buffer(app, original_view.buffer_id, AccessAll); if (buffer.exists){ build_view = get_first_view_with_buffer(app, buffer.buffer_id); @@ -35,11 +39,11 @@ CUSTOM_COMMAND_SIG(build_in_build_panel){ exec_command(app, hide_scrollbar); build_view = app->get_active_view(app, AccessAll); app->view_set_split_proportion(app, &build_view, .2f); + app->set_active_view(app, &original_view); } - app->set_active_view(app, &build_view); - exec_command(app, build_search); - app->set_active_view(app, &original_view); + execute_standard_build(app, &build_view, &original_buffer); + prev_location = {0}; }