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,475 @@
1
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
+ /* ***** BEGIN LICENSE BLOCK *****
3
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
+ *
5
+ * The contents of this file are subject to the Mozilla Public License Version
6
+ * 1.1 (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ * http://www.mozilla.org/MPL/
9
+ *
10
+ * Software distributed under the License is distributed on an "AS IS" basis,
11
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
+ * for the specific language governing rights and limitations under the
13
+ * License.
14
+ *
15
+ * The Original Code is Mozilla Communicator client code, released
16
+ * March 31, 1998.
17
+ *
18
+ * The Initial Developer of the Original Code is
19
+ * Netscape Communications Corporation.
20
+ * Portions created by the Initial Developer are Copyright (C) 1998
21
+ * the Initial Developer. All Rights Reserved.
22
+ *
23
+ * Contributor(s):
24
+ * IBM Corp.
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
+ /*
41
+ ** File: jstypes.h
42
+ ** Description: Definitions of NSPR's basic types
43
+ **
44
+ ** Prototypes and macros used to make up for deficiencies in ANSI environments
45
+ ** that we have found.
46
+ **
47
+ ** Since we do not wrap <stdlib.h> and all the other standard headers, authors
48
+ ** of portable code will not know in general that they need these definitions.
49
+ ** Instead of requiring these authors to find the dependent uses in their code
50
+ ** and take the following steps only in those C files, we take steps once here
51
+ ** for all C files.
52
+ **/
53
+
54
+ #ifndef jstypes_h___
55
+ #define jstypes_h___
56
+
57
+ #include <stddef.h>
58
+
59
+ /***********************************************************************
60
+ ** MACROS: JS_EXTERN_API
61
+ ** JS_EXPORT_API
62
+ ** DESCRIPTION:
63
+ ** These are only for externally visible routines and globals. For
64
+ ** internal routines, just use "extern" for type checking and that
65
+ ** will not export internal cross-file or forward-declared symbols.
66
+ ** Define a macro for declaring procedures return types. We use this to
67
+ ** deal with windoze specific type hackery for DLL definitions. Use
68
+ ** JS_EXTERN_API when the prototype for the method is declared. Use
69
+ ** JS_EXPORT_API for the implementation of the method.
70
+ **
71
+ ** Example:
72
+ ** in dowhim.h
73
+ ** JS_EXTERN_API( void ) DoWhatIMean( void );
74
+ ** in dowhim.c
75
+ ** JS_EXPORT_API( void ) DoWhatIMean( void ) { return; }
76
+ **
77
+ **
78
+ ***********************************************************************/
79
+ #ifdef WIN32
80
+
81
+ /* These also work for __MWERKS__ */
82
+ # define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
83
+ # define JS_EXPORT_API(__type) __declspec(dllexport) __type
84
+ # define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
85
+ # define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
86
+
87
+ # define JS_DLL_CALLBACK
88
+ # define JS_STATIC_DLL_CALLBACK(__x) static __x
89
+
90
+ #elif defined(XP_OS2) && defined(__declspec)
91
+
92
+ # define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
93
+ # define JS_EXPORT_API(__type) __declspec(dllexport) __type
94
+ # define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
95
+ # define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
96
+
97
+ # define JS_DLL_CALLBACK
98
+ # define JS_STATIC_DLL_CALLBACK(__x) static __x
99
+
100
+ #else /* Unix */
101
+
102
+ # ifdef HAVE_VISIBILITY_ATTRIBUTE
103
+ # define JS_EXTERNAL_VIS __attribute__((visibility ("default")))
104
+ # else
105
+ # define JS_EXTERNAL_VIS
106
+ # endif
107
+
108
+ # define JS_EXTERN_API(__type) extern JS_EXTERNAL_VIS __type
109
+ # define JS_EXPORT_API(__type) JS_EXTERNAL_VIS __type
110
+ # define JS_EXTERN_DATA(__type) extern JS_EXTERNAL_VIS __type
111
+ # define JS_EXPORT_DATA(__type) JS_EXTERNAL_VIS __type
112
+
113
+ # define JS_DLL_CALLBACK
114
+ # define JS_STATIC_DLL_CALLBACK(__x) static __x
115
+
116
+ #endif
117
+
118
+ #ifdef _WIN32
119
+ # if defined(__MWERKS__) || defined(__GNUC__)
120
+ # define JS_IMPORT_API(__x) __x
121
+ # else
122
+ # define JS_IMPORT_API(__x) __declspec(dllimport) __x
123
+ # endif
124
+ #elif defined(XP_OS2) && defined(__declspec)
125
+ # define JS_IMPORT_API(__x) __declspec(dllimport) __x
126
+ #else
127
+ # define JS_IMPORT_API(__x) JS_EXPORT_API (__x)
128
+ #endif
129
+
130
+ #if defined(_WIN32) && !defined(__MWERKS__)
131
+ # define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
132
+ #elif defined(XP_OS2) && defined(__declspec)
133
+ # define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
134
+ #else
135
+ # define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x)
136
+ #endif
137
+
138
+ /*
139
+ * The linkage of JS API functions differs depending on whether the file is
140
+ * used within the JS library or not. Any source file within the JS
141
+ * interpreter should define EXPORT_JS_API whereas any client of the library
142
+ * should not. STATIC_JS_API is used to build JS as a static library.
143
+ */
144
+ #if defined(STATIC_JS_API)
145
+
146
+ # define JS_PUBLIC_API(t) t
147
+ # define JS_PUBLIC_DATA(t) t
148
+
149
+ #elif defined(EXPORT_JS_API)
150
+
151
+ # define JS_PUBLIC_API(t) JS_EXPORT_API(t)
152
+ # define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
153
+
154
+ #else
155
+
156
+ # define JS_PUBLIC_API(t) JS_IMPORT_API(t)
157
+ # define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
158
+
159
+ #endif
160
+
161
+ #define JS_FRIEND_API(t) JS_PUBLIC_API(t)
162
+ #define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
163
+
164
+ #if defined(_MSC_VER)
165
+ # define JS_INLINE __forceinline
166
+ #elif defined(__GNUC__)
167
+ # ifndef DEBUG
168
+ # define JS_INLINE __attribute__((always_inline))
169
+ # else
170
+ # define JS_INLINE inline
171
+ # endif
172
+ #else
173
+ # define JS_INLINE
174
+ #endif
175
+
176
+ /***********************************************************************
177
+ ** MACROS: JS_BEGIN_MACRO
178
+ ** JS_END_MACRO
179
+ ** DESCRIPTION:
180
+ ** Macro body brackets so that macros with compound statement definitions
181
+ ** behave syntactically more like functions when called.
182
+ ***********************************************************************/
183
+ #define JS_BEGIN_MACRO do {
184
+
185
+ #if defined(_MSC_VER) && _MSC_VER >= 1400
186
+ # define JS_END_MACRO \
187
+ } __pragma(warning(push)) __pragma(warning(disable:4127)) \
188
+ while (0) __pragma(warning(pop))
189
+ #else
190
+ # define JS_END_MACRO } while (0)
191
+ #endif
192
+
193
+ /***********************************************************************
194
+ ** MACROS: JS_BEGIN_EXTERN_C
195
+ ** JS_END_EXTERN_C
196
+ ** DESCRIPTION:
197
+ ** Macro shorthands for conditional C++ extern block delimiters.
198
+ ***********************************************************************/
199
+ #ifdef __cplusplus
200
+
201
+ # define JS_BEGIN_EXTERN_C extern "C" {
202
+ # define JS_END_EXTERN_C }
203
+
204
+ #else
205
+
206
+ # define JS_BEGIN_EXTERN_C
207
+ # define JS_END_EXTERN_C
208
+
209
+ #endif
210
+
211
+ /***********************************************************************
212
+ ** MACROS: JS_BIT
213
+ ** JS_BITMASK
214
+ ** DESCRIPTION:
215
+ ** Bit masking macros. XXX n must be <= 31 to be portable
216
+ ***********************************************************************/
217
+ #define JS_BIT(n) ((JSUint32)1 << (n))
218
+ #define JS_BITMASK(n) (JS_BIT(n) - 1)
219
+
220
+ /***********************************************************************
221
+ ** MACROS: JS_PTR_TO_INT32
222
+ ** JS_PTR_TO_UINT32
223
+ ** JS_INT32_TO_PTR
224
+ ** JS_UINT32_TO_PTR
225
+ ** DESCRIPTION:
226
+ ** Integer to pointer and pointer to integer conversion macros.
227
+ ***********************************************************************/
228
+ #define JS_PTR_TO_INT32(x) ((jsint)((char *)(x) - (char *)0))
229
+ #define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0))
230
+ #define JS_INT32_TO_PTR(x) ((void *)((char *)0 + (jsint)(x)))
231
+ #define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x)))
232
+
233
+ /***********************************************************************
234
+ ** MACROS: JS_HOWMANY
235
+ ** JS_ROUNDUP
236
+ ** JS_MIN
237
+ ** JS_MAX
238
+ ** DESCRIPTION:
239
+ ** Commonly used macros for operations on compatible types.
240
+ ***********************************************************************/
241
+ #define JS_HOWMANY(x,y) (((x)+(y)-1)/(y))
242
+ #define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y))
243
+ #define JS_MIN(x,y) ((x)<(y)?(x):(y))
244
+ #define JS_MAX(x,y) ((x)>(y)?(x):(y))
245
+
246
+ #if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE)
247
+ # include "jscpucfg.h" /* Use standard Mac or Windows configuration */
248
+ #elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE)
249
+ # include "jsautocfg.h" /* Use auto-detected configuration */
250
+ #else
251
+ # error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX"
252
+ #endif
253
+
254
+ JS_BEGIN_EXTERN_C
255
+
256
+ /************************************************************************
257
+ ** TYPES: JSUint8
258
+ ** JSInt8
259
+ ** DESCRIPTION:
260
+ ** The int8 types are known to be 8 bits each. There is no type that
261
+ ** is equivalent to a plain "char".
262
+ ************************************************************************/
263
+ #if JS_BYTES_PER_BYTE == 1
264
+ typedef unsigned char JSUint8;
265
+ typedef signed char JSInt8;
266
+ #else
267
+ # error No suitable type for JSInt8/JSUint8
268
+ #endif
269
+
270
+ /************************************************************************
271
+ ** TYPES: JSUint16
272
+ ** JSInt16
273
+ ** DESCRIPTION:
274
+ ** The int16 types are known to be 16 bits each.
275
+ ************************************************************************/
276
+ #if JS_BYTES_PER_SHORT == 2
277
+ typedef unsigned short JSUint16;
278
+ typedef short JSInt16;
279
+ #else
280
+ # error No suitable type for JSInt16/JSUint16
281
+ #endif
282
+
283
+ /************************************************************************
284
+ ** TYPES: JSUint32
285
+ ** JSInt32
286
+ ** DESCRIPTION:
287
+ ** The int32 types are known to be 32 bits each.
288
+ ************************************************************************/
289
+ #if JS_BYTES_PER_INT == 4
290
+ typedef unsigned int JSUint32;
291
+ typedef int JSInt32;
292
+ # define JS_INT32(x) x
293
+ # define JS_UINT32(x) x ## U
294
+ #elif JS_BYTES_PER_LONG == 4
295
+ typedef unsigned long JSUint32;
296
+ typedef long JSInt32;
297
+ # define JS_INT32(x) x ## L
298
+ # define JS_UINT32(x) x ## UL
299
+ #else
300
+ # error No suitable type for JSInt32/JSUint32
301
+ #endif
302
+
303
+ /************************************************************************
304
+ ** TYPES: JSUint64
305
+ ** JSInt64
306
+ ** DESCRIPTION:
307
+ ** The int64 types are known to be 64 bits each. Care must be used when
308
+ ** declaring variables of type JSUint64 or JSInt64. Different hardware
309
+ ** architectures and even different compilers have varying support for
310
+ ** 64 bit values. The only guaranteed portability requires the use of
311
+ ** the JSLL_ macros (see jslong.h).
312
+ ************************************************************************/
313
+ #ifdef JS_HAVE_LONG_LONG
314
+
315
+ # if JS_BYTES_PER_LONG == 8
316
+ typedef long JSInt64;
317
+ typedef unsigned long JSUint64;
318
+ # elif defined(WIN16)
319
+ typedef __int64 JSInt64;
320
+ typedef unsigned __int64 JSUint64;
321
+ # elif defined(WIN32) && !defined(__GNUC__)
322
+ typedef __int64 JSInt64;
323
+ typedef unsigned __int64 JSUint64;
324
+ # else
325
+ typedef long long JSInt64;
326
+ typedef unsigned long long JSUint64;
327
+ # endif /* JS_BYTES_PER_LONG == 8 */
328
+
329
+ #else /* !JS_HAVE_LONG_LONG */
330
+
331
+ typedef struct {
332
+ # ifdef IS_LITTLE_ENDIAN
333
+ JSUint32 lo, hi;
334
+ # else
335
+ JSUint32 hi, lo;
336
+ #endif
337
+ } JSInt64;
338
+ typedef JSInt64 JSUint64;
339
+
340
+ #endif /* !JS_HAVE_LONG_LONG */
341
+
342
+ /************************************************************************
343
+ ** TYPES: JSUintn
344
+ ** JSIntn
345
+ ** DESCRIPTION:
346
+ ** The JSIntn types are most appropriate for automatic variables. They are
347
+ ** guaranteed to be at least 16 bits, though various architectures may
348
+ ** define them to be wider (e.g., 32 or even 64 bits). These types are
349
+ ** never valid for fields of a structure.
350
+ ************************************************************************/
351
+ #if JS_BYTES_PER_INT >= 2
352
+ typedef int JSIntn;
353
+ typedef unsigned int JSUintn;
354
+ #else
355
+ # error 'sizeof(int)' not sufficient for platform use
356
+ #endif
357
+
358
+ /************************************************************************
359
+ ** TYPES: JSFloat64
360
+ ** DESCRIPTION:
361
+ ** NSPR's floating point type is always 64 bits.
362
+ ************************************************************************/
363
+ typedef double JSFloat64;
364
+
365
+ /************************************************************************
366
+ ** TYPES: JSSize
367
+ ** DESCRIPTION:
368
+ ** A type for representing the size of objects.
369
+ ************************************************************************/
370
+ typedef size_t JSSize;
371
+
372
+ /************************************************************************
373
+ ** TYPES: JSPtrDiff
374
+ ** DESCRIPTION:
375
+ ** A type for pointer difference. Variables of this type are suitable
376
+ ** for storing a pointer or pointer sutraction.
377
+ ************************************************************************/
378
+ typedef ptrdiff_t JSPtrdiff;
379
+
380
+ /************************************************************************
381
+ ** TYPES: JSUptrdiff
382
+ ** DESCRIPTION:
383
+ ** A type for pointer difference. Variables of this type are suitable
384
+ ** for storing a pointer or pointer sutraction.
385
+ ************************************************************************/
386
+ #if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
387
+ typedef JSUint64 JSUptrdiff;
388
+ #else
389
+ typedef unsigned long JSUptrdiff;
390
+ #endif
391
+
392
+ /************************************************************************
393
+ ** TYPES: JSBool
394
+ ** DESCRIPTION:
395
+ ** Use JSBool for variables and parameter types. Use JS_FALSE and JS_TRUE
396
+ ** for clarity of target type in assignments and actual arguments. Use
397
+ ** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
398
+ ** just as you would C int-valued conditions.
399
+ ************************************************************************/
400
+ typedef JSIntn JSBool;
401
+ #define JS_TRUE (JSIntn)1
402
+ #define JS_FALSE (JSIntn)0
403
+
404
+ /************************************************************************
405
+ ** TYPES: JSPackedBool
406
+ ** DESCRIPTION:
407
+ ** Use JSPackedBool within structs where bitfields are not desireable
408
+ ** but minimum and consistent overhead matters.
409
+ ************************************************************************/
410
+ typedef JSUint8 JSPackedBool;
411
+
412
+ /*
413
+ ** A JSWord is an integer that is the same size as a void*
414
+ */
415
+ #if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
416
+ typedef JSInt64 JSWord;
417
+ typedef JSUint64 JSUword;
418
+ #else
419
+ typedef long JSWord;
420
+ typedef unsigned long JSUword;
421
+ #endif
422
+
423
+ #include "jsotypes.h"
424
+
425
+ /***********************************************************************
426
+ ** MACROS: JS_LIKELY
427
+ ** JS_UNLIKELY
428
+ ** DESCRIPTION:
429
+ ** These macros allow you to give a hint to the compiler about branch
430
+ ** probability so that it can better optimize. Use them like this:
431
+ **
432
+ ** if (JS_LIKELY(v == 1)) {
433
+ ** ... expected code path ...
434
+ ** }
435
+ **
436
+ ** if (JS_UNLIKELY(v == 0)) {
437
+ ** ... non-expected code path ...
438
+ ** }
439
+ **
440
+ ***********************************************************************/
441
+ #if defined(__GNUC__) && (__GNUC__ > 2)
442
+
443
+ # define JS_LIKELY(x) (__builtin_expect((x), 1))
444
+ # define JS_UNLIKELY(x) (__builtin_expect((x), 0))
445
+
446
+ #else
447
+
448
+ # define JS_LIKELY(x) (x)
449
+ # define JS_UNLIKELY(x) (x)
450
+
451
+ #endif
452
+
453
+ /***********************************************************************
454
+ ** MACROS: JS_ARRAY_LENGTH
455
+ ** JS_ARRAY_END
456
+ ** DESCRIPTION:
457
+ ** Macros to get the number of elements and the pointer to one past the
458
+ ** last element of a C array. Use them like this:
459
+ **
460
+ ** jschar buf[10], *s;
461
+ ** JSString *str;
462
+ ** ...
463
+ ** for (s = buf; s != JS_ARRAY_END(buf); ++s) *s = ...;
464
+ ** ...
465
+ ** str = JS_NewStringCopyN(cx, buf, JS_ARRAY_LENGTH(buf));
466
+ ** ...
467
+ **
468
+ ***********************************************************************/
469
+
470
+ #define JS_ARRAY_LENGTH(array) (sizeof (array) / sizeof (array)[0])
471
+ #define JS_ARRAY_END(array) ((array) + JS_ARRAY_LENGTH(array))
472
+
473
+ JS_END_EXTERN_C
474
+
475
+ #endif /* jstypes_h___ */