|
57 | 57 | arg = D_ARG(2);
|
58 | 58 | *D_RET = *D_ARG(1);
|
59 | 59 |
|
60 |
| - req = Use_Port_State(port, RDI_STDIO, sizeof(REBREQ)); |
| 60 | + //O: known limitation: works only with default system's imput port (not for custom console ports) |
| 61 | + req = Host_Lib->std_io; |
| 62 | + req->port = port; |
61 | 63 |
|
62 | 64 | switch (action) {
|
63 | 65 |
|
|
85 | 87 | if (req->actual == 1 && req->data[0] == '\x1B') return R_NONE; // CTRL-C
|
86 | 88 |
|
87 | 89 | #ifdef TO_WINDOWS
|
88 |
| - if (req->actual > 1) req->actual -= 2; // remove CRLF from tail |
| 90 | + if (req->actual > 1 && GET_FLAG(req->modes, RDM_READ_LINE)) req->actual -= 2; // remove CRLF from tail |
89 | 91 | #else
|
90 | 92 | if (req->actual > 0) req->actual -= 1; // remove LF from tail
|
91 | 93 | #endif
|
92 | 94 |
|
93 | 95 | Set_Binary(ds, Copy_Bytes(req->data, req->actual));
|
94 | 96 | break;
|
95 | 97 |
|
| 98 | + case A_UPDATE: |
| 99 | + // do nothing here, no wake-up, events should be handled by user defined port's awake function |
| 100 | + // ==>> SYSTEM/PORTS/INPUT/SCHEME/AWAKE |
| 101 | + return R_NONE; |
| 102 | + |
96 | 103 | case A_OPEN:
|
97 | 104 | // ?? why???
|
98 |
| - //if (OS_DO_DEVICE(req, RDC_OPEN)) Trap_Port(RE_CANNOT_OPEN, port); |
| 105 | + if (OS_DO_DEVICE(req, RDC_OPEN)) Trap_Port(RE_CANNOT_OPEN, port, req->error); |
99 | 106 | SET_OPEN(req);
|
100 | 107 | break;
|
101 | 108 |
|
|
108 | 115 | if (IS_OPEN(req)) return R_TRUE;
|
109 | 116 | return R_FALSE;
|
110 | 117 |
|
| 118 | + case A_MODIFY: |
| 119 | + if (IS_WORD(arg) |
| 120 | + && (VAL_WORD_CANON(arg) == SYM_ECHO || VAL_WORD_CANON(arg) == SYM_LINE) |
| 121 | + ) { |
| 122 | + spec = D_ARG(3); |
| 123 | + if (!IS_LOGIC(spec)) Trap2(RE_INVALID_VALUE_FOR, spec, arg); |
| 124 | + req->modify.mode = (VAL_WORD_CANON(arg) == SYM_ECHO) ? MODE_CONSOLE_ECHO : MODE_CONSOLE_LINE; |
| 125 | + req->modify.value = VAL_LOGIC(spec); |
| 126 | + OS_DO_DEVICE(req, RDC_MODIFY); |
| 127 | + } else Trap1(RE_BAD_FILE_MODE, arg); |
| 128 | + return R_ARG3; |
| 129 | + |
111 | 130 | case A_QUERY:
|
112 | 131 | spec = Get_System(SYS_STANDARD, STD_CONSOLE_INFO);
|
113 | 132 | if (!IS_OBJECT(spec)) Trap_Arg(spec);
|
|
0 commit comments