mirror of https://gitlab.com/nakst/essence
make posix launcher textbox clearer; dup2 bugfixes
This commit is contained in:
parent
3ecb3f4d2f
commit
fefa668d0d
|
@ -21,7 +21,7 @@ EsMutex mutex;
|
||||||
int stdinWritePipe;
|
int stdinWritePipe;
|
||||||
EsTextbox *textboxOutput, *textboxInput;
|
EsTextbox *textboxOutput, *textboxInput;
|
||||||
|
|
||||||
const EsStyle styleMonospacedTextbox = {
|
const EsStyle styleOutputTextbox = {
|
||||||
.inherit = ES_STYLE_TEXTBOX_NO_BORDER,
|
.inherit = ES_STYLE_TEXTBOX_NO_BORDER,
|
||||||
|
|
||||||
.metrics = {
|
.metrics = {
|
||||||
|
@ -31,6 +31,25 @@ const EsStyle styleMonospacedTextbox = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const EsStyle styleInputTextbox = {
|
||||||
|
.inherit = ES_STYLE_TEXTBOX_BORDERED_SINGLE,
|
||||||
|
|
||||||
|
.metrics = {
|
||||||
|
.mask = ES_THEME_METRICS_FONT_FAMILY | ES_THEME_METRICS_TEXT_SIZE,
|
||||||
|
.textSize = 12,
|
||||||
|
.fontFamily = ES_FONT_MONOSPACED,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const EsStyle styleInputRow = {
|
||||||
|
.inherit = ES_STYLE_PANEL_FORM_TABLE,
|
||||||
|
|
||||||
|
.metrics = {
|
||||||
|
.mask = ES_THEME_METRICS_INSETS,
|
||||||
|
.insets = ES_RECT_1(7),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
void WriteToOutputTextbox(const char *string, ptrdiff_t stringBytes) {
|
void WriteToOutputTextbox(const char *string, ptrdiff_t stringBytes) {
|
||||||
if (stringBytes == -1) {
|
if (stringBytes == -1) {
|
||||||
stringBytes = EsCRTstrlen(string);
|
stringBytes = EsCRTstrlen(string);
|
||||||
|
@ -170,9 +189,11 @@ void MessageLoopThread(EsGeneric) {
|
||||||
EsWindow *window = instance->window;
|
EsWindow *window = instance->window;
|
||||||
EsWindowSetIcon(window, ES_ICON_UTILITIES_TERMINAL);
|
EsWindowSetIcon(window, ES_ICON_UTILITIES_TERMINAL);
|
||||||
EsPanel *panel = EsPanelCreate(window, ES_PANEL_VERTICAL | ES_CELL_FILL, ES_STYLE_PANEL_WINDOW_BACKGROUND);
|
EsPanel *panel = EsPanelCreate(window, ES_PANEL_VERTICAL | ES_CELL_FILL, ES_STYLE_PANEL_WINDOW_BACKGROUND);
|
||||||
textboxOutput = EsTextboxCreate(panel, ES_TEXTBOX_MULTILINE | ES_CELL_FILL, &styleMonospacedTextbox);
|
textboxOutput = EsTextboxCreate(panel, ES_TEXTBOX_MULTILINE | ES_CELL_FILL, &styleOutputTextbox);
|
||||||
EsSpacerCreate(panel, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL);
|
EsSpacerCreate(panel, ES_CELL_H_FILL, ES_STYLE_SEPARATOR_HORIZONTAL);
|
||||||
textboxInput = EsTextboxCreate(panel, ES_CELL_H_FILL, &styleMonospacedTextbox);
|
EsPanel *row = EsPanelCreate(panel, ES_CELL_H_FILL | ES_PANEL_HORIZONTAL, &styleInputRow);
|
||||||
|
EsTextDisplayCreate(row, ES_FLAGS_DEFAULT, ES_STYLE_TEXT_LABEL, EsLiteral("Input:"));
|
||||||
|
textboxInput = EsTextboxCreate(row, ES_CELL_H_FILL, &styleInputTextbox);
|
||||||
EsTextboxEnableSmartReplacement(textboxInput, false);
|
EsTextboxEnableSmartReplacement(textboxInput, false);
|
||||||
EsTextboxSetReadOnly(textboxOutput, true);
|
EsTextboxSetReadOnly(textboxOutput, true);
|
||||||
textboxInput->messageUser = ProcessTextboxInputMessage;
|
textboxInput->messageUser = ProcessTextboxInputMessage;
|
||||||
|
|
|
@ -161,6 +161,10 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long
|
||||||
ProcessorCheckStackAlignment();
|
ProcessorCheckStackAlignment();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((uintptr_t) n < sizeof(syscallNames) / sizeof(syscallNames[0])) {
|
||||||
|
// EsPrint(":: %z %x %x %x\n", syscallNames[n], a1, a2, a3);
|
||||||
|
}
|
||||||
|
|
||||||
long returnValue = 0;
|
long returnValue = 0;
|
||||||
_EsPOSIXSyscall syscall = { n, a1, a2, a3, a4, a5, a6 };
|
_EsPOSIXSyscall syscall = { n, a1, a2, a3, a4, a5, a6 };
|
||||||
|
|
||||||
|
@ -689,11 +693,10 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long
|
||||||
double endTime = EsTimeStampMs();
|
double endTime = EsTimeStampMs();
|
||||||
syscallTimeSpent[n] += endTime - startTime;
|
syscallTimeSpent[n] += endTime - startTime;
|
||||||
syscallCallCount[n]++;
|
syscallCallCount[n]++;
|
||||||
|
// EsPrint(":: %z %x %x %x -> %x; %Fms\n", syscallNames[n], a1, a2, a3, returnValue, endTime - startTime);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// EsPrint(":: %z %x %x %x -> %x; %Fms\n", syscallNames[n], a1, a2, a3, returnValue, endTime - startTime);
|
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,13 +51,13 @@ struct POSIXThread {
|
||||||
|
|
||||||
#define SYSCALL_HANDLE_POSIX_2(handle, out) \
|
#define SYSCALL_HANDLE_POSIX_2(handle, out) \
|
||||||
Handle _ ## out; \
|
Handle _ ## out; \
|
||||||
uint8_t status_ ## out = currentProcess->handleTable.ResolveHandle(&_ ## out, ConvertStandardInputTo3(handle), KERNEL_OBJECT_POSIX_FD); \
|
uint8_t status_ ## out = handleTable->ResolveHandle(&_ ## out, ConvertStandardInputTo3(handle), KERNEL_OBJECT_POSIX_FD); \
|
||||||
if (status_ ## out == RESOLVE_HANDLE_FAILED) return -EBADF; \
|
if (status_ ## out == RESOLVE_HANDLE_FAILED) return -EBADF; \
|
||||||
EsDefer(if (status_ ## out == RESOLVE_HANDLE_NORMAL) CloseHandleToObject(_ ## out.object, _ ## out.type, _ ## out.flags)); \
|
EsDefer(if (status_ ## out == RESOLVE_HANDLE_NORMAL) CloseHandleToObject(_ ## out.object, _ ## out.type, _ ## out.flags)); \
|
||||||
const Handle out = _ ## out
|
const Handle out = _ ## out
|
||||||
#define SYSCALL_HANDLE_POSIX(handle, out) \
|
#define SYSCALL_HANDLE_POSIX(handle, out) \
|
||||||
Handle _ ## out; \
|
Handle _ ## out; \
|
||||||
uint8_t status_ ## out = currentProcess->handleTable.ResolveHandle(&_ ## out, ConvertStandardInputTo3(handle), KERNEL_OBJECT_POSIX_FD); \
|
uint8_t status_ ## out = handleTable->ResolveHandle(&_ ## out, ConvertStandardInputTo3(handle), KERNEL_OBJECT_POSIX_FD); \
|
||||||
if (status_ ## out == RESOLVE_HANDLE_FAILED) return -EBADF; \
|
if (status_ ## out == RESOLVE_HANDLE_FAILED) return -EBADF; \
|
||||||
EsDefer(if (status_ ## out == RESOLVE_HANDLE_NORMAL) CloseHandleToObject(_ ## out.object, _ ## out.type, _ ## out.flags)); \
|
EsDefer(if (status_ ## out == RESOLVE_HANDLE_NORMAL) CloseHandleToObject(_ ## out.object, _ ## out.type, _ ## out.flags)); \
|
||||||
POSIXFile *const out = (POSIXFile *) _ ## out.object
|
POSIXFile *const out = (POSIXFile *) _ ## out.object
|
||||||
|
@ -625,7 +625,8 @@ namespace POSIX {
|
||||||
// Clone the oldfd as newfd.
|
// Clone the oldfd as newfd.
|
||||||
|
|
||||||
OpenHandleToObject(file, KERNEL_OBJECT_POSIX_FD, fd.flags);
|
OpenHandleToObject(file, KERNEL_OBJECT_POSIX_FD, fd.flags);
|
||||||
return handleTable->OpenHandle(fd.object, fd.flags, fd.type, ConvertStandardInputTo3(syscall.arguments[1])) ? 0 : -EBUSY;
|
return handleTable->OpenHandle(fd.object, fd.flags, fd.type,
|
||||||
|
ConvertStandardInputTo3(syscall.arguments[1])) ? syscall.arguments[1] : -EBUSY;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SYS_pipe2: {
|
case SYS_pipe2: {
|
||||||
|
|
Loading…
Reference in New Issue