NetSurf
duktape.h
Go to the documentation of this file.
1/*
2 * Duktape public API for Duktape 2.7.0.
3 *
4 * See the API reference for documentation on call semantics. The exposed,
5 * supported API is between the "BEGIN PUBLIC API" and "END PUBLIC API"
6 * comments. Other parts of the header are Duktape internal and related to
7 * e.g. platform/compiler/feature detection.
8 *
9 * Git commit external (external).
10 * Git branch external.
11 *
12 * See Duktape AUTHORS.rst and LICENSE.txt for copyright and
13 * licensing information.
14 */
15
16/* LICENSE.txt */
17/*
18 * ===============
19 * Duktape license
20 * ===============
21 *
22 * (http://opensource.org/licenses/MIT)
23 *
24 * Copyright (c) 2013-present by Duktape authors (see AUTHORS.rst)
25 *
26 * Permission is hereby granted, free of charge, to any person obtaining a copy
27 * of this software and associated documentation files (the "Software"), to deal
28 * in the Software without restriction, including without limitation the rights
29 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30 * copies of the Software, and to permit persons to whom the Software is
31 * furnished to do so, subject to the following conditions:
32 *
33 * The above copyright notice and this permission notice shall be included in
34 * all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42 * THE SOFTWARE.
43 */
44
45/* AUTHORS.rst */
46/*
47 * ===============
48 * Duktape authors
49 * ===============
50 *
51 * Copyright
52 * =========
53 *
54 * Duktape copyrights are held by its authors. Each author has a copyright
55 * to their contribution, and agrees to irrevocably license the contribution
56 * under the Duktape ``LICENSE.txt``.
57 *
58 * Authors
59 * =======
60 *
61 * Please include an e-mail address, a link to your GitHub profile, or something
62 * similar to allow your contribution to be identified accurately.
63 *
64 * The following people have contributed code, website contents, or Wiki contents,
65 * and agreed to irrevocably license their contributions under the Duktape
66 * ``LICENSE.txt`` (in order of appearance):
67 *
68 * * Sami Vaarala <sami.vaarala@iki.fi>
69 * * Niki Dobrev
70 * * Andreas \u00d6man <andreas@lonelycoder.com>
71 * * L\u00e1szl\u00f3 Lang\u00f3 <llango.u-szeged@partner.samsung.com>
72 * * Legimet <legimet.calc@gmail.com>
73 * * Karl Skomski <karl@skomski.com>
74 * * Bruce Pascoe <fatcerberus1@gmail.com>
75 * * Ren\u00e9 Hollander <rene@rene8888.at>
76 * * Julien Hamaide (https://github.com/crazyjul)
77 * * Sebastian G\u00f6tte (https://github.com/jaseg)
78 * * Tomasz Magulski (https://github.com/magul)
79 * * \D. Bohdan (https://github.com/dbohdan)
80 * * Ond\u0159ej Jirman (https://github.com/megous)
81 * * Sa\u00fal Ibarra Corretg\u00e9 <saghul@gmail.com>
82 * * Jeremy HU <huxingyi@msn.com>
83 * * Ole Andr\u00e9 Vadla Ravn\u00e5s (https://github.com/oleavr)
84 * * Harold Brenes (https://github.com/harold-b)
85 * * Oliver Crow (https://github.com/ocrow)
86 * * Jakub Ch\u0142api\u0144ski (https://github.com/jchlapinski)
87 * * Brett Vickers (https://github.com/beevik)
88 * * Dominik Okwieka (https://github.com/okitec)
89 * * Remko Tron\u00e7on (https://el-tramo.be)
90 * * Romero Malaquias (rbsm@ic.ufal.br)
91 * * Michael Drake <michael.drake@codethink.co.uk>
92 * * Steven Don (https://github.com/shdon)
93 * * Simon Stone (https://github.com/sstone1)
94 * * \J. McC. (https://github.com/jmhmccr)
95 * * Jakub Nowakowski (https://github.com/jimvonmoon)
96 * * Tommy Nguyen (https://github.com/tn0502)
97 * * Fabrice Fontaine (https://github.com/ffontaine)
98 * * Christopher Hiller (https://github.com/boneskull)
99 * * Gonzalo Diethelm (https://github.com/gonzus)
100 * * Michal Kasperek (https://github.com/michalkas)
101 * * Andrew Janke (https://github.com/apjanke)
102 * * Steve Fan (https://github.com/stevefan1999)
103 * * Edward Betts (https://github.com/edwardbetts)
104 * * Ozhan Duz (https://github.com/webfolderio)
105 * * Akos Kiss (https://github.com/akosthekiss)
106 * * TheBrokenRail (https://github.com/TheBrokenRail)
107 * * Jesse Doyle (https://github.com/jessedoyle)
108 * * Gero Kuehn (https://github.com/dc6jgk)
109 * * James Swift (https://github.com/phraemer)
110 * * Luis de Bethencourt (https://github.com/luisbg)
111 * * Ian Whyman (https://github.com/v00d00)
112 * * Rick Sayre (https://github.com/whorfin)
113 * * Craig Leres (https://github.com/leres)
114 * * Maurici Abad (https://github.com/mauriciabad)
115 * * Nancy Li (https://github.com/NancyLi1013)
116 * * William Parks (https://github.com/WilliamParks)
117 * * Sam Hellawell (https://github.com/samhellawell)
118 * * Vladislavs Sokurenko (https://github.com/sokurenko)
119 *
120 * Other contributions
121 * ===================
122 *
123 * The following people have contributed something other than code (e.g. reported
124 * bugs, provided ideas, etc; roughly in order of appearance):
125 *
126 * * Greg Burns
127 * * Anthony Rabine
128 * * Carlos Costa
129 * * Aur\u00e9lien Bouilland
130 * * Preet Desai (Pris Matic)
131 * * judofyr (http://www.reddit.com/user/judofyr)
132 * * Jason Woofenden
133 * * Micha\u0142 Przyby\u015b
134 * * Anthony Howe
135 * * Conrad Pankoff
136 * * Jim Schimpf
137 * * Rajaran Gaunker (https://github.com/zimbabao)
138 * * Andreas \u00d6man
139 * * Doug Sanden
140 * * Josh Engebretson (https://github.com/JoshEngebretson)
141 * * Remo Eichenberger (https://github.com/remoe)
142 * * Mamod Mehyar (https://github.com/mamod)
143 * * David Demelier (https://github.com/markand)
144 * * Tim Caswell (https://github.com/creationix)
145 * * Mitchell Blank Jr (https://github.com/mitchblank)
146 * * https://github.com/yushli
147 * * Seo Sanghyeon (https://github.com/sanxiyn)
148 * * Han ChoongWoo (https://github.com/tunz)
149 * * Joshua Peek (https://github.com/josh)
150 * * Bruce E. Pascoe (https://github.com/fatcerberus)
151 * * https://github.com/Kelledin
152 * * https://github.com/sstruchtrup
153 * * Michael Drake (https://github.com/tlsa)
154 * * https://github.com/chris-y
155 * * Laurent Zubiaur (https://github.com/lzubiaur)
156 * * Neil Kolban (https://github.com/nkolban)
157 * * Wilhelm Wanecek (https://github.com/wanecek)
158 * * Andrew Janke (https://github.com/apjanke)
159 * * Unamer (https://github.com/unamer)
160 * * Karl Dahlke (eklhad@gmail.com)
161 *
162 * If you are accidentally missing from this list, send me an e-mail
163 * (``sami.vaarala@iki.fi``) and I'll fix the omission.
164 */
165
166#if !defined(DUKTAPE_H_INCLUDED)
167#define DUKTAPE_H_INCLUDED
168
169#define DUK_SINGLE_FILE
170
171/*
172 * BEGIN PUBLIC API
173 */
174
175/*
176 * Version and Git commit identification
177 */
178
179/* Duktape version, (major * 10000) + (minor * 100) + patch. Allows C code
180 * to #if (DUK_VERSION >= NNN) against Duktape API version. The same value
181 * is also available to ECMAScript code in Duktape.version. Unofficial
182 * development snapshots have 99 for patch level (e.g. 0.10.99 would be a
183 * development version after 0.10.0 but before the next official release).
184 */
185#define DUK_VERSION 20700L
186
187/* Git commit, describe, and branch for Duktape build. Useful for
188 * non-official snapshot builds so that application code can easily log
189 * which Duktape snapshot was used. Not available in the ECMAScript
190 * environment.
191 */
192#define DUK_GIT_COMMIT "external"
193#define DUK_GIT_DESCRIBE "external"
194#define DUK_GIT_BRANCH "external"
195
196/* External duk_config.h provides platform/compiler/OS dependent
197 * typedefs and macros, and DUK_USE_xxx config options so that
198 * the rest of Duktape doesn't need to do any feature detection.
199 * DUK_VERSION is defined before including so that configuration
200 * snippets can react to it.
201 */
202#include "duk_config.h"
203
204/*
205 * Avoid C++ name mangling
206 */
207
208#if defined(__cplusplus)
209extern "C" {
210#endif
211
212/*
213 * Some defines forwarded from feature detection
214 */
215
216#undef DUK_API_VARIADIC_MACROS
217#if defined(DUK_USE_VARIADIC_MACROS)
218#define DUK_API_VARIADIC_MACROS
219#endif
220
221#define DUK_API_NORETURN(decl) DUK_NORETURN(decl)
222
223/*
224 * Public API specific typedefs
225 *
226 * Many types are wrapped by Duktape for portability to rare platforms
227 * where e.g. 'int' is a 16-bit type. See practical typing discussion
228 * in Duktape web documentation.
229 */
230
231struct duk_thread_state;
236
237/* duk_context is now defined in duk_config.h because it may also be
238 * referenced there by prototypes.
239 */
245
247typedef void *(*duk_alloc_function) (void *udata, duk_size_t size);
248typedef void *(*duk_realloc_function) (void *udata, void *ptr, duk_size_t size);
249typedef void (*duk_free_function) (void *udata, void *ptr);
250typedef void (*duk_fatal_function) (void *udata, const char *msg);
251typedef void (*duk_decode_char_function) (void *udata, duk_codepoint_t codepoint);
252typedef duk_codepoint_t (*duk_map_char_function) (void *udata, duk_codepoint_t codepoint);
253typedef duk_ret_t (*duk_safe_call_function) (duk_context *ctx, void *udata);
254typedef duk_size_t (*duk_debug_read_function) (void *udata, char *buffer, duk_size_t length);
255typedef duk_size_t (*duk_debug_write_function) (void *udata, const char *buffer, duk_size_t length);
256typedef duk_size_t (*duk_debug_peek_function) (void *udata);
257typedef void (*duk_debug_read_flush_function) (void *udata);
258typedef void (*duk_debug_write_flush_function) (void *udata);
259typedef duk_idx_t (*duk_debug_request_function) (duk_context *ctx, void *udata, duk_idx_t nvalues);
260typedef void (*duk_debug_detached_function) (duk_context *ctx, void *udata);
261
263 /* XXX: Enough space to hold internal suspend/resume structure.
264 * This is rather awkward and to be fixed when the internal
265 * structure is visible for the public API header.
266 */
267 char data[128];
268};
269
274 void *udata;
275};
276
278 const char *key;
281};
282
284 const char *key;
286};
287
289 duk_double_t year; /* year, e.g. 2016, ECMAScript year range */
290 duk_double_t month; /* month: 1-12 */
291 duk_double_t day; /* day: 1-31 */
292 duk_double_t hours; /* hour: 0-59 */
293 duk_double_t minutes; /* minute: 0-59 */
294 duk_double_t seconds; /* second: 0-59 (in POSIX time no leap second) */
295 duk_double_t milliseconds; /* may contain sub-millisecond fractions */
296 duk_double_t weekday; /* weekday: 0-6, 0=Sunday, 1=Monday, ..., 6=Saturday */
297};
298
299/*
300 * Constants
301 */
302
303/* Duktape debug protocol version used by this build. */
304#define DUK_DEBUG_PROTOCOL_VERSION 2
305
306/* Used to represent invalid index; if caller uses this without checking,
307 * this index will map to a non-existent stack entry. Also used in some
308 * API calls as a marker to denote "no value".
309 */
310#define DUK_INVALID_INDEX DUK_IDX_MIN
311
312/* Indicates that a native function does not have a fixed number of args,
313 * and the argument stack should not be capped/extended at all.
314 */
315#define DUK_VARARGS ((duk_int_t) (-1))
316
317/* Number of value stack entries (in addition to actual call arguments)
318 * guaranteed to be allocated on entry to a Duktape/C function.
319 */
320#define DUK_API_ENTRY_STACK 64U
321
322/* Value types, used by e.g. duk_get_type() */
323#define DUK_TYPE_MIN 0U
324#define DUK_TYPE_NONE 0U /* no value, e.g. invalid index */
325#define DUK_TYPE_UNDEFINED 1U /* ECMAScript undefined */
326#define DUK_TYPE_NULL 2U /* ECMAScript null */
327#define DUK_TYPE_BOOLEAN 3U /* ECMAScript boolean: 0 or 1 */
328#define DUK_TYPE_NUMBER 4U /* ECMAScript number: double */
329#define DUK_TYPE_STRING 5U /* ECMAScript string: CESU-8 / extended UTF-8 encoded */
330#define DUK_TYPE_OBJECT 6U /* ECMAScript object: includes objects, arrays, functions, threads */
331#define DUK_TYPE_BUFFER 7U /* fixed or dynamic, garbage collected byte buffer */
332#define DUK_TYPE_POINTER 8U /* raw void pointer */
333#define DUK_TYPE_LIGHTFUNC 9U /* lightweight function pointer */
334#define DUK_TYPE_MAX 9U
335
336/* Value mask types, used by e.g. duk_get_type_mask() */
337#define DUK_TYPE_MASK_NONE (1U << DUK_TYPE_NONE)
338#define DUK_TYPE_MASK_UNDEFINED (1U << DUK_TYPE_UNDEFINED)
339#define DUK_TYPE_MASK_NULL (1U << DUK_TYPE_NULL)
340#define DUK_TYPE_MASK_BOOLEAN (1U << DUK_TYPE_BOOLEAN)
341#define DUK_TYPE_MASK_NUMBER (1U << DUK_TYPE_NUMBER)
342#define DUK_TYPE_MASK_STRING (1U << DUK_TYPE_STRING)
343#define DUK_TYPE_MASK_OBJECT (1U << DUK_TYPE_OBJECT)
344#define DUK_TYPE_MASK_BUFFER (1U << DUK_TYPE_BUFFER)
345#define DUK_TYPE_MASK_POINTER (1U << DUK_TYPE_POINTER)
346#define DUK_TYPE_MASK_LIGHTFUNC (1U << DUK_TYPE_LIGHTFUNC)
347#define DUK_TYPE_MASK_THROW (1U << 10) /* internal flag value: throw if mask doesn't match */
348#define DUK_TYPE_MASK_PROMOTE (1U << 11) /* internal flag value: promote to object if mask matches */
349
350/* Coercion hints */
351#define DUK_HINT_NONE 0 /* prefer number, unless input is a Date, in which
352 * case prefer string (E5 Section 8.12.8)
353 */
354#define DUK_HINT_STRING 1 /* prefer string */
355#define DUK_HINT_NUMBER 2 /* prefer number */
357/* Enumeration flags for duk_enum() */
358#define DUK_ENUM_INCLUDE_NONENUMERABLE (1U << 0) /* enumerate non-numerable properties in addition to enumerable */
359#define DUK_ENUM_INCLUDE_HIDDEN (1U << 1) /* enumerate hidden symbols too (in Duktape 1.x called internal properties) */
360#define DUK_ENUM_INCLUDE_SYMBOLS (1U << 2) /* enumerate symbols */
361#define DUK_ENUM_EXCLUDE_STRINGS (1U << 3) /* exclude strings */
362#define DUK_ENUM_OWN_PROPERTIES_ONLY (1U << 4) /* don't walk prototype chain, only check own properties */
363#define DUK_ENUM_ARRAY_INDICES_ONLY (1U << 5) /* only enumerate array indices */
364/* XXX: misleading name */
365#define DUK_ENUM_SORT_ARRAY_INDICES (1U << 6) /* sort array indices (applied to full enumeration result, including inherited array indices); XXX: misleading name */
366#define DUK_ENUM_NO_PROXY_BEHAVIOR (1U << 7) /* enumerate a proxy object itself without invoking proxy behavior */
367
368/* Compilation flags for duk_compile() and duk_eval() */
369/* DUK_COMPILE_xxx bits 0-2 are reserved for an internal 'nargs' argument.
370 */
371#define DUK_COMPILE_EVAL (1U << 3) /* compile eval code (instead of global code) */
372#define DUK_COMPILE_FUNCTION (1U << 4) /* compile function code (instead of global code) */
373#define DUK_COMPILE_STRICT (1U << 5) /* use strict (outer) context for global, eval, or function code */
374#define DUK_COMPILE_SHEBANG (1U << 6) /* allow shebang ('#! ...') comment on first line of source */
375#define DUK_COMPILE_SAFE (1U << 7) /* (internal) catch compilation errors */
376#define DUK_COMPILE_NORESULT (1U << 8) /* (internal) omit eval result */
377#define DUK_COMPILE_NOSOURCE (1U << 9) /* (internal) no source string on stack */
378#define DUK_COMPILE_STRLEN (1U << 10) /* (internal) take strlen() of src_buffer (avoids double evaluation in macro) */
379#define DUK_COMPILE_NOFILENAME (1U << 11) /* (internal) no filename on stack */
380#define DUK_COMPILE_FUNCEXPR (1U << 12) /* (internal) source is a function expression (used for Function constructor) */
382/* Flags for duk_def_prop() and its variants; base flags + a lot of convenience shorthands */
383#define DUK_DEFPROP_WRITABLE (1U << 0) /* set writable (effective if DUK_DEFPROP_HAVE_WRITABLE set) */
384#define DUK_DEFPROP_ENUMERABLE (1U << 1) /* set enumerable (effective if DUK_DEFPROP_HAVE_ENUMERABLE set) */
385#define DUK_DEFPROP_CONFIGURABLE (1U << 2) /* set configurable (effective if DUK_DEFPROP_HAVE_CONFIGURABLE set) */
386#define DUK_DEFPROP_HAVE_WRITABLE (1U << 3) /* set/clear writable */
387#define DUK_DEFPROP_HAVE_ENUMERABLE (1U << 4) /* set/clear enumerable */
388#define DUK_DEFPROP_HAVE_CONFIGURABLE (1U << 5) /* set/clear configurable */
389#define DUK_DEFPROP_HAVE_VALUE (1U << 6) /* set value (given on value stack) */
390#define DUK_DEFPROP_HAVE_GETTER (1U << 7) /* set getter (given on value stack) */
391#define DUK_DEFPROP_HAVE_SETTER (1U << 8) /* set setter (given on value stack) */
392#define DUK_DEFPROP_FORCE (1U << 9) /* force change if possible, may still fail for e.g. virtual properties */
393#define DUK_DEFPROP_SET_WRITABLE (DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_WRITABLE)
394#define DUK_DEFPROP_CLEAR_WRITABLE DUK_DEFPROP_HAVE_WRITABLE
395#define DUK_DEFPROP_SET_ENUMERABLE (DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE)
396#define DUK_DEFPROP_CLEAR_ENUMERABLE DUK_DEFPROP_HAVE_ENUMERABLE
397#define DUK_DEFPROP_SET_CONFIGURABLE (DUK_DEFPROP_HAVE_CONFIGURABLE | DUK_DEFPROP_CONFIGURABLE)
398#define DUK_DEFPROP_CLEAR_CONFIGURABLE DUK_DEFPROP_HAVE_CONFIGURABLE
399#define DUK_DEFPROP_W DUK_DEFPROP_WRITABLE
400#define DUK_DEFPROP_E DUK_DEFPROP_ENUMERABLE
401#define DUK_DEFPROP_C DUK_DEFPROP_CONFIGURABLE
402#define DUK_DEFPROP_WE (DUK_DEFPROP_WRITABLE | DUK_DEFPROP_ENUMERABLE)
403#define DUK_DEFPROP_WC (DUK_DEFPROP_WRITABLE | DUK_DEFPROP_CONFIGURABLE)
404#define DUK_DEFPROP_EC (DUK_DEFPROP_ENUMERABLE | DUK_DEFPROP_CONFIGURABLE)
405#define DUK_DEFPROP_WEC (DUK_DEFPROP_WRITABLE | DUK_DEFPROP_ENUMERABLE | DUK_DEFPROP_CONFIGURABLE)
406#define DUK_DEFPROP_HAVE_W DUK_DEFPROP_HAVE_WRITABLE
407#define DUK_DEFPROP_HAVE_E DUK_DEFPROP_HAVE_ENUMERABLE
408#define DUK_DEFPROP_HAVE_C DUK_DEFPROP_HAVE_CONFIGURABLE
409#define DUK_DEFPROP_HAVE_WE (DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_HAVE_ENUMERABLE)
410#define DUK_DEFPROP_HAVE_WC (DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_HAVE_CONFIGURABLE)
411#define DUK_DEFPROP_HAVE_EC (DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_HAVE_CONFIGURABLE)
412#define DUK_DEFPROP_HAVE_WEC (DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_HAVE_CONFIGURABLE)
413#define DUK_DEFPROP_SET_W DUK_DEFPROP_SET_WRITABLE
414#define DUK_DEFPROP_SET_E DUK_DEFPROP_SET_ENUMERABLE
415#define DUK_DEFPROP_SET_C DUK_DEFPROP_SET_CONFIGURABLE
416#define DUK_DEFPROP_SET_WE (DUK_DEFPROP_SET_WRITABLE | DUK_DEFPROP_SET_ENUMERABLE)
417#define DUK_DEFPROP_SET_WC (DUK_DEFPROP_SET_WRITABLE | DUK_DEFPROP_SET_CONFIGURABLE)
418#define DUK_DEFPROP_SET_EC (DUK_DEFPROP_SET_ENUMERABLE | DUK_DEFPROP_SET_CONFIGURABLE)
419#define DUK_DEFPROP_SET_WEC (DUK_DEFPROP_SET_WRITABLE | DUK_DEFPROP_SET_ENUMERABLE | DUK_DEFPROP_SET_CONFIGURABLE)
420#define DUK_DEFPROP_CLEAR_W DUK_DEFPROP_CLEAR_WRITABLE
421#define DUK_DEFPROP_CLEAR_E DUK_DEFPROP_CLEAR_ENUMERABLE
422#define DUK_DEFPROP_CLEAR_C DUK_DEFPROP_CLEAR_CONFIGURABLE
423#define DUK_DEFPROP_CLEAR_WE (DUK_DEFPROP_CLEAR_WRITABLE | DUK_DEFPROP_CLEAR_ENUMERABLE)
424#define DUK_DEFPROP_CLEAR_WC (DUK_DEFPROP_CLEAR_WRITABLE | DUK_DEFPROP_CLEAR_CONFIGURABLE)
425#define DUK_DEFPROP_CLEAR_EC (DUK_DEFPROP_CLEAR_ENUMERABLE | DUK_DEFPROP_CLEAR_CONFIGURABLE)
426#define DUK_DEFPROP_CLEAR_WEC (DUK_DEFPROP_CLEAR_WRITABLE | DUK_DEFPROP_CLEAR_ENUMERABLE | DUK_DEFPROP_CLEAR_CONFIGURABLE)
427#define DUK_DEFPROP_ATTR_W (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_W)
428#define DUK_DEFPROP_ATTR_E (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_E)
429#define DUK_DEFPROP_ATTR_C (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_C)
430#define DUK_DEFPROP_ATTR_WE (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_WE)
431#define DUK_DEFPROP_ATTR_WC (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_WC)
432#define DUK_DEFPROP_ATTR_EC (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_EC)
433#define DUK_DEFPROP_ATTR_WEC (DUK_DEFPROP_HAVE_WEC | DUK_DEFPROP_WEC)
435/* Flags for duk_push_thread_raw() */
436#define DUK_THREAD_NEW_GLOBAL_ENV (1U << 0) /* create a new global environment */
438/* Flags for duk_gc() */
439#define DUK_GC_COMPACT (1U << 0) /* compact heap objects */
441/* Error codes (must be 8 bits at most, see duk_error.h) */
442#define DUK_ERR_NONE 0 /* no error (e.g. from duk_get_error_code()) */
443#define DUK_ERR_ERROR 1 /* Error */
444#define DUK_ERR_EVAL_ERROR 2 /* EvalError */
445#define DUK_ERR_RANGE_ERROR 3 /* RangeError */
446#define DUK_ERR_REFERENCE_ERROR 4 /* ReferenceError */
447#define DUK_ERR_SYNTAX_ERROR 5 /* SyntaxError */
448#define DUK_ERR_TYPE_ERROR 6 /* TypeError */
449#define DUK_ERR_URI_ERROR 7 /* URIError */
451/* Return codes for C functions (shortcut for throwing an error) */
452#define DUK_RET_ERROR (-DUK_ERR_ERROR)
453#define DUK_RET_EVAL_ERROR (-DUK_ERR_EVAL_ERROR)
454#define DUK_RET_RANGE_ERROR (-DUK_ERR_RANGE_ERROR)
455#define DUK_RET_REFERENCE_ERROR (-DUK_ERR_REFERENCE_ERROR)
456#define DUK_RET_SYNTAX_ERROR (-DUK_ERR_SYNTAX_ERROR)
457#define DUK_RET_TYPE_ERROR (-DUK_ERR_TYPE_ERROR)
458#define DUK_RET_URI_ERROR (-DUK_ERR_URI_ERROR)
460/* Return codes for protected calls (duk_safe_call(), duk_pcall()) */
461#define DUK_EXEC_SUCCESS 0
462#define DUK_EXEC_ERROR 1
464/* Debug levels for DUK_USE_DEBUG_WRITE(). */
465#define DUK_LEVEL_DEBUG 0
466#define DUK_LEVEL_DDEBUG 1
467#define DUK_LEVEL_DDDEBUG 2
468
469/*
470 * Macros to create Symbols as C statically constructed strings.
471 *
472 * Call e.g. as DUK_HIDDEN_SYMBOL("myProperty") <=> ("\xFF" "myProperty").
473 *
474 * Local symbols have a unique suffix, caller should take care to avoid
475 * conflicting with the Duktape internal representation by e.g. prepending
476 * a '!' character: DUK_LOCAL_SYMBOL("myLocal", "!123").
477 *
478 * Note that these can only be used for string constants, not dynamically
479 * created strings.
480 *
481 * You shouldn't normally use DUK_INTERNAL_SYMBOL() at all. It is reserved
482 * for Duktape internal symbols only. There are no versioning guarantees
483 * for internal symbols.
484 */
486#define DUK_HIDDEN_SYMBOL(x) ("\xFF" x)
487#define DUK_GLOBAL_SYMBOL(x) ("\x80" x)
488#define DUK_LOCAL_SYMBOL(x,uniq) ("\x81" x "\xff" uniq)
489#define DUK_WELLKNOWN_SYMBOL(x) ("\x81" x "\xff")
490#define DUK_INTERNAL_SYMBOL(x) ("\x82" x)
491
492/*
493 * If no variadic macros, __FILE__ and __LINE__ are passed through globals
494 * which is ugly and not thread safe.
495 */
497#if !defined(DUK_API_VARIADIC_MACROS)
500#endif
501
502/*
503 * Context management
504 */
505
508 duk_realloc_function realloc_func,
509 duk_free_function free_func,
510 void *heap_udata,
511 duk_fatal_function fatal_handler);
513
516
517#define duk_create_heap_default() \
518 duk_create_heap(NULL, NULL, NULL, NULL, NULL)
519
520/*
521 * Memory management
522 *
523 * Raw functions have no side effects (cannot trigger GC).
524 */
525
527DUK_EXTERNAL_DECL void duk_free_raw(duk_context *ctx, void *ptr);
528DUK_EXTERNAL_DECL void *duk_realloc_raw(duk_context *ctx, void *ptr, duk_size_t size);
530DUK_EXTERNAL_DECL void duk_free(duk_context *ctx, void *ptr);
531DUK_EXTERNAL_DECL void *duk_realloc(duk_context *ctx, void *ptr, duk_size_t size);
534
535/*
536 * Error handling
537 */
540#define duk_throw(ctx) \
541 (duk_throw_raw((ctx)), (duk_ret_t) 0)
542DUK_API_NORETURN(DUK_EXTERNAL_DECL void duk_fatal_raw(duk_context *ctx, const char *err_msg));
543#define duk_fatal(ctx,err_msg) \
544 (duk_fatal_raw((ctx), (err_msg)), (duk_ret_t) 0)
545DUK_API_NORETURN(DUK_EXTERNAL_DECL void duk_error_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, ...));
546
547#if defined(DUK_API_VARIADIC_MACROS)
548#define duk_error(ctx,err_code,...) \
549 (duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
550#define duk_generic_error(ctx,...) \
551 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
552#define duk_eval_error(ctx,...) \
553 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_EVAL_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
554#define duk_range_error(ctx,...) \
555 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_RANGE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
556#define duk_reference_error(ctx,...) \
557 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_REFERENCE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
558#define duk_syntax_error(ctx,...) \
559 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_SYNTAX_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
560#define duk_type_error(ctx,...) \
561 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_TYPE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
562#define duk_uri_error(ctx,...) \
563 (duk_error_raw((ctx), (duk_errcode_t) DUK_ERR_URI_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
564#else /* DUK_API_VARIADIC_MACROS */
565/* For legacy compilers without variadic macros a macro hack is used to allow
566 * variable arguments. While the macro allows "return duk_error(...)", it
567 * will fail with e.g. "(void) duk_error(...)". The calls are noreturn but
568 * with a return value to allow the "return duk_error(...)" idiom. This may
569 * cause some compiler warnings, but without noreturn the generated code is
570 * often worse. The same approach as with variadic macros (using
571 * "(duk_error(...), 0)") won't work due to the macro hack structure.
572 */
581#define duk_error \
582 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
583 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
584 duk_error_stash) /* last value is func pointer, arguments follow in parens */
585#define duk_generic_error \
586 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
587 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
588 duk_generic_error_stash)
589#define duk_eval_error \
590 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
591 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
592 duk_eval_error_stash)
593#define duk_range_error \
594 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
595 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
596 duk_range_error_stash)
597#define duk_reference_error \
598 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
599 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
600 duk_reference_error_stash)
601#define duk_syntax_error \
602 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
603 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
604 duk_syntax_error_stash)
605#define duk_type_error \
606 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
607 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
608 duk_type_error_stash)
609#define duk_uri_error \
610 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
611 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
612 duk_uri_error_stash)
613#endif /* DUK_API_VARIADIC_MACROS */
614
615DUK_API_NORETURN(DUK_EXTERNAL_DECL void duk_error_va_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap));
616
617#define duk_error_va(ctx,err_code,fmt,ap) \
618 (duk_error_va_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
619#define duk_generic_error_va(ctx,fmt,ap) \
620 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
621#define duk_eval_error_va(ctx,fmt,ap) \
622 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_EVAL_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
623#define duk_range_error_va(ctx,fmt,ap) \
624 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_RANGE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
625#define duk_reference_error_va(ctx,fmt,ap) \
626 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_REFERENCE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
627#define duk_syntax_error_va(ctx,fmt,ap) \
628 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_SYNTAX_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
629#define duk_type_error_va(ctx,fmt,ap) \
630 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_TYPE_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
631#define duk_uri_error_va(ctx,fmt,ap) \
632 (duk_error_va_raw((ctx), (duk_errcode_t) DUK_ERR_URI_ERROR, (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap)), (duk_ret_t) 0)
633
634/*
635 * Other state related functions
636 */
637
640
641/*
642 * Stack management
643 */
644
649
654
655/* Although extra/top could be an unsigned type here, using a signed type
656 * makes the API more robust to calling code calculation errors or corner
657 * cases (where caller might occasionally come up with negative values).
658 * Negative values are treated as zero, which is better than casting them
659 * to a large unsigned number. (This principle is used elsewhere in the
660 * API too.)
661 */
666
667/*
668 * Stack manipulation (other than push/pop)
669 */
670
678DUK_EXTERNAL_DECL void duk_copy(duk_context *ctx, duk_idx_t from_idx, duk_idx_t to_idx);
681
682#define duk_xmove_top(to_ctx,from_ctx,count) \
683 duk_xcopymove_raw((to_ctx), (from_ctx), (count), 0 /*is_copy*/)
684#define duk_xcopy_top(to_ctx,from_ctx,count) \
685 duk_xcopymove_raw((to_ctx), (from_ctx), (count), 1 /*is_copy*/)
686
687/*
688 * Push operations
689 *
690 * Push functions return the absolute (relative to bottom of frame)
691 * position of the pushed value for convenience.
692 *
693 * Note: duk_dup() is technically a push.
694 */
695
705DUK_EXTERNAL_DECL const char *duk_push_string(duk_context *ctx, const char *str);
706DUK_EXTERNAL_DECL const char *duk_push_lstring(duk_context *ctx, const char *str, duk_size_t len);
708DUK_EXTERNAL_DECL const char *duk_push_sprintf(duk_context *ctx, const char *fmt, ...);
709DUK_EXTERNAL_DECL const char *duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap);
710
711/* duk_push_literal() may evaluate its argument (a C string literal) more than
712 * once on purpose. When speed is preferred, sizeof() avoids an unnecessary
713 * strlen() at runtime. Sizeof("foo") == 4, so subtract 1. The argument
714 * must be non-NULL and should not contain internal NUL characters as the
715 * behavior will then depend on config options.
716 */
717#if defined(DUK_USE_PREFER_SIZE)
718#define duk_push_literal(ctx,cstring) duk_push_string((ctx), (cstring))
719#else
720DUK_EXTERNAL_DECL const char *duk_push_literal_raw(duk_context *ctx, const char *str, duk_size_t len);
721#define duk_push_literal(ctx,cstring) duk_push_literal_raw((ctx), (cstring), sizeof((cstring)) - 1U)
722#endif
723
732
741
742#define duk_push_thread(ctx) \
743 duk_push_thread_raw((ctx), 0 /*flags*/)
744
745#define duk_push_thread_new_globalenv(ctx) \
746 duk_push_thread_raw((ctx), DUK_THREAD_NEW_GLOBAL_ENV /*flags*/)
747
748DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, ...);
749
750#if defined(DUK_API_VARIADIC_MACROS)
751#define duk_push_error_object(ctx,err_code,...) \
752 duk_push_error_object_raw((ctx), (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__)
753#else
755/* Note: parentheses are required so that the comma expression works in assignments. */
756#define duk_push_error_object \
757 (duk_api_global_filename = (const char *) (DUK_FILE_MACRO), \
758 duk_api_global_line = (duk_int_t) (DUK_LINE_MACRO), \
759 duk_push_error_object_stash) /* last value is func pointer, arguments follow in parens */
760#endif
762DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_va_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap);
763#define duk_push_error_object_va(ctx,err_code,fmt,ap) \
764 duk_push_error_object_va_raw((ctx), (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), (fmt), (ap))
766#define DUK_BUF_FLAG_DYNAMIC (1 << 0) /* internal flag: dynamic buffer */
767#define DUK_BUF_FLAG_EXTERNAL (1 << 1) /* internal flag: external buffer */
768#define DUK_BUF_FLAG_NOZERO (1 << 2) /* internal flag: don't zero allocated buffer */
769
771
772#define duk_push_buffer(ctx,size,dynamic) \
773 duk_push_buffer_raw((ctx), (size), (dynamic) ? DUK_BUF_FLAG_DYNAMIC : 0)
774#define duk_push_fixed_buffer(ctx,size) \
775 duk_push_buffer_raw((ctx), (size), 0 /*flags*/)
776#define duk_push_dynamic_buffer(ctx,size) \
777 duk_push_buffer_raw((ctx), (size), DUK_BUF_FLAG_DYNAMIC /*flags*/)
778#define duk_push_external_buffer(ctx) \
779 ((void) duk_push_buffer_raw((ctx), 0, DUK_BUF_FLAG_DYNAMIC | DUK_BUF_FLAG_EXTERNAL))
781#define DUK_BUFOBJ_ARRAYBUFFER 0
782#define DUK_BUFOBJ_NODEJS_BUFFER 1
783#define DUK_BUFOBJ_DATAVIEW 2
784#define DUK_BUFOBJ_INT8ARRAY 3
785#define DUK_BUFOBJ_UINT8ARRAY 4
786#define DUK_BUFOBJ_UINT8CLAMPEDARRAY 5
787#define DUK_BUFOBJ_INT16ARRAY 6
788#define DUK_BUFOBJ_UINT16ARRAY 7
789#define DUK_BUFOBJ_INT32ARRAY 8
790#define DUK_BUFOBJ_UINT32ARRAY 9
791#define DUK_BUFOBJ_FLOAT32ARRAY 10
792#define DUK_BUFOBJ_FLOAT64ARRAY 11
793
794DUK_EXTERNAL_DECL void duk_push_buffer_object(duk_context *ctx, duk_idx_t idx_buffer, duk_size_t byte_offset, duk_size_t byte_length, duk_uint_t flags);
795
797
798/*
799 * Pop operations
800 */
801
806
807/*
808 * Type checks
809 *
810 * duk_is_none(), which would indicate whether index it outside of stack,
811 * is not needed; duk_is_valid_index() gives the same information.
812 */
813
818
821#define duk_is_null_or_undefined(ctx, idx) \
822 ((duk_get_type_mask((ctx), (idx)) & (DUK_TYPE_MASK_NULL | DUK_TYPE_MASK_UNDEFINED)) ? 1 : 0)
823
833
841
842#define duk_is_callable(ctx,idx) \
843 duk_is_function((ctx), (idx))
845
849
850/* Buffers and lightfuncs are not considered primitive because they mimic
851 * objects and e.g. duk_to_primitive() will coerce them instead of returning
852 * them as is. Symbols are represented as strings internally.
853 */
854#define duk_is_primitive(ctx,idx) \
855 duk_check_type_mask((ctx), (idx), DUK_TYPE_MASK_UNDEFINED | \
856 DUK_TYPE_MASK_NULL | \
857 DUK_TYPE_MASK_BOOLEAN | \
858 DUK_TYPE_MASK_NUMBER | \
859 DUK_TYPE_MASK_STRING | \
860 DUK_TYPE_MASK_POINTER)
862/* Symbols are object coercible, covered by DUK_TYPE_MASK_STRING. */
863#define duk_is_object_coercible(ctx,idx) \
864 duk_check_type_mask((ctx), (idx), DUK_TYPE_MASK_BOOLEAN | \
865 DUK_TYPE_MASK_NUMBER | \
866 DUK_TYPE_MASK_STRING | \
867 DUK_TYPE_MASK_OBJECT | \
868 DUK_TYPE_MASK_BUFFER | \
869 DUK_TYPE_MASK_POINTER | \
870 DUK_TYPE_MASK_LIGHTFUNC)
873#define duk_is_error(ctx,idx) \
874 (duk_get_error_code((ctx), (idx)) != 0)
875#define duk_is_eval_error(ctx,idx) \
876 (duk_get_error_code((ctx), (idx)) == DUK_ERR_EVAL_ERROR)
877#define duk_is_range_error(ctx,idx) \
878 (duk_get_error_code((ctx), (idx)) == DUK_ERR_RANGE_ERROR)
879#define duk_is_reference_error(ctx,idx) \
880 (duk_get_error_code((ctx), (idx)) == DUK_ERR_REFERENCE_ERROR)
881#define duk_is_syntax_error(ctx,idx) \
882 (duk_get_error_code((ctx), (idx)) == DUK_ERR_SYNTAX_ERROR)
883#define duk_is_type_error(ctx,idx) \
884 (duk_get_error_code((ctx), (idx)) == DUK_ERR_TYPE_ERROR)
885#define duk_is_uri_error(ctx,idx) \
886 (duk_get_error_code((ctx), (idx)) == DUK_ERR_URI_ERROR)
887
888/*
889 * Get operations: no coercion, returns default value for invalid
890 * indices and invalid value types.
891 *
892 * duk_get_undefined() and duk_get_null() would be pointless and
893 * are not included.
894 */
895
901DUK_EXTERNAL_DECL const char *duk_get_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len);
908
909/*
910 * Get-with-explicit default operations: like get operations but with an
911 * explicit default value.
912 */
913
918DUK_EXTERNAL_DECL const char *duk_get_string_default(duk_context *ctx, duk_idx_t idx, const char *def_value);
919DUK_EXTERNAL_DECL const char *duk_get_lstring_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len, const char *def_ptr, duk_size_t def_len);
920DUK_EXTERNAL_DECL void *duk_get_buffer_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len);
921DUK_EXTERNAL_DECL void *duk_get_buffer_data_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len);
922DUK_EXTERNAL_DECL void *duk_get_pointer_default(duk_context *ctx, duk_idx_t idx, void *def_value);
925DUK_EXTERNAL_DECL void *duk_get_heapptr_default(duk_context *ctx, duk_idx_t idx, void *def_value);
926
927/*
928 * Opt operations: like require operations but with an explicit default value
929 * when value is undefined or index is invalid, null and non-matching types
930 * cause a TypeError.
931 */
932
937DUK_EXTERNAL_DECL const char *duk_opt_string(duk_context *ctx, duk_idx_t idx, const char *def_ptr);
938DUK_EXTERNAL_DECL const char *duk_opt_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len, const char *def_ptr, duk_size_t def_len);
939DUK_EXTERNAL_DECL void *duk_opt_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_size);
940DUK_EXTERNAL_DECL void *duk_opt_buffer_data(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_size);
941DUK_EXTERNAL_DECL void *duk_opt_pointer(duk_context *ctx, duk_idx_t idx, void *def_value);
944DUK_EXTERNAL_DECL void *duk_opt_heapptr(duk_context *ctx, duk_idx_t idx, void *def_value);
945
946/*
947 * Require operations: no coercion, throw error if index or type
948 * is incorrect. No defaulting.
949 */
950
951#define duk_require_type_mask(ctx,idx,mask) \
952 ((void) duk_check_type_mask((ctx), (idx), (mask) | DUK_TYPE_MASK_THROW))
953
969#define duk_require_callable(ctx,idx) \
970 duk_require_function((ctx), (idx))
975/* Symbols are object coercible and covered by DUK_TYPE_MASK_STRING. */
976#define duk_require_object_coercible(ctx,idx) \
977 ((void) duk_check_type_mask((ctx), (idx), DUK_TYPE_MASK_BOOLEAN | \
978 DUK_TYPE_MASK_NUMBER | \
979 DUK_TYPE_MASK_STRING | \
980 DUK_TYPE_MASK_OBJECT | \
981 DUK_TYPE_MASK_BUFFER | \
982 DUK_TYPE_MASK_POINTER | \
983 DUK_TYPE_MASK_LIGHTFUNC | \
984 DUK_TYPE_MASK_THROW))
985
986/*
987 * Coercion operations: in-place coercion, return coerced value where
988 * applicable. If index is invalid, throw error. Some coercions may
989 * throw an expected error (e.g. from a toString() or valueOf() call)
990 * or an internal error (e.g. from out of memory).
991 */
992
1003DUK_EXTERNAL_DECL const char *duk_to_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len);
1009#define DUK_BUF_MODE_FIXED 0 /* internal: request fixed buffer result */
1010#define DUK_BUF_MODE_DYNAMIC 1 /* internal: request dynamic buffer result */
1011#define DUK_BUF_MODE_DONTCARE 2 /* internal: don't care about fixed/dynamic nature */
1012
1013#define duk_to_buffer(ctx,idx,out_size) \
1014 duk_to_buffer_raw((ctx), (idx), (out_size), DUK_BUF_MODE_DONTCARE)
1015#define duk_to_fixed_buffer(ctx,idx,out_size) \
1016 duk_to_buffer_raw((ctx), (idx), (out_size), DUK_BUF_MODE_FIXED)
1017#define duk_to_dynamic_buffer(ctx,idx,out_size) \
1018 duk_to_buffer_raw((ctx), (idx), (out_size), DUK_BUF_MODE_DYNAMIC)
1019
1020/* safe variants of a few coercion operations */
1024#define duk_safe_to_string(ctx,idx) \
1025 duk_safe_to_lstring((ctx), (idx), NULL)
1026
1027/*
1028 * Value length
1029 */
1030
1033#if 0
1034/* duk_require_length()? */
1035/* duk_opt_length()? */
1036#endif
1037
1038/*
1039 * Misc conversion
1040 */
1041
1050
1052
1053/*
1054 * Buffer
1055 */
1056
1060
1061/*
1062 * Property access
1063 *
1064 * The basic function assumes key is on stack. The _(l)string variant takes
1065 * a C string as a property name; the _literal variant takes a C literal.
1066 * The _index variant takes an array index as a property name (e.g. 123 is
1067 * equivalent to the key "123"). The _heapptr variant takes a raw, borrowed
1068 * heap pointer.
1069 */
1070
1073DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
1074#if defined(DUK_USE_PREFER_SIZE)
1075#define duk_get_prop_literal(ctx,obj_idx,key) duk_get_prop_string((ctx), (obj_idx), (key))
1076#else
1078#define duk_get_prop_literal(ctx,obj_idx,key) duk_get_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
1079#endif
1084DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
1085#if defined(DUK_USE_PREFER_SIZE)
1086#define duk_put_prop_literal(ctx,obj_idx,key) duk_put_prop_string((ctx), (obj_idx), (key))
1087#else
1089#define duk_put_prop_literal(ctx,obj_idx,key) duk_put_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
1090#endif
1095DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
1096#if defined(DUK_USE_PREFER_SIZE)
1097#define duk_del_prop_literal(ctx,obj_idx,key) duk_del_prop_string((ctx), (obj_idx), (key))
1098#else
1100#define duk_del_prop_literal(ctx,obj_idx,key) duk_del_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
1101#endif
1106DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len);
1107#if defined(DUK_USE_PREFER_SIZE)
1108#define duk_has_prop_literal(ctx,obj_idx,key) duk_has_prop_string((ctx), (obj_idx), (key))
1109#else
1111#define duk_has_prop_literal(ctx,obj_idx,key) duk_has_prop_literal_raw((ctx), (obj_idx), (key), sizeof((key)) - 1U)
1112#endif
1115
1118
1121#if defined(DUK_USE_PREFER_SIZE)
1122#define duk_get_global_literal(ctx,key) duk_get_global_string((ctx), (key))
1123#else
1125#define duk_get_global_literal(ctx,key) duk_get_global_literal_raw((ctx), (key), sizeof((key)) - 1U)
1126#endif
1130#if defined(DUK_USE_PREFER_SIZE)
1131#define duk_put_global_literal(ctx,key) duk_put_global_string((ctx), (key))
1132#else
1134#define duk_put_global_literal(ctx,key) duk_put_global_literal_raw((ctx), (key), sizeof((key)) - 1U)
1135#endif
1137
1138/*
1139 * Inspection
1140 */
1141
1144
1145/*
1146 * Object prototype
1147 */
1148
1151
1152/*
1153 * Object finalizer
1154 */
1155
1158
1159/*
1160 * Global object
1161 */
1162
1164
1165/*
1166 * Duktape/C function magic value
1167 */
1168
1172
1173/*
1174 * Module helpers: put multiple function or constant properties
1175 */
1176
1179
1180/*
1181 * Object operations
1182 */
1183
1185DUK_EXTERNAL_DECL void duk_enum(duk_context *ctx, duk_idx_t obj_idx, duk_uint_t enum_flags);
1189
1190/*
1191 * String manipulation
1192 */
1193
1197DUK_EXTERNAL_DECL void duk_map_string(duk_context *ctx, duk_idx_t idx, duk_map_char_function callback, void *udata);
1198DUK_EXTERNAL_DECL void duk_substring(duk_context *ctx, duk_idx_t idx, duk_size_t start_char_offset, duk_size_t end_char_offset);
1201
1202/*
1203 * ECMAScript operators
1204 */
1205
1210
1211/*
1212 * Random
1213 */
1214
1216
1217/*
1218 * Function (method) calls
1219 */
1220
1230
1231/*
1232 * Thread management
1233 */
1234
1235/* There are currently no native functions to yield/resume, due to the internal
1236 * limitations on coroutine handling. These will be added later.
1237 */
1238
1239/*
1240 * Compilation and evaluation
1241 */
1242
1243DUK_EXTERNAL_DECL duk_int_t duk_eval_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags);
1244DUK_EXTERNAL_DECL duk_int_t duk_compile_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags);
1246/* plain */
1247#define duk_eval(ctx) \
1248 ((void) duk_eval_raw((ctx), NULL, 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOFILENAME))
1249
1250#define duk_eval_noresult(ctx) \
1251 ((void) duk_eval_raw((ctx), NULL, 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1252
1253#define duk_peval(ctx) \
1254 (duk_eval_raw((ctx), NULL, 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOFILENAME))
1255
1256#define duk_peval_noresult(ctx) \
1257 (duk_eval_raw((ctx), NULL, 0, 1 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1258
1259#define duk_compile(ctx,flags) \
1260 ((void) duk_compile_raw((ctx), NULL, 0, 2 /*args*/ | (flags)))
1261
1262#define duk_pcompile(ctx,flags) \
1263 (duk_compile_raw((ctx), NULL, 0, 2 /*args*/ | (flags) | DUK_COMPILE_SAFE))
1265/* string */
1266#define duk_eval_string(ctx,src) \
1267 ((void) duk_eval_raw((ctx), (src), 0, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))
1268
1269#define duk_eval_string_noresult(ctx,src) \
1270 ((void) duk_eval_raw((ctx), (src), 0, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1271
1272#define duk_peval_string(ctx,src) \
1273 (duk_eval_raw((ctx), (src), 0, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))
1274
1275#define duk_peval_string_noresult(ctx,src) \
1276 (duk_eval_raw((ctx), (src), 0, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1277
1278#define duk_compile_string(ctx,flags,src) \
1279 ((void) duk_compile_raw((ctx), (src), 0, 0 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))
1280
1281#define duk_compile_string_filename(ctx,flags,src) \
1282 ((void) duk_compile_raw((ctx), (src), 0, 1 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))
1283
1284#define duk_pcompile_string(ctx,flags,src) \
1285 (duk_compile_raw((ctx), (src), 0, 0 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN | DUK_COMPILE_NOFILENAME))
1286
1287#define duk_pcompile_string_filename(ctx,flags,src) \
1288 (duk_compile_raw((ctx), (src), 0, 1 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN))
1290/* lstring */
1291#define duk_eval_lstring(ctx,buf,len) \
1292 ((void) duk_eval_raw((ctx), buf, len, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))
1293
1294#define duk_eval_lstring_noresult(ctx,buf,len) \
1295 ((void) duk_eval_raw((ctx), buf, len, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1296
1297#define duk_peval_lstring(ctx,buf,len) \
1298 (duk_eval_raw((ctx), buf, len, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_NOSOURCE | DUK_COMPILE_SAFE | DUK_COMPILE_NOFILENAME))
1299
1300#define duk_peval_lstring_noresult(ctx,buf,len) \
1301 (duk_eval_raw((ctx), buf, len, 0 /*args*/ | DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NORESULT | DUK_COMPILE_NOFILENAME))
1302
1303#define duk_compile_lstring(ctx,flags,buf,len) \
1304 ((void) duk_compile_raw((ctx), buf, len, 0 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))
1305
1306#define duk_compile_lstring_filename(ctx,flags,buf,len) \
1307 ((void) duk_compile_raw((ctx), buf, len, 1 /*args*/ | (flags) | DUK_COMPILE_NOSOURCE))
1308
1309#define duk_pcompile_lstring(ctx,flags,buf,len) \
1310 (duk_compile_raw((ctx), buf, len, 0 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_NOFILENAME))
1311
1312#define duk_pcompile_lstring_filename(ctx,flags,buf,len) \
1313 (duk_compile_raw((ctx), buf, len, 1 /*args*/ | (flags) | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE))
1314
1315/*
1316 * Bytecode load/dump
1317 */
1318
1321
1322/*
1323 * Debugging
1324 */
1325
1327
1328/*
1329 * Debugger (debug protocol)
1330 */
1331
1334 duk_debug_write_function write_cb,
1336 duk_debug_read_flush_function read_flush_cb,
1337 duk_debug_write_flush_function write_flush_cb,
1338 duk_debug_request_function request_cb,
1339 duk_debug_detached_function detached_cb,
1340 void *udata);
1345
1346/*
1347 * Time handling
1348 */
1349
1353
1354/*
1355 * Date provider related constants
1356 *
1357 * NOTE: These are "semi public" - you should only use these if you write
1358 * your own platform specific Date provider, see doc/datetime.rst.
1359 */
1361/* Millisecond count constants. */
1362#define DUK_DATE_MSEC_SECOND 1000L
1363#define DUK_DATE_MSEC_MINUTE (60L * 1000L)
1364#define DUK_DATE_MSEC_HOUR (60L * 60L * 1000L)
1365#define DUK_DATE_MSEC_DAY (24L * 60L * 60L * 1000L)
1366
1367/* ECMAScript date range is 100 million days from Epoch:
1368 * > 100e6 * 24 * 60 * 60 * 1000 // 100M days in millisecs
1369 * 8640000000000000
1370 * (= 8.64e15)
1372#define DUK_DATE_MSEC_100M_DAYS (8.64e15)
1373#define DUK_DATE_MSEC_100M_DAYS_LEEWAY (8.64e15 + 24 * 3600e3)
1374
1375/* ECMAScript year range:
1376 * > new Date(100e6 * 24 * 3600e3).toISOString()
1377 * '+275760-09-13T00:00:00.000Z'
1378 * > new Date(-100e6 * 24 * 3600e3).toISOString()
1379 * '-271821-04-20T00:00:00.000Z'
1381#define DUK_DATE_MIN_ECMA_YEAR (-271821L)
1382#define DUK_DATE_MAX_ECMA_YEAR 275760L
1383
1384/* Part indices for internal breakdowns. Part order from DUK_DATE_IDX_YEAR
1385 * to DUK_DATE_IDX_MILLISECOND matches argument ordering of ECMAScript API
1386 * calls (like Date constructor call). Some functions in duk_bi_date.c
1387 * depend on the specific ordering, so change with care. 16 bits are not
1388 * enough for all parts (year, specifically).
1389 *
1390 * Must be in-sync with genbuiltins.py.
1392#define DUK_DATE_IDX_YEAR 0 /* year */
1393#define DUK_DATE_IDX_MONTH 1 /* month: 0 to 11 */
1394#define DUK_DATE_IDX_DAY 2 /* day within month: 0 to 30 */
1395#define DUK_DATE_IDX_HOUR 3
1396#define DUK_DATE_IDX_MINUTE 4
1397#define DUK_DATE_IDX_SECOND 5
1398#define DUK_DATE_IDX_MILLISECOND 6
1399#define DUK_DATE_IDX_WEEKDAY 7 /* weekday: 0 to 6, 0=sunday, 1=monday, etc */
1400#define DUK_DATE_IDX_NUM_PARTS 8
1401
1402/* Internal API call flags, used for various functions in duk_bi_date.c.
1403 * Certain flags are used by only certain functions, but since the flags
1404 * don't overlap, a single flags value can be passed around to multiple
1405 * functions.
1406 *
1407 * The unused top bits of the flags field are also used to pass values
1408 * to helpers (duk__get_part_helper() and duk__set_part_helper()).
1409 *
1410 * Must be in-sync with genbuiltins.py.
1411 */
1412
1413/* NOTE: when writing a Date provider you only need a few specific
1414 * flags from here, the rest are internal. Avoid using anything you
1415 * don't need.
1418#define DUK_DATE_FLAG_NAN_TO_ZERO (1 << 0) /* timeval breakdown: internal time value NaN -> zero */
1419#define DUK_DATE_FLAG_NAN_TO_RANGE_ERROR (1 << 1) /* timeval breakdown: internal time value NaN -> RangeError (toISOString) */
1420#define DUK_DATE_FLAG_ONEBASED (1 << 2) /* timeval breakdown: convert month and day-of-month parts to one-based (default is zero-based) */
1421#define DUK_DATE_FLAG_EQUIVYEAR (1 << 3) /* timeval breakdown: replace year with equivalent year in the [1971,2037] range for DST calculations */
1422#define DUK_DATE_FLAG_LOCALTIME (1 << 4) /* convert time value to local time */
1423#define DUK_DATE_FLAG_SUB1900 (1 << 5) /* getter: subtract 1900 from year when getting year part */
1424#define DUK_DATE_FLAG_TOSTRING_DATE (1 << 6) /* include date part in string conversion result */
1425#define DUK_DATE_FLAG_TOSTRING_TIME (1 << 7) /* include time part in string conversion result */
1426#define DUK_DATE_FLAG_TOSTRING_LOCALE (1 << 8) /* use locale specific formatting if available */
1427#define DUK_DATE_FLAG_TIMESETTER (1 << 9) /* setter: call is a time setter (affects hour, min, sec, ms); otherwise date setter (affects year, month, day-in-month) */
1428#define DUK_DATE_FLAG_YEAR_FIXUP (1 << 10) /* setter: perform 2-digit year fixup (00...99 -> 1900...1999) */
1429#define DUK_DATE_FLAG_SEP_T (1 << 11) /* string conversion: use 'T' instead of ' ' as a separator */
1430#define DUK_DATE_FLAG_VALUE_SHIFT 12 /* additional values begin at bit 12 */
1431
1432/*
1433 * ROM pointer compression
1434 */
1435
1436/* Support array for ROM pointer compression. Only declared when ROM
1437 * pointer compression is active.
1438 */
1439#if defined(DUK_USE_ROM_OBJECTS) && defined(DUK_USE_HEAPPTR16)
1440DUK_EXTERNAL_DECL const void * const duk_rom_compressed_pointers[];
1441#endif
1442
1443/*
1444 * C++ name mangling
1445 */
1446
1447#if defined(__cplusplus)
1448/* end 'extern "C"' wrapper */
1449}
1450#endif
1451
1452/*
1453 * END PUBLIC API
1454 */
1455
1456#endif /* DUKTAPE_H_INCLUDED */
static osspriteop_area * buffer
The buffer characteristics.
Definition: buffer.c:55
static uint32_t count(const http_directive *list, lwc_string *key)
#define DUK_EXTERNAL_DECL
Definition: duk_config.h:2727
unsigned int duk_small_uint_t
Definition: duk_config.h:2034
duk_small_int_t duk_ret_t
Definition: duk_config.h:2076
duk_int_t duk_idx_t
Definition: duk_config.h:2056
duk_int_t duk_errcode_t
Definition: duk_config.h:2083
duk_small_uint_t duk_bool_t
Definition: duk_config.h:2051
double duk_double_t
Definition: duk_config.h:2103
duk_uint_t duk_uarridx_t
Definition: duk_config.h:2068
duk_int_t duk_codepoint_t
Definition: duk_config.h:2094
duk_int_fast32_t duk_int_t
Definition: duk_config.h:2011
size_t duk_size_t
Definition: duk_config.h:1996
duk_uint_fast32_t duk_uint_t
Definition: duk_config.h:2012
DUK_EXTERNAL duk_ret_t duk_uri_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25184
DUK_EXTERNAL void duk_fatal_raw(duk_hthread *thr, const char *err_msg)
Definition: duktape.c:25067
DUK_EXTERNAL duk_ret_t duk_reference_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25172
DUK_EXTERNAL void duk_throw_raw(duk_hthread *thr)
Definition: duktape.c:25022
DUK_EXTERNAL void duk_error_va_raw(duk_hthread *thr, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap)
Definition: duktape.c:25091
DUK_EXTERNAL void duk_error_raw(duk_hthread *thr, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt,...)
Definition: duktape.c:25104
DUK_EXTERNAL duk_ret_t duk_type_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25180
DUK_EXTERNAL duk_ret_t duk_range_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25168
DUK_EXTERNAL duk_ret_t duk_error_stash(duk_hthread *thr, duk_errcode_t err_code, const char *fmt,...)
Definition: duktape.c:25156
DUK_EXTERNAL duk_ret_t duk_generic_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25160
DUK_EXTERNAL duk_ret_t duk_syntax_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25176
DUK_EXTERNAL duk_ret_t duk_eval_error_stash(duk_hthread *thr, const char *fmt,...)
Definition: duktape.c:25164
DUK_EXTERNAL_DECL duk_double_t duk_components_to_time(duk_context *ctx, duk_time_components *comp)
Definition: duktape.c:26049
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key)
Definition: duktape.c:18005
DUK_EXTERNAL_DECL void duk_dump_function(duk_context *ctx)
Definition: duktape.c:15102
DUK_EXTERNAL_DECL duk_bool_t duk_is_array(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22786
DUK_EXTERNAL_DECL void * duk_opt_pointer(duk_context *ctx, duk_idx_t idx, void *def_value)
Definition: duktape.c:20583
DUK_EXTERNAL_DECL void * duk_steal_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size)
Definition: duktape.c:14367
DUK_EXTERNAL_DECL void duk_to_undefined(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21418
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx)
Definition: duktape.c:18035
DUK_EXTERNAL_DECL duk_bool_t duk_is_valid_index(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:19050
DUK_EXTERNAL_DECL duk_idx_t duk_push_c_lightfunc(duk_context *ctx, duk_c_function func, duk_idx_t nargs, duk_idx_t length, duk_int_t magic)
Definition: duktape.c:23848
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17941
DUK_EXTERNAL_DECL duk_bool_t duk_samevalue(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2)
Definition: duktape.c:25226
DUK_EXTERNAL_DECL duk_int_t duk_eval_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags)
Definition: duktape.c:16657
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17859
duk_ret_t(* duk_safe_call_function)(duk_context *ctx, void *udata)
Definition: duktape.h:253
DUK_EXTERNAL_DECL void duk_replace(duk_context *ctx, duk_idx_t to_idx)
Definition: duktape.c:19937
DUK_EXTERNAL_DECL void duk_base64_decode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16373
DUK_EXTERNAL_DECL duk_bool_t duk_is_buffer_data(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22734
DUK_EXTERNAL_DECL void * duk_get_buffer_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len)
Definition: duktape.c:20693
DUK_EXTERNAL_DECL duk_double_t duk_get_now(duk_context *ctx)
Definition: duktape.c:26003
DUK_EXTERNAL_DECL const char * duk_api_global_filename
Definition: duktape.h:496
duk_size_t(* duk_debug_read_function)(void *udata, char *buffer, duk_size_t length)
Definition: duktape.h:254
DUK_EXTERNAL_DECL void * duk_get_buffer_data(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size)
Definition: duktape.c:20781
DUK_EXTERNAL_DECL duk_bool_t duk_get_boolean_default(duk_context *ctx, duk_idx_t idx, duk_bool_t def_value)
Definition: duktape.c:20237
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key)
Definition: duktape.c:17675
DUK_EXTERNAL_DECL void duk_seal(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:18339
DUK_EXTERNAL_DECL void duk_set_prototype(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18553
DUK_EXTERNAL_DECL duk_bool_t duk_is_number(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22675
DUK_EXTERNAL_DECL void duk_set_global_object(duk_context *ctx)
Definition: duktape.c:17230
DUK_EXTERNAL_DECL void * duk_get_pointer_default(duk_context *ctx, duk_idx_t idx, void *def_value)
Definition: duktape.c:20592
DUK_EXTERNAL_DECL void duk_require_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21047
DUK_EXTERNAL_DECL duk_bool_t duk_to_boolean(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21531
void *(* duk_alloc_function)(void *udata, duk_size_t size)
Definition: duktape.h:247
DUK_EXTERNAL_DECL duk_idx_t duk_push_heapptr(duk_context *ctx, void *ptr)
Definition: duktape.c:24438
DUK_EXTERNAL_DECL duk_idx_t duk_push_object(duk_context *ctx)
Definition: duktape.c:23545
DUK_EXTERNAL_DECL void duk_gc(duk_context *ctx, duk_uint_t flags)
Definition: duktape.c:17625
DUK_EXTERNAL_DECL duk_uint_t duk_require_uint(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20371
DUK_EXTERNAL_DECL void duk_config_buffer(duk_context *ctx, duk_idx_t idx, void *ptr, duk_size_t len)
Definition: duktape.c:14398
DUK_EXTERNAL_DECL duk_int_t duk_pcall_prop(duk_context *ctx, duk_idx_t obj_idx, duk_idx_t nargs)
Definition: duktape.c:15465
void(* duk_debug_detached_function)(duk_context *ctx, void *udata)
Definition: duktape.h:260
DUK_EXTERNAL_DECL void duk_require_constructor_call(duk_context *ctx)
Definition: duktape.c:15577
DUK_EXTERNAL_DECL duk_context * duk_opt_context(duk_context *ctx, duk_idx_t idx, duk_context *def_value)
Definition: duktape.c:21080
DUK_EXTERNAL_DECL duk_double_t duk_get_number_default(duk_context *ctx, duk_idx_t idx, duk_double_t def_value)
Definition: duktape.c:20303
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr)
Definition: duktape.c:18043
DUK_EXTERNAL_DECL duk_int_t duk_safe_call(duk_context *ctx, duk_safe_call_function func, void *udata, duk_idx_t nargs, duk_idx_t nrets)
Definition: duktape.c:15481
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len)
Definition: duktape.c:18406
DUK_EXTERNAL_DECL void duk_free(duk_context *ctx, void *ptr)
Definition: duktape.c:17588
DUK_EXTERNAL_DECL const char * duk_hex_encode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16429
DUK_EXTERNAL_DECL void duk_call(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15320
DUK_EXTERNAL_DECL void * duk_alloc_raw(duk_context *ctx, duk_size_t size)
Definition: duktape.c:17564
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_string(duk_context *ctx, const char *key)
Definition: duktape.c:18451
DUK_EXTERNAL_DECL void * duk_alloc(duk_context *ctx, duk_size_t size)
Definition: duktape.c:17582
DUK_EXTERNAL_DECL void duk_require_constructable(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21055
DUK_EXTERNAL_DECL duk_bool_t duk_is_thread(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22866
void(* duk_debug_write_flush_function)(void *udata)
Definition: duktape.h:258
DUK_EXTERNAL_DECL void * duk_require_buffer_data(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size)
Definition: duktape.c:20807
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx)
Definition: duktape.c:17705
DUK_EXTERNAL_DECL duk_bool_t duk_check_stack(duk_context *ctx, duk_idx_t extra)
Definition: duktape.c:19657
DUK_EXTERNAL_DECL duk_int_t duk_get_int_default(duk_context *ctx, duk_idx_t idx, duk_int_t def_value)
Definition: duktape.c:20353
DUK_EXTERNAL_DECL void * duk_get_pointer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20578
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr)
Definition: duktape.c:17878
DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt,...)
Definition: duktape.c:24164
DUK_EXTERNAL_DECL const char * duk_json_encode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16586
DUK_EXTERNAL_DECL void * duk_to_pointer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22263
DUK_EXTERNAL_DECL void duk_get_finalizer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18618
DUK_EXTERNAL_DECL void duk_push_thread_stash(duk_context *ctx, duk_context *target_ctx)
Definition: duktape.c:23393
DUK_EXTERNAL_DECL duk_idx_t duk_push_bare_array(duk_context *ctx)
Definition: duktape.c:23581
DUK_EXTERNAL_DECL void duk_swap_top(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:19771
DUK_EXTERNAL_DECL void duk_cbor_encode(duk_context *ctx, duk_idx_t idx, duk_uint_t encode_flags)
Definition: duktape.c:32613
DUK_EXTERNAL_DECL duk_idx_t duk_push_proxy(duk_context *ctx, duk_uint_t proxy_flags)
Definition: duktape.c:24245
DUK_EXTERNAL_DECL duk_bool_t duk_is_boolean(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22670
DUK_EXTERNAL_DECL duk_idx_t duk_push_array(duk_context *ctx)
Definition: duktape.c:23555
DUK_EXTERNAL_DECL void duk_put_function_list(duk_context *ctx, duk_idx_t obj_idx, const duk_function_list_entry *funcs)
Definition: duktape.c:18355
DUK_EXTERNAL_DECL void duk_pop(duk_context *ctx)
Definition: duktape.c:24715
DUK_EXTERNAL_DECL void duk_inspect_value(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:17343
DUK_EXTERNAL_DECL duk_int32_t duk_to_int32(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21678
DUK_EXTERNAL_DECL void duk_push_global_object(duk_context *ctx)
Definition: duktape.c:23357
DUK_EXTERNAL_DECL const char * duk_to_stacktrace(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21814
DUK_EXTERNAL_DECL duk_int_t duk_require_int(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20365
DUK_EXTERNAL_DECL duk_int_t duk_get_magic(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:15638
DUK_EXTERNAL_DECL void * duk_realloc_raw(duk_context *ctx, void *ptr, duk_size_t size)
Definition: duktape.c:17576
DUK_EXTERNAL_DECL void duk_pop_2(duk_context *ctx)
Definition: duktape.c:24804
DUK_EXTERNAL_DECL duk_bool_t duk_debugger_notify(duk_context *ctx, duk_idx_t nvalues)
Definition: duktape.c:17055
DUK_EXTERNAL_DECL void * duk_get_buffer_data_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len)
Definition: duktape.c:20786
DUK_EXTERNAL_DECL const char * duk_require_string(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20533
DUK_EXTERNAL_DECL void duk_decode_string(duk_context *ctx, duk_idx_t idx, duk_decode_char_function callback, void *udata)
Definition: duktape.c:25762
duk_codepoint_t(* duk_map_char_function)(void *udata, duk_codepoint_t codepoint)
Definition: duktape.h:252
DUK_EXTERNAL_DECL void * duk_opt_buffer_data(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_size)
Definition: duktape.c:20795
DUK_EXTERNAL_DECL const char * duk_require_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len)
Definition: duktape.c:20417
DUK_EXTERNAL_DECL void duk_suspend(duk_context *ctx, duk_thread_state *state)
Definition: duktape.c:17158
DUK_EXTERNAL_DECL void duk_push_boolean(duk_context *ctx, duk_bool_t val)
Definition: duktape.c:23004
DUK_EXTERNAL_DECL void duk_map_string(duk_context *ctx, duk_idx_t idx, duk_map_char_function callback, void *udata)
Definition: duktape.c:25785
DUK_EXTERNAL_DECL duk_idx_t duk_normalize_index(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18910
DUK_EXTERNAL_DECL void duk_json_decode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16612
DUK_EXTERNAL_DECL duk_c_function duk_require_c_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21034
DUK_EXTERNAL_DECL void * duk_require_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size)
Definition: duktape.c:20703
DUK_EXTERNAL_DECL void duk_push_number(duk_context *ctx, duk_double_t val)
Definition: duktape.c:23034
DUK_EXTERNAL_DECL duk_uint_t duk_to_uint(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21669
DUK_EXTERNAL_DECL duk_idx_t duk_push_c_function(duk_context *ctx, duk_c_function func, duk_idx_t nargs)
Definition: duktape.c:23806
DUK_EXTERNAL_DECL duk_bool_t duk_is_nan(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22692
DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_stash(duk_context *ctx, duk_errcode_t err_code, const char *fmt,...)
Definition: duktape.c:24177
DUK_EXTERNAL_DECL duk_bool_t duk_is_object(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22723
DUK_EXTERNAL_DECL void duk_push_current_thread(duk_context *ctx)
Definition: duktape.c:23347
void(* duk_free_function)(void *udata, void *ptr)
Definition: duktape.h:249
void(* duk_debug_read_flush_function)(void *udata)
Definition: duktape.h:257
DUK_EXTERNAL_DECL void duk_push_true(duk_context *ctx)
Definition: duktape.c:23015
DUK_EXTERNAL_DECL duk_bool_t duk_check_stack_top(duk_context *ctx, duk_idx_t top)
Definition: duktape.c:19703
DUK_EXTERNAL_DECL void duk_to_object(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22345
DUK_EXTERNAL_DECL void * duk_push_buffer_raw(duk_context *ctx, duk_size_t size, duk_small_uint_t flags)
Definition: duktape.c:24194
DUK_EXTERNAL_DECL void * duk_realloc(duk_context *ctx, void *ptr, duk_size_t size)
Definition: duktape.c:17594
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key)
Definition: duktape.c:17836
void *(* duk_realloc_function)(void *udata, void *ptr, duk_size_t size)
Definition: duktape.h:248
DUK_EXTERNAL_DECL const char * duk_buffer_to_string(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22192
DUK_EXTERNAL_DECL void * duk_get_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size)
Definition: duktape.c:20675
DUK_EXTERNAL_DECL duk_bool_t duk_is_string(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22713
DUK_EXTERNAL_DECL duk_idx_t duk_get_top(duk_context *ctx)
Definition: duktape.c:19072
DUK_EXTERNAL_DECL void duk_copy(duk_context *ctx, duk_idx_t from_idx, duk_idx_t to_idx)
Definition: duktape.c:19959
DUK_EXTERNAL_DECL void * duk_get_heapptr_default(duk_context *ctx, duk_idx_t idx, void *def_value)
Definition: duktape.c:21128
DUK_EXTERNAL_DECL void duk_set_magic(duk_context *ctx, duk_idx_t idx, duk_int_t magic)
Definition: duktape.c:15663
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx)
Definition: duktape.c:17870
DUK_EXTERNAL_DECL void duk_push_new_target(duk_context *ctx)
Definition: duktape.c:23294
DUK_EXTERNAL_DECL duk_uint32_t duk_to_uint32(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21694
DUK_EXTERNAL_DECL void duk_hex_decode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16485
DUK_EXTERNAL_DECL void duk_def_prop(duk_context *ctx, duk_idx_t obj_idx, duk_uint_t flags)
Definition: duktape.c:18169
DUK_EXTERNAL_DECL void duk_resume(duk_context *ctx, const duk_thread_state *state)
Definition: duktape.c:17203
DUK_EXTERNAL_DECL void * duk_require_heapptr(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21141
DUK_EXTERNAL_DECL void duk_trim(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:25873
DUK_EXTERNAL_DECL void duk_concat(duk_context *ctx, duk_idx_t count)
Definition: duktape.c:25701
DUK_EXTERNAL_DECL duk_int_t duk_api_global_line
Definition: duktape.h:497
DUK_EXTERNAL_DECL const char * duk_safe_to_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len)
Definition: duktape.c:21781
DUK_EXTERNAL_DECL duk_int_t duk_to_int(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21660
DUK_EXTERNAL_DECL duk_bool_t duk_instanceof(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2)
Definition: duktape.c:25245
void(* duk_fatal_function)(void *udata, const char *msg)
Definition: duktape.h:250
DUK_EXTERNAL_DECL void duk_push_undefined(duk_context *ctx)
Definition: duktape.c:22983
DUK_EXTERNAL_DECL const char * duk_base64_encode(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:16337
DUK_EXTERNAL_DECL void duk_get_prototype(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18535
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_heapptr(duk_context *ctx, void *ptr)
Definition: duktape.c:18437
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_index(duk_context *ctx, duk_idx_t obj_idx, duk_uarridx_t arr_idx)
Definition: duktape.c:17952
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:17831
DUK_EXTERNAL_DECL duk_bool_t duk_opt_boolean(duk_context *ctx, duk_idx_t idx, duk_bool_t def_value)
Definition: duktape.c:20261
DUK_EXTERNAL_DECL void duk_freeze(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:18345
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_lstring(duk_context *ctx, const char *key, duk_size_t key_len)
Definition: duktape.c:18466
DUK_EXTERNAL_DECL void duk_require_undefined(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20186
DUK_EXTERNAL_DECL const char * duk_to_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len)
Definition: duktape.c:21765
DUK_EXTERNAL_DECL void duk_set_length(duk_context *ctx, duk_idx_t idx, duk_size_t len)
Definition: duktape.c:21383
DUK_EXTERNAL_DECL duk_context * duk_create_heap(duk_alloc_function alloc_func, duk_realloc_function realloc_func, duk_free_function free_func, void *heap_udata, duk_fatal_function fatal_handler)
Definition: duktape.c:17094
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_literal_raw(duk_context *ctx, const char *key, duk_size_t key_len)
Definition: duktape.c:18482
duk_idx_t(* duk_debug_request_function)(duk_context *ctx, void *udata, duk_idx_t nvalues)
Definition: duktape.h:259
DUK_EXTERNAL_DECL void duk_require_stack_top(duk_context *ctx, duk_idx_t top)
Definition: duktape.c:19726
DUK_EXTERNAL_DECL duk_int_t duk_opt_int(duk_context *ctx, duk_idx_t idx, duk_int_t def_value)
Definition: duktape.c:20377
DUK_EXTERNAL_DECL const char * duk_opt_string(duk_context *ctx, duk_idx_t idx, const char *def_ptr)
Definition: duktape.c:20472
DUK_EXTERNAL_DECL duk_bool_t duk_check_type_mask(duk_context *ctx, duk_idx_t idx, duk_uint_t mask)
Definition: duktape.c:22647
DUK_EXTERNAL_DECL duk_bool_t duk_is_constructor_call(duk_context *ctx)
Definition: duktape.c:15565
DUK_EXTERNAL_DECL duk_double_t duk_to_number(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21566
DUK_EXTERNAL_DECL duk_bool_t duk_is_undefined(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22660
DUK_EXTERNAL_DECL duk_bool_t duk_strict_equals(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2)
Definition: duktape.c:25211
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:17899
DUK_EXTERNAL_DECL const char * duk_get_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len)
Definition: duktape.c:20395
DUK_EXTERNAL_DECL void * duk_require_pointer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20597
DUK_EXTERNAL_DECL duk_double_t duk_opt_number(duk_context *ctx, duk_idx_t idx, duk_double_t def_value)
Definition: duktape.c:20331
DUK_EXTERNAL_DECL void duk_call_method(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15335
DUK_EXTERNAL_DECL duk_bool_t duk_is_dynamic_buffer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22893
DUK_EXTERNAL_DECL duk_size_t duk_get_length(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21251
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17684
DUK_EXTERNAL_DECL void duk_destroy_heap(duk_context *ctx)
Definition: duktape.c:17145
DUK_EXTERNAL_DECL duk_bool_t duk_is_lightfunc(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22766
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:18024
DUK_EXTERNAL_DECL void duk_dup_top(duk_context *ctx)
Definition: duktape.c:19792
DUK_EXTERNAL_DECL void duk_push_buffer_object(duk_context *ctx, duk_idx_t idx_buffer, duk_size_t byte_offset, duk_size_t byte_length, duk_uint_t flags)
Definition: duktape.c:23982
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_string(duk_context *ctx, const char *key)
Definition: duktape.c:18392
DUK_EXTERNAL_DECL void duk_require_null(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20199
DUK_EXTERNAL_DECL duk_int_t duk_get_int(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20341
duk_size_t(* duk_debug_peek_function)(void *udata)
Definition: duktape.h:256
DUK_EXTERNAL_DECL void duk_push_false(duk_context *ctx)
Definition: duktape.c:23024
DUK_EXTERNAL_DECL duk_context * duk_get_context(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21068
DUK_EXTERNAL_DECL const char * duk_get_string(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20443
DUK_EXTERNAL_DECL const char * duk_opt_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len, const char *def_ptr, duk_size_t def_len)
Definition: duktape.c:20456
DUK_EXTERNAL_DECL duk_int_t duk_pcall(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15390
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:17652
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:18014
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_string(duk_context *ctx, duk_idx_t obj_idx, const char *key)
Definition: duktape.c:17922
DUK_EXTERNAL_DECL void duk_cbor_decode(duk_context *ctx, duk_idx_t idx, duk_uint_t decode_flags)
Definition: duktape.c:32617
DUK_EXTERNAL_DECL void duk_push_context_dump(duk_context *ctx)
Definition: duktape.c:16824
DUK_EXTERNAL_DECL duk_int_t duk_get_type(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22537
DUK_EXTERNAL_DECL duk_uint_t duk_opt_uint(duk_context *ctx, duk_idx_t idx, duk_uint_t def_value)
Definition: duktape.c:20386
DUK_EXTERNAL_DECL duk_context * duk_require_context(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21074
DUK_EXTERNAL_DECL duk_int_t duk_get_current_magic(duk_context *ctx)
Definition: duktape.c:15613
DUK_EXTERNAL_DECL void duk_push_int(duk_context *ctx, duk_int_t val)
Definition: duktape.c:23046
DUK_EXTERNAL_DECL const char * duk_get_lstring_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len, const char *def_ptr, duk_size_t def_len)
Definition: duktape.c:20481
DUK_EXTERNAL_DECL void duk_to_primitive(duk_context *ctx, duk_idx_t idx, duk_int_t hint)
Definition: duktape.c:21520
DUK_EXTERNAL_DECL duk_context * duk_get_context_default(duk_context *ctx, duk_idx_t idx, duk_context *def_value)
Definition: duktape.c:21089
DUK_EXTERNAL_DECL duk_idx_t duk_push_thread_raw(duk_context *ctx, duk_uint_t flags)
Definition: duktape.c:23643
DUK_EXTERNAL_DECL const char * duk_push_lstring(duk_context *ctx, const char *str, duk_size_t len)
Definition: duktape.c:23117
DUK_EXTERNAL_DECL void duk_put_number_list(duk_context *ctx, duk_idx_t obj_idx, const duk_number_list_entry *numbers)
Definition: duktape.c:18370
DUK_EXTERNAL_DECL void duk_push_nan(duk_context *ctx)
Definition: duktape.c:23105
DUK_EXTERNAL_DECL void duk_dup(duk_context *ctx, duk_idx_t from_idx)
Definition: duktape.c:19777
DUK_EXTERNAL_DECL duk_codepoint_t duk_char_code_at(duk_context *ctx, duk_idx_t idx, duk_size_t char_offset)
Definition: duktape.c:25950
DUK_EXTERNAL_DECL void duk_debugger_cooperate(duk_context *ctx)
Definition: duktape.c:17049
DUK_EXTERNAL_DECL void duk_compact(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:18248
DUK_EXTERNAL_DECL void * duk_opt_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_size)
Definition: duktape.c:20681
DUK_EXTERNAL_DECL duk_double_t duk_require_number(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20308
DUK_EXTERNAL_DECL void duk_push_pointer(duk_context *ctx, void *p)
Definition: duktape.c:23198
duk_size_t(* duk_debug_write_function)(void *udata, const char *buffer, duk_size_t length)
Definition: duktape.h:255
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17931
DUK_EXTERNAL_DECL const char * duk_push_vsprintf(duk_context *ctx, const char *fmt, va_list ap)
Definition: duktape.c:23421
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_literal_raw(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17694
DUK_EXTERNAL_DECL duk_idx_t duk_require_normalize_index(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18945
DUK_EXTERNAL_DECL duk_uint_t duk_get_uint_default(duk_context *ctx, duk_idx_t idx, duk_uint_t def_value)
Definition: duktape.c:20359
DUK_EXTERNAL_DECL void duk_pop_n(duk_context *ctx, duk_idx_t count)
Definition: duktape.c:24627
DUK_EXTERNAL_DECL void duk_substring(duk_context *ctx, duk_idx_t idx, duk_size_t start_char_offset, duk_size_t end_char_offset)
Definition: duktape.c:25825
DUK_EXTERNAL_DECL duk_bool_t duk_del_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr)
Definition: duktape.c:17960
DUK_EXTERNAL_DECL void * duk_resize_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t new_size)
Definition: duktape.c:14348
DUK_EXTERNAL_DECL duk_bool_t duk_is_ecmascript_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22856
DUK_EXTERNAL_DECL duk_idx_t duk_push_error_object_va_raw(duk_context *ctx, duk_errcode_t err_code, const char *filename, duk_int_t line, const char *fmt, va_list ap)
Definition: duktape.c:24105
DUK_EXTERNAL_DECL duk_int_t duk_pnew(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15546
DUK_EXTERNAL_DECL void duk_require_stack(duk_context *ctx, duk_idx_t extra)
Definition: duktape.c:19680
DUK_EXTERNAL_DECL const char * duk_push_literal_raw(duk_context *ctx, const char *str, duk_size_t len)
Definition: duktape.c:23164
DUK_EXTERNAL_DECL void duk_pull(duk_context *ctx, duk_idx_t from_idx)
Definition: duktape.c:19900
DUK_EXTERNAL_DECL duk_bool_t duk_is_strict_call(duk_context *ctx)
Definition: duktape.c:15586
duk_ret_t(* duk_c_function)(duk_context *ctx)
Definition: duktape.h:246
DUK_EXTERNAL_DECL duk_bool_t duk_check_type(duk_context *ctx, duk_idx_t idx, duk_int_t type)
Definition: duktape.c:22591
DUK_EXTERNAL_DECL duk_bool_t duk_is_external_buffer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22908
DUK_EXTERNAL_DECL void * duk_get_heapptr(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21102
DUK_EXTERNAL_DECL duk_idx_t duk_push_bare_object(duk_context *ctx)
Definition: duktape.c:24530
DUK_EXTERNAL_DECL duk_bool_t duk_get_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr)
Definition: duktape.c:17713
DUK_EXTERNAL_DECL void duk_remove(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:19974
DUK_EXTERNAL_DECL duk_bool_t duk_get_boolean(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20231
DUK_EXTERNAL_DECL duk_idx_t duk_get_top_index(duk_context *ctx)
Definition: duktape.c:19281
DUK_EXTERNAL_DECL duk_bool_t duk_is_bound_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22861
DUK_EXTERNAL_DECL void duk_debugger_detach(duk_context *ctx)
Definition: duktape.c:17043
DUK_EXTERNAL_DECL const char * duk_safe_to_stacktrace(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21844
DUK_EXTERNAL_DECL duk_bool_t duk_is_c_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22851
DUK_EXTERNAL_DECL duk_double_t duk_get_number(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20298
DUK_EXTERNAL_DECL void duk_time_to_components(duk_context *ctx, duk_double_t timeval, duk_time_components *comp)
Definition: duktape.c:26020
DUK_EXTERNAL_DECL duk_bool_t duk_has_prop(duk_context *ctx, duk_idx_t obj_idx)
Definition: duktape.c:17984
DUK_EXTERNAL_DECL const char * duk_push_string(duk_context *ctx, const char *str)
Definition: duktape.c:23151
DUK_EXTERNAL_DECL void duk_join(duk_context *ctx, duk_idx_t count)
Definition: duktape.c:25752
DUK_EXTERNAL_DECL duk_bool_t duk_is_fixed_buffer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22878
DUK_EXTERNAL_DECL const char * duk_push_sprintf(duk_context *ctx, const char *fmt,...)
Definition: duktape.c:23487
DUK_EXTERNAL_DECL void * duk_opt_heapptr(duk_context *ctx, duk_idx_t idx, void *def_value)
Definition: duktape.c:21119
DUK_EXTERNAL_DECL void duk_swap(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2)
Definition: duktape.c:19753
DUK_EXTERNAL_DECL void duk_push_heap_stash(duk_context *ctx)
Definition: duktape.c:23378
DUK_EXTERNAL_DECL void duk_get_prop_desc(duk_context *ctx, duk_idx_t obj_idx, duk_uint_t flags)
Definition: duktape.c:18161
DUK_EXTERNAL_DECL void duk_insert(duk_context *ctx, duk_idx_t to_idx)
Definition: duktape.c:19840
DUK_EXTERNAL_DECL const char * duk_get_string_default(duk_context *ctx, duk_idx_t idx, const char *def_value)
Definition: duktape.c:20507
DUK_EXTERNAL_DECL void duk_set_finalizer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:18628
DUK_EXTERNAL_DECL duk_idx_t duk_require_top_index(duk_context *ctx)
Definition: duktape.c:19309
DUK_EXTERNAL_DECL void duk_push_global_stash(duk_context *ctx)
Definition: duktape.c:23387
DUK_EXTERNAL_DECL void duk_to_null(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21428
DUK_EXTERNAL_DECL duk_c_function duk_get_c_function_default(duk_context *ctx, duk_idx_t idx, duk_c_function def_value)
Definition: duktape.c:21021
DUK_EXTERNAL_DECL void duk_debugger_pause(duk_context *ctx)
Definition: duktape.c:17071
DUK_EXTERNAL_DECL void duk_require_valid_index(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:19058
DUK_EXTERNAL_DECL void duk_push_null(duk_context *ctx)
Definition: duktape.c:22995
DUK_EXTERNAL_DECL void duk_new(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15522
DUK_EXTERNAL_DECL void duk_inspect_callstack_entry(duk_context *ctx, duk_int_t level)
Definition: duktape.c:17498
DUK_EXTERNAL_DECL void duk_xcopymove_raw(duk_context *to_ctx, duk_context *from_ctx, duk_idx_t count, duk_bool_t is_copy)
Definition: duktape.c:20080
DUK_EXTERNAL_DECL duk_double_t duk_random(duk_context *ctx)
Definition: duktape.c:18682
DUK_EXTERNAL_DECL duk_uint_t duk_get_uint(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20347
DUK_EXTERNAL_DECL duk_bool_t duk_equals(duk_context *ctx, duk_idx_t idx1, duk_idx_t idx2)
Definition: duktape.c:25194
DUK_EXTERNAL_DECL void duk_require_object(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20549
DUK_EXTERNAL_DECL duk_c_function duk_get_c_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20988
DUK_EXTERNAL_DECL duk_bool_t duk_is_pointer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22761
DUK_EXTERNAL_DECL duk_bool_t duk_put_global_heapptr(duk_context *ctx, void *ptr)
Definition: duktape.c:18499
DUK_EXTERNAL_DECL duk_bool_t duk_is_null(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22665
void(* duk_decode_char_function)(void *udata, duk_codepoint_t codepoint)
Definition: duktape.h:251
DUK_EXTERNAL_DECL void duk_push_this(duk_context *ctx)
Definition: duktape.c:23253
DUK_EXTERNAL_DECL duk_int_t duk_pcall_method(duk_context *ctx, duk_idx_t nargs)
Definition: duktape.c:15440
DUK_EXTERNAL_DECL duk_uint_t duk_get_type_mask(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22636
DUK_EXTERNAL_DECL duk_bool_t duk_is_buffer(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22728
DUK_EXTERNAL_DECL void duk_pop_3(duk_context *ctx)
Definition: duktape.c:24833
DUK_EXTERNAL_DECL duk_bool_t duk_next(duk_context *ctx, duk_idx_t enum_idx, duk_bool_t get_value)
Definition: duktape.c:18276
DUK_EXTERNAL_DECL duk_bool_t duk_put_prop_lstring(duk_context *ctx, duk_idx_t obj_idx, const char *key, duk_size_t key_len)
Definition: duktape.c:17849
DUK_EXTERNAL_DECL duk_errcode_t duk_get_error_code(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22923
DUK_EXTERNAL_DECL void duk_push_current_function(duk_context *ctx)
Definition: duktape.c:23334
DUK_EXTERNAL_DECL void duk_set_top(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:19098
DUK_EXTERNAL_DECL duk_uint16_t duk_to_uint16(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:21710
DUK_EXTERNAL_DECL duk_bool_t duk_get_global_literal_raw(duk_context *ctx, const char *key, duk_size_t key_len)
Definition: duktape.c:18421
DUK_EXTERNAL_DECL void duk_call_prop(duk_context *ctx, duk_idx_t obj_idx, duk_idx_t nargs)
Definition: duktape.c:15348
DUK_EXTERNAL_DECL duk_int_t duk_compile_raw(duk_context *ctx, const char *src_buffer, duk_size_t src_length, duk_uint_t flags)
Definition: duktape.c:16776
DUK_EXTERNAL_DECL duk_bool_t duk_is_function(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22798
DUK_EXTERNAL_DECL void * duk_to_buffer_raw(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, duk_uint_t flags)
Definition: duktape.c:22209
DUK_EXTERNAL_DECL void duk_enum(duk_context *ctx, duk_idx_t obj_idx, duk_uint_t enum_flags)
Definition: duktape.c:18268
DUK_EXTERNAL_DECL void duk_load_function(duk_context *ctx)
Definition: duktape.c:15133
DUK_EXTERNAL_DECL duk_bool_t duk_is_constructable(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22833
DUK_EXTERNAL_DECL duk_bool_t duk_is_symbol(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22771
DUK_EXTERNAL_DECL void duk_get_memory_functions(duk_context *ctx, duk_memory_functions *out_funcs)
Definition: duktape.c:17610
DUK_EXTERNAL_DECL void duk_push_uint(duk_context *ctx, duk_uint_t val)
Definition: duktape.c:23075
#define DUK_API_NORETURN(decl)
Definition: duktape.h:221
DUK_EXTERNAL_DECL const char * duk_to_string(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:22059
DUK_EXTERNAL_DECL void duk_free_raw(duk_context *ctx, void *ptr)
Definition: duktape.c:17570
DUK_EXTERNAL_DECL duk_c_function duk_opt_c_function(duk_context *ctx, duk_idx_t idx, duk_c_function def_value)
Definition: duktape.c:21012
DUK_EXTERNAL_DECL void duk_debugger_attach(duk_context *ctx, duk_debug_read_function read_cb, duk_debug_write_function write_cb, duk_debug_peek_function peek_cb, duk_debug_read_flush_function read_flush_cb, duk_debug_write_flush_function write_flush_cb, duk_debug_request_function request_cb, duk_debug_detached_function detached_cb, void *udata)
Definition: duktape.c:17021
DUK_EXTERNAL_DECL duk_bool_t duk_require_boolean(duk_context *ctx, duk_idx_t idx)
Definition: duktape.c:20243
const char * type
Definition: filetype.cpp:44
Definition: duktape.h:277
const char * key
Definition: duktape.h:278
duk_idx_t nargs
Definition: duktape.h:280
duk_c_function value
Definition: duktape.h:279
duk_free_function free_func
Definition: duktape.h:273
duk_realloc_function realloc_func
Definition: duktape.h:272
duk_alloc_function alloc_func
Definition: duktape.h:271
Definition: duktape.h:283
duk_double_t value
Definition: duktape.h:285
const char * key
Definition: duktape.h:284
char data[128]
Definition: duktape.h:267
duk_double_t month
Definition: duktape.h:290
duk_double_t seconds
Definition: duktape.h:294
duk_double_t year
Definition: duktape.h:289
duk_double_t hours
Definition: duktape.h:292
duk_double_t milliseconds
Definition: duktape.h:295
duk_double_t minutes
Definition: duktape.h:293
duk_double_t day
Definition: duktape.h:291
duk_double_t weekday
Definition: duktape.h:296
static nserror line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
Definition: plot.c:579