Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make it buildable. Pull test program from testee. Zap stray fprintf(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | console-io-lib |
Files: | files | file ages | folders |
SHA3-256: |
2b850aca1e76805a0358064318a765fa |
User & Date: | larrybr 2023-11-05 23:55:41.214 |
Context
2023-11-06
| ||
00:15 | Make MSVC accept it, too. (Cannot use static const int as part of a constant expression?) (check-in: bb278d2496 user: larrybr tags: console-io-lib) | |
2023-11-05
| ||
23:55 | Make it buildable. Pull test program from testee. Zap stray fprintf(). (check-in: 2b850aca1e user: larrybr tags: console-io-lib) | |
19:42 | Input working. No line-editor provisions yet. (WIP, but suitable for testing.) (check-in: e8568b1d92 user: larrybr tags: console-io-lib) | |
Changes
Changes to src/console_io.c.
︙ | ︙ | |||
129 130 131 132 133 134 135 | if( ix==0 ){ consoleInfo.haveInput = 1; consoleInfo.stdinEof = 0; }else{ consoleInfo.outputIx |= ix; } SetConsoleMode(ppst->hx, cm); | < | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | if( ix==0 ){ consoleInfo.haveInput = 1; consoleInfo.stdinEof = 0; }else{ consoleInfo.outputIx |= ix; } SetConsoleMode(ppst->hx, cm); #endif rv |= (CSCS_InConsole<<ix); } if( ix > 0 ) fflush(apf[ix]); #if SHELL_CON_TRANSLATE == 2 _setmode(_fileno(apf[ix]), _O_U8TEXT); _setmode(_fileno(apf[ix]), _O_TEXT); |
︙ | ︙ | |||
266 267 268 269 270 271 272 | BOOL bRC = ReadConsoleW(consoleInfo.pst[0].hx, wcBuf, na, &nbr, 0); if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){ /* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */ DWORD nbrx; bRC &= ReadConsoleW(consoleInfo.pst[0].hx, wcBuf+nbr, 1, &nbrx, 0); if( bRC ) nbr += nbrx; } | < | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | BOOL bRC = ReadConsoleW(consoleInfo.pst[0].hx, wcBuf, na, &nbr, 0); if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){ /* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */ DWORD nbrx; bRC &= ReadConsoleW(consoleInfo.pst[0].hx, wcBuf+nbr, 1, &nbrx, 0); if( bRC ) nbr += nbrx; } if( !bRC || (noc==0 && nbr==0) ) return 0; if( nbr > 0 ){ int nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,0,0,0,0); if( nmb != 0 && noc+nmb <= ncMax ){ int iseg = noc; nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,cBuf+noc,nmb,0,0); noc += nmb; |
︙ | ︙ | |||
310 311 312 313 314 315 316 | }else{ #endif return fgets(cBuf, ncMax, pfIn); #if SHELL_CON_TRANSLATE } #endif } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 308 309 310 311 312 313 314 | }else{ #endif return fgets(cBuf, ncMax, pfIn); #if SHELL_CON_TRANSLATE } #endif } |
Changes to src/console_io.h.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ** conditional compilation in their source for their console I/O. ** ** The symbols and functionality exposed here are not a public API. ** This code may change in tandem with other project code as needed. */ #ifndef INT_LINKAGE | | > > > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ** conditional compilation in their source for their console I/O. ** ** The symbols and functionality exposed here are not a public API. ** This code may change in tandem with other project code as needed. */ #ifndef INT_LINKAGE # define INT_LINKAGE extern /* Linkage external to translation unit. */ # include <stdio.h> # include <stdlib.h> # include <limits.h> # if defined(_WIN32) || defined(WIN32) # undef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # include <windows.h> # include <io.h> # include <fcntl.h> # endif #endif #ifndef SQLITE3_H # include "sqlite3.h" #endif /* Define enum for use with following function. */ typedef enum ConsoleStdConsStreams { CSCS_NoConsole = 0, CSCS_InConsole = 1, CSCS_OutConsole = 2, CSCS_ErrConsole = 4, CSCS_AnyConsole = 0x7 } ConsoleStdConsStreams; |
︙ | ︙ |