You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Format and cleanup site/source/docs/api_reference/advanced-apis.rst. NFC (#16523)
- Use hyperlinks in footnotes to make the source easier to read
- Reformat at 80 columns
- Remove redundant/out-of-date note about "The small number of options
that developers may have cause to change" (this is covered above
and also not so true anymore since we have settings_internal)
Copy file name to clipboardExpand all lines: site/source/docs/api_reference/advanced-apis.rst
+32-17
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,10 @@
4
4
Advanced APIs
5
5
=============
6
6
7
-
This section lists APIs that are not suitable for general use, but which may be useful to developers in some circumstances. These include APIs that are difficult or complicated to use, or which are intended primarily for developers working on the Emscripten core.
7
+
This section lists APIs that are not suitable for general use, but which may be
8
+
useful to developers in some circumstances. These include APIs that are
9
+
difficult or complicated to use, or which are intended primarily for developers
10
+
working on the Emscripten core.
8
11
9
12
.. contents:: Table of Contents
10
13
:local:
@@ -14,42 +17,51 @@ This section lists APIs that are not suitable for general use, but which may be
14
17
.. _settings-js:
15
18
16
19
settings.js
17
-
============
18
-
19
-
`settings.js <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_ contains default values and options used in various places by the compiler.
20
+
===========
20
21
21
-
.. Warning :: Many **settings.js** options are highly brittle - certain combinations of options, and combinations of certain options used with some source code, can cause Emscripten to fail badly. This is intended for use by "advanced users", and possibly even only people developing Emscripten itself.
22
+
`settings.js`_ contains default values and options used in various places by the
23
+
compiler.
22
24
25
+
.. Warning:: Many **settings.js** options are highly brittle - certain
26
+
combinations of options, and combinations of certain options used with some
27
+
source code, can cause Emscripten to fail badly. This is intended for use by
28
+
"advanced users", and possibly even only people developing Emscripten itself.
23
29
24
-
The options in **settings.js** are normally set as command line parameters to *emcc*: ::
30
+
The options in **settings.js** are normally set as command line parameters to
31
+
*emcc*::
25
32
26
33
emcc -s OPT=VALUE
27
34
28
-
29
-
While it is possible to edit **settings.js** manually, this is *highly discouraged*. In general **settings.js** defines low-level options that should not be modified. Note also that the compiler changes some options depending on other settings. For example, ``ASSERTIONS`` is enabled by default, but disabled in optimized builds (``-O1+``).
30
-
31
-
The small number of options that developers may have cause to change should be modified when the *emcc* tool is invoked. For example, ``EXPORTED_FUNCTIONS``: ::
While it is possible to edit **settings.js** manually, this is *highly
36
+
discouraged*. In general **settings.js** defines low-level options that should
37
+
not be modified. Note also that the compiler changes some options depending on
38
+
other settings. For example, ``ASSERTIONS`` is enabled by default, but disabled
39
+
in optimized builds (``-O1+``).
35
40
36
41
preamble.js
37
42
===========
38
43
39
-
The following advanced APIs are documented in `preamble.js<https://github.com/emscripten-core/emscripten/blob/main/src/preamble.js>`_.
44
+
The following advanced APIs are documented in `preamble.js`_.
40
45
41
46
.. js:function::allocate(slab, allocator)
42
47
43
-
This is marked as *internal* because it is difficult to use (it has been optimized for multiple syntaxes to save space in generated code). Normally developers should instead allocate memory using ``_malloc()``, initialize it with :js:func:`setValue`, etc., but this function may be useful for advanced developers in certain cases.
48
+
This is marked as *internal* because it is difficult to use (it has been
49
+
optimized for multiple syntaxes to save space in generated code). Normally
50
+
developers should instead allocate memory using ``_malloc()``, initialize it
51
+
with :js:func:`setValue`, etc., but this function may be useful for advanced
52
+
developers in certain cases.
44
53
45
-
:param slab: An array of data, or a number. If a number, then the size of the block to allocate, in *bytes*.
54
+
:param slab: An array of data, or a number. If a number, then the size of the
55
+
block to allocate, in *bytes*.
46
56
:param allocator: How to allocate memory, see ALLOC_*
47
57
48
58
49
59
Advanced File System API
50
60
========================
51
61
52
-
:ref:`Filesystem-API` covers the public API that will be relevant to most developers. The following functions are only needed for advanced use-cases (for example, writing a new local file system) or legacy file system compatibility.
62
+
:ref:`Filesystem-API` covers the public API that will be relevant to most
63
+
developers. The following functions are only needed for advanced use-cases (for
64
+
example, writing a new local file system) or legacy file system compatibility.
53
65
54
66
.. js:function::
55
67
FS.hashName(parentid, name)
@@ -106,3 +118,6 @@ There are also a small number of additional :ref:`flag modes <fs-read-and-write-
0 commit comments