From: larrybr Date: Wed, 15 Nov 2023 15:20:52 +0000 (+0000) Subject: Changes to console I/O for Fiddle build, to always defer to C library (as before... X-Git-Tag: version-3.44.1~8^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c283f969aa5922d740d1ac977eb0c02f1a615e8c;p=thirdparty%2Fsqlite.git 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 --- diff --git a/ext/consio/console_io.c b/ext/consio/console_io.c index 27727f2a8f..cbba5205b7 100755 --- a/ext/consio/console_io.c +++ b/ext/consio/console_io.c @@ -18,6 +18,8 @@ # define SQLITE_CDECL #endif +#ifndef SQLITE_SHELL_FIDDLE + #ifndef SHELL_NO_SYSINC # include # include @@ -498,6 +500,8 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){ #endif } +#endif /* !defined(SQLITE_SHELL_FIDDLE) */ + /* Skip over as much z[] input char sequence as is valid UTF-8, ** limited per nAccept char's or whole characters and containing ** no char cn such that ((1<=0)? z+nAccept : 0; assert(z!=0); - while( (pcLimit)? (z 0) ){ + while( (pcLimit)? (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 * eputz(z) => emit 0-terminated string z 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: * setOutputStream(FILE *pf) * This is normally the stream that CLI normal output goes to. * For the stand-alone CLI, it is stdout with no .output redirect. */ -#define sputz(s,z) fPutsUtf8(z,s) -#define sputf fPrintfUtf8 -#define oputz(z) oPutsUtf8(z) -#define oputf oPrintfUtf8 -#define eputz(z) ePutsUtf8(z) -#define eputf ePrintfUtf8 -#define sputc(f,c) fPutcUtf8(c,f) -#define oputc(c) oPutcUtf8(c) -#define eputc(c) ePutcUtf8(c) +# define sputz(s,z) fPutsUtf8(z,s) +# define sputf fPrintfUtf8 +# define oputz(z) oPutsUtf8(z) +# define oputf oPrintfUtf8 +# define eputz(z) ePutsUtf8(z) +# define eputf ePrintfUtf8 + +#else +/* 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 */ static int enableTimer = 0;