From 7a9a07b26b3d92c1ed4d37f55f4f2235e5602a19 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sat, 28 Apr 2018 13:27:04 +0300 Subject: [PATCH 1/2] Use 'Ecmascript' spelling in examples/ --- examples/cmdline/README.rst | 2 +- examples/eventloop/README.rst | 6 +++--- examples/eventloop/c_eventloop.c | 4 ++-- examples/eventloop/c_eventloop.js | 2 +- examples/eventloop/ecma_eventloop.js | 2 +- examples/eventloop/main.c | 6 +++--- examples/guide/prime.js | 8 ++++---- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/cmdline/README.rst b/examples/cmdline/README.rst index e0c6bceb..825eec91 100644 --- a/examples/cmdline/README.rst +++ b/examples/cmdline/README.rst @@ -2,5 +2,5 @@ Duktape command line ==================== -Ecmascript command line execution tool, useful for running Ecmascript code +ECMAScript command line execution tool, useful for running ECMAScript code from a file, stdin, or interactively. Also used by automatic testing. diff --git a/examples/eventloop/README.rst b/examples/eventloop/README.rst index 5b1b1477..4927afa5 100644 --- a/examples/eventloop/README.rst +++ b/examples/eventloop/README.rst @@ -12,7 +12,7 @@ built otherwise). To test (Linux only, perhaps other Unix):: $ make - $ ./evloop curses-timers.js # run with Ecmascript eventloop + $ ./evloop curses-timers.js # run with ECMAScript eventloop $ ./evloop -c curses-timers.js # run with C eventloop Implementation approaches @@ -25,8 +25,8 @@ two main approaches: like timers, sockets, etc, is held in C structures. (See ``c_eventloop.c`` and ``c_eventloop.js``.) -2. Using an Ecmascript eventloop which never returns. All the event loop state - can be managed with Ecmascript code instead of C structures. The Ecmascript +2. Using an ECMAScript eventloop which never returns. All the event loop state + can be managed with ECMAScript code instead of C structures. The ECMAScript eventloop calls a Duktape/C helper to do the lowest level poll() call. (See ``ecma_eventloop.js``.) diff --git a/examples/eventloop/c_eventloop.c b/examples/eventloop/c_eventloop.c index 481a229c..24cebbb2 100644 --- a/examples/eventloop/c_eventloop.c +++ b/examples/eventloop/c_eventloop.c @@ -272,7 +272,7 @@ duk_ret_t eventloop_run(duk_context *ctx, void *udata) { (void) udata; - /* The Ecmascript poll handler is passed through EventLoop.fdPollHandler + /* The ECMAScript poll handler is passed through EventLoop.fdPollHandler * which c_eventloop.js sets before we come here. */ duk_push_global_object(ctx); @@ -356,7 +356,7 @@ duk_ret_t eventloop_run(duk_context *ctx, void *udata) { /* * Check socket activity, handle all sockets. Handling is offloaded to - * Ecmascript code (fd + revents). + * ECMAScript code (fd + revents). * * If FDs are removed from the poll list while we're processing callbacks, * the entries are simply marked unused (fd set to 0) without actually diff --git a/examples/eventloop/c_eventloop.js b/examples/eventloop/c_eventloop.js index 6a79f042..3001c7e2 100644 --- a/examples/eventloop/c_eventloop.js +++ b/examples/eventloop/c_eventloop.js @@ -1,7 +1,7 @@ /* * C eventloop example (c_eventloop.c). * - * Ecmascript code to initialize the exposed API (setTimeout() etc) when + * ECMAScript code to initialize the exposed API (setTimeout() etc) when * using the C eventloop. * * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Timers diff --git a/examples/eventloop/ecma_eventloop.js b/examples/eventloop/ecma_eventloop.js index 4f195581..6ef91e4a 100644 --- a/examples/eventloop/ecma_eventloop.js +++ b/examples/eventloop/ecma_eventloop.js @@ -1,5 +1,5 @@ /* - * Pure Ecmascript eventloop example. + * Pure ECMAScript eventloop example. * * Timer state handling is inefficient in this trivial example. Timers are * kept in an array sorted by their expiry time which works well for expiring diff --git a/examples/eventloop/main.c b/examples/eventloop/main.c index f9270a12..933992ce 100644 --- a/examples/eventloop/main.c +++ b/examples/eventloop/main.c @@ -229,14 +229,14 @@ int main(int argc, char *argv[]) { fileio_register(ctx); if (c_evloop) { - fprintf(stderr, "Using C based eventloop (omit -c to use Ecmascript based eventloop)\n"); + fprintf(stderr, "Using C based eventloop (omit -c to use ECMAScript based eventloop)\n"); fflush(stderr); eventloop_register(ctx); fileio_push_file_string(ctx, "c_eventloop.js"); duk_eval(ctx); } else { - fprintf(stderr, "Using Ecmascript based eventloop (give -c to use C based eventloop)\n"); + fprintf(stderr, "Using ECMAScript based eventloop (give -c to use C based eventloop)\n"); fflush(stderr); fileio_push_file_string(ctx, "ecma_eventloop.js"); @@ -268,7 +268,7 @@ int main(int argc, char *argv[]) { usage: fprintf(stderr, "Usage: evloop [-c] \n"); fprintf(stderr, "\n"); - fprintf(stderr, "Uses an Ecmascript based eventloop (ecma_eventloop.js) by default.\n"); + fprintf(stderr, "Uses an ECMAScript based eventloop (ecma_eventloop.js) by default.\n"); fprintf(stderr, "If -c option given, uses a C based eventloop (c_eventloop.{c,js}).\n"); fprintf(stderr, "If is '-', the entire STDIN executed.\n"); fflush(stderr); diff --git a/examples/guide/prime.js b/examples/guide/prime.js index 8959754f..df97d504 100644 --- a/examples/guide/prime.js +++ b/examples/guide/prime.js @@ -1,7 +1,7 @@ // prime.js -// Pure Ecmascript version of low level helper -function primeCheckEcmascript(val, limit) { +// Pure ECMAScript version of low level helper +function primeCheckECMAScript(val, limit) { for (var i = 2; i <= limit; i++) { if ((val % i) == 0) { return false; } } @@ -9,7 +9,7 @@ function primeCheckEcmascript(val, limit) { } // Select available helper at load time -var primeCheckHelper = (this.primeCheckNative || primeCheckEcmascript); +var primeCheckHelper = (this.primeCheckNative || primeCheckECMAScript); // Check 'val' for primality function primeCheck(val) { @@ -23,7 +23,7 @@ function primeCheck(val) { function primeTest() { var res = []; - print('Have native helper: ' + (primeCheckHelper !== primeCheckEcmascript)); + print('Have native helper: ' + (primeCheckHelper !== primeCheckECMAScript)); for (var i = 1; i < 1000000; i++) { if (primeCheck(i) && (i % 10000) == 9999) { res.push(i); } } From f25225d765338e10d09abdb308a8fb6ce46b5a51 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sat, 28 Apr 2018 13:27:59 +0300 Subject: [PATCH 2/2] Use 'ECMAScript' spelling in extras/ --- extras/cbor/README.rst | 6 +++--- extras/cbor/jsoncbor.c | 2 +- extras/module-duktape/duk_module_duktape.c | 4 ++-- extras/module-node/README.rst | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/cbor/README.rst b/extras/cbor/README.rst index 2e7af221..50a3317f 100644 --- a/extras/cbor/README.rst +++ b/extras/cbor/README.rst @@ -14,7 +14,7 @@ To integrate CBOR into your application: is enough. * Call ``duk_cbor_init()`` to register a global ``CBOR`` object with - Ecmascript bindings ``CBOR.encode()`` and ``CBOR.decode()``, roughly + ECMAScript bindings ``CBOR.encode()`` and ``CBOR.decode()``, roughly matching https://github.com/paroga/cbor-js. Basic usage of the ``jsoncbor`` conversion tool:: @@ -24,7 +24,7 @@ Basic usage of the ``jsoncbor`` conversion tool:: $ cat test.json | ./jsoncbor -e # writes CBOR to stdout $ cat test.cbor | ./jsoncbor -d # writes JSON to stdout -CBOR objects are decoded into Ecmascript objects, with non-string keys +CBOR objects are decoded into ECMAScript objects, with non-string keys coerced into strings. Direct support for CBOR is likely to be included in the Duktape API in the @@ -45,7 +45,7 @@ Some CBOR shortcomings for preserving information: - Array objects with properties lose their non-index properties. - Array objects with gaps lose their gaps as they read back as undefined. - Buffer objects and views lose much of their detail besides the raw data. -- Ecmascript strings cannot be fully represented; strings must be UTF-8. +- ECMAScript strings cannot be fully represented; strings must be UTF-8. - Functions and native objects lose most of their detail. - CBOR tags are useful to provide soft decoding information, but the tags are just integers from an IANA controlled space with no space for custom diff --git a/extras/cbor/jsoncbor.c b/extras/cbor/jsoncbor.c index f954ac11..e31cf50c 100644 --- a/extras/cbor/jsoncbor.c +++ b/extras/cbor/jsoncbor.c @@ -51,7 +51,7 @@ static void usage_and_exit(void) { "\n" " Input is read from stdin, output is written to stdout.\n" " 'jx' is a Duktape custom JSON extension.\n" - " 'js' means evaluate input as an Ecmascript expression.\n"); + " 'js' means evaluate input as an ECMAScript expression.\n"); exit(1); } diff --git a/extras/module-duktape/duk_module_duktape.c b/extras/module-duktape/duk_module_duktape.c index e2616ba1..2b9ff08d 100644 --- a/extras/module-duktape/duk_module_duktape.c +++ b/extras/module-duktape/duk_module_duktape.c @@ -263,7 +263,7 @@ static duk_ret_t duk__require(duk_context *ctx) { * done with Object.defineProperty(). * * XXX: require.id could also be just made non-configurable, as there - * is no practical reason to touch it (at least from Ecmascript code). + * is no practical reason to touch it (at least from ECMAScript code). */ duk_push_c_function(ctx, duk__require, 1 /*nargs*/); duk_push_string(ctx, "name"); @@ -307,7 +307,7 @@ static duk_ret_t duk__require(duk_context *ctx) { * Call user provided module search function and build the wrapped * module source code (if necessary). The module search function * can be used to implement pure Ecmacsript, pure C, and mixed - * Ecmascript/C modules. + * ECMAScript/C modules. * * The module search function can operate on the exports table directly * (e.g. DLL code can register values to it). It can also return a diff --git a/extras/module-node/README.rst b/extras/module-node/README.rst index d7f4dd64..a260161b 100644 --- a/extras/module-node/README.rst +++ b/extras/module-node/README.rst @@ -63,7 +63,7 @@ The application needs only to provide the module resolution and loading logic: when the global ``require()`` is called, the parent ID is an empty string. * The load callback is a Duktape/C function which takes the resolved module ID - and: (1) returns the Ecmascript source code for the module or ``undefined`` + and: (1) returns the ECMAScript source code for the module or ``undefined`` if there's no source code, e.g. for pure C modules, (2) can populate ``module.exports`` itself, and (3) can replace ``module.exports``::