jbarnette-johnson 1.0.0.200806240111 → 1.0.0.200807291507

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. data/MANIFEST +1 -0
  2. data/Rakefile +3 -10
  3. data/bin/johnson +2 -1
  4. data/ext/spidermonkey/context.c +3 -4
  5. data/ext/spidermonkey/context.h +1 -1
  6. data/ext/spidermonkey/conversions.c +39 -33
  7. data/ext/spidermonkey/debugger.c +5 -5
  8. data/ext/spidermonkey/immutable_node.c.erb +11 -11
  9. data/ext/spidermonkey/jroot.h +4 -4
  10. data/ext/spidermonkey/js_land_proxy.c +9 -8
  11. data/ext/spidermonkey/ruby_land_proxy.c +5 -4
  12. data/ext/spidermonkey/runtime.c +1 -1
  13. data/johnson.gemspec +36 -0
  14. data/lib/hoe.rb +0 -7
  15. data/lib/johnson/cli/options.rb +10 -4
  16. data/lib/johnson/spidermonkey/runtime.rb +2 -2
  17. data/lib/johnson/version.rb +4 -2
  18. data/lib/johnson.rb +1 -0
  19. data/test/johnson/runtime_test.rb +11 -0
  20. data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +6 -0
  21. data/vendor/spidermonkey/.cvsignore +9 -0
  22. data/vendor/spidermonkey/Makefile.in +462 -0
  23. data/vendor/spidermonkey/Makefile.ref +364 -0
  24. data/vendor/spidermonkey/README.html +820 -0
  25. data/vendor/spidermonkey/SpiderMonkey.rsp +12 -0
  26. data/vendor/spidermonkey/Y.js +19 -0
  27. data/vendor/spidermonkey/build.mk +43 -0
  28. data/vendor/spidermonkey/config/AIX4.1.mk +65 -0
  29. data/vendor/spidermonkey/config/AIX4.2.mk +64 -0
  30. data/vendor/spidermonkey/config/AIX4.3.mk +65 -0
  31. data/vendor/spidermonkey/config/Darwin.mk +83 -0
  32. data/vendor/spidermonkey/config/Darwin1.3.mk +81 -0
  33. data/vendor/spidermonkey/config/Darwin1.4.mk +41 -0
  34. data/vendor/spidermonkey/config/Darwin5.2.mk +81 -0
  35. data/vendor/spidermonkey/config/Darwin5.3.mk +81 -0
  36. data/vendor/spidermonkey/config/HP-UXB.10.10.mk +77 -0
  37. data/vendor/spidermonkey/config/HP-UXB.10.20.mk +77 -0
  38. data/vendor/spidermonkey/config/HP-UXB.11.00.mk +80 -0
  39. data/vendor/spidermonkey/config/IRIX.mk +87 -0
  40. data/vendor/spidermonkey/config/IRIX5.3.mk +44 -0
  41. data/vendor/spidermonkey/config/IRIX6.1.mk +44 -0
  42. data/vendor/spidermonkey/config/IRIX6.2.mk +44 -0
  43. data/vendor/spidermonkey/config/IRIX6.3.mk +44 -0
  44. data/vendor/spidermonkey/config/IRIX6.5.mk +44 -0
  45. data/vendor/spidermonkey/config/Linux_All.mk +103 -0
  46. data/vendor/spidermonkey/config/Mac_OS10.0.mk +82 -0
  47. data/vendor/spidermonkey/config/OSF1V4.0.mk +72 -0
  48. data/vendor/spidermonkey/config/OSF1V5.0.mk +69 -0
  49. data/vendor/spidermonkey/config/SunOS4.1.4.mk +101 -0
  50. data/vendor/spidermonkey/config/SunOS5.10.mk +50 -0
  51. data/vendor/spidermonkey/config/SunOS5.3.mk +91 -0
  52. data/vendor/spidermonkey/config/SunOS5.4.mk +92 -0
  53. data/vendor/spidermonkey/config/SunOS5.5.1.mk +44 -0
  54. data/vendor/spidermonkey/config/SunOS5.5.mk +87 -0
  55. data/vendor/spidermonkey/config/SunOS5.6.mk +89 -0
  56. data/vendor/spidermonkey/config/SunOS5.7.mk +44 -0
  57. data/vendor/spidermonkey/config/SunOS5.8.mk +44 -0
  58. data/vendor/spidermonkey/config/SunOS5.9.mk +44 -0
  59. data/vendor/spidermonkey/config/WINNT4.0.mk +117 -0
  60. data/vendor/spidermonkey/config/WINNT5.0.mk +117 -0
  61. data/vendor/spidermonkey/config/WINNT5.1.mk +117 -0
  62. data/vendor/spidermonkey/config/WINNT5.2.mk +117 -0
  63. data/vendor/spidermonkey/config/WINNT6.0.mk +117 -0
  64. data/vendor/spidermonkey/config/dgux.mk +64 -0
  65. data/vendor/spidermonkey/config.mk +192 -0
  66. data/vendor/spidermonkey/editline/Makefile.ref +144 -0
  67. data/vendor/spidermonkey/editline/README +83 -0
  68. data/vendor/spidermonkey/editline/editline.3 +175 -0
  69. data/vendor/spidermonkey/editline/editline.c +1369 -0
  70. data/vendor/spidermonkey/editline/editline.h +135 -0
  71. data/vendor/spidermonkey/editline/sysunix.c +182 -0
  72. data/vendor/spidermonkey/editline/unix.h +82 -0
  73. data/vendor/spidermonkey/fdlibm/.cvsignore +7 -0
  74. data/vendor/spidermonkey/fdlibm/Makefile.in +127 -0
  75. data/vendor/spidermonkey/fdlibm/Makefile.ref +192 -0
  76. data/vendor/spidermonkey/fdlibm/e_acos.c +147 -0
  77. data/vendor/spidermonkey/fdlibm/e_acosh.c +105 -0
  78. data/vendor/spidermonkey/fdlibm/e_asin.c +156 -0
  79. data/vendor/spidermonkey/fdlibm/e_atan2.c +165 -0
  80. data/vendor/spidermonkey/fdlibm/e_atanh.c +110 -0
  81. data/vendor/spidermonkey/fdlibm/e_cosh.c +133 -0
  82. data/vendor/spidermonkey/fdlibm/e_exp.c +202 -0
  83. data/vendor/spidermonkey/fdlibm/e_fmod.c +184 -0
  84. data/vendor/spidermonkey/fdlibm/e_gamma.c +71 -0
  85. data/vendor/spidermonkey/fdlibm/e_gamma_r.c +70 -0
  86. data/vendor/spidermonkey/fdlibm/e_hypot.c +173 -0
  87. data/vendor/spidermonkey/fdlibm/e_j0.c +524 -0
  88. data/vendor/spidermonkey/fdlibm/e_j1.c +523 -0
  89. data/vendor/spidermonkey/fdlibm/e_jn.c +315 -0
  90. data/vendor/spidermonkey/fdlibm/e_lgamma.c +71 -0
  91. data/vendor/spidermonkey/fdlibm/e_lgamma_r.c +347 -0
  92. data/vendor/spidermonkey/fdlibm/e_log.c +184 -0
  93. data/vendor/spidermonkey/fdlibm/e_log10.c +134 -0
  94. data/vendor/spidermonkey/fdlibm/e_pow.c +386 -0
  95. data/vendor/spidermonkey/fdlibm/e_rem_pio2.c +222 -0
  96. data/vendor/spidermonkey/fdlibm/e_remainder.c +120 -0
  97. data/vendor/spidermonkey/fdlibm/e_scalb.c +89 -0
  98. data/vendor/spidermonkey/fdlibm/e_sinh.c +122 -0
  99. data/vendor/spidermonkey/fdlibm/e_sqrt.c +497 -0
  100. data/vendor/spidermonkey/fdlibm/fdlibm.h +273 -0
  101. data/vendor/spidermonkey/fdlibm/fdlibm.mak +1453 -0
  102. data/vendor/spidermonkey/fdlibm/fdlibm.mdp +0 -0
  103. data/vendor/spidermonkey/fdlibm/k_cos.c +135 -0
  104. data/vendor/spidermonkey/fdlibm/k_rem_pio2.c +354 -0
  105. data/vendor/spidermonkey/fdlibm/k_sin.c +114 -0
  106. data/vendor/spidermonkey/fdlibm/k_standard.c +785 -0
  107. data/vendor/spidermonkey/fdlibm/k_tan.c +170 -0
  108. data/vendor/spidermonkey/fdlibm/s_asinh.c +101 -0
  109. data/vendor/spidermonkey/fdlibm/s_atan.c +175 -0
  110. data/vendor/spidermonkey/fdlibm/s_cbrt.c +133 -0
  111. data/vendor/spidermonkey/fdlibm/s_ceil.c +120 -0
  112. data/vendor/spidermonkey/fdlibm/s_copysign.c +72 -0
  113. data/vendor/spidermonkey/fdlibm/s_cos.c +118 -0
  114. data/vendor/spidermonkey/fdlibm/s_erf.c +356 -0
  115. data/vendor/spidermonkey/fdlibm/s_expm1.c +267 -0
  116. data/vendor/spidermonkey/fdlibm/s_fabs.c +70 -0
  117. data/vendor/spidermonkey/fdlibm/s_finite.c +71 -0
  118. data/vendor/spidermonkey/fdlibm/s_floor.c +121 -0
  119. data/vendor/spidermonkey/fdlibm/s_frexp.c +99 -0
  120. data/vendor/spidermonkey/fdlibm/s_ilogb.c +85 -0
  121. data/vendor/spidermonkey/fdlibm/s_isnan.c +74 -0
  122. data/vendor/spidermonkey/fdlibm/s_ldexp.c +66 -0
  123. data/vendor/spidermonkey/fdlibm/s_lib_version.c +73 -0
  124. data/vendor/spidermonkey/fdlibm/s_log1p.c +211 -0
  125. data/vendor/spidermonkey/fdlibm/s_logb.c +79 -0
  126. data/vendor/spidermonkey/fdlibm/s_matherr.c +64 -0
  127. data/vendor/spidermonkey/fdlibm/s_modf.c +132 -0
  128. data/vendor/spidermonkey/fdlibm/s_nextafter.c +124 -0
  129. data/vendor/spidermonkey/fdlibm/s_rint.c +131 -0
  130. data/vendor/spidermonkey/fdlibm/s_scalbn.c +107 -0
  131. data/vendor/spidermonkey/fdlibm/s_signgam.c +40 -0
  132. data/vendor/spidermonkey/fdlibm/s_significand.c +68 -0
  133. data/vendor/spidermonkey/fdlibm/s_sin.c +118 -0
  134. data/vendor/spidermonkey/fdlibm/s_tan.c +112 -0
  135. data/vendor/spidermonkey/fdlibm/s_tanh.c +122 -0
  136. data/vendor/spidermonkey/fdlibm/w_acos.c +78 -0
  137. data/vendor/spidermonkey/fdlibm/w_acosh.c +78 -0
  138. data/vendor/spidermonkey/fdlibm/w_asin.c +80 -0
  139. data/vendor/spidermonkey/fdlibm/w_atan2.c +79 -0
  140. data/vendor/spidermonkey/fdlibm/w_atanh.c +81 -0
  141. data/vendor/spidermonkey/fdlibm/w_cosh.c +77 -0
  142. data/vendor/spidermonkey/fdlibm/w_exp.c +88 -0
  143. data/vendor/spidermonkey/fdlibm/w_fmod.c +78 -0
  144. data/vendor/spidermonkey/fdlibm/w_gamma.c +85 -0
  145. data/vendor/spidermonkey/fdlibm/w_gamma_r.c +81 -0
  146. data/vendor/spidermonkey/fdlibm/w_hypot.c +78 -0
  147. data/vendor/spidermonkey/fdlibm/w_j0.c +105 -0
  148. data/vendor/spidermonkey/fdlibm/w_j1.c +106 -0
  149. data/vendor/spidermonkey/fdlibm/w_jn.c +128 -0
  150. data/vendor/spidermonkey/fdlibm/w_lgamma.c +85 -0
  151. data/vendor/spidermonkey/fdlibm/w_lgamma_r.c +81 -0
  152. data/vendor/spidermonkey/fdlibm/w_log.c +78 -0
  153. data/vendor/spidermonkey/fdlibm/w_log10.c +81 -0
  154. data/vendor/spidermonkey/fdlibm/w_pow.c +99 -0
  155. data/vendor/spidermonkey/fdlibm/w_remainder.c +77 -0
  156. data/vendor/spidermonkey/fdlibm/w_scalb.c +95 -0
  157. data/vendor/spidermonkey/fdlibm/w_sinh.c +77 -0
  158. data/vendor/spidermonkey/fdlibm/w_sqrt.c +77 -0
  159. data/vendor/spidermonkey/javascript-trace.d +73 -0
  160. data/vendor/spidermonkey/js.c +3951 -0
  161. data/vendor/spidermonkey/js.mak +4438 -0
  162. data/vendor/spidermonkey/js.mdp +0 -0
  163. data/vendor/spidermonkey/js.msg +307 -0
  164. data/vendor/spidermonkey/js.pkg +2 -0
  165. data/vendor/spidermonkey/js3240.rc +79 -0
  166. data/vendor/spidermonkey/jsOS240.def +654 -0
  167. data/vendor/spidermonkey/jsapi.c +5836 -0
  168. data/vendor/spidermonkey/jsapi.h +2624 -0
  169. data/vendor/spidermonkey/jsarena.c +450 -0
  170. data/vendor/spidermonkey/jsarena.h +318 -0
  171. data/vendor/spidermonkey/jsarray.c +2988 -0
  172. data/vendor/spidermonkey/jsarray.h +124 -0
  173. data/vendor/spidermonkey/jsatom.c +1045 -0
  174. data/vendor/spidermonkey/jsatom.h +442 -0
  175. data/vendor/spidermonkey/jsbit.h +253 -0
  176. data/vendor/spidermonkey/jsbool.c +176 -0
  177. data/vendor/spidermonkey/jsbool.h +73 -0
  178. data/vendor/spidermonkey/jsclist.h +139 -0
  179. data/vendor/spidermonkey/jscntxt.c +1348 -0
  180. data/vendor/spidermonkey/jscntxt.h +1120 -0
  181. data/vendor/spidermonkey/jscompat.h +57 -0
  182. data/vendor/spidermonkey/jsconfig.h +248 -0
  183. data/vendor/spidermonkey/jsconfig.mk +181 -0
  184. data/vendor/spidermonkey/jscpucfg.c +383 -0
  185. data/vendor/spidermonkey/jscpucfg.h +212 -0
  186. data/vendor/spidermonkey/jsdate.c +2398 -0
  187. data/vendor/spidermonkey/jsdate.h +124 -0
  188. data/vendor/spidermonkey/jsdbgapi.c +1799 -0
  189. data/vendor/spidermonkey/jsdbgapi.h +464 -0
  190. data/vendor/spidermonkey/jsdhash.c +868 -0
  191. data/vendor/spidermonkey/jsdhash.h +592 -0
  192. data/vendor/spidermonkey/jsdtoa.c +3167 -0
  193. data/vendor/spidermonkey/jsdtoa.h +130 -0
  194. data/vendor/spidermonkey/jsdtracef.c +317 -0
  195. data/vendor/spidermonkey/jsdtracef.h +77 -0
  196. data/vendor/spidermonkey/jsemit.c +6909 -0
  197. data/vendor/spidermonkey/jsemit.h +741 -0
  198. data/vendor/spidermonkey/jsexn.c +1371 -0
  199. data/vendor/spidermonkey/jsexn.h +96 -0
  200. data/vendor/spidermonkey/jsfile.c +2736 -0
  201. data/vendor/spidermonkey/jsfile.h +56 -0
  202. data/vendor/spidermonkey/jsfile.msg +90 -0
  203. data/vendor/spidermonkey/jsfun.c +2634 -0
  204. data/vendor/spidermonkey/jsfun.h +254 -0
  205. data/vendor/spidermonkey/jsgc.c +3554 -0
  206. data/vendor/spidermonkey/jsgc.h +403 -0
  207. data/vendor/spidermonkey/jshash.c +476 -0
  208. data/vendor/spidermonkey/jshash.h +151 -0
  209. data/vendor/spidermonkey/jsify.pl +485 -0
  210. data/vendor/spidermonkey/jsinterp.c +6981 -0
  211. data/vendor/spidermonkey/jsinterp.h +521 -0
  212. data/vendor/spidermonkey/jsinvoke.c +43 -0
  213. data/vendor/spidermonkey/jsiter.c +1067 -0
  214. data/vendor/spidermonkey/jsiter.h +122 -0
  215. data/vendor/spidermonkey/jskeyword.tbl +124 -0
  216. data/vendor/spidermonkey/jskwgen.c +460 -0
  217. data/vendor/spidermonkey/jslibmath.h +266 -0
  218. data/vendor/spidermonkey/jslock.c +1309 -0
  219. data/vendor/spidermonkey/jslock.h +313 -0
  220. data/vendor/spidermonkey/jslocko.asm +60 -0
  221. data/vendor/spidermonkey/jslog2.c +94 -0
  222. data/vendor/spidermonkey/jslong.c +264 -0
  223. data/vendor/spidermonkey/jslong.h +412 -0
  224. data/vendor/spidermonkey/jsmath.c +568 -0
  225. data/vendor/spidermonkey/jsmath.h +57 -0
  226. data/vendor/spidermonkey/jsnum.c +1228 -0
  227. data/vendor/spidermonkey/jsnum.h +283 -0
  228. data/vendor/spidermonkey/jsobj.c +5266 -0
  229. data/vendor/spidermonkey/jsobj.h +709 -0
  230. data/vendor/spidermonkey/jsopcode.c +5245 -0
  231. data/vendor/spidermonkey/jsopcode.h +394 -0
  232. data/vendor/spidermonkey/jsopcode.tbl +523 -0
  233. data/vendor/spidermonkey/jsotypes.h +202 -0
  234. data/vendor/spidermonkey/jsparse.c +6680 -0
  235. data/vendor/spidermonkey/jsparse.h +511 -0
  236. data/vendor/spidermonkey/jsprf.c +1262 -0
  237. data/vendor/spidermonkey/jsprf.h +150 -0
  238. data/vendor/spidermonkey/jsproto.tbl +128 -0
  239. data/vendor/spidermonkey/jsprvtd.h +267 -0
  240. data/vendor/spidermonkey/jspubtd.h +744 -0
  241. data/vendor/spidermonkey/jsregexp.c +4352 -0
  242. data/vendor/spidermonkey/jsregexp.h +183 -0
  243. data/vendor/spidermonkey/jsreops.tbl +145 -0
  244. data/vendor/spidermonkey/jsscan.c +2003 -0
  245. data/vendor/spidermonkey/jsscan.h +387 -0
  246. data/vendor/spidermonkey/jsscope.c +1948 -0
  247. data/vendor/spidermonkey/jsscope.h +418 -0
  248. data/vendor/spidermonkey/jsscript.c +1832 -0
  249. data/vendor/spidermonkey/jsscript.h +287 -0
  250. data/vendor/spidermonkey/jsshell.msg +50 -0
  251. data/vendor/spidermonkey/jsstddef.h +83 -0
  252. data/vendor/spidermonkey/jsstr.c +5004 -0
  253. data/vendor/spidermonkey/jsstr.h +641 -0
  254. data/vendor/spidermonkey/jstypes.h +475 -0
  255. data/vendor/spidermonkey/jsutil.c +345 -0
  256. data/vendor/spidermonkey/jsutil.h +157 -0
  257. data/vendor/spidermonkey/jsxdrapi.c +800 -0
  258. data/vendor/spidermonkey/jsxdrapi.h +218 -0
  259. data/vendor/spidermonkey/jsxml.c +8471 -0
  260. data/vendor/spidermonkey/jsxml.h +349 -0
  261. data/vendor/spidermonkey/lock_SunOS.s +119 -0
  262. data/vendor/spidermonkey/perfect.js +39 -0
  263. data/vendor/spidermonkey/plify_jsdhash.sed +36 -0
  264. data/vendor/spidermonkey/prmjtime.c +846 -0
  265. data/vendor/spidermonkey/prmjtime.h +103 -0
  266. data/vendor/spidermonkey/resource.h +15 -0
  267. data/vendor/spidermonkey/rules.mk +197 -0
  268. data/vendor/spidermonkey/win32.order +384 -0
  269. metadata +4 -3
@@ -0,0 +1,151 @@
1
+ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
+ *
3
+ * ***** BEGIN LICENSE BLOCK *****
4
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
+ *
6
+ * The contents of this file are subject to the Mozilla Public License Version
7
+ * 1.1 (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ * http://www.mozilla.org/MPL/
10
+ *
11
+ * Software distributed under the License is distributed on an "AS IS" basis,
12
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
+ * for the specific language governing rights and limitations under the
14
+ * License.
15
+ *
16
+ * The Original Code is Mozilla Communicator client code, released
17
+ * March 31, 1998.
18
+ *
19
+ * The Initial Developer of the Original Code is
20
+ * Netscape Communications Corporation.
21
+ * Portions created by the Initial Developer are Copyright (C) 1998
22
+ * the Initial Developer. All Rights Reserved.
23
+ *
24
+ * Contributor(s):
25
+ *
26
+ * Alternatively, the contents of this file may be used under the terms of
27
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
28
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
+ * in which case the provisions of the GPL or the LGPL are applicable instead
30
+ * of those above. If you wish to allow use of your version of this file only
31
+ * under the terms of either the GPL or the LGPL, and not to allow others to
32
+ * use your version of this file under the terms of the MPL, indicate your
33
+ * decision by deleting the provisions above and replace them with the notice
34
+ * and other provisions required by the GPL or the LGPL. If you do not delete
35
+ * the provisions above, a recipient may use your version of this file under
36
+ * the terms of any one of the MPL, the GPL or the LGPL.
37
+ *
38
+ * ***** END LICENSE BLOCK ***** */
39
+
40
+ #ifndef jshash_h___
41
+ #define jshash_h___
42
+ /*
43
+ * API to portable hash table code.
44
+ */
45
+ #include <stddef.h>
46
+ #include <stdio.h>
47
+ #include "jstypes.h"
48
+ #include "jscompat.h"
49
+
50
+ JS_BEGIN_EXTERN_C
51
+
52
+ typedef uint32 JSHashNumber;
53
+ typedef struct JSHashEntry JSHashEntry;
54
+ typedef struct JSHashTable JSHashTable;
55
+
56
+ #define JS_HASH_BITS 32
57
+ #define JS_GOLDEN_RATIO 0x9E3779B9U
58
+
59
+ typedef JSHashNumber (* JS_DLL_CALLBACK JSHashFunction)(const void *key);
60
+ typedef intN (* JS_DLL_CALLBACK JSHashComparator)(const void *v1, const void *v2);
61
+ typedef intN (* JS_DLL_CALLBACK JSHashEnumerator)(JSHashEntry *he, intN i, void *arg);
62
+
63
+ /* Flag bits in JSHashEnumerator's return value */
64
+ #define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */
65
+ #define HT_ENUMERATE_STOP 1 /* stop enumerating entries */
66
+ #define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */
67
+
68
+ typedef struct JSHashAllocOps {
69
+ void * (*allocTable)(void *pool, size_t size);
70
+ void (*freeTable)(void *pool, void *item);
71
+ JSHashEntry * (*allocEntry)(void *pool, const void *key);
72
+ void (*freeEntry)(void *pool, JSHashEntry *he, uintN flag);
73
+ } JSHashAllocOps;
74
+
75
+ #define HT_FREE_VALUE 0 /* just free the entry's value */
76
+ #define HT_FREE_ENTRY 1 /* free value and entire entry */
77
+
78
+ struct JSHashEntry {
79
+ JSHashEntry *next; /* hash chain linkage */
80
+ JSHashNumber keyHash; /* key hash function result */
81
+ const void *key; /* ptr to opaque key */
82
+ void *value; /* ptr to opaque value */
83
+ };
84
+
85
+ struct JSHashTable {
86
+ JSHashEntry **buckets; /* vector of hash buckets */
87
+ uint32 nentries; /* number of entries in table */
88
+ uint32 shift; /* multiplicative hash shift */
89
+ JSHashFunction keyHash; /* key hash function */
90
+ JSHashComparator keyCompare; /* key comparison function */
91
+ JSHashComparator valueCompare; /* value comparison function */
92
+ JSHashAllocOps *allocOps; /* allocation operations */
93
+ void *allocPriv; /* allocation private data */
94
+ #ifdef JS_HASHMETER
95
+ uint32 nlookups; /* total number of lookups */
96
+ uint32 nsteps; /* number of hash chains traversed */
97
+ uint32 ngrows; /* number of table expansions */
98
+ uint32 nshrinks; /* number of table contractions */
99
+ #endif
100
+ };
101
+
102
+ /*
103
+ * Create a new hash table.
104
+ * If allocOps is null, use default allocator ops built on top of malloc().
105
+ */
106
+ extern JS_PUBLIC_API(JSHashTable *)
107
+ JS_NewHashTable(uint32 n, JSHashFunction keyHash,
108
+ JSHashComparator keyCompare, JSHashComparator valueCompare,
109
+ JSHashAllocOps *allocOps, void *allocPriv);
110
+
111
+ extern JS_PUBLIC_API(void)
112
+ JS_HashTableDestroy(JSHashTable *ht);
113
+
114
+ /* Low level access methods */
115
+ extern JS_PUBLIC_API(JSHashEntry **)
116
+ JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key);
117
+
118
+ extern JS_PUBLIC_API(JSHashEntry *)
119
+ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep, JSHashNumber keyHash,
120
+ const void *key, void *value);
121
+
122
+ extern JS_PUBLIC_API(void)
123
+ JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he);
124
+
125
+ /* Higher level access methods */
126
+ extern JS_PUBLIC_API(JSHashEntry *)
127
+ JS_HashTableAdd(JSHashTable *ht, const void *key, void *value);
128
+
129
+ extern JS_PUBLIC_API(JSBool)
130
+ JS_HashTableRemove(JSHashTable *ht, const void *key);
131
+
132
+ extern JS_PUBLIC_API(intN)
133
+ JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg);
134
+
135
+ extern JS_PUBLIC_API(void *)
136
+ JS_HashTableLookup(JSHashTable *ht, const void *key);
137
+
138
+ extern JS_PUBLIC_API(intN)
139
+ JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp);
140
+
141
+ /* General-purpose C string hash function. */
142
+ extern JS_PUBLIC_API(JSHashNumber)
143
+ JS_HashString(const void *key);
144
+
145
+ /* Stub function just returns v1 == v2 */
146
+ extern JS_PUBLIC_API(intN)
147
+ JS_CompareValues(const void *v1, const void *v2);
148
+
149
+ JS_END_EXTERN_C
150
+
151
+ #endif /* jshash_h___ */
@@ -0,0 +1,485 @@
1
+ #!/usr/local/bin/perl
2
+
3
+ # This script modifies C code to use the hijacked NSPR routines that are
4
+ # now baked into the JavaScript engine rather than using the NSPR
5
+ # routines that they were based on, i.e. types like PRArenaPool are changed
6
+ # to JSArenaPool.
7
+ #
8
+ # This script was used in 9/98 to facilitate the incorporation of some NSPR
9
+ # code into the JS engine so as to minimize dependency on NSPR.
10
+ #
11
+
12
+ # Command-line: jsify.pl [options] [filename]*
13
+ #
14
+ # Options:
15
+ # -r Reverse direction of transformation, i.e. JS ==> NSPR2
16
+ # -outdir Directory in which to place output files
17
+
18
+
19
+ # NSPR2 symbols that will be modified to JS symbols, e.g.
20
+ # PRArena <==> JSArena
21
+
22
+ @NSPR_symbols = (
23
+ "PRArena",
24
+ "PRArenaPool",
25
+ "PRArenaStats",
26
+ "PR_ARENAMETER",
27
+ "PR_ARENA_",
28
+ "PR_ARENA_ALIGN",
29
+ "PR_ARENA_ALLOCATE",
30
+ "PR_ARENA_CONST_ALIGN_MASK",
31
+ "PR_ARENA_DEFAULT_ALIGN",
32
+ "PR_ARENA_DESTROY",
33
+ "PR_ARENA_GROW",
34
+ "PR_ARENA_MARK",
35
+ "PR_ARENA_RELEASE",
36
+
37
+ "PR_smprintf",
38
+ "PR_smprintf_free",
39
+ "PR_snprintf",
40
+ "PR_sprintf_append",
41
+ "PR_sscanf",
42
+ "PR_sxprintf",
43
+ "PR_vsmprintf",
44
+ "PR_vsnprintf",
45
+ "PR_vsprintf_append",
46
+ "PR_vsxprintf",
47
+
48
+ "PRCList",
49
+ "PRCListStr",
50
+ "PRCLists",
51
+
52
+ "PRDestroyEventProc",
53
+ "PREvent",
54
+ "PREventFunProc",
55
+ "PREventQueue",
56
+ "PRHandleEventProc",
57
+ "PR_PostEvent",
58
+ "PR_PostSynchronousEvent",
59
+ "PR_ProcessPendingEvents",
60
+ "PR_CreateEventQueue",
61
+ "PR_DequeueEvent",
62
+ "PR_DestroyEvent",
63
+ "PR_DestroyEventQueue",
64
+ "PR_EventAvailable",
65
+ "PR_EventLoop",
66
+ "PR_GetEvent",
67
+ "PR_GetEventOwner",
68
+ "PR_GetEventQueueMonitor",
69
+ "PR_GetEventQueueSelectFD",
70
+ "PR_GetMainEventQueue",
71
+ "PR_HandleEvent",
72
+ "PR_InitEvent",
73
+ "PR_ENTER_EVENT_QUEUE_MONITOR",
74
+ "PR_EXIT_EVENT_QUEUE_MONITOR",
75
+ "PR_MapEvents",
76
+ "PR_RevokeEvents",
77
+
78
+ "PR_cnvtf",
79
+ "PR_dtoa",
80
+ "PR_strtod",
81
+
82
+ "PRFileDesc",
83
+
84
+ "PR_HASH_BITS",
85
+ "PR_GOLDEN_RATIO",
86
+ "PRHashAllocOps",
87
+ "PRHashComparator",
88
+ "PRHashEntry",
89
+ "PRHashEnumerator",
90
+ "PRHashFunction",
91
+ "PRHashNumber",
92
+ "PRHashTable",
93
+ "PR_HashString",
94
+ "PR_HashTableAdd",
95
+ "PR_HashTableDestroy",
96
+ "PR_HashTableDump",
97
+ "PR_HashTableEnumerateEntries",
98
+ "PR_HashTableLookup",
99
+ "PR_HashTableRawAdd",
100
+ "PR_HashTableRawLookup",
101
+ "PR_HashTableRawRemove",
102
+ "PR_HashTableRemove",
103
+
104
+ "PRBool",
105
+ "PRFloat64",
106
+ "PRInt16",
107
+ "PRInt32",
108
+ "PRInt64",
109
+ "PRInt8",
110
+ "PRIntn",
111
+ "PRUint16",
112
+ "PRUint32",
113
+ "PRUint64",
114
+ "PRUint8",
115
+ "PRUintn",
116
+ "PRPtrDiff",
117
+ "PRPtrdiff",
118
+ "PRUptrdiff",
119
+ "PRUword",
120
+ "PRWord",
121
+ "PRPackedBool",
122
+ "PRSize",
123
+ "PRStatus",
124
+ "pruword",
125
+ "prword",
126
+ "prword_t",
127
+
128
+ "PR_ALIGN_OF_DOUBLE",
129
+ "PR_ALIGN_OF_FLOAT",
130
+ "PR_ALIGN_OF_INT",
131
+ "PR_ALIGN_OF_INT64",
132
+ "PR_ALIGN_OF_LONG",
133
+ "PR_ALIGN_OF_POINTER",
134
+ "PR_ALIGN_OF_SHORT",
135
+ "PR_ALIGN_OF_WORD",
136
+ "PR_BITS_PER_BYTE",
137
+ "PR_BITS_PER_BYTE_LOG2",
138
+ "PR_BITS_PER_DOUBLE",
139
+ "PR_BITS_PER_DOUBLE_LOG2",
140
+ "PR_BITS_PER_FLOAT",
141
+ "PR_BITS_PER_FLOAT_LOG2",
142
+ "PR_BITS_PER_INT",
143
+ "PR_BITS_PER_INT64",
144
+ "PR_BITS_PER_INT64_LOG2",
145
+ "PR_BITS_PER_INT_LOG2",
146
+ "PR_BITS_PER_LONG",
147
+ "PR_BITS_PER_LONG_LOG2",
148
+ "PR_BITS_PER_SHORT",
149
+ "PR_BITS_PER_SHORT_LOG2",
150
+ "PR_BITS_PER_WORD",
151
+ "PR_BITS_PER_WORD_LOG2",
152
+ "PR_BYTES_PER_BYTE",
153
+ "PR_BYTES_PER_DOUBLE",
154
+ "PR_BYTES_PER_DWORD",
155
+ "PR_BYTES_PER_DWORD_LOG2",
156
+ "PR_BYTES_PER_FLOAT",
157
+ "PR_BYTES_PER_INT",
158
+ "PR_BYTES_PER_INT64",
159
+ "PR_BYTES_PER_LONG",
160
+ "PR_BYTES_PER_SHORT",
161
+ "PR_BYTES_PER_WORD",
162
+ "PR_BYTES_PER_WORD_LOG2",
163
+
164
+ "PRSegment",
165
+ "PRSegmentAccess",
166
+ "PRStuffFunc",
167
+ "PRThread",
168
+
169
+ "PR_APPEND_LINK",
170
+
171
+ "PR_ASSERT",
172
+
173
+ "PR_ATOMIC_DWORD_LOAD",
174
+ "PR_ATOMIC_DWORD_STORE",
175
+
176
+ "PR_Abort",
177
+
178
+ "PR_ArenaAllocate",
179
+ "PR_ArenaCountAllocation",
180
+ "PR_ArenaCountGrowth",
181
+ "PR_ArenaCountInplaceGrowth",
182
+ "PR_ArenaCountRelease",
183
+ "PR_ArenaCountRetract",
184
+ "PR_ArenaFinish",
185
+ "PR_ArenaGrow",
186
+ "PR_ArenaRelease",
187
+ "PR_CompactArenaPool",
188
+ "PR_DumpArenaStats",
189
+ "PR_FinishArenaPool",
190
+ "PR_FreeArenaPool",
191
+ "PR_InitArenaPool",
192
+
193
+ "PR_Assert",
194
+
195
+ "PR_AttachThread",
196
+
197
+ "PR_BEGIN_EXTERN_C",
198
+ "PR_BEGIN_MACRO",
199
+
200
+ "PR_BIT",
201
+ "PR_BITMASK",
202
+
203
+ "PR_BUFFER_OVERFLOW_ERROR",
204
+
205
+ "PR_CALLBACK",
206
+ "PR_CALLBACK_DECL",
207
+ "PR_CALLOC",
208
+ "PR_CEILING_LOG2",
209
+ "PR_CLEAR_ARENA",
210
+ "PR_CLEAR_BIT",
211
+ "PR_CLEAR_UNUSED",
212
+ "PR_CLIST_IS_EMPTY",
213
+ "PR_COUNT_ARENA",
214
+ "PR_CURRENT_THREAD",
215
+
216
+ "PR_GetSegmentAccess",
217
+ "PR_GetSegmentSize",
218
+ "PR_GetSegmentVaddr",
219
+ "PR_GrowSegment",
220
+ "PR_DestroySegment",
221
+ "PR_MapSegment",
222
+ "PR_NewSegment",
223
+ "PR_Segment",
224
+ "PR_Seg",
225
+ "PR_SEGMENT_NONE",
226
+ "PR_SEGMENT_RDONLY",
227
+ "PR_SEGMENT_RDWR",
228
+
229
+ "PR_Calloc",
230
+ "PR_CeilingLog2",
231
+ "PR_CompareStrings",
232
+ "PR_CompareValues",
233
+ "PR_DELETE",
234
+ "PR_END_EXTERN_C",
235
+ "PR_END_MACRO",
236
+ "PR_ENUMERATE_STOP",
237
+ "PR_FAILURE",
238
+ "PR_FALSE",
239
+ "PR_FLOOR_LOG2",
240
+ "PR_FREEIF",
241
+ "PR_FREE_PATTERN",
242
+ "PR_FloorLog2",
243
+ "PR_FormatTime",
244
+ "PR_Free",
245
+
246
+ "PR_GetEnv",
247
+ "PR_GetError",
248
+ "PR_INIT_ARENA_POOL",
249
+ "PR_INIT_CLIST",
250
+ "PR_INIT_STATIC_CLIST",
251
+ "PR_INLINE",
252
+ "PR_INSERT_AFTER",
253
+ "PR_INSERT_BEFORE",
254
+ "PR_INSERT_LINK",
255
+ "PR_INT32",
256
+ "PR_INTERVAL_NO_TIMEOUT",
257
+ "PR_INTERVAL_NO_WAIT",
258
+ "PR_Init",
259
+ "PR_LIST_HEAD",
260
+ "PR_LIST_TAIL",
261
+ "PR_LOG",
262
+ "PR_LOGGING",
263
+ "PR_LOG_ALWAYS",
264
+ "PR_LOG_BEGIN",
265
+ "PR_LOG_DEBUG",
266
+ "PR_LOG_DEFINE",
267
+ "PR_LOG_END",
268
+ "PR_LOG_ERROR",
269
+ "PR_LOG_MAX",
270
+ "PR_LOG_MIN",
271
+ "PR_LOG_NONE",
272
+ "PR_LOG_NOTICE",
273
+ "PR_LOG_TEST",
274
+ "PR_LOG_WARN",
275
+ "PR_LOG_WARNING",
276
+ "PR_LogFlush",
277
+ "PR_LogPrint",
278
+ "PR_MALLOC",
279
+ "PR_MAX",
280
+ "PR_MD_calloc",
281
+ "PR_MD_free",
282
+ "PR_MD_malloc",
283
+ "PR_MD_realloc",
284
+ "PR_MIN",
285
+ "PR_Malloc",
286
+ "PR_NEW",
287
+ "PR_NEWZAP",
288
+ "PR_NEXT_LINK",
289
+ "PR_NOT_REACHED",
290
+ "PR_NewCondVar",
291
+ "PR_NewHashTable",
292
+ "PR_NewLogModule",
293
+ "PR_PREV_LINK",
294
+ "PR_PUBLIC_API",
295
+ "PR_PUBLIC_DATA",
296
+ "PR_RANGE_ERROR",
297
+ "PR_REALLOC",
298
+ "PR_REMOVE_AND_INIT_LINK",
299
+ "PR_REMOVE_LINK",
300
+ "PR_ROUNDUP",
301
+ "PR_Realloc",
302
+
303
+ "PR_SET_BIT",
304
+ "PR_STATIC_CALLBACK",
305
+ "PR_SUCCESS",
306
+ "PR_SetError",
307
+ "PR_SetLogBuffering",
308
+ "PR_SetLogFile",
309
+
310
+ "PR_TEST_BIT",
311
+ "PR_TRUE",
312
+ "PR_UINT32",
313
+ "PR_UPTRDIFF",
314
+
315
+ "prarena_h___",
316
+ "prbit_h___",
317
+ "prclist_h___",
318
+ "prdtoa_h___",
319
+ "prlog_h___",
320
+ "prlong_h___",
321
+ "prmacos_h___",
322
+ "prmem_h___",
323
+ "prprf_h___",
324
+ "prtypes_h___",
325
+
326
+ "prarena",
327
+ "prbit",
328
+ "prbitmap_t",
329
+ "prclist",
330
+ "prcpucfg",
331
+ "prdtoa",
332
+ "prhash",
333
+ "plhash",
334
+ "prlong",
335
+ "prmacos",
336
+ "prmem",
337
+ "prosdep",
338
+ "protypes",
339
+ "prprf",
340
+ "prtypes"
341
+ );
342
+
343
+ while ($ARGV[0] =~ /^-/) {
344
+ if ($ARGV[0] eq "-r") {
345
+ shift;
346
+ $reverse_conversion = 1;
347
+ } elsif ($ARGV[0] eq "-outdir") {
348
+ shift;
349
+ $outdir = shift;
350
+ }
351
+ }
352
+
353
+ # Given an NSPR symbol compute the JS equivalent or
354
+ # vice-versa
355
+ sub subst {
356
+ local ($replacement);
357
+ local ($sym) = @_;
358
+
359
+ $replacement = substr($sym,0,2) eq "pr" ? "js" : "JS";
360
+ $replacement .= substr($sym, 2);
361
+ return $replacement;
362
+ }
363
+
364
+ # Build the regular expression that will convert between the NSPR
365
+ # types and the JS types
366
+ if ($reverse_conversion) {
367
+ die "Not implemented yet";
368
+ } else {
369
+ foreach $sym (@NSPR_symbols) {
370
+ $regexp .= $sym . "|"
371
+ }
372
+ # Get rid of the last "!"
373
+ chop $regexp;
374
+
375
+ # Replace PR* with JS* and replace pr* with js*
376
+ $regexp = 's/(^|\\W)(' . $regexp . ')/$1 . &subst($2)/eg';
377
+ # print $regexp;
378
+ }
379
+
380
+ # Pre-compile a little subroutine to perform the regexp substitution
381
+ # between NSPR types and JS types
382
+ eval('sub convert_from_NSPR {($line) = @_; $line =~ ' . $regexp . ';}');
383
+
384
+ sub convert_mallocs {
385
+ ($line) = @_;
386
+ $line =~ s/PR_MALLOC/malloc/g;
387
+ $line =~ s/PR_REALLOC/realloc/g;
388
+ $line =~ s/PR_FREE/free/g;
389
+ return $line;
390
+ }
391
+
392
+ sub convert_includes {
393
+ ($line) = @_;
394
+ if ($line !~ /include/) {
395
+ return $line;
396
+ }
397
+
398
+ if ($line =~ /prlog\.h/) {
399
+ $line = '#include "jsutil.h"'. " /* Added by JSIFY */\n";
400
+ } elsif ($line =~ /plhash\.h/) {
401
+ $line = '#include "jshash.h"'. " /* Added by JSIFY */\n";
402
+ } elsif ($line =~ /plarena\.h/) {
403
+ $line = '#include "jsarena.h"'. " /* Added by JSIFY */\n";
404
+ } elsif ($line =~ /prmem\.h/) {
405
+ $line = "";
406
+ } elsif ($line =~ /jsmsg\.def/) {
407
+ $line = '#include "js.msg"' . "\n";
408
+ } elsif ($line =~ /shellmsg\.def/) {
409
+ $line = '#include "jsshell.msg"' . "\n";
410
+ } elsif ($line =~ /jsopcode\.def/) {
411
+ $line = '#include "jsopcode.tbl"' . "\n";
412
+ }
413
+ return $line;
414
+ }
415
+
416
+ sub convert_declarations {
417
+ ($line) = @_;
418
+ $line =~ s/PR_EXTERN/JS_EXTERN_API/g;
419
+ $line =~ s/PR_IMPLEMENT_DATA/JS_EXPORT_DATA/g;
420
+ $line =~ s/PR_IMPLEMENT/JS_EXPORT_API/g;
421
+ $line =~ s/PR_CALLBACK/JS_DLL_CALLBACK/g;
422
+ $line =~ s/PR_STATIC_CALLBACK/JS_STATIC_DLL_CALLBACK/g;
423
+ $line =~ s/PR_IMPORT/JS_IMPORT/g;
424
+ $line =~ s/PR_PUBLIC_API/JS_EXPORT_API/g;
425
+ $line =~ s/PR_PUBLIC_DATA/JS_EXPORT_DATA/g;
426
+ return $line;
427
+ }
428
+
429
+ sub convert_long_long_macros {
430
+ ($line) = @_;
431
+ $line =~ s/\b(LL_)/JSLL_/g;
432
+ return $line;
433
+ }
434
+
435
+ sub convert_asserts {
436
+ ($line) = @_;
437
+ $line =~ s/\bPR_ASSERT/JS_ASSERT/g;
438
+ return $line;
439
+ }
440
+
441
+ while ($#ARGV >= 0) {
442
+ $infile = shift;
443
+
444
+ # Change filename, e.g. prtime.h to jsprtime.h, except for legacy
445
+ # files that start with 'prmj', like prmjtime.h.
446
+ $outfile = $infile;
447
+ if ($infile !~ /^prmj/) {
448
+ $outfile =~ s/^pr/js/;
449
+ $outfile =~ s/^pl/js/;
450
+ }
451
+
452
+ if ($outdir) {
453
+ $outfile = $outdir . '/' . $outfile;
454
+ }
455
+
456
+ if ($infile eq $outfile) {
457
+ die "Error: refuse to overwrite $outfile, use -outdir option."
458
+ }
459
+ die "Can't open $infile" if !open(INFILE, "<$infile");
460
+ die "Can't open $outfile for writing" if !open(OUTFILE, ">$outfile");
461
+
462
+ while (<INFILE>) {
463
+ $line = $_;
464
+
465
+ #Get rid of #include "prlog.h"
466
+ &convert_includes($line);
467
+
468
+ # Rename PR_EXTERN, PR_IMPORT, etc.
469
+ &convert_declarations($line);
470
+
471
+ # Convert from PR_MALLOC to malloc, etc.
472
+ &convert_mallocs($line);
473
+
474
+ # Convert from PR_ASSERT to JS_ASSERT
475
+ # &convert_asserts($line);
476
+
477
+ # Convert from, e.g. PRArena to JSPRArena
478
+ &convert_from_NSPR($line);
479
+
480
+ # Change LL_* macros to JSLL_*
481
+ &convert_long_long_macros($line);
482
+
483
+ print OUTFILE $line;
484
+ }
485
+ }