source: webkit/trunk/JavaScriptCore/API/JSBase.h@ 15480

Last change on this file since 15480 was 15480, checked in by ggaren, 19 years ago

Approved by Maciej, RS by Beth.


JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
JSObjectMakeFunctionWithBody -> JSObjectMakeFunction


because the latter is more common, and more fundamental, than the former.

  • API/APICast.h: (toJS):
  • API/JSBase.h:
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::getOwnPropertySlot): (KJS::JSCallbackObject::put): (KJS::JSCallbackObject::deleteProperty): (KJS::JSCallbackObject::getPropertyNames): (KJS::JSCallbackObject::staticValueGetter): (KJS::JSCallbackObject::staticFunctionGetter):
  • API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): (OpaqueJSClass::~OpaqueJSClass):
  • API/JSClassRef.h:
  • API/JSObjectRef.cpp: (JSClassCreate): (JSObjectMakeFunctionWithCallback): (JSObjectMakeFunction): (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray): (JSObjectCopyPropertyNames):
  • API/JSObjectRef.h:
  • API/minidom.c: (main):
  • API/testapi.c: (main):
  • ChangeLog:
  • JavaScriptCore.exp:
File size: 5.3 KB
Line 
1// -*- mode: c++; c-basic-offset: 4 -*-
2/*
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef JSBase_h
28#define JSBase_h
29
30#include <stdbool.h>
31
32/* JavaScript engine interface */
33
34/*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */
35typedef const struct OpaqueJSContext* JSContextRef;
36
37/*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */
38typedef struct OpaqueJSContext* JSGlobalContextRef;
39
40/*! @typedef JSString A UTF16 character buffer. The fundamental string representation in JavaScript. */
41typedef struct OpaqueJSString* JSStringRef;
42
43/*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */
44typedef struct OpaqueJSClass* JSClassRef;
45
46/*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */
47typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef;
48
49/*! @typedef JSPropertyNameAccumulatorRef A data type used to collect a JavaScript object's property names. */
50typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef;
51
52
53/* JavaScript data types */
54
55/*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */
56typedef const struct OpaqueJSValue* JSValueRef;
57
58/*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */
59typedef struct OpaqueJSValue* JSObjectRef;
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65/* Script Evaluation */
66
67/*!
68@function
69@abstract Evaluates a string of JavaScript.
70@param context The execution context to use.
71@param script A JSString containing the script to evaluate.
72@param thisObject The object to use as "this," or NULL to use the global object as "this."
73@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
74@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
75@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
76@result The JSValue that results from evaluating script, or NULL if an exception is thrown.
77*/
78JSValueRef JSEvaluateScript(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
79
80/*!
81@function JSCheckScriptSyntax
82@abstract Checks for syntax errors in a string of JavaScript.
83@param context The execution context to use.
84@param script A JSString containing the script to check for syntax errors.
85@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
86@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
87@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
88@result true if the script is syntactically correct, otherwise false.
89*/
90bool JSCheckScriptSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);
91
92/*!
93@function
94@abstract Performs a JavaScript garbage collection.
95@discussion JavaScript values that are on the machine stack, in a register,
96 protected by JSValueProtect, set as the global object of an execution context,
97 or reachable from any such value will not be collected.
98
99 You are not required to call this function; the JavaScript engine will garbage
100 collect as needed.
101*/
102void JSGarbageCollect(void);
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif // JSBase_h
Note: See TracBrowser for help on using the repository browser.