From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 27578 invoked from network); 27 Feb 2021 04:51:39 -0000 Received: from hurricane.the-brannons.com (216.252.162.32) by inbox.vuxu.org with ESMTPUTF8; 27 Feb 2021 04:51:39 -0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by hurricane.the-brannons.com (OpenSMTPD) with ESMTP id 0648c2dc for ; Fri, 26 Feb 2021 20:51:30 -0800 (PST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by hurricane.the-brannons.com (OpenSMTPD) with ESMTPS id 67f90f41 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 26 Feb 2021 20:51:07 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3E52A5C00DB for ; Fri, 26 Feb 2021 23:51:02 -0500 (EST) Received: from imap35 ([10.202.2.85]) by compute5.internal (MEProxy); Fri, 26 Feb 2021 23:51:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= mime-version:message-id:date:from:to:subject:content-type; s= fm2; bh=1GI1cU6UhQKLjsAFEVGiJjLwtJm+Jf4Yo/nXSheF6tk=; b=CaRPvsqz 8yj+3klxng78EYZuq3hnFVXKparHIsrShV5h/WMT4+ZZV7YCGHQtN6R7tYRSW9K2 6funMNJTU4VUM/GMQPhs+PsU/rYYNPEuXCSRHm8YOXH/Mm8Pm7BZlVXBj6e6A4et BSWcTgrBdQTjwOBh/wgzMov+y/aiBowkV5fxMTuI1trvD7EGu5yidXWYKKXejKtw xERUqN4WBbNGloDhDABdpy08wnDVY21EVr+AtB+lDi2bkMSYmFlGbsJg9OXs1N+C 1NX7qMuR+kupqh8kPBlcSZOXKoB/Di2LXP8QhdjYixrmFoThqar2tUqPxe6p11Fk 1V7jwjoSMYG22w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=1GI1cU6UhQKLjsAFEVGiJjLwtJm+J f4Yo/nXSheF6tk=; b=C6T3pGCuLayuZKV82rJWHDAYn0fgelMJT7m9WTKunloLA FpUlu5NuEr8V2AcNy/etqLP2sqbYIFskm5TpGUiCjmd3S4BO+H5Ap84Y9OdcJ+Lj Qvefr1aRPSLBJ96+x74vN5WJupKE8539iklSDmmupSikVSwz/EDIE1xxhAqsFZSg G/nfebaY9ucB6aPSl26i5DORzS5MgaxMPJGZ/9JAYsEWBCBgF7UOkdkeIoIlq2h1 K1pkcZIiItY7FgkmoXcbwpJPNY/LiHUkawwN3JwAvYpS1bF3dza+FCfq8VqmAPlF zb4XS4VizqfsbPciXWg6n68d9qYKL/AyWBpxrlhTw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrledvgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtredtre ertdenucfhrhhomhepfdfmvghvihhnucevrghrhhgrrhhtfdcuoehkvghvihhnpggtrghr hhgrrhhtsehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpeehheeiheekie eiffehgfelkeehteelheehueeuvdelfffgfeelhfeffeeludfhheenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkvghvihhnpggtrghrhhgrrh htsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 21CF015A005D; Fri, 26 Feb 2021 23:51:01 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a X-BeenThere: edbrowse-dev@edbrowse.org List-Id: Edbrowse Development List Mime-Version: 1.0 Message-Id: <074c2bb8-6d65-4028-891a-d3d0853aac49@www.fastmail.com> Date: Fri, 26 Feb 2021 20:50:32 -0800 From: "Kevin Carhart" To: edbrowse-dev@edbrowse.org Subject: [edbrowse-dev] triage document for jseng-duk Content-Type: text/plain Level 1 (59 functions) - No duktape API calls and the topic is not related to our major design decisions Level 2 (22 functions) - No duktape API calls but the topic *IS* related to our major design decisions Level 3 (83 functions) - Makes duktape API calls but the topic is not related to our major design decisions Level 4 (10 functions) - Makes duktape API calls and the topic *IS* about our major design decisions LEVEL 1 - NO DUKTAPE API CALLS AND THE TOPIC DOES NOT INVOLVE MAJOR DESIGNS LIKE FRAMES, EVENTS, TAG LINKING, GC static duk_ret_t nat_void(duk_context * cx) Commentary: return 0. Call needed: none Binding: duk_put_global_string(cx, "eb$voidfunction"); Binding: duk_put_global_string(cx, "scroll"); Binding: duk_put_global_string(cx, "scrollTo"); Binding: duk_put_global_string(cx, "scrollBy"); Binding: duk_put_global_string(cx, "scrollByLines"); Binding: duk_put_global_string(cx, "scrollByPages"); Binding: duk_put_global_string(cx, "focus"); Binding: duk_put_global_string(cx, "blur"); Binding: duk_put_prop_string(cx, -2, "focus"); Binding: duk_put_prop_string(cx, -2, "blur"); Binding: duk_put_prop_string(cx, -2, "close"); static duk_ret_t nat_new_location(duk_context * cx) Commentary: a wrapper around our domOpensWindow. No calls, just need to accept a couple of JS values properly and use them Calls needed: none Binding: duk_put_global_string(cx, "eb$newLocation"); static duk_ret_t nat_doc_write(duk_context * cx) Commentary: simple Calls needed: none Binding: duk_put_prop_string(cx, -2, "write"); static duk_ret_t nat_doc_writeln(duk_context * cx) Commentary: simple Calls needed: none Binding: duk_put_prop_string(cx, -2, "writeln"); void set_property_bool_win(const Frame *f, const char *name, bool v) Commentary: this only calls other edbrowse Calls needed: none void set_property_string_win(const Frame *f, const char *name, const char *v) Commentary: this only calls other edbrowse Calls needed: none void set_property_string_doc(const Frame *f, const char *name, const char *v) Commentary: this only calls other edbrowse Calls needed: none static duk_ret_t nat_setTimeout(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_global_string(cx, "setTimeout"); static duk_ret_t nat_setInterval(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_global_string(cx, "setInterval"); static duk_ret_t nat_apch1(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "eb$apch1"); static duk_ret_t nat_apch2(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "eb$apch2"); static duk_ret_t nat_crelem(duk_context *cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "createElement"); static duk_ret_t nat_crelns(duk_context *cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "createElementNS"); static duk_ret_t nat_crtext(duk_context *cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "createTextNode"); static duk_ret_t nat_crcom(duk_context *cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "createComment"); static duk_ret_t nat_crfrag(duk_context *cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_prop_string(cx, -2, "createDocumentFragment"); void jsRunScript_t(const Tag *t, const char *str, const char *filename, int lineno) Commentary: this only calls other edbrowse Calls needed: none char *jsRunScriptWinResult(const char *str, const char *filename, int lineno) Commentary: this only calls other edbrowse Calls needed: none int uname(struct utsname *pun) Commentary: this only calls other edbrowse Calls needed: none bool has_property_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none bool has_property_win(const Frame *f, const char *name) Commentary: this only calls other edbrowse Calls needed: none void set_property_object_t(const Tag *t, const char *name, const Tag *t2) Commentary: this only calls other edbrowse Calls needed: none static duk_ret_t nat_error_stub_1(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none bool run_function_bool_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none bool run_function_bool_win(const Frame *f, const char *name) Commentary: this only calls other edbrowse Calls needed: none int run_function_onearg_t(const Tag *t, const char *name, const Tag *t2) Commentary: this only calls other edbrowse Calls needed: none int run_function_onearg_win(const Frame *f, const char *name, const Tag *t2) Commentary: this only calls other edbrowse Calls needed: none int run_function_onearg_doc(const Frame *f, const char *name, const Tag *t2) Commentary: this only calls other edbrowse Calls needed: none void run_function_onestring_t(const Tag *t, const char *name, const char *s) Commentary: this only calls other edbrowse Calls needed: none bool get_property_bool_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none enum ej_proptype typeof_property_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none int get_property_number_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none char *get_property_string_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none char *get_property_url_t(const Tag *t, bool action) Commentary: this only calls other edbrowse Calls needed: none void delete_property_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none void delete_property_win(const Frame *f, const char *name) Commentary: this only calls other edbrowse Calls needed: none void delete_property_doc(const Frame *f, const char *name) Commentary: this only calls other edbrowse Calls needed: none void set_property_bool_t(const Tag *t, const char *name, bool v) Commentary: this only calls other edbrowse Calls needed: none void set_property_number_t(const Tag *t, const char *name, int v) Commentary: this only calls other edbrowse Calls needed: none void set_property_string_t(const Tag *t, const char *name, const char * v) Commentary: this only calls other edbrowse Calls needed: none void jsRunScriptWin(const char *str, const char *filename, int lineno) Commentary: this only calls other edbrowse Calls needed: none static duk_ret_t nat_win_close(duk_context * cx) Commentary: this only calls other edbrowse Calls needed: none Binding: duk_put_global_string(cx, "close"); char *get_style_string_t(const Tag *t, const char *name) Commentary: this only calls other edbrowse Calls needed: none void freeJSContext(Frame *f) Commentary: this only calls other edbrowse Calls needed: none void set_dataset_string_t(const Tag *t, const char *name, const char *v) Commentary: this only calls other edbrowse Calls needed: none void establish_js_textnode(Tag *t, const char *fpn) Commentary: this only calls other edbrowse Calls needed: none static char *jsRunScriptResult(const Frame *f, jsobjtype obj, const char *str, const char *filename, int lineno) Commentary: this is the prominent function that sends JS code to the interpreter when you DO care about the result Calls needed: none void createJSContext(Frame *f) Commentary: call createJSContext_0. Initialization. Calls needed: none char *get_dataset_string_t(const Tag *t, const char *p) Commentary: get string from dataset object; no duk calls Calls needed: none static void startCookie(void) Commentary: the back end component of creating a new cookie; no duk calls Calls needed: none static void rebuildSelector(Tag *sel, jsobjtype oa, int len2) Commentary: heavy tree work! No duk calls, therefore easy fom the perspective of porting to a new engine Calls needed: none static void domSetsLinkage(bool after, char type, jsobjtype p_j, const char *rest) Commentary: Major tree work! What remains of our side effects handler! This function contains no duk, therefore easy from the perspective of porting to a new engine. Calls needed: none void domLink(Tag *t, const char *classname,/* instantiate this class */ const char *href, const char *list, /* next member of this array */ const Tag * owntag, int extra) Commentary: well, domLink is domLink. Could be the most important function in the whole place. However, it does not involve any duktape API calls, so does this mean that nothing needs to be done when porting? I think so. It's a conduit to tons of other functions and those functions have the duk. Calls needed: none static char *get_property_url_0(jsobjtype cx, jsobjtype owner, bool action) Commentary: get an object property when it is of type URL? Does not actually call the Duktape API from here Calls needed: none static void processStyles(jsobjtype so, const char *stylestring) Commentary: deal with one particular kind of inline CSS, dates back to early libtidy; no duk calls Calls needed: none void rebuildSelectors(void) Commentary: A venerable, oldschool function for dropdown options! With no duktape Calls needed: none void establish_js_option(Tag *t, Tag *sel) Commentary: sets up options for the elements that have them. Right? Does not call the duktape API at all Calls needed: none static void setup_window_2(void) Commentary: fundamental javascript initializations - does not call the duktape API Calls needed: none static const char *pointer2string(const jsobjtype obj) Commentary: represent an object pointer in ascii Calls needed: none LEVEL 2 - NO DUKTAPE API INVOLVEMENT BUT THE TOPIC INVOLVES MAJOR DESIGNS LIKE FRAMES, EVENTS, TAG LINKING, GC bool frameExpand(bool expand, int ln1, int ln2) Commentary: no wrappers here Calls needed: none static int frameContractLine(int ln) Commentary: no wrappers Calls needed: none static void unlink_event_0(jsobjtype cx, jsobjtype parent) Commentary: this only calls other edbrowse Calls needed: none void jsUnroot(void) Commentary: this function isn't needed in the duktape world - I assume the same for qjs Calls needed: none bool run_event_t(const Tag *t, const char *pname, const char *evname) Commentary: this only calls other edbrowse Calls needed: none bool run_event_win(const Frame *f, const char *pname, const char *evname) Commentary: this only calls other edbrowse Calls needed: none bool run_event_doc(const Frame *f, const char *pname, const char *evname) Commentary: this only calls other edbrowse Calls needed: none static void linkageNow(duk_context * cx, char linkmode, jsobjtype o) Commentary: the logic may be complex, but there are no duk functions here Calls needed: none static jsobjtype create_event_0(jsobjtype cx, jsobjtype parent, const char *evname) Commentary: this only calls other edbrowse Calls needed: none static void forceFrameExpand(Tag *t) Commentary: this is serious frames code but this particular function does not have any duk involvement Calls needed: none static bool rootTag(jsobjtype start, Tag **tp) Commentary: May need to change if we change our design but this particular function has no duk involvement Calls needed: none bool bubble_event_t(const Tag *t, const char *name) Commentary: heavy events work but no duk calls in this particular one Calls needed: none static Tag *tagFromObject2(jsobjtype v, const char *tagname) Commentary: part of the crucial design of how we connect objects; no duk calls in this one Calls needed: none static Tag *tagFromObject(jsobjtype v) Commentary: part of the crucial design of how we connect objects; no duk calls in this one Calls needed: none static bool run_event_0(jsobjtype cx, jsobjtype obj, const char *pname, const char *evname) Commentary: the back end portion of our event execution apparatus; actually no duk in this one Calls needed: none bool reexpandFrame(void) Commentary: file with the intermediates - does not call the duktape API but this is one of the major nerve centers of edbrowse. It calls to tidy, builds the tree, when this is triggered by javascript (like innerHTML) rather than at the very outset Calls needed: none void connectTagObject(Tag *t, jsobjtype p) Commentary: Intermediate. calls set_property_number_0 which itself has API functions. The second hop is not explained here. It will be explained at the place where it is used. Everything else is edbrowse. Call needed: none void disconnectTagObject(Tag *t) Commentary: Intermediate. This is entirely edbrowse. The new engine can address it Call needed: none static void *watch_malloc(void *udata, size_t n) Commentary: related to heavy memory management issues. No duktape API calls. Calls needed: none static void *watch_realloc(void *udata, void *p, size_t n) Commentary: related to heavy memory management issues. No duktape API calls. Calls needed: none static void watch_free(void *udata, void *p) Commentary: related to heavy memory management issues. No duktape API calls. Calls needed: none static int frameExpandLine(int ln, Tag *t) Commentary: Heavy. Very intensive work related to our frames while at the same time, no duktape API calls here. May or may not be simple to port to a new engine but it should maybe be studied in tandem with its callors and callees Calls needed: none LEVEL 3 - LOTS OF DUKTAPE API CALLS BUT THE TOPIC IS NOT RELATED OR LESS RELATED TO THE MAJOR DESIGN DECISIONS static void set_timeout(duk_context * cx, bool isInterval) Commentary: file under the moderates because it is long and uses a lot of duktape but is more of a self contained job than a component of one of the major designs Calls needed: duk_get_top, duk_get_int, duk_pop_n, duk_is_function, duk_push_string, duk_put_prop_string, duk_is_string, duk_get_string, duk_pcompile, duk_push_c_function, duk_pop, duk_push_global_object, duk_get_global_string, duk_pnew, duk_push_int, duk_get_heapptr, duk_def_prop, duk_push_heapptr, duk_insert, duk_push_number static duk_ret_t nat_qsa(duk_context * cx) Commentary: the back end portion of querySelectorAll Calls needed: duk_get_string, duk_get_top, duk_pop_n, duk_is_object, duk_get_heapptr, duk_push_this, duk_pop Binding: duk_put_global_string(cx, "querySelectorAll"); static void dwrite(duk_context * cx, bool newline) Commentary: document.write. Intermediate difficulty. Somewhat isolated from large designs but uses duk calls Calls needed: duk_get_top, duk_push_string, duk_insert, duk_join, duk_push_string, duk_get_string static void processError(duk_context * cx) Commentary: process errors Calls needed: duk_get_prop_string, duk_get_int, duk_pop, duk_to_string static duk_ret_t nat_removeChild(duk_context * cx) Commentary: Intermediate. One of the fundamental DOM functions. Uses a lot of duk calls. Calls needed: duk_is_object, duk_get_heapptr, duk_push_this, duk_get_prop_string, duk_is_array, duk_pop_2, duk_get_length, duk_get_prop_index, duk_pop, duk_set_length, duk_push_null, duk_put_prop_string, duk_push_heapptr, duk_is_function, duk_push_false, duk_push_int, duk_call Binding: duk_put_prop_string(cx, -2, "removeChild"); static bool run_function_bool_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: code to run a function when the return is of type boolean Calls needed: duk_push_heapptr, duk_get_prop_string, duk_pop, duk_is_function, duk_pop_2, duk_insert, duk_pcall_method, duk_is_boolean, duk_get_boolean, duk_is_number, duk_get_number, duk_is_string, duk_get_string static const char *embedNodeName(duk_context * cx, jsobjtype obj) Commentary: We need to call and remember up to 3 node names, and then embed them in the side effects string, after all duktape calls have been made. Calls needed: duk_push_heapptr, duk_get_prop_string, duk_get_string, duk_pop_2 static duk_ret_t nat_qs(duk_context * cx) Commentary: back end portion of querySelector Calls needed: duk_get_string, duk_get_top, duk_pop_n, duk_is_object, duk_get_heapptr, duk_push_this, duk_pop, duk_push_undefined, duk_push_heapptr Binding: duk_put_global_string(cx, "querySelector"); static duk_ret_t nat_insbf(duk_context * cx) Commentary: the back end portion of insertBefore - fundamental DOM tree manipulation Calls needed: duk_get_top, duk_is_object, duk_get_heapptr, duk_push_this, duk_get_prop_string, duk_is_array, duk_pop_n, duk_get_length, duk_get_prop_index, duk_pop, duk_put_prop_index, duk_push_heapptr, duk_push_string, duk_insert, duk_remove, duk_def_prop Binding: duk_put_prop_string(cx, -2, "eb$insbf"); static int run_function_onearg_0(jsobjtype cx0, jsobjtype parent, const char *name, jsobjtype child) Commentary: code to run a function that takes one argument Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_function, duk_pop_2, duk_insert, duk_pcall_method, duk_get_boolean, duk_get_number, duk_pop static jsobjtype instantiate_0(jsobjtype cx0, jsobjtype parent, const char *name, const char *classname) Commentary: instantiate an object given its classname Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_object, duk_pop_2, duk_pop, duk_get_global_string, duk_pnew, duk_get_heapptr, duk_put_prop_string static duk_ret_t nat_logputs(duk_context * cx) Commentary: The interfaces are to safely accept and wrap a string and an int. And, duk_remove, which I need to make sure I understand Calls needed: duk_remove, plus standard I/O already covered Binding: duk_put_global_string(cx, "eb$logputs"); static duk_ret_t nat_prompt(duk_context * cx) Commentary: the only new one is duk_get_top, plus I/O already covered. There is work in the middle from edbrowse and other C which can stay the same. Calls needed: duk_get_top, plus standard I/O already covered Binding: duk_put_global_string(cx, "prompt"); static void jsInterruptCheck(duk_context * cx) Commentary: May be very engine specific. Uses duk_call so I need to find equivalent, if there is one Calls needed: duk_call static duk_ret_t nat_top(duk_context * cx) Commentary: not sure, I think it has to do with iframes Calls needed: duk_push_heapptr Binding: duk_put_global_string(cx, "eb$top"); void jsClose(void) Commentary: clean up memory Calls needed: duk_destroy_heap static duk_ret_t protected_get(duk_context * cx, void *udata) Commentary: I think it's a getter Calls needed: duk_get_prop_string static duk_ret_t getter_value(duk_context * cx) Commentary: it's a getter, by the book Calls needed: duk_push_this,duk_get_prop_string,duk_remove static void delete_property_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: deletes a property in the duktape context Calls needed: duk_push_heapptr, duk_del_prop_string, duk_pop static duk_ret_t nat_fntos(duk_context * cx) Commentary: a function to string Calls needed: duk_push_this, duk_get_prop_string, duk_remove static bool has_property_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: a boolean test of whether an object has a property. heapptr is used. Calls needed: duk_push_heapptr, duk_has_prop_string, duk_pop static int set_property_bool_0(jsobjtype cx0, jsobjtype parent, const char *name, bool n) Commentary: sets an object property with an incoming bool Calls needed: duk_push_heapptr, duk_push_boolean, duk_put_prop_string, duk_pop static int set_property_number_0(jsobjtype cx0, jsobjtype parent, const char *name, int n) Commentary: sets an object property with an incoming int Calls needed: duk_push_heapptr, duk_push_int, duk_put_prop_string, duk_pop static int set_property_object_0(jsobjtype cx0, jsobjtype parent, const char *name, jsobjtype child) Commentary: sets an object property with an incoming jsobjtype object Calls needed: duk_push_heapptr, duk_put_prop_string, duk_pop static int set_array_element_object_0(jsobjtype cx0, jsobjtype parent, int idx, jsobjtype child) Commentary: sets an array element in the way in which you do this in duktape Calls needed: duk_push_heapptr, duk_put_prop_index static enum ej_proptype typeof_property_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: I assume from the name that this returns typeof something Calls needed: duk_push_heapptr, duk_safe_call, duk_pop_2 static jsobjtype get_property_object_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: get an object property when it is of type object Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_object static int set_property_float_0(jsobjtype cx0, jsobjtype parent, const char *name, double n) Commentary: set an object property when it is of type float (an incoming c double) Calls needed: duk_push_heapptr, duk_push_number, duk_put_prop_string, duk_pop static jsobjtype get_array_element_object_0(jsobjtype cx0, jsobjtype parent, int idx) Commentary: look up and return an array element which is of type object, I think based on an index Calls needed: duk_push_heapptr, duk_get_prop_index, duk_is_object, duk_pop_2 static void freeJSContext_0(Frame *f) Commentary: free the JS context, make a neat shutdown according to the engine's rules for doing so Calls needed: duk_get_top, duk_get_context, duk_remove static int get_arraylength_0(jsobjtype cx0, jsobjtype a) Commentary: get the array length and return it Calls needed: duk_push_heapptr, duk_is_array, duk_get_length, duk_pop bool has_gcs(const char *name) Commentary: Is this about garbage collection? Or global? I think it's about global. Test for global? Calls needed: duk_get_global_string, duk_has_prop_string, duk_pop void set_gcs_number(const char *name, int n) Commentary: push a number (C int) on to the global scope Calls needed: duk_get_global_string, duk_push_int, duk_put_prop_string, duk_pop void set_gcs_bool(const char *name, bool v) Commentary: push a bool on to the global scope Calls needed: duk_get_global_string, duk_push_boolean, duk_put_prop_string, duk_pop void set_gcs_string(const char *name, const char *s) Commentary: push a string on to the global scope Calls needed: duk_get_global_string, duk_push_string, duk_put_prop_string, duk_pop static duk_ret_t nat_clearTimeout(duk_context * cx) Commentary: the native component for clearTimeout Calls needed: duk_get_heapptr Binding: duk_put_global_string(cx, "clearTimeout"); Binding: duk_put_global_string(cx, "clearInterval"); static jsobjtype get_property_function_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: return an object property when it is of type function Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_function static int get_property_number_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: return an object property when it is of type number Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_number, duk_get_number static double get_property_float_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: return an object property when it is of type float Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_number, duk_get_number void run_ontimer(const Frame *f, const char *backlink) Commentary: the native component of our timers Calls needed: duk_get_global_string, duk_pop, duk_get_heapptr static duk_ret_t nat_cssApply(duk_context * cx) Commentary: it is the native component of a CSS processing action. File under easy, not difficult. Calls needed: duk_get_heapptr, duk_get_number, duk_pop_2 Binding: duk_put_global_string(cx, "eb$cssApply"); static duk_ret_t nat_setcook(duk_context * cx) Commentary: the native portion of set cookie Calls needed: duk_get_string, duk_get_global_string, duk_pop Binding: duk_put_global_string(cx, "eb$setcook"); enum ej_proptype typeof_gcs(const char *name) Commentary: Is this to take the typeof something that is located in the global scope? Calls needed: duk_get_global_string, duk_get_prop_string static duk_ret_t nat_formSubmit(duk_context * cx) Commentary: this is the native portion of formSubmit which calls domSubmitsForm Calls needed: duk_push_this, duk_get_heapptr, duk_pop Binding: duk_put_global_string(cx, "eb$formSubmit"); static duk_ret_t nat_formReset(duk_context * cx) Commentary: this is the native portion of formReset which calls domSubmitsForm with arguments to reset it Calls needed: duk_push_this, duk_get_heapptr, duk_pop Binding: duk_put_global_string(cx, "eb$formReset"); int get_gcs_number(const char *name) Commentary: get a value from global scope which is of type number Calls needed: duk_get_global_string, duk_get_prop_string, duk_is_number, duk_get_number static duk_ret_t nat_parent(duk_context * cx) Commentary: the native component of parent, I think meaning when you go one level up from a frame Calls needed: duk_push_undefined, duk_push_heapptr, duk_push_undefined Binding: duk_put_global_string(cx, "eb$parent"); static duk_ret_t nat_resolveURL(duk_context * cx) Commentary: the native portion of resolving a URL Calls needed: duk_pop_2, duk_push_string Binding: duk_put_global_string(cx, "eb$resolveURL"); static bool get_property_bool_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: return an object property when it is of type bool Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_number, duk_get_number, duk_is_boolean, duk_get_boolean, duk_pop_2 static duk_ret_t nat_qs0(duk_context * cx) Commentary: the back end component of querySelector Calls needed: duk_get_string, duk_push_this, duk_get_heapptr, duk_pop, duk_push_false, duk_push_boolean Binding: duk_put_global_string(cx, "querySelector0"); static jsobjtype instantiate_array_element_0(jsobjtype cx0, jsobjtype parent, int idx, const char *classname) Commentary: instantiate an array element given a classname and an index Calls needed: duk_push_heapptr, duk_get_global_string, duk_pnew, duk_pop, duk_get_heapptr, duk_put_prop_index static void run_function_onestring_0(jsobjtype cx0, jsobjtype parent, const char *name, const char *s) Commentary: for running a function - the single argument to the function has to be a string. Calls needed: duk_push_heapptr, duk_get_prop_string, duk_is_function, duk_pop_2, duk_insert, duk_push_string, duk_pcall_method, duk_pop static jsobjtype instantiate_array_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: instantiate an array Calls needed: duk_push_heapptr, duk_get_prop_string, duk_get_heapptr, duk_pop_2, duk_pop, duk_get_global_string, duk_pnew, duk_put_prop_string static char *get_property_string_0(jsobjtype cx0, jsobjtype parent, const char *name) Commentary: get an object property when it is of type string Calls needed: duk_push_heapptr, duk_get_prop_string, duk_pop_2, duk_is_object, duk_get_heapptr, duk_safe_to_string static int set_property_function_0(jsobjtype cx0, jsobjtype parent, const char *name, const char *body) Commentary: set an object property when it is of type function Calls needed: duk_push_string, duk_pcompile, duk_push_c_function, duk_put_prop_string, duk_push_heapptr, duk_insert, duk_pop static int set_property_string_0(jsobjtype cx0, jsobjtype parent, const char *name, const char *value) Commentary: set an object property of type string Calls needed: duk_c_function, duk_push_heapptr, duk_get_global_string, duk_pop, duk_instanceof, duk_get_prop_string, duk_push_string, duk_push_c_function, duk_def_prop, duk_push_prop_string static void uptrace(duk_context * cx, jsobjtype node) Commentary: our uptrace. Off the beaten track from the major designs, but it uses duk, so call it moderate Calls needed: duk_push_heapptr, duk_get_prop_string, duk_to_string, duk_pop, duk_pop_2, duk_remove static char *run_script_0(jsobjtype cx0, const char *s) Commentary: run a script. A major entry point to the interpreter - right? My assumption as of now is that the trace@() handling will stay the same when porting. There is not any duk involvement in that section. Calls needed: duk_peval_string, duk_safe_to_string, duk_pop void jsRunData(const Tag *t, const char *filename, int lineno) Commentary: execute script.text code; more efficient than [run_script_0] Calls needed: duk_push_heapptr, duk_get_prop_string, duk_pop_2, duk_safe_to_string, duk_put_prop_string, duk_pop, duk_peval_string, duk_pop, duk_del_prop_string static void append0(duk_context * cx, bool side) Commentary: file with the intermediates. It is tree work - appendChild, less difficult. But, uses TONS of duk calls Calls needed: duk_get_top, duk_is_object, duk_get_heapptr, duk_push_this, duk_get_prop_string, duk_is_array, duk_pop_2, duk_get_length, duk_get_prop_index, duk_pop_n, duk_pop, duk_push_heapptr, duk_put_prop_index, duk_push_string, duk_insert, duk_def_prop static duk_ret_t nat_fetchHTTP(duk_context * cx) Commentary: the back end portion of our XHR - startwindow -> fetchHTTP -> curl -> fetchHTTP -> startwindow. File under moderate because basically it's more of a self-contained job rather than a component of one of the big design questions, yet it uses a ton of duktape that will need to be thought through in order to port to quick. Calls needed: duk_safe_to_string, duk_get_string, duk_push_this, duk_get_heapptr, duk_get_prop_string, duk_get_boolean, duk_pop_2, duk_pop_n, duk_push_global_object, duk_push_string, duk_def_prop, duk_pop, duk_put_prop_string, duk_get_global_string, duk_call, duk_push_int, duk_join Binding: duk_put_global_string(cx, "eb$fetchHTTP"); static duk_ret_t setter_value(duk_context * cx) Commentary: one of the setters, of value, as in, HTML tag value and our corresponding variable value, I believe Calls needed: duk_safe_to_string, duk_push_this, duk_insert, duk_put_prop_string, duk_get_heapptr, duk_pop static enum ej_proptype top_proptype(duk_context * cx) Commentary: determine the type of the element on the top of the stack. Calls needed: duk_get_type, duk_get_number, duk_is_function, duk_is_array static duk_ret_t nat_log_element(duk_context * cx) Commentary: is this just about console.log or logging? It seems to be about more, may file with the difficults Calls needed: duk_get_heapptr, duk_get_string, duk_pop, duk_push_string, duk_push_c_function, duk_def_prop, duk_put_prop_string Binding: duk_put_global_string(cx, "eb$logElement"); static void objectize(duk_context *cx, Tag **tlist) Commentary: turn an array of html tags into an array of objects. Leave the array on the duktape stack. Calls needed: duk_get_global_string, duk_new, duk_push_heapattr, duk_put_prop_index static duk_ret_t nat_null(duk_context * cx) Commentary: push a null Calls needed: duk_push_null static duk_ret_t nat_true(duk_context * cx) Commentary: push a true Calls needed: duk_push_true static duk_ret_t nat_false(duk_context * cx) Commentary: push a false Calls needed: duk_push_false static int js_main(void) Commentary: I don't totally know how this relates to other JS init routines. Calls needed: duk_create_heap, duk_push_global_object, duk_push_false, duk_push_prop_string, duk_get_heapptr, duk_pop static duk_ret_t nat_btoa(duk_context * cx) Commentary: base64 encode Calls needed: duk_get_string, duk_pop, duk_push_string Binding: duk_put_global_string(cx, "btoa"); static duk_ret_t nat_atob(duk_context * cx) Commentary: base64 decode Calls needed: duk_get_string, duk_pop, duk_push_string Binding: duk_put_global_string(cx, "atob"); static duk_ret_t nat_mywin(duk_context * cx) Commentary: push window object to global context Calls needed: duk_push_global_object static duk_ret_t nat_mydoc(duk_context * cx) Commentary: push document object to global context Calls needed: duk_get_global_string static duk_ret_t nat_hasfocus(duk_context * cx) Commentary: test focus and return boolean Calls needed: duk_push_boolean static duk_ret_t nat_puts(duk_context * cx) Commentary: not sure why this isn't covered by other means, but it uses the C function puts to put a string Calls needed: duk_safe_to_string static duk_ret_t nat_cssText(duk_context * cx) Commentary: CSS-related Calls needed: duk_get_string, duk_pop static duk_ret_t nat_css_start(duk_context * cx) Commentary: CSS-related Calls needed: duk_get_number, duk_get_string, duk_get_boolean Binding: duk_put_global_string(cx, "eb$cssDocLoad"); static duk_ret_t nat_getcook(duk_context * cx) Commentary: cookies-related Calls needed: duk_push_string static duk_ret_t nat_wlf(duk_context * cx) Commentary: write local file Calls needed: duk_safe_to_string static duk_ret_t nat_media(duk_context * cx) Commentary: the back end portion of matchMedia (don't remember what it does) Calls needed: duk_safe_to_string, duk_pop, duk_push_boolean Binding: duk_put_global_string(cx, "eb$media"); static duk_ret_t nat_confirm(duk_context * cx) Commentary: back end portion of a confirm box, like an alert, with multiple buttons Calls needed: duk_safe_to_string, duk_pop, duk_push_boolean Binding: duk_put_global_string(cx, "confirm"); static duk_ret_t getter_innerHTML(duk_context * cx) Commentary: get an element's innerHTML - happens back here because innerHTML is very dynamic Calls needed: duk_push_this, duk_get_prop_string, duk_remove static duk_ret_t setter_innerHTML(duk_context * cx) Commentary: related to how we update edbrowse with innerHTML changes immediately Calls needed: duk_safe_to_string, duk_push_this, duk_get_prop_string, duk_is_array, duk_get_heapptr, duk_pop_n, duk_put_prop_string, duk_get_global_string, duk_pnew, duk_insert, duk_push_heapptr, duk_is_function, duk_push_false, duk_call, duk_pop_2, duk_del_prop_string, duk_pop LEVEL 4 - LOTS OF DUKTAPE API CALLS AND THE TOPIC INVOLVES MAJOR DESIGNS LIKE FRAMES, EVENTS, TAG LINKING, GC static Frame *thisFrame(duk_context *cx, const char *whence) Commentary: Heavy. File with the difficults. This is serious work on our frames handling, with many duk calls Calls needed: duk_push_this, duk_has_prop_string, duk_pop, duk_get_heapptr static duk_ret_t nat_fe(duk_context * cx) Commentary: relates to frameElement Calls needed: duk_push_undefined, duk_push_heapptr Binding: duk_put_global_string(cx, "eb$frameElement"); static duk_ret_t nat_unframe2(duk_context * cx) Commentary: I am not sure what this does Calls needed: duk_is_object, duk_get_heapptr, duk_pop Binding: duk_put_global_string(cx, "eb$unframe2"); static Frame *win2frame(duk_context * cx) Commentary: our frames code Calls needed: duk_push_this, duk_get_heapptr, duk_pop static Frame *doc2frame(duk_context * cx) Commentary: used by document.write to put the html in the correct frame Calls needed: duk_push_this, duk_get_heapptr, duk_pop static void docWrap(duk_context *cx, const char *fn) Commentary: I am not sure what this does. The thing being wrapped is protected, from GC? Or something else? Answer TBD Calls needed: duk_get_top, duk_push_this, duk_get_prop_string, duk_insert, duk_pcall_method, duk_push_undefined static duk_ret_t getter_cw(duk_context * cx) Commentary: this function is both a component of one of the crucial design questions and *does* contain duk calls. So I would file it wth the moderate or difficult, not the simple Calls needed: duk_get_heapptr, duk_pop, duk_push_null Binding: duk_put_global_string(cx, "eb$getter_cw"); static duk_ret_t getter_cd(duk_context * cx) Commentary: contentDocument getter setter; this is a bit complicated - file with the crucial designs Calls needed: duk_push_this, duk_get_heapptr, duk_pop, duk_push_null Binding: duk_put_global_string(cx, "eb$getter_cd"); static void createJSContext_0(Frame *f) Commentary: file with the large and complex. Fundamental design problems and it has tons of duk calls Calls needed: duk_def_prop, duk_get_context, duk_get_heapptr, duk_pop, duk_push_c_function, duk_push_global_object, duk_push_heapptr, duk_push_number, duk_push_object, duk_push_string, duk_push_thread_new_globalenv, duk_put_global_string static duk_ret_t nat_unframe(duk_context * cx) Commentary: file with the most involved. This is part of our frames handling and intersects the duk API Calls needed: duk_is_object, duk_get_heapptr, duk_pop Binding: duk_put_global_string(cx, "eb$unframe");