LCOV - app.info - js/src/jspubtd.h

LCOV - code coverage report
| Current view: | directory - js/src - jspubtd.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 3 | 3 | 100.0 %
| Date: | 2012-04-07 | Functions: | 3 | 3 | 100.0 %

           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 jspubtd_h___
          41                 : #define jspubtd_h___
          42                 :
          43                 : /*
          44                 :  * JS public API typedefs.
          45                 :  */
          46                 : #include "jstypes.h"
          47                 :
          48                 : /*
          49                 :  * Allow headers to reference JS::Value without #including the whole jsapi.h.
          50                 :  * Unfortunately, typedefs (hence jsval) cannot be declared.
          51                 :  */
          52                 : #ifdef __cplusplus
          53                 : namespace JS { class Value; }
          54                 : #endif
          55                 :
          56                 : /*
          57                 :  * In release builds, jsid is defined to be an integral type. This
          58                 :  * prevents many bugs from being caught at compile time. E.g.:
          59                 :  *
          60                 :  *  jsid id = ...
          61                 :  *  if (id == JS_TRUE)  // error
          62                 :  *    ...
          63                 :  *
          64                 :  *  size_t n = id;      // error
          65                 :  *
          66                 :  * To catch more errors, jsid is given a struct type in C++ debug builds.
          67                 :  * Struct assignment and (in C++) operator== allow correct code to be mostly
          68                 :  * oblivious to the change. This feature can be explicitly disabled in debug
          69                 :  * builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES.
          70                 :  */
          71                 : #ifdef __cplusplus
          72                 :
          73                 : # if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES)
          74                 : #  define JS_USE_JSID_STRUCT_TYPES
          75                 : # endif
          76                 :
          77                 : # ifdef JS_USE_JSID_STRUCT_TYPES
          78                 : struct jsid
          79       155640977 : {
          80                 :     size_t asBits;
          81      1105382007 :     bool operator==(jsid rhs) const { return asBits == rhs.asBits; }
          82           44689 :     bool operator!=(jsid rhs) const { return asBits != rhs.asBits; }
          83                 : };
          84                 : #  define JSID_BITS(id) (id.asBits)
          85                 : # else  /* defined(JS_USE_JSID_STRUCT_TYPES) */
          86                 : typedef ptrdiff_t jsid;
          87                 : #  define JSID_BITS(id) (id)
          88                 : # endif  /* defined(JS_USE_JSID_STRUCT_TYPES) */
          89                 : #else  /* defined(__cplusplus) */
          90                 : typedef ptrdiff_t jsid;
          91                 : # define JSID_BITS(id) (id)
          92                 : #endif
          93                 :
          94                 : JS_BEGIN_EXTERN_C
          95                 :
          96                 : #ifdef WIN32
          97                 : typedef wchar_t   jschar;
          98                 : #else
          99                 : typedef uint16_t  jschar;
         100                 : #endif
         101                 :
         102                 : /*
         103                 :  * Run-time version enumeration.  See jsversion.h for compile-time counterparts
         104                 :  * to these values that may be selected by the JS_VERSION macro, and tested by
         105                 :  * #if expressions.
         106                 :  */
         107                 : typedef enum JSVersion {
         108                 :     JSVERSION_1_0     = 100,
         109                 :     JSVERSION_1_1     = 110,
         110                 :     JSVERSION_1_2     = 120,
         111                 :     JSVERSION_1_3     = 130,
         112                 :     JSVERSION_1_4     = 140,
         113                 :     JSVERSION_ECMA_3  = 148,
         114                 :     JSVERSION_1_5     = 150,
         115                 :     JSVERSION_1_6     = 160,
         116                 :     JSVERSION_1_7     = 170,
         117                 :     JSVERSION_1_8     = 180,
         118                 :     JSVERSION_ECMA_5  = 185,
         119                 :     JSVERSION_DEFAULT = 0,
         120                 :     JSVERSION_UNKNOWN = -1,
         121                 :     JSVERSION_LATEST  = JSVERSION_ECMA_5
         122                 : } JSVersion;
         123                 :
         124                 : #define JSVERSION_IS_ECMA(version) \
         125                 :     ((version) == JSVERSION_DEFAULT || (version) >= JSVERSION_1_3)
         126                 :
         127                 : /* Result of typeof operator enumeration. */
         128                 : typedef enum JSType {
         129                 :     JSTYPE_VOID,                /* undefined */
         130                 :     JSTYPE_OBJECT,              /* object */
         131                 :     JSTYPE_FUNCTION,            /* function */
         132                 :     JSTYPE_STRING,              /* string */
         133                 :     JSTYPE_NUMBER,              /* number */
         134                 :     JSTYPE_BOOLEAN,             /* boolean */
         135                 :     JSTYPE_NULL,                /* null */
         136                 :     JSTYPE_XML,                 /* xml object */
         137                 :     JSTYPE_LIMIT
         138                 : } JSType;
         139                 :
         140                 : /* Dense index into cached prototypes and class atoms for standard objects. */
         141                 : typedef enum JSProtoKey {
         142                 : #define JS_PROTO(name,code,init) JSProto_##name = code,
         143                 : #include "jsproto.tbl"
         144                 : #undef JS_PROTO
         145                 :     JSProto_LIMIT
         146                 : } JSProtoKey;
         147                 :
         148                 : /* js_CheckAccess mode enumeration. */
         149                 : typedef enum JSAccessMode {
         150                 :     JSACC_PROTO  = 0,           /* XXXbe redundant w.r.t. id */
         151                 :     JSACC_PARENT = 1,           /* XXXbe redundant w.r.t. id */
         152                 :
         153                 :                                 /*
         154                 :                                  * enum value #2 formerly called JSACC_IMPORT,
         155                 :                                  * gap preserved for ABI compatibility.
         156                 :                                  */
         157                 :
         158                 :     JSACC_WATCH  = 3,           /* a watchpoint on object foo for id 'bar' */
         159                 :     JSACC_READ   = 4,           /* a "get" of foo.bar */
         160                 :     JSACC_WRITE  = 8,           /* a "set" of foo.bar = baz */
         161                 :     JSACC_LIMIT
         162                 : } JSAccessMode;
         163                 :
         164                 : #define JSACC_TYPEMASK          (JSACC_WRITE - 1)
         165                 :
         166                 : /*
         167                 :  * This enum type is used to control the behavior of a JSObject property
         168                 :  * iterator function that has type JSNewEnumerate.
         169                 :  */
         170                 : typedef enum JSIterateOp {
         171                 :     /* Create new iterator state over enumerable properties. */
         172                 :     JSENUMERATE_INIT,
         173                 :
         174                 :     /* Create new iterator state over all properties. */
         175                 :     JSENUMERATE_INIT_ALL,
         176                 :
         177                 :     /* Iterate once. */
         178                 :     JSENUMERATE_NEXT,
         179                 :
         180                 :     /* Destroy iterator state. */
         181                 :     JSENUMERATE_DESTROY
         182                 : } JSIterateOp;
         183                 :
         184                 : /* See JSVAL_TRACE_KIND and JSTraceCallback in jsapi.h. */
         185                 : typedef enum {
         186                 :     JSTRACE_OBJECT,
         187                 :     JSTRACE_STRING,
         188                 :     JSTRACE_SCRIPT,
         189                 :
         190                 :     /*
         191                 :      * Trace kinds internal to the engine. The embedding can only them if it
         192                 :      * implements JSTraceCallback.
         193                 :      */
         194                 : #if JS_HAS_XML_SUPPORT
         195                 :     JSTRACE_XML,
         196                 : #endif
         197                 :     JSTRACE_SHAPE,
         198                 :     JSTRACE_BASE_SHAPE,
         199                 :     JSTRACE_TYPE_OBJECT,
         200                 :     JSTRACE_LAST = JSTRACE_TYPE_OBJECT
         201                 : } JSGCTraceKind;
         202                 :
         203                 : /* Struct typedefs. */
         204                 : typedef struct JSClass                      JSClass;
         205                 : typedef struct JSCompartment                JSCompartment;
         206                 : typedef struct JSConstDoubleSpec            JSConstDoubleSpec;
         207                 : typedef struct JSContext                    JSContext;
         208                 : typedef struct JSCrossCompartmentCall       JSCrossCompartmentCall;
         209                 : typedef struct JSErrorReport                JSErrorReport;
         210                 : typedef struct JSExceptionState             JSExceptionState;
         211                 : typedef struct JSFunction                   JSFunction;
         212                 : typedef struct JSFunctionSpec               JSFunctionSpec;
         213                 : typedef struct JSIdArray                    JSIdArray;
         214                 : typedef struct JSLocaleCallbacks            JSLocaleCallbacks;
         215                 : typedef struct JSObject                     JSObject;
         216                 : typedef struct JSObjectMap                  JSObjectMap;
         217                 : typedef struct JSPrincipals                 JSPrincipals;
         218                 : typedef struct JSPropertyDescriptor         JSPropertyDescriptor;
         219                 : typedef struct JSPropertyName               JSPropertyName;
         220                 : typedef struct JSPropertySpec               JSPropertySpec;
         221                 : typedef struct JSRuntime                    JSRuntime;
         222                 : typedef struct JSSecurityCallbacks          JSSecurityCallbacks;
         223                 : typedef struct JSStackFrame                 JSStackFrame;
         224                 : typedef struct JSScript          JSScript;
         225                 : typedef struct JSStructuredCloneCallbacks   JSStructuredCloneCallbacks;
         226                 : typedef struct JSStructuredCloneReader      JSStructuredCloneReader;
         227                 : typedef struct JSStructuredCloneWriter      JSStructuredCloneWriter;
         228                 : typedef struct JSTracer                     JSTracer;
         229                 :
         230                 : #ifdef __cplusplus
         231                 : class                                       JSFlatString;
         232                 : class                                       JSString;
         233                 : #else
         234                 : typedef struct JSFlatString                 JSFlatString;
         235                 : typedef struct JSString                     JSString;
         236                 : #endif /* !__cplusplus */
         237                 :
         238                 : #ifdef JS_THREADSAFE
         239                 : typedef struct PRCallOnceType    JSCallOnceType;
         240                 : #else
         241                 : typedef JSBool                   JSCallOnceType;
         242                 : #endif
         243                 : typedef JSBool                 (*JSInitCallback)(void);
         244                 :
         245                 : JS_END_EXTERN_C
         246                 :
         247                 : #endif /* jspubtd_h___ */

Generated by: LCOV version 1.7