Attempting to add support for 64-bit platforms. (CVS 314)

FossilOrigin-Name: 03673adbfe0c8a92d79f86ddf1136736594208ad
This commit is contained in:
drh 2001-11-21 02:21:11 +00:00
parent bc1bd58acf
commit 5a2c2c20af
10 changed files with 73 additions and 63 deletions

View File

@ -1,5 +1,5 @@
C Version\s2.1.1\s(CVS\s460)
D 2001-11-13T19:45:00
C Attempting\sto\sadd\ssupport\sfor\s64-bit\splatforms.\s(CVS\s314)
D 2001-11-21T02:21:12
F Makefile.in 6801df952cb1df64aa32e4de85fed24511d28efd
F Makefile.template 1fdb891f14083ee0b63cf7282f91529634438e7a
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
@ -19,12 +19,12 @@ F libtool c56e618713c9510a103bda6b95f3ea3900dcacd6
F ltmain.sh e9ed72eb1d690f447c13945eaf69e28af531eda1
F publish.sh 33cbe6798969f637698044023c139080e5d772a6
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
F src/btree.c 2c89ac317a43d03c389eea1a882b7bbfad2ae89a
F src/btree.c ef8934adc4ee61b4028ade1d6ed7ae1f74090e31
F src/btree.h 0250a0a577a98cc64ddf1582d50c08b8d2451650
F src/build.c 40b7d14435e2cfc5298e8b7bab5e92ed26f42310
F src/build.c 161023314950598be0cae9f7ef7e9b0d42c01252
F src/delete.c 5d93a21c1388cfb1359bda01c072f25583a2f4f2
F src/expr.c 53515a7ba787bf4f0b3f73be30eb86aadb6f1b90
F src/hash.c d0110e6da70a5962e21575fccf8206f7d9d75e00
F src/hash.c 6f1a7712ae3aac8351662969aec5693740a2fbf7
F src/hash.h a5f5b3ce2d086a172c5879b0b06a27a82eac9fac
F src/insert.c 3526be771a01035198bef28d8f370cbcab94f46d
F src/main.c 0b0e7244c7af91613111d5b72387e33f8789ed72
@ -40,15 +40,15 @@ F src/select.c fa1c7144a9ad7ce3f16373b443bc25e764af4be7
F src/shell.c 18e9f1cac7ec8af763f8fc71dfd81e2edee24008
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 934de9112747ad8d8e7d5fec44876246b24ca5a3
F src/sqliteInt.h aa26c7f8a0c5c3210a81177c60ca08bf8f3f7825
F src/sqliteInt.h 6f7c6552a6652f101e747c153fc3c1117b12f954
F src/table.c c89698bd5bb4b8d14722d6ee7e9be014c383d24a
F src/tclsqlite.c b82e4faeae89fdb7304b3c970979ade299336a1f
F src/test1.c 41eabe255970ef947263b94145c9b2766bab8675
F src/test2.c e9f99aa5ee73872819259d6612c11e55e1644321
F src/test3.c d6775f95fd91f5b3cf0e2382a28e5aaeb68f745b
F src/tokenize.c 830e9ef684334070a26583d94770bb869e2727bf
F src/update.c b1e315e20b98a013d30fd9ff3b7d9dc4f29b39b3
F src/util.c ac83973ecc647d3d3c58708f148442365abf9b94
F src/update.c 365f6fafe75f6816a598e76031b0a757d91c003d
F src/util.c 265cff871a6079b95878c738bc2da3420cca1375
F src/vdbe.c f1afb7a82016be2cb4cea24cf98dbb5af0ea7214
F src/vdbe.h cd4c8647051a0c22c0e133c375f1cd17bb8b1e06
F src/where.c 05d27a01e53c20b8cd10589b7e789b2a64367988
@ -103,7 +103,7 @@ F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl 03b521d252575f93b9c52f7c8b0007011512fcfb
F www/c_interface.tcl d446234c1d3ed747fcefd30e972a19f2b2fc0e05
F www/changes.tcl cdfba8341564efea07cb1e554963f2f8c3f9793c
F www/changes.tcl 5bb35cf96c744aaac092c25e194b35844d59fa48
F www/crosscompile.tcl c99efacb3aefaa550c6e80d91b240f55eb9fd33e
F www/download.tcl 3e51c9ff1326b0a182846134987301310dff7d60
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
@ -114,8 +114,8 @@ F www/opcode.tcl 7989ed328316454c7030dcdb60f09ae1e017286d
F www/speed.tcl 212a91d555384e01873160d6a189f1490c791bc2
F www/sqlite.tcl 6a21242a272e9c0939a04419a51c3d50cae33e3e
F www/tclsqlite.tcl 13d50723f583888fc80ae1a38247c0ab415066fa
F www/vdbe.tcl bb7d620995f0a987293e9d4fb6185a3b077e9b44
P 207a57ad2e4e1a44a4c0231b1ba334594402d6cd
R 0a13d7b08edf071b64dd2f420eda4445
F www/vdbe.tcl eb4e1768cffa266cbbb7133488022a7a6cb278d9
P be228cd13a4dcb7fdf7014910b7c61d502cb9a01
R b676570eed139d76f427f21092e18ba8
U drh
Z 06ae806c460464b0dc58a849aecc6f76
Z 75e264691fa9dda3479ccd075ddc9e4a

View File

@ -1 +1 @@
be228cd13a4dcb7fdf7014910b7c61d502cb9a01
03673adbfe0c8a92d79f86ddf1136736594208ad

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.39 2001/11/10 13:51:08 drh Exp $
** $Id: btree.c,v 1.40 2001/11/21 02:21:12 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -54,26 +54,6 @@
#include "btree.h"
#include <assert.h>
/*
** Primitive data types. u32 must be 4 bytes and u16 must be 2 bytes.
** The uptr type must be big enough to hold a pointer.
** Change these typedefs when porting to new architectures.
*/
typedef unsigned int uptr;
/* There are already defined in sqliteInt.h...
** typedef unsigned int u32;
** typedef unsigned short int u16;
** typedef unsigned char u8;
*/
/*
** This macro casts a pointer to an integer. Useful for doing
** pointer arithmetic.
*/
#define Addr(X) ((uptr)X)
/*
** Forward declarations of structures used only in this file.
*/
@ -829,7 +809,7 @@ int sqliteBtreeRollback(Btree *pBt){
int sqliteBtreeCursor(Btree *pBt, int iTable, int wrFlag, BtCursor **ppCur){
int rc;
BtCursor *pCur;
int nLock;
ptr nLock;
if( pBt->page1==0 ){
rc = lockBtree(pBt);
@ -852,7 +832,7 @@ int sqliteBtreeCursor(Btree *pBt, int iTable, int wrFlag, BtCursor **ppCur){
if( rc!=SQLITE_OK ){
goto create_cursor_exception;
}
nLock = (int)sqliteHashFind(&pBt->locks, 0, iTable);
nLock = (ptr)sqliteHashFind(&pBt->locks, 0, iTable);
if( nLock<0 || (nLock>0 && wrFlag) ){
rc = SQLITE_LOCKED;
goto create_cursor_exception;
@ -886,7 +866,7 @@ create_cursor_exception:
** when the last cursor is closed.
*/
int sqliteBtreeCloseCursor(BtCursor *pCur){
int nLock;
ptr nLock;
Btree *pBt = pCur->pBt;
if( pCur->pPrev ){
pCur->pPrev->pNext = pCur->pNext;
@ -900,7 +880,7 @@ int sqliteBtreeCloseCursor(BtCursor *pCur){
sqlitepager_unref(pCur->pPage);
}
unlockBtreeIfUnused(pBt);
nLock = (int)sqliteHashFind(&pBt->locks, 0, pCur->pgnoRoot);
nLock = (ptr)sqliteHashFind(&pBt->locks, 0, pCur->pgnoRoot);
assert( nLock!=0 || sqlite_malloc_failed );
nLock = nLock<0 ? 0 : nLock-1;
sqliteHashInsert(&pBt->locks, 0, pCur->pgnoRoot, (void*)nLock);
@ -2293,11 +2273,11 @@ static int clearDatabasePage(Btree *pBt, Pgno pgno, int freePageFlag){
*/
int sqliteBtreeClearTable(Btree *pBt, int iTable){
int rc;
int nLock;
ptr nLock;
if( !pBt->inTrans ){
return SQLITE_ERROR; /* Must start a transaction first */
}
nLock = (int)sqliteHashFind(&pBt->locks, 0, iTable);
nLock = (ptr)sqliteHashFind(&pBt->locks, 0, iTable);
if( nLock ){
return SQLITE_LOCKED;
}

View File

@ -25,7 +25,7 @@
** ROLLBACK
** PRAGMA
**
** $Id: build.c,v 1.55 2001/11/07 16:48:27 drh Exp $
** $Id: build.c,v 1.56 2001/11/21 02:21:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -101,7 +101,7 @@ Expr *sqliteExpr(int op, Expr *pLeft, Expr *pRight, Token *pToken){
void sqliteExprSpan(Expr *pExpr, Token *pLeft, Token *pRight){
if( pExpr ){
pExpr->span.z = pLeft->z;
pExpr->span.n = pRight->n + (int)pRight->z - (int)pLeft->z;
pExpr->span.n = pRight->n + Addr(pRight->z) - Addr(pLeft->z);
}
}
@ -498,7 +498,7 @@ void sqliteAddColumnType(Parse *pParse, Token *pFirst, Token *pLast){
i = p->nCol-1;
if( i<0 ) return;
pz = &p->aCol[i].zType;
n = pLast->n + ((int)pLast->z) - (int)pFirst->z;
n = pLast->n + Addr(pLast->z) - Addr(pFirst->z);
sqliteSetNString(pz, pFirst->z, n, 0);
z = *pz;
if( z==0 ) return;
@ -618,7 +618,7 @@ void sqliteEndTable(Parse *pParse, Token *pEnd){
v = sqliteGetVdbe(pParse);
if( v==0 ) return;
n = (int)pEnd->z - (int)pParse->sFirstToken.z + 1;
n = Addr(pEnd->z) - Addr(pParse->sFirstToken.z) + 1;
if( !p->isTemp ){
sqliteVdbeAddOp(v, OP_NewRecno, 0, 0);
sqliteVdbeAddOp(v, OP_String, 0, 0);
@ -972,7 +972,7 @@ void sqliteCreateIndex(
if( !isTemp ){
addr = sqliteVdbeAddOp(v, OP_String, 0, 0);
if( pStart && pEnd ){
n = (int)pEnd->z - (int)pStart->z + 1;
n = Addr(pEnd->z) - Addr(pStart->z) + 1;
sqliteVdbeChangeP3(v, addr, pStart->z, n);
}
sqliteVdbeAddOp(v, OP_MakeRecord, 5, 0);

View File

@ -12,7 +12,7 @@
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.3 2001/10/22 02:58:10 drh Exp $
** $Id: hash.c,v 1.4 2001/11/21 02:21:12 drh Exp $
*/
#include "sqliteInt.h"
#include <assert.h>
@ -68,11 +68,13 @@ static int intCompare(const void *pKey1, int n1, const void *pKey2, int n2){
** Hash and comparison functions when the mode is SQLITE_HASH_POINTER
*/
static int ptrHash(const void *pKey, int nKey){
nKey = (int)pKey;
return nKey ^ (nKey<<8) ^ (nKey>>8);
uptr x = Addr(pKey);
return x ^ (x<<8) ^ (x>>8);
}
static int ptrCompare(const void *pKey1, int n1, const void *pKey2, int n2){
return ((int)pKey2) - (int)pKey1;
if( pKey1==pKey2 ) return 0;
if( pKey1<pKey2 ) return -1;
return 1;
}
/*

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.69 2001/11/08 00:45:21 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.70 2001/11/21 02:21:12 drh Exp $
*/
#include "sqlite.h"
#include "hash.h"
@ -31,12 +31,35 @@
#define TEMP_PAGES 25
/*
** Integers of known sizes. These typedefs much change for architectures
** where the sizes very.
** Integers of known sizes. These typedefs might change for architectures
** where the sizes very. Preprocessor macros are available so that the
** types can be conveniently redefined at compile-type. Like this:
**
** cc '-DUINTPTR_TYPE=long long int' ...
*/
typedef unsigned int u32; /* 4-byte unsigned integer */
typedef unsigned short int u16; /* 2-byte unsigned integer */
typedef unsigned char u8; /* 1-byte unsigned integer */
#ifndef UINT32_TYPE
# define UINT32_TYPE unsigned int
#endif
#ifndef UINT16_TYPE
# define UINT16_TYPE unsigned short int
#endif
#ifndef UINT8_TYPE
# define UINT8_TYPE unsigned char
#endif
#ifndef INTPTR_TYPE
# define INTPTR_TYPE int
#endif
typedef UINT32_TYPE u32; /* 4-byte unsigned integer */
typedef UINT16_TYPE u16; /* 2-byte unsigned integer */
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */
typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */
/*
** This macro casts a pointer to an integer. Useful for doing
** pointer arithmetic.
*/
#define Addr(X) ((uptr)X)
/*
** The maximum number of bytes of data that can be put into a single

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.21 2001/11/07 14:22:00 drh Exp $
** $Id: update.c,v 1.22 2001/11/21 02:21:12 drh Exp $
*/
#include "sqliteInt.h"
@ -110,7 +110,7 @@ void sqliteUpdate(
}
}
/* Allocate memory for the array apIdx[] and fill it pointers to every
/* Allocate memory for the array apIdx[] and fill it with pointers to every
** index that needs to be updated. Indices only need updating if their
** key includes one of the columns named in pChanges.
*/
@ -193,7 +193,7 @@ void sqliteUpdate(
sqliteVdbeAddOp(v, OP_IdxDelete, base+i+1, 0);
}
/* Compute a completely new data for this record.
/* Compute new data for this record.
*/
for(i=0; i<pTab->nCol; i++){
j = aXRef[i];

View File

@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.31 2001/11/06 04:00:19 drh Exp $
** $Id: util.c,v 1.32 2001/11/21 02:21:12 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@ -769,7 +769,8 @@ int sqliteSortCompare(const char *a, const char *b){
** The following procedure converts a double-precision floating point
** number into a string. The resulting string has the property that
** two such strings comparied using strcmp() or memcmp() will give the
** same results as comparing the original floating point numbers.
** same results as a numeric comparison of the original floating point
** numbers.
**
** This routine is used to generate database keys from floating point
** numbers such that the keys sort in the same order as the original

View File

@ -17,6 +17,10 @@ proc chng {date desc} {
puts "<DD><P><UL>$desc</UL></P></DD>"
}
chng {2001 Nov ?? (2.1.2)} {
<li>Changes to support 64-bit architectures.</li>
}
chng {2001 Nov 13 (2.1.1)} {
<li>Bug fix: Sometimes arbirary strings were passed to the callback
function when the actual value of a column was NULL.</li>

View File

@ -1,7 +1,7 @@
#
# Run this Tcl script to generate the vdbe.html file.
#
set rcsid {$Id: vdbe.tcl,v 1.7 2001/09/28 23:11:24 drh Exp $}
set rcsid {$Id: vdbe.tcl,v 1.8 2001/11/21 02:21:13 drh Exp $}
puts {<html>
<head>
@ -1616,7 +1616,7 @@ difficulty understanding the rest.</p>
<p>If you find errors in either the documentation or the code,
feel free to fix them and/or contact the author at
<a href="drh@hwaci.com">drh@hwaci.com</a>. Your bug fixes or
<a href="mailto:drh@hwaci.com">drh@hwaci.com</a>. Your bug fixes or
suggestions are always welcomed.</p>
}