-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan Post
committed
Oct 16, 2015
0 parents
commit 74e6b1a
Showing
621 changed files
with
154,114 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<HTML><HEAD> | ||
<TITLE>Metakit by Equi4 Software</TITLE> | ||
</HEAD> | ||
<BODY BGCOLOR="#FFFFFF"><A NAME="top"></A> | ||
<IMG SRC="doc/metakit.png" WIDTH="160" HEIGHT="44" BORDER=0 align=left></A> | ||
<A HREF="http://www.equi4.com/"><IMG SRC="doc/e4s.gif" vspace=3 WIDTH="97" HEIGHT="35" BORDER=0 align=right></A> | ||
<br> | ||
<br> | ||
<br> | ||
<br> | ||
<H2>Metakit embedded database library</H2> | ||
<UL> | ||
<LI><a href="README">Read me</a> | ||
<LI><a href="CHANGES">Changes</a> | ||
<LI><a href="doc/python.html">Python</a> | ||
<LI><a href="doc/tcl.html">Tcl/Tk</a> | ||
<LI><a href="doc/format.html">File format</a> | ||
</UL> | ||
© 2005 Jean-Claude Wippler <<A HREF="mailto:[email protected]">[email protected]</A>> | ||
</BODY> | ||
</HTML> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
The Metakit Library 2.4.9.7 Jun 2007 | ||
============================================================================== | ||
|
||
|
||
WHAT IT IS - Metakit is an embeddable database which runs on Unix, Windows, | ||
Macintosh, and other platforms. It lets you build applications which | ||
store their data efficiently, in a portable way, and which will not need a | ||
complex runtime installation. In terms of the data model, Metakit takes | ||
the middle ground between RDBMS, OODBMS, and flat-file databases - yet it | ||
is quite different from each of them. | ||
|
||
TECHNOLOGY - Everything is stored variable-sized yet with efficient positional | ||
row access. Changing an existing datafile structure is as simple as re- | ||
opening it with that new structure. All changes are transacted, including | ||
restructuring. You can mix and match software written in C++, Python, | ||
and Tcl. Things can't get much more flexible... | ||
|
||
CORE - The Metakit core library is written in C++. It has a code footprint of | ||
just over 100 Kb on Windows. It can be used as DLL, or linked statically. | ||
Debug builds include extensive assertion checks to catch problems early. | ||
|
||
PYTHON - The binding for Python is called "Mk4py". It uses SCXX by Gordon | ||
McMillan as C++ glue interface. The source is in directory "python/". | ||
|
||
TCL/TK - The MK extension for Tcl is called "Mk4tcl". It is being used in a | ||
number of commercial projects. The source is in directory "tcl/". | ||
|
||
LICENSE AND SUPPORT - Metakit is now distributed as open source software (the | ||
X/MIT-style license is at the end of this document). Commercial support | ||
is available through an Enterprise License, see the URL mentioned below. | ||
|
||
DOCUMENTATION - All documentation uses HTML. The main page is "Metakit.html", | ||
which leads to the rest of the documentation in the "doc/" directory. | ||
The C++ API Reference is extracted from the source code using Doxygen. | ||
|
||
WEBSITE URLS - The main pages on the world wide web, for news and downloads: | ||
Homepage: http://www.equi4.com/metakit.html | ||
Python news: http://www.equi4.com/metakit/python.html | ||
Tcl/Tk news: http://www.equi4.com/metakit/tcl.html | ||
License info: http://www.equi4.com/mklicense.html | ||
Contact info: http://www.equi4.com/contact.html | ||
|
||
ACKNOWLEDGEMENTS - Thanks to everyone who has helped shape and extend Metakit, | ||
including Kyrill Denisenko, Mark Roseman, Gordon McMillan, Matt Newman, | ||
Christian Tismer, John Bushakra, Steve Landers, Jacob Levy, John Barnard, | ||
Nicholas Riley, Brian Kelley, and many more people who have reported bugs | ||
and helped fix them. Last but not least, many thanks to all enterprise | ||
license customers and all my clients for funding Metakit work. | ||
|
||
|
||
INSTALLATION | ||
============ | ||
|
||
All platform builds and language bindings are designed to work from a single | ||
common "builds/" directory. Where possible, that is - it turns out to be | ||
impossible to keep build side-effects limited to *just* this directory | ||
(CodeWarrior can't be told where to place its temp data, and Visual C++ still | ||
alters a few files next to the project ".dsw" file, to name two offenders). | ||
|
||
PYTHON - Nov 2006 | ||
|
||
There is a --with-python option in unix/configure, but it does not always | ||
seem to work. One problem is python version numbers being hard-wired into | ||
the configure/make files (2.5 right now). This worked for me on Mac OS X: | ||
cd builds | ||
../unix/configure \ | ||
--with-python=/Library/Frameworks/Python.framework/Versions/2.5 | ||
ln -s Mk4py.dylib Mk4py.so | ||
Note that the arg to --with-python is the path *upto* include/python2.5 | ||
|
||
There is also a python/setup.py script which should simplify building for | ||
Python. Unfortunately, it does things in a somewhat tricky way in that | ||
it uses MK's .o files from the builds/ directory. This in turn means | ||
that on Mac OS X, you'll need to hack things a bit to make these .o's end | ||
up as "fat" (ppc+i386) binaries since setup.py needs them that way. | ||
|
||
Here's how a non-macosx build should work: | ||
cd builds | ||
sh ../unix/configure | ||
make test | ||
cd ../python | ||
python setup.py clean build | ||
The result will be left in ../builds/lib.*/{Mk4py.so,metakit.py} | ||
|
||
For Mac OS X, you need to hack ../builds/Makefile after running configure: | ||
* change "CXXFLAGS = $(CXX_FLAGS)" to "CXXFLAGS = $(CXX_FLAGS) \ | ||
-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" | ||
* change "SHLIB_LD = g++" to "SHLIB_LD = g++ -dynamiclib \ | ||
-flat_namespace -undefined suppress -arch ppc -arch" | ||
Then do the rest, using "make" i.s.o. "make test" because the changes to | ||
the flags don't seem to create proper executables. That's ok though, the | ||
.o files are fat, which is all setup.py needs. | ||
|
||
TCL - Nov 2006 | ||
|
||
The unix/configure works better for Tcl than for Python, due to the stubs | ||
interface. In many cases, adding --with-tcl or --with-tcl=<dir-of-tcl.h> | ||
will produce a Mk4tcl.so (or a Mk4tcl.dylib on Mac OS X). | ||
|
||
Alternately, you could use the TEA3-based tcl/configure script. It needs | ||
a few preliminary steps to get a proper config.h file in the right spot: | ||
cd builds | ||
sh ../unix/configure | ||
cd ../tcl | ||
ln -s ../builds/config.h | ||
sh configure | ||
make | ||
There are still some issues, the above generates a lot of warning errors. | ||
Note that this does not depend on .o files in ../builds, just config.h | ||
|
||
Note: for Windows CE, the tcl.configure script has been successfully used | ||
using EVC3. One trick is that in tcl/configure.in, "TEA_ADD_CFLAGS([])" | ||
has to be changed to "TEA_ADD_CFLAGS([-Dq4_WINCE])". | ||
|
||
UNIX (ALSO MAC OS X) | ||
|
||
It is no longer advised to build the Unix code in the "unix/" directory. | ||
Instead, you should perform the following steps: | ||
cd builds | ||
sh ../unix/configure | ||
make | ||
make test | ||
And optionally (this only installs the core lib, not script extensions): | ||
make install | ||
|
||
By switching to the "builds/" directory, you will keep the distribution | ||
directory tree 100% unaltered. All changes are made in this subdir, and | ||
all final build results are left behind in this same subdir. | ||
|
||
To build with STL containers and strings, you can do the following: | ||
make CXXFLAGS='-Dq4_STD' test # add -O3 etc, as needed | ||
|
||
OLD: to build the Mk4tcl extension on Unix, change the configure to: | ||
../unix/configure --with-tcl=<dir-where-tcl.h-is> | ||
OLD: to build the Mk4py extension on Unix, change the configure to: | ||
../unix/configure --with-python=<dir-where-include/-is> | ||
E.g. | ||
../unix/configure --with-tcl=/usr/include --with-python=/usr | ||
|
||
Use "../unix/configure --help" to find out about other variants, when the | ||
include & lib dirs are completely different, and for other build options. | ||
|
||
WINDOWS | ||
|
||
There is a "win/" directory which contains subdirectories for a number of | ||
compiler systems. Metakit has been built with many different compilers | ||
in the past (Microsoft, Borland, Watcom, Symantec, Metrowerks, Optima), | ||
only a few are maintained (there are 12 configurations for MSVC6 alone!). | ||
|
||
The MS Visual C++ 6.0 project is "win/msvc60/mksrc.dsw", with subprojects | ||
for the C++ demo (mkdemo), building dll's (mkdll), static libs (mklib), | ||
regression tests (mktest), as well as Tcl (mktcl) and Python (mkpython). | ||
It has been set up to place all intermediate files and final results in | ||
the "builds/" subdirectory, even though you'll launch it from "win/". | ||
|
||
An MSVC 7.0 project by David Van Maren is in win/msvc70/mksrc.sln. | ||
|
||
To build with STL containers and strings under MSVC, define "q4_STD". | ||
To build with MFC containers and strings under MSVC, define "q4_MFC". | ||
|
||
The Metrowerks Codewarrior project is in the "mac/" directory, and can be | ||
used to build both Mac and Windows versions (on either Mac *or* Windows). | ||
The core libraries are built with "mac/cw5.mcp", demos / tests are built | ||
with "cw5apps.mcp", Tcl is "cw5tcl.mcp", and Python is "cw5python.mcp". | ||
|
||
The Borland C++ Builder projects have not yet been incorporated in this | ||
release, but the "KitViewer" application is an example of how to use BCB. | ||
|
||
The Cygwin build (B20.1 / gcc 2.95.2) is different, because it uses the | ||
unix autoconf system, and must be launched as described above for UNIX. | ||
I have upgraded to the latest development of libtool to be able to build | ||
DLL's with Cygwin. You can build the "-mno-cygwin" version by editing | ||
the Makefile by hand and adding that option to CXXFLAGS. | ||
|
||
Rob Bloodgood adds that the following GCC options are for maximum code | ||
efficiency on x86 hardware: "-O2 -m486 -malign-loops=2 -malign-jumps=2". | ||
I have not yet tried this myself, but am passing on the tip. | ||
|
||
MACINTOSH CLASSIC | ||
|
||
The Mac version requires Metrowerks CodeWarrior 6. See the info above | ||
in the Windows section (MWCW is multi-platform). The projects are all | ||
located in the "mac/" folder, which is also where MWCW will place its own | ||
"... Data" folders with intermediate results. As with all other setups, | ||
final results are made to end up in the "builds/" directory. | ||
|
||
|
||
LICENSE AND COPYRIGHT STATEMENT | ||
=============================== | ||
|
||
Copyright (c) 1996-2007 Jean-Claude Wippler | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included | ||
in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
============================================================================== | ||
-- Jean-Claude Wippler <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
// An example using the Metakit C++ persistence library | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// This code demonstrates: | ||
// | ||
// - Creating a persistent view and adding two data rows to it. | ||
// - Adding a third data row using Metakit's operator shorthands. | ||
// - Adding an additional property without losing the existing data. | ||
// - Storing an additional view in the data file later on. | ||
// - Inserting a new record into one of the views in the datafile. | ||
// - Real persistence, the data file will grow each time this is run. | ||
// | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "mk4.h" | ||
#include "mk4str.h" | ||
|
||
#include <stdio.h> | ||
|
||
int | ||
#if _WIN32_WCE | ||
_cdecl | ||
#endif | ||
main() | ||
{ | ||
// These properties could just as well have been declared globally. | ||
c4_StringProp pName ("name"); | ||
c4_StringProp pCountry ("country"); | ||
|
||
// Note: be careful with the lifetime of views vs. storage objects. | ||
// When a storage object goes away, all associated views are cleared. | ||
c4_Storage storage ("myfile.dat", true); | ||
|
||
// There are two ways to make views persistent, but the c4_View::Store call | ||
// call used in previous demos will be dropped, use "c4_View::GetAs" instead. | ||
|
||
// Start with an empty view of the proper structure. | ||
c4_View vAddress = storage.GetAs("address[name:S,country:S]"); | ||
|
||
// Let's add two rows of data to the view. | ||
c4_Row row; | ||
|
||
pName (row) = "John Williams"; | ||
pCountry (row) = "UK"; | ||
vAddress.Add(row); | ||
|
||
pName (row) = "Paco Pena"; | ||
pCountry (row) = "Spain"; | ||
vAddress.Add(row); | ||
|
||
// A simple check to prove that the data is in the view. | ||
c4_String s1 (pName (vAddress[1])); | ||
c4_String s2 (pCountry (vAddress[1])); | ||
printf("The country of %s is: %s\n", (const char*) s1, (const char*) s2); | ||
|
||
// This saves the data to file. | ||
storage.Commit(); // Data file now contains 2 addresses. | ||
|
||
// A very compact notation to create and add a third row. | ||
vAddress.Add(pName ["Julien Coco"] + pCountry ["Netherlands"]); | ||
|
||
storage.Commit(); // Data file now contains 3 addresses. | ||
|
||
// Add a third property to the address view ("on-the-fly"). | ||
vAddress = storage.GetAs("address[name:S,country:S,age:I]"); | ||
|
||
// Set the new age property in one of the existing addresses. | ||
c4_IntProp pAge ("age"); | ||
pAge (vAddress[1]) = 44; | ||
|
||
storage.Commit(); // Data file now contains 3 addresses with age field. | ||
|
||
// Add a second view to the data file, leaving the first view intact. | ||
c4_View vInfo = storage.GetAs("info[version:I]"); | ||
|
||
// Add some data, a single integer in this case. | ||
c4_IntProp pVersion ("version"); | ||
vInfo.Add(pVersion [100]); | ||
|
||
storage.Commit(); // Data file now contains 3 addresses and 1 info rec. | ||
|
||
// Insert a row into the address view. Note that another (duplicate) | ||
// property definition is used here - just to show it can be done. | ||
c4_IntProp pYears ("age"); // On file this is still the "age" field. | ||
|
||
vAddress.InsertAt(2, pName ["Julian Bream"] + pYears [50]); | ||
|
||
// Preceding commits were only included for demonstration purposes. | ||
storage.Commit(); // Datafile now contains 4 addresses and 1 info rec. | ||
|
||
// To inspect the data file, use the dump utility: "DUMP MYFILE.DAT". | ||
// It should generate the following output: | ||
// | ||
// myfile.dat: 3 properties | ||
// address[name:S,country:S,age:I],info[version:I] | ||
// | ||
// VIEW 1 rows = address:V info:V | ||
// 0: subview 'address' | ||
// VIEW 4 rows = name:S country:S age:I | ||
// 0: 'John Williams' 'UK' 0 | ||
// 1: 'Paco Pena' 'Spain' 44 | ||
// 2: 'Julian Bream' '' 50 | ||
// 3: 'Julien Coco' 'Netherlands' 0 | ||
// 0: subview 'info' | ||
// VIEW 1 rows = version:I | ||
// 0: 100 | ||
// | ||
// Note: results will differ if this program is run more than once. | ||
|
||
return 0; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// |
Oops, something went wrong.