Browse Source

Merge pull request #1897 from svaarala/ecmascript-spelling-examples-extras

Use 'ECMAScript' spelling in extras/ and examples/
pull/1898/head
Sami Vaarala 7 years ago
committed by GitHub
parent
commit
a9bda68c72
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      examples/cmdline/README.rst
  2. 6
      examples/eventloop/README.rst
  3. 4
      examples/eventloop/c_eventloop.c
  4. 2
      examples/eventloop/c_eventloop.js
  5. 2
      examples/eventloop/ecma_eventloop.js
  6. 6
      examples/eventloop/main.c
  7. 8
      examples/guide/prime.js
  8. 6
      extras/cbor/README.rst
  9. 2
      extras/cbor/jsoncbor.c
  10. 4
      extras/module-duktape/duk_module_duktape.c
  11. 2
      extras/module-node/README.rst

2
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.

6
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``.)

4
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

2
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

2
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

6
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] <filename>\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 <filename> is '-', the entire STDIN executed.\n");
fflush(stderr);

8
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); }
}

6
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

2
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);
}

4
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

2
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``::

Loading…
Cancel
Save