summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-06-07 16:01:04 +0100
committerVincent Sanders <vince@kyllikki.org>2016-06-07 16:01:04 +0100
commit042fcb82b83d19bf08afd3367235ac71a60b3850 (patch)
tree47fe3c15f160b3fac7b0e8ab4f47b495901e0557 /javascript
parent9754539e2275e33af34b5de9d343b85e8122d871 (diff)
downloadnetsurf-042fcb82b83d19bf08afd3367235ac71a60b3850.tar.gz
netsurf-042fcb82b83d19bf08afd3367235ac71a60b3850.tar.bz2
Move javascript content handler as appropriate for updated source format
Diffstat (limited to 'javascript')
-rw-r--r--javascript/Makefile34
-rw-r--r--javascript/WebIDL/Makefile57
-rw-r--r--javascript/WebIDL/console.idl24
-rw-r--r--javascript/WebIDL/cssom.idl157
-rw-r--r--javascript/WebIDL/dom-parsing.idl35
-rw-r--r--javascript/WebIDL/dom.idl479
-rw-r--r--javascript/WebIDL/html.idl2288
-rw-r--r--javascript/WebIDL/uievents.idl185
-rw-r--r--javascript/WebIDL/urlutils.idl65
-rw-r--r--javascript/content.c120
-rw-r--r--javascript/content.h1
-rw-r--r--javascript/duktape/Console.bnd177
-rw-r--r--javascript/duktape/Document.bnd445
-rw-r--r--javascript/duktape/Element.bnd379
-rw-r--r--javascript/duktape/Event.bnd150
-rw-r--r--javascript/duktape/HTMLAnchorElement.bnd39
-rw-r--r--javascript/duktape/HTMLAppletElement.bnd30
-rw-r--r--javascript/duktape/HTMLAreaElement.bnd26
-rw-r--r--javascript/duktape/HTMLBRElement.bnd14
-rw-r--r--javascript/duktape/HTMLBaseElement.bnd17
-rw-r--r--javascript/duktape/HTMLBodyElement.bnd24
-rw-r--r--javascript/duktape/HTMLButtonElement.bnd18
-rw-r--r--javascript/duktape/HTMLCollection.bnd24
-rw-r--r--javascript/duktape/HTMLDivElement.bnd14
-rw-r--r--javascript/duktape/HTMLElement.bnd162
-rw-r--r--javascript/duktape/HTMLFontElement.bnd20
-rw-r--r--javascript/duktape/HTMLFormElement.bnd26
-rw-r--r--javascript/duktape/HTMLFrameElement.bnd35
-rw-r--r--javascript/duktape/HTMLFrameSetElement.bnd17
-rw-r--r--javascript/duktape/HTMLHRElement.bnd24
-rw-r--r--javascript/duktape/HTMLHTMLElement.bnd14
-rw-r--r--javascript/duktape/HTMLHeadingElement.bnd14
-rw-r--r--javascript/duktape/HTMLIFrameElement.bnd41
-rw-r--r--javascript/duktape/HTMLImageElement.bnd47
-rw-r--r--javascript/duktape/HTMLInputElement.bnd64
-rw-r--r--javascript/duktape/HTMLLIElement.bnd17
-rw-r--r--javascript/duktape/HTMLLabelElement.bnd14
-rw-r--r--javascript/duktape/HTMLLegendElement.bnd14
-rw-r--r--javascript/duktape/HTMLLinkElement.bnd35
-rw-r--r--javascript/duktape/HTMLMapElement.bnd14
-rw-r--r--javascript/duktape/HTMLMarqueeElement.bnd11
-rw-r--r--javascript/duktape/HTMLMenuElement.bnd14
-rw-r--r--javascript/duktape/HTMLMetaElement.bnd23
-rw-r--r--javascript/duktape/HTMLOListElement.bnd18
-rw-r--r--javascript/duktape/HTMLObjectElement.bnd54
-rw-r--r--javascript/duktape/HTMLOptionElement.bnd28
-rw-r--r--javascript/duktape/HTMLParagraphElement.bnd14
-rw-r--r--javascript/duktape/HTMLParamElement.bnd23
-rw-r--r--javascript/duktape/HTMLPreElement.bnd15
-rw-r--r--javascript/duktape/HTMLQuoteElement.bnd14
-rw-r--r--javascript/duktape/HTMLScriptElement.bnd32
-rw-r--r--javascript/duktape/HTMLSelectElement.bnd26
-rw-r--r--javascript/duktape/HTMLStyleElement.bnd17
-rw-r--r--javascript/duktape/HTMLTableCaptionElement.bnd14
-rw-r--r--javascript/duktape/HTMLTableCellElement.bnd46
-rw-r--r--javascript/duktape/HTMLTableColElement.bnd26
-rw-r--r--javascript/duktape/HTMLTableElement.bnd38
-rw-r--r--javascript/duktape/HTMLTableRowElement.bnd30
-rw-r--r--javascript/duktape/HTMLTableSectionElement.bnd23
-rw-r--r--javascript/duktape/HTMLTextAreaElement.bnd30
-rw-r--r--javascript/duktape/HTMLTitleElement.bnd14
-rw-r--r--javascript/duktape/Location.bnd353
-rw-r--r--javascript/duktape/Makefile40
-rw-r--r--javascript/duktape/Navigator.bnd87
-rw-r--r--javascript/duktape/Node.bnd479
-rw-r--r--javascript/duktape/NodeList.bnd54
-rw-r--r--javascript/duktape/Window.bnd146
-rw-r--r--javascript/duktape/duk_config.h3753
-rw-r--r--javascript/duktape/duk_custom.h37
-rw-r--r--javascript/duktape/dukky.c1135
-rw-r--r--javascript/duktape/dukky.h45
-rw-r--r--javascript/duktape/duktape.c86513
-rw-r--r--javascript/duktape/duktape.h1567
-rw-r--r--javascript/duktape/netsurf.bnd200
-rw-r--r--javascript/fetcher.c217
-rw-r--r--javascript/fetcher.h28
-rw-r--r--javascript/js.h102
-rw-r--r--javascript/none/Makefile9
-rw-r--r--javascript/none/none.c70
79 files changed, 0 insertions, 100705 deletions
diff --git a/javascript/Makefile b/javascript/Makefile
deleted file mode 100644
index 36f123b64..000000000
--- a/javascript/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# NetSurf javascript source file inclusion
-#
-# Included by Makefile
-#
-
-# Check if jsapi is required
-ifeq ($(NETSURF_USE_JS),YES)
-WANT_JS_SOURCE := YES
-else
-ifeq ($(NETSURF_USE_MOZJS),YES)
-WANT_JS_SOURCE := YES
-endif
-endif
-
-S_JAVASCRIPT_BINDING:=
-
-ifeq ($(WANT_JS_SOURCE),YES)
-# JSAPI (spidemonkey)
-include javascript/jsapi/Makefile
-else
-ifeq ($(NETSURF_USE_DUKTAPE),YES)
-# Duktape
-include javascript/duktape/Makefile
-else
-# None
-include javascript/none/Makefile
-endif
-endif
-
-# Fetcher for javascript scheme is always required
-S_JAVASCRIPT += fetcher.c
-
-S_JAVASCRIPT := $(addprefix javascript/,$(S_JAVASCRIPT)) $(S_JAVASCRIPT_BINDING)
diff --git a/javascript/WebIDL/Makefile b/javascript/WebIDL/Makefile
deleted file mode 100644
index 7d901cee1..000000000
--- a/javascript/WebIDL/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/make
-#
-# Create the WebIDL for core DOM and HTML spec directly from
-# downloaded specifications. The resulting IDL is pretty close but
-# should be manually cleaned up and tagged with the retrival date and
-# source URL
-#
-# The dom spec has an index on the end that contains all the IDL a
-# second time! be aware htis needs removing or your IDL will have two
-# copies of all interfaces which is bad.
-#
-# needs debian packages: curl w3m tidy html-xml-utils
-#
-# Copyright 2012 Vincent Sanders
-# MIT licenced
-
-.PHONY:all clean
-
-all: dom.idl html.idl uievents.idl cssom.idl
-
-.INTERMEDIATE:dom-spec.html dom-spec.xml dom-idl.html
-.INTERMEDIATE:html-spec.html html-spec.xml html-idl.html
-.INTERMEDIATE:uievents-spec.html uievents-spec.xml uievents-idl.html
-.INTERMEDIATE:urlutils-spec.html urlutils-spec.xml urlutils-idl.html
-.INTERMEDIATE:cssom-spec.html cssom-spec.xml cssom-idl.html
-
-dom-spec.html:
- curl -s https://dom.spec.whatwg.org/ -o $@
-
-html-spec.html:
- curl -s https://html.spec.whatwg.org/ -o $@
-
-uievents-spec.html:
- curl -s http://www.w3.org/TR/uievents/ -o $@
-
-urlutils-spec.html:
- curl -s https://url.spec.whatwg.org/ -o $@
-
-cssom-spec.html:
- curl -s https://drafts.csswg.org/cssom-1/ -o $@
-
-%-spec.xml: %-spec.html
- -tidy -q -f $@.errors --new-blocklevel-tags header,hgroup,figure,time,main,nav,svg,rect,text,image,mark,figcaption,section,g,path,circle -o $@ -asxml $<
-
-%-idl.html: %-spec.xml
- hxselect 'pre[class="idl"]' < $< > $@
-
-%.idl: %-idl.html
- @echo "// Retrived from " >$@
- @echo "// $$(date)" >>$@
- @echo "" >>$@
- @echo "" >>$@
- cat $< | w3m -dump -T text/html >>$@
-
-
-clean:
- ${RM} dom.idl html.idl uievents.idl dom-spec.html dom-spec.xml dom-idl.html html-spec.html html-spec.xml html-idl.html uievents-spec.html uievents-spec.xml uievents-idl.html uievents-spec.xml.errors
diff --git a/javascript/WebIDL/console.idl b/javascript/WebIDL/console.idl
deleted file mode 100644
index 5a3d9eb27..000000000
--- a/javascript/WebIDL/console.idl
+++ /dev/null
@@ -1,24 +0,0 @@
-// de facto set of features for console object
-// https://developer.mozilla.org/en-US/docs/DOM/console
-// http://msdn.microsoft.com/en-us/library/dd565625%28v=vs.85%29.aspx#consolelogging
-// 31st October
-// Yay for non-standard standards
-
-interface Console {
- void debug(DOMString msg, Substitition... subst);
- void dir(JSObject object);
- void error(DOMString msg, Substitition... subst);
- void group();
- void groupCollapsed();
- void groupEnd();
- void info(DOMString msg, Substitition... subst);
- void log(DOMString msg, Substitition... subst);
- void time(DOMString timerName);
- void timeEnd(DOMString timerName);
- void trace();
- void warn(DOMString msg, Substitition... subst);
-};
-
-partial interface Window {
- readonly attribute Console console;
-}; \ No newline at end of file
diff --git a/javascript/WebIDL/cssom.idl b/javascript/WebIDL/cssom.idl
deleted file mode 100644
index 95c97e42a..000000000
--- a/javascript/WebIDL/cssom.idl
+++ /dev/null
@@ -1,157 +0,0 @@
-// Retrived from https://drafts.csswg.org/cssom-1/
-// Wed Nov 4 15:39:43 GMT 2015
-// Removed duplicate IDL from appendix
-
-
-[ArrayClass]interface MediaList {
- [TreatNullAs=EmptyString] stringifier attribute DOMString mediaText;
- readonly attribute unsigned long length;
- getter DOMString? item(unsigned long index );
- void appendMedium(DOMString medium );
- void deleteMedium(DOMString medium );
-};
-
-interface StyleSheet {
- readonly attribute DOMString type;
- readonly attribute DOMString? href;
- readonly attribute (Element or ProcessingInstruction)? ownerNode;
- readonly attribute StyleSheet? parentStyleSheet;
- readonly attribute DOMString? title;
- [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
- attribute boolean disabled;
-};
-
-interface CSSStyleSheet : StyleSheet {
- readonly attribute CSSRule? ownerRule;
- [SameObject] readonly attribute CSSRuleList cssRules;
- unsigned long insertRule(DOMString rule , unsigned long index );
- void deleteRule(unsigned long index );
-};
-
-[ArrayClass]interface StyleSheetList {
- getter StyleSheet? item(unsigned long index );
- readonly attribute unsigned long length;
-};
-
-partial interface Document {
- [SameObject] readonly attribute StyleSheetList styleSheets;
- attribute DOMString? selectedStyleSheetSet;
- readonly attribute DOMString? lastStyleSheetSet;
- readonly attribute DOMString? preferredStyleSheetSet;
- readonly attribute DOMString[] styleSheetSets;
- void enableStyleSheetsForSet(DOMString? name );
-};
-
-[NoInterfaceObject]interface LinkStyle {
- readonly attribute StyleSheet? sheet;
-};
-
-ProcessingInstruction implements LinkStyle;
-
-[ArrayClass]interface CSSRuleList {
- getter CSSRule? item(unsigned long index );
- readonly attribute unsigned long length;
-};
-
-interface CSSRule {
- const unsigned short STYLE_RULE = 1;
- const unsigned short CHARSET_RULE = 2; // historical
- const unsigned short IMPORT_RULE = 3;
- const unsigned short MEDIA_RULE = 4;
- const unsigned short FONT_FACE_RULE = 5;
- const unsigned short PAGE_RULE = 6;
- const unsigned short MARGIN_RULE = 9;
- const unsigned short NAMESPACE_RULE = 10;
- readonly attribute unsigned short type;
- attribute DOMString cssText;
- readonly attribute CSSRule? parentRule;
- readonly attribute CSSStyleSheet? parentStyleSheet;
-};
-
-interface CSSStyleRule : CSSRule {
- attribute DOMString selectorText;
- [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
-};
-
-interface CSSImportRule : CSSRule {
- readonly attribute DOMString href;
- [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
- [SameObject] readonly attribute CSSStyleSheet styleSheet;
-};
-
-interface CSSGroupingRule : CSSRule {
- [SameObject] readonly attribute CSSRuleList cssRules;
- unsigned long insertRule(DOMString rule , unsigned long index );
- void deleteRule(unsigned long index );
-};
-
-interface CSSMediaRule : CSSGroupingRule {
- [SameObject, PutForwards=mediaText] readonly attribute MediaList media ;
-};
-
-interface CSSPageRule : CSSGroupingRule {
- attribute DOMString selectorText ;
- [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style ;
-};
-
-interface CSSMarginRule : CSSRule {
- readonly attribute DOMString name;
- [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
-};
-
-interface CSSNamespaceRule : CSSRule {
- readonly attribute DOMString namespaceURI;
- readonly attribute DOMString prefix;
-};
-
-interface CSSStyleDeclaration {
- attribute DOMString cssText;
- readonly attribute unsigned long length;
- getter DOMString item(unsigned long index );
- DOMString getPropertyValue(DOMString property );
- DOMString getPropertyPriority(DOMString property );
- void setProperty(DOMString property , [TreatNullAs=EmptyString] DOMString value , [TreatNullAs=EmptyString] optional DOMString priority = "");
- void setPropertyValue(DOMString property , [TreatNullAs=EmptyString] DOMString value );
- void setPropertyPriority(DOMString property , [TreatNullAs=EmptyString] DOMString priority );
- DOMString removeProperty(DOMString property );
- readonly attribute CSSRule? parentRule;
- [TreatNullAs=EmptyString] attribute DOMString cssFloat;
-};
-
-partial interface CSSStyleDeclaration {
- [TreatNullAs=EmptyString] attribute DOMString _dashed_attribute ;
-};
-
-[NoInterfaceObject]interface ElementCSSInlineStyle {
- [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
-};
-
-HTMLElement implements ElementCSSInlineStyle;
-
-SVGElement implements ElementCSSInlineStyle;
-
-partial interface Window {
- [NewObject] CSSStyleDeclaration getComputedStyle(Element elt , optional DOMString? pseudoElt );
-};
-
-[NoInterfaceObject]interface GetStyleUtils {
- [SameObject] readonly attribute CSSStyleDeclaration cascadedStyle;
- [SameObject] readonly attribute CSSStyleDeclaration defaultStyle;
- [SameObject] readonly attribute CSSStyleDeclaration rawComputedStyle;
- [SameObject] readonly attribute CSSStyleDeclaration usedStyle;
-};
-
-partial interface Element {
- PseudoElement? pseudo(DOMString pseudoElt );
-};
-
-Element implements GetStyleUtils;
-
-interface PseudoElement {
-};
-
-PseudoElement implements GetStyleUtils;
-
-interface CSS {
- static DOMString escape(DOMString ident );
-};
diff --git a/javascript/WebIDL/dom-parsing.idl b/javascript/WebIDL/dom-parsing.idl
deleted file mode 100644
index d2581328e..000000000
--- a/javascript/WebIDL/dom-parsing.idl
+++ /dev/null
@@ -1,35 +0,0 @@
-// Retrived from http://www.w3.org/TR/DOM-Parsing/
-// Wed Nov 4 15:39:43 GMT 2015
-// Manually extracted IDL
-
-enum SupportedType {
- "text/html",
- "text/xml",
- "application/xml",
- "application/xhtml+xml",
- "image/svg+xml"
-};
-
-[Constructor]
-interface DOMParser {
- [NewObject]
- Document parseFromString (DOMString str, SupportedType type);
-};
-
-[Constructor]
-interface XMLSerializer {
- DOMString serializeToString (Node root);
-};
-
-partial interface Element {
- [TreatNullAs=EmptyString]
- attribute DOMString innerHTML;
- [TreatNullAs=EmptyString]
- attribute DOMString outerHTML;
- void insertAdjacentHTML (DOMString position, DOMString text);
-};
-
-partial interface Range {
- [NewObject]
- DocumentFragment createContextualFragment (DOMString fragment);
-};
diff --git a/javascript/WebIDL/dom.idl b/javascript/WebIDL/dom.idl
deleted file mode 100644
index 1c9e75bd8..000000000
--- a/javascript/WebIDL/dom.idl
+++ /dev/null
@@ -1,479 +0,0 @@
-// DOM web IDL
-// Retrived from https://dom.spec.whatwg.org/
-// Sat Jul 18 2015
-
-
-[Constructor(DOMString type, optional EventInit eventInitDict),
- Exposed=(Window,Worker)]
-interface Event {
- readonly attribute DOMString type;
- readonly attribute EventTarget? target;
- readonly attribute EventTarget? currentTarget;
-
- const unsigned short NONE = 0;
- const unsigned short CAPTURING_PHASE = 1;
- const unsigned short AT_TARGET = 2;
- const unsigned short BUBBLING_PHASE = 3;
- readonly attribute unsigned short eventPhase;
-
- void stopPropagation();
- void stopImmediatePropagation();
-
- readonly attribute boolean bubbles;
- readonly attribute boolean cancelable;
- void preventDefault();
- readonly attribute boolean defaultPrevented;
-
- [Unforgeable] readonly attribute boolean isTrusted;
- readonly attribute DOMTimeStamp timeStamp;
-
- void initEvent(DOMString type, boolean bubbles, boolean cancelable);
-};
-
-dictionary EventInit {
- boolean bubbles = false;
- boolean cancelable = false;
-};
-
-[Constructor(DOMString type, optional CustomEventInit eventInitDict),
- Exposed=(Window,Worker)]
-interface CustomEvent : Event {
- readonly attribute any detail;
-
- void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any detail);
-};
-
-dictionary CustomEventInit : EventInit {
- any detail = null;
-};
-
-[Exposed=(Window,Worker)]
-interface EventTarget {
- void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
- void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
- boolean dispatchEvent(Event event);
-};
-
-callback interface EventListener {
- void handleEvent(Event event);
-};
-
-[NoInterfaceObject,
- Exposed=Window]
-interface NonElementParentNode {
- Element? getElementById(DOMString elementId);
-};
-Document implements NonElementParentNode;
-DocumentFragment implements NonElementParentNode;
-
-[NoInterfaceObject,
- Exposed=Window]
-interface ParentNode {
- [SameObject] readonly attribute HTMLCollection children;
- readonly attribute Element? firstElementChild;
- readonly attribute Element? lastElementChild;
- readonly attribute unsigned long childElementCount;
-
- [Unscopeable] void prepend((Node or DOMString)... nodes);
- [Unscopeable] void append((Node or DOMString)... nodes);
-
- [Unscopeable] Element? query(DOMString relativeSelectors);
- [NewObject, Unscopeable] Elements queryAll(DOMString relativeSelectors);
- Element? querySelector(DOMString selectors);
- [NewObject] NodeList querySelectorAll(DOMString selectors);
-};
-Document implements ParentNode;
-DocumentFragment implements ParentNode;
-Element implements ParentNode;
-
-[NoInterfaceObject,
- Exposed=Window]
-interface NonDocumentTypeChildNode {
- readonly attribute Element? previousElementSibling;
- readonly attribute Element? nextElementSibling;
-};
-Element implements NonDocumentTypeChildNode;
-CharacterData implements NonDocumentTypeChildNode;
-
-[NoInterfaceObject,
- Exposed=Window]
-interface ChildNode {
- [Unscopeable] void before((Node or DOMString)... nodes);
- [Unscopeable] void after((Node or DOMString)... nodes);
- [Unscopeable] void replaceWith((Node or DOMString)... nodes);
- [Unscopeable] void remove();
-};
-DocumentType implements ChildNode;
-Element implements ChildNode;
-CharacterData implements ChildNode;
-
-//class Elements extends Array {
-// Element? query(DOMString relativeSelectors);
-// Elements queryAll(DOMString relativeSelectors);
-//};
-
-[Exposed=Window]
-interface NodeList {
- getter Node? item(unsigned long index);
- readonly attribute unsigned long length;
- iterable<Node>;
-};
-
-[Exposed=Window]
-interface HTMLCollection {
- readonly attribute unsigned long length;
- getter Element? item(unsigned long index);
- getter Element? namedItem(DOMString name);
-};
-
-[Constructor(MutationCallback callback)]
-interface MutationObserver {
- void observe(Node target, MutationObserverInit options);
- void disconnect();
- sequence<MutationRecord> takeRecords();
-};
-
-callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
-
-dictionary MutationObserverInit {
- boolean childList = false;
- boolean attributes;
- boolean characterData;
- boolean subtree = false;
- boolean attributeOldValue;
- boolean characterDataOldValue;
- sequence<DOMString> attributeFilter;
-};
-
-[Exposed=Window]
-interface MutationRecord {
- readonly attribute DOMString type;
- readonly attribute Node target;
- [SameObject] readonly attribute NodeList addedNodes;
- [SameObject] readonly attribute NodeList removedNodes;
- readonly attribute Node? previousSibling;
- readonly attribute Node? nextSibling;
- readonly attribute DOMString? attributeName;
- readonly attribute DOMString? attributeNamespace;
- readonly attribute DOMString? oldValue;
-};
-
-[Exposed=Window]
-interface Node : EventTarget {
- const unsigned short ELEMENT_NODE = 1;
- const unsigned short ATTRIBUTE_NODE = 2; // historical
- const unsigned short TEXT_NODE = 3;
- const unsigned short CDATA_SECTION_NODE = 4; // historical
- const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
- const unsigned short ENTITY_NODE = 6; // historical
- const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
- const unsigned short COMMENT_NODE = 8;
- const unsigned short DOCUMENT_NODE = 9;
- const unsigned short DOCUMENT_TYPE_NODE = 10;
- const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
- const unsigned short NOTATION_NODE = 12; // historical
- readonly attribute unsigned short nodeType;
- readonly attribute DOMString nodeName;
-
- readonly attribute DOMString? baseURI;
-
- readonly attribute Document? ownerDocument;
- readonly attribute Node? parentNode;
- readonly attribute Element? parentElement;
- boolean hasChildNodes();
- [SameObject] readonly attribute NodeList childNodes;
- readonly attribute Node? firstChild;
- readonly attribute Node? lastChild;
- readonly attribute Node? previousSibling;
- readonly attribute Node? nextSibling;
-
- attribute DOMString? nodeValue;
- attribute DOMString? textContent;
- void normalize();
-
- [NewObject] Node cloneNode(optional boolean deep = false);
- boolean isEqualNode(Node? otherNode);
-
- const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
- const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
- const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
- const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
- const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
- const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
- unsigned short compareDocumentPosition(Node other);
- boolean contains(Node? other);
-
- DOMString? lookupPrefix(DOMString? namespace);
- DOMString? lookupNamespaceURI(DOMString? prefix);
- boolean isDefaultNamespace(DOMString? namespace);
-
- Node insertBefore(Node node, Node? child);
- Node appendChild(Node node);
- Node replaceChild(Node node, Node child);
- Node removeChild(Node child);
-};
-
-[Constructor,
- Exposed=Window]
-interface Document : Node {
- [SameObject] readonly attribute DOMImplementation implementation;
- readonly attribute DOMString URL;
- readonly attribute DOMString documentURI;
- readonly attribute DOMString origin;
- readonly attribute DOMString compatMode;
- readonly attribute DOMString characterSet;
- readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
- readonly attribute DOMString contentType;
-
- readonly attribute DocumentType? doctype;
- readonly attribute Element? documentElement;
- HTMLCollection getElementsByTagName(DOMString localName);
- HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
- HTMLCollection getElementsByClassName(DOMString classNames);
-
- [NewObject] Element createElement(DOMString localName);
- [NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName);
- [NewObject] DocumentFragment createDocumentFragment();
- [NewObject] Text createTextNode(DOMString data);
- [NewObject] Comment createComment(DOMString data);
- [NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
-
- [NewObject] Node importNode(Node node, optional boolean deep = false);
- Node adoptNode(Node node);
-
- [NewObject] Attr createAttribute(DOMString localName);
- [NewObject] Attr createAttributeNS(DOMString? namespace, DOMString name);
-
- [NewObject] Event createEvent(DOMString interface);
-
- [NewObject] Range createRange();
-
- // NodeFilter.SHOW_ALL = 0xFFFFFFFF
- [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
- [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
-};
-
-[Exposed=Window]
-interface XMLDocument : Document {};
-
-[Exposed=Window]
-interface DOMImplementation {
- [NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
- [NewObject] XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
- [NewObject] Document createHTMLDocument(optional DOMString title);
-
- boolean hasFeature(); // useless; always returns true
-};
-
-[Constructor,
- Exposed=Window]
-interface DocumentFragment : Node {
-};
-
-[Exposed=Window]
-interface DocumentType : Node {
- readonly attribute DOMString name;
- readonly attribute DOMString publicId;
- readonly attribute DOMString systemId;
-};
-
-[Exposed=Window]
-interface Element : Node {
- readonly attribute DOMString? namespaceURI;
- readonly attribute DOMString? prefix;
- readonly attribute DOMString localName;
- readonly attribute DOMString tagName;
-
- attribute DOMString id;
- attribute DOMString className;
- [SameObject] readonly attribute DOMTokenList classList;
-
- boolean hasAttributes();
- [SameObject] readonly attribute NamedNodeMap attributes;
- DOMString? getAttribute(DOMString name);
- DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
- void setAttribute(DOMString name, DOMString value);
- void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
- void removeAttribute(DOMString name);
- void removeAttributeNS(DOMString? namespace, DOMString localName);
- boolean hasAttribute(DOMString name);
- boolean hasAttributeNS(DOMString? namespace, DOMString localName);
-
- Attr? getAttributeNode(DOMString name);
- Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
- Attr? setAttributeNode(Attr attr);
- Attr? setAttributeNodeNS(Attr attr);
- Attr removeAttributeNode(Attr attr);
-
- Element? closest(DOMString selectors);
- boolean matches(DOMString selectors);
-
- HTMLCollection getElementsByTagName(DOMString localName);
- HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
- HTMLCollection getElementsByClassName(DOMString classNames);
-};
-[Exposed=Window]
-interface NamedNodeMap {
- readonly attribute unsigned long length;
- getter Attr? item(unsigned long index);
- getter Attr? getNamedItem(DOMString name);
- Attr? getNamedItemNS(DOMString? namespace, DOMString localName);
- Attr? setNamedItem(Attr attr);
- Attr? setNamedItemNS(Attr attr);
- Attr removeNamedItem(DOMString name);
- Attr removeNamedItemNS(DOMString? namespace, DOMString localName);
-};
-
-[Exposed=Window]
-interface Attr {
- readonly attribute DOMString? namespaceURI;
- readonly attribute DOMString? prefix;
- readonly attribute DOMString localName;
- readonly attribute DOMString name;
- attribute DOMString value;
- [TreatNullAs=EmptyString] attribute DOMString nodeValue; // legacy alias of .value
- [TreatNullAs=EmptyString] attribute DOMString textContent; // legacy alias of .value
-
- readonly attribute Element? ownerElement;
-
- readonly attribute boolean specified; // useless; always returns true
-};
-[Exposed=Window]
-interface CharacterData : Node {
- [TreatNullAs=EmptyString] attribute DOMString data;
- readonly attribute unsigned long length;
- DOMString substringData(unsigned long offset, unsigned long count);
- void appendData(DOMString data);
- void insertData(unsigned long offset, DOMString data);
- void deleteData(unsigned long offset, unsigned long count);
- void replaceData(unsigned long offset, unsigned long count, DOMString data);
-};
-
-[Constructor(optional DOMString data = ""),
- Exposed=Window]
-interface Text : CharacterData {
- [NewObject] Text splitText(unsigned long offset);
- readonly attribute DOMString wholeText;
-};
-[Exposed=Window]
-interface ProcessingInstruction : CharacterData {
- readonly attribute DOMString target;
-};
-[Constructor(optional DOMString data = ""),
- Exposed=Window]
-interface Comment : CharacterData {
-};
-
-[Constructor,
- Exposed=Window]
-interface Range {
- readonly attribute Node startContainer;
- readonly attribute unsigned long startOffset;
- readonly attribute Node endContainer;
- readonly attribute unsigned long endOffset;
- readonly attribute boolean collapsed;
- readonly attribute Node commonAncestorContainer;
-
- void setStart(Node node, unsigned long offset);
- void setEnd(Node node, unsigned long offset);
- void setStartBefore(Node node);
- void setStartAfter(Node node);
- void setEndBefore(Node node);
- void setEndAfter(Node node);
- void collapse(optional boolean toStart = false);
- void selectNode(Node node);
- void selectNodeContents(Node node);
-
- const unsigned short START_TO_START = 0;
- const unsigned short START_TO_END = 1;
- const unsigned short END_TO_END = 2;
- const unsigned short END_TO_START = 3;
- short compareBoundaryPoints(unsigned short how, Range sourceRange);
-
- void deleteContents();
- [NewObject] DocumentFragment extractContents();
- [NewObject] DocumentFragment cloneContents();
- void insertNode(Node node);
- void surroundContents(Node newParent);
-
- [NewObject] Range cloneRange();
- void detach();
-
- boolean isPointInRange(Node node, unsigned long offset);
- short comparePoint(Node node, unsigned long offset);
-
- boolean intersectsNode(Node node);
-
- stringifier;
-};
-
-[Exposed=Window]
-interface NodeIterator {
- [SameObject] readonly attribute Node root;
- readonly attribute Node referenceNode;
- readonly attribute boolean pointerBeforeReferenceNode;
- readonly attribute unsigned long whatToShow;
- readonly attribute NodeFilter? filter;
-
- Node? nextNode();
- Node? previousNode();
-
- void detach();
-};
-
-[Exposed=Window]
-interface TreeWalker {
- [SameObject] readonly attribute Node root;
- readonly attribute unsigned long whatToShow;
- readonly attribute NodeFilter? filter;
- attribute Node currentNode;
-
- Node? parentNode();
- Node? firstChild();
- Node? lastChild();
- Node? previousSibling();
- Node? nextSibling();
- Node? previousNode();
- Node? nextNode();
-};
-[Exposed=Window]
-callback interface NodeFilter {
- // Constants for acceptNode()
- const unsigned short FILTER_ACCEPT = 1;
- const unsigned short FILTER_REJECT = 2;
- const unsigned short FILTER_SKIP = 3;
-
- // Constants for whatToShow
- const unsigned long SHOW_ALL = 0xFFFFFFFF;
- const unsigned long SHOW_ELEMENT = 0x1;
- const unsigned long SHOW_ATTRIBUTE = 0x2; // historical
- const unsigned long SHOW_TEXT = 0x4;
- const unsigned long SHOW_CDATA_SECTION = 0x8; // historical
- const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical
- const unsigned long SHOW_ENTITY = 0x20; // historical
- const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
- const unsigned long SHOW_COMMENT = 0x80;
- const unsigned long SHOW_DOCUMENT = 0x100;
- const unsigned long SHOW_DOCUMENT_TYPE = 0x200;
- const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
- const unsigned long SHOW_NOTATION = 0x800; // historical
-
- unsigned short acceptNode(Node node);
-};
-
-interface DOMTokenList {
- readonly attribute unsigned long length;
- getter DOMString? item(unsigned long index);
- boolean contains(DOMString token);
- void add(DOMString... tokens);
- void remove(DOMString... tokens);
- boolean toggle(DOMString token, optional boolean force);
- stringifier;
- iterable<DOMString>;
-};
-
-interface DOMSettableTokenList : DOMTokenList {
- attribute DOMString value;
-};
-
-
diff --git a/javascript/WebIDL/html.idl b/javascript/WebIDL/html.idl
deleted file mode 100644
index 73112f002..000000000
--- a/javascript/WebIDL/html.idl
+++ /dev/null
@@ -1,2288 +0,0 @@
-// HTML web IDL
-// Retrived from https://html.spec.whatwg.org/
-// Mon Oct 5 2015
-
-
-typedef (Int8Array or Uint8Array or Uint8ClampedArray or
- Int16Array or Uint16Array or
- Int32Array or Uint32Array or
- Float32Array or Float64Array or
- DataView) ArrayBufferView;
-
-interface HTMLAllCollection {
- readonly attribute unsigned long length;
- getter Element? item(unsigned long index);
- (HTMLCollection or Element)? item(DOMString name);
- legacycaller getter (HTMLCollection or Element)? namedItem(DOMString name);
-};
-
-interface HTMLFormControlsCollection : HTMLCollection {
- // inherits length and item()
- getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem()
-};
-
-interface RadioNodeList : NodeList {
- attribute DOMString value;
-};
-
-interface HTMLOptionsCollection : HTMLCollection {
- // inherits item(), namedItem()
- attribute unsigned long length; // shadows inherited length
- setter void (unsigned long index, HTMLOptionElement? option);
- void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
- void remove(long index);
- attribute long selectedIndex;
-};
-
-[OverrideBuiltins, Exposed=(Window,Worker)]
-interface DOMStringMap {
- getter DOMString (DOMString name);
- setter void (DOMString name, DOMString value);
- deleter void (DOMString name);
-};
-
-interface DOMElementMap {
- getter Element (DOMString name);
- setter void (DOMString name, Element value);
- deleter void (DOMString name);
-};
-
-typedef (ArrayBuffer or CanvasProxy or MessagePort) Transferable;
-
-callback FileCallback = void (File file);
-
-enum DocumentReadyState { "loading", "interactive", "complete" };
-
-[OverrideBuiltins]
-partial /*sealed*/ interface Document {
- // resource metadata management
- [PutForwards=href, Unforgeable] readonly attribute Location? location;
- attribute DOMString domain;
- readonly attribute DOMString referrer;
- attribute DOMString cookie;
- readonly attribute DOMString lastModified;
- readonly attribute DocumentReadyState readyState;
-
- // DOM tree accessors
- getter object (DOMString name);
- attribute DOMString title;
- attribute DOMString dir;
- attribute HTMLElement? body;
- readonly attribute HTMLHeadElement? head;
- [SameObject] readonly attribute HTMLCollection images;
- [SameObject] readonly attribute HTMLCollection embeds;
- [SameObject] readonly attribute HTMLCollection plugins;
- [SameObject] readonly attribute HTMLCollection links;
- [SameObject] readonly attribute HTMLCollection forms;
- [SameObject] readonly attribute HTMLCollection scripts;
- NodeList getElementsByName(DOMString elementName);
- [SameObject] readonly attribute DOMElementMap cssElementMap;
- readonly attribute HTMLScriptElement? currentScript;
-
- // dynamic markup insertion
- Document open(optional DOMString type = "text/html", optional DOMString replace = "");
- WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
- void close();
- void write(DOMString... text);
- void writeln(DOMString... text);
-
- // user interaction
- readonly attribute WindowProxy? defaultView;
- readonly attribute Element? activeElement;
- boolean hasFocus();
- attribute DOMString designMode;
- boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
- boolean queryCommandEnabled(DOMString commandId);
- boolean queryCommandIndeterm(DOMString commandId);
- boolean queryCommandState(DOMString commandId);
- boolean queryCommandSupported(DOMString commandId);
- DOMString queryCommandValue(DOMString commandId);
- readonly attribute HTMLCollection commands;
-
- // special event handler IDL attributes that only apply to Document objects
- [LenientThis] attribute EventHandler onreadystatechange;
-
- // also has obsolete members
-};
-Document implements GlobalEventHandlers;
-
-partial interface XMLDocument {
- boolean load(DOMString url);
-};
-
-interface HTMLElement : Element {
- // metadata attributes
- attribute DOMString title;
- attribute DOMString lang;
- attribute boolean translate;
- attribute DOMString dir;
- [SameObject] readonly attribute DOMStringMap dataset;
-
- // user interaction
- attribute boolean hidden;
- void click();
- attribute long tabIndex;
- void focus();
- void blur();
- attribute DOMString accessKey;
- readonly attribute DOMString accessKeyLabel;
- attribute boolean draggable;
- [PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
- attribute HTMLMenuElement? contextMenu;
- attribute boolean spellcheck;
- void forceSpellCheck();
-
- // command API
- readonly attribute DOMString? commandType;
- readonly attribute DOMString? commandLabel;
- readonly attribute DOMString? commandIcon;
- readonly attribute boolean? commandHidden;
- readonly attribute boolean? commandDisabled;
- readonly attribute boolean? commandChecked;
-};
-HTMLElement implements GlobalEventHandlers;
-HTMLElement implements ElementContentEditable;
-
-interface HTMLUnknownElement : HTMLElement { };
-
-interface HTMLHtmlElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLHeadElement : HTMLElement {};
-
-interface HTMLTitleElement : HTMLElement {
- attribute DOMString text;
-};
-
-interface HTMLBaseElement : HTMLElement {
- attribute DOMString href;
- attribute DOMString target;
-};
-
-interface HTMLLinkElement : HTMLElement {
- attribute DOMString href;
- attribute DOMString? crossOrigin;
- attribute DOMString rel;
- readonly attribute DOMTokenList relList;
- attribute DOMString media;
- attribute DOMString hreflang;
- attribute DOMString type;
- [PutForwards=value] readonly attribute DOMSettableTokenList sizes;
-
- // also has obsolete members
-};
-HTMLLinkElement implements LinkStyle;
-
-interface HTMLMetaElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString httpEquiv;
- attribute DOMString content;
-
- // also has obsolete members
-};
-
-interface HTMLStyleElement : HTMLElement {
- attribute DOMString media;
- attribute DOMString nonce;
- attribute DOMString type;
- attribute boolean scoped;
-};
-HTMLStyleElement implements LinkStyle;
-
-interface HTMLBodyElement : HTMLElement {
-
- // also has obsolete members
-};
-HTMLBodyElement implements WindowEventHandlers;
-
-interface HTMLHeadingElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLParagraphElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLHRElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLPreElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLQuoteElement : HTMLElement {
- attribute DOMString cite;
-};
-
-interface HTMLOListElement : HTMLElement {
- attribute boolean reversed;
- attribute long start;
- attribute DOMString type;
-
- // also has obsolete members
-};
-
-interface HTMLUListElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLLIElement : HTMLElement {
- attribute long value;
-
- // also has obsolete members
-};
-
-interface HTMLDListElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLDivElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLAnchorElement : HTMLElement {
- attribute DOMString target;
- attribute DOMString download;
- [PutForwards=value] readonly attribute DOMSettableTokenList ping;
- attribute DOMString rel;
- readonly attribute DOMTokenList relList;
- attribute DOMString hreflang;
- attribute DOMString type;
-
- attribute DOMString text;
-
- // also has obsolete members
-};
-HTMLAnchorElement implements URLUtils;
-
-interface HTMLDataElement : HTMLElement {
- attribute DOMString value;
-};
-
-interface HTMLTimeElement : HTMLElement {
- attribute DOMString dateTime;
-};
-
-interface HTMLSpanElement : HTMLElement {};
-
-interface HTMLBRElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLModElement : HTMLElement {
- attribute DOMString cite;
- attribute DOMString dateTime;
-};
-
-interface HTMLPictureElement : HTMLElement {};
-
-partial interface HTMLSourceElement {
- attribute DOMString srcset;
- attribute DOMString sizes;
- attribute DOMString media;
-};
-
-[NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
-interface HTMLImageElement : HTMLElement {
- attribute DOMString alt;
- attribute DOMString src;
- attribute DOMString srcset;
- attribute DOMString sizes;
- attribute DOMString? crossOrigin;
- attribute DOMString useMap;
- attribute boolean isMap;
- attribute unsigned long width;
- attribute unsigned long height;
- readonly attribute unsigned long naturalWidth;
- readonly attribute unsigned long naturalHeight;
- readonly attribute boolean complete;
- readonly attribute DOMString currentSrc;
-
- // also has obsolete members
-};
-
-interface HTMLIFrameElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString srcdoc;
- attribute DOMString name;
- [PutForwards=value] readonly attribute DOMSettableTokenList sandbox;
- attribute boolean seamless;
- attribute boolean allowFullscreen;
- attribute DOMString width;
- attribute DOMString height;
- readonly attribute Document? contentDocument;
- readonly attribute WindowProxy? contentWindow;
- Document? getSVGDocument();
-
- // also has obsolete members
-};
-
-interface HTMLEmbedElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString type;
- attribute DOMString width;
- attribute DOMString height;
- Document? getSVGDocument();
- legacycaller any (any... arguments);
-
- // also has obsolete members
-};
-
-interface HTMLObjectElement : HTMLElement {
- attribute DOMString data;
- attribute DOMString type;
- attribute boolean typeMustMatch;
- attribute DOMString name;
- attribute DOMString useMap;
- readonly attribute HTMLFormElement? form;
- attribute DOMString width;
- attribute DOMString height;
- readonly attribute Document? contentDocument;
- readonly attribute WindowProxy? contentWindow;
- Document? getSVGDocument();
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- legacycaller any (any... arguments);
-
- // also has obsolete members
-};
-
-interface HTMLParamElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString value;
-
- // also has obsolete members
-};
-
-interface HTMLVideoElement : HTMLMediaElement {
- attribute unsigned long width;
- attribute unsigned long height;
- readonly attribute unsigned long videoWidth;
- readonly attribute unsigned long videoHeight;
- attribute DOMString poster;
-};
-
-[NamedConstructor=Audio(optional DOMString src)]
-interface HTMLAudioElement : HTMLMediaElement {};
-
-interface HTMLSourceElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString type;
-
- // also has obsolete members
-};
-
-interface HTMLTrackElement : HTMLElement {
- attribute DOMString kind;
- attribute DOMString src;
- attribute DOMString srclang;
- attribute DOMString label;
- attribute boolean default;
-
- const unsigned short NONE = 0;
- const unsigned short LOADING = 1;
- const unsigned short LOADED = 2;
- const unsigned short ERROR = 3;
- readonly attribute unsigned short readyState;
-
- readonly attribute TextTrack track;
-};
-
-enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" };
-typedef (MediaStream or MediaSource or Blob) MediaProvider;
-interface HTMLMediaElement : HTMLElement {
-
- // error state
- readonly attribute MediaError? error;
-
- // network state
- attribute DOMString src;
- attribute MediaProvider? srcObject;
- readonly attribute DOMString currentSrc;
- attribute DOMString? crossOrigin;
- const unsigned short NETWORK_EMPTY = 0;
- const unsigned short NETWORK_IDLE = 1;
- const unsigned short NETWORK_LOADING = 2;
- const unsigned short NETWORK_NO_SOURCE = 3;
- readonly attribute unsigned short networkState;
- attribute DOMString preload;
- readonly attribute TimeRanges buffered;
- void load();
- CanPlayTypeResult canPlayType(DOMString type);
-
- // ready state
- const unsigned short HAVE_NOTHING = 0;
- const unsigned short HAVE_METADATA = 1;
- const unsigned short HAVE_CURRENT_DATA = 2;
- const unsigned short HAVE_FUTURE_DATA = 3;
- const unsigned short HAVE_ENOUGH_DATA = 4;
- readonly attribute unsigned short readyState;
- readonly attribute boolean seeking;
-
- // playback state
- attribute double currentTime;
- void fastSeek(double time);
- readonly attribute unrestricted double duration;
- Date getStartDate();
- readonly attribute boolean paused;
- attribute double defaultPlaybackRate;
- attribute double playbackRate;
- readonly attribute TimeRanges played;
- readonly attribute TimeRanges seekable;
- readonly attribute boolean ended;
- attribute boolean autoplay;
- attribute boolean loop;
- void play();
- void pause();
-
- // media controller
- attribute DOMString mediaGroup;
- attribute MediaController? controller;
-
- // controls
- attribute boolean controls;
- attribute double volume;
- attribute boolean muted;
- attribute boolean defaultMuted;
-
- // tracks
- [SameObject] readonly attribute AudioTrackList audioTracks;
- [SameObject] readonly attribute VideoTrackList videoTracks;
- [SameObject] readonly attribute TextTrackList textTracks;
- TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = "");
-};
-
-interface MediaError {
- const unsigned short MEDIA_ERR_ABORTED = 1;
- const unsigned short MEDIA_ERR_NETWORK = 2;
- const unsigned short MEDIA_ERR_DECODE = 3;
- const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
- readonly attribute unsigned short code;
-};
-
-interface AudioTrackList : EventTarget {
- readonly attribute unsigned long length;
- getter AudioTrack (unsigned long index);
- AudioTrack? getTrackById(DOMString id);
-
- attribute EventHandler onchange;
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
-};
-
-interface AudioTrack {
- readonly attribute DOMString id;
- readonly attribute DOMString kind;
- readonly attribute DOMString label;
- readonly attribute DOMString language;
- attribute boolean enabled;
-};
-
-interface VideoTrackList : EventTarget {
- readonly attribute unsigned long length;
- getter VideoTrack (unsigned long index);
- VideoTrack? getTrackById(DOMString id);
- readonly attribute long selectedIndex;
-
- attribute EventHandler onchange;
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
-};
-
-interface VideoTrack {
- readonly attribute DOMString id;
- readonly attribute DOMString kind;
- readonly attribute DOMString label;
- readonly attribute DOMString language;
- attribute boolean selected;
-};
-
-enum MediaControllerPlaybackState { "waiting", "playing", "ended" };
-[Constructor]
-interface MediaController : EventTarget {
- readonly attribute unsigned short readyState; // uses HTMLMediaElement.readyState's values
-
- readonly attribute TimeRanges buffered;
- readonly attribute TimeRanges seekable;
- readonly attribute unrestricted double duration;
- attribute double currentTime;
-
- readonly attribute boolean paused;
- readonly attribute MediaControllerPlaybackState playbackState;
- readonly attribute TimeRanges played;
- void pause();
- void unpause();
- void play(); // calls play() on all media elements as well
-
- attribute double defaultPlaybackRate;
- attribute double playbackRate;
-
- attribute double volume;
- attribute boolean muted;
-
- attribute EventHandler onemptied;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadeddata;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onplaying;
- attribute EventHandler onended;
- attribute EventHandler onwaiting;
-
- attribute EventHandler ondurationchange;
- attribute EventHandler ontimeupdate;
- attribute EventHandler onplay;
- attribute EventHandler onpause;
- attribute EventHandler onratechange;
- attribute EventHandler onvolumechange;
-};
-
-interface TextTrackList : EventTarget {
- readonly attribute unsigned long length;
- getter TextTrack (unsigned long index);
- TextTrack? getTrackById(DOMString id);
-
- attribute EventHandler onchange;
- attribute EventHandler onaddtrack;
- attribute EventHandler onremovetrack;
-};
-
-enum TextTrackMode { "disabled", "hidden", "showing" };
-enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" };
-interface TextTrack : EventTarget {
- readonly attribute TextTrackKind kind;
- readonly attribute DOMString label;
- readonly attribute DOMString language;
-
- readonly attribute DOMString id;
- readonly attribute DOMString inBandMetadataTrackDispatchType;
-
- attribute TextTrackMode mode;
-
- readonly attribute TextTrackCueList? cues;
- readonly attribute TextTrackCueList? activeCues;
-
- void addCue(TextTrackCue cue);
- void removeCue(TextTrackCue cue);
-
- attribute EventHandler oncuechange;
-};
-
-interface TextTrackCueList {
- readonly attribute unsigned long length;
- getter TextTrackCue (unsigned long index);
- TextTrackCue? getCueById(DOMString id);
-};
-
-interface TextTrackCue : EventTarget {
- readonly attribute TextTrack? track;
-
- attribute DOMString id;
- attribute double startTime;
- attribute double endTime;
- attribute boolean pauseOnExit;
-
- attribute EventHandler onenter;
- attribute EventHandler onexit;
-};
-
-interface TimeRanges {
- readonly attribute unsigned long length;
- double start(unsigned long index);
- double end(unsigned long index);
-};
-
-[Constructor(DOMString type, optional TrackEventInit eventInitDict)]
-interface TrackEvent : Event {
- readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
-};
-
-dictionary TrackEventInit : EventInit {
- (VideoTrack or AudioTrack or TextTrack)? track;
-};
-
-interface HTMLMapElement : HTMLElement {
- attribute DOMString name;
- readonly attribute HTMLCollection areas;
-};
-
-interface HTMLAreaElement : HTMLElement {
- attribute DOMString alt;
- attribute DOMString coords;
- attribute DOMString shape;
- attribute DOMString target;
- attribute DOMString download;
- [PutForwards=value] readonly attribute DOMSettableTokenList ping;
- attribute DOMString rel;
- readonly attribute DOMTokenList relList;
- attribute DOMString hreflang;
- attribute DOMString type;
-
- // also has obsolete members
-};
-HTMLAreaElement implements URLUtils;
-
-interface HTMLTableElement : HTMLElement {
- attribute HTMLTableCaptionElement? caption;
- HTMLElement createCaption();
- void deleteCaption();
- attribute HTMLTableSectionElement? tHead;
- HTMLElement createTHead();
- void deleteTHead();
- attribute HTMLTableSectionElement? tFoot;
- HTMLElement createTFoot();
- void deleteTFoot();
- readonly attribute HTMLCollection tBodies;
- HTMLElement createTBody();
- readonly attribute HTMLCollection rows;
- HTMLElement insertRow(optional long index = -1);
- void deleteRow(long index);
- attribute boolean sortable;
- void stopSorting();
-
- // also has obsolete members
-};
-
-interface HTMLTableCaptionElement : HTMLElement {
- // also has obsolete members
-};
-
-interface HTMLTableColElement : HTMLElement {
- attribute unsigned long span;
-
- // also has obsolete members
-};
-
-interface HTMLTableSectionElement : HTMLElement {
- readonly attribute HTMLCollection rows;
- HTMLElement insertRow(optional long index = -1);
- void deleteRow(long index);
-
- // also has obsolete members
-};
-
-interface HTMLTableRowElement : HTMLElement {
- readonly attribute long rowIndex;
- readonly attribute long sectionRowIndex;
- readonly attribute HTMLCollection cells;
- HTMLElement insertCell(optional long index = -1);
- void deleteCell(long index);
-
- // also has obsolete members
-};
-
-interface HTMLTableDataCellElement : HTMLTableCellElement {
- // also has obsolete members
-};
-
-interface HTMLTableHeaderCellElement : HTMLTableCellElement {
- attribute DOMString scope;
- attribute DOMString abbr;
- attribute DOMString sorted;
- void sort();
-};
-
-interface HTMLTableCellElement : HTMLElement {
- attribute unsigned long colSpan;
- attribute unsigned long rowSpan;
- [PutForwards=value] readonly attribute DOMSettableTokenList headers;
- readonly attribute long cellIndex;
-
- // also has obsolete members
-};
-
-[OverrideBuiltins]
-interface HTMLFormElement : HTMLElement {
- attribute DOMString acceptCharset;
- attribute DOMString action;
- attribute DOMString autocomplete;
- attribute DOMString enctype;
- attribute DOMString encoding;
- attribute DOMString method;
- attribute DOMString name;
- attribute boolean noValidate;
- attribute DOMString target;
-
- readonly attribute HTMLFormControlsCollection elements;
- readonly attribute long length;
- getter Element (unsigned long index);
- getter (RadioNodeList or Element) (DOMString name);
-
- void submit();
- void reset();
- boolean checkValidity();
- boolean reportValidity();
-
- void requestAutocomplete();
-};
-
-interface HTMLLabelElement : HTMLElement {
- readonly attribute HTMLFormElement? form;
- attribute DOMString htmlFor;
- readonly attribute HTMLElement? control;
-};
-
-interface HTMLInputElement : HTMLElement {
- attribute DOMString accept;
- attribute DOMString alt;
- attribute DOMString autocomplete;
- attribute boolean autofocus;
- attribute boolean defaultChecked;
- attribute boolean checked;
- attribute DOMString dirName;
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- readonly attribute FileList? files;
- attribute DOMString formAction;
- attribute DOMString formEnctype;
- attribute DOMString formMethod;
- attribute boolean formNoValidate;
- attribute DOMString formTarget;
- attribute unsigned long height;
- attribute boolean indeterminate;
- attribute DOMString inputMode;
- readonly attribute HTMLElement? list;
- attribute DOMString max;
- attribute long maxLength;
- attribute DOMString min;
- attribute long minLength;
- attribute boolean multiple;
- attribute DOMString name;
- attribute DOMString pattern;
- attribute DOMString placeholder;
- attribute boolean readOnly;
- attribute boolean required;
- attribute unsigned long size;
- attribute DOMString src;
- attribute DOMString step;
- attribute DOMString type;
- attribute DOMString defaultValue;
- [TreatNullAs=EmptyString] attribute DOMString value;
- attribute Date? valueAsDate;
- attribute unrestricted double valueAsNumber;
- attribute double valueLow;
- attribute double valueHigh;
- attribute unsigned long width;
-
- void stepUp(optional long n = 1);
- void stepDown(optional long n = 1);
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-
- void select();
- attribute unsigned long selectionStart;
- attribute unsigned long selectionEnd;
- attribute DOMString selectionDirection;
- void setRangeText(DOMString replacement);
- void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
- void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
-
- // also has obsolete members
-};
-
-interface HTMLButtonElement : HTMLElement {
- attribute boolean autofocus;
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString formAction;
- attribute DOMString formEnctype;
- attribute DOMString formMethod;
- attribute boolean formNoValidate;
- attribute DOMString formTarget;
- attribute DOMString name;
- attribute DOMString type;
- attribute DOMString value;
- attribute HTMLMenuElement? menu;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-};
-
-interface HTMLSelectElement : HTMLElement {
- attribute DOMString autocomplete;
- attribute boolean autofocus;
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute boolean multiple;
- attribute DOMString name;
- attribute boolean required;
- attribute unsigned long size;
-
- readonly attribute DOMString type;
-
- readonly attribute HTMLOptionsCollection options;
- attribute unsigned long length;
- getter Element? item(unsigned long index);
- HTMLOptionElement? namedItem(DOMString name);
- void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
- void remove(); // ChildNode overload
- void remove(long index);
- setter void (unsigned long index, HTMLOptionElement? option);
-
- readonly attribute HTMLCollection selectedOptions;
- attribute long selectedIndex;
- attribute DOMString value;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-};
-
-interface HTMLDataListElement : HTMLElement {
- readonly attribute HTMLCollection options;
-};
-
-interface HTMLOptGroupElement : HTMLElement {
- attribute boolean disabled;
- attribute DOMString label;
-};
-
-[NamedConstructor=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
-interface HTMLOptionElement : HTMLElement {
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString label;
- attribute boolean defaultSelected;
- attribute boolean selected;
- attribute DOMString value;
-
- attribute DOMString text;
- readonly attribute long index;
-};
-
-interface HTMLTextAreaElement : HTMLElement {
- attribute DOMString autocomplete;
- attribute boolean autofocus;
- attribute unsigned long cols;
- attribute DOMString dirName;
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString inputMode;
- attribute long maxLength;
- attribute long minLength;
- attribute DOMString name;
- attribute DOMString placeholder;
- attribute boolean readOnly;
- attribute boolean required;
- attribute unsigned long rows;
- attribute DOMString wrap;
-
- readonly attribute DOMString type;
- attribute DOMString defaultValue;
- [TreatNullAs=EmptyString] attribute DOMString value;
- readonly attribute unsigned long textLength;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-
- void select();
- attribute unsigned long selectionStart;
- attribute unsigned long selectionEnd;
- attribute DOMString selectionDirection;
- void setRangeText(DOMString replacement);
- void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve");
- void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
-};
-
-interface HTMLKeygenElement : HTMLElement {
- attribute boolean autofocus;
- attribute DOMString challenge;
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString keytype;
- attribute DOMString name;
-
- readonly attribute DOMString type;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-};
-
-interface HTMLOutputElement : HTMLElement {
- [PutForwards=value] readonly attribute DOMSettableTokenList htmlFor;
- readonly attribute HTMLFormElement? form;
- attribute DOMString name;
-
- readonly attribute DOMString type;
- attribute DOMString defaultValue;
- attribute DOMString value;
-
- readonly attribute boolean willValidate;
- readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-
- readonly attribute NodeList labels;
-};
-
-interface HTMLProgressElement : HTMLElement {
- attribute double value;
- attribute double max;
- readonly attribute double position;
- readonly attribute NodeList labels;
-};
-
-interface HTMLMeterElement : HTMLElement {
- attribute double value;
- attribute double min;
- attribute double max;
- attribute double low;
- attribute double high;
- attribute double optimum;
- readonly attribute NodeList labels;
-};
-
-interface HTMLFieldSetElement : HTMLElement {
- attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
- attribute DOMString name;
-
- readonly attribute DOMString type;
-
- readonly attribute HTMLFormControlsCollection elements;
-
- readonly attribute boolean willValidate;
- [SameObject] readonly attribute ValidityState validity;
- readonly attribute DOMString validationMessage;
- boolean checkValidity();
- boolean reportValidity();
- void setCustomValidity(DOMString error);
-};
-
-interface HTMLLegendElement : HTMLElement {
- readonly attribute HTMLFormElement? form;
-
- // also has obsolete members
-};
-
-enum AutocompleteErrorReason { "" /* empty string */, "cancel", "disabled", "invalid" };
-
-[Constructor(DOMString type, optional AutocompleteErrorEventInit eventInitDict)]
-interface AutocompleteErrorEvent : Event {
- readonly attribute AutocompleteErrorReason reason;
-};
-
-dictionary AutocompleteErrorEventInit : EventInit {
- AutocompleteErrorReason reason;
-};
-
-enum SelectionMode {
- "select",
- "start",
- "end",
- "preserve", // default
-};
-
-interface ValidityState {
- readonly attribute boolean valueMissing;
- readonly attribute boolean typeMismatch;
- readonly attribute boolean patternMismatch;
- readonly attribute boolean tooLong;
- readonly attribute boolean tooShort;
- readonly attribute boolean rangeUnderflow;
- readonly attribute boolean rangeOverflow;
- readonly attribute boolean stepMismatch;
- readonly attribute boolean badInput;
- readonly attribute boolean customError;
- readonly attribute boolean valid;
-};
-
-interface HTMLDetailsElement : HTMLElement {
- attribute boolean open;
-};
-
-interface HTMLMenuElement : HTMLElement {
- attribute DOMString type;
- attribute DOMString label;
-
- // also has obsolete members
-};
-
-interface HTMLMenuItemElement : HTMLElement {
- attribute DOMString type;
- attribute DOMString label;
- attribute DOMString icon;
- attribute boolean disabled;
- attribute boolean checked;
- attribute DOMString radiogroup;
- attribute boolean default;
- readonly attribute HTMLElement? command;
-};
-
-[Constructor(DOMString type, optional RelatedEventInit eventInitDict)]
-interface RelatedEvent : Event {
- readonly attribute EventTarget? relatedTarget;
-};
-
-dictionary RelatedEventInit : EventInit {
- EventTarget? relatedTarget;
-};
-
-interface HTMLDialogElement : HTMLElement {
- attribute boolean open;
- attribute DOMString returnValue;
- void show(optional (MouseEvent or Element) anchor);
- void showModal(optional (MouseEvent or Element) anchor);
- void close(optional DOMString returnValue);
-};
-
-interface HTMLScriptElement : HTMLElement {
- attribute DOMString src;
- attribute DOMString type;
- attribute DOMString charset;
- attribute boolean async;
- attribute boolean defer;
- attribute DOMString? crossOrigin;
- attribute DOMString text;
- attribute DOMString nonce;
-
- // also has obsolete members
-};
-
-interface HTMLTemplateElement : HTMLElement {
- readonly attribute DocumentFragment content;
-};
-
-typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
-
-interface HTMLCanvasElement : HTMLElement {
- attribute unsigned long width;
- attribute unsigned long height;
-
- RenderingContext? getContext(DOMString contextId, any... arguments);
- boolean probablySupportsContext(DOMString contextId, any... arguments);
-
- void setContext(RenderingContext context);
- CanvasProxy transferControlToProxy();
-
- DOMString toDataURL(optional DOMString type, any... arguments);
- void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);
-};
-
-[Exposed=(Window,Worker)]
-interface CanvasProxy {
- void setContext(RenderingContext context);
-};
-// CanvasProxy implements Transferable;
-
-typedef (HTMLImageElement or
- HTMLVideoElement or
- HTMLCanvasElement or
- CanvasRenderingContext2D or
- ImageBitmap) CanvasImageSource;
-
-enum CanvasFillRule { "nonzero", "evenodd" };
-
-dictionary CanvasRenderingContext2DSettings {
- boolean alpha = true;
-};
-
-enum ImageSmoothingQuality { "low", "medium", "high" };
-
-[Constructor(),
- Constructor(unsigned long width, unsigned long height),
- Exposed=(Window,Worker)]
-interface CanvasRenderingContext2D {
-
- // back-reference to the canvas
- readonly attribute HTMLCanvasElement canvas;
-
- // canvas dimensions
- attribute unsigned long width;
- attribute unsigned long height;
-
- // for contexts that aren't directly fixed to a specific canvas
- void commit(); // push the image to the output bitmap
-
- // state
- void save(); // push state on state stack
- void restore(); // pop state stack and restore state
-
- // transformations (default transform is the identity matrix)
- attribute DOMMatrix currentTransform;
- void scale(unrestricted double x, unrestricted double y);
- void rotate(unrestricted double angle);
- void translate(unrestricted double x, unrestricted double y);
- void transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void resetTransform();
-
- // compositing
- attribute unrestricted double globalAlpha; // (default 1.0)
- attribute DOMString globalCompositeOperation; // (default source-over)
-
- // image smoothing
- attribute boolean imageSmoothingEnabled; // (default true)
- attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
-
- // colours and styles (see also the CanvasDrawingStyles interface)
- attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
- attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
- CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
- CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
- CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
-
- // shadows
- attribute unrestricted double shadowOffsetX; // (default 0)
- attribute unrestricted double shadowOffsetY; // (default 0)
- attribute unrestricted double shadowBlur; // (default 0)
- attribute DOMString shadowColor; // (default transparent black)
-
- // rects
- void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
-
- // path API (see also CanvasPathMethods)
- void beginPath();
- void fill(optional CanvasFillRule fillRule = "nonzero");
- void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero");
- void stroke();
- void stroke(Path2D path);
- void drawFocusIfNeeded(Element element);
- void drawFocusIfNeeded(Path2D path, Element element);
- void scrollPathIntoView();
- void scrollPathIntoView(Path2D path);
- void clip(optional CanvasFillRule fillRule = "nonzero");
- void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
- void resetClip();
- boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero");
- boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero");
- boolean isPointInStroke(unrestricted double x, unrestricted double y);
- boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
-
- // text (see also the CanvasDrawingStyles interface)
- void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- TextMetrics measureText(DOMString text);
-
- // drawing images
- void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy);
- void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
- void drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
-
- // hit regions
- void addHitRegion(optional HitRegionOptions options);
- void removeHitRegion(DOMString id);
- void clearHitRegions();
-
- // pixel manipulation
- ImageData createImageData(double sw, double sh);
- ImageData createImageData(ImageData imagedata);
- ImageData getImageData(double sx, double sy, double sw, double sh);
- void putImageData(ImageData imagedata, double dx, double dy);
- void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
-};
-CanvasRenderingContext2D implements CanvasDrawingStyles;
-CanvasRenderingContext2D implements CanvasPathMethods;
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasDrawingStyles {
- // line caps/joins
- attribute unrestricted double lineWidth; // (default 1)
- attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
- attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
- attribute unrestricted double miterLimit; // (default 10)
-
- // dashed lines
- void setLineDash(sequence<unrestricted double> segments); // default empty
- sequence<unrestricted double> getLineDash();
- attribute unrestricted double lineDashOffset;
-
- // text
- attribute DOMString font; // (default 10px sans-serif)
- attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
- attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
- attribute DOMString direction; // "ltr", "rtl", "inherit" (default: "inherit")
-};
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasPathMethods {
- // shared path API methods
- void closePath();
- void moveTo(unrestricted double x, unrestricted double y);
- void lineTo(unrestricted double x, unrestricted double y);
- void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
- void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
- void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
- void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation);
- void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
- void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
-};
-
-[Exposed=(Window,Worker)]
-interface CanvasGradient {
- // opaque object
- void addColorStop(double offset, DOMString color);
-};
-
-[Exposed=(Window,Worker)]
-interface CanvasPattern {
- // opaque object
- void setTransform(DOMMatrix transform);
-};
-
-[Exposed=(Window,Worker)]
-interface TextMetrics {
- // x-direction
- readonly attribute double width; // advance width
- readonly attribute double actualBoundingBoxLeft;
- readonly attribute double actualBoundingBoxRight;
-
- // y-direction
- readonly attribute double fontBoundingBoxAscent;
- readonly attribute double fontBoundingBoxDescent;
- readonly attribute double actualBoundingBoxAscent;
- readonly attribute double actualBoundingBoxDescent;
- readonly attribute double emHeightAscent;
- readonly attribute double emHeightDescent;
- readonly attribute double hangingBaseline;
- readonly attribute double alphabeticBaseline;
- readonly attribute double ideographicBaseline;
-};
-
-dictionary HitRegionOptions {
- Path2D? path = null;
- CanvasFillRule fillRule = "nonzero";
- DOMString id = "";
- DOMString? parentID = null;
- DOMString cursor = "inherit";
- // for control-backed regions:
- Element? control = null;
- // for unbacked regions:
- DOMString? label = null;
- DOMString? role = null;
-};
-
-[Constructor(unsigned long sw, unsigned long sh),
- Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh),
- Exposed=(Window,Worker)]
-interface ImageData {
- readonly attribute unsigned long width;
- readonly attribute unsigned long height;
- readonly attribute Uint8ClampedArray data;
-};
-
-[Constructor(optional Element scope), Exposed=(Window,Worker)]
-interface DrawingStyle { };
-DrawingStyle implements CanvasDrawingStyles;
-
-[Constructor,
- Constructor(Path2D path),
- Constructor(sequence<Path2D> paths, optional CanvasFillRule fillRule = "nonzero"),
- Constructor(DOMString d), Exposed=(Window,Worker)]
-interface Path2D {
- void addPath(Path2D path, optional DOMMatrix? transformation = null);
- void addPathByStrokingPath(Path2D path, CanvasDrawingStyles styles, optional DOMMatrix? transformation = null);
- void addText(DOMString text, CanvasDrawingStyles styles, DOMMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, DOMMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void addText(DOMString text, CanvasDrawingStyles styles, DOMMatrix? transformation, Path2D path, optional unrestricted double maxWidth);
- void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, DOMMatrix? transformation, Path2D path, optional unrestricted double maxWidth);
-};
-Path2D implements CanvasPathMethods;
-
-partial interface MouseEvent {
- readonly attribute DOMString? region;
-};
-
-partial dictionary MouseEventInit {
- DOMString? region;
-};
-
-partial interface Touch {
- readonly attribute DOMString? region;
-};
-
-[NoInterfaceObject]
-interface ElementContentEditable {
- attribute DOMString contentEditable;
- readonly attribute boolean isContentEditable;
-};
-
-interface DataTransfer {
- attribute DOMString dropEffect;
- attribute DOMString effectAllowed;
-
- [SameObject] readonly attribute DataTransferItemList items;
-
- void setDragImage(Element image, long x, long y);
-
- /* old interface */
- [SameObject] readonly attribute DOMString[] types;
- DOMString getData(DOMString format);
- void setData(DOMString format, DOMString data);
- void clearData(optional DOMString format);
- [SameObject] readonly attribute FileList files;
-};
-
-interface DataTransferItemList {
- readonly attribute unsigned long length;
- getter DataTransferItem (unsigned long index);
- DataTransferItem? add(DOMString data, DOMString type);
- DataTransferItem? add(File data);
- void remove(unsigned long index);
- void clear();
-};
-
-interface DataTransferItem {
- readonly attribute DOMString kind;
- readonly attribute DOMString type;
- void getAsString(FunctionStringCallback? _callback);
- File? getAsFile();
-};
-
-callback FunctionStringCallback = void (DOMString data);
-
-[Constructor(DOMString type, optional DragEventInit eventInitDict)]
-interface DragEvent : MouseEvent {
- readonly attribute DataTransfer? dataTransfer;
-};
-
-dictionary DragEventInit : MouseEventInit {
- DataTransfer? dataTransfer = null;
-};
-
-[PrimaryGlobal]
-/*sealed*/ interface Window : EventTarget {
- // the current browsing context
- [Unforgeable] readonly attribute WindowProxy window;
- [Replaceable] readonly attribute WindowProxy self;
- [Unforgeable] readonly attribute Document document;
- attribute DOMString name;
- [PutForwards=href, Unforgeable] readonly attribute Location location;
- readonly attribute History history;
- [Replaceable] readonly attribute BarProp locationbar;
- [Replaceable] readonly attribute BarProp menubar;
- [Replaceable] readonly attribute BarProp personalbar;
- [Replaceable] readonly attribute BarProp scrollbars;
- [Replaceable] readonly attribute BarProp statusbar;
- [Replaceable] readonly attribute BarProp toolbar;
- attribute DOMString status;
- void close();
- readonly attribute boolean closed;
- void stop();
- void focus();
- void blur();
-
- // other browsing contexts
- [Replaceable] readonly attribute WindowProxy frames;
- [Replaceable] readonly attribute unsigned long length;
- [Unforgeable] readonly attribute WindowProxy top;
- attribute any opener;
- [Replaceable] readonly attribute WindowProxy parent;
- readonly attribute Element? frameElement;
- WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
- getter WindowProxy (unsigned long index);
- getter object (DOMString name);
-
- // the user agent
- readonly attribute Navigator navigator;
- [Replaceable, SameObject] readonly attribute External external;
- readonly attribute ApplicationCache applicationCache;
-
- // user prompts
- void alert();
- void alert(DOMString message);
- boolean confirm(optional DOMString message = "");
- DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
- void print();
- any showModalDialog(DOMString url, optional any argument); // deprecated
-
- unsigned long requestAnimationFrame(FrameRequestCallback callback);
- void cancelAnimationFrame(unsigned long handle);
-
- void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
-
- // also has obsolete members
-};
-Window implements GlobalEventHandlers;
-Window implements WindowEventHandlers;
-
-callback FrameRequestCallback = void (DOMHighResTimeStamp time);
-
-interface BarProp {
- readonly attribute boolean visible;
-};
-
-interface History {
- readonly attribute unsigned long length;
- readonly attribute any state;
- void go(optional long delta = 0);
- void back();
- void forward();
- void pushState(any data, DOMString title, optional DOMString? url = null);
- void replaceState(any data, DOMString title, optional DOMString? url = null);
-};
-
-[Unforgeable] interface Location {
- void assign(DOMString url);
- void replace(DOMString url);
- void reload();
-
- [SameObject] readonly attribute DOMString[] ancestorOrigins;
-};
-Location implements URLUtils;
-
-[Constructor(DOMString type, optional PopStateEventInit eventInitDict), Exposed=(Window,Worker)]
-interface PopStateEvent : Event {
- readonly attribute any state;
-};
-
-dictionary PopStateEventInit : EventInit {
- any state;
-};
-
-[Constructor(DOMString type, optional HashChangeEventInit eventInitDict), Exposed=(Window,Worker)]
-interface HashChangeEvent : Event {
- readonly attribute DOMString oldURL;
- readonly attribute DOMString newURL;
-};
-
-dictionary HashChangeEventInit : EventInit {
- DOMString oldURL;
- DOMString newURL;
-};
-
-[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict), Exposed=(Window,Worker)]
-interface PageTransitionEvent : Event {
- readonly attribute boolean persisted;
-};
-
-dictionary PageTransitionEventInit : EventInit {
- boolean persisted;
-};
-
-interface BeforeUnloadEvent : Event {
- attribute DOMString returnValue;
-};
-
-[Exposed=(Window,SharedWorker)]
-interface ApplicationCache : EventTarget {
-
- // update status
- const unsigned short UNCACHED = 0;
- const unsigned short IDLE = 1;
- const unsigned short CHECKING = 2;
- const unsigned short DOWNLOADING = 3;
- const unsigned short UPDATEREADY = 4;
- const unsigned short OBSOLETE = 5;
- readonly attribute unsigned short status;
-
- // updates
- void update();
- void abort();
- void swapCache();
-
- // events
- attribute EventHandler onchecking;
- attribute EventHandler onerror;
- attribute EventHandler onnoupdate;
- attribute EventHandler ondownloading;
- attribute EventHandler onprogress;
- attribute EventHandler onupdateready;
- attribute EventHandler oncached;
- attribute EventHandler onobsolete;
-};
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface NavigatorOnLine {
- readonly attribute boolean onLine;
-};
-
-[Constructor(DOMString type, optional ErrorEventInit eventInitDict), Exposed=(Window,Worker)]
-interface ErrorEvent : Event {
- readonly attribute DOMString message;
- readonly attribute DOMString filename;
- readonly attribute unsigned long lineno;
- readonly attribute unsigned long colno;
- readonly attribute any error;
-};
-
-dictionary ErrorEventInit : EventInit {
- DOMString message;
- DOMString filename;
- unsigned long lineno;
- unsigned long colno;
- any error;
-};
-
-[TreatNonObjectAsNull]
-callback EventHandlerNonNull = any (Event event);
-typedef EventHandlerNonNull? EventHandler;
-
-[TreatNonObjectAsNull]
-callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
-typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
-
-[TreatNonObjectAsNull]
-callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
-typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
-
-[NoInterfaceObject]
-interface GlobalEventHandlers {
- attribute EventHandler onabort;
- attribute EventHandler onautocomplete;
- attribute EventHandler onautocompleteerror;
- attribute EventHandler onblur;
- attribute EventHandler oncancel;
- attribute EventHandler oncanplay;
- attribute EventHandler oncanplaythrough;
- attribute EventHandler onchange;
- attribute EventHandler onclick;
- attribute EventHandler onclose;
- attribute EventHandler oncontextmenu;
- attribute EventHandler oncuechange;
- attribute EventHandler ondblclick;
- attribute EventHandler ondrag;
- attribute EventHandler ondragend;
- attribute EventHandler ondragenter;
- attribute EventHandler ondragexit;
- attribute EventHandler ondragleave;
- attribute EventHandler ondragover;
- attribute EventHandler ondragstart;
- attribute EventHandler ondrop;
- attribute EventHandler ondurationchange;
- attribute EventHandler onemptied;
- attribute EventHandler onended;
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onfocus;
- attribute EventHandler oninput;
- attribute EventHandler oninvalid;
- attribute EventHandler onkeydown;
- attribute EventHandler onkeypress;
- attribute EventHandler onkeyup;
- attribute EventHandler onload;
- attribute EventHandler onloadeddata;
- attribute EventHandler onloadedmetadata;
- attribute EventHandler onloadstart;
- attribute EventHandler onmousedown;
- [LenientThis] attribute EventHandler onmouseenter;
- [LenientThis] attribute EventHandler onmouseleave;
- attribute EventHandler onmousemove;
- attribute EventHandler onmouseout;
- attribute EventHandler onmouseover;
- attribute EventHandler onmouseup;
- attribute EventHandler onwheel;
- attribute EventHandler onpause;
- attribute EventHandler onplay;
- attribute EventHandler onplaying;
- attribute EventHandler onprogress;
- attribute EventHandler onratechange;
- attribute EventHandler onreset;
- attribute EventHandler onresize;
- attribute EventHandler onscroll;
- attribute EventHandler onseeked;
- attribute EventHandler onseeking;
- attribute EventHandler onselect;
- attribute EventHandler onshow;
- attribute EventHandler onsort;
- attribute EventHandler onstalled;
- attribute EventHandler onsubmit;
- attribute EventHandler onsuspend;
- attribute EventHandler ontimeupdate;
- attribute EventHandler ontoggle;
- attribute EventHandler onvolumechange;
- attribute EventHandler onwaiting;
-};
-
-[NoInterfaceObject]
-interface WindowEventHandlers {
- attribute EventHandler onafterprint;
- attribute EventHandler onbeforeprint;
- attribute OnBeforeUnloadEventHandler onbeforeunload;
- attribute EventHandler onhashchange;
- attribute EventHandler onlanguagechange;
- attribute EventHandler onmessage;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
- attribute EventHandler onpagehide;
- attribute EventHandler onpageshow;
- attribute EventHandler onpopstate;
- attribute EventHandler onstorage;
- attribute EventHandler onunload;
-};
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface WindowBase64 {
- DOMString btoa(DOMString btoa);
- DOMString atob(DOMString atob);
-};
-Window implements WindowBase64;
-WorkerGlobalScope implements WindowBase64;
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface WindowTimers {
- long setTimeout(Function handler, optional long timeout = 0, any... arguments);
- long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
- void clearTimeout(optional long handle = 0);
- long setInterval(Function handler, optional long timeout = 0, any... arguments);
- long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
- void clearInterval(optional long handle = 0);
-};
-Window implements WindowTimers;
-WorkerGlobalScope implements WindowTimers;
-
-[NoInterfaceObject]
-interface WindowModal {
- readonly attribute any dialogArguments;
- attribute any returnValue;
-};
-
-interface Navigator {
- // objects implementing this interface also implement the interfaces given below
-};
-Navigator implements NavigatorID;
-Navigator implements NavigatorLanguage;
-Navigator implements NavigatorOnLine;
-Navigator implements NavigatorContentUtils;
-Navigator implements NavigatorStorageUtils;
-Navigator implements NavigatorPlugins;
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface NavigatorID {
- [Exposed=Window] readonly attribute DOMString appCodeName; // constant "Mozilla"
- readonly attribute DOMString appName; // constant "Netscape"
- readonly attribute DOMString appVersion;
- readonly attribute DOMString platform;
- [Exposed=Window] readonly attribute DOMString product; // constant "Gecko"
- [Exposed=Window] readonly attribute DOMString productSub;
- readonly attribute DOMString userAgent;
- [Exposed=Window] readonly attribute DOMString vendor;
- [Exposed=Window] readonly attribute DOMString vendorSub; // constant ""
-
- // also has obsolete members
-};
-
-partial interface NavigatorID {
- [Exposed=Window] boolean taintEnabled(); // constant false
-};
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface NavigatorLanguage {
- readonly attribute DOMString? language;
- readonly attribute DOMString[] languages;
-};
-
-[NoInterfaceObject]
-interface NavigatorContentUtils {
- // content handler registration
- void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title);
- void registerContentHandler(DOMString mimeType, DOMString url, DOMString title);
- DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url);
- DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url);
- void unregisterProtocolHandler(DOMString scheme, DOMString url);
- void unregisterContentHandler(DOMString mimeType, DOMString url);
-};
-
-[NoInterfaceObject]
-interface NavigatorStorageUtils {
- readonly attribute boolean cookieEnabled;
- void yieldForStorageUpdates();
-};
-
-[NoInterfaceObject]
-interface NavigatorPlugins {
- [SameObject] readonly attribute PluginArray plugins;
- [SameObject] readonly attribute MimeTypeArray mimeTypes;
- readonly attribute boolean javaEnabled;
-};
-
-interface PluginArray {
- void refresh(optional boolean reload = false);
- readonly attribute unsigned long length;
- getter Plugin? item(unsigned long index);
- getter Plugin? namedItem(DOMString name);
-};
-
-interface MimeTypeArray {
- readonly attribute unsigned long length;
- getter MimeType? item(unsigned long index);
- getter MimeType? namedItem(DOMString name);
-};
-
-interface Plugin {
- readonly attribute DOMString name;
- readonly attribute DOMString description;
- readonly attribute DOMString filename;
- readonly attribute unsigned long length;
- getter MimeType? item(unsigned long index);
- getter MimeType? namedItem(DOMString name);
-};
-
-interface MimeType {
- readonly attribute DOMString type;
- readonly attribute DOMString description;
- readonly attribute DOMString suffixes; // comma-separated
- readonly attribute Plugin enabledPlugin;
-};
-
-interface External {
- void AddSearchProvider(DOMString engineURL);
- unsigned long IsSearchProviderInstalled(DOMString engineURL);
-};
-
-[Exposed=(Window,Worker)]
-interface ImageBitmap {
- readonly attribute unsigned long width;
- readonly attribute unsigned long height;
-};
-
-typedef (HTMLImageElement or
- HTMLVideoElement or
- HTMLCanvasElement or
- Blob or
- ImageData or
- CanvasRenderingContext2D or
- ImageBitmap) ImageBitmapSource;
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface ImageBitmapFactories {
- Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image);
- Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh);
-};
-Window implements ImageBitmapFactories;
-WorkerGlobalScope implements ImageBitmapFactories;
-
-[Constructor(DOMString type, optional MessageEventInit eventInitDict), Exposed=(Window,Worker)]
-interface MessageEvent : Event {
- readonly attribute any data;
- readonly attribute DOMString origin;
- readonly attribute DOMString lastEventId;
- readonly attribute (WindowProxy or MessagePort)? source;
- readonly attribute MessagePort[]? ports;
-
- void initMessageEvent(DOMString type, boolean bubbles, boolean cancelable, any data, DOMString origin, DOMString lastEventId, (WindowProxy or MessagePort)? source, sequence<MessagePort>? ports);
-};
-
-dictionary MessageEventInit : EventInit {
- any data;
- DOMString origin;
- DOMString lastEventId;
- (WindowProxy or MessagePort)? source;
- sequence<MessagePort>? ports;
-};
-
-[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict), Exposed=(Window,Worker)]
-interface EventSource : EventTarget {
- readonly attribute DOMString url;
- readonly attribute boolean withCredentials;
-
- // ready state
- const unsigned short CONNECTING = 0;
- const unsigned short OPEN = 1;
- const unsigned short CLOSED = 2;
- readonly attribute unsigned short readyState;
-
- // networking
- attribute EventHandler onopen;
- attribute EventHandler onmessage;
- attribute EventHandler onerror;
- void close();
-};
-
-dictionary EventSourceInit {
- boolean withCredentials = false;
-};
-
-enum BinaryType { "blob", "arraybuffer" };
-[Constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols), Exposed=(Window,Worker)]
-interface WebSocket : EventTarget {
- readonly attribute DOMString url;
-
- // ready state
- const unsigned short CONNECTING = 0;
- const unsigned short OPEN = 1;
- const unsigned short CLOSING = 2;
- const unsigned short CLOSED = 3;
- readonly attribute unsigned short readyState;
- readonly attribute unsigned long bufferedAmount;
-
- // networking
- attribute EventHandler onopen;
- attribute EventHandler onerror;
- attribute EventHandler onclose;
- readonly attribute DOMString extensions;
- readonly attribute DOMString protocol;
- void close([Clamp] optional unsigned short code, optional USVString reason);
-
- // messaging
- attribute EventHandler onmessage;
- attribute BinaryType binaryType;
- void send(USVString data);
- void send(Blob data);
- void send(ArrayBuffer data);
- void send(ArrayBufferView data);
-};
-
-[Constructor(DOMString type, optional CloseEventInit eventInitDict), Exposed=(Window,Worker)]
-interface CloseEvent : Event {
- readonly attribute boolean wasClean;
- readonly attribute unsigned short code;
- readonly attribute DOMString reason;
-};
-
-dictionary CloseEventInit : EventInit {
- boolean wasClean;
- unsigned short code;
- DOMString reason;
-};
-
-[Constructor, Exposed=(Window,Worker)]
-interface MessageChannel {
- readonly attribute MessagePort port1;
- readonly attribute MessagePort port2;
-};
-
-[Exposed=(Window,Worker)]
-interface MessagePort : EventTarget {
- void postMessage(any message, optional sequence<Transferable> transfer);
- void start();
- void close();
-
- // event handlers
- attribute EventHandler onmessage;
-};
-// MessagePort implements Transferable;
-
-[Constructor(DOMString name), Exposed=(Window,Worker)]
-interface BroadcastChannel : EventTarget {
- readonly attribute DOMString name;
- void postMessage(any message);
- void close();
- attribute EventHandler onmessage;
-};
-
-[Exposed=Worker]
-interface WorkerGlobalScope : EventTarget {
- readonly attribute WorkerGlobalScope self;
- readonly attribute WorkerLocation location;
- readonly attribute WorkerNavigator navigator;
- void importScripts(DOMString... urls);
-
- void close();
- attribute OnErrorEventHandler onerror;
- attribute EventHandler onlanguagechange;
- attribute EventHandler onoffline;
- attribute EventHandler ononline;
-};
-
-[Global=(Worker,DedicatedWorker),Exposed=DedicatedWorker]
-/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
- void postMessage(any message, optional sequence<Transferable> transfer);
- attribute EventHandler onmessage;
-};
-
-[Global=(Worker,SharedWorker),Exposed=SharedWorker]
-/*sealed*/ interface SharedWorkerGlobalScope : WorkerGlobalScope {
- readonly attribute DOMString name;
- readonly attribute ApplicationCache applicationCache;
- attribute EventHandler onconnect;
-};
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface AbstractWorker {
- attribute EventHandler onerror;
-};
-
-[Constructor(DOMString scriptURL), Exposed=(Window,Worker)]
-interface Worker : EventTarget {
- void terminate();
-
- void postMessage(any message, optional sequence<Transferable> transfer);
- attribute EventHandler onmessage;
-};
-Worker implements AbstractWorker;
-
-[Constructor(DOMString scriptURL, optional DOMString name = ""), Exposed=(Window,Worker)]
-interface SharedWorker : EventTarget {
- readonly attribute MessagePort port;
-};
-SharedWorker implements AbstractWorker;
-
-[Exposed=Worker]
-interface WorkerNavigator {};
-WorkerNavigator implements NavigatorID;
-WorkerNavigator implements NavigatorLanguage;
-WorkerNavigator implements NavigatorOnLine;
-
-[Exposed=Worker]
-interface WorkerLocation {
- stringifier readonly attribute USVString href;
- readonly attribute USVString origin;
- readonly attribute USVString protocol;
- readonly attribute USVString host;
- readonly attribute USVString hostname;
- readonly attribute USVString port;
- readonly attribute USVString pathname;
- readonly attribute USVString search;
- readonly attribute USVString hash;
-};
-
-interface Storage {
- readonly attribute unsigned long length;
- DOMString? key(unsigned long index);
- getter DOMString? getItem(DOMString key);
- setter void setItem(DOMString key, DOMString value);
- deleter void removeItem(DOMString key);
- void clear();
-};
-
-[NoInterfaceObject]
-interface WindowSessionStorage {
- readonly attribute Storage sessionStorage;
-};
-Window implements WindowSessionStorage;
-
-[NoInterfaceObject]
-interface WindowLocalStorage {
- readonly attribute Storage localStorage;
-};
-Window implements WindowLocalStorage;
-
-[Constructor(DOMString type, optional StorageEventInit eventInitDict)]
-interface StorageEvent : Event {
- readonly attribute DOMString? key;
- readonly attribute DOMString? oldValue;
- readonly attribute DOMString? newValue;
- readonly attribute DOMString url;
- readonly attribute Storage? storageArea;
-};
-
-dictionary StorageEventInit : EventInit {
- DOMString? key;
- DOMString? oldValue;
- DOMString? newValue;
- DOMString url;
- Storage? storageArea;
-};
-
-interface HTMLAppletElement : HTMLElement {
- attribute DOMString align;
- attribute DOMString alt;
- attribute DOMString archive;
- attribute DOMString code;
- attribute DOMString codeBase;
- attribute DOMString height;
- attribute unsigned long hspace;
- attribute DOMString name;
- attribute DOMString _object; // the underscore is not part of the identifier
- attribute unsigned long vspace;
- attribute DOMString width;
-};
-
-interface HTMLMarqueeElement : HTMLElement {
- attribute DOMString behavior;
- attribute DOMString bgColor;
- attribute DOMString direction;
- attribute DOMString height;
- attribute unsigned long hspace;
- attribute long loop;
- attribute unsigned long scrollAmount;
- attribute unsigned long scrollDelay;
- attribute boolean trueSpeed;
- attribute unsigned long vspace;
- attribute DOMString width;
-
- attribute EventHandler onbounce;
- attribute EventHandler onfinish;
- attribute EventHandler onstart;
-
- void start();
- void stop();
-};
-
-interface HTMLFrameSetElement : HTMLElement {
- attribute DOMString cols;
- attribute DOMString rows;
-};
-HTMLFrameSetElement implements WindowEventHandlers;
-
-interface HTMLFrameElement : HTMLElement {
- attribute DOMString name;
- attribute DOMString scrolling;
- attribute DOMString src;
- attribute DOMString frameBorder;
- attribute DOMString longDesc;
- attribute boolean noResize;
- readonly attribute Document? contentDocument;
- readonly attribute WindowProxy? contentWindow;
-
- [TreatNullAs=EmptyString] attribute DOMString marginHeight;
- [TreatNullAs=EmptyString] attribute DOMString marginWidth;
-};
-
-partial interface HTMLAnchorElement {
- attribute DOMString coords;
- attribute DOMString charset;
- attribute DOMString name;
- attribute DOMString rev;
- attribute DOMString shape;
-};
-
-partial interface HTMLAreaElement {
- attribute boolean noHref;
-};
-
-partial interface HTMLBodyElement {
- [TreatNullAs=EmptyString] attribute DOMString text;
- [TreatNullAs=EmptyString] attribute DOMString link;
- [TreatNullAs=EmptyString] attribute DOMString vLink;
- [TreatNullAs=EmptyString] attribute DOMString aLink;
- [TreatNullAs=EmptyString] attribute DOMString bgColor;
- attribute DOMString background;
-};
-
-partial interface HTMLBRElement {
- attribute DOMString clear;
-};
-
-partial interface HTMLTableCaptionElement {
- attribute DOMString align;
-};
-
-partial interface HTMLTableColElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
- attribute DOMString width;
-};
-
-interface HTMLDirectoryElement : HTMLElement {
- attribute boolean compact;
-};
-
-partial interface HTMLDivElement {
- attribute DOMString align;
-};
-
-partial interface HTMLDListElement {
- attribute boolean compact;
-};
-
-partial interface HTMLEmbedElement {
- attribute DOMString align;
- attribute DOMString name;
-};
-
-interface HTMLFontElement : HTMLElement {
- [TreatNullAs=EmptyString] attribute DOMString color;
- attribute DOMString face;
- attribute DOMString size;
-};
-
-partial interface HTMLHeadingElement {
- attribute DOMString align;
-};
-
-partial interface HTMLHRElement {
- attribute DOMString align;
- attribute DOMString color;
- attribute boolean noShade;
- attribute DOMString size;
- attribute DOMString width;
-};
-
-partial interface HTMLHtmlElement {
- attribute DOMString version;
-};
-
-partial interface HTMLIFrameElement {
- attribute DOMString align;
- attribute DOMString scrolling;
- attribute DOMString frameBorder;
- attribute DOMString longDesc;
-
- [TreatNullAs=EmptyString] attribute DOMString marginHeight;
- [TreatNullAs=EmptyString] attribute DOMString marginWidth;
-};
-
-partial interface HTMLImageElement {
- attribute DOMString name;
- attribute DOMString lowsrc;
- attribute DOMString align;
- attribute unsigned long hspace;
- attribute unsigned long vspace;
- attribute DOMString longDesc;
-
- [TreatNullAs=EmptyString] attribute DOMString border;
-};
-
-partial interface HTMLInputElement {
- attribute DOMString align;
- attribute DOMString useMap;
-};
-
-partial interface HTMLLegendElement {
- attribute DOMString align;
-};
-
-partial interface HTMLLIElement {
- attribute DOMString type;
-};
-
-partial interface HTMLLinkElement {
- attribute DOMString charset;
- attribute DOMString rev;
- attribute DOMString target;
-};
-
-partial interface HTMLMenuElement {
- attribute boolean compact;
-};
-
-partial interface HTMLMetaElement {
- attribute DOMString scheme;
-};
-
-partial interface HTMLObjectElement {
- attribute DOMString align;
- attribute DOMString archive;
- attribute DOMString code;
- attribute boolean declare;
- attribute unsigned long hspace;
- attribute DOMString standby;
- attribute unsigned long vspace;
- attribute DOMString codeBase;
- attribute DOMString codeType;
-
- [TreatNullAs=EmptyString] attribute DOMString border;
-};
-
-partial interface HTMLOListElement {
- attribute boolean compact;
-};
-
-partial interface HTMLParagraphElement {
- attribute DOMString align;
-};
-
-partial interface HTMLParamElement {
- attribute DOMString type;
- attribute DOMString valueType;
-};
-
-partial interface HTMLPreElement {
- attribute long width;
-};
-
-partial interface HTMLScriptElement {
- attribute DOMString event;
- attribute DOMString htmlFor;
-};
-
-partial interface HTMLTableElement {
- attribute DOMString align;
- attribute DOMString border;
- attribute DOMString frame;
- attribute DOMString rules;
- attribute DOMString summary;
- attribute DOMString width;
-
- [TreatNullAs=EmptyString] attribute DOMString bgColor;
- [TreatNullAs=EmptyString] attribute DOMString cellPadding;
- [TreatNullAs=EmptyString] attribute DOMString cellSpacing;
-};
-
-partial interface HTMLTableSectionElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
-};
-
-partial interface HTMLTableCellElement {
- attribute DOMString align;
- attribute DOMString axis;
- attribute DOMString height;
- attribute DOMString width;
-
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute boolean noWrap;
- attribute DOMString vAlign;
-
- [TreatNullAs=EmptyString] attribute DOMString bgColor;
-};
-
-partial interface HTMLTableDataCellElement {
- attribute DOMString abbr;
-};
-
-partial interface HTMLTableRowElement {
- attribute DOMString align;
- attribute DOMString ch;
- attribute DOMString chOff;
- attribute DOMString vAlign;
-
- [TreatNullAs=EmptyString] attribute DOMString bgColor;
-};
-
-partial interface HTMLUListElement {
- attribute boolean compact;
- attribute DOMString type;
-};
-
-partial interface Document {
- [TreatNullAs=EmptyString] attribute DOMString fgColor;
- [TreatNullAs=EmptyString] attribute DOMString linkColor;
- [TreatNullAs=EmptyString] attribute DOMString vlinkColor;
- [TreatNullAs=EmptyString] attribute DOMString alinkColor;
- [TreatNullAs=EmptyString] attribute DOMString bgColor;
-
- readonly attribute HTMLCollection anchors;
- readonly attribute HTMLCollection applets;
-
- void clear();
- void captureEvents();
- void releaseEvents();
-
- readonly attribute HTMLAllCollection all;
-};
-
-partial interface Window {
- void captureEvents();
- void releaseEvents();
-};
-
diff --git a/javascript/WebIDL/uievents.idl b/javascript/WebIDL/uievents.idl
deleted file mode 100644
index 3f339f381..000000000
--- a/javascript/WebIDL/uievents.idl
+++ /dev/null
@@ -1,185 +0,0 @@
-// Retrived from
-// Thu Jul 23 21:40:07 BST 2015
-
-
-[Constructor(DOMString type, optional UIEventInit eventInitDict)]
-interface UIEvent : Event {
- readonly attribute Window? view;
- readonly attribute long detail;
-};
-
-dictionary UIEventInit : EventInit {
- Window? view = null;
- long detail = 0;
-};
-
-[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict)]
-interface FocusEvent : UIEvent {
- readonly attribute EventTarget? relatedTarget;
-};
-
-dictionary FocusEventInit : UIEventInit {
- EventTarget? relatedTarget = null;
-};
-
-[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
-interface MouseEvent : UIEvent {
- readonly attribute long screenX;
- readonly attribute long screenY;
- readonly attribute long clientX;
- readonly attribute long clientY;
- readonly attribute boolean ctrlKey;
- readonly attribute boolean shiftKey;
- readonly attribute boolean altKey;
- readonly attribute boolean metaKey;
- readonly attribute short button;
- readonly attribute EventTarget? relatedTarget;
- // Introduced in this specification
- readonly attribute unsigned short buttons;
- boolean getModifierState (DOMString keyArg);
-};
-
-dictionary MouseEventInit : EventModifierInit {
- long screenX = 0;
- long screenY = 0;
- long clientX = 0;
- long clientY = 0;
- short button = 0;
- unsigned short buttons = 0;
- EventTarget? relatedTarget = null;
-};
-
-dictionary EventModifierInit : UIEventInit {
- boolean ctrlKey = false;
- boolean shiftKey = false;
- boolean altKey = false;
- boolean metaKey = false;
- boolean modifierAltGraph = false;
- boolean modifierCapsLock = false;
- boolean modifierFn = false;
- boolean modifierFnLock = false;
- boolean modifierHyper = false;
- boolean modifierNumLock = false;
- boolean modifierOS = false;
- boolean modifierScrollLock = false;
- boolean modifierSuper = false;
- boolean modifierSymbol = false;
- boolean modifierSymbolLock = false;
-};
-
-[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict)]
-interface WheelEvent : MouseEvent {
- // DeltaModeCode
- const unsigned long DOM_DELTA_PIXEL = 0x00;
- const unsigned long DOM_DELTA_LINE = 0x01;
- const unsigned long DOM_DELTA_PAGE = 0x02;
- readonly attribute double deltaX;
- readonly attribute double deltaY;
- readonly attribute double deltaZ;
- readonly attribute unsigned long deltaMode;
-};
-
-dictionary WheelEventInit : MouseEventInit {
- double deltaX = 0.0;
- double deltaY = 0.0;
- double deltaZ = 0.0;
- unsigned long deltaMode = 0;
-};
-
-[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict)]
-interface KeyboardEvent : UIEvent {
- // KeyLocationCode
- const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
- const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;
- const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02;
- const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
- readonly attribute DOMString key;
- readonly attribute DOMString code;
- readonly attribute unsigned long location;
- readonly attribute boolean ctrlKey;
- readonly attribute boolean shiftKey;
- readonly attribute boolean altKey;
- readonly attribute boolean metaKey;
- readonly attribute boolean repeat;
- readonly attribute boolean isComposing;
- boolean getModifierState (DOMString keyArg);
-};
-
-dictionary KeyboardEventInit : EventModifierInit {
- DOMString key = "";
- DOMString code = "";
- unsigned long location = 0;
- boolean repeat = false;
- boolean isComposing = false;
-};
-
-[Constructor(DOMString typeArg, optional CompositionEventInit compositionEventInitDict)]
-interface CompositionEvent : UIEvent {
- readonly attribute DOMString data;
-};
-
-dictionary CompositionEventInit : UIEventInit {
- DOMString data = "";
-};
-
-partial interface CustomEvent {
- // Originally introduced (and deprecated) in this specification
- void initCustomEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, any detailArg);
-};
-
-partial interface UIEvent {
- // Deprecated in this specification
- void initUIEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg);
-};
-
-partial interface FocusEvent {
- // Originally introduced (and deprecated) in this specification
- void initFocusEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg, EventTarget? relatedTargetArg);
-};
-
-partial interface MouseEvent {
- // Deprecated in this specification
- void initMouseEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, EventTarget? relatedTargetArg);
-};
-
-partial interface WheelEvent {
- // Originally introduced (and deprecated) in this specification
- void initWheelEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, short buttonArg, EventTarget? relatedTargetArg, DOMString modifiersListArg, double deltaXArg, double deltaYArg, double deltaZArg, unsigned long deltaMode);
-};
-
-partial interface KeyboardEvent {
- // Originally introduced (and deprecated) in this specification
- void initKeyboardEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, DOMString keyArg, unsigned long locationArg, DOMString modifiersListArg, boolean repeat, DOMString locale);
-};
-
-partial interface CompositionEvent {
- // Originally introduced (and deprecated) in this specification
- void initCompositionEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, DOMString dataArg, DOMString locale);
-};
-
-partial interface KeyboardEvent {
- // The following support legacy user agents
- readonly attribute unsigned long charCode;
- readonly attribute unsigned long keyCode;
- readonly attribute unsigned long which;
-};
-
-partial dictionary KeyboardEventInit {
- unsigned long charCode = 0;
- unsigned long keyCode = 0;
- unsigned long which = 0;
-};
-
-interface MutationEvent : Event {
- // attrChangeType
- const unsigned short MODIFICATION = 1;
- const unsigned short ADDITION = 2;
- const unsigned short REMOVAL = 3;
- readonly attribute Node? relatedNode;
- readonly attribute DOMString prevValue;
- readonly attribute DOMString newValue;
- readonly attribute DOMString attrName;
- readonly attribute unsigned short attrChange;
- void initMutationEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Node? relatedNodeArg, DOMString prevValueArg, DOMString newValueArg, DOMString attrNameArg, unsigned short attrChangeArg);
-};
-
diff --git a/javascript/WebIDL/urlutils.idl b/javascript/WebIDL/urlutils.idl
deleted file mode 100644
index e79d4ad42..000000000
--- a/javascript/WebIDL/urlutils.idl
+++ /dev/null
@@ -1,65 +0,0 @@
-// Retrived from https://url.spec.whatwg.org
-// Tue Aug 11 12:11:31 BST 2015
-// Removed duplicate IDL from appendix
-
-[Constructor(USVString url, optional USVString base),
- Exposed=(Window,Worker)]
-interface URL {
- static USVString domainToASCII(USVString domain);
- static USVString domainToUnicode(USVString domain);
-};
-URL implements URLUtils;
-URL implements URLUtilsSearchParams;
-
-[NoInterfaceObject,
- Exposed=(Window,Worker)]
-interface URLUtils {
- stringifier attribute USVString href;
- readonly attribute USVString origin;
-
- attribute USVString protocol;
- attribute USVString username;
- attribute USVString password;
- attribute USVString host;
- attribute USVString hostname;
- attribute USVString port;
- attribute USVString pathname;
- attribute USVString search;
- attribute USVString hash;
-};
-
-[NoInterfaceObject,
- Exposed=(Window, Worker)]
-interface URLUtilsSearchParams {
- attribute URLSearchParams searchParams;
-};
-
-[NoInterfaceObject,
- Exposed=(Window,Worker)]
-interface URLUtilsReadOnly {
- stringifier readonly attribute USVString href;
- readonly attribute USVString origin;
-
- readonly attribute USVString protocol;
- readonly attribute USVString host;
- readonly attribute USVString hostname;
- readonly attribute USVString port;
- readonly attribute USVString pathname;
- readonly attribute USVString search;
- readonly attribute USVString hash;
-};
-
-[Constructor(optional (USVString or URLSearchParams) init = ""),
- Exposed=(Window,Worker)]
-interface URLSearchParams {
- void append(USVString name, USVString value);
- void delete(USVString name);
- USVString? get(USVString name);
- sequence<USVString> getAll(USVString name);
- boolean has(USVString name);
- void set(USVString name, USVString value);
- iterable<USVString, USVString>;
- stringifier;
-};
-
-
diff --git a/javascript/content.c b/javascript/content.c
deleted file mode 100644
index ef5614094..000000000
--- a/javascript/content.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince@kyllikki.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Content for javascript (implementation)
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "utils/config.h"
-#include "content/content_protected.h"
-#include "content/hlcache.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "javascript/content.h"
-
-typedef struct javascript_content {
- struct content base;
-} javascript_content;
-
-static nserror javascript_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- javascript_content *script;
- nserror error;
-
- script = calloc(1, sizeof(javascript_content));
- if (script == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&script->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(script);
- return error;
- }
-
- *c = (struct content *) script;
-
- return NSERROR_OK;
-}
-
-static bool javascript_convert(struct content *c)
-{
- content_set_ready(c);
- content_set_done(c);
-
- return true;
-}
-
-static nserror
-javascript_clone(const struct content *old, struct content **newc)
-{
- javascript_content *script;
- nserror error;
-
- script = calloc(1, sizeof(javascript_content));
- if (script == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &script->base);
- if (error != NSERROR_OK) {
- content_destroy(&script->base);
- return error;
- }
-
- *newc = (struct content *) script;
-
- return NSERROR_OK;
-}
-
-static void javascript_destroy(struct content *c)
-{
-}
-
-static content_type javascript_content_type(void)
-{
- return CONTENT_JS;
-}
-
-
-static const content_handler javascript_content_handler = {
- .create = javascript_create,
- .data_complete = javascript_convert,
- .destroy = javascript_destroy,
- .clone = javascript_clone,
- .type = javascript_content_type,
- .no_share = false,
-};
-
-static const char *javascript_types[] = {
- "application/javascript", /* RFC 4329 */
- "application/ecmascript", /* RFC 4329 */
- "application/x-javascript", /* common usage */
- "text/javascript", /* common usage */
- "text/ecmascript", /* common usage */
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(javascript, javascript_types, javascript_content_handler);
diff --git a/javascript/content.h b/javascript/content.h
deleted file mode 100644
index f8160b4b1..000000000
--- a/javascript/content.h
+++ /dev/null
@@ -1 +0,0 @@
-nserror javascript_init(void);
diff --git a/javascript/duktape/Console.bnd b/javascript/duktape/Console.bnd
deleted file mode 100644
index 734f0035a..000000000
--- a/javascript/duktape/Console.bnd
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Console binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- * Copyright 2015 Daniel Silverstone <dsilvers@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Console {
- private unsigned int group;
- prologue %{
-#include <nsutils/time.h>
-
-#define CONSOLE_TIMERS MAGIC(ConsoleTimers)
-
-static void
-write_log_entry(duk_context *ctx, unsigned int group, char logtype)
-{
- /* objs... */
- for (int i = 0; i < duk_get_top(ctx); ++i) {
- (void)duk_safe_to_string(ctx, i);
- }
- /* strs... */
- duk_push_sprintf(ctx, "%c: ", logtype);
- duk_insert(ctx, 0);
- /* pfx strs... */
- for (unsigned int u = 0; u < group; ++u) {
- duk_push_lstring(ctx, " ", 1);
- duk_insert(ctx, 0);
- }
- /* spcs... pfx strs... */
- duk_concat(ctx, duk_get_top(ctx));
- /* str */
- LOG("%s", duk_safe_to_string(ctx, 0));
-}
-
-%};
-};
-
-init Console ()
-%{
- priv->group = 0;
- duk_push_object(ctx);
- duk_put_prop_string(ctx, 0, CONSOLE_TIMERS);
-%}
-
-method Console::group ()
-%{
- priv->group ++;
- return 0;
-%}
-
-method Console::groupCollapsed ()
-%{
- priv->group ++;
- return 0;
-%}
-
-method Console::groupEnd ()
-%{
- if (priv->group)
- priv->group --;
- return 0;
-%}
-
-method Console::info()
-%{
- write_log_entry(ctx, priv->group, 'I');
- return 0;
-%}
-
-method Console::debug()
-%{
- write_log_entry(ctx, priv->group, 'D');
- return 0;
-%}
-
-method Console::error()
-%{
- write_log_entry(ctx, priv->group, 'E');
- return 0;
-%}
-
-method Console::log()
-%{
- write_log_entry(ctx, priv->group, 'L');
- return 0;
-%}
-
-method Console::warn()
-%{
- write_log_entry(ctx, priv->group, 'W');
- return 0;
-%}
-
-method Console::dir()
-%{
- write_log_entry(ctx, priv->group, 'd');
- return 0;
-%}
-
-method Console::time()
-%{
- uint64_t time_ms = 0;
-
- if (nsu_getmonotonic_ms(&time_ms) != NSUERROR_OK)
- return 0;
-
- if (!duk_is_string(ctx, 0)) {
- duk_error(ctx, DUK_ERR_ERROR, "Console.time() takes a string");
- }
-
- duk_set_top(ctx, 1);
-
- duk_push_uint(ctx, (duk_uint_t)time_ms);
-
- duk_push_this(ctx);
- duk_get_prop_string(ctx, -1, CONSOLE_TIMERS);
- duk_insert(ctx, 0);
- duk_pop(ctx);
-
- duk_put_prop(ctx, 0);
-
- return 0;
-%}
-
-method Console::timeEnd()
-%{
- uint64_t time_ms = 0;
- uint64_t old_time_ms = 0;
-
- if (nsu_getmonotonic_ms(&time_ms) != NSUERROR_OK)
- return 0;
-
- if (!duk_is_string(ctx, 0)) {
- duk_error(ctx, DUK_ERR_ERROR, "Console.time() takes a string");
- }
-
- duk_set_top(ctx, 1);
-
- duk_push_this(ctx);
- duk_get_prop_string(ctx, -1, CONSOLE_TIMERS);
- duk_insert(ctx, 0);
- duk_pop(ctx);
-
- duk_dup(ctx, -1);
- duk_get_prop(ctx, 0);
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
- duk_push_uint(ctx, (duk_uint_t)time_ms);
- }
- /* timers timername oldval */
- old_time_ms = duk_to_uint32(ctx, -1);
- duk_pop(ctx);
- duk_dup(ctx, -1);
- duk_insert(ctx, 0);
- duk_del_prop(ctx, 0);
- duk_push_string(ctx, "Timer elapsed: ");
- duk_insert(ctx, 0);
- duk_push_sprintf(ctx, "%lu ms", (duk_uint_t)(time_ms - old_time_ms));
- write_log_entry(ctx, priv->group, 'T');
- return 0;
-%}
-
-method Console::trace ()
-%{
- duk_idx_t i = duk_push_error_object(ctx, DUK_ERR_ERROR, "Dummy Error");
- duk_get_prop_string(ctx, i, "stack");
- duk_safe_to_string(ctx, -1);
- duk_insert(ctx, 0);
- duk_set_top(ctx, 1);
- write_log_entry(ctx, priv->group, 'S');
- return 0;
-%}
diff --git a/javascript/duktape/Document.bnd b/javascript/duktape/Document.bnd
deleted file mode 100644
index 8658aec45..000000000
--- a/javascript/duktape/Document.bnd
+++ /dev/null
@@ -1,445 +0,0 @@
-/* document binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-prologue Document()
-%{
-#include "utils/corestrings.h"
-#include "utils/libdom.h"
-#include "utils/utils.h"
-#include "content/hlcache.h"
-#include "render/html_internal.h"
-#include "content/urldb.h"
-
-#define HANDLER_MAGIC MAGIC(HANDLER_MAP)
-%}
-
-
-init Document(struct dom_document *document::node);
-
-method Document::write()
-%{
- struct html_content *htmlc;
- duk_size_t text_len;
- dom_exception err;
- const char *text;
-
- for (int i = 0; i < duk_get_top(ctx); ++i) {
- duk_safe_to_string(ctx, i);
- }
- duk_concat(ctx, duk_get_top(ctx));
- text = duk_safe_to_lstring(ctx, 0, &text_len);
- JS_LOG("Writing %*s", (int)text_len, text);
-
- err = dom_node_get_user_data(priv->parent.node,
- corestring_dom___ns_key_html_content_data,
- &htmlc);
- if ((err != DOM_NO_ERR) || (htmlc == NULL)) {
- LOG("error getting htmlc. parent node:%p htmlc:%p",
- priv->parent.node, htmlc);
- return 0;
- } else if (htmlc->parser == NULL) {
- LOG("error; no parser for htmlc: %p", htmlc);
- return 0;
- }
-
- dom_hubbub_parser_insert_chunk(htmlc->parser,
- (uint8_t *)text, text_len);
-
- return 0;
-%}
-
-method Document::writeln()
-%{
- const char nl[] = "\n";
- struct html_content *htmlc;
- duk_size_t text_len;
- const char *text;
- dom_exception err;
-
- for (int i = 0; i < duk_get_top(ctx); ++i) {
- duk_safe_to_string(ctx, i);
- }
- duk_concat(ctx, duk_get_top(ctx));
- text = duk_safe_to_lstring(ctx, 0, &text_len);
-
- JS_LOG("Writeln %*s", (int)text_len, text);
- err = dom_node_get_user_data(priv->parent.node,
- corestring_dom___ns_key_html_content_data,
- &htmlc);
- if ((err != DOM_NO_ERR) || (htmlc == NULL)) {
- LOG("error getting htmlc. parent node:%p htmlc:%p",
- priv->parent.node, htmlc);
- return 0;
- } else if (htmlc->parser == NULL) {
- LOG("error; no parser for htmlc: %p", htmlc);
- return 0;
- }
-
- dom_hubbub_parser_insert_chunk(htmlc->parser, (uint8_t *)text, text_len);
- dom_hubbub_parser_insert_chunk(htmlc->parser, (uint8_t *)nl, SLEN(nl));
-
- return 0;
-%}
-
-method Document::createTextNode()
-%{
- dom_node *newnode;
- dom_exception err;
- duk_size_t text_len;
- const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
- dom_string *text_str;
-
- err = dom_string_create((const uint8_t*)text, text_len, &text_str);
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- err = dom_document_create_text_node(priv->parent.node,
- text_str,
- &newnode);
- if (err != DOM_NO_ERR) {
- dom_string_unref(text_str);
- return 0; /* coerced to undefined */
- }
-
- dom_string_unref(text_str);
-
- dukky_push_node(ctx, newnode);
-
- dom_node_unref(newnode);
-
- return 1;
-%}
-
-method Document::createElement()
-%{
- dom_node *newnode;
- dom_exception err;
- duk_size_t text_len;
- const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
- dom_string *text_str;
-
- err = dom_string_create((const uint8_t*)text, text_len, &text_str);
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- err = dom_document_create_element_ns(priv->parent.node,
- corestring_dom_html_namespace,
- text_str,
- &newnode);
- if (err != DOM_NO_ERR) {
- dom_string_unref(text_str);
- return 0; /* coerced to undefined */
- }
-
- dom_string_unref(text_str);
-
- dukky_push_node(ctx, newnode);
-
- dom_node_unref(newnode);
-
- return 1;
-%}
-
-getter Document::head()
-%{
- struct dom_nodelist *nodes;
- struct dom_node *retnode;
- dom_exception err;
- err = dom_document_get_elements_by_tag_name(priv->parent.node,
- corestring_dom_HEAD,
- &nodes);
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- err = dom_nodelist_item(nodes, 0, &retnode);
-
- if (err != DOM_NO_ERR) {
- dom_nodelist_unref(nodes);
- return 0; /* coerced to undefined */
- }
-
- dom_nodelist_unref(nodes);
-
- if (retnode == NULL) return 0; /* coerced to undefined */
-
- dukky_push_node(ctx, retnode);
-
- dom_node_unref(retnode);
-
- return 1;
-%}
-
-getter Document::body()
-%{
- struct dom_nodelist *nodes;
- struct dom_node *retnode;
- dom_exception err;
- err = dom_document_get_elements_by_tag_name(priv->parent.node,
- corestring_dom_BODY,
- &nodes);
- if (err != DOM_NO_ERR) {
- return 0; /* coerced to undefined */
- }
-
- err = dom_nodelist_item(nodes, 0, &retnode);
-
- if (err != DOM_NO_ERR) {
- dom_nodelist_unref(nodes);
- return 0; /* coerced to undefined */
- }
-
- dom_nodelist_unref(nodes);
-
- if (retnode != NULL) {
- dukky_push_node(ctx, retnode);
-
- dom_node_unref(retnode);
-
- return 1;
- }
-
- return 0; /* coerced to undefined */
-%}
-
-getter Document::location()
-%{
- /* retrieve the location object from the root object (window) */
- duk_push_global_object(ctx);
- duk_get_prop_string(ctx, -1, "location");
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
- return 0;
- }
- return 1;
-%}
-
-
-method Document::getElementById()
-%{
- dom_string *elementId_dom;
- dom_element *element;
- dom_exception exc;
- duk_size_t text_len;
- const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
-
- exc = dom_string_create((uint8_t*)text, text_len, &elementId_dom);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- exc = dom_document_get_element_by_id(((node_private_t *)priv)->node,
- elementId_dom, &element);
- dom_string_unref(elementId_dom);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- if (element != NULL) {
- dukky_push_node(ctx, (dom_node *)element);
- dom_node_unref(element);
- return 1;
- }
-
- return 0;
-%}
-
-getter Document::documentElement()
-%{
- dom_exception exc;
- dom_element *element;
-
- exc = dom_document_get_document_element(((node_private_t *)priv)->node,
- &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- if (element == NULL) {
- return 0;
- }
-
- dukky_push_node(ctx, (dom_node *)element);
- dom_node_unref(element);
-
- return 1;
-
-%}
-
-method Document::getElementsByTagName()
-%{
- dom_nodelist *nodes;
- dom_exception err;
- duk_size_t text_len;
- const char *text = duk_safe_to_lstring(ctx, 0, &text_len);
- dom_string *tag;
-
- err = dom_string_create((uint8_t*)text, text_len, &tag);
-
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- err = dom_document_get_elements_by_tag_name(((node_private_t *)priv)->node,
- tag, &nodes);
- dom_string_unref(tag);
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- if (nodes == NULL) return 0; /* coerced to undefined */
-
- duk_push_pointer(ctx, nodes);
- dukky_create_object(ctx, PROTO_NAME(NODELIST), 1);
- dom_nodelist_unref(nodes);
- return 1;
-%}
-
-getter Document::cookie()
-%{
- char *cookie_str;
- struct html_content *htmlc;
- dom_exception err;
-
- err = dom_node_get_user_data(priv->parent.node,
- corestring_dom___ns_key_html_content_data,
- &htmlc);
- if ((err == DOM_NO_ERR) && (htmlc != NULL)) {
- cookie_str = urldb_get_cookie(llcache_handle_get_url(htmlc->base.llcache), false);
- if (cookie_str != NULL) {
- duk_push_string(ctx, cookie_str);
- free(cookie_str);
- return 1;
- }
- } else {
- LOG("error getting htmlc. parent node:%p htmlc:%p",
- priv->parent.node, htmlc);
- }
- return 0;
-%}
-
-getter Document::onabort();
-setter Document::onabort();
-getter Document::onautocompleteerror();
-setter Document::onautocompleteerror();
-getter Document::onautocomplete();
-setter Document::onautocomplete();
-getter Document::onblur();
-setter Document::onblur();
-getter Document::oncancel();
-setter Document::oncancel();
-getter Document::oncanplaythrough();
-setter Document::oncanplaythrough();
-getter Document::oncanplay();
-setter Document::oncanplay();
-getter Document::onchange();
-setter Document::onchange();
-getter Document::onclick();
-setter Document::onclick();
-getter Document::onclose();
-setter Document::onclose();
-getter Document::oncontextmenu();
-setter Document::oncontextmenu();
-getter Document::oncuechange();
-setter Document::oncuechange();
-getter Document::ondblclick();
-setter Document::ondblclick();
-getter Document::ondragend();
-setter Document::ondragend();
-getter Document::ondragenter();
-setter Document::ondragenter();
-getter Document::ondragexit();
-setter Document::ondragexit();
-getter Document::ondragleave();
-setter Document::ondragleave();
-getter Document::ondragover();
-setter Document::ondragover();
-getter Document::ondragstart();
-setter Document::ondragstart();
-getter Document::ondrag();
-setter Document::ondrag();
-getter Document::ondrop();
-setter Document::ondrop();
-getter Document::ondurationchange();
-setter Document::ondurationchange();
-getter Document::onemptied();
-setter Document::onemptied();
-getter Document::onended();
-setter Document::onended();
-getter Document::onfocus();
-setter Document::onfocus();
-getter Document::oninput();
-setter Document::oninput();
-getter Document::oninvalid();
-setter Document::oninvalid();
-getter Document::onkeydown();
-setter Document::onkeydown();
-getter Document::onkeypress();
-setter Document::onkeypress();
-getter Document::onkeyup();
-setter Document::onkeyup();
-getter Document::onloadeddata();
-setter Document::onloadeddata();
-getter Document::onloadedmetadata();
-setter Document::onloadedmetadata();
-getter Document::onloadstart();
-setter Document::onloadstart();
-getter Document::onload();
-setter Document::onload();
-getter Document::onmousedown();
-setter Document::onmousedown();
-getter Document::onmouseenter();
-setter Document::onmouseenter();
-getter Document::onmouseleave();
-setter Document::onmouseleave();
-getter Document::onmousemove();
-setter Document::onmousemove();
-getter Document::onmouseout();
-setter Document::onmouseout();
-getter Document::onmouseover();
-setter Document::onmouseover();
-getter Document::onmouseup();
-setter Document::onmouseup();
-getter Document::onpause();
-setter Document::onpause();
-getter Document::onplaying();
-setter Document::onplaying();
-getter Document::onplay();
-setter Document::onplay();
-getter Document::onprogress();
-setter Document::onprogress();
-getter Document::onratechange();
-setter Document::onratechange();
-getter Document::onreadystatechange();
-setter Document::onreadystatechange();
-getter Document::onreset();
-setter Document::onreset();
-getter Document::onresize();
-setter Document::onresize();
-getter Document::onscroll();
-setter Document::onscroll();
-getter Document::onseeked();
-setter Document::onseeked();
-getter Document::onseeking();
-setter Document::onseeking();
-getter Document::onselect();
-setter Document::onselect();
-getter Document::onshow();
-setter Document::onshow();
-getter Document::onsort();
-setter Document::onsort();
-getter Document::onstalled();
-setter Document::onstalled();
-getter Document::onsubmit();
-setter Document::onsubmit();
-getter Document::onsuspend();
-setter Document::onsuspend();
-getter Document::ontimeupdate();
-setter Document::ontimeupdate();
-getter Document::ontoggle();
-setter Document::ontoggle();
-getter Document::onvolumechange();
-setter Document::onvolumechange();
-getter Document::onwaiting();
-setter Document::onwaiting();
-getter Document::onwheel();
-setter Document::onwheel();
diff --git a/javascript/duktape/Element.bnd b/javascript/duktape/Element.bnd
deleted file mode 100644
index d34e8c1eb..000000000
--- a/javascript/duktape/Element.bnd
+++ /dev/null
@@ -1,379 +0,0 @@
-/* document binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Element {
- prologue %{
-#include <utils/corestrings.h>
-%};
-};
-
-init Element(struct dom_element *element::node);
-
-getter Element::firstElementChild()
-%{
- dom_node *element;
- dom_exception exc;
- dom_node_type node_type;
- dom_node *next_node;
-
- exc = dom_node_get_first_child(((node_private_t*)priv)->node, &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- while (element != NULL) {
- exc = dom_node_get_node_type(element, &node_type);
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- /* found it */
- break;
- }
-
- exc = dom_node_get_next_sibling(element, &next_node);
- dom_node_unref(element);
- if (exc == DOM_NO_ERR) {
- element = next_node;
- } else {
- element = NULL;
- }
- }
- if (dukky_push_node(ctx, (dom_node *)element) == false) {
- dom_node_unref(element);
- return 0;
- }
- dom_node_unref(element);
- return 1;
-%}
-
-getter Element::lastElementChild()
-%{
- dom_node *element;
- dom_exception exc;
- dom_node_type node_type;
- dom_node *next_node;
-
- exc = dom_node_get_last_child(((node_private_t*)priv)->node, &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- while (element != NULL) {
- exc = dom_node_get_node_type(element, &node_type);
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- /* found it */
- break;
- }
-
- exc = dom_node_get_previous_sibling(element, &next_node);
- dom_node_unref(element);
- if (exc == DOM_NO_ERR) {
- element = next_node;
- } else {
- element = NULL;
- }
- }
- if (dukky_push_node(ctx, (dom_node *)element) == false) {
- dom_node_unref(element);
- return 0;
- }
- dom_node_unref(element);
- return 1;
-%}
-
-getter Element::previousElementSibling()
-%{
- dom_node *element;
- dom_exception exc;
- dom_node_type node_type;
- dom_node *sib_node;
-
- exc = dom_node_get_previous_sibling(((node_private_t *)priv)->node, &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- while (element != NULL) {
- exc = dom_node_get_node_type(element, &node_type);
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- /* found it */
- break;
- }
-
- exc = dom_node_get_previous_sibling(element, &sib_node);
- dom_node_unref(element);
- if (exc == DOM_NO_ERR) {
- element = sib_node;
- } else {
- element = NULL;
- }
- }
- if (dukky_push_node(ctx, (dom_node *)element) == false) {
- dom_node_unref(element);
- return 0;
- }
- dom_node_unref(element);
- return 1;
-%}
-
-getter Element::nextElementSibling()
-%{
- dom_node *element;
- dom_exception exc;
- dom_node_type node_type;
- dom_node *sib_node;
-
- exc = dom_node_get_next_sibling(((node_private_t *)priv)->node, &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- while (element != NULL) {
- exc = dom_node_get_node_type(element, &node_type);
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- /* found it */
- break;
- }
-
- exc = dom_node_get_next_sibling(element, &sib_node);
- dom_node_unref(element);
- if (exc == DOM_NO_ERR) {
- element = sib_node;
- } else {
- element = NULL;
- }
- }
- if (dukky_push_node(ctx, (dom_node *)element) == false) {
- dom_node_unref(element);
- return 0;
- }
- dom_node_unref(element);
- return 1;
-%}
-
-getter Element::childElementCount()
-%{
- dom_node *element;
- dom_exception exc;
- dom_node_type node_type;
- dom_node *next_node;
- duk_uint_t jsret = 0;
-
- exc = dom_node_get_first_child(((node_private_t *)priv)->node, &element);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- while (element != NULL) {
- exc = dom_node_get_node_type(element, &node_type);
- if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) {
- jsret += 1;
- }
-
- exc = dom_node_get_next_sibling(element, &next_node);
- dom_node_unref(element);
- if (exc == DOM_NO_ERR) {
- element = next_node;
- } else {
- element = NULL;
- }
- }
- LOG("I found %u of them", jsret);
- duk_push_uint(ctx, jsret);
- return 1;
-%}
-
-method Element::getElementsByTagName ()
-%{
- dom_nodelist *nlist = NULL;
- dom_exception exc;
- dom_string *tagname;
- duk_size_t len;
- const char *str = duk_to_lstring(ctx, 0, &len);
-
- exc = dom_string_create((const uint8_t *)str, len, &tagname);
-
- if (exc != DOM_NO_ERR) return 0;
-
- exc = dom_element_get_elements_by_tag_name(priv->parent.node,
- tagname, &nlist);
- dom_string_unref(tagname);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_pointer(ctx, nlist);
- dukky_create_object(ctx, PROTO_NAME(NODELIST), 1);
- dom_nodelist_unref(nlist);
-
- return 1;
-%}
-
-getter Element::id ()
-%{
- dom_string *idstr = NULL;
- dom_exception exc;
-
- exc = dom_element_get_attribute(priv->parent.node,
- corestring_dom_id,
- &idstr);
- if (exc != DOM_NO_ERR) return 0;
- if (idstr == NULL) {
- duk_push_lstring(ctx, "", 0);
- } else {
- duk_push_lstring(ctx, dom_string_data(idstr),
- dom_string_length(idstr));
- dom_string_unref(idstr);
- }
- return 1;
-%}
-
-setter Element::id ()
-%{
- dom_string *idstr = NULL;
- dom_exception exc;
- duk_size_t slen;
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
-
- exc = dom_string_create((const uint8_t *)s, slen, &idstr);
- if (exc != DOM_NO_ERR) return 0;
-
- exc = dom_element_set_attribute(priv->parent.node,
- corestring_dom_id,
- idstr);
- dom_string_unref(idstr);
- if (exc != DOM_NO_ERR) return 0;
- return 0;
-%}
-
-
-method Element::removeAttribute()
-%{
- dom_string *attr = NULL;
- dom_exception exc;
- duk_size_t slen;
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
-
- exc = dom_string_create((const uint8_t *)s, slen, &attr);
- if (exc != DOM_NO_ERR) return 0;
-
- exc = dom_element_remove_attribute(priv->parent.node, attr);
- dom_string_unref(attr);
- if (exc != DOM_NO_ERR) return 0;
- return 0;
-%}
-
-method Element::getAttribute()
-%{
- dom_string *attr_name = NULL;
- dom_string *attr_value = NULL;
- dom_exception exc;
- duk_size_t slen;
-
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
- exc = dom_string_create((const uint8_t *)s, slen, &attr_name);
- duk_pop(ctx);
-
- exc = dom_element_get_attribute(priv->parent.node,
- attr_name, &attr_value);
- dom_string_unref(attr_name);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- if (attr_value == NULL) {
- duk_push_null(ctx);
- } else {
- duk_push_lstring(ctx, dom_string_data(attr_value),
- dom_string_length(attr_value));
- dom_string_unref(attr_value);
- }
- return 1;
-%}
-
-method Element::setAttribute()
-%{
- dom_exception exc;
- dom_string *attr_str, *value_str;
- duk_size_t attr_len, value_len;
- const char *attr = duk_safe_to_lstring(ctx, 0, &attr_len);
- const char *value = duk_safe_to_lstring(ctx, 1, &value_len);
-
- exc = dom_string_create((const uint8_t *)attr, attr_len, &attr_str);
- if (exc != DOM_NO_ERR) return 0;
-
- exc = dom_string_create((const uint8_t *)value, value_len, &value_str);
- if (exc != DOM_NO_ERR) {
- dom_string_unref(attr_str);
- return 0;
- }
-
- exc = dom_element_set_attribute(priv->parent.node,
- attr_str, value_str);
- dom_string_unref(attr_str);
- dom_string_unref(value_str);
- if (exc != DOM_NO_ERR) return 0;
- return 0;
-%}
-
-method Element::hasAttribute()
-%{
- dom_string *attr_name = NULL;
- dom_exception exc;
- duk_size_t slen;
- bool res;
-
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
- exc = dom_string_create((const uint8_t *)s, slen, &attr_name);
- duk_pop(ctx);
-
- exc = dom_element_has_attribute(priv->parent.node,
- attr_name, &res);
- dom_string_unref(attr_name);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- duk_push_boolean(ctx, res);
- return 1;
-%}
-
-getter Element::className ()
-%{
- dom_string *classstr = NULL;
- dom_exception exc;
-
- exc = dom_element_get_attribute(priv->parent.node,
- corestring_dom_class,
- &classstr);
- if (exc != DOM_NO_ERR) return 0;
- if (classstr == NULL) {
- duk_push_lstring(ctx, "", 0);
- } else {
- duk_push_lstring(ctx, dom_string_data(classstr),
- dom_string_length(classstr));
- dom_string_unref(classstr);
- }
- return 1;
-%}
-
-setter Element::className ()
-%{
- dom_string *classstr = NULL;
- dom_exception exc;
- duk_size_t slen;
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
-
- exc = dom_string_create((const uint8_t *)s, slen, &classstr);
- if (exc != DOM_NO_ERR) return 0;
-
- exc = dom_element_set_attribute(priv->parent.node,
- corestring_dom_class,
- classstr);
- dom_string_unref(classstr);
- if (exc != DOM_NO_ERR) return 0;
- return 0;
-%}
-
diff --git a/javascript/duktape/Event.bnd b/javascript/duktape/Event.bnd
deleted file mode 100644
index a0bc3c3e7..000000000
--- a/javascript/duktape/Event.bnd
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Event binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- * Copyright 2015 Daniel Silverstone <dsilvers@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Event {
- private dom_event *evt;
-};
-
-init Event (struct dom_event *evt)
-%{
- priv->evt = evt;
- dom_event_ref(evt);
-%}
-
-fini Event ()
-%{
- dom_event_unref(priv->evt);
-%}
-
-/* Note: many of these could be automatics once nsgenbind gets there. */
-
-getter Event::type ()
-%{
- dom_string *ret;
- dom_exception exc;
-
- exc = dom_event_get_type(priv->evt, &ret);
- if (exc != DOM_NO_ERR) return 0;
- if (ret == NULL) {
- duk_push_lstring(ctx, "", 0);
- } else {
- duk_push_lstring(ctx, dom_string_data(ret),
- dom_string_length(ret));
- dom_string_unref(ret);
- }
-
- return 1;
-%}
-
-getter Event::target ()
-%{
- /** @todo Decide HTF this works wrt. Window as an event target */
- dom_node *et;
- dom_exception exc;
-
- exc = dom_event_get_target(priv->evt, &et);
- if (exc != DOM_NO_ERR) return 0;
-
- dukky_push_node(ctx, et);
- return 1;
-%}
-
-getter Event::currentTarget ()
-%{
- /** @todo Decide HTF this works wrt. Window as an event target */
- dom_node *et;
- dom_exception exc;
-
- exc = dom_event_get_current_target(priv->evt, &et);
- if (exc != DOM_NO_ERR) return 0;
-
- dukky_push_node(ctx, et);
- return 1;
-%}
-
-getter Event::eventPhase ()
-%{
- dom_exception exc;
- dom_event_flow_phase phase;
-
- exc = dom_event_get_event_phase(priv->evt, &phase);
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_uint(ctx, phase);
- return 1;
-%}
-
-method Event::stopPropagation ()
-%{
- dom_exception exc;
-
- exc = dom_event_stop_propagation(priv->evt);
- if (exc != DOM_NO_ERR) return 0;
-
- return 0;
-%}
-
-method Event::stopImmediatePropagation ()
-%{
- dom_exception exc;
-
- exc = dom_event_stop_immediate_propagation(priv->evt);
- if (exc != DOM_NO_ERR) return 0;
-
- return 0;
-%}
-
-getter Event::bubbles ()
-%{
- dom_exception exc;
- bool ret;
-
- exc = dom_event_get_bubbles(priv->evt, &ret);
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_boolean(ctx, ret);
- return 1;
-%}
-
-getter Event::cancelable ()
-%{
- dom_exception exc;
- bool ret;
-
- exc = dom_event_get_cancelable(priv->evt, &ret);
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_boolean(ctx, ret);
- return 1;
-%}
-
-method Event::preventDefault ()
-%{
- dom_exception exc;
-
- exc = dom_event_prevent_default(priv->evt);
- if (exc != DOM_NO_ERR) return 0;
-
- return 0;
-%}
-
-getter Event::defaultPrevented ()
-%{
- dom_exception exc;
- bool ret;
-
- exc = dom_event_is_default_prevented(priv->evt, &ret);
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_boolean(ctx, ret);
- return 1;
-%}
-
diff --git a/javascript/duktape/HTMLAnchorElement.bnd b/javascript/duktape/HTMLAnchorElement.bnd
deleted file mode 100644
index 3dcfef72e..000000000
--- a/javascript/duktape/HTMLAnchorElement.bnd
+++ /dev/null
@@ -1,39 +0,0 @@
-/* HTML anchor element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLAnchorElement(struct dom_html_element *html_anchor_element::html_element);
-
-getter HTMLAnchorElement::charset();
-setter HTMLAnchorElement::charset();
-
-getter HTMLAnchorElement::coords();
-setter HTMLAnchorElement::coords();
-
-getter HTMLAnchorElement::hreflang();
-setter HTMLAnchorElement::hreflang();
-
-getter HTMLAnchorElement::name();
-setter HTMLAnchorElement::name();
-
-getter HTMLAnchorElement::rel();
-setter HTMLAnchorElement::rel();
-
-getter HTMLAnchorElement::rev();
-setter HTMLAnchorElement::rev();
-
-getter HTMLAnchorElement::shape();
-setter HTMLAnchorElement::shape();
-
-getter HTMLAnchorElement::target();
-setter HTMLAnchorElement::target();
-
-
-
-
diff --git a/javascript/duktape/HTMLAppletElement.bnd b/javascript/duktape/HTMLAppletElement.bnd
deleted file mode 100644
index 8bf3ff2f7..000000000
--- a/javascript/duktape/HTMLAppletElement.bnd
+++ /dev/null
@@ -1,30 +0,0 @@
-/* HTML applet element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLAppletElement(struct dom_html_element *html_applet_element::html_element);
-
-getter HTMLAppletElement::align();
-setter HTMLAppletElement::align();
-getter HTMLAppletElement::alt();
-setter HTMLAppletElement::alt();
-getter HTMLAppletElement::archive();
-setter HTMLAppletElement::archive();
-getter HTMLAppletElement::codeBase();
-setter HTMLAppletElement::codeBase();
-getter HTMLAppletElement::code();
-setter HTMLAppletElement::code();
-getter HTMLAppletElement::height();
-setter HTMLAppletElement::height();
-getter HTMLAppletElement::name();
-setter HTMLAppletElement::name();
-getter HTMLAppletElement::object();
-setter HTMLAppletElement::object();
-getter HTMLAppletElement::width();
-setter HTMLAppletElement::width();
diff --git a/javascript/duktape/HTMLAreaElement.bnd b/javascript/duktape/HTMLAreaElement.bnd
deleted file mode 100644
index b6c17031c..000000000
--- a/javascript/duktape/HTMLAreaElement.bnd
+++ /dev/null
@@ -1,26 +0,0 @@
-/* HTML area element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLAreaElement(struct dom_html_element *html_area_element::html_element);
-
-getter HTMLAreaElement::alt();
-setter HTMLAreaElement::alt();
-
-getter HTMLAreaElement::coords();
-setter HTMLAreaElement::coords();
-
-getter HTMLAreaElement::noHref();
-setter HTMLAreaElement::noHref();
-
-getter HTMLAreaElement::shape();
-setter HTMLAreaElement::shape();
-
-getter HTMLAreaElement::target();
-setter HTMLAreaElement::target();
diff --git a/javascript/duktape/HTMLBRElement.bnd b/javascript/duktape/HTMLBRElement.bnd
deleted file mode 100644
index 3b44b9777..000000000
--- a/javascript/duktape/HTMLBRElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML br element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLBRElement(struct dom_html_element *html_br_element::html_element);
-
-getter HTMLBRElement::clear();
-setter HTMLBRElement::clear();
diff --git a/javascript/duktape/HTMLBaseElement.bnd b/javascript/duktape/HTMLBaseElement.bnd
deleted file mode 100644
index 143aefd36..000000000
--- a/javascript/duktape/HTMLBaseElement.bnd
+++ /dev/null
@@ -1,17 +0,0 @@
-/* HTML base element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLBaseElement(struct dom_html_element *html_base_element::html_element);
-
-getter HTMLBaseElement::href();
-setter HTMLBaseElement::href();
-
-getter HTMLBaseElement::target();
-setter HTMLBaseElement::target();
diff --git a/javascript/duktape/HTMLBodyElement.bnd b/javascript/duktape/HTMLBodyElement.bnd
deleted file mode 100644
index a283f897c..000000000
--- a/javascript/duktape/HTMLBodyElement.bnd
+++ /dev/null
@@ -1,24 +0,0 @@
-/* HTML body element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLBodyElement(struct dom_html_element *html_body_element::html_element);
-
-getter HTMLBodyElement::aLink();
-setter HTMLBodyElement::aLink();
-getter HTMLBodyElement::background();
-setter HTMLBodyElement::background();
-getter HTMLBodyElement::bgColor();
-setter HTMLBodyElement::bgColor();
-getter HTMLBodyElement::link();
-setter HTMLBodyElement::link();
-getter HTMLBodyElement::text();
-setter HTMLBodyElement::text();
-getter HTMLBodyElement::vLink();
-setter HTMLBodyElement::vLink();
diff --git a/javascript/duktape/HTMLButtonElement.bnd b/javascript/duktape/HTMLButtonElement.bnd
deleted file mode 100644
index 53431aa04..000000000
--- a/javascript/duktape/HTMLButtonElement.bnd
+++ /dev/null
@@ -1,18 +0,0 @@
-/* HTML button element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLButtonElement(struct dom_html_element *html_button_element::html_element);
-
-getter HTMLButtonElement::disabled();
-setter HTMLButtonElement::disabled();
-getter HTMLButtonElement::name();
-setter HTMLButtonElement::name();
-getter HTMLButtonElement::value();
-setter HTMLButtonElement::value();
diff --git a/javascript/duktape/HTMLCollection.bnd b/javascript/duktape/HTMLCollection.bnd
deleted file mode 100644
index 2ffe7027b..000000000
--- a/javascript/duktape/HTMLCollection.bnd
+++ /dev/null
@@ -1,24 +0,0 @@
-/* HTMLCollection binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class HTMLCollection {
- private struct dom_html_collection *coll;
-};
-
-init HTMLCollection(struct dom_html_collection *coll)
-%{
- priv->coll = coll;
- dom_html_collection_ref(coll);
-%}
-
-fini HTMLCollection()
-%{
- dom_html_collection_unref(priv->coll);
-%}
diff --git a/javascript/duktape/HTMLDivElement.bnd b/javascript/duktape/HTMLDivElement.bnd
deleted file mode 100644
index 759e34d96..000000000
--- a/javascript/duktape/HTMLDivElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML div element binding using duktape and libdom
- *
- * Copyright 2015 Michael Drake <tlsa@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLDivElement(struct dom_html_element *html_div_element::html_element);
-
-getter HTMLDivElement::align();
-setter HTMLDivElement::align();
diff --git a/javascript/duktape/HTMLElement.bnd b/javascript/duktape/HTMLElement.bnd
deleted file mode 100644
index b3de9c8fe..000000000
--- a/javascript/duktape/HTMLElement.bnd
+++ /dev/null
@@ -1,162 +0,0 @@
-/* HTML element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-prologue HTMLElement()
-%{
-#include <utils/corestrings.h>
-#define HANDLER_MAGIC MAGIC(HANDLER_MAP)
-%}
-
-init HTMLElement(struct dom_html_element *html_element::element);
-
-getter HTMLElement::dir();
-setter HTMLElement::dir();
-
-getter HTMLElement::lang();
-setter HTMLElement::lang();
-
-getter HTMLElement::title();
-setter HTMLElement::title();
-
-getter HTMLElement::onchange();
-setter HTMLElement::onchange();
-
-setter HTMLElement::onclick();
-getter HTMLElement::onclick();
-
-getter HTMLElement::onabort();
-setter HTMLElement::onabort();
-getter HTMLElement::onautocompleteerror();
-setter HTMLElement::onautocompleteerror();
-getter HTMLElement::onautocomplete();
-setter HTMLElement::onautocomplete();
-getter HTMLElement::onblur();
-setter HTMLElement::onblur();
-getter HTMLElement::oncancel();
-setter HTMLElement::oncancel();
-getter HTMLElement::oncanplaythrough();
-setter HTMLElement::oncanplaythrough();
-getter HTMLElement::oncanplay();
-setter HTMLElement::oncanplay();
-getter HTMLElement::onclose();
-setter HTMLElement::onclose();
-getter HTMLElement::oncontextmenu();
-setter HTMLElement::oncontextmenu();
-getter HTMLElement::oncuechange();
-setter HTMLElement::oncuechange();
-getter HTMLElement::ondblclick();
-setter HTMLElement::ondblclick();
-getter HTMLElement::ondragend();
-setter HTMLElement::ondragend();
-getter HTMLElement::ondragenter();
-setter HTMLElement::ondragenter();
-getter HTMLElement::ondragexit();
-setter HTMLElement::ondragexit();
-getter HTMLElement::ondragleave();
-setter HTMLElement::ondragleave();
-getter HTMLElement::ondragover();
-setter HTMLElement::ondragover();
-getter HTMLElement::ondragstart();
-setter HTMLElement::ondragstart();
-getter HTMLElement::ondrag();
-setter HTMLElement::ondrag();
-getter HTMLElement::ondrop();
-setter HTMLElement::ondrop();
-getter HTMLElement::ondurationchange();
-setter HTMLElement::ondurationchange();
-getter HTMLElement::onemptied();
-setter HTMLElement::onemptied();
-getter HTMLElement::onended();
-setter HTMLElement::onended();
-getter HTMLElement::onfocus();
-setter HTMLElement::onfocus();
-getter HTMLElement::oninput();
-setter HTMLElement::oninput();
-getter HTMLElement::oninvalid();
-setter HTMLElement::oninvalid();
-getter HTMLElement::onkeydown();
-setter HTMLElement::onkeydown();
-getter HTMLElement::onkeypress();
-setter HTMLElement::onkeypress();
-getter HTMLElement::onkeyup();
-setter HTMLElement::onkeyup();
-getter HTMLElement::onloadeddata();
-setter HTMLElement::onloadeddata();
-getter HTMLElement::onloadedmetadata();
-setter HTMLElement::onloadedmetadata();
-getter HTMLElement::onloadstart();
-setter HTMLElement::onloadstart();
-getter HTMLElement::onload();
-setter HTMLElement::onload();
-getter HTMLElement::onmousedown();
-setter HTMLElement::onmousedown();
-getter HTMLElement::onmouseenter();
-setter HTMLElement::onmouseenter();
-getter HTMLElement::onmouseleave();
-setter HTMLElement::onmouseleave();
-getter HTMLElement::onmousemove();
-setter HTMLElement::onmousemove();
-getter HTMLElement::onmouseout();
-setter HTMLElement::onmouseout();
-getter HTMLElement::onmouseover();
-setter HTMLElement::onmouseover();
-getter HTMLElement::onmouseup();
-setter HTMLElement::onmouseup();
-getter HTMLElement::onpause();
-setter HTMLElement::onpause();
-getter HTMLElement::onplaying();
-setter HTMLElement::onplaying();
-getter HTMLElement::onplay();
-setter HTMLElement::onplay();
-getter HTMLElement::onprogress();
-setter HTMLElement::onprogress();
-getter HTMLElement::onratechange();
-setter HTMLElement::onratechange();
-getter HTMLElement::onreset();
-setter HTMLElement::onreset();
-getter HTMLElement::onresize();
-setter HTMLElement::onresize();
-getter HTMLElement::onscroll();
-setter HTMLElement::onscroll();
-getter HTMLElement::onseeked();
-setter HTMLElement::onseeked();
-getter HTMLElement::onseeking();
-setter HTMLElement::onseeking();
-getter HTMLElement::onselect();
-setter HTMLElement::onselect();
-getter HTMLElement::onshow();
-setter HTMLElement::onshow();
-getter HTMLElement::onsort();
-setter HTMLElement::onsort();
-getter HTMLElement::onstalled();
-setter HTMLElement::onstalled();
-getter HTMLElement::onsubmit();
-setter HTMLElement::onsubmit();
-getter HTMLElement::onsuspend();
-setter HTMLElement::onsuspend();
-getter HTMLElement::ontimeupdate();
-setter HTMLElement::ontimeupdate();
-getter HTMLElement::ontoggle();
-setter HTMLElement::ontoggle();
-getter HTMLElement::onvolumechange();
-setter HTMLElement::onvolumechange();
-getter HTMLElement::onwaiting();
-setter HTMLElement::onwaiting();
-getter HTMLElement::onwheel();
-setter HTMLElement::onwheel();
-
-getter HTMLElement::style()
-%{
- /* Minimal implementation to avoid infinite-loop in Modernizr (c.f. #2413) */
- if (dukky_create_object(ctx, PROTO_NAME(CSSSTYLEDECLARATION), 0) != DUK_EXEC_SUCCESS) {
- return 0;
- }
- return 1;
-%}
diff --git a/javascript/duktape/HTMLFontElement.bnd b/javascript/duktape/HTMLFontElement.bnd
deleted file mode 100644
index e648a72e1..000000000
--- a/javascript/duktape/HTMLFontElement.bnd
+++ /dev/null
@@ -1,20 +0,0 @@
-/* HTML font element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLFontElement(struct dom_html_element *html_font_element::html_element);
-
-getter HTMLFontElement::color();
-setter HTMLFontElement::color();
-
-getter HTMLFontElement::face();
-setter HTMLFontElement::face();
-
-getter HTMLFontElement::size();
-setter HTMLFontElement::size();
diff --git a/javascript/duktape/HTMLFormElement.bnd b/javascript/duktape/HTMLFormElement.bnd
deleted file mode 100644
index 3906cf0b3..000000000
--- a/javascript/duktape/HTMLFormElement.bnd
+++ /dev/null
@@ -1,26 +0,0 @@
-/* HTML form element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLFormElement(struct dom_html_element *html_form_element::html_element);
-
-getter HTMLFormElement::acceptCharset();
-setter HTMLFormElement::acceptCharset();
-
-getter HTMLFormElement::action();
-setter HTMLFormElement::action();
-
-getter HTMLFormElement::enctype();
-setter HTMLFormElement::enctype();
-
-getter HTMLFormElement::method();
-setter HTMLFormElement::method();
-
-getter HTMLFormElement::target();
-setter HTMLFormElement::target();
diff --git a/javascript/duktape/HTMLFrameElement.bnd b/javascript/duktape/HTMLFrameElement.bnd
deleted file mode 100644
index ee5cfe3d0..000000000
--- a/javascript/duktape/HTMLFrameElement.bnd
+++ /dev/null
@@ -1,35 +0,0 @@
-/* HTML frame element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLFrameElement(struct dom_html_element *html_frame_element::html_element);
-
-getter HTMLFrameElement::frameBorder();
-setter HTMLFrameElement::frameBorder();
-
-getter HTMLFrameElement::longDesc();
-setter HTMLFrameElement::longDesc();
-
-getter HTMLFrameElement::marginHeight();
-setter HTMLFrameElement::marginHeight();
-
-getter HTMLFrameElement::marginWidth();
-setter HTMLFrameElement::marginWidth();
-
-getter HTMLFrameElement::name();
-setter HTMLFrameElement::name();
-
-getter HTMLFrameElement::noResize();
-setter HTMLFrameElement::noResize();
-
-getter HTMLFrameElement::scrolling();
-setter HTMLFrameElement::scrolling();
-
-getter HTMLFrameElement::src();
-setter HTMLFrameElement::src();
diff --git a/javascript/duktape/HTMLFrameSetElement.bnd b/javascript/duktape/HTMLFrameSetElement.bnd
deleted file mode 100644
index cc66e93d8..000000000
--- a/javascript/duktape/HTMLFrameSetElement.bnd
+++ /dev/null
@@ -1,17 +0,0 @@
-/* HTML frame set element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLFrameSetElement(struct dom_html_element *html_frame_set_element::html_element);
-
-getter HTMLFrameSetElement::cols();
-setter HTMLFrameSetElement::cols();
-
-getter HTMLFrameSetElement::rows();
-setter HTMLFrameSetElement::rows();
diff --git a/javascript/duktape/HTMLHRElement.bnd b/javascript/duktape/HTMLHRElement.bnd
deleted file mode 100644
index 421ec499b..000000000
--- a/javascript/duktape/HTMLHRElement.bnd
+++ /dev/null
@@ -1,24 +0,0 @@
-/* HTML hr element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLHRElement(struct dom_html_element *html_hr_element::html_element);
-
-getter HTMLHRElement::noShade();
-setter HTMLHRElement::noShade();
-
-getter HTMLHRElement::align();
-setter HTMLHRElement::align();
-
-getter HTMLHRElement::size();
-setter HTMLHRElement::size();
-
-getter HTMLHRElement::width();
-setter HTMLHRElement::width();
-
diff --git a/javascript/duktape/HTMLHTMLElement.bnd b/javascript/duktape/HTMLHTMLElement.bnd
deleted file mode 100644
index 01697d860..000000000
--- a/javascript/duktape/HTMLHTMLElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML html element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLHtmlElement(struct dom_html_element *html_html_element::html_element);
-
-getter HTMLHtmlElement::version();
-setter HTMLHtmlElement::version();
diff --git a/javascript/duktape/HTMLHeadingElement.bnd b/javascript/duktape/HTMLHeadingElement.bnd
deleted file mode 100644
index be51223c1..000000000
--- a/javascript/duktape/HTMLHeadingElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML heading element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLHeadingElement(struct dom_html_element *html_heading_element::html_element);
-
-getter HTMLHeadingElement::align();
-setter HTMLHeadingElement::align();
diff --git a/javascript/duktape/HTMLIFrameElement.bnd b/javascript/duktape/HTMLIFrameElement.bnd
deleted file mode 100644
index 64353769c..000000000
--- a/javascript/duktape/HTMLIFrameElement.bnd
+++ /dev/null
@@ -1,41 +0,0 @@
-/* HTML I frame element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLIFrameElement(struct dom_html_element *html_iframe_element::html_element);
-
-getter HTMLIFrameElement::align();
-setter HTMLIFrameElement::align();
-
-getter HTMLIFrameElement::frameBorder();
-setter HTMLIFrameElement::frameBorder();
-
-getter HTMLIFrameElement::height();
-setter HTMLIFrameElement::height();
-
-getter HTMLIFrameElement::longDesc();
-setter HTMLIFrameElement::longDesc();
-
-getter HTMLIFrameElement::marginHeight();
-setter HTMLIFrameElement::marginHeight();
-
-getter HTMLIFrameElement::marginWidth();
-setter HTMLIFrameElement::marginWidth();
-
-getter HTMLIFrameElement::name();
-setter HTMLIFrameElement::name();
-
-getter HTMLIFrameElement::scrolling();
-setter HTMLIFrameElement::scrolling();
-
-getter HTMLIFrameElement::src();
-setter HTMLIFrameElement::src();
-
-getter HTMLIFrameElement::width();
-setter HTMLIFrameElement::width();
diff --git a/javascript/duktape/HTMLImageElement.bnd b/javascript/duktape/HTMLImageElement.bnd
deleted file mode 100644
index 96b35b6f8..000000000
--- a/javascript/duktape/HTMLImageElement.bnd
+++ /dev/null
@@ -1,47 +0,0 @@
-/* HTML image element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLImageElement(struct dom_html_element *html_image_element::html_element);
-
-getter HTMLImageElement::align();
-setter HTMLImageElement::align();
-
-getter HTMLImageElement::alt();
-setter HTMLImageElement::alt();
-
-getter HTMLImageElement::border();
-setter HTMLImageElement::border();
-
-getter HTMLImageElement::isMap();
-setter HTMLImageElement::isMap();
-
-getter HTMLImageElement::longDesc();
-setter HTMLImageElement::longDesc();
-
-getter HTMLImageElement::name();
-setter HTMLImageElement::name();
-
-getter HTMLImageElement::src();
-setter HTMLImageElement::src();
-
-getter HTMLImageElement::useMap();
-setter HTMLImageElement::useMap();
-
-getter HTMLImageElement::height();
-setter HTMLImageElement::height();
-
-getter HTMLImageElement::hspace();
-setter HTMLImageElement::hspace();
-
-getter HTMLImageElement::vspace();
-setter HTMLImageElement::vspace();
-
-getter HTMLImageElement::width();
-setter HTMLImageElement::width();
diff --git a/javascript/duktape/HTMLInputElement.bnd b/javascript/duktape/HTMLInputElement.bnd
deleted file mode 100644
index 23645d0cd..000000000
--- a/javascript/duktape/HTMLInputElement.bnd
+++ /dev/null
@@ -1,64 +0,0 @@
-/* HTML input element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLInputElement(struct dom_html_element *html_input_element::html_element);
-
-getter HTMLInputElement::accept();
-setter HTMLInputElement::accept();
-
-getter HTMLInputElement::align();
-setter HTMLInputElement::align();
-
-getter HTMLInputElement::alt();
-setter HTMLInputElement::alt();
-
-getter HTMLInputElement::checked();
-setter HTMLInputElement::checked();
-
-getter HTMLInputElement::defaultChecked();
-setter HTMLInputElement::defaultChecked();
-
-getter HTMLInputElement::defaultValue();
-setter HTMLInputElement::defaultValue();
-
-getter HTMLInputElement::disabled();
-setter HTMLInputElement::disabled();
-
-getter HTMLInputElement::name();
-setter HTMLInputElement::name();
-
-getter HTMLInputElement::readOnly();
-setter HTMLInputElement::readOnly();
-
-getter HTMLInputElement::src();
-setter HTMLInputElement::src();
-
-getter HTMLInputElement::useMap();
-setter HTMLInputElement::useMap();
-
-getter HTMLInputElement::valueAsNumber();
-setter HTMLInputElement::valueAsNumber();
-
-getter HTMLInputElement::valueHigh();
-setter HTMLInputElement::valueHigh();
-
-getter HTMLInputElement::valueLow();
-setter HTMLInputElement::valueLow();
-
-getter HTMLInputElement::value();
-setter HTMLInputElement::value();
-
-getter HTMLInputElement::maxLength();
-setter HTMLInputElement::maxLength();
-
-getter HTMLInputElement::size();
-setter HTMLInputElement::size();
-
-getter HTMLInputElement::type();
diff --git a/javascript/duktape/HTMLLIElement.bnd b/javascript/duktape/HTMLLIElement.bnd
deleted file mode 100644
index a585693c0..000000000
--- a/javascript/duktape/HTMLLIElement.bnd
+++ /dev/null
@@ -1,17 +0,0 @@
-/* HTML li element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLLIElement(struct dom_html_element *html_li_element::html_element);
-
-getter HTMLLIElement::type();
-setter HTMLLIElement::type();
-
-getter HTMLLIElement::value();
-setter HTMLLIElement::value();
diff --git a/javascript/duktape/HTMLLabelElement.bnd b/javascript/duktape/HTMLLabelElement.bnd
deleted file mode 100644
index 018f798bd..000000000
--- a/javascript/duktape/HTMLLabelElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML label element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLLabelElement(struct dom_html_element *html_label_element::html_element);
-
-getter HTMLLabelElement::htmlFor();
-setter HTMLLabelElement::htmlFor();
diff --git a/javascript/duktape/HTMLLegendElement.bnd b/javascript/duktape/HTMLLegendElement.bnd
deleted file mode 100644
index 1bb95a94a..000000000
--- a/javascript/duktape/HTMLLegendElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML legend element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLLegendElement(struct dom_html_element *html_legend_element::html_element);
-
-getter HTMLLegendElement::align();
-setter HTMLLegendElement::align();
diff --git a/javascript/duktape/HTMLLinkElement.bnd b/javascript/duktape/HTMLLinkElement.bnd
deleted file mode 100644
index b215d76c0..000000000
--- a/javascript/duktape/HTMLLinkElement.bnd
+++ /dev/null
@@ -1,35 +0,0 @@
-/* HTML link element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLLinkElement(struct dom_html_element *html_link_element::html_element);
-
-getter HTMLLinkElement::charset();
-setter HTMLLinkElement::charset();
-
-getter HTMLLinkElement::hreflang();
-setter HTMLLinkElement::hreflang();
-
-getter HTMLLinkElement::href();
-setter HTMLLinkElement::href();
-
-getter HTMLLinkElement::media();
-setter HTMLLinkElement::media();
-
-getter HTMLLinkElement::rel();
-setter HTMLLinkElement::rel();
-
-getter HTMLLinkElement::rev();
-setter HTMLLinkElement::rev();
-
-getter HTMLLinkElement::target();
-setter HTMLLinkElement::target();
-
-getter HTMLLinkElement::type();
-setter HTMLLinkElement::type();
diff --git a/javascript/duktape/HTMLMapElement.bnd b/javascript/duktape/HTMLMapElement.bnd
deleted file mode 100644
index 0603f6f81..000000000
--- a/javascript/duktape/HTMLMapElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML map element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLMapElement(struct dom_html_element *html_map_element::html_element);
-
-getter HTMLMapElement::name();
-setter HTMLMapElement::name();
diff --git a/javascript/duktape/HTMLMarqueeElement.bnd b/javascript/duktape/HTMLMarqueeElement.bnd
deleted file mode 100644
index 16fbdc82c..000000000
--- a/javascript/duktape/HTMLMarqueeElement.bnd
+++ /dev/null
@@ -1,11 +0,0 @@
-/* HTML marquee element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLMarqueeElement(struct dom_html_element *html_marquee_element::html_element);
diff --git a/javascript/duktape/HTMLMenuElement.bnd b/javascript/duktape/HTMLMenuElement.bnd
deleted file mode 100644
index c7097b706..000000000
--- a/javascript/duktape/HTMLMenuElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML menu element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLMenuElement(struct dom_html_element *html_menu_element::html_element);
-
-getter HTMLMenuElement::compact();
-setter HTMLMenuElement::compact();
diff --git a/javascript/duktape/HTMLMetaElement.bnd b/javascript/duktape/HTMLMetaElement.bnd
deleted file mode 100644
index f9ecd4b07..000000000
--- a/javascript/duktape/HTMLMetaElement.bnd
+++ /dev/null
@@ -1,23 +0,0 @@
-/* HTML meta element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLMetaElement(struct dom_html_element *html_meta_element::html_element);
-
-getter HTMLMetaElement::content();
-setter HTMLMetaElement::content();
-
-getter HTMLMetaElement::httpEquiv();
-setter HTMLMetaElement::httpEquiv();
-
-getter HTMLMetaElement::name();
-setter HTMLMetaElement::name();
-
-getter HTMLMetaElement::scheme();
-setter HTMLMetaElement::scheme();
diff --git a/javascript/duktape/HTMLOListElement.bnd b/javascript/duktape/HTMLOListElement.bnd
deleted file mode 100644
index 8c12712a9..000000000
--- a/javascript/duktape/HTMLOListElement.bnd
+++ /dev/null
@@ -1,18 +0,0 @@
-/* HTML ol element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLOListElement(struct dom_html_element *html_o_list_element::html_element);
-
-getter HTMLOListElement::compact();
-setter HTMLOListElement::compact();
-getter HTMLOListElement::start();
-setter HTMLOListElement::start();
-getter HTMLOListElement::type();
-setter HTMLOListElement::type();
diff --git a/javascript/duktape/HTMLObjectElement.bnd b/javascript/duktape/HTMLObjectElement.bnd
deleted file mode 100644
index 2d07a7bb2..000000000
--- a/javascript/duktape/HTMLObjectElement.bnd
+++ /dev/null
@@ -1,54 +0,0 @@
-/* HTML object element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLObjectElement(struct dom_html_element *html_object_element::html_element);
-
-getter HTMLObjectElement::align();
-setter HTMLObjectElement::align();
-
-getter HTMLObjectElement::archive();
-setter HTMLObjectElement::archive();
-
-getter HTMLObjectElement::border();
-setter HTMLObjectElement::border();
-
-getter HTMLObjectElement::codeBase();
-setter HTMLObjectElement::codeBase();
-
-getter HTMLObjectElement::code();
-setter HTMLObjectElement::code();
-
-getter HTMLObjectElement::codeType();
-setter HTMLObjectElement::codeType();
-
-getter HTMLObjectElement::data();
-setter HTMLObjectElement::data();
-
-getter HTMLObjectElement::declare();
-setter HTMLObjectElement::declare();
-
-getter HTMLObjectElement::height();
-setter HTMLObjectElement::height();
-
-getter HTMLObjectElement::name();
-setter HTMLObjectElement::name();
-
-getter HTMLObjectElement::standby();
-setter HTMLObjectElement::standby();
-
-getter HTMLObjectElement::type();
-setter HTMLObjectElement::type();
-
-getter HTMLObjectElement::useMap();
-setter HTMLObjectElement::useMap();
-
-getter HTMLObjectElement::width();
-setter HTMLObjectElement::width();
-
diff --git a/javascript/duktape/HTMLOptionElement.bnd b/javascript/duktape/HTMLOptionElement.bnd
deleted file mode 100644
index d5094b7fa..000000000
--- a/javascript/duktape/HTMLOptionElement.bnd
+++ /dev/null
@@ -1,28 +0,0 @@
-/* HTML option element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLOptionElement(struct dom_html_element *html_option_element::html_element);
-
-getter HTMLOptionElement::defaultSelected();
-setter HTMLOptionElement::defaultSelected();
-
-getter HTMLOptionElement::disabled();
-setter HTMLOptionElement::disabled();
-
-getter HTMLOptionElement::label();
-setter HTMLOptionElement::label();
-
-getter HTMLOptionElement::selected();
-setter HTMLOptionElement::selected();
-
-getter HTMLOptionElement::text();
-
-getter HTMLOptionElement::value();
-setter HTMLOptionElement::value();
diff --git a/javascript/duktape/HTMLParagraphElement.bnd b/javascript/duktape/HTMLParagraphElement.bnd
deleted file mode 100644
index cc9ad83b5..000000000
--- a/javascript/duktape/HTMLParagraphElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML paragraph element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLParagraphElement(struct dom_html_element *html_paragraph_element::html_element);
-
-getter HTMLParagraphElement::align();
-setter HTMLParagraphElement::align();
diff --git a/javascript/duktape/HTMLParamElement.bnd b/javascript/duktape/HTMLParamElement.bnd
deleted file mode 100644
index 8fbe6fca6..000000000
--- a/javascript/duktape/HTMLParamElement.bnd
+++ /dev/null
@@ -1,23 +0,0 @@
-/* HTML param element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLParamElement(struct dom_html_element *html_param_element::html_element);
-
-getter HTMLParamElement::name();
-setter HTMLParamElement::name();
-
-getter HTMLParamElement::type();
-setter HTMLParamElement::type();
-
-getter HTMLParamElement::value();
-setter HTMLParamElement::value();
-
-getter HTMLParamElement::valueType();
-setter HTMLParamElement::valueType();
diff --git a/javascript/duktape/HTMLPreElement.bnd b/javascript/duktape/HTMLPreElement.bnd
deleted file mode 100644
index 06f6a76a9..000000000
--- a/javascript/duktape/HTMLPreElement.bnd
+++ /dev/null
@@ -1,15 +0,0 @@
-/* HTML li element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLPreElement(struct dom_html_element *html_pre_element::html_element);
-
-getter HTMLPreElement::width();
-setter HTMLPreElement::width();
-
diff --git a/javascript/duktape/HTMLQuoteElement.bnd b/javascript/duktape/HTMLQuoteElement.bnd
deleted file mode 100644
index 9e62f5d78..000000000
--- a/javascript/duktape/HTMLQuoteElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML quote element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLQuoteElement(struct dom_html_element *html_quote_element::html_element);
-
-getter HTMLQuoteElement::cite();
-setter HTMLQuoteElement::cite();
diff --git a/javascript/duktape/HTMLScriptElement.bnd b/javascript/duktape/HTMLScriptElement.bnd
deleted file mode 100644
index b3b22665a..000000000
--- a/javascript/duktape/HTMLScriptElement.bnd
+++ /dev/null
@@ -1,32 +0,0 @@
-/* HTML script element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLScriptElement(struct dom_html_element *html_script_element::html_element);
-
-getter HTMLScriptElement::charset();
-setter HTMLScriptElement::charset();
-
-getter HTMLScriptElement::defer();
-setter HTMLScriptElement::defer();
-
-getter HTMLScriptElement::event();
-setter HTMLScriptElement::event();
-
-getter HTMLScriptElement::htmlFor();
-setter HTMLScriptElement::htmlFor();
-
-getter HTMLScriptElement::src();
-setter HTMLScriptElement::src();
-
-getter HTMLScriptElement::text();
-setter HTMLScriptElement::text();
-
-getter HTMLScriptElement::type();
-setter HTMLScriptElement::type();
diff --git a/javascript/duktape/HTMLSelectElement.bnd b/javascript/duktape/HTMLSelectElement.bnd
deleted file mode 100644
index 36a5d1da4..000000000
--- a/javascript/duktape/HTMLSelectElement.bnd
+++ /dev/null
@@ -1,26 +0,0 @@
-/* HTML select element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLSelectElement(struct dom_html_element *html_select_element::html_element);
-
-getter HTMLSelectElement::disabled();
-setter HTMLSelectElement::disabled();
-
-getter HTMLSelectElement::multiple();
-setter HTMLSelectElement::multiple();
-
-getter HTMLSelectElement::name();
-setter HTMLSelectElement::name();
-
-getter HTMLSelectElement::type();
-
-getter HTMLSelectElement::value();
-setter HTMLSelectElement::value();
-
diff --git a/javascript/duktape/HTMLStyleElement.bnd b/javascript/duktape/HTMLStyleElement.bnd
deleted file mode 100644
index 45100876f..000000000
--- a/javascript/duktape/HTMLStyleElement.bnd
+++ /dev/null
@@ -1,17 +0,0 @@
-/* HTML style element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLStyleElement(struct dom_html_element *html_style_element::html_element);
-
-getter HTMLStyleElement::media();
-setter HTMLStyleElement::media();
-
-getter HTMLStyleElement::type();
-setter HTMLStyleElement::type();
diff --git a/javascript/duktape/HTMLTableCaptionElement.bnd b/javascript/duktape/HTMLTableCaptionElement.bnd
deleted file mode 100644
index 75754ccac..000000000
--- a/javascript/duktape/HTMLTableCaptionElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML table caption element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableCaptionElement(struct dom_html_element *html_table_caption_element::html_element);
-
-getter HTMLTableCaptionElement::align();
-setter HTMLTableCaptionElement::align();
diff --git a/javascript/duktape/HTMLTableCellElement.bnd b/javascript/duktape/HTMLTableCellElement.bnd
deleted file mode 100644
index 7040344c3..000000000
--- a/javascript/duktape/HTMLTableCellElement.bnd
+++ /dev/null
@@ -1,46 +0,0 @@
-/* HTML table cell element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableCellElement(struct dom_html_element *html_table_cell_element::html_element);
-
-getter HTMLTableCellElement::align();
-setter HTMLTableCellElement::align();
-
-getter HTMLTableCellElement::axis();
-setter HTMLTableCellElement::axis();
-
-getter HTMLTableCellElement::bgColor();
-setter HTMLTableCellElement::bgColor();
-
-getter HTMLTableCellElement::chOff();
-setter HTMLTableCellElement::chOff();
-
-getter HTMLTableCellElement::ch();
-setter HTMLTableCellElement::ch();
-
-getter HTMLTableCellElement::height();
-setter HTMLTableCellElement::height();
-
-getter HTMLTableCellElement::noWrap();
-setter HTMLTableCellElement::noWrap();
-
-getter HTMLTableCellElement::vAlign();
-setter HTMLTableCellElement::vAlign();
-
-getter HTMLTableCellElement::width();
-setter HTMLTableCellElement::width();
-
-getter HTMLTableCellElement::cellIndex();
-
-getter HTMLTableCellElement::colSpan();
-setter HTMLTableCellElement::colSpan();
-
-getter HTMLTableCellElement::rowSpan();
-setter HTMLTableCellElement::rowSpan();
diff --git a/javascript/duktape/HTMLTableColElement.bnd b/javascript/duktape/HTMLTableColElement.bnd
deleted file mode 100644
index ec7a954de..000000000
--- a/javascript/duktape/HTMLTableColElement.bnd
+++ /dev/null
@@ -1,26 +0,0 @@
-/* HTML table col element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableColElement(struct dom_html_element *html_table_col_element::html_element);
-
-getter HTMLTableColElement::align();
-setter HTMLTableColElement::align();
-
-getter HTMLTableColElement::chOff();
-setter HTMLTableColElement::chOff();
-
-getter HTMLTableColElement::ch();
-setter HTMLTableColElement::ch();
-
-getter HTMLTableColElement::vAlign();
-setter HTMLTableColElement::vAlign();
-
-getter HTMLTableColElement::width();
-setter HTMLTableColElement::width();
diff --git a/javascript/duktape/HTMLTableElement.bnd b/javascript/duktape/HTMLTableElement.bnd
deleted file mode 100644
index cd6d35769..000000000
--- a/javascript/duktape/HTMLTableElement.bnd
+++ /dev/null
@@ -1,38 +0,0 @@
-/* HTML table element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableElement(struct dom_html_element *html_table_element::html_element);
-
-getter HTMLTableElement::align();
-setter HTMLTableElement::align();
-
-getter HTMLTableElement::bgColor();
-setter HTMLTableElement::bgColor();
-
-getter HTMLTableElement::border();
-setter HTMLTableElement::border();
-
-getter HTMLTableElement::cellPadding();
-setter HTMLTableElement::cellPadding();
-
-getter HTMLTableElement::cellSpacing();
-setter HTMLTableElement::cellSpacing();
-
-getter HTMLTableElement::frame();
-setter HTMLTableElement::frame();
-
-getter HTMLTableElement::rules();
-setter HTMLTableElement::rules();
-
-getter HTMLTableElement::summary();
-setter HTMLTableElement::summary();
-
-getter HTMLTableElement::width();
-setter HTMLTableElement::width();
diff --git a/javascript/duktape/HTMLTableRowElement.bnd b/javascript/duktape/HTMLTableRowElement.bnd
deleted file mode 100644
index f736817b0..000000000
--- a/javascript/duktape/HTMLTableRowElement.bnd
+++ /dev/null
@@ -1,30 +0,0 @@
-/* HTML table row element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableRowElement(struct dom_html_element *html_table_row_element::html_element);
-
-getter HTMLTableRowElement::align();
-setter HTMLTableRowElement::align();
-
-getter HTMLTableRowElement::bgColor();
-setter HTMLTableRowElement::bgColor();
-
-getter HTMLTableRowElement::chOff();
-setter HTMLTableRowElement::chOff();
-
-getter HTMLTableRowElement::ch();
-setter HTMLTableRowElement::ch();
-
-getter HTMLTableRowElement::vAlign();
-setter HTMLTableRowElement::vAlign();
-
-getter HTMLTableRowElement::rowIndex();
-
-getter HTMLTableRowElement::sectionRowIndex();
diff --git a/javascript/duktape/HTMLTableSectionElement.bnd b/javascript/duktape/HTMLTableSectionElement.bnd
deleted file mode 100644
index 276533b3b..000000000
--- a/javascript/duktape/HTMLTableSectionElement.bnd
+++ /dev/null
@@ -1,23 +0,0 @@
-/* HTML table section element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTableSectionElement(struct dom_html_element *html_table_section_element::html_element);
-
-getter HTMLTableSectionElement::align();
-setter HTMLTableSectionElement::align();
-
-getter HTMLTableSectionElement::chOff();
-setter HTMLTableSectionElement::chOff();
-
-getter HTMLTableSectionElement::ch();
-setter HTMLTableSectionElement::ch();
-
-getter HTMLTableSectionElement::vAlign();
-setter HTMLTableSectionElement::vAlign();
diff --git a/javascript/duktape/HTMLTextAreaElement.bnd b/javascript/duktape/HTMLTextAreaElement.bnd
deleted file mode 100644
index a0fc1bf7b..000000000
--- a/javascript/duktape/HTMLTextAreaElement.bnd
+++ /dev/null
@@ -1,30 +0,0 @@
-/* HTML text area element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTextAreaElement(struct dom_html_element *html_text_area_element::html_element);
-
-getter HTMLTextAreaElement::defaultValue();
-setter HTMLTextAreaElement::defaultValue();
-
-getter HTMLTextAreaElement::disabled();
-setter HTMLTextAreaElement::disabled();
-
-getter HTMLTextAreaElement::name();
-setter HTMLTextAreaElement::name();
-
-getter HTMLTextAreaElement::readOnly();
-setter HTMLTextAreaElement::readOnly();
-
-getter HTMLTextAreaElement::type();
-
-getter HTMLTextAreaElement::value();
-setter HTMLTextAreaElement::value();
-
-
diff --git a/javascript/duktape/HTMLTitleElement.bnd b/javascript/duktape/HTMLTitleElement.bnd
deleted file mode 100644
index dee1c0749..000000000
--- a/javascript/duktape/HTMLTitleElement.bnd
+++ /dev/null
@@ -1,14 +0,0 @@
-/* HTML title element binding using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-init HTMLTitleElement(struct dom_html_element *html_title_element::html_element);
-
-getter HTMLTitleElement::text();
-setter HTMLTitleElement::text();
diff --git a/javascript/duktape/Location.bnd b/javascript/duktape/Location.bnd
deleted file mode 100644
index ca7e90509..000000000
--- a/javascript/duktape/Location.bnd
+++ /dev/null
@@ -1,353 +0,0 @@
-/* Location binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- * Copyright 2015 Daniel Silverstone <dsilvers@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Location {
- private nsurl *url;
-};
-
-prologue Location()
-%{
-#include "netsurf/browser_window.h"
-%}
-
-init Location(nsurl *url)
-%{
- priv->url = url;
- nsurl_ref(url);
-%}
-
-fini Location()
-%{
- nsurl_unref(priv->url);
-%}
-
-method Location::reload()
-%{
- /* retrieve the private data from the root object (window) */
- duk_push_global_object(ctx);
- duk_get_prop_string(ctx, -1, PRIVATE_MAGIC);
- window_private_t *priv_win = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- if (priv_win->win != NULL) {
- browser_window_reload(priv_win->win, false);
- } else {
- LOG("failed to get browser context");
- }
- return 0;
-%}
-
-method Location::assign()
-%{
- /* retrieve the private data from the root object (window) */
- duk_push_global_object(ctx);
- duk_get_prop_string(ctx, -1, PRIVATE_MAGIC);
- window_private_t *priv_win = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- if (priv_win == NULL || priv_win->win == NULL) {
- LOG("failed to get browser context");
- return 0;
- }
-
- nsurl *joined;
- duk_size_t slen;
- const char *url = duk_safe_to_lstring(ctx, 0, &slen);
-
- nsurl_join(priv->url, url, &joined);
- browser_window_navigate(priv_win->win,
- joined,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(joined);
- return 0;
-%}
-
-method Location::replace()
-%{
- /* retrieve the private data from the root object (window) */
- duk_push_global_object(ctx);
- duk_get_prop_string(ctx, -1, PRIVATE_MAGIC);
- window_private_t *priv_win = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- if (priv_win == NULL || priv_win->win == NULL) {
- LOG("failed to get browser context");
- return 0;
- }
-
- nsurl *joined;
- duk_size_t slen;
- const char *url = duk_safe_to_lstring(ctx, 0, &slen);
-
- nsurl_join(priv->url, url, &joined);
- browser_window_navigate(priv_win->win,
- joined,
- NULL,
- BW_NAVIGATE_NONE,
- NULL,
- NULL,
- NULL);
- nsurl_unref(joined);
- return 0;
-%}
-
-getter Location::href()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_COMPLETE, &url_s, &url_l);
- if (url_s == NULL) {
- return 0;
- }
-
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-setter Location::href()
-%{
- /* retrieve the private data from the root object (window) */
- duk_push_global_object(ctx);
- duk_get_prop_string(ctx, -1, PRIVATE_MAGIC);
- window_private_t *priv_win = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- if (priv_win == NULL || priv_win->win == NULL) {
- LOG("failed to get browser context");
- return 0;
- }
-
- nsurl *joined;
- duk_size_t slen;
- const char *url = duk_safe_to_lstring(ctx, 0, &slen);
-
- nsurl_join(priv->url, url, &joined);
- browser_window_navigate(priv_win->win,
- joined,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(joined);
- return 0;
-%}
-
-getter Location::origin()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_SCHEME | NSURL_HOST | NSURL_PORT, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-getter Location::protocol()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_SCHEME, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::username()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_USERNAME, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::password()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_PASSWORD, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::host()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_HOST, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::hostname()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_HOST, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-
-getter Location::port()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_PORT, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::pathname()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_PATH, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::search()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_QUERY, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
-getter Location::hash()
-%{
- char *url_s = NULL;
- size_t url_l;
-
- nsurl_get(priv->url, NSURL_FRAGMENT, &url_s, &url_l);
-
- /* if url_s is NULL duk_push_lstring pushes an empty string
- * which is correct for this API
- */
- duk_push_lstring(ctx, url_s, url_l);
-
- if (url_s != NULL) {
- free(url_s);
- }
-
- return 1;
-%}
-
-
diff --git a/javascript/duktape/Makefile b/javascript/duktape/Makefile
deleted file mode 100644
index 89353c340..000000000
--- a/javascript/duktape/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# NetSurf javascript source file inclusion
-#
-# Included by javascript/Makefile
-#
-
-javascript/dukky.c: $(OBJROOT)/duktape/binding.h
-
-BINDINGS := $(wildcard javascript/duktape/*.bnd)
-
-# ensure genbind generates debugging files
-GBFLAGS+=-D
-
-$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
- $(VQ)echo " GENBIND: $<"
- $(Q)nsgenbind $(GBFLAGS) -I javascript/WebIDL $< $(OBJROOT)/duktape
- $(VQ)echo " GENBIND: completed"
-
-# create unimplemented report for doxygen
-Docs/UnimplementedJavascript.txt: javascript/duktape/netsurf.bnd $(BINDINGS)
- $(Q)mkdir -p $(OBJROOT)/duktape
- $(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
- $(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
- $(VQ)echo "" >> $@
- $(VQ)echo " GENBIND: $<"
- $(Q)nsgenbind $(GBFLAGS) -Wunimplemented -I javascript/WebIDL $< $(OBJROOT)/duktape 2>&1 >/dev/null | grep "Unimplemented" | cut -d' ' -f4- | sort -k 2 | awk '{print $$0"\\n" }' >> $@
- $(VQ)echo "*/" >> $@
-
-ifeq ($(filter $(MAKECMDGOALS),clean test coverage),)
--include $(OBJROOT)/duktape/Makefile
-endif
-
-S_JAVASCRIPT_BINDING:=$(addprefix $(OBJROOT)/duktape/,$(NSGENBIND_SOURCES))
-
-$(S_JAVASCRIPT_BINDING): $(BINDINGS)
-
-S_JAVASCRIPT += content.c duktape/dukky.c duktape/duktape.c
-
-CFLAGS += -DDUK_OPT_HAVE_CUSTOM_H
diff --git a/javascript/duktape/Navigator.bnd b/javascript/duktape/Navigator.bnd
deleted file mode 100644
index b18ca8e83..000000000
--- a/javascript/duktape/Navigator.bnd
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Navigator binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-prologue Navigator()
-%{
-#include "utils/useragent.h"
-%}
-
-method Navigator::taintEnabled()
-%{
- duk_push_boolean(ctx, false);
- return 1;
-%}
-
-getter Navigator::appCodeName()
-%{
- duk_push_string(ctx, "Mozilla");
- return 1;
-%}
-
-getter Navigator::appName()
-%{
- duk_push_string(ctx, "Netscape");
- return 1;
-%}
-
-getter Navigator::appVersion()
-%{
- duk_push_string(ctx, "3.4");
- return 1;
-%}
-
-getter Navigator::platform()
-%{
- duk_push_string(ctx, NULL);
- return 1;
-%}
-
-getter Navigator::product()
-%{
- duk_push_string(ctx, "Gecko");
- return 1;
-%}
-
-getter Navigator::productSub()
-%{
- duk_push_string(ctx, "20100101");
- return 1;
-%}
-
-getter Navigator::vendor()
-%{
- duk_push_string(ctx, NULL);
- return 1;
-%}
-
-getter Navigator::vendorSub()
-%{
- duk_push_string(ctx, NULL);
- return 1;
-%}
-
-getter Navigator::cookieEnabled()
-%{
- duk_push_boolean(ctx, false);
- return 1;
-%}
-
-/* indicate there is no plugin for java installed */
-getter Navigator::javaEnabled()
-%{
- duk_push_boolean(ctx, false);
- return 1;
-%}
-
-getter Navigator::userAgent()
-%{
- duk_push_string(ctx, user_agent_string());
- return 1;
-%}
diff --git a/javascript/duktape/Node.bnd b/javascript/duktape/Node.bnd
deleted file mode 100644
index f237c876a..000000000
--- a/javascript/duktape/Node.bnd
+++ /dev/null
@@ -1,479 +0,0 @@
-/* Node binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Node {
- private dom_node *node;
-};
-
-init Node(struct dom_node *node)
-%{
- priv->node = node;
- dom_node_ref(node);
-%}
-
-fini Node()
-%{
- dom_node_unref(priv->node);
-%}
-
-getter Node::nodeType()
-%{
- dom_exception exc;
- dom_node_type ntype;
- exc = dom_node_get_node_type(priv->node, &ntype);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_uint(ctx, (duk_uint_t)ntype);
- return 1;
-%}
-
-getter Node::nodeName()
-%{
- dom_exception exc;
- dom_string *str = NULL;
- exc = dom_node_get_node_name(priv->node, &str);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_lstring(ctx, dom_string_data(str), dom_string_length(str));
- dom_string_unref(str);
- return 1;
-%}
-
-getter Node::baseURI()
-%{
- dom_exception exc;
- dom_string *base = NULL;
- exc = dom_node_get_base(priv->node, &base);
- if (exc != DOM_NO_ERR) return 0;
- assert(base != NULL);
- duk_push_lstring(ctx, dom_string_data(base), dom_string_length(base));
- dom_string_unref(base);
- return 1;
-%}
-
-getter Node::ownerDocument()
-%{
- dom_exception exc;
- dom_node *doc;
- exc = dom_node_get_owner_document(priv->node, &doc);
- if (exc != DOM_NO_ERR) return 0;
- if (doc == NULL) return 0;
- dukky_push_node(ctx, doc);
- dom_node_unref(doc);
- return 1;
-%}
-
-getter Node::parentNode()
-%{
- dom_exception exc;
- dom_node *pnode = NULL;
- exc = dom_node_get_parent_node(priv->node, &pnode);
- if (exc != DOM_NO_ERR) return 0;
- dukky_push_node(ctx, pnode);
- dom_node_unref(pnode);
- return 1;
-%}
-
-getter Node::parentElement()
-%{
- dom_exception exc;
- dom_node *pnode = NULL;
- dom_node_type ntype = DOM_NODE_TYPE_COUNT + 1;
- exc = dom_node_get_parent_node(priv->node, &pnode);
- if (exc != DOM_NO_ERR) return 0;
- if (pnode != NULL) {
- exc = dom_node_get_node_type(pnode, &ntype);
- if (exc != DOM_NO_ERR) { dom_node_unref(pnode); return 0; }
- }
- dukky_push_node(ctx, (ntype == DOM_ELEMENT_NODE) ? pnode : NULL);
- dom_node_unref(pnode);
- return 1;
-%}
-
-method Node::hasChildNodes()
-%{
- dom_exception exc;
- bool res;
- exc = dom_node_has_child_nodes(priv->node, &res);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_boolean(ctx, res);
- return 1;
-%}
-
-getter Node::childNodes()
-%{
- dom_exception exc;
- dom_nodelist *nlist = NULL;
- duk_set_top(ctx, 0);
- duk_push_this(ctx);
- duk_get_prop_string(ctx, 0, MAGIC(childNodes));
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
- exc = dom_node_get_child_nodes(priv->node, &nlist);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_pointer(ctx, nlist);
- if (dukky_create_object(ctx, PROTO_NAME(NODELIST), 1) != DUK_EXEC_SUCCESS) {
- dom_nodelist_unref(nlist);
- return 0;
- }
- dom_nodelist_unref(nlist);
- duk_dup(ctx, -1);
- duk_put_prop_string(ctx, 0, MAGIC(childNodes));
- }
- return 1;
-%}
-
-getter Node::firstChild()
-%{
- dom_exception exc;
- dom_node *n;
- exc = dom_node_get_first_child(priv->node, &n);
- if (exc != DOM_NO_ERR) return 0;
- if (dukky_push_node(ctx, n) == false) {
- dom_node_unref(n);
- return 0;
- }
- dom_node_unref(n);
- return 1;
-%}
-
-getter Node::lastChild()
-%{
- dom_exception exc;
- dom_node *n;
- exc = dom_node_get_last_child(priv->node, &n);
- if (exc != DOM_NO_ERR) return 0;
- if (dukky_push_node(ctx, n) == false) {
- dom_node_unref(n);
- return 0;
- }
- dom_node_unref(n);
- return 1;
-%}
-
-getter Node::previousSibling()
-%{
- dom_exception exc;
- dom_node *n;
- exc = dom_node_get_previous_sibling(priv->node, &n);
- if (exc != DOM_NO_ERR) return 0;
- if (dukky_push_node(ctx, n) == false) {
- dom_node_unref(n);
- return 0;
- }
- dom_node_unref(n);
- return 1;
-%}
-
-getter Node::nextSibling()
-%{
- dom_exception exc;
- dom_node *n;
- exc = dom_node_get_next_sibling(priv->node, &n);
- if (exc != DOM_NO_ERR) return 0;
- if (dukky_push_node(ctx, n) == false) {
- dom_node_unref(n);
- return 0;
- }
- dom_node_unref(n);
- return 1;
-%}
-
-getter Node::nodeValue()
-%{
- dom_exception exc;
- dom_string *content;
-
- exc = dom_node_get_node_value(priv->node, &content);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- if (content != NULL) {
- duk_push_lstring(ctx, dom_string_data(content), dom_string_length(content));
- dom_string_unref(content);
- return 1;
- }
- return 0;
-%}
-
-setter Node::nodeValue()
-%{
- dom_exception exc;
- dom_string *content;
- duk_size_t slen;
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
- exc = dom_string_create((const uint8_t *)s, slen, &content);
- if (exc != DOM_NO_ERR) return 0;
- exc = dom_node_set_node_value(priv->node, content);
- dom_string_unref(content);
- return 0;
-%}
-
-getter Node::textContent()
-%{
- dom_exception exc;
- dom_string *content;
-
- exc = dom_node_get_text_content(priv->node, &content);
- if (exc != DOM_NO_ERR) {
- return 0;
- }
-
- if (content != NULL) {
- duk_push_lstring(ctx, dom_string_data(content), dom_string_length(content));
- dom_string_unref(content);
- return 1;
- }
- return 0;
-%}
-
-setter Node::textContent()
-%{
- dom_exception exc;
- dom_string *content;
- duk_size_t slen;
- const char *s = duk_safe_to_lstring(ctx, 0, &slen);
- exc = dom_string_create((const uint8_t *)s, slen, &content);
- if (exc != DOM_NO_ERR) return 0;
- exc = dom_node_set_text_content(priv->node, content);
- dom_string_unref(content);
- return 0;
-%}
-
-method Node::normalize()
-%{
- dom_exception exc;
- exc = dom_node_normalize(priv->node);
- if (exc != DOM_NO_ERR) return 0;
- return 0;
-%}
-
-method Node::cloneNode()
-%{
- dom_exception exc;
- bool deep;
- dom_node *clone;
-
- deep = duk_to_boolean(ctx, 0);
-
- exc = dom_node_clone_node(priv->node, deep, &clone);
- if (exc != DOM_NO_ERR) return 0;
- duk_set_top(ctx, 0);
- dukky_push_node(ctx, clone);
- dom_node_unref(clone);
- return 1;
-%}
-
-method Node::isEqualNode()
-%{
- dom_exception exc;
- bool result;
-
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- exc = dom_node_is_equal(priv->node, other->node, &result);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_boolean(ctx, result);
- return 1;
-%}
-
-method Node::compareDocumentPosition()
-%{
- dom_exception exc;
- uint16_t ret;
-
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- exc = dom_node_compare_document_position(priv->node, other->node,
- &ret);
-
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_uint(ctx, ret);
-
- return 1;
-%}
-
-method Node::contains()
-%{
- dom_exception exc;
- uint16_t ret;
-
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- /* Note that inclusive descendant says *IS* or *CONTAINED_BY* */
- if (priv->node == other->node) {
- duk_push_boolean(ctx, true);
- return 1;
- }
-
- exc = dom_node_compare_document_position(priv->node, other->node,
- &ret);
-
- if (exc != DOM_NO_ERR) return 0;
-
- duk_push_boolean(ctx, ret == DOM_DOCUMENT_POSITION_CONTAINED_BY);
-
- return 1;
-%}
-
-method Node::lookupPrefix()
-%{
- dom_exception exc;
- dom_string *ns, *pfx;
- duk_size_t size;
- const char *s = duk_safe_to_lstring(ctx, 0, &size);
- exc = dom_string_create((const uint8_t *)s, size, &ns);
- if (exc != DOM_NO_ERR) return 0;
- exc = dom_node_lookup_prefix(priv->node, ns, &pfx);
- dom_string_unref(ns);
- if (exc != DOM_NO_ERR) return 0;
- if (pfx == NULL) return 0;
- duk_push_lstring(ctx, dom_string_data(pfx), dom_string_length(pfx));
- dom_string_unref(pfx);
- return 0;
-%}
-
-method Node::lookupNamespaceURI()
-%{
- dom_exception exc;
- dom_string *ns, *pfx;
- duk_size_t size;
- const char *s = duk_safe_to_lstring(ctx, 0, &size);
- exc = dom_string_create((const uint8_t *)s, size, &pfx);
- if (exc != DOM_NO_ERR) return 0;
- exc = dom_node_lookup_namespace(priv->node, pfx, &ns);
- dom_string_unref(pfx);
- if (exc != DOM_NO_ERR) return 0;
- if (ns == NULL) return 0;
- duk_push_lstring(ctx, dom_string_data(ns), dom_string_length(ns));
- dom_string_unref(ns);
- return 0;
-%}
-
-
-method Node::isDefaultNamespace()
-%{
- dom_exception exc;
- dom_string *ns;
- duk_size_t size;
- const char *s = duk_safe_to_lstring(ctx, 0, &size);
- bool ret;
- exc = dom_string_create((const uint8_t *)s, size, &ns);
- if (exc != DOM_NO_ERR) return 0;
- exc = dom_node_is_default_namespace(priv->node, ns, &ret);
- dom_string_unref(ns);
- if (exc != DOM_NO_ERR) return 0;
- duk_push_boolean(ctx, ret);
- return 1;
-%}
-
-method Node::insertBefore()
-%{
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- dom_node *before = NULL;
-
- if (duk_get_top(ctx) == 2) {
- if (!dukky_instanceof(ctx, 1, PROTO_NAME(NODE))) return 0;
- duk_get_prop_string(ctx, 1, PRIVATE_MAGIC);
- node_private_t *another = duk_get_pointer(ctx, -1);
- before = another->node;
- duk_pop(ctx);
- }
-
- dom_exception err;
- dom_node *spare;
-
- err = dom_node_insert_before(priv->node, other->node, before, &spare);
- if (err != DOM_NO_ERR) return 0;
- dukky_push_node(ctx, spare);
- dom_node_unref(spare);
-
- return 1;
-%}
-
-method Node::appendChild()
-%{
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- dom_exception err;
- dom_node *spare;
-
- err = dom_node_append_child(priv->node, other->node, &spare);
- if (err != DOM_NO_ERR) return 0;
- dukky_push_node(ctx, spare);
- dom_node_unref(spare);
-
- return 1;
-%}
-
-method Node::replaceChild()
-%{
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- if (!dukky_instanceof(ctx, 1, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 1, PRIVATE_MAGIC);
- node_private_t *old = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- dom_exception err;
- dom_node *spare;
-
- err = dom_node_replace_child(priv->node, other->node, old->node, &spare);
- if (err != DOM_NO_ERR) return 0;
- dukky_push_node(ctx, spare);
- dom_node_unref(spare);
-
- return 1;
-%}
-
-method Node::removeChild()
-%{
- if (!dukky_instanceof(ctx, 0, PROTO_NAME(NODE))) return 0;
-
- duk_get_prop_string(ctx, 0, PRIVATE_MAGIC);
- node_private_t *other = duk_get_pointer(ctx, -1);
- duk_pop(ctx);
-
- dom_exception err;
- dom_node *spare;
-
- err = dom_node_remove_child(priv->node, other->node, &spare);
- if (err != DOM_NO_ERR) return 0;
- dukky_push_node(ctx, spare);
- dom_node_unref(spare);
-
- return 1;
-%}
diff --git a/javascript/duktape/NodeList.bnd b/javascript/duktape/NodeList.bnd
deleted file mode 100644
index 7ddf56d15..000000000
--- a/javascript/duktape/NodeList.bnd
+++ /dev/null
@@ -1,54 +0,0 @@
-/* NodeList binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class NodeList {
- private struct dom_nodelist *nodes;
-};
-
-init NodeList(struct dom_nodelist *nodes)
-%{
- priv->nodes = nodes;
- dom_nodelist_ref(nodes);
-%}
-
-fini NodeList()
-%{
- dom_nodelist_unref(priv->nodes);
-%}
-
-getter NodeList::length()
-%{
- dom_exception err;
- uint32_t len;
-
- err = dom_nodelist_get_length(priv->nodes, &len);
-
- if (err != DOM_NO_ERR) return 0; /* coerced to undefined */
-
- duk_push_uint(ctx, (duk_uint_t)len);
-
- return 1;
-%}
-
-method NodeList::item()
-%{
- unsigned long i = duk_to_uint(ctx, 0);
- dom_exception err;
- dom_node *node;
-
- err = dom_nodelist_item(priv->nodes, i, &node);
-
- if (err != DOM_NO_ERR) return 0; /* coerced to undefied */
-
- dukky_push_node(ctx, node);
- dom_node_unref(node);
-
- return 1;
-%}
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd
deleted file mode 100644
index 489587899..000000000
--- a/javascript/duktape/Window.bnd
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Window binding for browser using duktape and libdom
- *
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * Released under the terms of the MIT License,
- * http://www.opensource.org/licenses/mit-license
- */
-
-class Window {
- private struct browser_window * win;
- private struct html_content * htmlc;
- prologue %{
-#include "utils/nsurl.h"
-#include "netsurf/browser_window.h"
-#include "content/hlcache.h"
-#include "render/html.h"
-#include "render/html_internal.h"
-%};
-};
-
-init Window(struct browser_window *win, struct html_content *htmlc)
-%{
- /* element window */
- priv->win = win;
- priv->htmlc = htmlc;
- LOG("win=%p htmlc=%p", priv->win, priv->htmlc);
-
- LOG("URL is %s", nsurl_access(browser_window_get_url(priv->win)));
-%}
-
-prototype Window()
-%{
-#define EXPOSE(v) \
- duk_get_global_string(ctx, #v); \
- duk_put_prop_string(ctx, 0, #v)
- /* steal undefined */
- EXPOSE(undefined);
- EXPOSE(eval);
- EXPOSE(Object);
- EXPOSE(parseInt);
- EXPOSE(parseFloat);
- EXPOSE(Array);
- EXPOSE(Date);
- EXPOSE(RegExp);
- EXPOSE(Math);
- EXPOSE(Function);
- EXPOSE(Proxy);
- EXPOSE(String);
-#undef EXPOSE
-%}
-
-getter Window::document()
-%{
- JS_LOG("priv=%p", priv);
- dom_document *doc = priv->htmlc->document;
- dukky_push_node(ctx, (struct dom_node *)doc);
- return 1;
-%}
-
-getter Window::window()
-%{
- duk_push_this(ctx);
- return 1;
-%}
-
-getter Window::console()
-%{
- duk_push_this(ctx);
- duk_get_prop_string(ctx, -1, MAGIC(Console));
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
- if (dukky_create_object(ctx, PROTO_NAME(CONSOLE), 0) != DUK_EXEC_SUCCESS) {
- duk_error(ctx, DUK_ERR_ERROR, "Unable to create console object");
- return 0;
- }
- duk_dup(ctx, -1);
- duk_put_prop_string(ctx, -3, MAGIC(Console));
- }
- return 1;
-%}
-
-getter Window::location()
-%{
- duk_push_this(ctx);
- duk_get_prop_string(ctx, -1, MAGIC(Location));
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
-
- duk_push_pointer(ctx, llcache_handle_get_url(priv->htmlc->base.llcache));
-
- if (dukky_create_object(ctx, PROTO_NAME(LOCATION), 1) != DUK_EXEC_SUCCESS) {
- duk_error(ctx, DUK_ERR_ERROR, "Unable to create location object");
- return 0;
- }
- duk_dup(ctx, -1);
- duk_put_prop_string(ctx, -3, MAGIC(Location));
- }
- return 1;
-%}
-
-getter Window::navigator()
-%{
- duk_push_this(ctx);
- duk_get_prop_string(ctx, -1, MAGIC(Navigator));
- if (duk_is_undefined(ctx, -1)) {
- duk_pop(ctx);
-
- if (dukky_create_object(ctx,
- PROTO_NAME(NAVIGATOR),
- 0) != DUK_EXEC_SUCCESS) {
- duk_error(ctx,
- DUK_ERR_ERROR,
- "Unable to create navigator object");
- return 0;
- }
- duk_dup(ctx, -1);
- duk_put_prop_string(ctx, -3, MAGIC(Navigator));
- }
- return 1;
-%}
-
-getter Window::name()
-%{
- const char *name;
- browser_window_get_name(priv->win, &name);
- duk_push_string(ctx, name);
- return 1;
-%}
-
-setter Window::name()
-%{
- const char *name;
- name = duk_to_string(ctx, -1);
- browser_window_set_name(priv->win, name);
- return 0;
-%}
-
-method Window::alert()
-%{
- duk_size_t msg_len;
- const char *msg = duk_safe_to_lstring(ctx, 0, &msg_len);
- LOG("JS ALERT: %*s", (int)msg_len, msg);
- return 0;
-%}
diff --git a/javascript/duktape/duk_config.h b/javascript/duktape/duk_config.h
deleted file mode 100644
index a3da70a3f..000000000
--- a/javascript/duktape/duk_config.h
+++ /dev/null
@@ -1,3753 +0,0 @@
-/*
- * duk_config.h configuration header generated by genconfig.py.
- *
- * Git commit: 83d557704ee63f68ab40b6fcb00995c9b3d6777c
- * Git describe: v1.5.0
- * Git branch: master
- *
- * Supported platforms:
- * - Mac OSX, iPhone, Darwin
- * - OpenBSD
- * - Generic BSD
- * - Atari ST TOS
- * - AmigaOS
- * - Windows
- * - Flashplayer (Crossbridge)
- * - QNX
- * - TI-Nspire
- * - Emscripten
- * - Linux
- * - Solaris
- * - Generic POSIX
- * - Cygwin
- * - Generic UNIX
- * - Generic fallback
- *
- * Supported architectures:
- * - x86
- * - x64
- * - x32
- * - ARM 32-bit
- * - ARM 64-bit
- * - MIPS 32-bit
- * - MIPS 64-bit
- * - PowerPC 32-bit
- * - PowerPC 64-bit
- * - SPARC 32-bit
- * - SPARC 64-bit
- * - SuperH
- * - Motorola 68k
- * - Emscripten
- * - Generic
- *
- * Supported compilers:
- * - Clang
- * - GCC
- * - MSVC
- * - Emscripten
- * - TinyC
- * - VBCC
- * - Bruce's C compiler
- * - Generic
- *
- */
-
-#if !defined(DUK_CONFIG_H_INCLUDED)
-#define DUK_CONFIG_H_INCLUDED
-
-/*
- * Intermediate helper defines
- */
-
-/* DLL build detection */
-#if defined(DUK_OPT_DLL_BUILD)
-#define DUK_F_DLL_BUILD
-#elif defined(DUK_OPT_NO_DLL_BUILD)
-#undef DUK_F_DLL_BUILD
-#else
-/* not configured for DLL build */
-#undef DUK_F_DLL_BUILD
-#endif
-
-/* Apple OSX, iOS */
-#if defined(__APPLE__)
-#define DUK_F_APPLE
-#endif
-
-/* OpenBSD */
-#if defined(__OpenBSD__) || defined(__OpenBSD)
-#define DUK_F_OPENBSD
-#endif
-
-/* NetBSD */
-#if defined(__NetBSD__) || defined(__NetBSD)
-#define DUK_F_NETBSD
-#endif
-
-/* FreeBSD */
-#if defined(__FreeBSD__) || defined(__FreeBSD)
-#define DUK_F_FREEBSD
-#endif
-
-/* BSD variant */
-#if defined(DUK_F_FREEBSD) || defined(DUK_F_NETBSD) || defined(DUK_F_OPENBSD) || \
- defined(__bsdi__) || defined(__DragonFly__)
-#define DUK_F_BSD
-#endif
-
-/* Atari ST TOS. __TOS__ defined by PureC. No platform define in VBCC
- * apparently, so to use with VBCC user must define __TOS__ manually.
- */
-#if defined(__TOS__)
-#define DUK_F_TOS
-#endif
-
-/* Motorola 68K. Not defined by VBCC, so user must define one of these
- * manually when using VBCC.
- */
-#if defined(__m68k__) || defined(M68000) || defined(__MC68K__)
-#define DUK_F_M68K
-#endif
-
-/* AmigaOS. Neither AMIGA nor __amigaos__ is defined on VBCC, so user must
- * define 'AMIGA' manually when using VBCC.
- */
-#if defined(AMIGA) || defined(__amigaos__)
-#define DUK_F_AMIGAOS
-#endif
-
-/* PowerPC */
-#if defined(__powerpc) || defined(__powerpc__) || defined(__PPC__)
-#define DUK_F_PPC
-#if defined(__PPC64__) || defined(__LP64__) || defined(_LP64)
-#define DUK_F_PPC64
-#else
-#define DUK_F_PPC32
-#endif
-#endif
-
-/* Windows, both 32-bit and 64-bit */
-#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || \
- defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
-#define DUK_F_WINDOWS
-#if defined(_WIN64) || defined(WIN64)
-#define DUK_F_WIN64
-#else
-#define DUK_F_WIN32
-#endif
-#endif
-
-/* Flash player (e.g. Crossbridge) */
-#if defined(__FLASHPLAYER__)
-#define DUK_F_FLASHPLAYER
-#endif
-
-/* QNX */
-#if defined(__QNX__)
-#define DUK_F_QNX
-#endif
-
-/* TI-Nspire (using Ndless) */
-#if defined(_TINSPIRE)
-#define DUK_F_TINSPIRE
-#endif
-
-/* Emscripten (provided explicitly by user), improve if possible */
-#if defined(EMSCRIPTEN)
-#define DUK_F_EMSCRIPTEN
-#endif
-
-/* BCC (Bruce's C compiler): this is a "torture target" for compilation */
-#if defined(__BCC__) || defined(__BCC_VERSION__)
-#define DUK_F_BCC
-#endif
-
-/* Linux */
-#if defined(__linux) || defined(__linux__) || defined(linux)
-#define DUK_F_LINUX
-#endif
-
-/* illumos / Solaris */
-#if defined(__sun) && defined(__SVR4)
-#define DUK_F_SUN
-#endif
-
-/* POSIX */
-#if defined(__posix)
-#define DUK_F_POSIX
-#endif
-
-/* Cygwin */
-#if defined(__CYGWIN__)
-#define DUK_F_CYGWIN
-#endif
-
-/* Generic Unix (includes Cygwin) */
-#if defined(__unix) || defined(__unix__) || defined(unix) || \
- defined(DUK_F_LINUX) || defined(DUK_F_BSD)
-#define DUK_F_UNIX
-#endif
-
-/* stdint.h not available */
-#if defined(DUK_F_WINDOWS) && defined(_MSC_VER)
-#if (_MSC_VER < 1700)
-/* VS2012+ has stdint.h, < VS2012 does not (but it's available for download). */
-#define DUK_F_NO_STDINT_H
-#endif
-#endif
-#if !defined(DUK_F_NO_STDINT_H) && (defined(DUK_F_TOS) || defined(DUK_F_BCC))
-#define DUK_F_NO_STDINT_H
-#endif
-
-/* C++ */
-#undef DUK_F_CPP
-#if defined(__cplusplus)
-#define DUK_F_CPP
-#endif
-
-/* Intel x86 (32-bit), x64 (64-bit) or x32 (64-bit but 32-bit pointers),
- * define only one of DUK_F_X86, DUK_F_X64, DUK_F_X32.
- * https://sites.google.com/site/x32abi/
- */
-#if defined(__amd64__) || defined(__amd64) || \
- defined(__x86_64__) || defined(__x86_64) || \
- defined(_M_X64) || defined(_M_AMD64)
-#if defined(__ILP32__) || defined(_ILP32)
-#define DUK_F_X32
-#else
-#define DUK_F_X64
-#endif
-#elif defined(i386) || defined(__i386) || defined(__i386__) || \
- defined(__i486__) || defined(__i586__) || defined(__i686__) || \
- defined(__IA32__) || defined(_M_IX86) || defined(__X86__) || \
- defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
-#if defined(__LP64__) || defined(_LP64)
-/* This should not really happen, but would indicate x64. */
-#define DUK_F_X64
-#else
-#define DUK_F_X86
-#endif
-#endif
-
-/* ARM */
-#if defined(__arm__) || defined(__thumb__) || defined(_ARM) || defined(_M_ARM)
-#define DUK_F_ARM
-#if defined(__LP64__) || defined(_LP64) || defined(__arm64) || defined(__arm64__)
-#define DUK_F_ARM64
-#else
-#define DUK_F_ARM32
-#endif
-#endif
-
-/* MIPS. Related defines: __MIPSEB__, __MIPSEL__, __mips_isa_rev, __LP64__ */
-#if defined(__mips__) || defined(mips) || defined(_MIPS_ISA) || \
- defined(_R3000) || defined(_R4000) || defined(_R5900) || \
- defined(_MIPS_ISA_MIPS1) || defined(_MIPS_ISA_MIPS2) || \
- defined(_MIPS_ISA_MIPS3) || defined(_MIPS_ISA_MIPS4) || \
- defined(__mips) || defined(__MIPS__)
-#define DUK_F_MIPS
-#if defined(__LP64__) || defined(_LP64) || defined(__mips64) || \
- defined(__mips64__) || defined(__mips_n64)
-#define DUK_F_MIPS64
-#else
-#define DUK_F_MIPS32
-#endif
-#endif
-
-/* SPARC */
-#if defined(sparc) || defined(__sparc) || defined(__sparc__)
-#define DUK_F_SPARC
-#if defined(__LP64__) || defined(_LP64)
-#define DUK_F_SPARC64
-#else
-#define DUK_F_SPARC32
-#endif
-#endif
-
-/* SuperH */
-#if defined(__sh__) || \
- defined(__sh1__) || defined(__SH1__) || \
- defined(__sh2__) || defined(__SH2__) || \
- defined(__sh3__) || defined(__SH3__) || \
- defined(__sh4__) || defined(__SH4__) || \
- defined(__sh5__) || defined(__SH5__)
-#define DUK_F_SUPERH
-#endif
-
-/* Clang */
-#if defined(__clang__)
-#define DUK_F_CLANG
-#endif
-
-/* C99 or above */
-#undef DUK_F_C99
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
-#define DUK_F_C99
-#endif
-
-/* C++11 or above */
-#undef DUK_F_CPP11
-#if defined(__cplusplus) && (__cplusplus >= 201103L)
-#define DUK_F_CPP11
-#endif
-
-/* GCC. Clang also defines __GNUC__ so don't detect GCC if using Clang. */
-#if defined(__GNUC__) && !defined(__clang__) && !defined(DUK_F_CLANG)
-#define DUK_F_GCC
-#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
-/* Convenience, e.g. gcc 4.5.1 == 40501; http://stackoverflow.com/questions/6031819/emulating-gccs-builtin-unreachable */
-#define DUK_F_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)
-#else
-#error cannot figure out gcc version
-#endif
-#endif
-
-/* MinGW. Also GCC flags (DUK_F_GCC) are enabled now. */
-#if defined(__MINGW32__) || defined(__MINGW64__)
-#define DUK_F_MINGW
-#endif
-
-/* MSVC */
-#if defined(_MSC_VER)
-/* MSVC preprocessor defines: http://msdn.microsoft.com/en-us/library/b0084kay.aspx
- * _MSC_FULL_VER includes the build number, but it has at least two formats, see e.g.
- * BOOST_MSVC_FULL_VER in http://www.boost.org/doc/libs/1_52_0/boost/config/compiler/visualc.hpp
- */
-#define DUK_F_MSVC
-#if defined(_MSC_FULL_VER)
-#if (_MSC_FULL_VER > 100000000)
-#define DUK_F_MSVC_FULL_VER _MSC_FULL_VER
-#else
-#define DUK_F_MSCV_FULL_VER (_MSC_FULL_VER * 10)
-#endif
-#endif
-#endif /* _MSC_VER */
-
-/* TinyC */
-#if defined(__TINYC__)
-/* http://bellard.org/tcc/tcc-doc.html#SEC9 */
-#define DUK_F_TINYC
-#endif
-
-/* VBCC */
-#if defined(__VBCC__)
-#define DUK_F_VBCC
-#endif
-
-/* Atari Mint */
-#if defined(__MINT__)
-#define DUK_F_MINT
-#endif
-
-/*
- * Platform autodetection
- */
-
-/* Workaround for older C++ compilers before including <inttypes.h>,
- * see e.g.: https://sourceware.org/bugzilla/show_bug.cgi?id=15366
- */
-#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
-#define __STDC_LIMIT_MACROS
-#endif
-#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
-#define __STDC_CONSTANT_MACROS
-#endif
-
-#if defined(DUK_F_APPLE)
-/* --- Mac OSX, iPhone, Darwin --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <TargetConditionals.h>
-#include <architecture/byte_order.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-/* http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor */
-#if TARGET_IPHONE_SIMULATOR
-#define DUK_USE_OS_STRING "iphone-sim"
-#elif TARGET_OS_IPHONE
-#define DUK_USE_OS_STRING "iphone"
-#elif TARGET_OS_MAC
-#define DUK_USE_OS_STRING "osx"
-#else
-#define DUK_USE_OS_STRING "osx-unknown"
-#endif
-
-/* Use _setjmp() on Apple by default, see GH-55. */
-#define DUK_JMPBUF_TYPE jmp_buf
-#define DUK_SETJMP(jb) _setjmp((jb))
-#define DUK_LONGJMP(jb) _longjmp((jb), 1)
-#elif defined(DUK_F_OPENBSD)
-/* --- OpenBSD --- */
-/* http://www.monkey.org/openbsd/archive/ports/0401/msg00089.html */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <sys/endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "openbsd"
-#elif defined(DUK_F_BSD)
-/* --- Generic BSD --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <sys/endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "bsd"
-#elif defined(DUK_F_TOS)
-/* --- Atari ST TOS --- */
-#define DUK_USE_DATE_NOW_TIME
-#define DUK_USE_DATE_TZO_GMTIME
-/* no parsing (not an error) */
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <time.h>
-
-#define DUK_USE_OS_STRING "tos"
-
-/* TOS on M68K is always big endian. */
-#if !defined(DUK_USE_BYTEORDER) && defined(DUK_F_M68K)
-#define DUK_USE_BYTEORDER 3
-#endif
-#elif defined(DUK_F_AMIGAOS)
-/* --- AmigaOS --- */
-#if defined(DUK_F_M68K)
-/* AmigaOS on M68k */
-#define DUK_USE_DATE_NOW_TIME
-#define DUK_USE_DATE_TZO_GMTIME
-/* no parsing (not an error) */
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <time.h>
-#elif defined(DUK_F_PPC)
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <time.h>
-#ifndef UINTPTR_MAX
-#define UINTPTR_MAX UINT_MAX
-#endif
-#else
-#error AmigaOS but not M68K/PPC, not supported now
-#endif
-
-#define DUK_USE_OS_STRING "amigaos"
-
-/* AmigaOS on M68K or PPC is always big endian. */
-#if !defined(DUK_USE_BYTEORDER) && (defined(DUK_F_M68K) || defined(DUK_F_PPC))
-#define DUK_USE_BYTEORDER 3
-#endif
-#elif defined(DUK_F_WINDOWS)
-/* --- Windows --- */
-/* Initial fix: disable secure CRT related warnings when compiling Duktape
- * itself (must be defined before including Windows headers). Don't define
- * for user code including duktape.h.
- */
-#if defined(DUK_COMPILING_DUKTAPE) && !defined(_CRT_SECURE_NO_WARNINGS)
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
-/* Windows 32-bit and 64-bit are currently the same. */
-/* MSVC does not have sys/param.h */
-#define DUK_USE_DATE_NOW_WINDOWS
-#define DUK_USE_DATE_TZO_WINDOWS
-/* Note: PRS and FMT are intentionally left undefined for now. This means
- * there is no platform specific date parsing/formatting but there is still
- * the ISO 8601 standard format.
- */
-#if defined(DUK_COMPILING_DUKTAPE)
-/* Only include when compiling Duktape to avoid polluting application build
- * with a lot of unnecessary defines.
- */
-#include <windows.h>
-#endif
-
-#define DUK_USE_OS_STRING "windows"
-
-/* On Windows, assume we're little endian. Even Itanium which has a
- * configurable endianness runs little endian in Windows.
- */
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-#elif defined(DUK_F_FLASHPLAYER)
-/* --- Flashplayer (Crossbridge) --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "flashplayer"
-
-#if !defined(DUK_USE_BYTEORDER) && defined(DUK_F_FLASHPLAYER)
-#define DUK_USE_BYTEORDER 1
-#endif
-#elif defined(DUK_F_QNX)
-/* --- QNX --- */
-#if defined(DUK_F_QNX) && defined(DUK_COMPILING_DUKTAPE)
-/* See: /opt/qnx650/target/qnx6/usr/include/sys/platform.h */
-#define _XOPEN_SOURCE 600
-#define _POSIX_C_SOURCE 200112L
-#endif
-
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "qnx"
-#elif defined(DUK_F_TINSPIRE)
-/* --- TI-Nspire --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "tinspire"
-#elif defined(DUK_F_EMSCRIPTEN)
-/* --- Emscripten --- */
-#if defined(DUK_COMPILING_DUKTAPE)
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200809L
-#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* e.g. getdate_r */
-#endif
-#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE /* e.g. strptime */
-#endif
-#endif /* DUK_COMPILING_DUKTAPE */
-
-#include <sys/types.h>
-#if defined(DUK_F_BCC)
-/* no endian.h */
-#else
-#include <endian.h>
-#endif /* DUK_F_BCC */
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-#include <stdint.h>
-
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-
-#define DUK_USE_OS_STRING "emscripten"
-#elif defined(DUK_F_LINUX)
-/* --- Linux --- */
-#if defined(DUK_COMPILING_DUKTAPE)
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200809L
-#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE /* e.g. getdate_r */
-#endif
-#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE /* e.g. strptime */
-#endif
-#endif /* DUK_COMPILING_DUKTAPE */
-
-#include <sys/types.h>
-#if defined(DUK_F_BCC)
-/* no endian.h or stdint.h */
-#else
-#include <endian.h>
-#include <stdint.h>
-#endif /* DUK_F_BCC */
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-
-#define DUK_USE_OS_STRING "linux"
-#elif defined(DUK_F_SUN)
-/* --- Solaris --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-
-#include <sys/types.h>
-#include <ast/endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "solaris"
-#elif defined(DUK_F_POSIX)
-/* --- Generic POSIX --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_USE_OS_STRING "posix"
-#elif defined(DUK_F_CYGWIN)
-/* --- Cygwin --- */
-/* don't use strptime() for now */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <sys/types.h>
-#include <endian.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define DUK_JMPBUF_TYPE jmp_buf
-#define DUK_SETJMP(jb) _setjmp((jb))
-#define DUK_LONGJMP(jb) _longjmp((jb), 1)
-
-#define DUK_USE_OS_STRING "windows"
-#elif defined(DUK_F_UNIX)
-/* --- Generic UNIX --- */
-#define DUK_USE_DATE_NOW_GETTIMEOFDAY
-#define DUK_USE_DATE_TZO_GMTIME_R
-#define DUK_USE_DATE_PRS_STRPTIME
-#define DUK_USE_DATE_FMT_STRFTIME
-#include <time.h>
-#include <sys/time.h>
-#define DUK_USE_OS_STRING "unknown"
-#else
-/* --- Generic fallback --- */
-/* The most portable current time provider is time(), but it only has a
- * one second resolution.
- */
-#define DUK_USE_DATE_NOW_TIME
-
-/* The most portable way to figure out local time offset is gmtime(),
- * but it's not thread safe so use with caution.
- */
-#define DUK_USE_DATE_TZO_GMTIME
-
-/* Avoid custom date parsing and formatting for portability. */
-#undef DUK_USE_DATE_PRS_STRPTIME
-#undef DUK_USE_DATE_FMT_STRFTIME
-
-/* Rely on C89 headers only; time.h must be here. */
-#include <time.h>
-
-#define DUK_USE_OS_STRING "unknown"
-#endif /* autodetect platform */
-
-/* Shared includes: C89 */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h> /* varargs */
-#include <setjmp.h>
-#include <stddef.h> /* e.g. ptrdiff_t */
-#include <math.h>
-#include <limits.h>
-
-/* date.h is omitted, and included per platform */
-
-/* Shared includes: stdint.h is C99 */
-#if defined(DUK_F_NO_STDINT_H)
-/* stdint.h not available */
-#else
-/* Technically C99 (C++11) but found in many systems. On some systems
- * __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS must be defined before
- * including stdint.h (see above).
- */
-#include <stdint.h>
-#endif
-
-#if defined(DUK_F_CPP)
-#include <exception> /* std::exception */
-#endif
-
-/*
- * Architecture autodetection
- */
-
-#if defined(DUK_F_X86)
-/* --- x86 --- */
-#define DUK_USE_ARCH_STRING "x86"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_X64)
-/* --- x64 --- */
-#define DUK_USE_ARCH_STRING "x64"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_X32)
-/* --- x32 --- */
-#define DUK_USE_ARCH_STRING "x32"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-/* XXX: This is technically not guaranteed because it's possible to configure
- * an x86 to require aligned accesses with Alignment Check (AC) flag.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 1
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_ARM32)
-/* --- ARM 32-bit --- */
-#define DUK_USE_ARCH_STRING "arm32"
-/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_ARM64)
-/* --- ARM 64-bit --- */
-#define DUK_USE_ARCH_STRING "arm64"
-/* Byte order varies, so rely on autodetect. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_MIPS32)
-/* --- MIPS 32-bit --- */
-#define DUK_USE_ARCH_STRING "mips32"
-/* MIPS byte order varies so rely on autodetection. */
-/* Based on 'make checkalign' there are no alignment requirements on
- * Linux MIPS except for doubles, which need align by 4. Alignment
- * requirements vary based on target though.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_MIPS64)
-/* --- MIPS 64-bit --- */
-#define DUK_USE_ARCH_STRING "mips64"
-/* MIPS byte order varies so rely on autodetection. */
-/* Good default is a bit arbitrary because alignment requirements
- * depend on target. See https://github.com/svaarala/duktape/issues/102.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_PPC32)
-/* --- PowerPC 32-bit --- */
-#define DUK_USE_ARCH_STRING "ppc32"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 3
-#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_PPC64)
-/* --- PowerPC 64-bit --- */
-#define DUK_USE_ARCH_STRING "ppc64"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 3
-#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_SPARC32)
-/* --- SPARC 32-bit --- */
-#define DUK_USE_ARCH_STRING "sparc32"
-/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_SPARC64)
-/* --- SPARC 64-bit --- */
-#define DUK_USE_ARCH_STRING "sparc64"
-/* SPARC byte order varies so rely on autodetection. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_SUPERH)
-/* --- SuperH --- */
-#define DUK_USE_ARCH_STRING "sh"
-/* Byte order varies, rely on autodetection. */
-/* Based on 'make checkalign' there are no alignment requirements on
- * Linux SH4, but align by 4 is probably a good basic default.
- */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 4
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_M68K)
-/* --- Motorola 68k --- */
-#define DUK_USE_ARCH_STRING "m68k"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 3
-#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#define DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#elif defined(DUK_F_EMSCRIPTEN)
-/* --- Emscripten --- */
-#define DUK_USE_ARCH_STRING "emscripten"
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-#undef DUK_USE_PACKED_TVAL
-#define DUK_F_PACKED_TVAL_PROVIDED
-#else
-/* --- Generic --- */
-/* These are necessary wild guesses. */
-#define DUK_USE_ARCH_STRING "generic"
-/* Rely on autodetection for byte order, alignment, and packed tval. */
-#endif /* autodetect architecture */
-
-/*
- * Compiler autodetection
- */
-
-#if defined(DUK_F_CLANG)
-/* --- Clang --- */
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-/* C99 / C++11 and above: rely on va_copy() which is required. */
-#define DUK_VA_COPY(dest,src) va_copy(dest,src)
-#else
-/* Clang: assume we have __va_copy() in non-C99 mode. */
-#define DUK_VA_COPY(dest,src) __va_copy(dest,src)
-#endif
-
-#define DUK_NORETURN(decl) decl __attribute__((noreturn))
-
-#if defined(__clang__) && defined(__has_builtin)
-#if __has_builtin(__builtin_unreachable)
-#define DUK_UNREACHABLE() do { __builtin_unreachable(); } while (0)
-#endif
-#endif
-
-#define DUK_USE_BRANCH_HINTS
-#define DUK_LIKELY(x) __builtin_expect((x), 1)
-#define DUK_UNLIKELY(x) __builtin_expect((x), 0)
-
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_NOINLINE __attribute__((noinline))
-#define DUK_INLINE inline
-#define DUK_ALWAYS_INLINE inline __attribute__((always_inline))
-#endif
-
-#if defined(DUK_F_DLL_BUILD) && defined(DUK_F_WINDOWS)
-/* MSVC dllexport/dllimport: appropriate __declspec depends on whether we're
- * compiling Duktape or the application.
- */
-#if defined(DUK_COMPILING_DUKTAPE)
-#define DUK_EXTERNAL_DECL extern __declspec(dllexport)
-#define DUK_EXTERNAL __declspec(dllexport)
-#else
-#define DUK_EXTERNAL_DECL extern __declspec(dllimport)
-#define DUK_EXTERNAL should_not_happen
-#endif
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL extern
-#define DUK_INTERNAL /*empty*/
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-#else
-#define DUK_EXTERNAL_DECL __attribute__ ((visibility("default"))) extern
-#define DUK_EXTERNAL __attribute__ ((visibility("default")))
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL __attribute__ ((visibility("hidden"))) extern
-#define DUK_INTERNAL __attribute__ ((visibility("hidden")))
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-#endif
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "clang"
-#else
-#define DUK_USE_COMPILER_STRING "clang"
-#endif
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-#define DUK_USE_UNION_INITIALIZERS
-
-#undef DUK_USE_FLEX_C99
-#undef DUK_USE_FLEX_ZEROSIZE
-#undef DUK_USE_FLEX_ONESIZE
-#if defined(DUK_F_C99)
-#define DUK_USE_FLEX_C99
-#else
-#define DUK_USE_FLEX_ZEROSIZE
-#endif
-
-#undef DUK_USE_GCC_PRAGMAS
-#define DUK_USE_PACK_CLANG_ATTR
-#elif defined(DUK_F_GCC)
-/* --- GCC --- */
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-/* C99 / C++11 and above: rely on va_copy() which is required. */
-#define DUK_VA_COPY(dest,src) va_copy(dest,src)
-#else
-/* GCC: assume we have __va_copy() in non-C99 mode. */
-#define DUK_VA_COPY(dest,src) __va_copy(dest,src)
-#endif
-
-#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 20500L)
-/* since gcc-2.5 */
-#define DUK_NORETURN(decl) decl __attribute__((noreturn))
-#endif
-
-#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40500L)
-/* since gcc-4.5 */
-#define DUK_UNREACHABLE() do { __builtin_unreachable(); } while (0)
-#endif
-
-#define DUK_USE_BRANCH_HINTS
-#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40500L)
-/* GCC: test not very accurate; enable only in relatively recent builds
- * because of bugs in gcc-4.4 (http://lists.debian.org/debian-gcc/2010/04/msg00000.html)
- */
-#define DUK_LIKELY(x) __builtin_expect((x), 1)
-#define DUK_UNLIKELY(x) __builtin_expect((x), 0)
-#endif
-
-#if (defined(DUK_F_C99) || defined(DUK_F_CPP11)) && \
- defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 30101)
-#define DUK_NOINLINE __attribute__((noinline))
-#define DUK_INLINE inline
-#define DUK_ALWAYS_INLINE inline __attribute__((always_inline))
-#endif
-
-#if defined(DUK_F_DLL_BUILD) && defined(DUK_F_WINDOWS)
-/* MSVC dllexport/dllimport: appropriate __declspec depends on whether we're
- * compiling Duktape or the application.
- */
-#if defined(DUK_COMPILING_DUKTAPE)
-#define DUK_EXTERNAL_DECL extern __declspec(dllexport)
-#define DUK_EXTERNAL __declspec(dllexport)
-#else
-#define DUK_EXTERNAL_DECL extern __declspec(dllimport)
-#define DUK_EXTERNAL should_not_happen
-#endif
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL extern
-#define DUK_INTERNAL /*empty*/
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-#elif defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40000)
-#define DUK_EXTERNAL_DECL __attribute__ ((visibility("default"))) extern
-#define DUK_EXTERNAL __attribute__ ((visibility("default")))
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL __attribute__ ((visibility("hidden"))) extern
-#define DUK_INTERNAL __attribute__ ((visibility("hidden")))
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-#endif
-
-#if defined(DUK_F_MINGW)
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "mingw++"
-#else
-#define DUK_USE_COMPILER_STRING "mingw"
-#endif
-#else
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "g++"
-#else
-#define DUK_USE_COMPILER_STRING "gcc"
-#endif
-#endif
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99) || (defined(DUK_F_CPP11) && defined(__GNUC__))
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-#define DUK_USE_UNION_INITIALIZERS
-
-#undef DUK_USE_FLEX_C99
-#undef DUK_USE_FLEX_ZEROSIZE
-#undef DUK_USE_FLEX_ONESIZE
-#if defined(DUK_F_C99)
-#define DUK_USE_FLEX_C99
-#else
-#define DUK_USE_FLEX_ZEROSIZE
-#endif
-
-#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40600)
-#define DUK_USE_GCC_PRAGMAS
-#else
-#undef DUK_USE_GCC_PRAGMAS
-#endif
-
-#define DUK_USE_PACK_GCC_ATTR
-#elif defined(DUK_F_MSVC)
-/* --- MSVC --- */
-/* http://msdn.microsoft.com/en-us/library/aa235362(VS.60).aspx */
-#define DUK_NORETURN(decl) __declspec(noreturn) decl
-
-/* XXX: DUK_UNREACHABLE for msvc? */
-
-#undef DUK_USE_BRANCH_HINTS
-
-/* XXX: DUK_LIKELY, DUK_UNLIKELY for msvc? */
-/* XXX: DUK_NOINLINE, DUK_INLINE, DUK_ALWAYS_INLINE for msvc? */
-
-#if defined(DUK_F_DLL_BUILD) && defined(DUK_F_WINDOWS)
-/* MSVC dllexport/dllimport: appropriate __declspec depends on whether we're
- * compiling Duktape or the application.
- */
-#if defined(DUK_COMPILING_DUKTAPE)
-#define DUK_EXTERNAL_DECL extern __declspec(dllexport)
-#define DUK_EXTERNAL __declspec(dllexport)
-#else
-#define DUK_EXTERNAL_DECL extern __declspec(dllimport)
-#define DUK_EXTERNAL should_not_happen
-#endif
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL extern
-#define DUK_INTERNAL /*empty*/
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-#endif
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "msvc++"
-#else
-#define DUK_USE_COMPILER_STRING "msvc"
-#endif
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99)
-#define DUK_USE_VARIADIC_MACROS
-#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
-/* VS2005+ should have variadic macros even when they're not C99. */
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-#undef DUK_USE_UNION_INITIALIZERS
-#if defined(_MSC_VER) && (_MSC_VER >= 1800)
-/* VS2013+ supports union initializers but there's a bug involving union-inside-struct:
- * https://connect.microsoft.com/VisualStudio/feedback/details/805981
- * The bug was fixed (at least) in VS2015 so check for VS2015 for now:
- * https://blogs.msdn.microsoft.com/vcblog/2015/07/01/c-compiler-front-end-fixes-in-vs2015/
- * Manually tested using VS2013, CL reports 18.00.31101, so enable for VS2013 too.
- */
-#define DUK_USE_UNION_INITIALIZERS
-#endif
-
-#undef DUK_USE_FLEX_C99
-#undef DUK_USE_FLEX_ZEROSIZE
-#undef DUK_USE_FLEX_ONESIZE
-#if defined(DUK_F_C99)
-#define DUK_USE_FLEX_C99
-#else
-#define DUK_USE_FLEX_ZEROSIZE
-#endif
-
-#undef DUK_USE_GCC_PRAGMAS
-
-#define DUK_USE_PACK_MSVC_PRAGMA
-
-/* These have been tested from VS2008 onwards; may work in older VS versions
- * too but not enabled by default.
- */
-#if defined(_MSC_VER) && (_MSC_VER >= 1500)
-#define DUK_NOINLINE __declspec(noinline)
-#define DUK_INLINE __inline
-#define DUK_ALWAYS_INLINE __forceinline
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1900)
-#define DUK_SNPRINTF snprintf
-#define DUK_VSNPRINTF vsnprintf
-#else
-/* (v)snprintf() is missing before MSVC 2015. Note that _(v)snprintf() does
- * NOT NUL terminate on truncation, but Duktape code never assumes that.
- * http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
- */
-#define DUK_SNPRINTF _snprintf
-#define DUK_VSNPRINTF _vsnprintf
-#endif
-#elif defined(DUK_F_EMSCRIPTEN)
-/* --- Emscripten --- */
-#define DUK_NORETURN(decl) decl __attribute__((noreturn))
-
-#if defined(__clang__) && defined(__has_builtin)
-#if __has_builtin(__builtin_unreachable)
-#define DUK_UNREACHABLE() do { __builtin_unreachable(); } while (0)
-#endif
-#endif
-
-#define DUK_USE_BRANCH_HINTS
-#define DUK_LIKELY(x) __builtin_expect((x), 1)
-#define DUK_UNLIKELY(x) __builtin_expect((x), 0)
-
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_NOINLINE __attribute__((noinline))
-#define DUK_INLINE inline
-#define DUK_ALWAYS_INLINE inline __attribute__((always_inline))
-#endif
-
-#define DUK_EXTERNAL_DECL __attribute__ ((visibility("default"))) extern
-#define DUK_EXTERNAL __attribute__ ((visibility("default")))
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL_DECL __attribute__ ((visibility("hidden"))) extern
-#define DUK_INTERNAL __attribute__ ((visibility("hidden")))
-#endif
-#define DUK_LOCAL_DECL static
-#define DUK_LOCAL static
-
-#define DUK_USE_COMPILER_STRING "emscripten"
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-#define DUK_USE_UNION_INITIALIZERS
-
-#undef DUK_USE_FLEX_C99
-#undef DUK_USE_FLEX_ZEROSIZE
-#undef DUK_USE_FLEX_ONESIZE
-#if defined(DUK_F_C99)
-#define DUK_USE_FLEX_C99
-#else
-#define DUK_USE_FLEX_ZEROSIZE
-#endif
-
-#undef DUK_USE_GCC_PRAGMAS
-#define DUK_USE_PACK_CLANG_ATTR
-#elif defined(DUK_F_TINYC)
-/* --- TinyC --- */
-#undef DUK_USE_BRANCH_HINTS
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "tinyc++"
-#else
-#define DUK_USE_COMPILER_STRING "tinyc"
-#endif
-
-/* http://bellard.org/tcc/tcc-doc.html#SEC7 */
-#define DUK_USE_VARIADIC_MACROS
-
-#define DUK_USE_UNION_INITIALIZERS
-
-/* Most portable, wastes space */
-#define DUK_USE_FLEX_ONESIZE
-
-/* Most portable, potentially wastes space */
-#define DUK_USE_PACK_DUMMY_MEMBER
-#elif defined(DUK_F_VBCC)
-/* --- VBCC --- */
-#undef DUK_USE_BRANCH_HINTS
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "vbcc-c++"
-#else
-#define DUK_USE_COMPILER_STRING "vbcc"
-#endif
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-/* VBCC supports C99 so check only for C99 for union initializer support.
- * Designated union initializers would possibly work even without a C99 check.
- */
-#undef DUK_USE_UNION_INITIALIZERS
-#if defined(DUK_F_C99)
-#define DUK_USE_UNION_INITIALIZERS
-#endif
-
-#define DUK_USE_FLEX_ZEROSIZE
-#define DUK_USE_PACK_DUMMY_MEMBER
-#elif defined(DUK_F_BCC)
-/* --- Bruce's C compiler --- */
-#undef DUK_USE_BRANCH_HINTS
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "bcc++"
-#else
-#define DUK_USE_COMPILER_STRING "bcc"
-#endif
-
-/* Most portable */
-#undef DUK_USE_VARIADIC_MACROS
-
-/* Most portable, wastes space */
-#undef DUK_USE_UNION_INITIALIZERS
-
-/* Most portable, wastes space */
-#define DUK_USE_FLEX_ONESIZE
-
-/* Most portable, potentially wastes space */
-#define DUK_USE_PACK_DUMMY_MEMBER
-
-/* BCC, assume we're on x86. */
-#if !defined(DUK_USE_BYTEORDER)
-#define DUK_USE_BYTEORDER 1
-#endif
-#else
-/* --- Generic --- */
-#undef DUK_USE_BRANCH_HINTS
-
-#if defined(DUK_F_CPP)
-#define DUK_USE_COMPILER_STRING "generic-c++"
-#else
-#define DUK_USE_COMPILER_STRING "generic"
-#endif
-
-#undef DUK_USE_VARIADIC_MACROS
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_USE_VARIADIC_MACROS
-#endif
-
-/* C++ doesn't have standard designated union initializers ({ .foo = 1 }). */
-#undef DUK_USE_UNION_INITIALIZERS
-#if defined(DUK_F_C99)
-#define DUK_USE_UNION_INITIALIZERS
-#endif
-
-/* Most portable, wastes space */
-#define DUK_USE_FLEX_ONESIZE
-
-/* Most portable, potentially wastes space */
-#define DUK_USE_PACK_DUMMY_MEMBER
-#endif /* autodetect compiler */
-
-/* uclibc */
-#if defined(__UCLIBC__)
-#define DUK_F_UCLIBC
-#endif
-
-/*
- * Wrapper typedefs and constants for integer types, also sanity check types.
- *
- * C99 typedefs are quite good but not always available, and we want to avoid
- * forcibly redefining the C99 typedefs. So, there are Duktape wrappers for
- * all C99 typedefs and Duktape code should only use these typedefs. Type
- * detection when C99 is not supported is best effort and may end up detecting
- * some types incorrectly.
- *
- * Pointer sizes are a portability problem: pointers to different types may
- * have a different size and function pointers are very difficult to manage
- * portably.
- *
- * http://en.wikipedia.org/wiki/C_data_types#Fixed-width_integer_types
- *
- * Note: there's an interesting corner case when trying to define minimum
- * signed integer value constants which leads to the current workaround of
- * defining e.g. -0x80000000 as (-0x7fffffffL - 1L). See doc/code-issues.txt
- * for a longer discussion.
- *
- * Note: avoid typecasts and computations in macro integer constants as they
- * can then no longer be used in macro relational expressions (such as
- * #if DUK_SIZE_MAX < 0xffffffffUL). There is internal code which relies on
- * being able to compare DUK_SIZE_MAX against a limit.
- */
-
-/* XXX: add feature options to force basic types from outside? */
-
-#if !defined(INT_MAX)
-#error INT_MAX not defined
-#endif
-
-/* Check that architecture is two's complement, standard C allows e.g.
- * INT_MIN to be -2**31+1 (instead of -2**31).
- */
-#if defined(INT_MAX) && defined(INT_MIN)
-#if INT_MAX != -(INT_MIN + 1)
-#error platform does not seem complement of two
-#endif
-#else
-#error cannot check complement of two
-#endif
-
-/* Pointer size determination based on __WORDSIZE or architecture when
- * that's not available.
- */
-#if defined(DUK_F_X86) || defined(DUK_F_X32) || \
- defined(DUK_F_M68K) || defined(DUK_F_PPC32) || \
- defined(DUK_F_BCC) || \
- (defined(__WORDSIZE) && (__WORDSIZE == 32))
-#define DUK_F_32BIT_PTRS
-#elif defined(DUK_F_X64) || \
- (defined(__WORDSIZE) && (__WORDSIZE == 64))
-#define DUK_F_64BIT_PTRS
-#else
-/* not sure, not needed with C99 anyway */
-#endif
-
-/* Intermediate define for 'have inttypes.h' */
-#undef DUK_F_HAVE_INTTYPES
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
- !(defined(DUK_F_AMIGAOS) && defined(DUK_F_VBCC))
-/* vbcc + AmigaOS has C99 but no inttypes.h */
-#define DUK_F_HAVE_INTTYPES
-#elif defined(__cplusplus) && (__cplusplus >= 201103L)
-/* C++11 apparently ratified stdint.h */
-#define DUK_F_HAVE_INTTYPES
-#endif
-
-/* Basic integer typedefs and limits, preferably from inttypes.h, otherwise
- * through automatic detection.
- */
-#if defined(DUK_F_HAVE_INTTYPES)
-/* C99 or compatible */
-
-#define DUK_F_HAVE_64BIT
-#include <inttypes.h>
-
-typedef uint8_t duk_uint8_t;
-typedef int8_t duk_int8_t;
-typedef uint16_t duk_uint16_t;
-typedef int16_t duk_int16_t;
-typedef uint32_t duk_uint32_t;
-typedef int32_t duk_int32_t;
-typedef uint64_t duk_uint64_t;
-typedef int64_t duk_int64_t;
-typedef uint_least8_t duk_uint_least8_t;
-typedef int_least8_t duk_int_least8_t;
-typedef uint_least16_t duk_uint_least16_t;
-typedef int_least16_t duk_int_least16_t;
-typedef uint_least32_t duk_uint_least32_t;
-typedef int_least32_t duk_int_least32_t;
-typedef uint_least64_t duk_uint_least64_t;
-typedef int_least64_t duk_int_least64_t;
-typedef uint_fast8_t duk_uint_fast8_t;
-typedef int_fast8_t duk_int_fast8_t;
-typedef uint_fast16_t duk_uint_fast16_t;
-typedef int_fast16_t duk_int_fast16_t;
-typedef uint_fast32_t duk_uint_fast32_t;
-typedef int_fast32_t duk_int_fast32_t;
-typedef uint_fast64_t duk_uint_fast64_t;
-typedef int_fast64_t duk_int_fast64_t;
-typedef uintptr_t duk_uintptr_t;
-typedef intptr_t duk_intptr_t;
-typedef uintmax_t duk_uintmax_t;
-typedef intmax_t duk_intmax_t;
-
-#define DUK_UINT8_MIN 0
-#define DUK_UINT8_MAX UINT8_MAX
-#define DUK_INT8_MIN INT8_MIN
-#define DUK_INT8_MAX INT8_MAX
-#define DUK_UINT_LEAST8_MIN 0
-#define DUK_UINT_LEAST8_MAX UINT_LEAST8_MAX
-#define DUK_INT_LEAST8_MIN INT_LEAST8_MIN
-#define DUK_INT_LEAST8_MAX INT_LEAST8_MAX
-#define DUK_UINT_FAST8_MIN 0
-#define DUK_UINT_FAST8_MAX UINT_FAST8_MAX
-#define DUK_INT_FAST8_MIN INT_FAST8_MIN
-#define DUK_INT_FAST8_MAX INT_FAST8_MAX
-#define DUK_UINT16_MIN 0
-#define DUK_UINT16_MAX UINT16_MAX
-#define DUK_INT16_MIN INT16_MIN
-#define DUK_INT16_MAX INT16_MAX
-#define DUK_UINT_LEAST16_MIN 0
-#define DUK_UINT_LEAST16_MAX UINT_LEAST16_MAX
-#define DUK_INT_LEAST16_MIN INT_LEAST16_MIN
-#define DUK_INT_LEAST16_MAX INT_LEAST16_MAX
-#define DUK_UINT_FAST16_MIN 0
-#define DUK_UINT_FAST16_MAX UINT_FAST16_MAX
-#define DUK_INT_FAST16_MIN INT_FAST16_MIN
-#define DUK_INT_FAST16_MAX INT_FAST16_MAX
-#define DUK_UINT32_MIN 0
-#define DUK_UINT32_MAX UINT32_MAX
-#define DUK_INT32_MIN INT32_MIN
-#define DUK_INT32_MAX INT32_MAX
-#define DUK_UINT_LEAST32_MIN 0
-#define DUK_UINT_LEAST32_MAX UINT_LEAST32_MAX
-#define DUK_INT_LEAST32_MIN INT_LEAST32_MIN
-#define DUK_INT_LEAST32_MAX INT_LEAST32_MAX
-#define DUK_UINT_FAST32_MIN 0
-#define DUK_UINT_FAST32_MAX UINT_FAST32_MAX
-#define DUK_INT_FAST32_MIN INT_FAST32_MIN
-#define DUK_INT_FAST32_MAX INT_FAST32_MAX
-#define DUK_UINT64_MIN 0
-#define DUK_UINT64_MAX UINT64_MAX
-#define DUK_INT64_MIN INT64_MIN
-#define DUK_INT64_MAX INT64_MAX
-#define DUK_UINT_LEAST64_MIN 0
-#define DUK_UINT_LEAST64_MAX UINT_LEAST64_MAX
-#define DUK_INT_LEAST64_MIN INT_LEAST64_MIN
-#define DUK_INT_LEAST64_MAX INT_LEAST64_MAX
-#define DUK_UINT_FAST64_MIN 0
-#define DUK_UINT_FAST64_MAX UINT_FAST64_MAX
-#define DUK_INT_FAST64_MIN INT_FAST64_MIN
-#define DUK_INT_FAST64_MAX INT_FAST64_MAX
-
-#define DUK_UINTPTR_MIN 0
-#define DUK_UINTPTR_MAX UINTPTR_MAX
-#define DUK_INTPTR_MIN INTPTR_MIN
-#define DUK_INTPTR_MAX INTPTR_MAX
-
-#define DUK_UINTMAX_MIN 0
-#define DUK_UINTMAX_MAX UINTMAX_MAX
-#define DUK_INTMAX_MIN INTMAX_MIN
-#define DUK_INTMAX_MAX INTMAX_MAX
-
-#define DUK_SIZE_MIN 0
-#define DUK_SIZE_MAX SIZE_MAX
-#undef DUK_SIZE_MAX_COMPUTED
-
-#else /* C99 types */
-
-/* When C99 types are not available, we use heuristic detection to get
- * the basic 8, 16, 32, and (possibly) 64 bit types. The fast/least
- * types are then assumed to be exactly the same for now: these could
- * be improved per platform but C99 types are very often now available.
- * 64-bit types are not available on all platforms; this is OK at least
- * on 32-bit platforms.
- *
- * This detection code is necessarily a bit hacky and can provide typedefs
- * and defines that won't work correctly on some exotic platform.
- */
-
-#if (defined(CHAR_BIT) && (CHAR_BIT == 8)) || \
- (defined(UCHAR_MAX) && (UCHAR_MAX == 255))
-typedef unsigned char duk_uint8_t;
-typedef signed char duk_int8_t;
-#else
-#error cannot detect 8-bit type
-#endif
-
-#if defined(USHRT_MAX) && (USHRT_MAX == 65535UL)
-typedef unsigned short duk_uint16_t;
-typedef signed short duk_int16_t;
-#elif defined(UINT_MAX) && (UINT_MAX == 65535UL)
-/* On some platforms int is 16-bit but long is 32-bit (e.g. PureC) */
-typedef unsigned int duk_uint16_t;
-typedef signed int duk_int16_t;
-#else
-#error cannot detect 16-bit type
-#endif
-
-#if defined(UINT_MAX) && (UINT_MAX == 4294967295UL)
-typedef unsigned int duk_uint32_t;
-typedef signed int duk_int32_t;
-#elif defined(ULONG_MAX) && (ULONG_MAX == 4294967295UL)
-/* On some platforms int is 16-bit but long is 32-bit (e.g. PureC) */
-typedef unsigned long duk_uint32_t;
-typedef signed long duk_int32_t;
-#else
-#error cannot detect 32-bit type
-#endif
-
-/* 64-bit type detection is a bit tricky.
- *
- * ULLONG_MAX is a standard define. __LONG_LONG_MAX__ and __ULONG_LONG_MAX__
- * are used by at least GCC (even if system headers don't provide ULLONG_MAX).
- * Some GCC variants may provide __LONG_LONG_MAX__ but not __ULONG_LONG_MAX__.
- *
- * ULL / LL constants are rejected / warned about by some compilers, even if
- * the compiler has a 64-bit type and the compiler/system headers provide an
- * unsupported constant (ULL/LL)! Try to avoid using ULL / LL constants.
- * As a side effect we can only check that e.g. ULONG_MAX is larger than 32
- * bits but can't be sure it is exactly 64 bits. Self tests will catch such
- * cases.
- */
-#undef DUK_F_HAVE_64BIT
-#if !defined(DUK_F_HAVE_64BIT) && defined(ULONG_MAX)
-#if (ULONG_MAX > 4294967295UL)
-#define DUK_F_HAVE_64BIT
-typedef unsigned long duk_uint64_t;
-typedef signed long duk_int64_t;
-#endif
-#endif
-#if !defined(DUK_F_HAVE_64BIT) && defined(ULLONG_MAX)
-#if (ULLONG_MAX > 4294967295UL)
-#define DUK_F_HAVE_64BIT
-typedef unsigned long long duk_uint64_t;
-typedef signed long long duk_int64_t;
-#endif
-#endif
-#if !defined(DUK_F_HAVE_64BIT) && defined(__ULONG_LONG_MAX__)
-#if (__ULONG_LONG_MAX__ > 4294967295UL)
-#define DUK_F_HAVE_64BIT
-typedef unsigned long long duk_uint64_t;
-typedef signed long long duk_int64_t;
-#endif
-#endif
-#if !defined(DUK_F_HAVE_64BIT) && defined(__LONG_LONG_MAX__)
-#if (__LONG_LONG_MAX__ > 2147483647L)
-#define DUK_F_HAVE_64BIT
-typedef unsigned long long duk_uint64_t;
-typedef signed long long duk_int64_t;
-#endif
-#endif
-#if !defined(DUK_F_HAVE_64BIT) && \
- (defined(DUK_F_MINGW) || defined(DUK_F_MSVC))
-/* Both MinGW and MSVC have a 64-bit type. */
-#define DUK_F_HAVE_64BIT
-typedef unsigned long duk_uint64_t;
-typedef signed long duk_int64_t;
-#endif
-#if !defined(DUK_F_HAVE_64BIT)
-/* cannot detect 64-bit type, not always needed so don't error */
-#endif
-
-typedef duk_uint8_t duk_uint_least8_t;
-typedef duk_int8_t duk_int_least8_t;
-typedef duk_uint16_t duk_uint_least16_t;
-typedef duk_int16_t duk_int_least16_t;
-typedef duk_uint32_t duk_uint_least32_t;
-typedef duk_int32_t duk_int_least32_t;
-typedef duk_uint8_t duk_uint_fast8_t;
-typedef duk_int8_t duk_int_fast8_t;
-typedef duk_uint16_t duk_uint_fast16_t;
-typedef duk_int16_t duk_int_fast16_t;
-typedef duk_uint32_t duk_uint_fast32_t;
-typedef duk_int32_t duk_int_fast32_t;
-#if defined(DUK_F_HAVE_64BIT)
-typedef duk_uint64_t duk_uint_least64_t;
-typedef duk_int64_t duk_int_least64_t;
-typedef duk_uint64_t duk_uint_fast64_t;
-typedef duk_int64_t duk_int_fast64_t;
-#endif
-#if defined(DUK_F_HAVE_64BIT)
-typedef duk_uint64_t duk_uintmax_t;
-typedef duk_int64_t duk_intmax_t;
-#else
-typedef duk_uint32_t duk_uintmax_t;
-typedef duk_int32_t duk_intmax_t;
-#endif
-
-/* Note: the funny looking computations for signed minimum 16-bit, 32-bit, and
- * 64-bit values are intentional as the obvious forms (e.g. -0x80000000L) are
- * -not- portable. See code-issues.txt for a detailed discussion.
- */
-#define DUK_UINT8_MIN 0UL
-#define DUK_UINT8_MAX 0xffUL
-#define DUK_INT8_MIN (-0x80L)
-#define DUK_INT8_MAX 0x7fL
-#define DUK_UINT_LEAST8_MIN 0UL
-#define DUK_UINT_LEAST8_MAX 0xffUL
-#define DUK_INT_LEAST8_MIN (-0x80L)
-#define DUK_INT_LEAST8_MAX 0x7fL
-#define DUK_UINT_FAST8_MIN 0UL
-#define DUK_UINT_FAST8_MAX 0xffUL
-#define DUK_INT_FAST8_MIN (-0x80L)
-#define DUK_INT_FAST8_MAX 0x7fL
-#define DUK_UINT16_MIN 0UL
-#define DUK_UINT16_MAX 0xffffUL
-#define DUK_INT16_MIN (-0x7fffL - 1L)
-#define DUK_INT16_MAX 0x7fffL
-#define DUK_UINT_LEAST16_MIN 0UL
-#define DUK_UINT_LEAST16_MAX 0xffffUL
-#define DUK_INT_LEAST16_MIN (-0x7fffL - 1L)
-#define DUK_INT_LEAST16_MAX 0x7fffL
-#define DUK_UINT_FAST16_MIN 0UL
-#define DUK_UINT_FAST16_MAX 0xffffUL
-#define DUK_INT_FAST16_MIN (-0x7fffL - 1L)
-#define DUK_INT_FAST16_MAX 0x7fffL
-#define DUK_UINT32_MIN 0UL
-#define DUK_UINT32_MAX 0xffffffffUL
-#define DUK_INT32_MIN (-0x7fffffffL - 1L)
-#define DUK_INT32_MAX 0x7fffffffL
-#define DUK_UINT_LEAST32_MIN 0UL
-#define DUK_UINT_LEAST32_MAX 0xffffffffUL
-#define DUK_INT_LEAST32_MIN (-0x7fffffffL - 1L)
-#define DUK_INT_LEAST32_MAX 0x7fffffffL
-#define DUK_UINT_FAST32_MIN 0UL
-#define DUK_UINT_FAST32_MAX 0xffffffffUL
-#define DUK_INT_FAST32_MIN (-0x7fffffffL - 1L)
-#define DUK_INT_FAST32_MAX 0x7fffffffL
-
-/* 64-bit constants. Since LL / ULL constants are not always available,
- * use computed values. These values can't be used in preprocessor
- * comparisons; flag them as such.
- */
-#if defined(DUK_F_HAVE_64BIT)
-#define DUK_UINT64_MIN ((duk_uint64_t) 0)
-#define DUK_UINT64_MAX ((duk_uint64_t) -1)
-#define DUK_INT64_MIN ((duk_int64_t) (~(DUK_UINT64_MAX >> 1)))
-#define DUK_INT64_MAX ((duk_int64_t) (DUK_UINT64_MAX >> 1))
-#define DUK_UINT_LEAST64_MIN DUK_UINT64_MIN
-#define DUK_UINT_LEAST64_MAX DUK_UINT64_MAX
-#define DUK_INT_LEAST64_MIN DUK_INT64_MIN
-#define DUK_INT_LEAST64_MAX DUK_INT64_MAX
-#define DUK_UINT_FAST64_MIN DUK_UINT64_MIN
-#define DUK_UINT_FAST64_MAX DUK_UINT64_MAX
-#define DUK_INT_FAST64_MIN DUK_INT64_MIN
-#define DUK_INT_FAST64_MAX DUK_INT64_MAX
-#define DUK_UINT64_MIN_COMPUTED
-#define DUK_UINT64_MAX_COMPUTED
-#define DUK_INT64_MIN_COMPUTED
-#define DUK_INT64_MAX_COMPUTED
-#define DUK_UINT_LEAST64_MIN_COMPUTED
-#define DUK_UINT_LEAST64_MAX_COMPUTED
-#define DUK_INT_LEAST64_MIN_COMPUTED
-#define DUK_INT_LEAST64_MAX_COMPUTED
-#define DUK_UINT_FAST64_MIN_COMPUTED
-#define DUK_UINT_FAST64_MAX_COMPUTED
-#define DUK_INT_FAST64_MIN_COMPUTED
-#define DUK_INT_FAST64_MAX_COMPUTED
-#endif
-
-#if defined(DUK_F_HAVE_64BIT)
-#define DUK_UINTMAX_MIN DUK_UINT64_MIN
-#define DUK_UINTMAX_MAX DUK_UINT64_MAX
-#define DUK_INTMAX_MIN DUK_INT64_MIN
-#define DUK_INTMAX_MAX DUK_INT64_MAX
-#define DUK_UINTMAX_MIN_COMPUTED
-#define DUK_UINTMAX_MAX_COMPUTED
-#define DUK_INTMAX_MIN_COMPUTED
-#define DUK_INTMAX_MAX_COMPUTED
-#else
-#define DUK_UINTMAX_MIN 0UL
-#define DUK_UINTMAX_MAX 0xffffffffUL
-#define DUK_INTMAX_MIN (-0x7fffffffL - 1L)
-#define DUK_INTMAX_MAX 0x7fffffffL
-#endif
-
-/* This detection is not very reliable. */
-#if defined(DUK_F_32BIT_PTRS)
-typedef duk_int32_t duk_intptr_t;
-typedef duk_uint32_t duk_uintptr_t;
-#define DUK_UINTPTR_MIN DUK_UINT32_MIN
-#define DUK_UINTPTR_MAX DUK_UINT32_MAX
-#define DUK_INTPTR_MIN DUK_INT32_MIN
-#define DUK_INTPTR_MAX DUK_INT32_MAX
-#elif defined(DUK_F_64BIT_PTRS) && defined(DUK_F_HAVE_64BIT)
-typedef duk_int64_t duk_intptr_t;
-typedef duk_uint64_t duk_uintptr_t;
-#define DUK_UINTPTR_MIN DUK_UINT64_MIN
-#define DUK_UINTPTR_MAX DUK_UINT64_MAX
-#define DUK_INTPTR_MIN DUK_INT64_MIN
-#define DUK_INTPTR_MAX DUK_INT64_MAX
-#define DUK_UINTPTR_MIN_COMPUTED
-#define DUK_UINTPTR_MAX_COMPUTED
-#define DUK_INTPTR_MIN_COMPUTED
-#define DUK_INTPTR_MAX_COMPUTED
-#else
-#error cannot determine intptr type
-#endif
-
-/* SIZE_MAX may be missing so use an approximate value for it. */
-#undef DUK_SIZE_MAX_COMPUTED
-#if !defined(SIZE_MAX)
-#define DUK_SIZE_MAX_COMPUTED
-#define SIZE_MAX ((size_t) (-1))
-#endif
-#define DUK_SIZE_MIN 0
-#define DUK_SIZE_MAX SIZE_MAX
-
-#endif /* C99 types */
-
-/* A few types are assumed to always exist. */
-typedef size_t duk_size_t;
-typedef ptrdiff_t duk_ptrdiff_t;
-
-/* The best type for an "all around int" in Duktape internals is "at least
- * 32 bit signed integer" which is most convenient. Same for unsigned type.
- * Prefer 'int' when large enough, as it is almost always a convenient type.
- */
-#if defined(UINT_MAX) && (UINT_MAX >= 0xffffffffUL)
-typedef int duk_int_t;
-typedef unsigned int duk_uint_t;
-#define DUK_INT_MIN INT_MIN
-#define DUK_INT_MAX INT_MAX
-#define DUK_UINT_MIN 0
-#define DUK_UINT_MAX UINT_MAX
-#else
-typedef duk_int_fast32_t duk_int_t;
-typedef duk_uint_fast32_t duk_uint_t;
-#define DUK_INT_MIN DUK_INT_FAST32_MIN
-#define DUK_INT_MAX DUK_INT_FAST32_MAX
-#define DUK_UINT_MIN DUK_UINT_FAST32_MIN
-#define DUK_UINT_MAX DUK_UINT_FAST32_MAX
-#endif
-
-/* Same as 'duk_int_t' but guaranteed to be a 'fast' variant if this
- * distinction matters for the CPU. These types are used mainly in the
- * executor where it might really matter.
- */
-typedef duk_int_fast32_t duk_int_fast_t;
-typedef duk_uint_fast32_t duk_uint_fast_t;
-#define DUK_INT_FAST_MIN DUK_INT_FAST32_MIN
-#define DUK_INT_FAST_MAX DUK_INT_FAST32_MAX
-#define DUK_UINT_FAST_MIN DUK_UINT_FAST32_MIN
-#define DUK_UINT_FAST_MAX DUK_UINT_FAST32_MAX
-
-/* Small integers (16 bits or more) can fall back to the 'int' type, but
- * have a typedef so they are marked "small" explicitly.
- */
-typedef int duk_small_int_t;
-typedef unsigned int duk_small_uint_t;
-#define DUK_SMALL_INT_MIN INT_MIN
-#define DUK_SMALL_INT_MAX INT_MAX
-#define DUK_SMALL_UINT_MIN 0
-#define DUK_SMALL_UINT_MAX UINT_MAX
-
-/* Fast variants of small integers, again for really fast paths like the
- * executor.
- */
-typedef duk_int_fast16_t duk_small_int_fast_t;
-typedef duk_uint_fast16_t duk_small_uint_fast_t;
-#define DUK_SMALL_INT_FAST_MIN DUK_INT_FAST16_MIN
-#define DUK_SMALL_INT_FAST_MAX DUK_INT_FAST16_MAX
-#define DUK_SMALL_UINT_FAST_MIN DUK_UINT_FAST16_MIN
-#define DUK_SMALL_UINT_FAST_MAX DUK_UINT_FAST16_MAX
-
-/* Boolean values are represented with the platform 'int'. */
-typedef duk_small_int_t duk_bool_t;
-#define DUK_BOOL_MIN DUK_SMALL_INT_MIN
-#define DUK_BOOL_MAX DUK_SMALL_INT_MAX
-
-/* Index values must have at least 32-bit signed range. */
-typedef duk_int_t duk_idx_t;
-#define DUK_IDX_MIN DUK_INT_MIN
-#define DUK_IDX_MAX DUK_INT_MAX
-
-/* Unsigned index variant. */
-typedef duk_uint_t duk_uidx_t;
-#define DUK_UIDX_MIN DUK_UINT_MIN
-#define DUK_UIDX_MAX DUK_UINT_MAX
-
-/* Array index values, could be exact 32 bits.
- * Currently no need for signed duk_arridx_t.
- */
-typedef duk_uint_t duk_uarridx_t;
-#define DUK_UARRIDX_MIN DUK_UINT_MIN
-#define DUK_UARRIDX_MAX DUK_UINT_MAX
-
-/* Duktape/C function return value, platform int is enough for now to
- * represent 0, 1, or negative error code. Must be compatible with
- * assigning truth values (e.g. duk_ret_t rc = (foo == bar);).
- */
-typedef duk_small_int_t duk_ret_t;
-#define DUK_RET_MIN DUK_SMALL_INT_MIN
-#define DUK_RET_MAX DUK_SMALL_INT_MAX
-
-/* Error codes are represented with platform int. High bits are used
- * for flags and such, so 32 bits are needed.
- */
-typedef duk_int_t duk_errcode_t;
-#define DUK_ERRCODE_MIN DUK_INT_MIN
-#define DUK_ERRCODE_MAX DUK_INT_MAX
-
-/* Codepoint type. Must be 32 bits or more because it is used also for
- * internal codepoints. The type is signed because negative codepoints
- * are used as internal markers (e.g. to mark EOF or missing argument).
- * (X)UTF-8/CESU-8 encode/decode take and return an unsigned variant to
- * ensure duk_uint32_t casts back and forth nicely. Almost everything
- * else uses the signed one.
- */
-typedef duk_int_t duk_codepoint_t;
-typedef duk_uint_t duk_ucodepoint_t;
-#define DUK_CODEPOINT_MIN DUK_INT_MIN
-#define DUK_CODEPOINT_MAX DUK_INT_MAX
-#define DUK_UCODEPOINT_MIN DUK_UINT_MIN
-#define DUK_UCODEPOINT_MAX DUK_UINT_MAX
-
-/* IEEE float/double typedef. */
-typedef float duk_float_t;
-typedef double duk_double_t;
-
-/* We're generally assuming that we're working on a platform with a 32-bit
- * address space. If DUK_SIZE_MAX is a typecast value (which is necessary
- * if SIZE_MAX is missing), the check must be avoided because the
- * preprocessor can't do a comparison.
- */
-#if !defined(DUK_SIZE_MAX)
-#error DUK_SIZE_MAX is undefined, probably missing SIZE_MAX
-#elif !defined(DUK_SIZE_MAX_COMPUTED)
-#if DUK_SIZE_MAX < 0xffffffffUL
-/* On some systems SIZE_MAX can be smaller than max unsigned 32-bit value
- * which seems incorrect if size_t is (at least) an unsigned 32-bit type.
- * However, it doesn't seem useful to error out compilation if this is the
- * case.
- */
-#endif
-#endif
-
-/* Type for public API calls. */
-typedef struct duk_hthread duk_context;
-
-/* Check whether we should use 64-bit integers or not.
- *
- * Quite incomplete now. Use 64-bit types if detected (C99 or other detection)
- * unless they are known to be unreliable. For instance, 64-bit types are
- * available on VBCC but seem to misbehave.
- */
-#if defined(DUK_F_HAVE_64BIT) && !defined(DUK_F_VBCC)
-#define DUK_USE_64BIT_OPS
-#else
-#undef DUK_USE_64BIT_OPS
-#endif
-
-/*
- * Fill-ins for platform, architecture, and compiler
- */
-
-#if !defined(DUK_SETJMP)
-#define DUK_JMPBUF_TYPE jmp_buf
-#define DUK_SETJMP(jb) setjmp((jb))
-#define DUK_LONGJMP(jb) longjmp((jb), 1)
-#endif
-
-#if 0
-/* sigsetjmp() alternative */
-#define DUK_JMPBUF_TYPE sigjmp_buf
-#define DUK_SETJMP(jb) sigsetjmp((jb))
-#define DUK_LONGJMP(jb) siglongjmp((jb), 1)
-#endif
-
-typedef FILE duk_file;
-#if !defined(DUK_STDIN)
-#define DUK_STDIN stdin
-#endif
-#if !defined(DUK_STDOUT)
-#define DUK_STDOUT stdout
-#endif
-#if !defined(DUK_STDERR)
-#define DUK_STDERR stderr
-#endif
-
-/* Special naming to avoid conflict with e.g. DUK_FREE() in duk_heap.h
- * (which is unfortunately named). May sometimes need replacement, e.g.
- * some compilers don't handle zero length or NULL correctly in realloc().
- */
-#if !defined(DUK_ANSI_MALLOC)
-#define DUK_ANSI_MALLOC malloc
-#endif
-#if !defined(DUK_ANSI_REALLOC)
-#define DUK_ANSI_REALLOC realloc
-#endif
-#if !defined(DUK_ANSI_CALLOC)
-#define DUK_ANSI_CALLOC calloc
-#endif
-#if !defined(DUK_ANSI_FREE)
-#define DUK_ANSI_FREE free
-#endif
-
-/* ANSI C (various versions) and some implementations require that the
- * pointer arguments to memset(), memcpy(), and memmove() be valid values
- * even when byte size is 0 (even a NULL pointer is considered invalid in
- * this context). Zero-size operations as such are allowed, as long as their
- * pointer arguments point to a valid memory area. The DUK_MEMSET(),
- * DUK_MEMCPY(), and DUK_MEMMOVE() macros require this same behavior, i.e.:
- * (1) pointers must be valid and non-NULL, (2) zero size must otherwise be
- * allowed. If these are not fulfilled, a macro wrapper is needed.
- *
- * http://stackoverflow.com/questions/5243012/is-it-guaranteed-to-be-safe-to-perform-memcpy0-0-0
- * http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-October/011065.html
- *
- * Not sure what's the required behavior when a pointer points just past the
- * end of a buffer, which often happens in practice (e.g. zero size memmoves).
- * For example, if allocation size is 3, the following pointer would not
- * technically point to a valid memory byte:
- *
- * <-- alloc -->
- * | 0 | 1 | 2 | .....
- * ^-- p=3, points after last valid byte (2)
- */
-#if !defined(DUK_MEMCPY)
-#if defined(DUK_F_UCLIBC)
-/* Old uclibcs have a broken memcpy so use memmove instead (this is overly wide
- * now on purpose): http://lists.uclibc.org/pipermail/uclibc-cvs/2008-October/025511.html
- */
-#define DUK_MEMCPY memmove
-#else
-#define DUK_MEMCPY memcpy
-#endif
-#endif
-#if !defined(DUK_MEMMOVE)
-#define DUK_MEMMOVE memmove
-#endif
-#if !defined(DUK_MEMCMP)
-#define DUK_MEMCMP memcmp
-#endif
-#if !defined(DUK_MEMSET)
-#define DUK_MEMSET memset
-#endif
-#if !defined(DUK_STRLEN)
-#define DUK_STRLEN strlen
-#endif
-#if !defined(DUK_STRCMP)
-#define DUK_STRCMP strcmp
-#endif
-#if !defined(DUK_STRNCMP)
-#define DUK_STRNCMP strncmp
-#endif
-#if !defined(DUK_PRINTF)
-#define DUK_PRINTF printf
-#endif
-#if !defined(DUK_FPRINTF)
-#define DUK_FPRINTF fprintf
-#endif
-#if !defined(DUK_SPRINTF)
-#define DUK_SPRINTF sprintf
-#endif
-#if !defined(DUK_SNPRINTF)
-/* snprintf() is technically not part of C89 but usually available. */
-#define DUK_SNPRINTF snprintf
-#endif
-#if !defined(DUK_VSPRINTF)
-#define DUK_VSPRINTF vsprintf
-#endif
-#if !defined(DUK_VSNPRINTF)
-/* vsnprintf() is technically not part of C89 but usually available. */
-#define DUK_VSNPRINTF vsnprintf
-#endif
-#if !defined(DUK_SSCANF)
-#define DUK_SSCANF sscanf
-#endif
-#if !defined(DUK_VSSCANF)
-#define DUK_VSSCANF vsscanf
-#endif
-#if !defined(DUK_FOPEN)
-#define DUK_FOPEN fopen
-#endif
-#if !defined(DUK_FCLOSE)
-#define DUK_FCLOSE fclose
-#endif
-#if !defined(DUK_FREAD)
-#define DUK_FREAD fread
-#endif
-#if !defined(DUK_FWRITE)
-#define DUK_FWRITE fwrite
-#endif
-#if !defined(DUK_FSEEK)
-#define DUK_FSEEK fseek
-#endif
-#if !defined(DUK_FTELL)
-#define DUK_FTELL ftell
-#endif
-#if !defined(DUK_FFLUSH)
-#define DUK_FFLUSH fflush
-#endif
-#if !defined(DUK_FPUTC)
-#define DUK_FPUTC fputc
-#endif
-#if !defined(DUK_MEMZERO)
-#define DUK_MEMZERO(p,n) DUK_MEMSET((p), 0, (n))
-#endif
-#if !defined(DUK_ABORT)
-#define DUK_ABORT abort
-#endif
-#if !defined(DUK_EXIT)
-#define DUK_EXIT exit
-#endif
-
-#if !defined(DUK_DOUBLE_2TO32)
-#define DUK_DOUBLE_2TO32 4294967296.0
-#endif
-#if !defined(DUK_DOUBLE_2TO31)
-#define DUK_DOUBLE_2TO31 2147483648.0
-#endif
-
-#if !defined(DUK_DOUBLE_INFINITY)
-#undef DUK_USE_COMPUTED_INFINITY
-#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION < 40600)
-/* GCC older than 4.6: avoid overflow warnings related to using INFINITY */
-#define DUK_DOUBLE_INFINITY (__builtin_inf())
-#elif defined(INFINITY)
-#define DUK_DOUBLE_INFINITY ((double) INFINITY)
-#elif !defined(DUK_F_VBCC) && !defined(DUK_F_MSVC) && !defined(DUK_F_BCC)
-#define DUK_DOUBLE_INFINITY (1.0 / 0.0)
-#else
-/* In VBCC (1.0 / 0.0) results in a warning and 0.0 instead of infinity.
- * Use a computed infinity (initialized when a heap is created at the
- * latest).
- */
-#define DUK_USE_COMPUTED_INFINITY
-#define DUK_DOUBLE_INFINITY duk_computed_infinity
-#endif
-#endif
-
-#if !defined(DUK_DOUBLE_NAN)
-#undef DUK_USE_COMPUTED_NAN
-#if defined(NAN)
-#define DUK_DOUBLE_NAN NAN
-#elif !defined(DUK_F_VBCC) && !defined(DUK_F_MSVC) && !defined(DUK_F_BCC)
-#define DUK_DOUBLE_NAN (0.0 / 0.0)
-#else
-/* In VBCC (0.0 / 0.0) results in a warning and 0.0 instead of NaN.
- * In MSVC (VS2010 Express) (0.0 / 0.0) results in a compile error.
- * Use a computed NaN (initialized when a heap is created at the
- * latest).
- */
-#define DUK_USE_COMPUTED_NAN
-#define DUK_DOUBLE_NAN duk_computed_nan
-#endif
-#endif
-
-/* Many platforms are missing fpclassify() and friends, so use replacements
- * if necessary. The replacement constants (FP_NAN etc) can be anything but
- * match Linux constants now.
- */
-#undef DUK_USE_REPL_FPCLASSIFY
-#undef DUK_USE_REPL_SIGNBIT
-#undef DUK_USE_REPL_ISFINITE
-#undef DUK_USE_REPL_ISNAN
-#undef DUK_USE_REPL_ISINF
-
-/* Complex condition broken into separate parts. */
-#undef DUK_F_USE_REPL_ALL
-#if !(defined(FP_NAN) && defined(FP_INFINITE) && defined(FP_ZERO) && \
- defined(FP_SUBNORMAL) && defined(FP_NORMAL))
-/* Missing some obvious constants. */
-#define DUK_F_USE_REPL_ALL
-#elif defined(DUK_F_AMIGAOS) && defined(DUK_F_VBCC)
-/* VBCC is missing the built-ins even in C99 mode (perhaps a header issue) */
-#define DUK_F_USE_REPL_ALL
-#elif defined(DUK_F_FREEBSD) && defined(DUK_F_CLANG)
-/* Placeholder fix for (detection is wider than necessary):
- * http://llvm.org/bugs/show_bug.cgi?id=17788
- */
-#define DUK_F_USE_REPL_ALL
-#elif defined(DUK_F_UCLIBC)
-/* At least some uclibc versions have broken floating point math. For
- * example, fpclassify() can incorrectly classify certain NaN formats.
- * To be safe, use replacements.
- */
-#define DUK_F_USE_REPL_ALL
-#endif
-
-#if defined(DUK_F_USE_REPL_ALL)
-#define DUK_USE_REPL_FPCLASSIFY
-#define DUK_USE_REPL_SIGNBIT
-#define DUK_USE_REPL_ISFINITE
-#define DUK_USE_REPL_ISNAN
-#define DUK_USE_REPL_ISINF
-#define DUK_FPCLASSIFY duk_repl_fpclassify
-#define DUK_SIGNBIT duk_repl_signbit
-#define DUK_ISFINITE duk_repl_isfinite
-#define DUK_ISNAN duk_repl_isnan
-#define DUK_ISINF duk_repl_isinf
-#define DUK_FP_NAN 0
-#define DUK_FP_INFINITE 1
-#define DUK_FP_ZERO 2
-#define DUK_FP_SUBNORMAL 3
-#define DUK_FP_NORMAL 4
-#else
-#define DUK_FPCLASSIFY fpclassify
-#define DUK_SIGNBIT signbit
-#define DUK_ISFINITE isfinite
-#define DUK_ISNAN isnan
-#define DUK_ISINF isinf
-#define DUK_FP_NAN FP_NAN
-#define DUK_FP_INFINITE FP_INFINITE
-#define DUK_FP_ZERO FP_ZERO
-#define DUK_FP_SUBNORMAL FP_SUBNORMAL
-#define DUK_FP_NORMAL FP_NORMAL
-#endif
-
-#if defined(DUK_F_USE_REPL_ALL)
-#undef DUK_F_USE_REPL_ALL
-#endif
-
-/* Some math functions are C99 only. This is also an issue with some
- * embedded environments using uclibc where uclibc has been configured
- * not to provide some functions. For now, use replacements whenever
- * using uclibc.
- */
-#undef DUK_USE_MATH_FMIN
-#undef DUK_USE_MATH_FMAX
-#undef DUK_USE_MATH_ROUND
-#if defined(DUK_F_UCLIBC)
-/* uclibc may be missing these */
-#elif defined(DUK_F_AMIGAOS) && defined(DUK_F_VBCC)
-/* vbcc + AmigaOS may be missing these */
-#elif defined(DUK_F_MINT)
-/* mint clib is missing these */
-#elif !defined(DUK_F_C99) && !defined(DUK_F_CPP11)
-/* build is not C99 or C++11, play it safe */
-#else
-/* C99 or C++11, no known issues */
-#define DUK_USE_MATH_FMIN
-#define DUK_USE_MATH_FMAX
-#define DUK_USE_MATH_ROUND
-#endif
-
-/* These functions don't currently need replacement but are wrapped for
- * completeness. Because these are used as function pointers, they need
- * to be defined as concrete C functions (not macros).
- */
-#if !defined(DUK_FABS)
-#define DUK_FABS fabs
-#endif
-#if !defined(DUK_FMIN)
-#define DUK_FMIN fmin
-#endif
-#if !defined(DUK_FMAX)
-#define DUK_FMAX fmax
-#endif
-#if !defined(DUK_FLOOR)
-#define DUK_FLOOR floor
-#endif
-#if !defined(DUK_CEIL)
-#define DUK_CEIL ceil
-#endif
-#if !defined(DUK_FMOD)
-#define DUK_FMOD fmod
-#endif
-#if !defined(DUK_POW)
-#define DUK_POW pow
-#endif
-#if !defined(DUK_ACOS)
-#define DUK_ACOS acos
-#endif
-#if !defined(DUK_ASIN)
-#define DUK_ASIN asin
-#endif
-#if !defined(DUK_ATAN)
-#define DUK_ATAN atan
-#endif
-#if !defined(DUK_ATAN2)
-#define DUK_ATAN2 atan2
-#endif
-#if !defined(DUK_SIN)
-#define DUK_SIN sin
-#endif
-#if !defined(DUK_COS)
-#define DUK_COS cos
-#endif
-#if !defined(DUK_TAN)
-#define DUK_TAN tan
-#endif
-#if !defined(DUK_EXP)
-#define DUK_EXP exp
-#endif
-#if !defined(DUK_LOG)
-#define DUK_LOG log
-#endif
-#if !defined(DUK_SQRT)
-#define DUK_SQRT sqrt
-#endif
-
-/* NetBSD 6.0 x86 (at least) has a few problems with pow() semantics,
- * see test-bug-netbsd-math-pow.js. Use NetBSD specific workaround.
- * (This might be a wider problem; if so, generalize the define name.)
- */
-#undef DUK_USE_POW_NETBSD_WORKAROUND
-#if defined(DUK_F_NETBSD)
-#define DUK_USE_POW_NETBSD_WORKAROUND
-#endif
-
-/* Rely as little as possible on compiler behavior for NaN comparison,
- * signed zero handling, etc. Currently never activated but may be needed
- * for broken compilers.
- */
-#undef DUK_USE_PARANOID_MATH
-
-/* There was a curious bug where test-bi-date-canceling.js would fail e.g.
- * on 64-bit Ubuntu, gcc-4.8.1, -m32, and no -std=c99. Some date computations
- * using doubles would be optimized which then broke some corner case tests.
- * The problem goes away by adding 'volatile' to the datetime computations.
- * Not sure what the actual triggering conditions are, but using this on
- * non-C99 systems solves the known issues and has relatively little cost
- * on other platforms.
- */
-#undef DUK_USE_PARANOID_DATE_COMPUTATION
-#if !defined(DUK_F_C99)
-#define DUK_USE_PARANOID_DATE_COMPUTATION
-#endif
-
-/*
- * Byte order and double memory layout detection
- *
- * Endianness detection is a major portability hassle because the macros
- * and headers are not standardized. There's even variance across UNIX
- * platforms. Even with "standard" headers, details like underscore count
- * varies between platforms, e.g. both __BYTE_ORDER and _BYTE_ORDER are used
- * (Crossbridge has a single underscore, for instance).
- *
- * The checks below are structured with this in mind: several approaches are
- * used, and at the end we check if any of them worked. This allows generic
- * approaches to be tried first, and platform/compiler specific hacks tried
- * last. As a last resort, the user can force a specific endianness, as it's
- * not likely that automatic detection will work on the most exotic platforms.
- *
- * Duktape supports little and big endian machines. There's also support
- * for a hybrid used by some ARM machines where integers are little endian
- * but IEEE double values use a mixed order (12345678 -> 43218765). This
- * byte order for doubles is referred to as "mixed endian".
- */
-
-/* For custom platforms allow user to define byteorder explicitly.
- * Since endianness headers are not standardized, this is a useful
- * workaround for custom platforms for which endianness detection
- * is not directly supported. Perhaps custom hardware is used and
- * user cannot submit upstream patches.
- */
-#if defined(DUK_OPT_FORCE_BYTEORDER)
-#undef DUK_USE_BYTEORDER
-#if (DUK_OPT_FORCE_BYTEORDER == 1)
-#define DUK_USE_BYTEORDER 1
-#elif (DUK_OPT_FORCE_BYTEORDER == 2)
-#define DUK_USE_BYTEORDER 2
-#elif (DUK_OPT_FORCE_BYTEORDER == 3)
-#define DUK_USE_BYTEORDER 3
-#else
-#error invalid DUK_OPT_FORCE_BYTEORDER value
-#endif
-#endif /* DUK_OPT_FORCE_BYTEORDER */
-
-/* GCC and Clang provide endianness defines as built-in predefines, with
- * leading and trailing double underscores (e.g. __BYTE_ORDER__). See
- * output of "make gccpredefs" and "make clangpredefs". Clang doesn't
- * seem to provide __FLOAT_WORD_ORDER__; assume not mixed endian for clang.
- * http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
- */
-#if !defined(DUK_USE_BYTEORDER) && defined(__BYTE_ORDER__)
-#if defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
-#if defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
-#define DUK_USE_BYTEORDER 1
-#elif defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
-#define DUK_USE_BYTEORDER 2
-#elif !defined(__FLOAT_WORD_ORDER__)
-/* Float word order not known, assume not a hybrid. */
-#define DUK_USE_BYTEORDER 1
-#else
-/* Byte order is little endian but cannot determine IEEE double word order. */
-#endif /* float word order */
-#elif defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
-#if defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
-#define DUK_USE_BYTEORDER 3
-#elif !defined(__FLOAT_WORD_ORDER__)
-/* Float word order not known, assume not a hybrid. */
-#define DUK_USE_BYTEORDER 3
-#else
-/* Byte order is big endian but cannot determine IEEE double word order. */
-#endif /* float word order */
-#else
-/* Cannot determine byte order; __ORDER_PDP_ENDIAN__ is related to 32-bit
- * integer ordering and is not relevant.
- */
-#endif /* integer byte order */
-#endif /* !defined(DUK_USE_BYTEORDER) && defined(__BYTE_ORDER__) */
-
-/* More or less standard endianness predefines provided by header files.
- * The ARM hybrid case is detected by assuming that __FLOAT_WORD_ORDER
- * will be big endian, see: http://lists.mysql.com/internals/443.
- * On some platforms some defines may be present with an empty value which
- * causes comparisons to fail: https://github.com/svaarala/duktape/issues/453.
- */
-#if !defined(DUK_USE_BYTEORDER)
-#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) || \
- defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) || \
- defined(__LITTLE_ENDIAN__)
-#if defined(__FLOAT_WORD_ORDER) && defined(__LITTLE_ENDIAN) && (__FLOAT_WORD_ORDER == __LITTLE_ENDIAN) || \
- defined(_FLOAT_WORD_ORDER) && defined(_LITTLE_ENDIAN) && (_FLOAT_WORD_ORDER == _LITTLE_ENDIAN)
-#define DUK_USE_BYTEORDER 1
-#elif defined(__FLOAT_WORD_ORDER) && defined(__BIG_ENDIAN) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) || \
- defined(_FLOAT_WORD_ORDER) && defined(_BIG_ENDIAN) && (_FLOAT_WORD_ORDER == _BIG_ENDIAN)
-#define DUK_USE_BYTEORDER 2
-#elif !defined(__FLOAT_WORD_ORDER) && !defined(_FLOAT_WORD_ORDER)
-/* Float word order not known, assume not a hybrid. */
-#define DUK_USE_BYTEORDER 1
-#else
-/* Byte order is little endian but cannot determine IEEE double word order. */
-#endif /* float word order */
-#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) || \
- defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) || \
- defined(__BIG_ENDIAN__)
-#if defined(__FLOAT_WORD_ORDER) && defined(__BIG_ENDIAN) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) || \
- defined(_FLOAT_WORD_ORDER) && defined(_BIG_ENDIAN) && (_FLOAT_WORD_ORDER == _BIG_ENDIAN)
-#define DUK_USE_BYTEORDER 3
-#elif !defined(__FLOAT_WORD_ORDER) && !defined(_FLOAT_WORD_ORDER)
-/* Float word order not known, assume not a hybrid. */
-#define DUK_USE_BYTEORDER 3
-#else
-/* Byte order is big endian but cannot determine IEEE double word order. */
-#endif /* float word order */
-#else
-/* Cannot determine byte order. */
-#endif /* integer byte order */
-#endif /* !defined(DUK_USE_BYTEORDER) */
-
-/* QNX gcc cross compiler seems to define e.g. __LITTLEENDIAN__ or __BIGENDIAN__:
- * $ /opt/qnx650/host/linux/x86/usr/bin/i486-pc-nto-qnx6.5.0-gcc -dM -E - </dev/null | grep -ni endian
- * 67:#define __LITTLEENDIAN__ 1
- * $ /opt/qnx650/host/linux/x86/usr/bin/mips-unknown-nto-qnx6.5.0-gcc -dM -E - </dev/null | grep -ni endian
- * 81:#define __BIGENDIAN__ 1
- * $ /opt/qnx650/host/linux/x86/usr/bin/arm-unknown-nto-qnx6.5.0-gcc -dM -E - </dev/null | grep -ni endian
- * 70:#define __LITTLEENDIAN__ 1
- */
-#if !defined(DUK_USE_BYTEORDER)
-#if defined(__LITTLEENDIAN__)
-#define DUK_USE_BYTEORDER 1
-#elif defined(__BIGENDIAN__)
-#define DUK_USE_BYTEORDER 3
-#endif
-#endif
-
-/*
- * Alignment requirement and support for unaligned accesses
- *
- * Assume unaligned accesses are not supported unless specifically allowed
- * in the target platform. Some platforms may support unaligned accesses
- * but alignment to 4 or 8 may still be desirable.
- */
-
-/* If not provided, use safe default for alignment. */
-#if !defined(DUK_USE_ALIGN_BY)
-#define DUK_USE_ALIGN_BY 8
-#endif
-
-/* User forced alignment to 4 or 8. */
-#if defined(DUK_OPT_FORCE_ALIGN)
-#undef DUK_USE_ALIGN_BY
-#if (DUK_OPT_FORCE_ALIGN == 4)
-#define DUK_USE_ALIGN_BY 4
-#elif (DUK_OPT_FORCE_ALIGN == 8)
-#define DUK_USE_ALIGN_BY 8
-#else
-#error invalid DUK_OPT_FORCE_ALIGN value
-#endif
-#endif
-
-/* Compiler specific hackery needed to force struct size to match aligment,
- * see e.g. duk_hbuffer.h.
- *
- * http://stackoverflow.com/questions/11130109/c-struct-size-alignment
- * http://stackoverflow.com/questions/10951039/specifying-64-bit-alignment
- */
-#if !(defined(DUK_USE_PACK_MSVC_PRAGMA) || defined(DUK_USE_PACK_GCC_ATTR) || \
- defined(DUK_USE_PACK_CLANG_ATTR) || defined(DUK_USE_PACK_DUMMY_MEMBER))
-#define DUK_USE_PACK_DUMMY_MEMBER
-#endif
-
-#if !defined(DUK_VA_COPY)
-/* We need va_copy() which is defined in C99 / C++11, so an awkward
- * replacement is needed for pre-C99 / pre-C++11 environments. This
- * will quite likely need portability hacks for some non-C99
- * environments.
- */
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-/* C99 / C++11 and above: rely on va_copy() which is required.
- * Omit parenthesis on macro right side on purpose to minimize differences
- * to direct use.
- */
-#define DUK_VA_COPY(dest,src) va_copy(dest,src)
-#else
-/* Pre-C99: va_list type is implementation dependent. This replacement
- * assumes it is a plain value so that a simple assignment will work.
- * This is not the case on all platforms (it may be a single-array element,
- * for instance).
- */
-#define DUK_VA_COPY(dest,src) do { (dest) = (src); } while (0)
-#endif
-#endif
-
-#if !defined(DUK_MACRO_STRINGIFY)
-/* Macro hackery to convert e.g. __LINE__ to a string without formatting,
- * see: http://stackoverflow.com/questions/240353/convert-a-preprocessor-token-to-a-string
- */
-#define DUK_MACRO_STRINGIFY_HELPER(x) #x
-#define DUK_MACRO_STRINGIFY(x) DUK_MACRO_STRINGIFY_HELPER(x)
-#endif
-
-#if !defined(DUK_CAUSE_SEGFAULT)
-/* This is optionally used by panic handling to cause the program to segfault
- * (instead of e.g. abort()) on panic. Valgrind will then indicate the C
- * call stack leading to the panic.
- */
-#define DUK_CAUSE_SEGFAULT() do { *((volatile duk_uint32_t *) NULL) = (duk_uint32_t) 0xdeadbeefUL; } while (0)
-#endif
-#if !defined(DUK_UNREF)
-/* Macro for suppressing warnings for potentially unreferenced variables.
- * The variables can be actually unreferenced or unreferenced in some
- * specific cases only; for instance, if a variable is only debug printed,
- * it is unreferenced when debug printing is disabled.
- */
-#define DUK_UNREF(x) do { (void) (x); } while (0)
-#endif
-#if !defined(DUK_NORETURN)
-#define DUK_NORETURN(decl) decl
-#endif
-#if !defined(DUK_UNREACHABLE)
-/* Don't know how to declare unreachable point, so don't do it; this
- * may cause some spurious compilation warnings (e.g. "variable used
- * uninitialized").
- */
-#define DUK_UNREACHABLE() do { } while (0)
-#endif
-#if !defined(DUK_LOSE_CONST)
-/* Convert any input pointer into a "void *", losing a const qualifier.
- * This is not fully portable because casting through duk_uintptr_t may
- * not work on all architectures (e.g. those with long, segmented pointers).
- */
-#define DUK_LOSE_CONST(src) ((void *) (duk_uintptr_t) (src))
-#endif
-
-#if !defined(DUK_LIKELY)
-#define DUK_LIKELY(x) (x)
-#endif
-#if !defined(DUK_UNLIKELY)
-#define DUK_UNLIKELY(x) (x)
-#endif
-
-#if !defined(DUK_NOINLINE)
-#define DUK_NOINLINE /*nop*/
-#endif
-#if !defined(DUK_INLINE)
-#define DUK_INLINE /*nop*/
-#endif
-#if !defined(DUK_ALWAYS_INLINE)
-#define DUK_ALWAYS_INLINE /*nop*/
-#endif
-
-#if !defined(DUK_EXTERNAL_DECL)
-#define DUK_EXTERNAL_DECL extern
-#endif
-#if !defined(DUK_EXTERNAL)
-#define DUK_EXTERNAL /*empty*/
-#endif
-#if !defined(DUK_INTERNAL_DECL)
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL_DECL static
-#else
-#define DUK_INTERNAL_DECL extern
-#endif
-#endif
-#if !defined(DUK_INTERNAL)
-#if defined(DUK_SINGLE_FILE)
-#define DUK_INTERNAL static
-#else
-#define DUK_INTERNAL /*empty*/
-#endif
-#endif
-#if !defined(DUK_LOCAL_DECL)
-#define DUK_LOCAL_DECL static
-#endif
-#if !defined(DUK_LOCAL)
-#define DUK_LOCAL static
-#endif
-
-#if !defined(DUK_FILE_MACRO)
-#define DUK_FILE_MACRO __FILE__
-#endif
-#if !defined(DUK_LINE_MACRO)
-#define DUK_LINE_MACRO __LINE__
-#endif
-#if !defined(DUK_FUNC_MACRO)
-#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
-#define DUK_FUNC_MACRO __func__
-#elif defined(__FUNCTION__)
-#define DUK_FUNC_MACRO __FUNCTION__
-#else
-#define DUK_FUNC_MACRO "unknown"
-#endif
-#endif
-
-#if !defined(DUK_BSWAP32)
-#define DUK_BSWAP32(x) \
- ((((duk_uint32_t) (x)) >> 24) | \
- ((((duk_uint32_t) (x)) >> 8) & 0xff00UL) | \
- ((((duk_uint32_t) (x)) << 8) & 0xff0000UL) | \
- (((duk_uint32_t) (x)) << 24))
-#endif
-#if !defined(DUK_BSWAP16)
-#define DUK_BSWAP16(x) \
- ((duk_uint16_t) (x) >> 8) | \
- ((duk_uint16_t) (x) << 8)
-#endif
-
-/* DUK_USE_VARIADIC_MACROS: required from compilers, so no fill-in. */
-/* DUK_USE_UNION_INITIALIZERS: required from compilers, so no fill-in. */
-
-#if !(defined(DUK_USE_FLEX_C99) || defined(DUK_USE_FLEX_ZEROSIZE) || defined(DUK_USE_FLEX_ONESIZE))
-#if defined(DUK_F_C99)
-#define DUK_USE_FLEX_C99
-#else
-#define DUK_USE_FLEX_ZEROSIZE /* Not standard but common enough */
-#endif
-#endif
-
-#if !(defined(DUK_USE_PACK_GCC_ATTR) || defined(DUK_USE_PACK_CLANG_ATTR) || \
- defined(DUK_USE_PACK_MSVC_PRAGMA) || defined(DUK_USE_PACK_DUMMY_MEMBER))
-#define DUK_USE_PACK_DUMMY_MEMBER
-#endif
-
-#if 0 /* not defined by default */
-#undef DUK_USE_GCC_PRAGMAS
-#endif
-
-/* Workaround for GH-323: avoid inlining control when compiling from
- * multiple sources, as it causes compiler portability trouble.
- */
-#if !defined(DUK_SINGLE_FILE)
-#undef DUK_NOINLINE
-#undef DUK_INLINE
-#undef DUK_ALWAYS_INLINE
-#define DUK_NOINLINE /*nop*/
-#define DUK_INLINE /*nop*/
-#define DUK_ALWAYS_INLINE /*nop*/
-#endif
-
-/*
- * Check whether or not a packed duk_tval representation is possible.
- * What's basically required is that pointers are 32-bit values
- * (sizeof(void *) == 4). Best effort check, not always accurate.
- * If guess goes wrong, crashes may result; self tests also verify
- * the guess.
- */
-
-/* Explicit marker needed; may be 'defined', 'undefined, 'or 'not provided'. */
-#if !defined(DUK_F_PACKED_TVAL_PROVIDED)
-#undef DUK_F_PACKED_TVAL_POSSIBLE
-
-/* Strict C99 case: DUK_UINTPTR_MAX (= UINTPTR_MAX) should be very reliable */
-#if !defined(DUK_F_PACKED_TVAL_POSSIBLE) && defined(DUK_UINTPTR_MAX)
-#if (DUK_UINTPTR_MAX <= 0xffffffffUL)
-#define DUK_F_PACKED_TVAL_POSSIBLE
-#endif
-#endif
-
-/* Non-C99 case, still relying on DUK_UINTPTR_MAX, as long as it is not a computed value */
-#if !defined(DUK_F_PACKED_TVAL_POSSIBLE) && defined(DUK_UINTPTR_MAX) && !defined(DUK_UINTPTR_MAX_COMPUTED)
-#if (DUK_UINTPTR_MAX <= 0xffffffffUL)
-#define DUK_F_PACKED_TVAL_POSSIBLE
-#endif
-#endif
-
-/* DUK_SIZE_MAX (= SIZE_MAX) is often reliable */
-#if !defined(DUK_F_PACKED_TVAL_POSSIBLE) && defined(DUK_SIZE_MAX) && !defined(DUK_SIZE_MAX_COMPUTED)
-#if (DUK_SIZE_MAX <= 0xffffffffUL)
-#define DUK_F_PACKED_TVAL_POSSIBLE
-#endif
-#endif
-
-#undef DUK_USE_PACKED_TVAL
-#if defined(DUK_F_PACKED_TVAL_POSSIBLE)
-#define DUK_USE_PACKED_TVAL
-#endif
-
-#undef DUK_F_PACKED_TVAL_POSSIBLE
-#endif /* DUK_F_PACKED_TVAL_PROVIDED */
-
-/* Feature option forcing. */
-#if defined(DUK_OPT_NO_PACKED_TVAL)
-#undef DUK_USE_PACKED_TVAL
-#elif defined(DUK_OPT_PACKED_TVAL)
-#undef DUK_USE_PACKED_TVAL
-#define DUK_USE_PACKED_TVAL
-#endif
-/* Object property allocation layout has implications for memory and code
- * footprint and generated code size/speed. The best layout also depends
- * on whether the platform has alignment requirements or benefits from
- * having mostly aligned accesses.
- */
-#undef DUK_USE_HOBJECT_LAYOUT_1
-#undef DUK_USE_HOBJECT_LAYOUT_2
-#undef DUK_USE_HOBJECT_LAYOUT_3
-#if (DUK_USE_ALIGN_BY == 1)
-/* On platforms without any alignment issues, layout 1 is preferable
- * because it compiles to slightly less code and provides direct access
- * to property keys.
- */
-#define DUK_USE_HOBJECT_LAYOUT_1
-#else
-/* On other platforms use layout 2, which requires some padding but
- * is a bit more natural than layout 3 in ordering the entries. Layout
- * 3 is currently not used.
- */
-#define DUK_USE_HOBJECT_LAYOUT_2
-#endif
-
-/* GCC/clang inaccurate math would break compliance and probably duk_tval,
- * so refuse to compile. Relax this if -ffast-math is tested to work.
- */
-#if defined(__FAST_MATH__)
-#error __FAST_MATH__ defined, refusing to compile
-#endif
-
-/*
- * Feature option handling
- */
-
-#if !defined(DUK_USE_ALIGN_BY)
-#if defined(DUK_OPT_FORCE_ALIGN)
-#define DUK_USE_ALIGN_BY DUK_OPT_FORCE_ALIGN
-#else
-#define DUK_USE_ALIGN_BY 8
-#endif
-#endif
-
-#if defined(DUK_OPT_ASSERTIONS)
-#define DUK_USE_ASSERTIONS
-#elif defined(DUK_OPT_NO_ASSERTIONS)
-#undef DUK_USE_ASSERTIONS
-#else
-#undef DUK_USE_ASSERTIONS
-#endif
-
-#if defined(DUK_OPT_AUGMENT_ERRORS)
-#define DUK_USE_AUGMENT_ERROR_CREATE
-#elif defined(DUK_OPT_NO_AUGMENT_ERRORS)
-#undef DUK_USE_AUGMENT_ERROR_CREATE
-#else
-#define DUK_USE_AUGMENT_ERROR_CREATE
-#endif
-
-#if defined(DUK_OPT_AUGMENT_ERRORS)
-#define DUK_USE_AUGMENT_ERROR_THROW
-#elif defined(DUK_OPT_NO_AUGMENT_ERRORS)
-#undef DUK_USE_AUGMENT_ERROR_THROW
-#else
-#define DUK_USE_AUGMENT_ERROR_THROW
-#endif
-
-#if defined(DUK_OPT_BROWSER_LIKE)
-#define DUK_USE_BROWSER_LIKE
-#elif defined(DUK_OPT_NO_BROWSER_LIKE)
-#undef DUK_USE_BROWSER_LIKE
-#else
-#define DUK_USE_BROWSER_LIKE
-#endif
-
-#if defined(DUK_OPT_BUFFEROBJECT_SUPPORT)
-#define DUK_USE_BUFFEROBJECT_SUPPORT
-#elif defined(DUK_OPT_NO_BUFFEROBJECT_SUPPORT)
-#undef DUK_USE_BUFFEROBJECT_SUPPORT
-#else
-#define DUK_USE_BUFFEROBJECT_SUPPORT
-#endif
-
-#if defined(DUK_OPT_BUFLEN16)
-#define DUK_USE_BUFLEN16
-#elif defined(DUK_OPT_NO_BUFLEN16)
-#undef DUK_USE_BUFLEN16
-#else
-#undef DUK_USE_BUFLEN16
-#endif
-
-#if defined(DUK_OPT_BYTECODE_DUMP_SUPPORT)
-#define DUK_USE_BYTECODE_DUMP_SUPPORT
-#elif defined(DUK_OPT_NO_BYTECODE_DUMP_SUPPORT)
-#undef DUK_USE_BYTECODE_DUMP_SUPPORT
-#else
-#define DUK_USE_BYTECODE_DUMP_SUPPORT
-#endif
-
-#if defined(DUK_OPT_COMMONJS_MODULES)
-#define DUK_USE_COMMONJS_MODULES
-#elif defined(DUK_OPT_NO_COMMONJS_MODULES)
-#undef DUK_USE_COMMONJS_MODULES
-#else
-#define DUK_USE_COMMONJS_MODULES
-#endif
-
-#if defined(DUK_OPT_CPP_EXCEPTIONS)
-#define DUK_USE_CPP_EXCEPTIONS
-#elif defined(DUK_OPT_NO_CPP_EXCEPTIONS)
-#undef DUK_USE_CPP_EXCEPTIONS
-#else
-#undef DUK_USE_CPP_EXCEPTIONS
-#endif
-
-#if defined(DUK_OPT_DATAPTR16)
-#define DUK_USE_DATAPTR16
-#elif defined(DUK_OPT_NO_DATAPTR16)
-#undef DUK_USE_DATAPTR16
-#else
-#undef DUK_USE_DATAPTR16
-#endif
-
-#if defined(DUK_OPT_DATAPTR_DEC16)
-#define DUK_USE_DATAPTR_DEC16(udata,ptr) DUK_OPT_DATAPTR_DEC16((udata),(ptr))
-#else
-#undef DUK_USE_DATAPTR_DEC16
-#endif
-
-#if defined(DUK_OPT_DATAPTR_ENC16)
-#define DUK_USE_DATAPTR_ENC16(udata,ptr) DUK_OPT_DATAPTR_ENC16((udata),(ptr))
-#else
-#undef DUK_USE_DATAPTR_ENC16
-#endif
-
-#if defined(DUK_OPT_DDDPRINT)
-#define DUK_USE_DDDPRINT
-#elif defined(DUK_OPT_NO_DDDPRINT)
-#undef DUK_USE_DDDPRINT
-#else
-#undef DUK_USE_DDDPRINT
-#endif
-
-#if defined(DUK_OPT_DDPRINT)
-#define DUK_USE_DDPRINT
-#elif defined(DUK_OPT_NO_DDPRINT)
-#undef DUK_USE_DDPRINT
-#else
-#undef DUK_USE_DDPRINT
-#endif
-
-#if defined(DUK_OPT_DEBUG)
-#define DUK_USE_DEBUG
-#elif defined(DUK_OPT_NO_DEBUG)
-#undef DUK_USE_DEBUG
-#else
-#undef DUK_USE_DEBUG
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_DUMPHEAP)
-#define DUK_USE_DEBUGGER_DUMPHEAP
-#elif defined(DUK_OPT_NO_DEBUGGER_DUMPHEAP)
-#undef DUK_USE_DEBUGGER_DUMPHEAP
-#else
-#undef DUK_USE_DEBUGGER_DUMPHEAP
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_FWD_LOGGING)
-#define DUK_USE_DEBUGGER_FWD_LOGGING
-#elif defined(DUK_OPT_NO_DEBUGGER_FWD_LOGGING)
-#undef DUK_USE_DEBUGGER_FWD_LOGGING
-#else
-#undef DUK_USE_DEBUGGER_FWD_LOGGING
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_FWD_PRINTALERT)
-#define DUK_USE_DEBUGGER_FWD_PRINTALERT
-#elif defined(DUK_OPT_NO_DEBUGGER_FWD_PRINTALERT)
-#undef DUK_USE_DEBUGGER_FWD_PRINTALERT
-#else
-#undef DUK_USE_DEBUGGER_FWD_PRINTALERT
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_INSPECT)
-#define DUK_USE_DEBUGGER_INSPECT
-#elif defined(DUK_OPT_NO_DEBUGGER_INSPECT)
-#undef DUK_USE_DEBUGGER_INSPECT
-#else
-#undef DUK_USE_DEBUGGER_INSPECT
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_PAUSE_UNCAUGHT)
-#define DUK_USE_DEBUGGER_PAUSE_UNCAUGHT
-#elif defined(DUK_OPT_NO_DEBUGGER_PAUSE_UNCAUGHT)
-#undef DUK_USE_DEBUGGER_PAUSE_UNCAUGHT
-#else
-#undef DUK_USE_DEBUGGER_PAUSE_UNCAUGHT
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_SUPPORT)
-#define DUK_USE_DEBUGGER_SUPPORT
-#elif defined(DUK_OPT_NO_DEBUGGER_SUPPORT)
-#undef DUK_USE_DEBUGGER_SUPPORT
-#else
-#undef DUK_USE_DEBUGGER_SUPPORT
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_THROW_NOTIFY)
-#define DUK_USE_DEBUGGER_THROW_NOTIFY
-#elif defined(DUK_OPT_NO_DEBUGGER_THROW_NOTIFY)
-#undef DUK_USE_DEBUGGER_THROW_NOTIFY
-#else
-#define DUK_USE_DEBUGGER_THROW_NOTIFY
-#endif
-
-#if defined(DUK_OPT_DEBUGGER_TRANSPORT_TORTURE)
-#define DUK_USE_DEBUGGER_TRANSPORT_TORTURE
-#elif defined(DUK_OPT_NO_DEBUGGER_TRANSPORT_TORTURE)
-#undef DUK_USE_DEBUGGER_TRANSPORT_TORTURE
-#else
-#undef DUK_USE_DEBUGGER_TRANSPORT_TORTURE
-#endif
-
-#if defined(DUK_OPT_DEBUG_BUFSIZE)
-#define DUK_USE_DEBUG_BUFSIZE DUK_OPT_DEBUG_BUFSIZE
-#else
-#define DUK_USE_DEBUG_BUFSIZE 65536L
-#endif
-
-#if defined(DUK_OPT_REFERENCE_COUNTING)
-#define DUK_USE_DOUBLE_LINKED_HEAP
-#elif defined(DUK_OPT_NO_REFERENCE_COUNTING)
-#undef DUK_USE_DOUBLE_LINKED_HEAP
-#else
-#define DUK_USE_DOUBLE_LINKED_HEAP
-#endif
-
-#if defined(DUK_OPT_DPRINT)
-#define DUK_USE_DPRINT
-#elif defined(DUK_OPT_NO_DPRINT)
-#undef DUK_USE_DPRINT
-#else
-#undef DUK_USE_DPRINT
-#endif
-
-#if defined(DUK_OPT_DPRINT_COLORS)
-#define DUK_USE_DPRINT_COLORS
-#elif defined(DUK_OPT_NO_DPRINT_COLORS)
-#undef DUK_USE_DPRINT_COLORS
-#else
-#undef DUK_USE_DPRINT_COLORS
-#endif
-
-#if defined(DUK_OPT_DPRINT_RDTSC)
-#define DUK_USE_DPRINT_RDTSC
-#elif defined(DUK_OPT_NO_DPRINT_RDTSC)
-#undef DUK_USE_DPRINT_RDTSC
-#else
-#undef DUK_USE_DPRINT_RDTSC
-#endif
-
-#if defined(DUK_OPT_AUGMENT_ERRORS)
-#define DUK_USE_ERRCREATE
-#elif defined(DUK_OPT_NO_AUGMENT_ERRORS)
-#undef DUK_USE_ERRCREATE
-#else
-#define DUK_USE_ERRCREATE
-#endif
-
-#if defined(DUK_OPT_AUGMENT_ERRORS)
-#define DUK_USE_ERRTHROW
-#elif defined(DUK_OPT_NO_AUGMENT_ERRORS)
-#undef DUK_USE_ERRTHROW
-#else
-#define DUK_USE_ERRTHROW
-#endif
-
-#if defined(DUK_OPT_ES6_OBJECT_PROTO_PROPERTY)
-#define DUK_USE_ES6_OBJECT_PROTO_PROPERTY
-#elif defined(DUK_OPT_NO_ES6_OBJECT_PROTO_PROPERTY)
-#undef DUK_USE_ES6_OBJECT_PROTO_PROPERTY
-#else
-#define DUK_USE_ES6_OBJECT_PROTO_PROPERTY
-#endif
-
-#if defined(DUK_OPT_ES6_OBJECT_SETPROTOTYPEOF)
-#define DUK_USE_ES6_OBJECT_SETPROTOTYPEOF
-#elif defined(DUK_OPT_NO_ES6_OBJECT_SETPROTOTYPEOF)
-#undef DUK_USE_ES6_OBJECT_SETPROTOTYPEOF
-#else
-#define DUK_USE_ES6_OBJECT_SETPROTOTYPEOF
-#endif
-
-#if defined(DUK_OPT_ES6_PROXY)
-#define DUK_USE_ES6_PROXY
-#elif defined(DUK_OPT_NO_ES6_PROXY)
-#undef DUK_USE_ES6_PROXY
-#else
-#define DUK_USE_ES6_PROXY
-#endif
-
-#if defined(DUK_OPT_ES6_REGEXP_BRACES)
-#define DUK_USE_ES6_REGEXP_BRACES
-#elif defined(DUK_OPT_NO_ES6_REGEXP_BRACES)
-#undef DUK_USE_ES6_REGEXP_BRACES
-#else
-#define DUK_USE_ES6_REGEXP_BRACES
-#endif
-
-#undef DUK_USE_EXEC_INDIRECT_BOUND_CHECK
-#if defined(DUK_OPT_DEBUG) || defined(DUK_OPT_ASSERTIONS)
-/* Enabled with debug/assertions just so that any issues can be caught. */
-#define DUK_USE_EXEC_INDIRECT_BOUND_CHECK
-#endif
-
-#undef DUK_USE_EXEC_TIMEOUT_CHECK
-#if defined(DUK_OPT_EXEC_TIMEOUT_CHECK)
-#define DUK_USE_EXEC_TIMEOUT_CHECK(udata) DUK_OPT_EXEC_TIMEOUT_CHECK((udata))
-#endif
-
-#undef DUK_USE_EXTSTR_FREE
-#if defined(DUK_OPT_EXTERNAL_STRINGS) && defined(DUK_OPT_EXTSTR_FREE)
-#define DUK_USE_EXTSTR_FREE(udata,ptr) DUK_OPT_EXTSTR_FREE((udata), (ptr))
-#endif
-
-#undef DUK_USE_EXTSTR_INTERN_CHECK
-#if defined(DUK_OPT_EXTERNAL_STRINGS) && defined(DUK_OPT_EXTSTR_INTERN_CHECK)
-#define DUK_USE_EXTSTR_INTERN_CHECK(udata,ptr,len) DUK_OPT_EXTSTR_INTERN_CHECK((udata), (ptr), (len))
-#endif
-
-/* Support for 48-bit signed integer duk_tval with transparent semantics. */
-#undef DUK_USE_FASTINT
-#if defined(DUK_OPT_FASTINT)
-#if !defined(DUK_F_HAVE_64BIT)
-#error DUK_OPT_FASTINT requires 64-bit integer type support at the moment
-#endif
-#define DUK_USE_FASTINT
-#endif
-
-#if defined(DUK_OPT_FILE_IO)
-#define DUK_USE_FILE_IO
-#elif defined(DUK_OPT_NO_FILE_IO)
-#undef DUK_USE_FILE_IO
-#else
-#define DUK_USE_FILE_IO
-#endif
-
-#if defined(DUK_OPT_FUNCPTR16)
-#define DUK_USE_FUNCPTR16
-#elif defined(DUK_OPT_NO_FUNCPTR16)
-#undef DUK_USE_FUNCPTR16
-#else
-#undef DUK_USE_FUNCPTR16
-#endif
-
-#if defined(DUK_OPT_FUNCPTR_DEC16)
-#define DUK_USE_FUNCPTR_DEC16(udata,ptr) DUK_OPT_FUNCPTR_DEC16((udata),(ptr))
-#else
-#undef DUK_USE_FUNCPTR_DEC16
-#endif
-
-#if defined(DUK_OPT_FUNCPTR_ENC16)
-#define DUK_USE_FUNCPTR_ENC16(udata,ptr) DUK_OPT_FUNCPTR_ENC16((udata),(ptr))
-#else
-#undef DUK_USE_FUNCPTR_ENC16
-#endif
-
-#if defined(DUK_OPT_GC_TORTURE)
-#define DUK_USE_GC_TORTURE
-#elif defined(DUK_OPT_NO_GC_TORTURE)
-#undef DUK_USE_GC_TORTURE
-#else
-#undef DUK_USE_GC_TORTURE
-#endif
-
-#if defined(DUK_OPT_HEAPPTR16)
-#define DUK_USE_HEAPPTR16
-#elif defined(DUK_OPT_NO_HEAPPTR16)
-#undef DUK_USE_HEAPPTR16
-#else
-#undef DUK_USE_HEAPPTR16
-#endif
-
-#if defined(DUK_OPT_HEAPPTR_DEC16)
-#define DUK_USE_HEAPPTR_DEC16(udata,ptr) DUK_OPT_HEAPPTR_DEC16((udata),(ptr))
-#else
-#undef DUK_USE_HEAPPTR_DEC16
-#endif
-
-#if defined(DUK_OPT_HEAPPTR_ENC16)
-#define DUK_USE_HEAPPTR_ENC16(udata,ptr) DUK_OPT_HEAPPTR_ENC16((udata),(ptr))
-#else
-#undef DUK_USE_HEAPPTR_ENC16
-#endif
-
-/* For now, hash part is dropped if and only if 16-bit object fields are used. */
-#define DUK_USE_HOBJECT_HASH_PART
-#if defined(DUK_OPT_OBJSIZES16)
-#undef DUK_USE_HOBJECT_HASH_PART
-#endif
-
-#if defined(DUK_OPT_HSTRING_CLEN)
-#define DUK_USE_HSTRING_CLEN
-#elif defined(DUK_OPT_NO_HSTRING_CLEN)
-#undef DUK_USE_HSTRING_CLEN
-#else
-#define DUK_USE_HSTRING_CLEN
-#endif
-
-#if defined(DUK_OPT_EXTERNAL_STRINGS)
-#define DUK_USE_HSTRING_EXTDATA
-#elif defined(DUK_OPT_NO_EXTERNAL_STRINGS)
-#undef DUK_USE_HSTRING_EXTDATA
-#else
-#undef DUK_USE_HSTRING_EXTDATA
-#endif
-
-#if defined(DUK_OPT_INTERRUPT_COUNTER)
-#define DUK_USE_INTERRUPT_COUNTER
-#elif defined(DUK_OPT_NO_INTERRUPT_COUNTER)
-#undef DUK_USE_INTERRUPT_COUNTER
-#else
-#undef DUK_USE_INTERRUPT_COUNTER
-#endif
-
-#if defined(DUK_OPT_JC)
-#define DUK_USE_JC
-#elif defined(DUK_OPT_NO_JC)
-#undef DUK_USE_JC
-#else
-#define DUK_USE_JC
-#endif
-
-#if defined(DUK_OPT_JSON_STRINGIFY_FASTPATH)
-#define DUK_USE_JSON_STRINGIFY_FASTPATH
-#elif defined(DUK_OPT_NO_JSON_STRINGIFY_FASTPATH)
-#undef DUK_USE_JSON_STRINGIFY_FASTPATH
-#else
-#undef DUK_USE_JSON_STRINGIFY_FASTPATH
-#endif
-
-#if defined(DUK_OPT_JX)
-#define DUK_USE_JX
-#elif defined(DUK_OPT_NO_JX)
-#undef DUK_USE_JX
-#else
-#define DUK_USE_JX
-#endif
-
-#if defined(DUK_OPT_LIGHTFUNC_BUILTINS)
-#define DUK_USE_LIGHTFUNC_BUILTINS
-#elif defined(DUK_OPT_NO_LIGHTFUNC_BUILTINS)
-#undef DUK_USE_LIGHTFUNC_BUILTINS
-#else
-#undef DUK_USE_LIGHTFUNC_BUILTINS
-#endif
-
-#if defined(DUK_OPT_MARK_AND_SWEEP)
-#define DUK_USE_MARK_AND_SWEEP
-#elif defined(DUK_OPT_NO_MARK_AND_SWEEP)
-#undef DUK_USE_MARK_AND_SWEEP
-#else
-#define DUK_USE_MARK_AND_SWEEP
-#endif
-
-#if defined(DUK_OPT_MS_STRINGTABLE_RESIZE)
-#define DUK_USE_MS_STRINGTABLE_RESIZE
-#elif defined(DUK_OPT_NO_MS_STRINGTABLE_RESIZE)
-#undef DUK_USE_MS_STRINGTABLE_RESIZE
-#else
-#define DUK_USE_MS_STRINGTABLE_RESIZE
-#endif
-
-#if defined(DUK_OPT_NONSTD_ARRAY_CONCAT_TRAILER)
-#define DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER
-#elif defined(DUK_OPT_NO_NONSTD_ARRAY_CONCAT_TRAILER)
-#undef DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER
-#else
-#define DUK_USE_NONSTD_ARRAY_CONCAT_TRAILER
-#endif
-
-#if defined(DUK_OPT_NONSTD_ARRAY_MAP_TRAILER)
-#define DUK_USE_NONSTD_ARRAY_MAP_TRAILER
-#elif defined(DUK_OPT_NO_NONSTD_ARRAY_MAP_TRAILER)
-#undef DUK_USE_NONSTD_ARRAY_MAP_TRAILER
-#else
-#define DUK_USE_NONSTD_ARRAY_MAP_TRAILER
-#endif
-
-#if defined(DUK_OPT_NONSTD_ARRAY_SPLICE_DELCOUNT)
-#define DUK_USE_NONSTD_ARRAY_SPLICE_DELCOUNT
-#elif defined(DUK_OPT_NO_NONSTD_ARRAY_SPLICE_DELCOUNT)
-#undef DUK_USE_NONSTD_ARRAY_SPLICE_DELCOUNT
-#else
-#define DUK_USE_NONSTD_ARRAY_SPLICE_DELCOUNT
-#endif
-
-#if defined(DUK_OPT_NONSTD_FUNC_CALLER_PROPERTY)
-#define DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
-#elif defined(DUK_OPT_NO_NONSTD_FUNC_CALLER_PROPERTY)
-#undef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
-#else
-#undef DUK_USE_NONSTD_FUNC_CALLER_PROPERTY
-#endif
-
-#if defined(DUK_OPT_NONSTD_FUNC_SOURCE_PROPERTY)
-#define DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY
-#elif defined(DUK_OPT_NO_NONSTD_FUNC_SOURCE_PROPERTY)
-#undef DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY
-#else
-#undef DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY
-#endif
-
-#if defined(DUK_OPT_NONSTD_FUNC_STMT)
-#define DUK_USE_NONSTD_FUNC_STMT
-#elif defined(DUK_OPT_NO_NONSTD_FUNC_STMT)
-#undef DUK_USE_NONSTD_FUNC_STMT
-#else
-#define DUK_USE_NONSTD_FUNC_STMT
-#endif
-
-#if defined(DUK_OPT_NONSTD_ACCESSOR_KEY_ARGUMENT)
-#define DUK_USE_NONSTD_GETTER_KEY_ARGUMENT
-#elif defined(DUK_OPT_NO_NONSTD_ACCESSOR_KEY_ARGUMENT)
-#undef DUK_USE_NONSTD_GETTER_KEY_ARGUMENT
-#else
-#define DUK_USE_NONSTD_GETTER_KEY_ARGUMENT
-#endif
-
-#if defined(DUK_OPT_NONSTD_JSON_ESC_U2028_U2029)
-#define DUK_USE_NONSTD_JSON_ESC_U2028_U2029
-#elif defined(DUK_OPT_NO_NONSTD_JSON_ESC_U2028_U2029)
-#undef DUK_USE_NONSTD_JSON_ESC_U2028_U2029
-#else
-#define DUK_USE_NONSTD_JSON_ESC_U2028_U2029
-#endif
-
-#if defined(DUK_OPT_NONSTD_REGEXP_DOLLAR_ESCAPE)
-#define DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE
-#elif defined(DUK_OPT_NO_NONSTD_REGEXP_DOLLAR_ESCAPE)
-#undef DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE
-#else
-#define DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE
-#endif
-
-#if defined(DUK_OPT_NONSTD_ACCESSOR_KEY_ARGUMENT)
-#define DUK_USE_NONSTD_SETTER_KEY_ARGUMENT
-#elif defined(DUK_OPT_NO_NONSTD_ACCESSOR_KEY_ARGUMENT)
-#undef DUK_USE_NONSTD_SETTER_KEY_ARGUMENT
-#else
-#define DUK_USE_NONSTD_SETTER_KEY_ARGUMENT
-#endif
-
-#if defined(DUK_OPT_NONSTD_STRING_FROMCHARCODE_32BIT)
-#define DUK_USE_NONSTD_STRING_FROMCHARCODE_32BIT
-#elif defined(DUK_OPT_NO_NONSTD_STRING_FROMCHARCODE_32BIT)
-#undef DUK_USE_NONSTD_STRING_FROMCHARCODE_32BIT
-#else
-#define DUK_USE_NONSTD_STRING_FROMCHARCODE_32BIT
-#endif
-
-#if defined(DUK_OPT_OBJSIZES16)
-#define DUK_USE_OBJSIZES16
-#elif defined(DUK_OPT_NO_OBJSIZES16)
-#undef DUK_USE_OBJSIZES16
-#else
-#undef DUK_USE_OBJSIZES16
-#endif
-
-#if defined(DUK_OPT_OCTAL_SUPPORT)
-#define DUK_USE_OCTAL_SUPPORT
-#elif defined(DUK_OPT_NO_OCTAL_SUPPORT)
-#undef DUK_USE_OCTAL_SUPPORT
-#else
-#define DUK_USE_OCTAL_SUPPORT
-#endif
-
-#if defined(DUK_OPT_PACKED_TVAL)
-#define DUK_USE_PACKED_TVAL
-#elif defined(DUK_OPT_NO_PACKED_TVAL)
-#undef DUK_USE_PACKED_TVAL
-#else
-/* Already provided above */
-#endif
-
-#undef DUK_USE_PANIC_ABORT
-#if !defined(DUK_OPT_SEGFAULT_ON_PANIC)
-#define DUK_USE_PANIC_ABORT
-#endif
-
-#undef DUK_USE_PANIC_HANDLER
-#if defined(DUK_OPT_PANIC_HANDLER)
-#define DUK_USE_PANIC_HANDLER(code,msg) DUK_OPT_PANIC_HANDLER((code),(msg))
-#endif
-
-#undef DUK_USE_PANIC_SEGFAULT
-#if defined(DUK_OPT_SEGFAULT_ON_PANIC)
-#define DUK_USE_PANIC_SEGFAULT
-#endif
-
-#if defined(DUK_OPT_PARANOID_ERRORS)
-#define DUK_USE_PARANOID_ERRORS
-#elif defined(DUK_OPT_NO_PARANOID_ERRORS)
-#undef DUK_USE_PARANOID_ERRORS
-#else
-#undef DUK_USE_PARANOID_ERRORS
-#endif
-
-#if defined(DUK_OPT_PC2LINE)
-#define DUK_USE_PC2LINE
-#elif defined(DUK_OPT_NO_PC2LINE)
-#undef DUK_USE_PC2LINE
-#else
-#define DUK_USE_PC2LINE
-#endif
-
-#if defined(DUK_OPT_REFCOUNT16)
-#define DUK_USE_REFCOUNT16
-#elif defined(DUK_OPT_NO_REFCOUNT16)
-#undef DUK_USE_REFCOUNT16
-#else
-#undef DUK_USE_REFCOUNT16
-#endif
-
-#if defined(DUK_OPT_REFERENCE_COUNTING)
-#define DUK_USE_REFERENCE_COUNTING
-#elif defined(DUK_OPT_NO_REFERENCE_COUNTING)
-#undef DUK_USE_REFERENCE_COUNTING
-#else
-#define DUK_USE_REFERENCE_COUNTING
-#endif
-
-#if defined(DUK_OPT_REGEXP_CANON_WORKAROUND)
-#define DUK_USE_REGEXP_CANON_WORKAROUND
-#elif defined(DUK_OPT_NO_REGEXP_CANON_WORKAROUND)
-#undef DUK_USE_REGEXP_CANON_WORKAROUND
-#else
-#undef DUK_USE_REGEXP_CANON_WORKAROUND
-#endif
-
-#if defined(DUK_OPT_REGEXP_SUPPORT)
-#define DUK_USE_REGEXP_SUPPORT
-#elif defined(DUK_OPT_NO_REGEXP_SUPPORT)
-#undef DUK_USE_REGEXP_SUPPORT
-#else
-#define DUK_USE_REGEXP_SUPPORT
-#endif
-
-#if defined(DUK_OPT_ROM_GLOBAL_CLONE)
-#define DUK_USE_ROM_GLOBAL_CLONE
-#elif defined(DUK_OPT_NO_ROM_GLOBAL_CLONE)
-#undef DUK_USE_ROM_GLOBAL_CLONE
-#else
-#undef DUK_USE_ROM_GLOBAL_CLONE
-#endif
-
-#if defined(DUK_OPT_ROM_GLOBAL_INHERIT)
-#define DUK_USE_ROM_GLOBAL_INHERIT
-#elif defined(DUK_OPT_NO_ROM_GLOBAL_INHERIT)
-#undef DUK_USE_ROM_GLOBAL_INHERIT
-#else
-#undef DUK_USE_ROM_GLOBAL_INHERIT
-#endif
-
-#if defined(DUK_OPT_ROM_OBJECTS)
-#define DUK_USE_ROM_OBJECTS
-#elif defined(DUK_OPT_NO_ROM_OBJECTS)
-#undef DUK_USE_ROM_OBJECTS
-#else
-#undef DUK_USE_ROM_OBJECTS
-#endif
-
-#if defined(DUK_OPT_ROM_STRINGS)
-#define DUK_USE_ROM_STRINGS
-#elif defined(DUK_OPT_NO_ROM_STRINGS)
-#undef DUK_USE_ROM_STRINGS
-#else
-#undef DUK_USE_ROM_STRINGS
-#endif
-
-#if defined(DUK_OPT_SECTION_B)
-#define DUK_USE_SECTION_B
-#elif defined(DUK_OPT_NO_SECTION_B)
-#undef DUK_USE_SECTION_B
-#else
-#define DUK_USE_SECTION_B
-#endif
-
-#if defined(DUK_OPT_SELF_TESTS)
-#define DUK_USE_SELF_TESTS
-#elif defined(DUK_OPT_NO_SELF_TESTS)
-#undef DUK_USE_SELF_TESTS
-#else
-#undef DUK_USE_SELF_TESTS
-#endif
-
-#if defined(DUK_OPT_SHUFFLE_TORTURE)
-#define DUK_USE_SHUFFLE_TORTURE
-#elif defined(DUK_OPT_NO_SHUFFLE_TORTURE)
-#undef DUK_USE_SHUFFLE_TORTURE
-#else
-#undef DUK_USE_SHUFFLE_TORTURE
-#endif
-
-#if defined(DUK_OPT_SOURCE_NONBMP)
-#define DUK_USE_SOURCE_NONBMP
-#elif defined(DUK_OPT_NO_SOURCE_NONBMP)
-#undef DUK_USE_SOURCE_NONBMP
-#else
-#define DUK_USE_SOURCE_NONBMP
-#endif
-
-#if defined(DUK_OPT_STRHASH16)
-#define DUK_USE_STRHASH16
-#elif defined(DUK_OPT_NO_STRHASH16)
-#undef DUK_USE_STRHASH16
-#else
-#undef DUK_USE_STRHASH16
-#endif
-
-#if defined(DUK_OPT_STRICT_DECL)
-#define DUK_USE_STRICT_DECL
-#elif defined(DUK_OPT_NO_STRICT_DECL)
-#undef DUK_USE_STRICT_DECL
-#else
-#define DUK_USE_STRICT_DECL
-#endif
-
-#if defined(DUK_OPT_STRICT_UTF8_SOURCE)
-#define DUK_USE_STRICT_UTF8_SOURCE
-#elif defined(DUK_OPT_NO_STRICT_UTF8_SOURCE)
-#undef DUK_USE_STRICT_UTF8_SOURCE
-#else
-#undef DUK_USE_STRICT_UTF8_SOURCE
-#endif
-
-#if defined(DUK_OPT_STRLEN16)
-#define DUK_USE_STRLEN16
-#elif defined(DUK_OPT_NO_STRLEN16)
-#undef DUK_USE_STRLEN16
-#else
-#undef DUK_USE_STRLEN16
-#endif
-
-#undef DUK_USE_STRTAB_CHAIN
-#if defined(DUK_OPT_STRTAB_CHAIN) && defined(DUK_OPT_STRTAB_CHAIN_SIZE)
-#define DUK_USE_STRTAB_CHAIN
-#endif
-
-#undef DUK_USE_STRTAB_CHAIN_SIZE
-#if defined(DUK_OPT_STRTAB_CHAIN) && defined(DUK_OPT_STRTAB_CHAIN_SIZE)
-/* Low memory algorithm: separate chaining using arrays, fixed size hash */
-#define DUK_USE_STRTAB_CHAIN_SIZE DUK_OPT_STRTAB_CHAIN_SIZE
-#endif
-
-#undef DUK_USE_STRTAB_PROBE
-#if !(defined(DUK_OPT_STRTAB_CHAIN) && defined(DUK_OPT_STRTAB_CHAIN_SIZE))
-#define DUK_USE_STRTAB_PROBE
-#endif
-
-#if defined(DUK_OPT_NONSTD_FUNC_CALLER_PROPERTY)
-#undef DUK_USE_TAILCALL
-#else
-#define DUK_USE_TAILCALL
-#endif
-
-#if defined(DUK_OPT_TARGET_INFO)
-#define DUK_USE_TARGET_INFO DUK_OPT_TARGET_INFO
-#else
-#define DUK_USE_TARGET_INFO "unknown"
-#endif
-
-#if defined(DUK_OPT_NO_AUGMENT_ERRORS)
-#undef DUK_USE_TRACEBACKS
-#elif defined(DUK_OPT_NO_TRACEBACKS)
-#undef DUK_USE_TRACEBACKS
-#else
-#define DUK_USE_TRACEBACKS
-#endif
-
-#if defined(DUK_OPT_TRACEBACK_DEPTH)
-#define DUK_USE_TRACEBACK_DEPTH DUK_OPT_TRACEBACK_DEPTH
-#else
-#define DUK_USE_TRACEBACK_DEPTH 10
-#endif
-
-#if defined(DUK_OPT_DECLARE)
-#define DUK_USE_USER_DECLARE() DUK_OPT_DECLARE
-#else
-#define DUK_USE_USER_DECLARE() /* no user declarations */
-#endif
-
-/* User provided InitJS. */
-#undef DUK_USE_USER_INITJS
-#if defined(DUK_OPT_USER_INITJS)
-#define DUK_USE_USER_INITJS (DUK_OPT_USER_INITJS)
-#endif
-
-#if defined(DUK_OPT_VERBOSE_ERRORS)
-#define DUK_USE_VERBOSE_ERRORS
-#elif defined(DUK_OPT_NO_VERBOSE_ERRORS)
-#undef DUK_USE_VERBOSE_ERRORS
-#else
-#define DUK_USE_VERBOSE_ERRORS
-#endif
-
-#if defined(DUK_OPT_VOLUNTARY_GC)
-#define DUK_USE_VOLUNTARY_GC
-#elif defined(DUK_OPT_NO_VOLUNTARY_GC)
-#undef DUK_USE_VOLUNTARY_GC
-#else
-#define DUK_USE_VOLUNTARY_GC
-#endif
-
-#if defined(DUK_OPT_ZERO_BUFFER_DATA)
-#define DUK_USE_ZERO_BUFFER_DATA
-#elif defined(DUK_OPT_NO_ZERO_BUFFER_DATA)
-#undef DUK_USE_ZERO_BUFFER_DATA
-#else
-#define DUK_USE_ZERO_BUFFER_DATA
-#endif
-
-/*
- * Autogenerated defaults
- */
-
-#define DUK_USE_AVOID_PLATFORM_FUNCPTRS
-#define DUK_USE_BASE64_FASTPATH
-#define DUK_USE_BUILTIN_INITJS
-#define DUK_USE_COMPILER_RECLIMIT 2500
-#undef DUK_USE_DATE_FORMAT_STRING
-#undef DUK_USE_DATE_GET_LOCAL_TZOFFSET
-#undef DUK_USE_DATE_GET_NOW
-#undef DUK_USE_DATE_PARSE_STRING
-#undef DUK_USE_DATE_PRS_GETDATE
-#define DUK_USE_ESBC_LIMITS
-#define DUK_USE_ESBC_MAX_BYTES 2147418112L
-#define DUK_USE_ESBC_MAX_LINENUMBER 2147418112L
-#undef DUK_USE_EXEC_FUN_LOCAL
-#undef DUK_USE_EXPLICIT_NULL_INIT
-#define DUK_USE_FAST_REFCOUNT_DEFAULT
-#define DUK_USE_HEX_FASTPATH
-#define DUK_USE_IDCHAR_FASTPATH
-#undef DUK_USE_INTERRUPT_DEBUG_FIXUP
-#define DUK_USE_JSON_DECNUMBER_FASTPATH
-#define DUK_USE_JSON_DECSTRING_FASTPATH
-#define DUK_USE_JSON_DEC_RECLIMIT 1000
-#define DUK_USE_JSON_EATWHITE_FASTPATH
-#define DUK_USE_JSON_ENC_RECLIMIT 1000
-#define DUK_USE_JSON_QUOTESTRING_FASTPATH
-#define DUK_USE_LEXER_SLIDING_WINDOW
-#undef DUK_USE_MARKANDSWEEP_FINALIZER_TORTURE
-#define DUK_USE_MARK_AND_SWEEP_RECLIMIT 256
-#define DUK_USE_MATH_BUILTIN
-#define DUK_USE_NATIVE_CALL_RECLIMIT 1000
-#undef DUK_USE_PANIC_EXIT
-#undef DUK_USE_PREFER_SIZE
-#define DUK_USE_PROVIDE_DEFAULT_ALLOC_FUNCTIONS
-#undef DUK_USE_REFZERO_FINALIZER_TORTURE
-#define DUK_USE_REGEXP_COMPILER_RECLIMIT 10000
-#define DUK_USE_REGEXP_EXECUTOR_RECLIMIT 10000
-#define DUK_USE_ROM_PTRCOMP_FIRST 63488L
-#undef DUK_USE_STRHASH_DENSE
-#define DUK_USE_STRHASH_SKIP_SHIFT 5
-#undef DUK_USE_VALSTACK_UNSAFE
-#define DUK_USE_VERBOSE_EXECUTOR_ERRORS
-
-/*
- * Alternative customization header
- *
- * If you want to modify the final DUK_USE_xxx flags directly (without
- * using the available DUK_OPT_xxx flags), define DUK_OPT_HAVE_CUSTOM_H
- * and tweak the final flags there.
- */
-
-#if defined(DUK_OPT_HAVE_CUSTOM_H)
-#include "duk_custom.h"
-#endif
-
-/*
- * You may add overriding #define/#undef directives below for
- * customization. You of course cannot un-#include or un-typedef
- * anything; these require direct changes above.
- */
-
-/* __OVERRIDE_DEFINES__ */
-
-/*
- * Date provider selection
- *
- * User may define DUK_USE_DATE_GET_NOW() etc directly, in which case we'll
- * rely on an external provider. If this is not done, revert to previous
- * behavior and use Unix/Windows built-in provider.
- */
-
-#if defined(DUK_COMPILING_DUKTAPE)
-
-#if defined(DUK_USE_DATE_GET_NOW)
-/* External provider already defined. */
-#elif defined(DUK_USE_DATE_NOW_GETTIMEOFDAY)
-#define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_gettimeofday((ctx))
-#elif defined(DUK_USE_DATE_NOW_TIME)
-#define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_time((ctx))
-#elif defined(DUK_USE_DATE_NOW_WINDOWS)
-#define DUK_USE_DATE_GET_NOW(ctx) duk_bi_date_get_now_windows((ctx))
-#else
-#error no provider for DUK_USE_DATE_GET_NOW()
-#endif
-
-#if defined(DUK_USE_DATE_GET_LOCAL_TZOFFSET)
-/* External provider already defined. */
-#elif defined(DUK_USE_DATE_TZO_GMTIME_R) || defined(DUK_USE_DATE_TZO_GMTIME)
-#define DUK_USE_DATE_GET_LOCAL_TZOFFSET(d) duk_bi_date_get_local_tzoffset_gmtime((d))
-#elif defined(DUK_USE_DATE_TZO_WINDOWS)
-#define DUK_USE_DATE_GET_LOCAL_TZOFFSET(d) duk_bi_date_get_local_tzoffset_windows((d))
-#else
-#error no provider for DUK_USE_DATE_GET_LOCAL_TZOFFSET()
-#endif
-
-#if defined(DUK_USE_DATE_PARSE_STRING)
-/* External provider already defined. */
-#elif defined(DUK_USE_DATE_PRS_STRPTIME)
-#define DUK_USE_DATE_PARSE_STRING(ctx,str) duk_bi_date_parse_string_strptime((ctx), (str))
-#elif defined(DUK_USE_DATE_PRS_GETDATE)
-#define DUK_USE_DATE_PARSE_STRING(ctx,str) duk_bi_date_parse_string_getdate((ctx), (str))
-#else
-/* No provider for DUK_USE_DATE_PARSE_STRING(), fall back to ISO 8601 only. */
-#endif
-
-#if defined(DUK_USE_DATE_FORMAT_STRING)
-/* External provider already defined. */
-#elif defined(DUK_USE_DATE_FMT_STRFTIME)
-#define DUK_USE_DATE_FORMAT_STRING(ctx,parts,tzoffset,flags) \
- duk_bi_date_format_parts_strftime((ctx), (parts), (tzoffset), (flags))
-#else
-/* No provider for DUK_USE_DATE_FORMAT_STRING(), fall back to ISO 8601 only. */
-#endif
-
-#endif /* DUK_COMPILING_DUKTAPE */
-
-/*
- * Checks for config option consistency (DUK_USE_xxx)
- */
-
-#if defined(DUK_USE_32BIT_PTRS)
-#error unsupported config option used (option has been removed): DUK_USE_32BIT_PTRS
-#endif
-#if defined(DUK_USE_ALIGN_4)
-#error unsupported config option used (option has been removed): DUK_USE_ALIGN_4
-#endif
-#if defined(DUK_USE_ALIGN_8)
-#error unsupported config option used (option has been removed): DUK_USE_ALIGN_8
-#endif
-#if defined(DUK_USE_BYTEORDER_FORCED)
-#error unsupported config option used (option has been removed): DUK_USE_BYTEORDER_FORCED
-#endif
-#if defined(DUK_USE_DATAPTR_DEC16) && !defined(DUK_USE_DATAPTR16)
-#error config option DUK_USE_DATAPTR_DEC16 requires option DUK_USE_DATAPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_DATAPTR_ENC16) && !defined(DUK_USE_DATAPTR16)
-#error config option DUK_USE_DATAPTR_ENC16 requires option DUK_USE_DATAPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_DEBUGGER_SUPPORT) && !defined(DUK_USE_INTERRUPT_COUNTER)
-#error config option DUK_USE_DEBUGGER_SUPPORT requires option DUK_USE_INTERRUPT_COUNTER (which is missing)
-#endif
-#if defined(DUK_USE_DEEP_C_STACK)
-#error unsupported config option used (option has been removed): DUK_USE_DEEP_C_STACK
-#endif
-#if defined(DUK_USE_DOUBLE_BE)
-#error unsupported config option used (option has been removed): DUK_USE_DOUBLE_BE
-#endif
-#if defined(DUK_USE_DOUBLE_BE) && defined(DUK_USE_DOUBLE_LE)
-#error config option DUK_USE_DOUBLE_BE conflicts with option DUK_USE_DOUBLE_LE (which is also defined)
-#endif
-#if defined(DUK_USE_DOUBLE_BE) && defined(DUK_USE_DOUBLE_ME)
-#error config option DUK_USE_DOUBLE_BE conflicts with option DUK_USE_DOUBLE_ME (which is also defined)
-#endif
-#if defined(DUK_USE_DOUBLE_LE)
-#error unsupported config option used (option has been removed): DUK_USE_DOUBLE_LE
-#endif
-#if defined(DUK_USE_DOUBLE_LE) && defined(DUK_USE_DOUBLE_BE)
-#error config option DUK_USE_DOUBLE_LE conflicts with option DUK_USE_DOUBLE_BE (which is also defined)
-#endif
-#if defined(DUK_USE_DOUBLE_LE) && defined(DUK_USE_DOUBLE_ME)
-#error config option DUK_USE_DOUBLE_LE conflicts with option DUK_USE_DOUBLE_ME (which is also defined)
-#endif
-#if defined(DUK_USE_DOUBLE_ME)
-#error unsupported config option used (option has been removed): DUK_USE_DOUBLE_ME
-#endif
-#if defined(DUK_USE_DOUBLE_ME) && defined(DUK_USE_DOUBLE_LE)
-#error config option DUK_USE_DOUBLE_ME conflicts with option DUK_USE_DOUBLE_LE (which is also defined)
-#endif
-#if defined(DUK_USE_DOUBLE_ME) && defined(DUK_USE_DOUBLE_BE)
-#error config option DUK_USE_DOUBLE_ME conflicts with option DUK_USE_DOUBLE_BE (which is also defined)
-#endif
-#if defined(DUK_USE_DPRINT) && !defined(DUK_USE_DEBUG)
-#error config option DUK_USE_DPRINT requires option DUK_USE_DEBUG (which is missing)
-#endif
-#if defined(DUK_USE_ESBC_MAX_BYTES) && !defined(DUK_USE_ESBC_LIMITS)
-#error config option DUK_USE_ESBC_MAX_BYTES requires option DUK_USE_ESBC_LIMITS (which is missing)
-#endif
-#if defined(DUK_USE_ESBC_MAX_LINENUMBER) && !defined(DUK_USE_ESBC_LIMITS)
-#error config option DUK_USE_ESBC_MAX_LINENUMBER requires option DUK_USE_ESBC_LIMITS (which is missing)
-#endif
-#if defined(DUK_USE_EXEC_TIMEOUT_CHECK) && !defined(DUK_USE_INTERRUPT_COUNTER)
-#error config option DUK_USE_EXEC_TIMEOUT_CHECK requires option DUK_USE_INTERRUPT_COUNTER (which is missing)
-#endif
-#if defined(DUK_USE_EXTSTR_FREE) && !defined(DUK_USE_HSTRING_EXTDATA)
-#error config option DUK_USE_EXTSTR_FREE requires option DUK_USE_HSTRING_EXTDATA (which is missing)
-#endif
-#if defined(DUK_USE_EXTSTR_INTERN_CHECK) && !defined(DUK_USE_HSTRING_EXTDATA)
-#error config option DUK_USE_EXTSTR_INTERN_CHECK requires option DUK_USE_HSTRING_EXTDATA (which is missing)
-#endif
-#if defined(DUK_USE_FULL_TVAL)
-#error unsupported config option used (option has been removed): DUK_USE_FULL_TVAL
-#endif
-#if defined(DUK_USE_FUNCPTR_DEC16) && !defined(DUK_USE_FUNCPTR16)
-#error config option DUK_USE_FUNCPTR_DEC16 requires option DUK_USE_FUNCPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_FUNCPTR_ENC16) && !defined(DUK_USE_FUNCPTR16)
-#error config option DUK_USE_FUNCPTR_ENC16 requires option DUK_USE_FUNCPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_HASHBYTES_UNALIGNED_U32_ACCESS)
-#error unsupported config option used (option has been removed): DUK_USE_HASHBYTES_UNALIGNED_U32_ACCESS
-#endif
-#if defined(DUK_USE_HEAPPTR16) && defined(DUK_USE_DEBUG)
-#error config option DUK_USE_HEAPPTR16 conflicts with option DUK_USE_DEBUG (which is also defined)
-#endif
-#if defined(DUK_USE_HEAPPTR_DEC16) && !defined(DUK_USE_HEAPPTR16)
-#error config option DUK_USE_HEAPPTR_DEC16 requires option DUK_USE_HEAPPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_HEAPPTR_ENC16) && !defined(DUK_USE_HEAPPTR16)
-#error config option DUK_USE_HEAPPTR_ENC16 requires option DUK_USE_HEAPPTR16 (which is missing)
-#endif
-#if defined(DUK_USE_INTEGER_BE)
-#error unsupported config option used (option has been removed): DUK_USE_INTEGER_BE
-#endif
-#if defined(DUK_USE_INTEGER_BE) && defined(DUK_USE_INTEGER_LE)
-#error config option DUK_USE_INTEGER_BE conflicts with option DUK_USE_INTEGER_LE (which is also defined)
-#endif
-#if defined(DUK_USE_INTEGER_BE) && defined(DUK_USE_INTEGER_ME)
-#error config option DUK_USE_INTEGER_BE conflicts with option DUK_USE_INTEGER_ME (which is also defined)
-#endif
-#if defined(DUK_USE_INTEGER_LE)
-#error unsupported config option used (option has been removed): DUK_USE_INTEGER_LE
-#endif
-#if defined(DUK_USE_INTEGER_LE) && defined(DUK_USE_INTEGER_BE)
-#error config option DUK_USE_INTEGER_LE conflicts with option DUK_USE_INTEGER_BE (which is also defined)
-#endif
-#if defined(DUK_USE_INTEGER_LE) && defined(DUK_USE_INTEGER_ME)
-#error config option DUK_USE_INTEGER_LE conflicts with option DUK_USE_INTEGER_ME (which is also defined)
-#endif
-#if defined(DUK_USE_INTEGER_ME)
-#error unsupported config option used (option has been removed): DUK_USE_INTEGER_ME
-#endif
-#if defined(DUK_USE_INTEGER_ME) && defined(DUK_USE_INTEGER_LE)
-#error config option DUK_USE_INTEGER_ME conflicts with option DUK_USE_INTEGER_LE (which is also defined)
-#endif
-#if defined(DUK_USE_INTEGER_ME) && defined(DUK_USE_INTEGER_BE)
-#error config option DUK_USE_INTEGER_ME conflicts with option DUK_USE_INTEGER_BE (which is also defined)
-#endif
-#if defined(DUK_USE_NO_DOUBLE_ALIASING_SELFTEST)
-#error unsupported config option used (option has been removed): DUK_USE_NO_DOUBLE_ALIASING_SELFTEST
-#endif
-#if defined(DUK_USE_PACKED_TVAL_POSSIBLE)
-#error unsupported config option used (option has been removed): DUK_USE_PACKED_TVAL_POSSIBLE
-#endif
-#if defined(DUK_USE_RDTSC)
-#error unsupported config option used (option has been removed): DUK_USE_RDTSC
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_CLONE) && !defined(DUK_USE_ROM_STRINGS)
-#error config option DUK_USE_ROM_GLOBAL_CLONE requires option DUK_USE_ROM_STRINGS (which is missing)
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_CLONE) && !defined(DUK_USE_ROM_OBJECTS)
-#error config option DUK_USE_ROM_GLOBAL_CLONE requires option DUK_USE_ROM_OBJECTS (which is missing)
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_CLONE) && defined(DUK_USE_ROM_GLOBAL_INHERIT)
-#error config option DUK_USE_ROM_GLOBAL_CLONE conflicts with option DUK_USE_ROM_GLOBAL_INHERIT (which is also defined)
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_INHERIT) && !defined(DUK_USE_ROM_STRINGS)
-#error config option DUK_USE_ROM_GLOBAL_INHERIT requires option DUK_USE_ROM_STRINGS (which is missing)
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_INHERIT) && !defined(DUK_USE_ROM_OBJECTS)
-#error config option DUK_USE_ROM_GLOBAL_INHERIT requires option DUK_USE_ROM_OBJECTS (which is missing)
-#endif
-#if defined(DUK_USE_ROM_GLOBAL_INHERIT) && defined(DUK_USE_ROM_GLOBAL_CLONE)
-#error config option DUK_USE_ROM_GLOBAL_INHERIT conflicts with option DUK_USE_ROM_GLOBAL_CLONE (which is also defined)
-#endif
-#if defined(DUK_USE_ROM_OBJECTS) && !defined(DUK_USE_ROM_STRINGS)
-#error config option DUK_USE_ROM_OBJECTS requires option DUK_USE_ROM_STRINGS (which is missing)
-#endif
-#if defined(DUK_USE_ROM_STRINGS) && !defined(DUK_USE_ROM_OBJECTS)
-#error config option DUK_USE_ROM_STRINGS requires option DUK_USE_ROM_OBJECTS (which is missing)
-#endif
-#if defined(DUK_USE_SETJMP)
-#error unsupported config option used (option has been removed): DUK_USE_SETJMP
-#endif
-#if defined(DUK_USE_SIGSETJMP)
-#error unsupported config option used (option has been removed): DUK_USE_SIGSETJMP
-#endif
-#if defined(DUK_USE_STRTAB_CHAIN_SIZE) && !defined(DUK_USE_STRTAB_CHAIN)
-#error config option DUK_USE_STRTAB_CHAIN_SIZE requires option DUK_USE_STRTAB_CHAIN (which is missing)
-#endif
-#if defined(DUK_USE_TAILCALL) && defined(DUK_USE_NONSTD_FUNC_CALLER_PROPERTY)
-#error config option DUK_USE_TAILCALL conflicts with option DUK_USE_NONSTD_FUNC_CALLER_PROPERTY (which is also defined)
-#endif
-#if defined(DUK_USE_UNALIGNED_ACCESSES_POSSIBLE)
-#error unsupported config option used (option has been removed): DUK_USE_UNALIGNED_ACCESSES_POSSIBLE
-#endif
-#if defined(DUK_USE_UNDERSCORE_SETJMP)
-#error unsupported config option used (option has been removed): DUK_USE_UNDERSCORE_SETJMP
-#endif
-
-#if defined(DUK_USE_CPP_EXCEPTIONS) && !defined(__cplusplus)
-#error DUK_USE_CPP_EXCEPTIONS enabled but not compiling with a C++ compiler
-#endif
-
-/*
- * Convert DUK_USE_BYTEORDER, from whatever source, into currently used
- * internal defines. If detection failed, #error out.
- */
-
-#if defined(DUK_USE_BYTEORDER)
-#if (DUK_USE_BYTEORDER == 1)
-#define DUK_USE_INTEGER_LE
-#define DUK_USE_DOUBLE_LE
-#elif (DUK_USE_BYTEORDER == 2)
-#define DUK_USE_INTEGER_LE /* integer endianness is little on purpose */
-#define DUK_USE_DOUBLE_ME
-#elif (DUK_USE_BYTEORDER == 3)
-#define DUK_USE_INTEGER_BE
-#define DUK_USE_DOUBLE_BE
-#else
-#error unsupported: byte order invalid
-#endif /* byte order */
-#else
-#error unsupported: byte order detection failed
-#endif /* defined(DUK_USE_BYTEORDER) */
-
-#endif /* DUK_CONFIG_H_INCLUDED */
diff --git a/javascript/duktape/duk_custom.h b/javascript/duktape/duk_custom.h
deleted file mode 100644
index 1f98b7825..000000000
--- a/javascript/duktape/duk_custom.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015 Daniel Silverstone <dsilvers@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Custom configuration for duktape
- */
-
-#include "utils/config.h"
-
-#ifndef HAVE_STRPTIME
-#undef DUK_USE_DATE_PRS_STRPTIME
-#undef DUK_USE_DATE_PRS_GETDATE
-#undef DUK_USE_DATE_PARSE_STRING
-#endif
-
-#define DUK_USE_REGEXP_CANON_WORKAROUND
-
-/* Required for execution timeout checking */
-#define DUK_USE_INTERRUPT_COUNTER
-
-extern duk_bool_t dukky_check_timeout(void *udata);
-#define DUK_USE_EXEC_TIMEOUT_CHECK dukky_check_timeout
diff --git a/javascript/duktape/dukky.c b/javascript/duktape/dukky.c
deleted file mode 100644
index 7dd3bd71e..000000000
--- a/javascript/duktape/dukky.c
+++ /dev/null
@@ -1,1135 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
- * Copyright 2015 Daniel Dilverstone <dsilvers@netsurf-browser.org>
- * Copyright 2016 Michael Drake <tlsa@netsurf-browser.org>
- * Copyright 2016 John-Mark Bell <jmb@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Duktapeish implementation of javascript engine functions.
- */
-
-#include <inttypes.h>
-
-#include <nsutils/time.h>
-
-#include "content/content.h"
-
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "utils/log.h"
-#include "utils/corestrings.h"
-
-#include "javascript/js.h"
-#include "javascript/content.h"
-
-#include "duktape/binding.h"
-
-#include "duktape.h"
-#include "dukky.h"
-
-#include <dom/dom.h>
-
-#define EVENT_MAGIC MAGIC(EVENT_MAP)
-#define HANDLER_LISTENER_MAGIC MAGIC(HANDLER_LISTENER_MAP)
-#define HANDLER_MAGIC MAGIC(HANDLER_MAP)
-
-static duk_ret_t dukky_populate_object(duk_context *ctx)
-{
- /* ... obj args protoname nargs */
- int nargs = duk_get_int(ctx, -1);
- duk_pop(ctx);
- /* ... obj args protoname */
- duk_get_global_string(ctx, PROTO_MAGIC);
- /* .. obj args protoname prototab */
- duk_insert(ctx, -2);
- /* ... obj args prototab protoname */
- duk_get_prop(ctx, -2);
- /* ... obj args prototab {proto/undefined} */
- if (duk_is_undefined(ctx, -1)) {
- LOG("RuhRoh, couldn't find a prototype, HTMLUnknownElement it is");
- duk_pop(ctx);
- duk_push_string(ctx, PROTO_NAME(HTMLUNKNOWNELEMENT));
- duk_get_prop(ctx, -2);
- }
- /* ... obj args prototab proto */
- duk_dup(ctx, -1);
- /* ... obj args prototab proto proto */
- duk_set_prototype(ctx, -(nargs+4));
- /* ... obj[proto] args prototab proto */
- duk_get_prop_string(ctx, -1, INIT_MAGIC);
- /* ... obj[proto] args prototab proto initfn */
- duk_insert(ctx, -(nargs+4));
- /* ... initfn obj[proto] args prototab proto */
- duk_pop_2(ctx);
- /* ... initfn obj[proto] args */
- LOG("Call the init function");
- duk_call(ctx, nargs + 1);
- return 1; /* The object */
-}
-
-duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
-{
- duk_ret_t ret;
- LOG("name=%s nargs=%d", name+2, args);
- /* ... args */
- duk_push_object(ctx);
- /* ... args obj */
- duk_push_object(ctx);
- /* ... args obj handlers */
- duk_put_prop_string(ctx, -2, HANDLER_LISTENER_MAGIC);
- /* ... args obj */
- duk_push_object(ctx);
- /* ... args obj handlers */
- duk_put_prop_string(ctx, -2, HANDLER_MAGIC);
- /* ... args obj */
- duk_insert(ctx, -(args+1));
- /* ... obj args */
- duk_push_string(ctx, name);
- /* ... obj args name */
- duk_push_int(ctx, args);
- /* ... obj args name nargs */
- if ((ret = duk_safe_call(ctx, dukky_populate_object, args + 3, 1))
- != DUK_EXEC_SUCCESS)
- return ret;
- LOG("created");
- return DUK_EXEC_SUCCESS;
-}
-
-
-
-duk_bool_t
-dukky_push_node_stacked(duk_context *ctx)
-{
- int top_at_fail = duk_get_top(ctx) - 2;
- /* ... nodeptr klass */
- duk_get_global_string(ctx, NODE_MAGIC);
- /* ... nodeptr klass nodes */
- duk_dup(ctx, -3);
- /* ... nodeptr klass nodes nodeptr */
- duk_get_prop(ctx, -2);
- /* ... nodeptr klass nodes node/undefined */
- if (duk_is_undefined(ctx, -1)) {
- /* ... nodeptr klass nodes undefined */
- duk_pop(ctx);
- /* ... nodeptr klass nodes */
- duk_push_object(ctx);
- /* ... nodeptr klass nodes obj */
- duk_push_object(ctx);
- /* ... nodeptr klass nodes obj handlers */
- duk_put_prop_string(ctx, -2, HANDLER_LISTENER_MAGIC);
- /* ... nodeptr klass nodes obj */
- duk_push_object(ctx);
- /* ... nodeptr klass nodes obj handlers */
- duk_put_prop_string(ctx, -2, HANDLER_MAGIC);
- /* ... nodeptr klass nodes obj */
- duk_dup(ctx, -4);
- /* ... nodeptr klass nodes obj nodeptr */
- duk_dup(ctx, -4);
- /* ... nodeptr klass nodes obj nodeptr klass */
- duk_push_int(ctx, 1);
- /* ... nodeptr klass nodes obj nodeptr klass 1 */
- if (duk_safe_call(ctx, dukky_populate_object, 4, 1)
- != DUK_EXEC_SUCCESS) {
- duk_set_top(ctx, top_at_fail);
- LOG("Boo and also hiss");
- return false;
- }
- /* ... nodeptr klass nodes node */
- duk_dup(ctx, -4);
- /* ... nodeptr klass nodes node nodeptr */
- duk_dup(ctx, -2);
- /* ... nodeptr klass nodes node nodeptr node */
- duk_put_prop(ctx, -4);
- /* ... nodeptr klass nodes node */
- }
- /* ... nodeptr klass nodes node */
- duk_insert(ctx, -4);
- /* ... node nodeptr klass nodes */
- duk_pop_3(ctx);
- /* ... node */
- return true;
-}
-
-#define SET_HTML_CLASS(CLASS) \
- *html_class = PROTO_NAME(HTML##CLASS##ELEMENT); \
- *html_class_len = \
- SLEN(PROTO_NAME(HTML)) + \
- SLEN(#CLASS) + \
- SLEN("ELEMENT");
-
-static void dukky_html_element_class_from_tag_type(dom_html_element_type type,
- const char **html_class, size_t *html_class_len)
-{
- switch(type) {
- case DOM_HTML_ELEMENT_TYPE_HTML:
- SET_HTML_CLASS(HTML)
- break;
- case DOM_HTML_ELEMENT_TYPE_HEAD:
- SET_HTML_CLASS(HEAD)
- break;
- case DOM_HTML_ELEMENT_TYPE_META:
- SET_HTML_CLASS(META)
- break;
- case DOM_HTML_ELEMENT_TYPE_BASE:
- SET_HTML_CLASS(BASE)
- break;
- case DOM_HTML_ELEMENT_TYPE_TITLE:
- SET_HTML_CLASS(TITLE)
- break;
- case DOM_HTML_ELEMENT_TYPE_BODY:
- SET_HTML_CLASS(BODY)
- break;
- case DOM_HTML_ELEMENT_TYPE_DIV:
- SET_HTML_CLASS(DIV)
- break;
- case DOM_HTML_ELEMENT_TYPE_FORM:
- SET_HTML_CLASS(FORM)
- break;
- case DOM_HTML_ELEMENT_TYPE_LINK:
- SET_HTML_CLASS(LINK)
- break;
- case DOM_HTML_ELEMENT_TYPE_BUTTON:
- SET_HTML_CLASS(BUTTOM)
- break;
- case DOM_HTML_ELEMENT_TYPE_INPUT:
- SET_HTML_CLASS(INPUT)
- break;
- case DOM_HTML_ELEMENT_TYPE_TEXTAREA:
- SET_HTML_CLASS(TEXTAREA)
- break;
- case DOM_HTML_ELEMENT_TYPE_OPTGROUP:
- SET_HTML_CLASS(OPTGROUP)
- break;
- case DOM_HTML_ELEMENT_TYPE_OPTION:
- SET_HTML_CLASS(OPTION)
- break;
- case DOM_HTML_ELEMENT_TYPE_SELECT:
- SET_HTML_CLASS(SELECT)
- break;
- case DOM_HTML_ELEMENT_TYPE_HR:
- SET_HTML_CLASS(HR)
- break;
- case DOM_HTML_ELEMENT_TYPE_DL:
- SET_HTML_CLASS(DLIST)
- break;
- case DOM_HTML_ELEMENT_TYPE_DIR:
- SET_HTML_CLASS(DIRECTORY)
- break;
- case DOM_HTML_ELEMENT_TYPE_MENU:
- SET_HTML_CLASS(MENU)
- break;
- case DOM_HTML_ELEMENT_TYPE_FIELDSET:
- SET_HTML_CLASS(FIELDSET)
- break;
- case DOM_HTML_ELEMENT_TYPE_LEGEND:
- SET_HTML_CLASS(LEGEND)
- break;
- case DOM_HTML_ELEMENT_TYPE_P:
- SET_HTML_CLASS(PARAGRAPH)
- break;
- case DOM_HTML_ELEMENT_TYPE_H1:
- case DOM_HTML_ELEMENT_TYPE_H2:
- case DOM_HTML_ELEMENT_TYPE_H3:
- case DOM_HTML_ELEMENT_TYPE_H4:
- case DOM_HTML_ELEMENT_TYPE_H5:
- case DOM_HTML_ELEMENT_TYPE_H6:
- SET_HTML_CLASS(HEADING)
- break;
- case DOM_HTML_ELEMENT_TYPE_BLOCKQUOTE:
- case DOM_HTML_ELEMENT_TYPE_Q:
- SET_HTML_CLASS(QUOTE)
- break;
- case DOM_HTML_ELEMENT_TYPE_PRE:
- SET_HTML_CLASS(PRE)
- break;
- case DOM_HTML_ELEMENT_TYPE_BR:
- SET_HTML_CLASS(BR)
- break;
- case DOM_HTML_ELEMENT_TYPE_LABEL:
- SET_HTML_CLASS(LABEL)
- break;
- case DOM_HTML_ELEMENT_TYPE_UL:
- SET_HTML_CLASS(ULIST)
- break;
- case DOM_HTML_ELEMENT_TYPE_OL:
- SET_HTML_CLASS(OLIST)
- break;
- case DOM_HTML_ELEMENT_TYPE_LI:
- SET_HTML_CLASS(LI)
- break;
- case DOM_HTML_ELEMENT_TYPE_FONT:
- SET_HTML_CLASS(FONT)
- break;
- case DOM_HTML_ELEMENT_TYPE_DEL:
- case DOM_HTML_ELEMENT_TYPE_INS:
- SET_HTML_CLASS(MOD)
- break;
- case DOM_HTML_ELEMENT_TYPE_A:
- SET_HTML_CLASS(ANCHOR)
- break;
- case DOM_HTML_ELEMENT_TYPE_BASEFONT:
- SET_HTML_CLASS(BASEFONT)
- break;
- case DOM_HTML_ELEMENT_TYPE_IMG:
- SET_HTML_CLASS(IMAGE)
- break;
- case DOM_HTML_ELEMENT_TYPE_OBJECT:
- SET_HTML_CLASS(OBJECT)
- break;
- case DOM_HTML_ELEMENT_TYPE_PARAM:
- SET_HTML_CLASS(PARAM)
- break;
- case DOM_HTML_ELEMENT_TYPE_APPLET:
- SET_HTML_CLASS(APPLET)
- break;
- case DOM_HTML_ELEMENT_TYPE_MAP:
- SET_HTML_CLASS(MAP)
- break;
- case DOM_HTML_ELEMENT_TYPE_AREA:
- SET_HTML_CLASS(AREA)
- break;
- case DOM_HTML_ELEMENT_TYPE_SCRIPT:
- SET_HTML_CLASS(SCRIPT)
- break;
- case DOM_HTML_ELEMENT_TYPE_CAPTION:
- SET_HTML_CLASS(TABLECAPTION)
- break;
- case DOM_HTML_ELEMENT_TYPE_TD:
- case DOM_HTML_ELEMENT_TYPE_TH:
- SET_HTML_CLASS(TABLECELL)
- break;
- case DOM_HTML_ELEMENT_TYPE_COL:
- case DOM_HTML_ELEMENT_TYPE_COLGROUP:
- SET_HTML_CLASS(TABLECOL)
- break;
- case DOM_HTML_ELEMENT_TYPE_THEAD:
- case DOM_HTML_ELEMENT_TYPE_TBODY:
- case DOM_HTML_ELEMENT_TYPE_TFOOT:
- SET_HTML_CLASS(TABLESECTION)
- break;
- case DOM_HTML_ELEMENT_TYPE_TABLE:
- SET_HTML_CLASS(TABLE)
- break;
- case DOM_HTML_ELEMENT_TYPE_TR:
- SET_HTML_CLASS(TABLEROW)
- break;
- case DOM_HTML_ELEMENT_TYPE_STYLE:
- SET_HTML_CLASS(STYLE)
- break;
- case DOM_HTML_ELEMENT_TYPE_FRAMESET:
- SET_HTML_CLASS(FRAMESET)
- break;
- case DOM_HTML_ELEMENT_TYPE_FRAME:
- SET_HTML_CLASS(FRAME)
- break;
- case DOM_HTML_ELEMENT_TYPE_IFRAME:
- SET_HTML_CLASS(IFRAME)
- break;
- case DOM_HTML_ELEMENT_TYPE_ISINDEX:
- SET_HTML_CLASS(ISINDEX)
- break;
- case DOM_HTML_ELEMENT_TYPE__COUNT:
- assert(type != DOM_HTML_ELEMENT_TYPE__COUNT);
- /* fallthrough */
- case DOM_HTML_ELEMENT_TYPE__UNKNOWN:
- SET_HTML_CLASS(UNKNOWN)
- break;
- default:
- /* Known HTML element without a specialisation */
- *html_class = PROTO_NAME(HTMLELEMENT);
- *html_class_len =
- SLEN(PROTO_NAME(HTML)) +
- SLEN("ELEMENT");
- break;
- }
- return;
-}
-
-#undef SET_HTML_CLASS
-
-static void
-dukky_push_node_klass(duk_context *ctx, struct dom_node *node)
-{
- dom_node_type nodetype;
- dom_exception err;
-
- err = dom_node_get_node_type(node, &nodetype);
- if (err != DOM_NO_ERR) {
- /* Oh bum, just node then */
- duk_push_string(ctx, PROTO_NAME(NODE));
- return;
- }
-
- switch(nodetype) {
- case DOM_ELEMENT_NODE: {
- dom_string *namespace;
- dom_html_element_type type;
- const char *html_class;
- size_t html_class_len;
- err = dom_node_get_namespace(node, &namespace);
- if (err != DOM_NO_ERR) {
- /* Feck it, element */
- LOG("dom_node_get_namespace() failed");
- duk_push_string(ctx, PROTO_NAME(ELEMENT));
- break;
- }
- if (namespace == NULL) {
- /* No namespace, -> element */
- LOG("no namespace");
- duk_push_string(ctx, PROTO_NAME(ELEMENT));
- break;
- }
-
- if (dom_string_isequal(namespace, corestring_dom_html_namespace) == false) {
- /* definitely not an HTML element of some kind */
- duk_push_string(ctx, PROTO_NAME(ELEMENT));
- dom_string_unref(namespace);
- break;
- }
- dom_string_unref(namespace);
-
- err = dom_html_element_get_tag_type(node, &type);
- if (err != DOM_NO_ERR) {
- type = DOM_HTML_ELEMENT_TYPE__UNKNOWN;
- }
-
- dukky_html_element_class_from_tag_type(type,
- &html_class, &html_class_len);
-
- duk_push_lstring(ctx, html_class, html_class_len);
- break;
- }
- case DOM_TEXT_NODE:
- duk_push_string(ctx, PROTO_NAME(TEXT));
- break;
- case DOM_COMMENT_NODE:
- duk_push_string(ctx, PROTO_NAME(COMMENT));
- break;
- case DOM_DOCUMENT_NODE:
- duk_push_string(ctx, PROTO_NAME(DOCUMENT));
- break;
- case DOM_ATTRIBUTE_NODE:
- case DOM_PROCESSING_INSTRUCTION_NODE:
- case DOM_DOCUMENT_TYPE_NODE:
- case DOM_DOCUMENT_FRAGMENT_NODE:
- case DOM_NOTATION_NODE:
- case DOM_ENTITY_REFERENCE_NODE:
- case DOM_ENTITY_NODE:
- case DOM_CDATA_SECTION_NODE:
- default:
- /* Oh bum, just node then */
- duk_push_string(ctx, PROTO_NAME(NODE));
- }
-}
-
-duk_bool_t
-dukky_push_node(duk_context *ctx, struct dom_node *node)
-{
- JS_LOG("Pushing node %p", node);
- /* First check if we can find the node */
- /* ... */
- duk_get_global_string(ctx, NODE_MAGIC);
- /* ... nodes */
- duk_push_pointer(ctx, node);
- /* ... nodes nodeptr */
- duk_get_prop(ctx, -2);
- /* ... nodes node/undefined */
- if (!duk_is_undefined(ctx, -1)) {
- /* ... nodes node */
- duk_insert(ctx, -2);
- /* ... node nodes */
- duk_pop(ctx);
- /* ... node */
- JS_LOG("Found it memoised");
- return true;
- }
- /* ... nodes undefined */
- duk_pop_2(ctx);
- /* ... */
- /* We couldn't, so now we determine the node type and then
- * we ask for it to be created
- */
- duk_push_pointer(ctx, node);
- /* ... nodeptr */
- dukky_push_node_klass(ctx, node);
- /* ... nodeptr klass */
- return dukky_push_node_stacked(ctx);
-}
-
-static duk_ret_t
-dukky_bad_constructor(duk_context *ctx)
-{
- duk_error(ctx, DUK_ERR_ERROR, "Bad constructor");
- return 0;
-}
-
-void
-dukky_inject_not_ctr(duk_context *ctx, int idx, const char *name)
-{
- /* ... p[idx] ... proto */
- duk_push_c_function(ctx, dukky_bad_constructor, 0);
- /* ... p[idx] ... proto cons */
- duk_insert(ctx, -2);
- /* ... p[idx] ... cons proto */
- duk_put_prop_string(ctx, -2, "prototype");
- /* ... p[idx] ... cons[proto] */
- duk_put_prop_string(ctx, idx, name);
- /* ... p ... */
- return;
-}
-
-/* Duktape heap utility functions */
-
-/* We need to override the defaults because not all platforms are fully ANSI
- * compatible. E.g. RISC OS gets upset if we malloc or realloc a zero byte
- * block, as do debugging tools such as Electric Fence by Bruce Perens.
- */
-
-static void *dukky_alloc_function(void *udata, duk_size_t size)
-{
- if (size == 0)
- return NULL;
-
- return malloc(size);
-}
-
-static void *dukky_realloc_function(void *udata, void *ptr, duk_size_t size)
-{
- if (ptr == NULL && size == 0)
- return NULL;
-
- if (size == 0) {
- free(ptr);
- return NULL;
- }
-
- return realloc(ptr, size);
-}
-
-static void dukky_free_function(void *udata, void *ptr)
-{
- if (ptr != NULL)
- free(ptr);
-}
-
-
-/**************************************** js.h ******************************/
-struct jscontext {
- duk_context *ctx;
- duk_context *thread;
- uint64_t exec_start_time;
-};
-
-#define CTX (ctx->thread)
-
-void js_initialise(void)
-{
- /** TODO: Forces JS on for our testing, needs changing before a release
- * lest we incur the wrath of others.
- */
- /* Disabled force-on for forthcoming release */
- /* nsoption_set_bool(enable_javascript, true);
- */
- javascript_init();
-}
-
-void js_finalise(void)
-{
- /* NADA for now */
-}
-
-#define DUKKY_NEW_PROTOTYPE(klass, uklass, klass_name) \
- dukky_create_prototype(ctx, dukky_##klass##___proto, PROTO_NAME(uklass), klass_name)
-
-nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
- jscontext **jsctx)
-{
- duk_context *ctx;
- jscontext *ret = calloc(1, sizeof(*ret));
- *jsctx = NULL;
- LOG("Creating new duktape javascript context");
- if (ret == NULL) return NSERROR_NOMEM;
- ctx = ret->ctx = duk_create_heap(
- dukky_alloc_function,
- dukky_realloc_function,
- dukky_free_function,
- ret,
- NULL);
- if (ret->ctx == NULL) { free(ret); return NSERROR_NOMEM; }
- /* Create the prototype stuffs */
- duk_push_global_object(ctx);
- duk_push_boolean(ctx, true);
- duk_put_prop_string(ctx, -2, "protos");
- duk_put_global_string(ctx, PROTO_MAGIC);
- /* Create prototypes here */
- dukky_create_prototypes(ctx);
-
- *jsctx = ret;
- return NSERROR_OK;
-}
-
-void js_destroycontext(jscontext *ctx)
-{
- LOG("Destroying duktape javascript context");
- duk_destroy_heap(ctx->ctx);
- free(ctx);
-}
-
-jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
-{
- assert(ctx != NULL);
- /* Pop any active thread off */
- LOG("Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv, doc_priv);
- duk_set_top(ctx->ctx, 0);
- duk_push_thread(ctx->ctx);
- ctx->thread = duk_require_context(ctx->ctx, -1);
- duk_push_int(CTX, 0);
- duk_push_int(CTX, 1);
- duk_push_int(CTX, 2);
- /* Manufacture a Window object */
- /* win_priv is a browser_window, doc_priv is an html content struct */
- duk_push_pointer(CTX, win_priv);
- duk_push_pointer(CTX, doc_priv);
- dukky_create_object(CTX, PROTO_NAME(WINDOW), 2);
- duk_push_global_object(CTX);
- duk_put_prop_string(CTX, -2, PROTO_MAGIC);
- duk_set_global_object(CTX);
-
- /* Now we need to prepare our node mapping table */
- duk_push_object(CTX);
- duk_push_pointer(CTX, NULL);
- duk_push_null(CTX);
- duk_put_prop(CTX, -3);
- duk_put_global_string(CTX, NODE_MAGIC);
-
- /* And now the event mapping table */
- duk_push_object(CTX);
- duk_put_global_string(CTX, EVENT_MAGIC);
-
- return (jsobject *)ctx;
-}
-
-static duk_ret_t eval_top_string(duk_context *ctx)
-{
- duk_eval(ctx);
- return 0;
-}
-
-duk_bool_t dukky_check_timeout(void *udata)
-{
-#define JS_EXEC_TIMEOUT_MS 10000 /* 10 seconds */
- jscontext *ctx = (jscontext *) udata;
- uint64_t now;
-
- (void) nsu_getmonotonic_ms(&now);
-
- /* This function may be called during duk heap construction,
- * so only test for execution timeout if we've recorded a
- * start time.
- */
- return ctx->exec_start_time != 0 &&
- now > (ctx->exec_start_time + JS_EXEC_TIMEOUT_MS);
-}
-
-bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
-{
- assert(ctx);
- if (txt == NULL || txtlen == 0) return false;
- duk_set_top(CTX, 0);
- duk_push_lstring(CTX, txt, txtlen);
-
- (void) nsu_getmonotonic_ms(&ctx->exec_start_time);
- if (duk_safe_call(CTX, eval_top_string, 1, 1) == DUK_EXEC_ERROR) {
- duk_get_prop_string(CTX, 0, "name");
- duk_get_prop_string(CTX, 0, "message");
- duk_get_prop_string(CTX, 0, "fileName");
- duk_get_prop_string(CTX, 0, "lineNumber");
- duk_get_prop_string(CTX, 0, "stack");
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, 1),
- duk_safe_to_string(CTX, 2));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, 3),
- duk_safe_to_string(CTX, 4));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, 5));
- return false;
- }
- if (duk_get_top(CTX) == 0) duk_push_boolean(CTX, false);
- LOG("Returning %s", duk_get_boolean(CTX, 0) ? "true" : "false");
- return duk_get_boolean(CTX, 0);
-}
-
-/*** New style event handling ***/
-
-static void dukky_push_event(duk_context *ctx, dom_event *evt)
-{
- /* ... */
- duk_get_global_string(ctx, EVENT_MAGIC);
- /* ... events */
- duk_push_pointer(ctx, evt);
- /* ... events eventptr */
- duk_get_prop(ctx, -2);
- /* ... events event? */
- if (duk_is_undefined(ctx, -1)) {
- /* ... events undefined */
- duk_pop(ctx);
- /* ... events */
- duk_push_pointer(ctx, evt);
- if (dukky_create_object(ctx, PROTO_NAME(EVENT), 1) != DUK_EXEC_SUCCESS) {
- /* ... events err */
- duk_pop(ctx);
- /* ... events */
- duk_push_object(ctx);
- /* ... events eobj[meh] */
- }
- /* ... events eobj */
- duk_push_pointer(ctx, evt);
- /* ... events eobj eventptr */
- duk_dup(ctx, -2);
- /* ... events eobj eventptr eobj */
- duk_put_prop(ctx, -4);
- /* ... events eobj */
- }
- /* ... events event */
- duk_replace(ctx, -2);
- /* ... event */
-}
-
-static void dukky_push_handler_code_(duk_context *ctx, dom_string *name,
- dom_event_target *et)
-{
- dom_string *onname, *val;
- dom_element *ele = (dom_element *)et;
- dom_exception exc;
- dom_node_type ntype;
-
- /* Currently safe since libdom has no event targets which are not
- * nodes. Reconsider this as and when we work out how to have
- * window do stuff
- */
- exc = dom_node_get_node_type(et, &ntype);
- if (exc != DOM_NO_ERR) {
- duk_push_lstring(ctx, "", 0);
- return;
- }
-
- if (ntype != DOM_ELEMENT_NODE) {
- duk_push_lstring(ctx, "", 0);
- return;
- }
-
- exc = dom_string_concat(corestring_dom_on, name, &onname);
- if (exc != DOM_NO_ERR) {
- duk_push_lstring(ctx, "", 0);
- return;
- }
-
- exc = dom_element_get_attribute(ele, onname, &val);
- if ((exc != DOM_NO_ERR) || (val == NULL)) {
- dom_string_unref(onname);
- duk_push_lstring(ctx, "", 0);
- return;
- }
-
- dom_string_unref(onname);
- duk_push_lstring(ctx, dom_string_data(val), dom_string_length(val));
- dom_string_unref(val);
-}
-
-bool dukky_get_current_value_of_event_handler(duk_context *ctx,
- dom_string *name,
- dom_event_target *et)
-{
- /* Must be entered as:
- * ... node(et)
- */
- duk_get_prop_string(ctx, -1, HANDLER_MAGIC);
- /* ... node handlers */
- duk_push_lstring(ctx, dom_string_data(name), dom_string_length(name));
- /* ... node handlers name */
- duk_get_prop(ctx, -2);
- /* ... node handlers handler? */
- if (duk_is_undefined(ctx, -1)) {
- /* ... node handlers undefined */
- duk_pop_2(ctx);
- /* ... node */
- dukky_push_handler_code_(ctx, name, et);
- /* ... node handlercode? */
- /* TODO: If this is null, clean up and propagate */
- /* ... node handlercode */
- /** @todo This is entirely wrong, but it's hard to get right */
- duk_push_string(ctx, "function (event) {");
- /* ... node handlercode prefix */
- duk_insert(ctx, -2);
- /* ... node prefix handlercode */
- duk_push_string(ctx, "}");
- /* ... node prefix handlercode suffix */
- duk_concat(ctx, 3);
- /* ... node fullhandlersrc */
- duk_push_string(ctx, "internal raw uncompiled handler");
- /* ... node fullhandlersrc filename */
- if (duk_pcompile(ctx, DUK_COMPILE_FUNCTION) != 0) {
- /* ... node err */
- LOG("Unable to proceed with handler, could not compile");
- duk_pop_2(ctx);
- return false;
- }
- /* ... node handler */
- duk_insert(ctx, -2);
- /* ... handler node */
- } else {
- /* ... node handlers handler */
- duk_insert(ctx, -3);
- /* ... handler node handlers */
- duk_pop(ctx);
- /* ... handler node */
- }
- /* ... handler node */
- return true;
-}
-
-static void dukky_generic_event_handler(dom_event *evt, void *pw)
-{
- duk_memory_functions funcs;
- duk_context *ctx = (duk_context *)pw;
- jscontext *jsctx;
- dom_string *name;
- dom_exception exc;
- dom_event_target *targ;
- dom_event_flow_phase phase;
-
- /* Retrieve the JS context from the Duktape context */
- duk_get_memory_functions(ctx, &funcs);
- jsctx = funcs.udata;
-
- LOG("WOOP WOOP, An event:");
- exc = dom_event_get_type(evt, &name);
- if (exc != DOM_NO_ERR) {
- LOG("Unable to find the event name");
- return;
- }
- LOG("Event's name is %*s",
- dom_string_length(name), dom_string_data(name));
- exc = dom_event_get_event_phase(evt, &phase);
- if (exc != DOM_NO_ERR) {
- LOG("Unable to get event phase");
- return;
- }
- LOG("Event phase is: %s (%d)",
- phase == DOM_CAPTURING_PHASE ? "capturing" :
- phase == DOM_AT_TARGET ? "at-target" :
- phase == DOM_BUBBLING_PHASE ? "bubbling" :
- "unknown", (int)phase);
-
- exc = dom_event_get_current_target(evt, &targ);
- if (exc != DOM_NO_ERR) {
- dom_string_unref(name);
- LOG("Unable to find the event target");
- return;
- }
-
- /* ... */
- if (dukky_push_node(ctx, (dom_node *)targ) == false) {
- dom_string_unref(name);
- dom_node_unref(targ);
- LOG("Unable to push JS node representation?!");
- return;
- }
- /* ... node */
- if (dukky_get_current_value_of_event_handler(
- ctx, name, (dom_event_target *)targ) == false) {
- dom_node_unref(targ);
- dom_string_unref(name);
- return;
- }
- /** @todo handle other kinds of event than the generic case */
- dom_node_unref(targ);
- dom_string_unref(name);
- /* ... handler node */
- dukky_push_event(ctx, evt);
- /* ... handler node event */
- (void) nsu_getmonotonic_ms(&jsctx->exec_start_time);
- if (duk_pcall_method(ctx, 1) != 0) {
- /* Failed to run the method */
- /* ... err */
- LOG("OH NOES! An error running a callback. Meh.");
- exc = dom_event_stop_immediate_propagation(evt);
- if (exc != DOM_NO_ERR)
- LOG("WORSE! could not stop propagation");
- duk_get_prop_string(ctx, -1, "name");
- duk_get_prop_string(ctx, -2, "message");
- duk_get_prop_string(ctx, -3, "fileName");
- duk_get_prop_string(ctx, -4, "lineNumber");
- duk_get_prop_string(ctx, -5, "stack");
- /* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(ctx, -5),
- duk_safe_to_string(ctx, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(ctx, -3),
- duk_safe_to_string(ctx, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(ctx, -1));
-
- duk_pop_n(ctx, 6);
- /* ... */
- return;
- }
- /* ... result */
- if (duk_is_boolean(ctx, -1) &&
- duk_to_boolean(ctx, -1) == 0) {
- dom_event_prevent_default(evt);
- }
- duk_pop(ctx);
- /* ... */
-}
-
-void dukky_register_event_listener_for(duk_context *ctx,
- struct dom_element *ele,
- dom_string *name)
-{
- dom_event_listener *listen = NULL;
- dom_exception exc;
-
- /* ... */
- if (dukky_push_node(ctx, (struct dom_node *)ele) == false)
- return;
- /* ... node */
- duk_get_prop_string(ctx, -1, HANDLER_LISTENER_MAGIC);
- /* ... node handlers */
- duk_push_lstring(ctx, dom_string_data(name), dom_string_length(name));
- /* ... node handlers name */
- if (duk_has_prop(ctx, -2)) {
- /* ... node handlers */
- duk_pop_2(ctx);
- /* ... */
- return;
- }
- /* ... node handlers */
- duk_push_lstring(ctx, dom_string_data(name), dom_string_length(name));
- /* ... node handlers name */
- duk_push_boolean(ctx, true);
- /* ... node handlers name true */
- duk_put_prop(ctx, -3);
- /* ... node handlers */
- duk_pop_2(ctx);
- /* ... */
- exc = dom_event_listener_create(dukky_generic_event_handler, ctx,
- &listen);
- if (exc != DOM_NO_ERR) return;
- exc = dom_event_target_add_event_listener(
- ele, name, listen, false);
- if (exc != DOM_NO_ERR) {
- LOG("Unable to register listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
- } else {
- LOG("have registered listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
- }
- dom_event_listener_unref(listen);
-}
-
-
-void js_handle_new_element(jscontext *ctx, struct dom_element *node)
-{
- assert(ctx);
- assert(node);
- dom_namednodemap *map;
- dom_exception exc;
- dom_ulong idx;
- dom_ulong siz;
- dom_attr *attr = NULL;
- dom_string *key = NULL;
- dom_string *nodename;
- duk_bool_t is_body = false;
-
- exc = dom_node_get_node_name(node, &nodename);
- if (exc != DOM_NO_ERR) return;
-
- if (nodename == corestring_dom_BODY)
- is_body = true;
-
- dom_string_unref(nodename);
-
- exc = dom_node_get_attributes(node, &map);
- if (exc != DOM_NO_ERR) return;
- if (map == NULL) return;
-
- exc = dom_namednodemap_get_length(map, &siz);
- if (exc != DOM_NO_ERR) goto out;
-
- for (idx = 0; idx < siz; idx++) {
- exc = dom_namednodemap_item(map, idx, &attr);
- if (exc != DOM_NO_ERR) goto out;
- exc = dom_attr_get_name(attr, &key);
- if (exc != DOM_NO_ERR) goto out;
- if (is_body && (
- key == corestring_dom_onblur ||
- key == corestring_dom_onerror ||
- key == corestring_dom_onfocus ||
- key == corestring_dom_onload ||
- key == corestring_dom_onresize ||
- key == corestring_dom_onscroll)) {
- /* This is a forwarded event, it doesn't matter,
- * we should skip registering for it and later
- * we will register it for Window itself
- */
- goto skip_register;
- }
- if (dom_string_length(key) > 2) {
- /* Can be on* */
- const uint8_t *data = (const uint8_t *)dom_string_data(key);
- if (data[0] == 'o' && data[1] == 'n') {
- dom_string *sub = NULL;
- exc = dom_string_substr(
- key, 2, dom_string_length(key),
- &sub);
- if (exc == DOM_NO_ERR) {
- dukky_register_event_listener_for(
- CTX, node, sub);
- dom_string_unref(sub);
- }
- }
- }
- skip_register:
- dom_string_unref(key); key = NULL;
- dom_node_unref(attr); attr = NULL;
- }
-
-out:
- if (key != NULL)
- dom_string_unref(key);
-
- if (attr != NULL)
- dom_node_unref(attr);
-
- dom_namednodemap_unref(map);
-}
-
-void js_event_cleanup(jscontext *ctx, struct dom_event *evt)
-{
- assert(ctx);
- /* ... */
- duk_get_global_string(CTX, EVENT_MAGIC);
- /* ... EVENT_MAP */
- duk_push_pointer(CTX, evt);
- /* ... EVENT_MAP eventptr */
- duk_del_prop(CTX, -2);
- /* ... EVENT_MAP */
- duk_pop(CTX);
- /* ... */
-}
-
-bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, struct dom_node *target)
-{
- dom_exception exc;
- dom_event *evt;
- dom_event_target *body;
-
- LOG("Event: %s (doc=%p, target=%p)", type, doc, target);
-
- /** @todo Make this more generic, this only handles load and only
- * targetting the window, so that we actually stand a chance of
- * getting 3.4 out.
- */
-
- if (target != NULL)
- /* Swallow non-Window-targetted events quietly */
- return true;
-
- if (strcmp(type, "load") != 0)
- /* Swallow non-load events quietly */
- return true;
-
- /* Okay, we're processing load, targetted at Window, do the single
- * thing which gets us there, which is to find the appropriate event
- * handler and call it. If we have no event handler on Window then
- * we divert to the body, and if there's no event handler there
- * we swallow the event silently
- */
-
- exc = dom_event_create(&evt);
- if (exc != DOM_NO_ERR) return true;
- exc = dom_event_init(evt, corestring_dom_load, false, false);
- if (exc != DOM_NO_ERR) {
- dom_event_unref(evt);
- return true;
- }
- /* ... */
- duk_get_global_string(CTX, HANDLER_MAGIC);
- /* ... handlers */
- duk_push_lstring(CTX, "load", 4);
- /* ... handlers "load" */
- duk_get_prop(CTX, -2);
- /* ... handlers handler? */
- if (duk_is_undefined(CTX, -1)) {
- /* No handler here, *try* and retrieve a handler from
- * the body
- */
- duk_pop(CTX);
- /* ... handlers */
- exc = dom_html_document_get_body(doc, &body);
- if (exc != DOM_NO_ERR) {
- dom_event_unref(evt);
- return true;
- }
- dukky_push_node(CTX, (struct dom_node *)body);
- /* ... handlers bodynode */
- if (dukky_get_current_value_of_event_handler(
- CTX, corestring_dom_load, body) == false) {
- /* ... handlers */
- duk_pop(CTX);
- return true;
- }
- /* ... handlers handler bodynode */
- duk_pop(CTX);
- }
- /* ... handlers handler */
- duk_insert(CTX, -2);
- /* ... handler handlers */
- duk_pop(CTX);
- /* ... handler */
- duk_push_global_object(CTX);
- /* ... handler Window */
- dukky_push_event(CTX, evt);
- /* ... handler Window event */
- (void) nsu_getmonotonic_ms(&ctx->exec_start_time);
- if (duk_pcall_method(CTX, 1) != 0) {
- /* Failed to run the handler */
- /* ... err */
- LOG("OH NOES! An error running a handler. Meh.");
- duk_get_prop_string(CTX, -1, "name");
- duk_get_prop_string(CTX, -2, "message");
- duk_get_prop_string(CTX, -3, "fileName");
- duk_get_prop_string(CTX, -4, "lineNumber");
- duk_get_prop_string(CTX, -5, "stack");
- /* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, -5),
- duk_safe_to_string(CTX, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, -3),
- duk_safe_to_string(CTX, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, -1));
-
- duk_pop_n(CTX, 6);
- /* ... */
- js_event_cleanup(ctx, evt);
- dom_event_unref(evt);
- return true;
- }
- /* ... result */
- duk_pop(CTX);
- /* ... */
- js_event_cleanup(ctx, evt);
- dom_event_unref(evt);
- return true;
-}
diff --git a/javascript/duktape/dukky.h b/javascript/duktape/dukky.h
deleted file mode 100644
index 0c3ff0e25..000000000
--- a/javascript/duktape/dukky.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
- * Copyright 2015 Daniel Dilverstone <dsilvers@netsurf-browser.org>
- * Copyright 2016 Michael Drake <tlsa@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Duktapeish implementation of javascript engine functions, prototypes.
- */
-
-#ifndef DUKKY_H
-#define DUKKY_H
-
-#ifdef JS_DEBUG
-# define JS_LOG(format, args...) LOG(format , ##args)
-#else
-# define JS_LOG(format, ...) ((void) 0)
-#endif
-
-duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args);
-duk_bool_t dukky_push_node_stacked(duk_context *ctx);
-duk_bool_t dukky_push_node(duk_context *ctx, struct dom_node *node);
-void dukky_inject_not_ctr(duk_context *ctx, int idx, const char *name);
-void dukky_register_event_listener_for(duk_context *ctx,
- struct dom_element *ele,
- dom_string *name);
-bool dukky_get_current_value_of_event_handler(duk_context *ctx,
- dom_string *name,
- dom_event_target *et);
-
-#endif
diff --git a/javascript/duktape/duktape.c b/javascript/duktape/duktape.c
deleted file mode 100644
index eb4c77a04..000000000
--- a/javascript/duktape/duktape.c
+++ /dev/null
@@ -1,86513 +0,0 @@
-/* Omit from static analysis. */
-#ifndef __clang_analyzer__
-/*
- * Single source autogenerated distributable for Duktape 1.5.0.
- *
- * Git commit 83d557704ee63f68ab40b6fcb00995c9b3d6777c (v1.5.0).
- * Git branch master.
- *
- * See Duktape AUTHORS.rst and LICENSE.txt for copyright and
- * licensing information.
- */
-
-/* LICENSE.txt */
-/*
-* ===============
-* Duktape license
-* ===============
-*
-* (http://opensource.org/licenses/MIT)
-*
-* Copyright (c) 2013-2016 by Duktape authors (see AUTHORS.rst)
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-* THE SOFTWARE.
-*/
-/* AUTHORS.rst */
-/*
-* ===============
-* Duktape authors
-* ===============
-*
-* Copyright
-* =========
-*
-* Duktape copyrights are held by its authors. Each author has a copyright
-* to their contribution, and agrees to irrevocably license the contribution
-* under the Duktape ``LICENSE.txt``.
-*
-* Authors
-* =======
-*
-* Please include an e-mail address, a link to your GitHub profile, or something
-* similar to allow your contribution to be identified accurately.
-*
-* The following people have contributed code, website contents, or Wiki contents,
-* and agreed to irrevocably license their contributions under the Duktape
-* ``LICENSE.txt`` (in order of appearance):
-*
-* * Sami Vaarala <sami.vaarala@iki.fi>
-* * Niki Dobrev
-* * Andreas \u00d6man <andreas@lonelycoder.com>
-* * L\u00e1szl\u00f3 Lang\u00f3 <llango.u-szeged@partner.samsung.com>
-* * Legimet <legimet.calc@gmail.com>
-* * Karl Skomski <karl@skomski.com>
-* * Bruce Pascoe <fatcerberus1@gmail.com>
-* * Ren\u00e9 Hollander <rene@rene8888.at>
-* * Julien Hamaide (https://github.com/crazyjul)
-* * Sebastian G\u00f6tte (https://github.com/jaseg)
-*
-* Other contributions
-* ===================
-*
-* The following people have contributed something other than code (e.g. reported
-* bugs, provided ideas, etc; roughly in order of appearance):
-*
-* * Greg Burns
-* * Anthony Rabine
-* * Carlos Costa
-* * Aur\u00e9lien Bouilland
-* * Preet Desai (Pris Matic)
-* * judofyr (http://www.reddit.com/user/judofyr)
-* * Jason Woofenden
-* * Micha\u0142 Przyby\u015b
-* * Anthony Howe
-* * Conrad Pankoff
-* * Jim Schimpf
-* * Rajaran Gaunker (https://github.com/zimbabao)
-* * Andreas \u00d6man
-* * Doug Sanden
-* * Josh Engebretson (https://github.com/JoshEngebretson)
-* * Remo Eichenberger (https://github.com/remoe)
-* * Mamod Mehyar (https://github.com/mamod)
-* * David Demelier (https://github.com/markand)
-* * Tim Caswell (https://github.com/creationix)
-* * Mitchell Blank Jr (https://github.com/mitchblank)
-* * https://github.com/yushli
-* * Seo Sanghyeon (https://github.com/sanxiyn)
-* * Han ChoongWoo (https://github.com/tunz)
-* * Joshua Peek (https://github.com/josh)
-* * Bruce E. Pascoe (https://github.com/fatcerberus)
-* * https://github.com/Kelledin
-* * https://github.com/sstruchtrup
-* * Michael Drake (https://github.com/tlsa)
-* * https://github.com/chris-y
-* * Laurent Zubiaur (https://github.com/lzubiaur)
-* * Ole Andr\u00e9 Vadla Ravn\u00e5s (https://github.com/oleavr)
-*
-* If you are accidentally missing from this list, send me an e-mail
-* (``sami.vaarala@iki.fi``) and I'll fix the omission.
-*/
-#line 1 "duk_internal.h"
-/*
- * Top-level include file to be used for all (internal) source files.
- *
- * Source files should not include individual header files, as they
- * have not been designed to be individually included.
- */
-
-#ifndef DUK_INTERNAL_H_INCLUDED
-#define DUK_INTERNAL_H_INCLUDED
-
-/*
- * The 'duktape.h' header provides the public API, but also handles all
- * compiler and platform specific feature detection, Duktape feature
- * resolution, inclusion of system headers, etc. These have been merged
- * because the public API is also dependent on e.g. detecting appropriate
- * C types which is quite platform/compiler specific especially for a non-C99
- * build. The public API is also dependent on the resolved feature set.
- *
- * Some actions taken by the merged header (such as including system headers)
- * are not appropriate for building a user application. The define
- * DUK_COMPILING_DUKTAPE allows the merged header to skip/include some
- * sections depending on what is being built.
- */
-
-#define DUK_COMPILING_DUKTAPE
-#include "duktape.h"
-
-/*
- * User declarations, e.g. prototypes for user functions used by Duktape
- * macros. Concretely, if DUK_USE_PANIC_HANDLER is used and the macro
- * value calls a user function, it needs to be declared for Duktape
- * compilation to avoid warnings.
- */
-
-DUK_USE_USER_DECLARE()
-
-/*
- * Duktape includes (other than duk_features.h)
- *
- * The header files expect to be included in an order which satisfies header
- * dependencies correctly (the headers themselves don't include any other
- * includes). Forward declarations are used to break circular struct/typedef
- * dependencies.
- */
-
-#line 1 "duk_replacements.h"
-#ifndef DUK_REPLACEMENTS_H_INCLUDED
-#define DUK_REPLACEMENTS_H_INCLUDED
-
-#if !defined(DUK_SINGLE_FILE)
-#if defined(DUK_USE_COMPUTED_INFINITY)
-DUK_INTERNAL_DECL double duk_computed_infinity;
-#endif
-#if defined(DUK_USE_COMPUTED_NAN)
-DUK_INTERNAL_DECL double duk_computed_nan;
-#endif
-#if defined(DUK_USE_REPL_FPCLASSIFY)
-DUK_INTERNAL_DECL int duk_repl_fpclassify(double x);
-#endif
-#if defined(DUK_USE_REPL_SIGNBIT)
-DUK_INTERNAL_DECL int duk_repl_signbit(double x);
-#endif
-#if defined(DUK_USE_REPL_ISFINITE)
-DUK_INTERNAL_DECL int duk_repl_isfinite(double x);
-#endif
-#if defined(DUK_USE_REPL_ISNAN)
-DUK_INTERNAL_DECL int duk_repl_isnan(double x);
-#endif
-#if defined(DUK_USE_REPL_ISINF)
-DUK_INTERNAL_DECL int duk_repl_isinf(double x);
-#endif
-#endif /* !DUK_SINGLE_FILE */
-
-#endif /* DUK_REPLACEMENTS_H_INCLUDED */
-#line 1 "duk_jmpbuf.h"
-/*
- * Wrapper for jmp_buf.
- *
- * This is used because jmp_buf is an array type for backward compatibility.
- * Wrapping jmp_buf in a struct makes pointer references, sizeof, etc,
- * behave more intuitively.
- *
- * http://en.wikipedia.org/wiki/Setjmp.h#Member_types
- */
-
-#ifndef DUK_JMPBUF_H_INCLUDED
-#define DUK_JMPBUF_H_INCLUDED
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-struct duk_jmpbuf {
- duk_small_int_t dummy; /* unused */
-};
-#else
-struct duk_jmpbuf {
- DUK_JMPBUF_TYPE jb;
-};
-#endif
-
-#endif /* DUK_JMPBUF_H_INCLUDED */
-#line 1 "duk_exception.h"
-/*
- * Exception for Duktape internal throws when C++ exceptions are used
- * for long control transfers.
- *
- * Doesn't inherit from any exception base class to minimize the chance
- * that user code would accidentally catch this exception.
- */
-
-#ifndef DUK_EXCEPTION_H_INCLUDED
-#define DUK_EXCEPTION_H_INCLUDED
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-class duk_internal_exception {
- /* intentionally empty */
-};
-#endif
-
-#endif /* DUK_EXCEPTION_H_INCLUDED */
-#line 1 "duk_forwdecl.h"
-/*
- * Forward declarations for all Duktape structures.
- */
-
-#ifndef DUK_FORWDECL_H_INCLUDED
-#define DUK_FORWDECL_H_INCLUDED
-
-/*
- * Forward declarations
- */
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-class duk_internal_exception;
-#else
-struct duk_jmpbuf;
-#endif
-
-/* duk_tval intentionally skipped */
-struct duk_heaphdr;
-struct duk_heaphdr_string;
-struct duk_hstring;
-struct duk_hstring_external;
-struct duk_hobject;
-struct duk_hcompiledfunction;
-struct duk_hnativefunction;
-struct duk_hthread;
-struct duk_hbufferobject;
-struct duk_hbuffer;
-struct duk_hbuffer_fixed;
-struct duk_hbuffer_dynamic;
-struct duk_hbuffer_external;
-
-struct duk_propaccessor;
-union duk_propvalue;
-struct duk_propdesc;
-
-struct duk_heap;
-struct duk_breakpoint;
-
-struct duk_activation;
-struct duk_catcher;
-struct duk_strcache;
-struct duk_ljstate;
-struct duk_strtab_entry;
-
-#ifdef DUK_USE_DEBUG
-struct duk_fixedbuffer;
-#endif
-
-struct duk_bitdecoder_ctx;
-struct duk_bitencoder_ctx;
-struct duk_bufwriter_ctx;
-
-struct duk_token;
-struct duk_re_token;
-struct duk_lexer_point;
-struct duk_lexer_ctx;
-struct duk_lexer_codepoint;
-
-struct duk_compiler_instr;
-struct duk_compiler_func;
-struct duk_compiler_ctx;
-
-struct duk_re_matcher_ctx;
-struct duk_re_compiler_ctx;
-
-#if defined(DUK_USE_CPP_EXCEPTIONS)
-/* no typedef */
-#else
-typedef struct duk_jmpbuf duk_jmpbuf;
-#endif
-
-/* duk_tval intentionally skipped */
-typedef struct duk_heaphdr duk_heaphdr;
-typedef struct duk_heaphdr_string duk_heaphdr_string;
-typedef struct duk_hstring duk_hstring;
-typedef struct duk_hstring_external duk_hstring_external;
-typedef struct duk_hobject duk_hobject;
-typedef struct duk_hcompiledfunction duk_hcompiledfunction;
-typedef struct duk_hnativefunction duk_hnativefunction;
-typedef struct duk_hbufferobject duk_hbufferobject;
-typedef struct duk_hthread duk_hthread;
-typedef struct duk_hbuffer duk_hbuffer;
-typedef struct duk_hbuffer_fixed duk_hbuffer_fixed;
-typedef struct duk_hbuffer_dynamic duk_hbuffer_dynamic;
-typedef struct duk_hbuffer_external duk_hbuffer_external;
-
-typedef struct duk_propaccessor duk_propaccessor;
-typedef union duk_propvalue duk_propvalue;
-typedef struct duk_propdesc duk_propdesc;
-
-typedef struct duk_heap duk_heap;
-typedef struct duk_breakpoint duk_breakpoint;
-
-typedef struct duk_activation duk_activation;
-typedef struct duk_catcher duk_catcher;
-typedef struct duk_strcache duk_strcache;
-typedef struct duk_ljstate duk_ljstate;
-typedef struct duk_strtab_entry duk_strtab_entry;
-
-#ifdef DUK_USE_DEBUG
-typedef struct duk_fixedbuffer duk_fixedbuffer;
-#endif
-
-typedef struct duk_bitdecoder_ctx duk_bitdecoder_ctx;
-typedef struct duk_bitencoder_ctx duk_bitencoder_ctx;
-typedef struct duk_bufwriter_ctx duk_bufwriter_ctx;
-
-typedef struct duk_token duk_token;
-typedef struct duk_re_token duk_re_token;
-typedef struct duk_lexer_point duk_lexer_point;
-typedef struct duk_lexer_ctx duk_lexer_ctx;
-typedef struct duk_lexer_codepoint duk_lexer_codepoint;
-
-typedef struct duk_compiler_instr duk_compiler_instr;
-typedef struct duk_compiler_func duk_compiler_func;
-typedef struct duk_compiler_ctx duk_compiler_ctx;
-
-typedef struct duk_re_matcher_ctx duk_re_matcher_ctx;
-typedef struct duk_re_compiler_ctx duk_re_compiler_ctx;
-
-#endif /* DUK_FORWDECL_H_INCLUDED */
-#line 1 "duk_tval.h"
-/*
- * Tagged type definition (duk_tval) and accessor macros.
- *
- * Access all fields through the accessor macros, as the representation
- * is quite tricky.
- *
- * There are two packed type alternatives: an 8-byte representation
- * based on an IEEE double (preferred for compactness), and a 12-byte
- * representation (portability). The latter is needed also in e.g.
- * 64-bit environments (it usually pads to 16 bytes per value).
- *
- * Selecting the tagged type format involves many trade-offs (memory
- * use, size and performance of generated code, portability, etc),
- * see doc/types.rst for a detailed discussion (especially of how the
- * IEEE double format is used to pack tagged values).
- *
- * NB: because macro arguments are often expressions, macros should
- * avoid evaluating their argument more than once.
- */
-
-#ifndef DUK_TVAL_H_INCLUDED
-#define DUK_TVAL_H_INCLUDED
-
-/* sanity */
-#if !defined(DUK_USE_DOUBLE_LE) && !defined(DUK_USE_DOUBLE_ME) && !defined(DUK_USE_DOUBLE_BE)
-#error unsupported: cannot determine byte order variant
-#endif
-
-#if defined(DUK_USE_PACKED_TVAL)
-/* ======================================================================== */
-
-/*
- * Packed 8-byte representation
- */
-
-/* use duk_double_union as duk_tval directly */
-typedef union duk_double_union duk_tval;
-
-/* tags */
-#define DUK_TAG_NORMALIZED_NAN 0x7ff8UL /* the NaN variant we use */
-/* avoid tag 0xfff0, no risk of confusion with negative infinity */
-#if defined(DUK_USE_FASTINT)
-#define DUK_TAG_FASTINT 0xfff1UL /* embed: integer value */
-#endif
-#define DUK_TAG_UNUSED 0xfff2UL /* marker; not actual tagged value */
-#define DUK_TAG_UNDEFINED 0xfff3UL /* embed: nothing */
-#define DUK_TAG_NULL 0xfff4UL /* embed: nothing */
-#define DUK_TAG_BOOLEAN 0xfff5UL /* embed: 0 or 1 (false or true) */
-/* DUK_TAG_NUMBER would logically go here, but it has multiple 'tags' */
-#define DUK_TAG_POINTER 0xfff6UL /* embed: void ptr */
-#define DUK_TAG_LIGHTFUNC 0xfff7UL /* embed: func ptr */
-#define DUK_TAG_STRING 0xfff8UL /* embed: duk_hstring ptr */
-#define DUK_TAG_OBJECT 0xfff9UL /* embed: duk_hobject ptr */
-#define DUK_TAG_BUFFER 0xfffaUL /* embed: duk_hbuffer ptr */
-
-/* for convenience */
-#define DUK_XTAG_BOOLEAN_FALSE 0xfff50000UL
-#define DUK_XTAG_BOOLEAN_TRUE 0xfff50001UL
-
-/* two casts to avoid gcc warning: "warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]" */
-#if defined(DUK_USE_64BIT_OPS)
-#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_TAGGEDPOINTER(v,h,tag) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) (tag)) << 16) | (((duk_uint64_t) (duk_uint32_t) (h)) << 32); \
- } while (0)
-#else
-#define DUK__TVAL_SET_TAGGEDPOINTER(v,h,tag) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) (tag)) << 48) | ((duk_uint64_t) (duk_uint32_t) (h)); \
- } while (0)
-#endif
-#else /* DUK_USE_64BIT_OPS */
-#define DUK__TVAL_SET_TAGGEDPOINTER(v,h,tag) do { \
- (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) (tag)) << 16; \
- (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (h); \
- } while (0)
-#endif /* DUK_USE_64BIT_OPS */
-
-#if defined(DUK_USE_64BIT_OPS)
-/* Double casting for pointer to avoid gcc warning (cast from pointer to integer of different size) */
-#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_LIGHTFUNC(v,fp,flags) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 16) | \
- ((duk_uint64_t) (flags)) | \
- (((duk_uint64_t) (duk_uint32_t) (fp)) << 32); \
- } while (0)
-#else
-#define DUK__TVAL_SET_LIGHTFUNC(v,fp,flags) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_LIGHTFUNC) << 48) | \
- (((duk_uint64_t) (flags)) << 32) | \
- ((duk_uint64_t) (duk_uint32_t) (fp)); \
- } while (0)
-#endif
-#else /* DUK_USE_64BIT_OPS */
-#define DUK__TVAL_SET_LIGHTFUNC(v,fp,flags) do { \
- (v)->ui[DUK_DBL_IDX_UI0] = (((duk_uint32_t) DUK_TAG_LIGHTFUNC) << 16) | ((duk_uint32_t) (flags)); \
- (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (fp); \
- } while (0)
-#endif /* DUK_USE_64BIT_OPS */
-
-#if defined(DUK_USE_FASTINT)
-/* Note: masking is done for 'i' to deal with negative numbers correctly */
-#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_SET_FASTINT(v,i) do { \
- (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16 | (((duk_uint32_t) ((i) >> 32)) & 0x0000ffffUL); \
- (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
- } while (0)
-#define DUK__TVAL_SET_FASTINT_U32(v,i) do { \
- (v)->ui[DUK_DBL_IDX_UI0] = ((duk_uint32_t) DUK_TAG_FASTINT) << 16; \
- (v)->ui[DUK_DBL_IDX_UI1] = (duk_uint32_t) (i); \
- } while (0)
-#else
-#define DUK__TVAL_SET_FASTINT(v,i) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (((duk_uint64_t) (i)) & 0x0000ffffffffffffULL); \
- } while (0)
-#define DUK__TVAL_SET_FASTINT_U32(v,i) do { \
- (v)->ull[DUK_DBL_IDX_ULL0] = (((duk_uint64_t) DUK_TAG_FASTINT) << 48) | (duk_uint64_t) (i); \
- } while (0)
-#endif
-
-#define DUK__TVAL_SET_FASTINT_I32(v,i) do { \
- duk_int64_t duk__tmp = (duk_int64_t) (i); \
- DUK_TVAL_SET_FASTINT((v), duk__tmp); \
- } while (0)
-
-/* XXX: clumsy sign extend and masking of 16 topmost bits */
-#if defined(DUK_USE_DOUBLE_ME)
-#define DUK__TVAL_GET_FASTINT(v) (((duk_int64_t) ((((duk_uint64_t) (v)->ui[DUK_DBL_IDX_UI0]) << 32) | ((duk_uint64_t) (v)->ui[DUK_DBL_IDX_UI1]))) << 16 >> 16)
-#else
-#define DUK__TVAL_GET_FASTINT(v) ((((duk_int64_t) (v)->ull[DUK_DBL_IDX_ULL0]) << 16) >> 16)
-#endif
-#define DUK__TVAL_GET_FASTINT_U32(v) ((v)->ui[DUK_DBL_IDX_UI1])
-#define DUK__TVAL_GET_FASTINT_I32(v) ((duk_int32_t) (v)->ui[DUK_DBL_IDX_UI1])
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_UNDEFINED(v) do { \
- (v)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_UNDEFINED; \
- } while (0)
-#define DUK_TVAL_SET_UNUSED(v) do { \
- (v)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_UNUSED; \
- } while (0)
-#define DUK_TVAL_SET_NULL(v) do { \
- (v)->us[DUK_DBL_IDX_US0] = (duk_uint16_t) DUK_TAG_NULL; \
- } while (0)
-
-#define DUK_TVAL_SET_BOOLEAN(v,val) DUK_DBLUNION_SET_HIGH32((v), (((duk_uint32_t) DUK_TAG_BOOLEAN) << 16) | ((duk_uint32_t) (val)))
-
-#define DUK_TVAL_SET_NAN(v) DUK_DBLUNION_SET_NAN_FULL((v))
-
-/* Assumes that caller has normalized NaNs, otherwise trouble ahead. */
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_DOUBLE(v,d) do { \
- duk_double_t duk__dblval; \
- duk__dblval = (d); \
- DUK_ASSERT_DOUBLE_IS_NORMALIZED(duk__dblval); \
- DUK_DBLUNION_SET_DOUBLE((v), duk__dblval); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT(v,i) DUK__TVAL_SET_FASTINT((v), (i))
-#define DUK_TVAL_SET_FASTINT_I32(v,i) DUK__TVAL_SET_FASTINT_I32((v), (i))
-#define DUK_TVAL_SET_FASTINT_U32(v,i) DUK__TVAL_SET_FASTINT_U32((v), (i))
-#define DUK_TVAL_SET_NUMBER_CHKFAST(v,d) duk_tval_set_number_chkfast((v), (d))
-#define DUK_TVAL_SET_NUMBER(v,d) DUK_TVAL_SET_DOUBLE((v), (d))
-#define DUK_TVAL_CHKFAST_INPLACE(v) do { \
- duk_tval *duk__tv; \
- duk_double_t duk__d; \
- duk__tv = (v); \
- if (DUK_TVAL_IS_DOUBLE(duk__tv)) { \
- duk__d = DUK_TVAL_GET_DOUBLE(duk__tv); \
- DUK_TVAL_SET_NUMBER_CHKFAST(duk__tv, duk__d); \
- } \
- } while (0)
-#else
-#define DUK_TVAL_SET_DOUBLE(v,d) do { \
- duk_double_t duk__dblval; \
- duk__dblval = (d); \
- DUK_ASSERT_DOUBLE_IS_NORMALIZED(duk__dblval); \
- DUK_DBLUNION_SET_DOUBLE((v), duk__dblval); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT(v,i) DUK_TVAL_SET_DOUBLE((v), (duk_double_t) (i)) /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_FASTINT_I32(v,i) DUK_TVAL_SET_DOUBLE((v), (duk_double_t) (i))
-#define DUK_TVAL_SET_FASTINT_U32(v,i) DUK_TVAL_SET_DOUBLE((v), (duk_double_t) (i))
-#define DUK_TVAL_SET_NUMBER_CHKFAST(v,d) DUK_TVAL_SET_DOUBLE((v), (d))
-#define DUK_TVAL_SET_NUMBER(v,d) DUK_TVAL_SET_DOUBLE((v), (d))
-#define DUK_TVAL_CHKFAST_INPLACE(v) do { } while (0)
-#endif
-
-#define DUK_TVAL_SET_LIGHTFUNC(v,fp,flags) DUK__TVAL_SET_LIGHTFUNC((v), (fp), (flags))
-#define DUK_TVAL_SET_STRING(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_STRING)
-#define DUK_TVAL_SET_OBJECT(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_OBJECT)
-#define DUK_TVAL_SET_BUFFER(v,h) DUK__TVAL_SET_TAGGEDPOINTER((v), (h), DUK_TAG_BUFFER)
-#define DUK_TVAL_SET_POINTER(v,p) DUK__TVAL_SET_TAGGEDPOINTER((v), (p), DUK_TAG_POINTER)
-
-#define DUK_TVAL_SET_TVAL(v,x) do { *(v) = *(x); } while (0)
-
-/* getters */
-#define DUK_TVAL_GET_BOOLEAN(v) ((int) (v)->us[DUK_DBL_IDX_US1])
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_GET_DOUBLE(v) ((v)->d)
-#define DUK_TVAL_GET_FASTINT(v) DUK__TVAL_GET_FASTINT((v))
-#define DUK_TVAL_GET_FASTINT_U32(v) DUK__TVAL_GET_FASTINT_U32((v))
-#define DUK_TVAL_GET_FASTINT_I32(v) DUK__TVAL_GET_FASTINT_I32((v))
-#define DUK_TVAL_GET_NUMBER(v) duk_tval_get_number_packed((v))
-#else
-#define DUK_TVAL_GET_NUMBER(v) ((v)->d)
-#define DUK_TVAL_GET_DOUBLE(v) ((v)->d)
-#endif
-#define DUK_TVAL_GET_LIGHTFUNC(v,out_fp,out_flags) do { \
- (out_flags) = (v)->ui[DUK_DBL_IDX_UI0] & 0xffffUL; \
- (out_fp) = (duk_c_function) (v)->ui[DUK_DBL_IDX_UI1]; \
- } while (0)
-#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(v) ((duk_c_function) ((v)->ui[DUK_DBL_IDX_UI1]))
-#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(v) (((int) (v)->ui[DUK_DBL_IDX_UI0]) & 0xffffUL)
-#define DUK_TVAL_GET_STRING(v) ((duk_hstring *) (v)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_OBJECT(v) ((duk_hobject *) (v)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_BUFFER(v) ((duk_hbuffer *) (v)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_POINTER(v) ((void *) (v)->vp[DUK_DBL_IDX_VP1])
-#define DUK_TVAL_GET_HEAPHDR(v) ((duk_heaphdr *) (v)->vp[DUK_DBL_IDX_VP1])
-
-/* decoding */
-#define DUK_TVAL_GET_TAG(v) ((duk_small_uint_t) (v)->us[DUK_DBL_IDX_US0])
-
-#define DUK_TVAL_IS_UNDEFINED(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_UNDEFINED)
-#define DUK_TVAL_IS_UNUSED(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_UNUSED)
-#define DUK_TVAL_IS_NULL(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_NULL)
-#define DUK_TVAL_IS_BOOLEAN(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_BOOLEAN)
-#define DUK_TVAL_IS_BOOLEAN_TRUE(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_TRUE)
-#define DUK_TVAL_IS_BOOLEAN_FALSE(v) ((v)->ui[DUK_DBL_IDX_UI0] == DUK_XTAG_BOOLEAN_FALSE)
-#define DUK_TVAL_IS_LIGHTFUNC(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_LIGHTFUNC)
-#define DUK_TVAL_IS_STRING(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_STRING)
-#define DUK_TVAL_IS_OBJECT(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_OBJECT)
-#define DUK_TVAL_IS_BUFFER(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_BUFFER)
-#define DUK_TVAL_IS_POINTER(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_POINTER)
-#if defined(DUK_USE_FASTINT)
-/* 0xfff0 is -Infinity */
-#define DUK_TVAL_IS_DOUBLE(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff0UL)
-#define DUK_TVAL_IS_FASTINT(v) (DUK_TVAL_GET_TAG((v)) == DUK_TAG_FASTINT)
-#define DUK_TVAL_IS_NUMBER(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff1UL)
-#else
-#define DUK_TVAL_IS_NUMBER(v) (DUK_TVAL_GET_TAG((v)) <= 0xfff0UL)
-#define DUK_TVAL_IS_DOUBLE(v) DUK_TVAL_IS_NUMBER((v))
-#endif
-
-/* This is performance critical because it appears in every DECREF. */
-#define DUK_TVAL_IS_HEAP_ALLOCATED(v) (DUK_TVAL_GET_TAG((v)) >= DUK_TAG_STRING)
-
-#if defined(DUK_USE_FASTINT)
-DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_packed(duk_tval *tv);
-#endif
-
-#else /* DUK_USE_PACKED_TVAL */
-/* ======================================================================== */
-
-/*
- * Portable 12-byte representation
- */
-
-/* Note: not initializing all bytes is normally not an issue: Duktape won't
- * read or use the uninitialized bytes so valgrind won't issue warnings.
- * In some special cases a harmless valgrind warning may be issued though.
- * For example, the DumpHeap debugger command writes out a compiled function's
- * 'data' area as is, including any uninitialized bytes, which causes a
- * valgrind warning.
- */
-
-typedef struct duk_tval_struct duk_tval;
-
-struct duk_tval_struct {
- duk_small_uint_t t;
- duk_small_uint_t v_extra;
- union {
- duk_double_t d;
- duk_small_int_t i;
-#if defined(DUK_USE_FASTINT)
- duk_int64_t fi; /* if present, forces 16-byte duk_tval */
-#endif
- void *voidptr;
- duk_hstring *hstring;
- duk_hobject *hobject;
- duk_hcompiledfunction *hcompiledfunction;
- duk_hnativefunction *hnativefunction;
- duk_hthread *hthread;
- duk_hbuffer *hbuffer;
- duk_heaphdr *heaphdr;
- duk_c_function lightfunc;
- } v;
-};
-
-#define DUK__TAG_NUMBER 0 /* not exposed */
-#if defined(DUK_USE_FASTINT)
-#define DUK_TAG_FASTINT 1
-#endif
-#define DUK_TAG_UNDEFINED 2
-#define DUK_TAG_NULL 3
-#define DUK_TAG_BOOLEAN 4
-#define DUK_TAG_POINTER 5
-#define DUK_TAG_LIGHTFUNC 6
-#define DUK_TAG_UNUSED 7 /* marker; not actual tagged type */
-#define DUK_TAG_STRING 8 /* first heap allocated, match bit boundary */
-#define DUK_TAG_OBJECT 9
-#define DUK_TAG_BUFFER 10
-
-/* DUK__TAG_NUMBER is intentionally first, as it is the default clause in code
- * to support the 8-byte representation. Further, it is a non-heap-allocated
- * type so it should come before DUK_TAG_STRING. Finally, it should not break
- * the tag value ranges covered by case-clauses in a switch-case.
- */
-
-/* setters */
-#define DUK_TVAL_SET_UNDEFINED(tv) do { \
- (tv)->t = DUK_TAG_UNDEFINED; \
- } while (0)
-
-#define DUK_TVAL_SET_UNUSED(tv) do { \
- (tv)->t = DUK_TAG_UNUSED; \
- } while (0)
-
-#define DUK_TVAL_SET_NULL(tv) do { \
- (tv)->t = DUK_TAG_NULL; \
- } while (0)
-
-#define DUK_TVAL_SET_BOOLEAN(tv,val) do { \
- (tv)->t = DUK_TAG_BOOLEAN; \
- (tv)->v.i = (val); \
- } while (0)
-
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_DOUBLE(tv,val) do { \
- (tv)->t = DUK__TAG_NUMBER; \
- (tv)->v.d = (val); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT(tv,val) do { \
- (tv)->t = DUK_TAG_FASTINT; \
- (tv)->v.fi = (val); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_U32(tv,val) do { \
- (tv)->t = DUK_TAG_FASTINT; \
- (tv)->v.fi = (duk_int64_t) (val); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_I32(tv,val) do { \
- (tv)->t = DUK_TAG_FASTINT; \
- (tv)->v.fi = (duk_int64_t) (val); \
- } while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST(tv,d) \
- duk_tval_set_number_chkfast((tv), (d))
-#define DUK_TVAL_SET_NUMBER(tv,val) \
- DUK_TVAL_SET_DOUBLE((tv), (val))
-#define DUK_TVAL_CHKFAST_INPLACE(v) do { \
- duk_tval *duk__tv; \
- duk_double_t duk__d; \
- duk__tv = (v); \
- if (DUK_TVAL_IS_DOUBLE(duk__tv)) { \
- duk__d = DUK_TVAL_GET_DOUBLE(duk__tv); \
- DUK_TVAL_SET_NUMBER_CHKFAST(duk__tv, duk__d); \
- } \
- } while (0)
-#else
-#define DUK_TVAL_SET_DOUBLE(tv,d) \
- DUK_TVAL_SET_NUMBER((tv), (d))
-#define DUK_TVAL_SET_FASTINT(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val)) /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_FASTINT_U32(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
-#define DUK_TVAL_SET_FASTINT_I32(tv,val) \
- DUK_TVAL_SET_NUMBER((tv), (duk_double_t) (val))
-#define DUK_TVAL_SET_NUMBER(tv,val) do { \
- (tv)->t = DUK__TAG_NUMBER; \
- (tv)->v.d = (val); \
- } while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST(tv,d) \
- DUK_TVAL_SET_NUMBER((tv), (d))
-#define DUK_TVAL_CHKFAST_INPLACE(v) do { } while (0)
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_POINTER(tv,hptr) do { \
- (tv)->t = DUK_TAG_POINTER; \
- (tv)->v.voidptr = (hptr); \
- } while (0)
-
-#define DUK_TVAL_SET_LIGHTFUNC(tv,fp,flags) do { \
- (tv)->t = DUK_TAG_LIGHTFUNC; \
- (tv)->v_extra = (flags); \
- (tv)->v.lightfunc = (duk_c_function) (fp); \
- } while (0)
-
-#define DUK_TVAL_SET_STRING(tv,hptr) do { \
- (tv)->t = DUK_TAG_STRING; \
- (tv)->v.hstring = (hptr); \
- } while (0)
-
-#define DUK_TVAL_SET_OBJECT(tv,hptr) do { \
- (tv)->t = DUK_TAG_OBJECT; \
- (tv)->v.hobject = (hptr); \
- } while (0)
-
-#define DUK_TVAL_SET_BUFFER(tv,hptr) do { \
- (tv)->t = DUK_TAG_BUFFER; \
- (tv)->v.hbuffer = (hptr); \
- } while (0)
-
-#define DUK_TVAL_SET_NAN(tv) do { \
- /* in non-packed representation we don't care about which NaN is used */ \
- (tv)->t = DUK__TAG_NUMBER; \
- (tv)->v.d = DUK_DOUBLE_NAN; \
- } while (0)
-
-#define DUK_TVAL_SET_TVAL(v,x) do { *(v) = *(x); } while (0)
-
-/* getters */
-#define DUK_TVAL_GET_BOOLEAN(tv) ((tv)->v.i)
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
-#define DUK_TVAL_GET_FASTINT(tv) ((tv)->v.fi)
-#define DUK_TVAL_GET_FASTINT_U32(tv) ((duk_uint32_t) ((tv)->v.fi))
-#define DUK_TVAL_GET_FASTINT_I32(tv) ((duk_int32_t) ((tv)->v.fi))
-#if 0
-#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? \
- (duk_double_t) DUK_TVAL_GET_FASTINT((tv)) : \
- DUK_TVAL_GET_DOUBLE((tv)))
-#define DUK_TVAL_GET_NUMBER(tv) duk_tval_get_number_unpacked((tv))
-#else
-/* This seems reasonable overall. */
-#define DUK_TVAL_GET_NUMBER(tv) (DUK_TVAL_IS_FASTINT((tv)) ? \
- duk_tval_get_number_unpacked_fastint((tv)) : \
- DUK_TVAL_GET_DOUBLE((tv)))
-#endif
-#else
-#define DUK_TVAL_GET_NUMBER(tv) ((tv)->v.d)
-#define DUK_TVAL_GET_DOUBLE(tv) ((tv)->v.d)
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_GET_POINTER(tv) ((tv)->v.voidptr)
-#define DUK_TVAL_GET_LIGHTFUNC(tv,out_fp,out_flags) do { \
- (out_flags) = (duk_uint32_t) (tv)->v_extra; \
- (out_fp) = (tv)->v.lightfunc; \
- } while (0)
-#define DUK_TVAL_GET_LIGHTFUNC_FUNCPTR(tv) ((tv)->v.lightfunc)
-#define DUK_TVAL_GET_LIGHTFUNC_FLAGS(tv) ((duk_uint32_t) ((tv)->v_extra))
-#define DUK_TVAL_GET_STRING(tv) ((tv)->v.hstring)
-#define DUK_TVAL_GET_OBJECT(tv) ((tv)->v.hobject)
-#define DUK_TVAL_GET_BUFFER(tv) ((tv)->v.hbuffer)
-#define DUK_TVAL_GET_HEAPHDR(tv) ((tv)->v.heaphdr)
-
-/* decoding */
-#define DUK_TVAL_GET_TAG(tv) ((tv)->t)
-#define DUK_TVAL_IS_UNDEFINED(tv) ((tv)->t == DUK_TAG_UNDEFINED)
-#define DUK_TVAL_IS_UNUSED(tv) ((tv)->t == DUK_TAG_UNUSED)
-#define DUK_TVAL_IS_NULL(tv) ((tv)->t == DUK_TAG_NULL)
-#define DUK_TVAL_IS_BOOLEAN(tv) ((tv)->t == DUK_TAG_BOOLEAN)
-#define DUK_TVAL_IS_BOOLEAN_TRUE(tv) (((tv)->t == DUK_TAG_BOOLEAN) && ((tv)->v.i != 0))
-#define DUK_TVAL_IS_BOOLEAN_FALSE(tv) (((tv)->t == DUK_TAG_BOOLEAN) && ((tv)->v.i == 0))
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_IS_DOUBLE(tv) ((tv)->t == DUK__TAG_NUMBER)
-#define DUK_TVAL_IS_FASTINT(tv) ((tv)->t == DUK_TAG_FASTINT)
-#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK__TAG_NUMBER || \
- (tv)->t == DUK_TAG_FASTINT)
-#else
-#define DUK_TVAL_IS_NUMBER(tv) ((tv)->t == DUK__TAG_NUMBER)
-#define DUK_TVAL_IS_DOUBLE(v) DUK_TVAL_IS_NUMBER((v))
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_IS_POINTER(tv) ((tv)->t == DUK_TAG_POINTER)
-#define DUK_TVAL_IS_LIGHTFUNC(tv) ((tv)->t == DUK_TAG_LIGHTFUNC)
-#define DUK_TVAL_IS_STRING(tv) ((tv)->t == DUK_TAG_STRING)
-#define DUK_TVAL_IS_OBJECT(tv) ((tv)->t == DUK_TAG_OBJECT)
-#define DUK_TVAL_IS_BUFFER(tv) ((tv)->t == DUK_TAG_BUFFER)
-
-/* This is performance critical because it's needed for every DECREF.
- * Take advantage of the fact that the first heap allocated tag is 8,
- * so that bit 3 is set for all heap allocated tags (and never set for
- * non-heap-allocated tags).
- */
-#if 0
-#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t >= DUK_TAG_STRING)
-#endif
-#define DUK_TVAL_IS_HEAP_ALLOCATED(tv) ((tv)->t & 0x08)
-
-#if defined(DUK_USE_FASTINT)
-#if 0
-DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_unpacked(duk_tval *tv);
-#endif
-DUK_INTERNAL_DECL duk_double_t duk_tval_get_number_unpacked_fastint(duk_tval *tv);
-#endif
-
-#endif /* DUK_USE_PACKED_TVAL */
-
-/*
- * Convenience (independent of representation)
- */
-
-#define DUK_TVAL_SET_BOOLEAN_TRUE(v) DUK_TVAL_SET_BOOLEAN(v, 1)
-#define DUK_TVAL_SET_BOOLEAN_FALSE(v) DUK_TVAL_SET_BOOLEAN(v, 0)
-
-/* Lightfunc flags packing and unpacking. */
-/* Sign extend: 0x0000##00 -> 0x##000000 -> sign extend to 0xssssss## */
-#define DUK_LFUNC_FLAGS_GET_MAGIC(lf_flags) \
- ((((duk_int32_t) (lf_flags)) << 16) >> 24)
-#define DUK_LFUNC_FLAGS_GET_LENGTH(lf_flags) \
- (((lf_flags) >> 4) & 0x0f)
-#define DUK_LFUNC_FLAGS_GET_NARGS(lf_flags) \
- ((lf_flags) & 0x0f)
-#define DUK_LFUNC_FLAGS_PACK(magic,length,nargs) \
- (((magic) & 0xff) << 8) | ((length) << 4) | (nargs)
-
-#define DUK_LFUNC_NARGS_VARARGS 0x0f /* varargs marker */
-#define DUK_LFUNC_NARGS_MIN 0x00
-#define DUK_LFUNC_NARGS_MAX 0x0e /* max, excl. varargs marker */
-#define DUK_LFUNC_LENGTH_MIN 0x00
-#define DUK_LFUNC_LENGTH_MAX 0x0f
-#define DUK_LFUNC_MAGIC_MIN (-0x80)
-#define DUK_LFUNC_MAGIC_MAX 0x7f
-
-/* fastint constants etc */
-#if defined(DUK_USE_FASTINT)
-#define DUK_FASTINT_MIN (-0x800000000000LL)
-#define DUK_FASTINT_MAX 0x7fffffffffffLL
-#define DUK_FASTINT_BITS 48
-
-DUK_INTERNAL_DECL void duk_tval_set_number_chkfast(duk_tval *tv, duk_double_t x);
-#endif
-
-#endif /* DUK_TVAL_H_INCLUDED */
-#line 1 "duk_builtins.h"
-/*
- * Automatically generated by genbuiltins.py, do not edit!
- */
-
-#ifndef DUK_BUILTINS_H_INCLUDED
-#define DUK_BUILTINS_H_INCLUDED
-
-#if defined(DUK_USE_ROM_STRINGS)
-#error ROM support not enabled, rerun make_dist.py with --rom-support
-#else /* DUK_USE_ROM_STRINGS */
-#define DUK_STRIDX_UC_UNDEFINED 0 /* 'Undefined' */
-#define DUK_HEAP_STRING_UC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_UNDEFINED)
-#define DUK_HTHREAD_STRING_UC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_UNDEFINED)
-#define DUK_STRIDX_UC_NULL 1 /* 'Null' */
-#define DUK_HEAP_STRING_UC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NULL)
-#define DUK_HTHREAD_STRING_UC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NULL)
-#define DUK_STRIDX_UC_ARGUMENTS 2 /* 'Arguments' */
-#define DUK_HEAP_STRING_UC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ARGUMENTS)
-#define DUK_HTHREAD_STRING_UC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ARGUMENTS)
-#define DUK_STRIDX_UC_OBJECT 3 /* 'Object' */
-#define DUK_HEAP_STRING_UC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_OBJECT)
-#define DUK_HTHREAD_STRING_UC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_OBJECT)
-#define DUK_STRIDX_UC_FUNCTION 4 /* 'Function' */
-#define DUK_HEAP_STRING_UC_FUNCTION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_FUNCTION)
-#define DUK_HTHREAD_STRING_UC_FUNCTION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_FUNCTION)
-#define DUK_STRIDX_ARRAY 5 /* 'Array' */
-#define DUK_HEAP_STRING_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ARRAY)
-#define DUK_HTHREAD_STRING_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ARRAY)
-#define DUK_STRIDX_UC_STRING 6 /* 'String' */
-#define DUK_HEAP_STRING_UC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_STRING)
-#define DUK_HTHREAD_STRING_UC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_STRING)
-#define DUK_STRIDX_UC_BOOLEAN 7 /* 'Boolean' */
-#define DUK_HEAP_STRING_UC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BOOLEAN)
-#define DUK_HTHREAD_STRING_UC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BOOLEAN)
-#define DUK_STRIDX_UC_NUMBER 8 /* 'Number' */
-#define DUK_HEAP_STRING_UC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_NUMBER)
-#define DUK_HTHREAD_STRING_UC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_NUMBER)
-#define DUK_STRIDX_DATE 9 /* 'Date' */
-#define DUK_HEAP_STRING_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DATE)
-#define DUK_HTHREAD_STRING_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DATE)
-#define DUK_STRIDX_REG_EXP 10 /* 'RegExp' */
-#define DUK_HEAP_STRING_REG_EXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REG_EXP)
-#define DUK_HTHREAD_STRING_REG_EXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REG_EXP)
-#define DUK_STRIDX_UC_ERROR 11 /* 'Error' */
-#define DUK_HEAP_STRING_UC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_ERROR)
-#define DUK_HTHREAD_STRING_UC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_ERROR)
-#define DUK_STRIDX_MATH 12 /* 'Math' */
-#define DUK_HEAP_STRING_MATH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MATH)
-#define DUK_HTHREAD_STRING_MATH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MATH)
-#define DUK_STRIDX_JSON 13 /* 'JSON' */
-#define DUK_HEAP_STRING_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON)
-#define DUK_HTHREAD_STRING_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON)
-#define DUK_STRIDX_EMPTY_STRING 14 /* '' */
-#define DUK_HEAP_STRING_EMPTY_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EMPTY_STRING)
-#define DUK_HTHREAD_STRING_EMPTY_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EMPTY_STRING)
-#define DUK_STRIDX_ARRAY_BUFFER 15 /* 'ArrayBuffer' */
-#define DUK_HEAP_STRING_ARRAY_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ARRAY_BUFFER)
-#define DUK_HTHREAD_STRING_ARRAY_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ARRAY_BUFFER)
-#define DUK_STRIDX_DATA_VIEW 16 /* 'DataView' */
-#define DUK_HEAP_STRING_DATA_VIEW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DATA_VIEW)
-#define DUK_HTHREAD_STRING_DATA_VIEW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DATA_VIEW)
-#define DUK_STRIDX_INT8_ARRAY 17 /* 'Int8Array' */
-#define DUK_HEAP_STRING_INT8_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT8_ARRAY)
-#define DUK_HTHREAD_STRING_INT8_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT8_ARRAY)
-#define DUK_STRIDX_UINT8_ARRAY 18 /* 'Uint8Array' */
-#define DUK_HEAP_STRING_UINT8_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UINT8_ARRAY)
-#define DUK_HTHREAD_STRING_UINT8_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UINT8_ARRAY)
-#define DUK_STRIDX_UINT8_CLAMPED_ARRAY 19 /* 'Uint8ClampedArray' */
-#define DUK_HEAP_STRING_UINT8_CLAMPED_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UINT8_CLAMPED_ARRAY)
-#define DUK_HTHREAD_STRING_UINT8_CLAMPED_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UINT8_CLAMPED_ARRAY)
-#define DUK_STRIDX_INT16_ARRAY 20 /* 'Int16Array' */
-#define DUK_HEAP_STRING_INT16_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT16_ARRAY)
-#define DUK_HTHREAD_STRING_INT16_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT16_ARRAY)
-#define DUK_STRIDX_UINT16_ARRAY 21 /* 'Uint16Array' */
-#define DUK_HEAP_STRING_UINT16_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UINT16_ARRAY)
-#define DUK_HTHREAD_STRING_UINT16_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UINT16_ARRAY)
-#define DUK_STRIDX_INT32_ARRAY 22 /* 'Int32Array' */
-#define DUK_HEAP_STRING_INT32_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT32_ARRAY)
-#define DUK_HTHREAD_STRING_INT32_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT32_ARRAY)
-#define DUK_STRIDX_UINT32_ARRAY 23 /* 'Uint32Array' */
-#define DUK_HEAP_STRING_UINT32_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UINT32_ARRAY)
-#define DUK_HTHREAD_STRING_UINT32_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UINT32_ARRAY)
-#define DUK_STRIDX_FLOAT32_ARRAY 24 /* 'Float32Array' */
-#define DUK_HEAP_STRING_FLOAT32_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FLOAT32_ARRAY)
-#define DUK_HTHREAD_STRING_FLOAT32_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FLOAT32_ARRAY)
-#define DUK_STRIDX_FLOAT64_ARRAY 25 /* 'Float64Array' */
-#define DUK_HEAP_STRING_FLOAT64_ARRAY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FLOAT64_ARRAY)
-#define DUK_HTHREAD_STRING_FLOAT64_ARRAY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FLOAT64_ARRAY)
-#define DUK_STRIDX_GLOBAL 26 /* 'global' */
-#define DUK_HEAP_STRING_GLOBAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GLOBAL)
-#define DUK_HTHREAD_STRING_GLOBAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GLOBAL)
-#define DUK_STRIDX_OBJ_ENV 27 /* 'ObjEnv' */
-#define DUK_HEAP_STRING_OBJ_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OBJ_ENV)
-#define DUK_HTHREAD_STRING_OBJ_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OBJ_ENV)
-#define DUK_STRIDX_DEC_ENV 28 /* 'DecEnv' */
-#define DUK_HEAP_STRING_DEC_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEC_ENV)
-#define DUK_HTHREAD_STRING_DEC_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEC_ENV)
-#define DUK_STRIDX_UC_BUFFER 29 /* 'Buffer' */
-#define DUK_HEAP_STRING_UC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_BUFFER)
-#define DUK_HTHREAD_STRING_UC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_BUFFER)
-#define DUK_STRIDX_UC_POINTER 30 /* 'Pointer' */
-#define DUK_HEAP_STRING_UC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_POINTER)
-#define DUK_HTHREAD_STRING_UC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_POINTER)
-#define DUK_STRIDX_UC_THREAD 31 /* 'Thread' */
-#define DUK_HEAP_STRING_UC_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_UC_THREAD)
-#define DUK_HTHREAD_STRING_UC_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_UC_THREAD)
-#define DUK_STRIDX_EVAL 32 /* 'eval' */
-#define DUK_HEAP_STRING_EVAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EVAL)
-#define DUK_HTHREAD_STRING_EVAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EVAL)
-#define DUK_STRIDX_DEFINE_PROPERTY 33 /* 'defineProperty' */
-#define DUK_HEAP_STRING_DEFINE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFINE_PROPERTY)
-#define DUK_HTHREAD_STRING_DEFINE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFINE_PROPERTY)
-#define DUK_STRIDX_VALUE 34 /* 'value' */
-#define DUK_HEAP_STRING_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE)
-#define DUK_HTHREAD_STRING_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE)
-#define DUK_STRIDX_WRITABLE 35 /* 'writable' */
-#define DUK_HEAP_STRING_WRITABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WRITABLE)
-#define DUK_HTHREAD_STRING_WRITABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WRITABLE)
-#define DUK_STRIDX_CONFIGURABLE 36 /* 'configurable' */
-#define DUK_HEAP_STRING_CONFIGURABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONFIGURABLE)
-#define DUK_HTHREAD_STRING_CONFIGURABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONFIGURABLE)
-#define DUK_STRIDX_ENUMERABLE 37 /* 'enumerable' */
-#define DUK_HEAP_STRING_ENUMERABLE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERABLE)
-#define DUK_HTHREAD_STRING_ENUMERABLE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERABLE)
-#define DUK_STRIDX_JOIN 38 /* 'join' */
-#define DUK_HEAP_STRING_JOIN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JOIN)
-#define DUK_HTHREAD_STRING_JOIN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JOIN)
-#define DUK_STRIDX_TO_LOCALE_STRING 39 /* 'toLocaleString' */
-#define DUK_HEAP_STRING_TO_LOCALE_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOCALE_STRING)
-#define DUK_HTHREAD_STRING_TO_LOCALE_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOCALE_STRING)
-#define DUK_STRIDX_VALUE_OF 40 /* 'valueOf' */
-#define DUK_HEAP_STRING_VALUE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VALUE_OF)
-#define DUK_HTHREAD_STRING_VALUE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VALUE_OF)
-#define DUK_STRIDX_TO_UTC_STRING 41 /* 'toUTCString' */
-#define DUK_HEAP_STRING_TO_UTC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_UTC_STRING)
-#define DUK_HTHREAD_STRING_TO_UTC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_UTC_STRING)
-#define DUK_STRIDX_TO_ISO_STRING 42 /* 'toISOString' */
-#define DUK_HEAP_STRING_TO_ISO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_ISO_STRING)
-#define DUK_HTHREAD_STRING_TO_ISO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_ISO_STRING)
-#define DUK_STRIDX_TO_GMT_STRING 43 /* 'toGMTString' */
-#define DUK_HEAP_STRING_TO_GMT_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_GMT_STRING)
-#define DUK_HTHREAD_STRING_TO_GMT_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_GMT_STRING)
-#define DUK_STRIDX_SOURCE 44 /* 'source' */
-#define DUK_HEAP_STRING_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SOURCE)
-#define DUK_HTHREAD_STRING_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SOURCE)
-#define DUK_STRIDX_IGNORE_CASE 45 /* 'ignoreCase' */
-#define DUK_HEAP_STRING_IGNORE_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IGNORE_CASE)
-#define DUK_HTHREAD_STRING_IGNORE_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IGNORE_CASE)
-#define DUK_STRIDX_MULTILINE 46 /* 'multiline' */
-#define DUK_HEAP_STRING_MULTILINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MULTILINE)
-#define DUK_HTHREAD_STRING_MULTILINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MULTILINE)
-#define DUK_STRIDX_LAST_INDEX 47 /* 'lastIndex' */
-#define DUK_HEAP_STRING_LAST_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LAST_INDEX)
-#define DUK_HTHREAD_STRING_LAST_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LAST_INDEX)
-#define DUK_STRIDX_ESCAPED_EMPTY_REGEXP 48 /* '(?:)' */
-#define DUK_HEAP_STRING_ESCAPED_EMPTY_REGEXP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
-#define DUK_HTHREAD_STRING_ESCAPED_EMPTY_REGEXP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ESCAPED_EMPTY_REGEXP)
-#define DUK_STRIDX_INDEX 49 /* 'index' */
-#define DUK_HEAP_STRING_INDEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INDEX)
-#define DUK_HTHREAD_STRING_INDEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INDEX)
-#define DUK_STRIDX_PROTOTYPE 50 /* 'prototype' */
-#define DUK_HEAP_STRING_PROTOTYPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTOTYPE)
-#define DUK_HTHREAD_STRING_PROTOTYPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTOTYPE)
-#define DUK_STRIDX_CONSTRUCTOR 51 /* 'constructor' */
-#define DUK_HEAP_STRING_CONSTRUCTOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONSTRUCTOR)
-#define DUK_HTHREAD_STRING_CONSTRUCTOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONSTRUCTOR)
-#define DUK_STRIDX_MESSAGE 52 /* 'message' */
-#define DUK_HEAP_STRING_MESSAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MESSAGE)
-#define DUK_HTHREAD_STRING_MESSAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MESSAGE)
-#define DUK_STRIDX_LC_BOOLEAN 53 /* 'boolean' */
-#define DUK_HEAP_STRING_LC_BOOLEAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BOOLEAN)
-#define DUK_HTHREAD_STRING_LC_BOOLEAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BOOLEAN)
-#define DUK_STRIDX_LC_NUMBER 54 /* 'number' */
-#define DUK_HEAP_STRING_LC_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NUMBER)
-#define DUK_HTHREAD_STRING_LC_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NUMBER)
-#define DUK_STRIDX_LC_STRING 55 /* 'string' */
-#define DUK_HEAP_STRING_LC_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_STRING)
-#define DUK_HTHREAD_STRING_LC_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_STRING)
-#define DUK_STRIDX_LC_OBJECT 56 /* 'object' */
-#define DUK_HEAP_STRING_LC_OBJECT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_OBJECT)
-#define DUK_HTHREAD_STRING_LC_OBJECT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_OBJECT)
-#define DUK_STRIDX_LC_UNDEFINED 57 /* 'undefined' */
-#define DUK_HEAP_STRING_LC_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_UNDEFINED)
-#define DUK_HTHREAD_STRING_LC_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_UNDEFINED)
-#define DUK_STRIDX_NAN 58 /* 'NaN' */
-#define DUK_HEAP_STRING_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAN)
-#define DUK_HTHREAD_STRING_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAN)
-#define DUK_STRIDX_INFINITY 59 /* 'Infinity' */
-#define DUK_HEAP_STRING_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INFINITY)
-#define DUK_HTHREAD_STRING_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INFINITY)
-#define DUK_STRIDX_MINUS_INFINITY 60 /* '-Infinity' */
-#define DUK_HEAP_STRING_MINUS_INFINITY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_INFINITY)
-#define DUK_HTHREAD_STRING_MINUS_INFINITY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_INFINITY)
-#define DUK_STRIDX_MINUS_ZERO 61 /* '-0' */
-#define DUK_HEAP_STRING_MINUS_ZERO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MINUS_ZERO)
-#define DUK_HTHREAD_STRING_MINUS_ZERO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MINUS_ZERO)
-#define DUK_STRIDX_COMMA 62 /* ',' */
-#define DUK_HEAP_STRING_COMMA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMMA)
-#define DUK_HTHREAD_STRING_COMMA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMMA)
-#define DUK_STRIDX_SPACE 63 /* ' ' */
-#define DUK_HEAP_STRING_SPACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SPACE)
-#define DUK_HTHREAD_STRING_SPACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SPACE)
-#define DUK_STRIDX_NEWLINE_4SPACE 64 /* '\n ' */
-#define DUK_HEAP_STRING_NEWLINE_4SPACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEWLINE_4SPACE)
-#define DUK_HTHREAD_STRING_NEWLINE_4SPACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEWLINE_4SPACE)
-#define DUK_STRIDX_BRACKETED_ELLIPSIS 65 /* '[...]' */
-#define DUK_HEAP_STRING_BRACKETED_ELLIPSIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BRACKETED_ELLIPSIS)
-#define DUK_HTHREAD_STRING_BRACKETED_ELLIPSIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BRACKETED_ELLIPSIS)
-#define DUK_STRIDX_INVALID_DATE 66 /* 'Invalid Date' */
-#define DUK_HEAP_STRING_INVALID_DATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INVALID_DATE)
-#define DUK_HTHREAD_STRING_INVALID_DATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INVALID_DATE)
-#define DUK_STRIDX_LC_ARGUMENTS 67 /* 'arguments' */
-#define DUK_HEAP_STRING_LC_ARGUMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ARGUMENTS)
-#define DUK_HTHREAD_STRING_LC_ARGUMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ARGUMENTS)
-#define DUK_STRIDX_CALLEE 68 /* 'callee' */
-#define DUK_HEAP_STRING_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLEE)
-#define DUK_HTHREAD_STRING_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLEE)
-#define DUK_STRIDX_CALLER 69 /* 'caller' */
-#define DUK_HEAP_STRING_CALLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CALLER)
-#define DUK_HTHREAD_STRING_CALLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CALLER)
-#define DUK_STRIDX_HAS 70 /* 'has' */
-#define DUK_HEAP_STRING_HAS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HAS)
-#define DUK_HTHREAD_STRING_HAS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HAS)
-#define DUK_STRIDX_GET 71 /* 'get' */
-#define DUK_HEAP_STRING_GET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_GET)
-#define DUK_HTHREAD_STRING_GET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_GET)
-#define DUK_STRIDX_DELETE_PROPERTY 72 /* 'deleteProperty' */
-#define DUK_HEAP_STRING_DELETE_PROPERTY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE_PROPERTY)
-#define DUK_HTHREAD_STRING_DELETE_PROPERTY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE_PROPERTY)
-#define DUK_STRIDX_ENUMERATE 73 /* 'enumerate' */
-#define DUK_HEAP_STRING_ENUMERATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUMERATE)
-#define DUK_HTHREAD_STRING_ENUMERATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUMERATE)
-#define DUK_STRIDX_OWN_KEYS 74 /* 'ownKeys' */
-#define DUK_HEAP_STRING_OWN_KEYS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_OWN_KEYS)
-#define DUK_HTHREAD_STRING_OWN_KEYS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_OWN_KEYS)
-#define DUK_STRIDX_SET_PROTOTYPE_OF 75 /* 'setPrototypeOf' */
-#define DUK_HEAP_STRING_SET_PROTOTYPE_OF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET_PROTOTYPE_OF)
-#define DUK_HTHREAD_STRING_SET_PROTOTYPE_OF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET_PROTOTYPE_OF)
-#define DUK_STRIDX___PROTO__ 76 /* '__proto__' */
-#define DUK_HEAP_STRING___PROTO__(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX___PROTO__)
-#define DUK_HTHREAD_STRING___PROTO__(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX___PROTO__)
-#define DUK_STRIDX_REQUIRE 77 /* 'require' */
-#define DUK_HEAP_STRING_REQUIRE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_REQUIRE)
-#define DUK_HTHREAD_STRING_REQUIRE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_REQUIRE)
-#define DUK_STRIDX_ID 78 /* 'id' */
-#define DUK_HEAP_STRING_ID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ID)
-#define DUK_HTHREAD_STRING_ID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ID)
-#define DUK_STRIDX_EXPORTS 79 /* 'exports' */
-#define DUK_HEAP_STRING_EXPORTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXPORTS)
-#define DUK_HTHREAD_STRING_EXPORTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXPORTS)
-#define DUK_STRIDX_FILENAME 80 /* 'filename' */
-#define DUK_HEAP_STRING_FILENAME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILENAME)
-#define DUK_HTHREAD_STRING_FILENAME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILENAME)
-#define DUK_STRIDX_TO_STRING 81 /* 'toString' */
-#define DUK_HEAP_STRING_TO_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_STRING)
-#define DUK_HTHREAD_STRING_TO_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_STRING)
-#define DUK_STRIDX_TO_JSON 82 /* 'toJSON' */
-#define DUK_HEAP_STRING_TO_JSON(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_JSON)
-#define DUK_HTHREAD_STRING_TO_JSON(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_JSON)
-#define DUK_STRIDX_TYPE 83 /* 'type' */
-#define DUK_HEAP_STRING_TYPE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPE)
-#define DUK_HTHREAD_STRING_TYPE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPE)
-#define DUK_STRIDX_DATA 84 /* 'data' */
-#define DUK_HEAP_STRING_DATA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DATA)
-#define DUK_HTHREAD_STRING_DATA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DATA)
-#define DUK_STRIDX_LENGTH 85 /* 'length' */
-#define DUK_HEAP_STRING_LENGTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LENGTH)
-#define DUK_HTHREAD_STRING_LENGTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LENGTH)
-#define DUK_STRIDX_BYTE_LENGTH 86 /* 'byteLength' */
-#define DUK_HEAP_STRING_BYTE_LENGTH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BYTE_LENGTH)
-#define DUK_HTHREAD_STRING_BYTE_LENGTH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BYTE_LENGTH)
-#define DUK_STRIDX_BYTE_OFFSET 87 /* 'byteOffset' */
-#define DUK_HEAP_STRING_BYTE_OFFSET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BYTE_OFFSET)
-#define DUK_HTHREAD_STRING_BYTE_OFFSET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BYTE_OFFSET)
-#define DUK_STRIDX_BYTES_PER_ELEMENT 88 /* 'BYTES_PER_ELEMENT' */
-#define DUK_HEAP_STRING_BYTES_PER_ELEMENT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BYTES_PER_ELEMENT)
-#define DUK_HTHREAD_STRING_BYTES_PER_ELEMENT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BYTES_PER_ELEMENT)
-#define DUK_STRIDX_SET 89 /* 'set' */
-#define DUK_HEAP_STRING_SET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SET)
-#define DUK_HTHREAD_STRING_SET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SET)
-#define DUK_STRIDX_STACK 90 /* 'stack' */
-#define DUK_HEAP_STRING_STACK(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STACK)
-#define DUK_HTHREAD_STRING_STACK(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STACK)
-#define DUK_STRIDX_PC 91 /* 'pc' */
-#define DUK_HEAP_STRING_PC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PC)
-#define DUK_HTHREAD_STRING_PC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PC)
-#define DUK_STRIDX_LINE_NUMBER 92 /* 'lineNumber' */
-#define DUK_HEAP_STRING_LINE_NUMBER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LINE_NUMBER)
-#define DUK_HTHREAD_STRING_LINE_NUMBER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LINE_NUMBER)
-#define DUK_STRIDX_INT_TRACEDATA 93 /* '\xffTracedata' */
-#define DUK_HEAP_STRING_INT_TRACEDATA(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_TRACEDATA)
-#define DUK_HTHREAD_STRING_INT_TRACEDATA(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_TRACEDATA)
-#define DUK_STRIDX_NAME 94 /* 'name' */
-#define DUK_HEAP_STRING_NAME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NAME)
-#define DUK_HTHREAD_STRING_NAME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NAME)
-#define DUK_STRIDX_FILE_NAME 95 /* 'fileName' */
-#define DUK_HEAP_STRING_FILE_NAME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FILE_NAME)
-#define DUK_HTHREAD_STRING_FILE_NAME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FILE_NAME)
-#define DUK_STRIDX_LC_BUFFER 96 /* 'buffer' */
-#define DUK_HEAP_STRING_LC_BUFFER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_BUFFER)
-#define DUK_HTHREAD_STRING_LC_BUFFER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_BUFFER)
-#define DUK_STRIDX_LC_POINTER 97 /* 'pointer' */
-#define DUK_HEAP_STRING_LC_POINTER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_POINTER)
-#define DUK_HTHREAD_STRING_LC_POINTER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_POINTER)
-#define DUK_STRIDX_INT_VALUE 98 /* '\xffValue' */
-#define DUK_HEAP_STRING_INT_VALUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VALUE)
-#define DUK_HTHREAD_STRING_INT_VALUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VALUE)
-#define DUK_STRIDX_INT_NEXT 99 /* '\xffNext' */
-#define DUK_HEAP_STRING_INT_NEXT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_NEXT)
-#define DUK_HTHREAD_STRING_INT_NEXT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_NEXT)
-#define DUK_STRIDX_INT_BYTECODE 100 /* '\xffBytecode' */
-#define DUK_HEAP_STRING_INT_BYTECODE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_BYTECODE)
-#define DUK_HTHREAD_STRING_INT_BYTECODE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_BYTECODE)
-#define DUK_STRIDX_INT_FORMALS 101 /* '\xffFormals' */
-#define DUK_HEAP_STRING_INT_FORMALS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_FORMALS)
-#define DUK_HTHREAD_STRING_INT_FORMALS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_FORMALS)
-#define DUK_STRIDX_INT_VARMAP 102 /* '\xffVarmap' */
-#define DUK_HEAP_STRING_INT_VARMAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VARMAP)
-#define DUK_HTHREAD_STRING_INT_VARMAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VARMAP)
-#define DUK_STRIDX_INT_LEXENV 103 /* '\xffLexenv' */
-#define DUK_HEAP_STRING_INT_LEXENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_LEXENV)
-#define DUK_HTHREAD_STRING_INT_LEXENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_LEXENV)
-#define DUK_STRIDX_INT_VARENV 104 /* '\xffVarenv' */
-#define DUK_HEAP_STRING_INT_VARENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_VARENV)
-#define DUK_HTHREAD_STRING_INT_VARENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_VARENV)
-#define DUK_STRIDX_INT_SOURCE 105 /* '\xffSource' */
-#define DUK_HEAP_STRING_INT_SOURCE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_SOURCE)
-#define DUK_HTHREAD_STRING_INT_SOURCE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_SOURCE)
-#define DUK_STRIDX_INT_PC2LINE 106 /* '\xffPc2line' */
-#define DUK_HEAP_STRING_INT_PC2LINE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_PC2LINE)
-#define DUK_HTHREAD_STRING_INT_PC2LINE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_PC2LINE)
-#define DUK_STRIDX_INT_ARGS 107 /* '\xffArgs' */
-#define DUK_HEAP_STRING_INT_ARGS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_ARGS)
-#define DUK_HTHREAD_STRING_INT_ARGS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_ARGS)
-#define DUK_STRIDX_INT_MAP 108 /* '\xffMap' */
-#define DUK_HEAP_STRING_INT_MAP(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_MAP)
-#define DUK_HTHREAD_STRING_INT_MAP(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_MAP)
-#define DUK_STRIDX_INT_FINALIZER 109 /* '\xffFinalizer' */
-#define DUK_HEAP_STRING_INT_FINALIZER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_FINALIZER)
-#define DUK_HTHREAD_STRING_INT_FINALIZER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_FINALIZER)
-#define DUK_STRIDX_INT_HANDLER 110 /* '\xffHandler' */
-#define DUK_HEAP_STRING_INT_HANDLER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_HANDLER)
-#define DUK_HTHREAD_STRING_INT_HANDLER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_HANDLER)
-#define DUK_STRIDX_INT_CALLEE 111 /* '\xffCallee' */
-#define DUK_HEAP_STRING_INT_CALLEE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_CALLEE)
-#define DUK_HTHREAD_STRING_INT_CALLEE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_CALLEE)
-#define DUK_STRIDX_INT_THREAD 112 /* '\xffThread' */
-#define DUK_HEAP_STRING_INT_THREAD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THREAD)
-#define DUK_HTHREAD_STRING_INT_THREAD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THREAD)
-#define DUK_STRIDX_INT_REGBASE 113 /* '\xffRegbase' */
-#define DUK_HEAP_STRING_INT_REGBASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_REGBASE)
-#define DUK_HTHREAD_STRING_INT_REGBASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_REGBASE)
-#define DUK_STRIDX_INT_TARGET 114 /* '\xffTarget' */
-#define DUK_HEAP_STRING_INT_TARGET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_TARGET)
-#define DUK_HTHREAD_STRING_INT_TARGET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_TARGET)
-#define DUK_STRIDX_INT_THIS 115 /* '\xffThis' */
-#define DUK_HEAP_STRING_INT_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INT_THIS)
-#define DUK_HTHREAD_STRING_INT_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INT_THIS)
-#define DUK_STRIDX_COMPILE 116 /* 'compile' */
-#define DUK_HEAP_STRING_COMPILE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_COMPILE)
-#define DUK_HTHREAD_STRING_COMPILE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_COMPILE)
-#define DUK_STRIDX_INPUT 117 /* 'input' */
-#define DUK_HEAP_STRING_INPUT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INPUT)
-#define DUK_HTHREAD_STRING_INPUT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INPUT)
-#define DUK_STRIDX_ERR_CREATE 118 /* 'errCreate' */
-#define DUK_HEAP_STRING_ERR_CREATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ERR_CREATE)
-#define DUK_HTHREAD_STRING_ERR_CREATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ERR_CREATE)
-#define DUK_STRIDX_ERR_THROW 119 /* 'errThrow' */
-#define DUK_HEAP_STRING_ERR_THROW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ERR_THROW)
-#define DUK_HTHREAD_STRING_ERR_THROW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ERR_THROW)
-#define DUK_STRIDX_MOD_SEARCH 120 /* 'modSearch' */
-#define DUK_HEAP_STRING_MOD_SEARCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_SEARCH)
-#define DUK_HTHREAD_STRING_MOD_SEARCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_SEARCH)
-#define DUK_STRIDX_MOD_LOADED 121 /* 'modLoaded' */
-#define DUK_HEAP_STRING_MOD_LOADED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_MOD_LOADED)
-#define DUK_HTHREAD_STRING_MOD_LOADED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_MOD_LOADED)
-#define DUK_STRIDX_ENV 122 /* 'env' */
-#define DUK_HEAP_STRING_ENV(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENV)
-#define DUK_HTHREAD_STRING_ENV(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENV)
-#define DUK_STRIDX_HEX 123 /* 'hex' */
-#define DUK_HEAP_STRING_HEX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_HEX)
-#define DUK_HTHREAD_STRING_HEX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_HEX)
-#define DUK_STRIDX_BASE64 124 /* 'base64' */
-#define DUK_HEAP_STRING_BASE64(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BASE64)
-#define DUK_HTHREAD_STRING_BASE64(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BASE64)
-#define DUK_STRIDX_JX 125 /* 'jx' */
-#define DUK_HEAP_STRING_JX(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JX)
-#define DUK_HTHREAD_STRING_JX(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JX)
-#define DUK_STRIDX_JC 126 /* 'jc' */
-#define DUK_HEAP_STRING_JC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JC)
-#define DUK_HTHREAD_STRING_JC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JC)
-#define DUK_STRIDX_RESUME 127 /* 'resume' */
-#define DUK_HEAP_STRING_RESUME(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RESUME)
-#define DUK_HTHREAD_STRING_RESUME(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RESUME)
-#define DUK_STRIDX_FMT 128 /* 'fmt' */
-#define DUK_HEAP_STRING_FMT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FMT)
-#define DUK_HTHREAD_STRING_FMT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FMT)
-#define DUK_STRIDX_RAW 129 /* 'raw' */
-#define DUK_HEAP_STRING_RAW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RAW)
-#define DUK_HTHREAD_STRING_RAW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RAW)
-#define DUK_STRIDX_LC_TRACE 130 /* 'trace' */
-#define DUK_HEAP_STRING_LC_TRACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_TRACE)
-#define DUK_HTHREAD_STRING_LC_TRACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_TRACE)
-#define DUK_STRIDX_LC_DEBUG 131 /* 'debug' */
-#define DUK_HEAP_STRING_LC_DEBUG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_DEBUG)
-#define DUK_HTHREAD_STRING_LC_DEBUG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_DEBUG)
-#define DUK_STRIDX_LC_INFO 132 /* 'info' */
-#define DUK_HEAP_STRING_LC_INFO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_INFO)
-#define DUK_HTHREAD_STRING_LC_INFO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_INFO)
-#define DUK_STRIDX_LC_WARN 133 /* 'warn' */
-#define DUK_HEAP_STRING_LC_WARN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_WARN)
-#define DUK_HTHREAD_STRING_LC_WARN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_WARN)
-#define DUK_STRIDX_LC_ERROR 134 /* 'error' */
-#define DUK_HEAP_STRING_LC_ERROR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_ERROR)
-#define DUK_HTHREAD_STRING_LC_ERROR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_ERROR)
-#define DUK_STRIDX_LC_FATAL 135 /* 'fatal' */
-#define DUK_HEAP_STRING_LC_FATAL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FATAL)
-#define DUK_HTHREAD_STRING_LC_FATAL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FATAL)
-#define DUK_STRIDX_LC_N 136 /* 'n' */
-#define DUK_HEAP_STRING_LC_N(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_N)
-#define DUK_HTHREAD_STRING_LC_N(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_N)
-#define DUK_STRIDX_LC_L 137 /* 'l' */
-#define DUK_HEAP_STRING_LC_L(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_L)
-#define DUK_HTHREAD_STRING_LC_L(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_L)
-#define DUK_STRIDX_CLOG 138 /* 'clog' */
-#define DUK_HEAP_STRING_CLOG(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLOG)
-#define DUK_HTHREAD_STRING_CLOG(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLOG)
-#define DUK_STRIDX_TO_LOG_STRING 139 /* 'toLogString' */
-#define DUK_HEAP_STRING_TO_LOG_STRING(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TO_LOG_STRING)
-#define DUK_HTHREAD_STRING_TO_LOG_STRING(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TO_LOG_STRING)
-#define DUK_STRIDX_JSON_EXT_UNDEFINED 140 /* '{"_undef":true}' */
-#define DUK_HEAP_STRING_JSON_EXT_UNDEFINED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_UNDEFINED)
-#define DUK_HTHREAD_STRING_JSON_EXT_UNDEFINED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_UNDEFINED)
-#define DUK_STRIDX_JSON_EXT_NAN 141 /* '{"_nan":true}' */
-#define DUK_HEAP_STRING_JSON_EXT_NAN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_NAN)
-#define DUK_HTHREAD_STRING_JSON_EXT_NAN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_NAN)
-#define DUK_STRIDX_JSON_EXT_POSINF 142 /* '{"_inf":true}' */
-#define DUK_HEAP_STRING_JSON_EXT_POSINF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_POSINF)
-#define DUK_HTHREAD_STRING_JSON_EXT_POSINF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_POSINF)
-#define DUK_STRIDX_JSON_EXT_NEGINF 143 /* '{"_ninf":true}' */
-#define DUK_HEAP_STRING_JSON_EXT_NEGINF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_NEGINF)
-#define DUK_HTHREAD_STRING_JSON_EXT_NEGINF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_NEGINF)
-#define DUK_STRIDX_JSON_EXT_FUNCTION1 144 /* '{"_func":true}' */
-#define DUK_HEAP_STRING_JSON_EXT_FUNCTION1(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_FUNCTION1)
-#define DUK_HTHREAD_STRING_JSON_EXT_FUNCTION1(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_FUNCTION1)
-#define DUK_STRIDX_JSON_EXT_FUNCTION2 145 /* '{_func:true}' */
-#define DUK_HEAP_STRING_JSON_EXT_FUNCTION2(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_JSON_EXT_FUNCTION2)
-#define DUK_HTHREAD_STRING_JSON_EXT_FUNCTION2(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_JSON_EXT_FUNCTION2)
-#define DUK_STRIDX_BREAK 146 /* 'break' */
-#define DUK_HEAP_STRING_BREAK(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_BREAK)
-#define DUK_HTHREAD_STRING_BREAK(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_BREAK)
-#define DUK_STRIDX_CASE 147 /* 'case' */
-#define DUK_HEAP_STRING_CASE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CASE)
-#define DUK_HTHREAD_STRING_CASE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CASE)
-#define DUK_STRIDX_CATCH 148 /* 'catch' */
-#define DUK_HEAP_STRING_CATCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CATCH)
-#define DUK_HTHREAD_STRING_CATCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CATCH)
-#define DUK_STRIDX_CONTINUE 149 /* 'continue' */
-#define DUK_HEAP_STRING_CONTINUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONTINUE)
-#define DUK_HTHREAD_STRING_CONTINUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONTINUE)
-#define DUK_STRIDX_DEBUGGER 150 /* 'debugger' */
-#define DUK_HEAP_STRING_DEBUGGER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEBUGGER)
-#define DUK_HTHREAD_STRING_DEBUGGER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEBUGGER)
-#define DUK_STRIDX_DEFAULT 151 /* 'default' */
-#define DUK_HEAP_STRING_DEFAULT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DEFAULT)
-#define DUK_HTHREAD_STRING_DEFAULT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DEFAULT)
-#define DUK_STRIDX_DELETE 152 /* 'delete' */
-#define DUK_HEAP_STRING_DELETE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DELETE)
-#define DUK_HTHREAD_STRING_DELETE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DELETE)
-#define DUK_STRIDX_DO 153 /* 'do' */
-#define DUK_HEAP_STRING_DO(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_DO)
-#define DUK_HTHREAD_STRING_DO(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_DO)
-#define DUK_STRIDX_ELSE 154 /* 'else' */
-#define DUK_HEAP_STRING_ELSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ELSE)
-#define DUK_HTHREAD_STRING_ELSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ELSE)
-#define DUK_STRIDX_FINALLY 155 /* 'finally' */
-#define DUK_HEAP_STRING_FINALLY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FINALLY)
-#define DUK_HTHREAD_STRING_FINALLY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FINALLY)
-#define DUK_STRIDX_FOR 156 /* 'for' */
-#define DUK_HEAP_STRING_FOR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FOR)
-#define DUK_HTHREAD_STRING_FOR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FOR)
-#define DUK_STRIDX_LC_FUNCTION 157 /* 'function' */
-#define DUK_HEAP_STRING_LC_FUNCTION(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_FUNCTION)
-#define DUK_HTHREAD_STRING_LC_FUNCTION(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_FUNCTION)
-#define DUK_STRIDX_IF 158 /* 'if' */
-#define DUK_HEAP_STRING_IF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IF)
-#define DUK_HTHREAD_STRING_IF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IF)
-#define DUK_STRIDX_IN 159 /* 'in' */
-#define DUK_HEAP_STRING_IN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IN)
-#define DUK_HTHREAD_STRING_IN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IN)
-#define DUK_STRIDX_INSTANCEOF 160 /* 'instanceof' */
-#define DUK_HEAP_STRING_INSTANCEOF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INSTANCEOF)
-#define DUK_HTHREAD_STRING_INSTANCEOF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INSTANCEOF)
-#define DUK_STRIDX_NEW 161 /* 'new' */
-#define DUK_HEAP_STRING_NEW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_NEW)
-#define DUK_HTHREAD_STRING_NEW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_NEW)
-#define DUK_STRIDX_RETURN 162 /* 'return' */
-#define DUK_HEAP_STRING_RETURN(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_RETURN)
-#define DUK_HTHREAD_STRING_RETURN(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_RETURN)
-#define DUK_STRIDX_SWITCH 163 /* 'switch' */
-#define DUK_HEAP_STRING_SWITCH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SWITCH)
-#define DUK_HTHREAD_STRING_SWITCH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SWITCH)
-#define DUK_STRIDX_THIS 164 /* 'this' */
-#define DUK_HEAP_STRING_THIS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THIS)
-#define DUK_HTHREAD_STRING_THIS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THIS)
-#define DUK_STRIDX_THROW 165 /* 'throw' */
-#define DUK_HEAP_STRING_THROW(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_THROW)
-#define DUK_HTHREAD_STRING_THROW(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_THROW)
-#define DUK_STRIDX_TRY 166 /* 'try' */
-#define DUK_HEAP_STRING_TRY(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRY)
-#define DUK_HTHREAD_STRING_TRY(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRY)
-#define DUK_STRIDX_TYPEOF 167 /* 'typeof' */
-#define DUK_HEAP_STRING_TYPEOF(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TYPEOF)
-#define DUK_HTHREAD_STRING_TYPEOF(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TYPEOF)
-#define DUK_STRIDX_VAR 168 /* 'var' */
-#define DUK_HEAP_STRING_VAR(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VAR)
-#define DUK_HTHREAD_STRING_VAR(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VAR)
-#define DUK_STRIDX_CONST 169 /* 'const' */
-#define DUK_HEAP_STRING_CONST(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CONST)
-#define DUK_HTHREAD_STRING_CONST(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CONST)
-#define DUK_STRIDX_VOID 170 /* 'void' */
-#define DUK_HEAP_STRING_VOID(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_VOID)
-#define DUK_HTHREAD_STRING_VOID(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_VOID)
-#define DUK_STRIDX_WHILE 171 /* 'while' */
-#define DUK_HEAP_STRING_WHILE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WHILE)
-#define DUK_HTHREAD_STRING_WHILE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WHILE)
-#define DUK_STRIDX_WITH 172 /* 'with' */
-#define DUK_HEAP_STRING_WITH(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_WITH)
-#define DUK_HTHREAD_STRING_WITH(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_WITH)
-#define DUK_STRIDX_CLASS 173 /* 'class' */
-#define DUK_HEAP_STRING_CLASS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_CLASS)
-#define DUK_HTHREAD_STRING_CLASS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_CLASS)
-#define DUK_STRIDX_ENUM 174 /* 'enum' */
-#define DUK_HEAP_STRING_ENUM(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_ENUM)
-#define DUK_HTHREAD_STRING_ENUM(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_ENUM)
-#define DUK_STRIDX_EXPORT 175 /* 'export' */
-#define DUK_HEAP_STRING_EXPORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXPORT)
-#define DUK_HTHREAD_STRING_EXPORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXPORT)
-#define DUK_STRIDX_EXTENDS 176 /* 'extends' */
-#define DUK_HEAP_STRING_EXTENDS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_EXTENDS)
-#define DUK_HTHREAD_STRING_EXTENDS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_EXTENDS)
-#define DUK_STRIDX_IMPORT 177 /* 'import' */
-#define DUK_HEAP_STRING_IMPORT(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IMPORT)
-#define DUK_HTHREAD_STRING_IMPORT(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IMPORT)
-#define DUK_STRIDX_SUPER 178 /* 'super' */
-#define DUK_HEAP_STRING_SUPER(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_SUPER)
-#define DUK_HTHREAD_STRING_SUPER(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_SUPER)
-#define DUK_STRIDX_LC_NULL 179 /* 'null' */
-#define DUK_HEAP_STRING_LC_NULL(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LC_NULL)
-#define DUK_HTHREAD_STRING_LC_NULL(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LC_NULL)
-#define DUK_STRIDX_TRUE 180 /* 'true' */
-#define DUK_HEAP_STRING_TRUE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_TRUE)
-#define DUK_HTHREAD_STRING_TRUE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_TRUE)
-#define DUK_STRIDX_FALSE 181 /* 'false' */
-#define DUK_HEAP_STRING_FALSE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_FALSE)
-#define DUK_HTHREAD_STRING_FALSE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_FALSE)
-#define DUK_STRIDX_IMPLEMENTS 182 /* 'implements' */
-#define DUK_HEAP_STRING_IMPLEMENTS(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_IMPLEMENTS)
-#define DUK_HTHREAD_STRING_IMPLEMENTS(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_IMPLEMENTS)
-#define DUK_STRIDX_INTERFACE 183 /* 'interface' */
-#define DUK_HEAP_STRING_INTERFACE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_INTERFACE)
-#define DUK_HTHREAD_STRING_INTERFACE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_INTERFACE)
-#define DUK_STRIDX_LET 184 /* 'let' */
-#define DUK_HEAP_STRING_LET(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_LET)
-#define DUK_HTHREAD_STRING_LET(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_LET)
-#define DUK_STRIDX_PACKAGE 185 /* 'package' */
-#define DUK_HEAP_STRING_PACKAGE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PACKAGE)
-#define DUK_HTHREAD_STRING_PACKAGE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PACKAGE)
-#define DUK_STRIDX_PRIVATE 186 /* 'private' */
-#define DUK_HEAP_STRING_PRIVATE(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PRIVATE)
-#define DUK_HTHREAD_STRING_PRIVATE(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PRIVATE)
-#define DUK_STRIDX_PROTECTED 187 /* 'protected' */
-#define DUK_HEAP_STRING_PROTECTED(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PROTECTED)
-#define DUK_HTHREAD_STRING_PROTECTED(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PROTECTED)
-#define DUK_STRIDX_PUBLIC 188 /* 'public' */
-#define DUK_HEAP_STRING_PUBLIC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_PUBLIC)
-#define DUK_HTHREAD_STRING_PUBLIC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_PUBLIC)
-#define DUK_STRIDX_STATIC 189 /* 'static' */
-#define DUK_HEAP_STRING_STATIC(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_STATIC)
-#define DUK_HTHREAD_STRING_STATIC(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_STATIC)
-#define DUK_STRIDX_YIELD 190 /* 'yield' */
-#define DUK_HEAP_STRING_YIELD(heap) DUK_HEAP_GET_STRING((heap),DUK_STRIDX_YIELD)
-#define DUK_HTHREAD_STRING_YIELD(thr) DUK_HTHREAD_GET_STRING((thr),DUK_STRIDX_YIELD)
-
-#define DUK_HEAP_NUM_STRINGS 191
-#define DUK_STRIDX_START_RESERVED 146
-#define DUK_STRIDX_START_STRICT_RESERVED 182
-#define DUK_STRIDX_END_RESERVED 191 /* exclusive endpoint */
-
-/* To convert a heap stridx to a token number, subtract
- * DUK_STRIDX_START_RESERVED and add DUK_TOK_START_RESERVED.
- */
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_strings_data[1049];
-#endif /* !DUK_SINGLE_FILE */
-#define DUK_STRDATA_MAX_STRLEN 17
-#define DUK_STRDATA_DATA_LENGTH 1049
-#endif /* DUK_USE_ROM_STRINGS */
-
-#if defined(DUK_USE_ROM_OBJECTS)
-#error ROM support not enabled, rerun make_dist.py with --rom-support
-#else
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_boolean_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_constructor_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_type_error_thrower(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_proxy_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_pointer_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_arraybuffer_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_dataview_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_typedarray_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_constructor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_eval(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_parse_int(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_parse_float(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_is_nan(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_is_finite(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_decode_uri(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_decode_uri_component(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_encode_uri(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_encode_uri_component(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_escape(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_unescape(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_print_helper(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_global_object_require(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_getprototype_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_setprototype_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_get_own_property_descriptor(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_keys_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_create(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_define_property(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_define_properties(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_seal_freeze_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_prevent_extensions(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_is_sealed_frozen_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_constructor_is_extensible(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_to_locale_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_value_of(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_has_own_property(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_is_prototype_of(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_object_prototype_property_is_enumerable(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_apply(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_call(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_function_prototype_bind(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_constructor_is_array(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_join_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_concat(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_pop(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_push(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_reverse(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_shift(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_slice(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_sort(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_splice(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_unshift(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_indexof_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_iter_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_array_prototype_reduce_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_constructor_from_char_code(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_at(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_char_code_at(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_concat(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_indexof_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_locale_compare(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_match(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_replace(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_search(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_slice(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_split(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_substring(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_caseconv_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_trim(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_string_prototype_substr(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_boolean_prototype_tostring_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_locale_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_value_of(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_fixed(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_exponential(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_number_prototype_to_precision(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_parse(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_utc(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_constructor_now(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_tostring_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_to_json(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_value_of(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_get_timezone_offset(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_time(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_date_prototype_set_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_exec(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_test(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_regexp_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_stack_getter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_stack_setter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_filename_getter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_filename_setter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_linenumber_getter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_linenumber_setter(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_error_prototype_to_string(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_onearg_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_twoarg_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_max(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_min(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_math_object_random(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_json_object_parse(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_json_object_stringify(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_info(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_act(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_gc(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_fin(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_enc(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_dec(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_duktape_object_compact(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_yield(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_resume(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_thread_current(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_prototype_tostring_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_pointer_prototype_tostring_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_fmt(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_raw(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_logger_prototype_log_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_arraybuffer_isview(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_slice_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_readfield(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_writefield(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_typedarray_set(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_concat(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_is_encoding(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_is_buffer(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_byte_length(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_buffer_compare_shared(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_tostring(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_tojson(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_fill(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_copy(duk_context *ctx);
-DUK_INTERNAL_DECL duk_ret_t duk_bi_nodejs_buffer_write(duk_context *ctx);
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_c_function duk_bi_native_functions[149];
-#endif /* !DUK_SINGLE_FILE */
-#if defined(DUK_USE_BUILTIN_INITJS)
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_initjs_data[187];
-#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTIN_INITJS_DATA_LENGTH 187
-#endif /* DUK_USE_BUILTIN_INITJS */
-#define DUK_BIDX_GLOBAL 0
-#define DUK_BIDX_GLOBAL_ENV 1
-#define DUK_BIDX_OBJECT_CONSTRUCTOR 2
-#define DUK_BIDX_OBJECT_PROTOTYPE 3
-#define DUK_BIDX_FUNCTION_CONSTRUCTOR 4
-#define DUK_BIDX_FUNCTION_PROTOTYPE 5
-#define DUK_BIDX_ARRAY_CONSTRUCTOR 6
-#define DUK_BIDX_ARRAY_PROTOTYPE 7
-#define DUK_BIDX_STRING_CONSTRUCTOR 8
-#define DUK_BIDX_STRING_PROTOTYPE 9
-#define DUK_BIDX_BOOLEAN_CONSTRUCTOR 10
-#define DUK_BIDX_BOOLEAN_PROTOTYPE 11
-#define DUK_BIDX_NUMBER_CONSTRUCTOR 12
-#define DUK_BIDX_NUMBER_PROTOTYPE 13
-#define DUK_BIDX_DATE_CONSTRUCTOR 14
-#define DUK_BIDX_DATE_PROTOTYPE 15
-#define DUK_BIDX_REGEXP_CONSTRUCTOR 16
-#define DUK_BIDX_REGEXP_PROTOTYPE 17
-#define DUK_BIDX_ERROR_CONSTRUCTOR 18
-#define DUK_BIDX_ERROR_PROTOTYPE 19
-#define DUK_BIDX_EVAL_ERROR_CONSTRUCTOR 20
-#define DUK_BIDX_EVAL_ERROR_PROTOTYPE 21
-#define DUK_BIDX_RANGE_ERROR_CONSTRUCTOR 22
-#define DUK_BIDX_RANGE_ERROR_PROTOTYPE 23
-#define DUK_BIDX_REFERENCE_ERROR_CONSTRUCTOR 24
-#define DUK_BIDX_REFERENCE_ERROR_PROTOTYPE 25
-#define DUK_BIDX_SYNTAX_ERROR_CONSTRUCTOR 26
-#define DUK_BIDX_SYNTAX_ERROR_PROTOTYPE 27
-#define DUK_BIDX_TYPE_ERROR_CONSTRUCTOR 28
-#define DUK_BIDX_TYPE_ERROR_PROTOTYPE 29
-#define DUK_BIDX_URI_ERROR_CONSTRUCTOR 30
-#define DUK_BIDX_URI_ERROR_PROTOTYPE 31
-#define DUK_BIDX_MATH 32
-#define DUK_BIDX_JSON 33
-#define DUK_BIDX_TYPE_ERROR_THROWER 34
-#define DUK_BIDX_PROXY_CONSTRUCTOR 35
-#define DUK_BIDX_DUKTAPE 36
-#define DUK_BIDX_THREAD_CONSTRUCTOR 37
-#define DUK_BIDX_THREAD_PROTOTYPE 38
-#define DUK_BIDX_BUFFER_CONSTRUCTOR 39
-#define DUK_BIDX_BUFFER_PROTOTYPE 40
-#define DUK_BIDX_POINTER_CONSTRUCTOR 41
-#define DUK_BIDX_POINTER_PROTOTYPE 42
-#define DUK_BIDX_LOGGER_CONSTRUCTOR 43
-#define DUK_BIDX_LOGGER_PROTOTYPE 44
-#define DUK_BIDX_DOUBLE_ERROR 45
-#define DUK_BIDX_ARRAYBUFFER_CONSTRUCTOR 46
-#define DUK_BIDX_ARRAYBUFFER_PROTOTYPE 47
-#define DUK_BIDX_DATAVIEW_CONSTRUCTOR 48
-#define DUK_BIDX_DATAVIEW_PROTOTYPE 49
-#define DUK_BIDX_TYPEDARRAY_PROTOTYPE 50
-#define DUK_BIDX_INT8ARRAY_CONSTRUCTOR 51
-#define DUK_BIDX_INT8ARRAY_PROTOTYPE 52
-#define DUK_BIDX_UINT8ARRAY_CONSTRUCTOR 53
-#define DUK_BIDX_UINT8ARRAY_PROTOTYPE 54
-#define DUK_BIDX_UINT8CLAMPEDARRAY_CONSTRUCTOR 55
-#define DUK_BIDX_UINT8CLAMPEDARRAY_PROTOTYPE 56
-#define DUK_BIDX_INT16ARRAY_CONSTRUCTOR 57
-#define DUK_BIDX_INT16ARRAY_PROTOTYPE 58
-#define DUK_BIDX_UINT16ARRAY_CONSTRUCTOR 59
-#define DUK_BIDX_UINT16ARRAY_PROTOTYPE 60
-#define DUK_BIDX_INT32ARRAY_CONSTRUCTOR 61
-#define DUK_BIDX_INT32ARRAY_PROTOTYPE 62
-#define DUK_BIDX_UINT32ARRAY_CONSTRUCTOR 63
-#define DUK_BIDX_UINT32ARRAY_PROTOTYPE 64
-#define DUK_BIDX_FLOAT32ARRAY_CONSTRUCTOR 65
-#define DUK_BIDX_FLOAT32ARRAY_PROTOTYPE 66
-#define DUK_BIDX_FLOAT64ARRAY_CONSTRUCTOR 67
-#define DUK_BIDX_FLOAT64ARRAY_PROTOTYPE 68
-#define DUK_BIDX_NODEJS_BUFFER_CONSTRUCTOR 69
-#define DUK_BIDX_NODEJS_BUFFER_PROTOTYPE 70
-#define DUK_NUM_BUILTINS 71
-#define DUK_NUM_BIDX_BUILTINS 71
-#define DUK_NUM_ALL_BUILTINS 71
-#if defined(DUK_USE_DOUBLE_LE)
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[3833];
-#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 3833
-#elif defined(DUK_USE_DOUBLE_BE)
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[3833];
-#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 3833
-#elif defined(DUK_USE_DOUBLE_ME)
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_builtins_data[3833];
-#endif /* !DUK_SINGLE_FILE */
-#define DUK_BUILTINS_DATA_LENGTH 3833
-#else
-#error invalid endianness defines
-#endif
-#endif /* DUK_USE_ROM_OBJECTS */
-#endif /* DUK_BUILTINS_H_INCLUDED */
-#line 52 "duk_internal.h"
-
-#line 1 "duk_util.h"
-/*
- * Utilities
- */
-
-#ifndef DUK_UTIL_H_INCLUDED
-#define DUK_UTIL_H_INCLUDED
-
-#define DUK_UTIL_MIN_HASH_PRIME 17 /* must match genhashsizes.py */
-
-#define DUK_UTIL_GET_HASH_PROBE_STEP(hash) (duk_util_probe_steps[(hash) & 0x1f])
-
-/*
- * Endian conversion
- */
-
-#if defined(DUK_USE_INTEGER_LE)
-#define DUK_HTON32(x) DUK_BSWAP32((x))
-#define DUK_NTOH32(x) DUK_BSWAP32((x))
-#define DUK_HTON16(x) DUK_BSWAP16((x))
-#define DUK_NTOH16(x) DUK_BSWAP16((x))
-#elif defined(DUK_USE_INTEGER_BE)
-#define DUK_HTON32(x) (x)
-#define DUK_NTOH32(x) (x)
-#define DUK_HTON16(x) (x)
-#define DUK_NTOH16(x) (x)
-#else
-#error internal error, endianness defines broken
-#endif
-
-/*
- * Bitstream decoder
- */
-
-struct duk_bitdecoder_ctx {
- const duk_uint8_t *data;
- duk_size_t offset;
- duk_size_t length;
- duk_uint32_t currval;
- duk_small_int_t currbits;
-};
-
-/*
- * Bitstream encoder
- */
-
-struct duk_bitencoder_ctx {
- duk_uint8_t *data;
- duk_size_t offset;
- duk_size_t length;
- duk_uint32_t currval;
- duk_small_int_t currbits;
- duk_small_int_t truncated;
-};
-
-/*
- * Raw write/read macros for big endian, unaligned basic values.
- * Caller ensures there's enough space. The macros update the pointer
- * argument automatically on resizes. The idiom seems a bit odd, but
- * leads to compact code.
- */
-
-#define DUK_RAW_WRITE_U8(ptr,val) do { \
- *(ptr)++ = (duk_uint8_t) (val); \
- } while (0)
-#define DUK_RAW_WRITE_U16_BE(ptr,val) duk_raw_write_u16_be(&(ptr), (duk_uint16_t) (val))
-#define DUK_RAW_WRITE_U32_BE(ptr,val) duk_raw_write_u32_be(&(ptr), (duk_uint32_t) (val))
-#define DUK_RAW_WRITE_DOUBLE_BE(ptr,val) duk_raw_write_double_be(&(ptr), (duk_double_t) (val))
-#define DUK_RAW_WRITE_XUTF8(ptr,val) do { \
- /* 'ptr' is evaluated both as LHS and RHS. */ \
- duk_uint8_t *duk__ptr; \
- duk_small_int_t duk__len; \
- duk__ptr = (duk_uint8_t *) (ptr); \
- duk__len = duk_unicode_encode_xutf8((duk_ucodepoint_t) (val), duk__ptr); \
- duk__ptr += duk__len; \
- (ptr) = duk__ptr; \
- } while (0)
-#define DUK_RAW_WRITE_CESU8(ptr,val) do { \
- /* 'ptr' is evaluated both as LHS and RHS. */ \
- duk_uint8_t *duk__ptr; \
- duk_small_int_t duk__len; \
- duk__ptr = (duk_uint8_t *) (ptr); \
- duk__len = duk_unicode_encode_cesu8((duk_ucodepoint_t) (val), duk__ptr); \
- duk__ptr += duk__len; \
- (ptr) = duk__ptr; \
- } while (0)
-
-#define DUK_RAW_READ_U8(ptr) ((duk_uint8_t) (*(ptr)++))
-#define DUK_RAW_READ_U16_BE(ptr) duk_raw_read_u16_be(&(ptr));
-#define DUK_RAW_READ_U32_BE(ptr) duk_raw_read_u32_be(&(ptr));
-#define DUK_RAW_READ_DOUBLE_BE(ptr) duk_raw_read_double_be(&(ptr));
-
-/*
- * Buffer writer (dynamic buffer only)
- *
- * Helper for writing to a dynamic buffer with a concept of a "spare" area
- * to reduce resizes. You can ensure there is enough space beforehand and
- * then write for a while without further checks, relying on a stable data
- * pointer. Spare handling is automatic so call sites only indicate how
- * much data they need right now.
- *
- * There are several ways to write using bufwriter. The best approach
- * depends mainly on how much performance matters over code footprint.
- * The key issues are (1) ensuring there is space and (2) keeping the
- * pointers consistent. Fast code should ensure space for multiple writes
- * with one ensure call. Fastest inner loop code can temporarily borrow
- * the 'p' pointer but must write it back eventually.
- *
- * Be careful to ensure all macro arguments (other than static pointers like
- * 'thr' and 'bw_ctx') are evaluated exactly once, using temporaries if
- * necessary (if that's not possible, there should be a note near the macro).
- * Buffer write arguments often contain arithmetic etc so this is
- * particularly important here.
- */
-
-/* XXX: Migrate bufwriter and other read/write helpers to its own header? */
-
-struct duk_bufwriter_ctx {
- duk_uint8_t *p;
- duk_uint8_t *p_base;
- duk_uint8_t *p_limit;
- duk_hbuffer_dynamic *buf;
-};
-
-#define DUK_BW_SPARE_ADD 64
-#define DUK_BW_SPARE_SHIFT 4 /* 2^4 -> 1/16 = 6.25% spare */
-
-/* Initialization and finalization (compaction), converting to other types. */
-
-#define DUK_BW_INIT_PUSHBUF(thr,bw_ctx,sz) do { \
- duk_bw_init_pushbuf((thr), (bw_ctx), (sz)); \
- } while (0)
-#define DUK_BW_INIT_WITHBUF(thr,bw_ctx,buf) do { \
- duk_bw_init((thr), (bw_ctx), (buf)); \
- } while (0)
-#define DUK_BW_COMPACT(thr,bw_ctx) do { \
- /* Make underlying buffer compact to match DUK_BW_GET_SIZE(). */ \
- duk_bw_compact((thr), (bw_ctx)); \
- } while (0)
-#define DUK_BW_PUSH_AS_STRING(thr,bw_ctx) do { \
- duk_push_lstring((duk_context *) (thr), \
- (const char *) (bw_ctx)->p_base, \
- (duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base)); \
- } while (0)
-/* Pointers may be NULL for a while when 'buf' size is zero and before any
- * ENSURE calls have been made. Once an ENSURE has been made, the pointers
- * are required to be non-NULL so that it's always valid to use memcpy() and
- * memmove(), even for zero size.
- */
-#define DUK_BW_ASSERT_VALID_EXPR(thr,bw_ctx) \
- DUK_ASSERT_EXPR((bw_ctx) != NULL && \
- (bw_ctx)->buf != NULL && \
- ((DUK_HBUFFER_DYNAMIC_GET_SIZE((bw_ctx)->buf) == 0) || \
- ((bw_ctx)->p != NULL && \
- (bw_ctx)->p_base != NULL && \
- (bw_ctx)->p_limit != NULL && \
- (bw_ctx)->p_limit >= (bw_ctx)->p_base && \
- (bw_ctx)->p >= (bw_ctx)->p_base && \
- (bw_ctx)->p <= (bw_ctx)->p_limit)))
-#define DUK_BW_ASSERT_VALID(thr,bw_ctx) do { \
- DUK_BW_ASSERT_VALID_EXPR((thr), (bw_ctx)); \
- } while (0)
-
-/* Working with the pointer and current size. */
-
-#define DUK_BW_GET_PTR(thr,bw_ctx) \
- ((bw_ctx)->p)
-#define DUK_BW_SET_PTR(thr,bw_ctx,ptr) do { \
- (bw_ctx)->p = (ptr); \
- } while (0)
-#define DUK_BW_ADD_PTR(thr,bw_ctx,delta) do { \
- (bw_ctx)->p += (delta); \
- } while (0)
-#define DUK_BW_GET_BASEPTR(thr,bw_ctx) \
- ((bw_ctx)->p_base)
-#define DUK_BW_GET_LIMITPTR(thr,bw_ctx) \
- ((bw_ctx)->p_limit)
-#define DUK_BW_GET_SIZE(thr,bw_ctx) \
- ((duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base))
-#define DUK_BW_SET_SIZE(thr,bw_ctx,sz) do { \
- DUK_ASSERT((duk_size_t) (sz) <= (duk_size_t) ((bw_ctx)->p - (bw_ctx)->p_base)); \
- (bw_ctx)->p = (bw_ctx)->p_base + (sz); \
- } while (0)
-#define DUK_BW_RESET_SIZE(thr,bw_ctx) do { \
- /* Reset to zero size, keep current limit. */ \
- (bw_ctx)->p = (bw_ctx)->p_base; \
- } while (0)
-#define DUK_BW_GET_BUFFER(thr,bw_ctx) \
- ((bw_ctx)->buf)
-
-/* Ensuring (reserving) space. */
-
-#define DUK_BW_ENSURE(thr,bw_ctx,sz) do { \
- duk_size_t duk__sz, duk__space; \
- DUK_BW_ASSERT_VALID((thr), (bw_ctx)); \
- duk__sz = (sz); \
- duk__space = (duk_size_t) ((bw_ctx)->p_limit - (bw_ctx)->p); \
- if (duk__space < duk__sz) { \
- (void) duk_bw_resize((thr), (bw_ctx), duk__sz); \
- } \
- } while (0)
-/* NOTE: Multiple evaluation of 'ptr' in this macro. */
-/* XXX: Rework to use an always-inline function? */
-#define DUK_BW_ENSURE_RAW(thr,bw_ctx,sz,ptr) \
- (((duk_size_t) ((bw_ctx)->p_limit - (ptr)) >= (sz)) ? \
- (ptr) : \
- ((bw_ctx)->p = (ptr), duk_bw_resize((thr),(bw_ctx),(sz))))
-#define DUK_BW_ENSURE_GETPTR(thr,bw_ctx,sz) \
- DUK_BW_ENSURE_RAW((thr), (bw_ctx), (sz), (bw_ctx)->p)
-#define DUK_BW_ASSERT_SPACE_EXPR(thr,bw_ctx,sz) \
- (DUK_BW_ASSERT_VALID_EXPR((thr), (bw_ctx)), \
- DUK_ASSERT_EXPR((duk_size_t) ((bw_ctx)->p_limit - (bw_ctx)->p) >= (duk_size_t) (sz)))
-#define DUK_BW_ASSERT_SPACE(thr,bw_ctx,sz) do { \
- DUK_BW_ASSERT_SPACE_EXPR((thr), (bw_ctx), (sz)); \
- } while (0)
-
-/* Miscellaneous. */
-
-#define DUK_BW_SETPTR_AND_COMPACT(thr,bw_ctx,ptr) do { \
- (bw_ctx)->p = (ptr); \
- duk_bw_compact((thr), (bw_ctx)); \
- } while (0)
-
-/* Fast write calls which assume you control the spare beforehand.
- * Multibyte write variants exist and use a temporary write pointer
- * because byte writes alias with anything: with a stored pointer
- * explicit pointer load/stores get generated (e.g. gcc -Os).
- */
-
-#define DUK_BW_WRITE_RAW_U8(thr,bw_ctx,val) do { \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 1); \
- *(bw_ctx)->p++ = (duk_uint8_t) (val); \
- } while (0)
-#define DUK_BW_WRITE_RAW_U8_2(thr,bw_ctx,val1,val2) do { \
- duk_uint8_t *duk__p; \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 2); \
- duk__p = (bw_ctx)->p; \
- *duk__p++ = (duk_uint8_t) (val1); \
- *duk__p++ = (duk_uint8_t) (val2); \
- (bw_ctx)->p = duk__p; \
- } while (0)
-#define DUK_BW_WRITE_RAW_U8_3(thr,bw_ctx,val1,val2,val3) do { \
- duk_uint8_t *duk__p; \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 3); \
- duk__p = (bw_ctx)->p; \
- *duk__p++ = (duk_uint8_t) (val1); \
- *duk__p++ = (duk_uint8_t) (val2); \
- *duk__p++ = (duk_uint8_t) (val3); \
- (bw_ctx)->p = duk__p; \
- } while (0)
-#define DUK_BW_WRITE_RAW_U8_4(thr,bw_ctx,val1,val2,val3,val4) do { \
- duk_uint8_t *duk__p; \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 4); \
- duk__p = (bw_ctx)->p; \
- *duk__p++ = (duk_uint8_t) (val1); \
- *duk__p++ = (duk_uint8_t) (val2); \
- *duk__p++ = (duk_uint8_t) (val3); \
- *duk__p++ = (duk_uint8_t) (val4); \
- (bw_ctx)->p = duk__p; \
- } while (0)
-#define DUK_BW_WRITE_RAW_U8_5(thr,bw_ctx,val1,val2,val3,val4,val5) do { \
- duk_uint8_t *duk__p; \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 5); \
- duk__p = (bw_ctx)->p; \
- *duk__p++ = (duk_uint8_t) (val1); \
- *duk__p++ = (duk_uint8_t) (val2); \
- *duk__p++ = (duk_uint8_t) (val3); \
- *duk__p++ = (duk_uint8_t) (val4); \
- *duk__p++ = (duk_uint8_t) (val5); \
- (bw_ctx)->p = duk__p; \
- } while (0)
-#define DUK_BW_WRITE_RAW_U8_6(thr,bw_ctx,val1,val2,val3,val4,val5,val6) do { \
- duk_uint8_t *duk__p; \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), 6); \
- duk__p = (bw_ctx)->p; \
- *duk__p++ = (duk_uint8_t) (val1); \
- *duk__p++ = (duk_uint8_t) (val2); \
- *duk__p++ = (duk_uint8_t) (val3); \
- *duk__p++ = (duk_uint8_t) (val4); \
- *duk__p++ = (duk_uint8_t) (val5); \
- *duk__p++ = (duk_uint8_t) (val6); \
- (bw_ctx)->p = duk__p; \
- } while (0)
-#define DUK_BW_WRITE_RAW_XUTF8(thr,bw_ctx,cp) do { \
- duk_ucodepoint_t duk__cp; \
- duk_small_int_t duk__enc_len; \
- duk__cp = (cp); \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), duk_unicode_get_xutf8_length(duk__cp)); \
- duk__enc_len = duk_unicode_encode_xutf8(duk__cp, (bw_ctx)->p); \
- (bw_ctx)->p += duk__enc_len; \
- } while (0)
-#define DUK_BW_WRITE_RAW_CESU8(thr,bw_ctx,cp) do { \
- duk_ucodepoint_t duk__cp; \
- duk_small_int_t duk__enc_len; \
- duk__cp = (duk_ucodepoint_t) (cp); \
- DUK_BW_ASSERT_SPACE((thr), (bw_ctx), duk_unicode_get_cesu8_length(duk__cp)); \
- duk__enc_len = duk_unicode_encode_cesu8(duk__cp, (bw_ctx)->p); \
- (bw_ctx)->p += duk__enc_len; \
- } while (0)
-/* XXX: add temporary duk__p pointer here too; sharing */
-#define DUK_BW_WRITE_RAW_BYTES(thr,bw_ctx,valptr,valsz) do { \
- const void *duk__valptr; \
- duk_size_t duk__valsz; \
- duk__valptr = (const void *) (valptr); \
- duk__valsz = (duk_size_t) (valsz); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), duk__valptr, duk__valsz); \
- (bw_ctx)->p += duk__valsz; \
- } while (0)
-#define DUK_BW_WRITE_RAW_CSTRING(thr,bw_ctx,val) do { \
- const duk_uint8_t *duk__val; \
- duk_size_t duk__val_len; \
- duk__val = (const duk_uint8_t *) (val); \
- duk__val_len = DUK_STRLEN((const char *) duk__val); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) duk__val, duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_RAW_HSTRING(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HSTRING_GET_BYTELEN((val)); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HSTRING_GET_DATA((val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_GET_SIZE((val)); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER_FIXED(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_FIXED_GET_SIZE((val)); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_RAW_HBUFFER_DYNAMIC(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_DYNAMIC_GET_SIZE((val)); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-
-/* Append bytes from a slice already in the buffer. */
-#define DUK_BW_WRITE_RAW_SLICE(thr,bw,dst_off,dst_len) \
- duk_bw_write_raw_slice((thr), (bw), (dst_off), (dst_len))
-
-/* Insert bytes in the middle of the buffer from an external buffer. */
-#define DUK_BW_INSERT_RAW_BYTES(thr,bw,dst_off,buf,len) \
- duk_bw_insert_raw_bytes((thr), (bw), (dst_off), (buf), (len))
-
-/* Insert bytes in the middle of the buffer from a slice already
- * in the buffer. Source offset is interpreted "before" the operation.
- */
-#define DUK_BW_INSERT_RAW_SLICE(thr,bw,dst_off,src_off,len) \
- duk_bw_insert_raw_slice((thr), (bw), (dst_off), (src_off), (len))
-
-/* Insert a reserved area somewhere in the buffer; caller fills it.
- * Evaluates to a (duk_uint_t *) pointing to the start of the reserved
- * area for convenience.
- */
-#define DUK_BW_INSERT_RAW_AREA(thr,bw,off,len) \
- duk_bw_insert_raw_area((thr), (bw), (off), (len))
-
-/* Remove a slice from inside buffer. */
-#define DUK_BW_REMOVE_RAW_SLICE(thr,bw,off,len) \
- duk_bw_remove_raw_slice((thr), (bw), (off), (len))
-
-/* Safe write calls which will ensure space first. */
-
-#define DUK_BW_WRITE_ENSURE_U8(thr,bw_ctx,val) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 1); \
- DUK_BW_WRITE_RAW_U8((thr), (bw_ctx), (val)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_U8_2(thr,bw_ctx,val1,val2) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 2); \
- DUK_BW_WRITE_RAW_U8_2((thr), (bw_ctx), (val1), (val2)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_U8_3(thr,bw_ctx,val1,val2,val3) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 3); \
- DUK_BW_WRITE_RAW_U8_3((thr), (bw_ctx), (val1), (val2), (val3)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_U8_4(thr,bw_ctx,val1,val2,val3,val4) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 4); \
- DUK_BW_WRITE_RAW_U8_4((thr), (bw_ctx), (val1), (val2), (val3), (val4)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_U8_5(thr,bw_ctx,val1,val2,val3,val4,val5) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 5); \
- DUK_BW_WRITE_RAW_U8_5((thr), (bw_ctx), (val1), (val2), (val3), (val4), (val5)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_U8_6(thr,bw_ctx,val1,val2,val3,val4,val5,val6) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), 6); \
- DUK_BW_WRITE_RAW_U8_6((thr), (bw_ctx), (val1), (val2), (val3), (val4), (val5), (val6)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_XUTF8(thr,bw_ctx,cp) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), DUK_UNICODE_MAX_XUTF8_LENGTH); \
- DUK_BW_WRITE_RAW_XUTF8((thr), (bw_ctx), (cp)); \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_CESU8(thr,bw_ctx,cp) do { \
- DUK_BW_ENSURE((thr), (bw_ctx), DUK_UNICODE_MAX_CESU8_LENGTH); \
- DUK_BW_WRITE_RAW_CESU8((thr), (bw_ctx), (cp)); \
- } while (0)
-/* XXX: add temporary duk__p pointer here too; sharing */
-#define DUK_BW_WRITE_ENSURE_BYTES(thr,bw_ctx,valptr,valsz) do { \
- const void *duk__valptr; \
- duk_size_t duk__valsz; \
- duk__valptr = (const void *) (valptr); \
- duk__valsz = (duk_size_t) (valsz); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__valsz); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), duk__valptr, duk__valsz); \
- (bw_ctx)->p += duk__valsz; \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_CSTRING(thr,bw_ctx,val) do { \
- const duk_uint8_t *duk__val; \
- duk_size_t duk__val_len; \
- duk__val = (const duk_uint8_t *) (val); \
- duk__val_len = DUK_STRLEN((const char *) duk__val); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) duk__val, duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_HSTRING(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HSTRING_GET_BYTELEN((val)); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HSTRING_GET_DATA((val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_GET_SIZE((val)); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER_FIXED(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_FIXED_GET_SIZE((val)); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_FIXED_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-#define DUK_BW_WRITE_ENSURE_HBUFFER_DYNAMIC(thr,bw_ctx,val) do { \
- duk_size_t duk__val_len; \
- duk__val_len = DUK_HBUFFER_DYNAMIC_GET_SIZE((val)); \
- DUK_BW_ENSURE((thr), (bw_ctx), duk__val_len); \
- DUK_MEMCPY((void *) ((bw_ctx)->p), (const void *) DUK_HBUFFER_DYNAMIC_GET_DATA_PTR((thr)->heap, (val)), duk__val_len); \
- (bw_ctx)->p += duk__val_len; \
- } while (0)
-
-#define DUK_BW_WRITE_ENSURE_SLICE(thr,bw,dst_off,dst_len) \
- duk_bw_write_ensure_slice((thr), (bw), (dst_off), (dst_len))
-#define DUK_BW_INSERT_ENSURE_BYTES(thr,bw,dst_off,buf,len) \
- duk_bw_insert_ensure_bytes((thr), (bw), (dst_off), (buf), (len))
-#define DUK_BW_INSERT_ENSURE_SLICE(thr,bw,dst_off,src_off,len) \
- duk_bw_insert_ensure_slice((thr), (bw), (dst_off), (src_off), (len))
-#define DUK_BW_INSERT_ENSURE_AREA(thr,bw,off,len) \
- /* Evaluates to (duk_uint8_t *) pointing to start of area. */ \
- duk_bw_insert_ensure_area((thr), (bw), (off), (len))
-#define DUK_BW_REMOVE_ENSURE_SLICE(thr,bw,off,len) \
- /* No difference between raw/ensure because the buffer shrinks. */ \
- DUK_BW_REMOVE_RAW_SLICE((thr), (bw), (off), (len))
-
-/*
- * Externs and prototypes
- */
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const duk_uint8_t duk_lc_digits[36];
-DUK_INTERNAL_DECL const duk_uint8_t duk_uc_nybbles[16];
-DUK_INTERNAL_DECL const duk_int8_t duk_hex_dectab[256];
-#if defined(DUK_USE_HEX_FASTPATH)
-DUK_INTERNAL_DECL const duk_int16_t duk_hex_dectab_shift4[256];
-DUK_INTERNAL_DECL const duk_uint16_t duk_hex_enctab[256];
-#endif
-#if defined(DUK_USE_BASE64_FASTPATH)
-DUK_INTERNAL_DECL const duk_uint8_t duk_base64_enctab[64];
-DUK_INTERNAL_DECL const duk_int8_t duk_base64_dectab[256];
-#endif
-#endif /* !DUK_SINGLE_FILE */
-
-/* Note: assumes that duk_util_probe_steps size is 32 */
-#if defined(DUK_USE_HOBJECT_HASH_PART) || defined(DUK_USE_STRTAB_PROBE)
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL duk_uint8_t duk_util_probe_steps[32];
-#endif /* !DUK_SINGLE_FILE */
-#endif
-
-#if defined(DUK_USE_STRHASH_DENSE)
-DUK_INTERNAL_DECL duk_uint32_t duk_util_hashbytes(const duk_uint8_t *data, duk_size_t len, duk_uint32_t seed);
-#endif
-
-#if defined(DUK_USE_HOBJECT_HASH_PART) || defined(DUK_USE_STRTAB_PROBE)
-DUK_INTERNAL_DECL duk_uint32_t duk_util_get_hash_prime(duk_uint32_t size);
-#endif
-
-DUK_INTERNAL_DECL duk_int32_t duk_bd_decode(duk_bitdecoder_ctx *ctx, duk_small_int_t bits);
-DUK_INTERNAL_DECL duk_small_int_t duk_bd_decode_flag(duk_bitdecoder_ctx *ctx);
-DUK_INTERNAL_DECL duk_int32_t duk_bd_decode_flagged(duk_bitdecoder_ctx *ctx, duk_small_int_t bits, duk_int32_t def_value);
-
-DUK_INTERNAL_DECL void duk_be_encode(duk_bitencoder_ctx *ctx, duk_uint32_t data, duk_small_int_t bits);
-DUK_INTERNAL_DECL void duk_be_finish(duk_bitencoder_ctx *ctx);
-
-DUK_INTERNAL_DECL duk_uint32_t duk_util_tinyrandom_get_bits(duk_hthread *thr, duk_small_int_t n);
-DUK_INTERNAL_DECL duk_double_t duk_util_tinyrandom_get_double(duk_hthread *thr);
-
-DUK_INTERNAL_DECL void duk_bw_init(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx, duk_hbuffer_dynamic *h_buf);
-DUK_INTERNAL_DECL void duk_bw_init_pushbuf(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx, duk_size_t buf_size);
-DUK_INTERNAL_DECL duk_uint8_t *duk_bw_resize(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx, duk_size_t sz);
-DUK_INTERNAL_DECL void duk_bw_compact(duk_hthread *thr, duk_bufwriter_ctx *bw_ctx);
-DUK_INTERNAL_DECL void duk_bw_write_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_write_ensure_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_raw_bytes(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, const duk_uint8_t *buf, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_ensure_bytes(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, const duk_uint8_t *buf, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_insert_ensure_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t dst_off, duk_size_t src_off, duk_size_t len);
-DUK_INTERNAL_DECL duk_uint8_t *duk_bw_insert_raw_area(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
-DUK_INTERNAL_DECL duk_uint8_t *duk_bw_insert_ensure_area(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
-DUK_INTERNAL_DECL void duk_bw_remove_raw_slice(duk_hthread *thr, duk_bufwriter_ctx *bw, duk_size_t off, duk_size_t len);
-/* No duk_bw_remove_ensure_slice(), functionality would be identical. */
-
-DUK_INTERNAL_DECL DUK_INLINE duk_uint16_t duk_raw_read_u16_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE duk_uint32_t duk_raw_read_u32_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE duk_double_t duk_raw_read_double_be(duk_uint8_t **p);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u16_be(duk_uint8_t **p, duk_uint16_t val);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_u32_be(duk_uint8_t **p, duk_uint32_t val);
-DUK_INTERNAL_DECL DUK_INLINE void duk_raw_write_double_be(duk_uint8_t **p, duk_double_t val);
-
-#if defined(DUK_USE_DEBUGGER_SUPPORT) /* For now only needed by the debugger. */
-DUK_INTERNAL void duk_byteswap_bytes(duk_uint8_t *p, duk_small_uint_t len);
-#endif
-
-#endif /* DUK_UTIL_H_INCLUDED */
-#line 1 "duk_strings.h"
-/*
- * Shared error messages: declarations and macros
- *
- * Error messages are accessed through macros with fine-grained, explicit
- * error message distinctions. Concrete error messages are selected by the
- * macros and multiple macros can map to the same concrete string to save
- * on code footprint. This allows flexible footprint/verbosity tuning with
- * minimal code impact. There are a few limitations to this approach:
- * (1) switching between plain messages and format strings doesn't work
- * conveniently, and (2) conditional strings are a bit awkward to handle.
- *
- * Because format strings behave differently in the call site (they need to
- * be followed by format arguments), they have a special prefix (DUK_STR_FMT_
- * and duk_str_fmt_).
- *
- * On some compilers using explicit shared strings is preferable; on others
- * it may be better to use straight literals because the compiler will combine
- * them anyway, and such strings won't end up unnecessarily in a symbol table.
- */
-
-#ifndef DUK_ERRMSG_H_INCLUDED
-#define DUK_ERRMSG_H_INCLUDED
-
-#define DUK_STR_INTERNAL_ERROR duk_str_internal_error
-#define DUK_STR_INVALID_COUNT duk_str_invalid_count
-#define DUK_STR_INVALID_CALL_ARGS duk_str_invalid_call_args
-#define DUK_STR_NOT_CONSTRUCTABLE duk_str_not_constructable
-#define DUK_STR_NOT_CALLABLE duk_str_not_callable
-#define DUK_STR_NOT_EXTENSIBLE duk_str_not_extensible
-#define DUK_STR_NOT_WRITABLE duk_str_not_writable
-#define DUK_STR_NOT_CONFIGURABLE duk_str_not_configurable
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_internal_error;
-DUK_INTERNAL_DECL const char *duk_str_invalid_count;
-DUK_INTERNAL_DECL const char *duk_str_invalid_call_args;
-DUK_INTERNAL_DECL const char *duk_str_not_constructable;
-DUK_INTERNAL_DECL const char *duk_str_not_callable;
-DUK_INTERNAL_DECL const char *duk_str_not_extensible;
-DUK_INTERNAL_DECL const char *duk_str_not_writable;
-DUK_INTERNAL_DECL const char *duk_str_not_configurable;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_INVALID_CONTEXT duk_str_invalid_context
-#define DUK_STR_INVALID_INDEX duk_str_invalid_call_args
-#define DUK_STR_PUSH_BEYOND_ALLOC_STACK duk_str_push_beyond_alloc_stack
-#define DUK_STR_NOT_UNDEFINED duk_str_unexpected_type
-#define DUK_STR_NOT_NULL duk_str_unexpected_type
-#define DUK_STR_NOT_BOOLEAN duk_str_unexpected_type
-#define DUK_STR_NOT_NUMBER duk_str_unexpected_type
-#define DUK_STR_NOT_STRING duk_str_unexpected_type
-#define DUK_STR_NOT_OBJECT duk_str_unexpected_type
-#define DUK_STR_NOT_POINTER duk_str_unexpected_type
-#define DUK_STR_NOT_BUFFER duk_str_not_buffer /* still in use with verbose messages */
-#define DUK_STR_UNEXPECTED_TYPE duk_str_unexpected_type
-#define DUK_STR_NOT_THREAD duk_str_unexpected_type
-#define DUK_STR_NOT_COMPILEDFUNCTION duk_str_unexpected_type
-#define DUK_STR_NOT_NATIVEFUNCTION duk_str_unexpected_type
-#define DUK_STR_NOT_C_FUNCTION duk_str_unexpected_type
-#define DUK_STR_NOT_FUNCTION duk_str_unexpected_type
-#define DUK_STR_NOT_REGEXP duk_str_unexpected_type
-#define DUK_STR_DEFAULTVALUE_COERCE_FAILED duk_str_defaultvalue_coerce_failed
-#define DUK_STR_NUMBER_OUTSIDE_RANGE duk_str_number_outside_range
-#define DUK_STR_NOT_OBJECT_COERCIBLE duk_str_not_object_coercible
-#define DUK_STR_STRING_TOO_LONG duk_str_string_too_long
-#define DUK_STR_BUFFER_TOO_LONG duk_str_buffer_too_long
-#define DUK_STR_SPRINTF_TOO_LONG duk_str_sprintf_too_long
-#define DUK_STR_ALLOC_FAILED duk_str_alloc_failed
-#define DUK_STR_POP_TOO_MANY duk_str_pop_too_many
-#define DUK_STR_WRONG_BUFFER_TYPE duk_str_wrong_buffer_type
-#define DUK_STR_ENCODE_FAILED duk_str_encode_failed
-#define DUK_STR_DECODE_FAILED duk_str_decode_failed
-#define DUK_STR_NO_SOURCECODE duk_str_no_sourcecode
-#define DUK_STR_CONCAT_RESULT_TOO_LONG duk_str_concat_result_too_long
-#define DUK_STR_UNIMPLEMENTED duk_str_unimplemented
-#define DUK_STR_UNSUPPORTED duk_str_unsupported
-#define DUK_STR_ARRAY_LENGTH_OVER_2G duk_str_array_length_over_2g
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_invalid_context;
-DUK_INTERNAL_DECL const char *duk_str_push_beyond_alloc_stack;
-DUK_INTERNAL_DECL const char *duk_str_not_buffer;
-DUK_INTERNAL_DECL const char *duk_str_unexpected_type;
-DUK_INTERNAL_DECL const char *duk_str_defaultvalue_coerce_failed;
-DUK_INTERNAL_DECL const char *duk_str_number_outside_range;
-DUK_INTERNAL_DECL const char *duk_str_not_object_coercible;
-DUK_INTERNAL_DECL const char *duk_str_string_too_long;
-DUK_INTERNAL_DECL const char *duk_str_buffer_too_long;
-DUK_INTERNAL_DECL const char *duk_str_sprintf_too_long;
-DUK_INTERNAL_DECL const char *duk_str_alloc_failed;
-DUK_INTERNAL_DECL const char *duk_str_pop_too_many;
-DUK_INTERNAL_DECL const char *duk_str_wrong_buffer_type;
-DUK_INTERNAL_DECL const char *duk_str_encode_failed;
-DUK_INTERNAL_DECL const char *duk_str_decode_failed;
-DUK_INTERNAL_DECL const char *duk_str_no_sourcecode;
-DUK_INTERNAL_DECL const char *duk_str_concat_result_too_long;
-DUK_INTERNAL_DECL const char *duk_str_unimplemented;
-DUK_INTERNAL_DECL const char *duk_str_unsupported;
-DUK_INTERNAL_DECL const char *duk_str_array_length_over_2g;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_FMT_PTR duk_str_fmt_ptr
-#define DUK_STR_FMT_INVALID_JSON duk_str_fmt_invalid_json
-#define DUK_STR_JSONDEC_RECLIMIT duk_str_jsondec_reclimit
-#define DUK_STR_JSONENC_RECLIMIT duk_str_jsonenc_reclimit
-#define DUK_STR_CYCLIC_INPUT duk_str_cyclic_input
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_fmt_ptr;
-DUK_INTERNAL_DECL const char *duk_str_fmt_invalid_json;
-DUK_INTERNAL_DECL const char *duk_str_jsondec_reclimit;
-DUK_INTERNAL_DECL const char *duk_str_jsonenc_reclimit;
-DUK_INTERNAL_DECL const char *duk_str_cyclic_input;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_PROXY_REVOKED duk_str_proxy_revoked
-#define DUK_STR_INVALID_BASE duk_str_invalid_base
-#define DUK_STR_STRICT_CALLER_READ duk_str_strict_caller_read
-#define DUK_STR_PROXY_REJECTED duk_str_proxy_rejected
-#define DUK_STR_INVALID_ARRAY_LENGTH duk_str_invalid_array_length
-#define DUK_STR_ARRAY_LENGTH_WRITE_FAILED duk_str_array_length_write_failed
-#define DUK_STR_ARRAY_LENGTH_NOT_WRITABLE duk_str_array_length_not_writable
-#define DUK_STR_SETTER_UNDEFINED duk_str_setter_undefined
-#define DUK_STR_REDEFINE_VIRT_PROP duk_str_redefine_virt_prop
-#define DUK_STR_INVALID_DESCRIPTOR duk_str_invalid_descriptor
-#define DUK_STR_PROPERTY_IS_VIRTUAL duk_str_property_is_virtual
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_proxy_revoked;
-DUK_INTERNAL_DECL const char *duk_str_invalid_base;
-DUK_INTERNAL_DECL const char *duk_str_strict_caller_read;
-DUK_INTERNAL_DECL const char *duk_str_proxy_rejected;
-DUK_INTERNAL_DECL const char *duk_str_invalid_array_length;
-DUK_INTERNAL_DECL const char *duk_str_array_length_write_failed;
-DUK_INTERNAL_DECL const char *duk_str_array_length_not_writable;
-DUK_INTERNAL_DECL const char *duk_str_setter_undefined;
-DUK_INTERNAL_DECL const char *duk_str_redefine_virt_prop;
-DUK_INTERNAL_DECL const char *duk_str_invalid_descriptor;
-DUK_INTERNAL_DECL const char *duk_str_property_is_virtual;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_PARSE_ERROR duk_str_parse_error
-#define DUK_STR_DUPLICATE_LABEL duk_str_duplicate_label
-#define DUK_STR_INVALID_LABEL duk_str_invalid_label
-#define DUK_STR_INVALID_ARRAY_LITERAL duk_str_invalid_array_literal
-#define DUK_STR_INVALID_OBJECT_LITERAL duk_str_invalid_object_literal
-#define DUK_STR_INVALID_VAR_DECLARATION duk_str_invalid_var_declaration
-#define DUK_STR_CANNOT_DELETE_IDENTIFIER duk_str_cannot_delete_identifier
-#define DUK_STR_INVALID_EXPRESSION duk_str_invalid_expression
-#define DUK_STR_INVALID_LVALUE duk_str_invalid_lvalue
-#define DUK_STR_EXPECTED_IDENTIFIER duk_str_expected_identifier
-#define DUK_STR_EMPTY_EXPR_NOT_ALLOWED duk_str_empty_expr_not_allowed
-#define DUK_STR_INVALID_FOR duk_str_invalid_for
-#define DUK_STR_INVALID_SWITCH duk_str_invalid_switch
-#define DUK_STR_INVALID_BREAK_CONT_LABEL duk_str_invalid_break_cont_label
-#define DUK_STR_INVALID_RETURN duk_str_invalid_return
-#define DUK_STR_INVALID_TRY duk_str_invalid_try
-#define DUK_STR_INVALID_THROW duk_str_invalid_throw
-#define DUK_STR_WITH_IN_STRICT_MODE duk_str_with_in_strict_mode
-#define DUK_STR_FUNC_STMT_NOT_ALLOWED duk_str_func_stmt_not_allowed
-#define DUK_STR_UNTERMINATED_STMT duk_str_unterminated_stmt
-#define DUK_STR_INVALID_ARG_NAME duk_str_invalid_arg_name
-#define DUK_STR_INVALID_FUNC_NAME duk_str_invalid_func_name
-#define DUK_STR_INVALID_GETSET_NAME duk_str_invalid_getset_name
-#define DUK_STR_FUNC_NAME_REQUIRED duk_str_func_name_required
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_parse_error;
-DUK_INTERNAL_DECL const char *duk_str_duplicate_label;
-DUK_INTERNAL_DECL const char *duk_str_invalid_label;
-DUK_INTERNAL_DECL const char *duk_str_invalid_array_literal;
-DUK_INTERNAL_DECL const char *duk_str_invalid_object_literal;
-DUK_INTERNAL_DECL const char *duk_str_invalid_var_declaration;
-DUK_INTERNAL_DECL const char *duk_str_cannot_delete_identifier;
-DUK_INTERNAL_DECL const char *duk_str_invalid_expression;
-DUK_INTERNAL_DECL const char *duk_str_invalid_lvalue;
-DUK_INTERNAL_DECL const char *duk_str_expected_identifier;
-DUK_INTERNAL_DECL const char *duk_str_empty_expr_not_allowed;
-DUK_INTERNAL_DECL const char *duk_str_invalid_for;
-DUK_INTERNAL_DECL const char *duk_str_invalid_switch;
-DUK_INTERNAL_DECL const char *duk_str_invalid_break_cont_label;
-DUK_INTERNAL_DECL const char *duk_str_invalid_return;
-DUK_INTERNAL_DECL const char *duk_str_invalid_try;
-DUK_INTERNAL_DECL const char *duk_str_invalid_throw;
-DUK_INTERNAL_DECL const char *duk_str_with_in_strict_mode;
-DUK_INTERNAL_DECL const char *duk_str_func_stmt_not_allowed;
-DUK_INTERNAL_DECL const char *duk_str_unterminated_stmt;
-DUK_INTERNAL_DECL const char *duk_str_invalid_arg_name;
-DUK_INTERNAL_DECL const char *duk_str_invalid_func_name;
-DUK_INTERNAL_DECL const char *duk_str_invalid_getset_name;
-DUK_INTERNAL_DECL const char *duk_str_func_name_required;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_INVALID_QUANTIFIER_NO_ATOM duk_str_invalid_quantifier_no_atom
-#define DUK_STR_INVALID_QUANTIFIER_VALUES duk_str_invalid_quantifier_values
-#define DUK_STR_QUANTIFIER_TOO_MANY_COPIES duk_str_quantifier_too_many_copies
-#define DUK_STR_UNEXPECTED_CLOSING_PAREN duk_str_unexpected_closing_paren
-#define DUK_STR_UNEXPECTED_END_OF_PATTERN duk_str_unexpected_end_of_pattern
-#define DUK_STR_UNEXPECTED_REGEXP_TOKEN duk_str_unexpected_regexp_token
-#define DUK_STR_INVALID_REGEXP_FLAGS duk_str_invalid_regexp_flags
-#define DUK_STR_INVALID_BACKREFS duk_str_invalid_backrefs
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_invalid_quantifier_no_atom;
-DUK_INTERNAL_DECL const char *duk_str_invalid_quantifier_values;
-DUK_INTERNAL_DECL const char *duk_str_quantifier_too_many_copies;
-DUK_INTERNAL_DECL const char *duk_str_unexpected_closing_paren;
-DUK_INTERNAL_DECL const char *duk_str_unexpected_end_of_pattern;
-DUK_INTERNAL_DECL const char *duk_str_unexpected_regexp_token;
-DUK_INTERNAL_DECL const char *duk_str_invalid_regexp_flags;
-DUK_INTERNAL_DECL const char *duk_str_invalid_backrefs;
-#endif /* !DUK_SINGLE_FILE */
-
-#define DUK_STR_VALSTACK_LIMIT duk_str_valstack_limit
-#define DUK_STR_CALLSTACK_LIMIT duk_str_callstack_limit
-#define DUK_STR_CATCHSTACK_LIMIT duk_str_catchstack_limit
-#define DUK_STR_PROTOTYPE_CHAIN_LIMIT duk_str_prototype_chain_limit
-#define DUK_STR_BOUND_CHAIN_LIMIT duk_str_bound_chain_limit
-#define DUK_STR_C_CALLSTACK_LIMIT duk_str_c_callstack_limit
-#define DUK_STR_COMPILER_RECURSION_LIMIT duk_str_compiler_recursion_limit
-#define DUK_STR_BYTECODE_LIMIT duk_str_bytecode_limit
-#define DUK_STR_REG_LIMIT duk_str_reg_limit
-#define DUK_STR_TEMP_LIMIT duk_str_temp_limit
-#define DUK_STR_CONST_LIMIT duk_str_const_limit
-#define DUK_STR_FUNC_LIMIT duk_str_func_limit
-#define DUK_STR_REGEXP_COMPILER_RECURSION_LIMIT duk_str_regexp_compiler_recursion_limit
-#define DUK_STR_REGEXP_EXECUTOR_RECURSION_LIMIT duk_str_regexp_executor_recursion_limit
-#define DUK_STR_REGEXP_EXECUTOR_STEP_LIMIT duk_str_regexp_executor_step_limit
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_valstack_limit;
-DUK_INTERNAL_DECL const char *duk_str_callstack_limit;
-DUK_INTERNAL_DECL const char *duk_str_catchstack_limit;
-DUK_INTERNAL_DECL const char *duk_str_prototype_chain_limit;
-DUK_INTERNAL_DECL const char *duk_str_bound_chain_limit;
-DUK_INTERNAL_DECL const char *duk_str_c_callstack_limit;
-DUK_INTERNAL_DECL const char *duk_str_compiler_recursion_limit;
-DUK_INTERNAL_DECL const char *duk_str_bytecode_limit;
-DUK_INTERNAL_DECL const char *duk_str_reg_limit;
-DUK_INTERNAL_DECL const char *duk_str_temp_limit;
-DUK_INTERNAL_DECL const char *duk_str_const_limit;
-DUK_INTERNAL_DECL const char *duk_str_func_limit;
-DUK_INTERNAL_DECL const char *duk_str_regexp_compiler_recursion_limit;
-DUK_INTERNAL_DECL const char *duk_str_regexp_executor_recursion_limit;
-DUK_INTERNAL_DECL const char *duk_str_regexp_executor_step_limit;
-#endif /* !DUK_SINGLE_FILE */
-
-#if !defined(DUK_SINGLE_FILE)
-DUK_INTERNAL_DECL const char *duk_str_anon;
-#endif /* !DUK_SINGLE_FILE */
-
-#endif /* DUK_ERRMSG_H_INCLUDED */
-#line 1 "duk_js_bytecode.h"
-/*
- * Ecmascript bytecode
- */
-
-#ifndef DUK_JS_BYTECODE_H_INCLUDED
-#define DUK_JS_BYTECODE_H_INCLUDED
-
-/*
- * Logical instruction layout
- * ==========================
- *
- * !3!3!2!2!2!2!2!2!2!2!2!2!1!1!1!1!1!1!1!1!1!1! ! ! ! ! ! ! ! ! ! !
- * !1!0!9!8!7!6!5!4!3!2!1!0!9!8!7!6!5!4!3!2!1!0!9!8!7!6!5!4!3!2!1!0!
- * +---------------------------------------------------+-----------+
- * ! C ! B ! A ! OP !
- * +---------------------------------------------------+-----------+
- *
- * OP (6 bits): opcode (DUK_OP_*), access should be fastest
- * A (8 bits): typically a target register number
- * B (9 bits): typically first source register/constant number
- * C (9 bits): typically second source register/constant number
- *
- * Some instructions combine BC or ABC together for larger parameter values.
- * Signed integers (e.g. jump offsets) are encoded as unsigned, with an opcode
- * specific bias. B and C may denote a register or a constant, see
- * DUK_BC_ISREG() and DUK_BC_ISCONST().
- *
- * Note: macro naming is a bit misleading, e.g. "ABC" in macro name but
- * the field layout is logically "CBA".
- */
-
-typedef duk_uint32_t duk_instr_t;
-
-#define DUK_DEC_OP(x) ((x) & 0x3fUL)
-#define DUK_DEC_A(x) (((x) >> 6) & 0xffUL)
-#define DUK_DEC_B(x) (((x) >> 14) & 0x1ffUL)
-#define DUK_DEC_C(x) (((x) >> 23) & 0x1ffUL)
-#define DUK_DEC_BC(x) (((x) >> 14) & 0x3ffffUL)
-#define DUK_DEC_ABC(x) (((x) >> 6) & 0x3ffffffUL)
-
-#define DUK_ENC_OP(op) ((duk_instr_t) (op))
-#define DUK_ENC_OP_ABC(op,abc) ((duk_instr_t) ( \
- (((duk_instr_t) (abc)) << 6) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_BC(op,a,bc) ((duk_instr_t) ( \
- (((duk_instr_t) (bc)) << 14) | \
- (((duk_instr_t) (a)) << 6) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_B_C(op,a,b,c) ((duk_instr_t) ( \
- (((duk_instr_t) (c)) << 23) | \
- (((duk_instr_t) (b)) << 14) | \
- (((duk_instr_t) (a)) << 6) | \
- ((duk_instr_t) (op)) \
- ))
-#define DUK_ENC_OP_A_B(op,a,b) DUK_ENC_OP_A_B_C(op,a,b,0)
-#define DUK_ENC_OP_A(op,a) DUK_ENC_OP_A_B_C(op,a,0,0)
-
-/* Constants should be signed so that signed arithmetic involving them
- * won't cause values to be coerced accidentally to unsigned.
- */
-#define DUK_BC_OP_MIN 0
-#define DUK_BC_OP_MAX 0x3fL
-#define DUK_BC_A_MIN 0
-#define DUK_BC_A_MAX 0xffL
-#define DUK_BC_B_MIN 0
-#define DUK_BC_B_MAX 0x1ffL
-#define DUK_BC_C_MIN 0
-#define DUK_BC_C_MAX 0x1ffL
-#define DUK_BC_BC_MIN 0
-#define DUK_BC_BC_MAX 0x3ffffL
-#define DUK_BC_ABC_MIN 0
-#define DUK_BC_ABC_MAX 0x3ffffffL
-#define DUK_BC_EXTRAOP_MIN DUK_BC_A_MIN
-#define DUK_BC_EXTRAOP_MAX DUK_BC_A_MAX
-
-#define DUK_OP_LDREG 0
-#define DUK_OP_STREG 1
-#define DUK_OP_LDCONST 2
-#define DUK_OP_LDINT 3
-#define DUK_OP_LDINTX 4
-#define DUK_OP_MPUTOBJ 5
-#define DUK_OP_MPUTOBJI 6
-#define DUK_OP_MPUTARR 7
-#define DUK_OP_MPUTARRI 8
-#define DUK_OP_NEW 9
-#define DUK_OP_NEWI 10
-#define DUK_OP_REGEXP 11
-#define DUK_OP_CSREG 12
-#define DUK_OP_CSREGI 13
-#define DUK_OP_GETVAR 14
-#define DUK_OP_PUTVAR 15
-#define DUK_OP_DECLVAR 16
-#define DUK_OP_DELVAR 17
-#define DUK_OP_CSVAR 18
-#define DUK_OP_CSVARI 19
-#define DUK_OP_CLOSURE 20
-#define DUK_OP_GETPROP 21
-#define DUK_OP_PUTPROP 22
-#define DUK_OP_DELPROP 23
-#define DUK_OP_CSPROP 24
-#define DUK_OP_CSPROPI 25
-#define DUK_OP_ADD 26
-#define DUK_OP_SUB 27
-#define DUK_OP_MUL 28
-#define DUK_OP_DIV 29
-#define DUK_OP_MOD 30
-#define DUK_OP_BAND 31
-#define DUK_OP_BOR 32
-#define DUK_OP_BXOR 33
-#define DUK_OP_BASL 34
-#define DUK_OP_BLSR 35
-#define DUK_OP_BASR 36
-#define DUK_OP_EQ 37
-#define DUK_OP_NEQ 38
-#define DUK_OP_SEQ 39
-#define DUK_OP_SNEQ 40
-#define DUK_OP_GT 41
-#define DUK_OP_GE 42
-#define DUK_OP_LT 43
-#define DUK_OP_LE 44
-#define DUK_OP_IF 45
-#define DUK_OP_JUMP 46
-#define DUK_OP_RETURN 47
-#define DUK_OP_CALL 48
-#define DUK_OP_CALLI 49
-#define DUK_OP_TRYCATCH 50
-#define DUK_OP_EXTRA 51
-#define DUK_OP_PREINCR 52 /* pre/post opcode values have constraints, */
-#define DUK_OP_PREDECR 53 /* see duk_js_executor.c */
-#define DUK_OP_POSTINCR 54
-#define DUK_OP_POSTDECR 55
-#define DUK_OP_PREINCV 56
-#define DUK_OP_PREDECV 57
-#define DUK_OP_POSTINCV 58
-#define DUK_OP_POSTDECV 59
-#define DUK_OP_PREINCP 60
-#define DUK_OP_PREDECP 61
-#define DUK_OP_POSTINCP 62
-#define DUK_OP_POSTDECP 63
-#define DUK_OP_NONE 64 /* dummy value used as marker */
-
-/* DUK_OP_EXTRA, sub-operation in A */
-#define DUK_EXTRAOP_NOP 0
-#define DUK_EXTRAOP_INVALID 1
-#define DUK_EXTRAOP_LDTHIS 2
-#define DUK_EXTRAOP_LDUNDEF 3
-#define DUK_EXTRAOP_LDNULL 4
-#define DUK_EXTRAOP_LDTRUE 5
-#define DUK_EXTRAOP_LDFALSE 6
-#define DUK_EXTRAOP_NEWOBJ 7
-#define DUK_EXTRAOP_NEWARR 8
-#define DUK_EXTRAOP_SETALEN 9
-#define DUK_EXTRAOP_TYPEOF 10
-#define DUK_EXTRAOP_TYPEOFID 11
-#define DUK_EXTRAOP_INITENUM 12
-#define DUK_EXTRAOP_NEXTENUM 13
-#define DUK_EXTRAOP_INITSET 14
-#define DUK_EXTRAOP_INITSETI 15
-#define DUK_EXTRAOP_INITGET 16
-#define DUK_EXTRAOP_INITGETI 17
-#define DUK_EXTRAOP_ENDTRY 18
-#define DUK_EXTRAOP_ENDCATCH 19
-#define DUK_EXTRAOP_ENDFIN 20
-#define DUK_EXTRAOP_THROW 21
-#define DUK_EXTRAOP_INVLHS 22
-#define DUK_EXTRAOP_UNM 23
-#define DUK_EXTRAOP_UNP 24
-#define DUK_EXTRAOP_DEBUGGER 25
-#define DUK_EXTRAOP_BREAK 26
-#define DUK_EXTRAOP_CONTINUE 27
-#define DUK_EXTRAOP_BNOT 28
-#define DUK_EXTRAOP_LNOT 29
-#define DUK_EXTRAOP_INSTOF 30
-#define DUK_EXTRAOP_IN 31
-#define DUK_EXTRAOP_LABEL 32
-#define DUK_EXTRAOP_ENDLABEL 33
-
-/* DUK_OP_CALL flags in A */
-#define DUK_BC_CALL_FLAG_TAILCALL (1 << 0)
-#define DUK_BC_CALL_FLAG_EVALCALL (1 << 1)
-
-/* DUK_OP_TRYCATCH flags in A */
-#define DUK_BC_TRYCATCH_FLAG_HAVE_CATCH (1 << 0)
-#define DUK_BC_TRYCATCH_FLAG_HAVE_FINALLY (1 << 1)
-#define DUK_BC_TRYCATCH_FLAG_CATCH_BINDING (1 << 2)
-#define DUK_BC_TRYCATCH_FLAG_WITH_BINDING (1 << 3)
-
-/* DUK_OP_RETURN flags in A */
-#define DUK_BC_RETURN_FLAG_HAVE_RETVAL (1 << 0)
-
-/* DUK_OP_DECLVAR flags in A; bottom bits are reserved for propdesc flags (DUK_PROPDESC_FLAG_XXX) */
-#define DUK_BC_DECLVAR_FLAG_UNDEF_VALUE (1 << 4) /* use 'undefined' for value automatically */
-#define DUK_BC_DECLVAR_FLAG_FUNC_DECL (1 << 5) /* function declaration */
-
-/* misc constants and helper macros */
-#define DUK_BC_REGLIMIT 256 /* if B/C is >= this value, refers to a const */
-#define DUK_BC_ISREG(x) ((x) < DUK_BC_REGLIMIT)
-#define DUK_BC_ISCONST(x) ((x) >= DUK_BC_REGLIMIT)
-#define DUK_BC_LDINT_BIAS (1L << 17)
-#define DUK_BC_LDINTX_SHIFT 18
-#define DUK_BC_JUMP_BIAS (1L << 25)
-
-#endif /* DUK_JS_BYTECODE_H_INCLUDED */
-#line 1 "duk_lexer.h"
-/*
- * Lexer defines.
- */
-
-#ifndef DUK_LEXER_H_INCLUDED
-#define DUK_LEXER_H_INCLUDED
-
-typedef void (*duk_re_range_callback)(void *user, duk_codepoint_t r1, duk_codepoint_t r2, duk_bool_t direct);
-
-/*
- * A token is interpreted as any possible production of InputElementDiv
- * and InputElementRegExp, see E5 Section 7 in its entirety. Note that
- * the E5 "Token" production does not cover all actual tokens of the
- * language (which is explicitly stated in the specification, Section 7.5).
- * Null and boolean literals are defined as part of both ReservedWord
- * (E5 Section 7.6.1) and Literal (E5 Section 7.8) productions. Here,
- * null and boolean values have literal tokens, and are not reserved
- * words.
- *
- * Decimal literal negative/positive sign is -not- part of DUK_TOK_NUMBER.
- * The number tokens always have a non-negative value. The unary minus
- * operator in "-1.0" is optimized during compilation to yield a single
- * negative constant.
- *
- * Token numbering is free except that reserved words are required to be
- * in a continuous range and in a particular order. See genstrings.py.
- */
-
-#define DUK_LEXER_INITCTX(ctx) duk_lexer_initctx((ctx))
-
-#define DUK_LEXER_SETPOINT(ctx,pt) duk_lexer_setpoint((ctx), (pt))
-
-#define DUK_LEXER_GETPOINT(ctx,pt) do { (pt)->offset = (ctx)->window[0].offset; \
- (pt)->line = (ctx)->window[0].line; } while (0)
-
-/* currently 6 characters of lookup are actually needed (duk_lexer.c) */
-#define DUK_LEXER_WINDOW_SIZE 6
-#if defined(DUK_USE_LEXER_SLIDING_WINDOW)
-#define DUK_LEXER_BUFFER_SIZE 64
-#endif
-
-#define DUK_TOK_MINVAL 0
-
-/* returned after EOF (infinite amount) */
-#define DUK_TOK_EOF 0
-
-/* identifier names (E5 Section 7.6) */
-#define DUK_TOK_IDENTIFIER 1
-
-/* reserved words: keywords */
-#define DUK_TOK_START_RESERVED 2
-#define DUK_TOK_BREAK 2
-#define DUK_TOK_CASE 3
-#define DUK_TOK_CATCH 4
-#define DUK_TOK_CONTINUE 5
-#define DUK_TOK_DEBUGGER 6
-#define DUK_TOK_DEFAULT 7
-#define DUK_TOK_DELETE 8
-#define DUK_TOK_DO 9
-#define DUK_TOK_ELSE 10
-#define DUK_TOK_FINALLY 11
-#define DUK_TOK_FOR 12
-#define DUK_TOK_FUNCTION 13
-#define DUK_TOK_IF 14
-#define DUK_TOK_IN 15
-#define DUK_TOK_INSTANCEOF 16
-#define DUK_TOK_NEW 17
-#define DUK_TOK_RETURN 18
-#define DUK_TOK_SWITCH 19
-#define DUK_TOK_THIS 20
-#define DUK_TOK_THROW 21
-#define DUK_TOK_TRY 22
-#define DUK_TOK_TYPEOF 23
-#define DUK_TOK_VAR 24
-#define DUK_TOK_CONST 25
-#define DUK_TOK_VOID 26
-#define DUK_TOK_WHILE 27
-#define DUK_TOK_WITH 28
-
-/* reserved words: future reserved words */
-#define DUK_TOK_CLASS 29
-#define DUK_TOK_ENUM 30
-#define DUK_TOK_EXPORT 31
-#define DUK_TOK_EXTENDS 32
-#define DUK_TOK_IMPORT 33
-#define DUK_TOK_SUPER 34
-
-/* "null", "true", and "false" are always reserved words.
- * Note that "get" and "set" are not!
- */
-#define DUK_TOK_NULL 35
-#define DUK_TOK_TRUE 36
-#define DUK_TOK_FALSE 37
-
-/* reserved words: additional future reserved words in strict mode */
-#define DUK_TOK_START_STRICT_RESERVED 38 /* inclusive */
-#define DUK_TOK_IMPLEMENTS 38
-#define DUK_TOK_INTERFACE 39
-#define DUK_TOK_LET 40
-#define DUK_TOK_PACKAGE 41
-#define DUK_TOK_PRIVATE 42
-#define DUK_TOK_PROTECTED 43
-#define DUK_TOK_PUBLIC 44
-#define DUK_TOK_STATIC 45
-#define DUK_TOK_YIELD 46
-
-#define DUK_TOK_END_RESERVED 47 /* exclusive */
-
-/* "get" and "set" are tokens but NOT ReservedWords. They are currently
- * parsed and identifiers and these defines are actually now unused.
- */
-#define DUK_TOK_GET 47
-#define DUK_TOK_SET 48
-
-/* punctuators (unlike the spec, also includes "/" and "/=") */
-#define DUK_TOK_LCURLY 49
-#define DUK_TOK_RCURLY 50
-#define DUK_TOK_LBRACKET 51
-#define DUK_TOK_RBRACKET 52
-#define DUK_TOK_LPAREN 53
-#define DUK_TOK_RPAREN 54
-#define DUK_TOK_PERIOD 55
-#define DUK_TOK_SEMICOLON 56
-#define DUK_TOK_COMMA 57
-#define DUK_TOK_LT 58
-#define DUK_TOK_GT 59
-#define DUK_TOK_LE 60
-#define DUK_TOK_GE 61
-#define DUK_TOK_EQ 62
-#define DUK_TOK_NEQ 63
-#define DUK_TOK_SEQ 64
-#define DUK_TOK_SNEQ 65
-#define DUK_TOK_ADD 66
-#define DUK_TOK_SUB 67
-#define DUK_TOK_MUL 68
-#define DUK_TOK_DIV 69
-#define DUK_TOK_MOD 70
-#define DUK_TOK_INCREMENT 71
-#define DUK_TOK_DECREMENT 72
-#define DUK_TOK_ALSHIFT 73 /* named "arithmetic" because result is signed */
-#define DUK_TOK_ARSHIFT 74
-#define DUK_TOK_RSHIFT 75
-#define DUK_TOK_BAND 76
-#define DUK_TOK_BOR 77
-#define DUK_TOK_BXOR 78
-#define DUK_TOK_LNOT 79
-#define DUK_TOK_BNOT 80
-#define DUK_TOK_LAND 81
-#define DUK_TOK_LOR 82
-#define DUK_TOK_QUESTION 83
-#define DUK_TOK_COLON 84
-#define DUK_TOK_EQUALSIGN 85
-#define DUK_TOK_ADD_EQ 86
-#define DUK_TOK_SUB_EQ 87
-#define DUK_TOK_MUL_EQ 88
-#define DUK_TOK_DIV_EQ 89
-#define DUK_TOK_MOD_EQ 90
-#define DUK_TOK_ALSHIFT_EQ 91
-#define DUK_TOK_ARSHIFT_EQ 92
-#define DUK_TOK_RSHIFT_EQ 93
-#define DUK_TOK_BAND_EQ 94
-#define DUK_TOK_BOR_EQ 95
-#define DUK_TOK_BXOR_EQ 96
-
-/* literals (E5 Section 7.8), except null, true, false, which are treated
- * like reserved words (above).
- */
-#define DUK_TOK_NUMBER 97
-#define DUK_TOK_STRING 98
-#define DUK_TOK_REGEXP 99
-
-#define DUK_TOK_MAXVAL 99 /* inclusive */
-
-/* Convert heap string index to a token (reserved words) */
-#define DUK_STRIDX_TO_TOK(x) ((x) - DUK_STRIDX_START_RESERVED + DUK_TOK_START_RESERVED)
-
-/* Sanity check */
-#if (DUK_TOK_MAXVAL > 255)
-#error DUK_TOK_MAXVAL too large, code assumes it fits into 8 bits
-#endif
-
-/* Sanity checks for string and token defines */
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_BREAK) != DUK_TOK_BREAK)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CASE) != DUK_TOK_CASE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CATCH) != DUK_TOK_CATCH)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CONTINUE) != DUK_TOK_CONTINUE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DEBUGGER) != DUK_TOK_DEBUGGER)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DEFAULT) != DUK_TOK_DEFAULT)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DELETE) != DUK_TOK_DELETE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_DO) != DUK_TOK_DO)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_ELSE) != DUK_TOK_ELSE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FINALLY) != DUK_TOK_FINALLY)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FOR) != DUK_TOK_FOR)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LC_FUNCTION) != DUK_TOK_FUNCTION)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IF) != DUK_TOK_IF)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IN) != DUK_TOK_IN)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_INSTANCEOF) != DUK_TOK_INSTANCEOF)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_NEW) != DUK_TOK_NEW)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_RETURN) != DUK_TOK_RETURN)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_SWITCH) != DUK_TOK_SWITCH)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_THIS) != DUK_TOK_THIS)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_THROW) != DUK_TOK_THROW)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TRY) != DUK_TOK_TRY)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TYPEOF) != DUK_TOK_TYPEOF)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_VAR) != DUK_TOK_VAR)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_VOID) != DUK_TOK_VOID)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_WHILE) != DUK_TOK_WHILE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_WITH) != DUK_TOK_WITH)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CLASS) != DUK_TOK_CLASS)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_CONST) != DUK_TOK_CONST)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_ENUM) != DUK_TOK_ENUM)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_EXPORT) != DUK_TOK_EXPORT)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_EXTENDS) != DUK_TOK_EXTENDS)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IMPORT) != DUK_TOK_IMPORT)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_SUPER) != DUK_TOK_SUPER)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LC_NULL) != DUK_TOK_NULL)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_TRUE) != DUK_TOK_TRUE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_FALSE) != DUK_TOK_FALSE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_IMPLEMENTS) != DUK_TOK_IMPLEMENTS)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_INTERFACE) != DUK_TOK_INTERFACE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_LET) != DUK_TOK_LET)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PACKAGE) != DUK_TOK_PACKAGE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PRIVATE) != DUK_TOK_PRIVATE)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PROTECTED) != DUK_TOK_PROTECTED)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_PUBLIC) != DUK_TOK_PUBLIC)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_STATIC) != DUK_TOK_STATIC)
-#error mismatch in token defines
-#endif
-#if (DUK_STRIDX_TO_TOK(DUK_STRIDX_YIELD) != DUK_TOK_YIELD)
-#error mismatch in token defines
-#endif
-
-/* Regexp tokens */
-#define DUK_RETOK_EOF 0
-#define DUK_RETOK_DISJUNCTION 1
-#define DUK_RETOK_QUANTIFIER 2
-#define DUK_RETOK_ASSERT_START 3
-#define DUK_RETOK_ASSERT_END 4
-#define DUK_RETOK_ASSERT_WORD_BOUNDARY 5
-#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY 6
-#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD 7
-#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD 8
-#define DUK_RETOK_ATOM_PERIOD 9
-#define DUK_RETOK_ATOM_CHAR 10
-#define DUK_RETOK_ATOM_DIGIT 11
-#define DUK_RETOK_ATOM_NOT_DIGIT 12
-#define DUK_RETOK_ATOM_WHITE 13
-#define DUK_RETOK_ATOM_NOT_WHITE 14
-#define DUK_RETOK_ATOM_WORD_CHAR 15
-#define DUK_RETOK_ATOM_NOT_WORD_CHAR 16
-#define DUK_RETOK_ATOM_BACKREFERENCE 17
-#define DUK_RETOK_ATOM_START_CAPTURE_GROUP 18
-#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP 19
-#define DUK_RETOK_ATOM_START_CHARCLASS 20
-#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED 21
-#define DUK_RETOK_ATOM_END_GROUP 22
-
-/* Constants for duk_lexer_ctx.buf. */
-#define DUK_LEXER_TEMP_BUF_LIMIT 256
-
-/* A token value. Can be memcpy()'d, but note that slot1/slot2 values are on the valstack.
- * Some fields (like num, str1, str2) are only valid for specific token types and may have
- * stale values otherwise.
- */
-struct duk_token {
- duk_small_int_t t; /* token type (with reserved word identification) */
- duk_small_int_t t_nores; /* token type (with reserved words as DUK_TOK_IDENTIFER) */
- duk_double_t num; /* numeric value of token */
- duk_hstring *str1; /* string 1 of token (borrowed, stored to ctx->slot1_idx) */
- duk_hstring *str2; /* string 2 of token (borrowed, stored to ctx->slot2_idx) */
- duk_size_t start_offset; /* start byte offset of token in lexer input */
- duk_int_t start_line; /* start line of token (first char) */
- duk_int_t num_escapes; /* number of escapes and line continuations (for directive prologue) */
- duk_bool_t lineterm; /* token was preceded by a lineterm */
- duk_bool_t allow_auto_semi; /* token allows automatic semicolon insertion (eof or preceded by newline) */
-};
-
-#define DUK_RE_QUANTIFIER_INFINITE ((duk_uint32_t) 0xffffffffUL)
-
-/* A regexp token value. */
-struct duk_re_token {
- duk_small_int_t t; /* token type */
- duk_small_int_t greedy;
- duk_uint_fast32_t num; /* numeric value (character, count) */
- duk_uint_fast32_t qmin;
- duk_uint_fast32_t qmax;
-};
-
-/* A structure for 'snapshotting' a point for rewinding */
-struct duk_lexer_point {
- duk_size_t offset;
- duk_int_t line;
-};
-
-/* Lexer codepoint with additional info like offset/line number */
-struct duk_lexer_codepoint {
- duk_codepoint_t codepoint;
- duk_size_t offset;
- duk_int_t line;
-};
-
-/* Lexer context. Same context is used for Ecmascript and Regexp parsing. */
-struct duk_lexer_ctx {
-#if defined(DUK_USE_LEXER_SLIDING_WINDOW)
- duk_lexer_codepoint *window; /* unicode code points, window[0] is always next, points to 'buffer' */
- duk_lexer_codepoint buffer[DUK_LEXER_BUFFER_SIZE];
-#else
- duk_lexer_codepoint window[DUK_LEXER_WINDOW_SIZE]; /* unicode code points, window[0] is always next */
-#endif
-
- duk_hthread *thr; /* thread; minimizes argument passing */
-
- const duk_uint8_t *input; /* input string (may be a user pointer) */
- duk_size_t input_length; /* input byte length */
- duk_size_t input_offset; /* input offset for window leading edge (not window[0]) */
- duk_int_t input_line; /* input linenumber at input_offset (not window[0]), init to 1 */
-
- duk_idx_t slot1_idx; /* valstack slot for 1st token value */
- duk_idx_t slot2_idx; /* valstack slot for 2nd token value */
- duk_idx_t buf_idx; /* valstack slot for temp buffer */
- duk_hbuffer_dynamic *buf; /* temp accumulation buffer */
- duk_bufwriter_ctx bw; /* bufwriter for temp accumulation */
-
- duk_int_t token_count; /* number of tokens parsed */
- duk_int_t token_limit; /* maximum token count before error (sanity backstop) */
-};
-
-/*
- * Prototypes
- */
-
-DUK_INTERNAL_DECL void duk_lexer_initctx(duk_lexer_ctx *lex_ctx);
-
-DUK_INTERNAL_DECL void duk_lexer_setpoint(duk_lexer_ctx *lex_ctx, duk_lexer_point *pt);
-
-DUK_INTERNAL_DECL
-void duk_lexer_parse_js_input_element(duk_lexer_ctx *lex_ctx,
- duk_token *out_token,
- duk_bool_t strict_mode,
- duk_bool_t regexp_mode);
-#ifdef DUK_USE_REGEXP_SUPPORT
-DUK_INTERNAL_DECL void duk_lexer_parse_re_token(duk_lexer_ctx *lex_ctx, duk_re_token *out_token);
-DUK_INTERNAL_DECL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_range_callback gen_range, void *userdata);
-#endif /* DUK_USE_REGEXP_SUPPORT */
-
-#endif /* DUK_LEXER_H_INCLUDED */
-#line 1 "duk_js_compiler.h"
-/*
- * Ecmascript compiler.
- */
-
-#ifndef DUK_JS_COMPILER_H_INCLUDED
-#define DUK_JS_COMPILER_H_INCLUDED
-
-/* ecmascript compiler limits */
-#define DUK_COMPILER_TOKEN_LIMIT 100000000L /* 1e8: protects against deeply nested inner functions */
-
-/* maximum loopcount for peephole optimization */
-#define DUK_COMPILER_PEEPHOLE_MAXITER 3
-
-/* maximum bytecode length in instructions */
-#define DUK_COMPILER_MAX_BYTECODE_LENGTH (256L * 1024L * 1024L) /* 1 GB */
-
-/*
- * Compiler intermediate values
- *
- * Intermediate values describe either plain values (e.g. strings or
- * numbers) or binary operations which have not yet been coerced into
- * either a left-hand-side or right-hand-side role (e.g. object property).
- */
-
-#define DUK_IVAL_NONE 0 /* no value */
-#define DUK_IVAL_PLAIN 1 /* register, constant, or value */
-#define DUK_IVAL_ARITH 2 /* binary arithmetic; DUK_OP_ADD, DUK_OP_EQ, other binary ops */
-#define DUK_IVAL_ARITH_EXTRAOP 3 /* binary arithmetic using extraops; DUK_EXTRAOP_INSTOF etc */
-#define DUK_IVAL_PROP 4 /* property access */
-#define DUK_IVAL_VAR 5 /* variable access */
-
-#define DUK_ISPEC_NONE 0 /* no value */
-#define DUK_ISPEC_VALUE 1 /* value resides in 'valstack_idx' */
-#define DUK_ISPEC_REGCONST 2 /* value resides in a register or constant */
-
-/* bit mask which indicates that a regconst is a constant instead of a register */
-#define DUK_JS_CONST_MARKER 0x80000000UL
-
-/* type to represent a reg/const reference during compilation */
-typedef duk_uint32_t duk_regconst_t;
-
-/* type to represent a straight register reference, with <0 indicating none */
-typedef duk_int32_t duk_reg_t;
-
-typedef struct {
- duk_small_uint_t t; /* DUK_ISPEC_XXX */
- duk_regconst_t regconst;
- duk_idx_t valstack_idx; /* always set; points to a reserved valstack slot */
-} duk_ispec;
-
-typedef struct {
- /*
- * PLAIN: x1
- * ARITH: x1 <op> x2
- * PROP: x1.x2
- * VAR: x1 (name)
- */
-
- /* XXX: can be optimized for smaller footprint esp. on 32-bit environments */
- duk_small_uint_t t; /* DUK_IVAL_XXX */
- duk_small_uint_t op; /* bytecode opcode (or extraop) for binary ops */
- duk_ispec x1;
- duk_ispec x2;
-} duk_ivalue;
-
-/*
- * Bytecode instruction representation during compilation
- *
- * Contains the actual instruction and (optionally) debug info.
- */
-
-struct duk_compiler_instr {
- duk_instr_t ins;
-#if defined(DUK_USE_PC2LINE)
- duk_uint32_t line;
-#endif
-};
-
-/*
- * Compiler state
- */
-
-#define DUK_LABEL_FLAG_ALLOW_BREAK (1 << 0)
-#define DUK_LABEL_FLAG_ALLOW_CONTINUE (1 << 1)
-
-#define DUK_DECL_TYPE_VAR 0
-#define DUK_DECL_TYPE_FUNC 1
-
-/* XXX: optimize to 16 bytes */
-typedef struct {
- duk_small_uint_t flags;
- duk_int_t label_id; /* numeric label_id (-1 reserved as marker) */
- duk_hstring *h_label; /* borrowed label name */
- duk_int_t catch_depth; /* catch depth at point of definition */
- duk_int_t pc_label; /* pc of label statement:
- * pc+1: break jump site
- * pc+2: continue jump site
- */
-
- /* Fast jumps (which avoid longjmp) jump directly to the jump sites
- * which are always known even while the iteration/switch statement
- * is still being parsed. A final peephole pass "straightens out"
- * the jumps.
- */
-} duk_labelinfo;
-
-/* Compiling state of one function, eventually converted to duk_hcompiledfunction */
-struct duk_compiler_func {
- /* These pointers are at the start of the struct so that they pack
- * nicely. Mixing pointers and integer values is bad on some
- * platforms (e.g. if int is 32 bits and pointers are 64 bits).
- */
-
- duk_bufwriter_ctx bw_code; /* bufwriter for code */
-
- duk_hstring *h_name; /* function name (borrowed reference), ends up in _name */
- /* h_code: held in bw_code */
- duk_hobject *h_consts; /* array */
- duk_hobject *h_funcs; /* array of function templates: [func1, offset1, line1, func2, offset2, line2]
- * offset/line points to closing brace to allow skipping on pass 2
- */
- duk_hobject *h_decls; /* array of declarations: [ name1, val1, name2, val2, ... ]
- * valN = (typeN) | (fnum << 8), where fnum is inner func number (0 for vars)
- * record function and variable declarations in pass 1
- */
- duk_hobject *h_labelnames; /* array of active label names */
- duk_hbuffer_dynamic *h_labelinfos; /* C array of duk_labelinfo */
- duk_hobject *h_argnames; /* array of formal argument names (-> _Formals) */
- duk_hobject *h_varmap; /* variable map for pass 2 (identifier -> register number or null (unmapped)) */
-
- /* value stack indices for tracking objects */
- /* code_idx: not needed */
- duk_idx_t consts_idx;
- duk_idx_t funcs_idx;
- duk_idx_t decls_idx;
- duk_idx_t labelnames_idx;
- duk_idx_t labelinfos_idx;
- duk_idx_t argnames_idx;
- duk_idx_t varmap_idx;
-
- /* temp reg handling */
- duk_reg_t temp_first; /* first register that is a temporary (below: variables) */
- duk_reg_t temp_next; /* next temporary register to allocate */
- duk_reg_t temp_max; /* highest value of temp_reg (temp_max - 1 is highest used reg) */
-
- /* shuffle registers if large number of regs/consts */
- duk_reg_t shuffle1;
- duk_reg_t shuffle2;
- duk_reg_t shuffle3;
-
- /* stats for current expression being parsed */
- duk_int_t nud_count;
- duk_int_t led_count;
- duk_int_t paren_level; /* parenthesis count, 0 = top level */
- duk_bool_t expr_lhs; /* expression is left-hand-side compatible */
- duk_bool_t allow_in; /* current paren level allows 'in' token */
-
- /* misc */
- duk_int_t stmt_next; /* statement id allocation (running counter) */
- duk_int_t label_next; /* label id allocation (running counter) */
- duk_int_t catch_depth; /* catch stack depth */
- duk_int_t with_depth; /* with stack depth (affects identifier lookups) */
- duk_int_t fnum_next; /* inner function numbering */
- duk_int_t num_formals; /* number of formal arguments */
- duk_reg_t reg_stmt_value; /* register for writing value of 'non-empty' statements (global or eval code), -1 is marker */
-#if defined(DUK_USE_DEBUGGER_SUPPORT)
- duk_int_t min_line; /* XXX: typing (duk_hcompiledfunction has duk_uint32_t) */
- duk_int_t max_line;
-#endif
-
- /* status booleans */
- duk_bool_t is_function; /* is an actual function (not global/eval code) */
- duk_bool_t is_eval; /* is eval code */
- duk_bool_t is_global; /* is global code */
- duk_bool_t is_setget; /* is a setter/getter */
- duk_bool_t is_decl; /* is a function declaration (as opposed to function expression) */
- duk_bool_t is_strict; /* function is strict */
- duk_bool_t is_notail; /* function must not be tail called */
- duk_bool_t in_directive_prologue; /* parsing in "directive prologue", recognize directives */
- duk_bool_t in_scanning; /* parsing in "scanning" phase (first pass) */
- duk_bool_t may_direct_eval; /* function may call direct eval */
- duk_bool_t id_access_arguments; /* function refers to 'arguments' identifier */
- duk_bool_t id_access_slow; /* function makes one or more slow path accesses */
- duk_bool_t is_arguments_shadowed; /* argument/function declaration shadows 'arguments' */
- duk_bool_t needs_shuffle; /* function needs shuffle registers */
- duk_bool_t reject_regexp_in_adv; /* reject RegExp literal on next advance() call; needed for handling IdentifierName productions */
-};
-
-struct duk_compiler_ctx {
- duk_hthread *thr;
-
- /* filename being compiled (ends up in functions' '_filename' property) */
- duk_hstring *h_filename; /* borrowed reference */
-
- /* lexing (tokenization) state (contains two valstack slot indices) */
- duk_lexer_ctx lex;
-
- /* current and previous token for parsing */
- duk_token prev_token;
- duk_token curr_token;
- duk_idx_t tok11_idx; /* curr_token slot1 (matches 'lex' slot1_idx) */
- duk_idx_t tok12_idx; /* curr_token slot2 (matches 'lex' slot2_idx) */
- duk_idx_t tok21_idx; /* prev_token slot1 */
- duk_idx_t tok22_idx; /* prev_token slot2 */
-
- /* recursion limit */
- duk_int_t recursion_depth;
- duk_int_t recursion_limit;
-
- /* code emission temporary */
- duk_int_t emit_jumpslot_pc;
-
- /* current function being compiled (embedded instead of pointer for more compact access) */
- duk_compiler_func curr_func;
-};
-
-/*
- * Prototypes
- */
-
-#define DUK_JS_COMPILE_FLAG_EVAL (1 << 0) /* source is eval code (not global) */
-#define DUK_JS_COMPILE_FLAG_STRICT (1 << 1) /* strict outer context */
-#define DUK_JS_COMPILE_FLAG_FUNCEXPR (1 << 2) /* source is a function expression (used for Function constructor) */
-
-DUK_INTERNAL_DECL void duk_js_compile(duk_hthread *thr, const duk_uint8_t *src_buffer, duk_size_t src_length, duk_small_uint_t flags);
-
-#endif /* DUK_JS_COMPILER_H_INCLUDED */
-#line 1 "duk_regexp.h"
-/*
- * Regular expression structs, constants, and bytecode defines.
- */
-
-#ifndef DUK_REGEXP_H_INCLUDED
-#define DUK_REGEXP_H_INCLUDED
-
-/* maximum bytecode copies for {n,m} quantifiers */
-#define DUK_RE_MAX_ATOM_COPIES 1000
-
-/* regexp compilation limits */
-#define DUK_RE_COMPILE_TOKEN_LIMIT 100000000L /* 1e8 */
-
-/* regexp execution limits */
-#define DUK_RE_EXECUTE_STEPS_LIMIT 1000000000L /* 1e9 */
-
-/* regexp opcodes */
-#define DUK_REOP_MATCH 1
-#define DUK_REOP_CHAR 2
-#define DUK_REOP_PERIOD 3
-#define DUK_REOP_RANGES 4
-#define DUK_REOP_INVRANGES 5
-#define DUK_REOP_JUMP 6
-#define DUK_REOP_SPLIT1 7
-#define DUK_REOP_SPLIT2 8
-#define DUK_REOP_SQMINIMAL 9
-#define DUK_REOP_SQGREEDY 10
-#define DUK_REOP_SAVE 11
-#define DUK_REOP_WIPERANGE 12
-#define DUK_REOP_LOOKPOS 13
-#define DUK_REOP_LOOKNEG 14
-#define DUK_REOP_BACKREFERENCE 15
-#define DUK_REOP_ASSERT_START 16
-#define DUK_REOP_ASSERT_END 17
-#define DUK_REOP_ASSERT_WORD_BOUNDARY 18
-#define DUK_REOP_ASSERT_NOT_WORD_BOUNDARY 19
-
-/* flags */
-#define DUK_RE_FLAG_GLOBAL (1 << 0)
-#define DUK_RE_FLAG_IGNORE_CASE (1 << 1)
-#define DUK_RE_FLAG_MULTILINE (1 << 2)
-
-struct duk_re_matcher_ctx {
- duk_hthread *thr;
-
- duk_uint32_t re_flags;
- const duk_uint8_t *input;
- const duk_uint8_t *input_end;
- const duk_uint8_t *bytecode;
- const duk_uint8_t *bytecode_end;
- const duk_uint8_t **saved; /* allocated from valstack (fixed buffer) */
- duk_uint32_t nsaved;
- duk_uint32_t recursion_depth;
- duk_uint32_t recursion_limit;
- duk_uint32_t steps_count;
- duk_uint32_t steps_limit;
-};
-
-struct duk_re_compiler_ctx {
- duk_hthread *thr;
-
- duk_uint32_t re_flags;
- duk_lexer_ctx lex;
- duk_re_token curr_token;
- duk_bufwriter_ctx bw;
- duk_uint32_t captures; /* highest capture number emitted so far (used as: ++captures) */
- duk_uint32_t highest_backref;
- duk_uint32_t recursion_depth;
- duk_uint32_t recursion_limit;
- duk_uint32_t nranges; /* internal temporary value, used for char classes */
-};
-
-/*
- * Prototypes
- */
-
-DUK_INTERNAL_DECL void duk_regexp_compile(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_regexp_create_instance(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_regexp_match(duk_hthread *thr);
-DUK_INTERNAL_DECL void duk_regexp_match_force_global(duk_hthread *thr); /* hacky helper for String.prototype.split() */
-
-#endif /* DUK_REGEXP_H_INCLUDED */
-#line 1 "duk_heaphdr.h"
-/*
- * Heap header definition and assorted macros, including ref counting.
- * Access all fields through the accessor macros.
- */
-
-#ifndef DUK_HEAPHDR_H_INCLUDED
-#define DUK_HEAPHDR_H_INCLUDED
-
-/*
- * Common heap header
- *
- * All heap objects share the same flags and refcount fields. Objects other
- * than strings also need to have a single or double linked list pointers
- * for insertion into the "heap allocated" list. Strings are held in the
- * heap-wide string table so they don't need link pointers.
- *
- * Technically, 'h_refcount' must be wide enough to guarantee that it cannot
- * wrap (otherwise objects might be freed incorrectly after wrapping). This
- * means essentially that the refcount field must be as wide as data pointers.
- * On 64-bit platforms this means that the refcount needs to be 64 bits even
- * if an 'int' is 32 bits. This is a bit unfortunate, and compromising on
- * this might be reasonable in the future.
- *
- * Heap header size on 32-bit platforms: 8 bytes without reference counting,
- * 16 bytes with reference counting.
- */
-
-struct duk_heaphdr {
- duk_uint32_t h_flags;
-
-#if defined(DUK_USE_REFERENCE_COUNTING)
-#if defined(DUK_USE_REFCOUNT16)
- duk_uint16_t h_refcount16;
-#else
- duk_size_t h_refcount;
-#endif
-#endif
-
-#if defined(DUK_USE_HEAPPTR16)
- duk_uint16_t h_next16;
-#else
- duk_heaphdr *h_next;
-#endif
-
-#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
- /* refcounting requires direct heap frees, which in turn requires a dual linked heap */
-#if defined(DUK_USE_HEAPPTR16)
- duk_uint16_t h_prev16;
-#else
- duk_heaphdr *h_prev;
-#endif
-#endif
-
- /* When DUK_USE_HEAPPTR16 (and DUK_USE_REFCOUNT16) is in use, the
- * struct won't align nicely to 4 bytes. This 16-bit extra field
- * is added to make the alignment clean; the field can be used by
- * heap objects when 16-bit packing is used. This field is now
- * conditional to DUK_USE_HEAPPTR16 only, but it is intended to be
- * used with DUK_USE_REFCOUNT16 and DUK_USE_DOUBLE_LINKED_HEAP;
- * this only matter to low memory environments anyway.
- */
-#if defined(DUK_USE_HEAPPTR16)
- duk_uint16_t h_extra16;
-#endif
-};
-
-struct duk_heaphdr_string {
- /* 16 bits would be enough for shared heaphdr flags and duk_hstring
- * flags. The initial parts of duk_heaphdr_string and duk_heaphdr
- * must match so changing the flags field size here would be quite
- * awkward. However, to minimize struct size, we can pack at least
- * 16 bits of duk_hstring data into the flags field.
- */
- duk_uint32_t h_flags;
-
-#if defined(DUK_USE_REFERENCE_COUNTING)
-#if defined(DUK_USE_REFCOUNT16)
- duk_uint16_t h_refcount16;
- duk_uint16_t h_strextra16; /* round out to 8 bytes */
-#else
- duk_size_t h_refcount;
-#endif
-#endif
-};
-
-#define DUK_HEAPHDR_FLAGS_TYPE_MASK 0x00000003UL
-#define DUK_HEAPHDR_FLAGS_FLAG_MASK (~DUK_HEAPHDR_FLAGS_TYPE_MASK)
-
- /* 2 bits for heap type */
-#define DUK_HEAPHDR_FLAGS_HEAP_START 2 /* 5 heap flags */
-#define DUK_HEAPHDR_FLAGS_USER_START 7 /* 25 user flags */
-
-#define DUK_HEAPHDR_HEAP_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_HEAP_START + (n))
-#define DUK_HEAPHDR_USER_FLAG_NUMBER(n) (DUK_HEAPHDR_FLAGS_USER_START + (n))
-#define DUK_HEAPHDR_HEAP_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_HEAP_START + (n)))
-#define DUK_HEAPHDR_USER_FLAG(n) (1UL << (DUK_HEAPHDR_FLAGS_USER_START + (n)))
-
-#define DUK_HEAPHDR_FLAG_REACHABLE DUK_HEAPHDR_HEAP_FLAG(0) /* mark-and-sweep: reachable */
-#define DUK_HEAPHDR_FLAG_TEMPROOT DUK_HEAPHDR_HEAP_FLAG(1) /* mark-and-sweep: children not processed */
-#define DUK_HEAPHDR_FLAG_FINALIZABLE DUK_HEAPHDR_HEAP_FLAG(2) /* mark-and-sweep: finalizable (on current pass) */
-#define DUK_HEAPHDR_FLAG_FINALIZED DUK_HEAPHDR_HEAP_FLAG(3) /* mark-and-sweep: finalized (on previous pass) */
-#define DUK_HEAPHDR_FLAG_READONLY DUK_HEAPHDR_HEAP_FLAG(4) /* read-only object, in code section */
-
-#define DUK_HTYPE_MIN 1
-#define DUK_HTYPE_STRING 1
-#define DUK_HTYPE_OBJECT 2
-#define DUK_HTYPE_BUFFER 3
-#define DUK_HTYPE_MAX 3
-
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HEAPHDR_GET_NEXT(heap,h) \
- ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_next16))
-#define DUK_HEAPHDR_SET_NEXT(heap,h,val) do { \
- (h)->h_next16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) val); \
- } while (0)
-#else
-#define DUK_HEAPHDR_GET_NEXT(heap,h) ((h)->h_next)
-#define DUK_HEAPHDR_SET_NEXT(heap,h,val) do { \
- (h)->h_next = (val); \
- } while (0)
-#endif
-
-#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
-#if defined(DUK_USE_HEAPPTR16)
-#define DUK_HEAPHDR_GET_PREV(heap,h) \
- ((duk_heaphdr *) DUK_USE_HEAPPTR_DEC16((heap)->heap_udata, (h)->h_prev16))
-#define DUK_HEAPHDR_SET_PREV(heap,h,val) do { \
- (h)->h_prev16 = DUK_USE_HEAPPTR_ENC16((heap)->heap_udata, (void *) (val)); \
- } while (0)
-#else
-#define DUK_HEAPHDR_GET_PREV(heap,h) ((h)->h_prev)
-#define DUK_HEAPHDR_SET_PREV(heap,h,val) do { \
- (h)->h_prev = (val); \
- } while (0)
-#endif
-#endif
-
-#if defined(DUK_USE_REFERENCE_COUNTING)
-#if defined(DUK_USE_REFCOUNT16)
-#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount16)
-#define DUK_HEAPHDR_SET_REFCOUNT(h,val) do { \
- (h)->h_refcount16 = (val); \
- } while (0)
-#define DUK_HEAPHDR_PREINC_REFCOUNT(h) (++(h)->h_refcount16) /* result: updated refcount */
-#define DUK_HEAPHDR_PREDEC_REFCOUNT(h) (--(h)->h_refcount16) /* result: updated refcount */
-#else
-#define DUK_HEAPHDR_GET_REFCOUNT(h) ((h)->h_refcount)
-#define DUK_HEAPHDR_SET_REFCOUNT(h,val) do { \
- (h)->h_refcount = (val); \
- } while (0)
-#define DUK_HEAPHDR_PREINC_REFCOUNT(h) (++(h)->h_refcount) /* result: updated refcount */
-#define DUK_HEAPHDR_PREDEC_REFCOUNT(h) (--(h)->h_refcount) /* result: updated refcount */
-#endif
-#else
-/* refcount macros not defined without refcounting, caller must #ifdef now */
-#endif /* DUK_USE_REFERENCE_COUNTING */
-
-/*
- * Note: type is treated as a field separate from flags, so some masking is
- * involved in the macros below.
- */
-
-#define DUK_HEAPHDR_GET_FLAGS_RAW(h) ((h)->h_flags)
-
-#define DUK_HEAPHDR_GET_FLAGS(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_FLAG_MASK)
-#define DUK_HEAPHDR_SET_FLAGS(h,val) do { \
- (h)->h_flags = ((h)->h_flags & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) | (val); \
- } while (0)
-
-#define DUK_HEAPHDR_GET_TYPE(h) ((h)->h_flags & DUK_HEAPHDR_FLAGS_TYPE_MASK)
-#define DUK_HEAPHDR_SET_TYPE(h,val) do { \
- (h)->h_flags = ((h)->h_flags & ~(DUK_HEAPHDR_FLAGS_TYPE_MASK)) | (val); \
- } while (0)
-
-#define DUK_HEAPHDR_HTYPE_VALID(h) ( \
- DUK_HEAPHDR_GET_TYPE((h)) >= DUK_HTYPE_MIN && \
- DUK_HEAPHDR_GET_TYPE((h)) <= DUK_HTYPE_MAX \
- )
-
-#define DUK_HEAPHDR_SET_TYPE_AND_FLAGS(h,tval,fval) do { \
- (h)->h_flags = ((tval) & DUK_HEAPHDR_FLAGS_TYPE_MASK) | \
- ((fval) & DUK_HEAPHDR_FLAGS_FLAG_MASK); \
- } while (0)
-
-#define DUK_HEAPHDR_SET_FLAG_BITS(h,bits) do { \
- DUK_ASSERT(((bits) & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) == 0); \
- (h)->h_flags |= (bits); \
- } while (0)
-
-#define DUK_HEAPHDR_CLEAR_FLAG_BITS(h,bits) do { \
- DUK_ASSERT(((bits) & ~(DUK_HEAPHDR_FLAGS_FLAG_MASK)) == 0); \
- (h)->h_flags &= ~((bits)); \
- } while (0)
-
-#define DUK_HEAPHDR_CHECK_FLAG_BITS(h,bits) (((h)->h_flags & (bits)) != 0)
-
-#define DUK_HEAPHDR_SET_REACHABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
-#define DUK_HEAPHDR_CLEAR_REACHABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
-#define DUK_HEAPHDR_HAS_REACHABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_REACHABLE)
-
-#define DUK_HEAPHDR_SET_TEMPROOT(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
-#define DUK_HEAPHDR_CLEAR_TEMPROOT(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
-#define DUK_HEAPHDR_HAS_TEMPROOT(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_TEMPROOT)
-
-#define DUK_HEAPHDR_SET_FINALIZABLE(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
-#define DUK_HEAPHDR_CLEAR_FINALIZABLE(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
-#define DUK_HEAPHDR_HAS_FINALIZABLE(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZABLE)
-
-#define DUK_HEAPHDR_SET_FINALIZED(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
-#define DUK_HEAPHDR_CLEAR_FINALIZED(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
-#define DUK_HEAPHDR_HAS_FINALIZED(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_FINALIZED)
-
-#define DUK_HEAPHDR_SET_READONLY(h) DUK_HEAPHDR_SET_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
-#define DUK_HEAPHDR_CLEAR_READONLY(h) DUK_HEAPHDR_CLEAR_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
-#define DUK_HEAPHDR_HAS_READONLY(h) DUK_HEAPHDR_CHECK_FLAG_BITS((h),DUK_HEAPHDR_FLAG_READONLY)
-
-/* get or set a range of flags; m=first bit number, n=number of bits */
-#define DUK_HEAPHDR_GET_FLAG_RANGE(h,m,n) (((h)->h_flags >> (m)) & ((1UL << (n)) - 1UL))
-
-#define DUK_HEAPHDR_SET_FLAG_RANGE(h,m,n,v) do { \
- (h)->h_flags = \
- ((h)->h_flags & (~(((1 << (n)) - 1) << (m)))) \
- | ((v) << (m)); \
- } while (0)
-
-/* init pointer fields to null */
-#if defined(DUK_USE_DOUBLE_LINKED_HEAP)
-#define DUK_HEAPHDR_INIT_NULLS(h) do { \
- DUK_HEAPHDR_SET_NEXT((h), (void *) NULL); \
- DUK_HEAPHDR_SET_PREV((h), (void *) NULL); \
- } while (0)
-#else
-#define DUK_HEAPHDR_INIT_NULLS(h) do { \
- DUK_HEAPHDR_SET_NEXT((h), (void *) NULL); \
- } while (0)
-#endif
-
-#define DUK_HEAPHDR_STRING_INIT_NULLS(h) /* currently nop */
-
-/*
- * Assert helpers
- */
-
-/* Check that prev/next links are consistent: if e.g. h->prev is != NULL,
- * h->prev->next should point back to h.
- */
-#if defined(DUK_USE_DOUBLE_LINKED_HEAP) && defined(DUK_USE_ASSERTIONS)
-#define DUK_ASSERT_HEAPHDR_LINKS(heap,h) do { \
- if ((h) != NULL) { \
- duk_heaphdr *h__prev, *h__next; \
- h__prev = DUK_HEAPHDR_GET_PREV((heap), (h)); \
- h__next = DUK_HEAPHDR_GET_NEXT((heap), (h)); \
- DUK_ASSERT(h__prev == NULL || (DUK_HEAPHDR_GET_NEXT((heap), h__prev) == (h))); \
- DUK_ASSERT(h__next == NULL || (DUK_HEAPHDR_GET_PREV((heap), h__next) == (h))); \
- } \
- } while (0)
-#else
-#define DUK_ASSERT_HEAPHDR_LINKS(heap,h) do {} while (0)
-#endif
-
-/*
- * Reference counting helper macros. The macros take a thread argument
- * and must thus always be executed in a specific thread context. The
- * thread argument is needed for features like finalization. Currently
- * it is not required for INCREF, but it is included just in case.
- *
- * Note that 'raw' macros such as DUK_HEAPHDR_GET_REFCOUNT() are not
- * defined without DUK_USE_REFERENCE_COUNTING, so caller must #ifdef
- * around them.
- */
-
-#if defined(DUK_USE_REFERENCE_COUNTING)
-
-#if defined(DUK_USE_ROM_OBJECTS)
-/* With ROM objects "needs refcount update" is true when the value is
- * heap allocated and is not a ROM object.
- */
-/* XXX: double evaluation for 'tv' argument. */
-#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) \
- (DUK_TVAL_IS_HEAP_ALLOCATED((tv)) && !DUK_HEAPHDR_HAS_READONLY(DUK_TVAL_GET_HEAPHDR((tv))))
-#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) (!DUK_HEAPHDR_HAS_READONLY((h)))
-#else /* DUK_USE_ROM_OBJECTS */
-/* Without ROM objects "needs refcount update" == is heap allocated. */
-#define DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv) DUK_TVAL_IS_HEAP_ALLOCATED((tv))
-#define DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(h) 1
-#endif /* DUK_USE_ROM_OBJECTS */
-
-/* Fast variants, inline refcount operations except for refzero handling.
- * Can be used explicitly when speed is always more important than size.
- * For a good compiler and a single file build, these are basically the
- * same as a forced inline.
- */
-#define DUK_TVAL_INCREF_FAST(thr,tv) do { \
- duk_tval *duk__tv = (tv); \
- DUK_ASSERT(duk__tv != NULL); \
- if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(duk__tv)) { \
- duk_heaphdr *duk__h = DUK_TVAL_GET_HEAPHDR(duk__tv); \
- DUK_ASSERT(duk__h != NULL); \
- DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
- DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
- } \
- } while (0)
-#define DUK_TVAL_DECREF_FAST(thr,tv) do { \
- duk_tval *duk__tv = (tv); \
- DUK_ASSERT(duk__tv != NULL); \
- if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(duk__tv)) { \
- duk_heaphdr *duk__h = DUK_TVAL_GET_HEAPHDR(duk__tv); \
- DUK_ASSERT(duk__h != NULL); \
- DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
- DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) > 0); \
- if (DUK_HEAPHDR_PREDEC_REFCOUNT(duk__h) == 0) { \
- duk_heaphdr_refzero((thr), duk__h); \
- } \
- } \
- } while (0)
-#define DUK_HEAPHDR_INCREF_FAST(thr,h) do { \
- duk_heaphdr *duk__h = (duk_heaphdr *) (h); \
- DUK_ASSERT(duk__h != NULL); \
- DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
- if (DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(duk__h)) { \
- DUK_HEAPHDR_PREINC_REFCOUNT(duk__h); \
- } \
- } while (0)
-#define DUK_HEAPHDR_DECREF_FAST(thr,h) do { \
- duk_heaphdr *duk__h = (duk_heaphdr *) (h); \
- DUK_ASSERT(duk__h != NULL); \
- DUK_ASSERT(DUK_HEAPHDR_HTYPE_VALID(duk__h)); \
- DUK_ASSERT(DUK_HEAPHDR_GET_REFCOUNT(duk__h) > 0); \
- if (DUK_HEAPHDR_NEEDS_REFCOUNT_UPDATE(duk__h)) { \
- if (DUK_HEAPHDR_PREDEC_REFCOUNT(duk__h) == 0) { \
- duk_heaphdr_refzero((thr), duk__h); \
- } \
- } \
- } while (0)
-
-/* Slow variants, call to a helper to reduce code size.
- * Can be used explicitly when size is always more important than speed.
- */
-#define DUK_TVAL_INCREF_SLOW(thr,tv) do { \
- duk_tval_incref((tv)); \
- } while (0)
-#define DUK_TVAL_DECREF_SLOW(thr,tv) do { \
- duk_tval_decref((thr), (tv)); \
- } while (0)
-#define DUK_HEAPHDR_INCREF_SLOW(thr,h) do { \
- duk_heaphdr_incref((duk_heaphdr *) (h)); \
- } while (0)
-#define DUK_HEAPHDR_DECREF_SLOW(thr,h) do { \
- duk_heaphdr_decref((thr), (duk_heaphdr *) (h)); \
- } while (0)
-
-/* Default variants. Selection depends on speed/size preference.
- * Concretely: with gcc 4.8.1 -Os x64 the difference in final binary
- * is about +1kB for _FAST variants.
- */
-#if defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
-#define DUK_TVAL_INCREF(thr,tv) DUK_TVAL_INCREF_FAST((thr),(tv))
-#define DUK_TVAL_DECREF(thr,tv) DUK_TVAL_DECREF_FAST((thr),(tv))
-#define DUK_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_FAST((thr),(h))
-#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_FAST((thr),(h))
-#else
-#define DUK_TVAL_INCREF(thr,tv) DUK_TVAL_INCREF_SLOW((thr),(tv))
-#define DUK_TVAL_DECREF(thr,tv) DUK_TVAL_DECREF_SLOW((thr),(tv))
-#define DUK_HEAPHDR_INCREF(thr,h) DUK_HEAPHDR_INCREF_SLOW((thr),(h))
-#define DUK_HEAPHDR_DECREF(thr,h) DUK_HEAPHDR_DECREF_SLOW((thr),(h))
-#endif
-
-/* Casting convenience. */
-#define DUK_HSTRING_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HSTRING_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
-#define DUK_HOBJECT_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HOBJECT_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
-#define DUK_HBUFFER_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) (h))
-#define DUK_HBUFFER_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) (h))
-#define DUK_HCOMPILEDFUNCTION_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HCOMPILEDFUNCTION_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HNATIVEFUNCTION_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HNATIVEFUNCTION_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HBUFFEROBJECT_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HBUFFEROBJECT_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HTHREAD_INCREF(thr,h) DUK_HEAPHDR_INCREF((thr),(duk_heaphdr *) &(h)->obj)
-#define DUK_HTHREAD_DECREF(thr,h) DUK_HEAPHDR_DECREF((thr),(duk_heaphdr *) &(h)->obj)
-
-/* Convenience for some situations; the above macros don't allow NULLs
- * for performance reasons.
- */
-#define DUK_HOBJECT_INCREF_ALLOWNULL(thr,h) do { \
- if ((h) != NULL) { \
- DUK_HEAPHDR_INCREF((thr), (duk_heaphdr *) (h)); \
- } \
- } while (0)
-#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do { \
- if ((h) != NULL) { \
- DUK_HEAPHDR_DECREF((thr), (duk_heaphdr *) (h)); \
- } \
- } while (0)
-
-/*
- * Macros to set a duk_tval and update refcount of the target (decref the
- * old value and incref the new value if necessary). This is both performance
- * and footprint critical; any changes made should be measured for size/speed.
- */
-
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_UNDEFINED(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_UNUSED(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_NULL(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_BOOLEAN(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_NUMBER(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_NUMBER_CHKFAST(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_DOUBLE(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_NAN(tv__dst); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_FASTINT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_FASTINT(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_FASTINT_I32(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_FASTINT_U32(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-#else
-#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr,tvptr_dst,newval) \
- DUK_TVAL_SET_DOUBLE_UPDREF((thr), (tvptr_dst), (duk_double_t) (newval))
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr,tvptr_dst,lf_v,lf_fp,lf_flags) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_LIGHTFUNC(tv__dst, (lf_v), (lf_fp), (lf_flags)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_STRING(tv__dst, (newval)); \
- DUK_HSTRING_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_OBJECT(tv__dst, (newval)); \
- DUK_HOBJECT_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_BUFFER(tv__dst, (newval)); \
- DUK_HBUFFER_INCREF((thr), (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; duk_tval tv__tmp; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_POINTER(tv__dst, (newval)); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-/* DUK_TVAL_SET_TVAL_UPDREF() is used a lot in executor, property lookups,
- * etc, so it's very important for performance. Measure when changing.
- *
- * NOTE: the source and destination duk_tval pointers may be the same, and
- * the macros MUST deal with that correctly.
- */
-
-/* Original idiom used, minimal code size. */
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr,tvptr_dst,tvptr_src) do { \
- duk_tval *tv__dst, *tv__src; duk_tval tv__tmp; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
- DUK_TVAL_SET_TVAL(&tv__tmp, tv__dst); \
- DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
- DUK_TVAL_INCREF((thr), tv__src); \
- DUK_TVAL_DECREF((thr), &tv__tmp); /* side effects */ \
- } while (0)
-
-/* Faster alternative: avoid making a temporary copy of tvptr_dst and use
- * fast incref/decref macros.
- */
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT1(thr,tvptr_dst,tvptr_src) do { \
- duk_tval *tv__dst, *tv__src; duk_heaphdr *h__obj; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
- DUK_TVAL_INCREF_FAST((thr), tv__src); \
- if (DUK_TVAL_NEEDS_REFCOUNT_UPDATE(tv__dst)) { \
- h__obj = DUK_TVAL_GET_HEAPHDR(tv__dst); \
- DUK_ASSERT(h__obj != NULL); \
- DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
- DUK_HEAPHDR_DECREF_FAST((thr), h__obj); /* side effects */ \
- } else { \
- DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
- } \
- } while (0)
-
-/* XXX: no optimized variants yet */
-#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
-#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
-#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
-#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
-#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
-#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_FASTINT_UPDREF_ALT0
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF DUK_TVAL_SET_FASTINT_I32_UPDREF_ALT0
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF DUK_TVAL_SET_FASTINT_U32_UPDREF_ALT0
-#else
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast int-to-double */
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
-#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
-#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
-#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
-#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
-
-#if defined(DUK_USE_FAST_REFCOUNT_DEFAULT)
-/* Optimized for speed. */
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT1
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT1
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#else
-/* Optimized for size. */
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#endif
-
-#else /* DUK_USE_REFERENCE_COUNTING */
-
-#define DUK_TVAL_INCREF_FAST(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_FAST(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_INCREF_SLOW(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF_SLOW(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_INCREF(thr,v) do {} while (0) /* nop */
-#define DUK_TVAL_DECREF(thr,v) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_FAST(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF_SLOW(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HEAPHDR_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HSTRING_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFER_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HCOMPILEDFUNCTION_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HCOMPILEDFUNCTION_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HNATIVEFUNCTION_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HNATIVEFUNCTION_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFEROBJECT_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HBUFFEROBJECT_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HTHREAD_INCREF(thr,h) do {} while (0) /* nop */
-#define DUK_HTHREAD_DECREF(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_INCREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-#define DUK_HOBJECT_DECREF_ALLOWNULL(thr,h) do {} while (0) /* nop */
-
-#define DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_UNDEFINED(tv__dst); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_UNUSED_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_UNUSED(tv__dst); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_NULL_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_NULL(tv__dst); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_BOOLEAN(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_NUMBER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_NUMBER(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_NUMBER_CHKFAST(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#define DUK_TVAL_SET_DOUBLE_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_DOUBLE(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#define DUK_TVAL_SET_NAN_UPDREF_ALT0(thr,tvptr_dst) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_NAN(tv__dst); \
- DUK_UNREF((thr)); \
- } while (0)
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_FASTINT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_FASTINT(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_FASTINT_I32(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_FASTINT_U32(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-#else
-#define DUK_TVAL_SET_DOUBLE_CAST_UPDREF(thr,tvptr_dst,newval) \
- DUK_TVAL_SET_DOUBLE_UPDREF((thr), (tvptr_dst), (duk_double_t) (newval))
-#endif /* DUK_USE_FASTINT */
-
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0(thr,tvptr_dst,lf_v,lf_fp,lf_flags) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_LIGHTFUNC(tv__dst, (lf_v), (lf_fp), (lf_flags)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_STRING_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_STRING(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_OBJECT_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_OBJECT(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_BUFFER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_BUFFER(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_POINTER_UPDREF_ALT0(thr,tvptr_dst,newval) do { \
- duk_tval *tv__dst; tv__dst = (tvptr_dst); \
- DUK_TVAL_SET_POINTER(tv__dst, (newval)); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_TVAL_UPDREF_ALT0(thr,tvptr_dst,tvptr_src) do { \
- duk_tval *tv__dst, *tv__src; \
- tv__dst = (tvptr_dst); tv__src = (tvptr_src); \
- DUK_TVAL_SET_TVAL(tv__dst, tv__src); \
- DUK_UNREF((thr)); \
- } while (0)
-
-#define DUK_TVAL_SET_UNDEFINED_UPDREF DUK_TVAL_SET_UNDEFINED_UPDREF_ALT0
-#define DUK_TVAL_SET_UNUSED_UPDREF DUK_TVAL_SET_UNUSED_UPDREF_ALT0
-#define DUK_TVAL_SET_NULL_UPDREF DUK_TVAL_SET_NULL_UPDREF_ALT0
-#define DUK_TVAL_SET_BOOLEAN_UPDREF DUK_TVAL_SET_BOOLEAN_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_UPDREF DUK_TVAL_SET_NUMBER_UPDREF_ALT0
-#define DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF DUK_TVAL_SET_NUMBER_CHKFAST_UPDREF_ALT0
-#define DUK_TVAL_SET_DOUBLE_UPDREF DUK_TVAL_SET_DOUBLE_UPDREF_ALT0
-#define DUK_TVAL_SET_NAN_UPDREF DUK_TVAL_SET_NAN_UPDREF_ALT0
-#if defined(DUK_USE_FASTINT)
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_FASTINT_UPDREF_ALT0
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF DUK_TVAL_SET_FASTINT_I32_UPDREF_ALT0
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF DUK_TVAL_SET_FASTINT_U32_UPDREF_ALT0
-#else
-#define DUK_TVAL_SET_FASTINT_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF /* XXX: fast-int-to-double */
-#define DUK_TVAL_SET_FASTINT_I32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#define DUK_TVAL_SET_FASTINT_U32_UPDREF DUK_TVAL_SET_DOUBLE_CAST_UPDREF
-#endif /* DUK_USE_FASTINT */
-#define DUK_TVAL_SET_LIGHTFUNC_UPDREF DUK_TVAL_SET_LIGHTFUNC_UPDREF_ALT0
-#define DUK_TVAL_SET_STRING_UPDREF DUK_TVAL_SET_STRING_UPDREF_ALT0
-#define DUK_TVAL_SET_OBJECT_UPDREF DUK_TVAL_SET_OBJECT_UPDREF_ALT0
-#define DUK_TVAL_SET_BUFFER_UPDREF DUK_TVAL_SET_BUFFER_UPDREF_ALT0
-#define DUK_TVAL_SET_POINTER_UPDREF DUK_TVAL_SET_POINTER_UPDREF_ALT0
-
-#define DUK_TVAL_SET_TVAL_UPDREF DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_FAST DUK_TVAL_SET_TVAL_UPDREF_ALT0
-#define DUK_TVAL_SET_TVAL_UPDREF_SLOW DUK_TVAL_SET_TVAL_UPDREF_ALT0
-
-#endif /* DUK_USE_REFERENCE_COUNTING */
-
-#endif /* DUK_HEAPHDR_H_INCLUDED */
-#line 1 "duk_api_internal.h"
-/*
- * Internal API calls which have (stack and other) semantics similar
- * to the public API.
- */
-
-#ifndef DUK_API_INTERNAL_H_INCLUDED
-#define DUK_API_INTERNAL_H_INCLUDED
-
-/* duk_push_sprintf constants */
-#define DUK_PUSH_SPRINTF_INITIAL_SIZE 256L
-#define DUK_PUSH_SPRINTF_SANITY_LIMIT (1L * 1024L * 1024L * 1024L)
-
-/* Flag ORed to err_code to indicate __FILE__ / __LINE__ is not
- * blamed as source of error for error fileName / lineNumber.
- */
-#define DUK_ERRCODE_FLAG_NOBLAME_FILELINE (1L << 24)
-
-/* Valstack resize flags */
-#define DUK_VSRESIZE_FLAG_SHRINK (1 << 0)
-#define DUK_VSRESIZE_FLAG_COMPACT (1 << 1)
-#define DUK_VSRESIZE_FLAG_THROW (1 << 2)
-
-/* Current convention is to use duk_size_t for value stack sizes and global indices,
- * and duk_idx_t for local frame indices.
- */
-DUK_INTERNAL_DECL
-duk_bool_t duk_valstack_resize_raw(duk_context *ctx,
- duk_size_t min_new_size,
- duk_small_uint_t flags);
-
-#if defined(DUK_USE_VERBOSE_ERRORS) && defined(DUK_USE_PARANOID_ERRORS)
-DUK_INTERNAL_DECL const char *duk_get_type_name(duk_context *ctx, duk_idx_t index);
-#endif
-
-DUK_INTERNAL_DECL duk_tval *duk_get_tval(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_tval *duk_require_tval(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL void duk_push_tval(duk_context *ctx, duk_tval *tv);
-
-/* Push the current 'this' binding; throw TypeError if binding is not object
- * coercible (CheckObjectCoercible).
- */
-DUK_INTERNAL_DECL void duk_push_this_check_object_coercible(duk_context *ctx);
-
-/* duk_push_this() + CheckObjectCoercible() + duk_to_object() */
-DUK_INTERNAL_DECL duk_hobject *duk_push_this_coercible_to_object(duk_context *ctx);
-
-/* duk_push_this() + CheckObjectCoercible() + duk_to_string() */
-DUK_INTERNAL_DECL duk_hstring *duk_push_this_coercible_to_string(duk_context *ctx);
-
-/* Get a borrowed duk_tval pointer to the current 'this' binding. Caller must
- * make sure there's an active callstack entry. Note that the returned pointer
- * is unstable with regards to side effects.
- */
-DUK_INTERNAL_DECL duk_tval *duk_get_borrowed_this_tval(duk_context *ctx);
-
-/* XXX: add fastint support? */
-#define duk_push_u64(ctx,val) \
- duk_push_number((ctx), (duk_double_t) (val))
-#define duk_push_i64(ctx,val) \
- duk_push_number((ctx), (duk_double_t) (val))
-
-/* duk_push_(u)int() is guaranteed to support at least (un)signed 32-bit range */
-#define duk_push_u32(ctx,val) \
- duk_push_uint((ctx), (duk_uint_t) (val))
-#define duk_push_i32(ctx,val) \
- duk_push_int((ctx), (duk_int_t) (val))
-
-/* sometimes stack and array indices need to go on the stack */
-#define duk_push_idx(ctx,val) \
- duk_push_int((ctx), (duk_int_t) (val))
-#define duk_push_uarridx(ctx,val) \
- duk_push_uint((ctx), (duk_uint_t) (val))
-#define duk_push_size_t(ctx,val) \
- duk_push_uint((ctx), (duk_uint_t) (val)) /* XXX: assumed to fit for now */
-
-DUK_INTERNAL_DECL duk_hstring *duk_get_hstring(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hobject *duk_get_hobject(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hbuffer *duk_get_hbuffer(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hthread *duk_get_hthread(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hcompiledfunction *duk_get_hcompiledfunction(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hnativefunction *duk_get_hnativefunction(duk_context *ctx, duk_idx_t index);
-
-DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_with_class(duk_context *ctx, duk_idx_t index, duk_small_uint_t classnum);
-
-#if 0 /* This would be pointless: unexpected type and lightfunc would both return NULL */
-DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_or_lfunc(duk_context *ctx, duk_idx_t index);
-#endif
-DUK_INTERNAL_DECL duk_hobject *duk_get_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index);
-
-#if 0 /*unused*/
-DUK_INTERNAL_DECL void *duk_get_voidptr(duk_context *ctx, duk_idx_t index);
-#endif
-
-DUK_INTERNAL_DECL duk_hstring *duk_to_hstring(duk_context *ctx, duk_idx_t index);
-#if defined(DUK_USE_DEBUGGER_SUPPORT) /* only needed by debugger for now */
-DUK_INTERNAL_DECL duk_hstring *duk_safe_to_hstring(duk_context *ctx, duk_idx_t index);
-#endif
-DUK_INTERNAL_DECL void duk_to_object_class_string_top(duk_context *ctx);
-#if !defined(DUK_USE_PARANOID_ERRORS)
-DUK_INTERNAL_DECL void duk_push_hobject_class_string(duk_context *ctx, duk_hobject *h);
-#endif
-
-DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped_raw(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval, duk_bool_t *out_clamped); /* out_clamped=NULL, RangeError if outside range */
-DUK_INTERNAL_DECL duk_int_t duk_to_int_clamped(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval);
-DUK_INTERNAL_DECL duk_int_t duk_to_int_check_range(duk_context *ctx, duk_idx_t index, duk_int_t minval, duk_int_t maxval);
-#if defined(DUK_USE_BUFFEROBJECT_SUPPORT)
-DUK_INTERNAL_DECL duk_uint8_t duk_to_uint8clamped(duk_context *ctx, duk_idx_t index);
-#endif
-
-DUK_INTERNAL_DECL duk_hstring *duk_require_hstring(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hobject *duk_require_hobject(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hbuffer *duk_require_hbuffer(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hthread *duk_require_hthread(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hcompiledfunction *duk_require_hcompiledfunction(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hnativefunction *duk_require_hnativefunction(duk_context *ctx, duk_idx_t index);
-
-DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_with_class(duk_context *ctx, duk_idx_t index, duk_small_uint_t classnum);
-
-DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_or_lfunc(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL duk_hobject *duk_require_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index);
-
-DUK_INTERNAL_DECL void duk_push_hstring(duk_context *ctx, duk_hstring *h);
-DUK_INTERNAL_DECL void duk_push_hstring_stridx(duk_context *ctx, duk_small_int_t stridx);
-DUK_INTERNAL_DECL void duk_push_hobject(duk_context *ctx, duk_hobject *h);
-DUK_INTERNAL_DECL void duk_push_hbuffer(duk_context *ctx, duk_hbuffer *h);
-#define duk_push_hthread(ctx,h) \
- duk_push_hobject((ctx), (duk_hobject *) (h))
-#define duk_push_hcompiledfunction(ctx,h) \
- duk_push_hobject((ctx), (duk_hobject *) (h))
-#define duk_push_hnativefunction(ctx,h) \
- duk_push_hobject((ctx), (duk_hobject *) (h))
-DUK_INTERNAL_DECL void duk_push_hobject_bidx(duk_context *ctx, duk_small_int_t builtin_idx);
-DUK_INTERNAL_DECL duk_idx_t duk_push_object_helper(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx);
-DUK_INTERNAL_DECL duk_idx_t duk_push_object_helper_proto(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_hobject *proto);
-DUK_INTERNAL_DECL duk_idx_t duk_push_object_internal(duk_context *ctx);
-DUK_INTERNAL_DECL duk_idx_t duk_push_compiledfunction(duk_context *ctx);
-DUK_INTERNAL_DECL void duk_push_c_function_noexotic(duk_context *ctx, duk_c_function func, duk_int_t nargs);
-DUK_INTERNAL_DECL void duk_push_c_function_noconstruct_noexotic(duk_context *ctx, duk_c_function func, duk_int_t nargs);
-
-DUK_INTERNAL_DECL void duk_push_string_funcptr(duk_context *ctx, duk_uint8_t *ptr, duk_size_t sz);
-DUK_INTERNAL_DECL void duk_push_lightfunc_name(duk_context *ctx, duk_tval *tv);
-DUK_INTERNAL_DECL void duk_push_lightfunc_tostring(duk_context *ctx, duk_tval *tv);
-DUK_INTERNAL_DECL duk_hbufferobject *duk_push_bufferobject_raw(duk_context *ctx, duk_uint_t hobject_flags_and_class, duk_small_int_t prototype_bidx);
-
-#if !defined(DUK_USE_PARANOID_ERRORS)
-DUK_INTERNAL_DECL const char *duk_push_string_readable(duk_context *ctx, duk_idx_t index);
-DUK_INTERNAL_DECL const char *duk_push_string_tval_readable(duk_context *ctx, duk_tval *tv);
-#endif
-
-DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [val] */
-DUK_INTERNAL_DECL duk_bool_t duk_put_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [val] -> [] */
-DUK_INTERNAL_DECL duk_bool_t duk_del_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [] */
-DUK_INTERNAL_DECL duk_bool_t duk_has_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx); /* [] -> [] */
-
-DUK_INTERNAL_DECL duk_bool_t duk_get_prop_stridx_boolean(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_bool_t *out_has_prop); /* [] -> [] */
-
-DUK_INTERNAL_DECL void duk_xdef_prop(duk_context *ctx, duk_idx_t obj_index, duk_small_uint_t desc_flags); /* [key val] -> [] */
-DUK_INTERNAL_DECL void duk_xdef_prop_index(duk_context *ctx, duk_idx_t obj_index, duk_uarridx_t arr_index, duk_small_uint_t desc_flags); /* [val] -> [] */
-DUK_INTERNAL_DECL void duk_xdef_prop_stridx(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_uint_t desc_flags); /* [val] -> [] */
-DUK_INTERNAL_DECL void duk_xdef_prop_stridx_builtin(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_int_t builtin_idx, duk_small_uint_t desc_flags); /* [] -> [] */
-DUK_INTERNAL_DECL void duk_xdef_prop_stridx_thrower(duk_context *ctx, duk_idx_t obj_index, duk_small_int_t stridx, duk_small_uint_t desc_flags); /* [] -> [] */
-
-/* These are macros for now, but could be separate functions to reduce code
- * footprint (check call site count before refactoring).
- */
-#define duk_xdef_prop_wec(ctx,obj_index) \
- duk_xdef_prop((ctx), (obj_index), DUK_PROPDESC_FLAGS_WEC)
-#define duk_xdef_prop_index_wec(ctx,obj_index,arr_index) \
- duk_xdef_prop_index((ctx), (obj_index), (arr_index), DUK_PROPDESC_FLAGS_WEC)
-#define duk_xdef_prop_stridx_wec(ctx,obj_index,stridx) \
- duk_xdef_prop_stridx((ctx), (obj_index), (stridx), DUK_PROPDESC_FLAGS_WEC)
-
-/* Set object 'length'. */
-DUK_INTERNAL_DECL void duk_set_length(duk_context *ctx, duk_idx_t index, duk_size_t length);
-
-/* Raw internal valstack access macros: access is unsafe so call site
- * must have a guarantee that the index is valid. When that is the case,
- * using these macro results in faster and smaller code than duk_get_tval().
- * Both 'ctx' and 'idx' are evaluted multiple times, but only for asserts.
- */
-#define DUK_ASSERT_VALID_NEGIDX(ctx,idx) \
- (DUK_ASSERT_EXPR((idx) < 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))
-#define DUK_ASSERT_VALID_POSIDX(ctx,idx) \
- (DUK_ASSERT_EXPR((idx) >= 0), DUK_ASSERT_EXPR(duk_is_valid_index((ctx), (idx))))
-#define DUK_GET_TVAL_NEGIDX(ctx,idx) \
- (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_top + (idx))
-#define DUK_GET_TVAL_POSIDX(ctx,idx) \
- (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), ((duk_hthread *) (ctx))->valstack_bottom + (idx))
-#define DUK_GET_HOBJECT_NEGIDX(ctx,idx) \
- (DUK_ASSERT_VALID_NEGIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_top + (idx)))
-#define DUK_GET_HOBJECT_POSIDX(ctx,idx) \
- (DUK_ASSERT_VALID_POSIDX((ctx),(idx)), DUK_TVAL_GET_OBJECT(((duk_hthread *) (ctx))->valstack_bottom + (idx)))
-
-#endif /* DUK_API_INTERNAL_H_INCLUDED */
-#line 1 "duk_hstring.h"
-/*
- * Heap string representation.
- *
- * Strings are byte sequences ordinarily stored in extended UTF-8 format,
- * allowing values larger than the official UTF-8 range (used internally)
- * and also allowing UTF-8 encoding of surrogate pairs (CESU-8 format).
- * Strings may also be invalid UTF-8 altogether which is the case e.g. with
- * strings used as internal property names and raw buffers converted to
- * strings. In such cases the 'clen' field contains an inaccurate value.
- *
- * Ecmascript requires support for 32-bit long strings. However, since each
- * 16-bit codepoint can take 3 bytes in CESU-8, this representation can only
- * support about 1.4G codepoint long strings in extreme cases. This is not
- * really a practical issue.
- */
-
-#ifndef DUK_HSTRING_H_INCLUDED
-#define DUK_HSTRING_H_INCLUDED
-
-/* Impose a maximum string length for now. Restricted artificially to
- * ensure adding a heap header length won't overflow size_t. The limit
- * should be synchronized with DUK_HBUFFER_MAX_BYTELEN.
- *
- * E5.1 makes provisions to support strings longer than 4G characters.
- * This limit should be eliminated on 64-bit platforms (and increased
- * closer to maximum support on 32-bit platforms).
- */
-
-#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_MAX_BYTELEN (0x0000ffffUL)
-#else
-#define DUK_HSTRING_MAX_BYTELEN (0x7fffffffUL)
-#endif
-
-/* XXX: could add flags for "is valid CESU-8" (Ecmascript compatible strings),
- * "is valid UTF-8", "is valid extended UTF-8" (internal strings are not,
- * regexp bytecode is), and "contains non-BMP characters". These are not
- * needed right now.
- */
-
-#define DUK_HSTRING_FLAG_ASCII DUK_HEAPHDR_USER_FLAG(0) /* string is ASCII, clen == blen */
-#define DUK_HSTRING_FLAG_ARRIDX DUK_HEAPHDR_USER_FLAG(1) /* string is a valid array index */
-#define DUK_HSTRING_FLAG_INTERNAL DUK_HEAPHDR_USER_FLAG(2) /* string is internal */
-#define DUK_HSTRING_FLAG_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(3) /* string is a reserved word (non-strict) */
-#define DUK_HSTRING_FLAG_STRICT_RESERVED_WORD DUK_HEAPHDR_USER_FLAG(4) /* string is a reserved word (strict) */
-#define DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS DUK_HEAPHDR_USER_FLAG(5) /* string is 'eval' or 'arguments' */
-#define DUK_HSTRING_FLAG_EXTDATA DUK_HEAPHDR_USER_FLAG(6) /* string data is external (duk_hstring_external) */
-
-#define DUK_HSTRING_HAS_ASCII(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_HAS_ARRIDX(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_HAS_INTERNAL(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_HAS_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_HAS_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_HAS_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_HAS_EXTDATA(x) DUK_HEAPHDR_CHECK_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#define DUK_HSTRING_SET_ASCII(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_SET_ARRIDX(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_SET_INTERNAL(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_SET_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_SET_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_SET_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_SET_EXTDATA(x) DUK_HEAPHDR_SET_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#define DUK_HSTRING_CLEAR_ASCII(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ASCII)
-#define DUK_HSTRING_CLEAR_ARRIDX(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_ARRIDX)
-#define DUK_HSTRING_CLEAR_INTERNAL(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_INTERNAL)
-#define DUK_HSTRING_CLEAR_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_STRICT_RESERVED_WORD(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_STRICT_RESERVED_WORD)
-#define DUK_HSTRING_CLEAR_EVAL_OR_ARGUMENTS(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EVAL_OR_ARGUMENTS)
-#define DUK_HSTRING_CLEAR_EXTDATA(x) DUK_HEAPHDR_CLEAR_FLAG_BITS(&(x)->hdr, DUK_HSTRING_FLAG_EXTDATA)
-
-#if 0 /* Slightly smaller code without explicit flag, but explicit flag
- * is very useful when 'clen' is dropped.
- */
-#define DUK_HSTRING_IS_ASCII(x) (DUK_HSTRING_GET_BYTELEN((x)) == DUK_HSTRING_GET_CHARLEN((x)))
-#endif
-#define DUK_HSTRING_IS_ASCII(x) DUK_HSTRING_HAS_ASCII((x))
-#define DUK_HSTRING_IS_EMPTY(x) (DUK_HSTRING_GET_BYTELEN((x)) == 0)
-
-#if defined(DUK_USE_STRHASH16)
-#define DUK_HSTRING_GET_HASH(x) ((x)->hdr.h_flags >> 16)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
- (x)->hdr.h_flags = ((x)->hdr.h_flags & 0x0000ffffUL) | ((v) << 16); \
- } while (0)
-#else
-#define DUK_HSTRING_GET_HASH(x) ((x)->hash)
-#define DUK_HSTRING_SET_HASH(x,v) do { \
- (x)->hash = (v); \
- } while (0)
-#endif
-
-#if defined(DUK_USE_STRLEN16)
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->hdr.h_strextra16)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
- (x)->hdr.h_strextra16 = (v); \
- } while (0)
-#if defined(DUK_USE_HSTRING_CLEN)
-#define DUK_HSTRING_GET_CHARLEN(x) ((x)->clen16)
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- (x)->clen16 = (v); \
- } while (0)
-#else
-#define DUK_HSTRING_GET_CHARLEN(x) duk_hstring_get_charlen((x))
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- DUK_ASSERT(0); /* should never be called */ \
- } while (0)
-#endif
-#else
-#define DUK_HSTRING_GET_BYTELEN(x) ((x)->blen)
-#define DUK_HSTRING_SET_BYTELEN(x,v) do { \
- (x)->blen = (v); \
- } while (0)
-#define DUK_HSTRING_GET_CHARLEN(x) ((x)->clen)
-#define DUK_HSTRING_SET_CHARLEN(x,v) do { \
- (x)->clen = (v); \
- } while (0)
-#endif
-
-#if defined(DUK_USE_HSTRING_EXTDATA)
-#define DUK_HSTRING_GET_EXTDATA(x) \
- ((x)->extdata)
-#define DUK_HSTRING_GET_DATA(x) \
- (DUK_HSTRING_HAS_EXTDATA((x)) ? \
- DUK_HSTRING_GET_EXTDATA((const duk_hstring_external *) (x)) : ((const duk_uint8_t *) ((x) + 1)))
-#else
-#define DUK_HSTRING_GET_DATA(x) \
- ((const duk_uint8_t *) ((x) + 1))
-#endif
-
-#define DUK_HSTRING_GET_DATA_END(x) \
- (DUK_HSTRING_GET_DATA((x)) + (x)->blen)
-
-/* marker value; in E5 2^32-1 is not a valid array index (2^32-2 is highest valid) */
-#define DUK_HSTRING_NO_ARRAY_INDEX (0xffffffffUL)
-
-/* get array index related to string (or return DUK_HSTRING_NO_ARRAY_INDEX);
- * avoids helper call if string has no array index value.
- */
-#define DUK_HSTRING_GET_ARRIDX_FAST(h) \
- (DUK_HSTRING_HAS_ARRIDX((h)) ? duk_js_to_arrayindex_string_helper((h)) : DUK_HSTRING_NO_ARRAY_INDEX)
-
-/* slower but more compact variant */
-#define DUK_HSTRING_GET_ARRIDX_SLOW(h) \
- (duk_js_to_arrayindex_string_helper((h)))
-
-/*
- * Misc
- */
-
-struct duk_hstring {
- /* Smaller heaphdr than for other objects, because strings are held
- * in string intern table which requires no link pointers. Much of
- * the 32-bit flags field is unused by flags, so we can stuff a 16-bit
- * field in there.
- */
- duk_heaphdr_string hdr;
-
- /* Note: we could try to stuff a partial hash (e.g. 16 bits) into the
- * shared heap header. Good hashing needs more hash bits though.
- */
-
- /* string hash */
-#if defined(DUK_USE_STRHASH16)
- /* If 16-bit hash is in use, stuff it into duk_heaphdr_string flags. */
-#else
- duk_uint32_t hash;
-#endif
-
- /* length in bytes (not counting NUL term) */
-#if defined(DUK_USE_STRLEN16)
- /* placed in duk_heaphdr_string */
-#else
- duk_uint32_t blen;
-#endif
-
- /* length in codepoints (must be E5 compatible) */
-#if defined(DUK_USE_STRLEN16)
-#if defined(DUK_USE_HSTRING_CLEN)
- duk_uint16_t clen16;
-#else
- /* computed live */
-#endif
-#else
- duk_uint32_t clen;
-#endif
-
- /*
- * String value of 'blen+1' bytes follows (+1 for NUL termination
- * convenience for C API). No alignment needs to be guaranteed
- * for strings, but fields above should guarantee alignment-by-4
- * (but not alignment-by-8).
- */
-};
-
-/* The external string struct is defined even when the feature is inactive. */
-struct duk_hstring_external {
- duk_hstring str;
-
- /*
- * For an external string, the NUL-terminated string