add extracted tar cmphv2.0.2
This commit is contained in:
parent
4e6915c41a
commit
0858c9c39c
4
cmph-2.0.2/AUTHORS
Normal file
4
cmph-2.0.2/AUTHORS
Normal file
@ -0,0 +1,4 @@
|
||||
Davi de Castro Reis davi@users.sourceforge.net
|
||||
Djamel Belazzougui db8192@users.sourceforge.net
|
||||
Fabiano Cupertino Botelho fc_botelho@users.sourceforge.net
|
||||
Nivio Ziviani nivio@dcc.ufmg.br
|
5
cmph-2.0.2/COPYING
Normal file
5
cmph-2.0.2/COPYING
Normal file
@ -0,0 +1,5 @@
|
||||
The code of the cmph library is dual licensed under the LGPL version 2 and MPL
|
||||
1.1 licenses. Please refer to the LGPL-2 and MPL-1.1 files in the repository
|
||||
for the full description of each of the licenses.
|
||||
|
||||
For cxxmph, the files stringpiece.h and MurmurHash2 are covered by the BSD and MIT licenses, respectively.
|
453
cmph-2.0.2/ChangeLog
Normal file
453
cmph-2.0.2/ChangeLog
Normal file
@ -0,0 +1,453 @@
|
||||
2005-08-08 18:34 fc_botelho
|
||||
|
||||
* INSTALL, examples/Makefile, examples/Makefile.in,
|
||||
examples/.deps/file_adapter_ex2.Po,
|
||||
examples/.deps/vector_adapter_ex1.Po, src/brz.c: [no log message]
|
||||
|
||||
2005-08-07 22:00 fc_botelho
|
||||
|
||||
* src/: brz.c, brz.h, brz_structs.h, cmph.c, cmph.h, main.c:
|
||||
temporary directory passed by command line
|
||||
|
||||
2005-08-07 20:22 fc_botelho
|
||||
|
||||
* src/brz.c: stable version of BRZ
|
||||
|
||||
2005-08-06 22:09 fc_botelho
|
||||
|
||||
* src/bmz.c: no message
|
||||
|
||||
2005-08-06 22:02 fc_botelho
|
||||
|
||||
* src/bmz.c: no message
|
||||
|
||||
2005-08-06 21:45 fc_botelho
|
||||
|
||||
* src/brz.c: fastest version of BRZ
|
||||
|
||||
2005-08-06 17:20 fc_botelho
|
||||
|
||||
* src/: bmz.c, brz.c, main.c: [no log message]
|
||||
|
||||
2005-07-29 16:43 fc_botelho
|
||||
|
||||
* src/brz.c: BRZ algorithm is almost stable
|
||||
|
||||
2005-07-29 15:29 fc_botelho
|
||||
|
||||
* src/: bmz.c, brz.c, brz_structs.h, cmph_types.h: BRZ algorithm is
|
||||
almost stable
|
||||
|
||||
2005-07-29 00:09 fc_botelho
|
||||
|
||||
* src/: brz.c, djb2_hash.c, djb2_hash.h, fnv_hash.c, fnv_hash.h,
|
||||
hash.c, hash.h, jenkins_hash.c, jenkins_hash.h, sdbm_hash.c,
|
||||
sdbm_hash.h: it was fixed more mistakes in BRZ algorithm
|
||||
|
||||
2005-07-28 21:00 fc_botelho
|
||||
|
||||
* src/: bmz.c, brz.c, cmph.c: fixed some mistakes in BRZ algorithm
|
||||
|
||||
2005-07-27 19:13 fc_botelho
|
||||
|
||||
* src/brz.c: algorithm BRZ included
|
||||
|
||||
2005-07-27 18:16 fc_botelho
|
||||
|
||||
* src/: bmz_structs.h, brz.c, brz.h, brz_structs.h: Algorithm BRZ
|
||||
included
|
||||
|
||||
2005-07-27 18:13 fc_botelho
|
||||
|
||||
* src/: Makefile.am, bmz.c, chm.c, cmph.c, cmph.h, cmph_types.h:
|
||||
Algorithm BRZ included
|
||||
|
||||
2005-07-25 19:18 fc_botelho
|
||||
|
||||
* README, README.t2t, scpscript: it was included an examples
|
||||
directory
|
||||
|
||||
2005-07-25 18:26 fc_botelho
|
||||
|
||||
* INSTALL, Makefile.am, configure.ac, examples/Makefile,
|
||||
examples/Makefile.am, examples/Makefile.in,
|
||||
examples/file_adapter_ex2.c, examples/keys.txt,
|
||||
examples/vector_adapter_ex1.c, examples/.deps/file_adapter_ex2.Po,
|
||||
examples/.deps/vector_adapter_ex1.Po, src/cmph.c, src/cmph.h: it
|
||||
was included a examples directory
|
||||
|
||||
2005-03-03 02:07 davi
|
||||
|
||||
* src/: bmz.c, chm.c, chm.h, chm_structs.h, cmph.c, cmph.h,
|
||||
graph.c, graph.h, jenkins_hash.c, jenkins_hash.h, main.c (xgraph):
|
||||
New f*cking cool algorithm works. Roughly implemented in chm.c
|
||||
|
||||
2005-03-02 20:55 davi
|
||||
|
||||
* src/xgraph.c (xgraph): xchmr working nice, but a bit slow
|
||||
|
||||
2005-03-02 02:01 davi
|
||||
|
||||
* src/xchmr.h: file xchmr.h was initially added on branch xgraph.
|
||||
|
||||
2005-03-02 02:01 davi
|
||||
|
||||
* src/xchmr_structs.h: file xchmr_structs.h was initially added on
|
||||
branch xgraph.
|
||||
|
||||
2005-03-02 02:01 davi
|
||||
|
||||
* src/xchmr.c: file xchmr.c was initially added on branch xgraph.
|
||||
|
||||
2005-03-02 02:01 davi
|
||||
|
||||
* src/: Makefile.am, cmph.c, cmph_types.h, xchmr.c, xchmr.h,
|
||||
xchmr_structs.h, xgraph.c, xgraph.h (xgraph): xchmr working fine
|
||||
except for false positives on cyclic detection.
|
||||
|
||||
2005-03-02 00:05 davi
|
||||
|
||||
* src/: Makefile.am, xgraph.c, xgraph.h (xgraph): Added external
|
||||
graph functionality in branch xgraph.
|
||||
|
||||
2005-03-02 00:05 davi
|
||||
|
||||
* src/xgraph.c: file xgraph.c was initially added on branch xgraph.
|
||||
|
||||
2005-03-02 00:05 davi
|
||||
|
||||
* src/xgraph.h: file xgraph.h was initially added on branch xgraph.
|
||||
|
||||
2005-02-28 19:53 davi
|
||||
|
||||
* src/chm.c: Fixed off by one bug in chm.
|
||||
|
||||
2005-02-17 16:20 fc_botelho
|
||||
|
||||
* LOGO.html, README, README.t2t, gendocs: The way of calling the
|
||||
function cmph_search was fixed in the file README.t2t
|
||||
|
||||
2005-01-31 17:13 fc_botelho
|
||||
|
||||
* README.t2t: Heuristic BMZ memory consumption was updated
|
||||
|
||||
2005-01-31 17:09 fc_botelho
|
||||
|
||||
* BMZ.t2t: DJB2, SDBM, FNV and Jenkins hash link were added
|
||||
|
||||
2005-01-31 16:50 fc_botelho
|
||||
|
||||
* BMZ.t2t, CHM.t2t, COMPARISON.t2t, CONCEPTS.t2t, CONFIG.t2t,
|
||||
FAQ.t2t, GPERF.t2t, LOGO.t2t, README.t2t, TABLE1.t2t, TABLE4.t2t,
|
||||
TABLE5.t2t, DOC.css: BMZ documentation was finished
|
||||
|
||||
2005-01-28 18:12 fc_botelho
|
||||
|
||||
* figs/img1.png, figs/img10.png, figs/img100.png, figs/img101.png,
|
||||
figs/img102.png, figs/img103.png, figs/img104.png, figs/img105.png,
|
||||
figs/img106.png, figs/img107.png, figs/img108.png, figs/img109.png,
|
||||
papers/bmz_tr004_04.ps, papers/bmz_wea2005.ps, papers/chm92.pdf,
|
||||
figs/img11.png, figs/img110.png, figs/img111.png, figs/img112.png,
|
||||
figs/img113.png, figs/img114.png, figs/img115.png, figs/img116.png,
|
||||
figs/img117.png, figs/img118.png, figs/img119.png, figs/img12.png,
|
||||
figs/img120.png, figs/img121.png, figs/img122.png, figs/img123.png,
|
||||
figs/img124.png, figs/img125.png, figs/img126.png, figs/img127.png,
|
||||
figs/img128.png, figs/img129.png, figs/img13.png, figs/img130.png,
|
||||
figs/img131.png, figs/img132.png, figs/img133.png, figs/img134.png,
|
||||
figs/img135.png, figs/img136.png, figs/img137.png, figs/img138.png,
|
||||
figs/img139.png, figs/img14.png, figs/img140.png, figs/img141.png,
|
||||
figs/img142.png, figs/img143.png, figs/img144.png, figs/img145.png,
|
||||
figs/img146.png, figs/img147.png, figs/img148.png, figs/img149.png,
|
||||
figs/img15.png, figs/img150.png, figs/img151.png, figs/img152.png,
|
||||
figs/img153.png, figs/img154.png, figs/img155.png, figs/img156.png,
|
||||
figs/img157.png, figs/img158.png, figs/img159.png, figs/img16.png,
|
||||
figs/img160.png, figs/img161.png, figs/img162.png, figs/img163.png,
|
||||
figs/img164.png, figs/img165.png, figs/img166.png, figs/img167.png,
|
||||
figs/img168.png, figs/img169.png, figs/img17.png, figs/img170.png,
|
||||
figs/img171.png, figs/img172.png, figs/img173.png, figs/img174.png,
|
||||
figs/img175.png, figs/img176.png, figs/img177.png, figs/img178.png,
|
||||
figs/img179.png, figs/img18.png, figs/img180.png, figs/img181.png,
|
||||
figs/img182.png, figs/img183.png, figs/img184.png, figs/img185.png,
|
||||
figs/img186.png, figs/img187.png, figs/img188.png, figs/img189.png,
|
||||
figs/img19.png, figs/img190.png, figs/img191.png, figs/img192.png,
|
||||
figs/img193.png, figs/img194.png, figs/img195.png, figs/img196.png,
|
||||
figs/img197.png, figs/img198.png, figs/img199.png, figs/img2.png,
|
||||
figs/img20.png, figs/img200.png, figs/img201.png, figs/img202.png,
|
||||
figs/img203.png, figs/img204.png, figs/img205.png, figs/img206.png,
|
||||
figs/img207.png, figs/img208.png, figs/img209.png, figs/img21.png,
|
||||
figs/img210.png, figs/img211.png, figs/img212.png, figs/img213.png,
|
||||
figs/img214.png, figs/img215.png, figs/img216.png, figs/img217.png,
|
||||
figs/img218.png, figs/img219.png, figs/img22.png, figs/img220.png,
|
||||
figs/img221.png, figs/img222.png, figs/img223.png, figs/img224.png,
|
||||
figs/img225.png, figs/img226.png, figs/img227.png, figs/img228.png,
|
||||
figs/img229.png, figs/img23.png, figs/img230.png, figs/img231.png,
|
||||
figs/img232.png, figs/img233.png, figs/img234.png, figs/img235.png,
|
||||
figs/img236.png, figs/img237.png, figs/img238.png, figs/img239.png,
|
||||
figs/img24.png, figs/img240.png, figs/img241.png, figs/img242.png,
|
||||
figs/img243.png, figs/img244.png, figs/img245.png, figs/img246.png,
|
||||
figs/img247.png, figs/img248.png, figs/img249.png, figs/img25.png,
|
||||
figs/img250.png, figs/img251.png, figs/img252.png, figs/img253.png,
|
||||
figs/img26.png, figs/img27.png, figs/img28.png, figs/img29.png,
|
||||
figs/img3.png, figs/img30.png, figs/img31.png, figs/img32.png,
|
||||
figs/img33.png, figs/img34.png, figs/img35.png, figs/img36.png,
|
||||
figs/img37.png, figs/img38.png, figs/img39.png, figs/img4.png,
|
||||
figs/img40.png, figs/img41.png, figs/img42.png, figs/img43.png,
|
||||
figs/img44.png, figs/img45.png, figs/img46.png, figs/img47.png,
|
||||
figs/img48.png, figs/img49.png, figs/img5.png, figs/img50.png,
|
||||
figs/img51.png, figs/img52.png, figs/img53.png, figs/img54.png,
|
||||
figs/img55.png, figs/img56.png, figs/img57.png, figs/img58.png,
|
||||
figs/img59.png, figs/img6.png, figs/img60.png, figs/img61.png,
|
||||
figs/img62.png, figs/img63.png, figs/img64.png, figs/img65.png,
|
||||
figs/img66.png, figs/img67.png, figs/img68.png, figs/img69.png,
|
||||
figs/img7.png, figs/img70.png, figs/img71.png, figs/img72.png,
|
||||
figs/img73.png, figs/img74.png, figs/img75.png, figs/img76.png,
|
||||
figs/img77.png, figs/img78.png, figs/img79.png, figs/img8.png,
|
||||
figs/img80.png, figs/img81.png, figs/img82.png, figs/img83.png,
|
||||
figs/img84.png, figs/img85.png, figs/img86.png, figs/img87.png,
|
||||
figs/img88.png, figs/img89.png, figs/img9.png, figs/img90.png,
|
||||
figs/img91.png, figs/img92.png, figs/img93.png, figs/img94.png,
|
||||
figs/img95.png, figs/img96.png, figs/img97.png, figs/img98.png,
|
||||
figs/img99.png: Initial version
|
||||
|
||||
2005-01-28 18:07 fc_botelho
|
||||
|
||||
* BMZ.t2t, CHM.t2t, COMPARISON.t2t, CONFIG.t2t, README.t2t: It was
|
||||
improved the documentation of BMZ and CHM algorithms
|
||||
|
||||
2005-01-27 18:07 fc_botelho
|
||||
|
||||
* BMZ.t2t, CHM.t2t, FAQ.t2t: history of BMZ algorithm is available
|
||||
|
||||
2005-01-27 14:23 fc_botelho
|
||||
|
||||
* AUTHORS: It was added the authors' email
|
||||
|
||||
2005-01-27 14:21 fc_botelho
|
||||
|
||||
* BMZ.t2t, CHM.t2t, COMPARISON.t2t, FAQ.t2t, FOOTER.t2t, GPERF.t2t,
|
||||
README.t2t: It was added FOOTER.t2t file
|
||||
|
||||
2005-01-27 12:16 fc_botelho
|
||||
|
||||
* src/cmph_types.h: It was removed pjw and glib functions from
|
||||
cmph_hash_names vector
|
||||
|
||||
2005-01-27 12:12 fc_botelho
|
||||
|
||||
* src/hash.c: It was removed pjw and glib functions from
|
||||
cmph_hash_names vector
|
||||
|
||||
2005-01-27 11:01 davi
|
||||
|
||||
* FAQ.t2t, README, README.t2t, gendocs, src/bmz.c, src/bmz.h,
|
||||
src/chm.c, src/chm.h, src/cmph.c, src/cmph_structs.c, src/debug.h,
|
||||
src/main.c: Fix to alternate hash functions code. Removed htonl
|
||||
stuff from chm algorithm. Added faq.
|
||||
|
||||
2005-01-27 09:14 fc_botelho
|
||||
|
||||
* README.t2t: It was corrected some formatting mistakes
|
||||
|
||||
2005-01-26 22:04 davi
|
||||
|
||||
* BMZ.t2t, CHM.t2t, COMPARISON.t2t, GPERF.t2t, README, README.t2t,
|
||||
gendocs: Added gperf notes.
|
||||
|
||||
2005-01-25 19:10 fc_botelho
|
||||
|
||||
* INSTALL: generated in version 0.3
|
||||
|
||||
2005-01-25 19:09 fc_botelho
|
||||
|
||||
* src/: czech.c, czech.h, czech_structs.h: The czech.h,
|
||||
czech_structs.h and czech.c files were removed
|
||||
|
||||
2005-01-25 19:06 fc_botelho
|
||||
|
||||
* src/: chm.c, chm.h, chm_structs.h, cmph.c, cmph_types.h, main.c,
|
||||
Makefile.am: It was changed the prefix czech by chm
|
||||
|
||||
2005-01-25 18:50 fc_botelho
|
||||
|
||||
* gendocs: script to generate the documentation and the README file
|
||||
|
||||
2005-01-25 18:47 fc_botelho
|
||||
|
||||
* README: README was updated
|
||||
|
||||
2005-01-25 18:44 fc_botelho
|
||||
|
||||
* configure.ac: Version was updated
|
||||
|
||||
2005-01-25 18:42 fc_botelho
|
||||
|
||||
* src/cmph.h: Vector adapter commented
|
||||
|
||||
2005-01-25 18:40 fc_botelho
|
||||
|
||||
* CHM.t2t, CONFIG.t2t, LOGO.html: It was included the PreProc macro
|
||||
through the CONFIG.t2t file and the LOGO through the LOGO.html file
|
||||
|
||||
2005-01-25 18:33 fc_botelho
|
||||
|
||||
* README.t2t, BMZ.t2t, COMPARISON.t2t, CZECH.t2t: It was included
|
||||
the PreProc macro through the CONFIG.t2t file and the LOGO through
|
||||
the LOGO.html file
|
||||
|
||||
2005-01-24 18:25 fc_botelho
|
||||
|
||||
* src/: bmz.c, bmz.h, cmph_structs.c, cmph_structs.h, czech.c,
|
||||
cmph.c, czech.h, main.c, cmph.h: The file adpater was implemented.
|
||||
|
||||
2005-01-24 17:20 fc_botelho
|
||||
|
||||
* README.t2t: the memory consumption to create a mphf using bmz
|
||||
with a heuristic was fixed.
|
||||
|
||||
2005-01-24 17:11 fc_botelho
|
||||
|
||||
* src/: cmph_types.h, main.c: The algorithms and hash functions
|
||||
were put in alphabetical order
|
||||
|
||||
2005-01-24 16:15 fc_botelho
|
||||
|
||||
* BMZ.t2t, COMPARISON.t2t, CZECH.t2t, README.t2t: It was fixed some
|
||||
English mistakes and It was included the files BMZ.t2t, CZECH.t2t
|
||||
and COMPARISON.t2t
|
||||
|
||||
2005-01-21 19:19 davi
|
||||
|
||||
* ChangeLog, Doxyfile: Added Doxyfile.
|
||||
|
||||
2005-01-21 19:14 davi
|
||||
|
||||
* README.t2t, wingetopt.c, src/cmph.h, tests/graph_tests.c: Fixed
|
||||
wingetopt.c
|
||||
|
||||
2005-01-21 18:44 fc_botelho
|
||||
|
||||
* src/Makefile.am: included files bitbool.h and bitbool.c
|
||||
|
||||
2005-01-21 18:42 fc_botelho
|
||||
|
||||
* src/: bmz.c, bmz.h, bmz_structs.h, cmph.c, cmph.h,
|
||||
cmph_structs.c, cmph_structs.h, czech.c, czech.h, czech_structs.h,
|
||||
djb2_hash.c, djb2_hash.h, fnv_hash.c, fnv_hash.h, graph.c, graph.h,
|
||||
hash.c, hash.h, hash_state.h, jenkins_hash.c, jenkins_hash.h,
|
||||
main.c, sdbm_hash.c, sdbm_hash.h, vqueue.c, vqueue.h, vstack.c,
|
||||
vstack.h: Only public symbols were prefixed with cmph, and the API
|
||||
was changed to agree with the initial txt2html documentation
|
||||
|
||||
2005-01-21 18:30 fc_botelho
|
||||
|
||||
* src/: bitbool.c, bitbool.h: mask to represent a boolean value
|
||||
using only 1 bit
|
||||
|
||||
2005-01-20 10:28 davi
|
||||
|
||||
* ChangeLog, README, README.t2t, wingetopt.h, src/main.c: Added
|
||||
initial txt2tags documentation.
|
||||
|
||||
2005-01-19 10:40 davi
|
||||
|
||||
* acinclude.m4, configure.ac: Added macros for large file support.
|
||||
|
||||
2005-01-18 19:06 fc_botelho
|
||||
|
||||
* src/: bmz.c, bmz.h, bmz_structs.h, cmph.c, cmph.h,
|
||||
cmph_structs.c, cmph_structs.h, cmph_types.h, czech.c, czech.h,
|
||||
czech_structs.h, djb2_hash.c, djb2_hash.h, fnv_hash.c, fnv_hash.h,
|
||||
graph.c, graph.h, hash.c, hash.h, hash_state.h, jenkins_hash.c,
|
||||
jenkins_hash.h, main.c, sdbm_hash.c, sdbm_hash.h, vqueue.c,
|
||||
vqueue.h, vstack.c, vstack.h: version with cmph prefix
|
||||
|
||||
2005-01-18 15:10 davi
|
||||
|
||||
* ChangeLog, cmph.vcproj, cmphapp.vcproj, wingetopt.c, wingetopt.h:
|
||||
Added missing files.
|
||||
|
||||
2005-01-18 14:25 fc_botelho
|
||||
|
||||
* aclocal.m4: initial version
|
||||
|
||||
2005-01-18 14:16 fc_botelho
|
||||
|
||||
* aclocal.m4: initial version
|
||||
|
||||
2005-01-18 13:58 fc_botelho
|
||||
|
||||
* src/czech.c: using bit mask to represent boolean values
|
||||
|
||||
2005-01-18 13:56 fc_botelho
|
||||
|
||||
* src/czech.c: no message
|
||||
|
||||
2005-01-18 10:18 davi
|
||||
|
||||
* COPYING, INSTALL, src/Makefile.am, src/bmz.c, src/bmz.h,
|
||||
src/cmph.c, src/cmph.h, src/cmph_structs.c, src/cmph_structs.h,
|
||||
src/czech.c, src/czech.h, src/debug.h, src/djb2_hash.c,
|
||||
src/graph.c, src/graph.h, src/hash.c, src/jenkins_hash.c,
|
||||
src/main.c, src/sdbm_hash.c, src/vqueue.c: Fixed a lot of warnings.
|
||||
Added visual studio project. Make needed changes to work with
|
||||
windows.
|
||||
|
||||
2005-01-17 16:01 fc_botelho
|
||||
|
||||
* src/main.c: stable version
|
||||
|
||||
2005-01-17 15:58 fc_botelho
|
||||
|
||||
* src/: bmz.c, cmph.c, cmph.h, graph.c: stable version
|
||||
|
||||
2005-01-13 21:56 davi
|
||||
|
||||
* src/czech.c: Better error handling in czech.c.
|
||||
|
||||
2005-01-05 18:45 fc_botelho
|
||||
|
||||
* src/cmph_structs.c: included option -k to specify the number of
|
||||
keys to use
|
||||
|
||||
2005-01-05 17:48 fc_botelho
|
||||
|
||||
* src/: cmph.c, main.c: included option -k to specify the number of
|
||||
keys to use
|
||||
|
||||
2005-01-03 19:38 fc_botelho
|
||||
|
||||
* src/bmz.c: using less memory
|
||||
|
||||
2005-01-03 18:47 fc_botelho
|
||||
|
||||
* src/: bmz.c, graph.c: using less space to store the used_edges
|
||||
and critical_nodes arrays
|
||||
|
||||
2004-12-23 11:16 davi
|
||||
|
||||
* INSTALL, COPYING, AUTHORS, ChangeLog, Makefile.am, NEWS, README,
|
||||
cmph.spec, configure.ac, src/graph.c, tests/Makefile.am,
|
||||
tests/graph_tests.c, src/bmz.c, src/cmph_types.h,
|
||||
src/czech_structs.h, src/hash_state.h, src/jenkins_hash.c,
|
||||
src/bmz_structs.h, src/cmph.c, src/cmph.h, src/cmph_structs.h,
|
||||
src/czech.c, src/debug.h, src/djb2_hash.c, src/djb2_hash.h,
|
||||
src/fnv_hash.c, src/fnv_hash.h, src/graph.h, src/hash.c,
|
||||
src/hash.h, src/jenkins_hash.h, src/sdbm_hash.c, src/vstack.h,
|
||||
src/Makefile.am, src/bmz.h, src/cmph_structs.c, src/czech.h,
|
||||
src/main.c, src/sdbm_hash.h, src/vqueue.c, src/vqueue.h,
|
||||
src/vstack.c: Initial release.
|
||||
|
||||
2004-12-23 11:16 davi
|
||||
|
||||
* INSTALL, COPYING, AUTHORS, ChangeLog, Makefile.am, NEWS, README,
|
||||
cmph.spec, configure.ac, src/graph.c, tests/Makefile.am,
|
||||
tests/graph_tests.c, src/bmz.c, src/cmph_types.h,
|
||||
src/czech_structs.h, src/hash_state.h, src/jenkins_hash.c,
|
||||
src/bmz_structs.h, src/cmph.c, src/cmph.h, src/cmph_structs.h,
|
||||
src/czech.c, src/debug.h, src/djb2_hash.c, src/djb2_hash.h,
|
||||
src/fnv_hash.c, src/fnv_hash.h, src/graph.h, src/hash.c,
|
||||
src/hash.h, src/jenkins_hash.h, src/sdbm_hash.c, src/vstack.h,
|
||||
src/Makefile.am, src/bmz.h, src/cmph_structs.c, src/czech.h,
|
||||
src/main.c, src/sdbm_hash.h, src/vqueue.c, src/vqueue.h,
|
||||
src/vstack.c: Initial revision
|
||||
|
368
cmph-2.0.2/INSTALL
Normal file
368
cmph-2.0.2/INSTALL
Normal file
@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
513
cmph-2.0.2/LGPL-2
Normal file
513
cmph-2.0.2/LGPL-2
Normal file
@ -0,0 +1,513 @@
|
||||
Most components of the "acl" package are licensed under
|
||||
Version 2.1 of the GNU Lesser General Public License (see below).
|
||||
below.
|
||||
|
||||
Some components (as annotated in the source) are licensed
|
||||
under Version 2 of the GNU General Public License (see COPYING).
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
469
cmph-2.0.2/MPL-1.1
Normal file
469
cmph-2.0.2/MPL-1.1
Normal file
@ -0,0 +1,469 @@
|
||||
MOZILLA PUBLIC LICENSE
|
||||
Version 1.1
|
||||
|
||||
---------------
|
||||
|
||||
1. Definitions.
|
||||
|
||||
1.0.1. "Commercial Use" means distribution or otherwise making the
|
||||
Covered Code available to a third party.
|
||||
|
||||
1.1. "Contributor" means each entity that creates or contributes to
|
||||
the creation of Modifications.
|
||||
|
||||
1.2. "Contributor Version" means the combination of the Original
|
||||
Code, prior Modifications used by a Contributor, and the Modifications
|
||||
made by that particular Contributor.
|
||||
|
||||
1.3. "Covered Code" means the Original Code or Modifications or the
|
||||
combination of the Original Code and Modifications, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
||||
accepted in the software development community for the electronic
|
||||
transfer of data.
|
||||
|
||||
1.5. "Executable" means Covered Code in any form other than Source
|
||||
Code.
|
||||
|
||||
1.6. "Initial Developer" means the individual or entity identified
|
||||
as the Initial Developer in the Source Code notice required by Exhibit
|
||||
A.
|
||||
|
||||
1.7. "Larger Work" means a work which combines Covered Code or
|
||||
portions thereof with code not governed by the terms of this License.
|
||||
|
||||
1.8. "License" means this document.
|
||||
|
||||
1.8.1. "Licensable" means having the right to grant, to the maximum
|
||||
extent possible, whether at the time of the initial grant or
|
||||
subsequently acquired, any and all of the rights conveyed herein.
|
||||
|
||||
1.9. "Modifications" means any addition to or deletion from the
|
||||
substance or structure of either the Original Code or any previous
|
||||
Modifications. When Covered Code is released as a series of files, a
|
||||
Modification is:
|
||||
A. Any addition to or deletion from the contents of a file
|
||||
containing Original Code or previous Modifications.
|
||||
|
||||
B. Any new file that contains any part of the Original Code or
|
||||
previous Modifications.
|
||||
|
||||
1.10. "Original Code" means Source Code of computer software code
|
||||
which is described in the Source Code notice required by Exhibit A as
|
||||
Original Code, and which, at the time of its release under this
|
||||
License is not already Covered Code governed by this License.
|
||||
|
||||
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
||||
hereafter acquired, including without limitation, method, process,
|
||||
and apparatus claims, in any patent Licensable by grantor.
|
||||
|
||||
1.11. "Source Code" means the preferred form of the Covered Code for
|
||||
making modifications to it, including all modules it contains, plus
|
||||
any associated interface definition files, scripts used to control
|
||||
compilation and installation of an Executable, or source code
|
||||
differential comparisons against either the Original Code or another
|
||||
well known, available Covered Code of the Contributor's choice. The
|
||||
Source Code can be in a compressed or archival form, provided the
|
||||
appropriate decompression or de-archiving software is widely available
|
||||
for no charge.
|
||||
|
||||
1.12. "You" (or "Your") means an individual or a legal entity
|
||||
exercising rights under, and complying with all of the terms of, this
|
||||
License or a future version of this License issued under Section 6.1.
|
||||
For legal entities, "You" includes any entity which controls, is
|
||||
controlled by, or is under common control with You. For purposes of
|
||||
this definition, "control" means (a) the power, direct or indirect,
|
||||
to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (b) ownership of more than fifty percent
|
||||
(50%) of the outstanding shares or beneficial ownership of such
|
||||
entity.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Initial Developer to use, reproduce,
|
||||
modify, display, perform, sublicense and distribute the Original
|
||||
Code (or portions thereof) with or without Modifications, and/or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patents Claims infringed by the making, using or
|
||||
selling of Original Code, to make, have made, use, practice,
|
||||
sell, and offer for sale, and/or otherwise dispose of the
|
||||
Original Code (or portions thereof).
|
||||
|
||||
(c) the licenses granted in this Section 2.1(a) and (b) are
|
||||
effective on the date Initial Developer first distributes
|
||||
Original Code under the terms of this License.
|
||||
|
||||
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
||||
granted: 1) for code that You delete from the Original Code; 2)
|
||||
separate from the Original Code; or 3) for infringements caused
|
||||
by: i) the modification of the Original Code or ii) the
|
||||
combination of the Original Code with other software or devices.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Subject to third party intellectual property claims, each Contributor
|
||||
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Contributor, to use, reproduce, modify,
|
||||
display, perform, sublicense and distribute the Modifications
|
||||
created by such Contributor (or portions thereof) either on an
|
||||
unmodified basis, with other Modifications, as Covered Code
|
||||
and/or as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using, or
|
||||
selling of Modifications made by that Contributor either alone
|
||||
and/or in combination with its Contributor Version (or portions
|
||||
of such combination), to make, use, sell, offer for sale, have
|
||||
made, and/or otherwise dispose of: 1) Modifications made by that
|
||||
Contributor (or portions thereof); and 2) the combination of
|
||||
Modifications made by that Contributor with its Contributor
|
||||
Version (or portions of such combination).
|
||||
|
||||
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
||||
effective on the date Contributor first makes Commercial Use of
|
||||
the Covered Code.
|
||||
|
||||
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
||||
granted: 1) for any code that Contributor has deleted from the
|
||||
Contributor Version; 2) separate from the Contributor Version;
|
||||
3) for infringements caused by: i) third party modifications of
|
||||
Contributor Version or ii) the combination of Modifications made
|
||||
by that Contributor with other software (except as part of the
|
||||
Contributor Version) or other devices; or 4) under Patent Claims
|
||||
infringed by Covered Code in the absence of Modifications made by
|
||||
that Contributor.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1. Application of License.
|
||||
The Modifications which You create or to which You contribute are
|
||||
governed by the terms of this License, including without limitation
|
||||
Section 2.2. The Source Code version of Covered Code may be
|
||||
distributed only under the terms of this License or a future version
|
||||
of this License released under Section 6.1, and You must include a
|
||||
copy of this License with every copy of the Source Code You
|
||||
distribute. You may not offer or impose any terms on any Source Code
|
||||
version that alters or restricts the applicable version of this
|
||||
License or the recipients' rights hereunder. However, You may include
|
||||
an additional document offering the additional rights described in
|
||||
Section 3.5.
|
||||
|
||||
3.2. Availability of Source Code.
|
||||
Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License
|
||||
either on the same media as an Executable version or via an accepted
|
||||
Electronic Distribution Mechanism to anyone to whom you made an
|
||||
Executable version available; and if made available via Electronic
|
||||
Distribution Mechanism, must remain available for at least twelve (12)
|
||||
months after the date it initially became available, or at least six
|
||||
(6) months after a subsequent version of that particular Modification
|
||||
has been made available to such recipients. You are responsible for
|
||||
ensuring that the Source Code version remains available even if the
|
||||
Electronic Distribution Mechanism is maintained by a third party.
|
||||
|
||||
3.3. Description of Modifications.
|
||||
You must cause all Covered Code to which You contribute to contain a
|
||||
file documenting the changes You made to create that Covered Code and
|
||||
the date of any change. You must include a prominent statement that
|
||||
the Modification is derived, directly or indirectly, from Original
|
||||
Code provided by the Initial Developer and including the name of the
|
||||
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
||||
Executable version or related documentation in which You describe the
|
||||
origin or ownership of the Covered Code.
|
||||
|
||||
3.4. Intellectual Property Matters
|
||||
(a) Third Party Claims.
|
||||
If Contributor has knowledge that a license under a third party's
|
||||
intellectual property rights is required to exercise the rights
|
||||
granted by such Contributor under Sections 2.1 or 2.2,
|
||||
Contributor must include a text file with the Source Code
|
||||
distribution titled "LEGAL" which describes the claim and the
|
||||
party making the claim in sufficient detail that a recipient will
|
||||
know whom to contact. If Contributor obtains such knowledge after
|
||||
the Modification is made available as described in Section 3.2,
|
||||
Contributor shall promptly modify the LEGAL file in all copies
|
||||
Contributor makes available thereafter and shall take other steps
|
||||
(such as notifying appropriate mailing lists or newsgroups)
|
||||
reasonably calculated to inform those who received the Covered
|
||||
Code that new knowledge has been obtained.
|
||||
|
||||
(b) Contributor APIs.
|
||||
If Contributor's Modifications include an application programming
|
||||
interface and Contributor has knowledge of patent licenses which
|
||||
are reasonably necessary to implement that API, Contributor must
|
||||
also include this information in the LEGAL file.
|
||||
|
||||
(c) Representations.
|
||||
Contributor represents that, except as disclosed pursuant to
|
||||
Section 3.4(a) above, Contributor believes that Contributor's
|
||||
Modifications are Contributor's original creation(s) and/or
|
||||
Contributor has sufficient rights to grant the rights conveyed by
|
||||
this License.
|
||||
|
||||
3.5. Required Notices.
|
||||
You must duplicate the notice in Exhibit A in each file of the Source
|
||||
Code. If it is not possible to put such notice in a particular Source
|
||||
Code file due to its structure, then You must include such notice in a
|
||||
location (such as a relevant directory) where a user would be likely
|
||||
to look for such a notice. If You created one or more Modification(s)
|
||||
You may add your name as a Contributor to the notice described in
|
||||
Exhibit A. You must also duplicate this License in any documentation
|
||||
for the Source Code where You describe recipients' rights or ownership
|
||||
rights relating to Covered Code. You may choose to offer, and to
|
||||
charge a fee for, warranty, support, indemnity or liability
|
||||
obligations to one or more recipients of Covered Code. However, You
|
||||
may do so only on Your own behalf, and not on behalf of the Initial
|
||||
Developer or any Contributor. You must make it absolutely clear than
|
||||
any such warranty, support, indemnity or liability obligation is
|
||||
offered by You alone, and You hereby agree to indemnify the Initial
|
||||
Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of warranty,
|
||||
support, indemnity or liability terms You offer.
|
||||
|
||||
3.6. Distribution of Executable Versions.
|
||||
You may distribute Covered Code in Executable form only if the
|
||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||
and if You include a notice stating that the Source Code version of
|
||||
the Covered Code is available under the terms of this License,
|
||||
including a description of how and where You have fulfilled the
|
||||
obligations of Section 3.2. The notice must be conspicuously included
|
||||
in any notice in an Executable version, related documentation or
|
||||
collateral in which You describe recipients' rights relating to the
|
||||
Covered Code. You may distribute the Executable version of Covered
|
||||
Code or ownership rights under a license of Your choice, which may
|
||||
contain terms different from this License, provided that You are in
|
||||
compliance with the terms of this License and that the license for the
|
||||
Executable version does not attempt to limit or alter the recipient's
|
||||
rights in the Source Code version from the rights set forth in this
|
||||
License. If You distribute the Executable version under a different
|
||||
license You must make it absolutely clear that any terms which differ
|
||||
from this License are offered by You alone, not by the Initial
|
||||
Developer or any Contributor. You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by
|
||||
the Initial Developer or such Contributor as a result of any such
|
||||
terms You offer.
|
||||
|
||||
3.7. Larger Works.
|
||||
You may create a Larger Work by combining Covered Code with other code
|
||||
not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation.
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Code due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description
|
||||
must be included in the LEGAL file described in Section 3.4 and must
|
||||
be included with all distributions of the Source Code. Except to the
|
||||
extent prohibited by statute or regulation, such description must be
|
||||
sufficiently detailed for a recipient of ordinary skill to be able to
|
||||
understand it.
|
||||
|
||||
5. Application of this License.
|
||||
|
||||
This License applies to code to which the Initial Developer has
|
||||
attached the notice in Exhibit A and to related Covered Code.
|
||||
|
||||
6. Versions of the License.
|
||||
|
||||
6.1. New Versions.
|
||||
Netscape Communications Corporation ("Netscape") may publish revised
|
||||
and/or new versions of the License from time to time. Each version
|
||||
will be given a distinguishing version number.
|
||||
|
||||
6.2. Effect of New Versions.
|
||||
Once Covered Code has been published under a particular version of the
|
||||
License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms
|
||||
of any subsequent version of the License published by Netscape. No one
|
||||
other than Netscape has the right to modify the terms applicable to
|
||||
Covered Code created under this License.
|
||||
|
||||
6.3. Derivative Works.
|
||||
If You create or use a modified version of this License (which you may
|
||||
only do in order to apply it to code which is not already Covered Code
|
||||
governed by this License), You must (a) rename Your license so that
|
||||
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
||||
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
||||
license (except to note that your license differs from this License)
|
||||
and (b) otherwise make it clear that Your version of the license
|
||||
contains terms which differ from the Mozilla Public License and
|
||||
Netscape Public License. (Filling in the name of the Initial
|
||||
Developer, Original Code or Contributor in the notice described in
|
||||
Exhibit A shall not of themselves be deemed to be modifications of
|
||||
this License.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
8.1. This License and the rights granted hereunder will terminate
|
||||
automatically if You fail to comply with terms herein and fail to cure
|
||||
such breach within 30 days of becoming aware of the breach. All
|
||||
sublicenses to the Covered Code which are properly granted shall
|
||||
survive any termination of this License. Provisions which, by their
|
||||
nature, must remain in effect beyond the termination of this License
|
||||
shall survive.
|
||||
|
||||
8.2. If You initiate litigation by asserting a patent infringement
|
||||
claim (excluding declatory judgment actions) against Initial Developer
|
||||
or a Contributor (the Initial Developer or Contributor against whom
|
||||
You file such action is referred to as "Participant") alleging that:
|
||||
|
||||
(a) such Participant's Contributor Version directly or indirectly
|
||||
infringes any patent, then any and all rights granted by such
|
||||
Participant to You under Sections 2.1 and/or 2.2 of this License
|
||||
shall, upon 60 days notice from Participant terminate prospectively,
|
||||
unless if within 60 days after receipt of notice You either: (i)
|
||||
agree in writing to pay Participant a mutually agreeable reasonable
|
||||
royalty for Your past and future use of Modifications made by such
|
||||
Participant, or (ii) withdraw Your litigation claim with respect to
|
||||
the Contributor Version against such Participant. If within 60 days
|
||||
of notice, a reasonable royalty and payment arrangement are not
|
||||
mutually agreed upon in writing by the parties or the litigation claim
|
||||
is not withdrawn, the rights granted by Participant to You under
|
||||
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
||||
the 60 day notice period specified above.
|
||||
|
||||
(b) any software, hardware, or device, other than such Participant's
|
||||
Contributor Version, directly or indirectly infringes any patent, then
|
||||
any rights granted to You by such Participant under Sections 2.1(b)
|
||||
and 2.2(b) are revoked effective as of the date You first made, used,
|
||||
sold, distributed, or had made, Modifications made by that
|
||||
Participant.
|
||||
|
||||
8.3. If You assert a patent infringement claim against Participant
|
||||
alleging that such Participant's Contributor Version directly or
|
||||
indirectly infringes any patent where such claim is resolved (such as
|
||||
by license or settlement) prior to the initiation of patent
|
||||
infringement litigation, then the reasonable value of the licenses
|
||||
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
||||
into account in determining the amount or value of any payment or
|
||||
license.
|
||||
|
||||
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
||||
all end user license agreements (excluding distributors and resellers)
|
||||
which have been validly granted by You or any distributor hereunder
|
||||
prior to termination shall survive termination.
|
||||
|
||||
9. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
||||
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
||||
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
||||
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
||||
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
10. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Code is a "commercial item," as that term is defined in
|
||||
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
||||
software" and "commercial computer software documentation," as such
|
||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||
all U.S. Government End Users acquire Covered Code with only those
|
||||
rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. This License shall be governed by
|
||||
California law provisions (except to the extent applicable law, if
|
||||
any, provides otherwise), excluding its conflict-of-law provisions.
|
||||
With respect to disputes in which at least one party is a citizen of,
|
||||
or an entity chartered or registered to do business in the United
|
||||
States of America, any litigation relating to this License shall be
|
||||
subject to the jurisdiction of the Federal Courts of the Northern
|
||||
District of California, with venue lying in Santa Clara County,
|
||||
California, with the losing party responsible for costs, including
|
||||
without limitation, court costs and reasonable attorneys' fees and
|
||||
expenses. The application of the United Nations Convention on
|
||||
Contracts for the International Sale of Goods is expressly excluded.
|
||||
Any law or regulation which provides that the language of a contract
|
||||
shall be construed against the drafter shall not apply to this
|
||||
License.
|
||||
|
||||
12. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
As between Initial Developer and the Contributors, each party is
|
||||
responsible for claims and damages arising, directly or indirectly,
|
||||
out of its utilization of rights under this License and You agree to
|
||||
work with Initial Developer and Contributors to distribute such
|
||||
responsibility on an equitable basis. Nothing herein is intended or
|
||||
shall be deemed to constitute any admission of liability.
|
||||
|
||||
13. MULTIPLE-LICENSED CODE.
|
||||
|
||||
Initial Developer may designate portions of the Covered Code as
|
||||
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
||||
Developer permits you to utilize portions of the Covered Code under
|
||||
Your choice of the NPL or the alternative licenses, if any, specified
|
||||
by the Initial Developer in the file described in Exhibit A.
|
||||
|
||||
EXHIBIT A -Mozilla Public License.
|
||||
|
||||
``The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is ______________________________________.
|
||||
|
||||
The Initial Developer of the Original Code is ________________________.
|
||||
Portions created by ______________________ are Copyright (C) ______
|
||||
_______________________. All Rights Reserved.
|
||||
|
||||
Contributor(s): ______________________________________.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms
|
||||
of the _____ license (the "[___] License"), in which case the
|
||||
provisions of [______] License are applicable instead of those
|
||||
above. If you wish to allow use of your version of this file only
|
||||
under the terms of the [____] License and not to allow others to use
|
||||
your version of this file under the MPL, indicate your decision by
|
||||
deleting the provisions above and replace them with the notice and
|
||||
other provisions required by the [___] License. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file
|
||||
under either the MPL or the [___] License."
|
||||
|
||||
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||
the notices in the Source Code files of the Original Code. You should
|
||||
use the text of this Exhibit A rather than the text found in the
|
||||
Original Code Source Code for Your Modifications.]
|
9
cmph-2.0.2/Makefile.am
Normal file
9
cmph-2.0.2/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
||||
SUBDIRS = src tests examples man $(CXXMPH)
|
||||
EXTRA_DIST = cmph.spec configure.ac cmph.pc.in cxxmph.pc.in LGPL-2 MPL-1.1
|
||||
pkgconfig_DATA = cmph.pc
|
||||
if USE_CXXMPH
|
||||
pkgconfig_DATA += cxxmph.pc
|
||||
endif
|
||||
ACLOCAL_AMFLAGS="-Im4"
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
888
cmph-2.0.2/Makefile.in
Normal file
888
cmph-2.0.2/Makefile.in
Normal file
@ -0,0 +1,888 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@USE_CXXMPH_TRUE@am__append_1 = cxxmph.pc
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
|
||||
$(top_srcdir)/m4/cxx0x.m4 $(top_srcdir)/m4/largefile.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/spoon.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
$(am__configure_deps) $(am__DIST_COMMON)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = cmph.pc cxxmph.pc
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
|
||||
DATA = $(pkgconfig_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir distdir-am dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
|
||||
$(LISP)config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/cmph.pc.in \
|
||||
$(srcdir)/config.h.in $(srcdir)/cxxmph.pc.in AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS README compile config.guess config.sub \
|
||||
depcomp install-sh ltmain.sh missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHECK_CFLAGS = @CHECK_CFLAGS@
|
||||
CHECK_LIBS = @CHECK_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXMPH = @CXXMPH@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src tests examples man $(CXXMPH)
|
||||
EXTRA_DIST = cmph.spec configure.ac cmph.pc.in cxxmph.pc.in LGPL-2 MPL-1.1
|
||||
pkgconfig_DATA = cmph.pc $(am__append_1)
|
||||
ACLOCAL_AMFLAGS = "-Im4"
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@test -f $@ || rm -f stamp-h1
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
cmph.pc: $(top_builddir)/config.status $(srcdir)/cmph.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
cxxmph.pc: $(top_builddir)/config.status $(srcdir)/cxxmph.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
install-pkgconfigDATA: $(pkgconfig_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgconfigDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build/sub \
|
||||
&& ../../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgconfigDATA
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-pkgconfigDATA
|
||||
|
||||
.MAKE: $(am__recursive_targets) all install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip distcheck distclean distclean-generic \
|
||||
distclean-hdr distclean-libtool distclean-tags distcleancheck \
|
||||
distdir distuninstallcheck dvi dvi-am html html-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-pkgconfigDATA \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-pkgconfigDATA
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
0
cmph-2.0.2/NEWS
Normal file
0
cmph-2.0.2/NEWS
Normal file
326
cmph-2.0.2/README
Normal file
326
cmph-2.0.2/README
Normal file
@ -0,0 +1,326 @@
|
||||
CMPH - C Minimal Perfect Hashing Library
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
|
||||
Motivation
|
||||
==========
|
||||
|
||||
A perfect hash function maps a static set of n keys into a set of m integer numbers without collisions, where m is greater than or equal to n. If m is equal to n, the function is called minimal.
|
||||
|
||||
Minimal perfect hash functions (concepts.html) are widely used for memory efficient storage and fast retrieval of items from static sets, such as words in natural languages, reserved words in programming languages or interactive systems, universal resource locations (URLs) in Web search engines, or item sets in data mining techniques. Therefore, there are applications for minimal perfect hash functions in information retrieval systems, database systems, language translation systems, electronic commerce systems, compilers, operating systems, among others.
|
||||
|
||||
The use of minimal perfect hash functions is, until now, restricted to scenarios where the set of keys being hashed is small, because of the limitations of current algorithms. But in many cases, to deal with huge set of keys is crucial. So, this project gives to the free software community an API that will work with sets in the order of billion of keys.
|
||||
|
||||
Probably, the most interesting application for minimal perfect hash functions is its use as an indexing structure for databases. The most popular data structure used as an indexing structure in databases is the B+ tree. In fact, the B+ tree is very used for dynamic applications with frequent insertions and deletions of records. However, for applications with sporadic modifications and a huge number of queries the B+ tree is not the best option, because practical deployments of this structure are extremely complex, and perform poorly with very large sets of keys such as those required for the new frontiers database applications (http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=299).
|
||||
|
||||
For example, in the information retrieval field, the work with huge collections is a daily task. The simple assignment of ids to web pages of a collection can be a challenging task. While traditional databases simply cannot handle more traffic once the working set of web page urls does not fit in main memory anymore, minimal perfect hash functions can easily scale to hundred of millions of entries, using stock hardware.
|
||||
|
||||
As there are lots of applications for minimal perfect hash functions, it is important to implement memory and time efficient algorithms for constructing such functions. The lack of similar libraries in the free software world has been the main motivation to create the C Minimal Perfect Hashing Library (gperf is a bit different (gperf.html), since it was conceived to create very fast perfect hash functions for small sets of keys and CMPH Library was conceived to create minimal perfect hash functions for very large sets of keys). C Minimal Perfect Hashing Library is a portable LGPLed library to generate and to work with very efficient minimal perfect hash functions.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
The CMPH Library encapsulates the newest and more efficient algorithms in an easy-to-use, production-quality, fast API. The library was designed to work with big entries that cannot fit in the main memory. It has been used successfully for constructing minimal perfect hash functions for sets with more than 100 million of keys, and we intend to expand this number to the order of billion of keys. Although there is a lack of similar libraries, we can point out some of the distinguishable features of the CMPH Library:
|
||||
|
||||
- Fast.
|
||||
- Space-efficient with main memory usage carefully documented.
|
||||
- The best modern algorithms are available (or at least scheduled for implementation :-)).
|
||||
- Works with in-disk key sets through of using the adapter pattern.
|
||||
- Serialization of hash functions.
|
||||
- Portable C code (currently works on GNU/Linux and WIN32 and is reported to work in OpenBSD and Solaris).
|
||||
- Object oriented implementation.
|
||||
- Easily extensible.
|
||||
- Well encapsulated API aiming binary compatibility through releases.
|
||||
- Free Software.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
Supported Algorithms
|
||||
====================
|
||||
|
||||
- CHD Algorithm:
|
||||
- It is the fastest algorithm to build PHFs and MPHFs in linear time.
|
||||
- It generates the most compact PHFs and MPHFs we know of.
|
||||
- It can generate PHFs with a load factor up to 99 %.
|
||||
- It can be used to generate t-perfect hash functions. A t-perfect hash function allows at most t collisions in a given bin. It is a well-known fact that modern memories are organized as blocks which constitute transfer unit. Example of such blocks are cache lines for internal memory or sectors for hard disks. Thus, it can be very useful for devices that carry out I/O operations in blocks.
|
||||
- It is a two level scheme. It uses a first level hash function to split the key set in buckets of average size determined by a parameter b in the range [1,32]. In the second level it uses displacement values to resolve the collisions that have given rise to the buckets.
|
||||
- It can generate MPHFs that can be stored in approximately 2.07 bits per key.
|
||||
- For a load factor equal to the maximum one that is achieved by the BDZ algorithm (81 %), the resulting PHFs are stored in approximately 1.40 bits per key.
|
||||
- BDZ Algorithm:
|
||||
- It is very simple and efficient. It outperforms all the ones below.
|
||||
- It constructs both PHFs and MPHFs in linear time.
|
||||
- The maximum load factor one can achieve for a PHF is 1/1.23.
|
||||
- It is based on acyclic random 3-graphs. A 3-graph is a generalization of a graph where each edge connects 3 vertices instead of only 2.
|
||||
- The resulting MPHFs are not order preserving.
|
||||
- The resulting MPHFs can be stored in only (2 + x)cn bits, where c should be larger than or equal to 1.23 and x is a constant larger than 0 (actually, x = 1/b and b is a parameter that should be larger than 2). For c = 1.23 and b = 8, the resulting functions are stored in approximately 2.6 bits per key.
|
||||
- For its maximum load factor (81 %), the resulting PHFs are stored in approximately 1.95 bits per key.
|
||||
- BMZ Algorithm:
|
||||
- Construct MPHFs in linear time.
|
||||
- It is based on cyclic random graphs. This makes it faster than the CHM algorithm.
|
||||
- The resulting MPHFs are not order preserving.
|
||||
- The resulting MPHFs are more compact than the ones generated by the CHM algorithm and can be stored in 4cn bytes, where c is in the range [0.93,1.15].
|
||||
- BRZ Algorithm:
|
||||
- A very fast external memory based algorithm for constructing minimal perfect hash functions for sets in the order of billions of keys.
|
||||
- It works in linear time.
|
||||
- The resulting MPHFs are not order preserving.
|
||||
- The resulting MPHFs can be stored using less than 8.0 bits per key.
|
||||
- CHM Algorithm:
|
||||
- Construct minimal MPHFs in linear time.
|
||||
- It is based on acyclic random graphs
|
||||
- The resulting MPHFs are order preserving.
|
||||
- The resulting MPHFs are stored in 4cn bytes, where c is greater than 2.
|
||||
- FCH Algorithm:
|
||||
- Construct minimal perfect hash functions that require less than 4 bits per key to be stored.
|
||||
- The resulting MPHFs are very compact and very efficient at evaluation time
|
||||
- The algorithm is only efficient for small sets.
|
||||
- It is used as internal algorithm in the BRZ algorithm to efficiently solve larger problems and even so to generate MPHFs that require approximately 4.1 bits per key to be stored. For that, you just need to set the parameters -a to brz and -c to a value larger than or equal to 2.6.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
News for version 2.0
|
||||
====================
|
||||
|
||||
Cleaned up most warnings for the c code.
|
||||
|
||||
Experimental C++ interface (--enable-cxxmph) implementing the BDZ algorithm in
|
||||
a convenient interface, which serves as the basis
|
||||
for drop-in replacements for std::unordered_map, sparsehash::sparse_hash_map
|
||||
and sparsehash::dense_hash_map. Potentially faster lookup time at the expense
|
||||
of insertion time. See cxxmpph/mph_map.h and cxxmph/mph_index.h for details.
|
||||
|
||||
|
||||
News for version 1.1
|
||||
====================
|
||||
|
||||
Fixed a bug in the chd_pc algorithm and reorganized tests.
|
||||
|
||||
|
||||
News for version 1.0
|
||||
====================
|
||||
|
||||
This is a bugfix only version, after which a revamp of the cmph code and
|
||||
algorithms will be done.
|
||||
|
||||
|
||||
News for version 0.9
|
||||
====================
|
||||
|
||||
- The CHD algorithm (chd.html), which is an algorithm that can be tuned to generate MPHFs that require approximately 2.07 bits per key to be stored. The algorithm outperforms the BDZ algorithm (bdz.html) and therefore is the fastest one available in the literature for sets that can be treated in internal memory.
|
||||
- The CHD_PH algorithm (chd.html), which is an algorithm to generate PHFs with load factor up to 99 %. It is actually the CHD algorithm without the ranking step. If we set the load factor to 81 %, which is the maximum that can be obtained with the BDZ algorithm (bdz.html), the resulting functions can be stored in 1.40 bits per key. The space requirement increases with the load factor.
|
||||
- All reported bugs and suggestions have been corrected and included as well.
|
||||
|
||||
|
||||
News for version 0.8
|
||||
====================
|
||||
|
||||
- An algorithm to generate MPHFs that require around 2.6 bits per key to be stored (bdz.html), which is referred to as BDZ algorithm. The algorithm is the fastest one available in the literature for sets that can be treated in internal memory.
|
||||
- An algorithm to generate PHFs with range m = cn, for c > 1.22 (bdz.html), which is referred to as BDZ_PH algorithm. It is actually the BDZ algorithm without the ranking step. The resulting functions can be stored in 1.95 bits per key for c = 1.23 and are considerably faster than the MPHFs generated by the BDZ algorithm.
|
||||
- An adapter to support a vector of struct as the source of keys has been added.
|
||||
- An API to support the ability of packing a perfect hash function into a preallocated contiguous memory space. The computation of a packed function is still faster and can be easily mmapped.
|
||||
- The hash functions djb2, fnv and sdbm were removed because they do not use random seeds and therefore are not useful for MPHFs algorithms.
|
||||
- All reported bugs and suggestions have been corrected and included as well.
|
||||
|
||||
News log (newslog.html)
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
Using cmph is quite simple. Take a look.
|
||||
|
||||
#include <cmph.h>
|
||||
#include <string.h>
|
||||
// Create minimal perfect hash function from in-memory vector
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
// Creating a filled vector
|
||||
unsigned int i = 0;
|
||||
const char *vector[] = {"aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc", "dddddddddd", "eeeeeeeeee",
|
||||
"ffffffffff", "gggggggggg", "hhhhhhhhhh", "iiiiiiiiii", "jjjjjjjjjj"};
|
||||
unsigned int nkeys = 10;
|
||||
FILE* mphf_fd = fopen("temp.mph", "w");
|
||||
// Source of keys
|
||||
cmph_io_adapter_t *source = cmph_io_vector_adapter((char **)vector, nkeys);
|
||||
|
||||
//Create minimal perfect hash function using the brz algorithm.
|
||||
cmph_config_t *config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, CMPH_BRZ);
|
||||
cmph_config_set_mphf_fd(config, mphf_fd);
|
||||
cmph_t *hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
cmph_dump(hash, mphf_fd);
|
||||
cmph_destroy(hash);
|
||||
fclose(mphf_fd);
|
||||
|
||||
//Find key
|
||||
mphf_fd = fopen("temp.mph", "r");
|
||||
hash = cmph_load(mphf_fd);
|
||||
while (i < nkeys) {
|
||||
const char *key = vector[i];
|
||||
unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
|
||||
fprintf(stderr, "key:%s -- hash:%u\n", key, id);
|
||||
i++;
|
||||
}
|
||||
|
||||
//Destroy hash
|
||||
cmph_destroy(hash);
|
||||
cmph_io_vector_adapter_destroy(source);
|
||||
fclose(mphf_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Download vector_adapter_ex1.c (examples/vector_adapter_ex1.c). This example does not work in versions below 0.6. You need to update the sources from GIT to make it work.
|
||||
|
||||
-------------------------------
|
||||
|
||||
#include <cmph.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
// Create minimal perfect hash function from in-disk keys using BDZ algorithm
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//Open file with newline separated list of keys
|
||||
FILE * keys_fd = fopen("keys.txt", "r");
|
||||
cmph_t *hash = NULL;
|
||||
if (keys_fd == NULL)
|
||||
{
|
||||
fprintf(stderr, "File \"keys.txt\" not found\n");
|
||||
exit(1);
|
||||
}
|
||||
// Source of keys
|
||||
cmph_io_adapter_t *source = cmph_io_nlfile_adapter(keys_fd);
|
||||
|
||||
cmph_config_t *config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, CMPH_BDZ);
|
||||
hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
|
||||
//Find key
|
||||
const char *key = "jjjjjjjjjj";
|
||||
unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
|
||||
fprintf(stderr, "Id:%u\n", id);
|
||||
//Destroy hash
|
||||
cmph_destroy(hash);
|
||||
cmph_io_nlfile_adapter_destroy(source);
|
||||
fclose(keys_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Download file_adapter_ex2.c (examples/file_adapter_ex2.c) and keys.txt (examples/keys.txt). This example does not work in versions below 0.8. You need to update the sources from GIT to make it work.
|
||||
|
||||
Click here to see more examples (examples.html)
|
||||
|
||||
--------------------------------------
|
||||
|
||||
|
||||
The cmph application
|
||||
====================
|
||||
|
||||
cmph is the name of both the library and the utility
|
||||
application that comes with this package. You can use the cmph
|
||||
application for constructing minimal perfect hash functions from the command line.
|
||||
The cmph utility
|
||||
comes with a number of flags, but it is very simple to create and to query
|
||||
minimal perfect hash functions:
|
||||
|
||||
$ # Using the chm algorithm (default one) for constructing a mphf for keys in file keys_file
|
||||
$ ./cmph -g keys_file
|
||||
$ # Query id of keys in the file keys_query
|
||||
$ ./cmph -m keys_file.mph keys_query
|
||||
|
||||
The additional options let you set most of the parameters you have
|
||||
available through the C API. Below you can see the full help message for the
|
||||
utility.
|
||||
|
||||
usage: cmph [-v] [-h] [-V] [-k nkeys] [-f hash_function] [-g [-c algorithm_dependent_value][-s seed] ]
|
||||
[-a algorithm] [-M memory_in_MB] [-b algorithm_dependent_value] [-t keys_per_bin] [-d tmp_dir]
|
||||
[-m file.mph] keysfile
|
||||
Minimum perfect hashing tool
|
||||
|
||||
-h print this help message
|
||||
-c c value determines:
|
||||
* the number of vertices in the graph for the algorithms BMZ and CHM
|
||||
* the number of bits per key required in the FCH algorithm
|
||||
* the load factor in the CHD_PH algorithm
|
||||
-a algorithm - valid values are
|
||||
* bmz
|
||||
* bmz8
|
||||
* chm
|
||||
* brz
|
||||
* fch
|
||||
* bdz
|
||||
* bdz_ph
|
||||
* chd_ph
|
||||
* chd
|
||||
-f hash function (may be used multiple times) - valid values are
|
||||
* jenkins
|
||||
-V print version number and exit
|
||||
-v increase verbosity (may be used multiple times)
|
||||
-k number of keys
|
||||
-g generation mode
|
||||
-s random seed
|
||||
-m minimum perfect hash function file
|
||||
-M main memory availability (in MB) used in BRZ algorithm
|
||||
-d temporary directory used in BRZ algorithm
|
||||
-b the meaning of this parameter depends on the algorithm selected in the -a option:
|
||||
* For BRZ it is used to make the maximal number of keys in a bucket lower than 256.
|
||||
In this case its value should be an integer in the range [64,175]. Default is 128.
|
||||
|
||||
* For BDZ it is used to determine the size of some precomputed rank
|
||||
information and its value should be an integer in the range [3,10]. Default
|
||||
is 7. The larger is this value, the more compact are the resulting functions
|
||||
and the slower are them at evaluation time.
|
||||
|
||||
* For CHD and CHD_PH it is used to set the average number of keys per bucket
|
||||
and its value should be an integer in the range [1,32]. Default is 4. The
|
||||
larger is this value, the slower is the construction of the functions.
|
||||
This parameter has no effect for other algorithms.
|
||||
|
||||
-t set the number of keys per bin for a t-perfect hashing function. A t-perfect
|
||||
hash function allows at most t collisions in a given bin. This parameter applies
|
||||
only to the CHD and CHD_PH algorithms. Its value should be an integer in the
|
||||
range [1,128]. Defaul is 1
|
||||
keysfile line separated file with keys
|
||||
|
||||
|
||||
Additional Documentation
|
||||
========================
|
||||
|
||||
FAQ (faq.html)
|
||||
|
||||
|
||||
Downloads
|
||||
=========
|
||||
|
||||
Use the project page at sourceforge: http://sf.net/projects/cmph
|
||||
|
||||
|
||||
License Stuff
|
||||
=============
|
||||
|
||||
Code is under the LGPL and the MPL 1.1.
|
||||
|
||||
----------------------------------------
|
||||
|
||||
Enjoy!
|
||||
|
||||
Davi de Castro Reis (davi@users.sourceforge.net)
|
||||
|
||||
Djamel Belazzougui (db8192@users.sourceforge.net)
|
||||
|
||||
Fabiano Cupertino Botelho (fc_botelho@users.sourceforge.net)
|
||||
|
||||
Nivio Ziviani (nivio@dcc.ufmg.br)
|
||||
|
||||
Last Updated: Fri Jun 6 17:16:57 2014
|
||||
|
1144
cmph-2.0.2/aclocal.m4
vendored
Normal file
1144
cmph-2.0.2/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12
cmph-2.0.2/cmph.pc.in
Normal file
12
cmph-2.0.2/cmph.pc.in
Normal file
@ -0,0 +1,12 @@
|
||||
url=http://cmph.sourceforge.net/
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: cmph
|
||||
Description: minimal perfect hashing library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lcmph
|
||||
Cflags: -I${includedir}
|
||||
URL: ${url}
|
39
cmph-2.0.2/cmph.spec
Normal file
39
cmph-2.0.2/cmph.spec
Normal file
@ -0,0 +1,39 @@
|
||||
%define name cmph
|
||||
%define version 0.4
|
||||
%define release 3
|
||||
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Summary: C Minimal perfect hash library
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
License: Proprietary
|
||||
URL: http://www.akwan.com.br
|
||||
BuildArch: i386
|
||||
Group: Sitesearch
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
|
||||
%description
|
||||
C Minimal perfect hash library
|
||||
|
||||
%prep
|
||||
rm -Rf $RPM_BUILD_ROOT
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%setup
|
||||
mkdir $RPM_BUILD_ROOT
|
||||
mkdir $RPM_BUILD_ROOT/usr
|
||||
CXXFLAGS="-O2" ./configure --prefix=/usr/
|
||||
|
||||
%build
|
||||
make
|
||||
|
||||
%install
|
||||
DESTDIR=$RPM_BUILD_ROOT make install
|
||||
|
||||
%files
|
||||
%defattr(755,root,root)
|
||||
/
|
||||
|
||||
%changelog
|
||||
* Tue Jun 1 2004 Davi de Castro Reis <davi@akwan.com.br>
|
||||
+ Initial build
|
348
cmph-2.0.2/compile
Executable file
348
cmph-2.0.2/compile
Executable file
@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1476
cmph-2.0.2/config.guess
vendored
Executable file
1476
cmph-2.0.2/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
85
cmph-2.0.2/config.h.in
Normal file
85
cmph-2.0.2/config.h.in
Normal file
@ -0,0 +1,85 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the <hopscotch_map.h> header file. */
|
||||
#undef HAVE_HOPSCOTCH_MAP_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `check' library (-lcheck). */
|
||||
#undef HAVE_LIBCHECK
|
||||
|
||||
/* Define to 1 if you have the <math.h> header file. */
|
||||
#undef HAVE_MATH_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if g++ supports C++0x features. */
|
||||
#undef HAVE_STDCXX_0X
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define to make fseeko etc. visible, on some hosts. */
|
||||
#undef _LARGEFILE_SOURCE
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
1801
cmph-2.0.2/config.sub
vendored
Executable file
1801
cmph-2.0.2/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
19345
cmph-2.0.2/configure
vendored
Executable file
19345
cmph-2.0.2/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
83
cmph-2.0.2/configure.ac
Normal file
83
cmph-2.0.2/configure.ac
Normal file
@ -0,0 +1,83 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT([cmph], [2.0.2])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
LT_INIT
|
||||
AC_SYS_EXTRA_LARGEFILE
|
||||
if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
|
||||
ac_cv_sys_largefile_CFLAGS=""
|
||||
fi
|
||||
if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
|
||||
ac_cv_sys_largefile_LDFLAGS=""
|
||||
fi
|
||||
if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
|
||||
ac_cv_sys_largefile_LIBS=""
|
||||
fi
|
||||
CFLAGS="$ac_cv_sys_largefile_CFLAGS $CFLAGS"
|
||||
LDFLAGS="$ac_cv_sys_largefile_LDFLAGS $LDFLAGS"
|
||||
LIBS="$LIBS $ac_cv_sys_largefile_LIBS"
|
||||
|
||||
dnl Checks for headers
|
||||
AC_CHECK_HEADERS([getopt.h math.h])
|
||||
|
||||
dnl Checks for libraries.
|
||||
LT_LIB_M
|
||||
LDFLAGS="$LIBS $LIBM $LDFLAGS"
|
||||
CFLAGS="-Wall $CFLAGS"
|
||||
|
||||
AC_PROG_CXX
|
||||
CXXFLAGS="-Wall -Wno-unused-function -DNDEBUG -O3 -fomit-frame-pointer $CXXFLAGS"
|
||||
AC_ENABLE_CXXMPH
|
||||
if test x$cxxmph = xtrue; then
|
||||
AC_COMPILE_STDCXX_0X
|
||||
if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; then
|
||||
if test x$ac_cv_cxx_compile_cxx11_cxx = "xyes"; then
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
elif test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then
|
||||
CXXFLAGS="$CXXFLAGS -std=c++0x"
|
||||
elif test x$ac_cv_cxx_compile_cxx0x_gxx = "xyes"; then
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
|
||||
else
|
||||
AC_MSG_ERROR("cxxmph demands a working c++0x compiler.")
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CXXMPH], "cxxmph")
|
||||
fi
|
||||
AM_CONDITIONAL([USE_CXXMPH], [test "$cxxmph" = true])
|
||||
|
||||
AC_ENABLE_BENCHMARKS
|
||||
if test x$benchmarks = xtrue; then
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CHECK_HEADERS([hopscotch_map.h])
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_BENCHMARKS], [test "$benchmarks" = true])
|
||||
|
||||
# Unit tests based on the check library. Disabled by default.
|
||||
# We do not use pkg-config because it is inconvenient for all developers to
|
||||
# have check library installed.
|
||||
AC_ARG_ENABLE(check, AS_HELP_STRING(
|
||||
[--enable-check],
|
||||
[Build unit tests depending on check library (default: disabled)]))
|
||||
AS_IF([test "x$enable_check" = "xyes"],
|
||||
[ AC_CHECK_LIB([check], [tcase_create])
|
||||
AS_IF([test "$ac_cv_lib_check_tcase_create" = yes], [CHECK_LIBS="-lcheck"],
|
||||
[AC_MSG_ERROR("Failed to find check library (http://check.sf.net).")])
|
||||
AC_CHECK_HEADER(check.h,[],
|
||||
[AC_MSG_ERROR("Failed to find check library header (http://check.sf.net).")])
|
||||
])
|
||||
AM_CONDITIONAL([USE_LIBCHECK], [test "$ac_cv_lib_check_tcase_create" = yes])
|
||||
AC_SUBST(CHECK_LIBS)
|
||||
AC_SUBST(CHECK_CFLAGS)
|
||||
|
||||
AC_CHECK_SPOON
|
||||
AC_CONFIG_FILES([Makefile src/Makefile cxxmph/Makefile tests/Makefile examples/Makefile man/Makefile cmph.pc cxxmph.pc])
|
||||
AC_OUTPUT
|
12
cmph-2.0.2/cxxmph.pc.in
Normal file
12
cmph-2.0.2/cxxmph.pc.in
Normal file
@ -0,0 +1,12 @@
|
||||
url=http://cmph.sourceforge.net/
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: cxxmph
|
||||
Description: minimal perfect hashing c++11 library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lcxxmph
|
||||
Cflags: -std=c++0x -I${includedir}
|
||||
URL: ${url}
|
62
cmph-2.0.2/cxxmph/Makefile.am
Normal file
62
cmph-2.0.2/cxxmph/Makefile.am
Normal file
@ -0,0 +1,62 @@
|
||||
TESTS = $(check_PROGRAMS)
|
||||
check_PROGRAMS = seeded_hash_test mph_bits_test hollow_iterator_test mph_index_test trigraph_test
|
||||
if USE_LIBCHECK
|
||||
check_PROGRAMS += test_test map_tester_test mph_map_test dense_hash_map_test string_util_test
|
||||
check_LTLIBRARIES = libcxxmph_test.la
|
||||
endif
|
||||
|
||||
if USE_BENCHMARKS
|
||||
noinst_PROGRAMS = bm_map # bm_index - disabled because of cmph dependency
|
||||
endif
|
||||
bin_PROGRAMS = cxxmph
|
||||
|
||||
cxxmph_includedir = $(includedir)/cxxmph/
|
||||
cxxmph_include_HEADERS = mph_bits.h mph_map.h mph_index.h MurmurHash3.h trigraph.h seeded_hash.h stringpiece.h hollow_iterator.h string_util.h
|
||||
|
||||
noinst_LTLIBRARIES = libcxxmph_bm.la
|
||||
lib_LTLIBRARIES = libcxxmph.la
|
||||
libcxxmph_la_SOURCES = MurmurHash3.cpp trigraph.cc mph_bits.cc mph_index.cc benchmark.h benchmark.cc string_util.cc
|
||||
libcxxmph_la_LDFLAGS = -version-info 0:0:0
|
||||
libcxxmph_test_la_SOURCES = test.h test.cc
|
||||
libcxxmph_test_la_LIBADD = libcxxmph.la
|
||||
libcxxmph_bm_la_SOURCES = benchmark.h benchmark.cc bm_common.h bm_common.cc
|
||||
libcxxmph_bm_la_LIBADD = libcxxmph.la
|
||||
|
||||
test_test_SOURCES = test_test.cc
|
||||
test_test_LDADD = libcxxmph_test.la $(CHECK_LIBS)
|
||||
|
||||
mph_map_test_LDADD = libcxxmph_test.la $(CHECK_LIBS)
|
||||
mph_map_test_SOURCES = mph_map_test.cc
|
||||
dense_hash_map_test_LDADD = libcxxmph_test.la $(CHECK_LIBS)
|
||||
dense_hash_map_test_SOURCES = dense_hash_map_test.cc
|
||||
|
||||
mph_index_test_LDADD = libcxxmph.la
|
||||
mph_index_test_SOURCES = mph_index_test.cc
|
||||
|
||||
trigraph_test_LDADD = libcxxmph.la
|
||||
trigraph_test_SOURCES = trigraph_test.cc
|
||||
|
||||
# Bad dependency, do not compile by default.
|
||||
# bm_index_LDADD = libcxxmph_bm.la -lcmph
|
||||
# bm_index_SOURCES = bm_index.cc
|
||||
|
||||
bm_map_LDADD = libcxxmph_bm.la
|
||||
bm_map_SOURCES = bm_map.cc
|
||||
|
||||
cxxmph_LDADD = libcxxmph.la
|
||||
cxxmph_SOURCES = cxxmph.cc
|
||||
|
||||
hollow_iterator_test_SOURCES = hollow_iterator_test.cc
|
||||
|
||||
seeded_hash_test_SOURCES = seeded_hash_test.cc
|
||||
seeded_hash_test_LDADD = libcxxmph.la
|
||||
|
||||
mph_bits_test_SOURCES = mph_bits_test.cc
|
||||
mph_bits_test_LDADD = libcxxmph.la
|
||||
|
||||
string_util_test_SOURCES = string_util_test.cc
|
||||
string_util_test_LDADD = libcxxmph.la libcxxmph_test.la $(CHECK_LIBS)
|
||||
|
||||
map_tester_test_SOURCES = map_tester.h map_tester.cc map_tester_test.cc
|
||||
map_tester_test_LDADD = libcxxmph.la libcxxmph_test.la $(CHECK_LIBS)
|
||||
|
1471
cmph-2.0.2/cxxmph/Makefile.in
Normal file
1471
cmph-2.0.2/cxxmph/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
335
cmph-2.0.2/cxxmph/MurmurHash3.cpp
Normal file
335
cmph-2.0.2/cxxmph/MurmurHash3.cpp
Normal file
@ -0,0 +1,335 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
// domain. The author hereby disclaims copyright to this source code.
|
||||
|
||||
// Note - The x86 and x64 versions do _not_ produce the same results, as the
|
||||
// algorithms are optimized for their respective platforms. You can still
|
||||
// compile and run any of them on any platform, but your performance with the
|
||||
// non-native version will be less than optimal.
|
||||
|
||||
#include "MurmurHash3.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
// Microsoft Visual Studio
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#define FORCE_INLINE __forceinline
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ROTL32(x,y) _rotl(x,y)
|
||||
#define ROTL64(x,y) _rotl64(x,y)
|
||||
|
||||
#define BIG_CONSTANT(x) (x)
|
||||
|
||||
// Other compilers
|
||||
|
||||
#else // defined(_MSC_VER)
|
||||
|
||||
#define FORCE_INLINE __attribute__((always_inline))
|
||||
|
||||
inline uint32_t rotl32 ( uint32_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (32 - r));
|
||||
}
|
||||
|
||||
inline uint64_t rotl64 ( uint64_t x, int8_t r )
|
||||
{
|
||||
return (x << r) | (x >> (64 - r));
|
||||
}
|
||||
|
||||
#define ROTL32(x,y) rotl32(x,y)
|
||||
#define ROTL64(x,y) rotl64(x,y)
|
||||
|
||||
#define BIG_CONSTANT(x) (x##LLU)
|
||||
|
||||
#endif // !defined(_MSC_VER)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Block read - if your platform needs to do endian-swapping or can only
|
||||
// handle aligned reads, do the conversion here
|
||||
|
||||
/*FORCE_INLINE*/ uint32_t getblock ( const uint32_t * p, int i )
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
|
||||
/*FORCE_INLINE*/ uint64_t getblock ( const uint64_t * p, int i )
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Finalization mix - force all bits of a hash block to avalanche
|
||||
|
||||
/*FORCE_INLINE*/ uint32_t fmix ( uint32_t h )
|
||||
{
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
/*FORCE_INLINE*/ uint64_t fmix ( uint64_t k )
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xff51afd7ed558ccd);
|
||||
k ^= k >> 33;
|
||||
k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
|
||||
k ^= k >> 33;
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 ( const void * key, int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 4;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
|
||||
uint32_t c1 = 0xcc9e2d51;
|
||||
uint32_t c2 = 0x1b873593;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
|
||||
|
||||
for(int i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock(blocks,i);
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32(k1,15);
|
||||
k1 *= c2;
|
||||
|
||||
h1 ^= k1;
|
||||
h1 = ROTL32(h1,13);
|
||||
h1 = h1*5+0xe6546b64;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
|
||||
switch(len & 3)
|
||||
{
|
||||
case 3: k1 ^= tail[2] << 16;
|
||||
case 2: k1 ^= tail[1] << 8;
|
||||
case 1: k1 ^= tail[0];
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len;
|
||||
|
||||
h1 = fmix(h1);
|
||||
|
||||
*(uint32_t*)out = h1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_128 ( const void * key, const int len,
|
||||
uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
|
||||
uint32_t h1 = seed;
|
||||
uint32_t h2 = seed;
|
||||
uint32_t h3 = seed;
|
||||
uint32_t h4 = seed;
|
||||
|
||||
uint32_t c1 = 0x239b961b;
|
||||
uint32_t c2 = 0xab0e9789;
|
||||
uint32_t c3 = 0x38b34ae5;
|
||||
uint32_t c4 = 0xa1e38b93;
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
|
||||
|
||||
for(int i = -nblocks; i; i++)
|
||||
{
|
||||
uint32_t k1 = getblock(blocks,i*4+0);
|
||||
uint32_t k2 = getblock(blocks,i*4+1);
|
||||
uint32_t k3 = getblock(blocks,i*4+2);
|
||||
uint32_t k4 = getblock(blocks,i*4+3);
|
||||
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
|
||||
h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
|
||||
|
||||
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
|
||||
|
||||
h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
|
||||
|
||||
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
|
||||
|
||||
h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
|
||||
|
||||
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
|
||||
|
||||
h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint32_t k1 = 0;
|
||||
uint32_t k2 = 0;
|
||||
uint32_t k3 = 0;
|
||||
uint32_t k4 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k4 ^= tail[14] << 16;
|
||||
case 14: k4 ^= tail[13] << 8;
|
||||
case 13: k4 ^= tail[12] << 0;
|
||||
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
|
||||
|
||||
case 12: k3 ^= tail[11] << 24;
|
||||
case 11: k3 ^= tail[10] << 16;
|
||||
case 10: k3 ^= tail[ 9] << 8;
|
||||
case 9: k3 ^= tail[ 8] << 0;
|
||||
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
|
||||
|
||||
case 8: k2 ^= tail[ 7] << 24;
|
||||
case 7: k2 ^= tail[ 6] << 16;
|
||||
case 6: k2 ^= tail[ 5] << 8;
|
||||
case 5: k2 ^= tail[ 4] << 0;
|
||||
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
|
||||
|
||||
case 4: k1 ^= tail[ 3] << 24;
|
||||
case 3: k1 ^= tail[ 2] << 16;
|
||||
case 2: k1 ^= tail[ 1] << 8;
|
||||
case 1: k1 ^= tail[ 0] << 0;
|
||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
|
||||
|
||||
h1 += h2; h1 += h3; h1 += h4;
|
||||
h2 += h1; h3 += h1; h4 += h1;
|
||||
|
||||
h1 = fmix(h1);
|
||||
h2 = fmix(h2);
|
||||
h3 = fmix(h3);
|
||||
h4 = fmix(h4);
|
||||
|
||||
h1 += h2; h1 += h3; h1 += h4;
|
||||
h2 += h1; h3 += h1; h4 += h1;
|
||||
|
||||
((uint32_t*)out)[0] = h1;
|
||||
((uint32_t*)out)[1] = h2;
|
||||
((uint32_t*)out)[2] = h3;
|
||||
((uint32_t*)out)[3] = h4;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x64_128 ( const void * key, const int len,
|
||||
const uint32_t seed, void * out )
|
||||
{
|
||||
const uint8_t * data = (const uint8_t*)key;
|
||||
const int nblocks = len / 16;
|
||||
|
||||
uint64_t h1 = seed;
|
||||
uint64_t h2 = seed;
|
||||
|
||||
uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
|
||||
uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
|
||||
|
||||
//----------
|
||||
// body
|
||||
|
||||
const uint64_t * blocks = (const uint64_t *)(data);
|
||||
|
||||
for(int i = 0; i < nblocks; i++)
|
||||
{
|
||||
uint64_t k1 = getblock(blocks,i*2+0);
|
||||
uint64_t k2 = getblock(blocks,i*2+1);
|
||||
|
||||
k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
|
||||
|
||||
h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
|
||||
|
||||
k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
|
||||
|
||||
h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
|
||||
|
||||
uint64_t k1 = 0;
|
||||
uint64_t k2 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= uint64_t(tail[14]) << 48;
|
||||
case 14: k2 ^= uint64_t(tail[13]) << 40;
|
||||
case 13: k2 ^= uint64_t(tail[12]) << 32;
|
||||
case 12: k2 ^= uint64_t(tail[11]) << 24;
|
||||
case 11: k2 ^= uint64_t(tail[10]) << 16;
|
||||
case 10: k2 ^= uint64_t(tail[ 9]) << 8;
|
||||
case 9: k2 ^= uint64_t(tail[ 8]) << 0;
|
||||
k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
|
||||
|
||||
case 8: k1 ^= uint64_t(tail[ 7]) << 56;
|
||||
case 7: k1 ^= uint64_t(tail[ 6]) << 48;
|
||||
case 6: k1 ^= uint64_t(tail[ 5]) << 40;
|
||||
case 5: k1 ^= uint64_t(tail[ 4]) << 32;
|
||||
case 4: k1 ^= uint64_t(tail[ 3]) << 24;
|
||||
case 3: k1 ^= uint64_t(tail[ 2]) << 16;
|
||||
case 2: k1 ^= uint64_t(tail[ 1]) << 8;
|
||||
case 1: k1 ^= uint64_t(tail[ 0]) << 0;
|
||||
k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h1 ^= len; h2 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix(h1);
|
||||
h2 = fmix(h2);
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
((uint64_t*)out)[0] = h1;
|
||||
((uint64_t*)out)[1] = h2;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
37
cmph-2.0.2/cxxmph/MurmurHash3.h
Normal file
37
cmph-2.0.2/cxxmph/MurmurHash3.h
Normal file
@ -0,0 +1,37 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// MurmurHash3 was written by Austin Appleby, and is placed in the public
|
||||
// domain. The author hereby disclaims copyright to this source code.
|
||||
|
||||
#ifndef _MURMURHASH3_H_
|
||||
#define _MURMURHASH3_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
// Microsoft Visual Studio
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
// Other compilers
|
||||
|
||||
#else // defined(_MSC_VER)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#endif // !defined(_MSC_VER)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _MURMURHASH3_H_
|
142
cmph-2.0.2/cxxmph/benchmark.cc
Normal file
142
cmph-2.0.2/cxxmph/benchmark.cc
Normal file
@ -0,0 +1,142 @@
|
||||
#include "benchmark.h"
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::setfill;
|
||||
using std::setw;
|
||||
using std::string;
|
||||
using std::ostringstream;
|
||||
using std::vector;
|
||||
|
||||
namespace {
|
||||
|
||||
/* Subtract the `struct timeval' values X and Y,
|
||||
storing the result in RESULT.
|
||||
Return 1 if the difference is negative, otherwise 0. */
|
||||
int timeval_subtract (
|
||||
struct timeval *result, struct timeval *x, struct timeval* y) {
|
||||
/* Perform the carry for the later subtraction by updating y. */
|
||||
if (x->tv_usec < y->tv_usec) {
|
||||
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
||||
y->tv_usec -= 1000000 * nsec;
|
||||
y->tv_sec += nsec;
|
||||
}
|
||||
if (x->tv_usec - y->tv_usec > 1000000) {
|
||||
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
||||
y->tv_usec += 1000000 * nsec;
|
||||
y->tv_sec -= nsec;
|
||||
}
|
||||
|
||||
/* Compute the time remaining to wait.
|
||||
tv_usec is certainly positive. */
|
||||
result->tv_sec = x->tv_sec - y->tv_sec;
|
||||
result->tv_usec = x->tv_usec - y->tv_usec;
|
||||
|
||||
/* Return 1 if result is negative. */
|
||||
return x->tv_sec < y->tv_sec;
|
||||
}
|
||||
|
||||
// C++ iostream is terrible for formatting.
|
||||
string timeval_to_string(timeval tv) {
|
||||
ostringstream out;
|
||||
out << setfill(' ') << setw(3) << tv.tv_sec << '.';
|
||||
out << setfill('0') << setw(6) << tv.tv_usec;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
struct rusage getrusage_or_die() {
|
||||
struct rusage rs;
|
||||
int ret = getrusage(RUSAGE_SELF, &rs);
|
||||
if (ret != 0) {
|
||||
cerr << "rusage failed: " << strerror(errno) << endl;
|
||||
exit(-1);
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
struct timeval gettimeofday_or_die() {
|
||||
struct timeval tv;
|
||||
int ret = gettimeofday(&tv, NULL);
|
||||
if (ret != 0) {
|
||||
cerr << "gettimeofday failed: " << strerror(errno) << endl;
|
||||
exit(-1);
|
||||
}
|
||||
return tv;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CXA_DEMANGLE
|
||||
string demangle(const string& name) {
|
||||
char buf[1024];
|
||||
unsigned int size = 1024;
|
||||
int status;
|
||||
char* res = abi::__cxa_demangle(
|
||||
name.c_str(), buf, &size, &status);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
string demangle(const string& name) { return name; }
|
||||
#endif
|
||||
|
||||
|
||||
static vector<cxxmph::Benchmark*> g_benchmarks;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
/* static */ void Benchmark::Register(Benchmark* bm) {
|
||||
if (bm->name().empty()) {
|
||||
string name = demangle(typeid(*bm).name());
|
||||
bm->set_name(name);
|
||||
}
|
||||
g_benchmarks.push_back(bm);
|
||||
}
|
||||
|
||||
/* static */ void Benchmark::RunAll() {
|
||||
for (uint32_t i = 0; i < g_benchmarks.size(); ++i) {
|
||||
std::auto_ptr<Benchmark> bm(g_benchmarks[i]);
|
||||
if (!bm->SetUp()) {
|
||||
cerr << "Set up phase for benchmark "
|
||||
<< bm->name() << " failed." << endl;
|
||||
continue;
|
||||
}
|
||||
bm->MeasureRun();
|
||||
bm->TearDown();
|
||||
}
|
||||
}
|
||||
|
||||
void Benchmark::MeasureRun() {
|
||||
struct timeval walltime_begin = gettimeofday_or_die();
|
||||
struct rusage begin = getrusage_or_die();
|
||||
Run();
|
||||
struct rusage end = getrusage_or_die();
|
||||
struct timeval walltime_end = gettimeofday_or_die();
|
||||
|
||||
struct timeval utime;
|
||||
timeval_subtract(&utime, &end.ru_utime, &begin.ru_utime);
|
||||
struct timeval stime;
|
||||
timeval_subtract(&stime, &end.ru_stime, &begin.ru_stime);
|
||||
struct timeval wtime;
|
||||
timeval_subtract(&wtime, &walltime_end, &walltime_begin);
|
||||
|
||||
cout << "Benchmark: " << name_ << endl;
|
||||
cout << "CPU User time : " << timeval_to_string(utime) << endl;
|
||||
cout << "CPU System time: " << timeval_to_string(stime) << endl;
|
||||
cout << "Wall clock time: " << timeval_to_string(wtime) << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
32
cmph-2.0.2/cxxmph/benchmark.h
Normal file
32
cmph-2.0.2/cxxmph/benchmark.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __CXXMPH_BENCHMARK_H__
|
||||
#define __CXXMPH_BENCHMARK_H__
|
||||
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class Benchmark {
|
||||
public:
|
||||
Benchmark() {}
|
||||
virtual ~Benchmark() {}
|
||||
|
||||
const std::string& name() { return name_; }
|
||||
void set_name(const std::string& name) { name_ = name; }
|
||||
|
||||
static void Register(Benchmark* bm);
|
||||
static void RunAll();
|
||||
|
||||
protected:
|
||||
virtual bool SetUp() { return true; };
|
||||
virtual void Run() = 0;
|
||||
virtual bool TearDown() { return true; };
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
void MeasureRun();
|
||||
};
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif
|
75
cmph-2.0.2/cxxmph/bm_common.cc
Normal file
75
cmph-2.0.2/cxxmph/bm_common.cc
Normal file
@ -0,0 +1,75 @@
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include "bm_common.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::set;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
UrlsBenchmark::~UrlsBenchmark() {}
|
||||
bool UrlsBenchmark::SetUp() {
|
||||
vector<string> urls;
|
||||
std::ifstream f(urls_file_.c_str());
|
||||
if (!f.is_open()) {
|
||||
cerr << "Failed to open urls file " << urls_file_ << endl;
|
||||
return false;
|
||||
}
|
||||
string buffer;
|
||||
while(std::getline(f, buffer)) urls.push_back(buffer);
|
||||
set<string> unique(urls.begin(), urls.end());
|
||||
if (unique.size() != urls.size()) {
|
||||
cerr << "Input file has repeated keys." << endl;
|
||||
return false;
|
||||
}
|
||||
urls.swap(urls_);
|
||||
return true;
|
||||
}
|
||||
|
||||
SearchUrlsBenchmark::~SearchUrlsBenchmark() {}
|
||||
bool SearchUrlsBenchmark::SetUp() {
|
||||
if (!UrlsBenchmark::SetUp()) return false;
|
||||
int32_t miss_ratio_int32 = std::numeric_limits<int32_t>::max() * miss_ratio_;
|
||||
forced_miss_urls_.resize(nsearches_);
|
||||
random_.resize(nsearches_);
|
||||
for (uint32_t i = 0; i < nsearches_; ++i) {
|
||||
random_[i] = urls_[random() % urls_.size()];
|
||||
if (random() < miss_ratio_int32) {
|
||||
forced_miss_urls_[i] = random_[i].as_string() + ".force_miss";
|
||||
random_[i] = forced_miss_urls_[i];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Uint64Benchmark::~Uint64Benchmark() {}
|
||||
bool Uint64Benchmark::SetUp() {
|
||||
set<uint64_t> unique;
|
||||
for (uint32_t i = 0; i < count_; ++i) {
|
||||
uint64_t v;
|
||||
do { v = random(); } while (unique.find(v) != unique.end());
|
||||
values_.push_back(v);
|
||||
unique.insert(v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SearchUint64Benchmark::~SearchUint64Benchmark() {}
|
||||
bool SearchUint64Benchmark::SetUp() {
|
||||
if (!Uint64Benchmark::SetUp()) return false;
|
||||
random_.resize(nsearches_);
|
||||
for (uint32_t i = 0; i < nsearches_; ++i) {
|
||||
uint32_t pos = random() % values_.size();
|
||||
random_[i] = values_[pos];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
73
cmph-2.0.2/cxxmph/bm_common.h
Normal file
73
cmph-2.0.2/cxxmph/bm_common.h
Normal file
@ -0,0 +1,73 @@
|
||||
#ifndef __CXXMPH_BM_COMMON_H__
|
||||
#define __CXXMPH_BM_COMMON_H__
|
||||
|
||||
#include "stringpiece.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map> // std::hash
|
||||
#include "MurmurHash3.h"
|
||||
|
||||
#include "benchmark.h"
|
||||
|
||||
namespace std {
|
||||
template <> struct hash<cxxmph::StringPiece> {
|
||||
uint32_t operator()(const cxxmph::StringPiece& k) const {
|
||||
uint32_t out;
|
||||
MurmurHash3_x86_32(k.data(), k.length(), 1, &out);
|
||||
return out;
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class UrlsBenchmark : public Benchmark {
|
||||
public:
|
||||
UrlsBenchmark(const std::string& urls_file) : urls_file_(urls_file) { }
|
||||
virtual ~UrlsBenchmark();
|
||||
protected:
|
||||
virtual bool SetUp();
|
||||
const std::string urls_file_;
|
||||
std::vector<std::string> urls_;
|
||||
};
|
||||
|
||||
class SearchUrlsBenchmark : public UrlsBenchmark {
|
||||
public:
|
||||
SearchUrlsBenchmark(const std::string& urls_file, uint32_t nsearches, float miss_ratio)
|
||||
: UrlsBenchmark(urls_file), nsearches_(nsearches), miss_ratio_(miss_ratio) {}
|
||||
virtual ~SearchUrlsBenchmark();
|
||||
protected:
|
||||
virtual bool SetUp();
|
||||
const uint32_t nsearches_;
|
||||
float miss_ratio_;
|
||||
std::vector<std::string> forced_miss_urls_;
|
||||
std::vector<StringPiece> random_;
|
||||
};
|
||||
|
||||
class Uint64Benchmark : public Benchmark {
|
||||
public:
|
||||
Uint64Benchmark(uint32_t count) : count_(count) { }
|
||||
virtual ~Uint64Benchmark();
|
||||
virtual void Run() {}
|
||||
protected:
|
||||
virtual bool SetUp();
|
||||
const uint32_t count_;
|
||||
std::vector<uint64_t> values_;
|
||||
};
|
||||
|
||||
class SearchUint64Benchmark : public Uint64Benchmark {
|
||||
public:
|
||||
SearchUint64Benchmark(uint32_t count, uint32_t nsearches)
|
||||
: Uint64Benchmark(count), nsearches_(nsearches) { }
|
||||
virtual ~SearchUint64Benchmark();
|
||||
virtual void Run() {};
|
||||
protected:
|
||||
virtual bool SetUp();
|
||||
const uint32_t nsearches_;
|
||||
std::vector<uint64_t> random_;
|
||||
};
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_BM_COMMON_H__
|
126
cmph-2.0.2/cxxmph/bm_map.cc
Normal file
126
cmph-2.0.2/cxxmph/bm_map.cc
Normal file
@ -0,0 +1,126 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "hopscotch_map.h"
|
||||
|
||||
#include "bm_common.h"
|
||||
#include "mph_map.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
// Another reference benchmark:
|
||||
// http://blog.aggregateknowledge.com/tag/bigmemory/
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
template <class MapType, class T>
|
||||
const T* myfind(const MapType& mymap, const T& k) {
|
||||
auto it = mymap.find(k);
|
||||
auto end = mymap.end();
|
||||
if (it == end) return NULL;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
template <class MapType>
|
||||
class BM_CreateUrls : public UrlsBenchmark {
|
||||
public:
|
||||
BM_CreateUrls(const string& urls_file) : UrlsBenchmark(urls_file) { }
|
||||
virtual void Run() {
|
||||
MapType mymap;
|
||||
for (auto it = urls_.begin(); it != urls_.end(); ++it) {
|
||||
mymap[*it] = *it;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class MapType>
|
||||
class BM_SearchUrls : public SearchUrlsBenchmark {
|
||||
public:
|
||||
BM_SearchUrls(const std::string& urls_file, int nsearches, float miss_ratio)
|
||||
: SearchUrlsBenchmark(urls_file, nsearches, miss_ratio) { }
|
||||
virtual ~BM_SearchUrls() {}
|
||||
virtual void Run() {
|
||||
uint32_t total = 1;
|
||||
for (auto it = random_.begin(); it != random_.end(); ++it) {
|
||||
auto v = myfind(mymap_, *it);
|
||||
if (v) total += v->length();
|
||||
}
|
||||
fprintf(stderr, "Total: %u\n", total);
|
||||
}
|
||||
protected:
|
||||
virtual bool SetUp() {
|
||||
if (!SearchUrlsBenchmark::SetUp()) return false;
|
||||
for (auto it = urls_.begin(); it != urls_.end(); ++it) {
|
||||
mymap_[*it] = *it;
|
||||
}
|
||||
mymap_.rehash(mymap_.bucket_count());
|
||||
fprintf(stderr, "Occupation: %f\n", static_cast<float>(mymap_.size())/mymap_.bucket_count());
|
||||
return true;
|
||||
}
|
||||
MapType mymap_;
|
||||
};
|
||||
|
||||
template <class MapType>
|
||||
class BM_SearchUint64 : public SearchUint64Benchmark {
|
||||
public:
|
||||
BM_SearchUint64() : SearchUint64Benchmark(100000, 10*1000*1000) { }
|
||||
virtual bool SetUp() {
|
||||
if (!SearchUint64Benchmark::SetUp()) return false;
|
||||
for (uint32_t i = 0; i < values_.size(); ++i) {
|
||||
mymap_[values_[i]] = values_[i];
|
||||
}
|
||||
mymap_.rehash(mymap_.bucket_count());
|
||||
// Double check if everything is all right
|
||||
cerr << "Doing double check" << endl;
|
||||
for (uint32_t i = 0; i < values_.size(); ++i) {
|
||||
if (mymap_[values_[i]] != values_[i]) {
|
||||
cerr << "Looking for " << i << " th key value " << values_[i];
|
||||
cerr << " yielded " << mymap_[values_[i]] << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual void Run() {
|
||||
for (auto it = random_.begin(); it != random_.end(); ++it) {
|
||||
auto v = myfind(mymap_, *it);
|
||||
if (*v != *it) {
|
||||
cerr << "Looked for " << *it << " got " << *v << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
MapType mymap_;
|
||||
};
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
using namespace cxxmph;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
srandom(4);
|
||||
Benchmark::Register(new BM_CreateUrls<dense_hash_map<StringPiece, StringPiece>>("URLS100k"));
|
||||
Benchmark::Register(new BM_CreateUrls<std::unordered_map<StringPiece, StringPiece>>("URLS100k"));
|
||||
Benchmark::Register(new BM_CreateUrls<mph_map<StringPiece, StringPiece>>("URLS100k"));
|
||||
Benchmark::Register(new BM_CreateUrls<sparse_hash_map<StringPiece, StringPiece>>("URLS100k"));
|
||||
Benchmark::Register(new BM_CreateUrls<tsl::hopscotch_map<StringPiece, StringPiece>>("URLS100k"));
|
||||
|
||||
Benchmark::Register(new BM_SearchUrls<dense_hash_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0));
|
||||
Benchmark::Register(new BM_SearchUrls<std::unordered_map<StringPiece, StringPiece, Murmur3StringPiece>>("URLS100k", 10*1000 * 1000, 0));
|
||||
Benchmark::Register(new BM_SearchUrls<mph_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0));
|
||||
Benchmark::Register(new BM_SearchUrls<sparse_hash_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0));
|
||||
Benchmark::Register(new BM_SearchUrls<tsl::hopscotch_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0));
|
||||
|
||||
Benchmark::Register(new BM_SearchUrls<dense_hash_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0.9));
|
||||
Benchmark::Register(new BM_SearchUrls<std::unordered_map<StringPiece, StringPiece, Murmur3StringPiece>>("URLS100k", 10*1000 * 1000, 0.9));
|
||||
Benchmark::Register(new BM_SearchUrls<mph_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0.9));
|
||||
Benchmark::Register(new BM_SearchUrls<sparse_hash_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0.9));
|
||||
Benchmark::Register(new BM_SearchUrls<tsl::hopscotch_map<StringPiece, StringPiece>>("URLS100k", 10*1000 * 1000, 0.9));
|
||||
|
||||
Benchmark::Register(new BM_SearchUint64<dense_hash_map<uint64_t, uint64_t>>);
|
||||
Benchmark::Register(new BM_SearchUint64<std::unordered_map<uint64_t, uint64_t>>);
|
||||
Benchmark::Register(new BM_SearchUint64<mph_map<uint64_t, uint64_t>>);
|
||||
Benchmark::Register(new BM_SearchUint64<sparse_hash_map<uint64_t, uint64_t>>);
|
||||
Benchmark::Register(new BM_SearchUint64<tsl::hopscotch_map<uint64_t, uint64_t>>);
|
||||
Benchmark::RunAll();
|
||||
}
|
74
cmph-2.0.2/cxxmph/cxxmph.cc
Normal file
74
cmph-2.0.2/cxxmph/cxxmph.cc
Normal file
@ -0,0 +1,74 @@
|
||||
// Copyright 2010 Google Inc. All Rights Reserved.
|
||||
// Author: davi@google.com (Davi Reis)
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mph_map.h"
|
||||
#include "config.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::getline;
|
||||
using std::ifstream;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
using cxxmph::mph_map;
|
||||
|
||||
void usage(const char* prg) {
|
||||
cerr << "usage: " << prg << " [-v] [-h] [-V] <keys.txt>" << endl;
|
||||
}
|
||||
void usage_long(const char* prg) {
|
||||
usage(prg);
|
||||
cerr << " -h\t print this help message" << endl;
|
||||
cerr << " -V\t print version number and exit" << endl;
|
||||
cerr << " -v\t increase verbosity (may be used multiple times)" << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
int verbosity = 0;
|
||||
while (1) {
|
||||
char ch = (char)getopt(argc, argv, "hvV");
|
||||
if (ch == -1) break;
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
usage_long(argv[0]);
|
||||
return 0;
|
||||
case 'V':
|
||||
std::cout << VERSION << std::endl;
|
||||
return 0;
|
||||
case 'v':
|
||||
++verbosity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (optind != argc - 1) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
vector<string> keys;
|
||||
ifstream f(argv[optind]);
|
||||
if (!f.is_open()) {
|
||||
std::cerr << "Failed to open " << argv[optind] << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
string buffer;
|
||||
while (!getline(f, buffer).eof()) keys.push_back(buffer);
|
||||
for (uint32_t i = 0; i < keys.size(); ++i) string s = keys[i];
|
||||
mph_map<string, string> table;
|
||||
|
||||
for (uint32_t i = 0; i < keys.size(); ++i) table[keys[i]] = keys[i];
|
||||
mph_map<string, string>::const_iterator it = table.begin();
|
||||
mph_map<string, string>::const_iterator end = table.end();
|
||||
for (int i = 0; it != end; ++it, ++i) {
|
||||
cout << i << ": " << it->first
|
||||
<<" -> " << it->second << endl;
|
||||
}
|
||||
}
|
25
cmph-2.0.2/cxxmph/dense_hash_map_test.cc
Normal file
25
cmph-2.0.2/cxxmph/dense_hash_map_test.cc
Normal file
@ -0,0 +1,25 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "mph_map.h"
|
||||
#include "map_tester.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace cxxmph;
|
||||
|
||||
typedef MapTester<dense_hash_map> Tester;
|
||||
|
||||
CXXMPH_CXX_TEST_CASE(empty_find, Tester::empty_find);
|
||||
CXXMPH_CXX_TEST_CASE(empty_erase, Tester::empty_erase);
|
||||
CXXMPH_CXX_TEST_CASE(small_insert, Tester::small_insert);
|
||||
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
||||
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
||||
CXXMPH_CXX_TEST_CASE(default_search, Tester::default_search);
|
||||
CXXMPH_CXX_TEST_CASE(large_search, Tester::large_search);
|
||||
CXXMPH_CXX_TEST_CASE(string_search, Tester::string_search);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_zero, Tester::rehash_zero);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size);
|
||||
CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value);
|
||||
CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);
|
81
cmph-2.0.2/cxxmph/hollow_iterator.h
Normal file
81
cmph-2.0.2/cxxmph/hollow_iterator.h
Normal file
@ -0,0 +1,81 @@
|
||||
#ifndef __CXXMPH_HOLLOW_ITERATOR_H__
|
||||
#define __CXXMPH_HOLLOW_ITERATOR_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
using std::vector;
|
||||
|
||||
template <typename container_type>
|
||||
struct is_empty {
|
||||
public:
|
||||
is_empty() : c_(NULL), p_(NULL) {};
|
||||
is_empty(const container_type* c, const vector<bool>* p) : c_(c), p_(p) {};
|
||||
bool operator()(typename container_type::const_iterator it) const {
|
||||
if (it == c_->end()) return false;
|
||||
return !(*p_)[it - c_->begin()];
|
||||
}
|
||||
private:
|
||||
const container_type* c_;
|
||||
const vector<bool>* p_;
|
||||
};
|
||||
|
||||
template <typename iterator, typename is_empty>
|
||||
struct hollow_iterator_base
|
||||
: public std::iterator<std::forward_iterator_tag,
|
||||
typename iterator::value_type> {
|
||||
public:
|
||||
typedef hollow_iterator_base<iterator, is_empty> self_type;
|
||||
typedef self_type& self_reference;
|
||||
typedef typename iterator::reference reference;
|
||||
typedef typename iterator::pointer pointer;
|
||||
inline hollow_iterator_base() : it_(), empty_() { }
|
||||
inline hollow_iterator_base(iterator it, is_empty empty, bool solid) : it_(it), empty_(empty) {
|
||||
if (!solid) advance();
|
||||
}
|
||||
// Same as above, assumes solid==true.
|
||||
inline hollow_iterator_base(iterator it, is_empty empty) : it_(it), empty_(empty) {}
|
||||
inline hollow_iterator_base(const self_type& rhs) { it_ = rhs.it_; empty_ = rhs.empty_; }
|
||||
template <typename const_iterator>
|
||||
hollow_iterator_base(const hollow_iterator_base<const_iterator, is_empty>& rhs) { it_ = rhs.it_; empty_ = rhs.empty_; }
|
||||
|
||||
reference operator*() { return *it_; }
|
||||
pointer operator->() { return &(*it_); }
|
||||
self_reference operator++() { ++it_; advance(); return *this; }
|
||||
// self_type operator++() { auto tmp(*this); ++tmp; return tmp; }
|
||||
|
||||
template <typename const_iterator>
|
||||
bool operator==(const hollow_iterator_base<const_iterator, is_empty>& rhs) { return rhs.it_ == it_; }
|
||||
template <typename const_iterator>
|
||||
bool operator!=(const hollow_iterator_base<const_iterator, is_empty>& rhs) { return rhs.it_ != it_; }
|
||||
|
||||
// should be friend
|
||||
iterator it_;
|
||||
is_empty empty_;
|
||||
|
||||
private:
|
||||
void advance() {
|
||||
while (empty_(it_)) ++it_;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename container_type, typename iterator>
|
||||
inline auto make_solid(
|
||||
container_type* v, const vector<bool>* p, iterator it) ->
|
||||
hollow_iterator_base<iterator, is_empty<const container_type>> {
|
||||
return hollow_iterator_base<iterator, is_empty<const container_type>>(
|
||||
it, is_empty<const container_type>(v, p));
|
||||
}
|
||||
|
||||
template <typename container_type, typename iterator>
|
||||
inline auto make_hollow(
|
||||
container_type* v, const vector<bool>* p, iterator it) ->
|
||||
hollow_iterator_base<iterator, is_empty<const container_type>> {
|
||||
return hollow_iterator_base<iterator, is_empty<const container_type>>(
|
||||
it, is_empty<const container_type>(v, p), false);
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_HOLLOW_ITERATOR_H__
|
49
cmph-2.0.2/cxxmph/hollow_iterator_test.cc
Normal file
49
cmph-2.0.2/cxxmph/hollow_iterator_test.cc
Normal file
@ -0,0 +1,49 @@
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::vector;
|
||||
#include "hollow_iterator.h"
|
||||
using cxxmph::hollow_iterator_base;
|
||||
using cxxmph::make_hollow;
|
||||
using cxxmph::is_empty;
|
||||
|
||||
int main(int, char**) {
|
||||
vector<int> v;
|
||||
vector<bool> p;
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
v.push_back(i);
|
||||
p.push_back(i % 2 == 0);
|
||||
}
|
||||
auto begin = make_hollow(&v, &p, v.begin());
|
||||
auto end = make_hollow(&v, &p, v.end());
|
||||
for (auto it = begin; it != end; ++it) {
|
||||
if (((*it) % 2) != 0) exit(-1);
|
||||
}
|
||||
const vector<int>* cv(&v);
|
||||
auto cbegin(make_hollow(cv, &p, cv->begin()));
|
||||
auto cend(make_hollow(cv, &p, cv->begin()));
|
||||
for (auto it = cbegin; it != cend; ++it) {
|
||||
if (((*it) % 2) != 0) exit(-1);
|
||||
}
|
||||
const vector<bool>* cp(&p);
|
||||
cbegin = make_hollow(cv, cp, v.begin());
|
||||
cend = make_hollow(cv, cp, cv->end());
|
||||
|
||||
vector<int>::iterator vit1 = v.begin();
|
||||
vector<int>::const_iterator vit2 = v.begin();
|
||||
if (vit1 != vit2) exit(-1);
|
||||
auto it1 = make_hollow(&v, &p, vit1);
|
||||
auto it2 = make_hollow(&v, &p, vit2);
|
||||
if (it1 != it2) exit(-1);
|
||||
|
||||
typedef is_empty<const vector<int>> iev;
|
||||
hollow_iterator_base<vector<int>::iterator, iev> default_constructed;
|
||||
default_constructed = make_hollow(&v, &p, v.begin());
|
||||
return 0;
|
||||
}
|
||||
|
4
cmph-2.0.2/cxxmph/map_tester.cc
Normal file
4
cmph-2.0.2/cxxmph/map_tester.cc
Normal file
@ -0,0 +1,4 @@
|
||||
#include "map_tester.h"
|
||||
|
||||
namespace cxxxmph {
|
||||
}
|
138
cmph-2.0.2/cxxmph/map_tester.h
Normal file
138
cmph-2.0.2/cxxmph/map_tester.h
Normal file
@ -0,0 +1,138 @@
|
||||
#ifndef __CXXMPH_MAP_TEST_HELPER_H__
|
||||
#define __CXXMPH_MAP_TEST_HELPER_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "string_util.h"
|
||||
#include <check.h>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
using namespace cxxmph;
|
||||
using namespace std;
|
||||
|
||||
template <template<typename...> class map_type>
|
||||
struct MapTester {
|
||||
static bool empty_find() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
if (m.find(i) != m.end()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool empty_erase() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
m.erase(i);
|
||||
if (m.size()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool small_insert() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
// Start counting from 1 to not touch default constructed value bugs
|
||||
for (int i = 1; i < 12; ++i) m.insert(make_pair(i, i));
|
||||
return m.size() == 11;
|
||||
}
|
||||
static bool large_insert() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
// Start counting from 1 to not touch default constructed value bugs
|
||||
int nkeys = 12 * 256 * 256;
|
||||
for (int i = 1; i < nkeys; ++i) m.insert(make_pair(i, i));
|
||||
return static_cast<int>(m.size()) == nkeys - 1;
|
||||
}
|
||||
static bool small_search() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
// Start counting from 1 to not touch default constructed value bugs
|
||||
for (int i = 1; i < 12; ++i) m.insert(make_pair(i, i));
|
||||
for (int i = 1; i < 12; ++i) if (m.find(i) == m.end()) return false;
|
||||
return true;
|
||||
}
|
||||
static bool default_search() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
if (m.find(0) != m.end()) return false;
|
||||
for (int i = 1; i < 256; ++i) m.insert(make_pair(i, i));
|
||||
if (m.find(0) != m.end()) return false;
|
||||
for (int i = 0; i < 256; ++i) m.insert(make_pair(i, i));
|
||||
if (m.find(0) == m.end()) return false;
|
||||
return true;
|
||||
}
|
||||
static bool large_search() {
|
||||
int nkeys = 10 * 1000;
|
||||
map_type<int64_t, int64_t> m;
|
||||
for (int i = 0; i < nkeys; ++i) m.insert(make_pair(i, i));
|
||||
for (int i = 0; i < nkeys; ++i) if (m.find(i) == m.end()) return false;
|
||||
return true;
|
||||
}
|
||||
static bool string_search() {
|
||||
int nkeys = 10 * 1000;
|
||||
vector<string> keys;
|
||||
for (int i = 0; i < nkeys; ++i) {
|
||||
keys.push_back(format("%v", i));
|
||||
}
|
||||
map_type<string, int64_t> m;
|
||||
for (int i = 0; i < nkeys; ++i) m.insert(make_pair(keys[i], i));
|
||||
for (int i = 0; i < nkeys; ++i) {
|
||||
auto it = m.find(keys[i]);
|
||||
if (it == m.end()) return false;
|
||||
if (it->second != i) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool rehash_zero() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
m.rehash(0);
|
||||
return m.size() == 0;
|
||||
}
|
||||
static bool rehash_size() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
int nkeys = 10 * 1000;
|
||||
for (int i = 0; i < nkeys; ++i) { m.insert(make_pair(i, i)); }
|
||||
m.rehash(nkeys);
|
||||
for (int i = 0; i < nkeys; ++i) { if (m.find(i) == m.end()) return false; }
|
||||
for (int i = nkeys; i < nkeys * 2; ++i) {
|
||||
if (m.find(i) != m.end()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool erase_iterator() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
int nkeys = 10 * 1000;
|
||||
for (int i = 0; i < nkeys; ++i) { m.insert(make_pair(i, i)); }
|
||||
for (int i = 0; i < nkeys; ++i) {
|
||||
if (m.find(i) == m.end()) return false;
|
||||
}
|
||||
for (int i = nkeys - 1; i >= 0; --i) { if (m.find(i) == m.end()) return false; }
|
||||
for (int i = nkeys - 1; i >= 0; --i) {
|
||||
fail_unless(m.find(i) != m.end(), "after erase %d cannot be found", i);
|
||||
fail_unless(m.find(i)->first == i, "after erase key %d cannot be found", i);
|
||||
}
|
||||
for (int i = nkeys - 1; i >= 0; --i) {
|
||||
fail_unless(m.find(i) != m.end(), "after erase %d cannot be found", i);
|
||||
fail_unless(m.find(i)->first == i, "after erase key %d cannot be found", i);
|
||||
if (!(m.find(i)->first == i)) return false;
|
||||
m.erase(m.find(i));
|
||||
if (static_cast<int>(m.size()) != i) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool erase_value() {
|
||||
map_type<int64_t, int64_t> m;
|
||||
int nkeys = 10 * 1000;
|
||||
for (int i = 0; i < nkeys; ++i) { m.insert(make_pair(i, i)); }
|
||||
for (int i = nkeys - 1; i >= 0; --i) {
|
||||
fail_unless(m.find(i) != m.end());
|
||||
m.erase(i);
|
||||
if (static_cast<int>(m.size()) != i) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cxxxmph
|
||||
|
||||
#endif // __CXXMPH_MAP_TEST_HELPER_H__
|
17
cmph-2.0.2/cxxmph/map_tester_test.cc
Normal file
17
cmph-2.0.2/cxxmph/map_tester_test.cc
Normal file
@ -0,0 +1,17 @@
|
||||
#include "map_tester.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace cxxmph;
|
||||
|
||||
typedef MapTester<std::unordered_map> Tester;
|
||||
|
||||
CXXMPH_CXX_TEST_CASE(small_insert, Tester::small_insert);
|
||||
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
||||
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
||||
CXXMPH_CXX_TEST_CASE(default_search, Tester::default_search);
|
||||
CXXMPH_CXX_TEST_CASE(large_search, Tester::large_search);
|
||||
CXXMPH_CXX_TEST_CASE(string_search, Tester::string_search);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_zero, Tester::rehash_zero);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size);
|
||||
CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value);
|
||||
CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);
|
11
cmph-2.0.2/cxxmph/mph_bits.cc
Normal file
11
cmph-2.0.2/cxxmph/mph_bits.cc
Normal file
@ -0,0 +1,11 @@
|
||||
#include "mph_bits.h"
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
const uint8_t dynamic_2bitset::vmask[] = { 0xfc, 0xf3, 0xcf, 0x3f};
|
||||
dynamic_2bitset::dynamic_2bitset() : size_(0), fill_(false) {}
|
||||
dynamic_2bitset::dynamic_2bitset(uint32_t size, bool fill)
|
||||
: size_(size), fill_(fill), data_(ceil(size / 4.0), ones()*fill) {}
|
||||
dynamic_2bitset::~dynamic_2bitset() {}
|
||||
|
||||
}
|
73
cmph-2.0.2/cxxmph/mph_bits.h
Normal file
73
cmph-2.0.2/cxxmph/mph_bits.h
Normal file
@ -0,0 +1,73 @@
|
||||
#ifndef __CXXMPH_MPH_BITS_H__
|
||||
#define __CXXMPH_MPH_BITS_H__
|
||||
|
||||
#include <stdint.h> // for uint32_t and friends
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class dynamic_2bitset {
|
||||
public:
|
||||
dynamic_2bitset();
|
||||
~dynamic_2bitset();
|
||||
dynamic_2bitset(uint32_t size, bool fill = false);
|
||||
|
||||
const uint8_t operator[](uint32_t i) const { return get(i); }
|
||||
const uint8_t get(uint32_t i) const {
|
||||
assert(i < size());
|
||||
assert((i >> 2) < data_.size());
|
||||
return (data_[(i >> 2)] >> (((i & 3) << 1)) & 3);
|
||||
}
|
||||
void set(uint32_t i, uint8_t v) {
|
||||
assert((i >> 2) < data_.size());
|
||||
data_[(i >> 2)] |= ones() ^ dynamic_2bitset::vmask[i & 3];
|
||||
data_[(i >> 2)] &= ((v << ((i & 3) << 1)) | dynamic_2bitset::vmask[i & 3]);
|
||||
assert(v <= 3);
|
||||
assert(get(i) == v);
|
||||
}
|
||||
void resize(uint32_t size) {
|
||||
size_ = size;
|
||||
data_.resize(size >> 2, fill_*ones());
|
||||
}
|
||||
void swap(dynamic_2bitset& other) {
|
||||
std::swap(other.size_, size_);
|
||||
std::swap(other.fill_, fill_);
|
||||
other.data_.swap(data_);
|
||||
}
|
||||
void clear() { data_.clear(); size_ = 0; }
|
||||
|
||||
uint32_t size() const { return size_; }
|
||||
static const uint8_t vmask[];
|
||||
const std::vector<uint8_t>& data() const { return data_; }
|
||||
private:
|
||||
uint32_t size_;
|
||||
bool fill_;
|
||||
std::vector<uint8_t> data_;
|
||||
const uint8_t ones() { return std::numeric_limits<uint8_t>::max(); }
|
||||
};
|
||||
|
||||
static uint32_t nextpoweroftwo(uint32_t k) {
|
||||
if (k == 0) return 1;
|
||||
k--;
|
||||
for (uint32_t i=1; i<sizeof(uint32_t)*CHAR_BIT; i<<=1) k = k | k >> i;
|
||||
return k+1;
|
||||
}
|
||||
// Interesting bit tricks that might end up here:
|
||||
// http://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord
|
||||
// Fast a % (k*2^t)
|
||||
// http://www.azillionmonkeys.com/qed/adiv.html
|
||||
// rank and select:
|
||||
// http://vigna.dsi.unimi.it/ftp/papers/Broadword.pdf
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif
|
61
cmph-2.0.2/cxxmph/mph_bits_test.cc
Normal file
61
cmph-2.0.2/cxxmph/mph_bits_test.cc
Normal file
@ -0,0 +1,61 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "mph_bits.h"
|
||||
|
||||
using cxxmph::dynamic_2bitset;
|
||||
using cxxmph::nextpoweroftwo;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
dynamic_2bitset small(256, true);
|
||||
for (uint32_t i = 0; i < small.size(); ++i) small.set(i, i % 4);
|
||||
for (uint32_t i = 0; i < small.size(); ++i) {
|
||||
if (small[i] != i % 4) {
|
||||
fprintf(stderr, "wrong bits %d at %d expected %d\n", small[i], i, i % 4);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t size = 256;
|
||||
dynamic_2bitset bits(size, true /* fill with ones */);
|
||||
for (uint32_t i = 0; i < size; ++i) {
|
||||
if (bits[i] != 3) {
|
||||
fprintf(stderr, "wrong bits %d at %d expected %d\n", bits[i], i, 3);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < size; ++i) bits.set(i, 0);
|
||||
for (uint32_t i = 0; i < size; ++i) {
|
||||
if (bits[i] != 0) {
|
||||
fprintf(stderr, "wrong bits %d at %d expected %d\n", bits[i], i, 0);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < size; ++i) bits.set(i, i % 4);
|
||||
for (uint32_t i = 0; i < size; ++i) {
|
||||
if (bits[i] != i % 4) {
|
||||
fprintf(stderr, "wrong bits %d at %d expected %d\n", bits[i], i, i % 4);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
dynamic_2bitset size_corner1(1);
|
||||
if (size_corner1.size() != 1) exit(-1);
|
||||
dynamic_2bitset size_corner2(2);
|
||||
if (size_corner2.size() != 2) exit(-1);
|
||||
(dynamic_2bitset(4, true)).swap(size_corner2);
|
||||
if (size_corner2.size() != 4) exit(-1);
|
||||
for (uint32_t i = 0; i < size_corner2.size(); ++i) {
|
||||
if (size_corner2[i] != 3) exit(-1);
|
||||
}
|
||||
size_corner2.clear();
|
||||
if (size_corner2.size() != 0) exit(-1);
|
||||
|
||||
dynamic_2bitset empty;
|
||||
empty.clear();
|
||||
dynamic_2bitset large(1000, true);
|
||||
empty.swap(large);
|
||||
|
||||
if (nextpoweroftwo(3) != 4) exit(-1);
|
||||
}
|
||||
|
||||
|
229
cmph-2.0.2/cxxmph/mph_index.cc
Normal file
229
cmph-2.0.2/cxxmph/mph_index.cc
Normal file
@ -0,0 +1,229 @@
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
#include "mph_index.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
namespace {
|
||||
|
||||
static const uint8_t kUnassigned = 3;
|
||||
// table used for looking up the number of assigned vertices to a 8-bit integer
|
||||
static uint8_t kBdzLookupIndex[] =
|
||||
{
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
MPHIndex::~MPHIndex() {
|
||||
clear();
|
||||
|
||||
}
|
||||
|
||||
void MPHIndex::clear() {
|
||||
std::vector<uint32_t> empty_ranktable;
|
||||
ranktable_.swap(empty_ranktable);
|
||||
dynamic_2bitset empty_g;
|
||||
g_.swap(empty_g);
|
||||
}
|
||||
|
||||
bool MPHIndex::GenerateQueue(
|
||||
TriGraph* graph, vector<uint32_t>* queue_output) {
|
||||
uint32_t queue_head = 0, queue_tail = 0;
|
||||
uint32_t nedges = m_;
|
||||
uint32_t nvertices = n_;
|
||||
// Relies on vector<bool> using 1 bit per element
|
||||
vector<bool> marked_edge(nedges + 1, false);
|
||||
vector<uint32_t> queue(nvertices, 0);
|
||||
for (uint32_t i = 0; i < nedges; ++i) {
|
||||
const TriGraph::Edge& e = graph->edges()[i];
|
||||
if (graph->vertex_degree()[e[0]] == 1 ||
|
||||
graph->vertex_degree()[e[1]] == 1 ||
|
||||
graph->vertex_degree()[e[2]] == 1) {
|
||||
if (!marked_edge[i]) {
|
||||
queue[queue_head++] = i;
|
||||
marked_edge[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (unsigned int i = 0; i < marked_edge.size(); ++i) {
|
||||
cerr << "vertex with degree " << static_cast<uint32_t>(graph->vertex_degree()[i]) << " marked " << marked_edge[i] << endl;
|
||||
}
|
||||
for (unsigned int i = 0; i < queue.size(); ++i) {
|
||||
cerr << "vertex " << i << " queued at " << queue[i] << endl;
|
||||
}
|
||||
*/
|
||||
// At this point queue head is the number of edges touching at least one
|
||||
// vertex of degree 1.
|
||||
// cerr << "Queue head " << queue_head << " Queue tail " << queue_tail << endl;
|
||||
// graph->DebugGraph();
|
||||
while (queue_tail != queue_head) {
|
||||
uint32_t current_edge = queue[queue_tail++];
|
||||
graph->RemoveEdge(current_edge);
|
||||
const TriGraph::Edge& e = graph->edges()[current_edge];
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
uint32_t v = e[i];
|
||||
if (graph->vertex_degree()[v] == 1) {
|
||||
uint32_t first_edge = graph->first_edge()[v];
|
||||
if (!marked_edge[first_edge]) {
|
||||
queue[queue_head++] = first_edge;
|
||||
marked_edge[first_edge] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (unsigned int i = 0; i < queue.size(); ++i) {
|
||||
cerr << "vertex " << i << " queued at " << queue[i] << endl;
|
||||
}
|
||||
*/
|
||||
int cycles = queue_head - nedges;
|
||||
if (cycles == 0) queue.swap(*queue_output);
|
||||
return cycles == 0;
|
||||
}
|
||||
|
||||
void MPHIndex::Assigning(
|
||||
const vector<TriGraph::Edge>& edges, const vector<uint32_t>& queue) {
|
||||
uint32_t current_edge = 0;
|
||||
vector<bool> marked_vertices(n_ + 1);
|
||||
dynamic_2bitset(8, true).swap(g_);
|
||||
// Initialize vector of half nibbles with all bits set.
|
||||
dynamic_2bitset g(n_, true /* set bits to 1 */);
|
||||
|
||||
uint32_t nedges = m_; // for legibility
|
||||
for (int i = nedges - 1; i + 1 >= 1; --i) {
|
||||
current_edge = queue[i];
|
||||
const TriGraph::Edge& e = edges[current_edge];
|
||||
/*
|
||||
cerr << "B: " << e[0] << " " << e[1] << " " << e[2] << " -> "
|
||||
<< get_2bit_value(g_, e[0]) << " "
|
||||
<< get_2bit_value(g_, e[1]) << " "
|
||||
<< get_2bit_value(g_, e[2]) << " edge " << current_edge << endl;
|
||||
*/
|
||||
if (!marked_vertices[e[0]]) {
|
||||
if (!marked_vertices[e[1]]) {
|
||||
g.set(e[1], kUnassigned);
|
||||
marked_vertices[e[1]] = true;
|
||||
}
|
||||
if (!marked_vertices[e[2]]) {
|
||||
g.set(e[2], kUnassigned);
|
||||
assert(marked_vertices.size() > e[2]);
|
||||
marked_vertices[e[2]] = true;
|
||||
}
|
||||
g.set(e[0], (6 - (g[e[1]] + g[e[2]])) % 3);
|
||||
marked_vertices[e[0]] = true;
|
||||
} else if (!marked_vertices[e[1]]) {
|
||||
if (!marked_vertices[e[2]]) {
|
||||
g.set(e[2], kUnassigned);
|
||||
marked_vertices[e[2]] = true;
|
||||
}
|
||||
g.set(e[1], (7 - (g[e[0]] + g[e[2]])) % 3);
|
||||
marked_vertices[e[1]] = true;
|
||||
} else {
|
||||
g.set(e[2], (8 - (g[e[0]] + g[e[1]])) % 3);
|
||||
marked_vertices[e[2]] = true;
|
||||
}
|
||||
/*
|
||||
cerr << "A: " << e[0] << " " << e[1] << " " << e[2] << " -> "
|
||||
<< static_cast<uint32_t>(g[e[0]]) << " "
|
||||
<< static_cast<uint32_t>(g[e[1]]) << " "
|
||||
<< static_cast<uint32_t>(g[e[2]]) << " " << endl;
|
||||
*/
|
||||
}
|
||||
g_.swap(g);
|
||||
}
|
||||
|
||||
void MPHIndex::Ranking() {
|
||||
uint32_t nbytes_total = static_cast<uint32_t>(ceil(n_ / 4.0));
|
||||
uint32_t size = k_ >> 2U;
|
||||
uint32_t ranktable_size = static_cast<uint32_t>(
|
||||
ceil(n_ / static_cast<double>(k_)));
|
||||
vector<uint32_t> ranktable(ranktable_size);
|
||||
uint32_t offset = 0;
|
||||
uint32_t count = 0;
|
||||
uint32_t i = 1;
|
||||
while (1) {
|
||||
if (i == ranktable.size()) break;
|
||||
uint32_t nbytes = size < nbytes_total ? size : nbytes_total;
|
||||
for (uint32_t j = 0; j < nbytes; ++j) {
|
||||
count += kBdzLookupIndex[g_.data()[offset + j]];
|
||||
}
|
||||
ranktable[i] = count;
|
||||
offset += nbytes;
|
||||
nbytes_total -= size;
|
||||
++i;
|
||||
}
|
||||
ranktable_.swap(ranktable);
|
||||
}
|
||||
|
||||
uint32_t MPHIndex::Rank(uint32_t vertex) const {
|
||||
if (ranktable_.empty()) return 0;
|
||||
uint32_t index = vertex >> b_;
|
||||
uint32_t base_rank = ranktable_[index];
|
||||
uint32_t beg_idx_v = index << b_;
|
||||
uint32_t beg_idx_b = beg_idx_v >> 2;
|
||||
uint32_t end_idx_b = vertex >> 2;
|
||||
while (beg_idx_b < end_idx_b) {
|
||||
assert(g_.data().size() > beg_idx_b);
|
||||
base_rank += kBdzLookupIndex[g_.data()[beg_idx_b++]];
|
||||
}
|
||||
beg_idx_v = beg_idx_b << 2;
|
||||
/*
|
||||
cerr << "beg_idx_v: " << beg_idx_v << endl;
|
||||
cerr << "base rank: " << base_rank << endl;
|
||||
cerr << "G: ";
|
||||
for (unsigned int i = 0; i < n_; ++i) {
|
||||
cerr << static_cast<uint32_t>(g_[i]) << " ";
|
||||
}
|
||||
cerr << endl;
|
||||
*/
|
||||
while (beg_idx_v < vertex) {
|
||||
if (g_[beg_idx_v] != kUnassigned) ++base_rank;
|
||||
++beg_idx_v;
|
||||
}
|
||||
// cerr << "Base rank: " << base_rank << endl;
|
||||
return base_rank;
|
||||
}
|
||||
|
||||
void MPHIndex::swap(std::vector<uint32_t>& params, dynamic_2bitset& g, std::vector<uint32_t>& ranktable) {
|
||||
params.resize(12);
|
||||
uint32_t rounded_c = c_ * 1000 * 1000;
|
||||
std::swap(params[0], rounded_c);
|
||||
c_ = static_cast<double>(rounded_c) / 1000 / 1000;
|
||||
std::swap(params[1], m_);
|
||||
std::swap(params[2], n_);
|
||||
std::swap(params[3], k_);
|
||||
uint32_t uint32_square = static_cast<uint32_t>(square_);
|
||||
std::swap(params[4], uint32_square);
|
||||
square_ = uint32_square;
|
||||
std::swap(params[5], hash_seed_[0]);
|
||||
std::swap(params[6], hash_seed_[1]);
|
||||
std::swap(params[7], hash_seed_[2]);
|
||||
g.swap(g_);
|
||||
ranktable.swap(ranktable_);
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
270
cmph-2.0.2/cxxmph/mph_index.h
Normal file
270
cmph-2.0.2/cxxmph/mph_index.h
Normal file
@ -0,0 +1,270 @@
|
||||
#ifndef __CXXMPH_MPH_INDEX_H__
|
||||
#define __CXXMPH_MPH_INDEX_H__
|
||||
|
||||
// Minimal perfect hash abstraction implementing the BDZ algorithm
|
||||
//
|
||||
// This is a data structure that given a set of known keys S, will create a
|
||||
// mapping from S to [0..|S|). The class is informed about S through the Reset
|
||||
// method and the mapping is queried by calling index(key).
|
||||
//
|
||||
// This is a pretty uncommon data structure, and if you application has a real
|
||||
// use case for it, chances are that it is a real win. If all you are doing is
|
||||
// a straightforward implementation of an in-memory associative mapping data
|
||||
// structure, then it will probably be slower. Take a look at mph_map.h
|
||||
// instead.
|
||||
//
|
||||
// Thesis presenting this and similar algorithms:
|
||||
// http://homepages.dcc.ufmg.br/~fbotelho/en/talks/thesis2008/thesis.pdf
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// Most users can use the SimpleMPHIndex wrapper instead of the MPHIndex which
|
||||
// have confusing template parameters.
|
||||
// This class only implements a minimal perfect hash function, it does not
|
||||
// implement an associative mapping data structure.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <unordered_map> // for std::hash
|
||||
#include <vector>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
#include "seeded_hash.h"
|
||||
#include "mph_bits.h"
|
||||
#include "trigraph.h"
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class MPHIndex {
|
||||
public:
|
||||
MPHIndex(bool square = false, double c = 1.23, uint8_t b = 7) :
|
||||
c_(c), b_(b), m_(0), n_(0), k_(0), square_(square), r_(1), g_(8, true) {
|
||||
nest_displacement_[0] = 0;
|
||||
nest_displacement_[1] = r_;
|
||||
nest_displacement_[2] = (r_ << 1);
|
||||
}
|
||||
~MPHIndex();
|
||||
|
||||
template <class SeededHashFcn, class ForwardIterator>
|
||||
bool Reset(ForwardIterator begin, ForwardIterator end, uint32_t size);
|
||||
template <class SeededHashFcn, class Key> // must agree with Reset
|
||||
// Get a unique identifier for k, in the range [0;size()). If x wasn't part
|
||||
// of the input in the last Reset call, returns a random value.
|
||||
uint32_t index(const Key& x) const;
|
||||
uint32_t size() const { return m_; }
|
||||
void clear();
|
||||
|
||||
// Advanced users functions. Please avoid unless you know what you are doing.
|
||||
uint32_t perfect_hash_size() const { return n_; }
|
||||
template <class SeededHashFcn, class Key> // must agree with Reset
|
||||
uint32_t perfect_hash(const Key& x) const; // way faster than the minimal
|
||||
template <class SeededHashFcn, class Key> // must agree with Reset
|
||||
uint32_t perfect_square(const Key& x) const; // even faster but needs square=true
|
||||
uint32_t minimal_perfect_hash_size() const { return size(); }
|
||||
template <class SeededHashFcn, class Key> // must agree with Reset
|
||||
uint32_t minimal_perfect_hash(const Key& x) const;
|
||||
|
||||
// Experimental api to use as a serialization building block.
|
||||
// Since this signature exposes some implementation details, expect it to
|
||||
// change.
|
||||
void swap(std::vector<uint32_t>& params, dynamic_2bitset& g, std::vector<uint32_t>& ranktable);
|
||||
|
||||
private:
|
||||
template <class SeededHashFcn, class ForwardIterator>
|
||||
bool Mapping(ForwardIterator begin, ForwardIterator end,
|
||||
std::vector<TriGraph::Edge>* edges,
|
||||
std::vector<uint32_t>* queue);
|
||||
bool GenerateQueue(TriGraph* graph, std::vector<uint32_t>* queue);
|
||||
void Assigning(const std::vector<TriGraph::Edge>& edges,
|
||||
const std::vector<uint32_t>& queue);
|
||||
void Ranking();
|
||||
uint32_t Rank(uint32_t vertex) const;
|
||||
|
||||
// Algorithm parameters
|
||||
// Perfect hash function density. If this was a 2graph,
|
||||
// then probability of having an acyclic graph would be
|
||||
// sqrt(1-(2/c)^2). See section 3 for details.
|
||||
// http://www.it-c.dk/people/pagh/papers/simpleperf.pdf
|
||||
double c_;
|
||||
uint8_t b_; // Number of bits of the kth index in the ranktable
|
||||
|
||||
// Values used during generation
|
||||
uint32_t m_; // edges count
|
||||
uint32_t n_; // vertex count
|
||||
uint32_t k_; // kth index in ranktable, $k = log_2(n=3r)\varepsilon$
|
||||
bool square_; // make bit vector size a power of 2
|
||||
|
||||
// Values used during search
|
||||
|
||||
// Partition vertex count, derived from c parameter.
|
||||
uint32_t r_;
|
||||
uint32_t nest_displacement_[3]; // derived from r_
|
||||
|
||||
// The array containing the minimal perfect hash function graph.
|
||||
dynamic_2bitset g_;
|
||||
uint8_t threebit_mod3[10]; // speed up mod3 calculation for 3bit ints
|
||||
// The table used for the rank step of the minimal perfect hash function
|
||||
std::vector<uint32_t> ranktable_;
|
||||
// The selected hash seed triplet for finding the edges in the minimal
|
||||
// perfect hash function graph.
|
||||
uint32_t hash_seed_[3];
|
||||
};
|
||||
|
||||
// Template method needs to go in the header file.
|
||||
template <class SeededHashFcn, class ForwardIterator>
|
||||
bool MPHIndex::Reset(
|
||||
ForwardIterator begin, ForwardIterator end, uint32_t size) {
|
||||
if (end == begin) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
m_ = size;
|
||||
r_ = static_cast<uint32_t>(ceil((c_*m_)/3));
|
||||
if ((r_ % 2) == 0) r_ += 1;
|
||||
// This can be used to speed mods, but increases occupation too much.
|
||||
// Needs to try http://gmplib.org/manual/Integer-Exponentiation.html instead
|
||||
if (square_) r_ = nextpoweroftwo(r_);
|
||||
nest_displacement_[0] = 0;
|
||||
nest_displacement_[1] = r_;
|
||||
nest_displacement_[2] = (r_ << 1);
|
||||
for (uint32_t i = 0; i < sizeof(threebit_mod3); ++i) threebit_mod3[i] = i % 3;
|
||||
|
||||
n_ = 3*r_;
|
||||
k_ = 1U << b_;
|
||||
|
||||
// cerr << "m " << m_ << " n " << n_ << " r " << r_ << endl;
|
||||
|
||||
int iterations = 1000;
|
||||
std::vector<TriGraph::Edge> edges;
|
||||
std::vector<uint32_t> queue;
|
||||
while (1) {
|
||||
// cerr << "Iterations missing: " << iterations << endl;
|
||||
for (int i = 0; i < 3; ++i) hash_seed_[i] = random();
|
||||
if (Mapping<SeededHashFcn>(begin, end, &edges, &queue)) break;
|
||||
else --iterations;
|
||||
if (iterations == 0) break;
|
||||
}
|
||||
if (iterations == 0) return false;
|
||||
Assigning(edges, queue);
|
||||
std::vector<TriGraph::Edge>().swap(edges);
|
||||
Ranking();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class SeededHashFcn, class ForwardIterator>
|
||||
bool MPHIndex::Mapping(
|
||||
ForwardIterator begin, ForwardIterator end,
|
||||
std::vector<TriGraph::Edge>* edges, std::vector<uint32_t>* queue) {
|
||||
TriGraph graph(n_, m_);
|
||||
for (ForwardIterator it = begin; it != end; ++it) {
|
||||
h128 h = SeededHashFcn().hash128(*it, hash_seed_[0]);
|
||||
// for (int i = 0; i < 3; ++i) h[i] = SeededHashFcn()(*it, hash_seed_[i]);
|
||||
uint32_t v0 = h[0] % r_;
|
||||
uint32_t v1 = h[1] % r_ + r_;
|
||||
uint32_t v2 = h[2] % r_ + (r_ << 1);
|
||||
// cerr << "Key: " << *it << " edge " << it - begin << " (" << v0 << "," << v1 << "," << v2 << ")" << endl;
|
||||
graph.AddEdge(TriGraph::Edge(v0, v1, v2));
|
||||
}
|
||||
if (GenerateQueue(&graph, queue)) {
|
||||
graph.ExtractEdgesAndClear(edges);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class SeededHashFcn, class Key>
|
||||
uint32_t MPHIndex::perfect_square(const Key& key) const {
|
||||
h128 h = SeededHashFcn().hash128(key, hash_seed_[0]);
|
||||
h[0] = (h[0] & (r_-1)) + nest_displacement_[0];
|
||||
h[1] = (h[1] & (r_-1)) + nest_displacement_[1];
|
||||
h[2] = (h[2] & (r_-1)) + nest_displacement_[2];
|
||||
assert((h[0]) < g_.size());
|
||||
assert((h[1]) < g_.size());
|
||||
assert((h[2]) < g_.size());
|
||||
uint8_t nest = threebit_mod3[g_[h[0]] + g_[h[1]] + g_[h[2]]];
|
||||
uint32_t vertex = h[nest];
|
||||
return vertex;
|
||||
}
|
||||
|
||||
template <class SeededHashFcn, class Key>
|
||||
uint32_t MPHIndex::perfect_hash(const Key& key) const {
|
||||
if (!g_.size()) return 0;
|
||||
h128 h = SeededHashFcn().hash128(key, hash_seed_[0]);
|
||||
h[0] = (h[0] % r_) + nest_displacement_[0];
|
||||
h[1] = (h[1] % r_) + nest_displacement_[1];
|
||||
h[2] = (h[2] % r_) + nest_displacement_[2];
|
||||
assert((h[0]) < g_.size());
|
||||
assert((h[1]) < g_.size());
|
||||
assert((h[2]) < g_.size());
|
||||
uint8_t nest = threebit_mod3[g_[h[0]] + g_[h[1]] + g_[h[2]]];
|
||||
uint32_t vertex = h[nest];
|
||||
return vertex;
|
||||
}
|
||||
|
||||
template <class SeededHashFcn, class Key>
|
||||
uint32_t MPHIndex::minimal_perfect_hash(const Key& key) const {
|
||||
return Rank(perfect_hash<SeededHashFcn, Key>(key));
|
||||
}
|
||||
|
||||
template <class SeededHashFcn, class Key>
|
||||
uint32_t MPHIndex::index(const Key& key) const {
|
||||
return minimal_perfect_hash<SeededHashFcn, Key>(key);
|
||||
}
|
||||
|
||||
// Simple wrapper around MPHIndex to simplify calling code. Please refer to the
|
||||
// MPHIndex class for documentation.
|
||||
template <class Key, class HashFcn = typename seeded_hash<std::hash<Key>>::hash_function>
|
||||
class SimpleMPHIndex : public MPHIndex {
|
||||
public:
|
||||
SimpleMPHIndex(bool advanced_usage = false) : MPHIndex(advanced_usage) {}
|
||||
template <class ForwardIterator>
|
||||
bool Reset(ForwardIterator begin, ForwardIterator end, uint32_t size) {
|
||||
return MPHIndex::Reset<HashFcn>(begin, end, size);
|
||||
}
|
||||
uint32_t index(const Key& key) const { return MPHIndex::index<HashFcn>(key); }
|
||||
};
|
||||
|
||||
// The parameters minimal and square trade memory usage for evaluation speed.
|
||||
// Minimal decreases speed and memory usage, and square does the opposite.
|
||||
// Using minimal=true and square=false is the same as SimpleMPHIndex.
|
||||
template <bool minimal, bool square, class Key, class HashFcn>
|
||||
struct FlexibleMPHIndex {};
|
||||
|
||||
template <class Key, class HashFcn>
|
||||
struct FlexibleMPHIndex<true, false, Key, HashFcn>
|
||||
: public SimpleMPHIndex<Key, HashFcn> {
|
||||
FlexibleMPHIndex() : SimpleMPHIndex<Key, HashFcn>(false) {}
|
||||
uint32_t index(const Key& key) const {
|
||||
return MPHIndex::minimal_perfect_hash<HashFcn>(key); }
|
||||
uint32_t size() const { return MPHIndex::minimal_perfect_hash_size(); }
|
||||
};
|
||||
template <class Key, class HashFcn>
|
||||
struct FlexibleMPHIndex<false, true, Key, HashFcn>
|
||||
: public SimpleMPHIndex<Key, HashFcn> {
|
||||
FlexibleMPHIndex() : SimpleMPHIndex<Key, HashFcn>(true) {}
|
||||
uint32_t index(const Key& key) const {
|
||||
return MPHIndex::perfect_square<HashFcn>(key); }
|
||||
uint32_t size() const { return MPHIndex::perfect_hash_size(); }
|
||||
};
|
||||
template <class Key, class HashFcn>
|
||||
struct FlexibleMPHIndex<false, false, Key, HashFcn>
|
||||
: public SimpleMPHIndex<Key, HashFcn> {
|
||||
FlexibleMPHIndex() : SimpleMPHIndex<Key, HashFcn>(false) {}
|
||||
uint32_t index(const Key& key) const {
|
||||
return MPHIndex::perfect_hash<HashFcn>(key); }
|
||||
uint32_t size() const { return MPHIndex::perfect_hash_size(); }
|
||||
};
|
||||
// From a trade-off perspective this case does not make much sense.
|
||||
// template <class Key, class HashFcn>
|
||||
// class FlexibleMPHIndex<true, true, Key, HashFcn>
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_MPH_INDEX_H__
|
53
cmph-2.0.2/cxxmph/mph_index_test.cc
Normal file
53
cmph-2.0.2/cxxmph/mph_index_test.cc
Normal file
@ -0,0 +1,53 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mph_index.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using namespace cxxmph;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
srand(1);
|
||||
vector<string> keys;
|
||||
keys.push_back("davi");
|
||||
keys.push_back("paulo");
|
||||
keys.push_back("joao");
|
||||
keys.push_back("maria");
|
||||
keys.push_back("bruno");
|
||||
keys.push_back("paula");
|
||||
keys.push_back("diego");
|
||||
keys.push_back("diogo");
|
||||
keys.push_back("algume");
|
||||
|
||||
SimpleMPHIndex<string> mph_index;
|
||||
if (!mph_index.Reset(keys.begin(), keys.end(), keys.size())) { exit(-1); }
|
||||
vector<int> ids;
|
||||
for (vector<int>::size_type i = 0; i < keys.size(); ++i) {
|
||||
ids.push_back(mph_index.index(keys[i]));
|
||||
cerr << " " << *(ids.end() - 1);
|
||||
}
|
||||
cerr << endl;
|
||||
sort(ids.begin(), ids.end());
|
||||
for (vector<int>::size_type i = 0; i < ids.size(); ++i) assert(ids[i] == static_cast<vector<int>::value_type>(i));
|
||||
|
||||
// Test serialization
|
||||
vector<uint32_t> params;
|
||||
dynamic_2bitset g;
|
||||
vector<uint32_t> ranktable;
|
||||
mph_index.swap(params, g, ranktable);
|
||||
assert(mph_index.size() == 0);
|
||||
mph_index.swap(params, g, ranktable);
|
||||
assert(mph_index.size() == ids.size());
|
||||
for (vector<int>::size_type i = 0; i < ids.size(); ++i) assert(ids[i] == static_cast<vector<int>::value_type>(i));
|
||||
|
||||
FlexibleMPHIndex<false, true, int64_t, seeded_hash<std::hash<int64_t>>::hash_function> square_empty;
|
||||
auto id = square_empty.index(1);
|
||||
FlexibleMPHIndex<false, false, int64_t, seeded_hash<std::hash<int64_t>>::hash_function> unordered_empty;
|
||||
id ^= unordered_empty.index(1);
|
||||
FlexibleMPHIndex<true, false, int64_t, seeded_hash<std::hash<int64_t>>::hash_function> minimal_empty;
|
||||
id ^= minimal_empty.index(1);
|
||||
}
|
272
cmph-2.0.2/cxxmph/mph_map.h
Normal file
272
cmph-2.0.2/cxxmph/mph_map.h
Normal file
@ -0,0 +1,272 @@
|
||||
#ifndef __CXXMPH_MPH_MAP_H__
|
||||
#define __CXXMPH_MPH_MAP_H__
|
||||
// Implementation of the unordered associative mapping interface using a
|
||||
// minimal perfect hash function.
|
||||
//
|
||||
// Since these are header-mostly libraries, make sure you compile your code
|
||||
// with -DNDEBUG and -O3. The code requires a modern C++11 compiler.
|
||||
//
|
||||
// The container comes in 3 flavors, all in the cxxmph namespace and drop-in
|
||||
// replacement for the popular classes with the same names.
|
||||
// * dense_hash_map
|
||||
// -> fast, uses more memory, 2.93 bits per bucket, ~50% occupation
|
||||
// * unordered_map (aliases: hash_map, mph_map)
|
||||
// -> middle ground, uses 2.93 bits per bucket, ~81% occupation
|
||||
// * sparse_hash_map -> slower, uses 3.6 bits per bucket
|
||||
// -> less fast, uses 3.6 bits per bucket, 100% occupation
|
||||
//
|
||||
// Those classes are not necessarily faster than their existing counterparts.
|
||||
// Benchmark your code before using it. The larger the key, the larger the
|
||||
// number of elements inserted, and the bigger the number of failed searches,
|
||||
// the more likely those classes will outperform existing code.
|
||||
//
|
||||
// For large sets of urls (>100k), which are a somewhat expensive to compare, I
|
||||
// found those class to be about 10%-50% faster than unordered_map.
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#include "string_util.h"
|
||||
#include "hollow_iterator.h"
|
||||
#include "mph_bits.h"
|
||||
#include "mph_index.h"
|
||||
#include "seeded_hash.h"
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using std::vector;
|
||||
|
||||
// Save on repetitive typing.
|
||||
#define MPH_MAP_TMPL_SPEC \
|
||||
template <bool minimal, bool square, \
|
||||
class Key, class Data, class HashFcn, class EqualKey, class Alloc>
|
||||
#define MPH_MAP_CLASS_SPEC mph_map_base<minimal, square, Key, Data, HashFcn, EqualKey, Alloc>
|
||||
#define MPH_MAP_METHOD_DECL(r, m) MPH_MAP_TMPL_SPEC typename MPH_MAP_CLASS_SPEC::r MPH_MAP_CLASS_SPEC::m
|
||||
#define MPH_MAP_INLINE_METHOD_DECL(r, m) MPH_MAP_TMPL_SPEC inline typename MPH_MAP_CLASS_SPEC::r MPH_MAP_CLASS_SPEC::m
|
||||
|
||||
template <bool minimal, bool square, class Key, class Data, class HashFcn = std::hash<Key>, class EqualKey = std::equal_to<Key>, class Alloc = std::allocator<Data> >
|
||||
class mph_map_base {
|
||||
public:
|
||||
typedef Key key_type;
|
||||
typedef Data data_type;
|
||||
typedef pair<Key, Data> value_type;
|
||||
typedef HashFcn hasher;
|
||||
typedef EqualKey key_equal;
|
||||
|
||||
typedef typename vector<value_type>::pointer pointer;
|
||||
typedef typename vector<value_type>::reference reference;
|
||||
typedef typename vector<value_type>::const_reference const_reference;
|
||||
typedef typename vector<value_type>::size_type size_type;
|
||||
typedef typename vector<value_type>::difference_type difference_type;
|
||||
|
||||
typedef is_empty<const vector<value_type>> is_empty_type;
|
||||
typedef hollow_iterator_base<typename vector<value_type>::iterator, is_empty_type> iterator;
|
||||
typedef hollow_iterator_base<typename vector<value_type>::const_iterator, is_empty_type> const_iterator;
|
||||
|
||||
// For making macros simpler.
|
||||
typedef void void_type;
|
||||
typedef bool bool_type;
|
||||
typedef pair<iterator, bool> insert_return_type;
|
||||
|
||||
mph_map_base();
|
||||
~mph_map_base();
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
void erase(iterator pos);
|
||||
void erase(const key_type& k);
|
||||
pair<iterator, bool> insert(const value_type& x);
|
||||
inline iterator find(const key_type& k);
|
||||
inline const_iterator find(const key_type& k) const;
|
||||
typedef int32_t my_int32_t; // help macros
|
||||
inline int32_t index(const key_type& k) const;
|
||||
data_type& operator[](const key_type &k);
|
||||
const data_type& operator[](const key_type &k) const;
|
||||
|
||||
size_type bucket_count() const { return index_.size() + slack_.bucket_count(); }
|
||||
void rehash(size_type nbuckets /*ignored*/);
|
||||
|
||||
protected: // mimicking STL implementation
|
||||
EqualKey equal_;
|
||||
|
||||
private:
|
||||
template <typename iterator>
|
||||
struct iterator_first : public iterator {
|
||||
iterator_first(iterator it) : iterator(it) { }
|
||||
const typename iterator::value_type::first_type& operator*() {
|
||||
return this->iterator::operator*().first;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename iterator>
|
||||
iterator_first<iterator> make_iterator_first(iterator it) {
|
||||
return iterator_first<iterator>(it);
|
||||
}
|
||||
|
||||
void pack();
|
||||
vector<value_type> values_;
|
||||
vector<bool> present_;
|
||||
FlexibleMPHIndex<minimal, square, Key, typename seeded_hash<HashFcn>::hash_function> index_;
|
||||
// TODO(davi) optimize slack to use hash from index rather than calculate its own
|
||||
typedef std::unordered_map<h128, uint32_t, h128::hash32> slack_type;
|
||||
slack_type slack_;
|
||||
size_type size_;
|
||||
typename seeded_hash<HashFcn>::hash_function hasher128_;
|
||||
};
|
||||
|
||||
MPH_MAP_TMPL_SPEC
|
||||
bool operator==(const MPH_MAP_CLASS_SPEC& lhs, const MPH_MAP_CLASS_SPEC& rhs) {
|
||||
return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin());
|
||||
}
|
||||
|
||||
MPH_MAP_TMPL_SPEC MPH_MAP_CLASS_SPEC::mph_map_base() : size_(0) {
|
||||
clear();
|
||||
pack();
|
||||
}
|
||||
MPH_MAP_TMPL_SPEC MPH_MAP_CLASS_SPEC::~mph_map_base() { }
|
||||
|
||||
MPH_MAP_METHOD_DECL(insert_return_type, insert)(const value_type& x) {
|
||||
auto it = find(x.first);
|
||||
auto it_end = end();
|
||||
if (it != it_end) return make_pair(it, false);
|
||||
bool should_pack = false;
|
||||
if (values_.capacity() == values_.size() && values_.size() > 256) {
|
||||
should_pack = true;
|
||||
}
|
||||
values_.push_back(x);
|
||||
present_.push_back(true);
|
||||
++size_;
|
||||
h128 h = hasher128_.hash128(x.first, 0);
|
||||
if (slack_.find(h) != slack_.end()) should_pack = true; // unavoidable pack
|
||||
else slack_.insert(std::make_pair(h, values_.size() - 1));
|
||||
if (should_pack) pack();
|
||||
it = find(x.first);
|
||||
return make_pair(it, true);
|
||||
}
|
||||
|
||||
MPH_MAP_METHOD_DECL(void_type, pack)() {
|
||||
// CXXMPH_DEBUGLN("Packing %v values")(values_.size());
|
||||
if (values_.empty()) return;
|
||||
assert(std::unordered_set<key_type>(make_iterator_first(begin()), make_iterator_first(end())).size() == size());
|
||||
bool success = index_.Reset(
|
||||
make_iterator_first(begin()),
|
||||
make_iterator_first(end()), size_);
|
||||
if (!success) { exit(-1); }
|
||||
vector<value_type> new_values(index_.size());
|
||||
new_values.reserve(new_values.size() * 2);
|
||||
vector<bool> new_present(index_.size(), false);
|
||||
new_present.reserve(new_present.size() * 2);
|
||||
for (iterator it = begin(), it_end = end(); it != it_end; ++it) {
|
||||
size_type id = index_.index(it->first);
|
||||
assert(id < index_.size());
|
||||
assert(id < new_values.size());
|
||||
new_values[id] = *it;
|
||||
new_present[id] = true;
|
||||
}
|
||||
// fprintf(stderr, "Collision ratio: %f\n", collisions*1.0/size());
|
||||
values_.swap(new_values);
|
||||
present_.swap(new_present);
|
||||
slack_type().swap(slack_);
|
||||
}
|
||||
|
||||
MPH_MAP_METHOD_DECL(iterator, begin)() { return make_hollow(&values_, &present_, values_.begin()); }
|
||||
MPH_MAP_METHOD_DECL(iterator, end)() { return make_solid(&values_, &present_, values_.end()); }
|
||||
MPH_MAP_METHOD_DECL(const_iterator, begin)() const { return make_hollow(&values_, &present_, values_.begin()); }
|
||||
MPH_MAP_METHOD_DECL(const_iterator, end)() const { return make_solid(&values_, &present_, values_.end()); }
|
||||
MPH_MAP_METHOD_DECL(bool_type, empty)() const { return size_ == 0; }
|
||||
MPH_MAP_METHOD_DECL(size_type, size)() const { return size_; }
|
||||
|
||||
MPH_MAP_METHOD_DECL(void_type, clear)() {
|
||||
values_.clear();
|
||||
present_.clear();
|
||||
slack_.clear();
|
||||
index_.clear();
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
MPH_MAP_METHOD_DECL(void_type, erase)(iterator pos) {
|
||||
assert(pos.it_ - values_.begin() < present_.size());
|
||||
assert(present_[pos.it_ - values_.begin()]);
|
||||
present_[pos.it_ - values_.begin()] = false;
|
||||
*pos = value_type();
|
||||
--size_;
|
||||
}
|
||||
MPH_MAP_METHOD_DECL(void_type, erase)(const key_type& k) {
|
||||
iterator it = find(k);
|
||||
if (it == end()) return;
|
||||
erase(it);
|
||||
}
|
||||
|
||||
MPH_MAP_INLINE_METHOD_DECL(const_iterator, find)(const key_type& k) const {
|
||||
auto idx = index(k);
|
||||
typename vector<value_type>::const_iterator vit = values_.begin() + idx;
|
||||
if (idx == -1 || !equal_(vit->first, k)) return end();
|
||||
return make_solid(&values_, &present_, vit);;
|
||||
}
|
||||
|
||||
MPH_MAP_INLINE_METHOD_DECL(iterator, find)(const key_type& k) {
|
||||
auto idx = index(k);
|
||||
typename vector<value_type>::iterator vit = values_.begin() + idx;
|
||||
if (idx == -1 || !equal_(vit->first, k)) return end();
|
||||
return make_solid(&values_, &present_, vit);;
|
||||
}
|
||||
|
||||
MPH_MAP_INLINE_METHOD_DECL(my_int32_t, index)(const key_type& k) const {
|
||||
if (__builtin_expect(!slack_.empty(), 0)) {
|
||||
auto sit = slack_.find(hasher128_.hash128(k, 0));
|
||||
if (sit != slack_.end()) return sit->second;
|
||||
}
|
||||
if (__builtin_expect(index_.size(), 1)) {
|
||||
auto id = index_.index(k);
|
||||
if (__builtin_expect(present_[id], true)) return id;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
MPH_MAP_METHOD_DECL(data_type&, operator[])(const key_type& k) {
|
||||
return insert(make_pair(k, data_type())).first->second;
|
||||
}
|
||||
MPH_MAP_METHOD_DECL(void_type, rehash)(size_type /*nbuckets*/) {
|
||||
pack();
|
||||
vector<value_type>(values_.begin(), values_.end()).swap(values_);
|
||||
vector<bool>(present_.begin(), present_.end()).swap(present_);
|
||||
slack_type().swap(slack_);
|
||||
}
|
||||
|
||||
#define MPH_MAP_PREAMBLE template <class Key, class Data,\
|
||||
class HashFcn = std::hash<Key>, class EqualKey = std::equal_to<Key>,\
|
||||
class Alloc = std::allocator<Data> >
|
||||
|
||||
MPH_MAP_PREAMBLE class mph_map : public mph_map_base<
|
||||
false, false, Key, Data, HashFcn, EqualKey, Alloc> {};
|
||||
MPH_MAP_PREAMBLE class unordered_map : public mph_map_base<
|
||||
false, false, Key, Data, HashFcn, EqualKey, Alloc> {};
|
||||
MPH_MAP_PREAMBLE class hash_map : public mph_map_base<
|
||||
false, false, Key, Data, HashFcn, EqualKey, Alloc> {};
|
||||
|
||||
MPH_MAP_PREAMBLE class dense_hash_map : public mph_map_base<
|
||||
false, true, Key, Data, HashFcn, EqualKey, Alloc> {};
|
||||
MPH_MAP_PREAMBLE class sparse_hash_map : public mph_map_base<
|
||||
true, false, Key, Data, HashFcn, EqualKey, Alloc> {};
|
||||
|
||||
#undef MPH_MAP_TMPL_SPEC
|
||||
#undef MPH_MAP_CLASS_SPEC
|
||||
#undef MPH_MAP_METHOD_DECL
|
||||
#undef MPH_MAP_INLINE_METHOD_DECL
|
||||
#undef MPH_MAP_PREAMBLE
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_MPH_MAP_H__
|
25
cmph-2.0.2/cxxmph/mph_map_test.cc
Normal file
25
cmph-2.0.2/cxxmph/mph_map_test.cc
Normal file
@ -0,0 +1,25 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "mph_map.h"
|
||||
#include "map_tester.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace cxxmph;
|
||||
|
||||
typedef MapTester<mph_map> Tester;
|
||||
|
||||
CXXMPH_CXX_TEST_CASE(empty_find, Tester::empty_find);
|
||||
CXXMPH_CXX_TEST_CASE(empty_erase, Tester::empty_erase);
|
||||
CXXMPH_CXX_TEST_CASE(small_insert, Tester::small_insert);
|
||||
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
||||
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
||||
CXXMPH_CXX_TEST_CASE(default_search, Tester::default_search);
|
||||
CXXMPH_CXX_TEST_CASE(large_search, Tester::large_search);
|
||||
CXXMPH_CXX_TEST_CASE(string_search, Tester::string_search);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_zero, Tester::rehash_zero);
|
||||
CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size);
|
||||
CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value);
|
||||
CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);
|
147
cmph-2.0.2/cxxmph/seeded_hash.h
Normal file
147
cmph-2.0.2/cxxmph/seeded_hash.h
Normal file
@ -0,0 +1,147 @@
|
||||
#ifndef __CXXMPH_SEEDED_HASH_H__
|
||||
#define __CXXMPH_SEEDED_HASH_H__
|
||||
|
||||
#include <stdint.h> // for uint32_t and friends
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <unordered_map> // for std::hash
|
||||
|
||||
#include "MurmurHash3.h"
|
||||
#include "stringpiece.h"
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
struct h128 {
|
||||
const uint32_t& operator[](uint8_t i) const { return uint32[i]; }
|
||||
uint32_t& operator[](uint8_t i) { return uint32[i]; }
|
||||
uint64_t get64(bool second) const { return (static_cast<uint64_t>(uint32[second << 1]) << 32) | uint32[1 + (second << 1)]; }
|
||||
void set64(uint64_t v, bool second) { uint32[second << 1] = v >> 32; uint32[1+(second<<1)] = ((v << 32) >> 32); }
|
||||
bool operator==(const h128 rhs) const { return memcmp(uint32, rhs.uint32, sizeof(uint32)) == 0; }
|
||||
|
||||
uint32_t uint32[4];
|
||||
|
||||
struct hash32 { uint32_t operator()(const cxxmph::h128& h) const { return h[3]; } };
|
||||
};
|
||||
|
||||
template <class HashFcn>
|
||||
struct seeded_hash_function {
|
||||
template <class Key>
|
||||
uint32_t operator()(const Key& k, uint32_t seed) const {
|
||||
uint32_t h;
|
||||
uint32_t h0 = HashFcn()(k);
|
||||
MurmurHash3_x86_32(reinterpret_cast<const void*>(&h0), 4, seed, &h);
|
||||
return h;
|
||||
}
|
||||
template <class Key>
|
||||
h128 hash128(const Key& k, uint32_t seed) const {
|
||||
h128 h;
|
||||
uint32_t h0 = HashFcn()(k);
|
||||
MurmurHash3_x64_128(reinterpret_cast<const void*>(&h0), 4, seed, &h);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
struct Murmur3 {
|
||||
template<class Key>
|
||||
uint32_t operator()(const Key& k) const {
|
||||
uint32_t out;
|
||||
MurmurHash3_x86_32(reinterpret_cast<const void*>(&k), sizeof(Key), 1 /* seed */, &out);
|
||||
return out;
|
||||
}
|
||||
template <class Key>
|
||||
h128 hash128(const Key& k) const {
|
||||
h128 h;
|
||||
MurmurHash3_x64_128(reinterpret_cast<const void*>(&k), sizeof(Key), 1 /* seed */, &h);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
struct Murmur3StringPiece {
|
||||
template <class Key>
|
||||
uint32_t operator()(const Key& k) const {
|
||||
StringPiece s(k);
|
||||
uint32_t out;
|
||||
MurmurHash3_x86_32(s.data(), s.length(), 1 /* seed */, &out);
|
||||
return out;
|
||||
}
|
||||
template <class Key>
|
||||
h128 hash128(const Key& k) const {
|
||||
h128 h;
|
||||
StringPiece s(k);
|
||||
MurmurHash3_x64_128(s.data(), s.length(), 1 /* seed */, &h);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct seeded_hash_function<Murmur3> {
|
||||
template <class Key>
|
||||
uint32_t operator()(const Key& k, uint32_t seed) const {
|
||||
uint32_t out;
|
||||
MurmurHash3_x86_32(reinterpret_cast<const void*>(&k), sizeof(Key), seed, &out);
|
||||
return out;
|
||||
}
|
||||
template <class Key>
|
||||
h128 hash128(const Key& k, uint32_t seed) const {
|
||||
h128 h;
|
||||
MurmurHash3_x64_128(reinterpret_cast<const void*>(&k), sizeof(Key), seed, &h);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct seeded_hash_function<Murmur3StringPiece> {
|
||||
template <class Key>
|
||||
uint32_t operator()(const Key& k, uint32_t seed) const {
|
||||
StringPiece s(k);
|
||||
uint32_t out;
|
||||
MurmurHash3_x86_32(s.data(), s.length(), seed, &out);
|
||||
return out;
|
||||
}
|
||||
template <class Key>
|
||||
h128 hash128(const Key& k, uint32_t seed) const {
|
||||
h128 h;
|
||||
StringPiece s(k);
|
||||
MurmurHash3_x64_128(s.data(), s.length(), seed, &h);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
template <class HashFcn> struct seeded_hash
|
||||
{ typedef seeded_hash_function<HashFcn> hash_function; };
|
||||
// Use Murmur3 instead for all types defined in std::hash, plus
|
||||
// std::string which is commonly extended.
|
||||
template <> struct seeded_hash<std::hash<char*> >
|
||||
{ typedef seeded_hash_function<Murmur3StringPiece> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<const char*> >
|
||||
{ typedef seeded_hash_function<Murmur3StringPiece> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<std::string> >
|
||||
{ typedef seeded_hash_function<Murmur3StringPiece> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<cxxmph::StringPiece> >
|
||||
{ typedef seeded_hash_function<Murmur3StringPiece> hash_function; };
|
||||
|
||||
template <> struct seeded_hash<std::hash<char> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<unsigned char> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<short> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<unsigned short> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<int> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<unsigned int> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<long> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<unsigned long> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<long long> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
template <> struct seeded_hash<std::hash<unsigned long long> >
|
||||
{ typedef seeded_hash_function<Murmur3> hash_function; };
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_SEEDED_HASH_H__
|
59
cmph-2.0.2/cxxmph/seeded_hash_test.cc
Normal file
59
cmph-2.0.2/cxxmph/seeded_hash_test.cc
Normal file
@ -0,0 +1,59 @@
|
||||
#include "seeded_hash.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
using std::unordered_map;
|
||||
using namespace cxxmph;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto hasher = seeded_hash_function<Murmur3StringPiece>();
|
||||
string key1("0");
|
||||
string key2("1");
|
||||
auto h1 = hasher.hash128(key1, 1);
|
||||
auto h2 = hasher.hash128(key2, 1);
|
||||
if (h1 == h2) {
|
||||
fprintf(stderr, "unexpected murmur collision\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
unordered_map<uint64_t, int> g;
|
||||
for (int i = 0; i < 1000; ++i) g[i] = i;
|
||||
for (int i = 0; i < 1000; ++i) if (g[i] != i) exit(-1);
|
||||
|
||||
auto inthasher = seeded_hash_function<std::hash<uint64_t>>();
|
||||
unordered_map<h128, uint64_t, h128::hash32> g2;
|
||||
for (uint64_t i = 0; i < 1000; ++i) {
|
||||
auto h = inthasher.hash128(i, 0);
|
||||
if (g2.find(h) != g2.end()) {
|
||||
std::cerr << "Incorrectly found " << i << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
if (h128::hash32()(h) != h[3]) {
|
||||
cerr << "Buggy hash method." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
auto h2 = inthasher.hash128(i, 0);
|
||||
if (!(h == h2)) {
|
||||
cerr << "h 64(0) " << h.get64(0) << " h 64(1) " << h.get64(1) << endl;
|
||||
cerr << " h2 64(0) " << h2.get64(0) << " h2 64(1) " << h2.get64(1) << endl;
|
||||
cerr << "Broken equality for h128" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
if (h128::hash32()(h) != h128::hash32()(h2)) {
|
||||
cerr << "Inconsistent hash method." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
g2[h] = i;
|
||||
if (g2.find(h) == g2.end()) {
|
||||
std::cerr << "Incorrectly missed " << i << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint64_t i = 0; i < 1000; ++i) if (g2[inthasher.hash128(i, 0)] != i) exit(-1);
|
||||
}
|
23
cmph-2.0.2/cxxmph/string_util.cc
Normal file
23
cmph-2.0.2/cxxmph/string_util.cc
Normal file
@ -0,0 +1,23 @@
|
||||
#include "string_util.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
bool stream_printf(
|
||||
const std::string& format_string, uint32_t offset, std::ostream* out) {
|
||||
if (offset == format_string.length()) return true;
|
||||
assert(offset < format_string.length());
|
||||
cerr << "length:" << format_string.length() << endl;
|
||||
cerr << "offset:" << offset << endl;
|
||||
auto txt = format_string.substr(offset, format_string.length() - offset);
|
||||
*out << txt;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
133
cmph-2.0.2/cxxmph/string_util.h
Normal file
133
cmph-2.0.2/cxxmph/string_util.h
Normal file
@ -0,0 +1,133 @@
|
||||
#ifndef __CXXMPH_STRING_UTIL_H__
|
||||
#define __CXXMPH_STRING_UTIL_H__
|
||||
|
||||
// Helper functions for string formatting and terminal output. Should be used
|
||||
// only for debugging and tests, since performance was not a concern.
|
||||
// Implemented using variadic templates because it is cool.
|
||||
//
|
||||
// Adds the extra format %v to the printf formatting language. Uses the method
|
||||
// cxxmph::tostr to implement custom printers and fallback to operator
|
||||
// ostream::operator<< otherwise.
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define CXXMPH_DEBUGLN(fmt) variadic_print(__FILE__, __LINE__, &std::cerr, fmt)
|
||||
#define CXXMPH_INFOLN(fmt) variadic_print(__FILE__, __LINE__, &std::cout, fmt)
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
using std::pair;
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
using std::vector;
|
||||
|
||||
template <class T> void tostr(ostream *out, const T& v) {
|
||||
*out << v;
|
||||
}
|
||||
inline void tostr(std::ostream* out, uint8_t v) {
|
||||
*out << static_cast<uint32_t>(v);
|
||||
}
|
||||
template <class V>
|
||||
inline void tostr(ostream* out, const vector<V>& v) {
|
||||
*out << "[";
|
||||
for (uint32_t i = 0; i < v.size(); ++i) {
|
||||
tostr(out, v[1]);
|
||||
if (i != v.size() - 1)*out << " ";
|
||||
}
|
||||
*out << "]";
|
||||
}
|
||||
template <class F, class S>
|
||||
inline void tostr(ostream* out, const pair<F, S>& v) {
|
||||
*out << "(";
|
||||
tostr(out, v.first);
|
||||
*out << ",";
|
||||
tostr(out, v.second);
|
||||
*out << ")";
|
||||
}
|
||||
|
||||
bool stream_printf(
|
||||
const std::string& format_string, uint32_t offset, std::ostream* out);
|
||||
|
||||
template <bool ispod> struct pod_snprintf {};
|
||||
template <> struct pod_snprintf<false> {
|
||||
template <class T>
|
||||
int operator()(char*, size_t, const char*, const T&) {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
template <> struct pod_snprintf<true> {
|
||||
template <class T>
|
||||
int operator()(char* str, size_t size, const char* format, const T& v) {
|
||||
return snprintf(str, size, format, v);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
bool stream_printf(const std::string& format_string, uint32_t offset,
|
||||
std::ostream* out, const T& value, Args&&... args) {
|
||||
auto txt = format_string.c_str() + offset;
|
||||
while (*txt) {
|
||||
auto b = txt;
|
||||
for (; *txt != '%'; ++txt);
|
||||
if (*(txt + 1) == '%') ++txt;
|
||||
else if (txt == b) break;
|
||||
*out << string(b, txt - b);
|
||||
if (*(txt - 1) == '%') ++txt;
|
||||
}
|
||||
auto fmt = txt + 1;
|
||||
while (*fmt && *fmt != '%') ++fmt;
|
||||
if (strncmp(txt, "%v", 2) == 0) {
|
||||
txt += 2;
|
||||
tostr(out, value);
|
||||
if (txt != fmt) *out << string(txt, fmt);
|
||||
} else {
|
||||
char buf[256]; // Is this enough?
|
||||
auto n = pod_snprintf<std::is_pod<T>::value>()(
|
||||
buf, 256, std::string(txt, fmt).c_str(), value);
|
||||
if (n < 0) return false;
|
||||
*out << buf;
|
||||
}
|
||||
return stream_printf(format_string, fmt - format_string.c_str(), out,
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
std::string format(const std::string& format_string, Args&&... args) {
|
||||
std::ostringstream out;
|
||||
if (!stream_printf(format_string, 0, &out, std::forward<Args>(args)...)) {
|
||||
return std::string();
|
||||
};
|
||||
return out.str();
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void infoln(const std::string& format_string, Args&&... args) {
|
||||
stream_printf(format_string + "\n", 0, &std::cout, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
struct variadic_print {
|
||||
variadic_print(const std::string& file, uint32_t line, std::ostream* out,
|
||||
const std::string& format_line)
|
||||
: file_(file), line_(line), out_(out), format_line_(format_line) {}
|
||||
template <typename... Args>
|
||||
void operator()(Args&&... args) {
|
||||
std::string fancy_format = "%v:%d: ";
|
||||
fancy_format += format_line_ + "\n";
|
||||
stream_printf(fancy_format, 0, out_, file_, line_, std::forward<Args>(args)...);
|
||||
}
|
||||
const std::string& file_;
|
||||
const uint32_t& line_;
|
||||
std::ostream* out_;
|
||||
const std::string& format_line_;
|
||||
};
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_STRING_UTIL_H__
|
27
cmph-2.0.2/cxxmph/string_util_test.cc
Normal file
27
cmph-2.0.2/cxxmph/string_util_test.cc
Normal file
@ -0,0 +1,27 @@
|
||||
#include "string_util.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace cxxmph;
|
||||
|
||||
bool test_format() {
|
||||
string expected = " %% 4 foo 0x0A bar ";
|
||||
string foo = "foo";
|
||||
string fmt = format(" %%%% %v %v 0x%.2X bar ", 4, foo, 10);
|
||||
fail_unless(fmt == expected, "expected\n-%s-\n got \n-%s-", expected.c_str(), fmt.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test_infoln() {
|
||||
infoln(string("%s:%d: MY INFO LINE"), __FILE__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool test_macro() {
|
||||
CXXMPH_DEBUGLN("here i am")();
|
||||
return true;
|
||||
}
|
||||
|
||||
CXXMPH_TEST_CASE(test_format)
|
||||
CXXMPH_TEST_CASE(test_infoln)
|
||||
CXXMPH_TEST_CASE(test_macro)
|
182
cmph-2.0.2/cxxmph/stringpiece.h
Normal file
182
cmph-2.0.2/cxxmph/stringpiece.h
Normal file
@ -0,0 +1,182 @@
|
||||
// Copyright 2001-2010 The RE2 Authors. All Rights Reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// A string-like object that points to a sized piece of memory.
|
||||
//
|
||||
// Functions or methods may use const StringPiece& parameters to accept either
|
||||
// a "const char*" or a "string" value that will be implicitly converted to
|
||||
// a StringPiece. The implicit conversion means that it is often appropriate
|
||||
// to include this .h file in other files rather than forward-declaring
|
||||
// StringPiece as would be appropriate for most other Google classes.
|
||||
//
|
||||
// Systematic usage of StringPiece is encouraged as it will reduce unnecessary
|
||||
// conversions from "const char*" to "string" and back again.
|
||||
//
|
||||
//
|
||||
// Arghh! I wish C++ literals were "string".
|
||||
|
||||
#ifndef CXXMPH_STRINGPIECE_H__
|
||||
#define CXXMPH_STRINGPIECE_H__
|
||||
|
||||
#include <cstddef>
|
||||
#include <string.h>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class StringPiece {
|
||||
private:
|
||||
const char* ptr_;
|
||||
int length_;
|
||||
|
||||
public:
|
||||
// We provide non-explicit singleton constructors so users can pass
|
||||
// in a "const char*" or a "string" wherever a "StringPiece" is
|
||||
// expected.
|
||||
StringPiece() : ptr_(NULL), length_(0) { }
|
||||
StringPiece(const char* str)
|
||||
: ptr_(str), length_((str == NULL) ? 0 : static_cast<int>(strlen(str))) { }
|
||||
StringPiece(const std::string& str)
|
||||
: ptr_(str.data()), length_(static_cast<int>(str.size())) { }
|
||||
StringPiece(const char* offset, int len) : ptr_(offset), length_(len) { }
|
||||
|
||||
// data() may return a pointer to a buffer with embedded NULs, and the
|
||||
// returned buffer may or may not be null terminated. Therefore it is
|
||||
// typically a mistake to pass data() to a routine that expects a NUL
|
||||
// terminated string.
|
||||
const char* data() const { return ptr_; }
|
||||
int size() const { return length_; }
|
||||
int length() const { return length_; }
|
||||
bool empty() const { return length_ == 0; }
|
||||
|
||||
void clear() { ptr_ = NULL; length_ = 0; }
|
||||
void set(const char* data, int len) { ptr_ = data; length_ = len; }
|
||||
void set(const char* str) {
|
||||
ptr_ = str;
|
||||
if (str != NULL)
|
||||
length_ = static_cast<int>(strlen(str));
|
||||
else
|
||||
length_ = 0;
|
||||
}
|
||||
void set(const void* data, int len) {
|
||||
ptr_ = reinterpret_cast<const char*>(data);
|
||||
length_ = len;
|
||||
}
|
||||
|
||||
char operator[](int i) const { return ptr_[i]; }
|
||||
|
||||
void remove_prefix(int n) {
|
||||
ptr_ += n;
|
||||
length_ -= n;
|
||||
}
|
||||
|
||||
void remove_suffix(int n) {
|
||||
length_ -= n;
|
||||
}
|
||||
|
||||
int compare(const StringPiece& x) const {
|
||||
int r = memcmp(ptr_, x.ptr_, std::min(length_, x.length_));
|
||||
if (r == 0) {
|
||||
if (length_ < x.length_) r = -1;
|
||||
else if (length_ > x.length_) r = +1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
std::string as_string() const {
|
||||
return std::string(data(), size());
|
||||
}
|
||||
// We also define ToString() here, since many other string-like
|
||||
// interfaces name the routine that converts to a C++ string
|
||||
// "ToString", and it's confusing to have the method that does that
|
||||
// for a StringPiece be called "as_string()". We also leave the
|
||||
// "as_string()" method defined here for existing code.
|
||||
std::string ToString() const {
|
||||
return std::string(data(), size());
|
||||
}
|
||||
|
||||
void CopyToString(std::string* target) const;
|
||||
void AppendToString(std::string* target) const;
|
||||
|
||||
// Does "this" start with "x"
|
||||
bool starts_with(const StringPiece& x) const {
|
||||
return ((length_ >= x.length_) &&
|
||||
(memcmp(ptr_, x.ptr_, x.length_) == 0));
|
||||
}
|
||||
|
||||
// Does "this" end with "x"
|
||||
bool ends_with(const StringPiece& x) const {
|
||||
return ((length_ >= x.length_) &&
|
||||
(memcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0));
|
||||
}
|
||||
|
||||
// standard STL container boilerplate
|
||||
typedef char value_type;
|
||||
typedef const char* pointer;
|
||||
typedef const char& reference;
|
||||
typedef const char& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
static const size_type npos;
|
||||
typedef const char* const_iterator;
|
||||
typedef const char* iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
iterator begin() const { return ptr_; }
|
||||
iterator end() const { return ptr_ + length_; }
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(ptr_ + length_);
|
||||
}
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(ptr_);
|
||||
}
|
||||
// STLS says return size_type, but Google says return int
|
||||
int max_size() const { return length_; }
|
||||
int capacity() const { return length_; }
|
||||
|
||||
int copy(char* buf, size_type n, size_type pos = 0) const;
|
||||
|
||||
int find(const StringPiece& s, size_type pos = 0) const;
|
||||
int find(char c, size_type pos = 0) const;
|
||||
int rfind(const StringPiece& s, size_type pos = npos) const;
|
||||
int rfind(char c, size_type pos = npos) const;
|
||||
|
||||
StringPiece substr(size_type pos, size_type n = npos) const;
|
||||
};
|
||||
|
||||
inline bool operator==(const StringPiece& x, const StringPiece& y) {
|
||||
return x.length() == y.length() && memcmp(x.data(), y.data(), x.length()) == 0;
|
||||
}
|
||||
|
||||
inline bool operator!=(const StringPiece& x, const StringPiece& y) {
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
inline bool operator<(const StringPiece& x, const StringPiece& y) {
|
||||
const int r = memcmp(x.data(), y.data(),
|
||||
std::min(x.size(), y.size()));
|
||||
return ((r < 0) || ((r == 0) && (x.size() < y.size())));
|
||||
}
|
||||
|
||||
inline bool operator>(const StringPiece& x, const StringPiece& y) {
|
||||
return y < x;
|
||||
}
|
||||
|
||||
inline bool operator<=(const StringPiece& x, const StringPiece& y) {
|
||||
return !(x > y);
|
||||
}
|
||||
|
||||
inline bool operator>=(const StringPiece& x, StringPiece& y) {
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
// allow StringPiece to be logged
|
||||
inline std::ostream& operator<<(std::ostream& o, const cxxmph::StringPiece& piece) {
|
||||
o << piece.as_string(); return o;
|
||||
}
|
||||
|
||||
#endif // CXXMPH_STRINGPIECE_H__
|
22
cmph-2.0.2/cxxmph/test.cc
Normal file
22
cmph-2.0.2/cxxmph/test.cc
Normal file
@ -0,0 +1,22 @@
|
||||
#include <cstdlib> // For EXIT_SUCCESS, EXIT_FAILURE
|
||||
|
||||
#include "test.h"
|
||||
|
||||
Suite* global_suite() {
|
||||
static Suite* gs = suite_create("cxxmph_test_suite");
|
||||
return gs;
|
||||
}
|
||||
TCase* global_tc_core() {
|
||||
static TCase* gtc = tcase_create("Core");
|
||||
return gtc;
|
||||
}
|
||||
|
||||
int main (void) {
|
||||
suite_add_tcase(global_suite(), global_tc_core());
|
||||
int number_failed;
|
||||
SRunner *sr = srunner_create (global_suite());
|
||||
srunner_run_all (sr, CK_NORMAL);
|
||||
number_failed = srunner_ntests_failed (sr);
|
||||
srunner_free (sr);
|
||||
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
32
cmph-2.0.2/cxxmph/test.h
Normal file
32
cmph-2.0.2/cxxmph/test.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __CXXMPH_TEST_H__
|
||||
#define __CXXMPH_TEST_H__
|
||||
|
||||
// Thin wrapper on top of check.h to get rid of boilerplate in tests. Assumes a
|
||||
// single test suite and test case per file, with each fixture represented by a
|
||||
// parameter-less boolean function.
|
||||
//
|
||||
// The check.h header macro-clashes with c++ libraries so this file needs to be
|
||||
// included last.
|
||||
|
||||
#include <check.h>
|
||||
#include <stdio.h>
|
||||
|
||||
Suite* global_suite();
|
||||
TCase* global_tc_core();
|
||||
|
||||
// Creates a new test case calling boolean_function. Name must be a valid,
|
||||
// unique c identifier when prefixed with tc_.
|
||||
#define CXXMPH_CXX_TEST_CASE(name, boolean_function) \
|
||||
START_TEST(tc_ ## name) \
|
||||
{ fail_unless(boolean_function()); } END_TEST \
|
||||
static TestCase global_cxxmph_tc_ ## name(tc_ ## name);
|
||||
|
||||
#define CXXMPH_TEST_CASE(name) CXXMPH_CXX_TEST_CASE(name, name)
|
||||
|
||||
struct TestCase {
|
||||
TestCase(void (*f)(int)) {
|
||||
tcase_add_test(global_tc_core(), f);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CXXMPH_TEST_H__
|
4
cmph-2.0.2/cxxmph/test_test.cc
Normal file
4
cmph-2.0.2/cxxmph/test_test.cc
Normal file
@ -0,0 +1,4 @@
|
||||
#include "test.h"
|
||||
|
||||
bool tautology() { return true; }
|
||||
CXXMPH_TEST_CASE(tautology)
|
82
cmph-2.0.2/cxxmph/trigraph.cc
Normal file
82
cmph-2.0.2/cxxmph/trigraph.cc
Normal file
@ -0,0 +1,82 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
#include "trigraph.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::vector;
|
||||
|
||||
namespace {
|
||||
static const uint32_t kInvalidEdge = std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
TriGraph::TriGraph(uint32_t nvertices, uint32_t nedges)
|
||||
: nedges_(0),
|
||||
edges_(nedges),
|
||||
next_edge_(nedges),
|
||||
first_edge_(nvertices, kInvalidEdge),
|
||||
vertex_degree_(nvertices, 0) { }
|
||||
TriGraph::~TriGraph() {}
|
||||
|
||||
void TriGraph::ExtractEdgesAndClear(vector<Edge>* edges) {
|
||||
vector<Edge>().swap(next_edge_);
|
||||
vector<uint32_t>().swap(first_edge_);
|
||||
vector<uint8_t>().swap(vertex_degree_);
|
||||
nedges_ = 0;
|
||||
edges->swap(edges_);
|
||||
}
|
||||
void TriGraph::AddEdge(const Edge& edge) {
|
||||
edges_[nedges_] = edge;
|
||||
assert(first_edge_.size() > edge[0]);
|
||||
assert(first_edge_.size() > edge[1]);
|
||||
assert(first_edge_.size() > edge[0]);
|
||||
assert(first_edge_.size() > edge[1]);
|
||||
assert(first_edge_.size() > edge[2]);
|
||||
assert(next_edge_.size() > nedges_);
|
||||
next_edge_[nedges_] = Edge(
|
||||
first_edge_[edge[0]], first_edge_[edge[1]], first_edge_[edge[2]]);
|
||||
first_edge_[edge[0]] = first_edge_[edge[1]] = first_edge_[edge[2]] = nedges_;
|
||||
++vertex_degree_[edge[0]];
|
||||
++vertex_degree_[edge[1]];
|
||||
++vertex_degree_[edge[2]];
|
||||
++nedges_;
|
||||
}
|
||||
|
||||
void TriGraph::RemoveEdge(uint32_t current_edge) {
|
||||
// cerr << "Removing edge " << current_edge << " from " << nedges_ << " existing edges " << endl;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
uint32_t vertex = edges_[current_edge][i];
|
||||
uint32_t edge1 = first_edge_[vertex];
|
||||
uint32_t edge2 = kInvalidEdge;
|
||||
uint32_t j = 0;
|
||||
while (edge1 != current_edge && edge1 != kInvalidEdge) {
|
||||
edge2 = edge1;
|
||||
if (edges_[edge1][0] == vertex) j = 0;
|
||||
else if (edges_[edge1][1] == vertex) j = 1;
|
||||
else j = 2;
|
||||
edge1 = next_edge_[edge1][j];
|
||||
}
|
||||
assert(edge1 != kInvalidEdge);
|
||||
if (edge2 != kInvalidEdge) next_edge_[edge2][j] = next_edge_[edge1][i];
|
||||
else first_edge_[vertex] = next_edge_[edge1][i];
|
||||
--vertex_degree_[vertex];
|
||||
}
|
||||
}
|
||||
|
||||
void TriGraph::DebugGraph() const {
|
||||
uint32_t i;
|
||||
for(i = 0; i < edges_.size(); i++){
|
||||
cerr << i << " " << edges_[i][0] << " " << edges_[i][1] << " " << edges_[i][2]
|
||||
<< " nexts " << next_edge_[i][0] << " " << next_edge_[i][1] << " " << next_edge_[i][2] << endl;
|
||||
}
|
||||
for(i = 0; i < first_edge_.size();i++){
|
||||
cerr << "first for vertice " <<i << " " << first_edge_[i] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace cxxmph
|
49
cmph-2.0.2/cxxmph/trigraph.h
Normal file
49
cmph-2.0.2/cxxmph/trigraph.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef __CXXMPH_TRIGRAPH_H__
|
||||
#define __CXXMPH_TRIGRAPH_H__
|
||||
// Build a trigraph using a memory efficient representation.
|
||||
//
|
||||
// Prior knowledge of the number of edges and vertices for the graph is
|
||||
// required. For each vertex, we store how many edges touch it (degree) and the
|
||||
// index of the first edge in the vector of triples representing the edges.
|
||||
|
||||
#include <stdint.h> // for uint32_t and friends
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace cxxmph {
|
||||
|
||||
class TriGraph {
|
||||
public:
|
||||
struct Edge {
|
||||
Edge() { }
|
||||
Edge(uint32_t v0, uint32_t v1, uint32_t v2) {
|
||||
vertices[0] = v0;
|
||||
vertices[1] = v1;
|
||||
vertices[2] = v2;
|
||||
}
|
||||
uint32_t& operator[](uint8_t v) { return vertices[v]; }
|
||||
const uint32_t& operator[](uint8_t v) const { return vertices[v]; }
|
||||
uint32_t vertices[3];
|
||||
};
|
||||
TriGraph(uint32_t nedges, uint32_t nvertices);
|
||||
~TriGraph();
|
||||
void AddEdge(const Edge& edge);
|
||||
void RemoveEdge(uint32_t edge_id);
|
||||
void ExtractEdgesAndClear(std::vector<Edge>* edges);
|
||||
void DebugGraph() const;
|
||||
|
||||
const std::vector<Edge>& edges() const { return edges_; }
|
||||
const std::vector<uint8_t>& vertex_degree() const { return vertex_degree_; }
|
||||
const std::vector<uint32_t>& first_edge() const { return first_edge_; }
|
||||
|
||||
private:
|
||||
uint32_t nedges_; // total number of edges
|
||||
std::vector<Edge> edges_;
|
||||
std::vector<Edge> next_edge_; // for implementing removal
|
||||
std::vector<uint32_t> first_edge_; // the first edge for this vertex
|
||||
std::vector<uint8_t> vertex_degree_; // number of edges for this vertex
|
||||
};
|
||||
|
||||
} // namespace cxxmph
|
||||
|
||||
#endif // __CXXMPH_TRIGRAPH_H__
|
22
cmph-2.0.2/cxxmph/trigraph_test.cc
Normal file
22
cmph-2.0.2/cxxmph/trigraph_test.cc
Normal file
@ -0,0 +1,22 @@
|
||||
#include <cassert>
|
||||
|
||||
#include "trigraph.h"
|
||||
|
||||
using cxxmph::TriGraph;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
TriGraph g(4, 2);
|
||||
g.AddEdge(TriGraph::Edge(0, 1, 2));
|
||||
g.AddEdge(TriGraph::Edge(1, 3, 2));
|
||||
assert(g.vertex_degree()[0] == 1);
|
||||
assert(g.vertex_degree()[1] == 2);
|
||||
assert(g.vertex_degree()[2] == 2);
|
||||
assert(g.vertex_degree()[3] == 1);
|
||||
g.RemoveEdge(0);
|
||||
assert(g.vertex_degree()[0] == 0);
|
||||
assert(g.vertex_degree()[1] == 1);
|
||||
assert(g.vertex_degree()[2] == 1);
|
||||
assert(g.vertex_degree()[3] == 1);
|
||||
std::vector<TriGraph::Edge> edges;
|
||||
g.ExtractEdgesAndClear(&edges);
|
||||
}
|
791
cmph-2.0.2/depcomp
Executable file
791
cmph-2.0.2/depcomp
Executable file
@ -0,0 +1,791 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
15
cmph-2.0.2/examples/Makefile.am
Executable file
15
cmph-2.0.2/examples/Makefile.am
Executable file
@ -0,0 +1,15 @@
|
||||
noinst_PROGRAMS = vector_adapter_ex1 file_adapter_ex2 struct_vector_adapter_ex3 small_set_ex4
|
||||
|
||||
AM_CPPFLAGS = -I../src/
|
||||
|
||||
vector_adapter_ex1_LDADD = ../src/libcmph.la
|
||||
vector_adapter_ex1_SOURCES = vector_adapter_ex1.c
|
||||
|
||||
file_adapter_ex2_LDADD = ../src/libcmph.la
|
||||
file_adapter_ex2_SOURCES = file_adapter_ex2.c
|
||||
|
||||
struct_vector_adapter_ex3_LDADD = ../src/libcmph.la
|
||||
struct_vector_adapter_ex3_SOURCES = struct_vector_adapter_ex3.c
|
||||
|
||||
small_set_ex4_LDADD = ../src/libcmph.la
|
||||
small_set_ex4_SOURCES = small_set_ex4.c
|
652
cmph-2.0.2/examples/Makefile.in
Normal file
652
cmph-2.0.2/examples/Makefile.in
Normal file
@ -0,0 +1,652 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = vector_adapter_ex1$(EXEEXT) \
|
||||
file_adapter_ex2$(EXEEXT) struct_vector_adapter_ex3$(EXEEXT) \
|
||||
small_set_ex4$(EXEEXT)
|
||||
subdir = examples
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
|
||||
$(top_srcdir)/m4/cxx0x.m4 $(top_srcdir)/m4/largefile.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/spoon.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_file_adapter_ex2_OBJECTS = file_adapter_ex2.$(OBJEXT)
|
||||
file_adapter_ex2_OBJECTS = $(am_file_adapter_ex2_OBJECTS)
|
||||
file_adapter_ex2_DEPENDENCIES = ../src/libcmph.la
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
am_small_set_ex4_OBJECTS = small_set_ex4.$(OBJEXT)
|
||||
small_set_ex4_OBJECTS = $(am_small_set_ex4_OBJECTS)
|
||||
small_set_ex4_DEPENDENCIES = ../src/libcmph.la
|
||||
am_struct_vector_adapter_ex3_OBJECTS = \
|
||||
struct_vector_adapter_ex3.$(OBJEXT)
|
||||
struct_vector_adapter_ex3_OBJECTS = \
|
||||
$(am_struct_vector_adapter_ex3_OBJECTS)
|
||||
struct_vector_adapter_ex3_DEPENDENCIES = ../src/libcmph.la
|
||||
am_vector_adapter_ex1_OBJECTS = vector_adapter_ex1.$(OBJEXT)
|
||||
vector_adapter_ex1_OBJECTS = $(am_vector_adapter_ex1_OBJECTS)
|
||||
vector_adapter_ex1_DEPENDENCIES = ../src/libcmph.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/file_adapter_ex2.Po \
|
||||
./$(DEPDIR)/small_set_ex4.Po \
|
||||
./$(DEPDIR)/struct_vector_adapter_ex3.Po \
|
||||
./$(DEPDIR)/vector_adapter_ex1.Po
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(file_adapter_ex2_SOURCES) $(small_set_ex4_SOURCES) \
|
||||
$(struct_vector_adapter_ex3_SOURCES) \
|
||||
$(vector_adapter_ex1_SOURCES)
|
||||
DIST_SOURCES = $(file_adapter_ex2_SOURCES) $(small_set_ex4_SOURCES) \
|
||||
$(struct_vector_adapter_ex3_SOURCES) \
|
||||
$(vector_adapter_ex1_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHECK_CFLAGS = @CHECK_CFLAGS@
|
||||
CHECK_LIBS = @CHECK_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXMPH = @CXXMPH@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CPPFLAGS = -I../src/
|
||||
vector_adapter_ex1_LDADD = ../src/libcmph.la
|
||||
vector_adapter_ex1_SOURCES = vector_adapter_ex1.c
|
||||
file_adapter_ex2_LDADD = ../src/libcmph.la
|
||||
file_adapter_ex2_SOURCES = file_adapter_ex2.c
|
||||
struct_vector_adapter_ex3_LDADD = ../src/libcmph.la
|
||||
struct_vector_adapter_ex3_SOURCES = struct_vector_adapter_ex3.c
|
||||
small_set_ex4_LDADD = ../src/libcmph.la
|
||||
small_set_ex4_SOURCES = small_set_ex4.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
file_adapter_ex2$(EXEEXT): $(file_adapter_ex2_OBJECTS) $(file_adapter_ex2_DEPENDENCIES) $(EXTRA_file_adapter_ex2_DEPENDENCIES)
|
||||
@rm -f file_adapter_ex2$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(file_adapter_ex2_OBJECTS) $(file_adapter_ex2_LDADD) $(LIBS)
|
||||
|
||||
small_set_ex4$(EXEEXT): $(small_set_ex4_OBJECTS) $(small_set_ex4_DEPENDENCIES) $(EXTRA_small_set_ex4_DEPENDENCIES)
|
||||
@rm -f small_set_ex4$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(small_set_ex4_OBJECTS) $(small_set_ex4_LDADD) $(LIBS)
|
||||
|
||||
struct_vector_adapter_ex3$(EXEEXT): $(struct_vector_adapter_ex3_OBJECTS) $(struct_vector_adapter_ex3_DEPENDENCIES) $(EXTRA_struct_vector_adapter_ex3_DEPENDENCIES)
|
||||
@rm -f struct_vector_adapter_ex3$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(struct_vector_adapter_ex3_OBJECTS) $(struct_vector_adapter_ex3_LDADD) $(LIBS)
|
||||
|
||||
vector_adapter_ex1$(EXEEXT): $(vector_adapter_ex1_OBJECTS) $(vector_adapter_ex1_DEPENDENCIES) $(EXTRA_vector_adapter_ex1_DEPENDENCIES)
|
||||
@rm -f vector_adapter_ex1$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(vector_adapter_ex1_OBJECTS) $(vector_adapter_ex1_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_adapter_ex2.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/small_set_ex4.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/struct_vector_adapter_ex3.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_adapter_ex1.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/file_adapter_ex2.Po
|
||||
-rm -f ./$(DEPDIR)/small_set_ex4.Po
|
||||
-rm -f ./$(DEPDIR)/struct_vector_adapter_ex3.Po
|
||||
-rm -f ./$(DEPDIR)/vector_adapter_ex1.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/file_adapter_ex2.Po
|
||||
-rm -f ./$(DEPDIR)/small_set_ex4.Po
|
||||
-rm -f ./$(DEPDIR)/struct_vector_adapter_ex3.Po
|
||||
-rm -f ./$(DEPDIR)/vector_adapter_ex1.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
32
cmph-2.0.2/examples/file_adapter_ex2.c
Normal file
32
cmph-2.0.2/examples/file_adapter_ex2.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <cmph.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
// Create minimal perfect hash function from in-disk keys using BDZ algorithm
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//Open file with newline separated list of keys
|
||||
FILE * keys_fd = fopen("keys.txt", "r");
|
||||
cmph_t *hash = NULL;
|
||||
if (keys_fd == NULL)
|
||||
{
|
||||
fprintf(stderr, "File \"keys.txt\" not found\n");
|
||||
exit(1);
|
||||
}
|
||||
// Source of keys
|
||||
cmph_io_adapter_t *source = cmph_io_nlfile_adapter(keys_fd);
|
||||
|
||||
cmph_config_t *config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, CMPH_BDZ);
|
||||
hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
|
||||
//Find key
|
||||
const char *key = "jjjjjjjjjj";
|
||||
unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
|
||||
fprintf(stderr, "Id:%u\n", id);
|
||||
//Destroy hash
|
||||
cmph_destroy(hash);
|
||||
cmph_io_nlfile_adapter_destroy(source);
|
||||
fclose(keys_fd);
|
||||
return 0;
|
||||
}
|
105
cmph-2.0.2/examples/small_set_ex4.c
Normal file
105
cmph-2.0.2/examples/small_set_ex4.c
Normal file
@ -0,0 +1,105 @@
|
||||
#include <cmph.h>
|
||||
|
||||
int test(cmph_uint32* items_to_hash, cmph_uint32 items_len, CMPH_ALGO alg_n)
|
||||
{
|
||||
cmph_t *hash;
|
||||
cmph_config_t *config;
|
||||
cmph_io_adapter_t *source;
|
||||
cmph_uint32 i;
|
||||
char filename[256];
|
||||
FILE* mphf_fd = NULL;
|
||||
|
||||
printf("%s (%u)\n", cmph_names[alg_n], alg_n);
|
||||
|
||||
source = cmph_io_struct_vector_adapter(items_to_hash,
|
||||
(cmph_uint32)sizeof(cmph_uint32),
|
||||
0,
|
||||
(cmph_uint32)sizeof(cmph_uint32),
|
||||
items_len);
|
||||
config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, alg_n);
|
||||
if (alg_n == CMPH_BRZ) {
|
||||
sprintf(filename, "%s_%u.mph", cmph_names[alg_n], items_len);
|
||||
mphf_fd = fopen(filename, "w");
|
||||
cmph_config_set_mphf_fd(config, mphf_fd);
|
||||
}
|
||||
hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
|
||||
if (alg_n == CMPH_BRZ) {
|
||||
cmph_dump(hash, mphf_fd);
|
||||
cmph_destroy(hash);
|
||||
fclose(mphf_fd);
|
||||
mphf_fd = fopen(filename, "r");
|
||||
hash = cmph_load(mphf_fd);
|
||||
}
|
||||
printf("packed_size %u\n",cmph_packed_size(hash));
|
||||
|
||||
for (i=0; i<items_len; ++i)
|
||||
printf("%d -> %u\n",
|
||||
items_to_hash[i],
|
||||
cmph_search(hash,
|
||||
(char*)(items_to_hash+i),
|
||||
(cmph_uint32)sizeof(cmph_uint32)));
|
||||
printf("\n");
|
||||
|
||||
cmph_io_vector_adapter_destroy(source);
|
||||
cmph_destroy(hash);
|
||||
|
||||
if (alg_n == CMPH_BRZ) {
|
||||
fclose(mphf_fd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
cmph_uint32 vec1[] = {1,2,3,4,5};
|
||||
cmph_uint32 vec1_len = 5;
|
||||
|
||||
cmph_uint32 vec2[] = {7576423, 7554496}; //CMPH_FCH, CMPH_BDZ, CMPH_BDZ_PH (4,5,6)
|
||||
cmph_uint32 vec2_len = 2;
|
||||
cmph_uint32 vec3[] = {2184764, 1882984, 1170551}; // CMPH_CHD_PH, CMPH_CHD (7,8)
|
||||
cmph_uint32 vec3_len = 3;
|
||||
cmph_uint32 vec4[] = {2184764}; // CMPH_CHD_PH, CMPH_CHD (7,8)
|
||||
cmph_uint32 vec4_len = 1;
|
||||
cmph_uint32 i;
|
||||
|
||||
// Testing with vec1
|
||||
cmph_uint32* values = (cmph_uint32*)vec1;
|
||||
cmph_uint32 length = vec1_len;
|
||||
printf("TESTING VECTOR WITH %u INTEGERS\n", length);
|
||||
for (i = 0; i < CMPH_COUNT; i++)
|
||||
{
|
||||
test(values, length, i);
|
||||
}
|
||||
|
||||
// Testing with vec2
|
||||
values = (cmph_uint32*)vec2;
|
||||
length = vec2_len;
|
||||
printf("TESTING VECTOR WITH %u INTEGERS\n", length);
|
||||
for (i = 0; i < CMPH_COUNT; i++)
|
||||
{
|
||||
test(values, length, i);
|
||||
}
|
||||
|
||||
// Testing with vec3
|
||||
values = (cmph_uint32*)vec3;
|
||||
length = vec3_len;
|
||||
printf("TESTING VECTOR WITH %u INTEGERS\n", length);
|
||||
for (i = 0; i < CMPH_COUNT; i++)
|
||||
{
|
||||
test(values, length, i);
|
||||
}
|
||||
|
||||
// Testing with vec4
|
||||
values = (cmph_uint32*)vec4;
|
||||
length = vec4_len;
|
||||
printf("TESTING VECTOR WITH %u INTEGERS\n", length);
|
||||
for (i = 0; i < CMPH_COUNT; i++)
|
||||
{
|
||||
test(values, length, i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
51
cmph-2.0.2/examples/struct_vector_adapter_ex3.c
Normal file
51
cmph-2.0.2/examples/struct_vector_adapter_ex3.c
Normal file
@ -0,0 +1,51 @@
|
||||
#include <cmph.h>
|
||||
#include <string.h>
|
||||
// Create minimal perfect hash function from in-memory vector
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
cmph_uint32 id;
|
||||
char key[11];
|
||||
cmph_uint32 year;
|
||||
} rec_t;
|
||||
#pragma pack(0)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Creating a filled vector
|
||||
unsigned int i = 0;
|
||||
rec_t vector[10] = {{1, "aaaaaaaaaa", 1999}, {2, "bbbbbbbbbb", 2000}, {3, "cccccccccc", 2001},
|
||||
{4, "dddddddddd", 2002}, {5, "eeeeeeeeee", 2003}, {6, "ffffffffff", 2004},
|
||||
{7, "gggggggggg", 2005}, {8, "hhhhhhhhhh", 2006}, {9, "iiiiiiiiii", 2007},
|
||||
{10,"jjjjjjjjjj", 2008}};
|
||||
unsigned int nkeys = 10;
|
||||
FILE* mphf_fd = fopen("temp_struct_vector.mph", "wb");
|
||||
// Source of keys
|
||||
cmph_io_adapter_t *source = cmph_io_struct_vector_adapter(vector, (cmph_uint32)sizeof(rec_t), (cmph_uint32)sizeof(cmph_uint32), 11, nkeys);
|
||||
|
||||
//Create minimal perfect hash function using the BDZ algorithm.
|
||||
cmph_config_t *config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, CMPH_BDZ);
|
||||
cmph_config_set_mphf_fd(config, mphf_fd);
|
||||
cmph_t *hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
cmph_dump(hash, mphf_fd);
|
||||
cmph_destroy(hash);
|
||||
fclose(mphf_fd);
|
||||
|
||||
//Find key
|
||||
mphf_fd = fopen("temp_struct_vector.mph", "rb");
|
||||
hash = cmph_load(mphf_fd);
|
||||
while (i < nkeys) {
|
||||
const char *key = vector[i].key;
|
||||
unsigned int id = cmph_search(hash, key, 11);
|
||||
fprintf(stderr, "key:%s -- hash:%u\n", key, id);
|
||||
i++;
|
||||
}
|
||||
|
||||
//Destroy hash
|
||||
cmph_destroy(hash);
|
||||
cmph_io_vector_adapter_destroy(source);
|
||||
fclose(mphf_fd);
|
||||
return 0;
|
||||
}
|
41
cmph-2.0.2/examples/vector_adapter_ex1.c
Executable file
41
cmph-2.0.2/examples/vector_adapter_ex1.c
Executable file
@ -0,0 +1,41 @@
|
||||
#include <cmph.h>
|
||||
#include <string.h>
|
||||
// Create minimal perfect hash function from in-memory vector
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
// Creating a filled vector
|
||||
unsigned int i = 0;
|
||||
const char *vector[] = {"aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc", "dddddddddd", "eeeeeeeeee",
|
||||
"ffffffffff", "gggggggggg", "hhhhhhhhhh", "iiiiiiiiii", "jjjjjjjjjj"};
|
||||
unsigned int nkeys = 10;
|
||||
FILE* mphf_fd = fopen("temp.mph", "wb");
|
||||
// Source of keys
|
||||
cmph_io_adapter_t *source = cmph_io_vector_adapter((char **)vector, nkeys);
|
||||
|
||||
//Create minimal perfect hash function using the brz algorithm.
|
||||
cmph_config_t *config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, CMPH_BRZ);
|
||||
cmph_config_set_mphf_fd(config, mphf_fd);
|
||||
cmph_t *hash = cmph_new(config);
|
||||
cmph_config_destroy(config);
|
||||
cmph_dump(hash, mphf_fd);
|
||||
cmph_destroy(hash);
|
||||
fclose(mphf_fd);
|
||||
|
||||
//Find key
|
||||
mphf_fd = fopen("temp.mph", "rb");
|
||||
hash = cmph_load(mphf_fd);
|
||||
while (i < nkeys) {
|
||||
const char *key = vector[i];
|
||||
unsigned int id = cmph_search(hash, key, (cmph_uint32)strlen(key));
|
||||
fprintf(stderr, "key:%s -- hash:%u\n", key, id);
|
||||
i++;
|
||||
}
|
||||
|
||||
//Destroy hash
|
||||
cmph_destroy(hash);
|
||||
cmph_io_vector_adapter_destroy(source);
|
||||
fclose(mphf_fd);
|
||||
return 0;
|
||||
}
|
518
cmph-2.0.2/install-sh
Executable file
518
cmph-2.0.2/install-sh
Executable file
@ -0,0 +1,518 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
11147
cmph-2.0.2/ltmain.sh
Normal file
11147
cmph-2.0.2/ltmain.sh
Normal file
File diff suppressed because it is too large
Load Diff
BIN
cmph-2.0.2/m4/._ltoptions.m4
Normal file
BIN
cmph-2.0.2/m4/._ltoptions.m4
Normal file
Binary file not shown.
BIN
cmph-2.0.2/m4/._ltsugar.m4
Normal file
BIN
cmph-2.0.2/m4/._ltsugar.m4
Normal file
Binary file not shown.
BIN
cmph-2.0.2/m4/._lt~obsolete.m4
Normal file
BIN
cmph-2.0.2/m4/._lt~obsolete.m4
Normal file
Binary file not shown.
15
cmph-2.0.2/m4/acinclude.m4
Normal file
15
cmph-2.0.2/m4/acinclude.m4
Normal file
@ -0,0 +1,15 @@
|
||||
AC_DEFUN([AC_ENABLE_CXXMPH], [AC_ARG_ENABLE([cxxmph],
|
||||
[ --enable-cxxmph enable the c++ cxxmph library ],
|
||||
[case "${enableval}" in
|
||||
yes) cxxmph=true ;;
|
||||
no) cxxmph=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-cxxmph]) ;;
|
||||
esac],[cxxmph=false])])
|
||||
|
||||
AC_DEFUN([AC_ENABLE_BENCHMARKS], [AC_ARG_ENABLE([benchmarks],
|
||||
[ --enable-benchmarks enable cxxmph benchmarks against other libs ],
|
||||
[case "${enableval}" in
|
||||
yes) benchmarks=true ;;
|
||||
no) benchmarks=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-benchmarks]) ;;
|
||||
esac],[benchmarks=false])])
|
101
cmph-2.0.2/m4/cxx0x.m4
Normal file
101
cmph-2.0.2/m4/cxx0x.m4
Normal file
@ -0,0 +1,101 @@
|
||||
dnl Check for baseline language coverage in the compiler for the C++0x standard.
|
||||
# AC_COMPILE_STDCXX_OX
|
||||
AC_DEFUN([AC_COMPILE_STDCXX_0X], [
|
||||
AC_CACHE_CHECK(if compiler supports C++0x features without additional flags,
|
||||
ac_cv_cxx_compile_cxx0x_native,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
],,
|
||||
ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(if compiler supports C++0x features with -std=c++11,
|
||||
ac_cv_cxx_compile_cxx11_cxx,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
AC_TRY_COMPILE([
|
||||
#include <unordered_map>
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;],,
|
||||
ac_cv_cxx_compile_cxx11_cxx=yes, ac_cv_cxx_compile_cxx11_cxx=no)
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
|
||||
|
||||
AC_CACHE_CHECK(if compiler supports C++0x features with -std=c++0x,
|
||||
ac_cv_cxx_compile_cxx0x_cxx,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -std=c++0x"
|
||||
AC_TRY_COMPILE([
|
||||
#include <unordered_map>
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;],,
|
||||
ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(if compiler supports C++0x features with -std=gnu++0x,
|
||||
ac_cv_cxx_compile_cxx0x_gxx,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
|
||||
AC_TRY_COMPILE([
|
||||
#include <unordered_map>
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;],,
|
||||
ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
|
||||
if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
|
||||
test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
|
||||
test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
|
||||
AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
|
||||
fi
|
||||
])
|
113
cmph-2.0.2/m4/largefile.m4
Normal file
113
cmph-2.0.2/m4/largefile.m4
Normal file
@ -0,0 +1,113 @@
|
||||
dnl By default, many hosts won't let programs access large files;
|
||||
dnl one must use special compiler options to get large-file access to work.
|
||||
dnl For more details about this brain damage please see:
|
||||
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
||||
|
||||
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
|
||||
[AC_CACHE_CHECK([for $1 value to request large file support],
|
||||
ac_cv_sys_largefile_$1,
|
||||
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
|
||||
ac_cv_sys_largefile_$1=no
|
||||
ifelse($1, CFLAGS,
|
||||
[case "$host_os" in
|
||||
# IRIX 6.2 and later require cc -n32.
|
||||
changequote(, )dnl
|
||||
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
|
||||
changequote([, ])dnl
|
||||
if test "$GCC" != yes; then
|
||||
ac_cv_sys_largefile_CFLAGS=-n32
|
||||
fi
|
||||
ac_save_CC="$CC"
|
||||
CC="$CC $ac_cv_sys_largefile_CFLAGS"
|
||||
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
|
||||
CC="$ac_save_CC"
|
||||
esac])
|
||||
}])])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
|
||||
[case $2 in
|
||||
no) ;;
|
||||
?*)
|
||||
case "[$]$1" in
|
||||
'') $1=$2 ;;
|
||||
*) $1=[$]$1' '$2 ;;
|
||||
esac ;;
|
||||
esac])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
|
||||
[AC_CACHE_CHECK([for $1], $2,
|
||||
[$2=no
|
||||
changequote(, )dnl
|
||||
$4
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
-D$1)
|
||||
$2=1 ;;
|
||||
-D$1=*)
|
||||
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
|
||||
esac
|
||||
done
|
||||
changequote([, ])dnl
|
||||
])
|
||||
if test "[$]$2" != no; then
|
||||
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
||||
fi])
|
||||
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_ENABLE(largefile,
|
||||
[ --disable-largefile omit support for large files])
|
||||
if test "$enable_largefile" != no; then
|
||||
AC_CHECK_TOOL(GETCONF, getconf)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
|
||||
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
no) ;;
|
||||
-D_FILE_OFFSET_BITS=*) ;;
|
||||
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
|
||||
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
|
||||
-D?* | -I?*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
|
||||
*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
|
||||
esac
|
||||
done
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
||||
ac_cv_sys_file_offset_bits,
|
||||
[Number of bits in a file offset, on hosts where this is settable.])
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_file_offset_bits=64 ;;
|
||||
esac]
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
||||
ac_cv_sys_largefile_source,
|
||||
[Define to make fseeko etc. visible, on some hosts.],
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_largefile_source=1 ;;
|
||||
esac])
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
||||
ac_cv_sys_large_files,
|
||||
[Define for large files, on AIX-style hosts.],
|
||||
[case "$host_os" in
|
||||
# AIX 4.2 and later
|
||||
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
||||
ac_cv_sys_large_files=1 ;;
|
||||
esac])
|
||||
fi
|
||||
])
|
8369
cmph-2.0.2/m4/libtool.m4
vendored
Normal file
8369
cmph-2.0.2/m4/libtool.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
437
cmph-2.0.2/m4/ltoptions.m4
vendored
Normal file
437
cmph-2.0.2/m4/ltoptions.m4
vendored
Normal file
@ -0,0 +1,437 @@
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
||||
[_LT_WITH_AIX_SONAME([aix])])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the 'shared' and
|
||||
# 'disable-shared' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the 'static' and
|
||||
# 'disable-static' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
||||
# and 'disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
||||
if test 64 = "${OBJECT_MODE-32}"; then
|
||||
shared_archive_member_spec=shr_64
|
||||
else
|
||||
shared_archive_member_spec=shr
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
with_aix_soname=aix
|
||||
;;
|
||||
esac
|
||||
|
||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
||||
])# _LT_WITH_AIX_SONAME
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
124
cmph-2.0.2/m4/ltsugar.m4
vendored
Normal file
124
cmph-2.0.2/m4/ltsugar.m4
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59, which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
23
cmph-2.0.2/m4/ltversion.m4
vendored
Normal file
23
cmph-2.0.2/m4/ltversion.m4
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 4179 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.6'
|
||||
macro_revision='2.4.6'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
99
cmph-2.0.2/m4/lt~obsolete.m4
vendored
Normal file
99
cmph-2.0.2/m4/lt~obsolete.m4
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
5
cmph-2.0.2/m4/spoon.m4
Normal file
5
cmph-2.0.2/m4/spoon.m4
Normal file
@ -0,0 +1,5 @@
|
||||
AC_DEFUN([AC_CHECK_SPOON], [
|
||||
AC_ARG_WITH(spoon, [ --with-spoon=SPOON this is inocuous, since the truth is that there is no spoon ])
|
||||
AC_MSG_CHECKING(if there is spoon)
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
2
cmph-2.0.2/man/Makefile.am
Normal file
2
cmph-2.0.2/man/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
||||
man_MANS = cmph.1
|
||||
EXTRA_DIST=cmph.1
|
531
cmph-2.0.2/man/Makefile.in
Normal file
531
cmph-2.0.2/man/Makefile.in
Normal file
@ -0,0 +1,531 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = man
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
|
||||
$(top_srcdir)/m4/cxx0x.m4 $(top_srcdir)/m4/largefile.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/spoon.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)"
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHECK_CFLAGS = @CHECK_CFLAGS@
|
||||
CHECK_LIBS = @CHECK_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXMPH = @CXXMPH@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
man_MANS = cmph.1
|
||||
EXTRA_DIST = cmph.1
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu man/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man1: $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(man_MANS)'; \
|
||||
test -n "$(man1dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.1[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man1
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
cscopelist-am ctags-am distclean distclean-generic \
|
||||
distclean-libtool distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man1 install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags-am uninstall uninstall-am uninstall-man \
|
||||
uninstall-man1
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
67
cmph-2.0.2/man/cmph.1
Normal file
67
cmph-2.0.2/man/cmph.1
Normal file
@ -0,0 +1,67 @@
|
||||
.TH CMPH "1" "October 2007" "cmph 0.6" "User Commands"
|
||||
.SH NAME
|
||||
cmph \- minimum perfect hashing tool
|
||||
.SH SYNOPSIS
|
||||
.B cmph
|
||||
[\-v] [\-h] [\-V] [\-k nkeys] [\-f hash_function] [\-g [\-c value][\-s seed] ] [\-a algorithm] [\-M memory_in_MB] [\-b BRZ_parameter] [\-d tmp_dir] [\-m file.mph] keysfile
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Command line tool to generate and query minimal perfect hash functions.
|
||||
.PP
|
||||
Please refer to http://cmph.sf.net for full documentation.
|
||||
.TP
|
||||
\fB\-h\fR
|
||||
Print an help message
|
||||
.TP
|
||||
\fB\-c\fR
|
||||
This value determines: the number of vertices in the graph for the algorithms BMZ and CHM; the number of bits per key required in the FCH algorithm
|
||||
.TP
|
||||
\fB\-a\fR
|
||||
Algorithm. Valid values are: bmz, bmz8, chm, brz, fch
|
||||
.TP
|
||||
\fB\-f\fR
|
||||
hash function (may be used multiple times). valid values are: djb2, fnv, jenkins, sdbm
|
||||
.TP
|
||||
\fB\-V\fR
|
||||
Print version number and exit
|
||||
.TP
|
||||
\fB\-v\fR
|
||||
Increase verbosity (may be used multiple times)
|
||||
.TP
|
||||
\fB\-k\fR
|
||||
Number of keys
|
||||
.TP
|
||||
\fB\-g\fR
|
||||
Generation mode
|
||||
.TP
|
||||
\fB\-s\fR
|
||||
Random seed
|
||||
.TP
|
||||
\fB\-m\fR
|
||||
Minimum perfect hash function file
|
||||
.TP
|
||||
\fB\-M\fR
|
||||
Main memory availability (in MB)
|
||||
.TP
|
||||
\fB\-d\fR
|
||||
Temporary directory used in brz algorithm
|
||||
.TP
|
||||
\fB\-b\fR
|
||||
Parameter of BRZ algorithm to make the maximal number of keys in a bucket lower than 256
|
||||
.TP
|
||||
\fBkeysfile\fR
|
||||
Line separated file with keys
|
||||
.SH EXAMPLE
|
||||
$ # Using the default algorithm (chm) for constructing a mphf
|
||||
.br
|
||||
$ # for keys in file keys_file. Lines in keys_file _must_ be unique.
|
||||
.br
|
||||
$ ./cmph \-v \-g keys_file
|
||||
.br
|
||||
$ # Query id of keys in the file keys_query
|
||||
.br
|
||||
$ ./cmph \-v \-m keys_file.mph keys_query
|
||||
.SH AUTHOR
|
||||
This manual page was written by Enrico Tassi <gareuselesinge@users.sourceforge.net>,
|
||||
for the Debian project (but may be used by others).
|
||||
|
215
cmph-2.0.2/missing
Executable file
215
cmph-2.0.2/missing
Executable file
@ -0,0 +1,215 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
37
cmph-2.0.2/src/Makefile.am
Normal file
37
cmph-2.0.2/src/Makefile.am
Normal file
@ -0,0 +1,37 @@
|
||||
bin_PROGRAMS = cmph
|
||||
noinst_PROGRAMS = bm_numbers
|
||||
lib_LTLIBRARIES = libcmph.la
|
||||
include_HEADERS = cmph.h cmph_types.h cmph_time.h chd_ph.h
|
||||
libcmph_la_SOURCES = hash.h hash.c \
|
||||
jenkins_hash.h jenkins_hash.c \
|
||||
hash_state.h debug.h \
|
||||
vstack.h vstack.c vqueue.h vqueue.c\
|
||||
graph.h graph.c bitbool.h \
|
||||
cmph.h cmph.c cmph_structs.h cmph_structs.c\
|
||||
chm.h chm.c chm_structs.h \
|
||||
bmz.h bmz.c bmz_structs.h \
|
||||
bmz8.h bmz8.c bmz8_structs.h \
|
||||
bdz.h bdz.c bdz_structs.h \
|
||||
bdz_ph.h bdz_ph.c bdz_structs_ph.h \
|
||||
brz.h brz.c brz_structs.h \
|
||||
fch.h fch.c fch_structs.h \
|
||||
fch_buckets.h fch_buckets.c \
|
||||
chd.h chd.c chd_structs.h \
|
||||
chd_ph.h chd_ph.c chd_structs_ph.h \
|
||||
miller_rabin.h miller_rabin.c \
|
||||
buffer_manager.h buffer_manager.c \
|
||||
buffer_entry.h buffer_entry.c\
|
||||
select.h select.c select_lookup_tables.h \
|
||||
compressed_seq.h compressed_seq.c \
|
||||
compressed_rank.h compressed_rank.c \
|
||||
linear_string_map.h linear_string_map.c \
|
||||
cmph_benchmark.h cmph_benchmark.c \
|
||||
cmph_time.h
|
||||
|
||||
libcmph_la_LDFLAGS = -version-info 0:0:0
|
||||
|
||||
cmph_SOURCES = main.c wingetopt.h wingetopt.c
|
||||
cmph_LDADD = libcmph.la
|
||||
|
||||
bm_numbers_SOURCES = bm_numbers.c
|
||||
bm_numbers_LDADD = libcmph.la
|
900
cmph-2.0.2/src/Makefile.in
Normal file
900
cmph-2.0.2/src/Makefile.in
Normal file
@ -0,0 +1,900 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = cmph$(EXEEXT)
|
||||
noinst_PROGRAMS = bm_numbers$(EXEEXT)
|
||||
subdir = src
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
|
||||
$(top_srcdir)/m4/cxx0x.m4 $(top_srcdir)/m4/largefile.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/spoon.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \
|
||||
"$(DESTDIR)$(includedir)"
|
||||
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libcmph_la_LIBADD =
|
||||
am_libcmph_la_OBJECTS = hash.lo jenkins_hash.lo vstack.lo vqueue.lo \
|
||||
graph.lo cmph.lo cmph_structs.lo chm.lo bmz.lo bmz8.lo bdz.lo \
|
||||
bdz_ph.lo brz.lo fch.lo fch_buckets.lo chd.lo chd_ph.lo \
|
||||
miller_rabin.lo buffer_manager.lo buffer_entry.lo select.lo \
|
||||
compressed_seq.lo compressed_rank.lo linear_string_map.lo \
|
||||
cmph_benchmark.lo
|
||||
libcmph_la_OBJECTS = $(am_libcmph_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libcmph_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libcmph_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_bm_numbers_OBJECTS = bm_numbers.$(OBJEXT)
|
||||
bm_numbers_OBJECTS = $(am_bm_numbers_OBJECTS)
|
||||
bm_numbers_DEPENDENCIES = libcmph.la
|
||||
am_cmph_OBJECTS = main.$(OBJEXT) wingetopt.$(OBJEXT)
|
||||
cmph_OBJECTS = $(am_cmph_OBJECTS)
|
||||
cmph_DEPENDENCIES = libcmph.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/bdz.Plo ./$(DEPDIR)/bdz_ph.Plo \
|
||||
./$(DEPDIR)/bm_numbers.Po ./$(DEPDIR)/bmz.Plo \
|
||||
./$(DEPDIR)/bmz8.Plo ./$(DEPDIR)/brz.Plo \
|
||||
./$(DEPDIR)/buffer_entry.Plo ./$(DEPDIR)/buffer_manager.Plo \
|
||||
./$(DEPDIR)/chd.Plo ./$(DEPDIR)/chd_ph.Plo ./$(DEPDIR)/chm.Plo \
|
||||
./$(DEPDIR)/cmph.Plo ./$(DEPDIR)/cmph_benchmark.Plo \
|
||||
./$(DEPDIR)/cmph_structs.Plo ./$(DEPDIR)/compressed_rank.Plo \
|
||||
./$(DEPDIR)/compressed_seq.Plo ./$(DEPDIR)/fch.Plo \
|
||||
./$(DEPDIR)/fch_buckets.Plo ./$(DEPDIR)/graph.Plo \
|
||||
./$(DEPDIR)/hash.Plo ./$(DEPDIR)/jenkins_hash.Plo \
|
||||
./$(DEPDIR)/linear_string_map.Plo ./$(DEPDIR)/main.Po \
|
||||
./$(DEPDIR)/miller_rabin.Plo ./$(DEPDIR)/select.Plo \
|
||||
./$(DEPDIR)/vqueue.Plo ./$(DEPDIR)/vstack.Plo \
|
||||
./$(DEPDIR)/wingetopt.Po
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libcmph_la_SOURCES) $(bm_numbers_SOURCES) $(cmph_SOURCES)
|
||||
DIST_SOURCES = $(libcmph_la_SOURCES) $(bm_numbers_SOURCES) \
|
||||
$(cmph_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
HEADERS = $(include_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHECK_CFLAGS = @CHECK_CFLAGS@
|
||||
CHECK_LIBS = @CHECK_LIBS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXMPH = @CXXMPH@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBM = @LIBM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
lib_LTLIBRARIES = libcmph.la
|
||||
include_HEADERS = cmph.h cmph_types.h cmph_time.h chd_ph.h
|
||||
libcmph_la_SOURCES = hash.h hash.c \
|
||||
jenkins_hash.h jenkins_hash.c \
|
||||
hash_state.h debug.h \
|
||||
vstack.h vstack.c vqueue.h vqueue.c\
|
||||
graph.h graph.c bitbool.h \
|
||||
cmph.h cmph.c cmph_structs.h cmph_structs.c\
|
||||
chm.h chm.c chm_structs.h \
|
||||
bmz.h bmz.c bmz_structs.h \
|
||||
bmz8.h bmz8.c bmz8_structs.h \
|
||||
bdz.h bdz.c bdz_structs.h \
|
||||
bdz_ph.h bdz_ph.c bdz_structs_ph.h \
|
||||
brz.h brz.c brz_structs.h \
|
||||
fch.h fch.c fch_structs.h \
|
||||
fch_buckets.h fch_buckets.c \
|
||||
chd.h chd.c chd_structs.h \
|
||||
chd_ph.h chd_ph.c chd_structs_ph.h \
|
||||
miller_rabin.h miller_rabin.c \
|
||||
buffer_manager.h buffer_manager.c \
|
||||
buffer_entry.h buffer_entry.c\
|
||||
select.h select.c select_lookup_tables.h \
|
||||
compressed_seq.h compressed_seq.c \
|
||||
compressed_rank.h compressed_rank.c \
|
||||
linear_string_map.h linear_string_map.c \
|
||||
cmph_benchmark.h cmph_benchmark.c \
|
||||
cmph_time.h
|
||||
|
||||
libcmph_la_LDFLAGS = -version-info 0:0:0
|
||||
cmph_SOURCES = main.c wingetopt.h wingetopt.c
|
||||
cmph_LDADD = libcmph.la
|
||||
bm_numbers_SOURCES = bm_numbers.c
|
||||
bm_numbers_LDADD = libcmph.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libcmph.la: $(libcmph_la_OBJECTS) $(libcmph_la_DEPENDENCIES) $(EXTRA_libcmph_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libcmph_la_LINK) -rpath $(libdir) $(libcmph_la_OBJECTS) $(libcmph_la_LIBADD) $(LIBS)
|
||||
|
||||
bm_numbers$(EXEEXT): $(bm_numbers_OBJECTS) $(bm_numbers_DEPENDENCIES) $(EXTRA_bm_numbers_DEPENDENCIES)
|
||||
@rm -f bm_numbers$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(bm_numbers_OBJECTS) $(bm_numbers_LDADD) $(LIBS)
|
||||
|
||||
cmph$(EXEEXT): $(cmph_OBJECTS) $(cmph_DEPENDENCIES) $(EXTRA_cmph_DEPENDENCIES)
|
||||
@rm -f cmph$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(cmph_OBJECTS) $(cmph_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdz.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdz_ph.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bm_numbers.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmz8.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brz.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer_entry.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer_manager.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chd.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chd_ph.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chm.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmph.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmph_benchmark.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmph_structs.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compressed_rank.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compressed_seq.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fch.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fch_buckets.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graph.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jenkins_hash.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear_string_map.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miller_rabin.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vqueue.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstack.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wingetopt.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS)
|
||||
install-binPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool clean-noinstPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/bdz.Plo
|
||||
-rm -f ./$(DEPDIR)/bdz_ph.Plo
|
||||
-rm -f ./$(DEPDIR)/bm_numbers.Po
|
||||
-rm -f ./$(DEPDIR)/bmz.Plo
|
||||
-rm -f ./$(DEPDIR)/bmz8.Plo
|
||||
-rm -f ./$(DEPDIR)/brz.Plo
|
||||
-rm -f ./$(DEPDIR)/buffer_entry.Plo
|
||||
-rm -f ./$(DEPDIR)/buffer_manager.Plo
|
||||
-rm -f ./$(DEPDIR)/chd.Plo
|
||||
-rm -f ./$(DEPDIR)/chd_ph.Plo
|
||||
-rm -f ./$(DEPDIR)/chm.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph_benchmark.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph_structs.Plo
|
||||
-rm -f ./$(DEPDIR)/compressed_rank.Plo
|
||||
-rm -f ./$(DEPDIR)/compressed_seq.Plo
|
||||
-rm -f ./$(DEPDIR)/fch.Plo
|
||||
-rm -f ./$(DEPDIR)/fch_buckets.Plo
|
||||
-rm -f ./$(DEPDIR)/graph.Plo
|
||||
-rm -f ./$(DEPDIR)/hash.Plo
|
||||
-rm -f ./$(DEPDIR)/jenkins_hash.Plo
|
||||
-rm -f ./$(DEPDIR)/linear_string_map.Plo
|
||||
-rm -f ./$(DEPDIR)/main.Po
|
||||
-rm -f ./$(DEPDIR)/miller_rabin.Plo
|
||||
-rm -f ./$(DEPDIR)/select.Plo
|
||||
-rm -f ./$(DEPDIR)/vqueue.Plo
|
||||
-rm -f ./$(DEPDIR)/vstack.Plo
|
||||
-rm -f ./$(DEPDIR)/wingetopt.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/bdz.Plo
|
||||
-rm -f ./$(DEPDIR)/bdz_ph.Plo
|
||||
-rm -f ./$(DEPDIR)/bm_numbers.Po
|
||||
-rm -f ./$(DEPDIR)/bmz.Plo
|
||||
-rm -f ./$(DEPDIR)/bmz8.Plo
|
||||
-rm -f ./$(DEPDIR)/brz.Plo
|
||||
-rm -f ./$(DEPDIR)/buffer_entry.Plo
|
||||
-rm -f ./$(DEPDIR)/buffer_manager.Plo
|
||||
-rm -f ./$(DEPDIR)/chd.Plo
|
||||
-rm -f ./$(DEPDIR)/chd_ph.Plo
|
||||
-rm -f ./$(DEPDIR)/chm.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph_benchmark.Plo
|
||||
-rm -f ./$(DEPDIR)/cmph_structs.Plo
|
||||
-rm -f ./$(DEPDIR)/compressed_rank.Plo
|
||||
-rm -f ./$(DEPDIR)/compressed_seq.Plo
|
||||
-rm -f ./$(DEPDIR)/fch.Plo
|
||||
-rm -f ./$(DEPDIR)/fch_buckets.Plo
|
||||
-rm -f ./$(DEPDIR)/graph.Plo
|
||||
-rm -f ./$(DEPDIR)/hash.Plo
|
||||
-rm -f ./$(DEPDIR)/jenkins_hash.Plo
|
||||
-rm -f ./$(DEPDIR)/linear_string_map.Plo
|
||||
-rm -f ./$(DEPDIR)/main.Po
|
||||
-rm -f ./$(DEPDIR)/miller_rabin.Plo
|
||||
-rm -f ./$(DEPDIR)/select.Plo
|
||||
-rm -f ./$(DEPDIR)/vqueue.Plo
|
||||
-rm -f ./$(DEPDIR)/vstack.Plo
|
||||
-rm -f ./$(DEPDIR)/wingetopt.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
|
||||
uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
|
||||
ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-includeHEADERS install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
706
cmph-2.0.2/src/bdz.c
Executable file
706
cmph-2.0.2/src/bdz.c
Executable file
@ -0,0 +1,706 @@
|
||||
#include "bdz.h"
|
||||
#include "cmph_structs.h"
|
||||
#include "bdz_structs.h"
|
||||
#include "hash.h"
|
||||
#include "bitbool.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
// #define DEBUG
|
||||
#include "debug.h"
|
||||
#define UNASSIGNED 3U
|
||||
#define NULL_EDGE 0xffffffff
|
||||
|
||||
//cmph_uint32 ngrafos = 0;
|
||||
//cmph_uint32 ngrafos_aciclicos = 0;
|
||||
// table used for looking up the number of assigned vertices a 8-bit integer
|
||||
const cmph_uint8 bdz_lookup_table[] =
|
||||
{
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 3, 3, 3, 3, 2,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 1,
|
||||
2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmph_uint32 vertices[3];
|
||||
cmph_uint32 next_edges[3];
|
||||
}bdz_edge_t;
|
||||
|
||||
typedef cmph_uint32 * bdz_queue_t;
|
||||
|
||||
static void bdz_alloc_queue(bdz_queue_t * queuep, cmph_uint32 nedges)
|
||||
{
|
||||
(*queuep)=(cmph_uint32 *)malloc(nedges*sizeof(cmph_uint32));
|
||||
};
|
||||
static void bdz_free_queue(bdz_queue_t * queue)
|
||||
{
|
||||
free(*queue);
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmph_uint32 nedges;
|
||||
bdz_edge_t * edges;
|
||||
cmph_uint32 * first_edge;
|
||||
cmph_uint8 * vert_degree;
|
||||
}bdz_graph3_t;
|
||||
|
||||
|
||||
static void bdz_alloc_graph3(bdz_graph3_t * graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
graph3->edges=(bdz_edge_t *)malloc(nedges*sizeof(bdz_edge_t));
|
||||
graph3->first_edge=(cmph_uint32 *)malloc(nvertices*sizeof(cmph_uint32));
|
||||
graph3->vert_degree=(cmph_uint8 *)malloc((size_t)nvertices);
|
||||
};
|
||||
static void bdz_init_graph3(bdz_graph3_t * graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
memset(graph3->first_edge,0xff,nvertices*sizeof(cmph_uint32));
|
||||
memset(graph3->vert_degree,0,(size_t)nvertices);
|
||||
graph3->nedges=0;
|
||||
};
|
||||
static void bdz_free_graph3(bdz_graph3_t *graph3)
|
||||
{
|
||||
free(graph3->edges);
|
||||
free(graph3->first_edge);
|
||||
free(graph3->vert_degree);
|
||||
};
|
||||
|
||||
static void bdz_partial_free_graph3(bdz_graph3_t *graph3)
|
||||
{
|
||||
free(graph3->first_edge);
|
||||
free(graph3->vert_degree);
|
||||
graph3->first_edge = NULL;
|
||||
graph3->vert_degree = NULL;
|
||||
};
|
||||
|
||||
static void bdz_add_edge(bdz_graph3_t * graph3, cmph_uint32 v0, cmph_uint32 v1, cmph_uint32 v2)
|
||||
{
|
||||
graph3->edges[graph3->nedges].vertices[0]=v0;
|
||||
graph3->edges[graph3->nedges].vertices[1]=v1;
|
||||
graph3->edges[graph3->nedges].vertices[2]=v2;
|
||||
graph3->edges[graph3->nedges].next_edges[0]=graph3->first_edge[v0];
|
||||
graph3->edges[graph3->nedges].next_edges[1]=graph3->first_edge[v1];
|
||||
graph3->edges[graph3->nedges].next_edges[2]=graph3->first_edge[v2];
|
||||
graph3->first_edge[v0]=graph3->first_edge[v1]=graph3->first_edge[v2]=graph3->nedges;
|
||||
graph3->vert_degree[v0]++;
|
||||
graph3->vert_degree[v1]++;
|
||||
graph3->vert_degree[v2]++;
|
||||
graph3->nedges++;
|
||||
};
|
||||
|
||||
static void bdz_dump_graph(bdz_graph3_t* graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
cmph_uint32 i;
|
||||
for(i=0;i<nedges;i++){
|
||||
printf("\nedge %d %d %d %d ",i,graph3->edges[i].vertices[0],
|
||||
graph3->edges[i].vertices[1],graph3->edges[i].vertices[2]);
|
||||
printf(" nexts %d %d %d",graph3->edges[i].next_edges[0],
|
||||
graph3->edges[i].next_edges[1],graph3->edges[i].next_edges[2]);
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
for(i=0;i<nvertices;i++){
|
||||
printf("\nfirst for vertice %d %d ",i,graph3->first_edge[i]);
|
||||
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
static void bdz_remove_edge(bdz_graph3_t * graph3, cmph_uint32 curr_edge)
|
||||
{
|
||||
cmph_uint32 i,j=0,vert,edge1,edge2;
|
||||
for(i=0;i<3;i++){
|
||||
vert=graph3->edges[curr_edge].vertices[i];
|
||||
edge1=graph3->first_edge[vert];
|
||||
edge2=NULL_EDGE;
|
||||
while(edge1!=curr_edge&&edge1!=NULL_EDGE){
|
||||
edge2=edge1;
|
||||
if(graph3->edges[edge1].vertices[0]==vert){
|
||||
j=0;
|
||||
} else if(graph3->edges[edge1].vertices[1]==vert){
|
||||
j=1;
|
||||
} else
|
||||
j=2;
|
||||
edge1=graph3->edges[edge1].next_edges[j];
|
||||
};
|
||||
if(edge1==NULL_EDGE){
|
||||
printf("\nerror remove edge %d dump graph",curr_edge);
|
||||
bdz_dump_graph(graph3,graph3->nedges,graph3->nedges+graph3->nedges/4);
|
||||
exit(-1);
|
||||
};
|
||||
|
||||
if(edge2!=NULL_EDGE){
|
||||
graph3->edges[edge2].next_edges[j] =
|
||||
graph3->edges[edge1].next_edges[i];
|
||||
} else
|
||||
graph3->first_edge[vert]=
|
||||
graph3->edges[edge1].next_edges[i];
|
||||
graph3->vert_degree[vert]--;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
static int bdz_generate_queue(cmph_uint32 nedges, cmph_uint32 nvertices, bdz_queue_t queue, bdz_graph3_t* graph3)
|
||||
{
|
||||
cmph_uint32 i,v0,v1,v2;
|
||||
cmph_uint32 queue_head=0,queue_tail=0;
|
||||
cmph_uint32 curr_edge;
|
||||
cmph_uint32 tmp_edge;
|
||||
cmph_uint8 * marked_edge = (cmph_uint8 *)malloc((size_t)(nedges >> 3) + 1);
|
||||
memset(marked_edge, 0, (size_t)(nedges >> 3) + 1);
|
||||
|
||||
for(i=0;i<nedges;i++){
|
||||
v0=graph3->edges[i].vertices[0];
|
||||
v1=graph3->edges[i].vertices[1];
|
||||
v2=graph3->edges[i].vertices[2];
|
||||
if(graph3->vert_degree[v0]==1 ||
|
||||
graph3->vert_degree[v1]==1 ||
|
||||
graph3->vert_degree[v2]==1){
|
||||
if(!GETBIT(marked_edge,i)) {
|
||||
queue[queue_head++]=i;
|
||||
SETBIT(marked_edge,i);
|
||||
}
|
||||
};
|
||||
};
|
||||
DEBUGP("Queue head %d Queue tail %d\n", queue_head, queue_tail);
|
||||
#ifdef DEBUG
|
||||
bdz_dump_graph(graph3,graph3->nedges,graph3->nedges+graph3->nedges/4);
|
||||
#endif
|
||||
while(queue_tail!=queue_head){
|
||||
curr_edge=queue[queue_tail++];
|
||||
bdz_remove_edge(graph3,curr_edge);
|
||||
DEBUGP("Removing edge %d\n", curr_edge);
|
||||
v0=graph3->edges[curr_edge].vertices[0];
|
||||
v1=graph3->edges[curr_edge].vertices[1];
|
||||
v2=graph3->edges[curr_edge].vertices[2];
|
||||
if(graph3->vert_degree[v0]==1 ) {
|
||||
tmp_edge=graph3->first_edge[v0];
|
||||
if(!GETBIT(marked_edge,tmp_edge)) {
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
|
||||
};
|
||||
if(graph3->vert_degree[v1]==1) {
|
||||
tmp_edge=graph3->first_edge[v1];
|
||||
if(!GETBIT(marked_edge,tmp_edge)){
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
|
||||
};
|
||||
if(graph3->vert_degree[v2]==1){
|
||||
tmp_edge=graph3->first_edge[v2];
|
||||
if(!GETBIT(marked_edge,tmp_edge)){
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
};
|
||||
};
|
||||
free(marked_edge);
|
||||
return (int)(queue_head-nedges);/* returns 0 if successful otherwies return negative number*/
|
||||
};
|
||||
|
||||
static int bdz_mapping(cmph_config_t *mph, bdz_graph3_t* graph3, bdz_queue_t queue);
|
||||
static void assigning(bdz_config_data_t *bdz, bdz_graph3_t* graph3, bdz_queue_t queue);
|
||||
static void ranking(bdz_config_data_t *bdz);
|
||||
static cmph_uint32 rank(cmph_uint32 b, cmph_uint32 * ranktable, cmph_uint8 * g, cmph_uint32 vertex);
|
||||
|
||||
bdz_config_data_t *bdz_config_new(void)
|
||||
{
|
||||
bdz_config_data_t *bdz;
|
||||
bdz = (bdz_config_data_t *)malloc(sizeof(bdz_config_data_t));
|
||||
if (!bdz) return NULL;
|
||||
memset(bdz, 0, sizeof(bdz_config_data_t));
|
||||
bdz->hashfunc = CMPH_HASH_JENKINS;
|
||||
bdz->g = NULL;
|
||||
bdz->hl = NULL;
|
||||
bdz->k = 0; //kth index in ranktable, $k = log_2(n=3r)/\varepsilon$
|
||||
bdz->b = 7; // number of bits of k
|
||||
bdz->ranktablesize = 0; //number of entries in ranktable, $n/k +1$
|
||||
bdz->ranktable = NULL; // rank table
|
||||
return bdz;
|
||||
}
|
||||
|
||||
void bdz_config_destroy(cmph_config_t *mph)
|
||||
{
|
||||
bdz_config_data_t *data = (bdz_config_data_t *)mph->data;
|
||||
DEBUGP("Destroying algorithm dependent data\n");
|
||||
free(data);
|
||||
}
|
||||
|
||||
void bdz_config_set_b(cmph_config_t *mph, cmph_uint32 b)
|
||||
{
|
||||
bdz_config_data_t *bdz = (bdz_config_data_t *)mph->data;
|
||||
if (b <= 2 || b > 10) b = 7; // validating restrictions over parameter b.
|
||||
bdz->b = (cmph_uint8)b;
|
||||
DEBUGP("b: %u\n", b);
|
||||
|
||||
}
|
||||
|
||||
void bdz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
|
||||
{
|
||||
bdz_config_data_t *bdz = (bdz_config_data_t *)mph->data;
|
||||
CMPH_HASH *hashptr = hashfuncs;
|
||||
cmph_uint32 i = 0;
|
||||
while(*hashptr != CMPH_HASH_COUNT)
|
||||
{
|
||||
if (i >= 1) break; //bdz only uses one linear hash function
|
||||
bdz->hashfunc = *hashptr;
|
||||
++i, ++hashptr;
|
||||
}
|
||||
}
|
||||
|
||||
cmph_t *bdz_new(cmph_config_t *mph, double c)
|
||||
{
|
||||
cmph_t *mphf = NULL;
|
||||
bdz_data_t *bdzf = NULL;
|
||||
cmph_uint32 iterations;
|
||||
bdz_queue_t edges;
|
||||
bdz_graph3_t graph3;
|
||||
bdz_config_data_t *bdz = (bdz_config_data_t *)mph->data;
|
||||
#ifdef CMPH_TIMING
|
||||
double construction_time_begin = 0.0;
|
||||
double construction_time = 0.0;
|
||||
ELAPSED_TIME_IN_SECONDS(&construction_time_begin);
|
||||
#endif
|
||||
|
||||
|
||||
if (c == 0) c = 1.23; // validating restrictions over parameter c.
|
||||
DEBUGP("c: %f\n", c);
|
||||
bdz->m = mph->key_source->nkeys;
|
||||
bdz->r = (cmph_uint32)ceil((c * mph->key_source->nkeys)/3);
|
||||
if ((bdz->r % 2) == 0) bdz->r+=1;
|
||||
|
||||
if (bdz->r == 1) { // workaround for small key sets
|
||||
bdz->r = 3;
|
||||
}
|
||||
|
||||
bdz->n = 3*bdz->r;
|
||||
|
||||
bdz->k = (1U << bdz->b);
|
||||
DEBUGP("b: %u -- k: %u\n", bdz->b, bdz->k);
|
||||
|
||||
bdz->ranktablesize = (cmph_uint32)ceil(bdz->n/(double)bdz->k);
|
||||
DEBUGP("ranktablesize: %u\n", bdz->ranktablesize);
|
||||
|
||||
|
||||
bdz_alloc_graph3(&graph3, bdz->m, bdz->n);
|
||||
bdz_alloc_queue(&edges,bdz->m);
|
||||
DEBUGP("Created hypergraph\n");
|
||||
|
||||
DEBUGP("m (edges): %u n (vertices): %u r: %u c: %f \n", bdz->m, bdz->n, bdz->r, c);
|
||||
|
||||
// Mapping step
|
||||
iterations = 1000;
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering mapping step for mph creation of %u keys with graph sized %u\n", bdz->m, bdz->n);
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
int ok;
|
||||
DEBUGP("linear hash function \n");
|
||||
bdz->hl = hash_state_new(bdz->hashfunc, 15);
|
||||
|
||||
ok = bdz_mapping(mph, &graph3, edges);
|
||||
//ok = 0;
|
||||
if (!ok)
|
||||
{
|
||||
--iterations;
|
||||
hash_state_destroy(bdz->hl);
|
||||
bdz->hl = NULL;
|
||||
DEBUGP("%u iterations remaining\n", iterations);
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "acyclic graph creation failure - %u iterations remaining\n", iterations);
|
||||
}
|
||||
if (iterations == 0) break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
if (iterations == 0)
|
||||
{
|
||||
bdz_free_queue(&edges);
|
||||
bdz_free_graph3(&graph3);
|
||||
return NULL;
|
||||
}
|
||||
bdz_partial_free_graph3(&graph3);
|
||||
// Assigning step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering assigning step for mph creation of %u keys with graph sized %u\n", bdz->m, bdz->n);
|
||||
}
|
||||
assigning(bdz, &graph3, edges);
|
||||
|
||||
bdz_free_queue(&edges);
|
||||
bdz_free_graph3(&graph3);
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering ranking step for mph creation of %u keys with graph sized %u\n", bdz->m, bdz->n);
|
||||
}
|
||||
ranking(bdz);
|
||||
#ifdef CMPH_TIMING
|
||||
ELAPSED_TIME_IN_SECONDS(&construction_time);
|
||||
#endif
|
||||
mphf = (cmph_t *)malloc(sizeof(cmph_t));
|
||||
mphf->algo = mph->algo;
|
||||
bdzf = (bdz_data_t *)malloc(sizeof(bdz_data_t));
|
||||
bdzf->g = bdz->g;
|
||||
bdz->g = NULL; //transfer memory ownership
|
||||
bdzf->hl = bdz->hl;
|
||||
bdz->hl = NULL; //transfer memory ownership
|
||||
bdzf->ranktable = bdz->ranktable;
|
||||
bdz->ranktable = NULL; //transfer memory ownership
|
||||
bdzf->ranktablesize = bdz->ranktablesize;
|
||||
bdzf->k = bdz->k;
|
||||
bdzf->b = bdz->b;
|
||||
bdzf->n = bdz->n;
|
||||
bdzf->m = bdz->m;
|
||||
bdzf->r = bdz->r;
|
||||
mphf->data = bdzf;
|
||||
mphf->size = bdz->m;
|
||||
|
||||
DEBUGP("Successfully generated minimal perfect hash\n");
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Successfully generated minimal perfect hash function\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef CMPH_TIMING
|
||||
register cmph_uint32 space_usage = bdz_packed_size(mphf)*8;
|
||||
register cmph_uint32 keys_per_bucket = 1;
|
||||
construction_time = construction_time - construction_time_begin;
|
||||
fprintf(stdout, "%u\t%.2f\t%u\t%.4f\t%.4f\n", bdz->m, bdz->m/(double)bdz->n, keys_per_bucket, construction_time, space_usage/(double)bdz->m);
|
||||
#endif
|
||||
|
||||
return mphf;
|
||||
}
|
||||
|
||||
|
||||
static int bdz_mapping(cmph_config_t *mph, bdz_graph3_t* graph3, bdz_queue_t queue)
|
||||
{
|
||||
cmph_uint32 e;
|
||||
int cycles = 0;
|
||||
cmph_uint32 hl[3];
|
||||
bdz_config_data_t *bdz = (bdz_config_data_t *)mph->data;
|
||||
bdz_init_graph3(graph3, bdz->m, bdz->n);
|
||||
mph->key_source->rewind(mph->key_source->data);
|
||||
for (e = 0; e < mph->key_source->nkeys; ++e)
|
||||
{
|
||||
cmph_uint32 h0, h1, h2;
|
||||
cmph_uint32 keylen;
|
||||
char *key = NULL;
|
||||
mph->key_source->read(mph->key_source->data, &key, &keylen);
|
||||
hash_vector(bdz->hl, key, keylen,hl);
|
||||
h0 = hl[0] % bdz->r;
|
||||
h1 = hl[1] % bdz->r + bdz->r;
|
||||
h2 = hl[2] % bdz->r + (bdz->r << 1);
|
||||
DEBUGP("Key: %.*s (%u %u %u)\n", keylen, key, h0, h1, h2);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
bdz_add_edge(graph3,h0,h1,h2);
|
||||
}
|
||||
cycles = bdz_generate_queue(bdz->m, bdz->n, queue, graph3);
|
||||
return (cycles == 0);
|
||||
}
|
||||
|
||||
static void assigning(bdz_config_data_t *bdz, bdz_graph3_t* graph3, bdz_queue_t queue)
|
||||
{
|
||||
cmph_uint32 i;
|
||||
cmph_uint32 nedges=graph3->nedges;
|
||||
cmph_uint32 curr_edge;
|
||||
cmph_uint32 v0,v1,v2;
|
||||
cmph_uint8 * marked_vertices = (cmph_uint8 *)malloc((size_t)(bdz->n >> 3) + 1);
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(bdz->n/4.0);
|
||||
bdz->g = (cmph_uint8 *)calloc((size_t)(sizeg), sizeof(cmph_uint8));
|
||||
memset(marked_vertices, 0, (size_t)(bdz->n >> 3) + 1);
|
||||
memset(bdz->g, 0xff, (size_t)(sizeg));
|
||||
|
||||
for(i=nedges-1;i+1>=1;i--){
|
||||
curr_edge=queue[i];
|
||||
v0=graph3->edges[curr_edge].vertices[0];
|
||||
v1=graph3->edges[curr_edge].vertices[1];
|
||||
v2=graph3->edges[curr_edge].vertices[2];
|
||||
DEBUGP("B:%u %u %u -- %u %u %u edge %u\n", v0, v1, v2, GETVALUE(bdz->g, v0), GETVALUE(bdz->g, v1), GETVALUE(bdz->g, v2), curr_edge);
|
||||
if(!GETBIT(marked_vertices, v0)){
|
||||
if(!GETBIT(marked_vertices,v1))
|
||||
{
|
||||
SETVALUE1(bdz->g, v1, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v1);
|
||||
}
|
||||
if(!GETBIT(marked_vertices,v2))
|
||||
{
|
||||
SETVALUE1(bdz->g, v2, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
SETVALUE1(bdz->g, v0, (6-(GETVALUE(bdz->g, v1) + GETVALUE(bdz->g,v2)))%3);
|
||||
SETBIT(marked_vertices, v0);
|
||||
} else if(!GETBIT(marked_vertices, v1)) {
|
||||
if(!GETBIT(marked_vertices, v2))
|
||||
{
|
||||
SETVALUE1(bdz->g, v2, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
SETVALUE1(bdz->g, v1, (7-(GETVALUE(bdz->g, v0)+GETVALUE(bdz->g, v2)))%3);
|
||||
SETBIT(marked_vertices, v1);
|
||||
}else {
|
||||
SETVALUE1(bdz->g, v2, (8-(GETVALUE(bdz->g,v0)+GETVALUE(bdz->g, v1)))%3);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
DEBUGP("A:%u %u %u -- %u %u %u\n", v0, v1, v2, GETVALUE(bdz->g, v0), GETVALUE(bdz->g, v1), GETVALUE(bdz->g, v2));
|
||||
};
|
||||
free(marked_vertices);
|
||||
}
|
||||
|
||||
|
||||
static void ranking(bdz_config_data_t *bdz)
|
||||
{
|
||||
cmph_uint32 i, j, offset = 0U, count = 0U, size = (bdz->k >> 2U), nbytes_total = (cmph_uint32)ceil(bdz->n/4.0), nbytes;
|
||||
bdz->ranktable = (cmph_uint32 *)calloc((size_t)bdz->ranktablesize, sizeof(cmph_uint32));
|
||||
// ranktable computation
|
||||
bdz->ranktable[0] = 0;
|
||||
i = 1;
|
||||
while(1)
|
||||
{
|
||||
if(i == bdz->ranktablesize) break;
|
||||
nbytes = size < nbytes_total? size : nbytes_total;
|
||||
for(j = 0; j < nbytes; j++)
|
||||
{
|
||||
count += bdz_lookup_table[*(bdz->g + offset + j)];
|
||||
}
|
||||
bdz->ranktable[i] = count;
|
||||
offset += nbytes;
|
||||
nbytes_total -= size;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int bdz_dump(cmph_t *mphf, FILE *fd)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
register size_t nbytes;
|
||||
bdz_data_t *data = (bdz_data_t *)mphf->data;
|
||||
__cmph_dump(mphf, fd);
|
||||
|
||||
hash_state_dump(data->hl, &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
nbytes = fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->r), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/4.0);
|
||||
nbytes = fwrite(data->g, sizeof(cmph_uint8)*sizeg, (size_t)1, fd);
|
||||
|
||||
nbytes = fwrite(&(data->k), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->b), sizeof(cmph_uint8), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->ranktablesize), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
|
||||
nbytes = fwrite(data->ranktable, sizeof(cmph_uint32)*(data->ranktablesize), (size_t)1, fd);
|
||||
#ifdef DEBUG
|
||||
cmph_uint32 i;
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", GETVALUE(data->g, i));
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bdz_load(FILE *f, cmph_t *mphf)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen, sizeg;
|
||||
register size_t nbytes;
|
||||
bdz_data_t *bdz = (bdz_data_t *)malloc(sizeof(bdz_data_t));
|
||||
|
||||
DEBUGP("Loading bdz mphf\n");
|
||||
mphf->data = bdz;
|
||||
|
||||
nbytes = fread(&buflen, sizeof(cmph_uint32), (size_t)1, f);
|
||||
DEBUGP("Hash state has %u bytes\n", buflen);
|
||||
buf = (char *)malloc((size_t)buflen);
|
||||
nbytes = fread(buf, (size_t)buflen, (size_t)1, f);
|
||||
bdz->hl = hash_state_load(buf, buflen);
|
||||
free(buf);
|
||||
|
||||
|
||||
DEBUGP("Reading m and n\n");
|
||||
nbytes = fread(&(bdz->n), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bdz->m), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bdz->r), sizeof(cmph_uint32), (size_t)1, f);
|
||||
sizeg = (cmph_uint32)ceil(bdz->n/4.0);
|
||||
bdz->g = (cmph_uint8 *)calloc((size_t)(sizeg), sizeof(cmph_uint8));
|
||||
nbytes = fread(bdz->g, sizeg*sizeof(cmph_uint8), (size_t)1, f);
|
||||
|
||||
nbytes = fread(&(bdz->k), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bdz->b), sizeof(cmph_uint8), (size_t)1, f);
|
||||
nbytes = fread(&(bdz->ranktablesize), sizeof(cmph_uint32), (size_t)1, f);
|
||||
|
||||
bdz->ranktable = (cmph_uint32 *)calloc((size_t)bdz->ranktablesize, sizeof(cmph_uint32));
|
||||
nbytes = fread(bdz->ranktable, sizeof(cmph_uint32)*(bdz->ranktablesize), (size_t)1, f);
|
||||
|
||||
#ifdef DEBUG
|
||||
cmph_uint32 i = 0;
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < bdz->n; ++i) fprintf(stderr, "%u ", GETVALUE(bdz->g,i));
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline cmph_uint32 rank(cmph_uint32 b, cmph_uint32 * ranktable, cmph_uint8 * g, cmph_uint32 vertex)
|
||||
{
|
||||
register cmph_uint32 index = vertex >> b;
|
||||
register cmph_uint32 base_rank = ranktable[index];
|
||||
register cmph_uint32 beg_idx_v = index << b;
|
||||
register cmph_uint32 beg_idx_b = beg_idx_v >> 2;
|
||||
register cmph_uint32 end_idx_b = vertex >> 2;
|
||||
while(beg_idx_b < end_idx_b)
|
||||
{
|
||||
base_rank += bdz_lookup_table[*(g + beg_idx_b++)];
|
||||
|
||||
}
|
||||
DEBUGP("base rank %u\n", base_rank);
|
||||
beg_idx_v = beg_idx_b << 2;
|
||||
DEBUGP("beg_idx_v %u\n", beg_idx_v);
|
||||
while(beg_idx_v < vertex)
|
||||
{
|
||||
if(GETVALUE(g, beg_idx_v) != UNASSIGNED) base_rank++;
|
||||
beg_idx_v++;
|
||||
}
|
||||
|
||||
return base_rank;
|
||||
}
|
||||
|
||||
cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
register cmph_uint32 vertex;
|
||||
register bdz_data_t *bdz = (bdz_data_t *)mphf->data;
|
||||
cmph_uint32 hl[3];
|
||||
hash_vector(bdz->hl, key, keylen, hl);
|
||||
hl[0] = hl[0] % bdz->r;
|
||||
hl[1] = hl[1] % bdz->r + bdz->r;
|
||||
hl[2] = hl[2] % bdz->r + (bdz->r << 1);
|
||||
vertex = hl[(GETVALUE(bdz->g, hl[0]) + GETVALUE(bdz->g, hl[1]) + GETVALUE(bdz->g, hl[2])) % 3];
|
||||
DEBUGP("Search found vertex %u\n", vertex);
|
||||
return rank(bdz->b, bdz->ranktable, bdz->g, vertex);
|
||||
}
|
||||
|
||||
|
||||
void bdz_destroy(cmph_t *mphf)
|
||||
{
|
||||
bdz_data_t *data = (bdz_data_t *)mphf->data;
|
||||
free(data->g);
|
||||
hash_state_destroy(data->hl);
|
||||
free(data->ranktable);
|
||||
free(data);
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bdz_pack(cmph_t *mphf, void *packed_mphf)
|
||||
{
|
||||
bdz_data_t *data = (bdz_data_t *)mphf->data;
|
||||
cmph_uint8 * ptr = (cmph_uint8 *)packed_mphf;
|
||||
|
||||
// packing hl type
|
||||
CMPH_HASH hl_type = hash_get_type(data->hl);
|
||||
*((cmph_uint32 *) ptr) = hl_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing hl
|
||||
hash_state_pack(data->hl, ptr);
|
||||
ptr += hash_state_packed_size(hl_type);
|
||||
|
||||
// packing r
|
||||
*((cmph_uint32 *) ptr) = data->r;
|
||||
ptr += sizeof(data->r);
|
||||
|
||||
// packing ranktablesize
|
||||
*((cmph_uint32 *) ptr) = data->ranktablesize;
|
||||
ptr += sizeof(data->ranktablesize);
|
||||
|
||||
// packing ranktable
|
||||
memcpy(ptr, data->ranktable, sizeof(cmph_uint32)*(data->ranktablesize));
|
||||
ptr += sizeof(cmph_uint32)*(data->ranktablesize);
|
||||
|
||||
// packing b
|
||||
*ptr++ = data->b;
|
||||
|
||||
// packing g
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/4.0);
|
||||
memcpy(ptr, data->g, sizeof(cmph_uint8)*sizeg);
|
||||
}
|
||||
|
||||
/** \fn cmph_uint32 bdz_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bdz_packed_size(cmph_t *mphf)
|
||||
{
|
||||
bdz_data_t *data = (bdz_data_t *)mphf->data;
|
||||
|
||||
CMPH_HASH hl_type = hash_get_type(data->hl);
|
||||
|
||||
return (cmph_uint32)(sizeof(CMPH_ALGO) + hash_state_packed_size(hl_type) + 3*sizeof(cmph_uint32) + sizeof(cmph_uint32)*(data->ranktablesize) + sizeof(cmph_uint8) + sizeof(cmph_uint8)* (cmph_uint32)(ceil(data->n/4.0)));
|
||||
}
|
||||
|
||||
/** cmph_uint32 bdz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bdz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
|
||||
register cmph_uint32 vertex;
|
||||
register CMPH_HASH hl_type = (CMPH_HASH)(*(cmph_uint32 *)packed_mphf);
|
||||
register cmph_uint8 *hl_ptr = (cmph_uint8 *)(packed_mphf) + 4;
|
||||
|
||||
register cmph_uint32 *ranktable = (cmph_uint32*)(hl_ptr + hash_state_packed_size(hl_type));
|
||||
|
||||
register cmph_uint32 r = *ranktable++;
|
||||
register cmph_uint32 ranktablesize = *ranktable++;
|
||||
register cmph_uint8 * g = (cmph_uint8 *)(ranktable + ranktablesize);
|
||||
register cmph_uint8 b = *g++;
|
||||
|
||||
cmph_uint32 hl[3];
|
||||
hash_vector_packed(hl_ptr, hl_type, key, keylen, hl);
|
||||
hl[0] = hl[0] % r;
|
||||
hl[1] = hl[1] % r + r;
|
||||
hl[2] = hl[2] % r + (r << 1);
|
||||
vertex = hl[(GETVALUE(g, hl[0]) + GETVALUE(g, hl[1]) + GETVALUE(g, hl[2])) % 3];
|
||||
return rank(b, ranktable, g, vertex);
|
||||
}
|
43
cmph-2.0.2/src/bdz.h
Executable file
43
cmph-2.0.2/src/bdz.h
Executable file
@ -0,0 +1,43 @@
|
||||
#ifndef __CMPH_BDZ_H__
|
||||
#define __CMPH_BDZ_H__
|
||||
|
||||
#include "cmph.h"
|
||||
|
||||
typedef struct __bdz_data_t bdz_data_t;
|
||||
typedef struct __bdz_config_data_t bdz_config_data_t;
|
||||
|
||||
bdz_config_data_t *bdz_config_new(void);
|
||||
void bdz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
||||
void bdz_config_destroy(cmph_config_t *mph);
|
||||
void bdz_config_set_b(cmph_config_t *mph, cmph_uint32 b);
|
||||
cmph_t *bdz_new(cmph_config_t *mph, double c);
|
||||
|
||||
void bdz_load(FILE *f, cmph_t *mphf);
|
||||
int bdz_dump(cmph_t *mphf, FILE *f);
|
||||
void bdz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bdz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** \fn void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bdz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
|
||||
/** \fn cmph_uint32 bdz_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bdz_packed_size(cmph_t *mphf);
|
||||
|
||||
/** cmph_uint32 bdz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bdz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
#endif
|
626
cmph-2.0.2/src/bdz_ph.c
Executable file
626
cmph-2.0.2/src/bdz_ph.c
Executable file
@ -0,0 +1,626 @@
|
||||
#include "bdz_ph.h"
|
||||
#include "cmph_structs.h"
|
||||
#include "bdz_structs_ph.h"
|
||||
#include "hash.h"
|
||||
#include "bitbool.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
//#define DEBUG
|
||||
#include "debug.h"
|
||||
#define UNASSIGNED 3
|
||||
#define NULL_EDGE 0xffffffff
|
||||
|
||||
|
||||
static cmph_uint8 pow3_table[5] = {1,3,9,27,81};
|
||||
static cmph_uint8 lookup_table[5][256] = {
|
||||
{0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0},
|
||||
{0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1},
|
||||
{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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmph_uint32 vertices[3];
|
||||
cmph_uint32 next_edges[3];
|
||||
}bdz_ph_edge_t;
|
||||
|
||||
typedef cmph_uint32 * bdz_ph_queue_t;
|
||||
|
||||
static void bdz_ph_alloc_queue(bdz_ph_queue_t * queuep, cmph_uint32 nedges)
|
||||
{
|
||||
(*queuep)=(cmph_uint32 *)malloc(nedges*sizeof(cmph_uint32));
|
||||
};
|
||||
static void bdz_ph_free_queue(bdz_ph_queue_t * queue)
|
||||
{
|
||||
free(*queue);
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmph_uint32 nedges;
|
||||
bdz_ph_edge_t * edges;
|
||||
cmph_uint32 * first_edge;
|
||||
cmph_uint8 * vert_degree;
|
||||
}bdz_ph_graph3_t;
|
||||
|
||||
|
||||
static void bdz_ph_alloc_graph3(bdz_ph_graph3_t * graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
graph3->edges=(bdz_ph_edge_t *)malloc(nedges*sizeof(bdz_ph_edge_t));
|
||||
graph3->first_edge=(cmph_uint32 *)malloc(nvertices*sizeof(cmph_uint32));
|
||||
graph3->vert_degree=(cmph_uint8 *)malloc((size_t)nvertices);
|
||||
};
|
||||
static void bdz_ph_init_graph3(bdz_ph_graph3_t * graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
memset(graph3->first_edge,0xff,nvertices*sizeof(cmph_uint32));
|
||||
memset(graph3->vert_degree,0,(size_t)nvertices);
|
||||
graph3->nedges=0;
|
||||
};
|
||||
static void bdz_ph_free_graph3(bdz_ph_graph3_t *graph3)
|
||||
{
|
||||
free(graph3->edges);
|
||||
free(graph3->first_edge);
|
||||
free(graph3->vert_degree);
|
||||
};
|
||||
|
||||
static void bdz_ph_partial_free_graph3(bdz_ph_graph3_t *graph3)
|
||||
{
|
||||
free(graph3->first_edge);
|
||||
free(graph3->vert_degree);
|
||||
graph3->first_edge = NULL;
|
||||
graph3->vert_degree = NULL;
|
||||
};
|
||||
|
||||
static void bdz_ph_add_edge(bdz_ph_graph3_t * graph3, cmph_uint32 v0, cmph_uint32 v1, cmph_uint32 v2)
|
||||
{
|
||||
graph3->edges[graph3->nedges].vertices[0]=v0;
|
||||
graph3->edges[graph3->nedges].vertices[1]=v1;
|
||||
graph3->edges[graph3->nedges].vertices[2]=v2;
|
||||
graph3->edges[graph3->nedges].next_edges[0]=graph3->first_edge[v0];
|
||||
graph3->edges[graph3->nedges].next_edges[1]=graph3->first_edge[v1];
|
||||
graph3->edges[graph3->nedges].next_edges[2]=graph3->first_edge[v2];
|
||||
graph3->first_edge[v0]=graph3->first_edge[v1]=graph3->first_edge[v2]=graph3->nedges;
|
||||
graph3->vert_degree[v0]++;
|
||||
graph3->vert_degree[v1]++;
|
||||
graph3->vert_degree[v2]++;
|
||||
graph3->nedges++;
|
||||
};
|
||||
|
||||
static void bdz_ph_dump_graph(bdz_ph_graph3_t* graph3, cmph_uint32 nedges, cmph_uint32 nvertices)
|
||||
{
|
||||
cmph_uint32 i;
|
||||
for(i=0;i<nedges;i++){
|
||||
printf("\nedge %d %d %d %d ",i,graph3->edges[i].vertices[0],
|
||||
graph3->edges[i].vertices[1],graph3->edges[i].vertices[2]);
|
||||
printf(" nexts %d %d %d",graph3->edges[i].next_edges[0],
|
||||
graph3->edges[i].next_edges[1],graph3->edges[i].next_edges[2]);
|
||||
};
|
||||
|
||||
for(i=0;i<nvertices;i++){
|
||||
printf("\nfirst for vertice %d %d ",i,graph3->first_edge[i]);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
static void bdz_ph_remove_edge(bdz_ph_graph3_t * graph3, cmph_uint32 curr_edge)
|
||||
{
|
||||
cmph_uint32 i,j=0,vert,edge1,edge2;
|
||||
for(i=0;i<3;i++){
|
||||
vert=graph3->edges[curr_edge].vertices[i];
|
||||
edge1=graph3->first_edge[vert];
|
||||
edge2=NULL_EDGE;
|
||||
while(edge1!=curr_edge&&edge1!=NULL_EDGE){
|
||||
edge2=edge1;
|
||||
if(graph3->edges[edge1].vertices[0]==vert){
|
||||
j=0;
|
||||
} else if(graph3->edges[edge1].vertices[1]==vert){
|
||||
j=1;
|
||||
} else
|
||||
j=2;
|
||||
edge1=graph3->edges[edge1].next_edges[j];
|
||||
};
|
||||
if(edge1==NULL_EDGE){
|
||||
printf("\nerror remove edge %d dump graph",curr_edge);
|
||||
bdz_ph_dump_graph(graph3,graph3->nedges,graph3->nedges+graph3->nedges/4);
|
||||
exit(-1);
|
||||
};
|
||||
|
||||
if(edge2!=NULL_EDGE){
|
||||
graph3->edges[edge2].next_edges[j] =
|
||||
graph3->edges[edge1].next_edges[i];
|
||||
} else
|
||||
graph3->first_edge[vert]=
|
||||
graph3->edges[edge1].next_edges[i];
|
||||
graph3->vert_degree[vert]--;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
static int bdz_ph_generate_queue(cmph_uint32 nedges, cmph_uint32 nvertices, bdz_ph_queue_t queue, bdz_ph_graph3_t* graph3)
|
||||
{
|
||||
cmph_uint32 i,v0,v1,v2;
|
||||
cmph_uint32 queue_head=0,queue_tail=0;
|
||||
cmph_uint32 curr_edge;
|
||||
cmph_uint32 tmp_edge;
|
||||
cmph_uint8 * marked_edge =(cmph_uint8 *)malloc((size_t)(nedges >> 3) + 1);
|
||||
memset(marked_edge, 0, (size_t)(nedges >> 3) + 1);
|
||||
|
||||
for(i=0;i<nedges;i++){
|
||||
v0=graph3->edges[i].vertices[0];
|
||||
v1=graph3->edges[i].vertices[1];
|
||||
v2=graph3->edges[i].vertices[2];
|
||||
if(graph3->vert_degree[v0]==1 ||
|
||||
graph3->vert_degree[v1]==1 ||
|
||||
graph3->vert_degree[v2]==1){
|
||||
if(!GETBIT(marked_edge,i)) {
|
||||
queue[queue_head++]=i;
|
||||
SETBIT(marked_edge,i);
|
||||
}
|
||||
};
|
||||
};
|
||||
while(queue_tail!=queue_head){
|
||||
curr_edge=queue[queue_tail++];
|
||||
bdz_ph_remove_edge(graph3,curr_edge);
|
||||
v0=graph3->edges[curr_edge].vertices[0];
|
||||
v1=graph3->edges[curr_edge].vertices[1];
|
||||
v2=graph3->edges[curr_edge].vertices[2];
|
||||
if(graph3->vert_degree[v0]==1 ) {
|
||||
tmp_edge=graph3->first_edge[v0];
|
||||
if(!GETBIT(marked_edge,tmp_edge)) {
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
|
||||
};
|
||||
if(graph3->vert_degree[v1]==1) {
|
||||
tmp_edge=graph3->first_edge[v1];
|
||||
if(!GETBIT(marked_edge,tmp_edge)){
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
|
||||
};
|
||||
if(graph3->vert_degree[v2]==1){
|
||||
tmp_edge=graph3->first_edge[v2];
|
||||
if(!GETBIT(marked_edge,tmp_edge)){
|
||||
queue[queue_head++]=tmp_edge;
|
||||
SETBIT(marked_edge,tmp_edge);
|
||||
};
|
||||
};
|
||||
};
|
||||
free(marked_edge);
|
||||
return (int)queue_head - (int)nedges;/* returns 0 if successful otherwies return negative number*/
|
||||
};
|
||||
|
||||
static int bdz_ph_mapping(cmph_config_t *mph, bdz_ph_graph3_t* graph3, bdz_ph_queue_t queue);
|
||||
static void assigning(bdz_ph_config_data_t *bdz_ph, bdz_ph_graph3_t* graph3, bdz_ph_queue_t queue);
|
||||
static void bdz_ph_optimization(bdz_ph_config_data_t *bdz_ph);
|
||||
|
||||
bdz_ph_config_data_t *bdz_ph_config_new(void)
|
||||
{
|
||||
bdz_ph_config_data_t *bdz_ph;
|
||||
bdz_ph = (bdz_ph_config_data_t *)malloc(sizeof(bdz_ph_config_data_t));
|
||||
assert(bdz_ph);
|
||||
memset(bdz_ph, 0, sizeof(bdz_ph_config_data_t));
|
||||
bdz_ph->hashfunc = CMPH_HASH_JENKINS;
|
||||
bdz_ph->g = NULL;
|
||||
bdz_ph->hl = NULL;
|
||||
return bdz_ph;
|
||||
}
|
||||
|
||||
void bdz_ph_config_destroy(cmph_config_t *mph)
|
||||
{
|
||||
bdz_ph_config_data_t *data = (bdz_ph_config_data_t *)mph->data;
|
||||
DEBUGP("Destroying algorithm dependent data\n");
|
||||
free(data);
|
||||
}
|
||||
|
||||
void bdz_ph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
|
||||
{
|
||||
bdz_ph_config_data_t *bdz_ph = (bdz_ph_config_data_t *)mph->data;
|
||||
CMPH_HASH *hashptr = hashfuncs;
|
||||
cmph_uint32 i = 0;
|
||||
while(*hashptr != CMPH_HASH_COUNT)
|
||||
{
|
||||
if (i >= 1) break; //bdz_ph only uses one linear hash function
|
||||
bdz_ph->hashfunc = *hashptr;
|
||||
++i, ++hashptr;
|
||||
}
|
||||
}
|
||||
|
||||
cmph_t *bdz_ph_new(cmph_config_t *mph, double c)
|
||||
{
|
||||
cmph_t *mphf = NULL;
|
||||
bdz_ph_data_t *bdz_phf = NULL;
|
||||
cmph_uint32 iterations;
|
||||
bdz_ph_queue_t edges;
|
||||
bdz_ph_graph3_t graph3;
|
||||
bdz_ph_config_data_t *bdz_ph = (bdz_ph_config_data_t *)mph->data;
|
||||
#ifdef CMPH_TIMING
|
||||
double construction_time_begin = 0.0;
|
||||
double construction_time = 0.0;
|
||||
ELAPSED_TIME_IN_SECONDS(&construction_time_begin);
|
||||
#endif
|
||||
|
||||
|
||||
if (c == 0) c = 1.23; // validating restrictions over parameter c.
|
||||
DEBUGP("c: %f\n", c);
|
||||
bdz_ph->m = mph->key_source->nkeys;
|
||||
bdz_ph->r = (cmph_uint32)ceil((c * mph->key_source->nkeys)/3);
|
||||
if ((bdz_ph->r % 2) == 0) bdz_ph->r += 1;
|
||||
|
||||
if (bdz_ph->r == 1) { // workaround for small key sets
|
||||
bdz_ph->r = 3;
|
||||
}
|
||||
|
||||
bdz_ph->n = 3*bdz_ph->r;
|
||||
|
||||
|
||||
bdz_ph_alloc_graph3(&graph3, bdz_ph->m, bdz_ph->n);
|
||||
bdz_ph_alloc_queue(&edges,bdz_ph->m);
|
||||
DEBUGP("Created hypergraph\n");
|
||||
|
||||
DEBUGP("m (edges): %u n (vertices): %u r: %u c: %f \n", bdz_ph->m, bdz_ph->n, bdz_ph->r, c);
|
||||
|
||||
// Mapping step
|
||||
iterations = 100;
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering mapping step for mph creation of %u keys with graph sized %u\n", bdz_ph->m, bdz_ph->n);
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
int ok;
|
||||
DEBUGP("linear hash function \n");
|
||||
bdz_ph->hl = hash_state_new(bdz_ph->hashfunc, 15);
|
||||
|
||||
ok = bdz_ph_mapping(mph, &graph3, edges);
|
||||
if (!ok)
|
||||
{
|
||||
--iterations;
|
||||
hash_state_destroy(bdz_ph->hl);
|
||||
bdz_ph->hl = NULL;
|
||||
DEBUGP("%u iterations remaining\n", iterations);
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "acyclic graph creation failure - %u iterations remaining\n", iterations);
|
||||
}
|
||||
if (iterations == 0) break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
if (iterations == 0)
|
||||
{
|
||||
// free(bdz_ph->g);
|
||||
bdz_ph_free_queue(&edges);
|
||||
bdz_ph_free_graph3(&graph3);
|
||||
return NULL;
|
||||
}
|
||||
bdz_ph_partial_free_graph3(&graph3);
|
||||
// Assigning step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering assigning step for mph creation of %u keys with graph sized %u\n", bdz_ph->m, bdz_ph->n);
|
||||
}
|
||||
assigning(bdz_ph, &graph3, edges);
|
||||
|
||||
bdz_ph_free_queue(&edges);
|
||||
bdz_ph_free_graph3(&graph3);
|
||||
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Starting optimization step\n");
|
||||
}
|
||||
|
||||
bdz_ph_optimization(bdz_ph);
|
||||
|
||||
#ifdef CMPH_TIMING
|
||||
ELAPSED_TIME_IN_SECONDS(&construction_time);
|
||||
#endif
|
||||
mphf = (cmph_t *)malloc(sizeof(cmph_t));
|
||||
mphf->algo = mph->algo;
|
||||
bdz_phf = (bdz_ph_data_t *)malloc(sizeof(bdz_ph_data_t));
|
||||
bdz_phf->g = bdz_ph->g;
|
||||
bdz_ph->g = NULL; //transfer memory ownership
|
||||
bdz_phf->hl = bdz_ph->hl;
|
||||
bdz_ph->hl = NULL; //transfer memory ownership
|
||||
bdz_phf->n = bdz_ph->n;
|
||||
bdz_phf->m = bdz_ph->m;
|
||||
bdz_phf->r = bdz_ph->r;
|
||||
mphf->data = bdz_phf;
|
||||
mphf->size = bdz_ph->n;
|
||||
|
||||
DEBUGP("Successfully generated minimal perfect hash\n");
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Successfully generated minimal perfect hash function\n");
|
||||
}
|
||||
|
||||
#ifdef CMPH_TIMING
|
||||
register cmph_uint32 space_usage = bdz_ph_packed_size(mphf)*8;
|
||||
register cmph_uint32 keys_per_bucket = 1;
|
||||
construction_time = construction_time - construction_time_begin;
|
||||
fprintf(stdout, "%u\t%.2f\t%u\t%.4f\t%.4f\n", bdz_ph->m, bdz_ph->m/(double)bdz_ph->n, keys_per_bucket, construction_time, space_usage/(double)bdz_ph->m);
|
||||
#endif
|
||||
|
||||
return mphf;
|
||||
}
|
||||
|
||||
|
||||
static int bdz_ph_mapping(cmph_config_t *mph, bdz_ph_graph3_t* graph3, bdz_ph_queue_t queue)
|
||||
{
|
||||
cmph_uint32 e;
|
||||
int cycles = 0;
|
||||
cmph_uint32 hl[3];
|
||||
|
||||
bdz_ph_config_data_t *bdz_ph = (bdz_ph_config_data_t *)mph->data;
|
||||
bdz_ph_init_graph3(graph3, bdz_ph->m, bdz_ph->n);
|
||||
mph->key_source->rewind(mph->key_source->data);
|
||||
for (e = 0; e < mph->key_source->nkeys; ++e)
|
||||
{
|
||||
cmph_uint32 h0, h1, h2;
|
||||
cmph_uint32 keylen;
|
||||
char *key = NULL;
|
||||
mph->key_source->read(mph->key_source->data, &key, &keylen);
|
||||
hash_vector(bdz_ph->hl, key, keylen, hl);
|
||||
h0 = hl[0] % bdz_ph->r;
|
||||
h1 = hl[1] % bdz_ph->r + bdz_ph->r;
|
||||
h2 = hl[2] % bdz_ph->r + (bdz_ph->r << 1);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
bdz_ph_add_edge(graph3,h0,h1,h2);
|
||||
}
|
||||
cycles = bdz_ph_generate_queue(bdz_ph->m, bdz_ph->n, queue, graph3);
|
||||
return (cycles == 0);
|
||||
}
|
||||
|
||||
static void assigning(bdz_ph_config_data_t *bdz_ph, bdz_ph_graph3_t* graph3, bdz_ph_queue_t queue)
|
||||
{
|
||||
cmph_uint32 i;
|
||||
cmph_uint32 nedges=graph3->nedges;
|
||||
cmph_uint32 curr_edge;
|
||||
cmph_uint32 v0,v1,v2;
|
||||
cmph_uint8 * marked_vertices = (cmph_uint8 *)malloc((size_t)(bdz_ph->n >> 3) + 1);
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(bdz_ph->n/4.0);
|
||||
bdz_ph->g = (cmph_uint8 *)calloc((size_t)sizeg, sizeof(cmph_uint8));
|
||||
memset(marked_vertices, 0, (size_t)(bdz_ph->n >> 3) + 1);
|
||||
//memset(bdz_ph->g, 0xff, sizeg);
|
||||
|
||||
for(i=nedges-1;i+1>=1;i--){
|
||||
curr_edge=queue[i];
|
||||
v0=graph3->edges[curr_edge].vertices[0];
|
||||
v1=graph3->edges[curr_edge].vertices[1];
|
||||
v2=graph3->edges[curr_edge].vertices[2];
|
||||
DEBUGP("B:%u %u %u -- %u %u %u\n", v0, v1, v2, GETVALUE(bdz_ph->g, v0), GETVALUE(bdz_ph->g, v1), GETVALUE(bdz_ph->g, v2));
|
||||
if(!GETBIT(marked_vertices, v0)){
|
||||
if(!GETBIT(marked_vertices,v1))
|
||||
{
|
||||
//SETVALUE(bdz_ph->g, v1, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v1);
|
||||
}
|
||||
if(!GETBIT(marked_vertices,v2))
|
||||
{
|
||||
//SETVALUE(bdz_ph->g, v2, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
SETVALUE0(bdz_ph->g, v0, (6-(GETVALUE(bdz_ph->g, v1) + GETVALUE(bdz_ph->g,v2)))%3);
|
||||
SETBIT(marked_vertices, v0);
|
||||
} else if(!GETBIT(marked_vertices, v1)) {
|
||||
if(!GETBIT(marked_vertices, v2))
|
||||
{
|
||||
//SETVALUE(bdz_ph->g, v2, UNASSIGNED);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
SETVALUE0(bdz_ph->g, v1, (7 - (GETVALUE(bdz_ph->g, v0)+GETVALUE(bdz_ph->g, v2)))%3);
|
||||
SETBIT(marked_vertices, v1);
|
||||
}else {
|
||||
SETVALUE0(bdz_ph->g, v2, (8-(GETVALUE(bdz_ph->g,v0)+GETVALUE(bdz_ph->g, v1)))%3);
|
||||
SETBIT(marked_vertices, v2);
|
||||
}
|
||||
DEBUGP("A:%u %u %u -- %u %u %u\n", v0, v1, v2, GETVALUE(bdz_ph->g, v0), GETVALUE(bdz_ph->g, v1), GETVALUE(bdz_ph->g, v2));
|
||||
};
|
||||
free(marked_vertices);
|
||||
}
|
||||
|
||||
static void bdz_ph_optimization(bdz_ph_config_data_t *bdz_ph)
|
||||
{
|
||||
cmph_uint32 i;
|
||||
cmph_uint8 byte = 0;
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(bdz_ph->n/5.0);
|
||||
cmph_uint8 * new_g = (cmph_uint8 *)calloc((size_t)sizeg, sizeof(cmph_uint8));
|
||||
cmph_uint8 value;
|
||||
cmph_uint32 idx;
|
||||
for(i = 0; i < bdz_ph->n; i++)
|
||||
{
|
||||
idx = i/5;
|
||||
byte = new_g[idx];
|
||||
value = GETVALUE(bdz_ph->g, i);
|
||||
byte = (cmph_uint8) (byte + value*pow3_table[i%5U]);
|
||||
new_g[idx] = byte;
|
||||
}
|
||||
free(bdz_ph->g);
|
||||
bdz_ph->g = new_g;
|
||||
}
|
||||
|
||||
|
||||
int bdz_ph_dump(cmph_t *mphf, FILE *fd)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint32 sizeg = 0;
|
||||
register size_t nbytes;
|
||||
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
|
||||
__cmph_dump(mphf, fd);
|
||||
|
||||
hash_state_dump(data->hl, &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
nbytes = fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->r), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
sizeg = (cmph_uint32)ceil(data->n/5.0);
|
||||
nbytes = fwrite(data->g, sizeof(cmph_uint8)*sizeg, (size_t)1, fd);
|
||||
|
||||
#ifdef DEBUG
|
||||
cmph_uint32 i;
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", GETVALUE(data->g, i));
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bdz_ph_load(FILE *f, cmph_t *mphf)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint32 sizeg = 0;
|
||||
register size_t nbytes;
|
||||
bdz_ph_data_t *bdz_ph = (bdz_ph_data_t *)malloc(sizeof(bdz_ph_data_t));
|
||||
|
||||
DEBUGP("Loading bdz_ph mphf\n");
|
||||
mphf->data = bdz_ph;
|
||||
|
||||
nbytes = fread(&buflen, sizeof(cmph_uint32), (size_t)1, f);
|
||||
DEBUGP("Hash state has %u bytes\n", buflen);
|
||||
buf = (char *)malloc((size_t)buflen);
|
||||
nbytes = fread(buf, (size_t)buflen, (size_t)1, f);
|
||||
bdz_ph->hl = hash_state_load(buf, buflen);
|
||||
free(buf);
|
||||
|
||||
|
||||
DEBUGP("Reading m and n\n");
|
||||
nbytes = fread(&(bdz_ph->n), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bdz_ph->m), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bdz_ph->r), sizeof(cmph_uint32), (size_t)1, f);
|
||||
sizeg = (cmph_uint32)ceil(bdz_ph->n/5.0);
|
||||
bdz_ph->g = (cmph_uint8 *)calloc((size_t)sizeg, sizeof(cmph_uint8));
|
||||
nbytes = fread(bdz_ph->g, sizeg*sizeof(cmph_uint8), (size_t)1, f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cmph_uint32 bdz_ph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
register bdz_ph_data_t *bdz_ph = (bdz_ph_data_t *)mphf->data;
|
||||
cmph_uint32 hl[3];
|
||||
register cmph_uint8 byte0, byte1, byte2;
|
||||
register cmph_uint32 vertex;
|
||||
|
||||
hash_vector(bdz_ph->hl, key, keylen,hl);
|
||||
hl[0] = hl[0] % bdz_ph->r;
|
||||
hl[1] = hl[1] % bdz_ph->r + bdz_ph->r;
|
||||
hl[2] = hl[2] % bdz_ph->r + (bdz_ph->r << 1);
|
||||
|
||||
byte0 = bdz_ph->g[hl[0]/5];
|
||||
byte1 = bdz_ph->g[hl[1]/5];
|
||||
byte2 = bdz_ph->g[hl[2]/5];
|
||||
|
||||
byte0 = lookup_table[hl[0]%5U][byte0];
|
||||
byte1 = lookup_table[hl[1]%5U][byte1];
|
||||
byte2 = lookup_table[hl[2]%5U][byte2];
|
||||
vertex = hl[(byte0 + byte1 + byte2)%3];
|
||||
|
||||
return vertex;
|
||||
}
|
||||
|
||||
|
||||
void bdz_ph_destroy(cmph_t *mphf)
|
||||
{
|
||||
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
|
||||
free(data->g);
|
||||
hash_state_destroy(data->hl);
|
||||
free(data);
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bdz_ph_pack(cmph_t *mphf, void *packed_mphf)
|
||||
{
|
||||
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
|
||||
cmph_uint8 * ptr = (cmph_uint8 *)packed_mphf;
|
||||
|
||||
// packing hl type
|
||||
CMPH_HASH hl_type = hash_get_type(data->hl);
|
||||
*((cmph_uint32 *) ptr) = hl_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing hl
|
||||
hash_state_pack(data->hl, ptr);
|
||||
ptr += hash_state_packed_size(hl_type);
|
||||
|
||||
// packing r
|
||||
*((cmph_uint32 *) ptr) = data->r;
|
||||
ptr += sizeof(data->r);
|
||||
|
||||
// packing g
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/5.0);
|
||||
memcpy(ptr, data->g, sizeof(cmph_uint8)*sizeg);
|
||||
}
|
||||
|
||||
/** \fn cmph_uint32 bdz_ph_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bdz_ph_packed_size(cmph_t *mphf)
|
||||
{
|
||||
bdz_ph_data_t *data = (bdz_ph_data_t *)mphf->data;
|
||||
CMPH_HASH hl_type = hash_get_type(data->hl);
|
||||
cmph_uint32 sizeg = (cmph_uint32)ceil(data->n/5.0);
|
||||
return (cmph_uint32) (sizeof(CMPH_ALGO) + hash_state_packed_size(hl_type) + 2*sizeof(cmph_uint32) + sizeof(cmph_uint8)*sizeg);
|
||||
}
|
||||
|
||||
/** cmph_uint32 bdz_ph_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bdz_ph_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
|
||||
register CMPH_HASH hl_type = (CMPH_HASH)*(cmph_uint32 *)packed_mphf;
|
||||
register cmph_uint8 *hl_ptr = (cmph_uint8 *)(packed_mphf) + 4;
|
||||
|
||||
register cmph_uint8 * ptr = hl_ptr + hash_state_packed_size(hl_type);
|
||||
|
||||
register cmph_uint32 r = *((cmph_uint32*) ptr);
|
||||
register cmph_uint8 * g = ptr + 4;
|
||||
|
||||
cmph_uint32 hl[3];
|
||||
register cmph_uint8 byte0, byte1, byte2;
|
||||
register cmph_uint32 vertex;
|
||||
|
||||
hash_vector_packed(hl_ptr, hl_type, key, keylen, hl);
|
||||
|
||||
hl[0] = hl[0] % r;
|
||||
hl[1] = hl[1] % r + r;
|
||||
hl[2] = hl[2] % r + (r << 1);
|
||||
|
||||
byte0 = g[hl[0]/5];
|
||||
byte1 = g[hl[1]/5];
|
||||
byte2 = g[hl[2]/5];
|
||||
|
||||
byte0 = lookup_table[hl[0]%5][byte0];
|
||||
byte1 = lookup_table[hl[1]%5][byte1];
|
||||
byte2 = lookup_table[hl[2]%5][byte2];
|
||||
vertex = hl[(byte0 + byte1 + byte2)%3];
|
||||
|
||||
return vertex;
|
||||
}
|
42
cmph-2.0.2/src/bdz_ph.h
Executable file
42
cmph-2.0.2/src/bdz_ph.h
Executable file
@ -0,0 +1,42 @@
|
||||
#ifndef __CMPH_BDZ_PH_H__
|
||||
#define __CMPH_BDZ_PH_H__
|
||||
|
||||
#include "cmph.h"
|
||||
|
||||
typedef struct __bdz_ph_data_t bdz_ph_data_t;
|
||||
typedef struct __bdz_ph_config_data_t bdz_ph_config_data_t;
|
||||
|
||||
bdz_ph_config_data_t *bdz_ph_config_new(void);
|
||||
void bdz_ph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
||||
void bdz_ph_config_destroy(cmph_config_t *mph);
|
||||
cmph_t *bdz_ph_new(cmph_config_t *mph, double c);
|
||||
|
||||
void bdz_ph_load(FILE *f, cmph_t *mphf);
|
||||
int bdz_ph_dump(cmph_t *mphf, FILE *f);
|
||||
void bdz_ph_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bdz_ph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** \fn void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bdz_ph_pack(cmph_t *mphf, void *packed_mphf);
|
||||
|
||||
/** \fn cmph_uint32 bdz_ph_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bdz_ph_packed_size(cmph_t *mphf);
|
||||
|
||||
/** cmph_uint32 bdz_ph_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bdz_ph_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
#endif
|
36
cmph-2.0.2/src/bdz_structs.h
Executable file
36
cmph-2.0.2/src/bdz_structs.h
Executable file
@ -0,0 +1,36 @@
|
||||
#ifndef __CMPH_BDZ_STRUCTS_H__
|
||||
#define __CMPH_BDZ_STRUCTS_H__
|
||||
|
||||
#include "hash_state.h"
|
||||
|
||||
struct __bdz_data_t
|
||||
{
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
cmph_uint32 r; //partition vertex count
|
||||
cmph_uint8 *g;
|
||||
hash_state_t *hl; // linear hashing
|
||||
|
||||
cmph_uint32 k; //kth index in ranktable, $k = log_2(n=3r)/\varepsilon$
|
||||
cmph_uint8 b; // number of bits of k
|
||||
cmph_uint32 ranktablesize; //number of entries in ranktable, $n/k +1$
|
||||
cmph_uint32 *ranktable; // rank table
|
||||
};
|
||||
|
||||
|
||||
struct __bdz_config_data_t
|
||||
{
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
cmph_uint32 r; //partition vertex count
|
||||
cmph_uint8 *g;
|
||||
hash_state_t *hl; // linear hashing
|
||||
|
||||
cmph_uint32 k; //kth index in ranktable, $k = log_2(n=3r)/\varepsilon$
|
||||
cmph_uint8 b; // number of bits of k
|
||||
cmph_uint32 ranktablesize; //number of entries in ranktable, $n/k +1$
|
||||
cmph_uint32 *ranktable; // rank table
|
||||
CMPH_HASH hashfunc;
|
||||
};
|
||||
|
||||
#endif
|
26
cmph-2.0.2/src/bdz_structs_ph.h
Executable file
26
cmph-2.0.2/src/bdz_structs_ph.h
Executable file
@ -0,0 +1,26 @@
|
||||
#ifndef __CMPH_BDZ_STRUCTS_PH_H__
|
||||
#define __CMPH_BDZ_STRUCTS_PH_H__
|
||||
|
||||
#include "hash_state.h"
|
||||
|
||||
struct __bdz_ph_data_t
|
||||
{
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
cmph_uint32 r; //partition vertex count
|
||||
cmph_uint8 *g;
|
||||
hash_state_t *hl; // linear hashing
|
||||
};
|
||||
|
||||
|
||||
struct __bdz_ph_config_data_t
|
||||
{
|
||||
CMPH_HASH hashfunc;
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
cmph_uint32 r; //partition vertex count
|
||||
cmph_uint8 *g;
|
||||
hash_state_t *hl; // linear hashing
|
||||
};
|
||||
|
||||
#endif
|
170
cmph-2.0.2/src/bitbool.h
Normal file
170
cmph-2.0.2/src/bitbool.h
Normal file
@ -0,0 +1,170 @@
|
||||
#ifndef _CMPH_BITBOOL_H__
|
||||
#define _CMPH_BITBOOL_H__
|
||||
#include "cmph_types.h"
|
||||
|
||||
static const cmph_uint8 bitmask[] = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 };
|
||||
|
||||
static const cmph_uint32 bitmask32[] = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7,
|
||||
1 << 8, 1 << 9, 1 << 10, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15,
|
||||
1 << 16, 1 << 17, 1 << 18, 1 << 19, 1 << 20, 1 << 21, 1 << 22, 1 << 23,
|
||||
1 << 24, 1 << 25, 1 << 26, 1 << 27, 1 << 28, 1 << 29, 1 << 30, 1U << 31
|
||||
};
|
||||
|
||||
static const cmph_uint8 valuemask[] = { 0xfc, 0xf3, 0xcf, 0x3f};
|
||||
|
||||
|
||||
/** \def GETBIT(array, i)
|
||||
* \brief get the value of an 1-bit integer stored in an array.
|
||||
* \param array to get 1-bit integer values from
|
||||
* \param i is the index in array to get the 1-bit integer value from
|
||||
*
|
||||
* GETBIT(array, i) is a macro that gets the value of an 1-bit integer stored in array.
|
||||
*/
|
||||
#define GETBIT(array, i) ((array[i >> 3] & bitmask[i & 0x00000007]) >> (i & 0x00000007))
|
||||
|
||||
/** \def SETBIT(array, i)
|
||||
* \brief set 1 to an 1-bit integer stored in an array.
|
||||
* \param array to store 1-bit integer values
|
||||
* \param i is the index in array to set the the bit to 1
|
||||
*
|
||||
* SETBIT(array, i) is a macro that sets 1 to an 1-bit integer stored in an array.
|
||||
*/
|
||||
#define SETBIT(array, i) (array[i >> 3] |= bitmask[i & 0x00000007])
|
||||
|
||||
//#define GETBIT(array, i) (array[(i) / 8] & bitmask[(i) % 8])
|
||||
//#define SETBIT(array, i) (array[(i) / 8] |= bitmask[(i) % 8])
|
||||
//#define UNSETBIT(array, i) (array[(i) / 8] ^= ((bitmask[(i) % 8])))
|
||||
|
||||
|
||||
/** \def SETVALUE1(array, i, v)
|
||||
* \brief set a value for a 2-bit integer stored in an array initialized with 1s.
|
||||
* \param array to store 2-bit integer values
|
||||
* \param i is the index in array to set the value v
|
||||
* \param v is the value to be set
|
||||
*
|
||||
* SETVALUE1(array, i, v) is a macro that set a value for a 2-bit integer stored in an array.
|
||||
* The array should be initialized with all bits set to 1. For example:
|
||||
* memset(array, 0xff, arraySize);
|
||||
*/
|
||||
#define SETVALUE1(array, i, v) (array[i >> 2] &= (cmph_uint8)((v << ((i & 0x00000003) << 1)) | valuemask[i & 0x00000003]))
|
||||
|
||||
/** \def SETVALUE0(array, i, v)
|
||||
* \brief set a value for a 2-bit integer stored in an array initialized with 0s.
|
||||
* \param array to store 2-bit integer values
|
||||
* \param i is the index in array to set the value v
|
||||
* \param v is the value to be set
|
||||
*
|
||||
* SETVALUE0(array, i, v) is a macro that set a value for a 2-bit integer stored in an array.
|
||||
* The array should be initialized with all bits set to 0. For example:
|
||||
* memset(array, 0, arraySize);
|
||||
*/
|
||||
#define SETVALUE0(array, i, v) (array[i >> 2] |= (cmph_uint8)(v << ((i & 0x00000003) << 1)))
|
||||
|
||||
|
||||
/** \def GETVALUE(array, i)
|
||||
* \brief get a value for a 2-bit integer stored in an array.
|
||||
* \param array to get 2-bit integer values from
|
||||
* \param i is the index in array to get the value from
|
||||
*
|
||||
* GETVALUE(array, i) is a macro that get a value for a 2-bit integer stored in an array.
|
||||
*/
|
||||
#define GETVALUE(array, i) ((cmph_uint8)((array[i >> 2] >> ((i & 0x00000003U) << 1U)) & 0x00000003U))
|
||||
|
||||
|
||||
|
||||
/** \def SETBIT32(array, i)
|
||||
* \brief set 1 to an 1-bit integer stored in an array of 32-bit words.
|
||||
* \param array to store 1-bit integer values. The entries are 32-bit words.
|
||||
* \param i is the index in array to set the the bit to 1
|
||||
*
|
||||
* SETBIT32(array, i) is a macro that sets 1 to an 1-bit integer stored in an array of 32-bit words.
|
||||
*/
|
||||
#define SETBIT32(array, i) (array[i >> 5] |= bitmask32[i & 0x0000001f])
|
||||
|
||||
/** \def GETBIT32(array, i)
|
||||
* \brief get the value of an 1-bit integer stored in an array of 32-bit words.
|
||||
* \param array to get 1-bit integer values from. The entries are 32-bit words.
|
||||
* \param i is the index in array to get the 1-bit integer value from
|
||||
*
|
||||
* GETBIT32(array, i) is a macro that gets the value of an 1-bit integer stored in an array of 32-bit words.
|
||||
*/
|
||||
#define GETBIT32(array, i) (array[i >> 5] & bitmask32[i & 0x0000001f])
|
||||
|
||||
/** \def UNSETBIT32(array, i)
|
||||
* \brief set 0 to an 1-bit integer stored in an array of 32-bit words.
|
||||
* \param array to store 1-bit integer values. The entries ar 32-bit words
|
||||
* \param i is the index in array to set the the bit to 0
|
||||
*
|
||||
* UNSETBIT32(array, i) is a macro that sets 0 to an 1-bit integer stored in an array of 32-bit words.
|
||||
*/
|
||||
#define UNSETBIT32(array, i) (array[i >> 5] ^= ((bitmask32[i & 0x0000001f])))
|
||||
|
||||
#define BITS_TABLE_SIZE(n, bits_length) ((n * bits_length + 31) >> 5)
|
||||
|
||||
static inline void set_bits_value(cmph_uint32 * bits_table, cmph_uint32 index, cmph_uint32 bits_string,
|
||||
cmph_uint32 string_length, cmph_uint32 string_mask)
|
||||
{
|
||||
register cmph_uint32 bit_idx = index * string_length;
|
||||
register cmph_uint32 word_idx = bit_idx >> 5;
|
||||
register cmph_uint32 shift1 = bit_idx & 0x0000001f;
|
||||
register cmph_uint32 shift2 = 32 - shift1;
|
||||
|
||||
bits_table[word_idx] &= ~((string_mask) << shift1);
|
||||
bits_table[word_idx] |= bits_string << shift1;
|
||||
|
||||
if(shift2 < string_length)
|
||||
{
|
||||
bits_table[word_idx+1] &= ~((string_mask) >> shift2);
|
||||
bits_table[word_idx+1] |= bits_string >> shift2;
|
||||
};
|
||||
};
|
||||
|
||||
static inline cmph_uint32 get_bits_value(cmph_uint32 * bits_table,cmph_uint32 index, cmph_uint32 string_length, cmph_uint32 string_mask)
|
||||
{
|
||||
register cmph_uint32 bit_idx = index * string_length;
|
||||
register cmph_uint32 word_idx = bit_idx >> 5;
|
||||
register cmph_uint32 shift1 = bit_idx & 0x0000001f;
|
||||
register cmph_uint32 shift2 = 32-shift1;
|
||||
register cmph_uint32 bits_string;
|
||||
|
||||
bits_string = (bits_table[word_idx] >> shift1) & string_mask;
|
||||
|
||||
if(shift2 < string_length)
|
||||
bits_string |= (bits_table[word_idx+1] << shift2) & string_mask;
|
||||
|
||||
return bits_string;
|
||||
};
|
||||
|
||||
static inline void set_bits_at_pos(cmph_uint32 * bits_table, cmph_uint32 pos, cmph_uint32 bits_string, cmph_uint32 string_length)
|
||||
{
|
||||
register cmph_uint32 word_idx = pos >> 5;
|
||||
register cmph_uint32 shift1 = pos & 0x0000001f;
|
||||
register cmph_uint32 shift2 = 32-shift1;
|
||||
register cmph_uint32 string_mask = (1U << string_length) - 1;
|
||||
|
||||
bits_table[word_idx] &= ~((string_mask) << shift1);
|
||||
bits_table[word_idx] |= bits_string << shift1;
|
||||
if(shift2 < string_length)
|
||||
{
|
||||
bits_table[word_idx+1] &= ~((string_mask) >> shift2);
|
||||
bits_table[word_idx+1] |= bits_string >> shift2;
|
||||
}
|
||||
};
|
||||
|
||||
static inline cmph_uint32 get_bits_at_pos(cmph_uint32 * bits_table,cmph_uint32 pos,cmph_uint32 string_length)
|
||||
{
|
||||
register cmph_uint32 word_idx = pos >> 5;
|
||||
register cmph_uint32 shift1 = pos & 0x0000001f;
|
||||
register cmph_uint32 shift2 = 32 - shift1;
|
||||
register cmph_uint32 string_mask = (1U << string_length) - 1;
|
||||
register cmph_uint32 bits_string;
|
||||
|
||||
bits_string = (bits_table[word_idx] >> shift1) & string_mask;
|
||||
|
||||
if(shift2 < string_length)
|
||||
bits_string |= (bits_table[word_idx+1] << shift2) & string_mask;
|
||||
return bits_string;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
130
cmph-2.0.2/src/bm_numbers.c
Normal file
130
cmph-2.0.2/src/bm_numbers.c
Normal file
@ -0,0 +1,130 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bitbool.h"
|
||||
#include "cmph.h"
|
||||
#include "cmph_benchmark.h"
|
||||
#include "linear_string_map.h"
|
||||
|
||||
// Generates a vector with random unique 32 bits integers
|
||||
cmph_uint32* random_numbers_vector_new(cmph_uint32 size) {
|
||||
cmph_uint32 i = 0;
|
||||
cmph_uint32 dup_bits = sizeof(cmph_uint32)*size*8;
|
||||
char* dup = (char*)malloc(dup_bits/8);
|
||||
cmph_uint32* vec = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*size);
|
||||
memset(dup, 0, dup_bits/8);
|
||||
for (i = 0; i < size; ++i) {
|
||||
cmph_uint32 v = random();
|
||||
while (GETBIT(dup, v % dup_bits)) { v = random(); }
|
||||
SETBIT(dup, v % dup_bits);
|
||||
vec[i] = v;
|
||||
}
|
||||
free(dup);
|
||||
return vec;
|
||||
}
|
||||
|
||||
int cmph_uint32_cmp(const void *a, const void *b) {
|
||||
return *(const cmph_uint32*)a - *(const cmph_uint32*)b;
|
||||
}
|
||||
|
||||
char* create_lsmap_key(CMPH_ALGO algo, int iters) {
|
||||
char mphf_name[128];
|
||||
snprintf(mphf_name, 128, "%s:%u", cmph_names[algo], iters);
|
||||
return strdup(mphf_name);
|
||||
}
|
||||
|
||||
static cmph_uint32 g_numbers_len = 0;
|
||||
static cmph_uint32 *g_numbers = NULL;
|
||||
static lsmap_t *g_created_mphf = NULL;
|
||||
static lsmap_t *g_expected_probes = NULL;
|
||||
static lsmap_t *g_mphf_probes = NULL;
|
||||
|
||||
void bm_create(CMPH_ALGO algo, int iters) {
|
||||
cmph_io_adapter_t* source = NULL;
|
||||
cmph_config_t* config = NULL;
|
||||
cmph_t* mphf = NULL;
|
||||
|
||||
if (iters > (int)g_numbers_len) {
|
||||
fprintf(stderr, "No input with proper size.");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
source = cmph_io_struct_vector_adapter(
|
||||
(void*)g_numbers, sizeof(cmph_uint32),
|
||||
0, sizeof(cmph_uint32), iters);
|
||||
config = cmph_config_new(source);
|
||||
cmph_config_set_algo(config, algo);
|
||||
mphf = cmph_new(config);
|
||||
if (!mphf) {
|
||||
fprintf(stderr, "Failed to create mphf for algorithm %s with %u keys",
|
||||
cmph_names[algo], iters);
|
||||
exit(-1);
|
||||
}
|
||||
cmph_config_destroy(config);
|
||||
cmph_io_struct_vector_adapter_destroy(source);
|
||||
lsmap_append(g_created_mphf, create_lsmap_key(algo, iters), mphf);
|
||||
}
|
||||
|
||||
void bm_search(CMPH_ALGO algo, int iters) {
|
||||
int i = 0;
|
||||
char *mphf_name;
|
||||
cmph_t* mphf = NULL;
|
||||
|
||||
mphf_name = create_lsmap_key(algo, iters);
|
||||
mphf = (cmph_t*)lsmap_search(g_created_mphf, mphf_name);
|
||||
free(mphf_name);
|
||||
|
||||
cmph_uint32* count = (cmph_uint32*)malloc(sizeof(cmph_uint32)*iters);
|
||||
cmph_uint32* hash_count = (cmph_uint32*)malloc(sizeof(cmph_uint32)*iters);
|
||||
|
||||
for (i = 0; i < iters * 100; ++i) {
|
||||
cmph_uint32 pos = random() % iters;
|
||||
const char* buf = (const char*)(g_numbers + pos);
|
||||
cmph_uint32 h = cmph_search(mphf, buf, sizeof(cmph_uint32));
|
||||
++count[pos];
|
||||
++hash_count[h];
|
||||
}
|
||||
|
||||
// Verify correctness later.
|
||||
lsmap_append(g_expected_probes, create_lsmap_key(algo, iters), count);
|
||||
lsmap_append(g_mphf_probes, create_lsmap_key(algo, iters), hash_count);
|
||||
}
|
||||
|
||||
void verify() { }
|
||||
|
||||
#define DECLARE_ALGO(algo) \
|
||||
void bm_create_ ## algo(int iters) { bm_create(algo, iters); } \
|
||||
void bm_search_ ## algo(int iters) { bm_search(algo, iters); }
|
||||
|
||||
DECLARE_ALGO(CMPH_BMZ);
|
||||
DECLARE_ALGO(CMPH_CHM);
|
||||
DECLARE_ALGO(CMPH_BRZ);
|
||||
DECLARE_ALGO(CMPH_FCH);
|
||||
DECLARE_ALGO(CMPH_BDZ);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
g_numbers_len = 1000 * 1000;
|
||||
g_numbers = random_numbers_vector_new(g_numbers_len);
|
||||
g_created_mphf = lsmap_new();
|
||||
g_expected_probes = lsmap_new();
|
||||
g_mphf_probes = lsmap_new();
|
||||
|
||||
BM_REGISTER(bm_create_CMPH_BMZ, 1000 * 1000);
|
||||
BM_REGISTER(bm_search_CMPH_BMZ, 1000 * 1000);
|
||||
BM_REGISTER(bm_create_CMPH_CHM, 1000 * 1000);
|
||||
BM_REGISTER(bm_search_CMPH_CHM, 1000 * 1000);
|
||||
// BM_REGISTER(bm_create_CMPH_BRZ, 1000 * 1000);
|
||||
// BM_REGISTER(bm_search_CMPH_BRZ, 1000 * 1000);
|
||||
// BM_REGISTER(bm_create_CMPH_FCH, 1000 * 1000);
|
||||
// BM_REGISTER(bm_search_CMPH_FCH, 1000 * 1000);
|
||||
BM_REGISTER(bm_create_CMPH_BDZ, 1000 * 1000);
|
||||
BM_REGISTER(bm_search_CMPH_BDZ, 1000 * 1000);
|
||||
run_benchmarks(argc, argv);
|
||||
|
||||
verify();
|
||||
free(g_numbers);
|
||||
lsmap_foreach_key(g_created_mphf, (void(*)(const char*))free);
|
||||
lsmap_foreach_value(g_created_mphf, (void(*)(void*))cmph_destroy);
|
||||
lsmap_destroy(g_created_mphf);
|
||||
return 0;
|
||||
}
|
631
cmph-2.0.2/src/bmz.c
Normal file
631
cmph-2.0.2/src/bmz.c
Normal file
@ -0,0 +1,631 @@
|
||||
#include "graph.h"
|
||||
#include "bmz.h"
|
||||
#include "cmph_structs.h"
|
||||
#include "bmz_structs.h"
|
||||
#include "hash.h"
|
||||
#include "vqueue.h"
|
||||
#include "bitbool.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
// #define DEBUG
|
||||
#include "debug.h"
|
||||
|
||||
static int bmz_gen_edges(cmph_config_t *mph);
|
||||
static cmph_uint8 bmz_traverse_critical_nodes(bmz_config_data_t *bmz, cmph_uint32 v, cmph_uint32 * biggest_g_value, cmph_uint32 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
static cmph_uint8 bmz_traverse_critical_nodes_heuristic(bmz_config_data_t *bmz, cmph_uint32 v, cmph_uint32 * biggest_g_value, cmph_uint32 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
static void bmz_traverse_non_critical_nodes(bmz_config_data_t *bmz, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
|
||||
bmz_config_data_t *bmz_config_new(void)
|
||||
{
|
||||
bmz_config_data_t *bmz = NULL;
|
||||
bmz = (bmz_config_data_t *)malloc(sizeof(bmz_config_data_t));
|
||||
if (!bmz) return NULL;
|
||||
memset(bmz, 0, sizeof(bmz_config_data_t));
|
||||
bmz->hashfuncs[0] = CMPH_HASH_JENKINS;
|
||||
bmz->hashfuncs[1] = CMPH_HASH_JENKINS;
|
||||
bmz->g = NULL;
|
||||
bmz->graph = NULL;
|
||||
bmz->hashes = NULL;
|
||||
return bmz;
|
||||
}
|
||||
|
||||
void bmz_config_destroy(cmph_config_t *mph)
|
||||
{
|
||||
bmz_config_data_t *data = (bmz_config_data_t *)mph->data;
|
||||
DEBUGP("Destroying algorithm dependent data\n");
|
||||
free(data);
|
||||
}
|
||||
|
||||
void bmz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
|
||||
{
|
||||
bmz_config_data_t *bmz = (bmz_config_data_t *)mph->data;
|
||||
CMPH_HASH *hashptr = hashfuncs;
|
||||
cmph_uint32 i = 0;
|
||||
while(*hashptr != CMPH_HASH_COUNT)
|
||||
{
|
||||
if (i >= 2) break; //bmz only uses two hash functions
|
||||
bmz->hashfuncs[i] = *hashptr;
|
||||
++i, ++hashptr;
|
||||
}
|
||||
}
|
||||
|
||||
cmph_t *bmz_new(cmph_config_t *mph, double c)
|
||||
{
|
||||
cmph_t *mphf = NULL;
|
||||
bmz_data_t *bmzf = NULL;
|
||||
cmph_uint32 i;
|
||||
cmph_uint32 iterations;
|
||||
cmph_uint32 iterations_map = 20;
|
||||
cmph_uint8 *used_edges = NULL;
|
||||
cmph_uint8 restart_mapping = 0;
|
||||
cmph_uint8 * visited = NULL;
|
||||
|
||||
bmz_config_data_t *bmz = (bmz_config_data_t *)mph->data;
|
||||
if (c == 0) c = 1.15; // validating restrictions over parameter c.
|
||||
DEBUGP("c: %f\n", c);
|
||||
bmz->m = mph->key_source->nkeys;
|
||||
bmz->n = (cmph_uint32)ceil(c * mph->key_source->nkeys);
|
||||
|
||||
if (bmz->n < 5) // workaround for small key sets
|
||||
{
|
||||
bmz->n = 5;
|
||||
}
|
||||
|
||||
DEBUGP("m (edges): %u n (vertices): %u c: %f\n", bmz->m, bmz->n, c);
|
||||
bmz->graph = graph_new(bmz->n, bmz->m);
|
||||
DEBUGP("Created graph\n");
|
||||
|
||||
bmz->hashes = (hash_state_t **)malloc(sizeof(hash_state_t *)*3);
|
||||
for(i = 0; i < 3; ++i) bmz->hashes[i] = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
// Mapping step
|
||||
cmph_uint32 biggest_g_value = 0;
|
||||
cmph_uint32 biggest_edge_value = 1;
|
||||
iterations = 100;
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering mapping step for mph creation of %u keys with graph sized %u\n", bmz->m, bmz->n);
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
int ok;
|
||||
DEBUGP("hash function 1\n");
|
||||
bmz->hashes[0] = hash_state_new(bmz->hashfuncs[0], bmz->n);
|
||||
DEBUGP("hash function 2\n");
|
||||
bmz->hashes[1] = hash_state_new(bmz->hashfuncs[1], bmz->n);
|
||||
DEBUGP("Generating edges\n");
|
||||
ok = bmz_gen_edges(mph);
|
||||
if (!ok)
|
||||
{
|
||||
--iterations;
|
||||
hash_state_destroy(bmz->hashes[0]);
|
||||
bmz->hashes[0] = NULL;
|
||||
hash_state_destroy(bmz->hashes[1]);
|
||||
bmz->hashes[1] = NULL;
|
||||
DEBUGP("%u iterations remaining\n", iterations);
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "simple graph creation failure - %u iterations remaining\n", iterations);
|
||||
}
|
||||
if (iterations == 0) break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (iterations == 0)
|
||||
{
|
||||
graph_destroy(bmz->graph);
|
||||
return NULL;
|
||||
}
|
||||
// Ordering step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Starting ordering step\n");
|
||||
}
|
||||
graph_obtain_critical_nodes(bmz->graph);
|
||||
|
||||
// Searching step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Starting Searching step.\n");
|
||||
fprintf(stderr, "\tTraversing critical vertices.\n");
|
||||
}
|
||||
DEBUGP("Searching step\n");
|
||||
visited = (cmph_uint8 *)malloc((size_t)bmz->n/8 + 1);
|
||||
memset(visited, 0, (size_t)bmz->n/8 + 1);
|
||||
used_edges = (cmph_uint8 *)malloc((size_t)bmz->m/8 + 1);
|
||||
memset(used_edges, 0, (size_t)bmz->m/8 + 1);
|
||||
free(bmz->g);
|
||||
bmz->g = (cmph_uint32 *)calloc((size_t)bmz->n, sizeof(cmph_uint32));
|
||||
assert(bmz->g);
|
||||
for (i = 0; i < bmz->n; ++i) // critical nodes
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, i) && (!GETBIT(visited,i)))
|
||||
{
|
||||
if(c > 1.14) restart_mapping = bmz_traverse_critical_nodes(bmz, i, &biggest_g_value, &biggest_edge_value, used_edges, visited);
|
||||
else restart_mapping = bmz_traverse_critical_nodes_heuristic(bmz, i, &biggest_g_value, &biggest_edge_value, used_edges, visited);
|
||||
if(restart_mapping) break;
|
||||
}
|
||||
}
|
||||
if(!restart_mapping)
|
||||
{
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "\tTraversing non critical vertices.\n");
|
||||
}
|
||||
bmz_traverse_non_critical_nodes(bmz, used_edges, visited); // non_critical_nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
iterations_map--;
|
||||
if (mph->verbosity) fprintf(stderr, "Restarting mapping step. %u iterations remaining.\n", iterations_map);
|
||||
}
|
||||
free(used_edges);
|
||||
free(visited);
|
||||
} while(restart_mapping && iterations_map > 0);
|
||||
graph_destroy(bmz->graph);
|
||||
bmz->graph = NULL;
|
||||
if (iterations_map == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < bmz->n; ++i) fprintf(stderr, "%u ", bmz->g[i]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
|
||||
mphf = (cmph_t *)malloc(sizeof(cmph_t));
|
||||
mphf->algo = mph->algo;
|
||||
bmzf = (bmz_data_t *)malloc(sizeof(bmz_data_t));
|
||||
bmzf->g = bmz->g;
|
||||
bmz->g = NULL; //transfer memory ownership
|
||||
bmzf->hashes = bmz->hashes;
|
||||
bmz->hashes = NULL; //transfer memory ownership
|
||||
bmzf->n = bmz->n;
|
||||
bmzf->m = bmz->m;
|
||||
mphf->data = bmzf;
|
||||
mphf->size = bmz->m;
|
||||
|
||||
DEBUGP("Successfully generated minimal perfect hash\n");
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Successfully generated minimal perfect hash function\n");
|
||||
}
|
||||
return mphf;
|
||||
}
|
||||
|
||||
static cmph_uint8 bmz_traverse_critical_nodes(bmz_config_data_t *bmz, cmph_uint32 v, cmph_uint32 * biggest_g_value, cmph_uint32 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
cmph_uint32 next_g;
|
||||
cmph_uint32 u; /* Auxiliary vertex */
|
||||
cmph_uint32 lav; /* lookahead vertex */
|
||||
cmph_uint8 collision;
|
||||
vqueue_t * q = vqueue_new((cmph_uint32)(graph_ncritical_nodes(bmz->graph)) + 1);
|
||||
graph_iterator_t it, it1;
|
||||
|
||||
DEBUGP("Labelling critical vertices\n");
|
||||
bmz->g[v] = (cmph_uint32)ceil ((double)(*biggest_edge_value)/2) - 1;
|
||||
SETBIT(visited, v);
|
||||
next_g = (cmph_uint32)floor((double)(*biggest_edge_value/2)); /* next_g is incremented in the do..while statement*/
|
||||
vqueue_insert(q, v);
|
||||
while(!vqueue_is_empty(q))
|
||||
{
|
||||
v = vqueue_remove(q);
|
||||
it = graph_neighbors_it(bmz->graph, v);
|
||||
while ((u = graph_next_neighbor(bmz->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, u) && (!GETBIT(visited,u)))
|
||||
{
|
||||
collision = 1;
|
||||
while(collision) // lookahead to resolve collisions
|
||||
{
|
||||
next_g = *biggest_g_value + 1;
|
||||
it1 = graph_neighbors_it(bmz->graph, u);
|
||||
collision = 0;
|
||||
while((lav = graph_next_neighbor(bmz->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, lav) && GETBIT(visited,lav))
|
||||
{
|
||||
if(next_g + bmz->g[lav] >= bmz->m)
|
||||
{
|
||||
vqueue_destroy(q);
|
||||
return 1; // restart mapping step.
|
||||
}
|
||||
if (GETBIT(used_edges, (next_g + bmz->g[lav])))
|
||||
{
|
||||
collision = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (next_g > *biggest_g_value) *biggest_g_value = next_g;
|
||||
}
|
||||
// Marking used edges...
|
||||
it1 = graph_neighbors_it(bmz->graph, u);
|
||||
while((lav = graph_next_neighbor(bmz->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, lav) && GETBIT(visited, lav))
|
||||
{
|
||||
SETBIT(used_edges,(next_g + bmz->g[lav]));
|
||||
if(next_g + bmz->g[lav] > *biggest_edge_value) *biggest_edge_value = next_g + bmz->g[lav];
|
||||
}
|
||||
}
|
||||
bmz->g[u] = next_g; // Labelling vertex u.
|
||||
SETBIT(visited,u);
|
||||
vqueue_insert(q, u);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vqueue_destroy(q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cmph_uint8 bmz_traverse_critical_nodes_heuristic(bmz_config_data_t *bmz, cmph_uint32 v, cmph_uint32 * biggest_g_value, cmph_uint32 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
cmph_uint32 next_g;
|
||||
cmph_uint32 u; /* Auxiliary vertex */
|
||||
cmph_uint32 lav; /* lookahead vertex */
|
||||
cmph_uint8 collision;
|
||||
cmph_uint32 * unused_g_values = NULL;
|
||||
cmph_uint32 unused_g_values_capacity = 0;
|
||||
cmph_uint32 nunused_g_values = 0;
|
||||
vqueue_t * q = vqueue_new((cmph_uint32)(0.5*graph_ncritical_nodes(bmz->graph))+1);
|
||||
graph_iterator_t it, it1;
|
||||
|
||||
DEBUGP("Labelling critical vertices\n");
|
||||
bmz->g[v] = (cmph_uint32)ceil ((double)(*biggest_edge_value)/2) - 1;
|
||||
SETBIT(visited, v);
|
||||
next_g = (cmph_uint32)floor((double)(*biggest_edge_value/2)); /* next_g is incremented in the do..while statement*/
|
||||
vqueue_insert(q, v);
|
||||
while(!vqueue_is_empty(q))
|
||||
{
|
||||
v = vqueue_remove(q);
|
||||
it = graph_neighbors_it(bmz->graph, v);
|
||||
while ((u = graph_next_neighbor(bmz->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, u) && (!GETBIT(visited,u)))
|
||||
{
|
||||
cmph_uint32 next_g_index = 0;
|
||||
collision = 1;
|
||||
while(collision) // lookahead to resolve collisions
|
||||
{
|
||||
if (next_g_index < nunused_g_values)
|
||||
{
|
||||
next_g = unused_g_values[next_g_index++];
|
||||
}
|
||||
else
|
||||
{
|
||||
next_g = *biggest_g_value + 1;
|
||||
next_g_index = UINT_MAX;
|
||||
}
|
||||
it1 = graph_neighbors_it(bmz->graph, u);
|
||||
collision = 0;
|
||||
while((lav = graph_next_neighbor(bmz->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, lav) && GETBIT(visited,lav))
|
||||
{
|
||||
if(next_g + bmz->g[lav] >= bmz->m)
|
||||
{
|
||||
vqueue_destroy(q);
|
||||
free(unused_g_values);
|
||||
return 1; // restart mapping step.
|
||||
}
|
||||
if (GETBIT(used_edges, (next_g + bmz->g[lav])))
|
||||
{
|
||||
collision = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(collision && (next_g > *biggest_g_value)) // saving the current g value stored in next_g.
|
||||
{
|
||||
if(nunused_g_values == unused_g_values_capacity)
|
||||
{
|
||||
unused_g_values = (cmph_uint32 *)realloc(unused_g_values, (unused_g_values_capacity + BUFSIZ)*sizeof(cmph_uint32));
|
||||
unused_g_values_capacity += BUFSIZ;
|
||||
}
|
||||
unused_g_values[nunused_g_values++] = next_g;
|
||||
|
||||
}
|
||||
if (next_g > *biggest_g_value) *biggest_g_value = next_g;
|
||||
}
|
||||
next_g_index--;
|
||||
if (next_g_index < nunused_g_values) unused_g_values[next_g_index] = unused_g_values[--nunused_g_values];
|
||||
|
||||
// Marking used edges...
|
||||
it1 = graph_neighbors_it(bmz->graph, u);
|
||||
while((lav = graph_next_neighbor(bmz->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz->graph, lav) && GETBIT(visited, lav))
|
||||
{
|
||||
SETBIT(used_edges,(next_g + bmz->g[lav]));
|
||||
if(next_g + bmz->g[lav] > *biggest_edge_value) *biggest_edge_value = next_g + bmz->g[lav];
|
||||
}
|
||||
}
|
||||
bmz->g[u] = next_g; // Labelling vertex u.
|
||||
SETBIT(visited, u);
|
||||
vqueue_insert(q, u);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vqueue_destroy(q);
|
||||
free(unused_g_values);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cmph_uint32 next_unused_edge(bmz_config_data_t *bmz, cmph_uint8 * used_edges, cmph_uint32 unused_edge_index)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
assert(unused_edge_index < bmz->m);
|
||||
if(GETBIT(used_edges, unused_edge_index)) unused_edge_index ++;
|
||||
else break;
|
||||
}
|
||||
return unused_edge_index;
|
||||
}
|
||||
|
||||
static void bmz_traverse(bmz_config_data_t *bmz, cmph_uint8 * used_edges, cmph_uint32 v, cmph_uint32 * unused_edge_index, cmph_uint8 * visited)
|
||||
{
|
||||
graph_iterator_t it = graph_neighbors_it(bmz->graph, v);
|
||||
cmph_uint32 neighbor = 0;
|
||||
while((neighbor = graph_next_neighbor(bmz->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if(GETBIT(visited,neighbor)) continue;
|
||||
//DEBUGP("Visiting neighbor %u\n", neighbor);
|
||||
*unused_edge_index = next_unused_edge(bmz, used_edges, *unused_edge_index);
|
||||
bmz->g[neighbor] = *unused_edge_index - bmz->g[v];
|
||||
//if (bmz->g[neighbor] >= bmz->m) bmz->g[neighbor] += bmz->m;
|
||||
SETBIT(visited, neighbor);
|
||||
(*unused_edge_index)++;
|
||||
bmz_traverse(bmz, used_edges, neighbor, unused_edge_index, visited);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void bmz_traverse_non_critical_nodes(bmz_config_data_t *bmz, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
|
||||
cmph_uint32 i, v1, v2, unused_edge_index = 0;
|
||||
DEBUGP("Labelling non critical vertices\n");
|
||||
for(i = 0; i < bmz->m; i++)
|
||||
{
|
||||
v1 = graph_vertex_id(bmz->graph, i, 0);
|
||||
v2 = graph_vertex_id(bmz->graph, i, 1);
|
||||
if((GETBIT(visited,v1) && GETBIT(visited,v2)) || (!GETBIT(visited,v1) && !GETBIT(visited,v2))) continue;
|
||||
if(GETBIT(visited,v1)) bmz_traverse(bmz, used_edges, v1, &unused_edge_index, visited);
|
||||
else bmz_traverse(bmz, used_edges, v2, &unused_edge_index, visited);
|
||||
|
||||
}
|
||||
|
||||
for(i = 0; i < bmz->n; i++)
|
||||
{
|
||||
if(!GETBIT(visited,i))
|
||||
{
|
||||
bmz->g[i] = 0;
|
||||
SETBIT(visited, i);
|
||||
bmz_traverse(bmz, used_edges, i, &unused_edge_index, visited);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int bmz_gen_edges(cmph_config_t *mph)
|
||||
{
|
||||
cmph_uint32 e;
|
||||
bmz_config_data_t *bmz = (bmz_config_data_t *)mph->data;
|
||||
cmph_uint8 multiple_edges = 0;
|
||||
DEBUGP("Generating edges for %u vertices\n", bmz->n);
|
||||
graph_clear_edges(bmz->graph);
|
||||
mph->key_source->rewind(mph->key_source->data);
|
||||
for (e = 0; e < mph->key_source->nkeys; ++e)
|
||||
{
|
||||
cmph_uint32 h1, h2;
|
||||
cmph_uint32 keylen;
|
||||
char *key = NULL;
|
||||
mph->key_source->read(mph->key_source->data, &key, &keylen);
|
||||
|
||||
h1 = hash(bmz->hashes[0], key, keylen) % bmz->n;
|
||||
h2 = hash(bmz->hashes[1], key, keylen) % bmz->n;
|
||||
if (h1 == h2) if (++h2 >= bmz->n) h2 = 0;
|
||||
DEBUGP("key: %.*s h1: %u h2: %u\n", keylen, key, h1, h2);
|
||||
if (h1 == h2)
|
||||
{
|
||||
if (mph->verbosity) fprintf(stderr, "Self loop for key %u\n", e);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
return 0;
|
||||
}
|
||||
DEBUGP("Adding edge: %u -> %u for key %.*s\n", h1, h2, keylen, key);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
multiple_edges = graph_contains_edge(bmz->graph, h1, h2);
|
||||
if (mph->verbosity && multiple_edges) fprintf(stderr, "A non simple graph was generated\n");
|
||||
if (multiple_edges) return 0; // checking multiple edge restriction.
|
||||
graph_add_edge(bmz->graph, h1, h2);
|
||||
}
|
||||
return !multiple_edges;
|
||||
}
|
||||
|
||||
int bmz_dump(cmph_t *mphf, FILE *fd)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint32 two = 2; //number of hash functions
|
||||
bmz_data_t *data = (bmz_data_t *)mphf->data;
|
||||
register size_t nbytes;
|
||||
__cmph_dump(mphf, fd);
|
||||
|
||||
nbytes = fwrite(&two, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
|
||||
hash_state_dump(data->hashes[0], &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
hash_state_dump(data->hashes[1], &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
nbytes = fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
|
||||
|
||||
nbytes = fwrite(data->g, sizeof(cmph_uint32)*(data->n), (size_t)1, fd);
|
||||
#ifdef DEBUG
|
||||
cmph_uint32 i;
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bmz_load(FILE *f, cmph_t *mphf)
|
||||
{
|
||||
cmph_uint32 nhashes;
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint32 i;
|
||||
bmz_data_t *bmz = (bmz_data_t *)malloc(sizeof(bmz_data_t));
|
||||
register size_t nbytes;
|
||||
DEBUGP("Loading bmz mphf\n");
|
||||
mphf->data = bmz;
|
||||
nbytes = fread(&nhashes, sizeof(cmph_uint32), (size_t)1, f);
|
||||
bmz->hashes = (hash_state_t **)malloc(sizeof(hash_state_t *)*(nhashes + 1));
|
||||
bmz->hashes[nhashes] = NULL;
|
||||
DEBUGP("Reading %u hashes\n", nhashes);
|
||||
for (i = 0; i < nhashes; ++i)
|
||||
{
|
||||
hash_state_t *state = NULL;
|
||||
nbytes = fread(&buflen, sizeof(cmph_uint32), (size_t)1, f);
|
||||
DEBUGP("Hash state has %u bytes\n", buflen);
|
||||
buf = (char *)malloc((size_t)buflen);
|
||||
nbytes = fread(buf, (size_t)buflen, (size_t)1, f);
|
||||
state = hash_state_load(buf, buflen);
|
||||
bmz->hashes[i] = state;
|
||||
free(buf);
|
||||
}
|
||||
|
||||
DEBUGP("Reading m and n\n");
|
||||
nbytes = fread(&(bmz->n), sizeof(cmph_uint32), (size_t)1, f);
|
||||
nbytes = fread(&(bmz->m), sizeof(cmph_uint32), (size_t)1, f);
|
||||
|
||||
bmz->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*bmz->n);
|
||||
nbytes = fread(bmz->g, bmz->n*sizeof(cmph_uint32), (size_t)1, f);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < bmz->n; ++i) fprintf(stderr, "%u ", bmz->g[i]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cmph_uint32 bmz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
bmz_data_t *bmz = (bmz_data_t *)mphf->data;
|
||||
cmph_uint32 h1 = hash(bmz->hashes[0], key, keylen) % bmz->n;
|
||||
cmph_uint32 h2 = hash(bmz->hashes[1], key, keylen) % bmz->n;
|
||||
DEBUGP("key: %.*s h1: %u h2: %u\n", keylen, key, h1, h2);
|
||||
if (h1 == h2 && ++h2 >= bmz->n) h2 = 0;
|
||||
DEBUGP("key: %.*s g[h1]: %u g[h2]: %u edges: %u\n", keylen, key, bmz->g[h1], bmz->g[h2], bmz->m);
|
||||
return bmz->g[h1] + bmz->g[h2];
|
||||
}
|
||||
void bmz_destroy(cmph_t *mphf)
|
||||
{
|
||||
bmz_data_t *data = (bmz_data_t *)mphf->data;
|
||||
free(data->g);
|
||||
hash_state_destroy(data->hashes[0]);
|
||||
hash_state_destroy(data->hashes[1]);
|
||||
free(data->hashes);
|
||||
free(data);
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bmz_pack(cmph_t *mphf, void *packed_mphf)
|
||||
{
|
||||
|
||||
bmz_data_t *data = (bmz_data_t *)mphf->data;
|
||||
cmph_uint8 * ptr = (cmph_uint8 *)packed_mphf;
|
||||
|
||||
// packing h1 type
|
||||
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
|
||||
*((cmph_uint32 *) ptr) = h1_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing h1
|
||||
hash_state_pack(data->hashes[0], ptr);
|
||||
ptr += hash_state_packed_size(h1_type);
|
||||
|
||||
// packing h2 type
|
||||
CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
|
||||
*((cmph_uint32 *) ptr) = h2_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing h2
|
||||
hash_state_pack(data->hashes[1], ptr);
|
||||
ptr += hash_state_packed_size(h2_type);
|
||||
|
||||
// packing n
|
||||
*((cmph_uint32 *) ptr) = data->n;
|
||||
ptr += sizeof(data->n);
|
||||
|
||||
// packing g
|
||||
memcpy(ptr, data->g, sizeof(cmph_uint32)*data->n);
|
||||
}
|
||||
|
||||
/** \fn cmph_uint32 bmz_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bmz_packed_size(cmph_t *mphf)
|
||||
{
|
||||
bmz_data_t *data = (bmz_data_t *)mphf->data;
|
||||
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
|
||||
CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
|
||||
|
||||
return (cmph_uint32)(sizeof(CMPH_ALGO) + hash_state_packed_size(h1_type) + hash_state_packed_size(h2_type) +
|
||||
3*sizeof(cmph_uint32) + sizeof(cmph_uint32)*data->n);
|
||||
}
|
||||
|
||||
/** cmph_uint32 bmz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bmz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
register cmph_uint8 *h1_ptr = (cmph_uint8 *)packed_mphf;
|
||||
register CMPH_HASH h1_type = (CMPH_HASH)(*((cmph_uint32 *)h1_ptr));
|
||||
h1_ptr += 4;
|
||||
|
||||
register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
|
||||
register CMPH_HASH h2_type = (CMPH_HASH)(*((cmph_uint32 *)h2_ptr));
|
||||
h2_ptr += 4;
|
||||
|
||||
register cmph_uint32 *g_ptr = (cmph_uint32 *)(h2_ptr + hash_state_packed_size(h2_type));
|
||||
|
||||
register cmph_uint32 n = *g_ptr++;
|
||||
|
||||
register cmph_uint32 h1 = hash_packed(h1_ptr, h1_type, key, keylen) % n;
|
||||
register cmph_uint32 h2 = hash_packed(h2_ptr, h2_type, key, keylen) % n;
|
||||
if (h1 == h2 && ++h2 >= n) h2 = 0;
|
||||
return (g_ptr[h1] + g_ptr[h2]);
|
||||
}
|
42
cmph-2.0.2/src/bmz.h
Normal file
42
cmph-2.0.2/src/bmz.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef __CMPH_BMZ_H__
|
||||
#define __CMPH_BMZ_H__
|
||||
|
||||
#include "cmph.h"
|
||||
|
||||
typedef struct __bmz_data_t bmz_data_t;
|
||||
typedef struct __bmz_config_data_t bmz_config_data_t;
|
||||
|
||||
bmz_config_data_t *bmz_config_new(void);
|
||||
void bmz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
||||
void bmz_config_destroy(cmph_config_t *mph);
|
||||
cmph_t *bmz_new(cmph_config_t *mph, double c);
|
||||
|
||||
void bmz_load(FILE *f, cmph_t *mphf);
|
||||
int bmz_dump(cmph_t *mphf, FILE *f);
|
||||
void bmz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 bmz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** \fn void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bmz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
|
||||
/** \fn cmph_uint32 bmz_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bmz_packed_size(cmph_t *mphf);
|
||||
|
||||
/** cmph_uint32 bmz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 bmz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
#endif
|
638
cmph-2.0.2/src/bmz8.c
Normal file
638
cmph-2.0.2/src/bmz8.c
Normal file
@ -0,0 +1,638 @@
|
||||
#include "graph.h"
|
||||
#include "bmz8.h"
|
||||
#include "cmph_structs.h"
|
||||
#include "bmz8_structs.h"
|
||||
#include "hash.h"
|
||||
#include "vqueue.h"
|
||||
#include "bitbool.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
//#define DEBUG
|
||||
#include "debug.h"
|
||||
|
||||
static int bmz8_gen_edges(cmph_config_t *mph);
|
||||
static cmph_uint8 bmz8_traverse_critical_nodes(bmz8_config_data_t *bmz8, cmph_uint32 v, cmph_uint8 * biggest_g_value, cmph_uint8 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
static cmph_uint8 bmz8_traverse_critical_nodes_heuristic(bmz8_config_data_t *bmz8, cmph_uint32 v, cmph_uint8 * biggest_g_value, cmph_uint8 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
static void bmz8_traverse_non_critical_nodes(bmz8_config_data_t *bmz8, cmph_uint8 * used_edges, cmph_uint8 * visited);
|
||||
|
||||
bmz8_config_data_t *bmz8_config_new(void)
|
||||
{
|
||||
bmz8_config_data_t *bmz8;
|
||||
bmz8 = (bmz8_config_data_t *)malloc(sizeof(bmz8_config_data_t));
|
||||
if (!bmz8) return NULL;
|
||||
memset(bmz8, 0, sizeof(bmz8_config_data_t));
|
||||
bmz8->hashfuncs[0] = CMPH_HASH_JENKINS;
|
||||
bmz8->hashfuncs[1] = CMPH_HASH_JENKINS;
|
||||
bmz8->g = NULL;
|
||||
bmz8->graph = NULL;
|
||||
bmz8->hashes = NULL;
|
||||
return bmz8;
|
||||
}
|
||||
|
||||
void bmz8_config_destroy(cmph_config_t *mph)
|
||||
{
|
||||
bmz8_config_data_t *data = (bmz8_config_data_t *)mph->data;
|
||||
DEBUGP("Destroying algorithm dependent data\n");
|
||||
free(data);
|
||||
}
|
||||
|
||||
void bmz8_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
|
||||
{
|
||||
bmz8_config_data_t *bmz8 = (bmz8_config_data_t *)mph->data;
|
||||
CMPH_HASH *hashptr = hashfuncs;
|
||||
cmph_uint8 i = 0;
|
||||
while(*hashptr != CMPH_HASH_COUNT)
|
||||
{
|
||||
if (i >= 2) break; //bmz8 only uses two hash functions
|
||||
bmz8->hashfuncs[i] = *hashptr;
|
||||
++i, ++hashptr;
|
||||
}
|
||||
}
|
||||
|
||||
cmph_t *bmz8_new(cmph_config_t *mph, double c)
|
||||
{
|
||||
cmph_t *mphf = NULL;
|
||||
bmz8_data_t *bmz8f = NULL;
|
||||
cmph_uint8 i;
|
||||
cmph_uint8 iterations;
|
||||
cmph_uint8 iterations_map = 20;
|
||||
cmph_uint8 *used_edges = NULL;
|
||||
cmph_uint8 restart_mapping = 0;
|
||||
cmph_uint8 * visited = NULL;
|
||||
bmz8_config_data_t *bmz8 = (bmz8_config_data_t *)mph->data;
|
||||
|
||||
if (mph->key_source->nkeys >= 256)
|
||||
{
|
||||
if (mph->verbosity) fprintf(stderr, "The number of keys in BMZ8 must be lower than 256.\n");
|
||||
return NULL;
|
||||
}
|
||||
if (c == 0) c = 1.15; // validating restrictions over parameter c.
|
||||
DEBUGP("c: %f\n", c);
|
||||
bmz8->m = (cmph_uint8) mph->key_source->nkeys;
|
||||
bmz8->n = (cmph_uint8) ceil(c * mph->key_source->nkeys);
|
||||
|
||||
if (bmz8->n < 5) // workaround for small key sets
|
||||
{
|
||||
bmz8->n = 5;
|
||||
}
|
||||
|
||||
DEBUGP("m (edges): %u n (vertices): %u c: %f\n", bmz8->m, bmz8->n, c);
|
||||
bmz8->graph = graph_new(bmz8->n, bmz8->m);
|
||||
DEBUGP("Created graph\n");
|
||||
|
||||
bmz8->hashes = (hash_state_t **)malloc(sizeof(hash_state_t *)*3);
|
||||
for(i = 0; i < 3; ++i) bmz8->hashes[i] = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
// Mapping step
|
||||
cmph_uint8 biggest_g_value = 0;
|
||||
cmph_uint8 biggest_edge_value = 1;
|
||||
iterations = 100;
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Entering mapping step for mph creation of %u keys with graph sized %u\n", bmz8->m, bmz8->n);
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
int ok;
|
||||
DEBUGP("hash function 1\n");
|
||||
bmz8->hashes[0] = hash_state_new(bmz8->hashfuncs[0], bmz8->n);
|
||||
DEBUGP("hash function 2\n");
|
||||
bmz8->hashes[1] = hash_state_new(bmz8->hashfuncs[1], bmz8->n);
|
||||
DEBUGP("Generating edges\n");
|
||||
ok = bmz8_gen_edges(mph);
|
||||
if (!ok)
|
||||
{
|
||||
--iterations;
|
||||
hash_state_destroy(bmz8->hashes[0]);
|
||||
bmz8->hashes[0] = NULL;
|
||||
hash_state_destroy(bmz8->hashes[1]);
|
||||
bmz8->hashes[1] = NULL;
|
||||
DEBUGP("%u iterations remaining\n", iterations);
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "simple graph creation failure - %u iterations remaining\n", iterations);
|
||||
}
|
||||
if (iterations == 0) break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (iterations == 0)
|
||||
{
|
||||
graph_destroy(bmz8->graph);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Ordering step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Starting ordering step\n");
|
||||
}
|
||||
|
||||
graph_obtain_critical_nodes(bmz8->graph);
|
||||
|
||||
// Searching step
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Starting Searching step.\n");
|
||||
fprintf(stderr, "\tTraversing critical vertices.\n");
|
||||
}
|
||||
DEBUGP("Searching step\n");
|
||||
visited = (cmph_uint8 *)malloc((size_t)bmz8->n/8 + 1);
|
||||
memset(visited, 0, (size_t)bmz8->n/8 + 1);
|
||||
used_edges = (cmph_uint8 *)malloc((size_t)bmz8->m/8 + 1);
|
||||
memset(used_edges, 0, (size_t)bmz8->m/8 + 1);
|
||||
free(bmz8->g);
|
||||
bmz8->g = (cmph_uint8 *)calloc((size_t)bmz8->n, sizeof(cmph_uint8));
|
||||
assert(bmz8->g);
|
||||
for (i = 0; i < bmz8->n; ++i) // critical nodes
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, i) && (!GETBIT(visited,i)))
|
||||
{
|
||||
if(c > 1.14) restart_mapping = bmz8_traverse_critical_nodes(bmz8, i, &biggest_g_value, &biggest_edge_value, used_edges, visited);
|
||||
else restart_mapping = bmz8_traverse_critical_nodes_heuristic(bmz8, i, &biggest_g_value, &biggest_edge_value, used_edges, visited);
|
||||
if(restart_mapping) break;
|
||||
}
|
||||
}
|
||||
if(!restart_mapping)
|
||||
{
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "\tTraversing non critical vertices.\n");
|
||||
}
|
||||
bmz8_traverse_non_critical_nodes(bmz8, used_edges, visited); // non_critical_nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
iterations_map--;
|
||||
if (mph->verbosity) fprintf(stderr, "Restarting mapping step. %u iterations remaining.\n", iterations_map);
|
||||
}
|
||||
|
||||
free(used_edges);
|
||||
free(visited);
|
||||
|
||||
}while(restart_mapping && iterations_map > 0);
|
||||
graph_destroy(bmz8->graph);
|
||||
bmz8->graph = NULL;
|
||||
if (iterations_map == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
mphf = (cmph_t *)malloc(sizeof(cmph_t));
|
||||
mphf->algo = mph->algo;
|
||||
bmz8f = (bmz8_data_t *)malloc(sizeof(bmz8_data_t));
|
||||
bmz8f->g = bmz8->g;
|
||||
bmz8->g = NULL; //transfer memory ownership
|
||||
bmz8f->hashes = bmz8->hashes;
|
||||
bmz8->hashes = NULL; //transfer memory ownership
|
||||
bmz8f->n = bmz8->n;
|
||||
bmz8f->m = bmz8->m;
|
||||
mphf->data = bmz8f;
|
||||
mphf->size = bmz8->m;
|
||||
DEBUGP("Successfully generated minimal perfect hash\n");
|
||||
if (mph->verbosity)
|
||||
{
|
||||
fprintf(stderr, "Successfully generated minimal perfect hash function\n");
|
||||
}
|
||||
return mphf;
|
||||
}
|
||||
|
||||
static cmph_uint8 bmz8_traverse_critical_nodes(bmz8_config_data_t *bmz8, cmph_uint32 v, cmph_uint8 * biggest_g_value, cmph_uint8 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
cmph_uint8 next_g;
|
||||
cmph_uint32 u; /* Auxiliary vertex */
|
||||
cmph_uint32 lav; /* lookahead vertex */
|
||||
cmph_uint8 collision;
|
||||
vqueue_t * q = vqueue_new((cmph_uint32)(graph_ncritical_nodes(bmz8->graph)));
|
||||
graph_iterator_t it, it1;
|
||||
|
||||
DEBUGP("Labelling critical vertices\n");
|
||||
bmz8->g[v] = (cmph_uint8)(ceil ((double)(*biggest_edge_value)/2) - 1);
|
||||
SETBIT(visited, v);
|
||||
next_g = (cmph_uint8)floor((double)(*biggest_edge_value/2)); /* next_g is incremented in the do..while statement*/
|
||||
vqueue_insert(q, v);
|
||||
while(!vqueue_is_empty(q))
|
||||
{
|
||||
v = vqueue_remove(q);
|
||||
it = graph_neighbors_it(bmz8->graph, v);
|
||||
while ((u = graph_next_neighbor(bmz8->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, u) && (!GETBIT(visited,u)))
|
||||
{
|
||||
collision = 1;
|
||||
while(collision) // lookahead to resolve collisions
|
||||
{
|
||||
next_g = (cmph_uint8)(*biggest_g_value + 1);
|
||||
it1 = graph_neighbors_it(bmz8->graph, u);
|
||||
collision = 0;
|
||||
while((lav = graph_next_neighbor(bmz8->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, lav) && GETBIT(visited,lav))
|
||||
{
|
||||
if(next_g + bmz8->g[lav] >= bmz8->m)
|
||||
{
|
||||
vqueue_destroy(q);
|
||||
return 1; // restart mapping step.
|
||||
}
|
||||
if (GETBIT(used_edges, (next_g + bmz8->g[lav])))
|
||||
{
|
||||
collision = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (next_g > *biggest_g_value) *biggest_g_value = next_g;
|
||||
}
|
||||
// Marking used edges...
|
||||
it1 = graph_neighbors_it(bmz8->graph, u);
|
||||
while((lav = graph_next_neighbor(bmz8->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, lav) && GETBIT(visited, lav))
|
||||
{
|
||||
SETBIT(used_edges,(next_g + bmz8->g[lav]));
|
||||
|
||||
if(next_g + bmz8->g[lav] > *biggest_edge_value)
|
||||
*biggest_edge_value = (cmph_uint8)(next_g + bmz8->g[lav]);
|
||||
}
|
||||
}
|
||||
bmz8->g[u] = next_g; // Labelling vertex u.
|
||||
SETBIT(visited,u);
|
||||
vqueue_insert(q, u);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vqueue_destroy(q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cmph_uint8 bmz8_traverse_critical_nodes_heuristic(bmz8_config_data_t *bmz8, cmph_uint32 v, cmph_uint8 * biggest_g_value, cmph_uint8 * biggest_edge_value, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
cmph_uint8 next_g;
|
||||
cmph_uint32 u;
|
||||
cmph_uint32 lav;
|
||||
cmph_uint8 collision;
|
||||
cmph_uint8 * unused_g_values = NULL;
|
||||
cmph_uint8 unused_g_values_capacity = 0;
|
||||
cmph_uint8 nunused_g_values = 0;
|
||||
vqueue_t * q = vqueue_new((cmph_uint32)(graph_ncritical_nodes(bmz8->graph)));
|
||||
graph_iterator_t it, it1;
|
||||
|
||||
DEBUGP("Labelling critical vertices\n");
|
||||
bmz8->g[v] = (cmph_uint8)(ceil ((double)(*biggest_edge_value)/2) - 1);
|
||||
SETBIT(visited, v);
|
||||
next_g = (cmph_uint8)floor((double)(*biggest_edge_value/2));
|
||||
vqueue_insert(q, v);
|
||||
while(!vqueue_is_empty(q))
|
||||
{
|
||||
v = vqueue_remove(q);
|
||||
it = graph_neighbors_it(bmz8->graph, v);
|
||||
while ((u = graph_next_neighbor(bmz8->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, u) && (!GETBIT(visited,u)))
|
||||
{
|
||||
cmph_uint8 next_g_index = 0;
|
||||
collision = 1;
|
||||
while(collision) // lookahead to resolve collisions
|
||||
{
|
||||
if (next_g_index < nunused_g_values)
|
||||
{
|
||||
next_g = unused_g_values[next_g_index++];
|
||||
}
|
||||
else
|
||||
{
|
||||
next_g = (cmph_uint8)(*biggest_g_value + 1);
|
||||
next_g_index = 255;//UINT_MAX;
|
||||
}
|
||||
it1 = graph_neighbors_it(bmz8->graph, u);
|
||||
collision = 0;
|
||||
while((lav = graph_next_neighbor(bmz8->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, lav) && GETBIT(visited,lav))
|
||||
{
|
||||
if(next_g + bmz8->g[lav] >= bmz8->m)
|
||||
{
|
||||
vqueue_destroy(q);
|
||||
free(unused_g_values);
|
||||
return 1; // restart mapping step.
|
||||
}
|
||||
if (GETBIT(used_edges, (next_g + bmz8->g[lav])))
|
||||
{
|
||||
collision = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(collision && (next_g > *biggest_g_value)) // saving the current g value stored in next_g.
|
||||
{
|
||||
if(nunused_g_values == unused_g_values_capacity)
|
||||
{
|
||||
unused_g_values = (cmph_uint8*)realloc(unused_g_values, ((size_t)(unused_g_values_capacity + BUFSIZ))*sizeof(cmph_uint8));
|
||||
unused_g_values_capacity += (cmph_uint8)BUFSIZ;
|
||||
}
|
||||
unused_g_values[nunused_g_values++] = next_g;
|
||||
|
||||
}
|
||||
if (next_g > *biggest_g_value) *biggest_g_value = next_g;
|
||||
}
|
||||
|
||||
next_g_index--;
|
||||
if (next_g_index < nunused_g_values) unused_g_values[next_g_index] = unused_g_values[--nunused_g_values];
|
||||
|
||||
// Marking used edges...
|
||||
it1 = graph_neighbors_it(bmz8->graph, u);
|
||||
while((lav = graph_next_neighbor(bmz8->graph, &it1)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if (graph_node_is_critical(bmz8->graph, lav) && GETBIT(visited, lav))
|
||||
{
|
||||
SETBIT(used_edges,(next_g + bmz8->g[lav]));
|
||||
if(next_g + bmz8->g[lav] > *biggest_edge_value)
|
||||
*biggest_edge_value = (cmph_uint8)(next_g + bmz8->g[lav]);
|
||||
}
|
||||
}
|
||||
|
||||
bmz8->g[u] = next_g; // Labelling vertex u.
|
||||
SETBIT(visited, u);
|
||||
vqueue_insert(q, u);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
vqueue_destroy(q);
|
||||
free(unused_g_values);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cmph_uint8 next_unused_edge(bmz8_config_data_t *bmz8, cmph_uint8 * used_edges, cmph_uint32 unused_edge_index)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
assert(unused_edge_index < bmz8->m);
|
||||
if(GETBIT(used_edges, unused_edge_index)) unused_edge_index ++;
|
||||
else break;
|
||||
}
|
||||
return (cmph_uint8)unused_edge_index;
|
||||
}
|
||||
|
||||
static void bmz8_traverse(bmz8_config_data_t *bmz8, cmph_uint8 * used_edges, cmph_uint32 v, cmph_uint8 * unused_edge_index, cmph_uint8 * visited)
|
||||
{
|
||||
graph_iterator_t it = graph_neighbors_it(bmz8->graph, v);
|
||||
cmph_uint32 neighbor = 0;
|
||||
while((neighbor = graph_next_neighbor(bmz8->graph, &it)) != GRAPH_NO_NEIGHBOR)
|
||||
{
|
||||
if(GETBIT(visited,neighbor)) continue;
|
||||
//DEBUGP("Visiting neighbor %u\n", neighbor);
|
||||
*unused_edge_index = next_unused_edge(bmz8, used_edges, *unused_edge_index);
|
||||
bmz8->g[neighbor] = (cmph_uint8)(*unused_edge_index - bmz8->g[v]);
|
||||
//if (bmz8->g[neighbor] >= bmz8->m) bmz8->g[neighbor] += bmz8->m;
|
||||
SETBIT(visited, neighbor);
|
||||
(*unused_edge_index)++;
|
||||
bmz8_traverse(bmz8, used_edges, neighbor, unused_edge_index, visited);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void bmz8_traverse_non_critical_nodes(bmz8_config_data_t *bmz8, cmph_uint8 * used_edges, cmph_uint8 * visited)
|
||||
{
|
||||
|
||||
cmph_uint8 i, v1, v2, unused_edge_index = 0;
|
||||
DEBUGP("Labelling non critical vertices\n");
|
||||
for(i = 0; i < bmz8->m; i++)
|
||||
{
|
||||
v1 = (cmph_uint8)graph_vertex_id(bmz8->graph, i, 0);
|
||||
v2 = (cmph_uint8)graph_vertex_id(bmz8->graph, i, 1);
|
||||
if((GETBIT(visited,v1) && GETBIT(visited,v2)) || (!GETBIT(visited,v1) && !GETBIT(visited,v2))) continue;
|
||||
if(GETBIT(visited,v1)) bmz8_traverse(bmz8, used_edges, v1, &unused_edge_index, visited);
|
||||
else bmz8_traverse(bmz8, used_edges, v2, &unused_edge_index, visited);
|
||||
|
||||
}
|
||||
|
||||
for(i = 0; i < bmz8->n; i++)
|
||||
{
|
||||
if(!GETBIT(visited,i))
|
||||
{
|
||||
bmz8->g[i] = 0;
|
||||
SETBIT(visited, i);
|
||||
bmz8_traverse(bmz8, used_edges, i, &unused_edge_index, visited);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int bmz8_gen_edges(cmph_config_t *mph)
|
||||
{
|
||||
cmph_uint8 e;
|
||||
bmz8_config_data_t *bmz8 = (bmz8_config_data_t *)mph->data;
|
||||
cmph_uint8 multiple_edges = 0;
|
||||
DEBUGP("Generating edges for %u vertices\n", bmz8->n);
|
||||
graph_clear_edges(bmz8->graph);
|
||||
mph->key_source->rewind(mph->key_source->data);
|
||||
for (e = 0; e < mph->key_source->nkeys; ++e)
|
||||
{
|
||||
cmph_uint8 h1, h2;
|
||||
cmph_uint32 keylen;
|
||||
char *key = NULL;
|
||||
mph->key_source->read(mph->key_source->data, &key, &keylen);
|
||||
|
||||
// if (key == NULL)fprintf(stderr, "key = %s -- read BMZ\n", key);
|
||||
h1 = (cmph_uint8)(hash(bmz8->hashes[0], key, keylen) % bmz8->n);
|
||||
h2 = (cmph_uint8)(hash(bmz8->hashes[1], key, keylen) % bmz8->n);
|
||||
if (h1 == h2) if (++h2 >= bmz8->n) h2 = 0;
|
||||
if (h1 == h2)
|
||||
{
|
||||
if (mph->verbosity) fprintf(stderr, "Self loop for key %u\n", e);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
return 0;
|
||||
}
|
||||
//DEBUGP("Adding edge: %u -> %u for key %s\n", h1, h2, key);
|
||||
mph->key_source->dispose(mph->key_source->data, key, keylen);
|
||||
// fprintf(stderr, "key = %s -- dispose BMZ\n", key);
|
||||
multiple_edges = graph_contains_edge(bmz8->graph, h1, h2);
|
||||
if (mph->verbosity && multiple_edges) fprintf(stderr, "A non simple graph was generated\n");
|
||||
if (multiple_edges) return 0; // checking multiple edge restriction.
|
||||
graph_add_edge(bmz8->graph, h1, h2);
|
||||
}
|
||||
return !multiple_edges;
|
||||
}
|
||||
|
||||
int bmz8_dump(cmph_t *mphf, FILE *fd)
|
||||
{
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint8 two = 2; //number of hash functions
|
||||
bmz8_data_t *data = (bmz8_data_t *)mphf->data;
|
||||
register size_t nbytes;
|
||||
__cmph_dump(mphf, fd);
|
||||
|
||||
nbytes = fwrite(&two, sizeof(cmph_uint8), (size_t)1, fd);
|
||||
|
||||
hash_state_dump(data->hashes[0], &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
hash_state_dump(data->hashes[1], &buf, &buflen);
|
||||
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
|
||||
nbytes = fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
|
||||
nbytes = fwrite(buf, (size_t)buflen, (size_t)1, fd);
|
||||
free(buf);
|
||||
|
||||
nbytes = fwrite(&(data->n), sizeof(cmph_uint8), (size_t)1, fd);
|
||||
nbytes = fwrite(&(data->m), sizeof(cmph_uint8), (size_t)1, fd);
|
||||
|
||||
nbytes = fwrite(data->g, sizeof(cmph_uint8)*(data->n), (size_t)1, fd);
|
||||
/* #ifdef DEBUG
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bmz8_load(FILE *f, cmph_t *mphf)
|
||||
{
|
||||
cmph_uint8 nhashes;
|
||||
char *buf = NULL;
|
||||
cmph_uint32 buflen;
|
||||
cmph_uint8 i;
|
||||
register size_t nbytes;
|
||||
bmz8_data_t *bmz8 = (bmz8_data_t *)malloc(sizeof(bmz8_data_t));
|
||||
|
||||
DEBUGP("Loading bmz8 mphf\n");
|
||||
mphf->data = bmz8;
|
||||
nbytes = fread(&nhashes, sizeof(cmph_uint8), (size_t)1, f);
|
||||
bmz8->hashes = (hash_state_t **)malloc(sizeof(hash_state_t *)*(size_t)(nhashes + 1));
|
||||
bmz8->hashes[nhashes] = NULL;
|
||||
DEBUGP("Reading %u hashes\n", nhashes);
|
||||
for (i = 0; i < nhashes; ++i)
|
||||
{
|
||||
hash_state_t *state = NULL;
|
||||
nbytes = fread(&buflen, sizeof(cmph_uint32), (size_t)1, f);
|
||||
DEBUGP("Hash state has %u bytes\n", buflen);
|
||||
buf = (char *)malloc((size_t)buflen);
|
||||
nbytes = fread(buf, (size_t)buflen, (size_t)1, f);
|
||||
state = hash_state_load(buf, buflen);
|
||||
bmz8->hashes[i] = state;
|
||||
free(buf);
|
||||
}
|
||||
|
||||
DEBUGP("Reading m and n\n");
|
||||
nbytes = fread(&(bmz8->n), sizeof(cmph_uint8), (size_t)1, f);
|
||||
nbytes = fread(&(bmz8->m), sizeof(cmph_uint8), (size_t)1, f);
|
||||
|
||||
bmz8->g = (cmph_uint8 *)malloc(sizeof(cmph_uint8)*bmz8->n);
|
||||
nbytes = fread(bmz8->g, bmz8->n*sizeof(cmph_uint8), (size_t)1, f);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "G: ");
|
||||
for (i = 0; i < bmz8->n; ++i) fprintf(stderr, "%u ", bmz8->g[i]);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
bmz8_data_t *bmz8 = (bmz8_data_t *)mphf->data;
|
||||
cmph_uint8 h1 = (cmph_uint8)(hash(bmz8->hashes[0], key, keylen) % bmz8->n);
|
||||
cmph_uint8 h2 = (cmph_uint8)(hash(bmz8->hashes[1], key, keylen) % bmz8->n);
|
||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
||||
if (h1 == h2 && ++h2 > bmz8->n) h2 = 0;
|
||||
DEBUGP("key: %s g[h1]: %u g[h2]: %u edges: %u\n", key, bmz8->g[h1], bmz8->g[h2], bmz8->m);
|
||||
return (cmph_uint8)(bmz8->g[h1] + bmz8->g[h2]);
|
||||
}
|
||||
void bmz8_destroy(cmph_t *mphf)
|
||||
{
|
||||
bmz8_data_t *data = (bmz8_data_t *)mphf->data;
|
||||
free(data->g);
|
||||
hash_state_destroy(data->hashes[0]);
|
||||
hash_state_destroy(data->hashes[1]);
|
||||
free(data->hashes);
|
||||
free(data);
|
||||
free(mphf);
|
||||
}
|
||||
|
||||
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bmz8_pack(cmph_t *mphf, void *packed_mphf)
|
||||
{
|
||||
bmz8_data_t *data = (bmz8_data_t *)mphf->data;
|
||||
cmph_uint8 * ptr = (cmph_uint8 *)packed_mphf;
|
||||
|
||||
// packing h1 type
|
||||
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
|
||||
*((cmph_uint32 *) ptr) = h1_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing h1
|
||||
hash_state_pack(data->hashes[0], ptr);
|
||||
ptr += hash_state_packed_size(h1_type);
|
||||
|
||||
// packing h2 type
|
||||
CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
|
||||
*((cmph_uint32 *) ptr) = h2_type;
|
||||
ptr += sizeof(cmph_uint32);
|
||||
|
||||
// packing h2
|
||||
hash_state_pack(data->hashes[1], ptr);
|
||||
ptr += hash_state_packed_size(h2_type);
|
||||
|
||||
// packing n
|
||||
*ptr++ = data->n;
|
||||
|
||||
// packing g
|
||||
memcpy(ptr, data->g, sizeof(cmph_uint8)*data->n);
|
||||
}
|
||||
|
||||
/** \fn cmph_uint32 bmz8_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bmz8_packed_size(cmph_t *mphf)
|
||||
{
|
||||
bmz8_data_t *data = (bmz8_data_t *)mphf->data;
|
||||
CMPH_HASH h1_type = hash_get_type(data->hashes[0]);
|
||||
CMPH_HASH h2_type = hash_get_type(data->hashes[1]);
|
||||
|
||||
return (cmph_uint32)(sizeof(CMPH_ALGO) + hash_state_packed_size(h1_type) + hash_state_packed_size(h2_type) +
|
||||
2*sizeof(cmph_uint32) + sizeof(cmph_uint8) + sizeof(cmph_uint8)*data->n);
|
||||
}
|
||||
|
||||
/** cmph_uint8 bmz8_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint8 bmz8_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen)
|
||||
{
|
||||
register cmph_uint8 *h1_ptr = (cmph_uint8 *)packed_mphf;
|
||||
register CMPH_HASH h1_type = (CMPH_HASH)(*((cmph_uint32 *)h1_ptr));
|
||||
h1_ptr += 4;
|
||||
|
||||
register cmph_uint8 *h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
|
||||
register CMPH_HASH h2_type = (CMPH_HASH)(*((cmph_uint32 *)h2_ptr));
|
||||
h2_ptr += 4;
|
||||
|
||||
register cmph_uint8 *g_ptr = h2_ptr + hash_state_packed_size(h2_type);
|
||||
|
||||
register cmph_uint8 n = *g_ptr++;
|
||||
|
||||
register cmph_uint8 h1 = (cmph_uint8)(hash_packed(h1_ptr, h1_type, key, keylen) % n);
|
||||
register cmph_uint8 h2 = (cmph_uint8)(hash_packed(h2_ptr, h2_type, key, keylen) % n);
|
||||
DEBUGP("key: %s h1: %u h2: %u\n", key, h1, h2);
|
||||
if (h1 == h2 && ++h2 > n) h2 = 0;
|
||||
return (cmph_uint8)(g_ptr[h1] + g_ptr[h2]);
|
||||
}
|
42
cmph-2.0.2/src/bmz8.h
Normal file
42
cmph-2.0.2/src/bmz8.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef __CMPH_BMZ8_H__
|
||||
#define __CMPH_BMZ8_H__
|
||||
|
||||
#include "cmph.h"
|
||||
|
||||
typedef struct __bmz8_data_t bmz8_data_t;
|
||||
typedef struct __bmz8_config_data_t bmz8_config_data_t;
|
||||
|
||||
bmz8_config_data_t *bmz8_config_new(void);
|
||||
void bmz8_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
||||
void bmz8_config_destroy(cmph_config_t *mph);
|
||||
cmph_t *bmz8_new(cmph_config_t *mph, double c);
|
||||
|
||||
void bmz8_load(FILE *f, cmph_t *mphf);
|
||||
int bmz8_dump(cmph_t *mphf, FILE *f);
|
||||
void bmz8_destroy(cmph_t *mphf);
|
||||
cmph_uint8 bmz8_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** \fn void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void bmz8_pack(cmph_t *mphf, void *packed_mphf);
|
||||
|
||||
/** \fn cmph_uint32 bmz8_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 bmz8_packed_size(cmph_t *mphf);
|
||||
|
||||
/** cmph_uint8 bmz8_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint8 bmz8_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
#endif
|
25
cmph-2.0.2/src/bmz8_structs.h
Normal file
25
cmph-2.0.2/src/bmz8_structs.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef __CMPH_BMZ8_STRUCTS_H__
|
||||
#define __CMPH_BMZ8_STRUCTS_H__
|
||||
|
||||
#include "hash_state.h"
|
||||
|
||||
struct __bmz8_data_t
|
||||
{
|
||||
cmph_uint8 m; //edges (words) count
|
||||
cmph_uint8 n; //vertex count
|
||||
cmph_uint8 *g;
|
||||
hash_state_t **hashes;
|
||||
};
|
||||
|
||||
|
||||
struct __bmz8_config_data_t
|
||||
{
|
||||
CMPH_HASH hashfuncs[2];
|
||||
cmph_uint8 m; //edges (words) count
|
||||
cmph_uint8 n; //vertex count
|
||||
graph_t *graph;
|
||||
cmph_uint8 *g;
|
||||
hash_state_t **hashes;
|
||||
};
|
||||
|
||||
#endif
|
25
cmph-2.0.2/src/bmz_structs.h
Normal file
25
cmph-2.0.2/src/bmz_structs.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef __CMPH_BMZ_STRUCTS_H__
|
||||
#define __CMPH_BMZ_STRUCTS_H__
|
||||
|
||||
#include "hash_state.h"
|
||||
|
||||
struct __bmz_data_t
|
||||
{
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
cmph_uint32 *g;
|
||||
hash_state_t **hashes;
|
||||
};
|
||||
|
||||
|
||||
struct __bmz_config_data_t
|
||||
{
|
||||
CMPH_HASH hashfuncs[2];
|
||||
cmph_uint32 m; //edges (words) count
|
||||
cmph_uint32 n; //vertex count
|
||||
graph_t *graph;
|
||||
cmph_uint32 *g;
|
||||
hash_state_t **hashes;
|
||||
};
|
||||
|
||||
#endif
|
1017
cmph-2.0.2/src/brz.c
Executable file
1017
cmph-2.0.2/src/brz.c
Executable file
File diff suppressed because it is too large
Load Diff
62
cmph-2.0.2/src/brz.h
Normal file
62
cmph-2.0.2/src/brz.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef __CMPH_BRZ_H__
|
||||
#define __CMPH_BRZ_H__
|
||||
|
||||
#include "cmph.h"
|
||||
|
||||
/*
|
||||
* The BRZ algorithm has been built so to consume the bare minimum
|
||||
* amount of memory to generate the MPHFs. Thereby we decided
|
||||
* to dump the resulting MPHFs to disk while creating them. Thus,
|
||||
* to use the BRZ algorithm, one has to call brz_config_set_mphf_fd
|
||||
* before calling brz_new. Otherwise we will fail the MPHF creation.
|
||||
* One side effect of this design decision is that the resulting
|
||||
* MPHF cannot be used until its dumping process is finalized
|
||||
* by calling brz_dump and the caller must use brz_load before
|
||||
* any call to either one of the following functions is made:
|
||||
* brz_search
|
||||
* brz_pack
|
||||
* brz_packed_size
|
||||
* brz_search_packed
|
||||
*/
|
||||
typedef struct __brz_data_t brz_data_t;
|
||||
typedef struct __brz_config_data_t brz_config_data_t;
|
||||
|
||||
brz_config_data_t *brz_config_new(void);
|
||||
void brz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
|
||||
void brz_config_set_tmp_dir(cmph_config_t *mph, cmph_uint8 *tmp_dir);
|
||||
void brz_config_set_mphf_fd(cmph_config_t *mph, FILE *mphf_fd);
|
||||
void brz_config_set_b(cmph_config_t *mph, cmph_uint32 b);
|
||||
void brz_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo);
|
||||
void brz_config_set_memory_availability(cmph_config_t *mph, cmph_uint32 memory_availability);
|
||||
void brz_config_destroy(cmph_config_t *mph);
|
||||
cmph_t *brz_new(cmph_config_t *mph, double c);
|
||||
|
||||
void brz_load(FILE *f, cmph_t *mphf);
|
||||
int brz_dump(cmph_t *mphf, FILE *f);
|
||||
void brz_destroy(cmph_t *mphf);
|
||||
cmph_uint32 brz_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
/** \fn void brz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
* \brief Support the ability to pack a perfect hash function into a preallocated contiguous memory space pointed by packed_mphf.
|
||||
* \param mphf pointer to the resulting mphf
|
||||
* \param packed_mphf pointer to the contiguous memory area used to store the resulting mphf. The size of packed_mphf must be at least cmph_packed_size()
|
||||
*/
|
||||
void brz_pack(cmph_t *mphf, void *packed_mphf);
|
||||
|
||||
/** \fn cmph_uint32 brz_packed_size(cmph_t *mphf);
|
||||
* \brief Return the amount of space needed to pack mphf.
|
||||
* \param mphf pointer to a mphf
|
||||
* \return the size of the packed function or zero for failures
|
||||
*/
|
||||
cmph_uint32 brz_packed_size(cmph_t *mphf);
|
||||
|
||||
/** cmph_uint32 brz_search(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
* \brief Use the packed mphf to do a search.
|
||||
* \param packed_mphf pointer to the packed mphf
|
||||
* \param key key to be hashed
|
||||
* \param keylen key legth in bytes
|
||||
* \return The mphf value
|
||||
*/
|
||||
cmph_uint32 brz_search_packed(void *packed_mphf, const char *key, cmph_uint32 keylen);
|
||||
|
||||
#endif
|
39
cmph-2.0.2/src/brz_structs.h
Executable file
39
cmph-2.0.2/src/brz_structs.h
Executable file
@ -0,0 +1,39 @@
|
||||
#ifndef __CMPH_BRZ_STRUCTS_H__
|
||||
#define __CMPH_BRZ_STRUCTS_H__
|
||||
|
||||
#include "hash_state.h"
|
||||
|
||||
struct __brz_data_t
|
||||
{
|
||||
CMPH_ALGO algo; // CMPH algo for generating the MPHFs for the buckets (Just CMPH_FCH and CMPH_BMZ8)
|
||||
cmph_uint32 m; // edges (words) count
|
||||
double c; // constant c
|
||||
cmph_uint8 *size; // size[i] stores the number of edges represented by g[i][...].
|
||||
cmph_uint32 *offset; // offset[i] stores the sum: size[0] + size[1] + ... size[i-1].
|
||||
cmph_uint8 **g; // g function.
|
||||
cmph_uint32 k; // number of components
|
||||
hash_state_t **h1;
|
||||
hash_state_t **h2;
|
||||
hash_state_t * h0;
|
||||
};
|
||||
|
||||
struct __brz_config_data_t
|
||||
{
|
||||
CMPH_HASH hashfuncs[3];
|
||||
CMPH_ALGO algo; // CMPH algo for generating the MPHFs for the buckets (Just CMPH_FCH and CMPH_BMZ8)
|
||||
double c; // constant c
|
||||
cmph_uint32 m; // edges (words) count
|
||||
cmph_uint8 *size; // size[i] stores the number of edges represented by g[i][...].
|
||||
cmph_uint32 *offset; // offset[i] stores the sum: size[0] + size[1] + ... size[i-1].
|
||||
cmph_uint8 **g; // g function.
|
||||
cmph_uint8 b; // parameter b.
|
||||
cmph_uint32 k; // number of components
|
||||
hash_state_t **h1;
|
||||
hash_state_t **h2;
|
||||
hash_state_t * h0;
|
||||
cmph_uint32 memory_availability;
|
||||
cmph_uint8 * tmp_dir; // temporary directory
|
||||
FILE * mphf_fd; // mphf file
|
||||
};
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user