heroku-tokyotyrant 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. data/COPYING +504 -0
  2. data/README.rdoc +231 -0
  3. data/Rakefile +72 -0
  4. data/benchmarks/balancer.rb +101 -0
  5. data/benchmarks/bulk_db.rb +74 -0
  6. data/benchmarks/bulk_table.rb +87 -0
  7. data/benchmarks/db.rb +114 -0
  8. data/benchmarks/table.rb +161 -0
  9. data/ext/extconf.rb +43 -0
  10. data/ext/tokyo/bin/tcamgr +0 -0
  11. data/ext/tokyo/bin/tcamttest +0 -0
  12. data/ext/tokyo/bin/tcatest +0 -0
  13. data/ext/tokyo/bin/tcbmgr +0 -0
  14. data/ext/tokyo/bin/tcbmttest +0 -0
  15. data/ext/tokyo/bin/tcbtest +0 -0
  16. data/ext/tokyo/bin/tcfmgr +0 -0
  17. data/ext/tokyo/bin/tcfmttest +0 -0
  18. data/ext/tokyo/bin/tcftest +0 -0
  19. data/ext/tokyo/bin/tchmgr +0 -0
  20. data/ext/tokyo/bin/tchmttest +0 -0
  21. data/ext/tokyo/bin/tchtest +0 -0
  22. data/ext/tokyo/bin/tcrmgr +0 -0
  23. data/ext/tokyo/bin/tcrmttest +0 -0
  24. data/ext/tokyo/bin/tcrtest +0 -0
  25. data/ext/tokyo/bin/tctmgr +0 -0
  26. data/ext/tokyo/bin/tctmttest +0 -0
  27. data/ext/tokyo/bin/tcttest +0 -0
  28. data/ext/tokyo/bin/tcucodec +0 -0
  29. data/ext/tokyo/bin/tcumttest +0 -0
  30. data/ext/tokyo/bin/tcutest +0 -0
  31. data/ext/tokyo/bin/ttserver +0 -0
  32. data/ext/tokyo/bin/ttulmgr +0 -0
  33. data/ext/tokyo/bin/ttultest +0 -0
  34. data/ext/tokyo/include/tcadb.h +548 -0
  35. data/ext/tokyo/include/tcbdb.h +1101 -0
  36. data/ext/tokyo/include/tcfdb.h +858 -0
  37. data/ext/tokyo/include/tchdb.h +871 -0
  38. data/ext/tokyo/include/tcrdb.h +801 -0
  39. data/ext/tokyo/include/tctdb.h +1086 -0
  40. data/ext/tokyo/include/tculog.h +392 -0
  41. data/ext/tokyo/include/tcutil.h +4184 -0
  42. data/ext/tokyo/include/ttutil.h +494 -0
  43. data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
  44. data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
  45. data/ext/tokyo/lib/libtokyocabinet.a +0 -0
  46. data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
  47. data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
  48. data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
  49. data/ext/tokyo/lib/libtokyotyrant.a +0 -0
  50. data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
  51. data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
  52. data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
  53. data/ext/tokyo/lib/ttskeldir.bundle +0 -0
  54. data/ext/tokyo/lib/ttskelmock.bundle +0 -0
  55. data/ext/tokyo/lib/ttskelnull.bundle +0 -0
  56. data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
  57. data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
  58. data/ext/tokyo/sbin/ttservctl +163 -0
  59. data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
  60. data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
  61. data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
  62. data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
  63. data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
  64. data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
  65. data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
  66. data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
  67. data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
  68. data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
  69. data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
  70. data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
  71. data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
  72. data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
  73. data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
  74. data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
  75. data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
  76. data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
  77. data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
  78. data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
  79. data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
  80. data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
  81. data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
  82. data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
  83. data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
  84. data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
  85. data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
  86. data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
  87. data/ext/tokyo/share/man/man3/tclist.3 +1 -0
  88. data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
  89. data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
  90. data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
  91. data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
  92. data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
  93. data/ext/tokyo/share/man/man3/tctree.3 +1 -0
  94. data/ext/tokyo/share/man/man3/tculog.3 +15 -0
  95. data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
  96. data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
  97. data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
  98. data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
  99. data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
  100. data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
  101. data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
  102. data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
  103. data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
  104. data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
  105. data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
  106. data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
  107. data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
  108. data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
  109. data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
  110. data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
  111. data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
  112. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
  113. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
  114. data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
  115. data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
  116. data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
  117. data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
  118. data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
  119. data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
  120. data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
  121. data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
  122. data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
  123. data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
  124. data/ext/tokyo_tyrant.c +147 -0
  125. data/ext/tokyo_tyrant.h +48 -0
  126. data/ext/tokyo_tyrant_db.c +227 -0
  127. data/ext/tokyo_tyrant_db.h +8 -0
  128. data/ext/tokyo_tyrant_module.c +453 -0
  129. data/ext/tokyo_tyrant_module.h +10 -0
  130. data/ext/tokyo_tyrant_query.c +226 -0
  131. data/ext/tokyo_tyrant_query.h +9 -0
  132. data/ext/tokyo_tyrant_table.c +319 -0
  133. data/ext/tokyo_tyrant_table.h +8 -0
  134. data/ext/tokyocabinet-1.4.41/COPYING +504 -0
  135. data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
  136. data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
  137. data/ext/tokyocabinet-1.4.41/README +38 -0
  138. data/ext/tokyocabinet-1.4.41/THANKS +12 -0
  139. data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
  140. data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
  141. data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
  142. data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
  143. data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
  144. data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
  145. data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
  146. data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
  147. data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
  148. data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
  149. data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
  150. data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
  151. data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
  152. data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
  153. data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
  154. data/ext/tokyocabinet-1.4.41/configure +7402 -0
  155. data/ext/tokyocabinet-1.4.41/configure.in +362 -0
  156. data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
  157. data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
  158. data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
  159. data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
  160. data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
  161. data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
  162. data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
  163. data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
  164. data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
  165. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
  166. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
  167. data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
  168. data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
  169. data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
  170. data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
  171. data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
  172. data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
  173. data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
  174. data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
  175. data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
  176. data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
  177. data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
  178. data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
  179. data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
  180. data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
  181. data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
  182. data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
  183. data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
  184. data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
  185. data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
  186. data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
  187. data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
  188. data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
  189. data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
  190. data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
  191. data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
  192. data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
  193. data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
  194. data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
  195. data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
  196. data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
  197. data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
  198. data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
  199. data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
  200. data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
  201. data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
  202. data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
  203. data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
  204. data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
  205. data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
  206. data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
  207. data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
  208. data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
  209. data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
  210. data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
  211. data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
  212. data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
  213. data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
  214. data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
  215. data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
  216. data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
  217. data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
  218. data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
  219. data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
  220. data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
  221. data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
  222. data/ext/tokyocabinet-1.4.41/md5.c +381 -0
  223. data/ext/tokyocabinet-1.4.41/md5.h +101 -0
  224. data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
  225. data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
  226. data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
  227. data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
  228. data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
  229. data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
  230. data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
  231. data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
  232. data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
  233. data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
  234. data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
  235. data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
  236. data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
  237. data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
  238. data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
  239. data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
  240. data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
  241. data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
  242. data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
  243. data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
  244. data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
  245. data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
  246. data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
  247. data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
  248. data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
  249. data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
  250. data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
  251. data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
  252. data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
  253. data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
  254. data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
  255. data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
  256. data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
  257. data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
  258. data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
  259. data/ext/tokyotyrant-1.1.39/COPYING +504 -0
  260. data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
  261. data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
  262. data/ext/tokyotyrant-1.1.39/README +38 -0
  263. data/ext/tokyotyrant-1.1.39/THANKS +15 -0
  264. data/ext/tokyotyrant-1.1.39/configure +6979 -0
  265. data/ext/tokyotyrant-1.1.39/configure.in +300 -0
  266. data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
  267. data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
  268. data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
  269. data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
  270. data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
  271. data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
  272. data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
  273. data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
  274. data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
  275. data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
  276. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
  277. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
  278. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
  279. data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
  280. data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
  281. data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
  282. data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
  283. data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
  284. data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
  285. data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
  286. data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
  287. data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
  288. data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
  289. data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
  290. data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
  291. data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
  292. data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
  293. data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
  294. data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
  295. data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
  296. data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
  297. data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
  298. data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
  299. data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
  300. data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
  301. data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
  302. data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
  303. data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
  304. data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
  305. data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
  306. data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
  307. data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
  308. data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
  309. data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
  310. data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
  311. data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
  312. data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
  313. data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
  314. data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
  315. data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
  316. data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
  317. data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
  318. data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
  319. data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
  320. data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
  321. data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
  322. data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
  323. data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
  324. data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
  325. data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
  326. data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
  327. data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
  328. data/lib/tokyo_tyrant/balancer.rb +189 -0
  329. data/spec/ext.lua +4 -0
  330. data/spec/plu_db.rb +538 -0
  331. data/spec/spec.rb +1 -0
  332. data/spec/spec_base.rb +17 -0
  333. data/spec/start_tyrants.sh +36 -0
  334. data/spec/stop_tyrants.sh +9 -0
  335. data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
  336. data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
  337. data/spec/tokyo_tyrant_query_spec.rb +159 -0
  338. data/spec/tokyo_tyrant_spec.rb +254 -0
  339. data/spec/tokyo_tyrant_table_spec.rb +301 -0
  340. metadata +402 -0
@@ -0,0 +1 @@
1
+ .so man3/tcutil.3
@@ -0,0 +1,15 @@
1
+ .TH "TCULOG" 3 "2009-08-31" "Man Page" "Tokyo Tyrant"
2
+
3
+ .SH NAME
4
+ tculog \- the update log API
5
+
6
+ .SH DESCRIPTION
7
+ .PP
8
+ hey.
9
+
10
+ .SH SEE ALSO
11
+ .PP
12
+ .BR ttserver (1),
13
+ .BR ttultest (1),
14
+ .BR ttulmgr (1),
15
+ .BR ttutil (3)
@@ -0,0 +1,4518 @@
1
+ .TH "TCUTIL" 3 "2009-10-13" "Man Page" "Tokyo Cabinet"
2
+
3
+ .SH NAME
4
+ tcutil \- the utility API
5
+
6
+ .SH DESCRIPTION
7
+ .PP
8
+ The utility API is a set of routines to handle records on memory easily. Especially, extensible string, array list, hash map, and ordered tree are useful.
9
+ .PP
10
+ To use the utility API, include `\fBtcutil.h\fR' and related standard header files. Usually, write the following description near the front of a source file.
11
+ .PP
12
+ .RS
13
+ .br
14
+ \fB#include <tcutil.h>\fR
15
+ .br
16
+ \fB#include <stdlib.h>\fR
17
+ .br
18
+ \fB#include <time.h>\fR
19
+ .br
20
+ \fB#include <stdbool.h>\fR
21
+ .br
22
+ \fB#include <stdint.h>\fR
23
+ .RE
24
+ .PP
25
+ Objects whose type is pointer to `\fBTCXSTR\fR' are used for extensible string. An extensible string object is created with the function `\fBtcxstrnew\fR' and is deleted with the function `\fBtcxstrdel\fR'. Objects whose type is pointer to `\fBTCLIST\fR' are used for array list. A list object is created with the function `\fBtclistnew\fR' and is deleted with the function `\fBtclistdel\fR'. Objects whose type is pointer to `\fBTCMAP\fR' are used for hash map. A map object is created with the function `\fBtcmapnew\fR' and is deleted with the function `\fBtcmapdel\fR'. Objects whose type is pointer to `\fBTCTREE\fR' are used for ordered tree. A tree object is created with the function `\fBtctreenew\fR' and is deleted with the function `\fBtctreedel\fR'. To avoid memory leak, it is important to delete every object when it is no longer in use.
26
+
27
+ .SH API OF BASIC UTILITIES
28
+ .PP
29
+ The constant `tcversion' is the string containing the version information.
30
+ .PP
31
+ .RS
32
+ .br
33
+ \fBextern const char *tcversion;\fR
34
+ .RE
35
+ .PP
36
+ The variable `tcfatalfunc' is the pointer to the call back function for handling a fatal error.
37
+ .PP
38
+ .RS
39
+ .br
40
+ \fBextern void (*tcfatalfunc)(const char *);\fR
41
+ .RS
42
+ The argument specifies the error message.
43
+ .RE
44
+ .RS
45
+ The initial value of this variable is `NULL'. If the value is `NULL', the default function is called when a fatal error occurs. A fatal error occurs when memory allocation is failed.
46
+ .RE
47
+ .RE
48
+ .PP
49
+ The function `tcmalloc' is used in order to allocate a region on memory.
50
+ .PP
51
+ .RS
52
+ .br
53
+ \fBvoid *tcmalloc(size_t \fIsize\fB);\fR
54
+ .RS
55
+ `\fIsize\fR' specifies the size of the region.
56
+ .RE
57
+ .RS
58
+ The return value is the pointer to the allocated region.
59
+ .RE
60
+ .RS
61
+ This function handles failure of memory allocation implicitly. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
62
+ .RE
63
+ .RE
64
+ .PP
65
+ The function `tccalloc' is used in order to allocate a nullified region on memory.
66
+ .PP
67
+ .RS
68
+ .br
69
+ \fBvoid *tccalloc(size_t \fInmemb\fB, size_t \fIsize\fB);\fR
70
+ .RS
71
+ `\fInmemb\fR' specifies the number of elements.
72
+ .RE
73
+ .RS
74
+ `\fIsize\fR' specifies the size of each element.
75
+ .RE
76
+ .RS
77
+ The return value is the pointer to the allocated nullified region.
78
+ .RE
79
+ .RS
80
+ This function handles failure of memory allocation implicitly. Because the region of the return value is allocated with the `calloc' call, it should be released with the `free' call when it is no longer in use.
81
+ .RE
82
+ .RE
83
+ .PP
84
+ The function `tcrealloc' is used in order to re\-allocate a region on memory.
85
+ .PP
86
+ .RS
87
+ .br
88
+ \fBvoid *tcrealloc(void *\fIptr\fB, size_t \fIsize\fB);\fR
89
+ .RS
90
+ `\fIptr\fR' specifies the pointer to the region.
91
+ .RE
92
+ .RS
93
+ `\fIsize\fR' specifies the size of the region.
94
+ .RE
95
+ .RS
96
+ The return value is the pointer to the re\-allocated region.
97
+ .RE
98
+ .RS
99
+ This function handles failure of memory allocation implicitly. Because the region of the return value is allocated with the `realloc' call, it should be released with the `free' call when it is no longer in use.
100
+ .RE
101
+ .RE
102
+ .PP
103
+ The function `tcmemdup' is used in order to duplicate a region on memory.
104
+ .PP
105
+ .RS
106
+ .br
107
+ \fBvoid *tcmemdup(const void *\fIptr\fB, size_t \fIsize\fB);\fR
108
+ .RS
109
+ `\fIptr\fR' specifies the pointer to the region.
110
+ .RE
111
+ .RS
112
+ `\fIsize\fR' specifies the size of the region.
113
+ .RE
114
+ .RS
115
+ The return value is the pointer to the allocated region of the duplicate.
116
+ .RE
117
+ .RS
118
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
119
+ .RE
120
+ .RE
121
+ .PP
122
+ The function `tcstrdup' is used in order to duplicate a string on memory.
123
+ .PP
124
+ .RS
125
+ .br
126
+ \fBchar *tcstrdup(const void *\fIstr\fB);\fR
127
+ .RS
128
+ `\fIstr\fR' specifies the string.
129
+ .RE
130
+ .RS
131
+ The return value is the allocated string equivalent to the specified string.
132
+ .RE
133
+ .RS
134
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
135
+ .RE
136
+ .RE
137
+ .PP
138
+ The function `tcfree' is used in order to free a region on memory.
139
+ .PP
140
+ .RS
141
+ .br
142
+ \fBvoid tcfree(void *\fIptr\fB);\fR
143
+ .RS
144
+ `\fIptr\fR' specifies the pointer to the region. If it is `NULL', this function has no effect.
145
+ .RE
146
+ .RS
147
+ Although this function is just a wrapper of `free' call, this is useful in applications using another package of the `malloc' series.
148
+ .RE
149
+ .RE
150
+
151
+ .SH API OF EXTENSIBLE STRING
152
+ .PP
153
+ The function `tcxstrnew' is used in order to create an extensible string object.
154
+ .PP
155
+ .RS
156
+ .br
157
+ \fBTCXSTR *tcxstrnew(void);\fR
158
+ .RS
159
+ The return value is the new extensible string object.
160
+ .RE
161
+ .RE
162
+ .PP
163
+ The function `tcxstrnew2' is used in order to create an extensible string object from a character string.
164
+ .PP
165
+ .RS
166
+ .br
167
+ \fBTCXSTR *tcxstrnew2(const char *\fIstr\fB);\fR
168
+ .RS
169
+ `\fIstr\fR' specifies the string of the initial content.
170
+ .RE
171
+ .RS
172
+ The return value is the new extensible string object containing the specified string.
173
+ .RE
174
+ .RE
175
+ .PP
176
+ The function `tcxstrnew3' is used in order to create an extensible string object with the initial allocation size.
177
+ .PP
178
+ .RS
179
+ .br
180
+ \fBTCXSTR *tcxstrnew3(int \fIasiz\fB);\fR
181
+ .RS
182
+ `\fIasiz\fR' specifies the initial allocation size.
183
+ .RE
184
+ .RS
185
+ The return value is the new extensible string object.
186
+ .RE
187
+ .RE
188
+ .PP
189
+ The function `tcxstrdup' is used in order to copy an extensible string object.
190
+ .PP
191
+ .RS
192
+ .br
193
+ \fBTCXSTR *tcxstrdup(const TCXSTR *\fIxstr\fB);\fR
194
+ .RS
195
+ `\fIxstr\fR' specifies the extensible string object.
196
+ .RE
197
+ .RS
198
+ The return value is the new extensible string object equivalent to the specified object.
199
+ .RE
200
+ .RE
201
+ .PP
202
+ The function `tcxstrdel' is used in order to delete an extensible string object.
203
+ .PP
204
+ .RS
205
+ .br
206
+ \fBvoid tcxstrdel(TCXSTR *\fIxstr\fB);\fR
207
+ .RS
208
+ `\fIxstr\fR' specifies the extensible string object.
209
+ .RE
210
+ .RS
211
+ Note that the deleted object and its derivatives can not be used anymore.
212
+ .RE
213
+ .RE
214
+ .PP
215
+ The function `tcxstrcat' is used in order to concatenate a region to the end of an extensible string object.
216
+ .PP
217
+ .RS
218
+ .br
219
+ \fBvoid tcxstrcat(TCXSTR *\fIxstr\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
220
+ .RS
221
+ `\fIxstr\fR' specifies the extensible string object.
222
+ .RE
223
+ .RS
224
+ `\fIptr\fR' specifies the pointer to the region to be appended.
225
+ .RE
226
+ .RS
227
+ `\fIsize\fR' specifies the size of the region.
228
+ .RE
229
+ .RE
230
+ .PP
231
+ The function `tcxstrcat2' is used in order to concatenate a character string to the end of an extensible string object.
232
+ .PP
233
+ .RS
234
+ .br
235
+ \fBvoid tcxstrcat2(TCXSTR *\fIxstr\fB, const char *\fIstr\fB);\fR
236
+ .RS
237
+ `\fIxstr\fR' specifies the extensible string object.
238
+ .RE
239
+ .RS
240
+ `\fIstr\fR' specifies the string to be appended.
241
+ .RE
242
+ .RE
243
+ .PP
244
+ The function `tcxstrptr' is used in order to get the pointer of the region of an extensible string object.
245
+ .PP
246
+ .RS
247
+ .br
248
+ \fBconst void *tcxstrptr(const TCXSTR *\fIxstr\fB);\fR
249
+ .RS
250
+ `\fIxstr\fR' specifies the extensible string object.
251
+ .RE
252
+ .RS
253
+ The return value is the pointer of the region of the object.
254
+ .RE
255
+ .RS
256
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.
257
+ .RE
258
+ .RE
259
+ .PP
260
+ The function `tcxstrsize' is used in order to get the size of the region of an extensible string object.
261
+ .PP
262
+ .RS
263
+ .br
264
+ \fBint tcxstrsize(const TCXSTR *\fIxstr\fB);\fR
265
+ .RS
266
+ `\fIxstr\fR' specifies the extensible string object.
267
+ .RE
268
+ .RS
269
+ The return value is the size of the region of the object.
270
+ .RE
271
+ .RE
272
+ .PP
273
+ The function `tcxstrclear' is used in order to clear an extensible string object.
274
+ .PP
275
+ .RS
276
+ .br
277
+ \fBvoid tcxstrclear(TCXSTR *\fIxstr\fB);\fR
278
+ .RS
279
+ `\fIxstr\fR' specifies the extensible string object.
280
+ .RE
281
+ .RS
282
+ The internal buffer of the object is cleared and the size is set zero.
283
+ .RE
284
+ .RE
285
+ .PP
286
+ The function `tcxstrprintf' is used in order to perform formatted output into an extensible string object.
287
+ .PP
288
+ .RS
289
+ .br
290
+ \fBvoid tcxstrprintf(TCXSTR *\fIxstr\fB, const char *\fIformat\fB, ...);\fR
291
+ .RS
292
+ `\fIxstr\fR' specifies the extensible string object.
293
+ .RE
294
+ .RS
295
+ `\fIformat\fR' specifies the printf\-like format string. The conversion character `%' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', `@', `?', `b', and `%'. `@' works as with `s' but escapes meta characters of XML. `?' works as with `s' but escapes meta characters of URL. `b' converts an integer to the string as binary numbers. The other conversion character work as with each original.
296
+ .RE
297
+ .RS
298
+ The other arguments are used according to the format string.
299
+ .RE
300
+ .RE
301
+ .PP
302
+ The function `tcsprintf' is used in order to allocate a formatted string on memory.
303
+ .PP
304
+ .RS
305
+ .br
306
+ \fBchar *tcsprintf(const char *\fIformat\fB, ...);\fR
307
+ .RS
308
+ `\fIformat\fR' specifies the printf\-like format string. The conversion character `%' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', `@', `?', `b', and `%'. `@' works as with `s' but escapes meta characters of XML. `?' works as with `s' but escapes meta characters of URL. `b' converts an integer to the string as binary numbers. The other conversion character work as with each original.
309
+ .RE
310
+ .RS
311
+ The other arguments are used according to the format string.
312
+ .RE
313
+ .RS
314
+ The return value is the pointer to the region of the result string.
315
+ .RE
316
+ .RS
317
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
318
+ .RE
319
+ .RE
320
+
321
+ .SH API OF ARRAY LIST
322
+ .PP
323
+ The function `tclistnew' is used in order to create a list object.
324
+ .PP
325
+ .RS
326
+ .br
327
+ \fBTCLIST *tclistnew(void);\fR
328
+ .RS
329
+ The return value is the new list object.
330
+ .RE
331
+ .RE
332
+ .PP
333
+ The function `tclistnew2' is used in order to create a list object with expecting the number of elements.
334
+ .PP
335
+ .RS
336
+ .br
337
+ \fBTCLIST *tclistnew2(int \fIanum\fB);\fR
338
+ .RS
339
+ `\fIanum\fR' specifies the number of elements expected to be stored in the list.
340
+ .RE
341
+ .RS
342
+ The return value is the new list object.
343
+ .RE
344
+ .RE
345
+ .PP
346
+ The function `tclistnew3' is used in order to create a list object with initial string elements.
347
+ .PP
348
+ .RS
349
+ .br
350
+ \fBTCLIST *tclistnew3(const char *\fIstr\fB, ...);\fR
351
+ .RS
352
+ `\fIstr\fR' specifies the string of the first element.
353
+ .RE
354
+ .RS
355
+ The other arguments are other elements. They should be trailed by a `NULL' argument.
356
+ .RE
357
+ .RS
358
+ The return value is the new list object.
359
+ .RE
360
+ .RE
361
+ .PP
362
+ The function `tclistdup' is used in order to copy a list object.
363
+ .PP
364
+ .RS
365
+ .br
366
+ \fBTCLIST *tclistdup(const TCLIST *\fIlist\fB);\fR
367
+ .RS
368
+ `\fIlist\fR' specifies the list object.
369
+ .RE
370
+ .RS
371
+ The return value is the new list object equivalent to the specified object.
372
+ .RE
373
+ .RE
374
+ .PP
375
+ The function `tclistdel' is used in order to delete a list object.
376
+ .PP
377
+ .RS
378
+ .br
379
+ \fBvoid tclistdel(TCLIST *\fIlist\fB);\fR
380
+ .RS
381
+ `\fIlist\fR' specifies the list object.
382
+ .RE
383
+ .RS
384
+ Note that the deleted object and its derivatives can not be used anymore.
385
+ .RE
386
+ .RE
387
+ .PP
388
+ The function `tclistnum' is used in order to get the number of elements of a list object.
389
+ .PP
390
+ .RS
391
+ .br
392
+ \fBint tclistnum(const TCLIST *\fIlist\fB);\fR
393
+ .RS
394
+ `\fIlist\fR' specifies the list object.
395
+ .RE
396
+ .RS
397
+ The return value is the number of elements of the list.
398
+ .RE
399
+ .RE
400
+ .PP
401
+ The function `tclistval' is used in order to get the pointer to the region of an element of a list object.
402
+ .PP
403
+ .RS
404
+ .br
405
+ \fBconst void *tclistval(const TCLIST *\fIlist\fB, int \fIindex\fB, int *\fIsp\fB);\fR
406
+ .RS
407
+ `\fIlist\fR' specifies the list object.
408
+ .RE
409
+ .RS
410
+ `\fIindex\fR' specifies the index of the element.
411
+ .RE
412
+ .RS
413
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
414
+ .RE
415
+ .RS
416
+ The return value is the pointer to the region of the value.
417
+ .RE
418
+ .RS
419
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. If `index' is equal to or more than the number of elements, the return value is `NULL'.
420
+ .RE
421
+ .RE
422
+ .PP
423
+ The function `tclistval2' is used in order to get the string of an element of a list object.
424
+ .PP
425
+ .RS
426
+ .br
427
+ \fBconst char *tclistval2(const TCLIST *\fIlist\fB, int \fIindex\fB);\fR
428
+ .RS
429
+ `\fIlist\fR' specifies the list object.
430
+ .RE
431
+ .RS
432
+ `\fIindex\fR' specifies the index of the element.
433
+ .RE
434
+ .RS
435
+ The return value is the string of the value.
436
+ .RE
437
+ .RS
438
+ If `index' is equal to or more than the number of elements, the return value is `NULL'.
439
+ .RE
440
+ .RE
441
+ .PP
442
+ The function `tclistpush' is used in order to add an element at the end of a list object.
443
+ .PP
444
+ .RS
445
+ .br
446
+ \fBvoid tclistpush(TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
447
+ .RS
448
+ `\fIlist\fR' specifies the list object.
449
+ .RE
450
+ .RS
451
+ `\fIptr\fR' specifies the pointer to the region of the new element.
452
+ .RE
453
+ .RS
454
+ `\fIsize\fR' specifies the size of the region.
455
+ .RE
456
+ .RE
457
+ .PP
458
+ The function `tclistpush2' is used in order to add a string element at the end of a list object.
459
+ .PP
460
+ .RS
461
+ .br
462
+ \fBvoid tclistpush2(TCLIST *\fIlist\fB, const char *\fIstr\fB);\fR
463
+ .RS
464
+ `\fIlist\fR' specifies the list object.
465
+ .RE
466
+ .RS
467
+ `\fIstr\fR' specifies the string of the new element.
468
+ .RE
469
+ .RE
470
+ .PP
471
+ The function `tclistpop' is used in order to remove an element of the end of a list object.
472
+ .PP
473
+ .RS
474
+ .br
475
+ \fBvoid *tclistpop(TCLIST *\fIlist\fB, int *\fIsp\fB);\fR
476
+ .RS
477
+ `\fIlist\fR' specifies the list object.
478
+ .RE
479
+ .RS
480
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
481
+ .RE
482
+ .RS
483
+ The return value is the pointer to the region of the removed element.
484
+ .RE
485
+ .RS
486
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'.
487
+ .RE
488
+ .RE
489
+ .PP
490
+ The function `tclistpop2' is used in order to remove a string element of the end of a list object.
491
+ .PP
492
+ .RS
493
+ .br
494
+ \fBchar *tclistpop2(TCLIST *\fIlist\fB);\fR
495
+ .RS
496
+ `\fIlist\fR' specifies the list object.
497
+ .RE
498
+ .RS
499
+ The return value is the string of the removed element.
500
+ .RE
501
+ .RS
502
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'.
503
+ .RE
504
+ .RE
505
+ .PP
506
+ The function `tclistunshift' is used in order to add an element at the top of a list object.
507
+ .PP
508
+ .RS
509
+ .br
510
+ \fBvoid tclistunshift(TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
511
+ .RS
512
+ `\fIlist\fR' specifies the list object.
513
+ .RE
514
+ .RS
515
+ `\fIptr\fR' specifies the pointer to the region of the new element.
516
+ .RE
517
+ .RS
518
+ `\fIsize\fR' specifies the size of the region.
519
+ .RE
520
+ .RE
521
+ .PP
522
+ The function `tclistunshift2' is used in order to add a string element at the top of a list object.
523
+ .PP
524
+ .RS
525
+ .br
526
+ \fBvoid tclistunshift2(TCLIST *\fIlist\fB, const char *\fIstr\fB);\fR
527
+ .RS
528
+ `\fIlist\fR' specifies the list object.
529
+ .RE
530
+ .RS
531
+ `\fIstr\fR' specifies the string of the new element.
532
+ .RE
533
+ .RE
534
+ .PP
535
+ The function `tclistshift' is used in order to remove an element of the top of a list object.
536
+ .PP
537
+ .RS
538
+ .br
539
+ \fBvoid *tclistshift(TCLIST *\fIlist\fB, int *\fIsp\fB);\fR
540
+ .RS
541
+ `\fIlist\fR' specifies the list object.
542
+ .RE
543
+ .RS
544
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
545
+ .RE
546
+ .RS
547
+ The return value is the pointer to the region of the removed element.
548
+ .RE
549
+ .RS
550
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'.
551
+ .RE
552
+ .RE
553
+ .PP
554
+ The function `tclistshift2' is used in order to remove a string element of the top of a list object.
555
+ .PP
556
+ .RS
557
+ .br
558
+ \fBchar *tclistshift2(TCLIST *\fIlist\fB);\fR
559
+ .RS
560
+ `\fIlist\fR' specifies the list object.
561
+ .RE
562
+ .RS
563
+ The return value is the string of the removed element.
564
+ .RE
565
+ .RS
566
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'.
567
+ .RE
568
+ .RE
569
+ .PP
570
+ The function `tclistinsert' is used in order to add an element at the specified location of a list object.
571
+ .PP
572
+ .RS
573
+ .br
574
+ \fBvoid tclistinsert(TCLIST *\fIlist\fB, int \fIindex\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
575
+ .RS
576
+ `\fIlist\fR' specifies the list object.
577
+ .RE
578
+ .RS
579
+ `\fIindex\fR' specifies the index of the new element.
580
+ .RE
581
+ .RS
582
+ `\fIptr\fR' specifies the pointer to the region of the new element.
583
+ .RE
584
+ .RS
585
+ `\fIsize\fR' specifies the size of the region.
586
+ .RE
587
+ .RS
588
+ If `index' is equal to or more than the number of elements, this function has no effect.
589
+ .RE
590
+ .RE
591
+ .PP
592
+ The function `tclistinsert2' is used in order to add a string element at the specified location of a list object.
593
+ .PP
594
+ .RS
595
+ .br
596
+ \fBvoid tclistinsert2(TCLIST *\fIlist\fB, int \fIindex\fB, const char *\fIstr\fB);\fR
597
+ .RS
598
+ `\fIlist\fR' specifies the list object.
599
+ .RE
600
+ .RS
601
+ `\fIindex\fR' specifies the index of the new element.
602
+ .RE
603
+ .RS
604
+ `\fIstr\fR' specifies the string of the new element.
605
+ .RE
606
+ .RS
607
+ If `index' is equal to or more than the number of elements, this function has no effect.
608
+ .RE
609
+ .RE
610
+ .PP
611
+ The function `tclistremove' is used in order to remove an element at the specified location of a list object.
612
+ .PP
613
+ .RS
614
+ .br
615
+ \fBvoid *tclistremove(TCLIST *\fIlist\fB, int \fIindex\fB, int *\fIsp\fB);\fR
616
+ .RS
617
+ `\fIlist\fR' specifies the list object.
618
+ .RE
619
+ .RS
620
+ `\fIindex\fR' specifies the index of the element to be removed.
621
+ .RE
622
+ .RS
623
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
624
+ .RE
625
+ .RS
626
+ The return value is the pointer to the region of the removed element.
627
+ .RE
628
+ .RS
629
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If `index' is equal to or more than the number of elements, no element is removed and the return value is `NULL'.
630
+ .RE
631
+ .RE
632
+ .PP
633
+ The function `tclistremove2' is used in order to remove a string element at the specified location of a list object.
634
+ .PP
635
+ .RS
636
+ .br
637
+ \fBchar *tclistremove2(TCLIST *\fIlist\fB, int \fIindex\fB);\fR
638
+ .RS
639
+ `\fIlist\fR' specifies the list object.
640
+ .RE
641
+ .RS
642
+ `\fIindex\fR' specifies the index of the element to be removed.
643
+ .RE
644
+ .RS
645
+ The return value is the string of the removed element.
646
+ .RE
647
+ .RS
648
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If `index' is equal to or more than the number of elements, no element is removed and the return value is `NULL'.
649
+ .RE
650
+ .RE
651
+ .PP
652
+ The function `tclistover' is used in order to overwrite an element at the specified location of a list object.
653
+ .PP
654
+ .RS
655
+ .br
656
+ \fBvoid tclistover(TCLIST *\fIlist\fB, int \fIindex\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
657
+ .RS
658
+ `\fIlist\fR' specifies the list object.
659
+ .RE
660
+ .RS
661
+ `\fIindex\fR' specifies the index of the element to be overwritten.
662
+ .RE
663
+ .RS
664
+ `\fIptr\fR' specifies the pointer to the region of the new content.
665
+ .RE
666
+ .RS
667
+ `\fIsize\fR' specifies the size of the new content.
668
+ .RE
669
+ .RS
670
+ If `index' is equal to or more than the number of elements, this function has no effect.
671
+ .RE
672
+ .RE
673
+ .PP
674
+ The function `tclistover2' is used in order to overwrite a string element at the specified location of a list object.
675
+ .PP
676
+ .RS
677
+ .br
678
+ \fBvoid tclistover2(TCLIST *\fIlist\fB, int \fIindex\fB, const char *\fIstr\fB);\fR
679
+ .RS
680
+ `\fIlist\fR' specifies the list object.
681
+ .RE
682
+ .RS
683
+ `\fIindex\fR' specifies the index of the element to be overwritten.
684
+ .RE
685
+ .RS
686
+ `\fIstr\fR' specifies the string of the new content.
687
+ .RE
688
+ .RS
689
+ If `index' is equal to or more than the number of elements, this function has no effect.
690
+ .RE
691
+ .RE
692
+ .PP
693
+ The function `tclistsort' is used in order to sort elements of a list object in lexical order.
694
+ .PP
695
+ .RS
696
+ .br
697
+ \fBvoid tclistsort(TCLIST *\fIlist\fB);\fR
698
+ .RS
699
+ `\fIlist\fR' specifies the list object.
700
+ .RE
701
+ .RE
702
+ .PP
703
+ The function `tclistlsearch' is used in order to search a list object for an element using liner search.
704
+ .PP
705
+ .RS
706
+ .br
707
+ \fBint tclistlsearch(const TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
708
+ .RS
709
+ `\fIlist\fR' specifies the list object.
710
+ .RE
711
+ .RS
712
+ `\fIptr\fR' specifies the pointer to the region of the key.
713
+ .RE
714
+ .RS
715
+ `\fIsize\fR' specifies the size of the region.
716
+ .RE
717
+ .RS
718
+ The return value is the index of a corresponding element or \-1 if there is no corresponding element.
719
+ .RE
720
+ .RS
721
+ If two or more elements correspond, the former returns.
722
+ .RE
723
+ .RE
724
+ .PP
725
+ The function `tclistbsearch' is used in order to search a list object for an element using binary search.
726
+ .PP
727
+ .RS
728
+ .br
729
+ \fBint tclistbsearch(const TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
730
+ .RS
731
+ `\fIlist\fR' specifies the list object. It should be sorted in lexical order.
732
+ .RE
733
+ .RS
734
+ `\fIptr\fR' specifies the pointer to the region of the key.
735
+ .RE
736
+ .RS
737
+ `\fIsize\fR' specifies the size of the region.
738
+ .RE
739
+ .RS
740
+ The return value is the index of a corresponding element or \-1 if there is no corresponding element.
741
+ .RE
742
+ .RS
743
+ If two or more elements correspond, which returns is not defined.
744
+ .RE
745
+ .RE
746
+ .PP
747
+ The function `tclistclear' is used in order to clear a list object.
748
+ .PP
749
+ .RS
750
+ .br
751
+ \fBvoid tclistclear(TCLIST *\fIlist\fB);\fR
752
+ .RS
753
+ `\fIlist\fR' specifies the list object.
754
+ .RE
755
+ .RS
756
+ All elements are removed.
757
+ .RE
758
+ .RE
759
+ .PP
760
+ The function `tclistdump' is used in order to serialize a list object into a byte array.
761
+ .PP
762
+ .RS
763
+ .br
764
+ \fBvoid *tclistdump(const TCLIST *\fIlist\fB, int *\fIsp\fB);\fR
765
+ .RS
766
+ `\fIlist\fR' specifies the list object.
767
+ .RE
768
+ .RS
769
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
770
+ .RE
771
+ .RS
772
+ The return value is the pointer to the region of the result serial region.
773
+ .RE
774
+ .RS
775
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
776
+ .RE
777
+ .RE
778
+ .PP
779
+ The function `tclistload' is used in order to create a list object from a serialized byte array.
780
+ .PP
781
+ .RS
782
+ .br
783
+ \fBTCLIST *tclistload(const void *\fIptr\fB, int \fIsize\fB);\fR
784
+ .RS
785
+ `\fIptr\fR' specifies the pointer to the region of serialized byte array.
786
+ .RE
787
+ .RS
788
+ `\fIsize\fR' specifies the size of the region.
789
+ .RE
790
+ .RS
791
+ The return value is a new list object.
792
+ .RE
793
+ .RS
794
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
795
+ .RE
796
+ .RE
797
+
798
+ .SH API OF HASH MAP
799
+ .PP
800
+ The function `tcmapnew' is used in order to create a map object.
801
+ .PP
802
+ .RS
803
+ .br
804
+ \fBTCMAP *tcmapnew(void);\fR
805
+ .RS
806
+ The return value is the new map object.
807
+ .RE
808
+ .RE
809
+ .PP
810
+ The function `tcmapnew2' is used in order to create a map object with specifying the number of the buckets.
811
+ .PP
812
+ .RS
813
+ .br
814
+ \fBTCMAP *tcmapnew2(uint32_t \fIbnum\fB);\fR
815
+ .RS
816
+ `\fIbnum\fR' specifies the number of the buckets.
817
+ .RE
818
+ .RS
819
+ The return value is the new map object.
820
+ .RE
821
+ .RE
822
+ .PP
823
+ The function `tcmapnew3' is used in order to create a map object with initial string elements.
824
+ .PP
825
+ .RS
826
+ .br
827
+ \fBTCMAP *tcmapnew3(const char *\fIstr\fB, ...);\fR
828
+ .RS
829
+ `\fIstr\fR' specifies the string of the first element.
830
+ .RE
831
+ .RS
832
+ The other arguments are other elements. They should be trailed by a `NULL' argument.
833
+ .RE
834
+ .RS
835
+ The return value is the new map object.
836
+ .RE
837
+ .RS
838
+ The key and the value of each record are situated one after the other.
839
+ .RE
840
+ .RE
841
+ .PP
842
+ The function `tcmapdup' is used in order to copy a map object.
843
+ .PP
844
+ .RS
845
+ .br
846
+ \fBTCMAP *tcmapdup(const TCMAP *\fImap\fB);\fR
847
+ .RS
848
+ `\fImap\fR' specifies the map object.
849
+ .RE
850
+ .RS
851
+ The return value is the new map object equivalent to the specified object.
852
+ .RE
853
+ .RE
854
+ .PP
855
+ The function `tcmapdel' is used in order to delete a map object.
856
+ .PP
857
+ .RS
858
+ .br
859
+ \fBvoid tcmapdel(TCMAP *\fImap\fB);\fR
860
+ .RS
861
+ `\fImap\fR' specifies the map object.
862
+ .RE
863
+ .RS
864
+ Note that the deleted object and its derivatives can not be used anymore.
865
+ .RE
866
+ .RE
867
+ .PP
868
+ The function `tcmapput' is used in order to store a record into a map object.
869
+ .PP
870
+ .RS
871
+ .br
872
+ \fBvoid tcmapput(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
873
+ .RS
874
+ `\fImap\fR' specifies the map object.
875
+ .RE
876
+ .RS
877
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
878
+ .RE
879
+ .RS
880
+ `\fIksiz\fR' specifies the size of the region of the key.
881
+ .RE
882
+ .RS
883
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
884
+ .RE
885
+ .RS
886
+ `\fIvsiz\fR' specifies the size of the region of the value.
887
+ .RE
888
+ .RS
889
+ If a record with the same key exists in the map, it is overwritten.
890
+ .RE
891
+ .RE
892
+ .PP
893
+ The function `tcmapput2' is used in order to store a string record into a map object.
894
+ .PP
895
+ .RS
896
+ .br
897
+ \fBvoid tcmapput2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
898
+ .RS
899
+ `\fImap\fR' specifies the map object.
900
+ .RE
901
+ .RS
902
+ `\fIkstr\fR' specifies the string of the key.
903
+ .RE
904
+ .RS
905
+ `\fIvstr\fR' specifies the string of the value.
906
+ .RE
907
+ .RS
908
+ If a record with the same key exists in the map, it is overwritten.
909
+ .RE
910
+ .RE
911
+ .PP
912
+ The function `tcmapputkeep' is used in order to store a new record into a map object.
913
+ .PP
914
+ .RS
915
+ .br
916
+ \fBbool tcmapputkeep(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
917
+ .RS
918
+ `\fImap\fR' specifies the map object.
919
+ .RE
920
+ .RS
921
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
922
+ .RE
923
+ .RS
924
+ `\fIksiz\fR' specifies the size of the region of the key.
925
+ .RE
926
+ .RS
927
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
928
+ .RE
929
+ .RS
930
+ `\fIvsiz\fR' specifies the size of the region of the value.
931
+ .RE
932
+ .RS
933
+ If successful, the return value is true, else, it is false.
934
+ .RE
935
+ .RS
936
+ If a record with the same key exists in the map, this function has no effect.
937
+ .RE
938
+ .RE
939
+ .PP
940
+ The function `tcmapputkeep2' is used in order to store a new string record into a map object.
941
+ .PP
942
+ .RS
943
+ .br
944
+ \fBbool tcmapputkeep2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
945
+ .RS
946
+ `\fImap\fR' specifies the map object.
947
+ .RE
948
+ .RS
949
+ `\fIkstr\fR' specifies the string of the key.
950
+ .RE
951
+ .RS
952
+ `\fIvstr\fR' specifies the string of the value.
953
+ .RE
954
+ .RS
955
+ If successful, the return value is true, else, it is false.
956
+ .RE
957
+ .RS
958
+ If a record with the same key exists in the map, this function has no effect.
959
+ .RE
960
+ .RE
961
+ .PP
962
+ The function `tcmapputcat' is used in order to concatenate a value at the end of the value of the existing record in a map object.
963
+ .PP
964
+ .RS
965
+ .br
966
+ \fBvoid tcmapputcat(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
967
+ .RS
968
+ `\fImap\fR' specifies the map object.
969
+ .RE
970
+ .RS
971
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
972
+ .RE
973
+ .RS
974
+ `\fIksiz\fR' specifies the size of the region of the key.
975
+ .RE
976
+ .RS
977
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
978
+ .RE
979
+ .RS
980
+ `\fIvsiz\fR' specifies the size of the region of the value.
981
+ .RE
982
+ .RS
983
+ If there is no corresponding record, a new record is created.
984
+ .RE
985
+ .RE
986
+ .PP
987
+ The function `tcmapputcat2' is used in order to concatenate a string value at the end of the value of the existing record in a map object.
988
+ .PP
989
+ .RS
990
+ .br
991
+ \fBvoid tcmapputcat2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
992
+ .RS
993
+ `\fImap\fR' specifies the map object.
994
+ .RE
995
+ .RS
996
+ `\fIkstr\fR' specifies the string of the key.
997
+ .RE
998
+ .RS
999
+ `\fIvstr\fR' specifies the string of the value.
1000
+ .RE
1001
+ .RS
1002
+ If there is no corresponding record, a new record is created.
1003
+ .RE
1004
+ .RE
1005
+ .PP
1006
+ The function `tcmapout' is used in order to remove a record of a map object.
1007
+ .PP
1008
+ .RS
1009
+ .br
1010
+ \fBbool tcmapout(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
1011
+ .RS
1012
+ `\fImap\fR' specifies the map object.
1013
+ .RE
1014
+ .RS
1015
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1016
+ .RE
1017
+ .RS
1018
+ `\fIksiz\fR' specifies the size of the region of the key.
1019
+ .RE
1020
+ .RS
1021
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1022
+ .RE
1023
+ .RE
1024
+ .PP
1025
+ The function `tcmapout2' is used in order to remove a string record of a map object.
1026
+ .PP
1027
+ .RS
1028
+ .br
1029
+ \fBbool tcmapout2(TCMAP *\fImap\fB, const char *\fIkstr\fB);\fR
1030
+ .RS
1031
+ `\fImap\fR' specifies the map object.
1032
+ .RE
1033
+ .RS
1034
+ `\fIkstr\fR' specifies the string of the key.
1035
+ .RE
1036
+ .RS
1037
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1038
+ .RE
1039
+ .RE
1040
+ .PP
1041
+ The function `tcmapget' is used in order to retrieve a record in a map object.
1042
+ .PP
1043
+ .RS
1044
+ .br
1045
+ \fBconst void *tcmapget(const TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR
1046
+ .RS
1047
+ `\fImap\fR' specifies the map object.
1048
+ .RE
1049
+ .RS
1050
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1051
+ .RE
1052
+ .RS
1053
+ `\fIksiz\fR' specifies the size of the region of the key.
1054
+ .RE
1055
+ .RS
1056
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1057
+ .RE
1058
+ .RS
1059
+ If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned when no record corresponds.
1060
+ .RE
1061
+ .RS
1062
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.
1063
+ .RE
1064
+ .RE
1065
+ .PP
1066
+ The function `tcmapget2' is used in order to retrieve a string record in a map object.
1067
+ .PP
1068
+ .RS
1069
+ .br
1070
+ \fBconst char *tcmapget2(const TCMAP *\fImap\fB, const char *\fIkstr\fB);\fR
1071
+ .RS
1072
+ `\fImap\fR' specifies the map object.
1073
+ .RE
1074
+ .RS
1075
+ `\fIkstr\fR' specifies the string of the key.
1076
+ .RE
1077
+ .RS
1078
+ If successful, the return value is the string of the value of the corresponding record. `NULL' is returned when no record corresponds.
1079
+ .RE
1080
+ .RE
1081
+ .PP
1082
+ The function `tcmapmove' is used in order to move a record to the edge of a map object.
1083
+ .PP
1084
+ .RS
1085
+ .br
1086
+ \fBbool tcmapmove(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, bool \fIhead\fB);\fR
1087
+ .RS
1088
+ `\fImap\fR' specifies the map object.
1089
+ .RE
1090
+ .RS
1091
+ `\fIkbuf\fR' specifies the pointer to the region of a key.
1092
+ .RE
1093
+ .RS
1094
+ `\fIksiz\fR' specifies the size of the region of the key.
1095
+ .RE
1096
+ .RS
1097
+ `\fIhead\fR' specifies the destination which is the head if it is true or the tail if else.
1098
+ .RE
1099
+ .RS
1100
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1101
+ .RE
1102
+ .RE
1103
+ .PP
1104
+ The function `tcmapmove2' is used in order to move a string record to the edge of a map object.
1105
+ .PP
1106
+ .RS
1107
+ .br
1108
+ \fBbool tcmapmove2(TCMAP *\fImap\fB, const char *\fIkstr\fB, bool \fIhead\fB);\fR
1109
+ .RS
1110
+ `\fImap\fR' specifies the map object.
1111
+ .RE
1112
+ .RS
1113
+ `\fIkstr\fR' specifies the string of a key.
1114
+ .RE
1115
+ .RS
1116
+ `\fIhead\fR' specifies the destination which is the head if it is true or the tail if else.
1117
+ .RE
1118
+ .RS
1119
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1120
+ .RE
1121
+ .RE
1122
+ .PP
1123
+ The function `tcmapiterinit' is used in order to initialize the iterator of a map object.
1124
+ .PP
1125
+ .RS
1126
+ .br
1127
+ \fBvoid tcmapiterinit(TCMAP *\fImap\fB);\fR
1128
+ .RS
1129
+ `\fImap\fR' specifies the map object.
1130
+ .RE
1131
+ .RS
1132
+ The iterator is used in order to access the key of every record stored in the map object.
1133
+ .RE
1134
+ .RE
1135
+ .PP
1136
+ The function `tcmapiternext' is used in order to get the next key of the iterator of a map object.
1137
+ .PP
1138
+ .RS
1139
+ .br
1140
+ \fBconst void *tcmapiternext(TCMAP *\fImap\fB, int *\fIsp\fB);\fR
1141
+ .RS
1142
+ `\fImap\fR' specifies the map object.
1143
+ .RE
1144
+ .RS
1145
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1146
+ .RE
1147
+ .RS
1148
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
1149
+ .RE
1150
+ .RS
1151
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. The order of iteration is assured to be the same as the stored order.
1152
+ .RE
1153
+ .RE
1154
+ .PP
1155
+ The function `tcmapiternext2' is used in order to get the next key string of the iterator of a map object.
1156
+ .PP
1157
+ .RS
1158
+ .br
1159
+ \fBconst char *tcmapiternext2(TCMAP *\fImap\fB);\fR
1160
+ .RS
1161
+ `\fImap\fR' specifies the map object.
1162
+ .RE
1163
+ .RS
1164
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
1165
+ .RE
1166
+ .RS
1167
+ The order of iteration is assured to be the same as the stored order.
1168
+ .RE
1169
+ .RE
1170
+ .PP
1171
+ The function `tcmaprnum' is used in order to get the number of records stored in a map object.
1172
+ .PP
1173
+ .RS
1174
+ .br
1175
+ \fBuint64_t tcmaprnum(const TCMAP *\fImap\fB);\fR
1176
+ .RS
1177
+ `\fImap\fR' specifies the map object.
1178
+ .RE
1179
+ .RS
1180
+ The return value is the number of the records stored in the map object.
1181
+ .RE
1182
+ .RE
1183
+ .PP
1184
+ The function `tcmapmsiz' is used in order to get the total size of memory used in a map object.
1185
+ .PP
1186
+ .RS
1187
+ .br
1188
+ \fBuint64_t tcmapmsiz(const TCMAP *\fImap\fB);\fR
1189
+ .RS
1190
+ `\fImap\fR' specifies the map object.
1191
+ .RE
1192
+ .RS
1193
+ The return value is the total size of memory used in a map object.
1194
+ .RE
1195
+ .RE
1196
+ .PP
1197
+ The function `tcmapkeys' is used in order to create a list object containing all keys in a map object.
1198
+ .PP
1199
+ .RS
1200
+ .br
1201
+ \fBTCLIST *tcmapkeys(const TCMAP *\fImap\fB);\fR
1202
+ .RS
1203
+ `\fImap\fR' specifies the map object.
1204
+ .RE
1205
+ .RS
1206
+ The return value is the new list object containing all keys in the map object.
1207
+ .RE
1208
+ .RS
1209
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
1210
+ .RE
1211
+ .RE
1212
+ .PP
1213
+ The function `tcmapvals' is used in order to create a list object containing all values in a map object.
1214
+ .PP
1215
+ .RS
1216
+ .br
1217
+ \fBTCLIST *tcmapvals(const TCMAP *\fImap\fB);\fR
1218
+ .RS
1219
+ `\fImap\fR' specifies the map object.
1220
+ .RE
1221
+ .RS
1222
+ The return value is the new list object containing all values in the map object.
1223
+ .RE
1224
+ .RS
1225
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
1226
+ .RE
1227
+ .RE
1228
+ .PP
1229
+ The function `tcmapaddint' is used in order to add an integer to a record in a map object.
1230
+ .PP
1231
+ .RS
1232
+ .br
1233
+ \fBint tcmapaddint(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR
1234
+ .RS
1235
+ `\fImap\fR' specifies the map object.
1236
+ .RE
1237
+ .RS
1238
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1239
+ .RE
1240
+ .RS
1241
+ `\fIksiz\fR' specifies the size of the region of the key.
1242
+ .RE
1243
+ .RS
1244
+ `\fInum\fR' specifies the additional value.
1245
+ .RE
1246
+ .RS
1247
+ The return value is the summation value.
1248
+ .RE
1249
+ .RS
1250
+ If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.
1251
+ .RE
1252
+ .RE
1253
+ .PP
1254
+ The function `tcmapadddouble' is used in order to add a real number to a record in a map object.
1255
+ .PP
1256
+ .RS
1257
+ .br
1258
+ \fBdouble tcmapadddouble(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR
1259
+ .RS
1260
+ `\fImap\fR' specifies the map object.
1261
+ .RE
1262
+ .RS
1263
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1264
+ .RE
1265
+ .RS
1266
+ `\fIksiz\fR' specifies the size of the region of the key.
1267
+ .RE
1268
+ .RS
1269
+ `\fInum\fR' specifies the additional value.
1270
+ .RE
1271
+ .RS
1272
+ The return value is the summation value.
1273
+ .RE
1274
+ .RS
1275
+ If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.
1276
+ .RE
1277
+ .RE
1278
+ .PP
1279
+ The function `tcmapclear' is used in order to clear a map object.
1280
+ .PP
1281
+ .RS
1282
+ .br
1283
+ \fBvoid tcmapclear(TCMAP *\fImap\fB);\fR
1284
+ .RS
1285
+ `\fImap\fR' specifies the map object.
1286
+ .RE
1287
+ .RS
1288
+ All records are removed.
1289
+ .RE
1290
+ .RE
1291
+ .PP
1292
+ The function `tcmapcutfront' is used in order to remove front records of a map object.
1293
+ .PP
1294
+ .RS
1295
+ .br
1296
+ \fBvoid tcmapcutfront(TCMAP *\fImap\fB, int \fInum\fB);\fR
1297
+ .RS
1298
+ `\fImap\fR' specifies the map object.
1299
+ .RE
1300
+ .RS
1301
+ `\fInum\fR' specifies the number of records to be removed.
1302
+ .RE
1303
+ .RE
1304
+ .PP
1305
+ The function `tcmapdump' is used in order to serialize a map object into a byte array.
1306
+ .PP
1307
+ .RS
1308
+ .br
1309
+ \fBvoid *tcmapdump(const TCMAP *\fImap\fB, int *\fIsp\fB);\fR
1310
+ .RS
1311
+ `\fImap\fR' specifies the map object.
1312
+ .RE
1313
+ .RS
1314
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1315
+ .RE
1316
+ .RS
1317
+ The return value is the pointer to the region of the result serial region.
1318
+ .RE
1319
+ .RS
1320
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
1321
+ .RE
1322
+ .RE
1323
+ .PP
1324
+ The function `tcmapload' is used in order to create a map object from a serialized byte array.
1325
+ .PP
1326
+ .RS
1327
+ .br
1328
+ \fBTCMAP *tcmapload(const void *\fIptr\fB, int \fIsize\fB);\fR
1329
+ .RS
1330
+ `\fIptr\fR' specifies the pointer to the region of serialized byte array.
1331
+ .RE
1332
+ .RS
1333
+ `\fIsize\fR' specifies the size of the region.
1334
+ .RE
1335
+ .RS
1336
+ The return value is a new map object.
1337
+ .RE
1338
+ .RS
1339
+ Because the object of the return value is created with the function `tcmapnew', it should be deleted with the function `tcmapdel' when it is no longer in use.
1340
+ .RE
1341
+ .RE
1342
+
1343
+ .SH API OF ORDERED TREE
1344
+ .PP
1345
+ The function `tctreenew' is used in order to create a tree object.
1346
+ .PP
1347
+ .RS
1348
+ .br
1349
+ \fBTCTREE *tctreenew(void);\fR
1350
+ .RS
1351
+ The return value is the new tree object.
1352
+ .RE
1353
+ .RE
1354
+ .PP
1355
+ The function `tctreenew2' is used in order to create a tree object with specifying the custom comparison function.
1356
+ .PP
1357
+ .RS
1358
+ .br
1359
+ \fBTCTREE *tctreenew2(TCCMP \fIcmp\fB, void *\fIcmpop\fB);\fR
1360
+ .RS
1361
+ `\fIcmp\fR' specifies the pointer to the custom comparison function. It receives five parameters. The first parameter is the pointer to the region of one key. The second parameter is the size of the region of one key. The third parameter is the pointer to the region of the other key. The fourth parameter is the size of the region of the other key. The fifth parameter is the pointer to the optional opaque object. It returns positive if the former is big, negative if the latter is big, 0 if both are equivalent.
1362
+ .RE
1363
+ .RS
1364
+ `\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function. If it is not needed, `NULL' can be specified.
1365
+ .RE
1366
+ .RS
1367
+ The return value is the new tree object.
1368
+ .RE
1369
+ .RS
1370
+ The default comparison function compares keys of two records by lexical order. The functions `tccmplexical' (dafault), `tccmpdecimal', `tccmpint32', and `tccmpint64' are built\-in.
1371
+ .RE
1372
+ .RE
1373
+ .PP
1374
+ The function `tctreedup' is used in order to copy a tree object.
1375
+ .PP
1376
+ .RS
1377
+ .br
1378
+ \fBTCTREE *tctreedup(const TCTREE *\fItree\fB);\fR
1379
+ .RS
1380
+ `\fItree\fR' specifies the tree object.
1381
+ .RE
1382
+ .RS
1383
+ The return value is the new tree object equivalent to the specified object.
1384
+ .RE
1385
+ .RE
1386
+ .PP
1387
+ The function `tctreedel' is used in order to delete a tree object.
1388
+ .PP
1389
+ .RS
1390
+ .br
1391
+ \fBvoid tctreedel(TCTREE *\fItree\fB);\fR
1392
+ .RS
1393
+ `tree' specifies the tree object.
1394
+ .RE
1395
+ .RS
1396
+ Note that the deleted object and its derivatives can not be used anymore.
1397
+ .RE
1398
+ .RE
1399
+ .PP
1400
+ The function `tctreeput' is used in order to store a record into a tree object.
1401
+ .PP
1402
+ .RS
1403
+ .br
1404
+ \fBvoid tctreeput(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1405
+ .RS
1406
+ `\fItree\fR' specifies the tree object.
1407
+ .RE
1408
+ .RS
1409
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1410
+ .RE
1411
+ .RS
1412
+ `\fIksiz\fR' specifies the size of the region of the key.
1413
+ .RE
1414
+ .RS
1415
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1416
+ .RE
1417
+ .RS
1418
+ `\fIvsiz\fR' specifies the size of the region of the value.
1419
+ .RE
1420
+ .RS
1421
+ If a record with the same key exists in the tree, it is overwritten.
1422
+ .RE
1423
+ .RE
1424
+ .PP
1425
+ The function `tctreeput2' is used in order to store a string record into a tree object.
1426
+ .PP
1427
+ .RS
1428
+ .br
1429
+ \fBvoid tctreeput2(TCTREE *\fItree\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
1430
+ .RS
1431
+ `\fItree\fR' specifies the tree object.
1432
+ .RE
1433
+ .RS
1434
+ `\fIkstr\fR' specifies the string of the key.
1435
+ .RE
1436
+ .RS
1437
+ `\fIvstr\fR' specifies the string of the value.
1438
+ .RE
1439
+ .RS
1440
+ If a record with the same key exists in the tree, it is overwritten.
1441
+ .RE
1442
+ .RE
1443
+ .PP
1444
+ The function `tctreeputkeep' is used in order to store a new record into a tree object.
1445
+ .PP
1446
+ .RS
1447
+ .br
1448
+ \fBbool tctreeputkeep(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1449
+ .RS
1450
+ `\fItree\fR' specifies the tree object.
1451
+ .RE
1452
+ .RS
1453
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1454
+ .RE
1455
+ .RS
1456
+ `\fIksiz\fR' specifies the size of the region of the key.
1457
+ .RE
1458
+ .RS
1459
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1460
+ .RE
1461
+ .RS
1462
+ `\fIvsiz\fR' specifies the size of the region of the value.
1463
+ .RE
1464
+ .RS
1465
+ If successful, the return value is true, else, it is false.
1466
+ .RE
1467
+ .RS
1468
+ If a record with the same key exists in the tree, this function has no effect.
1469
+ .RE
1470
+ .RE
1471
+ .PP
1472
+ The function `tctreeputkeep2' is used in order to store a new string record into a tree object.
1473
+ .PP
1474
+ .RS
1475
+ .br
1476
+ \fBbool tctreeputkeep2(TCTREE *\fItree\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
1477
+ .RS
1478
+ `\fItree\fR' specifies the tree object.
1479
+ .RE
1480
+ .RS
1481
+ `\fIkstr\fR' specifies the string of the key.
1482
+ .RE
1483
+ .RS
1484
+ `\fIvstr\fR' specifies the string of the value.
1485
+ .RE
1486
+ .RS
1487
+ If successful, the return value is true, else, it is false.
1488
+ .RE
1489
+ .RS
1490
+ If a record with the same key exists in the tree, this function has no effect.
1491
+ .RE
1492
+ .RE
1493
+ .PP
1494
+ The function `tctreeputcat' is used in order to concatenate a value at the end of the value of the existing record in a tree object.
1495
+ .PP
1496
+ .RS
1497
+ .br
1498
+ \fBvoid tctreeputcat(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1499
+ .RS
1500
+ `\fItree\fR' specifies the tree object.
1501
+ .RE
1502
+ .RS
1503
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1504
+ .RE
1505
+ .RS
1506
+ `\fIksiz\fR' specifies the size of the region of the key.
1507
+ .RE
1508
+ .RS
1509
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1510
+ .RE
1511
+ .RS
1512
+ `\fIvsiz\fR' specifies the size of the region of the value.
1513
+ .RE
1514
+ .RS
1515
+ If there is no corresponding record, a new record is created.
1516
+ .RE
1517
+ .RE
1518
+ .PP
1519
+ The function `tctreeputcat2' is used in order to concatenate a string value at the end of the value of the existing record in a tree object.
1520
+ .PP
1521
+ .RS
1522
+ .br
1523
+ \fBvoid tctreeputcat2(TCTREE *\fItree\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
1524
+ .RS
1525
+ `\fItree\fR' specifies the tree object.
1526
+ .RE
1527
+ .RS
1528
+ `\fIkstr\fR' specifies the string of the key.
1529
+ .RE
1530
+ .RS
1531
+ `\fIvstr\fR' specifies the string of the value.
1532
+ .RE
1533
+ .RS
1534
+ If there is no corresponding record, a new record is created.
1535
+ .RE
1536
+ .RE
1537
+ .PP
1538
+ The function `tctreeout' is used in order to remove a record of a tree object.
1539
+ .PP
1540
+ .RS
1541
+ .br
1542
+ \fBbool tctreeout(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
1543
+ .RS
1544
+ `\fItree\fR' specifies the tree object.
1545
+ .RE
1546
+ .RS
1547
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1548
+ .RE
1549
+ .RS
1550
+ `\fIksiz\fR' specifies the size of the region of the key.
1551
+ .RE
1552
+ .RS
1553
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1554
+ .RE
1555
+ .RE
1556
+ .PP
1557
+ The function `tctreeout2' is used in order to remove a string record of a tree object.
1558
+ .PP
1559
+ .RS
1560
+ .br
1561
+ \fBbool tctreeout2(TCTREE *\fItree\fB, const char *\fIkstr\fB);\fR
1562
+ .RS
1563
+ `\fItree\fR' specifies the tree object.
1564
+ .RE
1565
+ .RS
1566
+ `\fIkstr\fR' specifies the string of the key.
1567
+ .RE
1568
+ .RS
1569
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
1570
+ .RE
1571
+ .RE
1572
+ .PP
1573
+ The function `tctreeget' is used in order to retrieve a record in a tree object.
1574
+ .PP
1575
+ .RS
1576
+ .br
1577
+ \fBconst void *tctreeget(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR
1578
+ .RS
1579
+ `\fItree\fR' specifies the tree object.
1580
+ .RE
1581
+ .RS
1582
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1583
+ .RE
1584
+ .RS
1585
+ `\fIksiz\fR' specifies the size of the region of the key.
1586
+ .RE
1587
+ .RS
1588
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1589
+ .RE
1590
+ .RS
1591
+ If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned when no record corresponds.
1592
+ .RE
1593
+ .RS
1594
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.
1595
+ .RE
1596
+ .RE
1597
+ .PP
1598
+ The function `tctreeget2' is used in order to retrieve a string record in a tree object.
1599
+ .PP
1600
+ .RS
1601
+ .br
1602
+ \fBconst char *tctreeget2(TCTREE *\fItree\fB, const char *\fIkstr\fB);\fR
1603
+ .RS
1604
+ `\fItree\fR' specifies the tree object.
1605
+ .RE
1606
+ .RS
1607
+ `\fIkstr\fR' specifies the string of the key.
1608
+ .RE
1609
+ .RS
1610
+ If successful, the return value is the string of the value of the corresponding record. `NULL' is returned when no record corresponds.
1611
+ .RE
1612
+ .RE
1613
+ .PP
1614
+ The function `tctreeiterinit' is used in order to initialize the iterator of a tree object.
1615
+ .PP
1616
+ .RS
1617
+ .br
1618
+ \fBvoid tctreeiterinit(TCTREE *\fItree\fB);\fR
1619
+ .RS
1620
+ `\fItree\fR' specifies the tree object.
1621
+ .RE
1622
+ .RS
1623
+ The iterator is used in order to access the key of every record stored in the tree object.
1624
+ .RE
1625
+ .RE
1626
+ .PP
1627
+ The function `tctreeiternext' is used in order to get the next key of the iterator of a tree object.
1628
+ .PP
1629
+ .RS
1630
+ .br
1631
+ \fBconst void *tctreeiternext(TCTREE *\fItree\fB, int *\fIsp\fB);\fR
1632
+ .RS
1633
+ `\fItree\fR' specifies the tree object.
1634
+ .RE
1635
+ .RS
1636
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1637
+ .RE
1638
+ .RS
1639
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
1640
+ .RE
1641
+ .RS
1642
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. The order of iteration is assured to be ascending of the keys.
1643
+ .RE
1644
+ .RE
1645
+ .PP
1646
+ The function `tctreeiternext2' is used in order to get the next key string of the iterator of a tree object.
1647
+ .PP
1648
+ .RS
1649
+ .br
1650
+ \fBconst char *tctreeiternext2(TCTREE *\fItree\fB);\fR
1651
+ .RS
1652
+ `\fItree\fR' specifies the tree object.
1653
+ .RE
1654
+ .RS
1655
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
1656
+ .RE
1657
+ .RS
1658
+ The order of iteration is assured to be ascending of the keys.
1659
+ .RE
1660
+ .RE
1661
+ .PP
1662
+ The function `tctreernum' is used in order to get the number of records stored in a tree object.
1663
+ .PP
1664
+ .RS
1665
+ .br
1666
+ \fBuint64_t tctreernum(const TCTREE *\fItree\fB);\fR
1667
+ .RS
1668
+ `\fItree\fR' specifies the tree object.
1669
+ .RE
1670
+ .RS
1671
+ The return value is the number of the records stored in the tree object.
1672
+ .RE
1673
+ .RE
1674
+ .PP
1675
+ The function `tctreemsiz' is used in order to get the total size of memory used in a tree object.
1676
+ .PP
1677
+ .RS
1678
+ .br
1679
+ \fBuint64_t tctreemsiz(const TCTREE *\fItree\fB);\fR
1680
+ .RS
1681
+ `\fItree\fR' specifies the tree object.
1682
+ .RE
1683
+ .RS
1684
+ The return value is the total size of memory used in a tree object.
1685
+ .RE
1686
+ .RE
1687
+ .PP
1688
+ The function `tctreekeys' is used in order to create a list object containing all keys in a tree object.
1689
+ .PP
1690
+ .RS
1691
+ .br
1692
+ \fBTCLIST *tctreekeys(const TCTREE *\fItree\fB);\fR
1693
+ .RS
1694
+ `\fItree\fR' specifies the tree object.
1695
+ .RE
1696
+ .RS
1697
+ The return value is the new list object containing all keys in the tree object.
1698
+ .RE
1699
+ .RS
1700
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
1701
+ .RE
1702
+ .RE
1703
+ .PP
1704
+ The function `tctreevals' is used in order to create a list object containing all values in a tree object.
1705
+ .PP
1706
+ .RS
1707
+ .br
1708
+ \fBTCLIST *tctreevals(const TCTREE *\fItree\fB);\fR
1709
+ .RS
1710
+ `\fItree\fR' specifies the tree object.
1711
+ .RE
1712
+ .RS
1713
+ The return value is the new list object containing all values in the tree object.
1714
+ .RE
1715
+ .RS
1716
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
1717
+ .RE
1718
+ .RE
1719
+ .PP
1720
+ The function `tctreeaddint' is used in order to add an integer to a record in a tree object.
1721
+ .PP
1722
+ .RS
1723
+ .br
1724
+ \fBint tctreeaddint(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR
1725
+ .RS
1726
+ `\fItree\fR' specifies the tree object.
1727
+ .RE
1728
+ .RS
1729
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1730
+ .RE
1731
+ .RS
1732
+ `\fIksiz\fR' specifies the size of the region of the key.
1733
+ .RE
1734
+ .RS
1735
+ `\fInum\fR' specifies the additional value.
1736
+ .RE
1737
+ .RS
1738
+ The return value is the summation value.
1739
+ .RE
1740
+ .RS
1741
+ If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.
1742
+ .RE
1743
+ .RE
1744
+ .PP
1745
+ The function `tctreeadddouble' is used in order to add a real number to a record in a tree object.
1746
+ .PP
1747
+ .RS
1748
+ .br
1749
+ \fBdouble tctreeadddouble(TCTREE *\fItree\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR
1750
+ .RS
1751
+ `\fItree\fR' specifies the tree object.
1752
+ .RE
1753
+ .RS
1754
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1755
+ .RE
1756
+ .RS
1757
+ `\fIksiz\fR' specifies the size of the region of the key.
1758
+ .RE
1759
+ .RS
1760
+ `\fInum\fR' specifies the additional value.
1761
+ .RE
1762
+ .RS
1763
+ The return value is the summation value.
1764
+ .RE
1765
+ .RS
1766
+ If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.
1767
+ .RE
1768
+ .RE
1769
+ .PP
1770
+ The function `tctreeclear' is used in order to clear a tree object.
1771
+ .PP
1772
+ .RS
1773
+ .br
1774
+ \fBvoid tctreeclear(TCTREE *\fItree\fB);\fR
1775
+ .RS
1776
+ `\fItree\fR' specifies the tree object.
1777
+ .RE
1778
+ .RS
1779
+ All records are removed.
1780
+ .RE
1781
+ .RE
1782
+ .PP
1783
+ The function `tctreecutfringe' is used in order to remove fringe records of a tree object.
1784
+ .PP
1785
+ .RS
1786
+ .br
1787
+ \fBvoid tctreecutfringe(TCTREE *\fItree\fB, int \fInum\fB);\fR
1788
+ .RS
1789
+ `\fItree\fR' specifies the tree object.
1790
+ .RE
1791
+ .RS
1792
+ `\fInum\fR' specifies the number of records to be removed.
1793
+ .RE
1794
+ .RE
1795
+ .PP
1796
+ The function `tctreedump' is used in order to serialize a tree object into a byte array.
1797
+ .PP
1798
+ .RS
1799
+ .br
1800
+ \fBvoid *tctreedump(const TCTREE *\fItree\fB, int *\fIsp\fB);\fR
1801
+ .RS
1802
+ `\fItree\fR' specifies the tree object.
1803
+ .RE
1804
+ .RS
1805
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
1806
+ .RE
1807
+ .RS
1808
+ The return value is the pointer to the region of the result serial region.
1809
+ .RE
1810
+ .RS
1811
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
1812
+ .RE
1813
+ .RE
1814
+ .PP
1815
+ The function `tctreeload' is used in order to create a tree object from a serialized byte array.
1816
+ .PP
1817
+ .RS
1818
+ .br
1819
+ \fBTCTREE *tctreeload(const void *\fIptr\fB, int \fIsize\fB, TCCMP \fIcmp\fB, void *\fIcmpop\fB);\fR
1820
+ .RS
1821
+ `\fIptr\fR' specifies the pointer to the region of serialized byte array.
1822
+ .RE
1823
+ .RS
1824
+ `\fIsize\fR' specifies the size of the region.
1825
+ .RE
1826
+ .RS
1827
+ `\fIcmp\fR' specifies the pointer to the custom comparison function.
1828
+ .RE
1829
+ .RS
1830
+ `\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function.
1831
+ .RE
1832
+ .RS
1833
+ If it is not needed, `NULL' can be specified.
1834
+ .RE
1835
+ .RS
1836
+ The return value is a new tree object.
1837
+ .RE
1838
+ .RS
1839
+ Because the object of the return value is created with the function `tctreenew', it should be deleted with the function `tctreedel' when it is no longer in use.
1840
+ .RE
1841
+ .RE
1842
+
1843
+ .SH API OF ON\-MEMORY HASH DATABASE
1844
+ .PP
1845
+ The function `tcmdbnew' is used in order to create an on\-memory hash database object.
1846
+ .PP
1847
+ .RS
1848
+ .br
1849
+ \fBTCMDB *tcmdbnew(void);\fR
1850
+ .RS
1851
+ The return value is the new on\-memory hash database object.
1852
+ .RE
1853
+ .RS
1854
+ The object can be shared by plural threads because of the internal mutex.
1855
+ .RE
1856
+ .RE
1857
+ .PP
1858
+ The function `tcmdbnew2' is used in order to create an on\-memory hash database object with specifying the number of the buckets.
1859
+ .PP
1860
+ .RS
1861
+ .br
1862
+ \fBTCMDB *tcmdbnew2(uint32_t \fIbnum\fB);\fR
1863
+ .RS
1864
+ `\fIbnum\fR' specifies the number of the buckets.
1865
+ .RE
1866
+ .RS
1867
+ The return value is the new on\-memory hash database object.
1868
+ .RE
1869
+ .RS
1870
+ The object can be shared by plural threads because of the internal mutex.
1871
+ .RE
1872
+ .RE
1873
+ .PP
1874
+ The function `tcmdbdel' is used in order to delete an on\-memory hash database object.
1875
+ .PP
1876
+ .RS
1877
+ .br
1878
+ \fBvoid tcmdbdel(TCMDB *\fImdb\fB);\fR
1879
+ .RS
1880
+ `\fImdb\fR' specifies the on\-memory hash database object.
1881
+ .RE
1882
+ .RE
1883
+ .PP
1884
+ The function `tcmdbput' is used in order to store a record into an on\-memory hash database object.
1885
+ .PP
1886
+ .RS
1887
+ .br
1888
+ \fBvoid tcmdbput(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1889
+ .RS
1890
+ `\fImdb\fR' specifies the on\-memory hash database object.
1891
+ .RE
1892
+ .RS
1893
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1894
+ .RE
1895
+ .RS
1896
+ `\fIksiz\fR' specifies the size of the region of the key.
1897
+ .RE
1898
+ .RS
1899
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1900
+ .RE
1901
+ .RS
1902
+ `\fIvsiz\fR' specifies the size of the region of the value.
1903
+ .RE
1904
+ .RS
1905
+ If a record with the same key exists in the database, it is overwritten.
1906
+ .RE
1907
+ .RE
1908
+ .PP
1909
+ The function `tcmdbput2' is used in order to store a string record into an on\-memory hash database object.
1910
+ .PP
1911
+ .RS
1912
+ .br
1913
+ \fBvoid tcmdbput2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
1914
+ .RS
1915
+ `\fImdb\fR' specifies the on\-memory hash database object.
1916
+ .RE
1917
+ .RS
1918
+ `\fIkstr\fR' specifies the string of the key.
1919
+ .RE
1920
+ .RS
1921
+ `\fIvstr\fR' specifies the string of the value.
1922
+ .RE
1923
+ .RS
1924
+ If a record with the same key exists in the database, it is overwritten.
1925
+ .RE
1926
+ .RE
1927
+ .PP
1928
+ The function `tcmdbputkeep' is used in order to store a new record into an on\-memory hash database object.
1929
+ .PP
1930
+ .RS
1931
+ .br
1932
+ \fBbool tcmdbputkeep(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1933
+ .RS
1934
+ `\fImdb\fR' specifies the on\-memory hash database object.
1935
+ .RE
1936
+ .RS
1937
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1938
+ .RE
1939
+ .RS
1940
+ `\fIksiz\fR' specifies the size of the region of the key.
1941
+ .RE
1942
+ .RS
1943
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1944
+ .RE
1945
+ .RS
1946
+ `\fIvsiz\fR' specifies the size of the region of the value.
1947
+ .RE
1948
+ .RS
1949
+ If successful, the return value is true, else, it is false.
1950
+ .RE
1951
+ .RS
1952
+ If a record with the same key exists in the database, this function has no effect.
1953
+ .RE
1954
+ .RE
1955
+ .PP
1956
+ The function `tcmdbputkeep2' is used in order to store a new string record into an on\-memory hash database object.
1957
+ .PP
1958
+ .RS
1959
+ .br
1960
+ \fBbool tcmdbputkeep2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
1961
+ .RS
1962
+ `\fImdb\fR' specifies the on\-memory hash database object.
1963
+ .RE
1964
+ .RS
1965
+ `\fIkstr\fR' specifies the string of the key.
1966
+ .RE
1967
+ .RS
1968
+ `\fIvstr\fR' specifies the string of the value.
1969
+ .RE
1970
+ .RS
1971
+ If successful, the return value is true, else, it is false.
1972
+ .RE
1973
+ .RS
1974
+ If a record with the same key exists in the database, this function has no effect.
1975
+ .RE
1976
+ .RE
1977
+ .PP
1978
+ The function `tcmdbputcat' is used in order to concatenate a value at the end of the existing record in an on\-memory hash database.
1979
+ .PP
1980
+ .RS
1981
+ .br
1982
+ \fBvoid tcmdbputcat(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
1983
+ .RS
1984
+ `\fImdb\fR' specifies the on\-memory hash database object.
1985
+ .RE
1986
+ .RS
1987
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
1988
+ .RE
1989
+ .RS
1990
+ `\fIksiz\fR' specifies the size of the region of the key.
1991
+ .RE
1992
+ .RS
1993
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
1994
+ .RE
1995
+ .RS
1996
+ `\fIvsiz\fR' specifies the size of the region of the value.
1997
+ .RE
1998
+ .RS
1999
+ If there is no corresponding record, a new record is created.
2000
+ .RE
2001
+ .RE
2002
+ .PP
2003
+ The function `tcmdbputcat2' is used in order to concatenate a string at the end of the existing record in an on\-memory hash database.
2004
+ .PP
2005
+ .RS
2006
+ .br
2007
+ \fBvoid tcmdbputcat2(TCMDB *\fImdb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
2008
+ .RS
2009
+ `\fImdb\fR' specifies the on\-memory hash database object.
2010
+ .RE
2011
+ .RS
2012
+ `\fIkstr\fR' specifies the string of the key.
2013
+ .RE
2014
+ .RS
2015
+ `\fIvstr\fR' specifies the string of the value.
2016
+ .RE
2017
+ .RS
2018
+ If there is no corresponding record, a new record is created.
2019
+ .RE
2020
+ .RE
2021
+ .PP
2022
+ The function `tcmdbout' is used in order to remove a record of an on\-memory hash database object.
2023
+ .PP
2024
+ .RS
2025
+ .br
2026
+ \fBbool tcmdbout(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
2027
+ .RS
2028
+ `\fImdb\fR' specifies the on\-memory hash database object.
2029
+ .RE
2030
+ .RS
2031
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2032
+ .RE
2033
+ .RS
2034
+ `\fIksiz\fR' specifies the size of the region of the key.
2035
+ .RE
2036
+ .RS
2037
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
2038
+ .RE
2039
+ .RE
2040
+ .PP
2041
+ The function `tcmdbout2' is used in order to remove a string record of an on\-memory hash database object.
2042
+ .PP
2043
+ .RS
2044
+ .br
2045
+ \fBbool tcmdbout2(TCMDB *\fImdb\fB, const char *\fIkstr\fB);\fR
2046
+ .RS
2047
+ `\fImdb\fR' specifies the on\-memory hash database object.
2048
+ .RE
2049
+ .RS
2050
+ `\fIkstr\fR' specifies the string of the key.
2051
+ .RE
2052
+ .RS
2053
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
2054
+ .RE
2055
+ .RE
2056
+ .PP
2057
+ The function `tcmdbget' is used in order to retrieve a record in an on\-memory hash database object.
2058
+ .PP
2059
+ .RS
2060
+ .br
2061
+ \fBvoid *tcmdbget(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR
2062
+ .RS
2063
+ `\fImdb\fR' specifies the on\-memory hash database object.
2064
+ .RE
2065
+ .RS
2066
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2067
+ .RE
2068
+ .RS
2069
+ `\fIksiz\fR' specifies the size of the region of the key.
2070
+ .RE
2071
+ .RS
2072
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
2073
+ .RE
2074
+ .RS
2075
+ If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned when no record corresponds.
2076
+ .RE
2077
+ .RS
2078
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
2079
+ .RE
2080
+ .RE
2081
+ .PP
2082
+ The function `tcmdbget2' is used in order to retrieve a string record in an on\-memory hash database object.
2083
+ .PP
2084
+ .RS
2085
+ .br
2086
+ \fBchar *tcmdbget2(TCMDB *\fImdb\fB, const char *\fIkstr\fB);\fR
2087
+ .RS
2088
+ `\fImdb\fR' specifies the on\-memory hash database object.
2089
+ .RE
2090
+ .RS
2091
+ `\fIkstr\fR' specifies the string of the key.
2092
+ .RE
2093
+ .RS
2094
+ If successful, the return value is the string of the value of the corresponding record. `NULL' is returned when no record corresponds.
2095
+ .RE
2096
+ .RS
2097
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
2098
+ .RE
2099
+ .RE
2100
+ .PP
2101
+ The function `tcmdbvsiz' is used in order to get the size of the value of a record in an on\-memory hash database object.
2102
+ .PP
2103
+ .RS
2104
+ .br
2105
+ \fBint tcmdbvsiz(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
2106
+ .RS
2107
+ `\fImdb\fR' specifies the on\-memory hash database object.
2108
+ .RE
2109
+ .RS
2110
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2111
+ .RE
2112
+ .RS
2113
+ `\fIksiz\fR' specifies the size of the region of the key.
2114
+ .RE
2115
+ .RS
2116
+ If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
2117
+ .RE
2118
+ .RE
2119
+ .PP
2120
+ The function `tcmdbvsiz2' is used in order to get the size of the value of a string record in an on\-memory hash database object.
2121
+ .PP
2122
+ .RS
2123
+ .br
2124
+ \fBint tcmdbvsiz2(TCMDB *\fImdb\fB, const char *\fIkstr\fB);\fR
2125
+ .RS
2126
+ `\fImdb\fR' specifies the on\-memory hash database object.
2127
+ .RE
2128
+ .RS
2129
+ `\fIkstr\fR' specifies the string of the key.
2130
+ .RE
2131
+ .RS
2132
+ If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
2133
+ .RE
2134
+ .RE
2135
+ .PP
2136
+ The function `tcmdbiterinit' is used in order to initialize the iterator of an on\-memory hash database object.
2137
+ .PP
2138
+ .RS
2139
+ .br
2140
+ \fBvoid tcmdbiterinit(TCMDB *\fImdb\fB);\fR
2141
+ .RS
2142
+ `\fImdb\fR' specifies the on\-memory hash database object.
2143
+ .RE
2144
+ .RS
2145
+ The iterator is used in order to access the key of every record stored in the on\-memory hash database.
2146
+ .RE
2147
+ .RE
2148
+ .PP
2149
+ The function `tcmdbiternext' is used in order to get the next key of the iterator of an on\-memory hash database object.
2150
+ .PP
2151
+ .RS
2152
+ .br
2153
+ \fBvoid *tcmdbiternext(TCMDB *\fImdb\fB, int *\fIsp\fB);\fR
2154
+ .RS
2155
+ `\fImdb\fR' specifies the on\-memory hash database object.
2156
+ .RE
2157
+ .RS
2158
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return
2159
+ .RE
2160
+ .RS
2161
+ value is assigned.
2162
+ .RE
2163
+ .RS
2164
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
2165
+ .RE
2166
+ .RS
2167
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. The order of iteration is assured to be the same as the stored order.
2168
+ .RE
2169
+ .RE
2170
+ .PP
2171
+ The function `tcmdbiternext2' is used in order to get the next key string of the iterator of an on\-memory hash database object.
2172
+ .PP
2173
+ .RS
2174
+ .br
2175
+ \fBchar *tcmdbiternext2(TCMDB *\fImdb\fB);\fR
2176
+ .RS
2177
+ `\fImdb\fR' specifies the on\-memory hash database object.
2178
+ .RE
2179
+ .RS
2180
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
2181
+ .RE
2182
+ .RS
2183
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. The order of iteration is assured to be the same as the stored order.
2184
+ .RE
2185
+ .RE
2186
+ .PP
2187
+ The function `tcmdbfwmkeys' is used in order to get forward matching keys in an on\-memory hash database object.
2188
+ .PP
2189
+ .RS
2190
+ .br
2191
+ \fBTCLIST *tcmdbfwmkeys(TCMDB *\fImdb\fB, const void *\fIpbuf\fB, int \fIpsiz\fB, int \fImax\fB);\fR
2192
+ .RS
2193
+ `\fImdb\fR' specifies the on\-memory hash database object.
2194
+ .RE
2195
+ .RS
2196
+ `\fIpbuf\fR' specifies the pointer to the region of the prefix.
2197
+ .RE
2198
+ .RS
2199
+ `\fIpsiz\fR' specifies the size of the region of the prefix.
2200
+ .RE
2201
+ .RS
2202
+ `\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
2203
+ .RE
2204
+ .RS
2205
+ The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
2206
+ .RE
2207
+ .RS
2208
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. Note that this function may be very slow because every key in the database is scanned.
2209
+ .RE
2210
+ .RE
2211
+ .PP
2212
+ The function `tcmdbfwmkeys2' is used in order to get forward matching string keys in an on\-memory hash database object.
2213
+ .PP
2214
+ .RS
2215
+ .br
2216
+ \fBTCLIST *tcmdbfwmkeys2(TCMDB *\fImdb\fB, const char *\fIpstr\fB, int \fImax\fB);\fR
2217
+ .RS
2218
+ `\fImdb\fR' specifies the on\-memory hash database object.
2219
+ .RE
2220
+ .RS
2221
+ `\fIpstr\fR' specifies the string of the prefix.
2222
+ .RE
2223
+ .RS
2224
+ `\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
2225
+ .RE
2226
+ .RS
2227
+ The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
2228
+ .RE
2229
+ .RS
2230
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. Note that this function may be very slow because every key in the database is scanned.
2231
+ .RE
2232
+ .RE
2233
+ .PP
2234
+ The function `tcmdbrnum' is used in order to get the number of records stored in an on\-memory hash database object.
2235
+ .PP
2236
+ .RS
2237
+ .br
2238
+ \fBuint64_t tcmdbrnum(TCMDB *\fImdb\fB);\fR
2239
+ .RS
2240
+ `\fImdb\fR' specifies the on\-memory hash database object.
2241
+ .RE
2242
+ .RS
2243
+ The return value is the number of the records stored in the database.
2244
+ .RE
2245
+ .RE
2246
+ .PP
2247
+ The function `tcmdbmsiz' is used in order to get the total size of memory used in an on\-memory hash database object.
2248
+ .PP
2249
+ .RS
2250
+ .br
2251
+ \fBuint64_t tcmdbmsiz(TCMDB *\fImdb\fB);\fR
2252
+ .RS
2253
+ `\fImdb\fR' specifies the on\-memory hash database object.
2254
+ .RE
2255
+ .RS
2256
+ The return value is the total size of memory used in the database.
2257
+ .RE
2258
+ .RE
2259
+ .PP
2260
+ The function `tcmdbaddint' is used in order to add an integer to a record in an on\-memory hash database object.
2261
+ .PP
2262
+ .RS
2263
+ .br
2264
+ \fBint tcmdbaddint(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR
2265
+ .RS
2266
+ `\fImdb\fR' specifies the on\-memory hash database object.
2267
+ .RE
2268
+ .RS
2269
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2270
+ .RE
2271
+ .RS
2272
+ `\fIksiz\fR' specifies the size of the region of the key.
2273
+ .RE
2274
+ .RS
2275
+ `\fInum\fR' specifies the additional value.
2276
+ .RE
2277
+ .RS
2278
+ The return value is the summation value.
2279
+ .RE
2280
+ .RS
2281
+ If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.
2282
+ .RE
2283
+ .RE
2284
+ .PP
2285
+ The function `tcmdbadddouble' is used in order to add a real number to a record in an on\-memory hash database object.
2286
+ .PP
2287
+ .RS
2288
+ .br
2289
+ \fBdouble tcmdbadddouble(TCMDB *\fImdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR
2290
+ .RS
2291
+ `\fImdb\fR' specifies the on\-memory hash database object.
2292
+ .RE
2293
+ .RS
2294
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2295
+ .RE
2296
+ .RS
2297
+ `\fIksiz\fR' specifies the size of the region of the key.
2298
+ .RE
2299
+ .RS
2300
+ `\fInum\fR' specifies the additional value.
2301
+ .RE
2302
+ .RS
2303
+ The return value is the summation value.
2304
+ .RE
2305
+ .RS
2306
+ If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.
2307
+ .RE
2308
+ .RE
2309
+ .PP
2310
+ The function `tcmdbvanish' is used in order to clear an on\-memory hash database object.
2311
+ .PP
2312
+ .RS
2313
+ .br
2314
+ \fBvoid tcmdbvanish(TCMDB *\fImdb\fB);\fR
2315
+ .RS
2316
+ `\fImdb\fR' specifies the on\-memory hash database object.
2317
+ .RE
2318
+ .RS
2319
+ All records are removed.
2320
+ .RE
2321
+ .RE
2322
+ .PP
2323
+ The function `tcmdbcutfront' is used in order to remove front records of an on\-memory hash database object.
2324
+ .PP
2325
+ .RS
2326
+ .br
2327
+ \fBvoid tcmdbcutfront(TCMDB *\fImdb\fB, int \fInum\fB);\fR
2328
+ .RS
2329
+ `\fImdb\fR' specifies the on\-memory hash database object.
2330
+ .RE
2331
+ .RS
2332
+ `\fInum\fR' specifies the number of records to be removed.
2333
+ .RE
2334
+ .RE
2335
+
2336
+ .SH API OF ON\-MEMORY TREE DATABASE
2337
+ .PP
2338
+ The function `tcndbnew' is used in order to create an on\-memory tree database object.
2339
+ .PP
2340
+ .RS
2341
+ .br
2342
+ \fBTCNDB *tcndbnew(void);\fR
2343
+ .RS
2344
+ The return value is the new on\-memory tree database object.
2345
+ .RE
2346
+ .RS
2347
+ The object can be shared by plural threads because of the internal mutex.
2348
+ .RE
2349
+ .RE
2350
+ .PP
2351
+ The function `tcndbnew2' is used in order to create an on\-memory tree database object with specifying the custom comparison function.
2352
+ .PP
2353
+ .RS
2354
+ .br
2355
+ \fBTCNDB *tcndbnew2(TCCMP \fIcmp\fB, void *\fIcmpop\fB);\fR
2356
+ .RS
2357
+ `\fIcmp\fR' specifies the pointer to the custom comparison function.
2358
+ .RE
2359
+ .RS
2360
+ `\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function. If it is not needed, `NULL' can be specified.
2361
+ .RE
2362
+ .RS
2363
+ The return value is the new on\-memory tree database object.
2364
+ .RE
2365
+ .RS
2366
+ The default comparison function compares keys of two records by lexical order. The functions `tccmplexical' (dafault), `tccmpdecimal', `tccmpint32', and `tccmpint64' are built\-in. The object can be shared by plural threads because of the internal mutex.
2367
+ .RE
2368
+ .RE
2369
+ .PP
2370
+ The function `tcndbdel' is used in order to delete an on\-memory tree database object.
2371
+ .PP
2372
+ .RS
2373
+ .br
2374
+ \fBvoid tcndbdel(TCNDB *\fIndb\fB);\fR
2375
+ .RS
2376
+ `\fIndb\fR' specifies the on\-memory tree database object.
2377
+ .RE
2378
+ .RE
2379
+ .PP
2380
+ The function `tcndbput' is used in order to store a record into an on\-memory tree database object.
2381
+ .PP
2382
+ .RS
2383
+ .br
2384
+ \fBvoid tcndbput(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
2385
+ .RS
2386
+ `\fIndb\fR' specifies the on\-memory tree database object.
2387
+ .RE
2388
+ .RS
2389
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2390
+ .RE
2391
+ .RS
2392
+ `\fIksiz\fR' specifies the size of the region of the key.
2393
+ .RE
2394
+ .RS
2395
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
2396
+ .RE
2397
+ .RS
2398
+ `\fIvsiz\fR' specifies the size of the region of the value.
2399
+ .RE
2400
+ .RS
2401
+ If a record with the same key exists in the database, it is overwritten.
2402
+ .RE
2403
+ .RE
2404
+ .PP
2405
+ The function `tcndbput2' is used in order to store a string record into an on\-memory tree database object.
2406
+ .PP
2407
+ .RS
2408
+ .br
2409
+ \fBvoid tcndbput2(TCNDB *\fIndb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
2410
+ .RS
2411
+ `\fIndb\fR' specifies the on\-memory tree database object.
2412
+ .RE
2413
+ .RS
2414
+ `\fIkstr\fR' specifies the string of the key.
2415
+ .RE
2416
+ .RS
2417
+ `\fIvstr\fR' specifies the string of the value.
2418
+ .RE
2419
+ .RS
2420
+ If a record with the same key exists in the database, it is overwritten.
2421
+ .RE
2422
+ .RE
2423
+ .PP
2424
+ The function `tcndbputkeep' is used in order to store a new record into an on\-memory tree database object.
2425
+ .PP
2426
+ .RS
2427
+ .br
2428
+ \fBbool tcndbputkeep(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
2429
+ .RS
2430
+ `\fIndb\fR' specifies the on\-memory tree database object.
2431
+ .RE
2432
+ .RS
2433
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2434
+ .RE
2435
+ .RS
2436
+ `\fIksiz\fR' specifies the size of the region of the key.
2437
+ .RE
2438
+ .RS
2439
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
2440
+ .RE
2441
+ .RS
2442
+ `\fIvsiz\fR' specifies the size of the region of the value.
2443
+ .RE
2444
+ .RS
2445
+ If successful, the return value is true, else, it is false.
2446
+ .RE
2447
+ .RS
2448
+ If a record with the same key exists in the database, this function has no effect.
2449
+ .RE
2450
+ .RE
2451
+ .PP
2452
+ The function `tcndbputkeep2' is used in order to store a new string record into an on\-memory tree database object.
2453
+ .PP
2454
+ .RS
2455
+ .br
2456
+ \fBbool tcndbputkeep2(TCNDB *\fIndb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
2457
+ .RS
2458
+ `\fIndb\fR' specifies the on\-memory tree database object.
2459
+ .RE
2460
+ .RS
2461
+ `\fIkstr\fR' specifies the string of the key.
2462
+ .RE
2463
+ .RS
2464
+ `\fIvstr\fR' specifies the string of the value.
2465
+ .RE
2466
+ .RS
2467
+ If successful, the return value is true, else, it is false.
2468
+ .RE
2469
+ .RS
2470
+ If a record with the same key exists in the database, this function has no effect.
2471
+ .RE
2472
+ .RE
2473
+ .PP
2474
+ The function `tcndbputcat' is used in order to concatenate a value at the end of the existing record in an on\-memory tree database.
2475
+ .PP
2476
+ .RS
2477
+ .br
2478
+ \fBvoid tcndbputcat(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
2479
+ .RS
2480
+ `\fIndb\fR' specifies the on\-memory tree database object.
2481
+ .RE
2482
+ .RS
2483
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2484
+ .RE
2485
+ .RS
2486
+ `\fIksiz\fR' specifies the size of the region of the key.
2487
+ .RE
2488
+ .RS
2489
+ `\fIvbuf\fR' specifies the pointer to the region of the value.
2490
+ .RE
2491
+ .RS
2492
+ `\fIvsiz\fR' specifies the size of the region of the value.
2493
+ .RE
2494
+ .RS
2495
+ If there is no corresponding record, a new record is created.
2496
+ .RE
2497
+ .RE
2498
+ .PP
2499
+ The function `tcndbputcat2' is used in order to concatenate a string at the end of the existing record in an on\-memory tree database.
2500
+ .PP
2501
+ .RS
2502
+ .br
2503
+ \fBvoid tcndbputcat2(TCNDB *\fIndb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
2504
+ .RS
2505
+ `\fIndb\fR' specifies the on\-memory tree database object.
2506
+ .RE
2507
+ .RS
2508
+ `\fIkstr\fR' specifies the string of the key.
2509
+ .RE
2510
+ .RS
2511
+ `\fIvstr\fR' specifies the string of the value.
2512
+ .RE
2513
+ .RS
2514
+ If there is no corresponding record, a new record is created.
2515
+ .RE
2516
+ .RE
2517
+ .PP
2518
+ The function `tcndbout' is used in order to remove a record of an on\-memory tree database object.
2519
+ .PP
2520
+ .RS
2521
+ .br
2522
+ \fBbool tcndbout(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
2523
+ .RS
2524
+ `\fIndb\fR' specifies the on\-memory tree database object.
2525
+ .RE
2526
+ .RS
2527
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2528
+ .RE
2529
+ .RS
2530
+ `\fIksiz\fR' specifies the size of the region of the key.
2531
+ .RE
2532
+ .RS
2533
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
2534
+ .RE
2535
+ .RE
2536
+ .PP
2537
+ The function `tcndbout2' is used in order to remove a string record of an on\-memory tree database object.
2538
+ .PP
2539
+ .RS
2540
+ .br
2541
+ \fBbool tcndbout2(TCNDB *\fIndb\fB, const char *\fIkstr\fB);\fR
2542
+ .RS
2543
+ `\fIndb\fR' specifies the on\-memory tree database object.
2544
+ .RE
2545
+ .RS
2546
+ `\fIkstr\fR' specifies the string of the key.
2547
+ .RE
2548
+ .RS
2549
+ If successful, the return value is true. False is returned when no record corresponds to the specified key.
2550
+ .RE
2551
+ .RE
2552
+ .PP
2553
+ The function `tcndbget' is used in order to retrieve a record in an on\-memory tree database object.
2554
+ .PP
2555
+ .RS
2556
+ .br
2557
+ \fBvoid *tcndbget(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR
2558
+ .RS
2559
+ `\fIndb\fR' specifies the on\-memory tree database object.
2560
+ .RE
2561
+ .RS
2562
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2563
+ .RE
2564
+ .RS
2565
+ `\fIksiz\fR' specifies the size of the region of the key.
2566
+ .RE
2567
+ .RS
2568
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
2569
+ .RE
2570
+ .RS
2571
+ If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned when no record corresponds.
2572
+ .RE
2573
+ .RS
2574
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
2575
+ .RE
2576
+ .RE
2577
+ .PP
2578
+ The function `tcndbget2' is used in order to retrieve a string record in an on\-memory tree database object.
2579
+ .PP
2580
+ .RS
2581
+ .br
2582
+ \fBchar *tcndbget2(TCNDB *\fIndb\fB, const char *\fIkstr\fB);\fR
2583
+ .RS
2584
+ `\fIndb\fR' specifies the on\-memory tree database object.
2585
+ .RE
2586
+ .RS
2587
+ `\fIkstr\fR' specifies the string of the key.
2588
+ .RE
2589
+ .RS
2590
+ If successful, the return value is the string of the value of the corresponding record. `NULL' is returned when no record corresponds.
2591
+ .RE
2592
+ .RS
2593
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
2594
+ .RE
2595
+ .RE
2596
+ .PP
2597
+ The function `tcndbvsiz' is used in order to get the size of the value of a record in an on\-memory tree database object.
2598
+ .PP
2599
+ .RS
2600
+ .br
2601
+ \fBint tcndbvsiz(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
2602
+ .RS
2603
+ `\fIndb\fR' specifies the on\-memory tree database object.
2604
+ .RE
2605
+ .RS
2606
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2607
+ .RE
2608
+ .RS
2609
+ `\fIksiz\fR' specifies the size of the region of the key.
2610
+ .RE
2611
+ .RS
2612
+ If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
2613
+ .RE
2614
+ .RE
2615
+ .PP
2616
+ The function `tcndbvsiz2' is used in order to get the size of the value of a string record in an on\-memory tree database object.
2617
+ .PP
2618
+ .RS
2619
+ .br
2620
+ \fBint tcndbvsiz2(TCNDB *\fIndb\fB, const char *\fIkstr\fB);\fR
2621
+ .RS
2622
+ `\fIndb\fR' specifies the on\-memory tree database object.
2623
+ .RE
2624
+ .RS
2625
+ `\fIkstr\fR' specifies the string of the key.
2626
+ .RE
2627
+ .RS
2628
+ If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
2629
+ .RE
2630
+ .RE
2631
+ .PP
2632
+ The function `tcndbiterinit' is used in order to initialize the iterator of an on\-memory tree database object.
2633
+ .PP
2634
+ .RS
2635
+ .br
2636
+ \fBvoid tcndbiterinit(TCNDB *\fIndb\fB);\fR
2637
+ .RS
2638
+ `\fIndb\fR' specifies the on\-memory tree database object.
2639
+ .RE
2640
+ .RS
2641
+ The iterator is used in order to access the key of every record stored in the on\-memory database.
2642
+ .RE
2643
+ .RE
2644
+ .PP
2645
+ The function `tcndbiternext' is used in order to get the next key of the iterator of an on\-memory tree database object.
2646
+ .PP
2647
+ .RS
2648
+ .br
2649
+ \fBvoid *tcndbiternext(TCNDB *\fIndb\fB, int *\fIsp\fB);\fR
2650
+ .RS
2651
+ `\fIndb\fR' specifies the on\-memory tree database object.
2652
+ .RE
2653
+ .RS
2654
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
2655
+ .RE
2656
+ .RS
2657
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
2658
+ .RE
2659
+ .RS
2660
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. The order of iteration is assured to be the same as the stored order.
2661
+ .RE
2662
+ .RE
2663
+ .PP
2664
+ The function `tcndbiternext2' is used in order to get the next key string of the iterator of an on\-memory tree database object.
2665
+ .PP
2666
+ .RS
2667
+ .br
2668
+ \fBchar *tcndbiternext2(TCNDB *\fIndb\fB);\fR
2669
+ .RS
2670
+ `\fIndb\fR' specifies the on\-memory tree database object.
2671
+ .RE
2672
+ .RS
2673
+ If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record can be fetched from the iterator.
2674
+ .RE
2675
+ .RS
2676
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. The order of iteration is assured to be the same as the stored order.
2677
+ .RE
2678
+ .RE
2679
+ .PP
2680
+ The function `tcndbfwmkeys' is used in order to get forward matching keys in an on\-memory tree database object.
2681
+ .PP
2682
+ .RS
2683
+ .br
2684
+ \fBTCLIST *tcndbfwmkeys(TCNDB *\fIndb\fB, const void *\fIpbuf\fB, int \fIpsiz\fB, int \fImax\fB);\fR
2685
+ .RS
2686
+ `\fIndb\fR' specifies the on\-memory tree database object.
2687
+ .RE
2688
+ .RS
2689
+ `\fIpbuf\fR' specifies the pointer to the region of the prefix.
2690
+ .RE
2691
+ .RS
2692
+ `\fIpsiz\fR' specifies the size of the region of the prefix.
2693
+ .RE
2694
+ .RS
2695
+ `\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
2696
+ .RE
2697
+ .RS
2698
+ The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
2699
+ .RE
2700
+ .RS
2701
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
2702
+ .RE
2703
+ .RE
2704
+ .PP
2705
+ The function `tcndbfwmkeys2' is used in order to get forward matching string keys in an on\-memory tree database object.
2706
+ .PP
2707
+ .RS
2708
+ .br
2709
+ \fBTCLIST *tcndbfwmkeys2(TCNDB *\fIndb\fB, const char *\fIpstr\fB, int \fImax\fB);\fR
2710
+ .RS
2711
+ `\fIndb\fR' specifies the on\-memory tree database object.
2712
+ .RE
2713
+ .RS
2714
+ `\fIpstr\fR' specifies the string of the prefix.
2715
+ .RE
2716
+ .RS
2717
+ `\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
2718
+ .RE
2719
+ .RS
2720
+ The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
2721
+ .RE
2722
+ .RS
2723
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
2724
+ .RE
2725
+ .RE
2726
+ .PP
2727
+ The function `tcndbrnum' is used in order to get the number of records stored in an on\-memory tree database object.
2728
+ .PP
2729
+ .RS
2730
+ .br
2731
+ \fBuint64_t tcndbrnum(TCNDB *\fIndb\fB);\fR
2732
+ .RS
2733
+ `\fIndb\fR' specifies the on\-memory tree database object.
2734
+ .RE
2735
+ .RS
2736
+ The return value is the number of the records stored in the database.
2737
+ .RE
2738
+ .RE
2739
+ .PP
2740
+ The function `tcndbmsiz' is used in order to get the total size of memory used in an on\-memory tree database object.
2741
+ .PP
2742
+ .RS
2743
+ .br
2744
+ \fBuint64_t tcndbmsiz(TCNDB *\fIndb\fB);\fR
2745
+ .RS
2746
+ `\fIndb\fR' specifies the on\-memory tree database object.
2747
+ .RE
2748
+ .RS
2749
+ The return value is the total size of memory used in the database.
2750
+ .RE
2751
+ .RE
2752
+ .PP
2753
+ The function `tcndbaddint' is used in order to add an integer to a record in an on\-memory tree database object.
2754
+ .PP
2755
+ .RS
2756
+ .br
2757
+ \fBint tcndbaddint(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR
2758
+ .RS
2759
+ `\fIndb\fR' specifies the on\-memory tree database object.
2760
+ .RE
2761
+ .RS
2762
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2763
+ .RE
2764
+ .RS
2765
+ `\fIksiz\fR' specifies the size of the region of the key.
2766
+ .RE
2767
+ .RS
2768
+ `\fInum\fR' specifies the additional value.
2769
+ .RE
2770
+ .RS
2771
+ The return value is the summation value.
2772
+ .RE
2773
+ .RS
2774
+ If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.
2775
+ .RE
2776
+ .RE
2777
+ .PP
2778
+ The function `tcndbadddouble' is used in order to add a real number to a record in an on\-memory tree database object.
2779
+ .PP
2780
+ .RS
2781
+ .br
2782
+ \fBdouble tcndbadddouble(TCNDB *\fIndb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR
2783
+ .RS
2784
+ `\fIndb\fR' specifies the on\-memory tree database object.
2785
+ .RE
2786
+ .RS
2787
+ `\fIkbuf\fR' specifies the pointer to the region of the key.
2788
+ .RE
2789
+ .RS
2790
+ `\fIksiz\fR' specifies the size of the region of the key.
2791
+ .RE
2792
+ .RS
2793
+ `\fInum\fR' specifies the additional value.
2794
+ .RE
2795
+ .RS
2796
+ The return value is the summation value.
2797
+ .RE
2798
+ .RS
2799
+ If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.
2800
+ .RE
2801
+ .RE
2802
+ .PP
2803
+ The function `tcndbvanish' is used in order to clear an on\-memory tree database object.
2804
+ .PP
2805
+ .RS
2806
+ .br
2807
+ \fBvoid tcndbvanish(TCNDB *\fIndb\fB);\fR
2808
+ .RS
2809
+ `\fIndb\fR' specifies the on\-memory tree database object.
2810
+ .RE
2811
+ .RS
2812
+ All records are removed.
2813
+ .RE
2814
+ .RE
2815
+ .PP
2816
+ The function `tcndbcutfringe' is used in order to remove fringe records of an on\-memory tree database object.
2817
+ .PP
2818
+ .RS
2819
+ .br
2820
+ \fBvoid tcndbcutfringe(TCNDB *\fIndb\fB, int \fInum\fB);\fR
2821
+ .RS
2822
+ `\fIndb\fR' specifies the on\-memory tree database object.
2823
+ .RE
2824
+ .RS
2825
+ `\fInum\fR' specifies the number of records to be removed.
2826
+ .RE
2827
+ .RE
2828
+
2829
+ .SH API OF MEMORY POOL
2830
+ .PP
2831
+ The function `tcmpoolnew' is used in order to create a memory pool object.
2832
+ .PP
2833
+ .RS
2834
+ .br
2835
+ \fBTCMPOOL *tcmpoolnew(void);\fR
2836
+ .RS
2837
+ The return value is the new memory pool object.
2838
+ .RE
2839
+ .RE
2840
+ .PP
2841
+ The function `tcmpooldel' is used in order to delete a memory pool object.
2842
+ .PP
2843
+ .RS
2844
+ .br
2845
+ \fBvoid tcmpooldel(TCMPOOL *\fImpool\fB);\fR
2846
+ .RS
2847
+ `\fImpool\fR' specifies the memory pool object.
2848
+ .RE
2849
+ .RS
2850
+ Note that the deleted object and its derivatives can not be used anymore.
2851
+ .RE
2852
+ .RE
2853
+ .PP
2854
+ The function `tcmpoolpush' is used in order to relegate an arbitrary object to a memory pool object.
2855
+ .PP
2856
+ .RS
2857
+ .br
2858
+ \fBvoid *tcmpoolpush(TCMPOOL *\fImpool\fB, void *\fIptr\fB, void (*\fIdel\fB)(void *));\fR
2859
+ .RS
2860
+ `\fImpool\fR' specifies the memory pool object.
2861
+ .RE
2862
+ .RS
2863
+ `\fIptr\fR' specifies the pointer to the object to be relegated. If it is `NULL', this function has no effect.
2864
+ .RE
2865
+ .RS
2866
+ `\fIdel\fR' specifies the pointer to the function to delete the object.
2867
+ .RE
2868
+ .RS
2869
+ The return value is the pointer to the given object.
2870
+ .RE
2871
+ .RS
2872
+ This function assures that the specified object is deleted when the memory pool object is deleted.
2873
+ .RE
2874
+ .RE
2875
+ .PP
2876
+ The function `tcmpoolpushptr' is used in order to relegate an allocated region to a memory pool object.
2877
+ .PP
2878
+ .RS
2879
+ .br
2880
+ \fBvoid *tcmpoolpushptr(TCMPOOL *\fImpool\fB, void *\fIptr\fB);\fR
2881
+ .RS
2882
+ `\fImpool\fR' specifies the memory pool object.
2883
+ .RE
2884
+ .RS
2885
+ `\fIptr\fR' specifies the pointer to the region to be relegated. If it is `NULL', this function has no effect.
2886
+ .RE
2887
+ .RS
2888
+ The return value is the pointer to the given object.
2889
+ .RE
2890
+ .RS
2891
+ This function assures that the specified region is released when the memory pool object is deleted.
2892
+ .RE
2893
+ .RE
2894
+ .PP
2895
+ The function `tcmpoolpushxstr' is used in order to relegate an extensible string object to a memory pool object.
2896
+ .PP
2897
+ .RS
2898
+ .br
2899
+ \fBTCXSTR *tcmpoolpushxstr(TCMPOOL *\fImpool\fB, TCXSTR *\fIxstr\fB);\fR
2900
+ .RS
2901
+ `\fImpool\fR' specifies the memory pool object.
2902
+ .RE
2903
+ .RS
2904
+ `\fIxstr\fR' specifies the extensible string object. If it is `NULL', this function has no effect.
2905
+ .RE
2906
+ .RS
2907
+ The return value is the pointer to the given object.
2908
+ .RE
2909
+ .RS
2910
+ This function assures that the specified object is deleted when the memory pool object is deleted.
2911
+ .RE
2912
+ .RE
2913
+ .PP
2914
+ The function `tcmpoolpushlist' is used in order to relegate a list object to a memory pool object.
2915
+ .PP
2916
+ .RS
2917
+ .br
2918
+ \fBTCLIST *tcmpoolpushlist(TCMPOOL *\fImpool\fB, TCLIST *\fIlist\fB);\fR
2919
+ .RS
2920
+ `\fImpool\fR' specifies the memory pool object.
2921
+ .RE
2922
+ .RS
2923
+ `\fIlist\fR' specifies the list object. If it is `NULL', this function has no effect.
2924
+ .RE
2925
+ .RS
2926
+ The return value is the pointer to the given object.
2927
+ .RE
2928
+ .RS
2929
+ This function assures that the specified object is deleted when the memory pool object is deleted.
2930
+ .RE
2931
+ .RE
2932
+ .PP
2933
+ The function `tcmpoolpushmap' is used in order to relegate a map object to a memory pool object.
2934
+ .PP
2935
+ .RS
2936
+ .br
2937
+ \fBTCMAP *tcmpoolpushmap(TCMPOOL *\fImpool\fB, TCMAP *\fImap\fB);\fR
2938
+ .RS
2939
+ `\fImpool\fR' specifies the memory pool object.
2940
+ .RE
2941
+ .RS
2942
+ `\fImap\fR' specifies the map object. If it is `NULL', this function has no effect.
2943
+ .RE
2944
+ .RS
2945
+ The return value is the pointer to the given object.
2946
+ .RE
2947
+ .RS
2948
+ This function assures that the specified object is deleted when the memory pool object is deleted.
2949
+ .RE
2950
+ .RE
2951
+ .PP
2952
+ The function `tcmpoolpushtree' is used in order to relegate a tree object to a memory pool object.
2953
+ .PP
2954
+ .RS
2955
+ .br
2956
+ \fBTCTREE *tcmpoolpushtree(TCMPOOL *\fImpool\fB, TCTREE *\fItree\fB);\fR
2957
+ .RS
2958
+ `\fImpool\fR' specifies the memory pool object.
2959
+ .RE
2960
+ .RS
2961
+ `\fItree\fR' specifies the tree object. If it is `NULL', this function has no effect.
2962
+ .RE
2963
+ .RS
2964
+ The return value is the pointer to the given object.
2965
+ .RE
2966
+ .RS
2967
+ This function assures that the specified object is deleted when the memory pool object is deleted.
2968
+ .RE
2969
+ .RE
2970
+ .PP
2971
+ The function `tcmpoolmalloc' is used in order to allocate a region relegated to a memory pool object.
2972
+ .PP
2973
+ .RS
2974
+ .br
2975
+ \fBvoid *tcmpoolmalloc(TCMPOOL *\fImpool\fB, size_t \fIsize\fB);\fR
2976
+ .RS
2977
+ `\fImpool\fR' specifies the memory pool object.
2978
+ .RE
2979
+ .RS
2980
+ The return value is the pointer to the allocated region under the memory pool.
2981
+ .RE
2982
+ .RE
2983
+ .PP
2984
+ The function `tcmpoolxstrnew' is used in order to create an extensible string object relegated to a memory pool object.
2985
+ .PP
2986
+ .RS
2987
+ .br
2988
+ \fBTCXSTR *tcmpoolxstrnew(TCMPOOL *\fImpool\fB);\fR
2989
+ .RS
2990
+ The return value is the new extensible string object under the memory pool.
2991
+ .RE
2992
+ .RE
2993
+ .PP
2994
+ The function `tcmpoollistnew' is used in order to create a list object relegated to a memory pool object.
2995
+ .PP
2996
+ .RS
2997
+ .br
2998
+ \fBTCLIST *tcmpoollistnew(TCMPOOL *\fImpool\fB);\fR
2999
+ .RS
3000
+ The return value is the new list object under the memory pool.
3001
+ .RE
3002
+ .RE
3003
+ .PP
3004
+ The function `tcmpoolmapnew' is used in order to create a map object relegated to a memory pool object.
3005
+ .PP
3006
+ .RS
3007
+ .br
3008
+ \fBTCMAP *tcmpoolmapnew(TCMPOOL *\fImpool\fB);\fR
3009
+ .RS
3010
+ The return value is the new map object under the memory pool.
3011
+ .RE
3012
+ .RE
3013
+ .PP
3014
+ The function `tcmpooltreenew' is used in order to create a tree object relegated to a memory pool object.
3015
+ .PP
3016
+ .RS
3017
+ .br
3018
+ \fBTCTREE *tcmpooltreenew(TCMPOOL *\fImpool\fB);\fR
3019
+ .RS
3020
+ The return value is the new tree object under the memory pool.
3021
+ .RE
3022
+ .RE
3023
+ .PP
3024
+ The function `tcmpoolpop' is used in order to remove the most recently installed cleanup handler of a memory pool object.
3025
+ .PP
3026
+ .RS
3027
+ .br
3028
+ \fBvoid tcmpoolpop(TCMPOOL *\fImpool\fB, bool \fIexe\fB);\fR
3029
+ .RS
3030
+ `\fImpool\fR' specifies the memory pool object.
3031
+ .RE
3032
+ .RS
3033
+ `\fIexe\fR' specifies whether to execute the destructor of the removed handler.
3034
+ .RE
3035
+ .RE
3036
+ .PP
3037
+ The function `tcmpoolclear' is used in order to remove all cleanup handler of a memory pool object.
3038
+ .PP
3039
+ .RS
3040
+ .br
3041
+ \fBvoid tcmpoolclear(TCMPOOL *\fImpool\fB, bool \fIexe\fB);\fR
3042
+ .RS
3043
+ `\fImpool\fR' specifies the memory pool object.
3044
+ .RE
3045
+ .RS
3046
+ `\fIexe\fR' specifies whether to execute the destructors of the removed handlers.
3047
+ .RE
3048
+ .RE
3049
+ .PP
3050
+ The function `tcmpoolglobal' is used in order to get the global memory pool object.
3051
+ .PP
3052
+ .RS
3053
+ .br
3054
+ \fBTCMPOOL *tcmpoolglobal(void);\fR
3055
+ .RS
3056
+ The return value is the global memory pool object.
3057
+ .RE
3058
+ .RS
3059
+ The global memory pool object is a singleton and assured to be deleted when the process is terminating normally.
3060
+ .RE
3061
+ .RE
3062
+
3063
+ .SH API OF MISCELLANEOUS UTILITIES
3064
+ .PP
3065
+ The function `tclmax' is used in order to get the larger value of two integers.
3066
+ .PP
3067
+ .RS
3068
+ .br
3069
+ \fBlong tclmax(long \fIa\fB, long \fIb\fB);\fR
3070
+ .RS
3071
+ `\fIa\fR' specifies an integer.
3072
+ .RE
3073
+ .RS
3074
+ `\fIb\fR' specifies the other integer.
3075
+ .RE
3076
+ .RS
3077
+ The return value is the larger value of the two.
3078
+ .RE
3079
+ .RE
3080
+ .PP
3081
+ The function `tclmin' is used in order to get the lesser value of two integers.
3082
+ .PP
3083
+ .RS
3084
+ .br
3085
+ \fBlong tclmin(long \fIa\fB, long \fIb\fB);\fR
3086
+ .RS
3087
+ `\fIa\fR' specifies an integer.
3088
+ .RE
3089
+ .RS
3090
+ `\fIb\fR' specifies the other integer.
3091
+ .RE
3092
+ .RS
3093
+ The return value is the lesser value of the two.
3094
+ .RE
3095
+ .RE
3096
+ .PP
3097
+ The function `tclrand' is used in order to get a random number as long integer based on uniform distribution.
3098
+ .PP
3099
+ .RS
3100
+ .br
3101
+ \fBunsigned long tclrand(void);\fR
3102
+ .RS
3103
+ The return value is the random number between 0 and `ULONG_MAX'.
3104
+ .RE
3105
+ .RS
3106
+ This function uses the random number source device and generates a real random number if possible.
3107
+ .RE
3108
+ .RE
3109
+ .PP
3110
+ The function `tcdrand' is used in order to get a random number as double decimal based on uniform distribution.
3111
+ .PP
3112
+ .RS
3113
+ .br
3114
+ \fBdouble tcdrand(void);\fR
3115
+ .RS
3116
+ The return value is the random number equal to or greater than 0, and less than 1.0.
3117
+ .RE
3118
+ .RS
3119
+ This function uses the random number source device and generates a real random number if possible.
3120
+ .RE
3121
+ .RE
3122
+ .PP
3123
+ The function `tcdrandnd' is used in order to get a random number as double decimal based on normal distribution.
3124
+ .PP
3125
+ .RS
3126
+ .br
3127
+ \fBdouble tcdrandnd(double \fIavg\fB, double \fIsd\fB);\fR
3128
+ .RS
3129
+ `\fIavg\fR' specifies the average.
3130
+ .RE
3131
+ .RS
3132
+ `\fIsd\fR' specifies the standard deviation.
3133
+ .RE
3134
+ .RS
3135
+ The return value is the random number.
3136
+ .RE
3137
+ .RS
3138
+ This function uses the random number source device and generates a real random number if possible.
3139
+ .RE
3140
+ .RE
3141
+ .PP
3142
+ The function `tcstricmp' is used in order to compare two strings with case insensitive evaluation.
3143
+ .PP
3144
+ .RS
3145
+ .br
3146
+ \fBint tcstricmp(const char *\fIastr\fB, const char *\fIbstr\fB);\fR
3147
+ .RS
3148
+ `\fIastr\fR' specifies a string.
3149
+ .RE
3150
+ .RS
3151
+ `\fIbstr\fR' specifies of the other string.
3152
+ .RE
3153
+ .RS
3154
+ The return value is positive if the former is big, negative if the latter is big, 0 if both are equivalent.
3155
+ .RE
3156
+ .RE
3157
+ .PP
3158
+ The function `tcstrfwm' is used in order to check whether a string begins with a key.
3159
+ .PP
3160
+ .RS
3161
+ .br
3162
+ \fBbool tcstrfwm(const char *\fIstr\fB, const char *\fIkey\fB);\fR
3163
+ .RS
3164
+ `\fIstr\fR' specifies the target string.
3165
+ .RE
3166
+ .RS
3167
+ `\fIkey\fR' specifies the forward matching key string.
3168
+ .RE
3169
+ .RS
3170
+ The return value is true if the target string begins with the key, else, it is false.
3171
+ .RE
3172
+ .RE
3173
+ .PP
3174
+ The function `tcstrifwm' is used in order to check whether a string begins with a key with case insensitive evaluation.
3175
+ .PP
3176
+ .RS
3177
+ .br
3178
+ \fBbool tcstrifwm(const char *\fIstr\fB, const char *\fIkey\fB);\fR
3179
+ .RS
3180
+ `\fIstr\fR' specifies the target string.
3181
+ .RE
3182
+ .RS
3183
+ `\fIkey\fR' specifies the forward matching key string.
3184
+ .RE
3185
+ .RS
3186
+ The return value is true if the target string begins with the key, else, it is false.
3187
+ .RE
3188
+ .RE
3189
+ .PP
3190
+ The function `tcstrbwm' is used in order to check whether a string ends with a key.
3191
+ .PP
3192
+ .RS
3193
+ .br
3194
+ \fBbool tcstrbwm(const char *\fIstr\fB, const char *\fIkey\fB);\fR
3195
+ .RS
3196
+ `\fIstr\fR' specifies the target string.
3197
+ .RE
3198
+ .RS
3199
+ `\fIkey\fR' specifies the backward matching key string.
3200
+ .RE
3201
+ .RS
3202
+ The return value is true if the target string ends with the key, else, it is false.
3203
+ .RE
3204
+ .RE
3205
+ .PP
3206
+ The function `tcstribwm' is used in order to check whether a string ends with a key with case insensitive evaluation.
3207
+ .PP
3208
+ .RS
3209
+ .br
3210
+ \fBbool tcstribwm(const char *\fIstr\fB, const char *\fIkey\fB);\fR
3211
+ .RS
3212
+ `\fIstr\fR' specifies the target string.
3213
+ .RE
3214
+ .RS
3215
+ `\fIkey\fR' specifies the backward matching key string.
3216
+ .RE
3217
+ .RS
3218
+ The return value is true if the target string ends with the key, else, it is false.
3219
+ .RE
3220
+ .RE
3221
+ .PP
3222
+ The function `tcstrdist' is used in order to calculate the edit distance of two strings.
3223
+ .PP
3224
+ .RS
3225
+ .br
3226
+ \fBint tcstrdist(const char *\fIastr\fB, const char *\fIbstr\fB);\fR
3227
+ .RS
3228
+ `\fIastr\fR' specifies a string.
3229
+ .RE
3230
+ .RS
3231
+ `\fIbstr\fR' specifies of the other string.
3232
+ .RE
3233
+ .RS
3234
+ The return value is the edit distance which is known as the Levenshtein distance. The cost is calculated by byte.
3235
+ .RE
3236
+ .RE
3237
+ .PP
3238
+ The function `tcstrdistutf' is used in order to calculate the edit distance of two UTF\-8 strings.
3239
+ .PP
3240
+ .RS
3241
+ .br
3242
+ \fBint tcstrdistutf(const char *\fIastr\fB, const char *\fIbstr\fB);\fR
3243
+ .RS
3244
+ `\fIastr\fR' specifies a string.
3245
+ .RE
3246
+ .RS
3247
+ `\fIbstr\fR' specifies of the other string.
3248
+ .RE
3249
+ .RS
3250
+ The return value is the edit distance which is known as the Levenshtein distance. The cost is calculated by Unicode character.
3251
+ .RE
3252
+ .RE
3253
+ .PP
3254
+ The function `tcstrtoupper' is used in order to convert the letters of a string into upper case.
3255
+ .PP
3256
+ .RS
3257
+ .br
3258
+ \fBchar *tcstrtoupper(char *\fIstr\fB);\fR
3259
+ .RS
3260
+ `\fIstr\fR' specifies the string to be converted.
3261
+ .RE
3262
+ .RS
3263
+ The return value is the string itself.
3264
+ .RE
3265
+ .RE
3266
+ .PP
3267
+ The function `tcstrtolower' is used in order to convert the letters of a string into lower case.
3268
+ .PP
3269
+ .RS
3270
+ .br
3271
+ \fBchar *tcstrtolower(char *\fIstr\fB);\fR
3272
+ .RS
3273
+ `\fIstr\fR' specifies the string to be converted.
3274
+ .RE
3275
+ .RS
3276
+ The return value is the string itself.
3277
+ .RE
3278
+ .RE
3279
+ .PP
3280
+ The function `tcstrtrim' is used in order to cut space characters at head or tail of a string.
3281
+ .PP
3282
+ .RS
3283
+ .br
3284
+ \fBchar *tcstrtrim(char *\fIstr\fB);\fR
3285
+ .RS
3286
+ `\fIstr\fR' specifies the string to be converted.
3287
+ .RE
3288
+ .RS
3289
+ The return value is the string itself.
3290
+ .RE
3291
+ .RE
3292
+ .PP
3293
+ The function `tcstrsqzspc' is used in order to squeeze space characters in a string and trim it.
3294
+ .PP
3295
+ .RS
3296
+ .br
3297
+ \fBchar *tcstrsqzspc(char *\fIstr\fB);\fR
3298
+ .RS
3299
+ `\fIstr\fR' specifies the string to be converted.
3300
+ .RE
3301
+ .RS
3302
+ The return value is the string itself.
3303
+ .RE
3304
+ .RE
3305
+ .PP
3306
+ The function `tcstrsubchr' is used in order to substitute characters in a string.
3307
+ .PP
3308
+ .RS
3309
+ .br
3310
+ \fBchar *tcstrsubchr(char *\fIstr\fB, const char *\fIrstr\fB, const char *\fIsstr\fB);\fR
3311
+ .RS
3312
+ `\fIstr\fR' specifies the string to be converted.
3313
+ .RE
3314
+ .RS
3315
+ `\fIrstr\fR' specifies the string containing characters to be replaced.
3316
+ .RE
3317
+ .RS
3318
+ `\fIsstr\fR' specifies the string containing characters to be substituted.
3319
+ .RE
3320
+ .RS
3321
+ If the substitute string is shorter then the replacement string, corresponding characters are removed.
3322
+ .RE
3323
+ .RE
3324
+ .PP
3325
+ The function `tcstrcntutf' is used in order to count the number of characters in a string of UTF\-8.
3326
+ .PP
3327
+ .RS
3328
+ .br
3329
+ \fBint tcstrcntutf(const char *\fIstr\fB);\fR
3330
+ .RS
3331
+ `\fIstr\fR' specifies the string of UTF\-8.
3332
+ .RE
3333
+ .RS
3334
+ The return value is the number of characters in the string.
3335
+ .RE
3336
+ .RE
3337
+ .PP
3338
+ The function `tcstrcututf' is used in order to cut a string of UTF\-8 at the specified number of characters.
3339
+ .PP
3340
+ .RS
3341
+ .br
3342
+ \fBchar *tcstrcututf(char *\fIstr\fB, int \fInum\fB);\fR
3343
+ .RS
3344
+ `\fIstr\fR' specifies the string of UTF\-8.
3345
+ .RE
3346
+ .RS
3347
+ `\fInum\fR' specifies the number of characters to be kept.
3348
+ .RE
3349
+ .RS
3350
+ The return value is the string itself.
3351
+ .RE
3352
+ .RE
3353
+ .PP
3354
+ The function `tcstrutftoucs' is used in order to convert a UTF\-8 string into a UCS\-2 array.
3355
+ .PP
3356
+ .RS
3357
+ .br
3358
+ \fBvoid tcstrutftoucs(const char *\fIstr\fB, uint16_t *\fIary\fB, int *\fInp\fB);\fR
3359
+ .RS
3360
+ `\fIstr\fR' specifies the UTF\-8 string.
3361
+ .RE
3362
+ .RS
3363
+ `\fIary\fR' specifies the pointer to the region into which the result UCS\-2 codes are written. The size of the buffer should be sufficient.
3364
+ .RE
3365
+ .RS
3366
+ `\fInp\fR' specifies the pointer to a variable into which the number of elements of the result array is assigned.
3367
+ .RE
3368
+ .RE
3369
+ .PP
3370
+ The function `tcstrucstoutf' is used in order to convert a UCS\-2 array into a UTF\-8 string.
3371
+ .PP
3372
+ .RS
3373
+ .br
3374
+ \fBint tcstrucstoutf(const uint16_t *\fIary\fB, int \fInum\fB, char *\fIstr\fB);\fR
3375
+ .RS
3376
+ `\fIary\fR' specifies the array of UCS\-2 codes.
3377
+ .RE
3378
+ .RS
3379
+ `\fInum\fR' specifies the number of the array.
3380
+ .RE
3381
+ .RS
3382
+ `\fIstr\fR' specifies the pointer to the region into which the result UTF\-8 string is written. The size of the buffer should be sufficient.
3383
+ .RE
3384
+ .RS
3385
+ The return value is the length of the result string.
3386
+ .RE
3387
+ .RE
3388
+ .PP
3389
+ The function `tcstrsplit' is used in order to create a list object by splitting a string.
3390
+ .PP
3391
+ .RS
3392
+ .br
3393
+ \fBTCLIST *tcstrsplit(const char *\fIstr\fB, const char *\fIdelims\fB);\fR
3394
+ .RS
3395
+ `\fIstr\fR' specifies the source string.
3396
+ .RE
3397
+ .RS
3398
+ `\fIdelims\fR' specifies a string containing delimiting characters.
3399
+ .RE
3400
+ .RS
3401
+ The return value is a list object of the split elements.
3402
+ .RE
3403
+ .RS
3404
+ If two delimiters are successive, it is assumed that an empty element is between the two. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
3405
+ .RE
3406
+ .RE
3407
+ .PP
3408
+ The function `tcstrjoin' is used in order to create a string by joining all elements of a list object.
3409
+ .PP
3410
+ .RS
3411
+ .br
3412
+ \fBchar *tcstrjoin(const TCLIST *\fIlist\fB, char \fIdelim\fB);\fR
3413
+ .RS
3414
+ `\fIlist\fR' specifies a list object.
3415
+ .RE
3416
+ .RS
3417
+ `\fIdelim\fR' specifies a delimiting character.
3418
+ .RE
3419
+ .RS
3420
+ The return value is the result string.
3421
+ .RE
3422
+ .RS
3423
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
3424
+ .RE
3425
+ .RE
3426
+ .PP
3427
+ The function `tcatoi' is used in order to convert a string to an integer.
3428
+ .PP
3429
+ .RS
3430
+ .br
3431
+ \fBint64_t tcatoi(const char *\fIstr\fB);\fR
3432
+ .RS
3433
+ `\fIstr\fR' specifies the string.
3434
+ .RE
3435
+ .RS
3436
+ The return value is the integer. If the string does not contain numeric expression, 0 is returned.
3437
+ .RE
3438
+ .RS
3439
+ This function is equivalent to `atoll' except that it does not depend on the locale.
3440
+ .RE
3441
+ .RE
3442
+ .PP
3443
+ The function `tcatoix' is used in order to convert a string with a metric prefix to an integer.
3444
+ .PP
3445
+ .RS
3446
+ .br
3447
+ \fBint64_t tcatoix(const char *\fIstr\fB);\fR
3448
+ .RS
3449
+ `\fIstr\fR' specifies the string, which can be trailed by a binary metric prefix. "K", "M", "G", "T", "P", and "E" are supported. They are case\-insensitive.
3450
+ .RE
3451
+ .RS
3452
+ The return value is the integer. If the string does not contain numeric expression, 0 is returned. If the integer overflows the domain, `INT64_MAX' or `INT64_MIN' is returned according to the sign.
3453
+ .RE
3454
+ .RE
3455
+ .PP
3456
+ The function `tcatof' is used in order to convert a string to a real number.
3457
+ .PP
3458
+ .RS
3459
+ .br
3460
+ \fBdouble tcatof(const char *\fIstr\fB);\fR
3461
+ .RS
3462
+ `\fIstr\fR' specifies the string.
3463
+ .RE
3464
+ .RS
3465
+ The return value is the real number. If the string does not contain numeric expression, 0.0 is returned.
3466
+ .RE
3467
+ .RS
3468
+ This function is equivalent to `atof' except that it does not depend on the locale.
3469
+ .RE
3470
+ .RE
3471
+ .PP
3472
+ The function `tcregexmatch' is used in order to check whether a string matches a regular expression.
3473
+ .PP
3474
+ .RS
3475
+ .br
3476
+ \fBbool tcregexmatch(const char *\fIstr\fB, const char *\fIregex\fB);\fR
3477
+ .RS
3478
+ `\fIstr\fR' specifies the target string.
3479
+ .RE
3480
+ .RS
3481
+ `\fIregex\fR' specifies the regular expression string. If it begins with `*', the trailing substring is used as a case\-insensitive regular expression.
3482
+ .RE
3483
+ .RS
3484
+ The return value is true if matching is success, else, it is false.
3485
+ .RE
3486
+ .RE
3487
+ .PP
3488
+ The function `tcregexreplace' is used in order to replace each substring matching a regular expression string.
3489
+ .PP
3490
+ .RS
3491
+ .br
3492
+ \fBchar *tcregexreplace(const char *\fIstr\fB, const char *\fIregex\fB, const char *\fIalt\fB);\fR
3493
+ .RS
3494
+ `\fIstr\fR' specifies the target string.
3495
+ .RE
3496
+ .RS
3497
+ `\fIregex\fR' specifies the regular expression string for substrings. If it begins with `*', the trailing substring is used as a case\-insensitive regular expression.
3498
+ .RE
3499
+ .RS
3500
+ `\fIalt\fR' specifies the alternative string with which each substrings is replaced. Each `&' in the string is replaced with the matched substring. Each `\' in the string escapes the following character. Special escapes "\1" through "\9" referring to the corresponding matching sub\-expressions in the regular expression string are supported.
3501
+ .RE
3502
+ .RS
3503
+ The return value is a new converted string. Even if the regular expression is invalid, a copy of the original string is returned.
3504
+ .RE
3505
+ .RS
3506
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
3507
+ .RE
3508
+ .RE
3509
+ .PP
3510
+ The function `tcmd5hash' is used in order to get the MD5 hash value of a serial object.
3511
+ .PP
3512
+ .RS
3513
+ .br
3514
+ \fBvoid tcmd5hash(const void *\fIptr\fB, int \fIsize\fB, char *\fIbuf\fB);\fR
3515
+ .RS
3516
+ `\fIptr\fR' specifies the pointer to the region.
3517
+ .RE
3518
+ .RS
3519
+ `\fIsize\fR' specifies the size of the region.
3520
+ .RE
3521
+ .RS
3522
+ `\fIbuf\fR' specifies the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
3523
+ .RE
3524
+ .RE
3525
+ .PP
3526
+ The function `tcarccipher' is used in order to cipher or decipher a serial object with the Arcfour stream cipher.
3527
+ .PP
3528
+ .RS
3529
+ .br
3530
+ \fBvoid tcarccipher(const void *\fIptr\fB, int \fIsize\fB, const void *\fIkbuf\fB, int \fIksiz\fB, void *\fIobuf\fB);\fR
3531
+ .RS
3532
+ `\fIptr\fR' specifies the pointer to the region.
3533
+ .RE
3534
+ .RS
3535
+ `\fIsize\fR' specifies the size of the region.
3536
+ .RE
3537
+ .RS
3538
+ `\fIkbuf\fR' specifies the pointer to the region of the cipher key.
3539
+ .RE
3540
+ .RS
3541
+ `\fIksiz\fR' specifies the size of the region of the cipher key.
3542
+ .RE
3543
+ .RS
3544
+ `\fIobuf\fR' specifies the pointer to the region into which the result data is written. The size of the buffer should be equal to or more than the input region.
3545
+ .RE
3546
+ .RE
3547
+ .PP
3548
+ The function `tctime' is used in order to get the time of day in seconds.
3549
+ .PP
3550
+ .RS
3551
+ .br
3552
+ \fBdouble tctime(void);\fR
3553
+ .RS
3554
+ The return value is the time of day in seconds. The accuracy is in microseconds.
3555
+ .RE
3556
+ .RE
3557
+ .PP
3558
+ The function `tccalendar' is used in order to get the Gregorian calendar of a time.
3559
+ .PP
3560
+ .RS
3561
+ .br
3562
+ \fBvoid tccalendar(int64_t \fIt\fB, int \fIjl\fB, int *\fIyearp\fB, int *\fImonp\fB, int *\fIdayp\fB, int *\fIhourp\fB, int *\fIminp\fB, int *\fIsecp\fB);\fR
3563
+ .RS
3564
+ `\fIt\fR' specifies the source time in seconds from the epoch. If it is `INT64_MAX', the current time is specified.
3565
+ .RE
3566
+ .RS
3567
+ `\fIjl\fR' specifies the jet lag of a location in seconds. If it is `INT_MAX', the local jet lag is specified.
3568
+ .RE
3569
+ .RS
3570
+ `\fIyearp\fR' specifies the pointer to a variable to which the year is assigned. If it is `NULL', it is not used.
3571
+ .RE
3572
+ .RS
3573
+ `\fImonp\fR' specifies the pointer to a variable to which the month is assigned. If it is `NULL', it is not used. 1 means January and 12 means December.
3574
+ .RE
3575
+ .RS
3576
+ `\fIdayp\fR' specifies the pointer to a variable to which the day of the month is assigned. If it is `NULL', it is not used.
3577
+ .RE
3578
+ .RS
3579
+ `\fIhourp\fR' specifies the pointer to a variable to which the hours is assigned. If it is `NULL', it is not used.
3580
+ .RE
3581
+ .RS
3582
+ `\fIminp\fR' specifies the pointer to a variable to which the minutes is assigned. If it is `NULL', it is not used.
3583
+ .RE
3584
+ .RS
3585
+ `\fIsecp\fR' specifies the pointer to a variable to which the seconds is assigned. If it is `NULL', it is not used.
3586
+ .RE
3587
+ .RE
3588
+ .PP
3589
+ The function `tcdatestrwww' is used in order to format a date as a string in W3CDTF.
3590
+ .PP
3591
+ .RS
3592
+ .br
3593
+ \fBvoid tcdatestrwww(int64_t \fIt\fB, int \fIjl\fB, char *\fIbuf\fB);\fR
3594
+ .RS
3595
+ `\fIt\fR' specifies the source time in seconds from the epoch. If it is `INT64_MAX', the current time is specified.
3596
+ .RE
3597
+ .RS
3598
+ `\fIjl\fR' specifies the jet lag of a location in seconds. If it is `INT_MAX', the local jet lag is specified.
3599
+ .RE
3600
+ .RS
3601
+ `\fIbuf\fR' specifies the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
3602
+ .RE
3603
+ .RS
3604
+ W3CDTF represents a date as "YYYY\-MM\-DDThh:mm:ddTZD".
3605
+ .RE
3606
+ .RE
3607
+ .PP
3608
+ The function `tcdatestrhttp' is used in order to format a date as a string in RFC 1123 format.
3609
+ .PP
3610
+ .RS
3611
+ .br
3612
+ \fBvoid tcdatestrhttp(int64_t \fIt\fB, int \fIjl\fB, char *\fIbuf\fB);\fR
3613
+ .RS
3614
+ `\fIt\fR' specifies the source time in seconds from the epoch. If it is `INT64_MAX', the current time is specified.
3615
+ .RE
3616
+ .RS
3617
+ `\fIjl\fR' specifies the jet lag of a location in seconds. If it is `INT_MAX', the local jet lag is specified.
3618
+ .RE
3619
+ .RS
3620
+ `\fIbuf\fR' specifies the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
3621
+ .RE
3622
+ .RS
3623
+ RFC 1123 format represents a date as "Wdy, DD\-Mon\-YYYY hh:mm:dd TZD".
3624
+ .RE
3625
+ .RE
3626
+ .PP
3627
+ The function `tcstrmktime' is used in order to get the time value of a date string.
3628
+ .PP
3629
+ .RS
3630
+ .br
3631
+ \fBint64_t tcstrmktime(const char *\fIstr\fB);\fR
3632
+ .RS
3633
+ `\fIstr\fR' specifies the date string in decimal, hexadecimal, W3CDTF, or RFC 822 (1123). Decimal can be trailed by "s" for in seconds, "m" for in minutes, "h" for in hours, and "d" for in days.
3634
+ .RE
3635
+ .RS
3636
+ The return value is the time value of the date or `INT64_MIN' if the format is invalid.
3637
+ .RE
3638
+ .RE
3639
+ .PP
3640
+ The function `tcjetlag' is used in order to get the jet lag of the local time.
3641
+ .PP
3642
+ .RS
3643
+ .br
3644
+ \fBint tcjetlag(void);\fR
3645
+ .RS
3646
+ The return value is the jet lag of the local time in seconds.
3647
+ .RE
3648
+ .RE
3649
+ .PP
3650
+ The function `tcdayofweek' is used in order to get the day of week of a date.
3651
+ .PP
3652
+ .RS
3653
+ .br
3654
+ \fBint tcdayofweek(int \fIyear\fB, int \fImon\fB, int \fIday\fB);\fR
3655
+ .RS
3656
+ `\fIyear\fR' specifies the year of a date.
3657
+ .RE
3658
+ .RS
3659
+ `\fImon\fR' specifies the month of the date.
3660
+ .RE
3661
+ .RS
3662
+ `\fIday\fR' specifies the day of the date.
3663
+ .RE
3664
+ .RS
3665
+ The return value is the day of week of the date. 0 means Sunday and 6 means Saturday.
3666
+ .RE
3667
+ .RE
3668
+
3669
+ .SH API OF FILESYSTEM UTILITIES
3670
+ .PP
3671
+ The function `tcrealpath' is used in order to get the canonicalized absolute path of a file.
3672
+ .PP
3673
+ .RS
3674
+ .br
3675
+ \fBchar *tcrealpath(const char *\fIpath\fB);\fR
3676
+ .RS
3677
+ `\fIpath\fR' specifies the path of the file.
3678
+ .RE
3679
+ .RS
3680
+ The return value is the canonicalized absolute path of a file, or `NULL' if the path is invalid.
3681
+ .RE
3682
+ .RS
3683
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
3684
+ .RE
3685
+ .RE
3686
+ .PP
3687
+ The function `tcstatfile' is used in order to get the status information of a file.
3688
+ .PP
3689
+ .RS
3690
+ .br
3691
+ \fBbool tcstatfile(const char *\fIpath\fB, bool *\fIisdirp\fB, int64_t *\fIsizep\fB, int64_t *\fImtimep\fB);\fR
3692
+ .RS
3693
+ `\fIpath\fR' specifies the path of the file.
3694
+ .RE
3695
+ .RS
3696
+ `\fIisdirp\fR' specifies the pointer to a variable into which whether the file is a directory is assigned. If it is `NULL', it is ignored.
3697
+ .RE
3698
+ .RS
3699
+ `\fIsizep\fR' specifies the pointer to a variable into which the size of the file is assigned. If it is `NULL', it is ignored.
3700
+ .RE
3701
+ .RS
3702
+ `\fIntimep\fR' specifies the pointer to a variable into which the size of the file is assigned. If it is `NULL', it is ignored.
3703
+ .RE
3704
+ .RS
3705
+ If successful, the return value is true, else, it is false.
3706
+ .RE
3707
+ .RE
3708
+ .PP
3709
+ The function `tcreadfile' is used in order to read whole data of a file.
3710
+ .PP
3711
+ .RS
3712
+ .br
3713
+ \fBvoid *tcreadfile(const char *\fIpath\fB, int \fIlimit\fB, int *\fIsp\fB);\fR
3714
+ .RS
3715
+ `\fIpath\fR' specifies the path of the file. If it is `NULL', the standard input is specified.
3716
+ .RE
3717
+ .RS
3718
+ `\fIlimit\fR' specifies the limiting size of reading data. If it is not more than 0, the limitation is not specified.
3719
+ .RE
3720
+ .RS
3721
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned. If it is `NULL', it is not used.
3722
+ .RE
3723
+ .RS
3724
+ The return value is the pointer to the allocated region of the read data, or `NULL' if the file could not be opened.
3725
+ .RE
3726
+ .RS
3727
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when when is no longer in use.
3728
+ .RE
3729
+ .RE
3730
+ .PP
3731
+ The function `tcreadfilelines' is used in order to read every line of a file.
3732
+ .PP
3733
+ .RS
3734
+ .br
3735
+ \fBTCLIST *tcreadfilelines(const char *\fIpath\fB);\fR
3736
+ .RS
3737
+ `\fIpath\fR' specifies the path of the file. If it is `NULL', the standard input is specified.
3738
+ .RE
3739
+ .RS
3740
+ The return value is a list object of every lines if successful, else it is `NULL'.
3741
+ .RE
3742
+ .RS
3743
+ Line separators are cut out. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
3744
+ .RE
3745
+ .RE
3746
+ .PP
3747
+ The function `tcwritefile' is used in order to write data into a file.
3748
+ .PP
3749
+ .RS
3750
+ .br
3751
+ \fBbool tcwritefile(const char *\fIpath\fB, const void *\fIptr\fB, int \fIsize\fB);\fR
3752
+ .RS
3753
+ `\fIpath\fR' specifies the path of the file. If it is `NULL', the standard output is specified.
3754
+ .RE
3755
+ .RS
3756
+ `\fIptr\fR' specifies the pointer to the data region.
3757
+ .RE
3758
+ .RS
3759
+ `\fIsize\fR' specifies the size of the region.
3760
+ .RE
3761
+ .RS
3762
+ If successful, the return value is true, else, it is false.
3763
+ .RE
3764
+ .RE
3765
+ .PP
3766
+ The function `tccopyfile' is used in order to copy a file.
3767
+ .PP
3768
+ .RS
3769
+ .br
3770
+ \fBbool tccopyfile(const char *\fIsrc\fB, const char *\fIdest\fB);\fR
3771
+ .RS
3772
+ `\fIsrc\fR' specifies the path of the source file.
3773
+ .RE
3774
+ .RS
3775
+ `\fIdest\fR' specifies the path of the destination file.
3776
+ .RE
3777
+ .RS
3778
+ The return value is true if successful, else, it is false.
3779
+ .RE
3780
+ .RS
3781
+ If the destination file exists, it is overwritten.
3782
+ .RE
3783
+ .RE
3784
+ .PP
3785
+ The function `tcreaddir' is used in order to read names of files in a directory.
3786
+ .PP
3787
+ .RS
3788
+ .br
3789
+ \fBTCLIST *tcreaddir(const char *\fIpath\fB);\fR
3790
+ .RS
3791
+ `\fIpath\fR' specifies the path of the directory.
3792
+ .RE
3793
+ .RS
3794
+ The return value is a list object of names if successful, else it is `NULL'.
3795
+ .RE
3796
+ .RS
3797
+ Links to the directory itself and to the parent directory are ignored.
3798
+ .RE
3799
+ .RS
3800
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
3801
+ .RE
3802
+ .RE
3803
+ .PP
3804
+ The function `tcglobpat' is used in order to expand a pattern into a list of matched paths.
3805
+ .PP
3806
+ .RS
3807
+ .br
3808
+ \fBTCLIST *tcglobpat(const char *\fIpattern\fB);\fR
3809
+ .RS
3810
+ `\fIpattern\fR' specifies the matching pattern.
3811
+ .RE
3812
+ .RS
3813
+ The return value is a list object of matched paths. If no path is matched, an empty list is returned.
3814
+ .RE
3815
+ .RS
3816
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
3817
+ .RE
3818
+ .RE
3819
+ .PP
3820
+ The function `tcremovelink' is used in order to remove a file or a directory and its sub ones recursively.
3821
+ .PP
3822
+ .RS
3823
+ .br
3824
+ \fBbool tcremovelink(const char *\fIpath\fB);\fR
3825
+ .RS
3826
+ `\fIpath\fR' specifies the path of the link.
3827
+ .RE
3828
+ .RS
3829
+ If successful, the return value is true, else, it is false. False is returned when the link does not exist or the permission is denied.
3830
+ .RE
3831
+ .RE
3832
+ .PP
3833
+ The function `tcwrite' is used in order to write data into a file.
3834
+ .PP
3835
+ .RS
3836
+ .br
3837
+ \fBbool tcwrite(int \fIfd\fB, const void *\fIbuf\fB, size_t \fIsize\fB);\fR
3838
+ .RS
3839
+ `\fIfd\fR' specifies the file descriptor.
3840
+ .RE
3841
+ .RS
3842
+ `\fIbuf\fR' specifies the buffer to be written.
3843
+ .RE
3844
+ .RS
3845
+ `\fIsize\fR' specifies the size of the buffer.
3846
+ .RE
3847
+ .RS
3848
+ The return value is true if successful, else, it is false.
3849
+ .RE
3850
+ .RE
3851
+ .PP
3852
+ The function `tcread' is used in order to read data from a file.
3853
+ .PP
3854
+ .RS
3855
+ .br
3856
+ \fBbool tcread(int \fIfd\fB, void *\fIbuf\fB, size_t \fIsize\fB);\fR
3857
+ .RS
3858
+ `\fIfd\fR' specifies the file descriptor.
3859
+ .RE
3860
+ .RS
3861
+ `\fIbuf\fR' specifies the buffer to store into.
3862
+ .RE
3863
+ .RS
3864
+ `\fIsize\fR' specifies the size of the buffer.
3865
+ .RE
3866
+ .RS
3867
+ The return value is true if successful, else, it is false.
3868
+ .RE
3869
+ .RE
3870
+ .PP
3871
+ The function `tclock' is used in order to lock a file.
3872
+ .PP
3873
+ .RS
3874
+ .br
3875
+ \fBbool tclock(int \fIfd\fB, bool \fIex\fB, bool \fInb\fB);\fR
3876
+ .RS
3877
+ `\fIfd\fR' specifies the file descriptor.
3878
+ .RE
3879
+ .RS
3880
+ `\fIex\fR' specifies whether an exclusive lock or a shared lock is performed.
3881
+ .RE
3882
+ .RS
3883
+ `\fInb\fR' specifies whether to request with non\-blocking.
3884
+ .RE
3885
+ .RS
3886
+ The return value is true if successful, else, it is false.
3887
+ .RE
3888
+ .RE
3889
+ .PP
3890
+ The function `tcunlock' is used in order to unlock a file.
3891
+ .PP
3892
+ .RS
3893
+ .br
3894
+ \fBbool tcunlock(int \fIfd\fB);\fR
3895
+ .RS
3896
+ `\fIfd\fR' specifies the file descriptor.
3897
+ .RE
3898
+ .RS
3899
+ The return value is true if successful, else, it is false.
3900
+ .RE
3901
+ .RE
3902
+ .PP
3903
+ The function `tcsystem' is used in order to execute a shell command.
3904
+ .PP
3905
+ .RS
3906
+ .br
3907
+ \fBint tcsystem(const char **\fIargs\fB, int \fIanum\fB);\fR
3908
+ .RS
3909
+ `\fIargs\fR' specifies an array of the command name and its arguments.
3910
+ .RE
3911
+ .RS
3912
+ `\fIanum\fR' specifies the number of elements of the array.
3913
+ .RE
3914
+ .RS
3915
+ The return value is the exit code of the command or `INT_MAX' on failure.
3916
+ .RE
3917
+ .RS
3918
+ The command name and the arguments are quoted and meta characters are escaped.
3919
+ .RE
3920
+ .RE
3921
+
3922
+ .SH API OF ENCODING UTILITIES
3923
+ .PP
3924
+ The function `tcurlencode' is used in order to encode a serial object with URL encoding.
3925
+ .PP
3926
+ .RS
3927
+ .br
3928
+ \fBchar *tcurlencode(const char *\fIptr\fB, int \fIsize\fB);\fR
3929
+ .RS
3930
+ `\fIptr\fR' specifies the pointer to the region.
3931
+ .RE
3932
+ .RS
3933
+ `\fIsize\fR' specifies the size of the region.
3934
+ .RE
3935
+ .RS
3936
+ The return value is the result string.
3937
+ .RE
3938
+ .RS
3939
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
3940
+ .RE
3941
+ .RE
3942
+ .PP
3943
+ The function `tcurldecode' is used in order to decode a string encoded with URL encoding.
3944
+ .PP
3945
+ .RS
3946
+ .br
3947
+ \fBchar *tcurldecode(const char *\fIstr\fB, int *\fIsp\fB);\fR
3948
+ .RS
3949
+ `\fIstr\fR' specifies the encoded string.
3950
+ .RE
3951
+ .RS
3952
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
3953
+ .RE
3954
+ .RS
3955
+ The return value is the pointer to the region of the result.
3956
+ .RE
3957
+ .RS
3958
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
3959
+ .RE
3960
+ .RE
3961
+ .PP
3962
+ The function `tcurlbreak' is used in order to break up a URL into elements.
3963
+ .PP
3964
+ .RS
3965
+ .br
3966
+ \fBTCMAP *tcurlbreak(const char *\fIstr\fB);\fR
3967
+ .RS
3968
+ `\fIstr\fR' specifies the URL string.
3969
+ .RE
3970
+ .RS
3971
+ The return value is the map object whose keys are the name of elements. The key "self" indicates the URL itself. The key "scheme" indicates the scheme. The key "host" indicates the host of the server. The key "port" indicates the port number of the server. The key "authority" indicates the authority information. The key "path" indicates the path of the resource. The key "file" indicates the file name without the directory section. The key "query" indicates the query string. The key "fragment" indicates the fragment string.
3972
+ .RE
3973
+ .RS
3974
+ Supported schema are HTTP, HTTPS, FTP, and FILE. Absolute URL and relative URL are supported. Because the object of the return value is created with the function `tcmapnew', it should be deleted with the function `tcmapdel' when it is no longer in use.
3975
+ .RE
3976
+ .RE
3977
+ .PP
3978
+ The function `tcurlresolve' is used in order to resolve a relative URL with an absolute URL.
3979
+ .PP
3980
+ .RS
3981
+ .br
3982
+ \fBchar *tcurlresolve(const char *\fIbase\fB, const char *\fItarget\fB);\fR
3983
+ .RS
3984
+ `\fIbase\fR' specifies the absolute URL of the base location.
3985
+ .RE
3986
+ .RS
3987
+ `\fItarget\fR' specifies the URL to be resolved.
3988
+ .RE
3989
+ .RS
3990
+ The return value is the resolved URL. If the target URL is relative, a new URL of relative location from the base location is returned. Else, a copy of the target URL is returned.
3991
+ .RE
3992
+ .RS
3993
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
3994
+ .RE
3995
+ .RE
3996
+ .PP
3997
+ The function `tcbaseencode' is used in order to encode a serial object with Base64 encoding.
3998
+ .PP
3999
+ .RS
4000
+ .br
4001
+ \fBchar *tcbaseencode(const char *\fIptr\fB, int \fIsize\fB);\fR
4002
+ .RS
4003
+ `\fIptr\fR' specifies the pointer to the region.
4004
+ .RE
4005
+ .RS
4006
+ `\fIsize\fR' specifies the size of the region.
4007
+ .RE
4008
+ .RS
4009
+ The return value is the result string.
4010
+ .RE
4011
+ .RS
4012
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
4013
+ .RE
4014
+ .RE
4015
+ .PP
4016
+ The function `tcbasedecode' is used in order to decode a string encoded with Base64 encoding.
4017
+ .PP
4018
+ .RS
4019
+ .br
4020
+ \fBchar *tcbasedecode(const char *\fIstr\fB, int *\fIsp\fB);\fR
4021
+ .RS
4022
+ `\fIstr\fR' specifies the encoded string.
4023
+ .RE
4024
+ .RS
4025
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4026
+ .RE
4027
+ .RS
4028
+ The return value is the pointer to the region of the result.
4029
+ .RE
4030
+ .RS
4031
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4032
+ .RE
4033
+ .RE
4034
+ .PP
4035
+ The function `tcquoteencode' is used in order to encode a serial object with Quoted\-printable encoding.
4036
+ .PP
4037
+ .RS
4038
+ .br
4039
+ \fBchar *tcquoteencode(const char *\fIptr\fB, int \fIsize\fB);\fR
4040
+ .RS
4041
+ `\fIptr\fR' specifies the pointer to the region.
4042
+ .RE
4043
+ .RS
4044
+ `\fIsize\fR' specifies the size of the region.
4045
+ .RE
4046
+ .RS
4047
+ The return value is the result string.
4048
+ .RE
4049
+ .RS
4050
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
4051
+ .RE
4052
+ .RE
4053
+ .PP
4054
+ The function `tcquotedecode' is used in order to decode a string encoded with Quoted\-printable encoding.
4055
+ .PP
4056
+ .RS
4057
+ .br
4058
+ \fBchar *tcquotedecode(const char *\fIstr\fB, int *\fIsp\fB);\fR
4059
+ .RS
4060
+ `\fIstr\fR' specifies the encoded string.
4061
+ .RE
4062
+ .RS
4063
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4064
+ .RE
4065
+ .RS
4066
+ The return value is the pointer to the region of the result.
4067
+ .RE
4068
+ .RS
4069
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4070
+ .RE
4071
+ .RE
4072
+ .PP
4073
+ The function `tcmimeencode' is used in order to encode a string with MIME encoding.
4074
+ .PP
4075
+ .RS
4076
+ .br
4077
+ \fBchar *tcmimeencode(const char *\fIstr\fB, const char *\fIencname\fB, bool \fIbase\fB);\fR
4078
+ .RS
4079
+ `\fIstr\fR' specifies the string.
4080
+ .RE
4081
+ .RS
4082
+ `\fIencname\fR' specifies the string of the name of the character encoding.
4083
+ .RE
4084
+ .RS
4085
+ `\fIbase\fR' specifies whether to use Base64 encoding. If it is false, Quoted\-printable is used.
4086
+ .RE
4087
+ .RS
4088
+ The return value is the result string.
4089
+ .RE
4090
+ .RS
4091
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4092
+ .RE
4093
+ .RE
4094
+ .PP
4095
+ The function `tcmimedecode' is used in order to decode a string encoded with MIME encoding.
4096
+ .PP
4097
+ .RS
4098
+ .br
4099
+ \fBchar *tcmimedecode(const char *\fIstr\fB, char *\fIenp\fB);\fR
4100
+ .RS
4101
+ `\fIstr\fR' specifies the encoded string.
4102
+ .RE
4103
+ .RS
4104
+ `\fIenp\fR' specifies the pointer to the region into which the name of encoding is written. If it is `NULL', it is not used. The size of the buffer should be equal to or more than 32 bytes.
4105
+ .RE
4106
+ .RS
4107
+ The return value is the result string.
4108
+ .RE
4109
+ .RS
4110
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4111
+ .RE
4112
+ .RE
4113
+ .PP
4114
+ The function `tcmimebreak' is used in order to split a string of MIME into headers and the body.
4115
+ .PP
4116
+ .RS
4117
+ .br
4118
+ \fBchar *tcmimebreak(const char *\fIptr\fB, int \fIsize\fB, TCMAP *\fIheaders\fB, int *\fIsp\fB);\fR
4119
+ .RS
4120
+ `\fIptr\fR' specifies the pointer to the region of MIME data.
4121
+ .RE
4122
+ .RS
4123
+ `\fIsize\fR' specifies the size of the region.
4124
+ .RE
4125
+ .RS
4126
+ `\fIheaders\fR' specifies a map object to store headers. If it is `NULL', it is not used. Each key of the map is an uncapitalized header name.
4127
+ .RE
4128
+ .RS
4129
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4130
+ .RE
4131
+ .RS
4132
+ The return value is the pointer to the region of the body data.
4133
+ .RE
4134
+ .RS
4135
+ If the content type is defined, the header map has the key "TYPE" specifying the type. If the character encoding is defined, the key "CHARSET" indicates the encoding name. If the boundary string of multipart is defined, the key "BOUNDARY" indicates the string. If the content disposition is defined, the key "DISPOSITION" indicates the direction. If the file name is defined, the key "FILENAME" indicates the name. If the attribute name is defined, the key "NAME" indicates the name. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4136
+ .RE
4137
+ .RE
4138
+ .PP
4139
+ The function `tcmimeparts' is used in order to split multipart data of MIME into its parts.
4140
+ .PP
4141
+ .RS
4142
+ .br
4143
+ \fBTCLIST *tcmimeparts(const char *\fIptr\fB, int \fIsize\fB, const char *\fIboundary\fB);\fR
4144
+ .RS
4145
+ `\fIptr\fR' specifies the pointer to the region of multipart data of MIME.
4146
+ .RE
4147
+ .RS
4148
+ `\fIsize\fR' specifies the size of the region.
4149
+ .RE
4150
+ .RS
4151
+ `\fIboundary\fR' specifies the boundary string.
4152
+ .RE
4153
+ .RS
4154
+ The return value is a list object. Each element of the list is the data of a part.
4155
+ .RE
4156
+ .RS
4157
+ Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
4158
+ .RE
4159
+ .RE
4160
+ .PP
4161
+ The function `tchexencode' is used in order to encode a serial object with hexadecimal encoding.
4162
+ .PP
4163
+ .RS
4164
+ .br
4165
+ \fBchar *tchexencode(const char *\fIptr\fB, int \fIsize\fB);\fR
4166
+ .RS
4167
+ `\fIptr\fR' specifies the pointer to the region.
4168
+ .RE
4169
+ .RS
4170
+ `\fIsize\fR' specifies the size of the region.
4171
+ .RE
4172
+ .RS
4173
+ The return value is the result string.
4174
+ .RE
4175
+ .RS
4176
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
4177
+ .RE
4178
+ .RE
4179
+ .PP
4180
+ The function `tchexdecode' is used in order to decode a string encoded with hexadecimal encoding.
4181
+ .PP
4182
+ .RS
4183
+ .br
4184
+ \fBchar *tchexdecode(const char *\fIstr\fB, int *\fIsp\fB);\fR
4185
+ .RS
4186
+ `\fIstr\fR' specifies the encoded string.
4187
+ .RE
4188
+ .RS
4189
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return
4190
+ .RE
4191
+ .RS
4192
+ value is assigned.
4193
+ .RE
4194
+ .RS
4195
+ The return value is the pointer to the region of the result.
4196
+ .RE
4197
+ .RS
4198
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4199
+ .RE
4200
+ .RE
4201
+ .PP
4202
+ The function `tcpackencode' is used in order to compress a serial object with Packbits encoding.
4203
+ .PP
4204
+ .RS
4205
+ .br
4206
+ \fBchar *tcpackencode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4207
+ .RS
4208
+ `\fIptr\fR' specifies the pointer to the region.
4209
+ .RE
4210
+ .RS
4211
+ `\fIsize\fR' specifies the size of the region.
4212
+ .RE
4213
+ .RS
4214
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4215
+ .RE
4216
+ .RS
4217
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4218
+ .RE
4219
+ .RS
4220
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4221
+ .RE
4222
+ .RE
4223
+ .PP
4224
+ The function `tcpackdecode' is used in order to decompress a serial object compressed with Packbits encoding.
4225
+ .PP
4226
+ .RS
4227
+ .br
4228
+ \fBchar *tcpackdecode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4229
+ .RS
4230
+ `\fIptr\fR' specifies the pointer to the region.
4231
+ .RE
4232
+ .RS
4233
+ `\fIsize\fR' specifies the size of the region.
4234
+ .RE
4235
+ .RS
4236
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4237
+ .RE
4238
+ .RS
4239
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4240
+ .RE
4241
+ .RS
4242
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4243
+ .RE
4244
+ .RE
4245
+ .PP
4246
+ The function `tcbsencode' is used in order to compress a serial object with TCBS encoding.
4247
+ .PP
4248
+ .RS
4249
+ .br
4250
+ \fBchar *tcbsencode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4251
+ .RS
4252
+ `\fIptr\fR' specifies the pointer to the region.
4253
+ .RE
4254
+ .RS
4255
+ `\fIsize\fR' specifies the size of the region.
4256
+ .RE
4257
+ .RS
4258
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4259
+ .RE
4260
+ .RS
4261
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4262
+ .RE
4263
+ .RS
4264
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4265
+ .RE
4266
+ .RE
4267
+ .PP
4268
+ The function `tcbsdecode' is used in order to decompress a serial object compressed with TCBS encoding.
4269
+ .PP
4270
+ .RS
4271
+ .br
4272
+ \fBchar *tcbsdecode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4273
+ .RS
4274
+ `\fIptr\fR' specifies the pointer to the region.
4275
+ .RE
4276
+ .RS
4277
+ `\fIsize\fR' specifies the size of the region.
4278
+ .RE
4279
+ .RS
4280
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4281
+ .RE
4282
+ .RS
4283
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4284
+ .RE
4285
+ .RS
4286
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4287
+ .RE
4288
+ .RE
4289
+ .PP
4290
+ The function `tcdeflate' is used in order to compress a serial object with Deflate encoding.
4291
+ .PP
4292
+ .RS
4293
+ .br
4294
+ \fBchar *tcdeflate(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4295
+ .RS
4296
+ `\fIptr\fR' specifies the pointer to the region.
4297
+ .RE
4298
+ .RS
4299
+ `\fIsize\fR' specifies the size of the region.
4300
+ .RE
4301
+ .RS
4302
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4303
+ .RE
4304
+ .RS
4305
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4306
+ .RE
4307
+ .RS
4308
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4309
+ .RE
4310
+ .RE
4311
+ .PP
4312
+ The function `tcinflate' is used in order to decompress a serial object compressed with Deflate encoding.
4313
+ .PP
4314
+ .RS
4315
+ .br
4316
+ \fBchar *tcinflate(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4317
+ .RS
4318
+ `\fIptr\fR' specifies the pointer to the region.
4319
+ .RE
4320
+ .RS
4321
+ `\fIsize\fR' specifies the size of the region.
4322
+ .RE
4323
+ .RS
4324
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4325
+ .RE
4326
+ .RS
4327
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4328
+ .RE
4329
+ .RS
4330
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4331
+ .RE
4332
+ .RE
4333
+ .PP
4334
+ The function `tcgzipencode' is used in order to compress a serial object with GZIP encoding.
4335
+ .PP
4336
+ .RS
4337
+ .br
4338
+ \fBchar *tcgzipencode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4339
+ .RS
4340
+ `\fIptr\fR' specifies the pointer to the region.
4341
+ .RE
4342
+ .RS
4343
+ `\fIsize\fR' specifies the size of the region.
4344
+ .RE
4345
+ .RS
4346
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4347
+ .RE
4348
+ .RS
4349
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4350
+ .RE
4351
+ .RS
4352
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4353
+ .RE
4354
+ .RE
4355
+ .PP
4356
+ The function `tcgzipdecode' is used in order to decompress a serial object compressed with GZIP encoding.
4357
+ .PP
4358
+ .RS
4359
+ .br
4360
+ \fBchar *tcgzipdecode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4361
+ .RS
4362
+ `\fIptr\fR' specifies the pointer to the region.
4363
+ .RE
4364
+ .RS
4365
+ `\fIsize\fR' specifies the size of the region.
4366
+ .RE
4367
+ .RS
4368
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4369
+ .RE
4370
+ .RS
4371
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4372
+ .RE
4373
+ .RS
4374
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4375
+ .RE
4376
+ .RE
4377
+ .PP
4378
+ The function `tcgetcrc' is used in order to get the CRC32 checksum of a serial object.
4379
+ .PP
4380
+ .RS
4381
+ .br
4382
+ \fBunsigned int tcgetcrc(const char *\fIptr\fB, int \fIsize\fB);\fR
4383
+ .RS
4384
+ `\fIptr\fR' specifies the pointer to the region.
4385
+ .RE
4386
+ .RS
4387
+ `\fIsize\fR' specifies the size of the region.
4388
+ .RE
4389
+ .RS
4390
+ The return value is the CRC32 checksum of the object.
4391
+ .RE
4392
+ .RE
4393
+ .PP
4394
+ The function `tcbzipencode' is used in order to compress a serial object with BZIP2 encoding.
4395
+ .PP
4396
+ .RS
4397
+ .br
4398
+ \fBchar *tcbzipencode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4399
+ .RS
4400
+ `\fIptr\fR' specifies the pointer to the region.
4401
+ .RE
4402
+ .RS
4403
+ `\fIsize\fR' specifies the size of the region.
4404
+ .RE
4405
+ .RS
4406
+ `\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
4407
+ .RE
4408
+ .RS
4409
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4410
+ .RE
4411
+ .RS
4412
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4413
+ .RE
4414
+ .RE
4415
+ .PP
4416
+ The function `tcbzipdecode' is used in order to decompress a serial object compressed with BZIP2 encoding.
4417
+ .PP
4418
+ .RS
4419
+ .br
4420
+ \fBchar *tcbzipdecode(const char *\fIptr\fB, int \fIsize\fB, int *\fIsp\fB);\fR
4421
+ .RS
4422
+ `\fIptr\fR' specifies the pointer to the region.
4423
+ .RE
4424
+ .RS
4425
+ `\fIsize\fR' specifies the size of the region.
4426
+ .RE
4427
+ .RS
4428
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4429
+ .RE
4430
+ .RS
4431
+ If successful, the return value is the pointer to the result object, else, it is `NULL'.
4432
+ .RE
4433
+ .RS
4434
+ Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4435
+ .RE
4436
+ .RE
4437
+ .PP
4438
+ The function `tcberencode' is used in order to encode an array of nonnegative integers with BER encoding.
4439
+ .PP
4440
+ .RS
4441
+ .br
4442
+ \fBchar *tcberencode(const unsigned int *\fIary\fB, int \fIanum\fB, int *\fIsp\fB);\fR
4443
+ .RS
4444
+ `\fIary\fR' specifies the pointer to the array of nonnegative integers.
4445
+ .RE
4446
+ .RS
4447
+ `\fIanum\fR' specifies the size of the array.
4448
+ .RE
4449
+ .RS
4450
+ `\fIsp\fR' specifies the pointer to a variable into which the size of the region of the return value is assigned.
4451
+ .RE
4452
+ .RS
4453
+ The return value is the pointer to the region of the result.
4454
+ .RE
4455
+ .RS
4456
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
4457
+ .RE
4458
+ .RE
4459
+ .PP
4460
+ The function `tcberdecode' is used in order to decode a serial object encoded with BER encoding.
4461
+ .PP
4462
+ .RS
4463
+ .br
4464
+ \fBunsigned int *tcberdecode(const char *\fIptr\fB, int \fIsize\fB, int *\fInp\fB);\fR
4465
+ .RS
4466
+ `\fIptr\fR' specifies the pointer to the region.
4467
+ .RE
4468
+ .RS
4469
+ `\fIsize\fR' specifies the size of the region.
4470
+ .RE
4471
+ .RS
4472
+ `\fInp\fR' specifies the pointer to a variable into which the number of elements of the return value is assigned.
4473
+ .RE
4474
+ .RS
4475
+ The return value is the pointer to the array of the result.
4476
+ .RE
4477
+ .RS
4478
+ Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if when is no longer in use.
4479
+ .RE
4480
+ .RE
4481
+ .PP
4482
+ The function `tcxmlescape' is used in order to escape meta characters in a string with the entity references of XML.
4483
+ .PP
4484
+ .RS
4485
+ .br
4486
+ \fBchar *tcxmlescape(const char *\fIstr\fB);\fR
4487
+ .RS
4488
+ `\fIstr\fR' specifies the string.
4489
+ .RE
4490
+ .RS
4491
+ The return value is the pointer to the escaped string.
4492
+ .RE
4493
+ .RS
4494
+ This function escapes only `&', `<', `>', and `"'. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4495
+ .RE
4496
+ .RE
4497
+ .PP
4498
+ The function `tcxmlunescape' is used in order to unescape entity references in a string of XML.
4499
+ .PP
4500
+ .RS
4501
+ .br
4502
+ \fBchar *tcxmlunescape(const char *\fIstr\fB);\fR
4503
+ .RS
4504
+ `\fIstr\fR' specifies the string.
4505
+ .RE
4506
+ .RS
4507
+ The return value is the unescaped string.
4508
+ .RE
4509
+ .RS
4510
+ This function restores only `&amp;', `&lt;', `&gt;', and `&quot;'. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
4511
+ .RE
4512
+ .RE
4513
+
4514
+ .SH SEE ALSO
4515
+ .PP
4516
+ .BR tcutest (1),
4517
+ .BR tcucodec (1),
4518
+ .BR tokyocabinet (3)