From f74b9e0965bdf30ca8911ca28a5f7ad6e11d6b22 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 26 Nov 2013 01:00:31 +0000 Subject: [PATCH] Further work on Windows header file reform. FossilOrigin-Name: 540f5525160b516de282136ca77f909115a51630 --- Makefile.in | 2 ++ Makefile.msc | 2 ++ Makefile.vxworks | 2 ++ main.mk | 2 ++ manifest | 37 ++++++++++++------------ manifest.uuid | 2 +- src/os.h | 36 ++---------------------- src/os_setup.h | 56 +++++++++++++++++++++++++++++++++++++ src/test1.c | 4 +++ src/test_config.c | 4 +++ src/test_osinst.c | 7 ++++- src/test_quota.c | 40 ++------------------------ src/test_quota.h | 6 ---- tool/mksqlite3c-noext.tcl | 1 + tool/mksqlite3c.tcl | 1 + tool/mksqlite3internalh.tcl | 1 + 16 files changed, 106 insertions(+), 97 deletions(-) create mode 100644 src/os_setup.h diff --git a/Makefile.in b/Makefile.in index d96d30ae86..d554412348 100644 --- a/Makefile.in +++ b/Makefile.in @@ -239,6 +239,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -458,6 +459,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/Makefile.msc b/Makefile.msc index afe66baad8..18dfdf34b7 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -626,6 +626,7 @@ SRC = \ $(TOP)\src\os.c \ $(TOP)\src\os.h \ $(TOP)\src\os_common.h \ + $(TOP)\src\os_setup.h \ $(TOP)\src\os_unix.c \ $(TOP)\src\os_win.c \ $(TOP)\src\os_win.h \ @@ -848,6 +849,7 @@ HDR = \ opcodes.h \ $(TOP)\src\os.h \ $(TOP)\src\os_common.h \ + $(TOP)\src\os_setup.h \ $(TOP)\src\os_win.h \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ diff --git a/Makefile.vxworks b/Makefile.vxworks index 70b9bdde6b..0d9c27f635 100644 --- a/Makefile.vxworks +++ b/Makefile.vxworks @@ -262,6 +262,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -417,6 +418,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/main.mk b/main.mk index 4992de549b..904ddd708f 100644 --- a/main.mk +++ b/main.mk @@ -121,6 +121,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -340,6 +341,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/manifest b/manifest index 3f9a102e7b..2c2f3db4d5 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Merge\supdates\sfrom\strunk. -D 2013-11-26T00:33:25.374 +C Further\swork\son\sWindows\sheader\sfile\sreform. +D 2013-11-26T01:00:31.440 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 16254fb023b7e69788013f0da5ccdc2063ba2328 +F Makefile.in 5d0d35aef4d0601493f9b26e2f859b3e471b63ed F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 7e91dccedae82c45dbf91a4e8240c642c2b90c83 -F Makefile.vxworks f921bd6a0600e36d67da080d820ae712ab393f30 +F Makefile.msc d66f5d9f338735e07aa4f6e3c99491421cca24f5 +F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION 52f7e22bfcec71a462e34194b4ae1671380fde59 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -142,7 +142,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff -F main.mk c9b6d61c55f461543244d63992c63037c3f11dac +F main.mk 6e5cc23140ed3a85716c02376adc86aa11cfb673 F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338 @@ -203,8 +203,9 @@ F src/mutex_unix.c c3a4e00f96ba068a8dbef34084465979aaf369cc F src/mutex_w32.c ab08c0fc54b71979370ca7c8f42fc64a9f211ebb F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be -F src/os.h cd8fd6545d6a936bae05026136324ec8e620c7f8 +F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 +F src/os_setup.h 55a27b7b02b8fb289e16749df17edcc376ba2dfb F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 F src/os_win.c 99a5668c207bee7fae238209a3043c03b6050056 F src/os_win.h ac253253d080dc3dd261efe5e98626c4b95e5a26 @@ -230,7 +231,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 3b5f3716e320480659239abe887164521c575d83 -F src/test1.c 5757066e503a8ed51313cb3a5d9bcdcced2991a9 +F src/test1.c 8d96df19f045c629311751ed89c02c374d108e51 F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -243,7 +244,7 @@ F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 3875e899222b651e18b662f86e0e50daa946344e F src/test_btree.c 5b89601dcb42a33ba8b820a6b763cc9cb48bac16 -F src/test_config.c 10d0e00dd6315879a6d9fac20bd063c7bbbfb8f8 +F src/test_config.c 3186c5be34de7cd8c47487687e65ca2fb8bf6471 F src/test_demovfs.c 69b2085076654ebc18014cbc6386f04409c959a9 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f @@ -259,10 +260,10 @@ F src/test_multiplex.c 9f304bf04170c91c0318238d512df2da039eb1c8 F src/test_multiplex.h 110a8c4d356e0aa464ca8730375608a9a0b61ae1 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 -F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba +F src/test_osinst.c 3d0340bc31a9f3d8a3547e0272373e80f78dde25 F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00 -F src/test_quota.c 30c64f0ef84734f2231a686df41ed882b0c59bc0 -F src/test_quota.h 8761e463b25e75ebc078bd67d70e39b9c817a0cb +F src/test_quota.c 65f6348fec0f2b3020c907247fb47556b214abb9 +F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d F src/test_rtree.c f3d1d12538dccb75fd916e3fa58f250edbdd3b47 F src/test_schema.c cd12a2223c3a394f4d07bb93bdf6d344c5c121b6 F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe @@ -1113,10 +1114,10 @@ F tool/mkkeywordhash.c 189d76644e373c7d0864c628deb8ce7b4f403591 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 78a77b2c554d534c6f2dc903130186ed15715460 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 1407684f6781496421be53841f1259303f0c8be9 -F tool/mksqlite3c.tcl c6b22da4d4ee272afda33f0aeb896d9c2e26dc95 +F tool/mksqlite3c-noext.tcl 1712d3d71256ca1f297046619c89e77a4d7c8f6d +F tool/mksqlite3c.tcl db30eeba8bb34561985938438abca200689e8bc0 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 -F tool/mksqlite3internalh.tcl ba0532989220eaef044cbb8c0108eca623d23bbc +F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 F tool/mkvsix.tcl 6477fb9dab838b7eea1eed50658ff1cda04850b5 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 4665982e95a6e5c1bd806cf7bc3dea95be422d77 @@ -1144,7 +1145,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 94219b9f1ff59ea408c7ded167ee28b00c0f38c1 9954327c0febc0ece46f62e05976330a1b82b48f -R 8ba15fb22b38fc61c6334c03ecc16c63 +P c5ab4378756965b0c2ab218e5ec59c40898b89ea +R 3f71be42bb92a89017dddc2d61b45fe7 U mistachkin -Z a3a638752bfaa9f69bc41b7e3e5dbf34 +Z beeb2b639ff26c8bb19c3f48e2444291 diff --git a/manifest.uuid b/manifest.uuid index b8c2a58092..5a187b121e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5ab4378756965b0c2ab218e5ec59c40898b89ea \ No newline at end of file +540f5525160b516de282136ca77f909115a51630 \ No newline at end of file diff --git a/src/os.h b/src/os.h index 1d438d22cd..3920a62ee3 100644 --- a/src/os.h +++ b/src/os.h @@ -21,40 +21,10 @@ #define _SQLITE_OS_H_ /* -** Figure out if we are dealing with Unix, Windows, or some other -** operating system. After the following block of preprocess macros, -** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, and SQLITE_OS_OTHER -** will defined to either 1 or 0. One of the four will be 1. The other -** three will be 0. +** Attempt to automatically detect the operating system and setup the +** necessary pre-processor macros for it. */ -#if defined(SQLITE_OS_OTHER) -# if SQLITE_OS_OTHER==1 -# undef SQLITE_OS_UNIX -# define SQLITE_OS_UNIX 0 -# undef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# else -# undef SQLITE_OS_OTHER -# endif -#endif -#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) -# define SQLITE_OS_OTHER 0 -# ifndef SQLITE_OS_WIN -# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) -# define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 -# else -# define SQLITE_OS_WIN 0 -# define SQLITE_OS_UNIX 1 -# endif -# else -# define SQLITE_OS_UNIX 0 -# endif -#else -# ifndef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# endif -#endif +#include "os_setup.h" /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op diff --git a/src/os_setup.h b/src/os_setup.h new file mode 100644 index 0000000000..b04fbf7cf6 --- /dev/null +++ b/src/os_setup.h @@ -0,0 +1,56 @@ +/* +** 2013 November 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. +*/ +#ifndef _OS_SETUP_H_ +#define _OS_SETUP_H_ + +/* +** Figure out if we are dealing with Unix, Windows, or some other operating +** system. +** +** After the following block of preprocess macros, all of SQLITE_OS_UNIX, +** SQLITE_OS_WIN, and SQLITE_OS_OTHER will defined to either 1 or 0. One of +** the four will be 1. The other three will be 0. +*/ +#if defined(SQLITE_OS_OTHER) +# if SQLITE_OS_OTHER==1 +# undef SQLITE_OS_UNIX +# define SQLITE_OS_UNIX 0 +# undef SQLITE_OS_WIN +# define SQLITE_OS_WIN 0 +# else +# undef SQLITE_OS_OTHER +# endif +#endif +#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) +# define SQLITE_OS_OTHER 0 +# ifndef SQLITE_OS_WIN +# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \ + defined(__MINGW32__) || defined(__BORLANDC__) +# define SQLITE_OS_WIN 1 +# define SQLITE_OS_UNIX 0 +# else +# define SQLITE_OS_WIN 0 +# define SQLITE_OS_UNIX 1 +# endif +# else +# define SQLITE_OS_UNIX 0 +# endif +#else +# ifndef SQLITE_OS_WIN +# define SQLITE_OS_WIN 0 +# endif +#endif + +#endif /* _OS_SETUP_H_ */ diff --git a/src/test1.c b/src/test1.c index d8a9e52d21..88e42b2d76 100644 --- a/src/test1.c +++ b/src/test1.c @@ -14,6 +14,10 @@ ** testing of the SQLite library. */ #include "sqliteInt.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include "vdbeInt.h" #include "tcl.h" #include diff --git a/src/test_config.c b/src/test_config.c index f44be40508..e5d5d0739d 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -20,6 +20,10 @@ #include "sqliteLimit.h" #include "sqliteInt.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include "tcl.h" #include #include diff --git a/src/test_osinst.c b/src/test_osinst.c index 531433313e..1701def159 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -70,6 +70,12 @@ */ #include "sqlite3.h" + +#include "os_setup.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include #include @@ -221,7 +227,6 @@ static sqlite3_uint64 vfslog_time(){ return sTime.tv_usec + (sqlite3_uint64)sTime.tv_sec * 1000000; } #elif SQLITE_OS_WIN -#include #include static sqlite3_uint64 vfslog_time(){ FILETIME ft; diff --git a/src/test_quota.c b/src/test_quota.c index e590996ca4..80ebd0589e 100644 --- a/src/test_quota.c +++ b/src/test_quota.c @@ -44,49 +44,13 @@ #define sqlite3_mutex_notheld(X) ((void)(X),1) #endif /* SQLITE_THREADSAFE==0 */ - -/* -** Figure out if we are dealing with Unix, Windows, or some other -** operating system. After the following block of preprocess macros, -** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, and SQLITE_OS_OTHER -** will defined to either 1 or 0. One of the four will be 1. The other -** three will be 0. -*/ -#if defined(SQLITE_OS_OTHER) -# if SQLITE_OS_OTHER==1 -# undef SQLITE_OS_UNIX -# define SQLITE_OS_UNIX 0 -# undef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# else -# undef SQLITE_OS_OTHER -# endif -#endif -#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) -# define SQLITE_OS_OTHER 0 -# ifndef SQLITE_OS_WIN -# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \ - || defined(__MINGW32__) || defined(__BORLANDC__) -# define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 -# else -# define SQLITE_OS_WIN 0 -# define SQLITE_OS_UNIX 1 -# endif -# else -# define SQLITE_OS_UNIX 0 -# endif -#else -# ifndef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# endif -#endif +#include "os_setup.h" #if SQLITE_OS_UNIX # include #endif #if SQLITE_OS_WIN -# include +# include "os_win.h" # include #endif diff --git a/src/test_quota.h b/src/test_quota.h index 2d0767a19a..c17e15adca 100644 --- a/src/test_quota.h +++ b/src/test_quota.h @@ -31,12 +31,6 @@ #include #include #include -#if SQLITE_OS_UNIX -# include -#endif -#if SQLITE_OS_WIN -# include -#endif /* Make this callable from C++ */ #ifdef __cplusplus diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index 02d9ae5469..ecb9cb0439 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -99,6 +99,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index e565bcbfe3..cdfba7add7 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -103,6 +103,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h diff --git a/tool/mksqlite3internalh.tcl b/tool/mksqlite3internalh.tcl index 3938316eec..7e92b3ad7d 100644 --- a/tool/mksqlite3internalh.tcl +++ b/tool/mksqlite3internalh.tcl @@ -60,6 +60,7 @@ foreach hdr { keywordhash.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h