├── wrapper ├── wrapper.h ├── license │ ├── NOTICES.txt │ ├── EULA.txt │ └── LICENSE.txt ├── JavaScriptCore │ ├── JavaScript.h │ ├── WebKitAvailability.h │ ├── JSObjectRefPrivate.h │ ├── JSRetainPtr.h │ ├── JSStringRef.h │ ├── JSContextRef.h │ ├── JSBase.h │ ├── JSTypedArray.h │ ├── JSValueRef.h │ └── JSObjectRef.h └── AppCoreCAPI.h ├── .gitignore ├── src └── lib.rs ├── Cargo.toml ├── readme.md └── Cargo.lock /wrapper/wrapper.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "AppCoreCAPI.h" 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock.DS_Store 4 | .DS_Store 5 | .idea 6 | -------------------------------------------------------------------------------- /wrapper/license/NOTICES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/psychonautwiki/rust-ul-sys/HEAD/wrapper/license/NOTICES.txt -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | #![allow(non_camel_case_types)] 3 | #![allow(non_snake_case)] 4 | 5 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); 6 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ul-sys" 3 | version = "1.3.2-alpha.0" 4 | authors = ["Kenan Sulayman "] 5 | description = "Bindings to Ultralight Framework (Ultralight, AppCore)" 6 | documentation = "https://docs.rs/ul-sys/latest/ul_sys/" 7 | license = "MIT" 8 | readme = "readme.md" 9 | repository = "https://github.com/psychonautwiki/rust-ul-sys" 10 | edition = "2018" 11 | 12 | [build-dependencies] 13 | bindgen = "0.59.0" 14 | 15 | [dependencies] 16 | bindgen = "0.59.0" 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |

ul-sys

2 | 3 |
Low level bindings to Ultralight SDK. Ultralight is a light and fast option to integrate GPU-accelerated HTML UI in your app.
4 | 5 |
6 | 7 | crates.io 8 | 9 | — 10 | 11 | documentation 12 | 13 | — 14 | 15 | Ultralight SDK 16 | 17 |
18 | 19 |
20 | 21 | ```rust 22 | let (width, height): (u32, u32) = (1280, 768); 23 | 24 | let config = ul::ulCreateConfig(); 25 | 26 | let app = ul::ulCreateApp(config); 27 | let monitor = ul::ulAppGetMainMonitor(app); 28 | let window = ul::ulCreateWindow(monitor, width, height, false, 0); 29 | 30 | ul::ulAppSetWindow(app, window); 31 | 32 | let renderer = ul::ulAppGetRenderer(app); 33 | let view = ul::ulCreateView(renderer, width, height, false); 34 | let overlay = ul::ulCreateOverlay(window, width as i32, height as i32, 0, 0); 35 | let view = ul::ulOverlayGetView(overlay); 36 | 37 | ul::ulViewLoadURL(view, ulstr("https://apple.com")); 38 | 39 | ul::ulAppRun(app); 40 | ``` 41 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JavaScript.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Apple Inc. All rights reserved. 3 | * Copyright (C) 2008 Alp Toker 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 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 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 JavaScript_h 28 | #define JavaScript_h 29 | 30 | #include "JSBase.h" 31 | #include "JSContextRef.h" 32 | #include "JSStringRef.h" 33 | #include "JSObjectRef.h" 34 | #include "JSTypedArray.h" 35 | #include "JSValueRef.h" 36 | 37 | #endif /* JavaScript_h */ 38 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/WebKitAvailability.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008, 2009, 2010, 2014 Apple Inc. All Rights Reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef __WebKitAvailability__ 27 | #define __WebKitAvailability__ 28 | 29 | #if defined(__APPLE__) && defined(DEFINE_AVAILABILITY_MACROS) 30 | 31 | #include 32 | #include 33 | 34 | #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100 35 | /* To support availability macros that mention newer OS X versions when building on older OS X versions, 36 | we provide our own definitions of the underlying macros that the availability macros expand to. We're 37 | free to expand the macros as no-ops since frameworks built on older OS X versions only ship bundled with 38 | an application rather than as part of the system. 39 | */ 40 | 41 | #ifndef __NSi_10_10 // Building from trunk rather than SDK. 42 | #define __NSi_10_10 introduced=10.0 // Use 10.0 to indicate that everything is available. 43 | #endif 44 | 45 | #ifndef __NSi_10_11 // Building from trunk rather than SDK. 46 | #define __NSi_10_11 introduced=10.0 // Use 10.0 to indicate that everything is available. 47 | #endif 48 | 49 | #ifndef __NSi_10_12 // Building from trunk rather than SDK. 50 | #define __NSi_10_12 introduced=10.0 // Use 10.0 to indicate that everything is available. 51 | #endif 52 | 53 | #ifndef __AVAILABILITY_INTERNAL__MAC_10_9 54 | #define __AVAILABILITY_INTERNAL__MAC_10_9 55 | #endif 56 | 57 | #ifndef __AVAILABILITY_INTERNAL__MAC_10_10 58 | #define __AVAILABILITY_INTERNAL__MAC_10_10 59 | #endif 60 | 61 | #ifndef AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER 62 | #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER 63 | #endif 64 | 65 | #ifndef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER 66 | #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER 67 | #endif 68 | 69 | #endif /* !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100 */ 70 | 71 | #if defined(BUILDING_GTK__) 72 | #undef JSC_API_AVAILABLE 73 | #define JSC_API_AVAILABLE(...) 74 | #endif 75 | 76 | #else 77 | #define JSC_API_AVAILABLE(...) 78 | #endif 79 | 80 | #endif /* __WebKitAvailability__ */ 81 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSObjectRefPrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2019 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef JSObjectRefPrivate_h 27 | #define JSObjectRefPrivate_h 28 | 29 | #include "JSObjectRef.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /*! 36 | @function 37 | @abstract Sets a private property on an object. This private property cannot be accessed from within JavaScript. 38 | @param ctx The execution context to use. 39 | @param object The JSObject whose private property you want to set. 40 | @param propertyName A JSString containing the property's name. 41 | @param value A JSValue to use as the property's value. This may be NULL. 42 | @result true if object can store private data, otherwise false. 43 | @discussion This API allows you to store JS values directly an object in a way that will be ensure that they are kept alive without exposing them to JavaScript code and without introducing the reference cycles that may occur when using JSValueProtect. 44 | 45 | The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private properties. 46 | */ 47 | JS_EXPORT bool JSObjectSetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value); 48 | 49 | /*! 50 | @function 51 | @abstract Gets a private property from an object. 52 | @param ctx The execution context to use. 53 | @param object The JSObject whose private property you want to get. 54 | @param propertyName A JSString containing the property's name. 55 | @result The property's value if object has the property, otherwise NULL. 56 | */ 57 | JS_EXPORT JSValueRef JSObjectGetPrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); 58 | 59 | /*! 60 | @function 61 | @abstract Deletes a private property from an object. 62 | @param ctx The execution context to use. 63 | @param object The JSObject whose private property you want to delete. 64 | @param propertyName A JSString containing the property's name. 65 | @result true if object can store private data, otherwise false. 66 | @discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data. 67 | */ 68 | JS_EXPORT bool JSObjectDeletePrivateProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); 69 | 70 | JS_EXPORT JSObjectRef JSObjectGetProxyTarget(JSObjectRef); 71 | 72 | JS_EXPORT JSGlobalContextRef JSObjectGetGlobalContext(JSObjectRef object); 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // JSObjectRefPrivate_h 79 | -------------------------------------------------------------------------------- /wrapper/license/EULA.txt: -------------------------------------------------------------------------------- 1 | EXHIBIT A 2 | 3 | END USER LICENSE AGREEMENT 4 | 5 | This End User License Agreement ("EULA"), effective today, is made by and between you and Ultralight, Inc., having an address at 15822 Jamie Lee Drive, Houston, Texas 77095 ("Ultralight Inc"), and concerns certain software known as "Ultralight." The Ultralight software includes a library that makes it easy for developers to embed HTML UI in their applications. Ultralight software provides developers the ability to embed and manipulate an instance of a web page and render it using a virtual GPU device driver. 6 | License Grant. A limited, non-exclusive, nontransferable, and revocable license is granted to you to install, access, and use the Ultralight software solely in conjunction with and through third-party software separately licensed to you (the "Licensed Product") and subject to the terms and conditions of the third-party's license with Ultralight Inc. By using the Ultralight software (through the Licensed Product), you accept the terms and conditions herein. You may print and save a copy of this EULA for your records. 7 | Permitted Use and Restrictions. You agree to use and access the Ultralight Software solely in conjunction with and through the Licensed Product separately licensed to you. You agree not to reverse engineer, decompile, disassemble, modify, translate, make any attempt to discover the source code of the Ultralight software, or modify, or otherwise create derivative works of, the Ultralight software. 8 | 9 | Ownership of Intellectual Property. You acknowledge that Ultralight Inc owns and shall continue to own all intellectual property rights in the Ultralight software, including any documentation. You agree to use reasonable best efforts to protect the contents of the Ultralight software and to prevent unauthorized copying, disclosure, or use by your agents, officers, employees, and consultants. 10 | 11 | Copyright Notice. Ultralight (c) 2018 Ultralight, Inc. All rights reserved. Ultralight is a trademark of Ultralight, Inc. 12 | 13 | Disclaimer of Warranties, "AS IS". THE ULTRALIGHT SOFTWARE, INCLUDING, WITHOUT LIMITATION, ALL SOFTWARE, DOCUMENTS, FUNCTIONS, MATERIALS, AND INFORMATION, IS PROVIDED "AS IS." TO THE FULLEST EXTENT PERMISSIBLY BY LAW, Ultralight Inc MAKES NO OTHER REPRESENTATIONS, EXTENDS NO OTHER WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT (INCLUDING ANY OPEN SOURCE VIOLATIONS), AND ASSUMES NO LIABILITY TO YOU OR ANY OTHER PERSON FOR OR ON ACCOUNT OF ANY INJURY, LOSS OR DAMAGE, OF ANY KIND OR NATURE, SUSTAINED BY, OR ANY DAMAGE ASSESSED OR ASSERTED AGAINST, OR ANY OTHER LIABILITY INCURRED BY OR IMPOSED ON YOU OR ANY OTHER PERSON (INCLUDING DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), ARISING OUT OF OR IN CONNECTION WITH OR RESULTING FROM THE USE OF THE ULTRALIGHT SOFTWARE OR THIS EULA, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | 15 | Exclusive Remedy; Limitation of Liability. For any breach of warranty, your exclusive remedy shall be to return the Ultralight software to Ultralight Inc. Under this EULA, Ultralight Inc's maximum liability is further limited to one US Dollar (USD$1.00). 16 | 17 | Termination. This EULA is effective until terminated. Your rights under this EULA will terminate automatically without notice from Ultralight Inc if you fail to comply with any term(s) of this EULA. You may terminate this EULA by giving written notice of termination to the Ultralight Inc. Upon termination of this EULA, you shall immediately discontinue all use of the Ultralight Software and destroy the original and all copies, full or partial, including any associated documentation. 18 | 19 | Export Controls. The Ultralight software, including any downloading or use of, may be subject to export controls imposed by U.S. export control laws, including the U.S. Export Administration Act and its associated regulations, and may be subject to export or import regulations in other countries. You agree to comply strictly with all such regulations and acknowledge that you have the responsibility to obtain licenses to export, re-export, or import the Ultralight software. 20 | 21 | Governing Law and General Provisions. This EULA shall be governed by the laws of the State of Texas, excluding the application of its conflicts of law rules. You agree that any dispute regarding or relating to this EULA shall be litigated only in federal or state courts in Harris County, Texas, and hereby waive any objection to the jurisdiction of such courts. This EULA shall not be governed by the United Nations Convention on Contracts for the International Sale of Goods, the application of which is expressly excluded. If any provisions of this EULA are held invalid or unenforceable for any reason, the remaining provisions shall remain in full force and effect. This EULA is binding upon your successors and assigns. This EULA may be modified only by a non-electronic amendment, signed by each party. This EULA may not be assigned or transferred to any other person or entity by you without the express consent of Ultralight Inc. This EULA constitutes the entire agreement between the parties with respect to the use of the Ultralight software licensed hereunder and supersedes all other previous or contemporaneous agreements or understandings between the parties, whether verbal or written, concerning the subject matter. 22 | 23 | For additional information concerning open-source licensing and required copyright notices, please see the included NOTICES.txt. 24 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSRetainPtr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2018 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 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 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of 14 | * its contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | #include "JSContextRef.h" 32 | #include "JSStringRef.h" 33 | #include 34 | 35 | #if !defined(WARN_UNUSED_RETURN) 36 | #define WARN_UNUSED_RETURN 37 | #endif 38 | 39 | inline void JSRetain(JSStringRef string) { JSStringRetain(string); } 40 | inline void JSRelease(JSStringRef string) { JSStringRelease(string); } 41 | inline void JSRetain(JSGlobalContextRef context) { JSGlobalContextRetain(context); } 42 | inline void JSRelease(JSGlobalContextRef context) { JSGlobalContextRelease(context); } 43 | 44 | enum AdoptTag { Adopt }; 45 | 46 | template class JSRetainPtr { 47 | public: 48 | JSRetainPtr() = default; 49 | JSRetainPtr(T ptr) : m_ptr(ptr) { if (ptr) JSRetain(ptr); } 50 | JSRetainPtr(const JSRetainPtr&); 51 | JSRetainPtr(JSRetainPtr&&); 52 | ~JSRetainPtr(); 53 | 54 | T get() const { return m_ptr; } 55 | 56 | void clear(); 57 | T leakRef() WARN_UNUSED_RETURN; 58 | 59 | T operator->() const { return m_ptr; } 60 | 61 | bool operator!() const { return !m_ptr; } 62 | explicit operator bool() const { return m_ptr; } 63 | 64 | JSRetainPtr& operator=(const JSRetainPtr&); 65 | JSRetainPtr& operator=(JSRetainPtr&&); 66 | JSRetainPtr& operator=(T); 67 | 68 | void swap(JSRetainPtr&); 69 | 70 | friend JSRetainPtr adopt(JSStringRef); 71 | friend JSRetainPtr adopt(JSGlobalContextRef); 72 | 73 | // FIXME: Make this private once Apple's internal code is updated to not rely on it. 74 | // https://bugs.webkit.org/show_bug.cgi?id=189644 75 | JSRetainPtr(AdoptTag, T); 76 | 77 | private: 78 | T m_ptr { nullptr }; 79 | }; 80 | 81 | JSRetainPtr adopt(JSStringRef); 82 | JSRetainPtr adopt(JSGlobalContextRef); 83 | 84 | template inline JSRetainPtr::JSRetainPtr(AdoptTag, T ptr) 85 | : m_ptr(ptr) 86 | { 87 | } 88 | 89 | inline JSRetainPtr adopt(JSStringRef o) 90 | { 91 | return JSRetainPtr(Adopt, o); 92 | } 93 | 94 | inline JSRetainPtr adopt(JSGlobalContextRef o) 95 | { 96 | return JSRetainPtr(Adopt, o); 97 | } 98 | 99 | template inline JSRetainPtr::JSRetainPtr(const JSRetainPtr& o) 100 | : m_ptr(o.m_ptr) 101 | { 102 | if (m_ptr) 103 | JSRetain(m_ptr); 104 | } 105 | 106 | template inline JSRetainPtr::JSRetainPtr(JSRetainPtr&& o) 107 | : m_ptr(o.leakRef()) 108 | { 109 | } 110 | 111 | template inline JSRetainPtr::~JSRetainPtr() 112 | { 113 | if (m_ptr) 114 | JSRelease(m_ptr); 115 | } 116 | 117 | template inline void JSRetainPtr::clear() 118 | { 119 | if (T ptr = leakRef()) 120 | JSRelease(ptr); 121 | } 122 | 123 | template inline T JSRetainPtr::leakRef() 124 | { 125 | return std::exchange(m_ptr, nullptr); 126 | } 127 | 128 | template inline JSRetainPtr& JSRetainPtr::operator=(const JSRetainPtr& o) 129 | { 130 | return operator=(o.get()); 131 | } 132 | 133 | template inline JSRetainPtr& JSRetainPtr::operator=(JSRetainPtr&& o) 134 | { 135 | if (T ptr = std::exchange(m_ptr, o.leakRef())) 136 | JSRelease(ptr); 137 | return *this; 138 | } 139 | 140 | template inline JSRetainPtr& JSRetainPtr::operator=(T optr) 141 | { 142 | if (optr) 143 | JSRetain(optr); 144 | if (T ptr = std::exchange(m_ptr, optr)) 145 | JSRelease(ptr); 146 | return *this; 147 | } 148 | 149 | template inline void JSRetainPtr::swap(JSRetainPtr& o) 150 | { 151 | std::swap(m_ptr, o.m_ptr); 152 | } 153 | 154 | template inline void swap(JSRetainPtr& a, JSRetainPtr& b) 155 | { 156 | a.swap(b); 157 | } 158 | 159 | template inline bool operator==(const JSRetainPtr& a, const JSRetainPtr& b) 160 | { 161 | return a.get() == b.get(); 162 | } 163 | 164 | template inline bool operator==(const JSRetainPtr& a, U* b) 165 | { 166 | return a.get() == b; 167 | } 168 | 169 | template inline bool operator==(T* a, const JSRetainPtr& b) 170 | { 171 | return a == b.get(); 172 | } 173 | 174 | template inline bool operator!=(const JSRetainPtr& a, const JSRetainPtr& b) 175 | { 176 | return a.get() != b.get(); 177 | } 178 | 179 | template inline bool operator!=(const JSRetainPtr& a, U* b) 180 | { 181 | return a.get() != b; 182 | } 183 | 184 | template inline bool operator!=(T* a, const JSRetainPtr& b) 185 | { 186 | return a != b.get(); 187 | } 188 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSStringRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef JSStringRef_h 27 | #define JSStringRef_h 28 | 29 | #include "JSValueRef.h" 30 | 31 | #ifndef __cplusplus 32 | #include 33 | #endif 34 | #include /* for size_t */ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #if !defined(_NATIVE_WCHAR_T_DEFINED) /* MSVC */ \ 41 | && (!defined(__WCHAR_MAX__) || (__WCHAR_MAX__ > 0xffffU)) /* ISO C/C++ */ \ 42 | && (!defined(WCHAR_MAX) || (WCHAR_MAX > 0xffffU)) /* RVCT */ 43 | /*! 44 | @typedef JSChar 45 | @abstract A UTF-16 code unit. One, or a sequence of two, can encode any Unicode 46 | character. As with all scalar types, endianness depends on the underlying 47 | architecture. 48 | */ 49 | typedef unsigned short JSChar; 50 | #else 51 | typedef wchar_t JSChar; 52 | #endif 53 | 54 | /*! 55 | @function 56 | @abstract Creates a JavaScript string from a buffer of Unicode characters. 57 | @param chars The buffer of Unicode characters to copy into the new JSString. 58 | @param numChars The number of characters to copy from the buffer pointed to by chars. 59 | @result A JSString containing chars. Ownership follows the Create Rule. 60 | */ 61 | JS_EXPORT JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars); 62 | /*! 63 | @function 64 | @abstract Creates a JavaScript string from a null-terminated UTF8 string. 65 | @param string The null-terminated UTF8 string to copy into the new JSString. 66 | @result A JSString containing string. Ownership follows the Create Rule. 67 | */ 68 | JS_EXPORT JSStringRef JSStringCreateWithUTF8CString(const char* string); 69 | 70 | /*! 71 | @function 72 | @abstract Retains a JavaScript string. 73 | @param string The JSString to retain. 74 | @result A JSString that is the same as string. 75 | */ 76 | JS_EXPORT JSStringRef JSStringRetain(JSStringRef string); 77 | /*! 78 | @function 79 | @abstract Releases a JavaScript string. 80 | @param string The JSString to release. 81 | */ 82 | JS_EXPORT void JSStringRelease(JSStringRef string); 83 | 84 | /*! 85 | @function 86 | @abstract Returns the number of Unicode characters in a JavaScript string. 87 | @param string The JSString whose length (in Unicode characters) you want to know. 88 | @result The number of Unicode characters stored in string. 89 | */ 90 | JS_EXPORT size_t JSStringGetLength(JSStringRef string); 91 | /*! 92 | @function 93 | @abstract Returns a pointer to the Unicode character buffer that 94 | serves as the backing store for a JavaScript string. 95 | @param string The JSString whose backing store you want to access. 96 | @result A pointer to the Unicode character buffer that serves as string's 97 | backing store, which will be deallocated when string is deallocated. 98 | */ 99 | JS_EXPORT const JSChar* JSStringGetCharactersPtr(JSStringRef string); 100 | 101 | /*! 102 | @function 103 | @abstract Returns the maximum number of bytes a JavaScript string will 104 | take up if converted into a null-terminated UTF8 string. 105 | @param string The JSString whose maximum converted size (in bytes) you 106 | want to know. 107 | @result The maximum number of bytes that could be required to convert string into a 108 | null-terminated UTF8 string. The number of bytes that the conversion actually ends 109 | up requiring could be less than this, but never more. 110 | */ 111 | JS_EXPORT size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string); 112 | /*! 113 | @function 114 | @abstract Converts a JavaScript string into a null-terminated UTF8 string, 115 | and copies the result into an external byte buffer. 116 | @param string The source JSString. 117 | @param buffer The destination byte buffer into which to copy a null-terminated 118 | UTF8 representation of string. On return, buffer contains a UTF8 string 119 | representation of string. If bufferSize is too small, buffer will contain only 120 | partial results. If buffer is not at least bufferSize bytes in size, 121 | behavior is undefined. 122 | @param bufferSize The size of the external buffer in bytes. 123 | @result The number of bytes written into buffer (including the null-terminator byte). 124 | */ 125 | JS_EXPORT size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize); 126 | 127 | /*! 128 | @function 129 | @abstract Tests whether two JavaScript strings match. 130 | @param a The first JSString to test. 131 | @param b The second JSString to test. 132 | @result true if the two strings match, otherwise false. 133 | */ 134 | JS_EXPORT bool JSStringIsEqual(JSStringRef a, JSStringRef b); 135 | /*! 136 | @function 137 | @abstract Tests whether a JavaScript string matches a null-terminated UTF8 string. 138 | @param a The JSString to test. 139 | @param b The null-terminated UTF8 string to test. 140 | @result true if the two strings match, otherwise false. 141 | */ 142 | JS_EXPORT bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b); 143 | 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | 148 | #endif /* JSStringRef_h */ 149 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSContextRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef JSContextRef_h 27 | #define JSContextRef_h 28 | 29 | #include "JSObjectRef.h" 30 | #include "JSValueRef.h" 31 | #include "WebKitAvailability.h" 32 | 33 | #ifndef __cplusplus 34 | #include 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /*! 42 | @function 43 | @abstract Creates a JavaScript context group. 44 | @discussion A JSContextGroup associates JavaScript contexts with one another. 45 | Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging 46 | JavaScript objects between contexts in different groups will produce undefined behavior. 47 | When objects from the same context group are used in multiple threads, explicit 48 | synchronization is required. 49 | 50 | A JSContextGroup may need to run deferred tasks on a run loop, such as garbage collection 51 | or resolving WebAssembly compilations. By default, calling JSContextGroupCreate will use 52 | the run loop of the thread it was called on. Currently, there is no API to change a 53 | JSContextGroup's run loop once it has been created. 54 | @result The created JSContextGroup. 55 | */ 56 | JS_EXPORT JSContextGroupRef JSContextGroupCreate(void) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 57 | 58 | /*! 59 | @function 60 | @abstract Retains a JavaScript context group. 61 | @param group The JSContextGroup to retain. 62 | @result A JSContextGroup that is the same as group. 63 | */ 64 | JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 65 | 66 | /*! 67 | @function 68 | @abstract Releases a JavaScript context group. 69 | @param group The JSContextGroup to release. 70 | */ 71 | JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 72 | 73 | /*! 74 | @function 75 | @abstract Creates a global JavaScript execution context. 76 | @discussion JSGlobalContextCreate allocates a global object and populates it with all the 77 | built-in JavaScript objects, such as Object, Function, String, and Array. 78 | 79 | In WebKit version 4.0 and later, the context is created in a unique context group. 80 | Therefore, scripts may execute in it concurrently with scripts executing in other contexts. 81 | However, you may not use values created in the context in other contexts. 82 | @param globalObjectClass The class to use when creating the global object. Pass 83 | NULL to use the default object class. 84 | @result A JSGlobalContext with a global object of class globalObjectClass. 85 | */ 86 | JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSC_API_AVAILABLE(macos(10.5), ios(7.0)); 87 | 88 | /*! 89 | @function 90 | @abstract Creates a global JavaScript execution context in the context group provided. 91 | @discussion JSGlobalContextCreateInGroup allocates a global object and populates it with 92 | all the built-in JavaScript objects, such as Object, Function, String, and Array. 93 | @param globalObjectClass The class to use when creating the global object. Pass 94 | NULL to use the default object class. 95 | @param group The context group to use. The created global context retains the group. 96 | Pass NULL to create a unique group for the context. 97 | @result A JSGlobalContext with a global object of class globalObjectClass and a context 98 | group equal to group. 99 | */ 100 | JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 101 | 102 | /*! 103 | @function 104 | @abstract Retains a global JavaScript execution context. 105 | @param ctx The JSGlobalContext to retain. 106 | @result A JSGlobalContext that is the same as ctx. 107 | */ 108 | JS_EXPORT JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx); 109 | 110 | /*! 111 | @function 112 | @abstract Releases a global JavaScript execution context. 113 | @param ctx The JSGlobalContext to release. 114 | */ 115 | JS_EXPORT void JSGlobalContextRelease(JSGlobalContextRef ctx); 116 | 117 | /*! 118 | @function 119 | @abstract Gets the global object of a JavaScript execution context. 120 | @param ctx The JSContext whose global object you want to get. 121 | @result ctx's global object. 122 | */ 123 | JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx); 124 | 125 | /*! 126 | @function 127 | @abstract Gets the context group to which a JavaScript execution context belongs. 128 | @param ctx The JSContext whose group you want to get. 129 | @result ctx's group. 130 | */ 131 | JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 132 | 133 | /*! 134 | @function 135 | @abstract Gets the global context of a JavaScript execution context. 136 | @param ctx The JSContext whose global context you want to get. 137 | @result ctx's global context. 138 | */ 139 | JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSC_API_AVAILABLE(macos(10.7), ios(7.0)); 140 | 141 | /*! 142 | @function 143 | @abstract Gets a copy of the name of a context. 144 | @param ctx The JSGlobalContext whose name you want to get. 145 | @result The name for ctx. 146 | @discussion A JSGlobalContext's name is exposed for remote debugging to make it 147 | easier to identify the context you would like to attach to. 148 | */ 149 | JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macos(10.10), ios(8.0)); 150 | 151 | /*! 152 | @function 153 | @abstract Sets the remote debugging name for a context. 154 | @param ctx The JSGlobalContext that you want to name. 155 | @param name The remote debugging name to set on ctx. 156 | */ 157 | JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name) JSC_API_AVAILABLE(macos(10.10), ios(8.0)); 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif /* JSContextRef_h */ 164 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef JSBase_h 27 | #define JSBase_h 28 | 29 | #ifndef __cplusplus 30 | #include 31 | #endif 32 | 33 | #ifdef __OBJC__ 34 | #import 35 | #endif 36 | 37 | /* JavaScript engine interface */ 38 | 39 | /*! @typedef JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects. */ 40 | typedef const struct OpaqueJSContextGroup* JSContextGroupRef; 41 | 42 | /*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */ 43 | typedef const struct OpaqueJSContext* JSContextRef; 44 | 45 | /*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */ 46 | typedef struct OpaqueJSContext* JSGlobalContextRef; 47 | 48 | /*! @typedef JSStringRef A UTF16 character buffer. The fundamental string representation in JavaScript. */ 49 | typedef struct OpaqueJSString* JSStringRef; 50 | 51 | /*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */ 52 | typedef struct OpaqueJSClass* JSClassRef; 53 | 54 | /*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */ 55 | typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef; 56 | 57 | /*! @typedef JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties. */ 58 | typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef; 59 | 60 | /*! @typedef JSTypedArrayBytesDeallocator A function used to deallocate bytes passed to a Typed Array constructor. The function should take two arguments. The first is a pointer to the bytes that were originally passed to the Typed Array constructor. The second is a pointer to additional information desired at the time the bytes are to be freed. */ 61 | typedef void (*JSTypedArrayBytesDeallocator)(void* bytes, void* deallocatorContext); 62 | 63 | /* JavaScript data types */ 64 | 65 | /*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */ 66 | typedef const struct OpaqueJSValue* JSValueRef; 67 | 68 | /*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */ 69 | typedef struct OpaqueJSValue* JSObjectRef; 70 | 71 | /* Clang's __has_declspec_attribute emulation */ 72 | /* https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute */ 73 | 74 | #ifndef __has_declspec_attribute 75 | #define __has_declspec_attribute(x) 0 76 | #endif 77 | 78 | /* JavaScript symbol exports */ 79 | /* These rules should stay the same as in WebKit/Shared/API/c/WKDeclarationSpecifiers.h */ 80 | 81 | #undef JS_EXPORT 82 | #if defined(JS_NO_EXPORT) 83 | #define JS_EXPORT 84 | #elif defined(WIN32) || defined(_WIN32) || defined(__CC_ARM) || defined(__ARMCC__) || (__has_declspec_attribute(dllimport) && __has_declspec_attribute(dllexport)) 85 | #if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore) 86 | #define JS_EXPORT __declspec(dllexport) 87 | #else 88 | #define JS_EXPORT __declspec(dllimport) 89 | #endif 90 | #elif defined(__GNUC__) 91 | #define JS_EXPORT __attribute__((visibility("default"))) 92 | #else /* !defined(JS_NO_EXPORT) */ 93 | #define JS_EXPORT 94 | #endif /* defined(JS_NO_EXPORT) */ 95 | 96 | #ifdef __cplusplus 97 | extern "C" { 98 | #endif 99 | 100 | /* Script Evaluation */ 101 | 102 | /*! 103 | @function JSEvaluateScript 104 | @abstract Evaluates a string of JavaScript. 105 | @param ctx The execution context to use. 106 | @param script A JSString containing the script to evaluate. 107 | @param thisObject The object to use as "this," or NULL to use the global object as "this." 108 | @param sourceURL A JSString containing a URL for the script's source file. This is used by debuggers and when reporting exceptions. Pass NULL if you do not care to include source file information. 109 | @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. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. 110 | @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. 111 | @result The JSValue that results from evaluating script, or NULL if an exception is thrown. 112 | */ 113 | JS_EXPORT JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); 114 | 115 | /*! 116 | @function JSCheckScriptSyntax 117 | @abstract Checks for syntax errors in a string of JavaScript. 118 | @param ctx The execution context to use. 119 | @param script A JSString containing the script to check for syntax errors. 120 | @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. 121 | @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. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. 122 | @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. 123 | @result true if the script is syntactically correct, otherwise false. 124 | */ 125 | JS_EXPORT bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); 126 | 127 | /*! 128 | @function JSGarbageCollect 129 | @abstract Performs a JavaScript garbage collection. 130 | @param ctx The execution context to use. 131 | @discussion JavaScript values that are on the machine stack, in a register, 132 | protected by JSValueProtect, set as the global object of an execution context, 133 | or reachable from any such value will not be collected. 134 | 135 | During JavaScript execution, you are not required to call this function; the 136 | JavaScript engine will garbage collect as needed. JavaScript values created 137 | within a context group are automatically destroyed when the last reference 138 | to the context group is released. 139 | */ 140 | JS_EXPORT void JSGarbageCollect(JSContextRef ctx); 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | 146 | /* Enable the Objective-C API for platforms with a modern runtime. NOTE: This is duplicated in VM.h. */ 147 | #if !defined(JSC_OBJC_API_ENABLED) 148 | #if (defined(__clang__) && defined(__APPLE__) && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && !defined(__i386__)) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE))) 149 | #define JSC_OBJC_API_ENABLED 1 150 | #else 151 | #define JSC_OBJC_API_ENABLED 0 152 | #endif 153 | #endif 154 | 155 | #endif /* JSBase_h */ 156 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aho-corasick" 7 | version = "0.7.15" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" 10 | dependencies = [ 11 | "memchr", 12 | ] 13 | 14 | [[package]] 15 | name = "ansi_term" 16 | version = "0.11.0" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 19 | dependencies = [ 20 | "winapi", 21 | ] 22 | 23 | [[package]] 24 | name = "atty" 25 | version = "0.2.14" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 28 | dependencies = [ 29 | "hermit-abi", 30 | "libc", 31 | "winapi", 32 | ] 33 | 34 | [[package]] 35 | name = "bindgen" 36 | version = "0.59.1" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" 39 | dependencies = [ 40 | "bitflags", 41 | "cexpr", 42 | "clang-sys", 43 | "clap", 44 | "env_logger", 45 | "lazy_static", 46 | "lazycell", 47 | "log", 48 | "peeking_take_while", 49 | "proc-macro2", 50 | "quote", 51 | "regex", 52 | "rustc-hash", 53 | "shlex", 54 | "which", 55 | ] 56 | 57 | [[package]] 58 | name = "bitflags" 59 | version = "1.3.2" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 62 | 63 | [[package]] 64 | name = "bitvec" 65 | version = "0.19.5" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" 68 | dependencies = [ 69 | "funty", 70 | "radium", 71 | "tap", 72 | "wyz", 73 | ] 74 | 75 | [[package]] 76 | name = "cexpr" 77 | version = "0.5.0" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" 80 | dependencies = [ 81 | "nom", 82 | ] 83 | 84 | [[package]] 85 | name = "cfg-if" 86 | version = "1.0.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 89 | 90 | [[package]] 91 | name = "clang-sys" 92 | version = "1.2.1" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "81cf2cc85830eae84823884db23c5306442a6c3d5bfd3beb2f2a2c829faa1816" 95 | dependencies = [ 96 | "glob", 97 | "libc", 98 | "libloading", 99 | ] 100 | 101 | [[package]] 102 | name = "clap" 103 | version = "2.33.3" 104 | source = "registry+https://github.com/rust-lang/crates.io-index" 105 | checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" 106 | dependencies = [ 107 | "ansi_term", 108 | "atty", 109 | "bitflags", 110 | "strsim", 111 | "textwrap", 112 | "unicode-width", 113 | "vec_map", 114 | ] 115 | 116 | [[package]] 117 | name = "env_logger" 118 | version = "0.8.4" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" 121 | dependencies = [ 122 | "atty", 123 | "humantime", 124 | "log", 125 | "regex", 126 | "termcolor", 127 | ] 128 | 129 | [[package]] 130 | name = "funty" 131 | version = "1.1.0" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" 134 | 135 | [[package]] 136 | name = "glob" 137 | version = "0.3.0" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 140 | 141 | [[package]] 142 | name = "hermit-abi" 143 | version = "0.1.19" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 146 | dependencies = [ 147 | "libc", 148 | ] 149 | 150 | [[package]] 151 | name = "humantime" 152 | version = "2.1.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 155 | 156 | [[package]] 157 | name = "lazy_static" 158 | version = "1.4.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 161 | 162 | [[package]] 163 | name = "lazycell" 164 | version = "1.3.0" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 167 | 168 | [[package]] 169 | name = "libc" 170 | version = "0.2.101" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" 173 | 174 | [[package]] 175 | name = "libloading" 176 | version = "0.7.0" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" 179 | dependencies = [ 180 | "cfg-if", 181 | "winapi", 182 | ] 183 | 184 | [[package]] 185 | name = "log" 186 | version = "0.4.14" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 189 | dependencies = [ 190 | "cfg-if", 191 | ] 192 | 193 | [[package]] 194 | name = "memchr" 195 | version = "2.3.4" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" 198 | 199 | [[package]] 200 | name = "nom" 201 | version = "6.2.1" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "9c5c51b9083a3c620fa67a2a635d1ce7d95b897e957d6b28ff9a5da960a103a6" 204 | dependencies = [ 205 | "bitvec", 206 | "funty", 207 | "memchr", 208 | "version_check", 209 | ] 210 | 211 | [[package]] 212 | name = "peeking_take_while" 213 | version = "0.1.2" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" 216 | 217 | [[package]] 218 | name = "proc-macro2" 219 | version = "1.0.29" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" 222 | dependencies = [ 223 | "unicode-xid", 224 | ] 225 | 226 | [[package]] 227 | name = "quote" 228 | version = "1.0.9" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 231 | dependencies = [ 232 | "proc-macro2", 233 | ] 234 | 235 | [[package]] 236 | name = "radium" 237 | version = "0.5.3" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" 240 | 241 | [[package]] 242 | name = "regex" 243 | version = "1.4.6" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" 246 | dependencies = [ 247 | "aho-corasick", 248 | "memchr", 249 | "regex-syntax", 250 | ] 251 | 252 | [[package]] 253 | name = "regex-syntax" 254 | version = "0.6.25" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 257 | 258 | [[package]] 259 | name = "rustc-hash" 260 | version = "1.1.0" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 263 | 264 | [[package]] 265 | name = "shlex" 266 | version = "1.1.0" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" 269 | 270 | [[package]] 271 | name = "strsim" 272 | version = "0.8.0" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 275 | 276 | [[package]] 277 | name = "tap" 278 | version = "1.0.1" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 281 | 282 | [[package]] 283 | name = "termcolor" 284 | version = "1.1.2" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" 287 | dependencies = [ 288 | "winapi-util", 289 | ] 290 | 291 | [[package]] 292 | name = "textwrap" 293 | version = "0.11.0" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 296 | dependencies = [ 297 | "unicode-width", 298 | ] 299 | 300 | [[package]] 301 | name = "ul-sys" 302 | version = "1.3.2-alpha.0" 303 | dependencies = [ 304 | "bindgen", 305 | ] 306 | 307 | [[package]] 308 | name = "unicode-width" 309 | version = "0.1.8" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" 312 | 313 | [[package]] 314 | name = "unicode-xid" 315 | version = "0.2.2" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 318 | 319 | [[package]] 320 | name = "vec_map" 321 | version = "0.8.2" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 324 | 325 | [[package]] 326 | name = "version_check" 327 | version = "0.9.3" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" 330 | 331 | [[package]] 332 | name = "which" 333 | version = "3.1.1" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" 336 | dependencies = [ 337 | "libc", 338 | ] 339 | 340 | [[package]] 341 | name = "winapi" 342 | version = "0.3.9" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 345 | dependencies = [ 346 | "winapi-i686-pc-windows-gnu", 347 | "winapi-x86_64-pc-windows-gnu", 348 | ] 349 | 350 | [[package]] 351 | name = "winapi-i686-pc-windows-gnu" 352 | version = "0.4.0" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 355 | 356 | [[package]] 357 | name = "winapi-util" 358 | version = "0.1.5" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 361 | dependencies = [ 362 | "winapi", 363 | ] 364 | 365 | [[package]] 366 | name = "winapi-x86_64-pc-windows-gnu" 367 | version = "0.4.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 370 | 371 | [[package]] 372 | name = "wyz" 373 | version = "0.2.0" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" 376 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSTypedArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Dominic Szablewski (dominic@phoboslab.org) 3 | * Copyright (C) 2015-2016 Apple 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 JSTypedArray_h 28 | #define JSTypedArray_h 29 | 30 | #include "JSBase.h" 31 | #include "JSValueRef.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | // ------------- Typed Array functions -------------- 38 | 39 | /*! 40 | @function 41 | @abstract Creates a JavaScript Typed Array object with the given number of elements. 42 | @param ctx The execution context to use. 43 | @param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. 44 | @param length The number of elements to be in the new Typed Array. 45 | @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. 46 | @result A JSObjectRef that is a Typed Array with all elements set to zero or NULL if there was an error. 47 | */ 48 | JS_EXPORT JSObjectRef JSObjectMakeTypedArray(JSContextRef ctx, JSTypedArrayType arrayType, size_t length, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 49 | 50 | /*! 51 | @function 52 | @abstract Creates a JavaScript Typed Array object from an existing pointer. 53 | @param ctx The execution context to use. 54 | @param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. 55 | @param bytes A pointer to the byte buffer to be used as the backing store of the Typed Array object. 56 | @param byteLength The number of bytes pointed to by the parameter bytes. 57 | @param bytesDeallocator The allocator to use to deallocate the external buffer when the JSTypedArrayData object is deallocated. 58 | @param deallocatorContext A pointer to pass back to the deallocator. 59 | @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. 60 | @result A JSObjectRef Typed Array whose backing store is the same as the one pointed to by bytes or NULL if there was an error. 61 | @discussion If an exception is thrown during this function the bytesDeallocator will always be called. 62 | */ 63 | JS_EXPORT JSObjectRef JSObjectMakeTypedArrayWithBytesNoCopy(JSContextRef ctx, JSTypedArrayType arrayType, void* bytes, size_t byteLength, JSTypedArrayBytesDeallocator bytesDeallocator, void* deallocatorContext, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 64 | 65 | /*! 66 | @function 67 | @abstract Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object. 68 | @param ctx The execution context to use. 69 | @param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. 70 | @param buffer An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. 71 | @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. 72 | @result A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer. 73 | */ 74 | JS_EXPORT JSObjectRef JSObjectMakeTypedArrayWithArrayBuffer(JSContextRef ctx, JSTypedArrayType arrayType, JSObjectRef buffer, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 75 | 76 | /*! 77 | @function 78 | @abstract Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length. 79 | @param ctx The execution context to use. 80 | @param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. 81 | @param buffer An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. 82 | @param byteOffset The byte offset for the created Typed Array. byteOffset should aligned with the element size of arrayType. 83 | @param length The number of elements to include in the Typed Array. 84 | @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. 85 | @result A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer. 86 | */ 87 | JS_EXPORT JSObjectRef JSObjectMakeTypedArrayWithArrayBufferAndOffset(JSContextRef ctx, JSTypedArrayType arrayType, JSObjectRef buffer, size_t byteOffset, size_t length, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 88 | 89 | /*! 90 | @function 91 | @abstract Returns a temporary pointer to the backing store of a JavaScript Typed Array object. 92 | @param ctx The execution context to use. 93 | @param object The Typed Array object whose backing store pointer to return. 94 | @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. 95 | @result A pointer to the raw data buffer that serves as object's backing store or NULL if object is not a Typed Array object. 96 | @discussion The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls. 97 | */ 98 | JS_EXPORT void* JSObjectGetTypedArrayBytesPtr(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 99 | 100 | /*! 101 | @function 102 | @abstract Returns the length of a JavaScript Typed Array object. 103 | @param ctx The execution context to use. 104 | @param object The Typed Array object whose length to return. 105 | @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. 106 | @result The length of the Typed Array object or 0 if the object is not a Typed Array object. 107 | */ 108 | JS_EXPORT size_t JSObjectGetTypedArrayLength(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 109 | 110 | /*! 111 | @function 112 | @abstract Returns the byte length of a JavaScript Typed Array object. 113 | @param ctx The execution context to use. 114 | @param object The Typed Array object whose byte length to return. 115 | @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. 116 | @result The byte length of the Typed Array object or 0 if the object is not a Typed Array object. 117 | */ 118 | JS_EXPORT size_t JSObjectGetTypedArrayByteLength(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 119 | 120 | /*! 121 | @function 122 | @abstract Returns the byte offset of a JavaScript Typed Array object. 123 | @param ctx The execution context to use. 124 | @param object The Typed Array object whose byte offset to return. 125 | @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. 126 | @result The byte offset of the Typed Array object or 0 if the object is not a Typed Array object. 127 | */ 128 | JS_EXPORT size_t JSObjectGetTypedArrayByteOffset(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 129 | 130 | /*! 131 | @function 132 | @abstract Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object. 133 | @param ctx The execution context to use. 134 | @param object The JSObjectRef whose Typed Array type data pointer to obtain. 135 | @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. 136 | @result A JSObjectRef with a JSTypedArrayType of kJSTypedArrayTypeArrayBuffer or NULL if object is not a Typed Array. 137 | */ 138 | JS_EXPORT JSObjectRef JSObjectGetTypedArrayBuffer(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 139 | 140 | // ------------- Array Buffer functions ------------- 141 | 142 | /*! 143 | @function 144 | @abstract Creates a JavaScript Array Buffer object from an existing pointer. 145 | @param ctx The execution context to use. 146 | @param bytes A pointer to the byte buffer to be used as the backing store of the Typed Array object. 147 | @param byteLength The number of bytes pointed to by the parameter bytes. 148 | @param bytesDeallocator The allocator to use to deallocate the external buffer when the Typed Array data object is deallocated. 149 | @param deallocatorContext A pointer to pass back to the deallocator. 150 | @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. 151 | @result A JSObjectRef Array Buffer whose backing store is the same as the one pointed to by bytes or NULL if there was an error. 152 | @discussion If an exception is thrown during this function the bytesDeallocator will always be called. 153 | */ 154 | JS_EXPORT JSObjectRef JSObjectMakeArrayBufferWithBytesNoCopy(JSContextRef ctx, void* bytes, size_t byteLength, JSTypedArrayBytesDeallocator bytesDeallocator, void* deallocatorContext, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 155 | 156 | /*! 157 | @function 158 | @abstract Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object. 159 | @param object The Array Buffer object whose internal backing store pointer to return. 160 | @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. 161 | @result A pointer to the raw data buffer that serves as object's backing store or NULL if object is not an Array Buffer object. 162 | @discussion The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls. 163 | */ 164 | JS_EXPORT void* JSObjectGetArrayBufferBytesPtr(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 165 | 166 | /*! 167 | @function 168 | @abstract Returns the number of bytes in a JavaScript data object. 169 | @param ctx The execution context to use. 170 | @param object The JS Arary Buffer object whose length in bytes to return. 171 | @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. 172 | @result The number of bytes stored in the data object. 173 | */ 174 | JS_EXPORT size_t JSObjectGetArrayBufferByteLength(JSContextRef ctx, JSObjectRef object, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 175 | 176 | #ifdef __cplusplus 177 | } 178 | #endif 179 | 180 | #endif /* JSTypedArray_h */ 181 | -------------------------------------------------------------------------------- /wrapper/AppCoreCAPI.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file CAPI.h 3 | /// 4 | /// @brief The C-language API for AppCore 5 | /// 6 | /// @author 7 | /// 8 | /// This file is a part of Ultralight, a next-generation HTML renderer. 9 | /// 10 | /// Website: 11 | /// 12 | /// Copyright (C) 2021 Ultralight, Inc. All rights reserved. 13 | /// 14 | #ifndef APPCORE_CAPI_H 15 | #define APPCORE_CAPI_H 16 | 17 | #include "UltralightCAPI.h" 18 | 19 | #if defined(__WIN32__) || defined(_WIN32) 20 | # if defined(APPCORE_IMPLEMENTATION) 21 | # define ACExport __declspec(dllexport) 22 | # else 23 | # define ACExport __declspec(dllimport) 24 | # endif 25 | #else 26 | # define ACExport __attribute__((visibility("default"))) 27 | #endif 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct C_Settings* ULSettings; 34 | typedef struct C_App* ULApp; 35 | typedef struct C_Window* ULWindow; 36 | typedef struct C_Monitor* ULMonitor; 37 | typedef struct C_Overlay* ULOverlay; 38 | 39 | /// 40 | /// Window creation flags. @see Window::Create 41 | /// 42 | typedef enum { 43 | kWindowFlags_Borderless = 1 << 0, 44 | kWindowFlags_Titled = 1 << 1, 45 | kWindowFlags_Resizable = 1 << 2, 46 | kWindowFlags_Maximizable = 1 << 3, 47 | kWindowFlags_Hidden = 1 << 4, 48 | } ULWindowFlags; 49 | 50 | /// 51 | /// Create settings with default values (see ). 52 | /// 53 | ACExport ULSettings ulCreateSettings(); 54 | 55 | /// 56 | /// Destroy settings. 57 | /// 58 | ACExport void ulDestroySettings(ULSettings settings); 59 | 60 | /// 61 | /// Set the name of the developer of this app. 62 | /// 63 | /// This is used to generate a unique path to store local application data 64 | /// on the user's machine. 65 | /// 66 | /// Default is "MyCompany" 67 | /// 68 | ACExport void ulSettingsSetDeveloperName(ULSettings settings, ULString name); 69 | 70 | /// 71 | /// Set the name of this app. 72 | /// 73 | /// This is used to generate a unique path to store local application data 74 | /// on the user's machine. 75 | /// 76 | /// Default is "MyApp" 77 | /// 78 | ACExport void ulSettingsSetAppName(ULSettings settings, ULString name); 79 | 80 | /// 81 | /// Set the root file path for our file system, you should set this to the 82 | /// relative path where all of your app data is. 83 | /// 84 | /// This will be used to resolve all file URLs, eg file:///page.html 85 | /// 86 | /// @note The default path is "./assets/" 87 | /// 88 | /// This relative path is resolved using the following logic: 89 | /// - Windows: relative to the executable path 90 | /// - Linux: relative to the executable path 91 | /// - macOS: relative to YourApp.app/Contents/Resources/ 92 | /// 93 | ACExport void ulSettingsSetFileSystemPath(ULSettings settings, ULString path); 94 | 95 | /// 96 | /// Set whether or not we should load and compile shaders from the file system 97 | /// (eg, from the /shaders/ path, relative to file_system_path). 98 | /// 99 | /// If this is false (the default), we will instead load pre-compiled shaders 100 | /// from memory which speeds up application startup time. 101 | /// 102 | ACExport void ulSettingsSetLoadShadersFromFileSystem(ULSettings settings, 103 | bool enabled); 104 | 105 | /// 106 | /// We try to use the GPU renderer when a compatible GPU is detected. 107 | /// 108 | /// Set this to true to force the engine to always use the CPU renderer. 109 | /// 110 | ACExport void ulSettingsSetForceCPURenderer(ULSettings settings, 111 | bool force_cpu); 112 | /// 113 | /// Create the App singleton. 114 | /// 115 | /// @param settings Settings to customize App runtime behavior. You can pass 116 | /// NULL for this parameter to use default settings. 117 | /// 118 | /// @param config Config options for the Ultralight renderer. You can pass 119 | /// NULL for this parameter to use default config. 120 | /// 121 | /// @note You should only create one of these per application lifetime. 122 | /// 123 | /// @note Certain Config options may be overridden during App creation, 124 | /// most commonly Config::face_winding and Config::device_scale_hint. 125 | /// 126 | ACExport ULApp ulCreateApp(ULSettings settings, ULConfig config); 127 | 128 | /// 129 | /// Destroy the App instance. 130 | /// 131 | ACExport void ulDestroyApp(ULApp app); 132 | 133 | typedef void 134 | (*ULUpdateCallback) (void* user_data); 135 | 136 | /// 137 | /// Set a callback for whenever the App updates. You should update all app 138 | /// logic here. 139 | /// 140 | /// @note This event is fired right before the run loop calls 141 | /// Renderer::Update and Renderer::Render. 142 | /// 143 | ACExport void ulAppSetUpdateCallback(ULApp app, ULUpdateCallback callback, 144 | void* user_data); 145 | 146 | /// 147 | /// Whether or not the App is running. 148 | /// 149 | ACExport bool ulAppIsRunning(ULApp app); 150 | 151 | /// 152 | /// Get the main monitor (this is never NULL). 153 | /// 154 | /// @note We'll add monitor enumeration later. 155 | /// 156 | ACExport ULMonitor ulAppGetMainMonitor(ULApp app); 157 | 158 | /// 159 | /// Get the underlying Renderer instance. 160 | /// 161 | ACExport ULRenderer ulAppGetRenderer(ULApp app); 162 | 163 | /// 164 | /// Run the main loop. 165 | /// 166 | ACExport void ulAppRun(ULApp app); 167 | 168 | /// 169 | /// Quit the application. 170 | /// 171 | ACExport void ulAppQuit(ULApp app); 172 | 173 | /// 174 | /// Get the monitor's DPI scale (1.0 = 100%). 175 | /// 176 | ACExport double ulMonitorGetScale(ULMonitor monitor); 177 | 178 | /// 179 | /// Get the width of the monitor (in pixels). 180 | /// 181 | ACExport unsigned int ulMonitorGetWidth(ULMonitor monitor); 182 | 183 | /// 184 | /// Get the height of the monitor (in pixels). 185 | /// 186 | ACExport unsigned int ulMonitorGetHeight(ULMonitor monitor); 187 | 188 | /// 189 | /// Create a new Window. 190 | /// 191 | /// @param monitor The monitor to create the Window on. 192 | /// 193 | /// @param width The width (in screen coordinates). 194 | /// 195 | /// @param height The height (in screen coordinates). 196 | /// 197 | /// @param fullscreen Whether or not the window is fullscreen. 198 | /// 199 | /// @param window_flags Various window flags. 200 | /// 201 | ACExport ULWindow ulCreateWindow(ULMonitor monitor, unsigned int width, 202 | unsigned int height, bool fullscreen, 203 | unsigned int window_flags); 204 | 205 | /// 206 | /// Destroy a Window. 207 | /// 208 | ACExport void ulDestroyWindow(ULWindow window); 209 | 210 | typedef void 211 | (*ULCloseCallback) (void* user_data, ULWindow window); 212 | 213 | /// 214 | /// Set a callback to be notified when a window closes. 215 | /// 216 | ACExport void ulWindowSetCloseCallback(ULWindow window, 217 | ULCloseCallback callback, 218 | void* user_data); 219 | 220 | typedef void 221 | (*ULResizeCallback) (void* user_data, ULWindow window, unsigned int width, unsigned int height); 222 | 223 | /// 224 | /// Set a callback to be notified when a window resizes 225 | /// (parameters are passed back in pixels). 226 | /// 227 | ACExport void ulWindowSetResizeCallback(ULWindow window, 228 | ULResizeCallback callback, 229 | void* user_data); 230 | 231 | /// 232 | /// Get window width (in screen coordinates). 233 | /// 234 | ACExport unsigned int ulWindowGetScreenWidth(ULWindow window); 235 | 236 | /// 237 | /// Get window width (in pixels). 238 | /// 239 | ACExport unsigned int ulWindowGetWidth(ULWindow window); 240 | 241 | /// 242 | /// Get window height (in screen coordinates). 243 | /// 244 | ACExport unsigned int ulWindowGetScreenHeight(ULWindow window); 245 | 246 | /// 247 | /// Get window height (in pixels). 248 | /// 249 | ACExport unsigned int ulWindowGetHeight(ULWindow window); 250 | 251 | /// 252 | /// Move the window to a new position (in screen coordinates) relative to the top-left of the 253 | /// monitor area. 254 | /// 255 | ACExport void ulWindowMoveTo(ULWindow window, int x, int y); 256 | 257 | /// 258 | /// Move the window to the center of the monitor. 259 | /// 260 | ACExport void ulWindowMoveToCenter(ULWindow); 261 | 262 | /// 263 | /// Get the x-position of the window (in screen coordinates) relative to the top-left of the 264 | /// monitor area. 265 | /// 266 | ACExport int ulWindowGetPositionX(ULWindow window); 267 | 268 | /// 269 | /// Get the y-position of the window (in screen coordinates) relative to the top-left of the 270 | /// monitor area. 271 | /// 272 | ACExport int ulWindowGetPositionY(ULWindow window); 273 | 274 | /// 275 | /// Get whether or not a window is fullscreen. 276 | /// 277 | ACExport bool ulWindowIsFullscreen(ULWindow window); 278 | 279 | /// 280 | /// Get the DPI scale of a window. 281 | /// 282 | ACExport double ulWindowGetScale(ULWindow window); 283 | 284 | /// 285 | /// Set the window title. 286 | /// 287 | ACExport void ulWindowSetTitle(ULWindow window, const char* title); 288 | 289 | /// 290 | /// Set the cursor for a window. 291 | /// 292 | ACExport void ulWindowSetCursor(ULWindow window, ULCursor cursor); 293 | 294 | /// 295 | /// Show the window (if it was previously hidden). 296 | /// 297 | ACExport void ulWindowShow(ULWindow window); 298 | 299 | /// 300 | /// Hide the window. 301 | /// 302 | ACExport void ulWindowHide(ULWindow window); 303 | 304 | /// 305 | /// Whether or not the window is currently visible (not hidden). 306 | /// 307 | ACExport bool ulWindowIsVisible(ULWindow window); 308 | 309 | /// 310 | /// Close a window. 311 | /// 312 | ACExport void ulWindowClose(ULWindow window); 313 | 314 | /// 315 | /// Convert screen coordinates to pixels using the current DPI scale. 316 | /// 317 | ACExport int ulWindowScreenToPixels(ULWindow window, int val); 318 | 319 | /// 320 | /// Convert pixels to screen coordinates using the current DPI scale. 321 | /// 322 | ACExport int ulWindowPixelsToScreen(ULWindow window, int val); 323 | 324 | /// 325 | /// Get the underlying native window handle. 326 | /// 327 | /// @note This is: - HWND on Windows 328 | /// - NSWindow* on macOS 329 | /// - GLFWwindow* on Linux 330 | /// 331 | ACExport void* ulWindowGetNativeHandle(ULWindow window); 332 | 333 | /// 334 | /// Create a new Overlay. 335 | /// 336 | /// @param window The window to create the Overlay in. 337 | /// 338 | /// @param width The width in pixels. 339 | /// 340 | /// @param height The height in pixels. 341 | /// 342 | /// @param x The x-position (offset from the left of the Window), in 343 | /// pixels. 344 | /// 345 | /// @param y The y-position (offset from the top of the Window), in 346 | /// pixels. 347 | /// 348 | /// @note Each Overlay is essentially a View and an on-screen quad. You should 349 | /// create the Overlay then load content into the underlying View. 350 | /// 351 | ACExport ULOverlay ulCreateOverlay(ULWindow window, unsigned int width, 352 | unsigned int height, int x, int y); 353 | 354 | /// 355 | /// Create a new Overlay, wrapping an existing View. 356 | /// 357 | /// @param window The window to create the Overlay in. (we currently only 358 | /// support one window per application) 359 | /// 360 | /// @param view The View to wrap (will use its width and height). 361 | /// 362 | /// @param x The x-position (offset from the left of the Window), in 363 | /// pixels. 364 | /// 365 | /// @param y The y-position (offset from the top of the Window), in 366 | /// pixels. 367 | /// 368 | /// @note Each Overlay is essentially a View and an on-screen quad. You should 369 | /// create the Overlay then load content into the underlying View. 370 | /// 371 | ACExport ULOverlay ulCreateOverlayWithView(ULWindow window, ULView view, 372 | int x, int y); 373 | 374 | /// 375 | /// Destroy an overlay. 376 | /// 377 | ACExport void ulDestroyOverlay(ULOverlay overlay); 378 | 379 | /// 380 | /// Get the underlying View. 381 | /// 382 | ACExport ULView ulOverlayGetView(ULOverlay overlay); 383 | 384 | /// 385 | /// Get the width (in pixels). 386 | /// 387 | ACExport unsigned int ulOverlayGetWidth(ULOverlay overlay); 388 | 389 | /// 390 | /// Get the height (in pixels). 391 | /// 392 | ACExport unsigned int ulOverlayGetHeight(ULOverlay overlay); 393 | 394 | /// 395 | /// Get the x-position (offset from the left of the Window), in pixels. 396 | /// 397 | ACExport int ulOverlayGetX(ULOverlay overlay); 398 | 399 | /// 400 | /// Get the y-position (offset from the top of the Window), in pixels. 401 | /// 402 | ACExport int ulOverlayGetY(ULOverlay overlay); 403 | 404 | /// 405 | /// Move the overlay to a new position (in pixels). 406 | /// 407 | ACExport void ulOverlayMoveTo(ULOverlay overlay, int x, int y); 408 | 409 | /// 410 | /// Resize the overlay (and underlying View), dimensions should be 411 | /// specified in pixels. 412 | /// 413 | ACExport void ulOverlayResize(ULOverlay overlay, unsigned int width, 414 | unsigned int height); 415 | 416 | /// 417 | /// Whether or not the overlay is hidden (not drawn). 418 | /// 419 | ACExport bool ulOverlayIsHidden(ULOverlay overlay); 420 | 421 | /// 422 | /// Hide the overlay (will no longer be drawn). 423 | /// 424 | ACExport void ulOverlayHide(ULOverlay overlay); 425 | 426 | /// 427 | /// Show the overlay. 428 | /// 429 | ACExport void ulOverlayShow(ULOverlay overlay); 430 | 431 | /// 432 | /// Whether or not an overlay has keyboard focus. 433 | /// 434 | ACExport bool ulOverlayHasFocus(ULOverlay overlay); 435 | 436 | /// 437 | /// Grant this overlay exclusive keyboard focus. 438 | /// 439 | ACExport void ulOverlayFocus(ULOverlay overlay); 440 | 441 | /// 442 | /// Remove keyboard focus. 443 | /// 444 | ACExport void ulOverlayUnfocus(ULOverlay overlay); 445 | 446 | /****************************************************************************** 447 | * Platform 448 | *****************************************************************************/ 449 | 450 | /// 451 | /// This is only needed if you are not calling ulCreateApp(). 452 | /// 453 | /// Initializes the platform font loader and sets it as the current FontLoader. 454 | /// 455 | ACExport void ulEnablePlatformFontLoader(); 456 | 457 | /// 458 | /// This is only needed if you are not calling ulCreateApp(). 459 | /// 460 | /// Initializes the platform file system (needed for loading file:/// URLs) and 461 | /// sets it as the current FileSystem. 462 | /// 463 | /// You can specify a base directory path to resolve relative paths against. 464 | /// 465 | ACExport void ulEnablePlatformFileSystem(ULString base_dir); 466 | 467 | /// 468 | /// This is only needed if you are not calling ulCreateApp(). 469 | /// 470 | /// Initializes the default logger (writes the log to a file). 471 | /// 472 | /// You should specify a writable log path to write the log to 473 | /// for example "./ultralight.log". 474 | /// 475 | ACExport void ulEnableDefaultLogger(ULString log_path); 476 | 477 | #ifdef __cplusplus 478 | } 479 | #endif 480 | 481 | #endif // APPCORE_CAPI_H 482 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSValueRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2019 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef JSValueRef_h 27 | #define JSValueRef_h 28 | 29 | #include "JSBase.h" 30 | #include "WebKitAvailability.h" 31 | 32 | #ifndef __cplusplus 33 | #include 34 | #endif 35 | 36 | /*! 37 | @enum JSType 38 | @abstract A constant identifying the type of a JSValue. 39 | @constant kJSTypeUndefined The unique undefined value. 40 | @constant kJSTypeNull The unique null value. 41 | @constant kJSTypeBoolean A primitive boolean value, one of true or false. 42 | @constant kJSTypeNumber A primitive number value. 43 | @constant kJSTypeString A primitive string value. 44 | @constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef). 45 | @constant kJSTypeSymbol A primitive symbol value. 46 | */ 47 | typedef enum { 48 | kJSTypeUndefined, 49 | kJSTypeNull, 50 | kJSTypeBoolean, 51 | kJSTypeNumber, 52 | kJSTypeString, 53 | kJSTypeObject, 54 | kJSTypeSymbol JSC_API_AVAILABLE(macos(10.15), ios(13.0)) 55 | } JSType; 56 | 57 | /*! 58 | @enum JSTypedArrayType 59 | @abstract A constant identifying the Typed Array type of a JSObjectRef. 60 | @constant kJSTypedArrayTypeInt8Array Int8Array 61 | @constant kJSTypedArrayTypeInt16Array Int16Array 62 | @constant kJSTypedArrayTypeInt32Array Int32Array 63 | @constant kJSTypedArrayTypeUint8Array Uint8Array 64 | @constant kJSTypedArrayTypeUint8ClampedArray Uint8ClampedArray 65 | @constant kJSTypedArrayTypeUint16Array Uint16Array 66 | @constant kJSTypedArrayTypeUint32Array Uint32Array 67 | @constant kJSTypedArrayTypeFloat32Array Float32Array 68 | @constant kJSTypedArrayTypeFloat64Array Float64Array 69 | @constant kJSTypedArrayTypeArrayBuffer ArrayBuffer 70 | @constant kJSTypedArrayTypeNone Not a Typed Array 71 | 72 | */ 73 | typedef enum { 74 | kJSTypedArrayTypeInt8Array, 75 | kJSTypedArrayTypeInt16Array, 76 | kJSTypedArrayTypeInt32Array, 77 | kJSTypedArrayTypeUint8Array, 78 | kJSTypedArrayTypeUint8ClampedArray, 79 | kJSTypedArrayTypeUint16Array, 80 | kJSTypedArrayTypeUint32Array, 81 | kJSTypedArrayTypeFloat32Array, 82 | kJSTypedArrayTypeFloat64Array, 83 | kJSTypedArrayTypeArrayBuffer, 84 | kJSTypedArrayTypeNone, 85 | } JSTypedArrayType JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 86 | 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | /*! 92 | @function 93 | @abstract Returns a JavaScript value's type. 94 | @param ctx The execution context to use. 95 | @param value The JSValue whose type you want to obtain. 96 | @result A value of type JSType that identifies value's type. 97 | */ 98 | JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); 99 | 100 | /*! 101 | @function 102 | @abstract Tests whether a JavaScript value's type is the undefined type. 103 | @param ctx The execution context to use. 104 | @param value The JSValue to test. 105 | @result true if value's type is the undefined type, otherwise false. 106 | */ 107 | JS_EXPORT bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value); 108 | 109 | /*! 110 | @function 111 | @abstract Tests whether a JavaScript value's type is the null type. 112 | @param ctx The execution context to use. 113 | @param value The JSValue to test. 114 | @result true if value's type is the null type, otherwise false. 115 | */ 116 | JS_EXPORT bool JSValueIsNull(JSContextRef ctx, JSValueRef value); 117 | 118 | /*! 119 | @function 120 | @abstract Tests whether a JavaScript value's type is the boolean type. 121 | @param ctx The execution context to use. 122 | @param value The JSValue to test. 123 | @result true if value's type is the boolean type, otherwise false. 124 | */ 125 | JS_EXPORT bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value); 126 | 127 | /*! 128 | @function 129 | @abstract Tests whether a JavaScript value's type is the number type. 130 | @param ctx The execution context to use. 131 | @param value The JSValue to test. 132 | @result true if value's type is the number type, otherwise false. 133 | */ 134 | JS_EXPORT bool JSValueIsNumber(JSContextRef ctx, JSValueRef value); 135 | 136 | /*! 137 | @function 138 | @abstract Tests whether a JavaScript value's type is the string type. 139 | @param ctx The execution context to use. 140 | @param value The JSValue to test. 141 | @result true if value's type is the string type, otherwise false. 142 | */ 143 | JS_EXPORT bool JSValueIsString(JSContextRef ctx, JSValueRef value); 144 | 145 | /*! 146 | @function 147 | @abstract Tests whether a JavaScript value's type is the symbol type. 148 | @param ctx The execution context to use. 149 | @param value The JSValue to test. 150 | @result true if value's type is the symbol type, otherwise false. 151 | */ 152 | JS_EXPORT bool JSValueIsSymbol(JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 153 | 154 | /*! 155 | @function 156 | @abstract Tests whether a JavaScript value's type is the object type. 157 | @param ctx The execution context to use. 158 | @param value The JSValue to test. 159 | @result true if value's type is the object type, otherwise false. 160 | */ 161 | JS_EXPORT bool JSValueIsObject(JSContextRef ctx, JSValueRef value); 162 | 163 | 164 | /*! 165 | @function 166 | @abstract Tests whether a JavaScript value is an object with a given class in its class chain. 167 | @param ctx The execution context to use. 168 | @param value The JSValue to test. 169 | @param jsClass The JSClass to test against. 170 | @result true if value is an object and has jsClass in its class chain, otherwise false. 171 | */ 172 | JS_EXPORT bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass); 173 | 174 | /*! 175 | @function 176 | @abstract Tests whether a JavaScript value is an array. 177 | @param ctx The execution context to use. 178 | @param value The JSValue to test. 179 | @result true if value is an array, otherwise false. 180 | */ 181 | JS_EXPORT bool JSValueIsArray(JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 182 | 183 | /*! 184 | @function 185 | @abstract Tests whether a JavaScript value is a date. 186 | @param ctx The execution context to use. 187 | @param value The JSValue to test. 188 | @result true if value is a date, otherwise false. 189 | */ 190 | JS_EXPORT bool JSValueIsDate(JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.11), ios(9.0)); 191 | 192 | /*! 193 | @function 194 | @abstract Returns a JavaScript value's Typed Array type. 195 | @param ctx The execution context to use. 196 | @param value The JSValue whose Typed Array type to return. 197 | @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. 198 | @result A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object. 199 | */ 200 | JS_EXPORT JSTypedArrayType JSValueGetTypedArrayType(JSContextRef ctx, JSValueRef value, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.12), ios(10.0)); 201 | 202 | /* Comparing values */ 203 | 204 | /*! 205 | @function 206 | @abstract Tests whether two JavaScript values are equal, as compared by the JS == operator. 207 | @param ctx The execution context to use. 208 | @param a The first value to test. 209 | @param b The second value to test. 210 | @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. 211 | @result true if the two values are equal, false if they are not equal or an exception is thrown. 212 | */ 213 | JS_EXPORT bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception); 214 | 215 | /*! 216 | @function 217 | @abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator. 218 | @param ctx The execution context to use. 219 | @param a The first value to test. 220 | @param b The second value to test. 221 | @result true if the two values are strict equal, otherwise false. 222 | */ 223 | JS_EXPORT bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b); 224 | 225 | /*! 226 | @function 227 | @abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. 228 | @param ctx The execution context to use. 229 | @param value The JSValue to test. 230 | @param constructor The constructor to test against. 231 | @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. 232 | @result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false. 233 | */ 234 | JS_EXPORT bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception); 235 | 236 | /* Creating values */ 237 | 238 | /*! 239 | @function 240 | @abstract Creates a JavaScript value of the undefined type. 241 | @param ctx The execution context to use. 242 | @result The unique undefined value. 243 | */ 244 | JS_EXPORT JSValueRef JSValueMakeUndefined(JSContextRef ctx); 245 | 246 | /*! 247 | @function 248 | @abstract Creates a JavaScript value of the null type. 249 | @param ctx The execution context to use. 250 | @result The unique null value. 251 | */ 252 | JS_EXPORT JSValueRef JSValueMakeNull(JSContextRef ctx); 253 | 254 | /*! 255 | @function 256 | @abstract Creates a JavaScript value of the boolean type. 257 | @param ctx The execution context to use. 258 | @param boolean The bool to assign to the newly created JSValue. 259 | @result A JSValue of the boolean type, representing the value of boolean. 260 | */ 261 | JS_EXPORT JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean); 262 | 263 | /*! 264 | @function 265 | @abstract Creates a JavaScript value of the number type. 266 | @param ctx The execution context to use. 267 | @param number The double to assign to the newly created JSValue. 268 | @result A JSValue of the number type, representing the value of number. 269 | */ 270 | JS_EXPORT JSValueRef JSValueMakeNumber(JSContextRef ctx, double number); 271 | 272 | /*! 273 | @function 274 | @abstract Creates a JavaScript value of the string type. 275 | @param ctx The execution context to use. 276 | @param string The JSString to assign to the newly created JSValue. The 277 | newly created JSValue retains string, and releases it upon garbage collection. 278 | @result A JSValue of the string type, representing the value of string. 279 | */ 280 | JS_EXPORT JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string); 281 | 282 | /*! 283 | @function 284 | @abstract Creates a JavaScript value of the symbol type. 285 | @param ctx The execution context to use. 286 | @param description A description of the newly created symbol value. 287 | @result A unique JSValue of the symbol type, whose description matches the one provided. 288 | */ 289 | JS_EXPORT JSValueRef JSValueMakeSymbol(JSContextRef ctx, JSStringRef description) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 290 | 291 | /* Converting to and from JSON formatted strings */ 292 | 293 | /*! 294 | @function 295 | @abstract Creates a JavaScript value from a JSON formatted string. 296 | @param ctx The execution context to use. 297 | @param string The JSString containing the JSON string to be parsed. 298 | @result A JSValue containing the parsed value, or NULL if the input is invalid. 299 | */ 300 | JS_EXPORT JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string) JSC_API_AVAILABLE(macos(10.7), ios(7.0)); 301 | 302 | /*! 303 | @function 304 | @abstract Creates a JavaScript string containing the JSON serialized representation of a JS value. 305 | @param ctx The execution context to use. 306 | @param value The value to serialize. 307 | @param indent The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces. 308 | @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. 309 | @result A JSString with the result of serialization, or NULL if an exception is thrown. 310 | */ 311 | JS_EXPORT JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef value, unsigned indent, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.7), ios(7.0)); 312 | 313 | /* Converting to primitive values */ 314 | 315 | /*! 316 | @function 317 | @abstract Converts a JavaScript value to boolean and returns the resulting boolean. 318 | @param ctx The execution context to use. 319 | @param value The JSValue to convert. 320 | @result The boolean result of conversion. 321 | */ 322 | JS_EXPORT bool JSValueToBoolean(JSContextRef ctx, JSValueRef value); 323 | 324 | /*! 325 | @function 326 | @abstract Converts a JavaScript value to number and returns the resulting number. 327 | @param ctx The execution context to use. 328 | @param value The JSValue to convert. 329 | @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. 330 | @result The numeric result of conversion, or NaN if an exception is thrown. 331 | */ 332 | JS_EXPORT double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception); 333 | 334 | /*! 335 | @function 336 | @abstract Converts a JavaScript value to string and copies the result into a JavaScript string. 337 | @param ctx The execution context to use. 338 | @param value The JSValue to convert. 339 | @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. 340 | @result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule. 341 | */ 342 | JS_EXPORT JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception); 343 | 344 | /*! 345 | @function 346 | @abstract Converts a JavaScript value to object and returns the resulting object. 347 | @param ctx The execution context to use. 348 | @param value The JSValue to convert. 349 | @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. 350 | @result The JSObject result of conversion, or NULL if an exception is thrown. 351 | */ 352 | JS_EXPORT JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception); 353 | 354 | /* Garbage collection */ 355 | /*! 356 | @function 357 | @abstract Protects a JavaScript value from garbage collection. 358 | @param ctx The execution context to use. 359 | @param value The JSValue to protect. 360 | @discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it. 361 | 362 | A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. 363 | */ 364 | JS_EXPORT void JSValueProtect(JSContextRef ctx, JSValueRef value); 365 | 366 | /*! 367 | @function 368 | @abstract Unprotects a JavaScript value from garbage collection. 369 | @param ctx The execution context to use. 370 | @param value The JSValue to unprotect. 371 | @discussion A value may be protected multiple times and must be unprotected an 372 | equal number of times before becoming eligible for garbage collection. 373 | */ 374 | JS_EXPORT void JSValueUnprotect(JSContextRef ctx, JSValueRef value); 375 | 376 | #ifdef __cplusplus 377 | } 378 | #endif 379 | 380 | #endif /* JSValueRef_h */ 381 | -------------------------------------------------------------------------------- /wrapper/license/LICENSE.txt: -------------------------------------------------------------------------------- 1 | ULTRALIGHT FREE LICENSE AGREEMENT - V1 2 | 3 | This LICENSE AGREEMENT ("Agreement"), effective as of Effective Date, by and between Ultralight, Inc., having an address at 15822 Jamie Lee Drive, Houston, Texas 77095 ("Ultralight Inc") and Licensee. Ultralight Inc and Licensee are collectively referred to as the "Parties" and individually referred to as a "Party". A copy of this Agreement may be printed and saved for Licensee's records. 4 | RECITALS 5 | WHEREAS, Ultralight Inc has developed software, known as the Ultralight software ("Ultralight"), which includes a library that makes it easy for developers to embed HTML UI in their applications. Ultralight software provides developers the ability to embed and manipulate an instance of a web page and render it using a virtual GPU device driver. 6 | WHEREAS, Licensee desires to obtain a non-exclusive, free license to use the Ultralight software to develop, distribute, and display applications licensed to third party users ("End Users") or for public display, using Ultralight software to manipulate and render web pages under the terms and conditions of this Agreement. 7 | NOW, THEREFORE, in consideration of the foregoing premises and of the mutual covenants and obligations hereinafter contained, and other good and valuable consideration, the receipt and legal sufficiency of which is hereby acknowledged, the Parties hereto agree as follows: 8 | ARTICLE 1 9 | 10 | DEFINITIONS 11 | 1.1 Definitions. As used herein, the following terms have the meanings set forth below: 12 | 1.1.1 "Affiliates" means, with respect to an entity or person, any entity or person that directly or indirectly through one or more intermediaries Controls, is Controlled by, or is under common Control with such entity or person. 13 | 1.1.2 "Agreement" has the meaning as set forth in the preamble. 14 | 1.1.3 "Ultralight" has the meaning as set forth in the preamble and includes portions of WebKit software. The Ultralight software includes a set of C++ header files, static libraries, dynamically-linked libraries, and documentation. For purposes of this Agreement, Ultralight includes the current version of the Ultralight software as of the Effective Date, and any Maintenance Releases during the Support Period, but does not include future releases made after the Support Period. For purposes of this Agreement, the Ultralight software does NOT include its source code. 15 | 1.1.4 "Commercial" means for profit or in commerce, including marketing and promotions activities, whether or not profit, revenues, or sales are generated by such purpose. 16 | 1.1.5 "Commercial Application" has the meaning as set forth in Section 2.2. 17 | 1.1.6 "Confidential Information" means (a) any information disclosed by either Party to the other Party, either directly or indirectly, in writing, orally or by inspection of tangible objects, including, without limitation, trade secrets, data, know-how, materials, inventions, services, formulas, processes, designs, development, photographs, plans, drawings, models, specifications, samples, reports, pricing information, studies, findings, engineering, finances, financial models, business plans, listings and (concepts to the extent practical, Confidential Information will be disclosed in documentary or tangible form marked "Confidential" (collectively, the "Disclosed Materials")) and (b) any information otherwise obtained, directly or indirectly, by a receiving Party through inspection, review or analysis of the Disclosed Materials. Confidential Information shall not lose its status merely because it was disclosed orally. Confidential Information may also include information of a third party that is in the possession of one of the Parties and is disclosed to the other Party under this Agreement. Confidential Information shall not, however, include any information that (i) was publicly known and made generally available in the public domain prior to the time of disclosure by the disclosing Party; (ii) becomes publicly known and made generally available after disclosure by the disclosing Party to the receiving Party through no action or inaction of the receiving Party; (iii) is already in the possession of the receiving Party at the time of disclosure by the disclosing Party as shown by the receiving Party's files and records immediately prior to the time of disclosure; (iv) is obtained by the receiving Party from a third party lawfully in possession of such information and without a breach of such third party's obligations of confidentiality; or (v) is independently developed by the receiving Party without use of or reference to the disclosing Party's Confidential Information, as shown by documents and other competent evidence in the receiving Party's possession. The burden of proof shall be on the receiving Party to establish the existence of facts giving rise by clear and convincing evidence that any of the foregoing exceptions to the receiving Party's obligation of confidence apply. 18 | 1.1.7 "Control" shall mean the possession, directly or indirectly, of the power to direct or cause the direction of the management, activities or policies of any Person, whether through the ownership of voting securities, by contract, employment or otherwise. 19 | 1.1.8 "Disclosed Material" has the meaning as set forth in Section 1.1.6. 20 | 1.1.9 "End Users" has the meaning as set forth in the preamble. 21 | 1.1.10 "Effective Date" has the meaning as set forth in the preamble and is the date the Licensee enters into the Agreement with Ultralight Inc, by the Licensee agreeing to the terms and conditions of the Agreement by signing the Agreement or by otherwise accepting the terms and conditions, e.g., by Licensee clicking on a button on a computer screen, or by Licensee using or installing the Ultralight software. 22 | 1.1.11 "WebKit" is Open Source software code developed by Apple and licensed under the BSD license and other licenses. See also https://webkit.org/licensing-webkit/ 23 | 1.1.12 "Improvement" means any enhancement, conception, suggestion, invention or discovery created or otherwise developed by Ultralight Inc or Licensee during the Term, which constitutes an improvement to the Ultralight software. 24 | 1.1.13 "Indemnified Party" has the meaning as set forth in Section 8.3. 25 | 1.1.14 "Indemnifying Party" has the meaning as set forth in Section 8.3. 26 | 1.1.15 "Infringement" has the meaning as set forth in Section 4.6. 27 | 1.1.16 "Internal" means solely within Licensee and Licensee's Affiliates. 28 | 1.1.17 "Ultralight Inc" has the meaning as set forth in the preamble. 29 | 1.1.18 "Licensed Product" means any application, device, or software developed by the Licensee, the access, copy, distribution, display, manufacture, use, or sale of which would, if not licensed under this Agreement, infringe or misappropriate in any way the Ultralight software. 30 | 1.1.19 "Licensee" refers to the party to the Agreement to whom Ultralight Inc grants license rights to the Ultralight software as described herein. 31 | 1.1.20 "Losses" has the meaning as set forth in Section 8.1. 32 | 1.1.21 "Maintenance Release" has the meaning as set forth in ARTICLE 5. 33 | 1.1.22 "Non-Commercial" has the meaning as set forth in Section 2.2. 34 | 1.1.23 "Open Source" means software in which source code is generally available for modification and distribution, and which may include specific license requirements for other software that accesses, embeds, or uses the open source software. 35 | 1.1.24 "Party" or "Parties" has the meaning as set forth in the preamble. 36 | 1.1.25 "Platform" has the meaning as set forth in Section 2.3. 37 | 1.1.26 "Support Period" has the meaning as set forth in ARTICLE 5. 38 | 1.1.27 "Term" has the meaning as set forth in Section 10.1. 39 | 1.1.28 "Trademarks" means any filed or unfiled, common law, state law and federal law rights, as well as all international trademark rights, Ultralight Inc has in any trademarks for Ultralight software. 40 | 1.1.29 "Web" means the World Wide Web as set forth in the preamble. 41 | ARTICLE 2 42 | 43 | LICENSE GRANT 44 | 2.1 Development License Grant. Ultralight Inc hereby grants to Licensee a limited, non-transferable, non-exclusive, revocable, non-sublicensable, world-wide right and license to the Ultralight software solely to develop applications that access, embed, and use the Ultralight software ("Licensed Products"), including to test and evaluate such Licensed Products Internally by Licensee, under the terms and conditions herein. For purposes of clarity, this development license grant in Section 2.1 does not include any right or license to distribute the Ultralight software or to publically display or publically perform Licensed Products utilizing the Ultralight software. 45 | 2.2 Non-Commercial Distribution License Grant. Ultralight Inc hereby grants to Licensee a limited, non-transferable, non-exclusive, revocable, sublicensable as described herein, world-wide right and license to the Ultralight software to copy, develop, display, distribute, export, import, make, publically perform, test, and use a Licensed Product utilizing the Ultralight software, solely for Internal and Non-Commercial purposes, excluding use within Government agencies. The term "Non-Commercial" as used in this Agreement, means academic or other scholarly research which (a) is not undertaken for profit, or (b) is not intended to produce works, services, or data for Commercial use, or (c) is neither conducted, nor funded, by a person or an entity engaged in the Commercial use, application or exploitation of works similar to the software. 46 | 2.3 Limited Commercial Distribution License Grant. Ultralight Inc hereby grants to Licensee a limited, non-transferable, non-exclusive, revocable, sublicensable as described herein, world-wide right and license to the Ultralight software to copy, develop, display, distribute, evaluate, export, import, make, market, publically perform, sell, test, and use a Licensed Product utilizing the Ultralight software for Commercial purposes, excluding use within Government agencies. This provision is NOT valid if Licensee is a company or incorporated entity that had a turnover in excess of US$100,000 in their last fiscal year. In the event Licensee makes a turnover in excess of US$100,000 in any subsequent fiscal year, all commercial distribution provisions of this Agreement will be revoked and Licensee must negotiate a new license with Ultralight Inc to continue commercial distribution. 47 | 2.4 Trademark License. In the event that Licensee, at its sole discretion, decides to use Ultralight Inc's Trademarks, Ultralight Inc hereby grants Licensee a non-exclusive, royalty-free right and license to use, including the right to sublicense, the Trademarks in conjunction with Licensee's marketing, advertising, manufacturing information, and product packaging activities. 48 | 2.4.1 Non-Assignment. Licensee acknowledges and agrees that the trademark rights granted to Licensee by and obtained by Licensee as a result of or in connection with this Agreement are license rights only, and nothing contained in this Agreement constitutes or shall be construed to be an assignment of any or all of Ultralight Inc's rights in the Trademarks. All goodwill associated with such activities of Licensee shall inure to the benefit of the Ultralight Inc. 49 | 2.4.2 Quality of Product. In the event Licensee decides to use Ultralight Inc's Trademarks, Licensee agrees to maintain a high quality of any Licensed Product provided under the Trademark consistent with the quality of previous versions of Ultralight Inc's products as of the Effective Date and consistent with a standard that ensures the continued protection of the Trademark and the goodwill pertaining to the Trademark. In such an event, Ultralight Inc reserves the right to receive samples of the mark as used in conjunction with the Licensed Product no more than once per year or as reasonably provided by Licensee, to ensure that the quality meets the foregoing standard. 50 | 2.4.3 Trademark Format. Licensee shall only use or display the Trademark in a format approved by Ultralight Inc, such approval not to be unreasonably withheld. 51 | 2.4.4 Proper Notice and Acknowledgment. Every use of the Trademark by Licensee shall incorporate in an appropriate manner a "TM" or once it is registered an "R" enclosed by a circle or the phrase "Reg. U.S. Trademark of Ultralight, Inc.". 52 | 2.4.5 Impairment of Ultralight Inc's Rights. If Licensee decides to use the Trademark, Licensee shall not at any time, whether during or after the Term of this Agreement, do or cause to be done any act or thing challenging, contesting, impairing, invalidating, or tending to impair or invalidate any of Ultralight Inc's rights in the Trademark or any registrations derived from such rights. 53 | 2.4.6 Ultralight Inc's Rights and Remedies. If Licensee decides to use the Trademark, Licensee acknowledges and agrees that Ultralight Inc has, shall retain and may exercise, both during the Term of this Agreement and thereafter, all rights and remedies available to Ultralight Inc, whether derived from this Agreement, from statute, or otherwise, as a result of or in connection with Licensee's breach of the trademark license granted in this Agreement, misuse of the Trademark or any other use of the Trademark by Licensee which is not permitted by this Agreement. 54 | ARTICLE 3 55 | 56 | RESTRICTIONS AND IMPROVEMENTS 57 | 3.1 Restrictions. All rights not expressly granted in this Agreement are reserved by Ultralight Inc. Nothing contained in this Agreement shall be interpreted to give Licensee any rights with respect to any copyrights, patents, trademarks, or other intellectual property, including software by Ultralight Inc other than Ultralight software under the terms described herein. 58 | 3.2 Ownership of Intellectual Property. As between Ultralight Inc and Licensee, Ultralight Inc owns and shall continue to own all intellectual property rights in the Ultralight software. Nothing in this agreement shall be construed to grant Ultralight Inc any rights to Licensee's Licensed Products, except as expressly stated herein. 59 | 3.3 Interest in Improvements. Ultralight Inc shall own all intellectual property rights and all other property rights in new patent applications and Improvements which Ultralight Inc makes to the Ultralight software, including using information received from Licensee or while performing Ultralight Inc's obligations under the terms of this Agreement. Licensee hereby assigns, transfers and conveys to Ultralight Inc, and the Ultralight Inc hereby accepts and assumes, free and clear of and from encumbrances, all right, title and interest, together with all rights of priority, in and to such Improvements and the patent(s) that may issue from such Improvements, and including the subject matter of all claims that may be obtained therefrom, any foreign counterparts or equivalents thereto, existing now or in the future, and any and all divisionals, continuations (in whole or in part), reissues, renewals and extensions of any of the foregoing, any substitutions therefore and any patents that may issue from the foregoing, the same to be held and enjoyed by Ultralight Inc for its own use and benefit, and for the use and benefit of its successors or assigns, to the end of the term or terms for which said patents are or may be granted or reissued, as fully and entirely as the same would have been held and enjoyed by the Licensee if this assignment had not been made. Such assignment includes, without limitation, all income, royalties, damages or payments due or payable after the Effective Date related to any of the foregoing and all claims for damages by reason of past, present or future infringement or other unauthorized use of the foregoing, with the right to sue for and collect the same. Licensee hereby authorizes and requests the Commissioner of Patents of the United States Patent and Trademark Office, or any equivalent body in any foreign jurisdiction, to record this assignment so as to reflect Ultralight Inc's ownership of the Improvements. Licensee hereby covenants and agrees that the Licensee will, at any time, upon request, execute and deliver any and all papers and take any and all other reasonable actions that may be necessary or desirable to implement or perfect this assignment, without further compensation but at the expense of the assignee, its successors or assigns with respect to Licensee's reasonable out-of-pocket costs. 60 | 3.4 Protection of Improvements. Ultralight Inc shall prepare, file, prosecute, obtain, maintain and enforce any or all intellectual property rights in, to, and under the Improvements. Notwithstanding the foregoing, Ultralight Inc shall be under no obligation to prosecute or pursue intellectual property protection, in, to or under any Improvements inside or outside of the United States. 61 | ARTICLE 4 62 | 63 | CERTAIN LICENSEE OBLIGATIONS 64 | 4.1 No Reverse Engineering. Unless otherwise agreed to in writing, Licensee agrees not to reverse engineer, decompile, disassemble, modify, translate, make any attempt to discover the source code of the Ultralight software, or modify, or otherwise create derivative works of, the Ultralight software. 65 | 4.2 No Static Linking. Unless otherwise agreed to in writing, Licensee agrees not to access the Ultralight.dll using static-linking tools or other methods that hide or conceal any of the Ultralight software. 66 | 4.3 Licensing of End Users. Subject to the license grant in ARTICLE 2, Licensee may distribute to End Users the Ultralight software, as part of and in conjunction with Licensed Products, provided that such distribution to End Users is subject to the End User License Agreement in Exhibit A, or a license by Licensee having substantially the same terms and conditions. 67 | 4.4 Marking. Licensee shall ensure that the following legend, or a successor legend as designated by Ultralight Inc from time to time, shall appear in the credit section of any Licensed Product: 68 | 69 | Please see the accompanying NOTICES.txt for full text. 70 | 71 | 4.5 Export Controls. The Ultralight software, including any downloading or use of, may be subject to export controls imposed by U.S. export control laws, including the U.S. Export Administration Act and its associated regulations, and may be subject to export or import regulations in other countries. Licensee agrees to comply strictly with all such regulations and acknowledges that Licensee has the responsibility to obtain licenses to export, re-export, or import the Ultralight software. 72 | 4.6 Infringement. Licensee agrees to promptly notify Ultralight Inc if it becomes aware of any third party that infringes Ultralight Inc's intellectual property rights, including misappropriation of the Ultralight software or violations of an End User license agreement (an "Infringement"). Ultralight Inc, at its discretion, shall have the right, but not the obligation, to enforce intellectual property rights against any Infringement. Ultralight Inc shall solely control any such enforcement action. 73 | 4.7 Update Contact Information. Licensee shall promptly report to Ultralight Inc any change in mailing address, name or company affiliation during the period of this Agreement, and Licensee also shall promptly report when, and if, Licensee discontinues its development and marketing of the Ultralight software, and/or when Licensee discontinues its efforts to bring the Licensed Products to practical application. 74 | ARTICLE 5 75 | 76 | [THIS SECTION INTENTIONALLY RESERVED.] 77 | ARTICLE 6 78 | 79 | PAYMENTS AND ROYALTY 80 | 6.1 Payment. No payment or royalty is required for this Free License Agreement. For Commercial purposes or additional license rights, please contact Ultralight Inc: Ultralight, Inc., 15822 Jamie Lee Drive, Houston, Texas 77095, or through e-mail: sales@ultralig.ht 81 | ARTICLE 7 82 | 83 | REPRESENTATIONS AND WARRANTIES 84 | 7.1 LIMITATION OF WARRANTY; "AS IS". THE ULTRALIGHT SOFTWARE, INCLUDING, WITHOUT LIMITATION, ALL SOFTWARE, DOCUMENTS, FUNCTIONS, MATERIALS, AND INFORMATION, IS PROVIDED "AS IS." TO THE FULLEST EXTENT PERMISSIBLY BY LAW, Ultralight Inc MAKES NO OTHER REPRESENTATIONS, EXTENDS NO OTHER WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT (INCLUDING ANY OPEN SOURCE VIOLATIONS), AND ASSUMES NO LIABILITY TO LICENSEE OR ANY OTHER PERSON FOR OR ON ACCOUNT OF ANY INJURY, LOSS OR DAMAGE, OF ANY KIND OR NATURE, SUSTAINED BY, OR ANY DAMAGE ASSESSED OR ASSERTED AGAINST, OR ANY OTHER LIABILITY INCURRED BY OR IMPOSED ON LICENSEE OR ANY OTHER PERSON (INCLUDING DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), ARISING OUT OF OR IN CONNECTION WITH OR RESULTING FROM THE USE OF THE ULTRALIGHT SOFTWARE OR THIS AGREEMENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 85 | 7.2 Maximum Liability. Regardless of the basis on which a claim is made (including fundamental breach, negligence, misrepresentation, or other contract or tort claim), Ultralight Inc's maximum liability under this Agreement is further limited to the lesser of: the amount paid or due Ultralight Inc under this Agreement, or one US Dollar (USD$1.00). This limitation shall not apply to any claim based on an indemnity in ARTICLE 8 below. 86 | ARTICLE 8 87 | 88 | INDEMNIFICATION 89 | 8.1 Indemnification by Licensee. Provided that Ultralight Inc provides prompt and reasonable notice to Licensee, then Licensee shall defend and indemnify Ultralight Inc from and against any and all claims for damages, losses, liabilities, costs and expenses (including reasonable legal fees and expenses), deficiencies, including interest and penalties imposed or assessed by any judicial or administrative body, including, all amounts paid in investigation, defense or settlement of the foregoing, (collectively, the "Losses") incurred by Ultralight Inc that arise out of: 90 | 8.1.1 any breach of Licensee's obligations in ARTICLE 4; or 91 | 8.1.2 any breach of the confidentiality obligations under ARTICLE 9 by Licensee, its Affiliates, employees, or contractors; or 92 | 8.1.3 any third-party claim of infringement or misappropriation that arises out of the Licensed Product due to use of the Ultralight software in combination with Licensee's software or technology. 93 | 8.2 Indemnification by Ultralight Inc. Provided that Licensee provides prompt and reasonable notice to Ultralight Inc, then Ultralight Inc shall defend and indemnify Licensee from and against all Losses incurred by Licensee that arise out of: any breach of the confidentiality obligations under ARTICLE 9 by Ultralight Inc, its Affiliates, employees, or contractors. 94 | 8.3 Party Seeking Indemnification. (a) If either Party seeks indemnification under the terms of this ARTICLE 8 (the "Indemnified Party") against the other Party (the "Indemnifying Party"), the Indemnified Party shall promptly notify the Indemnifying Party in writing of the third party claim or threatened third party claim it receives notice thereof, shall permit the Indemnifying Party, at the Indemnifying Party's cost and expense, to assume direction and control of the defense of the third party claim, and shall cooperate as requested (at the expense of the Indemnifying Party), in the defense of the claim. 95 | 8.3.1 The obligations of the Indemnifying Party to indemnify the Indemnified Party pursuant to Section 8.1 and Section 8.2 are conditioned upon the delivery of written notice to the Indemnifying Party of any asserted or threatened third party claim promptly after the Indemnified Party becomes aware of such third party claim; provided, that, the failure of the Indemnified Party to give such notice or any delay thereof shall not offset the Indemnified Party's right to indemnification hereunder, except to the extent that such failure or delay impairs the Indemnifying Party's ability to defend or contest any such third party claim. 96 | ARTICLE 9 97 | 98 | CONFIDENTIALITY 99 | 9.1 Non-use and Non-disclosure. Each Party agrees not to use any Confidential Information of the other Party for any purpose except for the purposes set forth in this Agreement. Each Party agrees not to disclose any Confidential Information of the other Party, except that, subject to Section 9.2 below, a receiving Party may disclose the other Party's Confidential Information (except Source Code unless otherwise specified in writing) to those employees of the receiving Party who are required to have the information for the purposes set forth in this Agreement, and relevant consultants, provided that the receiving Party first obtains a signed confidentiality agreement with terms similar to this Agreement from the consultants, such that consultants are under a confidentiality obligation to the receiving Party. If a receiving Party is required by law to make any disclosure that is prohibited or otherwise constrained by this Agreement, the receiving Party will provide the disclosing Party with prompt written notice of such requirement so that the disclosing Party may seek a protective order or other appropriate relief. Subject to the foregoing sentence, such receiving Party may furnish that portion (and only that portion) of the Confidential Information that the receiving Party is legally compelled or is otherwise legally required to disclose; provided, however, that the receiving Party provides such reasonable assistance as the disclosing Party may request in obtaining such order or other relief. 100 | 9.2 Maintenance of Confidentiality. Each Party agrees that it shall take reasonable measures to protect the secrecy of and avoid disclosure and unauthorized use of the Confidential Information of the other Party. Without limiting the foregoing, each Party shall take at least those measures that it takes to protect its own confidential information of a similar nature, but in no case less than reasonable care (including, without limitation, all precautions the receiving Party employs with respect to its confidential materials). Prior to any disclosure of Confidential Information to its employees, each Party shall ensure that such employees who have access to the other Party's Confidential Information have signed a non-disclosure agreement in content similar to the provisions of this Agreement or are otherwise legally obligated not to disclose such Confidential Information. Each Party shall reproduce the other Party's proprietary rights notices on any photo or electronic copies, in the same manner in which such notices were set forth in or on the original. A Party receiving Confidential Information shall promptly notify the Party disclosing such Confidential Information of any use or disclosure of such Confidential Information in violation of this Agreement of which the receiving Party becomes aware. 101 | 9.3 Source Code. For purposes of clarity, any Source Code may not be disclosed by a receiving Party to any third party, including consultants under non-disclosure agreements, without the prior written consent of the disclosing Party. 102 | 9.4 Limitation on Copying. Other than Ultralight Inc's rights in the Improvements, the disclosing Party retains and owns all copyrights, rights in derivative works in the Confidential Information and the receiving Party hereby agrees not to copy the Confidential Information, in whole or in part, except as is necessary to perform its tasks under this Agreement. 103 | 9.5 Return of Materials. All documents and other tangible objects containing or representing Confidential Information that have been disclosed by either Party to the other Party, shall be and remain the property of the disclosing Party and shall be promptly returned to the disclosing Party upon the disclosing Party's written request. Notwithstanding the foregoing, one (1) copy of any written or photographic Confidential Information provided by the other Party may be retained by the receiving Party for archival purposes only. 104 | 9.6 Duration. The confidentiality obligations of each receiving Party under this Agreement shall survive until such time as all Confidential Information of the other Party disclosed hereunder becomes publicly known and made generally available through no action or inaction of the receiving Party. The obligations to hold information in confidence as required by ARTICLE 9 also shall survive any termination of this Agreement. 105 | 9.7 Duty to Notify of Confidentiality Breach. Either Party shall immediately provide written notice to the other Party of any breach of this ARTICLE 9, specifying the specific nature of the breach. The breaching Party shall then have thirty (30) days to reasonably cure the breach. Should such breach not be reasonably cured within sixty (60) days from receipt of such notice, then the non-breaching Party may terminate this Agreement. 106 | 9.8 Availability of Equitable Relief. Each Party understands and agrees that its breach or threatened breach of this Agreement will cause irreparable injury to the other Party and that money damages will not provide an adequate remedy for such breach or threatened breach, and both parties hereby agree that, in the event of such a breach or threatened breach, the non-breaching Party will also be entitled, without the requirement of posting a bond or other security, to equitable relief, including injunctive relief and specific performance. The Parties' rights under this Agreement are cumulative, and a Party's exercise of one right shall not waive the Party's right to assert any other legal remedy. 107 | ARTICLE 10 108 | 109 | TERM AND TERMINATION 110 | 10.1 Term. This Agreement will be for a term beginning on the Effective Date and will continue in effect unless otherwise terminated as provided by under Section 9.7 or as provided for in this ARTICLE 10, including: 111 | 10.1.1 Termination by Licensee. Licensee may terminate this Agreement by providing Ultralight Inc with thirty (30) days prior written notice intent to terminate. 112 | 10.1.2 Termination by Ultralight Inc. Ultralight Inc may terminate this Agreement with notification to Licensee of any breach of Licensee's obligations in ARTICLE 4 if such breach is not reasonably cured within thirty (30) days from receipt of such notice. 113 | 10.2 Effect of Termination. Upon termination or expiration of this Agreement, (1) the licenses granted to Licensee herein shall immediately cease; (2) if Licensee has decided to use the Trademark, Licensee shall immediately cease and desist from using the Trademark in conjunction with any future marketing and advertising activities; and (3) any license fee, consulting fee, or other payment owed by Licensee to Ultralight Inc shall become immediately due and payable. 114 | 10.3 Surviving Provisions. Notwithstanding any provision herein to the contrary, the rights and obligations of the Parties set forth in Articles 3, 7, 8, 9, 10 and 11, as well as any rights or obligations otherwise accrued hereunder, including any accrued payment obligations, shall survive the expiration or termination of the Term. 115 | ARTICLE 11 116 | 117 | GENERAL PROVISIONS 118 | 11.1 Severability. If any provision(s) of this Agreement are deemed to be unenforceable or are or become invalid, or are ruled illegal by any court of appropriate jurisdiction under then current applicable law from time to time in effect during the Term hereof, it is the intention of the Parties that the remainder of this Agreement shall not be affected thereby provided that a Party's rights under this Agreement are not materially affected. The Parties hereto covenant and agree to renegotiate any such term, covenant or application thereof in good faith in order to provide a reasonably acceptable alternative to the term, covenant or condition of this Agreement or the application thereof that is invalid, illegal or unenforceable, it being the intent of the Parties that the basic purposes of this Agreement are to be effectuated. 119 | 11.2 Venue and Jurisdiction. This Agreement shall be governed by and construed in accordance with the internal laws of the State of Texas, without reference to its conflicts of laws and choice of law rules or principles. Any disputes arising hereunder shall be adjudicated in Harris County, Texas, which state or federal courts having appropriate jurisdiction shall have exclusive jurisdiction over such dispute(s) but not including any appeals from decisions therefrom. 120 | 11.3 Notification. All notices, requests and other communications hereunder shall be in writing, shall be addressed to the receiving Party's address set forth below or as otherwise provided by Licensee to Ultralight Inc, or to such other address as a Party may designate by notice hereunder, and shall be either: (a) delivered by hand; (b) made by facsimile transmission (to be followed with written fax confirmation); (c) sent by private courier service providing evidence of receipt; or (d) sent by registered or certified mail, return receipt requested, postage prepaid. The addresses and other contact information for the Parties are as follows: 121 | 122 | If to Ultralight Inc: 123 | Mr. Adam Simmons 124 | 15822 Jamie Lee Drive 125 | Houston, Texas 77095 126 | 127 | All notices, requests and other communications hereunder shall be deemed to have been given either: (a) if by hand, at the time of the delivery thereof to the receiving Party at the address of such Party set forth above; (b) if made by telecopy or facsimile transmission, at the time that receipt thereof has been acknowledged by the recipient; (c) if sent by private courier, on the day such notice is delivered to the recipient; or (d) if sent by registered or certified mail, on the fifth (5th) business day following the day such mailing is made. 128 | 11.4 Entire Agreement. This is the entire Agreement between the Parties with respect to the subject matter hereof and supersedes all prior representations, understandings and agreements between the Parties with respect to the subject matter hereof. No modification shall be effective unless in writing with specific reference to this Agreement and signed by the Parties. 129 | 11.5 Waiver. The terms or conditions of this Agreement may be waived only by a non-electronic written instrument executed by the Party waiving compliance. The failure of either Party at any time or times to require performance of any provision hereof shall in no manner affect its rights at a later time to enforce the same. No waiver by either Party of any condition or term shall be deemed as a continuing waiver of such condition or term or of another condition or term. 130 | 11.6 Headings. Section and subsection headings are inserted for convenience of reference only and do not form part of this Agreement. 131 | 11.7 Assignment. Neither this Agreement nor any right or obligation hereunder may be assigned, delegated or otherwise transferred, in whole or part, by either Party without the prior express written consent of the other provided, provided, however, that either Party may, without the prior written consent of the other Party, assign this Agreement and its rights and delegate its obligations hereunder to its Affiliates, and may assign this Agreement in conjunction with an acquisition, merger, sale of substantially all of its assets, or other business combination. Any permitted assignee shall assume all obligations of its assignor under this Agreement. Any purported assignment in violation of this Section 11.7 shall be void. The terms and conditions of this Agreement shall be binding upon and inure to the benefit of the permitted successors and assigns of the Parties. 132 | 11.8 Force Majeure. Neither Party shall be liable for failure of or delay in performing obligations set forth in this Agreement, and neither shall be deemed in breach of its obligations, if such failure or delay is due to natural disasters, acts of terrorism or any other causes beyond the reasonable control of such Party. In event of such force majeure, the Party affected thereby shall use reasonable efforts to cure or overcome the same and resume performance of its obligations hereunder. 133 | 11.9 Construction. The Parties hereto acknowledge and agree that: (i) each Party and its counsel reviewed and negotiated the terms and provisions of this Agreement and have contributed to its revision; (ii) the rule of construction to the effect that any ambiguities are resolved against the drafting Party shall not be employed in the interpretation of this Agreement; and (iii) the terms and provisions of this Agreement shall be construed fairly as to all Parties hereto and not in favor of or against any Party, regardless of which Party was generally responsible for the preparation of this Agreement. 134 | 11.10 Status. Nothing in this Agreement is intended or shall be deemed to constitute a partner, agency, employer-employee, or joint venture relationship between the Parties. 135 | 11.11 Further Assurances. Each Party agrees to execute, acknowledge and deliver such further instructions, and to do all such other acts, as may be reasonably necessary or appropriate in order to carry out the purposes and intent of this Agreement. 136 | 11.12 Counterparts. This Agreement may be executed simultaneously in one or more counterparts, each of which shall be deemed an original, but all of which together shall constitute one and the same instrument. 137 | 11.13 Negotiation and Mediation. If an issue arises over the subject matter of this Agreement, before initiating litigation, the Parties hereby agree to attempt in good faith to settle any disputes or issues through mediation, including a direct exchange between chief executives, at least thirty (30) days prior to any filing suit. 138 | 139 | /end 140 | -------------------------------------------------------------------------------- /wrapper/JavaScriptCore/JSObjectRef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2019 Apple Inc. All rights reserved. 3 | * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) 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 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 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 JSObjectRef_h 28 | #define JSObjectRef_h 29 | 30 | #include "JSBase.h" 31 | #include "JSValueRef.h" 32 | #include "WebKitAvailability.h" 33 | 34 | #ifndef __cplusplus 35 | #include 36 | #endif 37 | #include /* for size_t */ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /*! 44 | @enum JSPropertyAttribute 45 | @constant kJSPropertyAttributeNone Specifies that a property has no special attributes. 46 | @constant kJSPropertyAttributeReadOnly Specifies that a property is read-only. 47 | @constant kJSPropertyAttributeDontEnum Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops. 48 | @constant kJSPropertyAttributeDontDelete Specifies that the delete operation should fail on a property. 49 | */ 50 | enum { 51 | kJSPropertyAttributeNone = 0, 52 | kJSPropertyAttributeReadOnly = 1 << 1, 53 | kJSPropertyAttributeDontEnum = 1 << 2, 54 | kJSPropertyAttributeDontDelete = 1 << 3 55 | }; 56 | 57 | /*! 58 | @typedef JSPropertyAttributes 59 | @abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together. 60 | */ 61 | typedef unsigned JSPropertyAttributes; 62 | 63 | /*! 64 | @enum JSClassAttribute 65 | @constant kJSClassAttributeNone Specifies that a class has no special attributes. 66 | @constant kJSClassAttributeNoAutomaticPrototype Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually. 67 | */ 68 | enum { 69 | kJSClassAttributeNone = 0, 70 | kJSClassAttributeNoAutomaticPrototype = 1 << 1 71 | }; 72 | 73 | /*! 74 | @typedef JSClassAttributes 75 | @abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together. 76 | */ 77 | typedef unsigned JSClassAttributes; 78 | 79 | /*! 80 | @typedef JSObjectInitializeCallback 81 | @abstract The callback invoked when an object is first created. 82 | @param ctx The execution context to use. 83 | @param object The JSObject being created. 84 | @discussion If you named your function Initialize, you would declare it like this: 85 | 86 | void Initialize(JSContextRef ctx, JSObjectRef object); 87 | 88 | Unlike the other object callbacks, the initialize callback is called on the least 89 | derived class (the parent class) first, and the most derived class last. 90 | */ 91 | typedef void 92 | (*JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object); 93 | 94 | /* Extension of the above callback with the class that the method is being invoked for. */ 95 | typedef void 96 | (*JSObjectInitializeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object); 97 | 98 | /*! 99 | @typedef JSObjectFinalizeCallback 100 | @abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. 101 | @param object The JSObject being finalized. 102 | @discussion If you named your function Finalize, you would declare it like this: 103 | 104 | void Finalize(JSObjectRef object); 105 | 106 | The finalize callback is called on the most derived class first, and the least 107 | derived class (the parent class) last. 108 | 109 | You must not call any function that may cause a garbage collection or an allocation 110 | of a garbage collected object from within a JSObjectFinalizeCallback. This includes 111 | all functions that have a JSContextRef parameter. 112 | */ 113 | typedef void 114 | (*JSObjectFinalizeCallback) (JSObjectRef object); 115 | 116 | /* Extension of the above callback with the class that the method is being invoked for. */ 117 | typedef void 118 | (*JSObjectFinalizeCallbackEx) (JSClassRef jsClass, JSObjectRef object); 119 | 120 | /*! 121 | @typedef JSObjectHasPropertyCallback 122 | @abstract The callback invoked when determining whether an object has a property. 123 | @param ctx The execution context to use. 124 | @param object The JSObject to search for the property. 125 | @param propertyName A JSString containing the name of the property look up. 126 | @result true if object has the property, otherwise false. 127 | @discussion If you named your function HasProperty, you would declare it like this: 128 | 129 | bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); 130 | 131 | If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. 132 | 133 | This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive. 134 | 135 | If this callback is NULL, the getProperty callback will be used to service hasProperty requests. 136 | */ 137 | typedef bool 138 | (*JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); 139 | 140 | /* Extension of the above callback with the class that the method is being invoked for. */ 141 | typedef bool 142 | (*JSObjectHasPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName); 143 | 144 | /*! 145 | @typedef JSObjectGetPropertyCallback 146 | @abstract The callback invoked when getting a property's value. 147 | @param ctx The execution context to use. 148 | @param object The JSObject to search for the property. 149 | @param propertyName A JSString containing the name of the property to get. 150 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 151 | @result The property's value if object has the property, otherwise NULL. 152 | @discussion If you named your function GetProperty, you would declare it like this: 153 | 154 | JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 155 | 156 | If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. 157 | */ 158 | typedef JSValueRef 159 | (*JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 160 | 161 | /* Extension of the above callback with the class that the method is being invoked for. */ 162 | typedef JSValueRef 163 | (*JSObjectGetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 164 | 165 | /*! 166 | @typedef JSObjectSetPropertyCallback 167 | @abstract The callback invoked when setting a property's value. 168 | @param ctx The execution context to use. 169 | @param object The JSObject on which to set the property's value. 170 | @param propertyName A JSString containing the name of the property to set. 171 | @param value A JSValue to use as the property's value. 172 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 173 | @result true if the property was set, otherwise false. 174 | @discussion If you named your function SetProperty, you would declare it like this: 175 | 176 | bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); 177 | 178 | If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). 179 | */ 180 | typedef bool 181 | (*JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); 182 | 183 | /* Extension of the above callback with the class that the method is being invoked for. */ 184 | typedef bool 185 | (*JSObjectSetPropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); 186 | 187 | /*! 188 | @typedef JSObjectDeletePropertyCallback 189 | @abstract The callback invoked when deleting a property. 190 | @param ctx The execution context to use. 191 | @param object The JSObject in which to delete the property. 192 | @param propertyName A JSString containing the name of the property to delete. 193 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 194 | @result true if propertyName was successfully deleted, otherwise false. 195 | @discussion If you named your function DeleteProperty, you would declare it like this: 196 | 197 | bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 198 | 199 | If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). 200 | */ 201 | typedef bool 202 | (*JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 203 | 204 | /* Extension of the above callback with the class that the method is being invoked for. */ 205 | typedef bool 206 | (*JSObjectDeletePropertyCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 207 | 208 | /*! 209 | @typedef JSObjectGetPropertyNamesCallback 210 | @abstract The callback invoked when collecting the names of an object's properties. 211 | @param ctx The execution context to use. 212 | @param object The JSObject whose property names are being collected. 213 | @param propertyNames A JavaScript property name accumulator in which to accumulate the names of object's properties. 214 | @discussion If you named your function GetPropertyNames, you would declare it like this: 215 | 216 | void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); 217 | 218 | Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops. 219 | 220 | Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. 221 | */ 222 | typedef void 223 | (*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); 224 | 225 | /* Extension of the above callback with the class that the method is being invoked for. */ 226 | typedef void 227 | (*JSObjectGetPropertyNamesCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); 228 | 229 | /*! 230 | @typedef JSObjectCallAsFunctionCallback 231 | @abstract The callback invoked when an object is called as a function. 232 | @param ctx The execution context to use. 233 | @param function A JSObject that is the function being called. 234 | @param thisObject A JSObject that is the 'this' variable in the function's scope. 235 | @param argumentCount An integer count of the number of arguments in arguments. 236 | @param arguments A JSValue array of the arguments passed to the function. 237 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 238 | @result A JSValue that is the function's return value. 239 | @discussion If you named your function CallAsFunction, you would declare it like this: 240 | 241 | JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 242 | 243 | If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject. 244 | 245 | If this callback is NULL, calling your object as a function will throw an exception. 246 | */ 247 | typedef JSValueRef 248 | (*JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 249 | 250 | /* Extension of the above callback with the class and class name of the object being called as a function. 251 | @discussion If this is a JSStaticFunctionEx, className will actually be the name of the function. 252 | */ 253 | typedef JSValueRef 254 | (*JSObjectCallAsFunctionCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSStringRef className, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 255 | 256 | /*! 257 | @typedef JSObjectCallAsConstructorCallback 258 | @abstract The callback invoked when an object is used as a constructor in a 'new' expression. 259 | @param ctx The execution context to use. 260 | @param constructor A JSObject that is the constructor being called. 261 | @param argumentCount An integer count of the number of arguments in arguments. 262 | @param arguments A JSValue array of the arguments passed to the function. 263 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 264 | @result A JSObject that is the constructor's return value. 265 | @discussion If you named your function CallAsConstructor, you would declare it like this: 266 | 267 | JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 268 | 269 | If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor. 270 | 271 | If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. 272 | */ 273 | typedef JSObjectRef 274 | (*JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 275 | 276 | /* Extension of the above callback with the class that the method is being invoked for. */ 277 | typedef JSObjectRef 278 | (*JSObjectCallAsConstructorCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 279 | 280 | /*! 281 | @typedef JSObjectHasInstanceCallback 282 | @abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. 283 | @param ctx The execution context to use. 284 | @param constructor The JSObject that is the target of the 'instanceof' expression. 285 | @param possibleInstance The JSValue being tested to determine if it is an instance of constructor. 286 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 287 | @result true if possibleInstance is an instance of constructor, otherwise false. 288 | @discussion If you named your function HasInstance, you would declare it like this: 289 | 290 | bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); 291 | 292 | If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue. 293 | 294 | If this callback is NULL, 'instanceof' expressions that target your object will return false. 295 | 296 | Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well. 297 | */ 298 | typedef bool 299 | (*JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); 300 | 301 | /* Extension of the above callback with the class that the method is being invoked for. */ 302 | typedef bool 303 | (*JSObjectHasInstanceCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); 304 | 305 | /*! 306 | @typedef JSObjectConvertToTypeCallback 307 | @abstract The callback invoked when converting an object to a particular JavaScript type. 308 | @param ctx The execution context to use. 309 | @param object The JSObject to convert. 310 | @param type A JSType specifying the JavaScript type to convert to. 311 | @param exception A pointer to a JSValueRef in which to return an exception, if any. 312 | @result The objects's converted value, or NULL if the object was not converted. 313 | @discussion If you named your function ConvertToType, you would declare it like this: 314 | 315 | JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); 316 | 317 | If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class). 318 | 319 | This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself. 320 | */ 321 | typedef JSValueRef 322 | (*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); 323 | 324 | /* Extension of the above callback with the class that the method is being invoked for. */ 325 | typedef JSValueRef 326 | (*JSObjectConvertToTypeCallbackEx) (JSContextRef ctx, JSClassRef jsClass, JSObjectRef object, JSType type, JSValueRef* exception); 327 | 328 | /*! 329 | @struct JSStaticValue 330 | @abstract This structure describes a statically declared value property. 331 | @field name A null-terminated UTF8 string containing the property's name. 332 | @field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value. 333 | @field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set. 334 | @field attributes A logically ORed set of JSPropertyAttributes to give to the property. 335 | */ 336 | typedef struct { 337 | const char* name; 338 | JSObjectGetPropertyCallback getProperty; 339 | JSObjectSetPropertyCallback setProperty; 340 | JSPropertyAttributes attributes; 341 | } JSStaticValue; 342 | 343 | /* Extension of the above structure for use with class version 1000 */ 344 | typedef struct { 345 | const char* name; 346 | JSObjectGetPropertyCallbackEx getPropertyEx; 347 | JSObjectSetPropertyCallbackEx setPropertyEx; 348 | JSPropertyAttributes attributes; 349 | } JSStaticValueEx; 350 | 351 | /*! 352 | @struct JSStaticFunction 353 | @abstract This structure describes a statically declared function property. 354 | @field name A null-terminated UTF8 string containing the property's name. 355 | @field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function. 356 | @field attributes A logically ORed set of JSPropertyAttributes to give to the property. 357 | */ 358 | typedef struct { 359 | const char* name; 360 | JSObjectCallAsFunctionCallback callAsFunction; 361 | JSPropertyAttributes attributes; 362 | } JSStaticFunction; 363 | 364 | /* Extension of the above structure for use with class version 1000 */ 365 | typedef struct { 366 | const char* name; 367 | JSObjectCallAsFunctionCallbackEx callAsFunctionEx; 368 | JSPropertyAttributes attributes; 369 | } JSStaticFunctionEx; 370 | 371 | /*! 372 | @struct JSClassDefinition 373 | @abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. 374 | @field version The version number of this structure. The current version is 0. 375 | @field attributes A logically ORed set of JSClassAttributes to give to the class. 376 | @field className A null-terminated UTF8 string containing the class's name. 377 | @field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class. 378 | @field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL. 379 | @field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL. 380 | @field initialize The callback invoked when an object is first created. Use this callback to initialize the object. 381 | @field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup. 382 | @field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive. 383 | @field getProperty The callback invoked when getting a property's value. 384 | @field setProperty The callback invoked when setting a property's value. 385 | @field deleteProperty The callback invoked when deleting a property. 386 | @field getPropertyNames The callback invoked when collecting the names of an object's properties. 387 | @field callAsFunction The callback invoked when an object is called as a function. 388 | @field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. 389 | @field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression. 390 | @field convertToType The callback invoked when converting an object to a particular JavaScript type. 391 | @discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time. 392 | 393 | If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this: 394 | 395 | JSStaticValue StaticValueArray[] = { 396 | { "X", GetX, SetX, kJSPropertyAttributeNone }, 397 | { 0, 0, 0, 0 } 398 | }; 399 | 400 | Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects. 401 | 402 | A NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute. 403 | */ 404 | typedef struct { 405 | int version; /* default version is 0, use version 1000 for callbacks with extended class information */ 406 | JSClassAttributes attributes; 407 | 408 | const char* className; 409 | JSClassRef parentClass; 410 | 411 | union { 412 | /* version 0 */ 413 | struct { 414 | const JSStaticValue* staticValues; 415 | const JSStaticFunction* staticFunctions; 416 | JSObjectInitializeCallback initialize; 417 | JSObjectFinalizeCallback finalize; 418 | JSObjectHasPropertyCallback hasProperty; 419 | JSObjectGetPropertyCallback getProperty; 420 | JSObjectSetPropertyCallback setProperty; 421 | JSObjectDeletePropertyCallback deleteProperty; 422 | JSObjectGetPropertyNamesCallback getPropertyNames; 423 | JSObjectCallAsFunctionCallback callAsFunction; 424 | JSObjectCallAsConstructorCallback callAsConstructor; 425 | JSObjectHasInstanceCallback hasInstance; 426 | JSObjectConvertToTypeCallback convertToType; 427 | }; 428 | 429 | /* version 1000 */ 430 | struct { 431 | const JSStaticValueEx* staticValuesEx; 432 | const JSStaticFunctionEx* staticFunctionsEx; 433 | JSObjectInitializeCallbackEx initializeEx; 434 | JSObjectFinalizeCallbackEx finalizeEx; 435 | JSObjectHasPropertyCallbackEx hasPropertyEx; 436 | JSObjectGetPropertyCallbackEx getPropertyEx; 437 | JSObjectSetPropertyCallbackEx setPropertyEx; 438 | JSObjectDeletePropertyCallbackEx deletePropertyEx; 439 | JSObjectGetPropertyNamesCallbackEx getPropertyNamesEx; 440 | JSObjectCallAsFunctionCallbackEx callAsFunctionEx; 441 | JSObjectCallAsConstructorCallbackEx callAsConstructorEx; 442 | JSObjectHasInstanceCallbackEx hasInstanceEx; 443 | JSObjectConvertToTypeCallbackEx convertToTypeEx; 444 | }; 445 | }; 446 | 447 | void* privateData; /* version 1000 only */ 448 | } JSClassDefinition; 449 | 450 | /*! 451 | @const kJSClassDefinitionEmpty 452 | @abstract A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes. 453 | @discussion Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method: 454 | 455 | JSClassDefinition definition = kJSClassDefinitionEmpty; 456 | definition.finalize = Finalize; 457 | */ 458 | JS_EXPORT extern const JSClassDefinition kJSClassDefinitionEmpty; 459 | 460 | /*! 461 | @function 462 | @abstract Creates a JavaScript class suitable for use with JSObjectMake. 463 | @param definition A JSClassDefinition that defines the class. 464 | @result A JSClass with the given definition. Ownership follows the Create Rule. 465 | */ 466 | JS_EXPORT JSClassRef JSClassCreate(const JSClassDefinition* definition); 467 | 468 | /*! 469 | @function 470 | @abstract Retains a JavaScript class. 471 | @param jsClass The JSClass to retain. 472 | @result A JSClass that is the same as jsClass. 473 | */ 474 | JS_EXPORT JSClassRef JSClassRetain(JSClassRef jsClass); 475 | 476 | /*! 477 | @function 478 | @abstract Releases a JavaScript class. 479 | @param jsClass The JSClass to release. 480 | */ 481 | JS_EXPORT void JSClassRelease(JSClassRef jsClass); 482 | 483 | /*! 484 | @function 485 | @abstract Retrieves the private data from a class reference, only possible with classes created with version 1000 (extended callbacks). 486 | @param jsClass The class to get the data from 487 | @result The private data on the class, or NULL, if not set 488 | @discussion Only classes with version 1000 (extended callbacks) can store private data, for other classes always NULL will always be returned. 489 | */ 490 | JS_EXPORT void* JSClassGetPrivate(JSClassRef jsClass); 491 | 492 | /*! 493 | @function 494 | @abstract Sets the private data on a class, only possible with classes created with version 1000 (extended callbacks). 495 | @param jsClass The class to set the data on 496 | @param data A void* to set as the private data for the class 497 | @result true if the data has been set on the class, false if the class has not been created with version 1000 (extended callbacks) 498 | @discussion Only classes with version 1000 (extended callbacks) can store private data, for other classes the function always fails. The set pointer is not touched by the engine. 499 | */ 500 | JS_EXPORT bool JSClassSetPrivate(JSClassRef jsClass, void* data); 501 | 502 | /*! 503 | @function 504 | @abstract Creates a JavaScript object. 505 | @param ctx The execution context to use. 506 | @param jsClass The JSClass to assign to the object. Pass NULL to use the default object class. 507 | @param data A void* to set as the object's private data. Pass NULL to specify no private data. 508 | @result A JSObject with the given class and private data. 509 | @discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data. 510 | 511 | data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate. 512 | */ 513 | JS_EXPORT JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data); 514 | 515 | /*! 516 | @function 517 | @abstract Convenience method for creating a JavaScript function with a given callback as its implementation. 518 | @param ctx The execution context to use. 519 | @param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. 520 | @param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called. 521 | @result A JSObject that is a function. The object's prototype will be the default function prototype. 522 | */ 523 | JS_EXPORT JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); 524 | 525 | /*! 526 | @function 527 | @abstract Convenience method for creating a JavaScript constructor. 528 | @param ctx The execution context to use. 529 | @param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class. 530 | @param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor. 531 | @result A JSObject that is a constructor. The object's prototype will be the default object prototype. 532 | @discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data. 533 | */ 534 | JS_EXPORT JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor); 535 | 536 | /*! 537 | @function 538 | @abstract Creates a JavaScript Array object. 539 | @param ctx The execution context to use. 540 | @param argumentCount An integer count of the number of arguments in arguments. 541 | @param arguments A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0. 542 | @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. 543 | @result A JSObject that is an Array. 544 | @discussion The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument 545 | is supplied, this function returns an array with one element. 546 | */ 547 | JS_EXPORT JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 548 | 549 | /*! 550 | @function 551 | @abstract Creates a JavaScript Date object, as if by invoking the built-in Date constructor. 552 | @param ctx The execution context to use. 553 | @param argumentCount An integer count of the number of arguments in arguments. 554 | @param arguments A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0. 555 | @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. 556 | @result A JSObject that is a Date. 557 | */ 558 | JS_EXPORT JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 559 | 560 | /*! 561 | @function 562 | @abstract Creates a JavaScript Error object, as if by invoking the built-in Error constructor. 563 | @param ctx The execution context to use. 564 | @param argumentCount An integer count of the number of arguments in arguments. 565 | @param arguments A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0. 566 | @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. 567 | @result A JSObject that is a Error. 568 | */ 569 | JS_EXPORT JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 570 | 571 | /*! 572 | @function 573 | @abstract Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor. 574 | @param ctx The execution context to use. 575 | @param argumentCount An integer count of the number of arguments in arguments. 576 | @param arguments A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0. 577 | @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. 578 | @result A JSObject that is a RegExp. 579 | */ 580 | JS_EXPORT JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) JSC_API_AVAILABLE(macos(10.6), ios(7.0)); 581 | 582 | /*! 583 | @function 584 | @abstract Creates a JavaScript promise object by invoking the provided executor. 585 | @param ctx The execution context to use. 586 | @param resolve A pointer to a JSObjectRef in which to store the resolve function for the new promise. Pass NULL if you do not care to store the resolve callback. 587 | @param reject A pointer to a JSObjectRef in which to store the reject function for the new promise. Pass NULL if you do not care to store the reject callback. 588 | @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. 589 | @result A JSObject that is a promise or NULL if an exception occurred. 590 | */ 591 | JS_EXPORT JSObjectRef JSObjectMakeDeferredPromise(JSContextRef ctx, JSObjectRef* resolve, JSObjectRef* reject, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 592 | 593 | /*! 594 | @function 595 | @abstract Creates a function with a given script as its body. 596 | @param ctx The execution context to use. 597 | @param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. 598 | @param parameterCount An integer count of the number of parameter names in parameterNames. 599 | @param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. 600 | @param body A JSString containing the script to use as the function's body. 601 | @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. 602 | @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. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. 603 | @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. 604 | @result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype. 605 | @discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. 606 | */ 607 | JS_EXPORT JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); 608 | 609 | /*! 610 | @function 611 | @abstract Gets an object's prototype. 612 | @param ctx The execution context to use. 613 | @param object A JSObject whose prototype you want to get. 614 | @result A JSValue that is the object's prototype. 615 | */ 616 | JS_EXPORT JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object); 617 | 618 | /*! 619 | @function 620 | @abstract Sets an object's prototype. 621 | @param ctx The execution context to use. 622 | @param object The JSObject whose prototype you want to set. 623 | @param value A JSValue to set as the object's prototype. 624 | */ 625 | JS_EXPORT void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value); 626 | 627 | /*! 628 | @function 629 | @abstract Tests whether an object has a given property. 630 | @param object The JSObject to test. 631 | @param propertyName A JSString containing the property's name. 632 | @result true if the object has a property whose name matches propertyName, otherwise false. 633 | */ 634 | JS_EXPORT bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); 635 | 636 | /*! 637 | @function 638 | @abstract Gets a property from an object. 639 | @param ctx The execution context to use. 640 | @param object The JSObject whose property you want to get. 641 | @param propertyName A JSString containing the property's name. 642 | @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. 643 | @result The property's value if object has the property, otherwise the undefined value. 644 | */ 645 | JS_EXPORT JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 646 | 647 | /*! 648 | @function 649 | @abstract Sets a property on an object. 650 | @param ctx The execution context to use. 651 | @param object The JSObject whose property you want to set. 652 | @param propertyName A JSString containing the property's name. 653 | @param value A JSValueRef to use as the property's value. 654 | @param attributes A logically ORed set of JSPropertyAttributes to give to the property. 655 | @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. 656 | */ 657 | JS_EXPORT void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception); 658 | 659 | /*! 660 | @function 661 | @abstract Deletes a property from an object. 662 | @param ctx The execution context to use. 663 | @param object The JSObject whose property you want to delete. 664 | @param propertyName A JSString containing the property's name. 665 | @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. 666 | @result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). 667 | */ 668 | JS_EXPORT bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); 669 | 670 | /*! 671 | @function 672 | @abstract Tests whether an object has a given property using a JSValueRef as the property key. 673 | @param object The JSObject to test. 674 | @param propertyKey A JSValueRef containing the property key to use when looking up the property. 675 | @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. 676 | @result true if the object has a property whose name matches propertyKey, otherwise false. 677 | @discussion This function is the same as performing "propertyKey in object" from JavaScript. 678 | */ 679 | JS_EXPORT bool JSObjectHasPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 680 | 681 | /*! 682 | @function 683 | @abstract Gets a property from an object using a JSValueRef as the property key. 684 | @param ctx The execution context to use. 685 | @param object The JSObject whose property you want to get. 686 | @param propertyKey A JSValueRef containing the property key to use when looking up the property. 687 | @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. 688 | @result The property's value if object has the property key, otherwise the undefined value. 689 | @discussion This function is the same as performing "object[propertyKey]" from JavaScript. 690 | */ 691 | JS_EXPORT JSValueRef JSObjectGetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 692 | 693 | /*! 694 | @function 695 | @abstract Sets a property on an object using a JSValueRef as the property key. 696 | @param ctx The execution context to use. 697 | @param object The JSObject whose property you want to set. 698 | @param propertyKey A JSValueRef containing the property key to use when looking up the property. 699 | @param value A JSValueRef to use as the property's value. 700 | @param attributes A logically ORed set of JSPropertyAttributes to give to the property. 701 | @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. 702 | @discussion This function is the same as performing "object[propertyKey] = value" from JavaScript. 703 | */ 704 | JS_EXPORT void JSObjectSetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 705 | 706 | /*! 707 | @function 708 | @abstract Deletes a property from an object using a JSValueRef as the property key. 709 | @param ctx The execution context to use. 710 | @param object The JSObject whose property you want to delete. 711 | @param propertyKey A JSValueRef containing the property key to use when looking up the property. 712 | @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. 713 | @result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). 714 | @discussion This function is the same as performing "delete object[propertyKey]" from JavaScript. 715 | */ 716 | JS_EXPORT bool JSObjectDeletePropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macos(10.15), ios(13.0)); 717 | 718 | /*! 719 | @function 720 | @abstract Gets a property from an object by numeric index. 721 | @param ctx The execution context to use. 722 | @param object The JSObject whose property you want to get. 723 | @param propertyIndex An integer value that is the property's name. 724 | @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. 725 | @result The property's value if object has the property, otherwise the undefined value. 726 | @discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties. 727 | */ 728 | JS_EXPORT JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception); 729 | 730 | /*! 731 | @function 732 | @abstract Sets a property on an object by numeric index. 733 | @param ctx The execution context to use. 734 | @param object The JSObject whose property you want to set. 735 | @param propertyIndex The property's name as a number. 736 | @param value A JSValue to use as the property's value. 737 | @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. 738 | @discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties. 739 | */ 740 | JS_EXPORT void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception); 741 | 742 | /*! 743 | @function 744 | @abstract Gets an object's private data. 745 | @param object A JSObject whose private data you want to get. 746 | @result A void* that is the object's private data, if the object has private data, otherwise NULL. 747 | */ 748 | JS_EXPORT void* JSObjectGetPrivate(JSObjectRef object); 749 | 750 | /*! 751 | @function 752 | @abstract Sets a pointer to private data on an object. 753 | @param object The JSObject whose private data you want to set. 754 | @param data A void* to set as the object's private data. 755 | @result true if object can store private data, otherwise false. 756 | @discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data. 757 | */ 758 | JS_EXPORT bool JSObjectSetPrivate(JSObjectRef object, void* data); 759 | 760 | /*! 761 | @function 762 | @abstract Tests whether an object can be called as a function. 763 | @param ctx The execution context to use. 764 | @param object The JSObject to test. 765 | @result true if the object can be called as a function, otherwise false. 766 | */ 767 | JS_EXPORT bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object); 768 | 769 | /*! 770 | @function 771 | @abstract Calls an object as a function. 772 | @param ctx The execution context to use. 773 | @param object The JSObject to call as a function. 774 | @param thisObject The object to use as "this," or NULL to use the global object as "this." 775 | @param argumentCount An integer count of the number of arguments in arguments. 776 | @param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0. 777 | @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. 778 | @result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function. 779 | */ 780 | JS_EXPORT JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 781 | 782 | /*! 783 | @function 784 | @abstract Tests whether an object can be called as a constructor. 785 | @param ctx The execution context to use. 786 | @param object The JSObject to test. 787 | @result true if the object can be called as a constructor, otherwise false. 788 | */ 789 | JS_EXPORT bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object); 790 | 791 | /*! 792 | @function 793 | @abstract Calls an object as a constructor. 794 | @param ctx The execution context to use. 795 | @param object The JSObject to call as a constructor. 796 | @param argumentCount An integer count of the number of arguments in arguments. 797 | @param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. 798 | @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. 799 | @result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor. 800 | */ 801 | JS_EXPORT JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); 802 | 803 | /*! 804 | @function 805 | @abstract Gets the names of an object's enumerable properties. 806 | @param ctx The execution context to use. 807 | @param object The object whose property names you want to get. 808 | @result A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule. 809 | */ 810 | JS_EXPORT JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object); 811 | 812 | /*! 813 | @function 814 | @abstract Retains a JavaScript property name array. 815 | @param array The JSPropertyNameArray to retain. 816 | @result A JSPropertyNameArray that is the same as array. 817 | */ 818 | JS_EXPORT JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array); 819 | 820 | /*! 821 | @function 822 | @abstract Releases a JavaScript property name array. 823 | @param array The JSPropetyNameArray to release. 824 | */ 825 | JS_EXPORT void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array); 826 | 827 | /*! 828 | @function 829 | @abstract Gets a count of the number of items in a JavaScript property name array. 830 | @param array The array from which to retrieve the count. 831 | @result An integer count of the number of names in array. 832 | */ 833 | JS_EXPORT size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array); 834 | 835 | /*! 836 | @function 837 | @abstract Gets a property name at a given index in a JavaScript property name array. 838 | @param array The array from which to retrieve the property name. 839 | @param index The index of the property name to retrieve. 840 | @result A JSStringRef containing the property name. 841 | */ 842 | JS_EXPORT JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index); 843 | 844 | /*! 845 | @function 846 | @abstract Adds a property name to a JavaScript property name accumulator. 847 | @param accumulator The accumulator object to which to add the property name. 848 | @param propertyName The property name to add. 849 | */ 850 | JS_EXPORT void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName); 851 | 852 | #ifdef __cplusplus 853 | } 854 | #endif 855 | 856 | #endif /* JSObjectRef_h */ 857 | --------------------------------------------------------------------------------