mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Support generating the '.def' file using the autoconf Makefile for MSVC.
FossilOrigin-Name: 3617564cb630ed418badf43d2c0291c11c166d12
This commit is contained in:
12
Makefile.msc
12
Makefile.msc
@ -306,6 +306,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
|
|||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
|
# Check for the predefined command macro CSC. This should point to a working
|
||||||
|
# C Sharp compiler binary. If it is not defined, simply define it to the
|
||||||
|
# legacy default value 'csc.exe'.
|
||||||
|
#
|
||||||
|
!IFNDEF CSC
|
||||||
|
CSC = csc.exe
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
# Check for the command macro LD. This should point to the linker binary for
|
# Check for the command macro LD. This should point to the linker binary for
|
||||||
# the target platform. If it is not defined, simply define it to the legacy
|
# the target platform. If it is not defined, simply define it to the legacy
|
||||||
# default value 'link.exe'.
|
# default value 'link.exe'.
|
||||||
@ -1408,13 +1416,13 @@ libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
|
|||||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||||
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
||||||
|
|
||||||
# <<mark>>
|
# <<block2>>
|
||||||
sqlite3.def: libsqlite3.lib
|
sqlite3.def: libsqlite3.lib
|
||||||
echo EXPORTS > sqlite3.def
|
echo EXPORTS > sqlite3.def
|
||||||
dumpbin /all libsqlite3.lib \
|
dumpbin /all libsqlite3.lib \
|
||||||
| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \
|
| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3_[^@]*)(?:@\d+)?$$" \1 \
|
||||||
| sort >> sqlite3.def
|
| sort >> sqlite3.def
|
||||||
# <</mark>>
|
# <</block2>>
|
||||||
|
|
||||||
$(SQLITE3EXE): $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
|
$(SQLITE3EXE): $(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
|
||||||
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(SHELL_CORE_SRC) \
|
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(SHELL_CORE_SRC) \
|
||||||
|
@ -291,6 +291,14 @@ PROGRAMFILES_X86 = $(PROGRAMFILES_X86:\\=\)
|
|||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
|
# Check for the predefined command macro CSC. This should point to a working
|
||||||
|
# C Sharp compiler binary. If it is not defined, simply define it to the
|
||||||
|
# legacy default value 'csc.exe'.
|
||||||
|
#
|
||||||
|
!IFNDEF CSC
|
||||||
|
CSC = csc.exe
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
# Check for the command macro LD. This should point to the linker binary for
|
# Check for the command macro LD. This should point to the linker binary for
|
||||||
# the target platform. If it is not defined, simply define it to the legacy
|
# the target platform. If it is not defined, simply define it to the legacy
|
||||||
# default value 'link.exe'.
|
# default value 'link.exe'.
|
||||||
@ -460,7 +468,7 @@ CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
|
|||||||
!IF $(DYNAMIC_SHELL)!=0
|
!IF $(DYNAMIC_SHELL)!=0
|
||||||
CORE_LINK_DEP =
|
CORE_LINK_DEP =
|
||||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||||
CORE_LINK_DEP =
|
CORE_LINK_DEP = sqlite3.def
|
||||||
!ELSE
|
!ELSE
|
||||||
CORE_LINK_DEP =
|
CORE_LINK_DEP =
|
||||||
!ENDIF
|
!ENDIF
|
||||||
@ -472,7 +480,7 @@ CORE_LINK_DEP =
|
|||||||
!IF $(DYNAMIC_SHELL)!=0
|
!IF $(DYNAMIC_SHELL)!=0
|
||||||
CORE_LINK_OPTS =
|
CORE_LINK_OPTS =
|
||||||
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
!ELSEIF $(FOR_WIN10)==0 || "$(PLATFORM)"=="x86"
|
||||||
CORE_LINK_OPTS =
|
CORE_LINK_OPTS = /DEF:sqlite3.def
|
||||||
!ELSE
|
!ELSE
|
||||||
CORE_LINK_OPTS =
|
CORE_LINK_OPTS =
|
||||||
!ENDIF
|
!ENDIF
|
||||||
@ -888,6 +896,14 @@ shell: $(SQLITE3EXE)
|
|||||||
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
$(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
|
||||||
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
|
||||||
|
|
||||||
|
Replace.exe:
|
||||||
|
$(CSC) /target:exe $(TOP)\Replace.cs
|
||||||
|
|
||||||
|
sqlite3.def: Replace.exe $(LIBOBJ)
|
||||||
|
echo EXPORTS > sqlite3.def
|
||||||
|
dumpbin /all $(LIBOBJ) \
|
||||||
|
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
|
||||||
|
| sort >> sqlite3.def
|
||||||
|
|
||||||
$(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
|
$(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)
|
||||||
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \
|
$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\shell.c $(SHELL_CORE_SRC) \
|
||||||
|
@ -6,8 +6,8 @@ This package contains:
|
|||||||
* the shell.c file used to build the sqlite3 command-line shell program
|
* the shell.c file used to build the sqlite3 command-line shell program
|
||||||
* autoconf/automake installation infrastucture for building on POSIX
|
* autoconf/automake installation infrastucture for building on POSIX
|
||||||
compliant systems
|
compliant systems
|
||||||
* a Makefile.msc and sqlite3.rc for building with Microsoft Visual C++ on
|
* a Makefile.msc, sqlite3.rc, and Replace.cs for building with Microsoft
|
||||||
Windows
|
Visual C++ on Windows
|
||||||
|
|
||||||
SUMMARY OF HOW TO BUILD
|
SUMMARY OF HOW TO BUILD
|
||||||
=======================
|
=======================
|
||||||
|
23
manifest
23
manifest
@ -1,8 +1,8 @@
|
|||||||
C Fix\sa\spotential\sbuffer\soverflow\sin\sthe\sICU\supper()\sfunction.
|
C Support\sgenerating\sthe\s'.def'\sfile\susing\sthe\sautoconf\sMakefile\sfor\sMSVC.
|
||||||
D 2016-02-26T21:20:57.225
|
D 2016-02-26T23:13:16.711
|
||||||
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
|
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc 56ea123a975690bf9ed38b31bb89ff87b02a7c2b
|
F Makefile.msc b6eb7a434c2e160a042036bd5047c3bd89eedacc
|
||||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||||
F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f
|
F VERSION c6b1f51809551d60ad001e6d87cf3ab2c7f54b6f
|
||||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||||
@ -11,9 +11,9 @@ F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
|||||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||||
F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4
|
F autoconf/Makefile.am 29e2a6e8d0c5e32723a48b4faf6b168854dde5f4
|
||||||
F autoconf/Makefile.msc 3cbf11c911fafd4d95fbe8aec059b5aa586a0157
|
F autoconf/Makefile.msc 91fe02447e4a90b9368b2b1406d51ee5f7e83c6a
|
||||||
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
|
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
|
||||||
F autoconf/README.txt 7c31da66232f7590bb987cfcd4e2381744b25d24
|
F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1
|
||||||
F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8
|
F autoconf/configure.ac 72a5e42beb090b32bca580285dc0ab3c4670adb8
|
||||||
F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd
|
F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd
|
||||||
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
|
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
|
||||||
@ -1368,6 +1368,7 @@ F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
|
|||||||
F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac
|
F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac
|
||||||
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
|
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
|
||||||
F tool/GetTclKit.bat 629d87562e0487c386db630033931d12d62e6372
|
F tool/GetTclKit.bat 629d87562e0487c386db630033931d12d62e6372
|
||||||
|
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
|
||||||
F tool/addopcodes.tcl 4ca9c3ef196f08da30add5d07ce0c9458dc8c633
|
F tool/addopcodes.tcl 4ca9c3ef196f08da30add5d07ce0c9458dc8c633
|
||||||
F tool/build-all-msvc.bat 55be1cf8545dabd69df2ba6b3de6868da0c26f52 x
|
F tool/build-all-msvc.bat 55be1cf8545dabd69df2ba6b3de6868da0c26f52 x
|
||||||
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
|
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
|
||||||
@ -1384,9 +1385,9 @@ F tool/lemon.c 251f5c3f21b553240cbdd42dd187a51bb2372cd3
|
|||||||
F tool/lempar.c d5114c7d13aa3af1e27ff3d02e4dea6eadec7ddf
|
F tool/lempar.c d5114c7d13aa3af1e27ff3d02e4dea6eadec7ddf
|
||||||
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
|
||||||
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
||||||
F tool/mkautoconfamal.sh c78caa3214f25dc28ea157b5a82abb311f209906
|
F tool/mkautoconfamal.sh e855df211ecbcc7131dee817110ff386cfb112f7
|
||||||
F tool/mkkeywordhash.c f7f3b342211ac6a14258b9726d5b97cf4f548f22
|
F tool/mkkeywordhash.c f7f3b342211ac6a14258b9726d5b97cf4f548f22
|
||||||
F tool/mkmsvcmin.tcl f9fc6f6a373084c0e0feef972485212bd0869c06
|
F tool/mkmsvcmin.tcl 2f12f7fa8858bbe61cf81820a2da96c79ed1ca8d
|
||||||
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
|
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
|
||||||
F tool/mkopcodeh.tcl 385c62d78c38b2d92146dcb5abd319dbbc33506d
|
F tool/mkopcodeh.tcl 385c62d78c38b2d92146dcb5abd319dbbc33506d
|
||||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||||
@ -1450,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P cf4e4fbdb6a29b7fbd5150958ab4f8f2a1cd7f21
|
P b8dc1b9f5d413000387bfe784b69f5d0ee5c0489
|
||||||
R a5aa0b45f5ae16ce5e364c4bc7498593
|
R e824451697993aa684f279d9331c397b
|
||||||
U drh
|
U mistachkin
|
||||||
Z d4cfa74b26d8bc26b2ff43ad0d4d53e2
|
Z bb33bef608d1de79741a7de07ef806b0
|
||||||
|
@ -1 +1 @@
|
|||||||
b8dc1b9f5d413000387bfe784b69f5d0ee5c0489
|
3617564cb630ed418badf43d2c0291c11c166d12
|
223
tool/Replace.cs
Normal file
223
tool/Replace.cs
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
/*
|
||||||
|
** 2016 February 26
|
||||||
|
**
|
||||||
|
** 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 C# code to perform regular expression replacements
|
||||||
|
** using the standard input and output channels.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#region Assembly Metadata
|
||||||
|
[assembly: AssemblyTitle("Replace Tool")]
|
||||||
|
[assembly: AssemblyDescription("Replace text using standard input/output.")]
|
||||||
|
[assembly: AssemblyCompany("SQLite Development Team")]
|
||||||
|
[assembly: AssemblyProduct("SQLite")]
|
||||||
|
[assembly: AssemblyCopyright("Public Domain")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
[assembly: Guid("95a0513f-8863-48cd-a76f-cb80868cb578")]
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
[assembly: AssemblyConfiguration("Debug")]
|
||||||
|
#else
|
||||||
|
[assembly: AssemblyConfiguration("Release")]
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace Replace
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This enumeration is used to represent all the possible exit codes from
|
||||||
|
/// this tool.
|
||||||
|
/// </summary>
|
||||||
|
internal enum ExitCode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The file download was a success.
|
||||||
|
/// </summary>
|
||||||
|
Success = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The command line arguments are missing (i.e. null). Generally,
|
||||||
|
/// this should not happen.
|
||||||
|
/// </summary>
|
||||||
|
MissingArgs = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The wrong number of command line arguments was supplied.
|
||||||
|
/// </summary>
|
||||||
|
WrongNumArgs = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The "matchingOnly" flag could not be converted to a value of the
|
||||||
|
/// <see cref="Boolean"/> type.
|
||||||
|
/// </summary>
|
||||||
|
BadMatchingOnlyFlag = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An exception was caught in <see cref="Main" />. Generally, this
|
||||||
|
/// should not happen.
|
||||||
|
/// </summary>
|
||||||
|
Exception = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
internal static class Replace
|
||||||
|
{
|
||||||
|
#region Private Support Methods
|
||||||
|
/// <summary>
|
||||||
|
/// This method displays an error message to the console and/or
|
||||||
|
/// displays the command line usage information for this tool.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">
|
||||||
|
/// The error message to display, if any.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="usage">
|
||||||
|
/// Non-zero to display the command line usage information.
|
||||||
|
/// </param>
|
||||||
|
private static void Error(
|
||||||
|
string message,
|
||||||
|
bool usage
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (message != null)
|
||||||
|
Console.WriteLine(message);
|
||||||
|
|
||||||
|
string fileName = Path.GetFileName(
|
||||||
|
Process.GetCurrentProcess().MainModule.FileName);
|
||||||
|
|
||||||
|
Console.WriteLine(String.Format(
|
||||||
|
"usage: {0} <regExPattern> <regExSubSpec> <matchingOnly>",
|
||||||
|
fileName));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#region Program Entry Point
|
||||||
|
/// <summary>
|
||||||
|
/// This is the entry-point for this tool. It handles processing the
|
||||||
|
/// command line arguments, reading from the standard input channel,
|
||||||
|
/// replacing any matching lines of text, and writing to the standard
|
||||||
|
/// output channel.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">
|
||||||
|
/// The command line arguments.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// Zero upon success; non-zero on failure. This will be one of the
|
||||||
|
/// values from the <see cref="ExitCode" /> enumeration.
|
||||||
|
/// </returns>
|
||||||
|
private static int Main(
|
||||||
|
string[] args
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// NOTE: Sanity check the command line arguments.
|
||||||
|
//
|
||||||
|
if (args == null)
|
||||||
|
{
|
||||||
|
Error(null, true);
|
||||||
|
return (int)ExitCode.MissingArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Length != 3)
|
||||||
|
{
|
||||||
|
Error(null, true);
|
||||||
|
return (int)ExitCode.WrongNumArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// NOTE: Create a regular expression from the first command
|
||||||
|
// line argument. Then, grab the replacement string,
|
||||||
|
// which is the second argument.
|
||||||
|
//
|
||||||
|
Regex regEx = new Regex(args[0]);
|
||||||
|
string replacement = args[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: Attempt to convert the third argument to a boolean.
|
||||||
|
//
|
||||||
|
bool matchingOnly;
|
||||||
|
|
||||||
|
if (!bool.TryParse(args[2], out matchingOnly))
|
||||||
|
{
|
||||||
|
Error(null, true);
|
||||||
|
return (int)ExitCode.BadMatchingOnlyFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: Grab the standard input and output channels from the
|
||||||
|
// console.
|
||||||
|
//
|
||||||
|
TextReader inputTextReader = Console.In;
|
||||||
|
TextWriter outputTextWriter = Console.Out;
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: Loop until end-of-file is hit on the standard input
|
||||||
|
// stream.
|
||||||
|
//
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// NOTE: Read a line from the standard input channel. If
|
||||||
|
// null is returned here, there is no more input and
|
||||||
|
// we are done.
|
||||||
|
//
|
||||||
|
string inputLine = inputTextReader.ReadLine();
|
||||||
|
|
||||||
|
if (inputLine == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: Perform regular expression replacements on this
|
||||||
|
// line, if any. Then, write the modified line to
|
||||||
|
// the standard output channel.
|
||||||
|
//
|
||||||
|
string outputLine = regEx.Replace(inputLine, replacement);
|
||||||
|
|
||||||
|
if (!matchingOnly || !String.Equals(
|
||||||
|
inputLine, outputLine, StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
outputTextWriter.WriteLine(outputLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: At this point, everything has succeeded.
|
||||||
|
//
|
||||||
|
return (int)ExitCode.Success;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// NOTE: An exception was caught. Report it via the console
|
||||||
|
// and return failure.
|
||||||
|
//
|
||||||
|
Error(e.ToString(), false);
|
||||||
|
return (int)ExitCode.Exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -53,6 +53,7 @@ cp $TOP/sqlite3.1 $TMPSPACE
|
|||||||
cp $TOP/sqlite3.pc.in $TMPSPACE
|
cp $TOP/sqlite3.pc.in $TMPSPACE
|
||||||
cp $TOP/src/shell.c $TMPSPACE
|
cp $TOP/src/shell.c $TMPSPACE
|
||||||
cp $TOP/src/sqlite3.rc $TMPSPACE
|
cp $TOP/src/sqlite3.rc $TMPSPACE
|
||||||
|
cp $TOP/tool/Replace.cs $TMPSPACE
|
||||||
|
|
||||||
cat $TMPSPACE/configure.ac |
|
cat $TMPSPACE/configure.ac |
|
||||||
sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp
|
sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp
|
||||||
|
@ -72,6 +72,21 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
|
|||||||
$(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
|
$(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
|
||||||
}]]
|
}]]
|
||||||
|
|
||||||
|
#
|
||||||
|
# NOTE: This block is used to replace the section marked <<block2>> in
|
||||||
|
# the Makefile, if it exists.
|
||||||
|
#
|
||||||
|
set blocks(2) [string trimleft [string map [list \\\\ \\] {
|
||||||
|
Replace.exe:
|
||||||
|
$(CSC) /target:exe $(TOP)\Replace.cs
|
||||||
|
|
||||||
|
sqlite3.def: Replace.exe $(LIBOBJ)
|
||||||
|
echo EXPORTS > sqlite3.def
|
||||||
|
dumpbin /all $(LIBOBJ) \\
|
||||||
|
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \\
|
||||||
|
| sort >> sqlite3.def
|
||||||
|
}]]
|
||||||
|
|
||||||
set data "#### DO NOT EDIT ####\n"
|
set data "#### DO NOT EDIT ####\n"
|
||||||
append data "# This makefile is automatically "
|
append data "# This makefile is automatically "
|
||||||
append data "generated from the [file tail $fromFileName] at\n"
|
append data "generated from the [file tail $fromFileName] at\n"
|
||||||
@ -90,8 +105,6 @@ foreach i [lsort -integer [array names blocks]] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set data [string map [list " -I\$(TOP)\\src" ""] $data]
|
set data [string map [list " -I\$(TOP)\\src" ""] $data]
|
||||||
set data [string map [list " /DEF:sqlite3.def" ""] $data]
|
|
||||||
set data [string map [list " sqlite3.def" ""] $data]
|
|
||||||
set data [string map [list " libsqlite3.lib" ""] $data]
|
set data [string map [list " libsqlite3.lib" ""] $data]
|
||||||
set data [string map [list " \$(ALL_TCL_TARGETS)" ""] $data]
|
set data [string map [list " \$(ALL_TCL_TARGETS)" ""] $data]
|
||||||
set data [string map [list "\$(TOP)\\src\\" "\$(TOP)\\"] $data]
|
set data [string map [list "\$(TOP)\\src\\" "\$(TOP)\\"] $data]
|
||||||
|
Reference in New Issue
Block a user