Fixes default log output to console for macOS
[sqlcipher.git] / tool / sqlite3_analyzer.c.in
blob2d799ed250f9c9505b58504aef8626a2aeff6c07
1 /*
2 ** Read an SQLite database file and analyze its space utilization. Generate
3 ** text on standard output.
4 */
5 #define TCLSH_INIT_PROC sqlite3_analyzer_init_proc
6 #define SQLITE_ENABLE_DBSTAT_VTAB 1
7 #undef SQLITE_THREADSAFE
8 #define SQLITE_THREADSAFE 0
9 #undef SQLITE_ENABLE_COLUMN_METADATA
10 #define SQLITE_OMIT_DECLTYPE 1
11 #define SQLITE_OMIT_DEPRECATED 1
12 #define SQLITE_OMIT_PROGRESS_CALLBACK 1
13 #define SQLITE_OMIT_SHARED_CACHE 1
14 #define SQLITE_DEFAULT_MEMSTATUS 0
15 #define SQLITE_MAX_EXPR_DEPTH 0
16 #define SQLITE_OMIT_LOAD_EXTENSION 1
17 #if !defined(SQLITE_AMALGAMATION) && !defined(USE_EXTERNAL_SQLITE)
18 INCLUDE sqlite3.c
19 #endif
20 INCLUDE $ROOT/src/tclsqlite.c
22 #if defined(_WIN32)
23 INCLUDE $ROOT/ext/consio/console_io.h
24 INCLUDE $ROOT/ext/consio/console_io.c
26 /* Substitute "puts" command. Only these forms recognized:
28 ** puts STRING
29 ** puts stderr STRING
30 ** puts -nonewline STRING
32 static int subst_puts(
33 void *NotUsed,
34 Tcl_Interp *interp,
35 int objc,
36 Tcl_Obj *const*objv
38 FILE *pOut = stdout;
39 const char *zOut;
40 int addNewLine = 1;
41 if( objc==2 ){
42 zOut = Tcl_GetString(objv[1]);
43 }else if( objc!=3 ){
44 Tcl_WrongNumArgs(interp, 1, objv, "?stderr|-nonewline? STRING");
45 return TCL_ERROR;
46 }else{
47 const char *zArg = Tcl_GetString(objv[1]);
48 if( zArg==0 ) return TCL_ERROR;
49 zOut = Tcl_GetString(objv[2]);
50 if( strcmp(zArg, "stderr")==0 ){
51 pOut = stderr;
52 }else if( strcmp(zArg, "-nonewline")==0 ){
53 addNewLine = 0;
54 }else{
55 Tcl_AppendResult(interp, "bad argument: ", zArg, 0);
56 return TCL_ERROR;
59 fPutsUtf8(zOut, pOut);
60 if( addNewLine ) fPutsUtf8("\n", pOut);
61 return TCL_OK;
63 #endif /* defined(_WIN32) */
65 const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
66 #if defined(_WIN32)
67 Tcl_CreateObjCommand(interp, "puts", subst_puts, 0, 0);
68 #else
69 (void)interp;
70 #endif
71 return
72 BEGIN_STRING
73 INCLUDE $ROOT/tool/spaceanal.tcl
74 END_STRING