home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / js / src / jspubtd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.8 KB  |  128 lines

  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef jspubtd_h___
  20. #define jspubtd_h___
  21. /*
  22.  * JS public API typedefs.
  23.  */
  24. #include "prtypes.h"
  25.  
  26. #define NETSCAPE_INTERNAL 1
  27. #include "jscompat.h"
  28.  
  29. #define JS_FRIEND_API(t) PR_IMPLEMENT(t)
  30.  
  31. /* Scalar typedefs. */
  32. typedef uint16    jschar;
  33. typedef int32     jsint;
  34. typedef uint32    jsuint;
  35. typedef float64   jsdouble;
  36. typedef prword    jsval;
  37.  
  38. /* Boolean enum and packed int types. */
  39. typedef PRBool       JSBool;
  40. typedef PRPackedBool JSPackedBool;
  41.  
  42. #define JS_FALSE     PR_FALSE
  43. #define JS_TRUE      PR_TRUE
  44.  
  45. typedef enum JSVersion {
  46.     JSVERSION_1_0     = 100,
  47.     JSVERSION_1_1     = 110,
  48.     JSVERSION_1_2     = 120,
  49.     JSVERSION_1_3     = 130,
  50.     JSVERSION_DEFAULT = 0,
  51.     JSVERSION_UNKNOWN = -1
  52. } JSVersion;
  53.  
  54. #define JSVERSION_IS_ECMA(version) \
  55.     ((version) == JSVERSION_DEFAULT || (version) >= JSVERSION_1_3)
  56.  
  57. /* Typeof operator result enumeration. */
  58. typedef enum JSType {
  59.     JSTYPE_VOID,                /* undefined */
  60.     JSTYPE_OBJECT,              /* object */
  61.     JSTYPE_FUNCTION,            /* function */
  62.     JSTYPE_STRING,              /* string */
  63.     JSTYPE_NUMBER,              /* number */
  64.     JSTYPE_BOOLEAN,             /* boolean */
  65.     JSTYPE_LIMIT
  66. } JSType;
  67.  
  68. /* Struct typedefs. */
  69. typedef struct JSClass           JSClass;
  70. typedef struct JSConstDoubleSpec JSConstDoubleSpec;
  71. typedef struct JSContext         JSContext;
  72. typedef struct JSErrorReport     JSErrorReport;
  73. typedef struct JSFunction        JSFunction;
  74. typedef struct JSFunctionSpec    JSFunctionSpec;
  75. typedef struct JSPropertySpec    JSPropertySpec;
  76. typedef struct JSObject          JSObject;
  77. typedef struct JSObjectMap       JSObjectMap;
  78. typedef struct JSRuntime         JSRuntime;
  79. typedef struct JSRuntime         JSTaskState;    /* XXX deprecated name */
  80. typedef struct JSScript          JSScript;
  81. typedef struct JSString          JSString;
  82.  
  83. #ifndef CRT_CALL
  84. #ifdef XP_OS2
  85. #define CRT_CALL _Optlink
  86. #else
  87. #define CRT_CALL 
  88. #endif
  89. #endif
  90.  
  91. /* Typedefs for user-supplied functions called by the JS VM. */
  92. typedef JSBool
  93. (* CRT_CALL JSPropertyOp)(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
  94.  
  95. typedef JSBool
  96. (* CRT_CALL JSEnumerateOp)(JSContext *cx, JSObject *obj);
  97.  
  98. typedef JSBool
  99. (* CRT_CALL JSResolveOp)(JSContext *cx, JSObject *obj, jsval id);
  100.  
  101. typedef JSBool
  102. (* CRT_CALL JSNewResolveOp)(JSContext *cx, JSObject *obj, jsval id,
  103.                 JSObject **objp);
  104.  
  105. typedef JSBool
  106. (* CRT_CALL JSConvertOp)(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
  107.  
  108. typedef void
  109. (* CRT_CALL JSFinalizeOp)(JSContext *cx, JSObject *obj);
  110.  
  111. typedef JSBool
  112. (* CRT_CALL JSNative)(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
  113.               jsval *rval);
  114.  
  115. typedef JSBool
  116. (* CRT_CALL JSBranchCallback)(JSContext *cx, JSScript *script);
  117.  
  118. typedef void
  119. (* CRT_CALL JSErrorReporter)(JSContext *cx, const char *message,
  120.                  JSErrorReport *report);
  121.  
  122. #ifdef NETSCAPE_INTERNAL
  123. /* XXX remove and provide transcoder API when JS uses Unicode */
  124. typedef int (* CRT_CALL JSCharScanner)(int, char);
  125. #endif
  126.  
  127. #endif /* jspubtd_h___ */
  128.