cleaned up the arbitrary system command code a little

master
Allen Webster 2017-07-17 17:13:57 -04:00
parent 6d90c58f81
commit 367a72fa03
2 changed files with 23 additions and 23 deletions

View File

@ -11,6 +11,20 @@ TYPE: 'drop-in-command-pack'
#include "4coder_default_framework.h"
CUSTOM_COMMAND_SIG(execute_previous_cli){
String out_buffer = make_string_slowly(out_buffer_space);
String cmd = make_string_slowly(command_space);
String hot_directory = make_string_slowly(hot_directory_space);
if (out_buffer.size > 0 && cmd.size > 0 && hot_directory.size > 0){
uint32_t access = AccessAll;
View_Summary view = get_active_view(app, access);
exec_system_command(app, &view, buffer_identifier(out_buffer.str, out_buffer.size), hot_directory.str, hot_directory.size, cmd.str, cmd.size, CLI_OverlapWithConflict | CLI_CursorAtEnd);
lock_jump_buffer(out_buffer.str, out_buffer.size);
}
}
CUSTOM_COMMAND_SIG(execute_any_cli){
Query_Bar bar_out = {0};
Query_Bar bar_cmd = {0};
@ -26,25 +40,7 @@ CUSTOM_COMMAND_SIG(execute_any_cli){
String hot_directory = make_fixed_width_string(hot_directory_space);
hot_directory.size = directory_get_hot(app, hot_directory.str, hot_directory.memory_size);
uint32_t access = AccessAll;
View_Summary view = get_active_view(app, access);
exec_system_command(app, &view, buffer_identifier(bar_out.string.str, bar_out.string.size), hot_directory.str, hot_directory.size, bar_cmd.string.str, bar_cmd.string.size, CLI_OverlapWithConflict | CLI_CursorAtEnd);
lock_jump_buffer(bar_out.string.str, bar_out.string.size);
}
CUSTOM_COMMAND_SIG(execute_previous_cli){
String out_buffer = make_string_slowly(out_buffer_space);
String cmd = make_string_slowly(command_space);
String hot_directory = make_string_slowly(hot_directory_space);
if (out_buffer.size > 0 && cmd.size > 0 && hot_directory.size > 0){
uint32_t access = AccessAll;
View_Summary view = get_active_view(app, access);
exec_system_command(app, &view, buffer_identifier(out_buffer.str, out_buffer.size), hot_directory.str, hot_directory.size, cmd.str, cmd.size, CLI_OverlapWithConflict | CLI_CursorAtEnd);
lock_jump_buffer(out_buffer.str, out_buffer.size);
}
execute_previous_cli(app);
}
#endif

View File

@ -290,7 +290,7 @@ DOC_SEE(Command_Line_Interface_Flag)
init_read_only_file(system, models, file);
}
if (file){
if (file != 0){
i32 proc_count = vars->cli_processes.count;
for (i32 i = 0; i < proc_count; ++i){
if (procs[i].out_file == file){
@ -299,7 +299,8 @@ DOC_SEE(Command_Line_Interface_Flag)
}
else{
file = 0;
}break;
}
break;
}
}
@ -1228,10 +1229,13 @@ DOC(Whenever a buffer is killed an end signal is sent which triggers the end fil
API_EXPORT Buffer_Summary
Create_Buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags)
/*
DOC_PARAM(filename, The name of the file to associate to the new buffer. If the file is not found, the buffer will be created empty and will not be associated to a file until it is saved.)
DOC_PARAM(filename, The name of the file to associate to the new buffer.)
DOC_PARAM(filename_len, The length of the filename string.)
DOC_PARAM(flags, Flags controlling the buffer creation behavior.)
DOC()
DOC_RETURN(Returns the newly created buffer or an already existing buffer with the given name.)
DOC(Try to create a new buffer. This call first checks to see if a buffer already exists that goes by the given name, if so, that buffer is returned.
If no buffer exists with the given name, then a new buffer is created. If a file that matches the given filename exists, the file is loaded as the contents of the new buffer. Otherwise a buffer is created without a matching file until the buffer is saved and the buffer is left blank.)
DOC_SEE(Buffer_Create_Flag)
*/{
PRFL_FUNC_GROUP();