diff options
| author | Philipp Stephani | 2019-12-23 17:12:56 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2019-12-23 17:16:10 +0100 |
| commit | 94fa7ceb480632fec7dda6d41f63223e4127bd83 (patch) | |
| tree | 7ac195f5d9bc1c347ba4841c396727c2954a3928 /doc | |
| parent | 64fe67beff937fe6279f073dcfe28b15a2a811f9 (diff) | |
| download | emacs-94fa7ceb480632fec7dda6d41f63223e4127bd83.tar.gz emacs-94fa7ceb480632fec7dda6d41f63223e4127bd83.zip | |
Make argument names in module interface more consistent.
Previously, the names of arguments and other details were needlessly
inconsistent between the documentation, the declarations, and the
definitions, as well as between each other. This commit makes them
more consistent, in most cases by applying the names from the
documentation everywhere.
* src/module-env-27.h:
* src/module-env-25.h:
* src/emacs-module.h.in:
* src/emacs-module.c (module_get_environment)
(module_make_global_ref, module_free_global_ref)
(module_non_local_exit_get, module_non_local_exit_signal)
(module_make_function, module_funcall, module_type_of)
(module_is_not_nil, module_extract_integer)
(module_extract_float, module_copy_string_contents)
(module_make_string, module_vec_set, module_vec_get)
(module_vec_size, module_extract_time)
(module_assert_runtime):
* doc/lispref/internals.texi (Module Initialization)
(Module Functions, Module Values): Make argument names and some other
details consistent. No functional changes.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/internals.texi | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index bccdca65e4e..da98283be80 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -1228,9 +1228,9 @@ the @var{runtime} structure with the value compiled into the module: | |||
| 1228 | 1228 | ||
| 1229 | @example | 1229 | @example |
| 1230 | int | 1230 | int |
| 1231 | emacs_module_init (struct emacs_runtime *ert) | 1231 | emacs_module_init (struct emacs_runtime *runtime) |
| 1232 | @{ | 1232 | @{ |
| 1233 | if (ert->size < sizeof (*ert)) | 1233 | if (ert->size < sizeof (*runtime)) |
| 1234 | return 1; | 1234 | return 1; |
| 1235 | @} | 1235 | @} |
| 1236 | @end example | 1236 | @end example |
| @@ -1247,7 +1247,7 @@ assumes it is part of the @code{emacs_module_init} function shown | |||
| 1247 | above: | 1247 | above: |
| 1248 | 1248 | ||
| 1249 | @example | 1249 | @example |
| 1250 | emacs_env *env = ert->get_environment (ert); | 1250 | emacs_env *env = ert->get_environment (runtime); |
| 1251 | if (env->size < sizeof (*env)) | 1251 | if (env->size < sizeof (*env)) |
| 1252 | return 2; | 1252 | return 2; |
| 1253 | @end example | 1253 | @end example |
| @@ -1264,7 +1264,7 @@ Emacs, by comparing the size of the environment passed by Emacs with | |||
| 1264 | known sizes, like this: | 1264 | known sizes, like this: |
| 1265 | 1265 | ||
| 1266 | @example | 1266 | @example |
| 1267 | emacs_env *env = ert->get_environment (ert); | 1267 | emacs_env *env = ert->get_environment (runtime); |
| 1268 | if (env->size >= sizeof (struct emacs_env_26)) | 1268 | if (env->size >= sizeof (struct emacs_env_26)) |
| 1269 | emacs_version = 26; /* Emacs 26 or later. */ | 1269 | emacs_version = 26; /* Emacs 26 or later. */ |
| 1270 | else if (env->size >= sizeof (struct emacs_env_25)) | 1270 | else if (env->size >= sizeof (struct emacs_env_25)) |
| @@ -1388,7 +1388,7 @@ Combining the above steps, code that arranges for a C function | |||
| 1388 | look like this, as part of the module initialization function: | 1388 | look like this, as part of the module initialization function: |
| 1389 | 1389 | ||
| 1390 | @example | 1390 | @example |
| 1391 | emacs_env *env = ert->get_environment (ert); | 1391 | emacs_env *env = ert->get_environment (runtime); |
| 1392 | emacs_value func = env->make_function (env, min_arity, max_arity, | 1392 | emacs_value func = env->make_function (env, min_arity, max_arity, |
| 1393 | module_func, docstring, data); | 1393 | module_func, docstring, data); |
| 1394 | emacs_value symbol = env->intern (env, "module-func"); | 1394 | emacs_value symbol = env->intern (env, "module-func"); |
| @@ -1525,12 +1525,11 @@ This function returns the value of a Lisp float specified by | |||
| 1525 | @var{arg}, as a C @code{double} value. | 1525 | @var{arg}, as a C @code{double} value. |
| 1526 | @end deftypefn | 1526 | @end deftypefn |
| 1527 | 1527 | ||
| 1528 | @deftypefn Function struct timespec extract_time (emacs_env *@var{env}, emacs_value @var{time}) | 1528 | @deftypefn Function struct timespec extract_time (emacs_env *@var{env}, emacs_value @var{arg}) |
| 1529 | This function, which is available since Emacs 27, interprets | 1529 | This function, which is available since Emacs 27, interprets @var{arg} |
| 1530 | @var{time} as an Emacs Lisp time value and returns the corresponding | 1530 | as an Emacs Lisp time value and returns the corresponding @code{struct |
| 1531 | @code{struct timespec}. @xref{Time of Day}. @code{struct timespec} | 1531 | timespec}. @xref{Time of Day}. @code{struct timespec} represents a |
| 1532 | represents a timestamp with nanosecond precision. It has the | 1532 | timestamp with nanosecond precision. It has the following members: |
| 1533 | following members: | ||
| 1534 | 1533 | ||
| 1535 | @table @code | 1534 | @table @code |
| 1536 | @item time_t tv_sec | 1535 | @item time_t tv_sec |
| @@ -1728,9 +1727,9 @@ next_prime (emacs_env *env, ptrdiff_t nargs, emacs_value *args, | |||
| 1728 | @} | 1727 | @} |
| 1729 | 1728 | ||
| 1730 | int | 1729 | int |
| 1731 | emacs_module_init (struct emacs_runtime *ert) | 1730 | emacs_module_init (struct emacs_runtime *runtime) |
| 1732 | @{ | 1731 | @{ |
| 1733 | emacs_env *env = ert->get_environment (ert); | 1732 | emacs_env *env = ert->get_environment (runtime); |
| 1734 | emacs_value symbol = env->intern (env, "next-prime"); | 1733 | emacs_value symbol = env->intern (env, "next-prime"); |
| 1735 | emacs_value func | 1734 | emacs_value func |
| 1736 | = env->make_function (env, 1, 1, next_prime, NULL, NULL); | 1735 | = env->make_function (env, 1, 1, next_prime, NULL, NULL); |
| @@ -1757,16 +1756,15 @@ there's no requirement that @var{time} be normalized. This means that | |||
| 1757 | @code{@var{time}.tv_nsec} can be negative or larger than 999,999,999. | 1756 | @code{@var{time}.tv_nsec} can be negative or larger than 999,999,999. |
| 1758 | @end deftypefn | 1757 | @end deftypefn |
| 1759 | 1758 | ||
| 1760 | @deftypefn Function emacs_value make_string (emacs_env *@var{env}, const char *@var{str}, ptrdiff_t @var{strlen}) | 1759 | @deftypefn Function emacs_value make_string (emacs_env *@var{env}, const char *@var{str}, ptrdiff_t @var{len}) |
| 1761 | This function creates an Emacs string from C text string pointed by | 1760 | This function creates an Emacs string from C text string pointed by |
| 1762 | @var{str} whose length in bytes, not including the terminating null | 1761 | @var{str} whose length in bytes, not including the terminating null |
| 1763 | byte, is @var{strlen}. The original string in @var{str} can be either | 1762 | byte, is @var{len}. The original string in @var{str} can be either an |
| 1764 | an @acronym{ASCII} string or a UTF-8 encoded non-@acronym{ASCII} | 1763 | @acronym{ASCII} string or a UTF-8 encoded non-@acronym{ASCII} string; |
| 1765 | string; it can include embedded null bytes, and doesn't have to end in | 1764 | it can include embedded null bytes, and doesn't have to end in a |
| 1766 | a terminating null byte at @code{@var{str}[@var{strlen}]}. The | 1765 | terminating null byte at @code{@var{str}[@var{len}]}. The function |
| 1767 | function raises the @code{overflow-error} error condition if | 1766 | raises the @code{overflow-error} error condition if @var{len} is |
| 1768 | @var{strlen} is negative or exceeds the maximum length of an Emacs | 1767 | negative or exceeds the maximum length of an Emacs string. |
| 1769 | string. | ||
| 1770 | @end deftypefn | 1768 | @end deftypefn |
| 1771 | 1769 | ||
| 1772 | The @acronym{API} does not provide functions to manipulate Lisp data | 1770 | The @acronym{API} does not provide functions to manipulate Lisp data |
| @@ -1823,25 +1821,27 @@ garbage-collected. Don't run any expensive code in a finalizer, | |||
| 1823 | because GC must finish quickly to keep Emacs responsive. | 1821 | because GC must finish quickly to keep Emacs responsive. |
| 1824 | @end deftypefn | 1822 | @end deftypefn |
| 1825 | 1823 | ||
| 1826 | @deftypefn Function void *get_user_ptr (emacs_env *@var{env}, emacs_value val) | 1824 | @deftypefn Function void *get_user_ptr (emacs_env *@var{env}, emacs_value @var{arg}) |
| 1827 | This function extracts the C pointer from the Lisp object represented | 1825 | This function extracts the C pointer from the Lisp object represented |
| 1828 | by @var{val}. | 1826 | by @var{arg}. |
| 1829 | @end deftypefn | 1827 | @end deftypefn |
| 1830 | 1828 | ||
| 1831 | @deftypefn Function void set_user_ptr (emacs_env *@var{env}, emacs_value @var{value}, void *@var{ptr}) | 1829 | @deftypefn Function void set_user_ptr (emacs_env *@var{env}, emacs_value @var{arg}, void *@var{ptr}) |
| 1832 | This function sets the C pointer embedded in the @code{user-ptr} | 1830 | This function sets the C pointer embedded in the @code{user-ptr} |
| 1833 | object represented by @var{value} to @var{ptr}. | 1831 | object represented by @var{arg} to @var{ptr}. |
| 1834 | @end deftypefn | 1832 | @end deftypefn |
| 1835 | 1833 | ||
| 1836 | @deftypefn Function emacs_finalizer get_user_finalizer (emacs_env *@var{env}, emacs_value val) | 1834 | @deftypefn Function emacs_finalizer get_user_finalizer (emacs_env *@var{env}, emacs_value @var{arg}) |
| 1837 | This function returns the finalizer of the @code{user-ptr} object | 1835 | This function returns the finalizer of the @code{user-ptr} object |
| 1838 | represented by @var{val}, or @code{NULL} if it doesn't have a finalizer. | 1836 | represented by @var{arg}, or @code{NULL} if it doesn't have a |
| 1837 | finalizer. | ||
| 1839 | @end deftypefn | 1838 | @end deftypefn |
| 1840 | 1839 | ||
| 1841 | @deftypefn Function void set_user_finalizer (emacs_env *@var{env}, emacs_value @var{val}, emacs_finalizer @var{fin}) | 1840 | @deftypefn Function void set_user_finalizer (emacs_env *@var{env}, emacs_value @var{arg}, emacs_finalizer @var{fin}) |
| 1842 | This function changes the finalizer of the @code{user-ptr} object | 1841 | This function changes the finalizer of the @code{user-ptr} object |
| 1843 | represented by @var{val} to be @var{fin}. If @var{fin} is a | 1842 | represented by @var{arg} to be @var{fin}. If @var{fin} is a |
| 1844 | @code{NULL} pointer, the @code{user-ptr} object will have no finalizer. | 1843 | @code{NULL} pointer, the @code{user-ptr} object will have no |
| 1844 | finalizer. | ||
| 1845 | @end deftypefn | 1845 | @end deftypefn |
| 1846 | 1846 | ||
| 1847 | @node Module Misc | 1847 | @node Module Misc |
| @@ -1854,20 +1854,20 @@ be called via the @code{emacs_env} pointer. Description of functions | |||
| 1854 | that were introduced after Emacs 25 calls out the first version where | 1854 | that were introduced after Emacs 25 calls out the first version where |
| 1855 | they became available. | 1855 | they became available. |
| 1856 | 1856 | ||
| 1857 | @deftypefn Function bool eq (emacs_env *@var{env}, emacs_value @var{val1}, emacs_value @var{val2}) | 1857 | @deftypefn Function bool eq (emacs_env *@var{env}, emacs_value @var{a}, emacs_value @var{b}) |
| 1858 | This function returns @code{true} if the Lisp objects represented by | 1858 | This function returns @code{true} if the Lisp objects represented by |
| 1859 | @var{val1} and @var{val2} are identical, @code{false} otherwise. This | 1859 | @var{a} and @var{b} are identical, @code{false} otherwise. This is |
| 1860 | is the same as the Lisp function @code{eq} (@pxref{Equality | 1860 | the same as the Lisp function @code{eq} (@pxref{Equality Predicates}), |
| 1861 | Predicates}), but avoids the need to intern the objects represented by | 1861 | but avoids the need to intern the objects represented by the |
| 1862 | the arguments. | 1862 | arguments. |
| 1863 | 1863 | ||
| 1864 | There are no @acronym{API} functions for other equality predicates, so | 1864 | There are no @acronym{API} functions for other equality predicates, so |
| 1865 | you will need to use @code{intern} and @code{funcall}, described | 1865 | you will need to use @code{intern} and @code{funcall}, described |
| 1866 | below, to perform more complex equality tests. | 1866 | below, to perform more complex equality tests. |
| 1867 | @end deftypefn | 1867 | @end deftypefn |
| 1868 | 1868 | ||
| 1869 | @deftypefn Function bool is_not_nil (emacs_env *@var{env}, emacs_value @var{val}) | 1869 | @deftypefn Function bool is_not_nil (emacs_env *@var{env}, emacs_value @var{arg}) |
| 1870 | This function tests whether the Lisp object represented by @var{val} | 1870 | This function tests whether the Lisp object represented by @var{arg} |
| 1871 | is non-@code{nil}; it returns @code{true} or @code{false} accordingly. | 1871 | is non-@code{nil}; it returns @code{true} or @code{false} accordingly. |
| 1872 | 1872 | ||
| 1873 | Note that you could implement an equivalent test by using | 1873 | Note that you could implement an equivalent test by using |
| @@ -1876,12 +1876,12 @@ then use @code{eq}, described above, to test for equality. But using | |||
| 1876 | this function is more convenient. | 1876 | this function is more convenient. |
| 1877 | @end deftypefn | 1877 | @end deftypefn |
| 1878 | 1878 | ||
| 1879 | @deftypefn Function emacs_value type_of (emacs_env *@var{env}, emacs_value @code{object}) | 1879 | @deftypefn Function emacs_value type_of (emacs_env *@var{env}, emacs_value @code{arg}) |
| 1880 | This function returns the type of @var{object} as a value that | 1880 | This function returns the type of @var{arg} as a value that represents |
| 1881 | represents a symbol: @code{string} for a string, @code{integer} for an | 1881 | a symbol: @code{string} for a string, @code{integer} for an integer, |
| 1882 | integer, @code{process} for a process, etc. @xref{Type Predicates}. | 1882 | @code{process} for a process, etc. @xref{Type Predicates}. You can |
| 1883 | You can use @code{intern} and @code{eq} to compare against known type | 1883 | use @code{intern} and @code{eq} to compare against known type symbols, |
| 1884 | symbols, if your code needs to depend on the object type. | 1884 | if your code needs to depend on the object type. |
| 1885 | @end deftypefn | 1885 | @end deftypefn |
| 1886 | 1886 | ||
| 1887 | @anchor{intern} | 1887 | @anchor{intern} |
| @@ -2055,11 +2055,12 @@ One use of this function is when you want to re-throw a non-local exit | |||
| 2055 | from one of the called @acronym{API} or Lisp functions. | 2055 | from one of the called @acronym{API} or Lisp functions. |
| 2056 | @end deftypefn | 2056 | @end deftypefn |
| 2057 | 2057 | ||
| 2058 | @deftypefn Function void non_local_exit_signal (emacs_env *@var{env}, emacs_value @var{error}, emacs_value @var{data}) | 2058 | @deftypefn Function void non_local_exit_signal (emacs_env *@var{env}, emacs_value @var{symbol}, emacs_value @var{data}) |
| 2059 | This function signals the error represented by @var{error} with the | 2059 | This function signals the error represented by the error symbol |
| 2060 | specified error data @var{data}. The module function should return | 2060 | @var{symbol} with the specified error data @var{data}. The module |
| 2061 | soon after calling this function. This function could be useful, | 2061 | function should return soon after calling this function. This |
| 2062 | e.g., for signaling errors from module functions to Emacs. | 2062 | function could be useful, e.g., for signaling errors from module |
| 2063 | functions to Emacs. | ||
| 2063 | @end deftypefn | 2064 | @end deftypefn |
| 2064 | 2065 | ||
| 2065 | 2066 | ||