Permalink
Browse files

Work around problem with forward declarations of constants in MSVC

in the amalgamation.  Ticket #2574. (CVS 4304)
  • Loading branch information...
1 parent 9f0b58d commit 7261e7e3ffd1df513869ff068457ea8bc230feed Unknown committed Aug 27, 2007
Showing with 37 additions and 24 deletions.
  1. +6 −3 mkopcodec.awk
  2. +11 −3 src/complete.c
  3. +2 −2 src/os_unix.c
  4. +7 −1 src/sqliteInt.h
  5. +5 −5 src/tokenize.c
  6. +2 −7 src/vdbeInt.h
  7. +3 −2 src/vdbeaux.c
  8. +1 −1 tool/mksqlite3c.tcl
View
@@ -15,14 +15,17 @@ BEGIN {
printf " || !defined(NDEBUG)"
printf " || defined(VDBE_PROFILE)"
print " || defined(SQLITE_DEBUG)"
- print "const char *const sqlite3OpcodeNames[] = { \"?\","
+ print "const char *sqlite3OpcodeName(int i){"
+ print " static const char *const azName[] = { \"?\","
}
/define OP_/ {
sub("OP_","",$2)
i++
- printf " /* %3d */ \"%s\",\n", $3, $2
+ printf " /* %3d */ \"%s\",\n", $3, $2
}
END {
- print "};"
+ print " };"
+ print " return azName[i];"
+ print "}"
print "#endif"
}
View
@@ -16,16 +16,24 @@
** separating it out, the code will be automatically omitted from
** static links that do not use it.
**
-** $Id: complete.c,v 1.5 2007/08/21 19:33:56 drh Exp $
+** $Id: complete.c,v 1.6 2007/08/27 23:26:59 drh Exp $
*/
#include "sqliteInt.h"
#ifndef SQLITE_OMIT_COMPLETE
/*
** This is defined in tokenize.c. We just have to import the definition.
*/
-extern const char sqlite3IsIdChar[];
-#define IdChar(C) (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsIdChar[c-0x20]))
+#ifndef SQLITE_AMALGAMATION
+#ifdef SQLITE_ASCII
+extern const char sqlite3IsAsciiIdChar[];
+#define IdChar(C) (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsAsciiIdChar[c-0x20]))
+#endif
+#ifdef SQLITE_EBCDIC
+extern const char sqlite3IsEbcdicIdChar[];
+#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))
+#endif
+#endif /* SQLITE_AMALGAMATION */
/*
View
@@ -2588,10 +2588,10 @@ static void unixDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
}
leaveMutex();
}
-void *unixDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
+static void *unixDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
return dlsym(pHandle, zSymbol);
}
-void unixDlClose(sqlite3_vfs *pVfs, void *pHandle){
+static void unixDlClose(sqlite3_vfs *pVfs, void *pHandle){
dlclose(pHandle);
}
#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
View
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.601 2007/08/27 21:49:34 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.602 2007/08/27 23:26:59 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -198,7 +198,11 @@ typedef UINT8_TYPE i8; /* 1-byte signed integer */
** Macros to determine whether the machine is big or little endian,
** evaluated at runtime.
*/
+#ifdef SQLITE_AMALGAMATION
+const int sqlite3One;
+#else
extern const int sqlite3one;
+#endif
#if defined(i386) || defined(__i386__) || defined(_M_IX86)
# define SQLITE_BIGENDIAN 0
# define SQLITE_LITTLEENDIAN 1
@@ -1756,7 +1760,9 @@ sqlite3_value *sqlite3ValueNew(sqlite3 *);
char *sqlite3Utf16to8(sqlite3 *, const void*, int);
int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
+#ifndef SQLITE_AMALGAMATION
extern const unsigned char sqlite3UpperToLower[];
+#endif
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(sqlite3*);
View
@@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
-** $Id: tokenize.c,v 1.135 2007/08/22 20:18:22 drh Exp $
+** $Id: tokenize.c,v 1.136 2007/08/27 23:26:59 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -85,7 +85,7 @@ const unsigned char ebcdicToAscii[] = {
** But the feature is undocumented.
*/
#ifdef SQLITE_ASCII
-const char sqlite3IsIdChar[] = {
+const char sqlite3IsAsciiIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 3x */
@@ -94,10 +94,10 @@ const char sqlite3IsIdChar[] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 7x */
};
-#define IdChar(C) (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsIdChar[c-0x20]))
+#define IdChar(C) (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsAsciiIdChar[c-0x20]))
#endif
#ifdef SQLITE_EBCDIC
-const char sqlite3IsIdChar[] = {
+const char sqlite3IsEbcdicIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 4x */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, /* 5x */
@@ -112,7 +112,7 @@ const char sqlite3IsIdChar[] = {
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Ex */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */
};
-#define IdChar(C) (((c=C)>=0x42 && sqlite3IsIdChar[c-0x40]))
+#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))
#endif
View
@@ -25,13 +25,6 @@
#define keyToInt(X) (X)
#define intToKey(X) (X)
-/*
-** The makefile scans the vdbe.c source file and creates the following
-** array of string constants which are the names of all VDBE opcodes. This
-** array is defined in a separate source code file named opcode.c which is
-** automatically generated by the makefile.
-*/
-extern const char *const sqlite3OpcodeNames[];
/*
** SQL is translated into a sequence of instructions to be
@@ -406,6 +399,8 @@ int sqlite3VdbeMemNumerify(Mem*);
int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
void sqlite3VdbeMemRelease(Mem *p);
int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
+const char *sqlite3OpcodeName(int);
+
#ifndef NDEBUG
void sqlite3VdbeMemSanity(Mem*);
int sqlite3VdbeOpcodeNoPush(u8);
View
@@ -19,6 +19,7 @@
#include "vdbeInt.h"
+
/*
** When debugging the code generator in a symbolic debugger, one can
** set the sqlite3_vdbe_addop_trace to 1 and all opcodes will be printed
@@ -669,7 +670,7 @@ void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){
if( pOut==0 ) pOut = stdout;
zP3 = displayP3(pOp, zPtr, sizeof(zPtr));
fprintf(pOut, zFormat1,
- pc, sqlite3OpcodeNames[pOp->opcode], pOp->p1, pOp->p2, zP3);
+ pc, sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, zP3);
fflush(pOut);
}
#endif
@@ -734,7 +735,7 @@ int sqlite3VdbeList(
pMem++;
pMem->flags = MEM_Static|MEM_Str|MEM_Term;
- pMem->z = (char*)sqlite3OpcodeNames[pOp->opcode]; /* Opcode */
+ pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
assert( pMem->z!=0 );
pMem->n = strlen(pMem->z);
pMem->type = SQLITE_TEXT;
View
@@ -233,7 +233,6 @@ foreach file {
auth.c
build.c
callback.c
- complete.c
delete.c
func.c
insert.c
@@ -252,6 +251,7 @@ foreach file {
parse.c
tokenize.c
+ complete.c
main.c
} {

0 comments on commit 7261e7e

Please sign in to comment.