mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Changes to console I/O for Fiddle build, to always defer to C library (as before.) A WIP, pending testing with Fiddle build.
FossilOrigin-Name: 45b8061e7568ccca164fe000f1f0a0d984b1c28fad530bc9fdea35793a0f40bc
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
# define SQLITE_CDECL
|
# define SQLITE_CDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SQLITE_SHELL_FIDDLE
|
||||||
|
|
||||||
#ifndef SHELL_NO_SYSINC
|
#ifndef SHELL_NO_SYSINC
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
@@ -498,6 +500,8 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !defined(SQLITE_SHELL_FIDDLE) */
|
||||||
|
|
||||||
/* Skip over as much z[] input char sequence as is valid UTF-8,
|
/* Skip over as much z[] input char sequence as is valid UTF-8,
|
||||||
** limited per nAccept char's or whole characters and containing
|
** limited per nAccept char's or whole characters and containing
|
||||||
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
|
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
|
||||||
@@ -508,7 +512,7 @@ static const char* zSkipValidUtf8(const char *z, int nAccept, long ccm){
|
|||||||
int ng = (nAccept<0)? -nAccept : 0;
|
int ng = (nAccept<0)? -nAccept : 0;
|
||||||
const char *pcLimit = (nAccept>=0)? z+nAccept : 0;
|
const char *pcLimit = (nAccept>=0)? z+nAccept : 0;
|
||||||
assert(z!=0);
|
assert(z!=0);
|
||||||
while( (pcLimit)? (z<pcLimit) : (ng-- > 0) ){
|
while( (pcLimit)? (z<pcLimit) : (ng-- != 0) ){
|
||||||
char c = *z;
|
char c = *z;
|
||||||
if( (c & 0x80) == 0 ){
|
if( (c & 0x80) == 0 ){
|
||||||
if( ccm != 0L && c < 0x20 && ((1L<<c) & ccm) != 0 ) return z;
|
if( ccm != 0L && c < 0x20 && ((1L<<c) & ccm) != 0 ) return z;
|
||||||
@@ -532,6 +536,28 @@ static const char* zSkipValidUtf8(const char *z, int nAccept, long ccm){
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SQLITE_SHELL_FIDDLE
|
||||||
|
# define fPutbUtf8(f, cB, nA, cM) \
|
||||||
|
((f)? fwrite(cB,1,nA,f) : zSkipValidUtf8(cB,nA,cM))
|
||||||
|
|
||||||
|
static int oprintf(const char zFmt, ...){
|
||||||
|
va_list ap;
|
||||||
|
int rv;
|
||||||
|
va_start(ap, zFormat);
|
||||||
|
rv = vfprintf(stdout, zFmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
static int eprintf(const char zFmt, ...){
|
||||||
|
va_list ap;
|
||||||
|
int rv;
|
||||||
|
va_start(ap, zFormat);
|
||||||
|
rv = vfprintf(stderr, zFmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
SQLITE_INTERNAL_LINKAGE int
|
SQLITE_INTERNAL_LINKAGE int
|
||||||
fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept, long ctrlMask){
|
fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept, long ctrlMask){
|
||||||
const char *zPast = zSkipValidUtf8(cBuf, nAccept, ctrlMask);
|
const char *zPast = zSkipValidUtf8(cBuf, nAccept, ctrlMask);
|
||||||
@@ -662,3 +688,4 @@ SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef SHELL_INVALID_FILE_PTR
|
#undef SHELL_INVALID_FILE_PTR
|
||||||
|
#endif /* !defined(SQLITE_SHELL_FIDDLE) */
|
||||||
|
@@ -42,6 +42,7 @@ typedef enum StreamsAreConsole {
|
|||||||
SAC_AnyConsole = 0x7
|
SAC_AnyConsole = 0x7
|
||||||
} StreamsAreConsole;
|
} StreamsAreConsole;
|
||||||
|
|
||||||
|
#ifndef SQLITE_SHELL_FIDDLE
|
||||||
/*
|
/*
|
||||||
** Classify the three standard I/O streams according to whether
|
** Classify the three standard I/O streams according to whether
|
||||||
** they are connected to a console attached to the process.
|
** they are connected to a console attached to the process.
|
||||||
@@ -262,3 +263,4 @@ shellGetLine(FILE *pfIn, char *zBufPrior, int nLen,
|
|||||||
** may have to establish console operating mode, possibly
|
** may have to establish console operating mode, possibly
|
||||||
** in a way that interferes with the above functionality.
|
** in a way that interferes with the above functionality.
|
||||||
*/
|
*/
|
||||||
|
#endif /* !defined(SQLITE_SHELL_FIDDLE) */
|
||||||
|
17
manifest
17
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Cherry-pick\ssome\sassert()s\sto\scover\smisuse\sof\s*Put*()\sfrom\s500+\sshell.c\scallers.
|
C Changes\sto\sconsole\sI/O\sfor\sFiddle\sbuild,\sto\salways\sdefer\sto\sC\slibrary\s(as\sbefore.)\sA\sWIP,\spending\stesting\swith\sFiddle\sbuild.
|
||||||
D 2023-11-14T03:31:24.845
|
D 2023-11-15T15:20:52.098
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -50,8 +50,8 @@ F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
|
|||||||
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
|
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
|
||||||
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
|
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
|
||||||
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
|
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
|
||||||
F ext/consio/console_io.c baffbeb5e73dcd3191c677bbcd5266c35891c17f87930cd89cf2463b7ec2da09 x
|
F ext/consio/console_io.c b28bc0bd7d35f39de99ca0a73f5b9b50217bcb157f4903051260d3b37ace6b8d x
|
||||||
F ext/consio/console_io.h 515d27ca9e5a5d36e12ff2b85977b5931fdeba0ce142f40178d94dc8638b4c81
|
F ext/consio/console_io.h a1aabe4db7f345e71411f3a50b6c6c7acb40fc4aa68aed8c623d401c3804c772
|
||||||
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
||||||
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
|
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
|
||||||
F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6
|
F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6
|
||||||
@@ -724,7 +724,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
|||||||
F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23
|
F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23
|
||||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||||
F src/select.c 503331aca8785254a7bf3d74ab338a99118fa297e1184a4dde33b3cdf7a9d341
|
F src/select.c 503331aca8785254a7bf3d74ab338a99118fa297e1184a4dde33b3cdf7a9d341
|
||||||
F src/shell.c.in 187da23da7601bfb225d0efadf77cbf766d9cee7574323a25a3d42dc29cd27fe
|
F src/shell.c.in eb9e9a66328340b832c269bd03b19fb24cac9e36fd0b76118fc95427c604fac1
|
||||||
F src/sqlite.h.in 4f841d3d117b830ee5ee45e8d89ceff1195f3ebb72d041ace8d116ba4c103b35
|
F src/sqlite.h.in 4f841d3d117b830ee5ee45e8d89ceff1195f3ebb72d041ace8d116ba4c103b35
|
||||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||||
@@ -2141,9 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 18ebcf117aad77fa968ff5c537c9b56c1342dea687377a72a02519412a6aa565
|
P c1a53c28a4286c4c52fb78398d4dbf5c03de514a1fa9199bf0cfcd2cd3cc7cd9
|
||||||
Q +2341f9b6a48634a94e90e849f579afd07d398c3e0304efccf07d18b41a0e40aa
|
R 9f2a69ab179ad2f0c7192d052189e011
|
||||||
R 60fd6c8a04f40ed6debc651106b241bb
|
|
||||||
U larrybr
|
U larrybr
|
||||||
Z ec0a20ca68f8ea6e6133b8144bc6b5ec
|
Z 4b2770a837909b0492b3a22fea2548c0
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@@ -1 +1 @@
|
|||||||
c1a53c28a4286c4c52fb78398d4dbf5c03de514a1fa9199bf0cfcd2cd3cc7cd9
|
45b8061e7568ccca164fe000f1f0a0d984b1c28fad530bc9fdea35793a0f40bc
|
@@ -242,8 +242,10 @@ extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText);
|
|||||||
INCLUDE ../ext/consio/console_io.h
|
INCLUDE ../ext/consio/console_io.h
|
||||||
INCLUDE ../ext/consio/console_io.c
|
INCLUDE ../ext/consio/console_io.c
|
||||||
|
|
||||||
|
#ifndef SQLITE_SHELL_FIDDLE
|
||||||
|
|
||||||
/* From here onward, fgets() is redirected to the console_io library. */
|
/* From here onward, fgets() is redirected to the console_io library. */
|
||||||
#define fgets(b,n,f) fGetsUtf8(b,n,f)
|
# define fgets(b,n,f) fGetsUtf8(b,n,f)
|
||||||
/*
|
/*
|
||||||
* Define macros for emitting output text in various ways:
|
* Define macros for emitting output text in various ways:
|
||||||
* sputz(s, z) => emit 0-terminated string z to given stream s
|
* sputz(s, z) => emit 0-terminated string z to given stream s
|
||||||
@@ -252,24 +254,28 @@ INCLUDE ../ext/consio/console_io.c
|
|||||||
* oputf(f, ...) => emit varargs per format f to default stream
|
* oputf(f, ...) => emit varargs per format f to default stream
|
||||||
* eputz(z) => emit 0-terminated string z to error stream
|
* eputz(z) => emit 0-terminated string z to error stream
|
||||||
* eputf(f, ...) => emit varargs per format f to error stream
|
* eputf(f, ...) => emit varargs per format f to error stream
|
||||||
* sputc(s, c) => emit single ASCII character to given stream s
|
|
||||||
* oputc(c) => emit single ASCII character to default stream
|
|
||||||
* eputc(c) => emit single ASCII character to error stream
|
|
||||||
*
|
*
|
||||||
* Note that the default stream is whatever has been last set via:
|
* Note that the default stream is whatever has been last set via:
|
||||||
* setOutputStream(FILE *pf)
|
* setOutputStream(FILE *pf)
|
||||||
* This is normally the stream that CLI normal output goes to.
|
* This is normally the stream that CLI normal output goes to.
|
||||||
* For the stand-alone CLI, it is stdout with no .output redirect.
|
* For the stand-alone CLI, it is stdout with no .output redirect.
|
||||||
*/
|
*/
|
||||||
#define sputz(s,z) fPutsUtf8(z,s)
|
# define sputz(s,z) fPutsUtf8(z,s)
|
||||||
#define sputf fPrintfUtf8
|
# define sputf fPrintfUtf8
|
||||||
#define oputz(z) oPutsUtf8(z)
|
# define oputz(z) oPutsUtf8(z)
|
||||||
#define oputf oPrintfUtf8
|
# define oputf oPrintfUtf8
|
||||||
#define eputz(z) ePutsUtf8(z)
|
# define eputz(z) ePutsUtf8(z)
|
||||||
#define eputf ePrintfUtf8
|
# define eputf ePrintfUtf8
|
||||||
#define sputc(f,c) fPutcUtf8(c,f)
|
|
||||||
#define oputc(c) oPutcUtf8(c)
|
#else
|
||||||
#define eputc(c) ePutcUtf8(c)
|
/* For Fiddle, all console handling and emit redirection is omitted. */
|
||||||
|
# define sputz(s,z) fputs(z,s)
|
||||||
|
# define sputf fprintf
|
||||||
|
# define oputz(z) fputs(z,stdout)
|
||||||
|
# define oputf oprintf
|
||||||
|
# define eputz(z) fputs(z,stderr)
|
||||||
|
# define eputf eprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
/* True if the timer is enabled */
|
/* True if the timer is enabled */
|
||||||
static int enableTimer = 0;
|
static int enableTimer = 0;
|
||||||
|
Reference in New Issue
Block a user