+/*
+** This header file is used by programs that want to link against the
+** FTS2 library. All it does is declare the sqlite3Fts2Init() interface.
+*/
#include "sqlite3.h"
#ifdef __cplusplus
** part of a token. In other words, delimiters all must have
** values of 0x7f or lower.
*/
-static const char isIdChar[] = {
+static const char porterIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 3x */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */
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) (((ch=C)&0x80)!=0 || (ch>0x2f && isIdChar[ch-0x30]))
-#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !isIdChar[ch-0x30]))
+#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30]))
/*
** Extract the next token from a tokenization cursor. The cursor must
/* Forward declaration */
static const sqlite3_tokenizer_module simpleTokenizerModule;
-static int isDelim(simple_tokenizer *t, unsigned char c){
+static int simpleDelim(simple_tokenizer *t, unsigned char c){
return c<0x80 && t->delim[c];
}
int iStartOffset;
/* Scan past delimiter characters */
- while( c->iOffset<c->nBytes && isDelim(t, p[c->iOffset]) ){
+ while( c->iOffset<c->nBytes && simpleDelim(t, p[c->iOffset]) ){
c->iOffset++;
}
/* Count non-delimiter characters. */
iStartOffset = c->iOffset;
- while( c->iOffset<c->nBytes && !isDelim(t, p[c->iOffset]) ){
+ while( c->iOffset<c->nBytes && !simpleDelim(t, p[c->iOffset]) ){
c->iOffset++;
}
--- /dev/null
+#!/usr/bin/tclsh
+#
+# This script builds a single C code file holding all of FTS2 code.
+# The name of the output file is fts2amal.c. To build this file,
+# first do:
+#
+# make target_source
+#
+# The make target above moves all of the source code files into
+# a subdirectory named "tsrc". (This script expects to find the files
+# there and will not work if they are not found.)
+#
+# After the "tsrc" directory has been created and populated, run
+# this script:
+#
+# tclsh mkfts2amal.tcl
+#
+# The amalgamated FTS2 code will be written into fts2amal.c
+#
+
+# Open the output file and write a header comment at the beginning
+# of the file.
+#
+set out [open fts2amal.c w]
+set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
+puts $out [subst \
+{/******************************************************************************
+** This file is an amalgamation of separate C source files from the SQLite
+** Full Text Search extension 2 (fts2). By combining all the individual C
+** code files into this single large file, the entire code can be compiled
+** as a one translation unit. This allows many compilers to do optimizations
+** that would not be possible if the files were compiled separately. It also
+** makes the code easier to import into other projects.
+**
+** This amalgamation was generated on $today.
+*/}]
+
+# These are the header files used by FTS2. The first time any of these
+# files are seen in a #include statement in the C code, include the complete
+# text of the file in-line. The file only needs to be included once.
+#
+foreach hdr {
+ fts2.h
+ fts2_hash.h
+ fts2_tokenizer.h
+ sqlite3.h
+ sqlite3ext.h
+} {
+ set available_hdr($hdr) 1
+}
+
+# 78 stars used for comment formatting.
+set s78 \
+{*****************************************************************************}
+
+# Insert a comment into the code
+#
+proc section_comment {text} {
+ global out s78
+ set n [string length $text]
+ set nstar [expr {60 - $n}]
+ set stars [string range $s78 0 $nstar]
+ puts $out "/************** $text $stars/"
+}
+
+# Read the source file named $filename and write it into the
+# sqlite3.c output file. If any #include statements are seen,
+# process them approprately.
+#
+proc copy_file {filename} {
+ global seen_hdr available_hdr out
+ set tail [file tail $filename]
+ section_comment "Begin file $tail"
+ set in [open $filename r]
+ while {![eof $in]} {
+ set line [gets $in]
+ if {[regexp {^#\s*include\s+["<]([^">]+)[">]} $line all hdr]} {
+ if {[info exists available_hdr($hdr)]} {
+ if {$available_hdr($hdr)} {
+ section_comment "Include $hdr in the middle of $tail"
+ copy_file tsrc/$hdr
+ section_comment "Continuing where we left off in $tail"
+ }
+ } elseif {![info exists seen_hdr($hdr)]} {
+ set seen_hdr($hdr) 1
+ puts $out $line
+ }
+ } elseif {[regexp {^#ifdef __cplusplus} $line]} {
+ puts $out "#if 0"
+ } elseif {[regexp {^#line} $line]} {
+ # Skip #line directives.
+ } else {
+ puts $out $line
+ }
+ }
+ close $in
+ section_comment "End of $tail"
+}
+
+
+# Process the source files. Process files containing commonly
+# used subroutines first in order to help the compiler find
+# inlining opportunities.
+#
+foreach file {
+ fts2.c
+ fts2_hash.c
+ fts2_porter.c
+ fts2_tokenizer1.c
+} {
+ copy_file tsrc/$file
+}
+
+close $out
-C Remove\sthe\sARRAYSIZE\smacro\sfrom\swhere.c\sto\savoid\sa\sname\sconflict\swith\nmicrosoft\sheader\sfiles.\s\sTicket\s#2311\s(CVS\s3863)
-D 2007-04-20T12:22:02
+C Add\sthe\sability\sto\sturn\sthe\sFTS2\smodule\sinto\san\samalgamation.\s(CVS\s3864)
+D 2007-04-21T16:37:49
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F ext/fts1/tokenizer.h 0c53421b832366d20d720d21ea3e1f6e66a36ef9
F ext/fts2/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts2/fts2.c dd35df80f4b99181d610302c5a4ac71406a02fe0
-F ext/fts2/fts2.h bbdab26d34f91974d5b9ade8b7836c140a7c4ce1
+F ext/fts2/fts2.h 591916a822cfb6426518fdbf6069359119bc46eb
F ext/fts2/fts2_hash.c b3f22116d4ef0bc8f2da6e3fdc435c86d0951a9b
F ext/fts2/fts2_hash.h e283308156018329f042816eb09334df714e105e
-F ext/fts2/fts2_porter.c df529ee9b70f21ebb9c5affd3c7669ee615accc7
+F ext/fts2/fts2_porter.c 991a45463553c7318063fe7773368a6c0f39e35d
F ext/fts2/fts2_tokenizer.h 4c5ffe31d63622869eb6eec1503df7f6996fd1bd
-F ext/fts2/fts2_tokenizer1.c 6067f2f710bc7e91c0688b7b11be1027777553e0
+F ext/fts2/fts2_tokenizer1.c 5c979fe8815f95396beb22b627571da895a025af
+F ext/fts2/mkfts2amal.tcl 2a9ec76b0760fe7f3669dca5bc0d60728bc1c977
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
F main.mk dd14eeac33ac5e6c062f43e79876948f1d64908b
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P dfac6082e8ffc52a85c4906107a7fc0e1aa9df82
-R 70a329ef96824c4ac0f20c0e9d368dfe
+P 9389a15f35f854c88440e365d85b48af3ff76b00
+R 2cbc78e0dd70ca0f7d6672765f8b0a98
U drh
-Z 1b6107bb1679b972c0e210e23338040a
+Z 36d5b444e4309d5378f3e0773c4a5bc8
-9389a15f35f854c88440e365d85b48af3ff76b00
\ No newline at end of file
+94374654ccabb391f5dcccfc88176ca677c5804e
\ No newline at end of file