├── python ├── .cvsignore ├── test │ ├── .cvsignore │ ├── test_hash.py │ ├── test_stringtype.py │ ├── all.py │ └── test_inttypes.py ├── PyHead.h ├── PyProperty.h ├── PyStorage.h ├── scxx │ ├── PWOCallable.h │ └── PWOImp.cpp ├── PyRowRef.h ├── PyProperty.cpp ├── PyView.h └── metakit.py ├── tests ├── ok │ ├── e05a.txt │ ├── f11a.txt │ ├── s18a.txt │ ├── s19a.txt │ ├── s20a.txt │ ├── s23a.txt │ ├── c05.txt │ ├── m03.txt │ ├── b01.txt │ ├── b02.txt │ ├── b03.txt │ ├── b05.txt │ ├── b10.txt │ ├── b11.txt │ ├── b19.txt │ ├── b21.txt │ ├── c01.txt │ ├── c02.txt │ ├── c03.txt │ ├── c17.txt │ ├── d01.txt │ ├── m01.txt │ ├── m04.txt │ ├── n05.txt │ ├── r00.txt │ ├── r01.txt │ ├── s00.txt │ ├── s02.txt │ ├── s03.txt │ ├── s04.txt │ ├── s06.txt │ ├── s09.txt │ ├── s10.txt │ ├── s12.txt │ ├── s18.txt │ ├── s22.txt │ ├── s25.txt │ ├── s30.txt │ ├── b04.txt │ ├── b06.txt │ ├── b07.txt │ ├── b08.txt │ ├── b09.txt │ ├── b12.txt │ ├── b13.txt │ ├── b17.txt │ ├── b18.txt │ ├── b20.txt │ ├── b23.txt │ ├── c04.txt │ ├── c07.txt │ ├── c08.txt │ ├── c09.txt │ ├── c10.txt │ ├── c11.txt │ ├── c12.txt │ ├── c13.txt │ ├── c14.txt │ ├── c15.txt │ ├── c16.txt │ ├── c18.txt │ ├── c19.txt │ ├── e01.txt │ ├── e03.txt │ ├── e04.txt │ ├── e05.txt │ ├── f01.txt │ ├── f04.txt │ ├── f05.txt │ ├── f06.txt │ ├── f11.txt │ ├── l00.txt │ ├── l07.txt │ ├── m02.txt │ ├── n01.txt │ ├── n06.txt │ ├── n13.txt │ ├── s01.txt │ ├── s05.txt │ ├── s07.txt │ ├── s08.txt │ ├── s11.txt │ ├── s21.txt │ ├── s23.txt │ ├── s24.txt │ ├── s26.txt │ ├── s27.txt │ ├── s28.txt │ ├── s36.txt │ ├── s42.txt │ ├── s44.txt │ ├── s50.txt │ ├── b22.txt │ ├── b24.txt │ ├── b25.txt │ ├── c06.txt │ ├── c20.txt │ ├── c21.txt │ ├── c22.txt │ ├── e02.txt │ ├── e06.txt │ ├── f02.txt │ ├── f03.txt │ ├── f08.txt │ ├── f09.txt │ ├── f10.txt │ ├── l01.txt │ ├── l02.txt │ ├── l06.txt │ ├── n02.txt │ ├── n03.txt │ ├── n04.txt │ ├── n09.txt │ ├── n10.txt │ ├── s13.txt │ ├── s14.txt │ ├── s16.txt │ ├── s20.txt │ ├── s29.txt │ ├── s31.txt │ ├── s33.txt │ ├── s34.txt │ ├── s35.txt │ ├── s38.txt │ ├── s40.txt │ ├── s41.txt │ ├── s46.txt │ ├── b15.txt │ ├── b26.txt │ ├── b27.txt │ ├── l03.txt │ ├── l04.txt │ ├── l05.txt │ ├── m05.txt │ ├── n07.txt │ ├── n08.txt │ ├── n11.txt │ ├── n12.txt │ ├── n14.txt │ ├── r02.txt │ ├── r03.txt │ ├── s15.txt │ ├── s17.txt │ ├── s19.txt │ ├── s32.txt │ ├── s37.txt │ ├── s45.txt │ ├── s47.txt │ ├── b14.txt │ ├── b16.txt │ ├── m06.txt │ ├── r04.txt │ ├── s43.txt │ ├── s48.txt │ ├── s49.txt │ ├── f07.txt │ ├── s39.txt │ ├── b00.txt │ ├── r04a.txt │ ├── s00a.txt │ ├── s29a.txt │ ├── s12a.txt │ ├── d01a.txt │ ├── f03a.txt │ ├── s05a.txt │ ├── s07a.txt │ ├── s08a.txt │ ├── s09a.txt │ ├── s09b.txt │ ├── s11a.txt │ ├── s27a.txt │ ├── s32a.txt │ ├── s34a.txt │ ├── s35a.txt │ ├── s36a.txt │ ├── s36b.txt │ ├── s39a.txt │ ├── s40a.txt │ ├── f07a.txt │ ├── s37a.txt │ ├── s44a.txt │ ├── e01a.txt │ ├── e02a.txt │ ├── e03a.txt │ ├── e04a.txt │ ├── e06a.txt │ ├── f02a.txt │ ├── s06a.txt │ ├── s43a.txt │ ├── s31a.txt │ ├── s01a.txt │ ├── s02a.txt │ ├── s25a.txt │ ├── s26a.txt │ ├── s30a.txt │ ├── s33a.txt │ ├── s33b.txt │ ├── s33c.txt │ ├── s50a.txt │ ├── s03a.txt │ ├── s48a.txt │ ├── s48b.txt │ ├── l05a.txt │ ├── s22a.txt │ ├── f08a.txt │ ├── r02a.txt │ ├── s14a.txt │ ├── s16a.txt │ ├── s17a.txt │ ├── s15a.txt │ ├── r03a.txt │ ├── s45a.txt │ ├── f01a.txt │ ├── f04a.txt │ ├── s38a.txt │ ├── f05a.txt │ ├── s28a.txt │ ├── s49a.txt │ ├── s41a.txt │ ├── m04a.txt │ ├── n14a.txt │ ├── s21a.txt │ ├── s46a.txt │ ├── s13a.txt │ ├── r01a.txt │ ├── f09a.txt │ ├── f10a.txt │ ├── s04a.txt │ ├── s10a.txt │ ├── s10b.txt │ ├── reversed.txt │ ├── s10c.txt │ ├── d01b.txt │ ├── m02a.txt │ ├── s24a.txt │ ├── l00a.txt │ ├── m03a.txt │ └── m07.txt └── tdiffer.cpp ├── win ├── msvc70 │ ├── tests │ │ └── !keepme.txt │ ├── reversed │ └── mkdist.vcproj ├── msvc60 │ ├── reversed │ └── mkdist.dsp └── config.h ├── doc ├── e4s.gif ├── tcl.gif ├── metakit.png ├── python.jpg └── api │ ├── c4_Row.html │ ├── c4_Bytes.html │ ├── c4_View.html │ ├── c4_Cursor.html │ ├── c4_IntRef.html │ ├── c4_RowRef.html │ ├── c4_Stream.html │ ├── c4_IntProp.html │ ├── c4_MemoRef.html │ ├── c4_Storage.html │ ├── c4_ViewRef.html │ ├── c4_BytesRef.html │ ├── c4_FloatRef.html │ ├── c4_MemoProp.html │ ├── c4_Property.html │ ├── c4_Sequence.html │ ├── c4_Strategy.html │ ├── c4_ViewProp.html │ ├── c4_BytesProp.html │ ├── c4_DoubleProp.html │ ├── c4_DoubleRef.html │ ├── c4_FloatProp.html │ ├── c4_Reference.html │ ├── c4_StringProp.html │ ├── c4_StringRef.html │ ├── c4_CustomViewer.html │ ├── c4_Bytes___NONAME.html │ ├── index.html │ ├── c4_Bytes___NONAME_info.html │ ├── c4_Stream_info.html │ ├── c4_Bytes___NONAME_desc.html │ ├── doc_mkoptim.html │ ├── doc_dbf2mk.html │ ├── c4_Stream_desc.html │ ├── doc_demo.html │ ├── c4_IntRef_desc.html │ ├── c4_StringRef_desc.html │ ├── c4_FloatRef_desc.html │ ├── c4_DoubleRef_desc.html │ ├── c4_ViewRef_desc.html │ ├── doc_myio.html │ ├── c4_BytesRef_desc.html │ ├── navbar.html │ ├── c4_RowRef_info.html │ ├── c4_CustomViewer_desc.html │ ├── c4_CustomViewer_info.html │ ├── doc_struct.html │ ├── c4_MemoRef_desc.html │ └── doc_dump.html ├── unix ├── reversed ├── README ├── Doxytail.html ├── cpprt0_stubs.s ├── config.h.in └── metakit.spec ├── tcl ├── tests │ ├── all.tcl │ ├── limit.test │ └── initests.tcl ├── pkgIndex.tcl.in ├── aclocal.m4 ├── tequila │ └── proxy.tcl ├── tclconfig │ ├── README.txt │ └── install-sh ├── stubtcl.h ├── configure.in └── config.h.in ├── src ├── gnuc.h ├── store.inl ├── format.h ├── win.h ├── mwcw.h ├── derived.h ├── field.inl ├── mfc.h ├── remap.h ├── borc.h ├── doxy.h ├── msvc.h ├── std.h ├── handler.inl ├── field.h ├── custom.h ├── column.inl ├── std.cpp └── univ.h ├── examples ├── pair.py ├── remap.py ├── derived.py ├── mkbug.cpp ├── bigblock.tcl ├── wrap.py ├── selfref.py ├── case.py ├── demo.py ├── demold.tcl ├── README ├── demo.tcl ├── sort.tcl ├── blockdels.tcl └── selmap.tcl ├── demos ├── struct.cpp └── bigdemo.cpp ├── license.terms └── include └── mk4io.h /python/.cvsignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /python/test/.cvsignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /tests/ok/e05a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/f11a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/s18a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/s19a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/s20a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/s23a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = 2 | -------------------------------------------------------------------------------- /tests/ok/c05.txt: -------------------------------------------------------------------------------- 1 | >>> Remapping 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m03.txt: -------------------------------------------------------------------------------- 1 | >>> Hash adds 2 | <<< done. 3 | -------------------------------------------------------------------------------- /win/msvc70/tests/!keepme.txt: -------------------------------------------------------------------------------- 1 | placeholder 2 | -------------------------------------------------------------------------------- /tests/ok/b01.txt: -------------------------------------------------------------------------------- 1 | >>> Should succeed 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b02.txt: -------------------------------------------------------------------------------- 1 | >>> Int property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b03.txt: -------------------------------------------------------------------------------- 1 | >>> Float property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b05.txt: -------------------------------------------------------------------------------- 1 | >>> View property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b10.txt: -------------------------------------------------------------------------------- 1 | >>> View sorting 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b11.txt: -------------------------------------------------------------------------------- 1 | >>> View selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b19.txt: -------------------------------------------------------------------------------- 1 | >>> Bytes property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b21.txt: -------------------------------------------------------------------------------- 1 | >>> Memo property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c01.txt: -------------------------------------------------------------------------------- 1 | >>> Slice forward 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c02.txt: -------------------------------------------------------------------------------- 1 | >>> Slice backward 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c03.txt: -------------------------------------------------------------------------------- 1 | >>> Slice reverse 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c17.txt: -------------------------------------------------------------------------------- 1 | >>> Join operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/d01.txt: -------------------------------------------------------------------------------- 1 | >>> Commit aside 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m01.txt: -------------------------------------------------------------------------------- 1 | >>> Hash mapping 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m04.txt: -------------------------------------------------------------------------------- 1 | >>> Locate bug 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n05.txt: -------------------------------------------------------------------------------- 1 | >>> Add to sorted 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/r00.txt: -------------------------------------------------------------------------------- 1 | >>> Simple insert 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/r01.txt: -------------------------------------------------------------------------------- 1 | >>> Simple removes 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s00.txt: -------------------------------------------------------------------------------- 1 | >>> Simple storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s02.txt: -------------------------------------------------------------------------------- 1 | >>> Float storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s03.txt: -------------------------------------------------------------------------------- 1 | >>> String storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s04.txt: -------------------------------------------------------------------------------- 1 | >>> View storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s06.txt: -------------------------------------------------------------------------------- 1 | >>> Commit twice 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s09.txt: -------------------------------------------------------------------------------- 1 | >>> Copy storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s10.txt: -------------------------------------------------------------------------------- 1 | >>> Stream storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s12.txt: -------------------------------------------------------------------------------- 1 | >>> Remove subview 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s18.txt: -------------------------------------------------------------------------------- 1 | >>> Empty storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s22.txt: -------------------------------------------------------------------------------- 1 | >>> Double storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s25.txt: -------------------------------------------------------------------------------- 1 | >>> Bytes storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s30.txt: -------------------------------------------------------------------------------- 1 | >>> Memo storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b04.txt: -------------------------------------------------------------------------------- 1 | >>> String property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b06.txt: -------------------------------------------------------------------------------- 1 | >>> View construction 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b07.txt: -------------------------------------------------------------------------------- 1 | >>> Row manipulation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b08.txt: -------------------------------------------------------------------------------- 1 | >>> Row expressions 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b09.txt: -------------------------------------------------------------------------------- 1 | >>> View manipulation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b12.txt: -------------------------------------------------------------------------------- 1 | >>> Add after remove 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b13.txt: -------------------------------------------------------------------------------- 1 | >>> Clear view entry 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b17.txt: -------------------------------------------------------------------------------- 1 | >>> Double property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b18.txt: -------------------------------------------------------------------------------- 1 | >>> SetAtGrow usage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b20.txt: -------------------------------------------------------------------------------- 1 | >>> Search sorted view 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b23.txt: -------------------------------------------------------------------------------- 1 | >>> Sort comparison fix 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c04.txt: -------------------------------------------------------------------------------- 1 | >>> Cartesian product 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c07.txt: -------------------------------------------------------------------------------- 1 | >>> Concatenate views 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c08.txt: -------------------------------------------------------------------------------- 1 | >>> Rename property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c09.txt: -------------------------------------------------------------------------------- 1 | >>> GroupBy operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c10.txt: -------------------------------------------------------------------------------- 1 | >>> Counts operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c11.txt: -------------------------------------------------------------------------------- 1 | >>> Unique operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c12.txt: -------------------------------------------------------------------------------- 1 | >>> Union operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c13.txt: -------------------------------------------------------------------------------- 1 | >>> Intersect operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c14.txt: -------------------------------------------------------------------------------- 1 | >>> Different operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c15.txt: -------------------------------------------------------------------------------- 1 | >>> Minus operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c16.txt: -------------------------------------------------------------------------------- 1 | >>> View comparisons 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c18.txt: -------------------------------------------------------------------------------- 1 | >>> Groupby sort fix 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c19.txt: -------------------------------------------------------------------------------- 1 | >>> JoinProp operation 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e01.txt: -------------------------------------------------------------------------------- 1 | >>> Extend new file 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e03.txt: -------------------------------------------------------------------------------- 1 | >>> Read during extend 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e04.txt: -------------------------------------------------------------------------------- 1 | >>> Extend during read 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e05.txt: -------------------------------------------------------------------------------- 1 | >>> Test memory mapping 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f01.txt: -------------------------------------------------------------------------------- 1 | >>> Add view to format 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f04.txt: -------------------------------------------------------------------------------- 1 | >>> Rearrange format 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f05.txt: -------------------------------------------------------------------------------- 1 | >>> Nested reformat 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f06.txt: -------------------------------------------------------------------------------- 1 | >>> Flip foreign data 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f11.txt: -------------------------------------------------------------------------------- 1 | >>> Delete missing view 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l00.txt: -------------------------------------------------------------------------------- 1 | >>> Lots of properties 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l07.txt: -------------------------------------------------------------------------------- 1 | >>> Huge description 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m02.txt: -------------------------------------------------------------------------------- 1 | >>> Blocked view bug 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n01.txt: -------------------------------------------------------------------------------- 1 | >>> Add to selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n06.txt: -------------------------------------------------------------------------------- 1 | >>> Remove from sorted 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n13.txt: -------------------------------------------------------------------------------- 1 | >>> Project without 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s01.txt: -------------------------------------------------------------------------------- 1 | >>> Integer storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s05.txt: -------------------------------------------------------------------------------- 1 | >>> Store and reload 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s07.txt: -------------------------------------------------------------------------------- 1 | >>> Commit modified 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s08.txt: -------------------------------------------------------------------------------- 1 | >>> View after storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s11.txt: -------------------------------------------------------------------------------- 1 | >>> Commit and rollback 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s21.txt: -------------------------------------------------------------------------------- 1 | >>> Test demo scenario 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s23.txt: -------------------------------------------------------------------------------- 1 | >>> Find absent record 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s24.txt: -------------------------------------------------------------------------------- 1 | >>> Bitwise storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s26.txt: -------------------------------------------------------------------------------- 1 | >>> Bitwise autosizing 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s27.txt: -------------------------------------------------------------------------------- 1 | >>> Bytes restructuring 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s28.txt: -------------------------------------------------------------------------------- 1 | >>> Doubles added later 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s36.txt: -------------------------------------------------------------------------------- 1 | >>> Commit after load 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s42.txt: -------------------------------------------------------------------------------- 1 | >>> Get descriptions 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s44.txt: -------------------------------------------------------------------------------- 1 | >>> Bad memo free space 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s50.txt: -------------------------------------------------------------------------------- 1 | >>> Free space usage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b22.txt: -------------------------------------------------------------------------------- 1 | >>> Stored view references 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b24.txt: -------------------------------------------------------------------------------- 1 | >>> Custom view comparisons 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b25.txt: -------------------------------------------------------------------------------- 1 | >>> Copy row from derived 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c06.txt: -------------------------------------------------------------------------------- 1 | >>> Pairwise combination 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c20.txt: -------------------------------------------------------------------------------- 1 | >>> Wide cartesian product 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c21.txt: -------------------------------------------------------------------------------- 1 | >>> Join on compound key 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/c22.txt: -------------------------------------------------------------------------------- 1 | >>> Groupby with selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e02.txt: -------------------------------------------------------------------------------- 1 | >>> Extend committing twice 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/e06.txt: -------------------------------------------------------------------------------- 1 | >>> Rollback during extend 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f02.txt: -------------------------------------------------------------------------------- 1 | >>> Remove view from format 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f03.txt: -------------------------------------------------------------------------------- 1 | >>> Rollback format change 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f08.txt: -------------------------------------------------------------------------------- 1 | >>> Automatic storage format 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f09.txt: -------------------------------------------------------------------------------- 1 | >>> Partial restructuring 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/f10.txt: -------------------------------------------------------------------------------- 1 | >>> Committed restructuring 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l01.txt: -------------------------------------------------------------------------------- 1 | >>> Over 32 Kb of integers 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l02.txt: -------------------------------------------------------------------------------- 1 | >>> Over 64 Kb of strings 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l06.txt: -------------------------------------------------------------------------------- 1 | >>> Bit field manipulations 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n02.txt: -------------------------------------------------------------------------------- 1 | >>> Remove from selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n03.txt: -------------------------------------------------------------------------------- 1 | >>> Modify into selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n04.txt: -------------------------------------------------------------------------------- 1 | >>> Modify out of selection 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n09.txt: -------------------------------------------------------------------------------- 1 | >>> Multiple dependencies 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n10.txt: -------------------------------------------------------------------------------- 1 | >>> Modify sorted duplicates 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s13.txt: -------------------------------------------------------------------------------- 1 | >>> Remove middle subview 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s14.txt: -------------------------------------------------------------------------------- 1 | >>> Replace attached subview 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s16.txt: -------------------------------------------------------------------------------- 1 | >>> Add after removed ints 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s20.txt: -------------------------------------------------------------------------------- 1 | >>> View outlives storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s29.txt: -------------------------------------------------------------------------------- 1 | >>> Delete bytes property 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s31.txt: -------------------------------------------------------------------------------- 1 | >>> Check sort buffer use 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s33.txt: -------------------------------------------------------------------------------- 1 | >>> Serialize memo fields 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s34.txt: -------------------------------------------------------------------------------- 1 | >>> Smart and failed commits 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s35.txt: -------------------------------------------------------------------------------- 1 | >>> Datafile with preamble 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s38.txt: -------------------------------------------------------------------------------- 1 | >>> Lots of empty subviews 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s40.txt: -------------------------------------------------------------------------------- 1 | >>> LoadFrom after commit 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s41.txt: -------------------------------------------------------------------------------- 1 | >>> Partial modify blocked 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s46.txt: -------------------------------------------------------------------------------- 1 | >>> LoadFrom after commit 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b15.txt: -------------------------------------------------------------------------------- 1 | >>> View outlives temp storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b26.txt: -------------------------------------------------------------------------------- 1 | >>> Partial memo field access 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b27.txt: -------------------------------------------------------------------------------- 1 | >>> Copy value to another row 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l03.txt: -------------------------------------------------------------------------------- 1 | >>> Force sections in storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l04.txt: -------------------------------------------------------------------------------- 1 | >>> Modify sections in storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/l05.txt: -------------------------------------------------------------------------------- 1 | >>> Delete from 32 Kb of strings 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m05.txt: -------------------------------------------------------------------------------- 1 | >>> Blocked view with subviews 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n07.txt: -------------------------------------------------------------------------------- 1 | >>> New property through sort 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n08.txt: -------------------------------------------------------------------------------- 1 | >>> Nested project and select 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n11.txt: -------------------------------------------------------------------------------- 1 | >>> Resize compound derived view 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n12.txt: -------------------------------------------------------------------------------- 1 | >>> Alter multiply derived view 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/n14.txt: -------------------------------------------------------------------------------- 1 | >>> Insert in non-mapped position 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/r02.txt: -------------------------------------------------------------------------------- 1 | >>> Large inserts and removes 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/r03.txt: -------------------------------------------------------------------------------- 1 | >>> Binary property insertions 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s15.txt: -------------------------------------------------------------------------------- 1 | >>> Add after removed subviews 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s17.txt: -------------------------------------------------------------------------------- 1 | >>> Add after removed strings 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s19.txt: -------------------------------------------------------------------------------- 1 | >>> Empty view outlives storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s32.txt: -------------------------------------------------------------------------------- 1 | >>> Set memo empty or same size 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s37.txt: -------------------------------------------------------------------------------- 1 | >>> Change short partial fields 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s45.txt: -------------------------------------------------------------------------------- 1 | >>> Bad subview memo free space 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s47.txt: -------------------------------------------------------------------------------- 1 | >>> Defining bad property type 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b14.txt: -------------------------------------------------------------------------------- 1 | >>> Empty view outlives temp storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/b16.txt: -------------------------------------------------------------------------------- 1 | >>> View outlives cleared temp storage 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/m06.txt: -------------------------------------------------------------------------------- 1 | >>> Blocked view multi-row deletion 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/r04.txt: -------------------------------------------------------------------------------- 1 | >>> Scripted string property tests 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s43.txt: -------------------------------------------------------------------------------- 1 | >>> View reuse after sub-byte ints 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s48.txt: -------------------------------------------------------------------------------- 1 | >>> Resize subview to zero and back 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s49.txt: -------------------------------------------------------------------------------- 1 | >>> Specify conflicting properties 2 | <<< done. 3 | -------------------------------------------------------------------------------- /doc/e4s.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/doc/e4s.gif -------------------------------------------------------------------------------- /doc/tcl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/doc/tcl.gif -------------------------------------------------------------------------------- /tests/ok/f07.txt: -------------------------------------------------------------------------------- 1 | >>> Automatic structure info (obsolete) 2 | <<< done. 3 | -------------------------------------------------------------------------------- /tests/ok/s39.txt: -------------------------------------------------------------------------------- 1 | >>> Do not detach empty top-level views 2 | <<< done. 3 | -------------------------------------------------------------------------------- /doc/metakit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/doc/metakit.png -------------------------------------------------------------------------------- /doc/python.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/doc/python.jpg -------------------------------------------------------------------------------- /tests/ok/b00.txt: -------------------------------------------------------------------------------- 1 | >>> Should fail 2 | *** Failed: A(false) *** 3 | <<< done. 4 | -------------------------------------------------------------------------------- /unix/reversed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/unix/reversed -------------------------------------------------------------------------------- /win/msvc60/reversed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/win/msvc60/reversed -------------------------------------------------------------------------------- /win/msvc70/reversed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jnorthrup/metakit/HEAD/win/msvc70/reversed -------------------------------------------------------------------------------- /tests/ok/r04a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 0 rows = p1:S 4 | -------------------------------------------------------------------------------- /tests/ok/s00a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 0 rows = p1:I 4 | -------------------------------------------------------------------------------- /tests/ok/s29a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 0 rows = p1:B 4 | -------------------------------------------------------------------------------- /tests/ok/s12a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 0 rows = p1:I p2:V 4 | -------------------------------------------------------------------------------- /tests/ok/d01a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/f03a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s05a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s07a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 234 5 | -------------------------------------------------------------------------------- /tests/ok/s08a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s09a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s09b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s11a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s27a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:B 4 | 0: (4b) 5 | -------------------------------------------------------------------------------- /tests/ok/s32a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:B 4 | 0: (4b) 5 | -------------------------------------------------------------------------------- /tests/ok/s34a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 111 5 | -------------------------------------------------------------------------------- /tests/ok/s35a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 111 5 | -------------------------------------------------------------------------------- /tests/ok/s36a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 111 5 | -------------------------------------------------------------------------------- /tests/ok/s36b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 111 5 | -------------------------------------------------------------------------------- /tests/ok/s39a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | -------------------------------------------------------------------------------- /tests/ok/s40a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 456 5 | -------------------------------------------------------------------------------- /tests/ok/f07a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = dict:V 2 | 0: subview 'dict' 3 | VIEW 0 rows = parent:I index:I view:V 4 | -------------------------------------------------------------------------------- /tests/ok/s37a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 1 rows = key:I p1:B 4 | 0: 0 (6b) 5 | -------------------------------------------------------------------------------- /tests/ok/s44a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:B 4 | 0: 0 (12345b) 5 | -------------------------------------------------------------------------------- /tests/ok/e01a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 456 6 | -------------------------------------------------------------------------------- /tests/ok/e02a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 456 6 | -------------------------------------------------------------------------------- /tests/ok/e03a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 456 6 | -------------------------------------------------------------------------------- /tests/ok/e04a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 123 6 | -------------------------------------------------------------------------------- /tests/ok/e06a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 456 6 | -------------------------------------------------------------------------------- /tests/ok/f02a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = b:V 2 | 0: subview 'b' 3 | VIEW 2 rows = p2:I 4 | 0: 345 5 | 1: 567 6 | -------------------------------------------------------------------------------- /tests/ok/s06a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 123 5 | 1: 234 6 | -------------------------------------------------------------------------------- /tests/ok/s43a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I 4 | 0: 0 5 | 1: 12345 6 | -------------------------------------------------------------------------------- /tcl/tests/all.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env tclsh 2 | 3 | source [file join [file dir [info script]] initests.tcl] 4 | 5 | runAllTests 6 | 7 | -------------------------------------------------------------------------------- /tests/ok/s31a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:I 4 | 0: 3 5 | 1: 1 6 | 2: 2 7 | -------------------------------------------------------------------------------- /tests/ok/s01a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:I 4 | 0: 123 5 | 1: 789 6 | 2: 456 7 | -------------------------------------------------------------------------------- /tests/ok/s02a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:F 4 | 0: 12.3 5 | 1: 78.9 6 | 2: 45.6 7 | -------------------------------------------------------------------------------- /tests/ok/s25a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:B 4 | 0: (2b) 5 | 1: (4b) 6 | 2: (5b) 7 | -------------------------------------------------------------------------------- /tests/ok/s26a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:I p3:I p4:I 4 | 0: 100000 100000 100000 100000 5 | -------------------------------------------------------------------------------- /tests/ok/s30a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:B 4 | 0: (2b) 5 | 1: (4b) 6 | 2: (5b) 7 | -------------------------------------------------------------------------------- /tests/ok/s33a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:B 4 | 0: (2b) 5 | 1: (4b) 6 | 2: (5b) 7 | -------------------------------------------------------------------------------- /tests/ok/s33b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:B 4 | 0: (2b) 5 | 1: (4b) 6 | 2: (5b) 7 | -------------------------------------------------------------------------------- /tests/ok/s33c.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:B 4 | 0: (2b) 5 | 1: (4b) 6 | 2: (5b) 7 | -------------------------------------------------------------------------------- /tests/ok/s50a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:I 4 | 0: 12345 5 | 1: 2345 6 | 2: 345 7 | -------------------------------------------------------------------------------- /tests/ok/s03a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:S 4 | 0: 'one' 5 | 1: 'three' 6 | 2: 'two' 7 | -------------------------------------------------------------------------------- /tests/ok/s48a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 1 rows = v2:V 4 | 0: subview 'v2' 5 | VIEW 0 rows = p1:I 6 | -------------------------------------------------------------------------------- /tests/ok/s48b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 1 rows = v2:V 4 | 0: subview 'v2' 5 | VIEW 0 rows = p1:I 6 | -------------------------------------------------------------------------------- /tests/ok/l05a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:S p3:S 4 | 0: 1747 'The wizard of Oz' 'The wizard of Oz' 5 | -------------------------------------------------------------------------------- /tests/ok/s22a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:D 4 | 0: 1234.5678 5 | 1: 3456.789 6 | 2: 2345.6789 7 | -------------------------------------------------------------------------------- /tests/ok/f08a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = dict:V 2 | 0: subview 'dict' 3 | VIEW 3 rows = p1:S p2:S 4 | 0: 'One' 'Two' 5 | 1: '' '' 6 | 2: 'One' 'Two' 7 | -------------------------------------------------------------------------------- /tests/ok/r02a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 5 rows = p1:I 4 | 0: 37 5 | 1: 38 6 | 2: 39 7 | 3: 95 8 | 4: 96 9 | -------------------------------------------------------------------------------- /tests/ok/s14a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:V 4 | 0: 0 5 | 0: subview 'p2' 6 | VIEW 0 rows = p3:I 7 | -------------------------------------------------------------------------------- /tests/ok/s16a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:V 4 | 0: 4 5 | 0: subview 'p2' 6 | VIEW 0 rows = p3:I 7 | -------------------------------------------------------------------------------- /tcl/pkgIndex.tcl.in: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \ 5 | [list load [file join $dir @PKG_LIB_FILE@] @PACKAGE_NAME@] 6 | -------------------------------------------------------------------------------- /tests/ok/s17a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:S p2:V 4 | 0: 'four' 5 | 0: subview 'p2' 6 | VIEW 0 rows = p3:I 7 | -------------------------------------------------------------------------------- /tests/ok/s15a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:V 4 | 0: 111 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 234 8 | -------------------------------------------------------------------------------- /tests/ok/r03a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 5 rows = p1:B 4 | 0: (1024b) 5 | 1: (256b) 6 | 2: (1024b) 7 | 3: (1024b) 8 | 4: (341b) 9 | -------------------------------------------------------------------------------- /tests/ok/s45a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:V 4 | 0: 0 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:B 7 | 0: (12345b) 8 | -------------------------------------------------------------------------------- /tcl/aclocal.m4: -------------------------------------------------------------------------------- 1 | # 2 | # Include the TEA standard macro set 3 | # 4 | 5 | builtin(include,tclconfig/tcl.m4) 6 | 7 | # 8 | # Add here whatever m4 macros you want to define for your package 9 | # 10 | -------------------------------------------------------------------------------- /tests/ok/f01a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V b:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | 0: subview 'b' 6 | VIEW 2 rows = p2:I 7 | 0: 345 8 | 1: 567 9 | -------------------------------------------------------------------------------- /tests/ok/f04a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = b:V a:V 2 | 0: subview 'b' 3 | VIEW 2 rows = p2:I 4 | 0: 345 5 | 1: 567 6 | 0: subview 'a' 7 | VIEW 1 rows = p1:I 8 | 0: 123 9 | -------------------------------------------------------------------------------- /tests/ok/s38a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v:V 2 | 0: subview 'v' 3 | VIEW 2 rows = v1:V 4 | 0: subview 'v1' 5 | VIEW 0 rows = p1:S 6 | 1: subview 'v1' 7 | VIEW 0 rows = p1:S 8 | -------------------------------------------------------------------------------- /tests/ok/f05a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V b:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I 4 | 0: 123 5 | 0: subview 'b' 6 | VIEW 2 rows = p1:I p2:I 7 | 0: 543 345 8 | 1: 765 567 9 | -------------------------------------------------------------------------------- /tests/ok/s28a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:F p2:D p3:V 4 | 0: 123 123 5 | 0: subview 'p3' 6 | VIEW 1 rows = p1:F p2:D 7 | 0: 234 234 8 | -------------------------------------------------------------------------------- /tests/ok/s49a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V v2:V v3:V 2 | 0: subview 'v1' 3 | VIEW 0 rows = p1:I 4 | 0: subview 'v2' 5 | VIEW 0 rows = p1:I 6 | 0: subview 'v3' 7 | VIEW 0 rows = v3:V 8 | -------------------------------------------------------------------------------- /doc/api/c4_Row.html: -------------------------------------------------------------------------------- 1 | class c4_Row 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Bytes.html: -------------------------------------------------------------------------------- 1 | class c4_Bytes 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_View.html: -------------------------------------------------------------------------------- 1 | class c4_View 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Cursor.html: -------------------------------------------------------------------------------- 1 | class c4_Cursor 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_IntRef.html: -------------------------------------------------------------------------------- 1 | class c4_IntRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_RowRef.html: -------------------------------------------------------------------------------- 1 | class c4_RowRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Stream.html: -------------------------------------------------------------------------------- 1 | class c4_Stream 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/ok/s41a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = _B:V 4 | 0: subview '_B' 5 | VIEW 1 rows = p1:B 6 | 0: (8b) 7 | 1: subview '_B' 8 | VIEW 0 rows = p1:B 9 | -------------------------------------------------------------------------------- /doc/api/c4_IntProp.html: -------------------------------------------------------------------------------- 1 | class c4_IntProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_MemoRef.html: -------------------------------------------------------------------------------- 1 | class c4_MemoRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Storage.html: -------------------------------------------------------------------------------- 1 | class c4_Storage 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_ViewRef.html: -------------------------------------------------------------------------------- 1 | class c4_ViewRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_BytesRef.html: -------------------------------------------------------------------------------- 1 | class c4_BytesRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_FloatRef.html: -------------------------------------------------------------------------------- 1 | class c4_FloatRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_MemoProp.html: -------------------------------------------------------------------------------- 1 | class c4_MemoProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Property.html: -------------------------------------------------------------------------------- 1 | class c4_Property 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Sequence.html: -------------------------------------------------------------------------------- 1 | class c4_Sequence 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Strategy.html: -------------------------------------------------------------------------------- 1 | class c4_Strategy 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_ViewProp.html: -------------------------------------------------------------------------------- 1 | class c4_ViewProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_BytesProp.html: -------------------------------------------------------------------------------- 1 | class c4_BytesProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_DoubleProp.html: -------------------------------------------------------------------------------- 1 | class c4_DoubleProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_DoubleRef.html: -------------------------------------------------------------------------------- 1 | class c4_DoubleRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_FloatProp.html: -------------------------------------------------------------------------------- 1 | class c4_FloatProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Reference.html: -------------------------------------------------------------------------------- 1 | class c4_Reference 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_StringProp.html: -------------------------------------------------------------------------------- 1 | class c4_StringProp 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_StringRef.html: -------------------------------------------------------------------------------- 1 | class c4_StringRef 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/ok/m04a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 6 rows = p1:I p2:S 4 | 0: 1 'one' 5 | 1: 2 'two' 6 | 2: 3 'three' 7 | 3: 4 'four' 8 | 4: 5 'five' 9 | 5: 6 'six' 10 | -------------------------------------------------------------------------------- /unix/README: -------------------------------------------------------------------------------- 1 | To keep the unix/ directory as is, please build Metakit using: 2 | 3 | cd ../builds 4 | ../unix/configure 5 | make 6 | make test 7 | make install 8 | 9 | Further documentation and install notes are in "../README". 10 | -------------------------------------------------------------------------------- /doc/api/c4_CustomViewer.html: -------------------------------------------------------------------------------- 1 | class c4_CustomViewer 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/c4_Bytes___NONAME.html: -------------------------------------------------------------------------------- 1 | class c4_Bytes::NONAME 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /doc/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | The Metakit class library for persistent structured data 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /unix/Doxytail.html: -------------------------------------------------------------------------------- 1 |

2 |
3 | Metakit C++ API Reference - 4 | http://www.equi4.com/metakit.html 5 | - extracted with 6 | Doxygen 7 |
8 | 9 | -------------------------------------------------------------------------------- /tests/ok/n14a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 12 rows = p1:I 4 | 0: 0 5 | 1: 1 6 | 2: 2 7 | 3: 6 8 | 4: 0 9 | 5: 1 10 | 6: 2 11 | 7: 1 12 | 8: 0 13 | 9: 1 14 | 10: 2 15 | 11: 0 16 | -------------------------------------------------------------------------------- /src/gnuc.h: -------------------------------------------------------------------------------- 1 | // gnuc.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for GNU C++ 7 | */ 8 | 9 | #define q4_GNUC 1 10 | 11 | #if !defined (q4_BOOL) 12 | #define q4_BOOL 1 13 | #endif 14 | -------------------------------------------------------------------------------- /tests/ok/s21a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V b:V 2 | 0: subview 'a' 3 | VIEW 4 rows = p1:S p2:S p3:I 4 | 0: 'One' 'Un' 0 5 | 1: 'Two' 'Deux' 123 6 | 2: 'Four' '' 0 7 | 3: 'Three' 'Trois' 0 8 | 0: subview 'b' 9 | VIEW 1 rows = p4:I 10 | 0: 234 11 | -------------------------------------------------------------------------------- /tests/ok/s46a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 12 rows = p1:I 4 | 0: 11 5 | 1: 22 6 | 2: 33 7 | 3: 44 8 | 4: 0 9 | 5: 55 10 | 6: 66 11 | 7: 77 12 | 8: 0 13 | 9: 88 14 | 10: 99 15 | 11: 1000 16 | -------------------------------------------------------------------------------- /win/config.h: -------------------------------------------------------------------------------- 1 | #if _MSC_VER >= 1000 2 | #define HAVE_MMAP 1 3 | #define HAVE_MEMMOVE 1 4 | #define HAVE_BCOPY 0 5 | #define SIZEOF_LONG 4 6 | #define LONG_LONG __int64 7 | #else 8 | #define HAVE_MMAP 0 9 | #define HAVE_MEMMOVE 1 10 | #define HAVE_BCOPY 0 11 | #define SIZEOF_LONG 4 12 | #endif 13 | -------------------------------------------------------------------------------- /tests/ok/s13a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 2 rows = p1:I p2:V 4 | 0: 123 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 234 8 | 1: 125 9 | 1: subview 'p2' 10 | VIEW 3 rows = p3:I 11 | 0: 456 12 | 1: 457 13 | 2: 458 14 | -------------------------------------------------------------------------------- /tests/ok/r01a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 15 rows = p1:I 4 | 0: 9 5 | 1: 10 6 | 2: 11 7 | 3: 12 8 | 4: 13 9 | 5: 14 10 | 6: 15 11 | 7: 16 12 | 8: 17 13 | 9: 18 14 | 10: 19 15 | 11: 20 16 | 12: 21 17 | 13: 22 18 | 14: 23 19 | -------------------------------------------------------------------------------- /tests/ok/f09a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 10 rows = p1:I p2:I p3:I 4 | 0: 1000 2000 3000 5 | 1: 1001 0 0 6 | 2: 1002 2002 0 7 | 3: 1003 0 3003 8 | 4: 1004 2004 0 9 | 5: 1005 0 0 10 | 6: 1006 2006 3006 11 | 7: 1007 0 0 12 | 8: 1008 2008 0 13 | 9: 1009 0 3009 14 | -------------------------------------------------------------------------------- /tests/ok/f10a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 10 rows = p1:I p2:I p3:I 4 | 0: 1000 2000 3000 5 | 1: 1001 0 0 6 | 2: 1002 2002 0 7 | 3: 1003 0 3003 8 | 4: 1004 2004 0 9 | 5: 1005 0 0 10 | 6: 1006 2006 3006 11 | 7: 1007 0 0 12 | 8: 1008 2008 0 13 | 9: 1009 0 3009 14 | -------------------------------------------------------------------------------- /tests/ok/s04a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:S p2:V 4 | 0: 'one' 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 1 8 | 1: 'three' 9 | 1: subview 'p2' 10 | VIEW 3 rows = p3:I 11 | 0: 111 12 | 1: 222 13 | 2: 333 14 | 2: 'two' 15 | 2: subview 'p2' 16 | VIEW 2 rows = p3:I 17 | 0: 11 18 | 1: 22 19 | -------------------------------------------------------------------------------- /tests/ok/s10a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:S p2:V 4 | 0: 'one' 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 1 8 | 1: 'three' 9 | 1: subview 'p2' 10 | VIEW 3 rows = p3:I 11 | 0: 111 12 | 1: 222 13 | 2: 333 14 | 2: 'two' 15 | 2: subview 'p2' 16 | VIEW 2 rows = p3:I 17 | 0: 11 18 | 1: 22 19 | -------------------------------------------------------------------------------- /tests/ok/s10b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 3 rows = p1:S p2:V 4 | 0: 'one' 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 1 8 | 1: 'three' 9 | 1: subview 'p2' 10 | VIEW 3 rows = p3:I 11 | 0: 111 12 | 1: 222 13 | 2: 333 14 | 2: 'two' 15 | 2: subview 'p2' 16 | VIEW 2 rows = p3:I 17 | 0: 11 18 | 1: 22 19 | -------------------------------------------------------------------------------- /unix/cpprt0_stubs.s: -------------------------------------------------------------------------------- 1 | 2 | .code 3 | ; stubs for static constructors in a.out 4 | .export __StaticCtorTable_Start,data 5 | .export __StaticCtorTable_End,data 6 | __StaticCtorTable_Start 7 | __StaticCtorTable_End 8 | 9 | .data 10 | ; stubs for static constructors in a.out, compiled with +z/+Z 11 | .export __ZStaticCtorTable_Start,data 12 | .export __ZStaticCtorTable_End,data 13 | __ZStaticCtorTable_Start 14 | __ZStaticCtorTable_End 15 | -------------------------------------------------------------------------------- /python/test/test_hash.py: -------------------------------------------------------------------------------- 1 | # test_hash.py -- Test Metakit Python bindings for hashed views 2 | # $Id$ 3 | # This is part of Metakit, see http://www.equi4.com/metakit/ 4 | 5 | from mktestsupport import * 6 | 7 | works = 't[z:I,pizza:S]', 'pizza' 8 | fails = 't[z:I,a:S]', 'a' 9 | 10 | for struc, field in (works, fails): 11 | v = HashedViewTester(struc, 1) 12 | for i in range(4): 13 | v.insert(1, 'A') 14 | for i in range(4): 15 | v.insert(**{field: 'A', 'z': 1}) 16 | v.finished() 17 | -------------------------------------------------------------------------------- /tests/ok/reversed.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = address:V info:V 2 | 0: subview 'address' 3 | VIEW 8 rows = name:S country:S age:I 4 | 0: 'John Williams' 'UK' 0 5 | 1: 'Paco Pena' 'Spain' 44 6 | 2: 'Julian Bream' '' 50 7 | 3: 'Julian Bream' '' 0 8 | 4: 'Julien Coco' 'Netherlands' 0 9 | 5: 'John Williams' 'UK' 0 10 | 6: 'Paco Pena' 'Spain' 0 11 | 7: 'Julien Coco' 'Netherlands' 0 12 | 0: subview 'info' 13 | VIEW 1 rows = version:I 14 | 0: 100 15 | -------------------------------------------------------------------------------- /examples/pair.py: -------------------------------------------------------------------------------- 1 | # Small demo of v1.pair(v2) 2 | # 3 | # Expected output: 4 | # s i 5 | # ----- - 6 | # zero 0 7 | # one 1 8 | # two 2 9 | # three 3 10 | # four 4 11 | # five 5 12 | # ----- - 13 | # Total: 6 rows 14 | 15 | import metakit 16 | 17 | db = metakit.storage() 18 | v1 = db.getas("one[s:S]") 19 | v2 = db.getas("two[i:I]") 20 | 21 | for v in ['zero','one','two','three','four','five']: 22 | v1.append(s=v) 23 | for v in range(6): 24 | v2.append(i=v) 25 | 26 | metakit.dump(v1.pair(v2)) 27 | -------------------------------------------------------------------------------- /tests/ok/s10c.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 4 rows = p1:S p2:V 4 | 0: 'one' 5 | 0: subview 'p2' 6 | VIEW 1 rows = p3:I 7 | 0: 1 8 | 1: 'three' 9 | 1: subview 'p2' 10 | VIEW 3 rows = p3:I 11 | 0: 111 12 | 1: 222 13 | 2: 333 14 | 2: 'two' 15 | 2: subview 'p2' 16 | VIEW 2 rows = p3:I 17 | 0: 11 18 | 1: 22 19 | 3: 'four' 20 | 3: subview 'p2' 21 | VIEW 0 rows = p3:I 22 | -------------------------------------------------------------------------------- /tests/ok/d01b.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = _C:V 2 | 0: subview '_C' 3 | VIEW 4 rows = _O:I _D:V 4 | 0: 8 5 | 0: subview '_D' 6 | VIEW 1 rows = _K:I _R:I _B:B 7 | 0: 0 0 (4b) 8 | 1: 0 9 | 1: subview '_D' 10 | VIEW 1 rows = _K:I _R:I _B:B 11 | 0: 0 0 (5b) 12 | 2: 0 13 | 2: subview '_D' 14 | VIEW 1 rows = _K:I _R:I _B:B 15 | 0: 0 0 (13b) 16 | 3: 0 17 | 3: subview '_D' 18 | VIEW 1 rows = _K:I _R:I _B:B 19 | 0: 0 0 (13b) 20 | -------------------------------------------------------------------------------- /examples/remap.py: -------------------------------------------------------------------------------- 1 | # Small demo of v1.remapwith(v2) 2 | # 3 | # Expected output: 4 | # s 5 | # ----- 6 | # one 7 | # three 8 | # five 9 | # two 10 | # four 11 | # one 12 | # three 13 | # five 14 | # ----- 15 | # Total: 8 rows 16 | 17 | import metakit 18 | 19 | db = metakit.storage() 20 | v1 = db.getas("counts[s:S]") 21 | v2 = db.getas("map[i:I]") 22 | 23 | for v in ['zero','one','two','three','four','five']: 24 | v1.append(s=v) 25 | for v in [1,3,5,2,4,1,3,5]: 26 | v2.append(i=v) 27 | 28 | metakit.dump(v1.remapwith(v2)) 29 | -------------------------------------------------------------------------------- /tcl/tequila/proxy.tcl: -------------------------------------------------------------------------------- 1 | # test the proxy interface to tequila 2 | # assume tequilas is running on localhost 3 | 4 | source tequila.tcl 5 | 6 | tequila::open localhost 20458 7 | 8 | tequila::proxy ;# this defines all mk::* procs as proxy calls 9 | # datafile 'tqs' is open and ready for use 10 | 11 | mk::view layout tqs.people {name country} 12 | 13 | mk::row append tqs.people name jc country nl 14 | mk::row append tqs.people name nb country gr 15 | 16 | foreach i [mk::select tqs.people -sort name] { 17 | puts [mk::get tqs.people!$i] 18 | } 19 | 20 | -------------------------------------------------------------------------------- /tests/ok/m02a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = v1:V 2 | 0: subview 'v1' 3 | VIEW 2 rows = _B:V 4 | 0: subview '_B' 5 | VIEW 15 rows = p1:B 6 | 0: (3490b) 7 | 1: (3491b) 8 | 2: (3492b) 9 | 3: (3493b) 10 | 4: (3494b) 11 | 5: (3495b) 12 | 6: (3496b) 13 | 7: (3497b) 14 | 8: (3498b) 15 | 9: (3499b) 16 | 10: (3500b) 17 | 11: (3501b) 18 | 12: (3502b) 19 | 13: (3503b) 20 | 14: (3504b) 21 | 1: subview '_B' 22 | VIEW 0 rows = p1:B 23 | -------------------------------------------------------------------------------- /python/PyHead.h: -------------------------------------------------------------------------------- 1 | // PyHead.h -- 2 | // $Id$ 3 | // This is part of MetaKit, see http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // Common object header class 7 | 8 | #if !defined INCLUDE_PYHEAD_H 9 | #define INCLUDE_PYHEAD_H 10 | 11 | #include 12 | 13 | class PyHead: public PyObject { 14 | public: 15 | PyHead(PyTypeObject &t) { 16 | #ifdef Py_TRACE_REFS 17 | _ob_next = 0; 18 | _ob_prev = 0; 19 | _Py_AddToAllObjects(this, 0); 20 | #endif 21 | ob_refcnt = 1; 22 | ob_type = &t; 23 | } 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/store.inl: -------------------------------------------------------------------------------- 1 | // store.inl -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Inlined members of the storage management classes 7 | */ 8 | 9 | ///////////////////////////////////////////////////////////////////////////// 10 | // c4_Notifier 11 | 12 | d4_inline c4_Notifier::c4_Notifier (c4_Sequence* origin_) 13 | : _origin (origin_), _chain (0), _next (0), 14 | _type (kNone), _index (0), _propId (0), _count (0), 15 | _cursor (0), _bytes (0) 16 | { 17 | d4_assert(_origin != 0); 18 | } 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | -------------------------------------------------------------------------------- /src/format.h: -------------------------------------------------------------------------------- 1 | // format.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Encapsulation of all format handlers 7 | */ 8 | 9 | #ifndef __FORMAT_H__ 10 | #define __FORMAT_H__ 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | // Declarations in this file 14 | 15 | class c4_Handler; // not defined here 16 | 17 | extern c4_Handler *f4_CreateFormat(const c4_Property &, c4_HandlerSeq &); 18 | extern int f4_ClearFormat(char); 19 | extern int f4_CompareFormat(char, const c4_Bytes &, const c4_Bytes &); 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/win.h: -------------------------------------------------------------------------------- 1 | // win.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for Windows builds 7 | */ 8 | 9 | #if defined (_MSDOS) 10 | #define q4_DOS 1 11 | #endif 12 | 13 | #if defined (_WINDOWS) 14 | #define q4_WIN 1 15 | #endif 16 | 17 | #if defined (_WIN32) 18 | #define q4_WIN32 1 19 | #endif 20 | 21 | #if defined (_WIN32_WCE) // check for Win CE 22 | #define q4_WINCE 1 23 | #define q4_WIN32 1 24 | #endif 25 | 26 | #if q4_WIN32 // WIN32 implies WIN 27 | #undef q4_WIN 28 | #define q4_WIN 1 29 | #endif 30 | 31 | #if q4_WIN // WIN implies not DOS, even for Win3 32 | #undef q4_DOS 33 | #endif 34 | -------------------------------------------------------------------------------- /examples/derived.py: -------------------------------------------------------------------------------- 1 | # Demo of derived view dynamics 2 | # 3 | # Output: 4 | # [1, 2, 3, 4, 5, 6] 5 | # [2, 3, 4, 5] 6 | # [2, 4, 5] 7 | # [2, 5] 8 | # [1, 2, 5, 6] 9 | 10 | import metakit 11 | db = metakit.storage() 12 | vw = db.getas('data[value:I]') 13 | 14 | def fill(l): 15 | vw[:] = [] 16 | for i in l: 17 | vw.append(value=i) 18 | 19 | def show(v): 20 | print map((lambda x: x.value), v) 21 | 22 | fill([1,2,3,4,5,6]) 23 | show(vw) 24 | 25 | # select values in range [2..5] 26 | v2 = vw.select({'value':2},{'value':5}) 27 | show(v2) 28 | 29 | # a deletion in original "vw" affects derived "v2" 30 | vw.delete(2) 31 | show(v2) 32 | 33 | # deletion in derived "v2" affects both (new in 2.3) 34 | v2.delete(1) 35 | show(v2) 36 | show(vw) 37 | -------------------------------------------------------------------------------- /src/mwcw.h: -------------------------------------------------------------------------------- 1 | // mwcw.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for Metrowerks CodeWarrior 7 | */ 8 | 9 | #define q4_MWCW 1 10 | 11 | ///////////////////////////////////////////////////////////////////////////// 12 | 13 | #if q4_68K 14 | #if !__option(IEEEdoubles) 15 | #error Cannot build Metakit with 10-byte doubles 16 | #endif 17 | #endif 18 | 19 | #if __option(bool) 20 | #define q4_BOOL 1 21 | // undo previous defaults, because q4_BOOL is not set early enough 22 | #undef false 23 | #undef true 24 | #undef bool 25 | #endif 26 | 27 | #undef _MSC_VER 28 | 29 | #pragma export on 30 | 31 | ///////////////////////////////////////////////////////////////////////////// 32 | -------------------------------------------------------------------------------- /examples/mkbug.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mk4.h" 3 | #include "mk4str.h" 4 | 5 | void QuickTest(int pos_, int len_) 6 | { 7 | c4_ViewProp p1 ("_B"); 8 | c4_IntProp p2 ("p2"); 9 | 10 | c4_Storage s1; 11 | c4_View v1 = s1.GetAs("v1[_B[p2:I]]"); 12 | 13 | int n = 0; 14 | static int sizes[] = {999, 999, 999, 3, 0}; 15 | 16 | for (int i = 0; sizes[i]; ++i) { 17 | c4_View v; 18 | for (int j = 0; j < sizes[i]; ++j) 19 | v.Add(p2 [++n]); 20 | v1.Add(p1 [v]); 21 | } 22 | 23 | c4_View v2 = v1.Blocked(); 24 | printf("%d\n", v2.GetSize()); 25 | 26 | v2.RemoveAt(pos_, len_); 27 | printf("%d\n", v2.GetSize()); 28 | 29 | puts("done"); 30 | } 31 | 32 | int main(int argc, char** argv) 33 | { 34 | QuickTest(999, 1200); 35 | } 36 | -------------------------------------------------------------------------------- /src/derived.h: -------------------------------------------------------------------------------- 1 | // derived.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Encapsulation of derived view classes 7 | */ 8 | 9 | #ifndef __DERIVED_H__ 10 | #define __DERIVED_H__ 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | // Declarations in this file 14 | 15 | class c4_Cursor; // not defined here 16 | class c4_Sequence; // not defined here 17 | 18 | extern c4_Sequence *f4_CreateFilter(c4_Sequence &, c4_Cursor, c4_Cursor); 19 | extern c4_Sequence *f4_CreateSort(c4_Sequence &, c4_Sequence * = 0); 20 | extern c4_Sequence *f4_CreateProject(c4_Sequence &, c4_Sequence &, bool, 21 | c4_Sequence * = 0); 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/field.inl: -------------------------------------------------------------------------------- 1 | // field.inl -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Inlined members of the field class 7 | */ 8 | 9 | d4_inline bool c4_Field::IsRepeating() const 10 | { 11 | return _type == 'V'; 12 | } 13 | 14 | d4_inline int c4_Field::NumSubFields() const 15 | { 16 | return _indirect->_subFields.GetSize(); 17 | } 18 | 19 | d4_inline c4_Field& c4_Field::SubField(int index_) const 20 | { 21 | return *(c4_Field*) _indirect->_subFields.GetAt(index_); 22 | } 23 | 24 | d4_inline const c4_String& c4_Field::Name() const 25 | { 26 | return _name; 27 | } 28 | 29 | d4_inline char c4_Field::OrigType() const 30 | { 31 | return _type; 32 | } 33 | 34 | d4_inline char c4_Field::Type() const 35 | { 36 | return _type == 'M' ? 'B' : _type; 37 | } 38 | -------------------------------------------------------------------------------- /doc/api/c4_Bytes___NONAME_info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | class c4_Bytes::NONAME - 6 | 7 |
8 | 9 |
10 | 11 | 12 |
13 | 14 | double 15 | _aligner; 16 | 17 |
18 | 19 | on a Sparc, the int below wasn't enough... 20 |
21 | 22 |

23 | 24 | 25 | 26 |

27 | 28 | t4_byte* 29 | _contents; 30 | 31 |
32 | 33 | 34 | 35 |

36 | 37 | 38 |

39 | 40 |
41 | class 42 | c4_Bytes::NONAME 43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /demos/struct.cpp: -------------------------------------------------------------------------------- 1 | // This command-line utility displays the data structure of a datafile 2 | // created with the Metakit library as a one-line description. 3 | 4 | #include "mk4.h" 5 | 6 | #include 7 | 8 | #if defined (macintosh) 9 | #include /**/ 10 | #define d4_InitMain(c,v) c = ccommand(&v) 11 | #endif 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | 15 | int main(int argc, char** argv) 16 | { 17 | #ifdef d4_InitMain 18 | d4_InitMain(argc, argv); 19 | #endif 20 | 21 | if (argc != 2) 22 | fputs("Usage: STRUCT datafile", stderr); 23 | else 24 | { 25 | c4_Storage store (argv[1], false); 26 | puts(store.Description()); 27 | } 28 | 29 | return 0; 30 | } 31 | 32 | ///////////////////////////////////////////////////////////////////////////// 33 | -------------------------------------------------------------------------------- /tests/ok/s24a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a1:V a2:V a3:V a4:V 2 | 0: subview 'a1' 3 | VIEW 9 rows = p1:I 4 | 0: 1 5 | 1: 0 6 | 2: 1 7 | 3: 0 8 | 4: 1 9 | 5: 0 10 | 6: 1 11 | 7: 0 12 | 8: 1 13 | 0: subview 'a2' 14 | VIEW 9 rows = p1:I 15 | 0: 3 16 | 1: 0 17 | 2: 1 18 | 3: 2 19 | 4: 3 20 | 5: 0 21 | 6: 1 22 | 7: 2 23 | 8: 3 24 | 0: subview 'a3' 25 | VIEW 9 rows = p1:I 26 | 0: 7 27 | 1: 8 28 | 2: 9 29 | 3: 10 30 | 4: 11 31 | 5: 12 32 | 6: 13 33 | 7: 14 34 | 8: 15 35 | 0: subview 'a4' 36 | VIEW 9 rows = p1:I 37 | 0: 119 38 | 1: 120 39 | 2: 121 40 | 3: 122 41 | 4: 123 42 | 5: 124 43 | 6: 125 44 | 7: 126 45 | 8: 127 46 | -------------------------------------------------------------------------------- /python/PyProperty.h: -------------------------------------------------------------------------------- 1 | // PyProperty.h -- 2 | // $Id$ 3 | // This is part of MetaKit, see http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // Property class header 7 | 8 | #if !defined INCLUDE_PYPROPERTY_H 9 | #define INCLUDE_PYPROPERTY_H 10 | 11 | #include 12 | #include "PyHead.h" 13 | 14 | #define PyProperty_Check(ob) ((ob)->ob_type == &PyPropertytype) 15 | 16 | extern PyTypeObject PyPropertytype; 17 | 18 | class PyProperty: public PyHead, public c4_Property { 19 | public: 20 | //PyProperty(); 21 | PyProperty(const c4_Property &o): PyHead(PyPropertytype), c4_Property(o){} 22 | PyProperty(char t, const char *n): PyHead(PyPropertytype), c4_Property(t, n) 23 | {} 24 | ~PyProperty(){} 25 | }; 26 | 27 | PyObject *PyProperty_new(PyObject *o, PyObject *_args); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/mfc.h: -------------------------------------------------------------------------------- 1 | // mfc.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for MFC-based builds 7 | */ 8 | 9 | #define q4_MFC 1 10 | 11 | #if q4_WIN && !q4_WIN32 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #undef d4_assert 18 | #define d4_assert ASSERT 19 | 20 | #undef d4_assertThis 21 | #define d4_assertThis d4_assert(AfxIsValidAddress(this, sizeof *this, FALSE)) 22 | 23 | #undef d4_new 24 | #define d4_new DEBUG_NEW 25 | 26 | typedef class CString c4_String; 27 | typedef class CPtrArray c4_PtrArray; 28 | typedef class CDWordArray c4_DWordArray; 29 | typedef class CStringArray c4_StringArray; 30 | 31 | // MSVC 1.52 thinks a typedef has no constructor, so use a define instead 32 | #if !q4_OK && q4_MSVC && _MSC_VER == 800 33 | #define c4_String CString 34 | #endif 35 | -------------------------------------------------------------------------------- /src/remap.h: -------------------------------------------------------------------------------- 1 | // remap.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Encapsulation of the (re)mapping viewers 7 | */ 8 | 9 | #ifndef __REMAP_H__ 10 | #define __REMAP_H__ 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | // Declarations in this file 14 | 15 | class c4_Sequence; // not defined here 16 | 17 | extern c4_CustomViewer *f4_CreateReadOnly(c4_Sequence &); 18 | extern c4_CustomViewer *f4_CreateHash(c4_Sequence &, int, c4_Sequence * = 0); 19 | extern c4_CustomViewer *f4_CreateBlocked(c4_Sequence &); 20 | extern c4_CustomViewer *f4_CreateOrdered(c4_Sequence &, int); 21 | extern c4_CustomViewer *f4_CreateIndexed(c4_Sequence &, c4_Sequence &, const 22 | c4_View &, bool = false); 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /tcl/tclconfig/README.txt: -------------------------------------------------------------------------------- 1 | These files comprise the basic building blocks for a Tcl Extension 2 | Architecture (TEA) extension. For more information on TEA see: 3 | 4 | http://www.tcl.tk/doc/tea/ 5 | 6 | This package is part of the Tcl project at SourceForge, and latest 7 | sources should be available there: 8 | 9 | http://tcl.sourceforge.net/ 10 | 11 | This package is a freely available open source package. You can do 12 | virtually anything you like with it, such as modifying it, redistributing 13 | it, and selling it either in whole or in part. 14 | 15 | CONTENTS 16 | ======== 17 | The following is a short description of the files you will find in 18 | the sample extension. 19 | 20 | README.txt This file 21 | 22 | install-sh Program used for copying binaries and script files 23 | to their install locations. 24 | 25 | tcl.m4 Collection of Tcl autoconf macros. Included by a package's 26 | aclocal.m4 to define SC_* macros. 27 | -------------------------------------------------------------------------------- /examples/bigblock.tcl: -------------------------------------------------------------------------------- 1 | # Let's store 100 million integers 2 | 3 | catch { load ../builds/.libs/libmk4tcl[info sharedlibextension] Mk4tcl } 4 | puts "[info script] - Mk4tcl [package require Mk4tcl] - $tcl_platform(os)" 5 | 6 | file delete bigdata.mk 7 | mk::file open db bigdata.mk 8 | mk::view layout db.v {{_B {a:I}}} 9 | 10 | set bv [[mk::view open db.v] view blocked] 11 | 12 | set n 0 13 | 14 | puts " filled commit #blocks filesize memuse total" 15 | 16 | for {set i 0} {$i < 20} {incr i} { 17 | 18 | set s [clock seconds] 19 | for {set j 0} {$j < 5000000} {incr j} { 20 | $bv insert end a [incr n] 21 | } 22 | set t [expr {[clock seconds] - $s}] 23 | set u [expr {[lindex [time {mk::file commit db}] 0]/1000.0}] 24 | set v [mk::view size db.v] 25 | set w [file size bigdata.mk] 26 | set x [lindex [exec ps l --noheader [pid]] 7] 27 | set y [$bv size] 28 | 29 | puts [format {%6s s %7.1f ms %6d %10d b %6d K %10d rows} $t $u $v $w $x $y] 30 | } 31 | -------------------------------------------------------------------------------- /src/borc.h: -------------------------------------------------------------------------------- 1 | // borc.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for Borland C++ 7 | */ 8 | 9 | #define q4_BORC 1 10 | 11 | // get rid of several common warning messages 12 | #if !q4_STRICT 13 | #pragma warn -aus // 'identifier' is assigned a value that is never used 14 | #pragma warn -par // Parameter 'parameter' is never used. 15 | #pragma warn -sig // Conversion may lose significant digits 16 | #pragma warn -use // 'identifier' declared but never used 17 | #endif 18 | 19 | #if __BORLANDC__ >= 0x500 20 | #define q4_BOOL 1 // supports the bool datatype 21 | // undo previous defaults, because q4_BOOL is not set early enough 22 | #undef false 23 | #undef true 24 | #undef bool 25 | #endif 26 | 27 | #if !defined (q4_EXPORT) 28 | #define q4_EXPORT 1 // requires export/import specifiers 29 | #endif 30 | 31 | #if defined (__MT__) 32 | #define q4_MULTI 1 // uses multi-threading 33 | #endif 34 | -------------------------------------------------------------------------------- /src/doxy.h: -------------------------------------------------------------------------------- 1 | // doxy.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @mainpage Metakit API Reference 6 | 7 | The is the reference documentation for the public C++ API of Metakit. 8 | 9 | - For the documentation of Metakit, see http://www.equi4.com/mkdocs.html 10 | - To use Metakit from Python, see http://www.equi4.com/metakit/python.html 11 | - To use Metakit from Tcl, see http://www.equi4.com/metakit/tcl.html 12 | 13 | @section install Installation 14 | 15 | - Windows: open "win/msvc60/mksrc.dsw" with Microsoft Visual C++ 6.0 16 | - Unix: "cd builds; ../unix/configure; make; make test; make install" 17 | 18 | @section using Using the library 19 | 20 | - There are some examples in the "demo/" and "examples/" directories. 21 | - The "tests/" directory contains a test suite with 140+ small samples. 22 | 23 | @section news News, releases, discussions 24 | 25 | - See the Metakit homepage at http://www.equi4.com/metakit.html 26 | */ 27 | 28 | // vim:wm=5 29 | -------------------------------------------------------------------------------- /python/test/test_stringtype.py: -------------------------------------------------------------------------------- 1 | # test_stringtype.py -- Test Metakit Python bindings for string type 2 | # $Id$ 3 | # This is part of Metakit, see http://www.equi4.com/metakit/ 4 | 5 | from mktestsupport import * 6 | 7 | v = ViewTester('test[a:S,b:S]') 8 | 9 | # defaults 10 | v.insert(a='', b='') 11 | 12 | # ASCII strings 13 | v.insert(a='asdasdfasdfasdfsa', b='!@*%$#@#$%^&*()') 14 | v.reject(TypeError, a=3, b='') 15 | 16 | # Null termination 17 | v.reject(ValueError, a='\0', b='hi\0') 18 | v.reject(ValueError, a='abcdabcdabcd\0hi', b='lo') 19 | v.reject(ValueError, a='\0\0hi', b='lo') 20 | 21 | # Unicode and UTF-8 strings 22 | if UnicodeType: 23 | v.insert(a=unicode('hi there', 'utf-8'), b='hi') 24 | v.insert(a=unicode('\xe2\x82\xac', 'utf-8'), b='hi') 25 | v.insert(a=unicode('Sample\xe2\x82\xacTesting', 'utf-8'), b='') 26 | v.reject(ValueError, a=unicode('Sample\0blahblah', 'utf-8'), b='yo') 27 | 28 | # Non-ASCII 8-bit strings 29 | v.insert(a='', b='\xe2\x82\xacHi there') 30 | 31 | v.finished() 32 | -------------------------------------------------------------------------------- /examples/wrap.py: -------------------------------------------------------------------------------- 1 | # Wrapping Python data as Metakit views 2 | # 3 | # Expected output (3 times): 4 | # a b c 5 | # ----- ----- - 6 | # one un 1 7 | # two deux 2 8 | # three trois 3 9 | # ----- ----- - 10 | # Total: 3 rows 11 | 12 | import metakit 13 | 14 | class C: 15 | def __init__(self, a, b, c): 16 | self.a, self.b, self.c = a, b, c 17 | 18 | dc = [ C ('one', 'un', 1), 19 | C ('two', 'deux', 2), 20 | C ('three', 'trois', 3) ] 21 | 22 | dd = [ {'a':'one', 'b':'un', 'c':1}, 23 | {'a':'two', 'b':'deux', 'c':2}, 24 | {'a':'three', 'b':'trois', 'c':3} ] 25 | 26 | dt = [ ('one', 'un', 1), 27 | ('two', 'deux', 2), 28 | ('three', 'trois', 3) ] 29 | 30 | pl = [ metakit.property('S','a'), 31 | metakit.property('S','b'), 32 | metakit.property('I','c') ] 33 | 34 | vc = metakit.wrap(dc, pl) 35 | vd = metakit.wrap(dd, pl) 36 | vt = metakit.wrap(dt, pl, 1) 37 | 38 | metakit.dump(vc, 'class objects:') 39 | metakit.dump(vd, 'dictionary elements:') 40 | metakit.dump(vt, 'tuples (by position):') 41 | -------------------------------------------------------------------------------- /tcl/stubtcl.h: -------------------------------------------------------------------------------- 1 | /* Internal stub code, copied from CritLib */ 2 | 3 | TclStubs *tclStubsPtr; 4 | TclPlatStubs *tclPlatStubsPtr; 5 | struct TclIntStubs *tclIntStubsPtr; 6 | struct TclIntPlatStubs *tclIntPlatStubsPtr; 7 | 8 | static int MyInitStubs(Tcl_Interp *ip) { 9 | typedef struct { 10 | char *result; 11 | Tcl_FreeProc *freeProc; 12 | int errorLine; 13 | TclStubs *stubTable; 14 | } HeadOfInterp; 15 | 16 | HeadOfInterp *hoi = (HeadOfInterp*)ip; 17 | 18 | if (hoi->stubTable == NULL || hoi->stubTable->magic != TCL_STUB_MAGIC) { 19 | ip->result = "This extension requires stubs-support."; 20 | ip->freeProc = TCL_STATIC; 21 | return 0; 22 | } 23 | 24 | tclStubsPtr = hoi->stubTable; 25 | 26 | if (Tcl_PkgRequire(ip, "Tcl", "8.1", 0) == NULL) { 27 | tclStubsPtr = NULL; 28 | return 0; 29 | } 30 | 31 | if (tclStubsPtr->hooks != NULL) { 32 | tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; 33 | tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; 34 | tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; 35 | } 36 | 37 | return 1; 38 | } 39 | -------------------------------------------------------------------------------- /examples/selfref.py: -------------------------------------------------------------------------------- 1 | # Demo of the new 2.3 self-referential view structures. 2 | # 3 | # Output: 4 | # 0 5 | # 00000 1 6 | # 11111 1 7 | # 22222 0 8 | # [Property('S', 's'), Property('V', 'sub')] 9 | # 00000 1 10 | # 11111 1 11 | # 22222 0 12 | # [Property('S', 's'), Property('I', 'i'), Property('V', 'sub')] 13 | # ok 14 | 15 | import os 16 | try: os.remove("_selfref.mk") 17 | except: pass 18 | 19 | import metakit 20 | db = metakit.storage('_selfref.mk',1) 21 | vw = db.getas('data[s:S,sub[^]]') 22 | 23 | print len(vw) 24 | 25 | v = vw 26 | for i in range(3): 27 | v.append(s=`i`*5) 28 | v = v[0].sub 29 | 30 | def show(vw): 31 | for v in [vw[0], vw[0].sub[0], vw[0].sub[0].sub[0]]: 32 | print v.s, len(v.sub) 33 | print vw[0].sub[0].sub[0].sub.structure() 34 | assert len(vw[0].sub[0].sub[0].sub) == 0 35 | try: 36 | metakit.dump(vw[0].sub[0].sub[0].sub[0].sub) 37 | except IndexError: 38 | pass 39 | 40 | show(vw) 41 | 42 | # note that (recursive!) on-the-fly restructuring works 43 | show(db.getas('data[s:S,i:I,sub[^]]')) 44 | 45 | db.commit() 46 | print 'ok' 47 | 48 | os.remove("_selfref.mk") 49 | -------------------------------------------------------------------------------- /examples/case.py: -------------------------------------------------------------------------------- 1 | # Properties are case-insensitive, but this can lead to some 2 | # surprising behavior: the first way a property is used will 3 | # determine how it ends up in the global symbol table. 4 | # 5 | # Sample output: 6 | # Property('S', 'HeLLo') Property('S', 'HeLLo') 7 | # 2 8 | # 2 9 | # 135099576 10 | # 135033272 11 | # 0 12 | 13 | import metakit 14 | db = metakit.storage() 15 | v1 = db.getas('lo[HeLLo:S]') 16 | v2 = db.getas('hi[hello:S]') 17 | 18 | # surprise: this prints two mixed-case names 19 | print v1.HeLLo, v2.hello 20 | 21 | # this shows that the Metakit property is the same for both 22 | # reason: there is a single global case-insensitive symbol table 23 | print metakit.property('S','HeLLo').id 24 | print metakit.property('S','hello').id 25 | 26 | # this shows that the Python objects differ 27 | # reason: these are two wrapper objects around the same thing 28 | print id(metakit.property('S','HeLLo')) 29 | print id(metakit.property('S','hello')) 30 | 31 | # this causes a mismatch, it will have to be fixed one day 32 | print metakit.property('S','HeLLo') == metakit.property('S','hello') 33 | -------------------------------------------------------------------------------- /doc/api/c4_Stream_info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 |
10 | 11 | 12 |
13 | 14 | virtual int 15 | Read (void* buffer_, int length_); 16 | 17 |
18 | 19 | 20 | Fetch some bytes sequentially 21 |

22 | 23 | 24 | 25 |

26 | 27 | virtual void 28 | Write (const void* buffer_, int length_); 29 | 30 |
31 | 32 | 33 | Store some bytes sequentially 34 |

35 | 36 | 37 | 38 |

39 | 40 | virtual 41 | ~c4_Stream (); 42 | 43 |
44 | 45 | 46 | 47 |

48 | 49 | 50 |

51 | 52 |
53 | class 54 | c4_Stream 55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /python/PyStorage.h: -------------------------------------------------------------------------------- 1 | // PyStorage.h -- 2 | // $Id$ 3 | // This is part of MetaKit, see http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // Storage class header 7 | 8 | #if !defined INCLUDE_PYSTORAGE_H 9 | #define INCLUDE_PYSTORAGE_H 10 | 11 | #include 12 | #include "PyHead.h" 13 | 14 | extern PyTypeObject PyStoragetype; 15 | class SiasStrategy; 16 | 17 | #define PyStorage_Check(v) ((v)->ob_type==&PyStoragetype) 18 | 19 | class PyStorage: public PyHead, public c4_Storage { 20 | public: 21 | PyStorage(): PyHead(PyStoragetype){} 22 | PyStorage(c4_Strategy &strategy_, bool owned_ = false, int mode_ = 1): 23 | PyHead(PyStoragetype), c4_Storage(strategy_, owned_, mode_){} 24 | PyStorage(const char *fnm, int mode): PyHead(PyStoragetype), c4_Storage(fnm, 25 | mode){} 26 | PyStorage(const c4_Storage &storage_): PyHead(PyStoragetype), c4_Storage 27 | (storage_){} 28 | // PyStorage(const char *fnm, const char *descr) 29 | // : PyHead(PyStoragetype), c4_Storage(fnm, descr) { } 30 | ~PyStorage(){} 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /license.terms: -------------------------------------------------------------------------------- 1 | Copyright (c) 1996-2007 Jean-Claude Wippler 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /examples/demo.py: -------------------------------------------------------------------------------- 1 | # Simple demo, can be used to verify proper Mk4py installation 2 | 3 | import Mk4py, sys 4 | mk = Mk4py 5 | print sys.argv[0], '- Mk4py', mk.version, '-', sys.platform 6 | 7 | # On first run, output should consist of 5 lines: 8 | # John Lennon 44 9 | # Flash Gordon 42 10 | # Flash Gordon 42 11 | # John Lennon 44 12 | # John Lennon 44 13 | # Each following run will generate 5 more lines of output 14 | 15 | # create a file called "demo.db" 16 | db = mk.storage("demo.db",1) 17 | # define a view in it called "people", containing three fields 18 | vw = db.getas("people[first:S,last:S,shoesize:I]") 19 | 20 | # let's append two rows to the end of the view 21 | vw.append(first='John',last='Lennon',shoesize=44) 22 | vw.append(first='Flash',last='Gordon',shoesize=42) 23 | 24 | # commit the structure and data to file 25 | db.commit() 26 | 27 | # a simple loop to print out all rows 28 | for r in vw: 29 | print r.first, r.last, r.shoesize 30 | 31 | # another way to loop, in sorted order 32 | for r in vw.sort(vw.last): 33 | print r.first, r.last, r.shoesize 34 | 35 | # this loop iterates over a selection 36 | for r in vw.select(first='John'): 37 | print r.first, r.last, r.shoesize 38 | -------------------------------------------------------------------------------- /python/scxx/PWOCallable.h: -------------------------------------------------------------------------------- 1 | /******************************************** 2 | copyright 2000 McMillan Enterprises, Inc. 3 | www.mcmillan-inc.com 4 | *********************************************/ 5 | #if !defined(PWOCALLABLE_H_INCLUDED_) 6 | #define PWOCALLABLE_H_INCLUDED_ 7 | 8 | #include "PWOBase.h" 9 | #include "PWOSequence.h" 10 | #include "PWOMapping.h" 11 | 12 | class PWOCallable: public PWOBase { 13 | public: 14 | PWOCallable(): PWOBase(){} 15 | ; 16 | PWOCallable(PyObject *obj): PWOBase(obj) { 17 | _violentTypeCheck(); 18 | }; 19 | virtual ~PWOCallable(){} 20 | ; 21 | virtual PWOCallable &operator = (const PWOCallable &other) { 22 | GrabRef(other); 23 | return *this; 24 | }; 25 | PWOCallable &operator = (const PWOBase &other) { 26 | GrabRef(other); 27 | _violentTypeCheck(); 28 | return *this; 29 | }; 30 | virtual void _violentTypeCheck() { 31 | if (!isCallable()) { 32 | GrabRef(0); 33 | Fail(PyExc_TypeError, "Not a callable object"); 34 | } 35 | }; 36 | PWOBase call()const; 37 | PWOBase call(PWOTuple &args)const; 38 | PWOBase call(PWOTuple &args, PWOMapping &kws)const; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /examples/demold.tcl: -------------------------------------------------------------------------------- 1 | # Simple demo, can be used to verify proper Mk4tcl/TclKit installation 2 | # 3 | # On first run, output should consist of 5 lines: 4 | # John Lennon 44 5 | # Flash Gordon 42 6 | # first Flash last Gordon shoesize 42 7 | # first John last Lennon shoesize 44 8 | # first John last Lennon shoesize 44 9 | # 10 | # Every following run will generate 5 more lines of output 11 | 12 | package require Mk4tcl 13 | 14 | # create a file called "demo.db" 15 | mk::file open db demo.db 16 | # define a view in it called "people", containing three fields 17 | set vw [mk::view layout db.people {first last shoesize:I}] 18 | 19 | # let's append two rows to the end of the view 20 | mk::row append $vw first John last Lennon shoesize 44 21 | mk::row append $vw first Flash last Gordon shoesize 42 22 | 23 | # commit the structure and data to file 24 | mk::file commit db 25 | 26 | # a simple loop to print out all rows 27 | mk::loop c $vw { 28 | puts [mk::get $c first last shoesize] 29 | } 30 | 31 | # another way to loop, in sorted order 32 | foreach r [mk::select $vw -sort last] { 33 | puts [mk::get $vw!$r] 34 | } 35 | 36 | # this loop iterates over a selection 37 | foreach r [mk::select $vw first John] { 38 | puts [mk::get $vw!$r] 39 | } 40 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | Sample scripts 2 | 3 | aside.py commit extend and commit aside 4 | bigblock.tcl storing 100,000,000 integers 5 | blockdels.tcl blocked view deletion tests 6 | case.py case sensitivity can be a bit tricky 7 | demo.py trivial demo in Python 8 | demo.tcl trivial demo in Tcl, new OO interface 9 | demold.tcl trivial demo in Tcl, original API 10 | derived.py derived views propagate changes 11 | find.py find, binary search, and hashing performance 12 | mapped.tcl performance of plain, hashed, ordered, blocked views 13 | millions.py storing millions of row, using a trick (by Christian Tismer) 14 | mkhash.cpp hashed / blocked / ordered view performance in C++ 15 | mkmemoio.py treating a memo (binary) property as an I/O stream 16 | pair.py pairwise view combination 17 | random.tcl test of 100,000 adds/mods/dels using a bytes property 18 | remap.py new mapping views (like mapped.tcl), in Python 19 | selfref.py defining a self-referential (recursive) structure 20 | selmap.tcl illustrates mapping select results back to a view 21 | slow.tcl hashed views performance in Tcl 22 | sort.tcl sorting performance in Tcl 23 | wrap.py wrapping provides a MK layer around anything 24 | -------------------------------------------------------------------------------- /tests/ok/l00a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = a:V 2 | 0: subview 'a' 3 | VIEW 1 rows = p1:I p2:I p3:I p4:I p5:I p6:I p7:I p8:I p9:I p10:I p11:I p12:I p13:I p14:I p15:I p16:I p17:I p18:I p19:I p20:I p21:I p22:I p23:I p24:I p25:I p26:I p27:I p28:I p29:I p30:I p31:I p32:I p33:I p34:I p35:I p36:I p37:I p38:I p39:I p40:I p41:I p42:I p43:I p44:I p45:I p46:I p47:I p48:I p49:I p50:I p51:I p52:I p53:I p54:I p55:I p56:I p57:I p58:I p59:I p60:I p61:I p62:I p63:I p64:I p65:I p66:I p67:I p68:I p69:I p70:I p71:I p72:I p73:I p74:I p75:I p76:I p77:I p78:I p79:I p80:I p81:I p82:I p83:I p84:I p85:I p86:I p87:I p88:I p89:I p90:I p91:I p92:I p93:I p94:I p95:I p96:I p97:I p98:I p99:I p100:I p101:I p102:I p103:I p104:I p105:I p106:I p107:I p108:I p109:I p110:I p111:I p112:I p113:I p114:I p115:I p116:I p117:I p118:I p119:I p120:I p121:I p122:I p123:I p124:I p125:I p126:I p127:I p128:I p129:I p130:I p131:I p132:I p133:I p134:I p135:I p136:I p137:I p138:I p139:I p140:I p141:I p142:I p143:I p144:I p145:I p146:I p147:I p148:I p149:I 4 | 0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 123 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 | -------------------------------------------------------------------------------- /tests/ok/m03a.txt: -------------------------------------------------------------------------------- 1 | VIEW 1 rows = d1:V m1:V d2:V m2:V d3:V m3:V d4:V m4:V 2 | 0: subview 'd1' 3 | VIEW 4 rows = p1:S 4 | 0: 'one' 5 | 1: 'two' 6 | 2: 'three' 7 | 3: 'four' 8 | 0: subview 'm1' 9 | VIEW 9 rows = _H:I _R:I 10 | 0: 0 -1 11 | 1: -1413211378 1 12 | 2: -153687682 2 13 | 3: 0 -1 14 | 4: 0 -1 15 | 5: 0 -1 16 | 6: -1614533319 3 17 | 7: -245760992 0 18 | 8: 11 0 19 | 0: subview 'd2' 20 | VIEW 3 rows = p1:S 21 | 0: 'two' 22 | 1: 'three' 23 | 2: 'four' 24 | 0: subview 'm2' 25 | VIEW 9 rows = _H:I _R:I 26 | 0: 0 -1 27 | 1: -1413211378 0 28 | 2: -153687682 1 29 | 3: 0 -1 30 | 4: 0 -1 31 | 5: 0 -1 32 | 6: -1614533319 2 33 | 7: 0 -1 34 | 8: 11 0 35 | 0: subview 'd3' 36 | VIEW 2 rows = p1:S 37 | 0: 'three' 38 | 1: 'four' 39 | 0: subview 'm3' 40 | VIEW 5 rows = _H:I _R:I 41 | 0: 0 -1 42 | 1: -153687682 0 43 | 2: -1614533319 1 44 | 3: 0 -1 45 | 4: 7 0 46 | 0: subview 'd4' 47 | VIEW 1 rows = p1:S 48 | 0: 'four' 49 | 0: subview 'm4' 50 | VIEW 5 rows = _H:I _R:I 51 | 0: 0 -1 52 | 1: 0 -1 53 | 2: -1614533319 0 54 | 3: 0 -1 55 | 4: 7 0 56 | -------------------------------------------------------------------------------- /doc/api/c4_Bytes___NONAME_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_Bytes::NONAME 7 |

8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 34 | 35 | 36 | 37 | 40 | 47 | 48 | 49 |
19 | Public members 20 |
25 | t4_byte* 26 | 28 | 29 | _contents; 30 | 31 | 32 | 33 |
38 | double 39 | 41 | 42 | _aligner; 43 | 44 | 45 | 46 |
50 | 51 | 52 | 53 | 54 | 55 | 56 |

57 | 58 | 59 | 60 | 63 | 66 | 67 | 68 | 69 | 70 | 71 |
61 | Header file 62 | 64 | "mk4.h"   --   Dec 9, 1999 65 |
72 | 73 |
74 | 75 |
76 | -------------------------------------------------------------------------------- /examples/demo.tcl: -------------------------------------------------------------------------------- 1 | # Simple demo, can be used to verify proper Mk4tcl installation 2 | 3 | load ../builds/Mk4tcl[info sharedlibextension] Mk4tcl 4 | puts "[info script] - Mk4tcl [package require Mk4tcl] - $tcl_platform(os)" 5 | 6 | # On first run, output should consist of 5 lines: 7 | # John Lennon 44 8 | # Flash Gordon 42 9 | # Flash Gordon 42 10 | # John Lennon 44 11 | # John Lennon 44 12 | # Each following run will generate 5 more lines of output 13 | 14 | # create a file called "demo.db" 15 | mk::file open db demo.db -nocommit 16 | # define a view in it called "people", containing three fields 17 | mk::view layout db.people {first last shoesize:I} 18 | set vw [mk::view open db.people] 19 | 20 | # let's append two rows to the end of the view 21 | $vw insert end first John last Lennon shoesize 44 22 | $vw insert end first Flash last Gordon shoesize 42 23 | 24 | # commit the structure and data to file 25 | mk::file commit db 26 | 27 | # a simple loop to print out all rows 28 | for {set r 0} {$r < [$vw size]} {incr r} { 29 | puts [$vw get $r first last shoesize] 30 | } 31 | 32 | # another way to loop, in sorted order 33 | foreach r [$vw select -sort last] { 34 | puts [$vw get $r first last shoesize] 35 | } 36 | 37 | # this loop iterates over a selection 38 | foreach r [$vw select first John] { 39 | puts [$vw get $r first last shoesize] 40 | } 41 | -------------------------------------------------------------------------------- /examples/sort.tcl: -------------------------------------------------------------------------------- 1 | # Timing of the view sort operation 2 | 3 | package require Mk4tcl 4 | 5 | proc timedRun {tag count args} { 6 | set usec [lindex [time $args $count] 0] 7 | append ::stats($tag) [format {%9.2f} [expr {$count*$usec/1000.0}]] 8 | } 9 | 10 | proc fill {seq} { 11 | global warray 12 | foreach {k v} [array get warray] { 13 | mk::row append db.words text $k$seq 14 | } 15 | } 16 | 17 | set step 40000 18 | set mult 7 19 | 20 | #set fd [open /usr/share/dict/words] 21 | set fd [open words] 22 | for {set i 0} {$i < $step && [gets $fd line] >= 0} {incr i} { 23 | set warray($line) $i 24 | } 25 | close $fd 26 | 27 | puts [clock format [clock seconds]] 28 | 29 | file delete _large.mk 30 | mk::file open db _large.mk -nocommit 31 | mk::view layout db.words text 32 | 33 | for {set i 0} {$i < $mult} {incr i} { 34 | append stats(count) [format {%9d} [expr {($i+1)*$step}]] 35 | timedRun fill 1 fill $i 36 | timedRun sort 1 mk::select db.words -sort text 37 | puts -nonewline stderr . 38 | } 39 | 40 | timedRun commit 1 mk::file commit db 41 | puts stderr " [mk::view size db.words] rows, [file size _large.mk] b" 42 | 43 | for {set i 0} {$i < 3} {incr i} { 44 | puts " $i: [mk::get db.words!$i]" 45 | } 46 | 47 | mk::file close db 48 | 49 | puts [clock format [clock seconds]] 50 | 51 | puts "" 52 | parray stats 53 | puts "" 54 | puts [clock format [clock seconds]] 55 | -------------------------------------------------------------------------------- /doc/api/doc_mkoptim.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - Dump 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - MkOptim


10 | 11 |

This a generic utility for the Metakit library.

12 | 13 |

What it does: MkOptim is a utility program which copies data from 14 | one Metakit file to another. This has the effect of optimizing the datafile 15 | (automatic integer sizing and compaction to remove all unused space) and of 16 | converting old datafile formats to the current one.

17 | 18 |

What it illustrates: ***TBD***

19 | 20 |

How to use it: ***TBD***. 21 |

22 | 23 |

Known problems: None.

24 | 25 |

Files in EXAMPLES\MKOPTIM:

26 | 27 |

MKOPTIM.CPP - MkOptim main program 28 |
MKOPTIM.MAK, MKOPTIM.DSP - MSVC 5.0 project makefiles for Win32

29 | 30 | 31 |


32 | || 33 |  
Roadmap 34 |   Class Index 35 |   Sample Index 36 |   || 37 |   Introduction 38 |   Tips and Tricks 39 |   || 40 | 41 |
42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /python/test/all.py: -------------------------------------------------------------------------------- 1 | # all.py -- Run all tests for the Metakit Python bindings 2 | # $Id$ 3 | # This is part of Metakit, see http://www.equi4.com/metakit/ 4 | 5 | import sys 6 | import os 7 | import test.regrtest 8 | 9 | def canonicalPath(path): 10 | """Do everything but resolve symbolic links to create an absolute path.""" 11 | return os.path.abspath(os.path.expanduser(os.path.expandvars(path))) 12 | 13 | # from Python 2.2's test.regrtest module 14 | def findtestdir(): 15 | if __name__ == '__main__': 16 | file = sys.argv[0] 17 | else: 18 | file = __file__ 19 | testdir = os.path.dirname(file) or os.curdir 20 | return testdir 21 | 22 | testdir = canonicalPath(findtestdir()) 23 | 24 | # Make sure 'import metakit' works, assuming metakit modules are 25 | # in the directory above that containing this script. 26 | sys.path.insert(0, os.path.dirname(testdir)) 27 | 28 | # Make sure we're using modules from the builds directory, assuming 29 | # that's the current directory at the time we're run. (While this 30 | # directory is probably named 'test', it isn't a module, so it 31 | # shouldn't interfere with references to the Python 'test' module). 32 | sys.path.insert(0, os.getcwd()) 33 | 34 | # Don't run the standard Python tests, just run Metakit tests 35 | test.regrtest.STDTESTS = [] 36 | test.regrtest.NOTTESTS = [] 37 | 38 | # Run all tests 39 | test.regrtest.main(testdir=testdir) 40 | -------------------------------------------------------------------------------- /src/msvc.h: -------------------------------------------------------------------------------- 1 | // msvc.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for Microsoft Visual C++ 7 | */ 8 | 9 | #define q4_MSVC 1 10 | 11 | // get rid of several common warning messages 12 | #if !q4_STRICT 13 | //#pragma warning(disable: 4244) // conversion ..., possible loss of data 14 | //#pragma warning(disable: 4135) // conversion between diff. integral types 15 | //#pragma warning(disable: 4511) // copy constructor could not be generated 16 | //#pragma warning(disable: 4512) // assignment op could not be generated 17 | //#pragma warning(disable: 4514) // unreferenced inline removed 18 | #pragma warning(disable: 4710) // function ... not inlined 19 | #pragma warning(disable: 4711) // ... selected for automatic inline expansion 20 | #pragma warning(disable: 4100) // unreferenced formal parameter 21 | #endif 22 | 23 | #if _MSC_VER >= 1100 24 | #define q4_BOOL 1 // 5.0 supports the bool datatype 25 | #else 26 | #define q4_NO_NS 1 // 4.x doesn't use namespaces for STL 27 | #endif 28 | 29 | #if defined (_MT) 30 | #define q4_MULTI 1 // uses multi-threading 31 | #endif 32 | 33 | #if defined (_DEBUG) && !defined (q4_CHECK) // use assertions in debug build 34 | #define q4_CHECK 1 35 | #endif 36 | 37 | #if !q4_STD && !q4_UNIV && !defined (q4_MFC) 38 | #define d4_FW_H "mfc.h" // default for MSVC is to use MFC 39 | #endif 40 | -------------------------------------------------------------------------------- /doc/api/doc_dbf2mk.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - Dump 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - Dbf2mk


10 | 11 |

This is a generic utility for the Metakit library.

12 | 13 |

What it does: Dbf2mk is a utility program which reads data from one 14 | or more industry-standard DBF files and saves the data in a Metakit datafile.

15 | 16 |

What it illustrates: ***TBD***

17 | 18 |

How to use it: ***TBD***. 19 |

20 | 21 |

Known problems: None. This utility has not yet been extensively 22 | tested. This version can handle files of any size, but it does not load 23 | DBase "memo" fields and ignores all index files and calculated fields.

24 | 25 |

Files in EXAMPLES\DBF2MK:

26 | 27 |

DBF2MK.CPP - Dbf2mk main program 28 |
DBF2MK.MAK, DBF2MK.DSP - MSVC 5.0 project makefiles for Win32

29 | 30 | 31 |


32 | || 33 |   Roadmap 34 |   Class Index 35 |   Sample Index 36 |   || 37 |   Introduction 38 |   Tips and Tricks 39 |   || 40 | 41 |
42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /examples/blockdels.tcl: -------------------------------------------------------------------------------- 1 | # Blocked view deletion tests 2 | # jcw, 26-3-2002 3 | 4 | if [catch {package require Mk4tcl}] { 5 | catch {load ./Mk4tcl.so mk4tcl} 6 | catch {load ./Mk4tcl_d.dll mk4tcl} 7 | } 8 | 9 | proc fill {n} { 10 | $::bv size 0 11 | set ::vv {} 12 | for {set i 0} {$i < $n} {incr i} { 13 | $::bv insert end a $i 14 | lappend ::vv $i 15 | } 16 | } 17 | 18 | proc remove {from {count 1}} { 19 | incr count -1 20 | $::bv delete $from [incr count $from] 21 | set ::vv [lreplace $::vv $from $count] 22 | } 23 | 24 | proc check {} { 25 | set pos 0 26 | foreach y $::vv { 27 | set x [$::bv get $pos a] 28 | if {$x != $y} { error "pos $pos is $x, should be $y" } 29 | incr pos 30 | } 31 | } 32 | 33 | mk::file open db 34 | mk::view layout db.v {{_B {a:I}}} 35 | 36 | set bv [[mk::view open db.v] view blocked] 37 | 38 | for {set j 1} {$j < 6} {incr j} { 39 | fill 2000 40 | remove 996 $j 41 | check 42 | } 43 | 44 | for {set j 988} {$j < 1001} {incr j} { 45 | fill 2000 46 | remove $j 10 47 | check 48 | } 49 | 50 | for {set j 1100} {$j < 1110} {incr j} { 51 | fill 3000 52 | remove 985 $j 53 | check 54 | } 55 | 56 | set total 50000 57 | fill $total 58 | 59 | foreach x {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} { 60 | puts -nonewline stderr "$x " 61 | for {set i [expr {$total-1025}]} {$i > 0} {incr i -1000} { 62 | remove $i 45 63 | remove $i 45 64 | incr total -90 65 | } 66 | check 67 | } 68 | 69 | puts stderr OK 70 | -------------------------------------------------------------------------------- /tests/tdiffer.cpp: -------------------------------------------------------------------------------- 1 | // tdiffer.cpp -- Regression test program, differential commit tests 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | #include "regress.h" 6 | 7 | void TestDiffer() { 8 | B(d01, Commit aside, 0)W(d01a); 9 | W(d01b); 10 | { 11 | c4_IntProp p1("p1"); 12 | { 13 | c4_Storage s1("d01a", 1); 14 | A(s1.Strategy().FileSize() == 0); 15 | c4_View v1 = s1.GetAs("a[p1:I]"); 16 | v1.Add(p1[123]); 17 | s1.Commit(); 18 | } 19 | { 20 | c4_Storage s1("d01a", 0); 21 | c4_Storage s2("d01b", 1); 22 | s1.SetAside(s2); 23 | c4_View v1 = s1.View("a"); 24 | A(v1.GetSize() == 1); 25 | A(p1(v1[0]) == 123); 26 | v1.Add(p1[456]); 27 | A(v1.GetSize() == 2); 28 | A(p1(v1[0]) == 123); 29 | A(p1(v1[1]) == 456); 30 | s1.Commit(); 31 | A(v1.GetSize() == 2); 32 | A(p1(v1[0]) == 123); 33 | A(p1(v1[1]) == 456); 34 | s2.Commit(); 35 | A(v1.GetSize() == 2); 36 | A(p1(v1[0]) == 123); 37 | A(p1(v1[1]) == 456); 38 | } 39 | { 40 | c4_Storage s1("d01a", 0); 41 | c4_View v1 = s1.View("a"); 42 | A(v1.GetSize() == 1); 43 | A(p1(v1[0]) == 123); 44 | c4_Storage s2("d01b", 0); 45 | s1.SetAside(s2); 46 | c4_View v2 = s1.View("a"); 47 | A(v2.GetSize() == 2); 48 | A(p1(v2[0]) == 123); 49 | A(p1(v2[1]) == 456); 50 | } 51 | } 52 | D(d01a); 53 | D(d01b); 54 | R(d01a); 55 | R(d01b); 56 | E; 57 | } 58 | -------------------------------------------------------------------------------- /tcl/configure.in: -------------------------------------------------------------------------------- 1 | AC_INIT([Mk4tcl], [2.4.9.7]) 2 | TEA_INIT([3.6]) 3 | 4 | AC_CONFIG_AUX_DIR(tclconfig) 5 | 6 | TEA_PATH_TCLCONFIG 7 | TEA_LOAD_TCLCONFIG 8 | TEA_PREFIX 9 | TEA_SETUP_COMPILER 10 | 11 | TEA_ADD_SOURCES([../src/column.cpp 12 | ../src/custom.cpp 13 | ../src/derived.cpp 14 | ../src/field.cpp 15 | ../src/fileio.cpp 16 | ../src/format.cpp 17 | ../src/handler.cpp 18 | ../src/persist.cpp 19 | ../src/remap.cpp 20 | ../src/std.cpp 21 | ../src/store.cpp 22 | ../src/string.cpp 23 | ../src/table.cpp 24 | ../src/univ.cpp 25 | ../src/view.cpp 26 | ../src/viewx.cpp 27 | mk4tcl.cpp 28 | mk4too.cpp]) 29 | 30 | TEA_ADD_HEADERS([]) 31 | TEA_ADD_INCLUDES([-I\"${srcdir}/../include\" -I\"${srcdir}\" -I.]) 32 | TEA_ADD_LIBS([]) 33 | TEA_ADD_CFLAGS([]) 34 | TEA_ADD_STUB_SOURCES([]) 35 | TEA_ADD_TCL_SOURCES([]) 36 | 37 | if test "${TEA_PLATFORM}" = "windows" ; then 38 | AC_DEFINE(BUILD_Mk4tcl) 39 | CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch" 40 | #TEA_ADD_SOURCES([win/winFile.c]) 41 | #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 42 | else 43 | CLEANFILES="" 44 | #TEA_ADD_SOURCES([unix/unixFile.c]) 45 | #TEA_ADD_LIBS([-lsuperfly]) 46 | fi 47 | AC_SUBST(CLEANFILES) 48 | 49 | TEA_PUBLIC_TCL_HEADERS 50 | TEA_ENABLE_THREADS 51 | TEA_ENABLE_SHARED 52 | TEA_CONFIG_CFLAGS 53 | TEA_ENABLE_SYMBOLS 54 | 55 | if test "${SHARED_BUILD}" = "1"; then 56 | AC_DEFINE(USE_TCL_STUBS) 57 | fi 58 | 59 | TEA_MAKE_LIB 60 | TEA_PROG_TCLSH 61 | 62 | AC_OUTPUT([Makefile pkgIndex.tcl config.h]) 63 | -------------------------------------------------------------------------------- /tcl/tests/limit.test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env tclsh 2 | # %renumber<^\s*test >% 3 | 4 | source [file join [file dir [info script]] initests.tcl] 5 | 6 | test 0 {} { 7 | package require Mk4tcl 8 | } $version 9 | 10 | set f f1.dat 11 | test 1 {lots of properties} -body { 12 | file delete $f 13 | 14 | mk::file open db $f 15 | for {set i 0} {$i < 250} {incr i} { 16 | lappend format i$i:I 17 | } 18 | mk::view layout db.v $format 19 | mk::file commit db 20 | equal [mk::view layout db.v] $format 21 | } -cleanup {mk::file close db} 22 | file delete $f 23 | 24 | set f f2.dat 25 | test 2 {string/byte/memo property mix} -body { 26 | file delete $f 27 | 28 | mk::file open db $f 29 | mk::view layout db.a {s:S b:B} 30 | 31 | set a 123456789012345 32 | set b $a$a$a$a$a$a$a$a$a$a 33 | set c $b$b$b$b$b$b$b$b$b$b 34 | set d $c$c$c$c$c$c$c$c$c$c 35 | equal [string length $d] 15000 36 | 37 | mk::row append db.a s A$a b A$a 38 | mk::row append db.a s A$d b A$d 39 | mk::row append db.a 40 | 41 | mk::row append db.a s B$a b B$a 42 | mk::row append db.a s B$d b B$d 43 | mk::row append db.a 44 | 45 | mk::file close db 46 | mk::file open db $f -readonly 47 | 48 | equal [mk::get db.a!0 b] A$a 49 | equal [mk::get db.a!1 b] A$d 50 | equal [mk::get db.a!2 b] {} 51 | 52 | equal [mk::get db.a!0 s] A$a 53 | equal [mk::get db.a!1 s] A$d 54 | equal [mk::get db.a!2 s] {} 55 | 56 | equal [mk::get db.a!3 b] B$a 57 | equal [mk::get db.a!4 b] B$d 58 | equal [mk::get db.a!5 b] {} 59 | 60 | equal [mk::get db.a!3 s] B$a 61 | equal [mk::get db.a!4 s] B$d 62 | equal [mk::get db.a!5 s] {} 63 | } -cleanup {mk::file close db} 64 | file delete $f 65 | 66 | ::tcltest::cleanupTests 67 | -------------------------------------------------------------------------------- /doc/api/c4_Stream_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_Stream 7 |

8 | 9 |
10 | A stream is a virtual helper class to serialize in binary form.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 34 | 35 | 36 | 37 | 40 | 48 | 49 | 50 | 51 | 54 | 62 | 63 | 64 |
19 | Public members 20 |
25 | virtual 26 | 28 | 29 | ~c4_Stream (); 30 | 31 | 32 | 33 |
38 | virtual int 39 | 41 | 42 | Read (void* buffer_, int length_); 43 | 44 | 45 |
46 | Fetch some bytes sequentially
47 |
52 | virtual void 53 | 55 | 56 | Write (const void* buffer_, int length_); 57 | 58 | 59 |
60 | Store some bytes sequentially
61 |
65 | 66 | 67 | 68 | 69 | 70 | 71 |

72 | 73 | 74 | 75 | 78 | 81 | 82 | 83 | 84 | 85 | 86 |
76 | Header file 77 | 79 | "mk4.h"   --   Dec 9, 1999 80 |
87 | 88 |
89 | 90 |
91 | -------------------------------------------------------------------------------- /tcl/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the `bcopy' function. */ 4 | #undef HAVE_BCOPY 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DLFCN_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if the system has the type `long long'. */ 13 | #undef HAVE_LONG_LONG 14 | 15 | /* Define to 1 if you have the `memmove' function. */ 16 | #undef HAVE_MEMMOVE 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_MEMORY_H 20 | 21 | /* Define to 1 if you have the `mmap' function. */ 22 | #undef HAVE_MMAP 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STDINT_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_STDLIB_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_STRINGS_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_STRING_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_SYS_STAT_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_SYS_TYPES_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_UNISTD_H 44 | 45 | /* The size of a `long', as computed by sizeof. */ 46 | #undef SIZEOF_LONG 47 | 48 | /* Define to 1 if you have the ANSI C header files. */ 49 | #undef STDC_HEADERS 50 | 51 | /* Define to empty if `const' does not conform to ANSI C. */ 52 | #undef const 53 | 54 | /* Define as `__inline' if that's what the C compiler calls it, or to nothing 55 | if it is not supported. */ 56 | #undef inline 57 | -------------------------------------------------------------------------------- /unix/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the `bcopy' function. */ 4 | #undef HAVE_BCOPY 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DLFCN_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if the system has the type `long long'. */ 13 | #undef HAVE_LONG_LONG 14 | 15 | /* Define to 1 if you have the `memmove' function. */ 16 | #undef HAVE_MEMMOVE 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_MEMORY_H 20 | 21 | /* Define to 1 if you have the `mmap' function. */ 22 | #undef HAVE_MMAP 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STDINT_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_STDLIB_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_STRINGS_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_STRING_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_SYS_STAT_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_SYS_TYPES_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_UNISTD_H 44 | 45 | /* The size of a `long', as computed by sizeof. */ 46 | #undef SIZEOF_LONG 47 | 48 | /* Define to 1 if you have the ANSI C header files. */ 49 | #undef STDC_HEADERS 50 | 51 | /* Define to empty if `const' does not conform to ANSI C. */ 52 | #undef const 53 | 54 | /* Define as `__inline' if that's what the C compiler calls it, or to nothing 55 | if it is not supported. */ 56 | #undef inline 57 | -------------------------------------------------------------------------------- /src/std.h: -------------------------------------------------------------------------------- 1 | // std.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Configuration header for STL-based builds 7 | */ 8 | 9 | #define q4_STD 1 10 | 11 | #include "mk4str.h" 12 | 13 | #include 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | 17 | template class c4_ArrayT { 18 | #if defined(_MSC_VER) || defined(__BORLANDC__) 19 | d4_std::vector > _vector; 20 | #else 21 | d4_std::vector _vector; 22 | #endif 23 | 24 | public: 25 | c4_ArrayT(){} 26 | ~c4_ArrayT(){} 27 | 28 | int GetSize()const { 29 | return _vector.size(); 30 | } 31 | void SetSize(int nNewSize, int = - 1) { 32 | _vector.resize(nNewSize); 33 | } 34 | 35 | T GetAt(int nIndex)const { 36 | return _vector[nIndex]; 37 | } 38 | T &ElementAt(int nIndex) { 39 | return _vector[nIndex]; 40 | } 41 | 42 | void SetAt(int nIndex, const T &newElement) { 43 | _vector[nIndex] = newElement; 44 | } 45 | 46 | int Add(const T &newElement) { 47 | int n = _vector.size(); 48 | _vector.push_back(newElement); 49 | return n; 50 | } 51 | 52 | void InsertAt(int nIndex, const T &newElement, int nCount = 1) { 53 | _vector.insert(&_vector[nIndex], nCount, newElement); 54 | } 55 | 56 | void RemoveAt(int nIndex, int nCount = 1) { 57 | _vector.erase(&_vector[nIndex], &_vector[nIndex + nCount]); 58 | } 59 | }; 60 | 61 | typedef c4_ArrayT < t4_i32 > c4_DWordArray; 62 | typedef c4_ArrayT < void * > c4_PtrArray; 63 | typedef c4_ArrayT < c4_String > c4_StringArray; 64 | 65 | ///////////////////////////////////////////////////////////////////////////// 66 | -------------------------------------------------------------------------------- /tests/ok/m07.txt: -------------------------------------------------------------------------------- 1 | >>> All blocked view multi-deletion cases 2 | blockdel pos 0 len 1 3 | blockdel pos 0 len 2 4 | blockdel pos 0 len 3 5 | blockdel pos 0 len 998 6 | blockdel pos 0 len 999 7 | blockdel pos 0 len 1000 8 | blockdel pos 0 len 1001 9 | blockdel pos 0 len 1998 10 | blockdel pos 0 len 1999 11 | blockdel pos 0 len 2000 12 | blockdel pos 0 len 2001 13 | blockdel pos 1 len 1 14 | blockdel pos 1 len 2 15 | blockdel pos 1 len 3 16 | blockdel pos 1 len 998 17 | blockdel pos 1 len 999 18 | blockdel pos 1 len 1000 19 | blockdel pos 1 len 1001 20 | blockdel pos 1 len 1998 21 | blockdel pos 1 len 1999 22 | blockdel pos 1 len 2000 23 | blockdel pos 1 len 2001 24 | blockdel pos 998 len 1 25 | blockdel pos 998 len 2 26 | blockdel pos 998 len 3 27 | blockdel pos 998 len 998 28 | blockdel pos 998 len 999 29 | blockdel pos 998 len 1000 30 | blockdel pos 998 len 1001 31 | blockdel pos 999 len 1 32 | blockdel pos 999 len 2 33 | blockdel pos 999 len 3 34 | blockdel pos 999 len 998 35 | blockdel pos 999 len 999 36 | blockdel pos 999 len 1000 37 | blockdel pos 999 len 1001 38 | blockdel pos 1000 len 1 39 | blockdel pos 1000 len 2 40 | blockdel pos 1000 len 3 41 | blockdel pos 1000 len 998 42 | blockdel pos 1000 len 999 43 | blockdel pos 1000 len 1000 44 | blockdel pos 1000 len 1001 45 | blockdel pos 1001 len 1 46 | blockdel pos 1001 len 2 47 | blockdel pos 1001 len 3 48 | blockdel pos 1001 len 998 49 | blockdel pos 1001 len 999 50 | blockdel pos 1001 len 1000 51 | blockdel pos 1001 len 1001 52 | blockdel pos 2998 len 1 53 | blockdel pos 2997 len 2 54 | blockdel pos 2996 len 3 55 | blockdel pos 2001 len 998 56 | blockdel pos 2000 len 999 57 | blockdel pos 1999 len 1000 58 | blockdel pos 1998 len 1001 59 | blockdel pos 1001 len 1998 60 | blockdel pos 1000 len 1999 61 | blockdel pos 999 len 2000 62 | blockdel pos 998 len 2001 63 | <<< done. 64 | -------------------------------------------------------------------------------- /python/PyRowRef.h: -------------------------------------------------------------------------------- 1 | // PyRowRef.h -- 2 | // $Id$ 3 | // This is part of MetaKit, see http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // RowRef class header 7 | 8 | #if !defined INCLUDE_PYROWREF_H 9 | #define INCLUDE_PYROWREF_H 10 | 11 | #include 12 | #include "PyHead.h" 13 | #include 14 | #include "PyView.h" 15 | #include "PyProperty.h" 16 | 17 | #define PyRowRef_Check(ob) ((ob)->ob_type == &PyRowReftype) 18 | #define PyRORowRef_Check(ob) ((ob)->ob_type == &PyRORowReftype) 19 | #define PyGenericRowRef_Check(ob) (PyRowRef_Check(ob) || PyRORowRef_Check(ob)) 20 | 21 | extern PyTypeObject PyRowReftype; 22 | extern PyTypeObject PyRORowReftype; 23 | 24 | class PyRowRef: public PyHead, public c4_RowRef { 25 | public: 26 | //PyRowRef(); 27 | PyRowRef(const c4_RowRef &o, int immutable = 0); 28 | //PyRowRef(c4_Row row); 29 | ~PyRowRef() { 30 | c4_Cursor c = &(*(c4_RowRef*)this); 31 | c._seq->DecRef(); 32 | } 33 | PyProperty *getProperty(char *nm) { 34 | c4_View cntr = Container(); 35 | int ndx = cntr.FindPropIndexByName(nm); 36 | if (ndx > - 1) { 37 | return new PyProperty(cntr.NthProperty(ndx)); 38 | } 39 | return 0; 40 | }; 41 | 42 | PyObject *getPropertyValue(char *nm) { 43 | PyProperty *prop = getProperty(nm); 44 | if (prop) { 45 | PyObject *result = asPython(*prop); 46 | Py_DECREF(prop); 47 | return result; 48 | } 49 | return 0; 50 | }; 51 | 52 | static void setFromPython(const c4_RowRef &row, const c4_Property &prop, 53 | PyObject *val); 54 | static void setDefault(const c4_RowRef &row, const c4_Property &prop); 55 | PyObject *asPython(const c4_Property &prop); 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/handler.inl: -------------------------------------------------------------------------------- 1 | // handler.inl -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Inlined members of the handler classes 7 | */ 8 | 9 | ///////////////////////////////////////////////////////////////////////////// 10 | // c4_Handler 11 | 12 | d4_inline c4_Handler::c4_Handler (const c4_Property& prop_) 13 | : _property (prop_) 14 | { 15 | } 16 | 17 | d4_inline c4_Handler::~c4_Handler () 18 | { 19 | } 20 | 21 | d4_inline void c4_Handler::Define(int, const t4_byte**) 22 | { 23 | } 24 | 25 | d4_inline void c4_Handler::FlipBytes() 26 | { 27 | } 28 | 29 | d4_inline const c4_Property& c4_Handler::Property() const 30 | { 31 | return _property; 32 | } 33 | 34 | d4_inline int c4_Handler::PropId() const 35 | { 36 | return _property.GetId(); 37 | } 38 | 39 | d4_inline c4_Column* c4_Handler::GetNthMemoCol(int, bool alloc_) 40 | { 41 | return 0; 42 | } 43 | 44 | d4_inline bool c4_Handler::IsPersistent() const 45 | { 46 | return false; 47 | } 48 | 49 | d4_inline void c4_Handler::Unmapped() 50 | { 51 | } 52 | 53 | d4_inline bool c4_Handler::HasSubview(int) 54 | { 55 | return false; 56 | } 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // c4_HandlerSeq 60 | 61 | d4_inline int c4_HandlerSeq::NumRows() const 62 | { 63 | d4_assert(_numRows >= 0); 64 | 65 | return _numRows; 66 | } 67 | 68 | d4_inline int c4_HandlerSeq::NumHandlers() const 69 | { 70 | return _handlers.GetSize(); 71 | } 72 | 73 | d4_inline c4_Handler& c4_HandlerSeq::NthHandler(int index_) const 74 | { 75 | d4_assert(_handlers.GetAt(index_) != 0); 76 | 77 | return *(c4_Handler*) _handlers.GetAt(index_); 78 | } 79 | 80 | d4_inline const c4_Sequence* c4_HandlerSeq::HandlerContext(int) const 81 | { 82 | return this; 83 | } 84 | 85 | d4_inline c4_HandlerSeq& c4_HandlerSeq::Parent() const 86 | { 87 | return *_parent; 88 | } 89 | 90 | ///////////////////////////////////////////////////////////////////////////// 91 | -------------------------------------------------------------------------------- /src/field.h: -------------------------------------------------------------------------------- 1 | // field.h -- 2 | // $Id$ 3 | // This is part of Metakit, see http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Core class to represent fields 7 | */ 8 | 9 | #ifndef __FIELD_H__ 10 | #define __FIELD_H__ 11 | 12 | #ifndef __K4CONF_H__ 13 | #error Please include "k4conf.h" before this header file 14 | #endif 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | 18 | class c4_Field { 19 | c4_PtrArray _subFields; 20 | c4_String _name; 21 | char _type; 22 | c4_Field *_indirect; 23 | 24 | public: 25 | /* Construction / destruction */ 26 | c4_Field(const char * &, c4_Field * = 0); 27 | //: Constructs a new field. 28 | ~c4_Field(); 29 | 30 | /* Repeating and compound fields */ 31 | int NumSubFields()const; 32 | //: Returns the number of subfields. 33 | c4_Field &SubField(int)const; 34 | //: Returns the description of each subfield. 35 | bool IsRepeating()const; 36 | //: Returns true if this field contains subtables. 37 | 38 | /* Field name and description */ 39 | const c4_String &Name()const; 40 | //: Returns name of this field. 41 | char Type()const; 42 | //: Returns the type description of this field, if any. 43 | char OrigType()const; 44 | //: Similar, but report types which were originall 'M' as well. 45 | c4_String Description(bool anonymous_ = false)const; 46 | //: Describes the structure, omit names if anonymous. 47 | c4_String DescribeSubFields(bool anonymous_ = false)const; 48 | //: Describes just the subfields, omit names if anonymous. 49 | 50 | private: 51 | c4_Field(const c4_Field &); // not implemented 52 | void operator = (const c4_Field &); // not implemented 53 | }; 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | 57 | #if q4_INLINE 58 | #include "field.inl" 59 | #endif 60 | 61 | ///////////////////////////////////////////////////////////////////////////// 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /examples/selmap.tcl: -------------------------------------------------------------------------------- 1 | # How to map a Tcl selection result back to a view 2 | # 3 | # Note: it'd be nice to have a "$view loop var { script ... }" in Mk4tcl 4 | 5 | if {[catch {package require Mk4tcl}] && 6 | [catch {load ./Mk4tcl.so mk4tcl}] && 7 | [catch {load ../builds/Mk4tcl.so mk4tcl}] && 8 | [catch {load ./Mk4tcl_d.dll mk4tcl}] && 9 | [catch {load ../builds/Mk4tcl_d.dll mk4tcl}]} { 10 | error "cannot load Mk4tcl" 11 | } 12 | 13 | mk::file open db 14 | mk::view layout db.squares {x:I y:I} 15 | 16 | set count 50000 17 | mk::view size db.squares $count 18 | 19 | set t [clock seconds] 20 | 21 | mk::loop c db.squares { 22 | set i [mk::cursor position c] 23 | mk::set $c x $i y [expr {$i*$i}] 24 | } 25 | 26 | puts "init took [expr {[clock seconds] - $t}] seconds" 27 | 28 | puts "select timing: [time {set v [mk::select db.squares -regexp y 11111]}]" 29 | 30 | puts "results from select:" 31 | foreach i $v { 32 | foreach {x y} [mk::get db.squares!$i x y] break 33 | puts [format {%7i: %10d,%d} $i $x $y] 34 | } 35 | 36 | set v1 [mk::view new] 37 | foreach i $v { 38 | $v1 insert end n:I $i 39 | } 40 | 41 | puts "contents of v1:" 42 | for {set i 0} {$i < [$v1 size]} {incr i} { 43 | puts " [$v1 get $i n]" 44 | } 45 | 46 | set v2 [mk::view open db.squares] 47 | puts "the squares view is called '$v2' and contains [$v2 size] rows" 48 | 49 | set v3 [$v2 view map $v1] 50 | 51 | puts "mapped view:" 52 | for {set i 0} {$i < [$v3 size]} {incr i} { 53 | foreach {x y} [$v3 get $i x y] break 54 | puts [format {%7i: %10d,%d} $i $x $y] 55 | } 56 | 57 | $v3 close 58 | $v2 close 59 | $v1 close 60 | 61 | # The output on this script should be: 62 | # 63 | # init took 1 seconds 64 | # select timing: 443096 microseconds per iteration 65 | # results from select: 66 | # 10541: 10541,111112681 67 | # 33334: 33334,1111155556 68 | # 48310: 48310,-1961111196 69 | # contents of v1: 70 | # 10541 71 | # 33334 72 | # 48310 73 | # the squares view is called 'view1' and contains 100000 rows 74 | # mapped view: 75 | # 0: 10541,111112681 76 | # 1: 33334,1111155556 77 | # 2: 48310,-1961111196 78 | -------------------------------------------------------------------------------- /doc/api/doc_demo.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - Demo 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - Demo


10 | 11 |

This example is more a "proof of concept" than anything else...

12 | 13 |

What it does: Demo creates a simple view on disk, makes a few 14 | changes to the data as well as the structure, and then saves these too. 15 |

16 | 17 |

What it illustrates: This sample program shows how to set up 18 | a simple program which uses Metakit. The source code of this 19 | application can be compiled for 32-bit Windows (as console application) 20 | as well as for 16-bit small-model DOS targets. When run more than once, i.e. with an existing 21 | datafile, this program will cause some changes to the data which illustrate 22 | the effects of "on-the-fly data restrcuturing". 23 | Demo has little practical use, other than to show you 24 | how to get started with Metakit.

25 | 26 |

How to use it: When you launch the 16-bit DOS version called DEMO16.EXE, 27 | it creates a datafile called "myfile.dat", saves some 28 | data to it, and then reopens it and displays the line: 29 |

     The country of Paco Pena is: Spain 
30 | 31 | By following the code, you can see where this came from. You can use the Metakit 32 | dump utility (see below) to examine the contents of the data file. 33 | 34 |

Known problems: None.

35 | 36 |

Files in EXAMPLES\DEMO:

37 | 38 |

DEMO.CPP - Demo main program 39 |
DEMO.MAK, DEMO.MDP - MSVC 4.2 project makefiles for Win32 40 |
DEMO16.MAK - MSVC 1.52 project makefile 41 | 42 | 43 |


44 | || 45 |   Roadmap 46 |   Class Index 47 |   Sample Index 48 |   || 49 |   Introduction 50 |   Tips and Tricks 51 |   || 52 | 53 |
54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /src/custom.h: -------------------------------------------------------------------------------- 1 | // custom.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Encapsulation of many custom viewer classes 7 | */ 8 | 9 | #ifndef __CUSTOM_H__ 10 | #define __CUSTOM_H__ 11 | 12 | #ifndef __FIELD_H__ 13 | #include "field.h" 14 | #endif 15 | #ifndef __STORE_H__ 16 | #include "handler.h" 17 | #endif 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | 21 | class c4_CustomSeq: public c4_HandlerSeq { 22 | c4_CustomViewer *_viewer; 23 | bool _inited; 24 | 25 | public: 26 | c4_CustomSeq(c4_CustomViewer *viewer_); 27 | virtual ~c4_CustomSeq(); 28 | 29 | virtual int NumRows()const; 30 | 31 | virtual bool RestrictSearch(c4_Cursor, int &, int &); 32 | 33 | virtual void InsertAt(int, c4_Cursor, int = 1); 34 | virtual void RemoveAt(int, int = 1); 35 | virtual void Move(int from_, int); 36 | 37 | bool DoGet(int row_, int col_, c4_Bytes &buf_)const; 38 | void DoSet(int row_, int col_, const c4_Bytes &buf_); 39 | 40 | private: 41 | // this *is* used, as override 42 | virtual c4_Handler *CreateHandler(const c4_Property &); 43 | }; 44 | 45 | ///////////////////////////////////////////////////////////////////////////// 46 | 47 | extern c4_CustomViewer *f4_CustSlice(c4_Sequence &, int, int, int); 48 | extern c4_CustomViewer *f4_CustProduct(c4_Sequence &, const c4_View &); 49 | extern c4_CustomViewer *f4_CustRemapWith(c4_Sequence &, const c4_View &); 50 | extern c4_CustomViewer *f4_CustPair(c4_Sequence &, const c4_View &); 51 | extern c4_CustomViewer *f4_CustConcat(c4_Sequence &, const c4_View &); 52 | extern c4_CustomViewer *f4_CustRename(c4_Sequence &, const c4_Property &, const 53 | c4_Property &); 54 | extern c4_CustomViewer *f4_CustGroupBy(c4_Sequence &, const c4_View &, const 55 | c4_Property &); 56 | extern c4_CustomViewer *f4_CustJoinProp(c4_Sequence &, const c4_ViewProp &, 57 | bool); 58 | extern c4_CustomViewer *f4_CustJoin(c4_Sequence &, const c4_View &, const 59 | c4_View &, bool); 60 | 61 | ///////////////////////////////////////////////////////////////////////////// 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/column.inl: -------------------------------------------------------------------------------- 1 | // column.inl -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Inlined members of the column classes 7 | */ 8 | 9 | ///////////////////////////////////////////////////////////////////////////// 10 | // c4_Column 11 | 12 | d4_inline int c4_Column::fSegIndex(t4_i32 offset_) 13 | { 14 | // limited by max array: 1 << (kSegBits + 15) with 16-bit ints 15 | return (int) (offset_ >> kSegBits); 16 | } 17 | 18 | d4_inline t4_i32 c4_Column::fSegOffset(int index_) 19 | { 20 | return (t4_i32) index_ << kSegBits; 21 | } 22 | 23 | d4_inline int c4_Column::fSegRest(t4_i32 offset_) 24 | { 25 | return ((int) offset_ & kSegMask); 26 | } 27 | 28 | d4_inline c4_Persist* c4_Column::Persist() const 29 | { 30 | return _persist; 31 | } 32 | 33 | d4_inline t4_i32 c4_Column::Position() const 34 | { 35 | return _position; 36 | } 37 | 38 | d4_inline t4_i32 c4_Column::ColSize() const 39 | { 40 | return _size; 41 | } 42 | 43 | d4_inline bool c4_Column::IsDirty() const 44 | { 45 | return _dirty; 46 | } 47 | 48 | d4_inline void c4_Column::SetBuffer(t4_i32 length_) 49 | { 50 | SetLocation(0, length_); 51 | _dirty = true; 52 | } 53 | 54 | d4_inline const t4_byte* c4_Column::LoadNow(t4_i32 offset_) 55 | { 56 | if (_segments.GetSize() == 0) 57 | SetupSegments(); 58 | 59 | if (offset_ >= _gap) 60 | offset_ += _slack; 61 | 62 | t4_byte* ptr = (t4_byte*) _segments.GetAt(fSegIndex(offset_)); 63 | return ptr + fSegRest(offset_); 64 | } 65 | 66 | ///////////////////////////////////////////////////////////////////////////// 67 | // c4_ColIter 68 | 69 | d4_inline c4_ColIter::c4_ColIter (c4_Column& col_, t4_i32 offset_, t4_i32 limit_) 70 | : _column (col_), _limit (limit_), _pos (offset_), _len (0), _ptr (0) 71 | { 72 | } 73 | 74 | d4_inline const t4_byte* c4_ColIter::BufLoad() const 75 | { 76 | return _ptr; 77 | } 78 | 79 | d4_inline t4_byte* c4_ColIter::BufSave() 80 | { 81 | return _column.CopyNow(_pos); 82 | } 83 | 84 | d4_inline int c4_ColIter::BufLen() const 85 | { 86 | return _len; 87 | } 88 | 89 | ///////////////////////////////////////////////////////////////////////////// 90 | -------------------------------------------------------------------------------- /src/std.cpp: -------------------------------------------------------------------------------- 1 | // std.cpp -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Implementation of STL-based strings and containers 7 | */ 8 | 9 | #include "header.h" 10 | 11 | #if q4_STD // until end of source 12 | ///////////////////////////////////////////////////////////////////////////// 13 | 14 | #include "column.h" // c4_ColCache 15 | 16 | #if !q4_INLINE 17 | static char _mk4stdInl[] = "mk4str.inl"; 18 | #include "mk4str.inl" 19 | #endif 20 | 21 | #if !q4_NO_NS 22 | using namespace std; 23 | #endif 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // Implemented in this file 27 | 28 | class c4_String; 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | 32 | #if !q4_MSVC && !q4_WATC 33 | 34 | // MS C/C++ has this handy stricmp: a case-insensitive version of strcmp 35 | // This version only works with 7-bit ASCII characters 0x00 through 0x7F 36 | 37 | static int stricmp(const char *p1, const char *p2) { 38 | int c1, c2; 39 | 40 | #ifdef d4_USE_UNOPTIMIZED_CODE 41 | do { 42 | c1 = tolower(*p1++); 43 | c2 = tolower(*p2++); 44 | } while (c1 != 0 && c1 == c2); 45 | #else 46 | do { 47 | c1 = *p1++; 48 | c2 = *p2++; 49 | } while (c1 != 0 && (c1 == c2 || tolower(c1) == tolower(c2))); 50 | 51 | c1 = tolower(c1); 52 | c2 = tolower(c2); 53 | #endif 54 | 55 | return c1 - c2; 56 | } 57 | 58 | #endif 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // c4_String 62 | 63 | c4_String c4_String::Mid(int nFirst_, int nCount_)const { 64 | int n = length(); 65 | if (nFirst_ > n) 66 | nFirst_ = n; 67 | if (nFirst_ + nCount_ > n) 68 | nCount_ = n - nFirst_; 69 | 70 | return substr(nFirst_, nCount_); 71 | } 72 | 73 | int c4_String::CompareNoCase(const char *str_)const { 74 | // this is not very "standard library-ish" ... 75 | return *(const string*)this == str_ ? 0 : stricmp(c_str(), str_); 76 | } 77 | 78 | ///////////////////////////////////////////////////////////////////////////// 79 | #endif // q4_STD 80 | -------------------------------------------------------------------------------- /doc/api/c4_IntRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_IntRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set integer values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_IntRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | t4_i32 () const; 44 | 45 | 46 |
47 | Get the value as long integer
48 |
53 | c4_IntRef& 54 | 56 | 57 | operator= (t4_i32); 58 | 59 | 60 |
61 | Set the value to the specified long integer
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /tcl/tests/initests.tcl: -------------------------------------------------------------------------------- 1 | # common test setup script 2 | 3 | if {[info exists testsInited]} return 4 | 5 | package require Tcl 8.4 6 | 7 | if {[lsearch [namespace children] ::tcltest] == -1} { 8 | package require tcltest 2.2 9 | namespace import tcltest::* 10 | } 11 | 12 | singleProcess true ;# run without forking 13 | 14 | testsDirectory [file dirname [info script]] 15 | 16 | # if run from the tests directory, move one level up 17 | if {[pwd] eq [testsDirectory]} { 18 | cd .. 19 | } 20 | 21 | temporaryDirectory [pwd] 22 | #workingDirectory [file dirname [testsDirectory]] 23 | 24 | # TextMate support on Mac OS X: run make before running any test from editor 25 | if {[info exists env(TM_FILENAME)]} { 26 | if {[catch { exec make } msg]} { 27 | puts stderr $msg 28 | exit 1 29 | } 30 | } 31 | 32 | proc readfile {filename} { 33 | set fd [open $filename] 34 | set data [read $fd] 35 | close $fd 36 | return $data 37 | } 38 | 39 | # extract version number from pkgIndex.tcl 40 | regexp {ifneeded Mk4tcl\s(\S+)\s} [readfile [workingDirectory]/pkgIndex.tcl] - version 41 | unset - 42 | 43 | # make sure the pkgIndex.tcl is found 44 | if {[lsearch $auto_path [workingDirectory]] < 0} { 45 | set auto_path [linsert $auto_path 0 [workingDirectory]] 46 | } 47 | 48 | testConstraint 64bit [expr {$tcl_platform(wordSize) == 8}] 49 | testConstraint bigendian [expr {$tcl_platform(byteOrder) eq "bigEndian"}] 50 | testConstraint tcl$tcl_version 1 51 | 52 | proc assert {ok} { 53 | if {!$ok} { 54 | return -code error "assertion failed" 55 | } 56 | } 57 | 58 | proc equal {expected result} { 59 | if {$expected ne $result} { 60 | return -code error [list expected $expected got $result] 61 | } 62 | } 63 | 64 | proc match {pattern result} { 65 | if {![string match $pattern $result]} { 66 | return -code error [list pattern $pattern does not match $result] 67 | } 68 | } 69 | 70 | set testsInited 1 71 | -------------------------------------------------------------------------------- /doc/api/c4_StringRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_StringRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set string values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_StringRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator const 40 | 42 | 43 | char* () const; 44 | 45 | 46 |
47 | Get the value as string
48 |
53 | c4_StringRef& 54 | 56 | 57 | operator= (const char*); 58 | 59 | 60 |
61 | Set the value to the specified string
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /include/mk4io.h: -------------------------------------------------------------------------------- 1 | // mk4io.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Declaration of the file stream and strategy classes. 7 | */ 8 | 9 | #ifndef __MK4IO_H__ 10 | #define __MK4IO_H__ 11 | 12 | #include 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | /// A file stream can be used to serialize using the stdio library. 16 | 17 | class c4_FileStream: public c4_Stream { 18 | public: 19 | c4_FileStream(FILE *stream_, bool owned_ = false); 20 | virtual ~c4_FileStream(); 21 | 22 | virtual int Read(void *buffer_, int length_); 23 | virtual bool Write(const void *buffer_, int length_); 24 | 25 | FILE *_stream; 26 | bool _owned; 27 | }; 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | /// A file strategy encapsulates code dealing with all file I/O. 31 | 32 | class c4_FileStrategy: public c4_Strategy { 33 | public: 34 | /// Construct a new strategy object 35 | c4_FileStrategy(FILE *file_ = 0); 36 | virtual ~c4_FileStrategy(); 37 | 38 | /// True if we can do I/O with this object 39 | virtual bool IsValid()const; 40 | /// Open a data file by name 41 | virtual bool DataOpen(const char *fileName_, int mode_); 42 | /// Read a number of bytes 43 | virtual int DataRead(t4_i32 pos_, void *buffer_, int length_); 44 | /// Write a number of bytes, return true if successful 45 | virtual void DataWrite(t4_i32 pos_, const void *buffer_, int length_); 46 | /// Flush and truncate file 47 | virtual void DataCommit(t4_i32 newSize_); 48 | /// Support for memory-mapped files 49 | virtual void ResetFileMapping(); 50 | /// Report total size of the datafile 51 | virtual t4_i32 FileSize(); 52 | /// Return a good value to use as fresh generation counter 53 | virtual t4_i32 FreshGeneration(); 54 | 55 | protected: 56 | /// Pointer to file object 57 | FILE *_file; 58 | /// Pointer to same file object, if it must be deleted at end 59 | FILE *_cleanup; 60 | }; 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | 64 | #endif // __MK4IO_H__ 65 | -------------------------------------------------------------------------------- /doc/api/c4_FloatRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_FloatRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set floating point values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_FloatRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | double () const; 44 | 45 | 46 |
47 | Get the value as floating point
48 |
53 | c4_FloatRef& 54 | 56 | 57 | operator= (double); 58 | 59 | 60 |
61 | Set the value to the specified floating point
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /doc/api/c4_DoubleRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_DoubleRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set double precision values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_DoubleRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | double () const; 44 | 45 | 46 |
47 | Get the value as floating point
48 |
53 | c4_DoubleRef& 54 | 56 | 57 | operator= (double); 58 | 59 | 60 |
61 | Set the value to the specified floating point
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /doc/api/c4_ViewRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_ViewRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set view values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_ViewRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | c4_View () const; 44 | 45 | 46 |
47 | Get the value as view
48 |
53 | c4_ViewRef& 54 | 56 | 57 | operator= (const c4_View&); 58 | 59 | 60 |
61 | Set the value to the specified view
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /python/scxx/PWOImp.cpp: -------------------------------------------------------------------------------- 1 | /******************************************** 2 | copyright 1999 McMillan Enterprises, Inc. 3 | www.mcmillan-inc.com 4 | *********************************************/ 5 | #include "PWOSequence.h" 6 | #include "PWOMSequence.h" 7 | #include "PWOMapping.h" 8 | #include "PWOCallable.h" 9 | 10 | // dummy exception singleton 11 | const PWDException PWDPyExceptionObj; 12 | const PWDException &PWDPyException = PWDPyExceptionObj; 13 | 14 | // incref new owner, and decref old owner, and adjust to new owner 15 | void PWOBase::GrabRef(PyObject *newObj) { 16 | // be careful to incref before decref if old is same as new 17 | Py_XINCREF(newObj); 18 | Py_XDECREF(_own); 19 | _own = _obj = newObj; 20 | } 21 | 22 | PWOTuple::PWOTuple(const PWOList &list): PWOSequence(PyList_AsTuple(list)) { 23 | LoseRef(_obj); 24 | } 25 | 26 | PWOListMmbr::PWOListMmbr(PyObject *obj, PWOList &parent, int ndx): PWOBase(obj), 27 | _parent(parent), _ndx(ndx){} 28 | 29 | PWOListMmbr &PWOListMmbr::operator = (const PWOBase &other) { 30 | GrabRef(other); 31 | //Py_XINCREF(_obj); // this one is for setItem to steal 32 | _parent.setItem(_ndx, *this); 33 | return *this; 34 | } 35 | 36 | PWOMappingMmbr &PWOMappingMmbr::operator = (const PWOBase &other) { 37 | GrabRef(other); 38 | _parent.setItem(_key, *this); 39 | return *this; 40 | } 41 | 42 | PWOBase PWOCallable::call()const { 43 | static PWOTuple _empty; 44 | PyObject *rslt = PyEval_CallObjectWithKeywords(*this, _empty, NULL); 45 | if (rslt == 0) 46 | throw PWDPyException; 47 | return rslt; 48 | } 49 | 50 | PWOBase PWOCallable::call(PWOTuple &args)const { 51 | PyObject *rslt = PyEval_CallObjectWithKeywords(*this, args, NULL); 52 | if (rslt == 0) 53 | throw PWDPyException; 54 | return rslt; 55 | } 56 | 57 | PWOBase PWOCallable::call(PWOTuple &args, PWOMapping &kws)const { 58 | PyObject *rslt = PyEval_CallObjectWithKeywords(*this, args, kws); 59 | if (rslt == 0) 60 | throw PWDPyException; 61 | return rslt; 62 | } 63 | 64 | void Fail(PyObject *exc, const char *msg) { 65 | PyErr_SetString(exc, msg); 66 | throw PWDPyException; 67 | } 68 | 69 | void FailIfPyErr() { 70 | PyObject *exc = PyErr_Occurred(); 71 | if (exc != NULL) 72 | throw PWDPyException; 73 | } 74 | -------------------------------------------------------------------------------- /python/test/test_inttypes.py: -------------------------------------------------------------------------------- 1 | # test_inttypes.py -- Test Metakit Python bindings for integral types 2 | # $Id$ 3 | # This is part of Metakit, see http://www.equi4.com/metakit/ 4 | 5 | from mktestsupport import * 6 | 7 | v = ViewTester('test[intf:I,longf:L]') 8 | 9 | # defaults 10 | v.insert(intf=0, longf=0) 11 | 12 | # int field 13 | v.insert(intf=1, longf=0) 14 | v.insert(intf=-5, longf=0) 15 | v.insert(intf=MAXINT, longf=0) 16 | v.insert(intf=MININT, longf=0) 17 | v.reject(int_long_error, intf=MAXINT + 1, longf=0) 18 | v.reject(int_long_error, intf=MININT - 1, longf=0) 19 | if int_long_integrated: 20 | v.reject(OverflowError, intf=MAXLONGLONG, longf=0) 21 | v.reject(OverflowError, intf=MINLONGLONG, longf=0) 22 | 23 | # long field 24 | v.insert(intf=0, longf=-1L) 25 | v.insert(intf=0, longf=5L) 26 | v.insert(intf=0, longf=MAXLONGLONG) 27 | v.insert(intf=0, longf=MINLONGLONG) 28 | v.reject(ValueError, intf=0, longf=MAXULONGLONG) 29 | v.reject(ValueError, intf=0, longf=MAXLONGLONG + 1) 30 | v.reject(ValueError, intf=0, longf=MAXULONGLONG) 31 | v.reject(ValueError, intf=0, longf=MINLONGLONG - 1) 32 | 33 | # mixed valid int/long 34 | v.insert(intf=1, longf=2) 35 | v.insert(intf=-5, longf=-2**30) 36 | 37 | # implicit conversion to int 38 | v.insert(intf=14L, longf=0) 39 | v.insert(intf=-30L, longf=0) 40 | v.insert(intf=45.0, longf=0) 41 | v.insert(intf=21.4, longf=0) 42 | v.reject(int_long_error, intf=float(MAXINT + 1), longf=0) 43 | v.reject(int_long_error, intf=float(MININT - 1), longf=0) 44 | v.reject(TypeError, intf='215', longf=0) 45 | v.reject(TypeError, intf='-318.19', longf=0) 46 | v.reject(TypeError, intf=str(MAXINT + 1), longf=0) 47 | 48 | # implicit conversion to long 49 | v.insert(intf=0, longf=278) 50 | v.insert(intf=0, longf=-213) 51 | v.insert(intf=0, longf=95.0) 52 | v.insert(intf=0, longf=27.3) 53 | v.reject(ValueError, intf=0, longf=float(2 * MAXLONGLONG)) 54 | v.reject(ValueError, intf=0, longf=float(2 * MINLONGLONG)) 55 | v.reject(TypeError, intf=0, longf=str(MAXLONGLONG)) 56 | v.reject(TypeError, intf=0, longf=str(MINLONGLONG)) 57 | v.reject(TypeError, intf=0, longf='-21.39') 58 | v.reject(TypeError, intf=0, longf=str(MAXULONGLONG)) 59 | 60 | # XXX should repeat with assignment instead of appending 61 | # XXX test v.select() 62 | 63 | v.finished() 64 | -------------------------------------------------------------------------------- /doc/api/doc_myio.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - MyIO 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - MyIO


10 | 11 |

This example demonstrates how to setup low-level datafile encryption with Metakit.

12 | 13 |

What it does: MyIO creates a simple view on disk, and then loads it back in. 14 | The data on disk is stored in a simple encrypted format. 15 |

16 | 17 |

What it illustrates: This sample program shows how to customize Metakit 18 | via its "Strategy" object.

Just to show it can be done, MyIO also disables all 19 | flush calls issued by Metakit. This slightly reduces the fail-safe properties but 20 | improves performance with frequent commits on systems which implement caching using 21 | "lazy writes" (such as Windows).

The source code of this 22 | application can be compiled for 32-bit Windows (as console application) 23 | as well as for 16-bit DOS targets. MyIO has no practical use, but it contains a 24 | "CEncryptStrategy" class which you can adapt to suit your purposes.

25 | 26 |

How to use it: When you launch MYIO.EXE, it creates a datafile called "secret.dat", 27 | saves some string data to it, then reads that back and displays these strings. 28 |

Note that due to the encrypted 29 | storage format you can NOT use the Metakit dump utility to examine the contents of the data file. 30 | You can of course build your own version of it, since all the necessary source code is included. 31 | 32 |

Known problems: None.

33 | 34 |

Files in EXAMPLES\MYIO:

35 | 36 |

MYIO.CPP - MyIO main program 37 |
MYIO.MAK, MYIO.MDP - MSVC 4.2 project makefiles for Win32 38 |
MYIO16.MAK - MSVC 1.52 project makefile 39 | 40 | 41 |


42 | || 43 |   Roadmap 44 |   Class Index 45 |   Sample Index 46 |   || 47 |   Introduction 48 |   Tips and Tricks 49 |   || 50 | 51 |
52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/api/c4_BytesRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_BytesRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set binary object values.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_BytesRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | c4_Bytes () const; 44 | 45 | 46 |
47 | Get the value as binary object
48 |
53 | c4_BytesRef& 54 | 56 | 57 | operator= (const c4_Bytes&); 58 | 59 | 60 |
61 | Set the value to the specified binary object
62 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |

73 | 74 | 75 | 76 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 96 | 97 | 98 |
77 | Header file 78 | 80 | "mk4.h"   --   Dec 9, 1999 81 |
89 | Derived from 90 | 92 | 93 | c4_Reference 94 | 95 |
99 | 100 |
101 | 102 |
103 | -------------------------------------------------------------------------------- /demos/bigdemo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * A demo that creates a file with a large number of rows 3 | * and shows how to use blocked ordered views to ensure efficient 4 | * fast access. 5 | * 6 | * usage: bigdemo -create NUMROWS FILENAME 7 | * bigdemo -check ROWNUM FILENAME 8 | * 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | static void 17 | randfill(char *data, size_t len) 18 | { 19 | for (size_t n = 0; n < len; ++n) 20 | *data++ = char(rand() * 26 + 95); 21 | } 22 | 23 | int 24 | main(int argc, char *argv[]) 25 | { 26 | if (argc != 4) { 27 | printf("usage: bigdemo -create|-check count filename\n"); 28 | return 0; 29 | } 30 | 31 | int count = strtol(argv[2], NULL, 0); 32 | const char *filename = argv[3]; 33 | 34 | // Access the file, declare the layout and open a view 35 | c4_Storage storage(filename, true); 36 | c4_View vRoot = storage.GetAs("items[_B[name:S,data:B]]"); 37 | // Open the blocked version of this base view. 38 | c4_View vStuff = vRoot.Blocked(); 39 | 40 | // Declare our property accessors. 41 | c4_StringProp rName("name"); 42 | c4_BytesProp rData("data"); 43 | 44 | if (strcmp("-create", argv[1]) == 0) { 45 | 46 | // Create some data to pad out the file. 47 | char name[34]; 48 | char garbage[1024]; 49 | randfill(garbage, sizeof(garbage)); 50 | c4_Bytes data(garbage, sizeof(garbage)); 51 | 52 | // Pre-size the view to speed up the creation 53 | vStuff.SetSize(count); 54 | for (int n = 0; n < count; ++n) { 55 | sprintf_s(name, sizeof(name), "item%d", n); 56 | c4_RowRef row = vStuff[n]; 57 | rData(row) = data; 58 | rName(row) = name; 59 | } 60 | 61 | // Finally actually write this to a file. 62 | storage.Commit(); 63 | 64 | } else { 65 | 66 | char name[34]; 67 | sprintf_s(name, sizeof(name), "item%d", count); 68 | 69 | int row = vStuff.Find(rName[name]); 70 | printf("looking for '%s' returned row %d\n", name, row); 71 | if (row == -1) 72 | printf("error\n"); 73 | else 74 | printf("found '%s'\n", (const char *)rName(vStuff[row])); 75 | 76 | } 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /win/msvc70/mkdist.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 21 | 36 | 38 | 47 | 50 | 52 | 54 | 56 | 60 | 62 | 64 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /doc/api/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit Class Index 3 | 4 | 5 | 6 |
7 | Roadmap 8 |
Class Index 9 |
Sample Index 10 |
Tips and Tricks 11 |
12 | 13 |


14 | 15 | 16 | 17 |
c4_Bytes 18 | 19 |
c4_BytesProp 20 | 21 |
c4_BytesRef 22 | 23 |
c4_Cursor 24 | 25 |
c4_CustomViewer 26 | 27 |
c4_DoubleProp 28 | 29 |
c4_DoubleRef 30 | 31 |
c4_FloatProp 32 | 33 |
c4_FloatRef 34 | 35 |
c4_IntProp 36 | 37 |
c4_IntRef 38 | 39 |
c4_MemoProp 40 | 41 |
c4_MemoRef 42 | 43 |
c4_Property 44 | 45 |
c4_Reference 46 | 47 |
c4_Row 48 | 49 |
c4_RowRef 50 | 51 |
c4_Sequence 52 | 53 |
c4_Storage 54 | 55 |
c4_Strategy 56 | 57 |
c4_Stream 58 | 59 |
c4_StringProp 60 | 61 |
c4_StringRef 62 | 63 |
c4_View 64 | 65 |
c4_ViewProp 66 | 67 |
c4_ViewRef 68 | 69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /win/msvc60/mkdist.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="mkdist" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=mkdist - Win32 Release 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "mkdist.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "mkdist.mak" CFG="mkdist - Win32 Release" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "mkdist - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE 22 | 23 | # Begin Project 24 | # PROP AllowPerConfigDependencies 0 25 | # PROP Scc_ProjName "" 26 | # PROP Scc_LocalPath "" 27 | CPP=cl.exe 28 | RSC=rc.exe 29 | # PROP BASE Use_MFC 0 30 | # PROP BASE Use_Debug_Libraries 0 31 | # PROP BASE Output_Dir "Release" 32 | # PROP BASE Intermediate_Dir "Release" 33 | # PROP BASE Target_Dir "" 34 | # PROP Use_MFC 0 35 | # PROP Use_Debug_Libraries 0 36 | # PROP Output_Dir "..\..\builds\msvc60\mkdist\Release" 37 | # PROP Intermediate_Dir "..\..\builds\msvc60\mkdist\Release" 38 | # PROP Ignore_Export_Lib 0 39 | # PROP Target_Dir "" 40 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 41 | # ADD CPP /nologo /MD /W3 /GX /O2 /Ob2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c 42 | # SUBTRACT CPP /YX 43 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 44 | # ADD RSC /l 0x409 /d "NDEBUG" 45 | BSC32=bscmake.exe 46 | # ADD BASE BSC32 /nologo 47 | # ADD BSC32 /nologo 48 | LINK32=link.exe 49 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 50 | # ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\builds\mkdist.exe" 51 | # Begin Target 52 | 53 | # Name "mkdist - Win32 Release" 54 | # Begin Source File 55 | 56 | SOURCE=..\..\demos\demo.cpp 57 | # End Source File 58 | # End Target 59 | # End Project 60 | -------------------------------------------------------------------------------- /python/PyProperty.cpp: -------------------------------------------------------------------------------- 1 | // PyProperty.cpp -- 2 | // $Id$ 3 | // This is part of MetaKit, the homepage is http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // Property class implementation 7 | 8 | #include "PyProperty.h" 9 | #include 10 | #include 11 | 12 | static PyMethodDef PropertyMethods[] = { 13 | { 14 | 0, 0, 0, 0 15 | } 16 | }; 17 | 18 | static void PyProperty_dealloc(PyProperty *o) { 19 | delete o; 20 | } 21 | 22 | static int PyProperty_print(PyProperty *o, FILE *f, int) { 23 | fprintf(f, "Property('%c', '%s')", o->Type(), o->Name()); 24 | return 0; 25 | } 26 | 27 | static PyObject *PyProperty_getattr(PyProperty *o, char *nm) { 28 | try { 29 | if (nm[0] == 'n' && strcmp(nm, "name") == 0) { 30 | PWOString rslt(o->Name()); 31 | return rslt.disOwn(); 32 | } 33 | if (nm[0] == 't' && strcmp(nm, "type") == 0) { 34 | char s = o->Type(); 35 | PWOString rslt(&s, 1); 36 | return rslt.disOwn(); 37 | } 38 | if (nm[0] == 'i' && strcmp(nm, "id") == 0) { 39 | PWONumber rslt(o->GetId()); 40 | return rslt.disOwn(); 41 | } 42 | return Py_FindMethod(PropertyMethods, o, nm); 43 | } catch (...) { 44 | return 0; 45 | } 46 | } 47 | 48 | static int PyProperty_compare(PyProperty *o, PyObject *ob) { 49 | PyProperty *other; 50 | int myid, hisid; 51 | try { 52 | if (!PyProperty_Check(ob)) 53 | return - 1; 54 | other = (PyProperty*)ob; 55 | myid = o->GetId(); 56 | hisid = other->GetId(); 57 | if (myid < hisid) 58 | return - 1; 59 | else if (myid == hisid) 60 | return 0; 61 | return 1; 62 | } catch (...) { 63 | return - 1; 64 | } 65 | } 66 | 67 | PyTypeObject PyPropertytype = { 68 | PyObject_HEAD_INIT(&PyType_Type)0, "PyProperty", sizeof(PyProperty), 0, 69 | (destructor)PyProperty_dealloc, /*tp_dealloc*/ 70 | (printfunc)PyProperty_print, /*tp_print*/ 71 | (getattrfunc)PyProperty_getattr, /*tp_getattr*/ 72 | 0, /*tp_setattr*/ 73 | (cmpfunc)PyProperty_compare, /*tp_compare*/ 74 | 0, /*tp_repr*/ 75 | 0, /*tp_as_number*/ 76 | 0, /*tp_as_sequence*/ 77 | 0, /*tp_as_mapping*/ 78 | }; 79 | 80 | PyObject *PyProperty_new(PyObject *o, PyObject *_args) { 81 | try { 82 | PWOSequence args(_args); 83 | PWOString typ(args[0]); 84 | PWOString nam(args[1]); 85 | return new PyProperty(*(const char*)typ, nam); 86 | } catch (...) { 87 | return 0; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /python/PyView.h: -------------------------------------------------------------------------------- 1 | // PyView.h -- 2 | // $Id$ 3 | // This is part of MetaKit, see http://www.equi4.com/metakit.html 4 | // Copyright (C) 1999-2004 Gordon McMillan and Jean-Claude Wippler. 5 | // 6 | // View class header 7 | 8 | #if !defined INCLUDE_PYVIEW_H 9 | #define INCLUDE_PYVIEW_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "PyHead.h" 16 | 17 | #define PyView_Check(v) ((v)->ob_type==&PyViewtype) 18 | #define PyViewer_Check(v) ((v)->ob_type==&PyViewertype) 19 | #define PyROViewer_Check(v) ((v)->ob_type==&PyROViewertype) 20 | #define PyGenericView_Check(v) (PyView_Check(v) || PyViewer_Check(v) || \ 21 | PyROViewer_Check(v)) 22 | 23 | class PyView; 24 | class PyRowRef; 25 | 26 | extern PyTypeObject PyViewtype; 27 | extern PyTypeObject PyViewertype; 28 | extern PyTypeObject PyROViewertype; 29 | 30 | #define BASE 0 //0000 31 | #define MVIEWER 4 //0100 32 | #define RWVIEWER 5 //0101 33 | #define NOTIFIABLE 1 //0001 34 | #define FINALNOTIFIABLE 9 //1001 35 | #define ROVIEWER 7 //0111 36 | #define IMMUTABLEROWS 2 37 | 38 | class PyView: public PyHead, public c4_View { 39 | PyView *_base; 40 | int _state; 41 | public: 42 | PyView(); 43 | PyView(const c4_View &o, PyView *owner = 0, int state = BASE); 44 | ~PyView(){} 45 | void insertAt(int i, PyObject *o); 46 | PyRowRef *getItem(int i); 47 | PyView *getSlice(int s, int e); 48 | int setItemRow(int i, const c4_RowRef &v) { 49 | if (i < 0) 50 | i += GetSize(); 51 | if (i > GetSize() || i < 0) 52 | Fail(PyExc_IndexError, "Index out of range"); 53 | SetAt(i, v); 54 | return 0; 55 | }; 56 | int setItem(int i, PyObject *v); 57 | void addProperties(const PWOSequence &lst); 58 | int setSlice(int s, int e, const PWOSequence &lst); 59 | PyObject *structure(); 60 | void makeRow(c4_Row &temp, PyObject *o, bool useDefaults = true); 61 | void makeRowFromDict(c4_Row &temp, PyObject *o, bool useDefaults = true); 62 | void map(const PWOCallable &func); 63 | void map(const PWOCallable &func, const PyView &subset); 64 | PyView *filter(const PWOCallable &func); 65 | PyObject *reduce(const PWOCallable &func, PWONumber &start); 66 | void remove(const PyView &indices); 67 | PyView *indices(const PyView &subset); 68 | int computeState(int targetstate); 69 | PyObject *properties(); 70 | }; 71 | 72 | PyObject *PyView_new(PyObject *o, PyObject *_args); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /doc/api/c4_RowRef_info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Row references are created when dereferencing a c4_Cursor or when 6 | indexing an element of a c4_View. Assignment will change the 7 | corresponding item. Rows (objects of type c4_Row) are a special 8 | case of row references, consisting of a view with exactly one item. 9 |

10 | 11 | Internally, row references are very similar to cursors, in fact they are 12 | little more than a wrapper around them. The essential difference is one 13 | of semantics: comparing row references compares contents, copying row 14 | references copies the contents, whereas cursor comparison and copying 15 | deals with the pointer to the row, not its contents. 16 | 17 |

18 | 19 | 20 | 21 |


22 | 23 |
24 | 25 | 26 |
27 | 28 | c4_View 29 | Container () const; 30 | 31 |
32 | 33 | 34 | Return the underlying container view 35 |

36 | 37 | 38 | 39 |

40 | 41 | c4_Cursor 42 | _cursor; 43 | 44 |
45 | 46 | 47 | 48 |

49 | 50 | 51 | 52 |

53 | 54 | 55 | c4_RowRef (c4_Cursor); 56 | 57 |
58 | 59 | 60 | Constructor, not for general use 61 |

62 | 63 | 64 | 65 |

66 | 67 | c4_Cursor 68 | operator& () const; 69 | 70 |
71 | 72 | 73 | Return the cursor associated to this row 74 |

75 | 76 | 77 | 78 |

79 | 80 | c4_RowRef 81 | operator= (const c4_RowRef& row_); 82 | 83 |
84 | 85 | 86 | Assign the value of another row to this one 87 |

88 | 89 | 90 |

91 | 92 |
93 | class 94 | c4_RowRef 95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /doc/api/c4_CustomViewer_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_CustomViewer 7 |

8 | 9 |
10 | Abstract base class for definition of custom views.

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 | 66 | 69 | 77 | 78 | 79 |
19 | Public members 20 |
25 | virtual 26 | 28 | 29 | ~c4_CustomViewer (); 30 | 31 | 32 |
33 | Destructor
34 |
39 | virtual c4_View 40 | 42 | 43 | GetTemplate (); 44 | 45 | 46 |
47 | Return the structure of this view (initialization, called once)
48 |
53 | virtual int 54 | 56 | 57 | GetSize (); 58 | 59 | 60 |
61 | Return the number of rows in this view
62 |
67 | virtual bool 68 | 70 | 71 | GetItem (int row_, int col_, c4_Bytes& buf_); 72 | 73 | 74 |
75 | Fetch one data item, return it as a generic data value
76 |
80 | 81 | 82 | 83 | 84 | 85 | 88 | 89 | 90 | 91 | 94 | 99 | 100 | 101 |
86 | Protected members 87 |
92 | 93 | 95 | 96 | c4_CustomViewer (); 97 |
Constructor, must be overriden in derived class
98 |
102 | 103 | 104 | 105 | 106 |

107 | 108 | 109 | 110 | 113 | 116 | 117 | 118 | 119 | 120 | 121 |
111 | Header file 112 | 114 | "mk4.h"   --   Dec 9, 1999 115 |
122 | 123 |
124 | 125 |
126 | -------------------------------------------------------------------------------- /python/metakit.py: -------------------------------------------------------------------------------- 1 | """ 2 | metakit.py -- Utility code for the Python interface to Metakit 3 | $Id$ 4 | This is part of Metakit, see http://www.equi4.com/metakit.html 5 | 6 | This wraps the raw Mk4py compiled extension interface. 7 | To use Metakit through this interface, simply do: 8 | import metakit 9 | After that, things like metakit.storage(...) are available, 10 | as well as utilities defined below. This assumes that both 11 | both metakit.py and Mk4py.{dll,so} can be found by Python. 12 | """ 13 | 14 | _oldname = __name__ 15 | __name__ = "metakit" 16 | __version__ = "2.4.9.7" 17 | __description__ = "Python bindings to the Metakit database library" 18 | __author__ = "Gordon McMillan / Jean-Claude Wippler" 19 | __email__ = "jcw@equi4.com" 20 | __url__ = "http://www.equi4.com/metakit/python.html" 21 | __license__ = "X/MIT style, see: http://www.equi4.com/mklicense.html" 22 | from Mk4py import * 23 | import string 24 | 25 | def dump(view, title=None): 26 | """pretty printer for MK views""" 27 | 28 | widths = [] 29 | cols = [] 30 | justs = [] 31 | 32 | props = view.structure() 33 | for prop in props: 34 | widths.append(len(prop.name)) 35 | cols.append([None]) 36 | if prop.type in ('I','F','D','V'): 37 | justs.append(string.rjust) 38 | else: 39 | justs.append(string.ljust) 40 | 41 | for row in view: 42 | for c in range(len(props)): 43 | attr = getattr(row, props[c].name, None) 44 | if type(attr) is type(view): 45 | text = '%d rows' % len(attr) 46 | else: 47 | text = str(attr) 48 | if len(text) > 20: 49 | text = text[0:17] + '...' 50 | widths[c] = max(widths[c],len(text)) 51 | cols[c].append(text) 52 | 53 | if title: print title 54 | 55 | for c in range(len(props)): 56 | cols[c][0] = widths[c] * '-' 57 | cols[c].append(cols[c][0]) 58 | print '', string.ljust(props[c].name, widths[c]), 59 | print 60 | 61 | for r in xrange(len(view)+2): 62 | for c in range(len(props)): 63 | print '', justs[c](cols[c][r], widths[c]), 64 | print 65 | 66 | print " Total: %d rows" % len(view) 67 | 68 | if _oldname == '__main__': 69 | db = storage() 70 | f = db.getas('frequents[drinker,bar,perweek:I]') 71 | s = db.getas('serves[bar,beer,quantity:I]') 72 | 73 | f.append(drinker='adam', bar='lolas', perweek=1) 74 | f.append(drinker='woody', bar='cheers', perweek=5) 75 | f.append(drinker='sam', bar='cheers', perweek=5) 76 | f.append(drinker='lola', bar='lolas', perweek=6) 77 | 78 | s.append(bar='cheers', beer='bud', quantity=500) 79 | s.append(bar='cheers', beer='samaddams', quantity=255) 80 | s.append(bar='lolas', beer='mickies', quantity=1515) 81 | 82 | dump(f, 'frequents:') 83 | dump(s, 'serves:') 84 | dump(f.join(s, s.bar), 'join on "bar":') 85 | -------------------------------------------------------------------------------- /doc/api/c4_CustomViewer_info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | A custom view is a view which can be accessed like any other view, using 6 | row and property operations, but which is fully managed by a customized 7 | "viewer" class. The viewer will eventually handle all requests for the 8 | view, such as defining its structure and size, as well as providing the 9 | actual data values when requested. 10 |

11 | 12 | Custom views are read-only in this version, and cannot propagate changes. 13 |

14 | 15 | To implement a custom view, you must derive your viewer from this base 16 | class and define each of the virtual members. Then create a new object 17 | of this type on the heap and pass it to the c4_View constructor. Your 18 | viewer will automatically be destroyed when the last reference to its 19 | view goes away. See the DBF2MK sample code for an example of a viewer. 20 | 21 |

22 | 23 | 24 | 25 |


26 | 27 |
28 | 29 | 30 |
31 | 32 | virtual bool 33 | GetItem (int row_, int col_, c4_Bytes& buf_); 34 | 35 |
36 | 37 | 38 | Fetch one data item, return it as a generic data value 39 |

40 | 41 | 42 | 43 |

44 | 45 | virtual int 46 | GetSize (); 47 | 48 |
49 | 50 | 51 | Return the number of rows in this view 52 |

53 | 54 | 55 | 56 |

57 | 58 | virtual c4_View 59 | GetTemplate (); 60 | 61 |
62 | 63 | 64 | Return the structure of this view (initialization, called once) 65 |

66 | 67 | 68 | 69 |

70 | 71 | 72 | c4_CustomViewer (); 73 | 74 |
75 | 76 | 77 | Constructor, must be overriden in derived class 78 |

79 | 80 | 81 | 82 |

83 | 84 | virtual 85 | ~c4_CustomViewer (); 86 | 87 |
88 | 89 | 90 | Destructor 91 |

92 | 93 | 94 |

95 | 96 |
97 | class 98 | c4_CustomViewer 99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /tcl/tclconfig/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # install - install a program, script, or datafile 5 | # This comes from X11R5; it is not part of GNU. 6 | # 7 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ 8 | # 9 | # This script is compatible with the BSD install script, but was written 10 | # from scratch. 11 | # 12 | 13 | 14 | # set DOITPROG to echo to test this script 15 | 16 | # Don't use :- since 4.3BSD and earlier shells don't like it. 17 | doit="${DOITPROG-}" 18 | 19 | 20 | # put in absolute paths if you don't have them in your path; or use env. vars. 21 | 22 | mvprog="${MVPROG-mv}" 23 | cpprog="${CPPROG-cp}" 24 | chmodprog="${CHMODPROG-chmod}" 25 | chownprog="${CHOWNPROG-chown}" 26 | chgrpprog="${CHGRPPROG-chgrp}" 27 | stripprog="${STRIPPROG-strip}" 28 | rmprog="${RMPROG-rm}" 29 | 30 | instcmd="$mvprog" 31 | chmodcmd="" 32 | chowncmd="" 33 | chgrpcmd="" 34 | stripcmd="" 35 | rmcmd="$rmprog -f" 36 | mvcmd="$mvprog" 37 | src="" 38 | dst="" 39 | 40 | while [ x"$1" != x ]; do 41 | case $1 in 42 | -c) instcmd="$cpprog" 43 | shift 44 | continue;; 45 | 46 | -m) chmodcmd="$chmodprog $2" 47 | shift 48 | shift 49 | continue;; 50 | 51 | -o) chowncmd="$chownprog $2" 52 | shift 53 | shift 54 | continue;; 55 | 56 | -g) chgrpcmd="$chgrpprog $2" 57 | shift 58 | shift 59 | continue;; 60 | 61 | -s) stripcmd="$stripprog" 62 | shift 63 | continue;; 64 | 65 | *) if [ x"$src" = x ] 66 | then 67 | src=$1 68 | else 69 | dst=$1 70 | fi 71 | shift 72 | continue;; 73 | esac 74 | done 75 | 76 | if [ x"$src" = x ] 77 | then 78 | echo "install: no input file specified" 79 | exit 1 80 | fi 81 | 82 | if [ x"$dst" = x ] 83 | then 84 | echo "install: no destination specified" 85 | exit 1 86 | fi 87 | 88 | 89 | # If destination is a directory, append the input filename; if your system 90 | # does not like double slashes in filenames, you may need to add some logic 91 | 92 | if [ -d $dst ] 93 | then 94 | dst="$dst"/`basename $src` 95 | fi 96 | 97 | # Make a temp file name in the proper directory. 98 | 99 | dstdir=`dirname $dst` 100 | dsttmp=$dstdir/#inst.$$# 101 | 102 | # Move or copy the file name to the temp name 103 | 104 | $doit $instcmd $src $dsttmp 105 | 106 | # and set any options; do chmod last to preserve setuid bits 107 | 108 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi 109 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi 110 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi 111 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi 112 | 113 | # Now rename the file to the real destination. 114 | 115 | $doit $rmcmd $dst 116 | $doit $mvcmd $dsttmp $dst 117 | 118 | 119 | exit 0 120 | -------------------------------------------------------------------------------- /doc/api/doc_struct.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - Struct 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - Struct


10 | 11 |

This application highlights some low-level aspects of the Metakit library. 12 |

13 | 14 |

What it does: Struct is a little utility which displays the data 15 | structure of any Metakit datafile on standard output. The output uses a 16 | text-mode graph to display the data structure, which can be useful to determine 17 | what information is stored in a specific Metakit datafile.

18 | 19 |

What it illustrates: For demonstration purposes, Struct has been 20 | compiled as a real-mode small-model MS-DOS utility program. It shows how you can extract 21 | structural information from a Metakit datafile without knowing anything 22 | about it. The sample code includes a general "StructureMap" class 23 | to generate text-based graphs. The size of the STRUCT.EXE program demonstrates 24 | how small a fully self-contained application using Metakit can be.

25 | 26 |

Note that although Struct must respect the very severe 64 K memory limit imposed 27 | by small-model MS-DOS, you can still use this program to examine the structure of files 28 | of any reasonable size. The reason for this is that Metakit implements on-demand loading, 29 | and that Struct never accesses the actual data itself.

30 | 31 |

How to use it: To examine the structure of a datafile, simply 32 | run STRUCT.EXE from the MS-DOS prompt with the filename as argument. There 33 | are a few command-line options to control the output format, these are 34 | listed when you start Struct without a filename. They are:

35 | 36 |
    37 |
    38 |
    -d
    Show a linear description instead of the default tree.
    39 |
    -t
    Show a linear description of the structure, omitting the property names.
    40 |
    -c
    Show column structure instead of the deafult tree structure (advanced).
    41 |
    42 |
43 | 44 |

You can redirect the output to file, just as with any other MS-DOS program. 45 |

46 | 47 |

Known problems: None.

48 | 49 |

Files in EXAMPLES\STRUCT:

50 | 51 |

STRUCT.CPP - Struct main program 52 |
STRUCT.MAK - MSVC 1.52 project makefile

53 | 54 | 55 |


56 | || 57 |  
Roadmap 58 |   Class Index 59 |   Sample Index 60 |   || 61 |   Introduction 62 |   Tips and Tricks 63 |   || 64 | 65 |
66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /src/univ.h: -------------------------------------------------------------------------------- 1 | // univ.h -- 2 | // $Id$ 3 | // This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 | 5 | /** @file 6 | * Definition of the container classes 7 | */ 8 | 9 | #define q4_UNIV 1 10 | 11 | #include "mk4str.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | 15 | class c4_BaseArray { 16 | public: 17 | c4_BaseArray(); 18 | ~c4_BaseArray(); 19 | 20 | int GetLength()const; 21 | void SetLength(int nNewSize); 22 | 23 | const void *GetData(int nIndex)const; 24 | void *GetData(int nIndex); 25 | 26 | void Grow(int nIndex); 27 | 28 | void InsertAt(int nIndex, int nCount); 29 | void RemoveAt(int nIndex, int nCount); 30 | 31 | private: 32 | char *_data; 33 | int _size; 34 | // char _buffer[4]; 35 | }; 36 | 37 | class c4_PtrArray { 38 | public: 39 | c4_PtrArray(); 40 | ~c4_PtrArray(); 41 | 42 | int GetSize()const; 43 | void SetSize(int nNewSize, int nGrowBy = - 1); 44 | 45 | void *GetAt(int nIndex)const; 46 | void SetAt(int nIndex, const void *newElement); 47 | void * &ElementAt(int nIndex); 48 | 49 | int Add(void *newElement); 50 | 51 | void InsertAt(int nIndex, void *newElement, int nCount = 1); 52 | void RemoveAt(int nIndex, int nCount = 1); 53 | 54 | private: 55 | static int Off(int n_); 56 | 57 | c4_BaseArray _vector; 58 | }; 59 | 60 | class c4_DWordArray { 61 | public: 62 | c4_DWordArray(); 63 | ~c4_DWordArray(); 64 | 65 | int GetSize()const; 66 | void SetSize(int nNewSize, int nGrowBy = - 1); 67 | 68 | t4_i32 GetAt(int nIndex)const; 69 | void SetAt(int nIndex, t4_i32 newElement); 70 | t4_i32 &ElementAt(int nIndex); 71 | 72 | int Add(t4_i32 newElement); 73 | 74 | void InsertAt(int nIndex, t4_i32 newElement, int nCount = 1); 75 | void RemoveAt(int nIndex, int nCount = 1); 76 | 77 | private: 78 | static int Off(int n_); 79 | 80 | c4_BaseArray _vector; 81 | }; 82 | 83 | class c4_StringArray { 84 | public: 85 | c4_StringArray(); 86 | ~c4_StringArray(); 87 | 88 | int GetSize()const; 89 | void SetSize(int nNewSize, int nGrowBy = - 1); 90 | 91 | const char *GetAt(int nIndex)const; 92 | void SetAt(int nIndex, const char *newElement); 93 | // c4_String& ElementAt(int nIndex); 94 | 95 | int Add(const char *newElement); 96 | 97 | void InsertAt(int nIndex, const char *newElement, int nCount = 1); 98 | void RemoveAt(int nIndex, int nCount = 1); 99 | 100 | private: 101 | c4_PtrArray _ptrs; 102 | }; 103 | 104 | ///////////////////////////////////////////////////////////////////////////// 105 | 106 | #if q4_INLINE 107 | #include "univ.inl" 108 | #endif 109 | 110 | ///////////////////////////////////////////////////////////////////////////// 111 | -------------------------------------------------------------------------------- /doc/api/c4_MemoRef_desc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | class c4_MemoRef 7 | : public c4_Reference

8 | 9 |
10 | Used to get or set memo values (growable large binary objects).

11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 35 | 36 | 37 | 38 | 41 | 49 | 50 | 51 | 52 | 55 | 63 | 64 | 65 | 66 | 69 | 77 | 78 | 79 | 80 | 83 | 91 | 92 | 93 |
19 | Public members 20 |
25 | 26 | 28 | 29 | c4_MemoRef (const c4_Reference&); 30 | 31 | 32 |
33 | Constructor
34 |
39 | operator 40 | 42 | 43 | c4_Bytes () const; 44 | 45 | 46 |
47 | Get the value as binary object
48 |
53 | c4_MemoRef& 54 | 56 | 57 | operator= (const c4_Bytes&); 58 | 59 | 60 |
61 | Set the value to the specified binary object
62 |
67 | c4_Bytes 68 | 70 | 71 | Access (t4_u32 off_, int len_ =0) const; 72 | 73 | 74 |
75 | Fetch data from the memo field, up to end if length is zero
76 |
81 | bool 82 | 84 | 85 | Modify (const c4_Bytes& buf_, t4_u32 off_, int diff_ =0) const; 86 | 87 | 88 |
89 | Store data, resize by diff_ bytes, return true if successful
90 |
94 | 95 | 96 | 97 | 98 | 99 | 100 |

101 | 102 | 103 | 104 | 107 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 119 | 124 | 125 | 126 |
105 | Header file 106 | 108 | "mk4.h"   --   Dec 9, 1999 109 |
117 | Derived from 118 | 120 | 121 | c4_Reference 122 | 123 |
127 | 128 |
129 | 130 |
131 | -------------------------------------------------------------------------------- /doc/api/doc_dump.html: -------------------------------------------------------------------------------- 1 | 2 | Metakit sample code - Dump 3 | 4 | 5 | 6 | 7 | 8 |

App Icon 9 | Metakit sample code - Dump


10 | 11 |

This application is a generic utility for the Metakit library.

12 | 13 |

What it does: Dump is a utility program which displays the contents 14 | of a Metakit datafile on standard output. The output shows all the information 15 | which is stored in the datafile, which can be quite useful while developing 16 | and debugging applications based on Metakit.

17 | 18 |

What it illustrates: Dump is a so-called "32-bit console 19 | application", this is the modern version of the classical MS-DOS command-line 20 | executables. It shows how you can extract structural information from a 21 | Metakit datafile without knowing anything about it. The basic trick is 22 | to simply open the file, and then to step through each of the properties 23 | (using the members NumProperties and NthProperty). The executable file 24 | is tiny, because both Metakit and MFC have been linked as DLLs.

25 | 26 |

How to use it: To dump a datafile, you can start DUMP.EXE from 27 | the MS-DOS prompt with the filename as argument (or drop a file on it in 28 | the Explorer). Since datafiles can store arbitrarily nested data structures, 29 | you may need to examine the output to understand how the information is 30 | presented on standard output. Dump adds quite a bit of detail to guide 31 | you (including all the property names). Basically, the data structure is 32 | traversed recursively, with indentation added to reflect the current nesting 33 | level. There are a number of command-line options to modify the default 34 | output style:

35 | 36 |
    37 |
    38 |
    -s
    List all tables and subtable, but omit the actual data values.
    39 |
    -d
    List all tables and subtables, including a low-level data dump.
    40 |
    -f
    Only list all the fields (properties) and their structure.
    41 |
    -w
    Wait for the RETURN key just before exiting.
    42 |
    43 |
44 | 45 |

You can redirect the output to file, just like any other console application. 46 |

47 | 48 |

Known problems: None. Note that this is a 32-bit application 49 | which requires Windows 95 (or perhaps Windows NT or Win32s), and that the 50 | Metakit DLLs are used.

51 | 52 |

Files in EXAMPLES\DUMP:

53 | 54 |

DUMP.CPP - Dump main program 55 |
DUMP.MAK, DUMP.MDP - MSVC 4.2 project makefiles for Win32

56 | 57 | 58 |


59 | || 60 |   Roadmap 61 |   Class Index 62 |   Sample Index 63 |   || 64 |   Introduction 65 |   Tips and Tricks 66 |   || 67 | 68 |
69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /unix/metakit.spec: -------------------------------------------------------------------------------- 1 | %define name metakit 2 | %define ver 2.0 3 | %define extension tar.gz 4 | 5 | Summary: The Metakit Library 2.0 6 | Name: %{name} 7 | Version: %{ver} 8 | Release: 1 9 | Copyright: GPL 10 | Group: Applications/Databases 11 | Source: %{name}-%{ver}.%{extension} 12 | Patch: metakit-install.patch 13 | URL: http://www.equi4.com/metakit/ 14 | Buildroot: /tmp/%{name}-%{ver}-root 15 | Packager: Sean Summers 16 | 17 | %description 18 | Metakit is an embeddable database which runs on Unix, Windows, 19 | Macintosh, and other platforms. It lets you build applications which 20 | store their data efficiently, in a portable way, and which will not need a 21 | complex runtime installation. In terms of the data model, Metakit takes 22 | the middle ground between RDBMS, OODBMS, and flat-file databases - yet it 23 | is quite different from each of them. 24 | 25 | WHAT IT ISN'T - Metakit is not: 1) an SQL database, 2) multi-user/-threading, 26 | 3) scalable to gigabytes, 4) proprietary software, 5) a toy. 27 | 28 | %package devel 29 | Summary: Development Libraries for The Metakit Library 2.0 30 | Group: Development/Libraries 31 | %description devel 32 | The %{name}-devel package contains the libraries and header files necessary 33 | for writing programs that make use of the Metakit library. 34 | 35 | %package python 36 | Group: Development/Libraries 37 | Summary: Python module for The Metakit Library 2.0 38 | %description python 39 | The %{name}-python package contains the libraries necessary 40 | for using the Metakit as a python module. 41 | 42 | #%package tcl 43 | #Group: Development/Libraries 44 | #Summary: TCL module for The Metakit Library 2.0 45 | #%description tcl 46 | #The %{name}-tcl package contains the libraries necessary 47 | #for using the Metakit as a tcl module. 48 | 49 | %prep 50 | %setup 51 | %patch -p1 52 | 53 | %build 54 | cd builds 55 | ../unix/configure --prefix=/usr --with-python 56 | #--with-tcl ## maybe TCL_DECLARE_MUTEX is too new for RH6.1.92? 57 | make ${RPM_BUILD_OPTS} 58 | 59 | # Testing takes a while 60 | rm tests/\!keepme.txt 61 | make ${RPM_BUILD_OPTS} test 62 | 63 | %install 64 | cd builds 65 | make install DESTDIR=${RPM_BUILD_ROOT} 66 | libtool --finish ${RPM_BUILD_ROOT}/usr/lib/ 67 | 68 | #python setup 69 | make Mk4py.so 70 | install -Ds Mk4py.so ${RPM_BUILD_ROOT}/usr/lib/python1.5/site-packages/Mk4pymodule.so 71 | 72 | #%install tcl 73 | #make Mk4tcl.so 74 | 75 | %clean 76 | rm -rf $RPM_BUILD_ROOT 77 | 78 | %files 79 | %doc CHANGES README Metakit.html 80 | %doc doc/e4s.gif doc/format.html 81 | /usr/lib/libmk4.so 82 | /usr/lib/libmk4.so.0 83 | /usr/lib/libmk4.so.0.0.0 84 | /usr/lib/libmk4.la 85 | 86 | %files devel 87 | %doc doc/api/ demos/ 88 | /usr/lib/libmk4.a 89 | /usr/include/mk4.h 90 | /usr/include/mk4.inl 91 | /usr/include/mk4str.h 92 | /usr/include/mk4str.inl 93 | 94 | %files python 95 | %doc python/*.py 96 | %doc doc/python.* 97 | /usr/lib/python1.5/site-packages/Mk4pymodule.so 98 | 99 | #%files tcl 100 | #%doc tcl/*.tcl 101 | #%doc doc/tcl.* 102 | #/usr/lib/tcl 103 | 104 | --------------------------------------------------------------------------------