PageRenderTime 40ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/js/jsprvtd.h

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
C++ Header | 263 lines | 142 code | 26 blank | 95 comment | 0 complexity | 64df4f606be9c2798baabded3616227c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  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. #ifndef jsprvtd_h___
  40. #define jsprvtd_h___
  41. /*
  42. * JS private typename definitions.
  43. *
  44. * This header is included only in other .h files, for convenience and for
  45. * simplicity of type naming. The alternative for structures is to use tags,
  46. * which are named the same as their typedef names (legal in C/C++, and less
  47. * noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
  48. * all .h files that include this file may use the same typedef name, whether
  49. * declaring a pointer to struct type, or defining a member of struct type.
  50. *
  51. * A few fundamental scalar types are defined here too. Neither the scalar
  52. * nor the struct typedefs should change much, therefore the nearly-global
  53. * make dependency induced by this file should not prove painful.
  54. */
  55. #include "jspubtd.h"
  56. /* Internal identifier (jsid) macros. */
  57. #define JSID_IS_ATOM(id) JSVAL_IS_STRING((jsval)(id))
  58. #define JSID_TO_ATOM(id) ((JSAtom *)(id))
  59. #define ATOM_TO_JSID(atom) (JS_ASSERT(ATOM_IS_STRING(atom)), \
  60. (jsid)(atom))
  61. #define JSID_IS_INT(id) JSVAL_IS_INT((jsval)(id))
  62. #define JSID_TO_INT(id) JSVAL_TO_INT((jsval)(id))
  63. #define INT_TO_JSID(i) ((jsid)INT_TO_JSVAL(i))
  64. #define INT_JSVAL_TO_JSID(v) ((jsid)(v))
  65. #define INT_JSID_TO_JSVAL(id) ((jsval)(id))
  66. #define JSID_IS_OBJECT(id) JSVAL_IS_OBJECT((jsval)(id))
  67. #define JSID_TO_OBJECT(id) JSVAL_TO_OBJECT((jsval)(id))
  68. #define OBJECT_TO_JSID(obj) ((jsid)OBJECT_TO_JSVAL(obj))
  69. #define OBJECT_JSVAL_TO_JSID(v) ((jsid)v)
  70. #define ID_TO_VALUE(id) ((jsval)(id))
  71. /*
  72. * Convenience constants.
  73. */
  74. #define JS_BITS_PER_UINT32_LOG2 5
  75. #define JS_BITS_PER_UINT32 32
  76. /* Scalar typedefs. */
  77. typedef uint8 jsbytecode;
  78. typedef uint8 jssrcnote;
  79. typedef uint32 jsatomid;
  80. /* Struct typedefs. */
  81. typedef struct JSArgumentFormatMap JSArgumentFormatMap;
  82. typedef struct JSCodeGenerator JSCodeGenerator;
  83. typedef struct JSGCThing JSGCThing;
  84. typedef struct JSGenerator JSGenerator;
  85. typedef struct JSNativeEnumerator JSNativeEnumerator;
  86. typedef struct JSParseContext JSParseContext;
  87. typedef struct JSParsedObjectBox JSParsedObjectBox;
  88. typedef struct JSParseNode JSParseNode;
  89. typedef struct JSPropCacheEntry JSPropCacheEntry;
  90. typedef struct JSSharpObjectMap JSSharpObjectMap;
  91. typedef struct JSTempValueRooter JSTempValueRooter;
  92. typedef struct JSThread JSThread;
  93. typedef struct JSToken JSToken;
  94. typedef struct JSTokenPos JSTokenPos;
  95. typedef struct JSTokenPtr JSTokenPtr;
  96. typedef struct JSTokenStream JSTokenStream;
  97. typedef struct JSTreeContext JSTreeContext;
  98. typedef struct JSTryNote JSTryNote;
  99. typedef struct JSWeakRoots JSWeakRoots;
  100. /* Friend "Advanced API" typedefs. */
  101. typedef struct JSAtom JSAtom;
  102. typedef struct JSAtomList JSAtomList;
  103. typedef struct JSAtomListElement JSAtomListElement;
  104. typedef struct JSAtomMap JSAtomMap;
  105. typedef struct JSAtomState JSAtomState;
  106. typedef struct JSCodeSpec JSCodeSpec;
  107. typedef struct JSPrinter JSPrinter;
  108. typedef struct JSRegExp JSRegExp;
  109. typedef struct JSRegExpStatics JSRegExpStatics;
  110. typedef struct JSScope JSScope;
  111. typedef struct JSScopeOps JSScopeOps;
  112. typedef struct JSScopeProperty JSScopeProperty;
  113. typedef struct JSStackHeader JSStackHeader;
  114. typedef struct JSStringBuffer JSStringBuffer;
  115. typedef struct JSSubString JSSubString;
  116. typedef struct JSTraceableNative JSTraceableNative;
  117. typedef struct JSXML JSXML;
  118. typedef struct JSXMLArray JSXMLArray;
  119. typedef struct JSXMLArrayCursor JSXMLArrayCursor;
  120. /* "Friend" types used by jscntxt.h and jsdbgapi.h. */
  121. typedef enum JSTrapStatus {
  122. JSTRAP_ERROR,
  123. JSTRAP_CONTINUE,
  124. JSTRAP_RETURN,
  125. JSTRAP_THROW,
  126. JSTRAP_LIMIT
  127. } JSTrapStatus;
  128. typedef JSTrapStatus
  129. (* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
  130. void *closure);
  131. typedef JSBool
  132. (* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id, jsval old,
  133. jsval *newp, void *closure);
  134. /* called just after script creation */
  135. typedef void
  136. (* JSNewScriptHook)(JSContext *cx,
  137. const char *filename, /* URL of script */
  138. uintN lineno, /* first line */
  139. JSScript *script,
  140. JSFunction *fun,
  141. void *callerdata);
  142. /* called just before script destruction */
  143. typedef void
  144. (* JSDestroyScriptHook)(JSContext *cx,
  145. JSScript *script,
  146. void *callerdata);
  147. typedef void
  148. (* JSSourceHandler)(const char *filename, uintN lineno, jschar *str,
  149. size_t length, void **listenerTSData, void *closure);
  150. /*
  151. * This hook captures high level script execution and function calls (JS or
  152. * native). It is used by JS_SetExecuteHook to hook top level scripts and by
  153. * JS_SetCallHook to hook function calls. It will get called twice per script
  154. * or function call: just before execution begins and just after it finishes.
  155. * In both cases the 'current' frame is that of the executing code.
  156. *
  157. * The 'before' param is JS_TRUE for the hook invocation before the execution
  158. * and JS_FALSE for the invocation after the code has run.
  159. *
  160. * The 'ok' param is significant only on the post execution invocation to
  161. * signify whether or not the code completed 'normally'.
  162. *
  163. * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
  164. * for the 'before'invocation, but is whatever value is returned from that
  165. * invocation for the 'after' invocation. Thus, the hook implementor *could*
  166. * allocate a structure in the 'before' invocation and return a pointer to that
  167. * structure. The pointer would then be handed to the hook for the 'after'
  168. * invocation. Alternately, the 'before' could just return the same value as
  169. * in 'closure' to cause the 'after' invocation to be called with the same
  170. * 'closure' value as the 'before'.
  171. *
  172. * Returning NULL in the 'before' hook will cause the 'after' hook *not* to
  173. * be called.
  174. */
  175. typedef void *
  176. (* JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
  177. JSBool *ok, void *closure);
  178. typedef void
  179. (* JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew, void *closure);
  180. typedef JSBool
  181. (* JSDebugErrorHook)(JSContext *cx, const char *message, JSErrorReport *report,
  182. void *closure);
  183. typedef struct JSDebugHooks {
  184. JSTrapHandler interruptHandler;
  185. void *interruptHandlerData;
  186. JSNewScriptHook newScriptHook;
  187. void *newScriptHookData;
  188. JSDestroyScriptHook destroyScriptHook;
  189. void *destroyScriptHookData;
  190. JSTrapHandler debuggerHandler;
  191. void *debuggerHandlerData;
  192. JSSourceHandler sourceHandler;
  193. void *sourceHandlerData;
  194. JSInterpreterHook executeHook;
  195. void *executeHookData;
  196. JSInterpreterHook callHook;
  197. void *callHookData;
  198. JSObjectHook objectHook;
  199. void *objectHookData;
  200. JSTrapHandler throwHook;
  201. void *throwHookData;
  202. JSDebugErrorHook debugErrorHook;
  203. void *debugErrorHookData;
  204. } JSDebugHooks;
  205. /*
  206. * Type definitions for temporary GC roots that register with GC local C
  207. * variables. See jscntxt.h for details.
  208. */
  209. typedef void
  210. (* JSTempValueTrace)(JSTracer *trc, JSTempValueRooter *tvr);
  211. typedef union JSTempValueUnion {
  212. jsval value;
  213. JSObject *object;
  214. JSString *string;
  215. JSXML *xml;
  216. JSTempValueTrace trace;
  217. JSScopeProperty *sprop;
  218. JSWeakRoots *weakRoots;
  219. JSParseContext *parseContext;
  220. JSScript *script;
  221. jsval *array;
  222. } JSTempValueUnion;
  223. struct JSTempValueRooter {
  224. JSTempValueRooter *down;
  225. ptrdiff_t count;
  226. JSTempValueUnion u;
  227. };
  228. /*
  229. * The following determines whether JS_EncodeCharacters and JS_DecodeBytes
  230. * treat char[] as utf-8 or simply as bytes that need to be inflated/deflated.
  231. */
  232. #ifdef JS_C_STRINGS_ARE_UTF8
  233. # define js_CStringsAreUTF8 JS_TRUE
  234. #else
  235. extern JSBool js_CStringsAreUTF8;
  236. #endif
  237. #endif /* jsprvtd_h___ */