intended interface for stdout capture

This commit is contained in:
Allen Webster 2016-03-20 18:43:28 -04:00
parent 0fea10aaef
commit 3fd4565eab
6 changed files with 56 additions and 36 deletions

View File

@ -3732,7 +3732,7 @@ App_Step_Sig(app_step){
"-The file count limit is over 8 million now\n"
"-File equality is handled better so renamings (such as 'subst') are safe now\n"
"-This buffer will report events including errors that happen in 4coder\n"
"-Super users can post their own messages here with app->do_message\n"
"-Super users can post their own messages here with printf\n"
"-Set font size on command line with -f N, N = 16 by default\n\n"
);

3
4ed.h
View File

@ -104,9 +104,10 @@ struct Application_Step_Result{
};
#define App_Step_Sig(name) void \
name(System_Functions *system, \
name(System_Functions *system, \
Key_Input_Data *input, \
Mouse_State *mouse, \
CLI_Handles self, \
Render_Target *target, \
Application_Memory *memory, \
Exchange *exchange, \

View File

@ -193,7 +193,6 @@ tbl_file_hash(void *item, void *arg){
hash = ((hash << 6) + hash) + uhash.d[1];
hash = ((hash << 6) + hash) + uhash.d[2];
hash = ((hash << 6) + hash) + uhash.d[3];
hash = ((hash << 6) + hash) + uhash.non_file_id;
return(hash);
}

View File

@ -13,9 +13,14 @@ struct Plat_Handle{
u32 d[4];
};
inline int
handle_equal(Plat_Handle a, Plat_Handle b){
int result = (memcmp(&a, &b, sizeof(a)) == 0);
return(result);
}
struct Unique_Hash{
u32 d[4];
u32 non_file_id;
};
inline Unique_Hash

View File

@ -98,18 +98,21 @@
; [X] get key stroke in custom callback
; [X] tab option for auto-indent
; [X] catch unsaved files on close
; [X] feedback messages
;
; [] file status in custom API
; [] user file bar string
; [] feedback message API
; [] simple multi-line
;
; [] feedback messages
; [] command meta data
; [] additional hooks
; [] new file
; [X] new file
; [] file out of sync
; [] double binding warnings
; [] kill rect
; [] simple multi-line
;
; [] manipulate scroll starget API
;
; search related tech
; [X] replace word (incremental and/or in range)
@ -136,15 +139,13 @@
; [] "thin cursor"
;
; [] switch over to gap buffer
; [] multiple chunk lexer input
; [] lexer with multiple chunk input
;
; [] macros
;
; [X] cuber's return to previous buffer idea
; [] cuber's return to previous buffer idea
; [] miblo's various number editors
;
; [] out of sync options
; [] hook
; [] keep copy of unedited orignal, somewhere (compressed, restore by history?)
;
; [] diff
@ -160,7 +161,9 @@
; [] error text at line
; [] word complete ghosting
;
; [] main_4coder experiment
; [] the main_4coder experiment
;
; [] tutorials
;
; INTERNAL TODOS
@ -184,6 +187,7 @@
; HARD BUGS
; [] fyoucon's segfaults with malloc on win10
; [] minimize and reopen problem (reported by two users now, still not reproduced here)
; [] repainting too slow for resize looks really dumb
; [] handling cursor in non-client part of window so it doesn't spaz
; [] fill screen right away

View File

@ -164,6 +164,10 @@ struct Win32_Vars{
// it up if needed.
Win32_Coroutine coroutine_data[2];
Win32_Coroutine *coroutine_free;
// TODO(allen): Initialize this by redirecting std out to these CLI
// handles so that the application step can read from them.
CLI_Handles cli_self;
};
globalvar Win32_Vars win32vars;
@ -989,6 +993,7 @@ Sys_CLI_End_Update_Sig(system_cli_end_update){
DWORD result = 0;
if (WaitForSingleObject(proc, 0) == WAIT_OBJECT_0){
if (!handle_equal(cli->proc, win32vars.cli_self.proc)){
if (GetExitCodeProcess(proc, &result) == 0)
cli->exit = -1;
else
@ -999,6 +1004,11 @@ Sys_CLI_End_Update_Sig(system_cli_end_update){
CloseHandle(*(HANDLE*)&cli->out_read);
CloseHandle(*(HANDLE*)&cli->out_write);
}
else{
// TODO(allen): wtf? How does this happen? It doesn't right?
Assert(0);
}
}
return close_me;
}
@ -1550,6 +1560,7 @@ UpdateLoop(LPVOID param){
win32vars.app.step(win32vars.system,
&input_data,
&mouse,
win32vars.cli_self,
&win32vars.target,
&memory_vars,
&exchange_vars,