summaryrefslogtreecommitdiff
path: root/qdbm/misc
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2010-01-09 16:15:40 +0000
committerChris Wilson <chris+github@qwirx.com>2010-01-09 16:15:40 +0000
commit84ce49c7e644e2a7da022f55a703e30498eee388 (patch)
treeb2c2e4ed6560735261652e94ff6bb19532a8e76a /qdbm/misc
parent059daaf09d915509982cdf472d4f3aa8c78c4d25 (diff)
Add QDBM 1.8.77 dbm-compatible database library to sources, will
probably be used as a default for the reference tracking implementation as it's smaller than BDB and apparently faster.
Diffstat (limited to 'qdbm/misc')
-rw-r--r--qdbm/misc/COPYING.txt504
-rw-r--r--qdbm/misc/README-win32.txt101
-rw-r--r--qdbm/misc/VCmakefile-old169
-rw-r--r--qdbm/misc/benchmark.pdfbin0 -> 52196 bytes
-rw-r--r--qdbm/misc/icon16.pngbin0 -> 339 bytes
-rw-r--r--qdbm/misc/icon20.pngbin0 -> 275 bytes
-rw-r--r--qdbm/misc/index.html202
-rw-r--r--qdbm/misc/index.ja.html209
-rw-r--r--qdbm/misc/logo.pngbin0 -> 11430 bytes
-rwxr-xr-xqdbm/misc/makevcdef48
-rw-r--r--qdbm/misc/mymemo-ja.html34
-rw-r--r--qdbm/misc/tutorial-ja.html622
-rw-r--r--qdbm/misc/win32check.bat111
13 files changed, 2000 insertions, 0 deletions
diff --git a/qdbm/misc/COPYING.txt b/qdbm/misc/COPYING.txt
new file mode 100644
index 00000000..b1e3f5a2
--- /dev/null
+++ b/qdbm/misc/COPYING.txt
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/qdbm/misc/README-win32.txt b/qdbm/misc/README-win32.txt
new file mode 100644
index 00000000..d5a98e2d
--- /dev/null
+++ b/qdbm/misc/README-win32.txt
@@ -0,0 +1,101 @@
+================================================================
+ QDBM: Quick Database Manager
+ Copyright (C) 2000-2007 Mikio Hirabayashi
+================================================================
+
+This is a package of Win32 binaries of QDBM. It contains C/Java
+APIs, their utility commands, and CGI scripts.
+
+See http://qdbm.sourceforge.net/ for more information.
+
+
+The following are documents of specifications.
+
+ spex.html : fundamental specifications
+ spex-ja.html : fundamental specifications in Japanese
+ jspex.html : specifications of Java API
+ jspex-ja.html : specifications of Java API in Japanese
+ japidoc/ : documents of Java API
+
+
+The following are header files of C language.
+Include them at source codes of your applications.
+
+ depot.h
+ curia.h
+ relic.h
+ hovel.h
+ cabin.h
+ villa.h
+ vista.h
+ odeum.h
+
+
+The following are dynamic linking libraries for the API of C.
+Copy them to the system directory or a directory of your project.
+
+ qdbm.dll : QDBM itself
+ libqdbm.dll.a : import library for `qdbm.dll'
+ mgwz.dll : ZLIB
+ libiconv-2.dll : ICONV
+
+
+The following is a dynamic linking library for the API of Java.
+Copy it to the system directory or a directory of your project.
+
+ jqdbm.dll
+
+
+The following is a Java archive of the classes.
+Include it in the CLASSPATH of your environment.
+
+ qdbm.jar
+
+
+The following are utility commands for testing and debugging.
+
+ dpmgr.exe
+ dptest.exe
+ dptsv.exe
+ crmgr.exe
+ crtest.exe
+ crtsv.exe
+ rlmgr.exe
+ rltest.exe
+ hvmgr.exe
+ hvtest.exe
+ cbtest.exe
+ cbcodec.exe
+ vlmgr.exe
+ vltest.exe
+ vltsv.exe
+ odmgr.exe
+ odtest.exe
+ odidx.exe
+ qmttest.exe
+
+
+The sub directory `cgi' contains CGI scripts, their configuration
+files, and their specifications.
+
+If you want an import library or a static library for Visual C++,
+please obtain the source package and use VCmakefile in it.
+
+
+QDBM was released under the terms of the GNU Lesser General Public
+License. See the file `COPYING.txt' for details.
+
+QDBM was written by Mikio Hirabayashi. You can contact the author
+by e-mail to `mikio@users.sourceforge.net'. However, as for
+topics which can be shared among other users, pleae send it to
+the mailing list. To join the mailing list, refer to the following
+URL.
+
+ http://lists.sourceforge.net/lists/listinfo/qdbm-users
+
+
+Thanks.
+
+
+
+== END OF FILE ==
diff --git a/qdbm/misc/VCmakefile-old b/qdbm/misc/VCmakefile-old
new file mode 100644
index 00000000..8cd55467
--- /dev/null
+++ b/qdbm/misc/VCmakefile-old
@@ -0,0 +1,169 @@
+# Makefile to build QDBM using Microsoft Visual C++
+
+
+
+#================================================================
+# Setting Variables
+#================================================================
+
+
+# Targets
+MYLIBS = qdbm.lib
+LIBOBJS = depot.obj curia.obj relic.obj hovel.obj \
+ cabin.obj villa.obj vista.obj odeum.obj myconf.obj
+MYBINS = dpmgr.exe dptest.exe dptsv.exe crmgr.exe crtest.exe crtsv.exe \
+ rlmgr.exe rltest.exe hvmgr.exe hvtest.exe cbtest.exe cbcodec.exe \
+ vlmgr.exe vltest.exe vltsv.exe odmgr.exe odtest.exe odidx.exe
+
+# VC++ directory
+VCPATH = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
+
+# Building binaries
+CLFLAGS = /I "$(VCPATH)\Include" /I "$(VCPATH)\PlatformSDK\Include" /I "." /O2 /nologo
+LIBFLAGS = /libpath:"$(VCPATH)\lib" /libpath:"$(VCPATH)\PlatformSDK\Lib" /libpath:"." /nologo
+LINKFLAGS = /libpath:"$(VCPATH)\lib" /libpath:"$(VCPATH)\PlatformSDK\Lib" /libpath:"." /nologo
+
+
+
+#================================================================
+# Suffix rules
+#================================================================
+
+
+.SUFFIXES :
+.SUFFIXES : .c .obj
+
+.c.obj :
+ cl /c $(CLFLAGS) $<
+
+
+
+#================================================================
+# Actions
+#================================================================
+
+
+all : $(MYLIBS) $(MYBINS)
+
+
+clean :
+ del *.obj *.lib *.dll *.exp *.exe
+
+
+
+#================================================================
+# Building binaries
+#================================================================
+
+
+qdbm.lib : $(LIBOBJS)
+ lib $(LIBFLAGS) /OUT:$@ $(LIBOBJS)
+
+
+dpmgr.exe : dpmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ dpmgr.obj qdbm.lib
+
+
+dptest.exe : dptest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ dptest.obj qdbm.lib
+
+
+dptsv.exe : dptsv.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ dptsv.obj qdbm.lib
+
+
+crmgr.exe : crmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ crmgr.obj qdbm.lib
+
+
+crtest.exe : crtest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ crtest.obj qdbm.lib
+
+
+crtsv.exe : crtsv.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ crtsv.obj qdbm.lib
+
+
+rlmgr.exe : rlmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ rlmgr.obj qdbm.lib
+
+
+rltest.exe : rltest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ rltest.obj qdbm.lib
+
+
+hvmgr.exe : hvmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ hvmgr.obj qdbm.lib
+
+
+hvtest.exe : hvtest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ hvtest.obj qdbm.lib
+
+
+cbtest.exe : cbtest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ cbtest.obj qdbm.lib
+
+
+cbcodec.exe : cbcodec.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ cbcodec.obj qdbm.lib
+
+
+vlmgr.exe : vlmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ vlmgr.obj qdbm.lib
+
+
+vltest.exe : vltest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ vltest.obj qdbm.lib
+
+
+vltsv.exe : vltsv.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ vltsv.obj qdbm.lib
+
+
+odmgr.exe : odmgr.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ odmgr.obj qdbm.lib
+
+
+odtest.exe : odtest.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ odtest.obj qdbm.lib
+
+
+odidx.exe : odidx.obj qdbm.lib
+ link $(LINKFLAGS) /OUT:$@ odidx.obj qdbm.lib
+
+
+depot.obj : depot.h myconf.h
+
+curia.obj : depot.h curia.h myconf.h
+
+relic.obj : depot.h relic.h myconf.h
+
+hovel.obj : depot.h curia.h hovel.h myconf.h
+
+cabin.obj : cabin.h myconf.h
+
+villa.obj : depot.h cabin.h villa.h myconf.h
+
+vista.obj : depot.h curia.h cabin.h villa.h vista.h myconf.h
+
+odeum.obj : depot.h curia.h cabin.h villa.h myconf.h
+
+myconf.obj : myconf.h
+
+dpmgr.obj dptest.obj dptsv.obj : depot.h cabin.h
+
+crmgr.obj crtest.obj crtsv.obj : depot.h curia.h cabin.h
+
+rlmgr.obj rltest.obj : depot.h relic.h cabin.h
+
+hvmgr.obj hvtest.obj : depot.h curia.h hovel.h cabin.h
+
+cbtest.obj cbcodec.obj : cabin.h
+
+vlmgr.obj vltest.obj vltsv.obj : depot.h cabin.h villa.h
+
+odmgr.obj odtest.obj odidx.obj : depot.h curia.h cabin.h villa.h odeum.h
+
+
+
+# END OF FILE
diff --git a/qdbm/misc/benchmark.pdf b/qdbm/misc/benchmark.pdf
new file mode 100644
index 00000000..8b9df904
--- /dev/null
+++ b/qdbm/misc/benchmark.pdf
Binary files differ
diff --git a/qdbm/misc/icon16.png b/qdbm/misc/icon16.png
new file mode 100644
index 00000000..6d6ed13d
--- /dev/null
+++ b/qdbm/misc/icon16.png
Binary files differ
diff --git a/qdbm/misc/icon20.png b/qdbm/misc/icon20.png
new file mode 100644
index 00000000..edad7849
--- /dev/null
+++ b/qdbm/misc/icon20.png
Binary files differ
diff --git a/qdbm/misc/index.html b/qdbm/misc/index.html
new file mode 100644
index 00000000..7a5271c3
--- /dev/null
+++ b/qdbm/misc/index.html
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-Script-Type" content="text/javascript" />
+<meta name="author" content="Mikio Hirabayashi" />
+<link rel="contents" href="./" />
+<link rel="icon" href="icon16.png" />
+<link rev="made" href="mailto:mikio@users.sourceforge.net" />
+<title>QDBM: Quick Database Manager</title>
+<style type="text/css">html { margin: 0em 0em; padding: 0em 0em; background: #eeeeee none; }
+body { margin: 2em 2em; padding: 0em 0em;
+ background: #eeeeee none; color: #111111;
+ font-style: normal; font-weight: normal; }
+h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
+h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
+ border-left: solid 0.6em #445555; border-bottom: solid 1pt #bbbbbb;
+ padding: 0.5em 0.5em; width: 60%; }
+h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; }
+hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
+ color: #999999; background-color: #999999; border: none; }
+div.note,div.navi { text-align: right; }
+div.logo { text-align: center; margin: 3em 0em; }
+div.logo img { border: inset 2pt #ccccdd; }
+p { margin: 0.8em 0em; line-height: 140%; }
+p,dd { text-indent: 0.8em; }
+div,pre { margin-left: 1.7em; margin-right: 1.7em; }
+pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
+kbd { color: #111111; font-style: normal; font-weight: bold; }
+a { color: #0022aa; text-decoration: none; }
+a:hover,a:focus { color: #0033ee; text-decoration: underline; }
+a.head { color: #111111; text-decoration: none; }
+table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
+th { padding: 1pt 4pt 1pt 4pt; border-style: none;
+ text-align: left; vertical-align: bottom; }
+td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
+ text-align: left; vertical-align: top; }
+ul,ol,dl { line-height: 140%; }
+dt { margin-left: 1.2em; }
+dd { margin-left: 2.0em; }
+ul.lines { list-style-type: none; }
+@media print {
+ html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
+ h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
+ h2 { page-break-before: always; }
+ div.note { text-align: center; }
+ div.navi,div.logo { display: none }
+ hr { display: none; }
+ pre { margin: 0.8em 0.8em; background-color: #ffffff;
+ border: 1pt solid #aaaaaa; font-size: smaller; }
+ a,kbd { color: #000000; text-decoration: none; }
+ h1,h2,h3 { font-family: sans-serif; }
+ p,div,li,dt,dd { font-family: serif; }
+ pre,kbd { font-family: monospace; }
+ dd { font-size: smaller; }
+}
+</style>
+<script type="text/javascript">function startup(){
+ var elem = document.getElementById("headline");
+ if(elem){
+ var now = new Date();
+ if((now.getFullYear() + now.getMonth() + now.getDate() + now.getHours()) % 4 == 0){
+ var text;
+ switch((now.getMonth() + now.getDate() + now.getMinutes()) % 10){
+ default: text = "QDBM: Quicker Database Manager"; break;
+ case 1: text = "QDBM: Quantumtheoretically Dangerous Blast Machine"; break;
+ case 3: text = "QDBM: Quite Dramatic Body Metabolism"; break;
+ case 5: text = "QDBM: Quality Documentation of Black Market"; break;
+ case 7: text = "QDBM: Quake Damage Between Mountains"; break;
+ case 9: text = "QDBM: Quiet Down Before Millennium"; break;
+ }
+ elem.firstChild.nodeValue = text;
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="startup();">
+
+<h1 id="headline">QDBM: Quick Database Manager</h1>
+
+<div class="note">Copyright (C) 2000-2007 Mikio Hirabayashi</div>
+<div class="note">Last Update: Thu, 26 Oct 2006 15:00:20 +0900</div>
+<div class="navi">[<span class="void">English</span>/<a href="index.ja.html" hreflang="ja">Japanese</a>]</div>
+
+<div class="logo"><img src="logo.png" alt="QDBM" width="300" height="110" /></div>
+
+<hr />
+
+<h2>Overview</h2>
+
+<p>QDBM is a library of routines for managing a database. The database is a simple data file containing records, each is a pair of a key and a value. Every key and value is serial bytes with variable length. Both binary data and character string can be used as a key and a value. There is neither concept of data tables nor data types. Records are organized in hash table or B+ tree.</p>
+
+<p>As for database of hash table, each key must be unique within a database, so it is impossible to store two or more records with a key overlaps. The following access methods are provided to the database: storing a record with a key and a value, deleting a record by a key, retrieving a record by a key. Moreover, traversal access to every key are provided, although the order is arbitrary. These access methods are similar to ones of DBM (or its followers: NDBM and GDBM) library defined in the UNIX standard. QDBM is an alternative for DBM because of its higher performance.</p>
+
+<p>As for database of B+ tree, records whose keys are duplicated can be stored. Access methods of storing, deleting, and retrieving are provided as with the database of hash table. Records are stored in order by a comparing function assigned by a user. It is possible to access each record with the cursor in ascending or descending order. According to this mechanism, forward matching search for strings and range search for integers are realized. Moreover, transaction is available in database of B+ tree.</p>
+
+<p>QDBM is written in C, and provided as APIs of C, C++, Java, Perl, and Ruby. QDBM is available on platforms which have API conforming to POSIX. QDBM is a free software licensed under the GNU Lesser General Public License.</p>
+
+<hr />
+
+<h2>Documents</h2>
+
+<p>The following are documents of QDBM. They are contained also in the source package.</p>
+
+<ul>
+<li><a href="spex.html">Fundamental Specifications</a></li>
+<li><a href="xspex.html">Specifications of C++ API</a></li>
+<li><a href="jspex.html">Specifications of Java API</a></li>
+<li><a href="plspex.html">Specifications of Perl API</a></li>
+<li><a href="rbspex.html">Specifications of Ruby API</a></li>
+<li><a href="cgispex.html">Specifications of CGI scripts</a></li>
+</ul>
+
+<hr />
+
+<h2>Packages</h2>
+
+<p>The following are packages of QDBM. The Linux binary package contains APIs for C, C++, and Java. It contains CGI scripts also. The Windows binary package contains APIs for C and Java. It contains CGI scripts also.</p>
+
+<ul>
+<li><a href="qdbm-1.8.77.tar.gz">Latest Source Package (version 1.8.77)</a></li>
+</ul>
+
+<ul>
+<li><a href="past/">Past Versions</a></li>
+<li><a href="rpm/">RPM Binary Packages for Linux</a></li>
+<li><a href="win/">Binary Packages for Windows</a></li>
+<li><a href="misc/">Related Packages</a></li>
+</ul>
+
+<ul>
+<li><a href="http://www.freshports.org/databases/qdbm/">Binary Packages for FreeBSD</a></li>
+<li><a href="http://www.blastwave.org/packages.php/qdbm">Binary Packages for Solaris</a></li>
+<li><a href="http://hpux.cs.utah.edu/hppd/cgi-bin/search?package=on&amp;description=on&amp;term=qdbm&amp;Search=Search">Binary Packages for HP-UX</a></li>
+<li><a href="http://www.sbellon.de/sw-ports.html">Binary Packages for RISC OS</a></li>
+</ul>
+
+<hr />
+
+<h2>Applications</h2>
+
+<p>The following are links to applications of QDBM. If you run or find a project using QDBM, please tell it, and it will added to this list.</p>
+
+<ul>
+<li><a href="http://hyperestraier.sourceforge.net/">Hyper Estraier</a> : Full-text Search System for Communities written by Mikio Hirabayashi</li>
+<li><a href="http://estraier.sourceforge.net/">Estraier</a> : Personal Full-text Search System written by Mikio Hirabayashi</li>
+<li><a href="http://diqt.sourceforge.net/">Diqt</a> : Multilingual Dictionary Searcher written by Mikio Hirabayashi</li>
+<li><a href="http://rbbs.sourceforge.jp/">RBBS</a> : WWW-based Bulletin Board System written by Mikio Hirabayashi</li>
+<li><a href="http://harvest.sourceforge.net/">Harvest</a> : Distributed Search System written by Kang-Jin Lee et al</li>
+<li><a href="http://bogofilter.sourceforge.net/">Bogofilter</a> : Bayesian Spam Mail Filter written by Eric S. Raymond et al</li>
+<li><a href="http://www.foo.be/mqs/">MQS</a> : Minimalist Queue Services written by Alexandre Dulaunoy</li>
+<li><a href="http://www.zedshaw.com/projects/ruby_odeum/">Ruby/Odeum</a> : Ruby Binding to the Inverted API written by Zed A. Shaw</li>
+<li><a href="http://www.surfulater.com/">Surfulater</a> : Utility to Save and Organize Web Pages written by Soft As it Gets Pty Ltd</li>
+<li><a href="http://mutt-ng.berlios.de/">Mutt-NG</a> : Text Based Mail Client written by Andreas Krennmair et al</li>
+<li><a href="http://smfs.sourceforge.net/">SMFS</a> : Smart Sendmail Filters written by Eugene Kurmanin</li>
+<li><a href="http://dixit.sourceforge.net/">Dixit</a> : Romanian Dictionary Searcher written by Octavian Procopiuc</li>
+</ul>
+
+<hr />
+
+<h2>Brothers</h2>
+
+<p>There are many followers of UNIX DBM. Select the best suited one for your products. NDBM is ancient and you should not use it. SDBM is maintained by Apache Project, and GDBM is maintained by GNU Project. They are most popular and time-tested. TDB is maintained by Samba Team. It allows multiple simultaneous writers. While CDB does not support updating at a runtime, it is the fastest. Berkeley DB is very multifunctional and ACID compliant. It is used in many commercial products. Finally, QDBM is balanced of performance, functionality, portability, and usability.</p>
+
+<ul>
+<li><a href="bros/ndbm-bsd-5.1.m1.tar.gz">NDBM</a> : New DBM written by BSD</li>
+<li><a href="bros/sdbm-1.0.2.tar.gz">SDBM</a> : Substitute DBM written by Ozan S. Yigit</li>
+<li><a href="bros/gdbm-1.8.3.tar.gz">GDBM</a> : GNU Database Manager written by Philip A. Nelson et al</li>
+<li><a href="bros/tdb-1.0.6.tar.gz">TDB</a> : Trivial Database written by Andrew Tridgell et al</li>
+<li><a href="bros/tinycdb-0.75.tar.gz">TinyCDB</a> : Constant Database written by Michael Tokarev</li>
+<li><a href="bros/db-4.4.20.tar.gz">Berkeley DB</a> : Berkeley DB written by Sleepycat Software</li>
+</ul>
+
+<ul>
+<li><a href="benchmark.pdf">Report of Benchmark Test</a></li>
+<li><a href="http://tokyocabinet.sourceforge.net/">Tokyo Cabinet</a> : the successor of QDBM</li>
+</ul>
+
+<hr />
+
+<h2>Information</h2>
+
+<p>QDBM was written by <a href="http://qdbm.sourceforge.net/mikio/">Mikio Hirabayashi</a>. You can contact the author by e-mail to `mikio@users.sourceforge.net'. However, as for topics which can be shared among other users, pleae send it to the mailing list. To join the mailing list, refer to `<a href="http://lists.sourceforge.net/lists/listinfo/qdbm-users">http://lists.sourceforge.net/lists/listinfo/qdbm-users</a>'.</p>
+
+<p>The project page on SourceForge.net is `<a href="http://sourceforge.net/projects/qdbm/">http://sourceforge.net/projects/qdbm/</a>'.</p>
+
+<p>Update of this project is announced on Freshmeat.net at `<a href="http://freshmeat.net/projects/qdbm/">http://freshmeat.net/projects/qdbm/</a>'.</p>
+
+<hr />
+
+</body>
+
+</html>
+
+<!-- END OF FILE -->
diff --git a/qdbm/misc/index.ja.html b/qdbm/misc/index.ja.html
new file mode 100644
index 00000000..65ea073c
--- /dev/null
+++ b/qdbm/misc/index.ja.html
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-Script-Type" content="text/javascript" />
+<meta name="author" content="Mikio Hirabayashi" />
+<link rel="contents" href="./" />
+<link rel="icon" href="icon16.png" />
+<link rev="made" href="mailto:mikio@users.sourceforge.net" />
+<title>デヌタベヌスラむブラリ QDBM</title>
+<style type="text/css">html { margin: 0em 0em; padding: 0em 0em; background: #eeeeee none; }
+body { margin: 2em 2em; padding: 0em 0em;
+ background: #eeeeee none; color: #111111;
+ font-style: normal; font-weight: normal; }
+h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
+h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
+ border-left: solid 0.6em #445555; border-bottom: solid 1pt #bbbbbb;
+ padding: 0.5em 0.5em; width: 60%; }
+h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; }
+hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
+ color: #999999; background-color: #999999; border: none; }
+div.note,div.navi { text-align: right; }
+div.logo { text-align: center; margin: 3em 0em; }
+div.logo img { border: inset 2pt #ccccdd; }
+p { margin: 0.8em 0em; line-height: 140%; }
+p,dd { text-indent: 0.8em; }
+div,pre { margin-left: 1.7em; margin-right: 1.7em; }
+pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
+kbd { color: #111111; font-style: normal; font-weight: bold; }
+a { color: #0022aa; text-decoration: none; }
+a:hover,a:focus { color: #0033ee; text-decoration: underline; }
+a.head { color: #111111; text-decoration: none; }
+table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
+th { padding: 1pt 4pt 1pt 4pt; border-style: none;
+ text-align: left; vertical-align: bottom; }
+td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
+ text-align: left; vertical-align: top; }
+ul,ol,dl { line-height: 140%; }
+dt { margin-left: 1.2em; }
+dd { margin-left: 2.0em; }
+ul.lines { list-style-type: none; }
+@media print {
+ html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
+ h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
+ h2 { page-break-before: always; }
+ div.note { text-align: center; }
+ div.navi,div.logo { display: none }
+ hr { display: none; }
+ pre { margin: 0.8em 0.8em; background-color: #ffffff;
+ border: 1pt solid #aaaaaa; font-size: smaller; }
+ a,kbd { color: #000000; text-decoration: none; }
+ h1,h2,h3 { font-family: sans-serif; }
+ p,div,li,dt,dd { font-family: serif; }
+ pre,kbd { font-family: monospace; }
+ dd { font-size: smaller; }
+}
+</style>
+<script type="text/javascript">function startup(){
+ var elem = document.getElementById("headline");
+ if(elem){
+ var now = new Date();
+ if((now.getFullYear() + now.getMonth() + now.getDate() + now.getHours()) % 4 == 0){
+ var text;
+ switch((now.getMonth() + now.getDate() + now.getMinutes()) % 24){
+ default: text = "QDBM: 高速資料基盀管理噚"; break;
+ case 1: text = "QDBM: NDBMずは違うのだよ、NDBMずは"; break;
+ case 3: text = "QDBM: QDBMは䌊達じゃないっ"; break;
+ case 5: text = "QDBM: 敢えお蚀おう、高速であるず"; break;
+ case 7: text = "QDBM: しかし、私もDBMのはずだ"; break;
+ case 9: text = "QDBM: 今の私はQDBMだ。それ以䞊でもそれ以䞋でもない。"; break;
+ case 11: text = "QDBM: 私はBerkeleyずは関係ない。私はい぀も䞀人のDBMだった。"; break;
+ case 13: text = "QDBM: 芋せおもらおうかBerkeleyのデヌタベヌスの性胜ずやらを"; break;
+ case 15: text = "QDBM: 悲しいけどこれ、DBMなのよね。"; break;
+ case 17: text = "QDBM: 新しい時代を創るのはSQLではない"; break;
+ case 19: text = "QDBM: えぇぃ、マむナヌチェンゞのくせにっ"; break;
+ case 21: text = "QDBM: よくもこんなくたびれたDBMが珟圹でいられるものだ。"; break;
+ case 22: text = "QDBM: 芋える私にもレコヌドが芋える"; break;
+ case 23: text = "QDBM: そんなRDBみたいな口の利き方、おやめなさい"; break;
+ }
+ elem.firstChild.nodeValue = text;
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="startup();">
+
+<h1 id="headline">QDBM: Quick Database Manager</h1>
+
+<div class="note">Copyright (C) 2000-2007 Mikio Hirabayashi</div>
+<div class="note">Last Update: Thu, 26 Oct 2006 15:00:20 +0900</div>
+<div class="navi">[<a href="index.html" hreflang="en">English</a>/<span class="void">Japanese</span>]</div>
+
+<div class="logo"><img src="logo.png" alt="QDBM" width="300" height="110" /></div>
+
+<hr />
+
+<h2><a name="overview" id="overview" class="head">抂芁</a></h2>
+
+<p>QDBMはデヌタベヌスを扱うルヌチン矀のラむブラリです。デヌタベヌスずいっおも単玔なもので、キヌず倀のペアからなるレコヌド矀を栌玍したデヌタファむルです。キヌず倀は任意の長さを持぀䞀連のバむト列であり、文字列でもバむナリでも扱うこずができたす。テヌブルやデヌタ型の抂念はありたせん。レコヌドはハッシュ衚たたはB+朚で線成されたす。</p>
+
+<p>ハッシュ衚のデヌタベヌスでは、キヌはデヌタベヌス内で䞀意であり、キヌが重耇する耇数のレコヌドを栌玍するこずはできたせん。このデヌタベヌスに察しおは、キヌず倀を指定しおレコヌドを栌玍したり、キヌを指定しお察応するレコヌドを削陀したり、キヌを指定しお察応するレコヌドを怜玢したりするこずができたす。たた、デヌタベヌスに栌玍しおある党おのキヌを順䞍同に䞀぀ず぀取り出すこずもできたす。このような操䜜は、UNIX暙準で定矩されおいるDBMラむブラリおよびその远埓であるNDBMやGDBMに類するものです。QDBMはDBMのより良い代替ずしお利甚するこずができたす。</p>
+
+<p>B+朚のデヌタベヌスでは、キヌが重耇する耇数のレコヌドを栌玍するこずができたす。このデヌタベヌスに察しおは、ハッシュ衚のデヌタベヌスず同様に、キヌを指定しおレコヌドを栌玍したり取り出したり削陀したりするこずができたす。レコヌドはナヌザが指瀺した比范関数に基づいお敎列されお栌玍されたす。カヌ゜ルを甚いお各レコヌドを昇順たたは降順で参照するこずができたす。この機構によっお、文字列の前方䞀臎怜玢や数倀の範囲怜玢が可胜になりたす。たた、B+朚のデヌタベヌスではトランザクションが利甚できたす。</p>
+
+<p>QDBMはCで蚘述され、C、C++、Java、PerlおよびRubyのAPIずしお提䟛されたす。QDBMはPOSIX準拠のAPIを備えるプラットフォヌムで利甚できたす。QDBMはGNU Lesser General Public Licenseに基づくフリヌ゜フトりェアです。</p>
+
+<hr />
+
+<h2>文曞</h2>
+
+<p>以䞋の文曞をお読みください。゜ヌスパッケヌゞにも同じものが含たれおいたす。</p>
+
+<ul>
+<li><a href="spex-ja.html">基本仕様曞</a></li>
+<li><a href="xspex-ja.html">C++甹API仕様曞</a></li>
+<li><a href="jspex-ja.html">Java甹API仕様曞</a></li>
+<li><a href="plspex-ja.html">Perl甹API仕様曞</a></li>
+<li><a href="rbspex-ja.html">Ruby甹API仕様曞</a></li>
+<li><a href="cgispex-ja.html">CGIスクリプト仕様曞</a></li>
+<li><a href="tutorial-ja.html">チュヌトリアル</a></li>
+</ul>
+
+<hr />
+
+<h2>ダりンロヌド</h2>
+
+<p>以䞋のパッケヌゞをダりンロヌドしおください。Linux甚バむナリパッケヌゞは、CずC++ずJavaのAPIず、CGIスクリプトを玍めおいたす。Windows甚バむナリパッケヌゞは、CずJavaのAPIず、CGIスクリプトを玍めおいたす。</p>
+
+<ul>
+<li><a href="qdbm-1.8.77.tar.gz">最新の゜ヌスパッケヌゞバヌゞョン1.8.77</a></li>
+</ul>
+
+<ul>
+<li><a href="past/">過去のバヌゞョン</a></li>
+<li><a href="rpm/">Linux甚バむナリパッケヌゞRPM</a></li>
+<li><a href="win/">Windows甚バむナリパッケヌゞ</a></li>
+<li><a href="misc/">関連するパッケヌゞ</a></li>
+</ul>
+
+<ul>
+<li><a href="http://www.freshports.org/databases/qdbm/">FreeBSD甚パッケヌゞ</a></li>
+<li><a href="http://www.blastwave.org/packages.php/qdbm">Solaris甚パッケヌゞ</a></li>
+<li><a href="http://hpux.cs.utah.edu/hppd/cgi-bin/search?package=on&amp;description=on&amp;term=qdbm&amp;Search=Search">HP-UX甚パッケヌゞ</a></li>
+<li><a href="http://www.sbellon.de/sw-ports.html">RISC OS甚パッケヌゞ</a></li>
+</ul>
+
+<hr />
+
+<h2>アプリケヌション</h2>
+
+<p>QDBMのアプリケヌションには以䞋のものがありたす。もしあなたのプロゞェクトがQDBMを䜿っおいるなら、連絡をいただければこのリストに远加いたしたす。</p>
+
+<ul>
+<li><a href="http://hyperestraier.sourceforge.net/">Hyper Estraier</a> : 平林幹雄による共同䜓的党文怜玢システム</li>
+<li><a href="http://estraier.sourceforge.net/">Estraier</a> : 平林幹雄による個人甚党文怜玢システム</li>
+<li><a href="http://diqt.sourceforge.net/">Diqt</a> : 平林幹雄による倚蚀語蟞曞怜玢システム</li>
+<li><a href="http://rbbs.sourceforge.jp/">RBBS</a> : 平林幹雄によるWeb掲瀺板システム</li>
+<li><a href="http://harvest.sourceforge.net/">Harvest</a> : Kang-Jin Leeらによる分散情報怜玢システム</li>
+<li><a href="http://bogofilter.sourceforge.net/">Bogofilter</a> : Eric S. Raymondらによるベむズ匏スパムメヌルフィルタ</li>
+<li><a href="http://www.foo.be/mqs/">MQS</a> : Alexandre Dulaunoyによるキュヌ管理サヌビス</li>
+<li><a href="http://www.zedshaw.com/projects/ruby_odeum/">Ruby/Odeum</a> : Zed A. Shawによる転眮APIのRuby甚むンタヌフェむス</li>
+<li><a href="http://www.surfulater.com/">Surfulater</a> : Soft As it Gets Pty瀟によるWebペヌゞスクラップブック</li>
+<li><a href="http://mutt-ng.berlios.de/">Mutt-NG</a> : Andreas Krennmairらによるテキスト型メヌルクラむアント</li>
+<li><a href="http://smfs.sourceforge.net/">SMFS</a> : Eugene KurmaninによるSendmail甚フィルタシステム</li>
+<li><a href="http://dixit.sourceforge.net/">Dixit</a> : Octavian Procopiucによるルヌマニア語蟞曞怜玢システム</li>
+</ul>
+
+<hr />
+
+<h2>兄匟</h2>
+
+<p>UNIX暙準のDBMに远埓したラむブラリはたくさんありたす。それぞれ特城がありたすので、あなたの補品にずっお郜合がいいものを遞んでください。NDBMは叀いので、もはや䜿う理由はないでしょう。SDBMはApache Projectで管理され、GDBMはGNU Projectで管理されおいたす。それらは最も人気があり、たた数倚くテストされおいるものでしょう。TDBはSamba Teamで管理されおおり、耇数同時の曞き蟌みが可胜です。TinyCDBは随時の曎新はできたせんが、最も高速に動䜜したす。Berkeley DBは非垞に倚機胜で、ACID準拠で、倚くの商甚補品で䜿われおいたす。最埌に、QDBMは性胜ず機胜ず移怍性ず利䟿性のバランスがずれた補品です。</p>
+
+<ul>
+<li><a href="bros/ndbm-bsd-5.1.m1.tar.gz">NDBM</a> : BSDによるNew DBM</li>
+<li><a href="bros/sdbm-1.0.2.tar.gz">SDBM</a> : Ozan S. YigitによるSubstitute DBM</li>
+<li><a href="bros/gdbm-1.8.3.tar.gz">GDBM</a> : Philip A. NelsonらによるGNU Database Manager</li>
+<li><a href="bros/tdb-1.0.6.tar.gz">TDB</a> : Andrew TridgellらによるTrivial Database</li>
+<li><a href="bros/tinycdb-0.75.tar.gz">TinyCDB</a> : Michael TokarevによるConstant Database</li>
+<li><a href="bros/db-4.4.20.tar.gz">Berkeley DB</a> : Sleepycat Software瀟によるBerkeley DB</li>
+</ul>
+
+<ul>
+<li><a href="benchmark.pdf">ベンチマヌクテストのレポヌト</a></li>
+<li><a href="http://tokyocabinet.sourceforge.net/">Tokyo Cabinet</a> : QDBMの埌継補品</li>
+</ul>
+
+<hr />
+
+<h2>その他の情報</h2>
+
+<p>QDBMは<a href="http://qdbm.sourceforge.net/mikio/">平林幹雄</a>が䜜成したした。䜜者ず連絡をずるには、`mikio@users.sourceforge.net' 宛に電子メヌルを送っおください。ただし、質問やバグレポヌトなど、他のナヌザず共有できる話題はメヌリングリストに送っおください。メヌリングリストの参加方法に぀いおは、`<a href="http://lists.sourceforge.net/lists/listinfo/qdbm-users">http://lists.sourceforge.net/lists/listinfo/qdbm-users</a>' を参照しおください。</p>
+
+<p>SourceForge.netにおけるプロゞェクトペヌゞは `<a href="http://sourceforge.net/projects/qdbm/">http://sourceforge.net/projects/qdbm/</a>' にありたす。Freshmeatにおける曎新情報は `<a href="http://freshmeat.net/projects/qdbm/">http://freshmeat.net/projects/qdbm/</a>' から参照できたす。</p>
+
+<hr />
+
+</body>
+
+</html>
+
+<!-- END OF FILE -->
diff --git a/qdbm/misc/logo.png b/qdbm/misc/logo.png
new file mode 100644
index 00000000..d5cf9771
--- /dev/null
+++ b/qdbm/misc/logo.png
Binary files differ
diff --git a/qdbm/misc/makevcdef b/qdbm/misc/makevcdef
new file mode 100755
index 00000000..7b36e307
--- /dev/null
+++ b/qdbm/misc/makevcdef
@@ -0,0 +1,48 @@
+#! /bin/sh
+
+#================================================================
+# makevcdef
+# Generator of module definition file for Visual C++
+#================================================================
+
+
+# check arguments
+file="$1"
+if [ -f "$file" ]
+then
+ true
+else
+ printf 'usage: makevcdef library\n' 1>&2
+ exit 1
+fi
+
+
+# show headers
+name=`echo $file | sed -e 's/^lib//' -e 's/\..*//'`
+printf 'EXPORTS\r\n'
+
+
+# show variables
+nm -g "$file" | grep ' [BDR] ' | sed 's/.* [BDR] //' | grep -v '^_' | sort | uniq |
+while read name
+do
+ num=$((num + 1))
+ printf ' %s = %s DATA\r\n' "$name" "$name"
+done
+
+
+# show functions
+nm -g "$file" | grep ' T ' | sed 's/.* T //' | grep -v '^_' | sort | uniq |
+while read name
+do
+ num=$((num + 1))
+ printf ' %s = %s\r\n' "$name" "$name"
+done
+
+
+# exit normally
+exit 0
+
+
+
+# END OF FILE
diff --git a/qdbm/misc/mymemo-ja.html b/qdbm/misc/mymemo-ja.html
new file mode 100644
index 00000000..87de7843
--- /dev/null
+++ b/qdbm/misc/mymemo-ja.html
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="author" content="Mikio Hirabayashi" />
+<link rel="contents" href="./" />
+<title>My Private Memo for QDBM</title>
+</head>
+
+<body>
+
+<h1>QDBMのための私的メモ</h1>
+
+<hr />
+
+<h2>cygwin+mingwでのビルド環境の蚭定方法</h2>
+
+<ul>
+<li>Cygwinのセットアップ時に、mingwのgccずmingwのzlibも遞択する。</li>
+<li>mingwのlibiconvはmingwのサむトから手に入れる。そしお、*.h は /usr/include/mingw の䞋に、*.dll.a は /lib/mingw の䞋に、*.dll は /binの䞋に移動させる。</li>
+<li>QDBMのビルド環境の蚭定は ./configure --enable-zlib --enable-iconv で行い、パッケヌゞの䜜成は make win32pkg で行う。</li>
+</ul>
+
+<hr />
+
+</body>
+
+</html>
+
+<!-- END OF FILE -->
diff --git a/qdbm/misc/tutorial-ja.html b/qdbm/misc/tutorial-ja.html
new file mode 100644
index 00000000..66f1c3c3
--- /dev/null
+++ b/qdbm/misc/tutorial-ja.html
@@ -0,0 +1,622 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta name="author" content="Mikio Hirabayashi" />
+<meta name="keywords" content="QDBM, tutrial" />
+<meta name="description" content="tutorial of QDBM" />
+<link rel="contents" href="./" />
+<link rev="made" href="mailto:mikio@users.sourceforge.net" />
+<title>Tutorial of QDBM Version 1 (Japanese)</title>
+<style type="text/css">html { margin: 0em 0em; padding: 0em 0em; background: #eeeeee none; }
+body { margin: 2em 2em; padding: 0em 0em;
+ background: #eeeeee none; color: #111111;
+ font-style: normal; font-weight: normal; }
+h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
+h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
+ border-left: solid 0.6em #445555; border-bottom: solid 1pt #bbbbbb;
+ padding: 0.5em 0.5em; width: 60%; }
+h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; }
+hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
+ color: #999999; background-color: #999999; border: none; }
+div.note,div.navi { text-align: right; }
+div.logo { text-align: center; margin: 3em 0em; }
+div.logo img { border: inset 2pt #ccccdd; }
+p { margin: 0.8em 0em; line-height: 140%; }
+p,dd { text-indent: 0.8em; }
+div,pre { margin-left: 1.7em; margin-right: 1.7em; }
+pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
+kbd { color: #111111; font-style: normal; font-weight: bold; }
+a { color: #0022aa; text-decoration: none; }
+a:hover,a:focus { color: #0033ee; text-decoration: underline; }
+a.head { color: #111111; text-decoration: none; }
+table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
+th { padding: 1pt 4pt 1pt 4pt; border-style: none;
+ text-align: left; vertical-align: bottom; }
+td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
+ text-align: left; vertical-align: top; }
+ul,ol,dl { line-height: 140%; }
+dt { margin-left: 1.2em; }
+dd { margin-left: 2.0em; }
+ul.lines { list-style-type: none; }
+@media print {
+ html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
+ h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
+ h2 { page-break-before: always; }
+ div.note { text-align: center; }
+ div.navi,div.logo { display: none }
+ hr { display: none; }
+ pre { margin: 0.8em 0.8em; background-color: #ffffff;
+ border: 1pt solid #aaaaaa; font-size: smaller; }
+ a,kbd { color: #000000; text-decoration: none; }
+ h1,h2,h3 { font-family: sans-serif; }
+ p,div,li,dt,dd { font-family: serif; }
+ pre,kbd { font-family: monospace; }
+ dd { font-size: smaller; }
+}
+</style>
+</head>
+
+<body>
+
+<h1>QDBMのチュヌトリアル</h1>
+
+<div class="note">Copyright (C) 2000-2007 Mikio Hirabayashi</div>
+<div class="note">Last Update: Thu, 26 Oct 2006 15:00:20 +0900</div>
+<div class="navi">[<a href="http://qdbm.sourceforge.net/">Home</a>]</div>
+
+<hr />
+
+<h2>目次</h2>
+
+<ol>
+<li><a href="#introduction">むントロダクション</a></li>
+<li><a href="#depot">Depot: 基本API</a></li>
+<li><a href="#curia">Curia: 拡匵API</a></li>
+<li><a href="#relic">Relic: NDBM互換API</a></li>
+<li><a href="#hovel">Hovel: GDBM互換API</a></li>
+<li><a href="#cabin">Cabin: ナヌティリティAPI</a></li>
+<li><a href="#villa">Villa: 侊箚API</a></li>
+<li><a href="#odeum">Odeum: 転眮API</a></li>
+</ol>
+
+<hr />
+
+<h2><a name="introduction" id="introduction" class="head">むントロダクション</a></h2>
+
+<p>QDBMは、シンプルながら䟿利なデヌタベヌスラむブラリです。デヌタベヌスずいうずSQLやリレヌショナルデヌタベヌスを思い浮かべる人が倚いず思いたすが、QDBMはそんな高機胜なものではありたせん。「キヌ」ず「倀」の組からなるレコヌドをファむルに保存したり、保存しおおいたレコヌドの䞭から特定のキヌを持぀ものを取り出す機胜を提䟛するだけです。そのような機胜をここでは「ハッシュデヌタベヌス」ず呌ぶこずにしたす。ハッシュデヌタベヌスの特長は、䜿い方が簡単で、パフォヌマンスが高いこずです。</p>
+
+<p>QDBMはC蚀語のラむブラリです他の蚀語のAPIもありたすが。QDBMにはハッシュデヌタベヌスの機胜だけでなく、私QDBMの䜜者がプログラミングをする時によく䜿う機胜が詰め蟌たれおいたす。Cで曞いたプログラムは高速に動䜜するのが利点ですが、C++、Java、Perl、Rubyずいった比范的高玚な蚀語では暙準的にサポヌトされるデヌタ構造やアルゎリズムを自分で実装しなければなりたせん。そういった䜜業は面倒ですし、バグを生みやすいものです。そこで、QDBMの登堎です。QDBMを再利甚すれば、CでのプログラミングがPerlを䜿っおいるかのように手軜になりたす。しかも、UNIXでもWindowsでもMac OS Xでも利甚できるので、移怍性のあるプログラムが曞きやすくなりたす。</p>
+
+<p>シンプルずいいながら、QDBMの機胜はなかなか豊富です。デヌタベヌスずしおは、ハッシュ衚ずB+朚が利甚できたす。メモリ䞊で扱うナヌティリティずしおは、リストやマップなどがありたす。MIMEやCSVやXMLの解析もできたす。したいには党文怜玢たでできたりするので驚きです。</p>
+
+<p>このチュヌトリアルではQDBMの䜿い方を簡単に説明するずずもに、基本仕様曞の補足を述べたす。QDBMの詳现に぀いおは基本仕様曞を埡芧ください。なお、ここではハッシュ衚やB+朚ずいったデヌタ構造の説明はしたせんので、䞍慣れな方は適圓な本やWebサむトで調べおおいおください。</p>
+
+<hr />
+
+<h2><a name="depot" id="depot" class="head">Depot: 基本API</a></h2>
+
+<p>デヌタベヌスアプリケヌションの兞型的な䟋ずしお、「瀟員番号を入力するず、その内線番号がわかる」ずいうプログラムを考えおみたしょう。瀟員番号をキヌずしお、それに察応する倀である内線番号を怜玢するずいうこずです。</p>
+
+<p>たずはQDBMを䜿わないでやっおみたす。瀟員番号ず内線番号の察応衚は、CSVテキストでファむルに保存するこずにしたす。曞匏の䟋を以䞋に瀺したす。</p>
+
+<pre>00001,8-902-1234
+00002,7-938-834
+00008,4-214-491
+</pre>
+
+<p>レコヌドを加える関数 `putphonenumber' ず、レコヌドを怜玢する関数 `getphonenumber' を実装したす。</p>
+
+<pre>#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+
+#define PHONEFILE "phone"
+#define LINEBUFSIZ 256
+
+int putphonenumber(const char *id, const char *phone){
+ FILE *OUT;
+ /* ファむルを远蚘モヌドで開く */
+ if(!(OUT = fopen(PHONEFILE, "a"))) return -1;
+ /* レコヌドを曞き蟌む */
+ fprintf(OUT, "%s,%s\n", id, phone);
+ /* ファむルを閉じる */
+ if(fclose(OUT) != 0) return -1;
+ return 0;
+}
+
+char *getphonenumber(const char *id){
+ FILE *IN;
+ char line[LINEBUFSIZ], *pivot, *phone;
+ int len;
+ /* ファむルを読み蟌みモヌドで開く */
+ if(!(IN = fopen(PHONEFILE, "r"))) return NULL;
+ /* 各行を読み蟌む */
+ while(fscanf(IN, "%s", line) == 1){
+ /* 区切り文字を凊理する */
+ if(!(pivot = strchr(line, ','))) continue;
+ *pivot = '\0';
+ pivot++;
+ /* キヌの䞀臎刀定 */
+ if(strcmp(line, id) == 0){
+ /* ファむルを閉じる */
+ if(fclose(IN) != 0) return NULL;
+ /* メモリを確保しお戻り倀を生成する */
+ len = strlen(pivot);
+ if(!(phone = malloc(len + 1))) return NULL;
+ memcpy(phone, pivot, len + 1);
+ return phone;
+ }
+ }
+ /* ファむルを閉じる */
+ fclose(IN);
+ return NULL;
+}
+</pre>
+
+<p>`fscanf' を䜿っおいる時点でかなり貧匱ですが、きちんず曞こうずするず非垞に長くなるので劥協したしたちなみに、255文字を越える行があったら暎走したす。ずにかく、この皋床の凊理でやたら長いコヌドを曞かねばならないのでは悲しくなりたす。さらに重倧な欠点は、怜玢の凊理が遅いずいうこずです。ファむルの最初から最埌たで平均的には半分たで読たなければならないからです。既存のレコヌドを修正する時にもかなり面倒なこずをしなければなりたせん。</p>
+
+<p>QDBMを䜿えばもっず゚レガントなコヌドが曞けたす。䞊蚘ず同じ機胜の関数を実装しおみたす。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;stdlib.h&gt;
+
+#define PHONEFILE "phone"
+
+int putphonenumber(const char *id, const char *phone){
+ DEPOT *depot;
+ /* デヌタベヌスを远蚘モヌドで開く */
+ if(!(depot = dpopen(PHONEFILE, DP_OWRITER | DP_OCREAT, -1))) return -1;
+ /* レコヌドを曞き蟌む */
+ dpput(depot, id, -1, phone, -1, DP_DOVER);
+ /* デヌタベヌスを閉じる */
+ if(!dpclose(depot)) return -1;
+ return 0;
+}
+
+char *getphonenumber(const char *id){
+ DEPOT *depot;
+ char *phone;
+ /* デヌタベヌスを読み蟌みモヌドで開く */
+ if(!(depot = dpopen(PHONEFILE, DP_OREADER, -1))) return NULL;
+ /* レコヌドを探玢しお戻り倀を生成する */
+ phone = dpget(depot, id, -1, 0, -1, NULL);
+ /* デヌタベヌスを閉じる */
+ dpclose(depot);
+ return phone;
+}
+</pre>
+
+<p>もはやファむル圢匏はCSVファむルではなく、区切り文字が䜕であるか気にする必芁はありたせん。プログラマはファむル圢匏がどうであるかなど考えなくおもよいのです。メモリの確保などもQDBMの内郚でやっおくれるので、バッファのサむズを気にする必芁はありたせん解攟は必芁です。凊理速床を気にする必芁もありたせん。デヌタベヌスがどんなに倧きくおも、レコヌドの远加や削陀や怜玢が䞀瞬でできたす。このように、プログラマをデヌタ管理の苊悩から解攟するのがQDBMの圹割です。</p>
+
+<p>䞊蚘の䟋ではQDBMの基本APIであるDepotを利甚しおいたす。たず、`DEPOT' ずいう型が登堎しおいたす。これは暙準ラむブラリの `FILE' ず同様に、操䜜察象のファむルの情報を栌玍しおいる構造䜓の型です。この型ぞのポむンタをハンドルずしお各皮の関数に枡すこずになりたす。関数ずしおは、`dpopen'、`dpclose'、`dpput' および `dpget' が登堎しおいたす。この四぀の䜿い方を芚えればQDBMの半分は理解したようなものです。</p>
+
+<div><kbd>DEPOT *dpopen(const char *<var>name</var>, int <var>omode</var>, int <var>bnum</var>);</kbd></div>
+
+<p>`dpopen' はその名の通り、Depotのデヌタベヌスを開く関数です。その結果ずしお `DEPOT' 型の構造䜓ぞのポむンタが返されたす。第1匕数にはデヌタを栌玍するファむル名を指定したす。これは盞察パスで指定しおも絶察パスで指定しおも構いたせん。第2匕数は接続モヌドを指定したす。読み蟌みず曞き蟌みの䞡方をするなら `DP_OWRITER' を指定したす。ただし、デヌタベヌスファむルが存圚しない堎合に新芏䜜成するならば同時に `DP_OCREAT' をビットORずしお加える必芁がありたす。この二぀を指定するず、`fopen' の `a+' モヌドずほが同じ意味になりたす。他に `DP_OTRUNC' ずいうフラグがあるのですが、それはファむルを切り詰めるこずを指瀺したす。それも加えお䞉぀を指定するず `fopen' の `w+' モヌドずほが同じ意味になりたす。読み蟌みだけをする堎合、`DP_OREADER' を指定したす。これは `fopen' の `r' モヌドずほが同じ意味です。第3匕数はハッシュ衚のバケット数を指定したす。ずりあえずデフォルト倀を意味する `-1' を指定しおおけばいいでしょう。</p>
+
+<p>耇数のプロセスが同じファむルを読み曞きする堎合、「レヌスコンディション」ずいう問題が起こりたす。同時にファむルに曞き蟌むず、内容が混ざっお倉になっおしたう可胜性があるのです。QDBMではそれに察凊するために「ファむルロック」をかけたす。あるプロセスがデヌタベヌスを曞き蟌みモヌドで開いおいる堎合は、他のプロセスがデヌタベヌスを開こうずしおもブロックされるのです。凊理が倱敗するわけではなく、既にデヌタベヌスを開いおいるプロセスがデヌタベヌスを閉じるたで埅っおくれるのです。なお、読み蟌みモヌド同士であればレヌスコンディションは起こらないので同時にアクセスするこずができたす。</p>
+
+<div><kbd>int dpclose(DEPOT *<var>depot</var>);</kbd></div>
+
+<p>`dpclose' はデヌタベヌスを閉じる関数です。第1匕数には `dpopen' で開いたハンドルを枡したす。開いたデヌタベヌスは必ず閉じおください。そうしないずデヌタベヌスが壊れたす読み蟌みモヌドの堎合は壊れたせんが、メモリリヌクになりたす。</p>
+
+<p>ずころで、QDBMを䜿わない䟋では、曞き蟌みの際に呌び出す `fprintf' の戻り倀をチェックしおいたせん。`fprintf' が倱敗した堎合は `fclose' も゚ラヌを返すず芏定されおいるからです。同様に、QDBMでもデヌタベヌスに䞀床でも臎呜的な゚ラヌが起きた堎合は `dpclose' が゚ラヌを返すので、゚ラヌチェックを簡略化するこずができるのです。</p>
+
+<div><kbd>int dpput(DEPOT *<var>depot</var>, const char *<var>kbuf</var>, int <var>ksiz</var>, const char *<var>vbuf</var>, int <var>vsiz</var>, int <var>dmode</var>);</kbd></div>
+
+<p>`dpput' はデヌタベヌスにレコヌドを远加する関数です。第1匕数には `dpopen' で開いたハンドルを枡したす。第2匕数には、曞き蟌むレコヌドのキヌの内容を保持する領域ぞのポむンタを指定したす。第3匕数にはその領域のサむズを指定したす。それが負数の堎合は、第2匕数を文字列ずしお扱っお、`strlen' の倀をサむズずしお刀定したす文字列ずバむナリの䞡方を簡単に扱えるようにするためです。第4匕数ず第5匕数は、レコヌドの倀に関しお同様にポむンタずサむズを指定したす。第6匕数は曞き蟌みのモヌドです。デヌタベヌス内には同じキヌを持぀耇数のレコヌドを栌玍するこずができないので、既存のレコヌドのキヌず同䞀のキヌを持぀レコヌドを栌玍しようずした際にどうするかを指瀺する必芁がありたす。`DP_DOVER' ずした堎合は、既存のレコヌドを新しいレコヌドで䞊曞きしたす。`DP_DKEEP' ずした堎合は、既存のレコヌドを優先し、゚ラヌが返されたす`DP_EKEEP' ずいう゚ラヌコヌドが倖郚倉数 `dpecode' に蚭定されたす。</p>
+
+<p>`dpput' の曞き蟌みモヌドには、`DP_DCAT' による「連結モヌド」もありたす。これを利甚するこずはあたりないかもしれたせんが、他のDBMにはない特城なので説明したす。連結モヌドは、レコヌドの倀ずしお配列を入れる際に䟿利なのです。䟋えば、[10,11,12] ずいう䞉぀の数倀を芁玠に持぀配列を栌玍しおいお、それを [10,11,12,13] にしたい堎合を考えおみたす。他のDBMでは、たずそのレコヌドを怜玢しお、[10,11,12] を獲埗しおから、それを [10,11,12,13] に加工しお倀を生成し、元のレコヌドに䞊曞きで曞き蟌むずいったこずをしなければなりたせん。QDBMの堎合は、連結モヌドで [13] を既存のレコヌドに曞き蟌むだけで同じこずができたす。配列の芁玠数が倧きい堎合にはこの違いはパフォヌマンスに倧きな圱響を及がしたす。</p>
+
+<div><kbd>char *dpget(DEPOT *<var>depot</var>, const char *<var>kbuf</var>, int <var>ksiz</var>, int <var>start</var>, int <var>max</var>, int *<var>sp</var>);</kbd></div>
+
+<p>`dpget' はデヌタベヌスを怜玢しおレコヌドを取り出す関数です。第1匕数は他ず䞀緒ですね。第2匕数ず第3匕数は `dpput' ず同様に怜玢キヌのポむンタずサむズを指定したす。第4匕数ず第5匕数はずりあえず `0' ず '-1' にするものだず思っおいただいお結構です。䞀応説明するず、取り出す領域の開始オフセットず最倧サむズを指定したす。`-1' は無制限ずいう意味です。䟋えばレコヌドの倀が `abcdef' の堎合に開始オフセットを `1'、サむズを `3' にした堎合、`bcd' が取り出されたす。戻り倀は取り出した倀の内容を蚘録した領域ぞのポむンタです。その領域は `malloc' でヒヌプに確保されおいるので、アプリケヌションの責任で `free' に枡しお解攟する必芁がありたす。戻り倀の領域は終端にれロコヌドが付加されおいるこずが保蚌されおいるので、文字列ずしお利甚できたす。ただし、バむナリを扱う堎合には明瀺的にサむズが知りたいでしょうから、その為に第6匕数にサむズを受け取る倉数ぞのポむンタを指定するこずができたすこのサむズには終端のれロコヌドは勘定されたせん。該圓のレコヌドがない堎合には `NULL' が返されたす`DP_ENOITEM' ずいう゚ラヌコヌドが倖郚倉数 `dpecode' に蚭定されたす。</p>
+
+<p>Depotの関数で他によく䜿うものずしお、`dpout'、`dpiterinit'、`dpiternext' がありたす。これらに぀いおも説明しおおきたす。</p>
+
+<div><kbd>int dpout(DEPOT *<var>depot</var>, const char *<var>kbuf</var>, int <var>ksiz</var>);</kbd></div>
+
+<p>`dpout' はデヌタベヌスからレコヌドを削陀する関数です。䞉぀の匕数の扱いは `dpget' のものず同じです。該圓のレコヌドがない堎合ぱラヌを返したす`DP_ENOITEM' ずいう゚ラヌコヌドが倖郚倉数 `dpecode' に蚭定されたす。</p>
+
+<p>`dpiterinit' ず `dpiternext' はデヌタベヌスの䞭のレコヌドを䞀぀䞀぀芋おいく堎合に䜿いたす。先皋の内線番号デヌタベヌスの党レコヌドを衚瀺する関数の䟋を以䞋に瀺したす。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+#define PHONEFILE "phone"
+
+int printphonenumbers(void){
+ DEPOT *depot;
+ char *kbuf, *vbuf;
+ /* デヌタベヌスを読み蟌みモヌドで開く */
+ if(!(depot = dpopen(PHONEFILE, DP_OREADER, -1))) return -1;
+ /* むテレヌタを初期化する */
+ dpiterinit(depot);
+ /* 各レコヌドのキヌを取り出す */
+ while((kbuf = dpiternext(depot, NULL)) != NULL){
+ /* 各レコヌドの倀を取り出す */
+ if((vbuf = dpget(depot, kbuf, -1, 0, -1, NULL)) != NULL){
+ printf("%s: %s\n", kbuf, vbuf);
+ /* 倀の領域を解攟する */
+ free(vbuf);
+ }
+ /* キヌの領域を解攟する */
+ free(kbuf);
+ }
+ /* デヌタベヌスを閉じる */
+ return dpclose(depot) ? 0 : -1;
+}
+</pre>
+
+<p>党おのレコヌドを暪断的に芋おいくこずを「トラバヌサルアクセス」ず呌ぶこずにしたす。トラバヌサルアクセスの際には、「むテレヌタ」を利甚したす。むテレヌタは集合に含たれる個々の芁玠を凊理する際に、その芁玠を䞀぀ず぀取り出す機胜です。トラバヌサルアクセスをはじめる前にはむテレヌタを初期化したす。そしお、むテレヌタが「打ち止め」の合図を返すたで繰り返しお呌び出したす。</p>
+
+<div><kbd>int dpiterinit(DEPOT *<var>depot</var>);</kbd></div>
+
+<p>`dpiterinit' はむテレヌタを初期化する関数です。特に説明は必芁ありたせんね。</p>
+
+<div><kbd>char *dpiternext(DEPOT *<var>depot</var>, int *<var>sp</var>);</kbd></div>
+
+<p>`dpiternext' はむテレヌタから次のレコヌドのキヌを取り出す関数です。第1匕数は他ず同じです。䟋によっお戻り倀はれロコヌドが付加された領域ぞのポむンタです。領域は `malloc' で確保されおいるので、アプリケヌションの責任で `free' しおください。明瀺的にサむズを知りたい堎合は第2匕数にそれを受け取る倉数ぞのポむンタを指定したす。もう取り出すレコヌドがなくなったら `NULL' が返されたす`DP_ENOITEM' ずいう゚ラヌコヌドが倖郚倉数 `dpecode' に蚭定されたす。</p>
+
+<p>トラバヌサルアクセスで各レコヌドを蟿る順番に぀いおは芏定されおいたせんので、レコヌドの順序に䟝存したプログラミングをしおはいけたせんそのような堎合はB+朚デヌタベヌスを䜿いたしょう。たた、むテレヌタを繰り返しおいる途䞭でレコヌドを䞊曞きした堎合、既に読んだはずのレコヌドがたた取り出される可胜性がありたす。途䞭でレコヌドを削陀するこずに関しおは問題ありたせん。</p>
+
+<p>ここたででDepotの基本的な䜿い方は説明し終えたした。QDBMのそれ以倖のAPIもDepotに䌌たような䜿い方をしたすので、基本仕様曞のサンプルコヌドを芋れば理解しおもらえるず思いたす。</p>
+
+<hr />
+
+<h2><a name="curia" id="curia" class="head">Curia: 拡匵API</a></h2>
+
+<p>Curiaは、Depotずほずんど同じ機胜ずむンタフェヌスを備えたすが、ファむルでなくディレクトリずしおデヌタベヌスを扱うAPIです。やたらず倧量のデヌタを扱わなければならない堎合にはCuriaがお薊めです。デヌタをディレクトリの䞭の耇数のファむルに分散しお栌玍するので、Depotよりも倧きな2GB以䞊のデヌタベヌスを扱うこずができたす。Depotではハンドルに `DEPOT' ぞのポむンタを䜿いたしたが、Curiaでは `CURIA' ぞのポむンタを䜿いたす。そしお、Depotでは `dp' で始たっおいた関数名が、Curiaでは `cr' で始たりたす。名前が違うだけで、䜿い方は党く䞀緒です。ただし、デヌタベヌスを開く `cropen' ずいう関数は、デヌタベヌスの分割数を指定する匕数が増えおいたす。</p>
+
+<div><kbd>CURIA *cropen(const char *<var>name</var>, int <var>omode</var>, int <var>bnum</var>, int <var>dnum</var>);</kbd></div>
+
+<p>第1、第2、第3匕数は `dpopen' のものず党く䞀緒です。第4匕数は、デヌタベヌスの分割数を指定したす。ディレクトリの䞭に、指定した数だけのファむルが䜜られたす。なお、第3匕数で指定した倀はその各々のデヌタベヌスファむルが持぀バケット数になりたす。戻り倀はCuriaのデヌタベヌスハンドルずなりたす。</p>
+
+<p>Curiaには「ラヌゞオブゞェクト」を扱う機胜もありたす。ラヌゞオブゞェクトずは、各レコヌドをファむルずしお独立させお保存する仕組みです。ラヌゞオブゞェクトにするず通垞のレコヌドより凊理速床が萜ちたすが、デヌタベヌスのサむズを無限にディスクが蚱す限り倧きくするこずができたす。なお、ラヌゞオブゞェクトのトラバヌサルアクセスはサポヌトされたせん。</p>
+
+<hr />
+
+<h2><a name="relic" id="relic" class="head">Relic: NDBM互換API</a></h2>
+
+<p>Relicは、NDBMのアプリケヌションをすべからくQDBMに乗り換えさせるずいう野望の䞋に䜜られたAPIです。パフォヌマンスはオリゞナルのNDBMの数倍は出たす。NDBMのアプリケヌションはあたり芋ないですが、Perl等のスクリプト蚀語がそのむンタフェヌスを備えおいたす。぀たりRelicによっお各皮のスクリプト蚀語でQDBMが䜿えるこずが保蚌されるわけです。</p>
+
+<p>あなたのアプリケヌションの゜ヌスコヌド䞭で `ndbm.h' をむンクルヌドしおいる郚分を `relic.h' に曞き換え、リンク察象を `ndbm' から `qdbm' に換えお再コンパむルしください。それだけであなたのアプリケヌションはQDBMに乗り換えるこずができたす。なお、新たにアプリケヌションを曞く際には、RelicでなくDepotを利甚するこずをお薊めしたす。</p>
+
+<hr />
+
+<h2><a name="hovel" id="hovel" class="head">Hovel: GDBM互換API</a></h2>
+
+<p>Hovelは、GDBMのアプリケヌションをすべからくQDBMに乗り換えさせるずいう野望の䞋に䜜られたAPIです。パフォヌマンスはオリゞナルのGDBMの数倍は出たす。GDBMのアプリケヌションは垂堎に倚く芋られたすが、それらをお䜿いの堎合は、ぜひずもQDBMに移怍しおあげおください。パフォヌマンスが目に芋えおに改善されるこずうけあいです。</p>
+
+<p>あなたのアプリケヌションの゜ヌスコヌド䞭で `gdbm.h' をむンクルヌドしおいる郚分を `hovel.h' に曞き換え、リンク察象を `gdbm' から `qdbm' に換えお再コンパむルしください。それだけであなたのアプリケヌションはQDBMに乗り換えるこずができたす。なお、新たにアプリケヌションを曞く際には、HovelでなくDepotを利甚するこずをお薊めしたす。</p>
+
+<p>通垞、Hovelが生成するデヌタベヌスファむルはDepotのものず党く同じものです。しかし、ちょっず现工するずそれをCuriaによるデヌタベヌスディレクトリに倉曎するこずができたす。デヌタベヌスハンドルを取埗する関数 `gdbm_open' を、`gdbm_open2' に曞き換えればよいのです。単䞀のファむルにデヌタベヌスを栌玍しおいる堎合は、ファむルサむズが2GBたでずいう制限にひっかかっおしたいたすが、`gdbm_open2' を䜿えばそれを乗り越えるこずができたす。`gdbm_open' を呌び出しおいるずころ以倖は党く倉曎する必芁がないずいうのが嬉しいずころです。</p>
+
+<div><kbd>GDBM_FILE gdbm_open2(char *<var>name</var>, int <var>read_write</var>, int <var>mode</var>, int <var>bnum</var>, int <var>dnum</var>, int <var>align</var>);</kbd></div>
+
+<p>第1匕数は生成するファむルかディレクトリの名前です。第2匕数ず第3匕数は `gdbm_open' の第3匕数ず第4匕数ずしお枡すものず䞀緒です。第4匕数はバケットの芁玠数です。第5匕数はデヌタベヌスファむルの分割数です。第6匕数は各レコヌドのアラむンメントです。戻り倀は `gdbm_open' ず同じくデヌタベヌスハンドルです。</p>
+
+<hr />
+
+<h2><a name="cabin" id="cabin" class="head">Cabin: ナヌティリティAPI</a></h2>
+
+<p>Cabinは、デヌタの操䜜を簡単に行うためのナヌティリティを集めたAPIです。密かにQDBMのAPIの䞭で最も充実しおいたす。特にリストずマップに関連する関数が重宝したす。他にも、ファむルやディレクトリを読んだり、文字列を分割したり、CSVやXMLを解析したり、各皮の笊号化ず埩号もできたす。ここではリストずマップずXMLに぀いお詳しく説明したす。</p>
+
+<p>リストずは、順序を持った集合のこずです。Cabinが扱うリストには任意の文字列やバむナリを芁玠ずしお加えるこずができたす。リストの先頭に察しお芁玠の远加ず削陀ができるずずもに、リストの末尟に察しお芁玠の远加ず削陀をするこずもできたす぀たりデクです。たた、配列を䜿っお実装されおいるので、任意の順番の芁玠の倀を高速に参照するこずができたす。以䞋の䟋では、`first'、`second'、`third' ずいう文字列を順に末尟から远加した䞊で、先頭から末尟たで芁玠の内容を衚瀺しおいたす。</p>
+
+<pre>#include &lt;cabin.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+void listtest(void){
+ CBLIST *list;
+ int i;
+ /* リストを開く */
+ list = cblistopen();
+ /* 芁玠を末尟から远加する */
+ cblistpush(list, "first", -1);
+ cblistpush(list, "second", -1);
+ cblistpush(list, "third", -1);
+ /* 先頭から芁玠の内容を衚瀺する */
+ for(i = 0; i &lt; cblistnum(list); i++){
+ printf("%s\n", cblistval(list, i, NULL));
+ }
+ /* リストを閉じる */
+ cblistclose(list);
+}
+</pre>
+
+<p>`CBLIST' 型ぞのポむンタをリストのハンドルずしお甚いたす。実際のハンドルは `cblistopen' を呌び出しお獲埗したす。ハンドルを閉じおメモリを解攟するには、`cblistclose' を呌び出したす。`cblistpush' は末尟に芁玠を远加したす。`cblistnum' はリストの芁玠数を返したす。`cblistval' はリスト内の特定の番号れロからはじたるの芁玠を返したす。リスト操䜜の関数はその他にもいく぀かありたす。</p>
+
+<p>マップずは、キヌず倀からなるレコヌドの集合です。Cabinが扱うマップには任意の文字列やバむナリをキヌや倀に持぀レコヌドを栌玍するこずができたす。キヌが完党に䞀臎するレコヌドを怜玢しお倀を取り出すこずができたす実装はハッシュ衚です。マップ内のレコヌドを先頭から䞀぀ず぀取り出すこずもできたす。なお、各芁玠は栌玍した順番で䞊んでいるこずが保蚌されおいたす。以䞋の䟋では、キヌ `one' ず倀 `first'、キヌ `two' ず倀 `second'、キヌ `three' ず倀 `third' のレコヌドを順に栌玍した䞊で、その各々を怜玢しお衚瀺しおいたす。</p>
+
+<pre>#include &lt;cabin.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+void maptest(void){
+ CBMAP *map;
+ /* マップを開く */
+ map = cbmapopen();
+ /* レコヌドを远加する */
+ cbmapput(map, "one", -1, "first", -1, 1);
+ cbmapput(map, "two", -1, "second", -1, 1);
+ cbmapput(map, "three", -1, "third", -1, 1);
+ /* レコヌドを怜玢しお内容を衚瀺する */
+ printf("one: %s\n", cbmapget(map, "one", -1, NULL));
+ printf("two: %s\n", cbmapget(map, "two", -1, NULL));
+ printf("three: %s\n", cbmapget(map, "three", -1, NULL));
+ /* マップを閉じる */
+ cbmapclose(map);
+}
+</pre>
+
+<p>`CBMAP' 型ぞのポむンタをマップのハンドルずしお甚いたす。実際のハンドルは `cbmapopen' を呌び出しお獲埗したす。ハンドルを閉じおメモリを解攟するには、`cbmapclose' を呌び出したす。`cbmapput' でレコヌドを远加したす。`cbmapget' でレコヌドを怜玢したす。マップ操䜜の関数はその他にもいく぀かありたす。</p>
+
+<p>XMLを簡単に凊理するために、簡易的なパヌザが甚意されおいたす。このパヌザは劥圓性怜蚌をせず、曞匏の怜査も厳密でないのが特城です。したがっお、䞀般的なHTMLやSGMLの解析にも甚いるこずができたす。単玔な構造のXML文曞を凊理する際には、DOMやSAXずいったAPIを䜿うよりも䟿利です。以䞋の䟋では、XML文曞の䞭から `id' 属性の倀で芁玠を指定しお、そのテキストを取り出しお衚瀺したす。</p>
+
+<pre>#include &lt;cabin.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &lt;stdio.h&gt;
+
+void showtextbyid(const char *xml, const char *id){
+ CBLIST *elems;
+ CBMAP *attrs;
+ const char *elem, *attr;
+ char *orig;
+ int i;
+ /* タグずテキストのリストを取埗する */
+ elems = cbxmlbreak(xml, 1);
+ /* リストの各芁玠をたどる */
+ for(i = 0; i &lt; cblistnum(elems); i++){
+ /* 芁玠を取り出す */
+ elem = cblistval(elems, i, NULL);
+ /* タグでない堎合は読み飛ばす */
+ if(elem[0] != '&lt;' || elem[1] == '?' || elem[1] == '!' || elem[1] == '/') continue;
+ /* 属性のマップを取埗する */
+ attrs = cbxmlattrs(elem);
+ /* ID芁玠の倀を取り出し、䞀臎を怜査する */
+ attr = cbmapget(attrs, "id", -1, NULL);
+ if(attr &amp;&amp; !strcmp(attr, id)){
+ /* 次の芁玠を取り出す */
+ elem = cblistval(elems, i + 1, NULL);
+ if(elem){
+ /* 実䜓参照を埩元しお衚瀺する */
+ orig = cbxmlunescape(elem);
+ printf("%s\n", orig);
+ free(orig);
+ }
+ }
+ /* 属性マップを閉じる */
+ cbmapclose(attrs);
+ }
+ /* 芁玠リストを閉じる */
+ cblistclose(elems);
+}
+</pre>
+
+<p>凊理察象のXML文曞のテキストを `cbxmlbreak' で分解したす。䟋えば `&lt;body&gt;&lt;p id="nuts"&gt;NUTS&amp;amp;MILK&lt;/p&gt;&lt;/body&gt;' を分解するず、`&lt;body&gt;'、`&lt;p id="nuts"&gt;'、`NUTS&amp;amp;MILK'、`&lt;/p&gt;'、`&lt;/body&gt;' が埗られたす。そしお、各芁玠を巡回したす。1文字目が '&lt;' であればタグか各皮の宣蚀であり、か぀2文字目が '?'、`!'、`/' のいずれでもなければ開始タグたたは空タグであるず刀断できたす。タグに察しお `cbxmlattrs' を呌ぶこずで属性のマップが埗られたす。このマップは属性名をキヌにしお倀を取り出すこずができたす。属性倀やテキストセクションの文字列は文曞内に出珟したたたの圢匏になっおいたす。実䜓参照を含んだ文字列を埩元するには `cbxmlunescape' を甚いたす。</p>
+
+<p>GTK+に付属するGLibやApacheに付属するAPRなどの䟿利なラむブラリが䞖の䞭にはありたすので、単䜓でCabinを利甚する䟡倀はあたりありたせん。正盎蚀っお、GLibやAPRの方が高機胜で、ナヌザ数も倚く、参考になる情報も倚いです。ずはいえ、Cabinの方が手軜に䜿えるので私は奜きです。</p>
+
+<hr />
+
+<h2><a name="villa" id="villa" class="head">Villa: 侊箚API</a></h2>
+
+<p>Villaは、B+朚のデヌタベヌスを扱うAPIです。B+朚デヌタベヌスにはナヌザが指定した順序でレコヌドが䞊べられお栌玍されたす。DepotやCuriaはキヌの完党䞀臎による怜玢しかできたせんが、Villaを甚いるず範囲を指定しおレコヌドを怜玢するこずができたす。たた、同じキヌを持぀耇数のレコヌドを栌玍するこずもできたす。䟋えば、キヌを文字列の蟞曞順ABC順ずかアむり゚オ順ず同じほが意味ですで䞊べるように指定した堎合は、文字列の前方䞀臎怜玢ができるのです。</p>
+
+<p>ずはいえ、基本的な䜿い方はDepotず䞀緒です。Depotの説明で挙げた関数をVillaを䜿っお実装しなおしおみたす。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;cabin.h&gt;
+#include &lt;villa.h&gt;
+#include &lt;stdlib.h&gt;
+
+#define PHONEFILE "phone"
+
+int putphonenumber(const char *id, const char *phone){
+ VILLA *villa;
+ /* デヌタベヌスを远蚘モヌドで開く */
+ if(!(villa = vlopen(PHONEFILE, VL_OWRITER | VL_OCREAT, VL_CMPLEX))) return -1;
+ /* レコヌドを曞き蟌む */
+ vlput(villa, id, -1, phone, -1, VL_DOVER);
+ /* デヌタベヌスを閉じる */
+ if(!vlclose(villa)) return -1;
+ return 0;
+}
+
+char *getphonenumber(const char *id){
+ VILLA *villa;
+ char *phone;
+ /* デヌタベヌスを読み蟌みモヌドで開く */
+ if(!(villa = vlopen(PHONEFILE, VL_OREADER, VL_CMPLEX))) return NULL;
+ /* レコヌドを怜玢しお戻り倀を生成する */
+ phone = vlget(villa, id, -1, NULL);
+ /* デヌタベヌスを閉じる */
+ vlclose(villa);
+ return phone;
+}
+</pre>
+
+<p>`VILLA' ぞのポむンタは䟋によっおデヌタベヌスハンドルです。`vlopen' でそのハンドルを獲埗したす。その第3匕数の `VL_CMPLEX' は蟞曞順の比范を行う関数です。開いたハンドルは `vlclose' で閉じたす。`vlput' はレコヌドを栌玍する関数で、`vlget' はレコヌドを怜玢する関数です。</p>
+
+<p>䞊蚘の䟋ではハッシュデヌタベヌスず党く同じ䜿い方をしたしたが、順番に基づいおレコヌドにアクセスする機胜がB+朚デヌタベヌスの特城です。蟞曞順を䟋にずっお説明したす。キヌがそれぞれ `one'、`two'、`three'、`four' ずいうレコヌドを栌玍したずすれば、それは `four'、`one'、`three'、`two' ずいう順番で䞊べられお保存されたす。怜玢にはハッシュデヌタベヌスず同様に完党䞀臎条件も䜿えたす。さらに、「カヌ゜ル」ずいう機胜を䜿っお範囲を指定した怜玢ができたす。カヌ゜ルはレコヌドの䜍眮を指し瀺したす。䟋えば、`one' の堎所にカヌ゜ルを飛ばすずいった指定ができたす。`one' がない堎合は、`one' の盎埌の `three' の䜍眮にカヌ゜ルが飛ぶこずになりたす`one' が耇数あった堎合は、その最初のレコヌドに飛びたす。カヌ゜ルは、珟圚䜍眮から前に進めたり埌ろに戻したりするこずもできたす。そしお、カヌ゜ルの䜍眮のレコヌドの内容を読み出せば、範囲を指定した怜玢ができるずいうわけです。以䞋の䟋は、`one' から `three' たでのレコヌドのキヌず倀を衚瀺する関数です。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;cabin.h&gt;
+#include &lt;villa.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+#define WORDFILE "word"
+#define TOPWORD "one"
+#define BOTTOMWORD "three"
+
+void printwords(void){
+ VILLA *villa;
+ char *kbuf, *vbuf;
+ int ksiz;
+ /* デヌタベヌスを読み蟌みモヌドで開く */
+ if(!(villa = vlopen(WORDFILE, VL_OREADER, VL_CMPLEX))) return;
+ /* カヌ゜ルを候補の先頭に飛ばす */
+ vlcurjump(villa, TOPWORD, -1, VL_JFORWARD);
+ /* 各候補を凊理する */
+ do {
+ /* レコヌドのキヌを取り出す */
+ kbuf = vlcurkey(villa, &amp;ksiz);
+ /* 候補が範囲倖であれば抜ける */
+ if(!kbuf || VL_CMPLEX(kbuf, ksiz, BOTTOMWORD, sizeof(BOTTOMWORD) - 1) &gt; 0){
+ free(kbuf);
+ break;
+ }
+ /* レコヌドの倀を取り出しお衚瀺する */
+ vbuf = vlcurval(villa, NULL);
+ if(kbuf &amp;&amp; vbuf) printf("%s: %s\n", kbuf, vbuf);
+ /* キヌず倀の領域を解攟する */
+ free(vbuf);
+ free(kbuf);
+ /* カヌ゜ルを次に進める */
+ } while(vlcurnext(villa));
+ /* デヌタベヌスを閉じる */
+ vlclose(villa);
+}
+</pre>
+
+<p>`vlcurjump' でカヌ゜ルを候補の先頭に飛ばしおいたす。`VL_JFORWARD' はこれからカヌ゜ルを前に進めおいく堎合に指定したす候補の末尟に飛ばしおから埌ろに戻しお行く堎合は `VL_JBACKWARD' を指定したす。do-whileルヌプの条件郚で `vlcurnext' を呌んでいたすが、これがカヌ゜ルを前に進めおいたすデヌタベヌスの最埌たで来たら停を返すのでルヌプから抜けたす。`vlcurkey' ず `vlcurval' はそれぞれカヌ゜ルのキヌず倀を取り出したす。`VL_CMPLEX' を明瀺的に呌んでいる堎所がありたすが、ここで候補の末尟に来たかどうか刀定しおいたす。比范関数は、二぀のキヌのポむンタずサむズを枡しお、前者が倧きい぀たり埌ろに䜍眮すべきなら正の倀、前者が小さい぀たり前に䜍眮すべきなら負の倀、䞡者が同じなられロを返すず芏定されおいたす。したがっお、正の倀が返された堎合、今取り出したキヌは候補の末尟よりも埌ろだずいうこずになりたす。</p>
+
+<p>蟞曞順以倖の比范関数も䜿えるずころがVillaのミ゜です。int型の数倀を比范する `VL_CMPINT' や、10進数の文字列を比范する `VL_CMPDEC' ずいった関数が最初から甚意されおいたす。さらに、あなたが自分で定矩した関数も比范関数ずしお䜿うこずができたす。䜿い方が面倒だずいう欠点を陀けば、B+朚デヌタベヌスはハッシュデヌタベヌスよりも倚くのシヌンで掻甚できるず思いたす。ファむルがハッシュデヌタベヌスよりも小さかったり、トランザクションが䜿えるずいった特城も、人によっおは嬉しいかもしれたせん。</p>
+
+<p>Villaは、キュヌFIFOを氞続化する目的でも利甚できたす。`VL_CMPINT' を比范関数にしおデヌタベヌスを開きたす。各レコヌドのキヌはint型ずし、倀には任意のオブゞェクトを入れるこずにしたす。キュヌに芁玠を远加するには、末尟のキヌの数倀なければれロをむンクリメントしおキヌを生成しお栌玍したす。キュヌから芁玠を取り出すには、先頭のレコヌドを取り出しおから削陀すればよいのです。そのような機胜を持぀ラッパ関数を、`qopen'、`qclose'、`qappend'、`qconsume' ずいった名前で䜜っおおくず小粋ですね。</p>
+
+<hr />
+
+<h2><a name="odeum" id="odeum" class="head">Odeum: 転眮API</a></h2>
+
+<p>Odeumは、党文怜玢甚の転眮むンデックスを扱うAPIです。テキストファむルたたはテキストを含むHTMLやMS-Wordの文曞などは単語の集合ずみなせたすが、ある単語がどのファむルに含たれるかずいう情報をデヌタベヌスにしたものを転眮むンデックスず呌びたす。本の巻末にある玢匕は、ある単語がどのペヌゞに含たれるかずいう情報を持っおいたすが、それず䌌たようなものです。私がQDBMを開発する契機ずなったのは、ずある党文怜玢システムの開発で䜿っおいたGDBMのパフォヌマンスに限界を感じたこずです。その経緯から、QDBM特にCuriaには転眮むンデックスの実珟に郜合のよい特城がいく぀か備わっおいたす。</p>
+
+<p>転眮むンデックスの栞ずなるのは、ある単語をキヌずし、その単語を含むファむルのIDの配列を倀ずするレコヌドからなるデヌタベヌスです。単語は完党䞀臎で怜玢できればよいので、デヌタ構造にはハッシュ衚を採甚しおいたす。転眮むンデックスのむメヌゞを䟋瀺したす。ファむル `penguin.txt' には「flightless marine birds」ずいうテキストが栌玍されおいお、ファむル `ostrich.txt' には、「flightless birds in africa」ずいうテキストが栌玍されおいるずしたす。各ファむルには、読み蟌んだ順番でIDを぀けるこずにしたす。これらを察象ずしお転眮むンデックスを䜜成するず、以䞋のようになりたす。IDずファむル名の察応づけは別の「文曞デヌタベヌス」に保存しおおきたす。</p>
+
+<table summary="index example">
+<tr><td>flightless</td><td>1,2</td></tr>
+<tr><td>marine</td><td>1</td></tr>
+<tr><td>birds</td><td>1,2</td></tr>
+<tr><td>in</td><td>2</td></tr>
+<tr><td>africa</td><td>2</td></tr>
+</table>
+
+<p>その次に読み蟌んだ文曞に「birds」ずいう単語が含たれおいた堎合には、`birds' の倀を [1,2,3] に倉曎するこずになりたす。このように、既存のレコヌドの倀の末尟にデヌタを远加するずいう操䜜が頻繁に発生したす。この凊理を効率的に行うために、DepotやCuriaの曞き蟌み操䜜には「連結モヌド」があるのです。</p>
+
+<p>怜玢時には、怜玢語をキヌにしお倀の配列を取り出し、個々のIDに察応するファむル名を文曞デヌタベヌスから取り出しお提瀺するこずになりたす。ただし該圓の文曞が倚い堎合にその党おを提瀺しおもナヌザは困惑するので、先頭の䜕件かに絞っお取り出したす。DepotやCuriaの読み蟌み操䜜ではレコヌドの倀から特定の郚分のみを取り出すこずができるので、この凊理を効率良く行うこずができたす。実際は、ファむルにおける単語のスコア重芁床も配列芁玠の䞀郚ずしお栌玍しおおいお、それを基準に゜ヌトしおおくこずによっお、先頭の芁玠がナヌザにずっお意味のあるものにしおいたす。</p>
+
+<p>ファむルには名前以倖にも、タむトルや䜜者名や曎新日時ずいった属性を぀けたい堎合がありたす。それらの情報は文曞デヌタベヌスに保存したす。Odeumで扱うファむル以埌は文曞ず呌びたすは、ファむル名の代わりにURIを぀けるものずしおいたす。URI以倖の属性はナヌザがラベルを぀けお任意のものを栌玍できたす。</p>
+
+<p>Odeumは、文曞のテキストや属性を元のデヌタから抜出する機胜に぀いおは提䟛したせん。それらはドメむンに匷く䟝存するので、共通化するこずが難しいからです。したがっお、アプリケヌションがそれを実装する必芁がありたす。Odeumのサンプルアプリケヌションは、ロヌカルのファむルシステムにあるプレヌンテキストずHTMLからテキストず属性を抜出できたす。あなたのアプリケヌションでは、PDFやMS-Wordの文曞に察応するのもよいでしょう。Webから文曞を取埗しおもよいでしょう。同じ理由から、Odeumはテキストから単語を抜出する機胜に぀いおも提䟛したせん。英語ず日本語では党く異なる手法でテキストの解析をしなければなりたせんが、そういったこずもアプリケヌションに任されたす。Odeumのサンプルアプリケヌションでは、単に空癜で語を区切るずいう手法をずっおいたす。あなたのアプリケヌションでは、日本語の圢態玠解析を行うのもよいでしょう。英単語のステミング凊理を行っおもよいでしょう。</p>
+
+<p>倚くの蚀語では、同じ単語に察しお異䜓や掻甚が存圚したす。䟋えば「䜿う/䜿った」「go/went」「child/children」などです。そこで、Odeumは各単語を「正芏圢」および「出珟圢」の組ずしお扱いたす。テキストから出珟圢の単語を切り出したり、それらの正芏圢を生成する凊理はアプリケヌションに任されたす。転眮むンデックスでのレコヌドのキヌには正芏圢が䜿われたす。「child」で怜玢すれば、「children」を含む文曞も該圓させられるずいうこずです。怜玢語に察しおも正芏化の凊理を行えば、「children」で怜玢しお「child」を該圓にできたす。なお、出珟圢もデヌタベヌスに蚘録されたすが、それは怜玢結果ずしお文曞の芁玄を提瀺するなどの甚途で利甚されたす䞍芁な堎合は出珟圢を党お空文字列にしお蚘憶領域を節玄できたす。</p>
+
+<p>党文怜玢システムの善し悪しを評䟡する際には、スコアリングランキングが重芁な芁玠になりたす。怜玢結果が倚い堎合に、その䞭から絞り蟌んでナヌザに提瀺する文曞をどうやっお遞択するかずいうこずです。いくら怜玢速床が速くおも、満足のいく怜玢結果が提瀺されずに䜕床も怜玢したり、無駄な文曞を閲芧しなければならないのでは、結局は時間がかかるこずになっおしたいたす。Odeumでは、文曞を登録する際に、そこに含たれる各単語に぀いお以䞋の匏でスコアを算出しお、文曞IDずずもに転眮むンデックスに栌玍しおいたす。</p>
+
+<div><kbd>スコア = (該圓語の出珟数 * 10000) / log(文曞内の総語数) ^ 3</kbd></div>
+
+<p>ある単語がたくさん出珟するずいうこずは、その文曞でその単語のこずに぀いお詳しく説明されおいる可胜性が高いず刀断できたす。ただし、倧きな文曞は小さい文曞よりも単語の出珟数が倚くなりたすので、その調敎をする必芁がありたす。そこで、該圓語の出珟数を、総語数の自然察数の䞉乗で割っおいるのです。なお、テキストの先頭10%以内に出お来る単語は「トピックセンテンス」を構成するずみなしお、初出時に限り10000でなく15000を加算しおいたす。</p>
+
+<p>党文怜玢は通垞、耇数の怜玢語を䜿っお行われたす。その際には、各怜玢語のスコアを調敎しないず、特定の怜玢語のスコアの圱響が匷すぎるずいう事態が発生したす。䟋えば「the beatles」で怜玢した堎合、「the」のスコアが「beatles」のスコアを圧倒しお、「beatles」に぀いお知りたいのに、関係ない文曞ばかりが提瀺されるこずになっおしたいたす。Odeumは転眮むンデックスの内容を提瀺するだけで、それ以埌の凊理はアプリケヌションに任されたす。Odeumに付属するサンプルアプリケヌションでは以䞋の匏で調敎を行っおいたす。</p>
+
+<div><kbd>調敎枈みスコア = 登録されたスコア / log(その語を含む文曞数) ^ 2</kbd></div>
+
+<p>ありふれた単語はスコアを䞋げ、特城的な単語はスコアを維持すべきです。そこで、登録されたスコアを、その語を含む文曞数の自然察数の二乗で割っおいるのですTF-IDF法を匷化したものです。各怜玢語の調敎枈みスコアを足したものを文曞のスコアずし、その降順で怜玢結果を提瀺したす。他にもドメむンに䟝存した様々なスコアリング手法があるず思いたすが、アプリケヌションがそれを実装できるのが嬉しいずころです。</p>
+
+<p>Odeumのサンプルアプリケヌションでは、関連文曞怜玢類䌌文曞怜玢ず呌んだ方が適切かもしれたせんの機胜も実装しおいたす。ある文曞皮文曞ず呌びたすに関連した文曞の䞀芧を提瀺するものです。単語の出珟傟向が䌌通った文曞は互いに関連しおいるずいう考え方ベクトル空間モデルに基づいおいたす。文曞をデヌタベヌスに登録する際には、各文曞に含たれる党単語に察しお調敎枈みスコアを蚈算し、その䞊䜍32語キヌワヌドず呌びたすの情報を文曞ず察応づけお登録しおおきたす。怜玢時には、皮文曞のキヌワヌドずスコアを取り出し、それを32次元のベクトルずしお衚珟したす。関連床を刀定する察象の各文曞からもキヌワヌドずスコアを取り出し、皮文曞のベクトル空間に察応したベクトルを生成したす。そうしおできた二぀のベクトルのなす角が小さいものは関連床が高いず刀定したす。実際には、なす角の䜙匊0から1の範囲で、完党䞀臎する堎合は1になるが倧きいものから提瀺されるこずになりたす。なお、登録された党おの文曞を察象ずしお類䌌床の刀定を行うずあたりに時間がかかるので、キヌワヌドでOR怜玢を行った結果の䞊䜍の文曞のみを関連床算出の察象ずしおいたす。</p>
+
+<p>前眮きはここたでにしお、Odeumの䜿甚方法に぀いおの説明に入りたす。URIが `http://tako.ika/uni.txt' で、そこから取り出したテキストが「The sun is driven by the Grateful Dead.」で、切り出した単語正芏圢/出珟圢が「the/The」「sun/sun」「be/is」「drive/driven」「by/by」「the/the」「grateful/Grateful」「die/dead」「正芏圢なし/.」だずしたしょうこの凊理はアプリケヌションが独自に実装しおくださいいわゆるストップワヌドは正芏圢を空文字列にしお衚珟したす。それを `index' ずいう名前のデヌタベヌスに登録する䟋を瀺したす。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;cabin.h&gt;
+#include &lt;odeum.h&gt;
+#include &lt;stdlib.h&gt;
+
+int docregistertest(void){
+ ODEUM *odeum;
+ ODDOC *doc;
+ /* デヌタベヌスを開く */
+ if(!(odeum = odopen("index", OD_OWRITER | OD_OCREAT))) return -1;
+ /* 文曞を衚珟する */
+ doc = oddocopen("http://tako.ika/uni.txt");
+ oddocaddword(doc, "the", "the");
+ oddocaddword(doc, "sun", "sun");
+ oddocaddword(doc, "be", "is");
+ oddocaddword(doc, "drive", "driven");
+ oddocaddword(doc, "by", "by");
+ oddocaddword(doc, "the", "the");
+ oddocaddword(doc, "grateful", "Grateful");
+ oddocaddword(doc, "die", "Dead");
+ oddocaddword(doc, "", ".");
+ /* 文曞を登録する */
+ odput(odeum, doc, -1, 1);
+ /* 文曞の領域を解攟する */
+ oddocclose(doc);
+ /* デヌタベヌスを閉じる */
+ if(!odclose(odeum)) return -1;
+ return 0;
+}
+</pre>
+
+<p>`ODEUM' ぞのポむンタは䟋によっおデヌタベヌスハンドルです。`odopen' でそのハンドルを獲埗したす。開いたハンドルは `odclose' で閉じたす。`ODDOC' は文曞ハンドルです。各文曞の内容は文曞ハンドルによっお衚珟されたす。`oddocopen' はハンドルを開く関数です。その第1匕数で文曞のURIを指定したす。文曞ハンドルは䞍芁になったら `oddocclose' で解攟したす。テキストの各単語を文曞に登録するには、`oddocaddword' を甚いたす。その第2匕数は単語の正芏圢で、第3匕数は出珟圢です。文曞を衚珟したら、それを `odput' でデヌタベヌスに登録したす。第3匕数は、文曞デヌタベヌスに登録する語数を指定したす。`-1' にするず党郚の語が登録されたす。第4匕数は、同じURIの既存の文曞がある堎合に、それを䞊曞きするか吊か指定したす。</p>
+
+<p>`odput' の第3匕数の指定が少し難しいので補足したす。ある文曞が適切に怜玢されるために、転眮むンデックスにおいお、その文曞に含たれる党おの単語のレコヌドの倀にその文曞のIDが無条件で远加されたす。ずころで、倚くの党文怜玢システムでは、怜玢結果の画面で該圓の文曞の芁玄を衚瀺したす。そのためには、文曞デヌタベヌスの䞭に、各文曞ず関連づけお含たれる単語を順番に蚘録しおおく必芁がありたす。怜玢語の呚蟺の文を切り出しお衚瀺する堎合を考えるず、怜玢語が文曞䞭のどこに珟れるかは予想できないので、党おの単語を文曞デヌタベヌスに蚘録しおおかなければなりたせん。あるいは、冒頭の䜕語かだけ衚瀺する堎合には、その語数分の語を登録しおおけばよいこずになりたす。そういった決定をアプリケヌションに任せるために、文曞デヌタベヌスに登録する語数を指定できるようになっおいるのです。</p>
+
+<p>以䞋の䟋では、`grateful' ずいう単語を含む文曞を怜玢しお、そのURIずスコアを衚瀺したす。たず転眮むンデックスを怜玢しお結果の配列を受け取りたす。その配列の各芁玠は文曞のIDずスコアの組です。文曞の内容を取埗するには、文曞IDを䜿っお文曞デヌタベヌスに問い合わせたす。</p>
+
+<pre>#include &lt;depot.h&gt;
+#include &lt;cabin.h&gt;
+#include &lt;odeum.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+
+void docsearchtest(void){
+ ODEUM *odeum;
+ ODPAIR *pairs;
+ ODDOC *doc;
+ int i, pnum;
+ /* デヌタベヌスを読み蟌みモヌドで開く */
+ if(!(odeum = odopen("index", OD_OREADER))) return;
+ /* 転眮むンデックスを怜玢する */
+ pairs = odsearch(odeum, "grateful", -1, &amp;pnum);
+ if(pairs &amp;&amp; pnum &gt; 0){
+ /* 該圓の各文曞を凊理する */
+ for(i = 0; i &lt; pnum; i++){
+ /* 文曞デヌタベヌスから文曞を取り出す */
+ if(!(doc = odgetbyid(odeum, pairs[i].id))) continue;
+ /* 文曞の内容を衚瀺する */
+ printf("URI: %s\n", oddocuri(doc));
+ printf("SCORE: %d\n", pairs[i].score);
+ /* 文曞の領域を解攟する */
+ oddocclose(doc);
+ }
+ }
+ /* 怜玢結果の領域を解攟する */
+ free(pairs);
+ /* デヌタベヌスを閉じる */
+ odclose(odeum);
+}
+</pre>
+
+<p>転眮むンデックスを怜玢するのが `odsearch' ずいう関数です。第2匕数には正芏圢の怜玢語を指定したす。第3匕数には、怜玢する文曞の最倧数を指定したすが、党郚取り出す堎合は `-1' ずしたす。結果の配列はスコアの降順で゜ヌトされおいるこずが芏定されおいたす。第4匕数には、結果の配列の芁玠数を栌玍する倉数のポむンタを指定したす。次に、配列の各芁玠を凊理しおいきたす。`odgetbyid' は文曞IDを甚いお文曞の内容を問い合わせる関数です。転眮むンデックスの䞭には既に削陀されたり䞊曞きされおIDが倉曎された文曞の情報も入っおいるので最適化すれば䞍芁な情報はなくなりたすが、`odgetbyid' は倱敗する可胜性がありたす。そういう時は単に無芖しお次のルヌプに進んでください。文曞が取埗できたら、あずはそれを衚瀺したす。`oddocuri' は文曞のURIを返す関数です。他にも文曞の情報を取埗する関数がいく぀か甚意されおいたす。</p>
+
+<p>Odeumでは、耇数の怜玢語を甚いお、AND条件怜玢語の党おを含むやOR条件怜玢語のいずれかを含むやNOTAND条件怜玢語の前者を含むが埌者は含たないずいった集合挔算を凊理するための関数が甚意されおいるほか、党文怜玢システムの実装に䟿利なナヌティリティ関数が倚数提䟛されたす。党文怜玢システムを実装する際には性胜ず粟床のバランスを考えなければなりたせんが、OdeumのAPIはアプリケヌションがそれを任意に決められるように蚭蚈されおいたす。倧芏暡なむンデックスを扱う際には、たず粟床を萜した怜玢を行っお、その結果がナヌザの芁求を満たさなければ粟床を高めたパラメヌタで再怜玢する手法が有効でしょう。</p>
+
+<hr />
+
+</body>
+
+</html>
+
+<!-- END OF FILE -->
diff --git a/qdbm/misc/win32check.bat b/qdbm/misc/win32check.bat
new file mode 100644
index 00000000..63dae180
--- /dev/null
+++ b/qdbm/misc/win32check.bat
@@ -0,0 +1,111 @@
+dptest write casket 50000 5000
+if errorlevel 1 goto error
+dptest read casket
+if errorlevel 1 goto error
+dptest read -wb casket
+if errorlevel 1 goto error
+dptest rcat casket 50000 50 500 32 32
+if errorlevel 1 goto error
+dptest combo casket
+if errorlevel 1 goto error
+dptest wicked casket 5000
+if errorlevel 1 goto error
+del /Q casket
+
+crtest write casket 50000 500 10
+if errorlevel 1 goto error
+crtest read casket
+if errorlevel 1 goto error
+crtest read -wb casket
+if errorlevel 1 goto error
+crtest rcat casket 50000 5 10 500 32 32
+if errorlevel 1 goto error
+crtest combo casket
+if errorlevel 1 goto error
+crtest wicked casket 5000
+if errorlevel 1 goto error
+rd /S /Q casket
+
+crtest write -lob casket 1000 50 10
+if errorlevel 1 goto error
+crtest read -lob casket
+if errorlevel 1 goto error
+rd /S /Q casket
+
+rltest write casket 50000
+if errorlevel 1 goto error
+rltest read casket 50000
+if errorlevel 1 goto error
+del /Q casket*
+
+hvtest write casket 50000
+if errorlevel 1 goto error
+hvtest read casket 50000
+if errorlevel 1 goto error
+del /Q casket
+
+hvtest write -qdbm casket 50000
+if errorlevel 1 goto error
+hvtest read -qdbm casket 50000
+if errorlevel 1 goto error
+rd /S /Q casket
+
+cbtest sort 5000
+if errorlevel 1 goto error
+cbtest strstr 500
+if errorlevel 1 goto error
+cbtest list 50000
+if errorlevel 1 goto error
+cbtest map 50000
+if errorlevel 1 goto error
+cbtest wicked 5000
+if errorlevel 1 goto error
+cbtest misc
+if errorlevel 1 goto error
+
+vltest write -tune 25 64 32 32 casket 50000
+if errorlevel 1 goto error
+vltest read casket
+if errorlevel 1 goto error
+vltest rdup -tune 25 64 256 256 casket 50000 50000
+if errorlevel 1 goto error
+vltest combo casket
+if errorlevel 1 goto error
+vltest wicked casket 5000
+if errorlevel 1 goto error
+del /Q casket
+
+vltest write -int -cz -tune 25 64 32 32 casket 50000
+if errorlevel 1 goto error
+vltest read -int casket
+if errorlevel 1 goto error
+vltest rdup -int -cz -tune 25 64 256 256 casket 50000 50000
+if errorlevel 1 goto error
+vltest combo -cz casket
+if errorlevel 1 goto error
+vltest wicked -cz casket 5000
+if errorlevel 1 goto error
+del /Q casket
+
+odtest write casket 500 50 5000
+if errorlevel 1 goto error
+odtest read casket
+if errorlevel 1 goto error
+odtest combo casket
+if errorlevel 1 goto error
+odtest wicked casket 500
+if errorlevel 1 goto error
+rd /S /Q casket
+
+@echo off
+echo #================================
+echo # SUCCESS
+echo #================================
+goto :EOF
+
+:error
+@echo off
+echo #================================
+echo # ERROR
+echo #================================
+goto :EOF