2 * Copyright 2012 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
43 static inline jsval_t jsval_bool(BOOL b)
51 static inline jsval_t jsval_string(BSTR str)
54 ret.type = JSV_STRING;
59 static inline jsval_t jsval_disp(IDispatch *obj)
62 ret.type = JSV_OBJECT;
67 static inline jsval_t jsval_obj(jsdisp_t *obj)
69 return jsval_disp(to_disp(obj));
72 static inline jsval_t jsval_null(void)
74 jsval_t ret = { JSV_NULL };
78 static inline jsval_t jsval_undefined(void)
80 jsval_t ret = { JSV_UNDEFINED };
84 static inline jsval_t jsval_number(double n)
87 ret.type = JSV_NUMBER;
92 static inline BOOL is_object_instance(jsval_t v)
94 return v.type == JSV_OBJECT;
97 static inline BOOL is_undefined(jsval_t v)
99 return v.type == JSV_UNDEFINED;
102 static inline BOOL is_null(jsval_t v)
104 return v.type == JSV_NULL;
107 static inline BOOL is_null_instance(jsval_t v)
109 return v.type == JSV_NULL || (v.type == JSV_OBJECT && !v.u.obj);
112 static inline BOOL is_string(jsval_t v)
114 return v.type == JSV_STRING;
117 static inline BOOL is_number(jsval_t v)
119 return v.type == JSV_NUMBER;
122 static inline BOOL is_variant(jsval_t v)
124 return v.type == JSV_VARIANT;
127 static inline BOOL is_bool(jsval_t v)
129 return v.type == JSV_BOOL;
132 static inline IDispatch *get_object(jsval_t v)
137 static inline double get_number(jsval_t v)
142 static inline BSTR get_string(jsval_t v)
147 static inline VARIANT *get_variant(jsval_t v)
152 static inline BOOL get_bool(jsval_t v)
157 HRESULT variant_to_jsval(VARIANT*,jsval_t*) DECLSPEC_HIDDEN;
158 HRESULT jsval_to_variant(jsval_t,VARIANT*) DECLSPEC_HIDDEN;
159 void jsval_release(jsval_t) DECLSPEC_HIDDEN;
160 HRESULT jsval_variant(jsval_t*,VARIANT*) DECLSPEC_HIDDEN;
161 HRESULT jsval_copy(jsval_t,jsval_t*) DECLSPEC_HIDDEN;