Fix the amalgamation generator so that all non-API functions have file scope. (CVS 3958)

FossilOrigin-Name: e9f56ead0514f3eac75807ea710c1f035b8add4f
diff --git a/src/build.c b/src/build.c
index f8ef212..22ec4ce 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,7 +22,7 @@
 **     COMMIT
 **     ROLLBACK
 **
-** $Id: build.c,v 1.427 2007/05/08 13:58:27 drh Exp $
+** $Id: build.c,v 1.428 2007/05/08 20:37:39 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1566,7 +1566,7 @@
         pCons = pEnd;
       }
       nName = (const char *)pCons->z - zName;
-      p->addColOffset = 13 + sqlite3utf8CharLen(zName, nName);
+      p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
     }
 #endif
   }
diff --git a/src/func.c b/src/func.c
index 2012666..c9a035a 100644
--- a/src/func.c
+++ b/src/func.c
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.151 2007/05/08 15:46:18 drh Exp $
+** $Id: func.c,v 1.152 2007/05/08 20:37:39 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -555,7 +555,7 @@
     */
     const unsigned char *zEsc = sqlite3_value_text(argv[2]);
     if( zEsc==0 ) return;
-    if( sqlite3utf8CharLen((char*)zEsc, -1)!=1 ){
+    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
       sqlite3_result_error(context, 
           "ESCAPE expression must be a single character", -1);
       return;
@@ -1275,7 +1275,7 @@
     { "length",             1, 0, SQLITE_UTF8,    0, lengthFunc },
     { "substr",             3, 0, SQLITE_UTF8,    0, substrFunc },
 #ifndef SQLITE_OMIT_UTF16
-    { "substr",             3, 0, SQLITE_UTF16LE, 0, sqlite3utf16Substr },
+    { "substr",             3, 0, SQLITE_UTF16LE, 0, sqlite3Utf16Substr },
 #endif
     { "abs",                1, 0, SQLITE_UTF8,    0, absFunc    },
     { "round",              1, 0, SQLITE_UTF8,    0, roundFunc  },
diff --git a/src/main.c b/src/main.c
index 9f92bd6..e4eb7fc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.375 2007/05/08 12:12:17 drh Exp $
+** $Id: main.c,v 1.376 2007/05/08 20:37:39 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -562,7 +562,7 @@
   char *zFunc8;
   assert( !sqlite3MallocFailed() );
 
-  zFunc8 = sqlite3utf16to8(zFunctionName, -1);
+  zFunc8 = sqlite3Utf16to8(zFunctionName, -1);
   rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
   sqliteFree(zFunc8);
 
@@ -1171,7 +1171,7 @@
   int rc = SQLITE_OK;
   char *zName8; 
   assert( !sqlite3MallocFailed() );
-  zName8 = sqlite3utf16to8(zName, -1);
+  zName8 = sqlite3Utf16to8(zName, -1);
   if( zName8 ){
     rc = createCollation(db, zName8, enc, pCtx, xCompare, 0);
     sqliteFree(zName8);
diff --git a/src/prepare.c b/src/prepare.c
index 4078952..223df16 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -13,7 +13,7 @@
 ** interface, and routines that contribute to loading the database schema
 ** from disk.
 **
-** $Id: prepare.c,v 1.49 2007/05/08 13:58:28 drh Exp $
+** $Id: prepare.c,v 1.50 2007/05/08 20:37:39 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -649,7 +649,7 @@
   if( sqlite3SafetyCheck(db) ){
     return SQLITE_MISUSE;
   }
-  zSql8 = sqlite3utf16to8(zSql, nBytes);
+  zSql8 = sqlite3Utf16to8(zSql, nBytes);
   if( zSql8 ){
     rc = sqlite3Prepare(db, zSql8, -1, saveSqlFlag, ppStmt, &zTail8);
   }
@@ -660,8 +660,8 @@
     ** characters between zSql8 and zTail8, and then returning a pointer
     ** the same number of characters into the UTF-16 string.
     */
-    int chars_parsed = sqlite3utf8CharLen(zSql8, zTail8-zSql8);
-    *pzTail = (u8 *)zSql + sqlite3utf16ByteLen(zSql, chars_parsed);
+    int chars_parsed = sqlite3Utf8CharLen(zSql8, zTail8-zSql8);
+    *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);
   }
   sqliteFree(zSql8); 
   return sqlite3ApiExit(db, rc);
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index c1c5c07..e19ea3d 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.560 2007/05/08 17:54:44 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.561 2007/05/08 20:37:39 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -1751,8 +1751,8 @@
 char *sqlite3_snprintf(int,char*,const char*,...);
 int sqlite3GetInt32(const char *, int*);
 int sqlite3FitsIn64Bits(const char *);
-int sqlite3utf16ByteLen(const void *pData, int nChar);
-int sqlite3utf8CharLen(const char *pData, int nByte);
+int sqlite3Utf16ByteLen(const void *pData, int nChar);
+int sqlite3Utf8CharLen(const char *pData, int nByte);
 int sqlite3ReadUtf8(const unsigned char *);
 int sqlite3PutVarint(unsigned char *, u64);
 int sqlite3GetVarint(const unsigned char *, u64 *);
@@ -1763,7 +1763,7 @@
 char sqlite3CompareAffinity(Expr *pExpr, char aff2);
 int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
 char sqlite3ExprAffinity(Expr *pExpr);
-int sqlite3atoi64(const char*, i64*);
+int sqlite3Atoi64(const char*, i64*);
 void sqlite3Error(sqlite3*, int, const char*,...);
 void *sqlite3HexToBlob(const char *z);
 int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
@@ -1778,14 +1778,14 @@
 int sqlite3CheckIndexCollSeq(Parse *, Index *);
 int sqlite3CheckObjectName(Parse *, const char *);
 void sqlite3VdbeSetChanges(sqlite3 *, int);
-void sqlite3utf16Substr(sqlite3_context *,int,sqlite3_value **);
+void sqlite3Utf16Substr(sqlite3_context *,int,sqlite3_value **);
 
 const void *sqlite3ValueText(sqlite3_value*, u8);
 int sqlite3ValueBytes(sqlite3_value*, u8);
 void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
 void sqlite3ValueFree(sqlite3_value*);
 sqlite3_value *sqlite3ValueNew(void);
-char *sqlite3utf16to8(const void*, int);
+char *sqlite3Utf16to8(const void*, int);
 int sqlite3ValueFromExpr(Expr *, u8, u8, sqlite3_value **);
 void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
 extern const unsigned char sqlite3UpperToLower[];
diff --git a/src/test1.c b/src/test1.c
index 47f1909..4f26a89 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.251 2007/05/08 01:08:49 drh Exp $
+** $Id: test1.c,v 1.252 2007/05/08 20:37:39 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -1069,7 +1069,7 @@
 */
 static int sqlite3GetInt64(const char *zNum, i64 *pValue){
   if( sqlite3FitsIn64Bits(zNum) ){
-    sqlite3atoi64(zNum, pValue);
+    sqlite3Atoi64(zNum, pValue);
     return 1;
   }
   return 0;
@@ -3035,7 +3035,7 @@
 
   zErr = sqlite3_errmsg16(db);
   if( zErr ){
-    bytes = sqlite3utf16ByteLen(zErr, -1);
+    bytes = sqlite3Utf16ByteLen(zErr, -1);
   }
   Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(zErr, bytes));
 #endif /* SQLITE_OMIT_UTF16 */
@@ -3646,7 +3646,7 @@
 
   zName16 = xFunc(pStmt, col);
   if( zName16 ){
-    pRet = Tcl_NewByteArrayObj(zName16, sqlite3utf16ByteLen(zName16, -1)+2);
+    pRet = Tcl_NewByteArrayObj(zName16, sqlite3Utf16ByteLen(zName16, -1)+2);
     Tcl_SetObjResult(interp, pRet);
   }
 #endif /* SQLITE_OMIT_UTF16 */
diff --git a/src/test5.c b/src/test5.c
index 6bed4c2..79f9bb4 100644
--- a/src/test5.c
+++ b/src/test5.c
@@ -15,7 +15,7 @@
 ** is used for testing the SQLite routines for converting between
 ** the various supported unicode encodings.
 **
-** $Id: test5.c,v 1.15 2005/12/09 20:21:59 drh Exp $
+** $Id: test5.c,v 1.16 2007/05/08 20:37:40 drh Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -180,10 +180,10 @@
 /*
 ** Usage: translate_selftest
 **
-** Call sqlite3utfSelfTest() to run the internal tests for unicode
+** Call sqlite3UtfSelfTest() to run the internal tests for unicode
 ** translation. If there is a problem an assert() will fail.
 **/
-void sqlite3utfSelfTest();
+void sqlite3UtfSelfTest();
 static int test_translate_selftest(
   void * clientData,
   Tcl_Interp *interp,
@@ -191,7 +191,7 @@
   Tcl_Obj *CONST objv[]
 ){
 #ifndef SQLITE_OMIT_UTF16
-  sqlite3utfSelfTest();
+  sqlite3UtfSelfTest();
 #endif
   return SQLITE_OK;
 }
diff --git a/src/utf.c b/src/utf.c
index fb995cc..f78e600 100644
--- a/src/utf.c
+++ b/src/utf.c
@@ -12,7 +12,7 @@
 ** This file contains routines used to translate between UTF-8, 
 ** UTF-16, UTF-16BE, and UTF-16LE.
 **
-** $Id: utf.c,v 1.44 2007/03/31 15:28:00 drh Exp $
+** $Id: utf.c,v 1.45 2007/05/08 20:37:40 drh Exp $
 **
 ** Notes on UTF-8:
 **
@@ -53,9 +53,9 @@
 **
 ** sqlite3VdbeMemTranslate() - Translate the encoding used by a Mem* string.
 ** sqlite3VdbeMemHandleBom() - Handle byte-order-marks in UTF16 Mem* strings.
-** sqlite3utf16ByteLen()     - Calculate byte-length of a void* UTF16 string.
-** sqlite3utf8CharLen()      - Calculate char-length of a char* UTF8 string.
-** sqlite3utf8LikeCompare()  - Do a LIKE match given two UTF8 char* strings.
+** sqlite3Utf16ByteLen()     - Calculate byte-length of a void* UTF16 string.
+** sqlite3Utf8CharLen()      - Calculate char-length of a char* UTF8 string.
+** sqlite3Utf8LikeCompare()  - Do a LIKE match given two UTF8 char* strings.
 **
 */
 #include "sqliteInt.h"
@@ -457,7 +457,7 @@
 ** number of unicode characters in the first nByte of pZ (or up to 
 ** the first 0x00, whichever comes first).
 */
-int sqlite3utf8CharLen(const char *z, int nByte){
+int sqlite3Utf8CharLen(const char *z, int nByte){
   int r = 0;
   const char *zTerm;
   if( nByte>=0 ){
@@ -481,7 +481,7 @@
 **
 ** NULL is returned if there is an allocation error.
 */
-char *sqlite3utf16to8(const void *z, int nByte){
+char *sqlite3Utf16to8(const void *z, int nByte){
   Mem m;
   memset(&m, 0, sizeof(m));
   sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC);
@@ -498,7 +498,7 @@
 ** then return the number of bytes in the first nChar unicode characters
 ** in pZ (or up until the first pair of 0x00 bytes, whichever comes first).
 */
-int sqlite3utf16ByteLen(const void *zIn, int nChar){
+int sqlite3Utf16ByteLen(const void *zIn, int nChar){
   unsigned int c = 1;
   char const *z = zIn;
   int n = 0;
@@ -528,7 +528,7 @@
 /*
 ** UTF-16 implementation of the substr()
 */
-void sqlite3utf16Substr(
+void sqlite3Utf16Substr(
   sqlite3_context *context,
   int argc,
   sqlite3_value **argv
@@ -579,7 +579,7 @@
 ** It checks that the primitives for serializing and deserializing
 ** characters in each encoding are inverses of each other.
 */
-void sqlite3utfSelfTest(){
+void sqlite3UtfSelfTest(){
   unsigned int i, t;
   unsigned char zBuf[20];
   unsigned char *z;
diff --git a/src/util.c b/src/util.c
index cc73dc3..b79a14b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.201 2007/05/05 11:48:54 drh Exp $
+** $Id: util.c,v 1.202 2007/05/08 20:37:40 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -292,7 +292,7 @@
   *pResult = sign<0 ? -v1 : v1;
   return z - zBegin;
 #else
-  return sqlite3atoi64(z, pResult);
+  return sqlite3Atoi64(z, pResult);
 #endif /* SQLITE_OMIT_FLOATING_POINT */
 }
 
@@ -307,7 +307,7 @@
 ** 32-bit numbers.  At that time, it was much faster than the
 ** atoi() library routine in RedHat 7.2.
 */
-int sqlite3atoi64(const char *zNum, i64 *pNum){
+int sqlite3Atoi64(const char *zNum, i64 *pNum){
   i64 v = 0;
   int neg;
   int i, c;
diff --git a/src/vdbe.c b/src/vdbe.c
index 0d53450..2e546ae 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.610 2007/05/08 13:57:34 danielk1977 Exp $
+** $Id: vdbe.c,v 1.611 2007/05/08 20:37:40 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -220,7 +220,7 @@
          && sqlite3IsNumber(pRec->z, &realnum, pRec->enc) ){
       i64 value;
       sqlite3VdbeChangeEncoding(pRec, SQLITE_UTF8);
-      if( !realnum && sqlite3atoi64(pRec->z, &value) ){
+      if( !realnum && sqlite3Atoi64(pRec->z, &value) ){
         sqlite3VdbeMemRelease(pRec);
         pRec->u.i = value;
         pRec->flags = MEM_Int;
diff --git a/src/vdbe.h b/src/vdbe.h
index 9613ce0..86e94d9 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -15,7 +15,7 @@
 ** or VDBE.  The VDBE implements an abstract machine that runs a
 ** simple program to access and modify the underlying database.
 **
-** $Id: vdbe.h,v 1.108 2007/01/09 14:01:14 drh Exp $
+** $Id: vdbe.h,v 1.109 2007/05/08 20:37:40 drh Exp $
 */
 #ifndef _SQLITE_VDBE_H_
 #define _SQLITE_VDBE_H_
@@ -131,7 +131,6 @@
 void sqlite3VdbeTrace(Vdbe*,FILE*);
 void sqlite3VdbeResetStepResult(Vdbe*);
 int sqlite3VdbeReset(Vdbe*);
-int sqliteVdbeSetVariables(Vdbe*,int,const char**);
 void sqlite3VdbeSetNumCols(Vdbe*,int);
 int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, int);
 void sqlite3VdbeCountChanges(Vdbe*);
diff --git a/src/vdbeblob.c b/src/vdbeblob.c
index 8f52ca0..9d826c9 100644
--- a/src/vdbeblob.c
+++ b/src/vdbeblob.c
@@ -12,7 +12,7 @@
 **
 ** This file contains code used to implement incremental BLOB I/O.
 **
-** $Id: vdbeblob.c,v 1.9 2007/05/05 18:39:25 drh Exp $
+** $Id: vdbeblob.c,v 1.10 2007/05/08 20:37:40 drh Exp $
 */
 
 #include "sqliteInt.h"
@@ -247,7 +247,7 @@
 }
 
 
-int blobReadWrite(
+static int blobReadWrite(
   sqlite3_blob *pBlob, 
   void *z, 
   int n, 
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 94188a0..64ee451 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -290,7 +290,7 @@
       return 0;
     }
     assert( pMem->z );
-    sqlite3atoi64(pMem->z, &value);
+    sqlite3Atoi64(pMem->z, &value);
     return value;
   }else{
     return 0;
@@ -538,7 +538,7 @@
     case SQLITE_UTF16BE:
       pMem->flags |= MEM_Str;
       if( pMem->n<0 ){
-        pMem->n = sqlite3utf16ByteLen(pMem->z,-1);
+        pMem->n = sqlite3Utf16ByteLen(pMem->z,-1);
         pMem->flags |= MEM_Term;
       }
       if( sqlite3VdbeMemHandleBom(pMem) ){
@@ -841,7 +841,7 @@
 /*
 ** Create a new sqlite3_value object.
 */
-sqlite3_value* sqlite3ValueNew(void){
+sqlite3_value *sqlite3ValueNew(void){
   Mem *p = sqliteMalloc(sizeof(*p));
   if( p ){
     p->flags = MEM_Null;