diff options
author | drh <drh@noemail.net> | 2015-06-08 15:08:15 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-06-08 15:08:15 +0000 |
commit | 38b4149ca1308db644dbf55426cc366c45ad7579 (patch) | |
tree | 1358311ba976552c37ceb2b794699cc5d0c831e0 /src/printf.c | |
parent | 6c1f4ef217deae6f288f86cb9b572256024fa97d (diff) | |
download | sqlite-38b4149ca1308db644dbf55426cc366c45ad7579.tar.gz sqlite-38b4149ca1308db644dbf55426cc366c45ad7579.zip |
Factor out the TreeView parse tree printing module into a separate file.
FossilOrigin-Name: c32ce54ca46a4be4373983be6fd44b1f3a0250d1
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 66 |
1 files changed, 1 insertions, 65 deletions
diff --git a/src/printf.c b/src/printf.c index edf2210e0..ebdf44518 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1,9 +1,6 @@ /* ** The "printf" code that follows dates from the 1980's. It is in -** the public domain. The original comments are included here for -** completeness. They are very out-of-date but might be useful as -** an historical reference. Most of the "enhancements" have been backed -** out so that the functionality is now the same as standard printf(). +** the public domain. ** ************************************************************************** ** @@ -1058,67 +1055,6 @@ void sqlite3DebugPrintf(const char *zFormat, ...){ } #endif -#ifdef SQLITE_DEBUG -/************************************************************************* -** Routines for implementing the "TreeView" display of hierarchical -** data structures for debugging. -** -** The main entry points (coded elsewhere) are: -** sqlite3TreeViewExpr(0, pExpr, 0); -** sqlite3TreeViewExprList(0, pList, 0, 0); -** sqlite3TreeViewSelect(0, pSelect, 0); -** Insert calls to those routines while debugging in order to display -** a diagram of Expr, ExprList, and Select objects. -** -*/ -/* Add a new subitem to the tree. The moreToFollow flag indicates that this -** is not the last item in the tree. */ -TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){ - if( p==0 ){ - p = sqlite3_malloc64( sizeof(*p) ); - if( p==0 ) return 0; - memset(p, 0, sizeof(*p)); - }else{ - p->iLevel++; - } - assert( moreToFollow==0 || moreToFollow==1 ); - if( p->iLevel<sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow; - return p; -} -/* Finished with one layer of the tree */ -void sqlite3TreeViewPop(TreeView *p){ - if( p==0 ) return; - p->iLevel--; - if( p->iLevel<0 ) sqlite3_free(p); -} -/* Generate a single line of output for the tree, with a prefix that contains -** all the appropriate tree lines */ -void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){ - va_list ap; - int i; - StrAccum acc; - char zBuf[500]; - sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); - if( p ){ - for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){ - sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4); - } - sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); - } - va_start(ap, zFormat); - sqlite3VXPrintf(&acc, 0, zFormat, ap); - va_end(ap); - if( zBuf[acc.nChar-1]!='\n' ) sqlite3StrAccumAppend(&acc, "\n", 1); - sqlite3StrAccumFinish(&acc); - fprintf(stdout,"%s", zBuf); - fflush(stdout); -} -/* Shorthand for starting a new tree item that consists of a single label */ -void sqlite3TreeViewItem(TreeView *p, const char *zLabel, u8 moreToFollow){ - p = sqlite3TreeViewPush(p, moreToFollow); - sqlite3TreeViewLine(p, "%s", zLabel); -} -#endif /* SQLITE_DEBUG */ /* ** variable-argument wrapper around sqlite3VXPrintf(). |