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,40 @@
1
+ .TH "TTULMGR" 1 "2009-08-31" "Man Page" "Tokyo Tyrant"
2
+
3
+ .SH NAME
4
+ ttulmgr \- the command line utility of the update log API
5
+
6
+ .SH DESCRIPTION
7
+ .PP
8
+ The command `\fBttulmgr\fR' is the utility to export and import the update log. It is useful to filter the update log with such text utilities as `\fBgrep\fR' and `\fBsed\fR'. This command is used in the following format. `\fIupath\fR' specifies the update log directory.
9
+ .PP
10
+ .RS
11
+ .br
12
+ \fBttulmgr export \fR[\fB\-ts \fInum\fB\fR]\fB \fR[\fB\-sid \fInum\fB\fR]\fB \fIupath\fB\fR
13
+ .RS
14
+ Export the update log as TSV text data to the standard output.
15
+ .RE
16
+ .br
17
+ \fBttulmgr import \fIupath\fB\fR
18
+ .RS
19
+ Import TSV text data from the standard input to the update log.
20
+ .RE
21
+ .RE
22
+ .PP
23
+ Options feature the following.
24
+ .PP
25
+ .RS
26
+ \fB\-ts\fR \fInum\fR : specify the beginning time stamp.
27
+ .br
28
+ \fB\-sid\fR \fInum\fR : specify the self server ID.
29
+ .br
30
+ .RE
31
+ .PP
32
+ This command returns 0 on success, another on failure.
33
+
34
+ .SH SEE ALSO
35
+ .PP
36
+ .BR ttserver (1),
37
+ .BR ttultest (1),
38
+ .BR ttutil (3),
39
+ .BR tculog (3),
40
+ .BR tcrdb (3)
@@ -0,0 +1,16 @@
1
+ .TH "TTULTEST" 1 "2009-08-31" "Man Page" "Tokyo Tyrant"
2
+
3
+ .SH NAME
4
+ ttultest \- test cases of 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 ttulmgr (1),
14
+ .BR ttutil (3),
15
+ .BR tculog (3),
16
+ .BR tcrdb (3)
@@ -0,0 +1,14 @@
1
+ .TH "TTUTIL" 3 "2009-08-31" "Man Page" "Tokyo Tyrant"
2
+
3
+ .SH NAME
4
+ ttutil \- the utility API
5
+
6
+ .SH DESCRIPTION
7
+ .PP
8
+ now printing.
9
+
10
+ .SH SEE ALSO
11
+ .PP
12
+ .BR ttserver (1),
13
+ .BR tcrmgr (1),
14
+ .BR tcrdb (3)
@@ -0,0 +1,169 @@
1
+ /*************************************************************************************************
2
+ * System-dependent configurations of Tokyo Tyrant
3
+ * Copyright (C) 2006-2009 Mikio Hirabayashi
4
+ * This file is part of Tokyo Tyrant.
5
+ * Tokyo Tyrant is free software; you can redistribute it and/or modify it under the terms of
6
+ * the GNU Lesser General Public License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License or any later version. Tokyo Tyrant is distributed in the hope
8
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
+ * License for more details.
11
+ * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12
+ * Tyrant; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13
+ * Boston, MA 02111-1307 USA.
14
+ *************************************************************************************************/
15
+
16
+
17
+ #include "myconf.h"
18
+
19
+
20
+
21
+ /*************************************************************************************************
22
+ * common settings
23
+ *************************************************************************************************/
24
+
25
+
26
+ int _tt_dummyfunc(void){
27
+ return 0;
28
+ }
29
+
30
+
31
+ int _tt_dummyfuncv(int a, ...){
32
+ return 0;
33
+ }
34
+
35
+
36
+
37
+ /*************************************************************************************************
38
+ * epoll emulation
39
+ *************************************************************************************************/
40
+
41
+
42
+ #if defined(TTUSEKQUEUE)
43
+
44
+
45
+ #include <sys/event.h>
46
+
47
+
48
+ int _tt_epoll_create(int size){
49
+ return kqueue();
50
+ }
51
+
52
+
53
+ int _tt_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event){
54
+ if(op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD){
55
+ struct kevent kev;
56
+ int kfilt = 0;
57
+ if(event->events & EPOLLIN){
58
+ kfilt |= EVFILT_READ;
59
+ } else {
60
+ fprintf(stderr, "the epoll emulation supports EPOLLIN only\n");
61
+ return -1;
62
+ }
63
+ if(event->events & EPOLLOUT){
64
+ fprintf(stderr, "the epoll emulation supports EPOLLIN only\n");
65
+ return -1;
66
+ }
67
+ int kflags = EV_ADD;
68
+ if(event->events & EPOLLONESHOT) kflags |= EV_ONESHOT;
69
+ EV_SET(&kev, fd, kfilt, kflags, 0, 0, NULL);
70
+ return kevent(epfd, &kev, 1, NULL, 0, NULL) != -1 ? 0 : -1;
71
+ } else if(op == EPOLL_CTL_DEL){
72
+ struct kevent kev;
73
+ int kfilt = EVFILT_READ;
74
+ EV_SET(&kev, fd, kfilt, EV_DELETE, 0, 0, NULL);
75
+ return kevent(epfd, &kev, 1, NULL, 0, NULL) != -1 || errno == ENOENT ? 0 : -1;
76
+ }
77
+ return -1;
78
+ }
79
+
80
+
81
+ int _tt_epoll_reassoc(int epfd, int fd){
82
+ return 0;
83
+ }
84
+
85
+
86
+ int _tt_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout){
87
+ div_t td = div(timeout, 1000);
88
+ struct timespec ts;
89
+ ts.tv_sec = td.quot;
90
+ ts.tv_nsec = td.rem * 1000000;
91
+ struct kevent kevs[maxevents];
92
+ int num = kevent(epfd, NULL, 0, kevs, maxevents, &ts);
93
+ if(num == -1) return -1;
94
+ for(int i = 0; i < num; i++){
95
+ events[i].data.fd = kevs[i].ident;
96
+ }
97
+ return num;
98
+ }
99
+
100
+
101
+ #elif defined(TTUSEEVPORTS)
102
+
103
+
104
+ #include <port.h>
105
+
106
+
107
+ int _tt_epoll_create(int size){
108
+ int port = port_create();
109
+ if(port < 0) return -1;
110
+ return port;
111
+ }
112
+
113
+
114
+ int _tt_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event){
115
+ if(op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD){
116
+ if(event->events & EPOLLIN){
117
+ int result = port_associate(epfd, PORT_SOURCE_FD, fd, POLLIN, event);
118
+ if(result == -1) return -1;
119
+ return 0;
120
+ } else {
121
+ return -1;
122
+ }
123
+ } else if(op == EPOLL_CTL_DEL){
124
+ int result = port_dissociate(epfd, PORT_SOURCE_FD, fd);
125
+ if(result == -1) return -1;
126
+ return 0;
127
+ }
128
+ return -1;
129
+ }
130
+
131
+
132
+ int _tt_epoll_reassoc(int epfd, int fd){
133
+ struct epoll_event ev;
134
+ ev.events = EPOLLIN;
135
+ ev.data.fd = fd;
136
+ if(epoll_ctl(epfd, EPOLL_CTL_MOD, fd, &ev) != 0) return -1;
137
+ return 0;
138
+ }
139
+
140
+
141
+ int _tt_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout){
142
+ div_t td = div(timeout, 1000);
143
+ struct timespec ts;
144
+ ts.tv_sec = td.quot;
145
+ ts.tv_nsec = td.rem * 1000000;
146
+ port_event_t list[maxevents];
147
+ unsigned int actevents = maxevents;
148
+ if(port_getn(epfd, list, 0, &actevents, &ts) == -1) return -1;
149
+ if(actevents == 0) actevents = 1;
150
+ if(actevents > maxevents) actevents = maxevents;
151
+ if(port_getn(epfd, list, maxevents, &actevents, &ts) == -1){
152
+ if(errno == EINTR){
153
+ return 0;
154
+ } else if(errno != ETIME){
155
+ return -1;
156
+ }
157
+ }
158
+ for(int i = 0; i < actevents; i++){
159
+ events[i].data.fd = list[i].portev_object;
160
+ }
161
+ return actevents;
162
+ }
163
+
164
+
165
+ #endif
166
+
167
+
168
+
169
+ // END OF FILE
@@ -0,0 +1,408 @@
1
+ /*************************************************************************************************
2
+ * System-dependent configurations of Tokyo Tyrant
3
+ * Copyright (C) 2006-2009 Mikio Hirabayashi
4
+ * This file is part of Tokyo Tyrant.
5
+ * Tokyo Tyrant is free software; you can redistribute it and/or modify it under the terms of
6
+ * the GNU Lesser General Public License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License or any later version. Tokyo Tyrant is distributed in the hope
8
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
+ * License for more details.
11
+ * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12
+ * Tyrant; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13
+ * Boston, MA 02111-1307 USA.
14
+ *************************************************************************************************/
15
+
16
+
17
+ #ifndef _MYCONF_H // duplication check
18
+ #define _MYCONF_H
19
+
20
+
21
+
22
+ /*************************************************************************************************
23
+ * system discrimination
24
+ *************************************************************************************************/
25
+
26
+
27
+ #if defined(__linux__)
28
+
29
+ #define _SYS_LINUX_
30
+ #define TTSYSNAME "Linux"
31
+
32
+ #elif defined(__FreeBSD__)
33
+
34
+ #define _SYS_FREEBSD_
35
+ #define TTSYSNAME "FreeBSD"
36
+
37
+ #elif defined(__NetBSD__)
38
+
39
+ #define _SYS_NETBSD_
40
+ #define TTSYSNAME "NetBSD"
41
+
42
+ #elif defined(__OpenBSD__)
43
+
44
+ #define _SYS_OPENBSD_
45
+ #define TTSYSNAME "OpenBSD"
46
+
47
+ #elif defined(__sun__) || defined(__sun)
48
+
49
+ #define _SYS_SUNOS_
50
+ #define TTSYSNAME "SunOS"
51
+
52
+ #elif defined(__hpux)
53
+
54
+ #define _SYS_HPUX_
55
+ #define TTSYSNAME "HP-UX"
56
+
57
+ #elif defined(__osf)
58
+
59
+ #define _SYS_TRU64_
60
+ #define TTSYSNAME "Tru64"
61
+
62
+ #elif defined(_AIX)
63
+
64
+ #define _SYS_AIX_
65
+ #define TTSYSNAME "AIX"
66
+
67
+ #elif defined(__APPLE__) && defined(__MACH__)
68
+
69
+ #define _SYS_MACOSX_
70
+ #define TTSYSNAME "Mac OS X"
71
+
72
+ #elif defined(_MSC_VER)
73
+
74
+ #define _SYS_MSVC_
75
+ #define TTSYSNAME "Windows (VC++)"
76
+
77
+ #elif defined(_WIN32)
78
+
79
+ #define _SYS_MINGW_
80
+ #define TTSYSNAME "Windows (MinGW)"
81
+
82
+ #elif defined(__CYGWIN__)
83
+
84
+ #define _SYS_CYGWIN_
85
+ #define TTSYSNAME "Windows (Cygwin)"
86
+
87
+ #else
88
+
89
+ #define _SYS_GENERIC_
90
+ #define TTSYSNAME "Generic"
91
+
92
+ #endif
93
+
94
+ #if !defined(_SYS_LINUX_) && !defined(_SYS_FREEBSD_) && !defined(_SYS_MACOSX_) && \
95
+ !defined(_SYS_SUNOS_)
96
+ #error =======================================
97
+ #error Your platform is not supported. Sorry.
98
+ #error =======================================
99
+ #endif
100
+
101
+
102
+
103
+ /*************************************************************************************************
104
+ * common settings
105
+ *************************************************************************************************/
106
+
107
+
108
+ #if defined(NDEBUG)
109
+ #define TTDODEBUG(TT_expr) \
110
+ do { \
111
+ } while(false)
112
+ #else
113
+ #define TTDODEBUG(TT_expr) \
114
+ do { \
115
+ TT_expr; \
116
+ } while(false)
117
+ #endif
118
+
119
+ #define TTSWAB16(TT_num) \
120
+ ( \
121
+ ((TT_num & 0x00ffU) << 8) | \
122
+ ((TT_num & 0xff00U) >> 8) \
123
+ )
124
+
125
+ #define TTSWAB32(TT_num) \
126
+ ( \
127
+ ((TT_num & 0x000000ffUL) << 24) | \
128
+ ((TT_num & 0x0000ff00UL) << 8) | \
129
+ ((TT_num & 0x00ff0000UL) >> 8) | \
130
+ ((TT_num & 0xff000000UL) >> 24) \
131
+ )
132
+
133
+ #define TTSWAB64(TT_num) \
134
+ ( \
135
+ ((TT_num & 0x00000000000000ffULL) << 56) | \
136
+ ((TT_num & 0x000000000000ff00ULL) << 40) | \
137
+ ((TT_num & 0x0000000000ff0000ULL) << 24) | \
138
+ ((TT_num & 0x00000000ff000000ULL) << 8) | \
139
+ ((TT_num & 0x000000ff00000000ULL) >> 8) | \
140
+ ((TT_num & 0x0000ff0000000000ULL) >> 24) | \
141
+ ((TT_num & 0x00ff000000000000ULL) >> 40) | \
142
+ ((TT_num & 0xff00000000000000ULL) >> 56) \
143
+ )
144
+
145
+ #if defined(_MYBIGEND) || defined(_MYSWAB)
146
+ #define TTBIGEND 1
147
+ #define TTHTONS(TT_num) (TT_num)
148
+ #define TTHTONL(TT_num) (TT_num)
149
+ #define TTHTONLL(TT_num) (TT_num)
150
+ #define TTNTOHS(TT_num) (TT_num)
151
+ #define TTNTOHL(TT_num) (TT_num)
152
+ #define TTNTOHLL(TT_num) (TT_num)
153
+ #else
154
+ #define TTBIGEND 0
155
+ #define TTHTONS(TT_num) TTSWAB16(TT_num)
156
+ #define TTHTONL(TT_num) TTSWAB32(TT_num)
157
+ #define TTHTONLL(TT_num) TTSWAB64(TT_num)
158
+ #define TTNTOHS(TT_num) TTSWAB16(TT_num)
159
+ #define TTNTOHL(TT_num) TTSWAB32(TT_num)
160
+ #define TTNTOHLL(TT_num) TTSWAB64(TT_num)
161
+ #endif
162
+
163
+
164
+
165
+ /*************************************************************************************************
166
+ * general headers
167
+ *************************************************************************************************/
168
+
169
+
170
+ #include <assert.h>
171
+ #include <ctype.h>
172
+ #include <errno.h>
173
+ #include <float.h>
174
+ #include <limits.h>
175
+ #include <locale.h>
176
+ #include <math.h>
177
+ #include <setjmp.h>
178
+ #include <stdarg.h>
179
+ #include <stddef.h>
180
+ #include <stdio.h>
181
+ #include <stdlib.h>
182
+ #include <signal.h>
183
+ #include <string.h>
184
+ #include <time.h>
185
+
186
+ #include <inttypes.h>
187
+ #include <stdbool.h>
188
+ #include <stdint.h>
189
+
190
+ #include <unistd.h>
191
+ #include <sys/types.h>
192
+ #include <sys/stat.h>
193
+ #include <sys/mman.h>
194
+ #include <sys/time.h>
195
+ #include <sys/times.h>
196
+ #include <sys/resource.h>
197
+ #include <sys/socket.h>
198
+ #include <sys/un.h>
199
+ #include <sys/select.h>
200
+ #include <fcntl.h>
201
+ #include <dirent.h>
202
+ #include <aio.h>
203
+ #include <netinet/in.h>
204
+ #include <netinet/tcp.h>
205
+ #include <arpa/inet.h>
206
+ #include <netdb.h>
207
+ #include <dlfcn.h>
208
+
209
+ #include <pthread.h>
210
+
211
+ #include <tcutil.h>
212
+ #include <tchdb.h>
213
+ #include <tcbdb.h>
214
+ #include <tcfdb.h>
215
+ #include <tctdb.h>
216
+ #include <tcadb.h>
217
+
218
+ #if defined(_SYS_FREEBSD_) || defined(_SYS_MACOSX_)
219
+ #define TTUSEKQUEUE 1
220
+ #elif defined(_SYS_SUNOS_)
221
+
222
+ /* to check the possilibity of compilation on Linux
223
+
224
+ #define port_create() (1)
225
+ #define port_associate(aaa, bbb, ccc, ddd, eee) (0)
226
+ #define port_dissociate(aaa, bbb, ccc) (0)
227
+ typedef struct { int portev_object; } port_event_t;
228
+ #define port_getn(aaa, bbb, ccc, ddd, eee) (0)
229
+ #define PORT_SOURCE_FD 0
230
+ */
231
+
232
+ #include <sys/loadavg.h>
233
+ #define TTUSEEVPORTS 1
234
+ #else
235
+ #include <sys/epoll.h>
236
+ #endif
237
+
238
+
239
+
240
+ /*************************************************************************************************
241
+ * miscellaneous hacks
242
+ *************************************************************************************************/
243
+
244
+
245
+ #if defined(_SYS_FREEBSD_) || defined(_SYS_NETBSD_) || defined(_SYS_OPENBSD_)
246
+ #define nan(TC_a) strtod("nan", NULL)
247
+ #define nanl(TC_a) ((long double)strtod("nan", NULL))
248
+ #endif
249
+
250
+ int _tt_dummyfunc(void);
251
+ int _tt_dummyfuncv(int a, ...);
252
+
253
+
254
+
255
+ /*************************************************************************************************
256
+ * notation of filesystems
257
+ *************************************************************************************************/
258
+
259
+
260
+ #define MYPATHCHR '/'
261
+ #define MYPATHSTR "/"
262
+ #define MYEXTCHR '.'
263
+ #define MYEXTSTR "."
264
+ #define MYCDIRSTR "."
265
+ #define MYPDIRSTR ".."
266
+
267
+
268
+
269
+ /*************************************************************************************************
270
+ * epoll emulation
271
+ *************************************************************************************************/
272
+
273
+
274
+ #if defined(TTUSEKQUEUE) || defined(TTUSEEVPORTS)
275
+
276
+ struct epoll_event {
277
+ uint32_t events;
278
+ union {
279
+ void *ptr;
280
+ int fd;
281
+ } data;
282
+ };
283
+
284
+ enum {
285
+ EPOLLIN = 1 << 0,
286
+ EPOLLOUT = 1 << 1,
287
+ EPOLLONESHOT = 1 << 8
288
+ };
289
+
290
+ enum {
291
+ EPOLL_CTL_ADD,
292
+ EPOLL_CTL_MOD,
293
+ EPOLL_CTL_DEL
294
+ };
295
+
296
+ int _tt_epoll_create(int size);
297
+ int _tt_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
298
+ int _tt_epoll_reassoc(int epfd, int fd);
299
+ int _tt_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
300
+
301
+ #define epoll_create _tt_epoll_create
302
+ #define epoll_ctl _tt_epoll_ctl
303
+ #define epoll_reassoc _tt_epoll_reassoc
304
+ #define epoll_wait _tt_epoll_wait
305
+ #define epoll_close close
306
+
307
+ #else
308
+
309
+ #define epoll_reassoc(TC_epfd, TC_fd) 0
310
+ #define epoll_close close
311
+
312
+ #endif
313
+
314
+
315
+
316
+ /*************************************************************************************************
317
+ * utilities for implementation
318
+ *************************************************************************************************/
319
+
320
+
321
+ #define TTNUMBUFSIZ 32 // size of a buffer for a number
322
+
323
+ /* set a buffer for a variable length number */
324
+ #define TTSETVNUMBUF(TT_len, TT_buf, TT_num) \
325
+ do { \
326
+ int _TT_num = (TT_num); \
327
+ if(_TT_num == 0){ \
328
+ ((signed char *)(TT_buf))[0] = 0; \
329
+ (TT_len) = 1; \
330
+ } else { \
331
+ (TT_len) = 0; \
332
+ while(_TT_num > 0){ \
333
+ int _TT_rem = _TT_num & 0x7f; \
334
+ _TT_num >>= 7; \
335
+ if(_TT_num > 0){ \
336
+ ((signed char *)(TT_buf))[(TT_len)] = -_TT_rem - 1; \
337
+ } else { \
338
+ ((signed char *)(TT_buf))[(TT_len)] = _TT_rem; \
339
+ } \
340
+ (TT_len)++; \
341
+ } \
342
+ } \
343
+ } while(false)
344
+
345
+ /* set a buffer for a variable length number of 64-bit */
346
+ #define TTSETVNUMBUF64(TT_len, TT_buf, TT_num) \
347
+ do { \
348
+ long long int _TT_num = (TT_num); \
349
+ if(_TT_num == 0){ \
350
+ ((signed char *)(TT_buf))[0] = 0; \
351
+ (TT_len) = 1; \
352
+ } else { \
353
+ (TT_len) = 0; \
354
+ while(_TT_num > 0){ \
355
+ int _TT_rem = _TT_num & 0x7f; \
356
+ _TT_num >>= 7; \
357
+ if(_TT_num > 0){ \
358
+ ((signed char *)(TT_buf))[(TT_len)] = -_TT_rem - 1; \
359
+ } else { \
360
+ ((signed char *)(TT_buf))[(TT_len)] = _TT_rem; \
361
+ } \
362
+ (TT_len)++; \
363
+ } \
364
+ } \
365
+ } while(false)
366
+
367
+ /* read a variable length buffer */
368
+ #define TTREADVNUMBUF(TT_buf, TT_num, TT_step) \
369
+ do { \
370
+ TT_num = 0; \
371
+ int _TT_base = 1; \
372
+ int _TT_i = 0; \
373
+ while(true){ \
374
+ if(((signed char *)(TT_buf))[_TT_i] >= 0){ \
375
+ TT_num += ((signed char *)(TT_buf))[_TT_i] * _TT_base; \
376
+ break; \
377
+ } \
378
+ TT_num += _TT_base * (((signed char *)(TT_buf))[_TT_i] + 1) * -1; \
379
+ _TT_base <<= 7; \
380
+ _TT_i++; \
381
+ } \
382
+ (TT_step) = _TT_i + 1; \
383
+ } while(false)
384
+
385
+ /* read a variable length buffer */
386
+ #define TTREADVNUMBUF64(TT_buf, TT_num, TT_step) \
387
+ do { \
388
+ TT_num = 0; \
389
+ long long int _TT_base = 1; \
390
+ int _TT_i = 0; \
391
+ while(true){ \
392
+ if(((signed char *)(TT_buf))[_TT_i] >= 0){ \
393
+ TT_num += ((signed char *)(TT_buf))[_TT_i] * _TT_base; \
394
+ break; \
395
+ } \
396
+ TT_num += _TT_base * (((signed char *)(TT_buf))[_TT_i] + 1) * -1; \
397
+ _TT_base <<= 7; \
398
+ _TT_i++; \
399
+ } \
400
+ (TT_step) = _TT_i + 1; \
401
+ } while(false)
402
+
403
+
404
+
405
+ #endif // duplication check
406
+
407
+
408
+ // END OF FILE