| 1 | /* |
| 2 | * Copyright (C) 2006 Apple Computer, 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 COMPUTER, 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 COMPUTER, 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 APICast_h |
| 27 | #define APICast_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h:27:9`! |
| 28 | |
| 29 | #include "JSAPIValueWrapper.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSAPIValueWrapper.h`/ |
| 30 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 31 | #include "JSValue.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h`/ |
| 32 | #include <wtf/Platform.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/ |
| 33 | #include <wtf/UnusedParam.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h`/ |
| 34 | |
| 35 | namespace JSCcxx . . $ QTJSC/ { |
| 36 | class ExecStatecxx . . $ QTJSC/ExecState#; |
| 37 | class PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#; |
| 38 | class JSGlobalDatacxx . . $ QTJSC/JSGlobalData#; |
| 39 | class JSObjectcxx . . $ QTJSC/JSObject#; |
| 40 | class JSValuecxx . . $ QTJSC/JSValue#; |
| 41 | } |
| 42 | |
| 43 | typedef const struct OpaqueJSContextGroupcxx . . $ OpaqueJSContextGroup#* JSContextGroupRefcxx . . $ JSContextGroupRef#; |
| 44 | typedef const struct OpaqueJSContextcxx . . $ OpaqueJSContext#* JSContextRefcxx . . $ JSContextRef#; |
| 45 | typedef struct OpaqueJSContextcxx . . $ OpaqueJSContext#* JSGlobalContextRefcxx . . $ JSGlobalContextRef#; |
| 46 | typedef struct OpaqueJSPropertyNameAccumulatorcxx . . $ OpaqueJSPropertyNameAccumulator#* JSPropertyNameAccumulatorRefcxx . . $ JSPropertyNameAccumulatorRef#; |
| 47 | typedef const struct OpaqueJSValuecxx . . $ OpaqueJSValue#* JSValueRefcxx . . $ JSValueRef#; |
| 48 | typedef struct OpaqueJSValuecxx . . $ OpaqueJSValue#* JSObjectRefcxx . . $ JSObjectRef#; |
| 49 | |
| 50 | /* Opaque typing convenience methods */ |
| 51 | |
| 52 | inline JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#* toJScxx . . $ toJS(f59d9eed7d59fe2c).(JSContextRefcxx . . $ JSContextRef# c) |
| 53 | { |
| 54 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(c); |
| 55 | return reinterpret_cast<JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#*>(const_cast<OpaqueJSContextcxx . . $ OpaqueJSContext#*>(c)); |
| 56 | } |
| 57 | |
| 58 | inline JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#* toJScxx . . $ toJS(9aa0b3d2bc733a67).(JSGlobalContextRefcxx . . $ JSGlobalContextRef# c) |
| 59 | { |
| 60 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(c); |
| 61 | return reinterpret_cast<JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#*>(c); |
| 62 | } |
| 63 | |
| 64 | inline JSCcxx . . $ `<built-in>:463:9`!::JSValuecxx . . $ QTJSC/JSValue# toJScxx . . $ toJS(c1f9d3957c3f3cd7).(JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValueRefcxx . . $ JSValueRef# v) |
| 65 | { |
| 66 | ASSERT_UNUSEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:186:9`!(exec, exec); |
| 67 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(v); |
| 68 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(JSVALUE32_64) |
| 69 | JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v)); |
| 70 | if (!jsCell) |
| 71 | return JSC::JSValue(); |
| 72 | if (jsCell->isAPIValueWrapper()) |
| 73 | return static_cast<JSC::JSAPIValueWrapper*>(jsCell)->value(); |
| 74 | return jsCell; |
| 75 | #else |
| 76 | return JSCcxx . . $ `<built-in>:463:9`!::JSValuecxx . . $ QTJSC/JSValue#::decodecxx . . $ QTJSC/JSValue#decode(921aba6f6725337d).(reinterpret_cast<JSCcxx . . $ `<built-in>:463:9`!::EncodedJSValuecxx . . $ QTJSC/EncodedJSValue#>(const_cast<OpaqueJSValuecxx . . $ OpaqueJSValue#*>(v))); |
| 77 | #endif |
| 78 | } |
| 79 | |
| 80 | inline JSCcxx . . $ QTJSC/::JSValuecxx . . $ QTJSC/JSValue# toJSForGCcxx . . $ toJSForGC(c1f9d3957c3f3cd7).(JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValueRefcxx . . $ JSValueRef# v) |
| 81 | { |
| 82 | ASSERT_UNUSEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:186:9`!(exec, exec); |
| 83 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(v); |
| 84 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(JSVALUE32_64) |
| 85 | JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v)); |
| 86 | if (!jsCell) |
| 87 | return JSC::JSValue(); |
| 88 | return jsCell; |
| 89 | #else |
| 90 | return JSCcxx . . $ QTJSC/::JSValuecxx . . $ QTJSC/JSValue#::decodecxx . . $ QTJSC/JSValue#decode(921aba6f6725337d).(reinterpret_cast<JSCcxx . . $ `<built-in>:463:9`!::EncodedJSValuecxx . . $ QTJSC/EncodedJSValue#>(const_cast<OpaqueJSValuecxx . . $ OpaqueJSValue#*>(v))); |
| 91 | #endif |
| 92 | } |
| 93 | |
| 94 | inline JSCcxx . . $ `<built-in>:463:9`!::JSObjectcxx . . $ QTJSC/JSObject#* toJScxx . . $ toJS(a8374ff494b0ca9c).(JSObjectRefcxx . . $ JSObjectRef# o) |
| 95 | { |
| 96 | return reinterpret_cast<JSCcxx . . $ `<built-in>:463:9`!::JSObjectcxx . . $ QTJSC/JSObject#*>(o); |
| 97 | } |
| 98 | |
| 99 | inline JSCcxx . . $ QTJSC/::PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#* toJScxx . . $ toJS(bb1dcb6cf638bc89).(JSPropertyNameAccumulatorRefcxx . . $ JSPropertyNameAccumulatorRef# a) |
| 100 | { |
| 101 | return reinterpret_cast<JSCcxx . . $ `<built-in>:463:9`!::PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#*>(a); |
| 102 | } |
| 103 | |
| 104 | inline JSCcxx . . $ `<built-in>:463:9`!::JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* toJScxx . . $ toJS(dd2920ba27487f28).(JSContextGroupRefcxx . . $ JSContextGroupRef# g) |
| 105 | { |
| 106 | return reinterpret_cast<JSCcxx . . $ QTJSC/::JSGlobalDatacxx . . $ QTJSC/JSGlobalData#*>(const_cast<OpaqueJSContextGroupcxx . . $ OpaqueJSContextGroup#*>(g)); |
| 107 | } |
| 108 | |
| 109 | inline JSValueRefcxx . . $ JSValueRef# toRefcxx . . $ toRef(df99c259cd5b7643).(JSCcxx . . $ QTJSC/::ExecStatecxx . . $ QTJSC/ExecState#* exec, JSCcxx . . $ QTJSC/::JSValuecxx . . $ QTJSC/JSValue# v) |
| 110 | { |
| 111 | #if USEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:55:9`!(JSVALUE32_64) |
| 112 | if (!v) |
| 113 | return 0; |
| 114 | if (!v.isCell()) |
| 115 | return reinterpret_cast<JSValueRef>(asCell(JSC::jsAPIValueWrapper(exec, v))); |
| 116 | return reinterpret_cast<JSValueRef>(asCell(v)); |
| 117 | #else |
| 118 | UNUSED_PARAMcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h:27:9`!(exec); |
| 119 | return reinterpret_cast<JSValueRefcxx . . $ JSValueRef#>(JSCcxx . . $ QTJSC/::JSValuecxx . . $ QTJSC/JSValue#::encodecxx . . $ QTJSC/JSValue#encode(48544357535317c5).(v)); |
| 120 | #endif |
| 121 | } |
| 122 | |
| 123 | inline JSObjectRefcxx . . $ JSObjectRef# toRefcxx . . $ toRef(d2164949e0d73831).(JSCcxx . . $ QTJSC/::JSObjectcxx . . $ QTJSC/JSObject#* o) |
| 124 | { |
| 125 | return reinterpret_cast<JSObjectRefcxx . . $ JSObjectRef#>(o); |
| 126 | } |
| 127 | |
| 128 | inline JSObjectRefcxx . . $ JSObjectRef# toRefcxx . . $ toRef(2a1143cc825aac90).(const JSCcxx . . $ `<built-in>:463:9`!::JSObjectcxx . . $ QTJSC/JSObject#* o) |
| 129 | { |
| 130 | return reinterpret_cast<JSObjectRefcxx . . $ JSObjectRef#>(const_cast<JSCcxx . . $ `<built-in>:463:9`!::JSObjectcxx . . $ QTJSC/JSObject#*>(o)); |
| 131 | } |
| 132 | |
| 133 | inline JSContextRefcxx . . $ JSContextRef# toRefcxx . . $ toRef(90ae1fbacdaa4c37).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState#* e) |
| 134 | { |
| 135 | return reinterpret_cast<JSContextRefcxx . . $ JSContextRef#>(e); |
| 136 | } |
| 137 | |
| 138 | inline JSGlobalContextRefcxx . . $ JSGlobalContextRef# toGlobalRefcxx . . $ toGlobalRef(7c36b1a9a86a63ea).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState#* e) |
| 139 | { |
| 140 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(e == e->lexicalGlobalObject()->globalExec()); |
| 141 | return reinterpret_cast<JSGlobalContextRefcxx . . $ JSGlobalContextRef#>(e); |
| 142 | } |
| 143 | |
| 144 | inline JSPropertyNameAccumulatorRefcxx . . $ JSPropertyNameAccumulatorRef# toRefcxx . . $ toRef(a3a0aaa39c54fbf3).(JSCcxx . . $ QTJSC/::PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#* l) |
| 145 | { |
| 146 | return reinterpret_cast<JSPropertyNameAccumulatorRefcxx . . $ JSPropertyNameAccumulatorRef#>(l); |
| 147 | } |
| 148 | |
| 149 | inline JSContextGroupRefcxx . . $ JSContextGroupRef# toRefcxx . . $ toRef(c44cefdcd7666f07).(JSCcxx . . $ QTJSC/::JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* g) |
| 150 | { |
| 151 | return reinterpret_cast<JSContextGroupRefcxx . . $ JSContextGroupRef#>(g); |
| 152 | } |
| 153 | |
| 154 | #endif // APICast_h |