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 | |
| 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.
| -rw-r--r-- | doc/lispref/internals.texi | 97 | ||||
| -rw-r--r-- | src/emacs-module.c | 146 | ||||
| -rw-r--r-- | src/emacs-module.h.in | 4 | ||||
| -rw-r--r-- | src/module-env-25.h | 67 | ||||
| -rw-r--r-- | src/module-env-27.h | 2 |
5 files changed, 155 insertions, 161 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 | ||
diff --git a/src/emacs-module.c b/src/emacs-module.c index f2e3f627756..ff1a05450ce 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -126,7 +126,7 @@ typedef int (*emacs_init_function) (struct emacs_runtime *); | |||
| 126 | should not throw C++ exceptions, so emacs-module.h declares the | 126 | should not throw C++ exceptions, so emacs-module.h declares the |
| 127 | corresponding interfaces with EMACS_NOEXCEPT. There is only C code | 127 | corresponding interfaces with EMACS_NOEXCEPT. There is only C code |
| 128 | in this module, though, so this constraint is not enforced here. */ | 128 | in this module, though, so this constraint is not enforced here. */ |
| 129 | typedef void (*emacs_finalizer_function) (void *); | 129 | typedef void (*emacs_finalizer) (void *); |
| 130 | 130 | ||
| 131 | 131 | ||
| 132 | /* Memory management. */ | 132 | /* Memory management. */ |
| @@ -343,11 +343,11 @@ CHECK_USER_PTR (Lisp_Object obj) | |||
| 343 | the Emacs main thread. */ | 343 | the Emacs main thread. */ |
| 344 | 344 | ||
| 345 | static emacs_env * | 345 | static emacs_env * |
| 346 | module_get_environment (struct emacs_runtime *ert) | 346 | module_get_environment (struct emacs_runtime *runtime) |
| 347 | { | 347 | { |
| 348 | module_assert_thread (); | 348 | module_assert_thread (); |
| 349 | module_assert_runtime (ert); | 349 | module_assert_runtime (runtime); |
| 350 | return ert->private_members->env; | 350 | return runtime->private_members->env; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | /* To make global refs (GC-protected global values) keep a hash that | 353 | /* To make global refs (GC-protected global values) keep a hash that |
| @@ -356,11 +356,11 @@ module_get_environment (struct emacs_runtime *ert) | |||
| 356 | static Lisp_Object Vmodule_refs_hash; | 356 | static Lisp_Object Vmodule_refs_hash; |
| 357 | 357 | ||
| 358 | static emacs_value | 358 | static emacs_value |
| 359 | module_make_global_ref (emacs_env *env, emacs_value ref) | 359 | module_make_global_ref (emacs_env *env, emacs_value value) |
| 360 | { | 360 | { |
| 361 | MODULE_FUNCTION_BEGIN (NULL); | 361 | MODULE_FUNCTION_BEGIN (NULL); |
| 362 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); | 362 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); |
| 363 | Lisp_Object new_obj = value_to_lisp (ref), hashcode; | 363 | Lisp_Object new_obj = value_to_lisp (value), hashcode; |
| 364 | ptrdiff_t i = hash_lookup (h, new_obj, &hashcode); | 364 | ptrdiff_t i = hash_lookup (h, new_obj, &hashcode); |
| 365 | 365 | ||
| 366 | if (i >= 0) | 366 | if (i >= 0) |
| @@ -381,14 +381,14 @@ module_make_global_ref (emacs_env *env, emacs_value ref) | |||
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | static void | 383 | static void |
| 384 | module_free_global_ref (emacs_env *env, emacs_value ref) | 384 | module_free_global_ref (emacs_env *env, emacs_value global_value) |
| 385 | { | 385 | { |
| 386 | /* TODO: This probably never signals. */ | 386 | /* TODO: This probably never signals. */ |
| 387 | /* FIXME: Wait a minute. Shouldn't this function report an error if | 387 | /* FIXME: Wait a minute. Shouldn't this function report an error if |
| 388 | the hash lookup fails? */ | 388 | the hash lookup fails? */ |
| 389 | MODULE_FUNCTION_BEGIN (); | 389 | MODULE_FUNCTION_BEGIN (); |
| 390 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); | 390 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); |
| 391 | Lisp_Object obj = value_to_lisp (ref); | 391 | Lisp_Object obj = value_to_lisp (global_value); |
| 392 | ptrdiff_t i = hash_lookup (h, obj, NULL); | 392 | ptrdiff_t i = hash_lookup (h, obj, NULL); |
| 393 | 393 | ||
| 394 | if (i >= 0) | 394 | if (i >= 0) |
| @@ -406,7 +406,7 @@ module_free_global_ref (emacs_env *env, emacs_value ref) | |||
| 406 | if (module_assertions) | 406 | if (module_assertions) |
| 407 | { | 407 | { |
| 408 | ptrdiff_t count = 0; | 408 | ptrdiff_t count = 0; |
| 409 | if (value_storage_contains_p (&global_storage, ref, &count)) | 409 | if (value_storage_contains_p (&global_storage, global_value, &count)) |
| 410 | return; | 410 | return; |
| 411 | module_abort ("Global value was not found in list of %"pD"d globals", | 411 | module_abort ("Global value was not found in list of %"pD"d globals", |
| 412 | count); | 412 | count); |
| @@ -430,14 +430,15 @@ module_non_local_exit_clear (emacs_env *env) | |||
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | static enum emacs_funcall_exit | 432 | static enum emacs_funcall_exit |
| 433 | module_non_local_exit_get (emacs_env *env, emacs_value *sym, emacs_value *data) | 433 | module_non_local_exit_get (emacs_env *env, |
| 434 | emacs_value *symbol, emacs_value *data) | ||
| 434 | { | 435 | { |
| 435 | module_assert_thread (); | 436 | module_assert_thread (); |
| 436 | module_assert_env (env); | 437 | module_assert_env (env); |
| 437 | struct emacs_env_private *p = env->private_members; | 438 | struct emacs_env_private *p = env->private_members; |
| 438 | if (p->pending_non_local_exit != emacs_funcall_exit_return) | 439 | if (p->pending_non_local_exit != emacs_funcall_exit_return) |
| 439 | { | 440 | { |
| 440 | *sym = &p->non_local_exit_symbol; | 441 | *symbol = &p->non_local_exit_symbol; |
| 441 | *data = &p->non_local_exit_data; | 442 | *data = &p->non_local_exit_data; |
| 442 | } | 443 | } |
| 443 | return p->pending_non_local_exit; | 444 | return p->pending_non_local_exit; |
| @@ -445,12 +446,13 @@ module_non_local_exit_get (emacs_env *env, emacs_value *sym, emacs_value *data) | |||
| 445 | 446 | ||
| 446 | /* Like for `signal', DATA must be a list. */ | 447 | /* Like for `signal', DATA must be a list. */ |
| 447 | static void | 448 | static void |
| 448 | module_non_local_exit_signal (emacs_env *env, emacs_value sym, emacs_value data) | 449 | module_non_local_exit_signal (emacs_env *env, |
| 450 | emacs_value symbol, emacs_value data) | ||
| 449 | { | 451 | { |
| 450 | module_assert_thread (); | 452 | module_assert_thread (); |
| 451 | module_assert_env (env); | 453 | module_assert_env (env); |
| 452 | if (module_non_local_exit_check (env) == emacs_funcall_exit_return) | 454 | if (module_non_local_exit_check (env) == emacs_funcall_exit_return) |
| 453 | module_non_local_exit_signal_1 (env, value_to_lisp (sym), | 455 | module_non_local_exit_signal_1 (env, value_to_lisp (symbol), |
| 454 | value_to_lisp (data)); | 456 | value_to_lisp (data)); |
| 455 | } | 457 | } |
| 456 | 458 | ||
| @@ -466,7 +468,7 @@ module_non_local_exit_throw (emacs_env *env, emacs_value tag, emacs_value value) | |||
| 466 | 468 | ||
| 467 | /* Function prototype for the module Lisp functions. */ | 469 | /* Function prototype for the module Lisp functions. */ |
| 468 | typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t, | 470 | typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t, |
| 469 | emacs_value [], void *); | 471 | emacs_value *, void *); |
| 470 | 472 | ||
| 471 | /* Module function. */ | 473 | /* Module function. */ |
| 472 | 474 | ||
| @@ -503,8 +505,7 @@ allocate_module_function (void) | |||
| 503 | 505 | ||
| 504 | static emacs_value | 506 | static emacs_value |
| 505 | module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, | 507 | module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, |
| 506 | emacs_subr subr, const char *documentation, | 508 | emacs_subr func, const char *docstring, void *data) |
| 507 | void *data) | ||
| 508 | { | 509 | { |
| 509 | MODULE_FUNCTION_BEGIN (NULL); | 510 | MODULE_FUNCTION_BEGIN (NULL); |
| 510 | 511 | ||
| @@ -518,11 +519,11 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, | |||
| 518 | struct Lisp_Module_Function *function = allocate_module_function (); | 519 | struct Lisp_Module_Function *function = allocate_module_function (); |
| 519 | function->min_arity = min_arity; | 520 | function->min_arity = min_arity; |
| 520 | function->max_arity = max_arity; | 521 | function->max_arity = max_arity; |
| 521 | function->subr = subr; | 522 | function->subr = func; |
| 522 | function->data = data; | 523 | function->data = data; |
| 523 | 524 | ||
| 524 | if (documentation) | 525 | if (docstring) |
| 525 | function->documentation = build_string_from_utf8 (documentation); | 526 | function->documentation = build_string_from_utf8 (docstring); |
| 526 | 527 | ||
| 527 | Lisp_Object result; | 528 | Lisp_Object result; |
| 528 | XSET_MODULE_FUNCTION (result, function); | 529 | XSET_MODULE_FUNCTION (result, function); |
| @@ -532,8 +533,8 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, | |||
| 532 | } | 533 | } |
| 533 | 534 | ||
| 534 | static emacs_value | 535 | static emacs_value |
| 535 | module_funcall (emacs_env *env, emacs_value fun, ptrdiff_t nargs, | 536 | module_funcall (emacs_env *env, emacs_value func, ptrdiff_t nargs, |
| 536 | emacs_value args[]) | 537 | emacs_value *args) |
| 537 | { | 538 | { |
| 538 | MODULE_FUNCTION_BEGIN (NULL); | 539 | MODULE_FUNCTION_BEGIN (NULL); |
| 539 | 540 | ||
| @@ -545,7 +546,7 @@ module_funcall (emacs_env *env, emacs_value fun, ptrdiff_t nargs, | |||
| 545 | if (INT_ADD_WRAPV (nargs, 1, &nargs1)) | 546 | if (INT_ADD_WRAPV (nargs, 1, &nargs1)) |
| 546 | overflow_error (); | 547 | overflow_error (); |
| 547 | SAFE_ALLOCA_LISP (newargs, nargs1); | 548 | SAFE_ALLOCA_LISP (newargs, nargs1); |
| 548 | newargs[0] = value_to_lisp (fun); | 549 | newargs[0] = value_to_lisp (func); |
| 549 | for (ptrdiff_t i = 0; i < nargs; i++) | 550 | for (ptrdiff_t i = 0; i < nargs; i++) |
| 550 | newargs[1 + i] = value_to_lisp (args[i]); | 551 | newargs[1 + i] = value_to_lisp (args[i]); |
| 551 | emacs_value result = lisp_to_value (env, Ffuncall (nargs1, newargs)); | 552 | emacs_value result = lisp_to_value (env, Ffuncall (nargs1, newargs)); |
| @@ -561,17 +562,17 @@ module_intern (emacs_env *env, const char *name) | |||
| 561 | } | 562 | } |
| 562 | 563 | ||
| 563 | static emacs_value | 564 | static emacs_value |
| 564 | module_type_of (emacs_env *env, emacs_value value) | 565 | module_type_of (emacs_env *env, emacs_value arg) |
| 565 | { | 566 | { |
| 566 | MODULE_FUNCTION_BEGIN (NULL); | 567 | MODULE_FUNCTION_BEGIN (NULL); |
| 567 | return lisp_to_value (env, Ftype_of (value_to_lisp (value))); | 568 | return lisp_to_value (env, Ftype_of (value_to_lisp (arg))); |
| 568 | } | 569 | } |
| 569 | 570 | ||
| 570 | static bool | 571 | static bool |
| 571 | module_is_not_nil (emacs_env *env, emacs_value value) | 572 | module_is_not_nil (emacs_env *env, emacs_value arg) |
| 572 | { | 573 | { |
| 573 | MODULE_FUNCTION_BEGIN_NO_CATCH (false); | 574 | MODULE_FUNCTION_BEGIN_NO_CATCH (false); |
| 574 | return ! NILP (value_to_lisp (value)); | 575 | return ! NILP (value_to_lisp (arg)); |
| 575 | } | 576 | } |
| 576 | 577 | ||
| 577 | static bool | 578 | static bool |
| @@ -582,14 +583,14 @@ module_eq (emacs_env *env, emacs_value a, emacs_value b) | |||
| 582 | } | 583 | } |
| 583 | 584 | ||
| 584 | static intmax_t | 585 | static intmax_t |
| 585 | module_extract_integer (emacs_env *env, emacs_value n) | 586 | module_extract_integer (emacs_env *env, emacs_value arg) |
| 586 | { | 587 | { |
| 587 | MODULE_FUNCTION_BEGIN (0); | 588 | MODULE_FUNCTION_BEGIN (0); |
| 588 | Lisp_Object l = value_to_lisp (n); | 589 | Lisp_Object lisp = value_to_lisp (arg); |
| 589 | CHECK_INTEGER (l); | 590 | CHECK_INTEGER (lisp); |
| 590 | intmax_t i; | 591 | intmax_t i; |
| 591 | if (! integer_to_intmax (l, &i)) | 592 | if (! integer_to_intmax (lisp, &i)) |
| 592 | xsignal1 (Qoverflow_error, l); | 593 | xsignal1 (Qoverflow_error, lisp); |
| 593 | return i; | 594 | return i; |
| 594 | } | 595 | } |
| 595 | 596 | ||
| @@ -601,10 +602,10 @@ module_make_integer (emacs_env *env, intmax_t n) | |||
| 601 | } | 602 | } |
| 602 | 603 | ||
| 603 | static double | 604 | static double |
| 604 | module_extract_float (emacs_env *env, emacs_value f) | 605 | module_extract_float (emacs_env *env, emacs_value arg) |
| 605 | { | 606 | { |
| 606 | MODULE_FUNCTION_BEGIN (0); | 607 | MODULE_FUNCTION_BEGIN (0); |
| 607 | Lisp_Object lisp = value_to_lisp (f); | 608 | Lisp_Object lisp = value_to_lisp (arg); |
| 608 | CHECK_TYPE (FLOATP (lisp), Qfloatp, lisp); | 609 | CHECK_TYPE (FLOATP (lisp), Qfloatp, lisp); |
| 609 | return XFLOAT_DATA (lisp); | 610 | return XFLOAT_DATA (lisp); |
| 610 | } | 611 | } |
| @@ -617,8 +618,8 @@ module_make_float (emacs_env *env, double d) | |||
| 617 | } | 618 | } |
| 618 | 619 | ||
| 619 | static bool | 620 | static bool |
| 620 | module_copy_string_contents (emacs_env *env, emacs_value value, char *buffer, | 621 | module_copy_string_contents (emacs_env *env, emacs_value value, char *buf, |
| 621 | ptrdiff_t *length) | 622 | ptrdiff_t *len) |
| 622 | { | 623 | { |
| 623 | MODULE_FUNCTION_BEGIN (false); | 624 | MODULE_FUNCTION_BEGIN (false); |
| 624 | Lisp_Object lisp_str = value_to_lisp (value); | 625 | Lisp_Object lisp_str = value_to_lisp (value); |
| @@ -642,77 +643,77 @@ module_copy_string_contents (emacs_env *env, emacs_value value, char *buffer, | |||
| 642 | ptrdiff_t raw_size = SBYTES (lisp_str_utf8); | 643 | ptrdiff_t raw_size = SBYTES (lisp_str_utf8); |
| 643 | ptrdiff_t required_buf_size = raw_size + 1; | 644 | ptrdiff_t required_buf_size = raw_size + 1; |
| 644 | 645 | ||
| 645 | if (buffer == NULL) | 646 | if (buf == NULL) |
| 646 | { | 647 | { |
| 647 | *length = required_buf_size; | 648 | *len = required_buf_size; |
| 648 | return true; | 649 | return true; |
| 649 | } | 650 | } |
| 650 | 651 | ||
| 651 | if (*length < required_buf_size) | 652 | if (*len < required_buf_size) |
| 652 | { | 653 | { |
| 653 | ptrdiff_t actual = *length; | 654 | ptrdiff_t actual = *len; |
| 654 | *length = required_buf_size; | 655 | *len = required_buf_size; |
| 655 | args_out_of_range_3 (INT_TO_INTEGER (actual), | 656 | args_out_of_range_3 (INT_TO_INTEGER (actual), |
| 656 | INT_TO_INTEGER (required_buf_size), | 657 | INT_TO_INTEGER (required_buf_size), |
| 657 | INT_TO_INTEGER (PTRDIFF_MAX)); | 658 | INT_TO_INTEGER (PTRDIFF_MAX)); |
| 658 | } | 659 | } |
| 659 | 660 | ||
| 660 | *length = required_buf_size; | 661 | *len = required_buf_size; |
| 661 | memcpy (buffer, SDATA (lisp_str_utf8), raw_size + 1); | 662 | memcpy (buf, SDATA (lisp_str_utf8), raw_size + 1); |
| 662 | 663 | ||
| 663 | return true; | 664 | return true; |
| 664 | } | 665 | } |
| 665 | 666 | ||
| 666 | static emacs_value | 667 | static emacs_value |
| 667 | module_make_string (emacs_env *env, const char *str, ptrdiff_t length) | 668 | module_make_string (emacs_env *env, const char *str, ptrdiff_t len) |
| 668 | { | 669 | { |
| 669 | MODULE_FUNCTION_BEGIN (NULL); | 670 | MODULE_FUNCTION_BEGIN (NULL); |
| 670 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) | 671 | if (! (0 <= len && len <= STRING_BYTES_BOUND)) |
| 671 | overflow_error (); | 672 | overflow_error (); |
| 672 | Lisp_Object lstr = make_string_from_utf8 (str, length); | 673 | Lisp_Object lstr = make_string_from_utf8 (str, len); |
| 673 | return lisp_to_value (env, lstr); | 674 | return lisp_to_value (env, lstr); |
| 674 | } | 675 | } |
| 675 | 676 | ||
| 676 | static emacs_value | 677 | static emacs_value |
| 677 | module_make_user_ptr (emacs_env *env, emacs_finalizer_function fin, void *ptr) | 678 | module_make_user_ptr (emacs_env *env, emacs_finalizer fin, void *ptr) |
| 678 | { | 679 | { |
| 679 | MODULE_FUNCTION_BEGIN (NULL); | 680 | MODULE_FUNCTION_BEGIN (NULL); |
| 680 | return lisp_to_value (env, make_user_ptr (fin, ptr)); | 681 | return lisp_to_value (env, make_user_ptr (fin, ptr)); |
| 681 | } | 682 | } |
| 682 | 683 | ||
| 683 | static void * | 684 | static void * |
| 684 | module_get_user_ptr (emacs_env *env, emacs_value uptr) | 685 | module_get_user_ptr (emacs_env *env, emacs_value arg) |
| 685 | { | 686 | { |
| 686 | MODULE_FUNCTION_BEGIN (NULL); | 687 | MODULE_FUNCTION_BEGIN (NULL); |
| 687 | Lisp_Object lisp = value_to_lisp (uptr); | 688 | Lisp_Object lisp = value_to_lisp (arg); |
| 688 | CHECK_USER_PTR (lisp); | 689 | CHECK_USER_PTR (lisp); |
| 689 | return XUSER_PTR (lisp)->p; | 690 | return XUSER_PTR (lisp)->p; |
| 690 | } | 691 | } |
| 691 | 692 | ||
| 692 | static void | 693 | static void |
| 693 | module_set_user_ptr (emacs_env *env, emacs_value uptr, void *ptr) | 694 | module_set_user_ptr (emacs_env *env, emacs_value arg, void *ptr) |
| 694 | { | 695 | { |
| 695 | MODULE_FUNCTION_BEGIN (); | 696 | MODULE_FUNCTION_BEGIN (); |
| 696 | Lisp_Object lisp = value_to_lisp (uptr); | 697 | Lisp_Object lisp = value_to_lisp (arg); |
| 697 | CHECK_USER_PTR (lisp); | 698 | CHECK_USER_PTR (lisp); |
| 698 | XUSER_PTR (lisp)->p = ptr; | 699 | XUSER_PTR (lisp)->p = ptr; |
| 699 | } | 700 | } |
| 700 | 701 | ||
| 701 | static emacs_finalizer_function | 702 | static emacs_finalizer |
| 702 | module_get_user_finalizer (emacs_env *env, emacs_value uptr) | 703 | module_get_user_finalizer (emacs_env *env, emacs_value arg) |
| 703 | { | 704 | { |
| 704 | MODULE_FUNCTION_BEGIN (NULL); | 705 | MODULE_FUNCTION_BEGIN (NULL); |
| 705 | Lisp_Object lisp = value_to_lisp (uptr); | 706 | Lisp_Object lisp = value_to_lisp (arg); |
| 706 | CHECK_USER_PTR (lisp); | 707 | CHECK_USER_PTR (lisp); |
| 707 | return XUSER_PTR (lisp)->finalizer; | 708 | return XUSER_PTR (lisp)->finalizer; |
| 708 | } | 709 | } |
| 709 | 710 | ||
| 710 | static void | 711 | static void |
| 711 | module_set_user_finalizer (emacs_env *env, emacs_value uptr, | 712 | module_set_user_finalizer (emacs_env *env, emacs_value arg, |
| 712 | emacs_finalizer_function fin) | 713 | emacs_finalizer fin) |
| 713 | { | 714 | { |
| 714 | MODULE_FUNCTION_BEGIN (); | 715 | MODULE_FUNCTION_BEGIN (); |
| 715 | Lisp_Object lisp = value_to_lisp (uptr); | 716 | Lisp_Object lisp = value_to_lisp (arg); |
| 716 | CHECK_USER_PTR (lisp); | 717 | CHECK_USER_PTR (lisp); |
| 717 | XUSER_PTR (lisp)->finalizer = fin; | 718 | XUSER_PTR (lisp)->finalizer = fin; |
| 718 | } | 719 | } |
| @@ -727,30 +728,31 @@ check_vec_index (Lisp_Object lvec, ptrdiff_t i) | |||
| 727 | } | 728 | } |
| 728 | 729 | ||
| 729 | static void | 730 | static void |
| 730 | module_vec_set (emacs_env *env, emacs_value vec, ptrdiff_t i, emacs_value val) | 731 | module_vec_set (emacs_env *env, emacs_value vector, ptrdiff_t index, |
| 732 | emacs_value value) | ||
| 731 | { | 733 | { |
| 732 | MODULE_FUNCTION_BEGIN (); | 734 | MODULE_FUNCTION_BEGIN (); |
| 733 | Lisp_Object lvec = value_to_lisp (vec); | 735 | Lisp_Object lisp = value_to_lisp (vector); |
| 734 | check_vec_index (lvec, i); | 736 | check_vec_index (lisp, index); |
| 735 | ASET (lvec, i, value_to_lisp (val)); | 737 | ASET (lisp, index, value_to_lisp (value)); |
| 736 | } | 738 | } |
| 737 | 739 | ||
| 738 | static emacs_value | 740 | static emacs_value |
| 739 | module_vec_get (emacs_env *env, emacs_value vec, ptrdiff_t i) | 741 | module_vec_get (emacs_env *env, emacs_value vector, ptrdiff_t index) |
| 740 | { | 742 | { |
| 741 | MODULE_FUNCTION_BEGIN (NULL); | 743 | MODULE_FUNCTION_BEGIN (NULL); |
| 742 | Lisp_Object lvec = value_to_lisp (vec); | 744 | Lisp_Object lisp = value_to_lisp (vector); |
| 743 | check_vec_index (lvec, i); | 745 | check_vec_index (lisp, index); |
| 744 | return lisp_to_value (env, AREF (lvec, i)); | 746 | return lisp_to_value (env, AREF (lisp, index)); |
| 745 | } | 747 | } |
| 746 | 748 | ||
| 747 | static ptrdiff_t | 749 | static ptrdiff_t |
| 748 | module_vec_size (emacs_env *env, emacs_value vec) | 750 | module_vec_size (emacs_env *env, emacs_value vector) |
| 749 | { | 751 | { |
| 750 | MODULE_FUNCTION_BEGIN (0); | 752 | MODULE_FUNCTION_BEGIN (0); |
| 751 | Lisp_Object lvec = value_to_lisp (vec); | 753 | Lisp_Object lisp = value_to_lisp (vector); |
| 752 | CHECK_VECTOR (lvec); | 754 | CHECK_VECTOR (lisp); |
| 753 | return ASIZE (lvec); | 755 | return ASIZE (lisp); |
| 754 | } | 756 | } |
| 755 | 757 | ||
| 756 | /* This function should return true if and only if maybe_quit would | 758 | /* This function should return true if and only if maybe_quit would |
| @@ -771,10 +773,10 @@ module_process_input (emacs_env *env) | |||
| 771 | } | 773 | } |
| 772 | 774 | ||
| 773 | static struct timespec | 775 | static struct timespec |
| 774 | module_extract_time (emacs_env *env, emacs_value value) | 776 | module_extract_time (emacs_env *env, emacs_value arg) |
| 775 | { | 777 | { |
| 776 | MODULE_FUNCTION_BEGIN ((struct timespec) {0}); | 778 | MODULE_FUNCTION_BEGIN ((struct timespec) {0}); |
| 777 | return lisp_time_argument (value_to_lisp (value)); | 779 | return lisp_time_argument (value_to_lisp (arg)); |
| 778 | } | 780 | } |
| 779 | 781 | ||
| 780 | static emacs_value | 782 | static emacs_value |
| @@ -1088,14 +1090,14 @@ module_assert_thread (void) | |||
| 1088 | } | 1090 | } |
| 1089 | 1091 | ||
| 1090 | static void | 1092 | static void |
| 1091 | module_assert_runtime (struct emacs_runtime *ert) | 1093 | module_assert_runtime (struct emacs_runtime *runtime) |
| 1092 | { | 1094 | { |
| 1093 | if (! module_assertions) | 1095 | if (! module_assertions) |
| 1094 | return; | 1096 | return; |
| 1095 | ptrdiff_t count = 0; | 1097 | ptrdiff_t count = 0; |
| 1096 | for (Lisp_Object tail = Vmodule_runtimes; CONSP (tail); tail = XCDR (tail)) | 1098 | for (Lisp_Object tail = Vmodule_runtimes; CONSP (tail); tail = XCDR (tail)) |
| 1097 | { | 1099 | { |
| 1098 | if (xmint_pointer (XCAR (tail)) == ert) | 1100 | if (xmint_pointer (XCAR (tail)) == runtime) |
| 1099 | return; | 1101 | return; |
| 1100 | ++count; | 1102 | ++count; |
| 1101 | } | 1103 | } |
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index e9d5de495d6..4175240cd09 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in | |||
| @@ -68,7 +68,7 @@ struct emacs_runtime | |||
| 68 | struct emacs_runtime_private *private_members; | 68 | struct emacs_runtime_private *private_members; |
| 69 | 69 | ||
| 70 | /* Return an environment pointer. */ | 70 | /* Return an environment pointer. */ |
| 71 | emacs_env *(*get_environment) (struct emacs_runtime *ert) | 71 | emacs_env *(*get_environment) (struct emacs_runtime *runtime) |
| 72 | EMACS_ATTRIBUTE_NONNULL(1); | 72 | EMACS_ATTRIBUTE_NONNULL(1); |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| @@ -126,7 +126,7 @@ struct emacs_env_27 | |||
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | /* Every module should define a function as follows. */ | 128 | /* Every module should define a function as follows. */ |
| 129 | extern int emacs_module_init (struct emacs_runtime *ert) | 129 | extern int emacs_module_init (struct emacs_runtime *runtime) |
| 130 | EMACS_NOEXCEPT | 130 | EMACS_NOEXCEPT |
| 131 | EMACS_ATTRIBUTE_NONNULL(1); | 131 | EMACS_ATTRIBUTE_NONNULL(1); |
| 132 | 132 | ||
diff --git a/src/module-env-25.h b/src/module-env-25.h index d8f8eb68119..01ce65e9148 100644 --- a/src/module-env-25.h +++ b/src/module-env-25.h | |||
| @@ -6,12 +6,10 @@ | |||
| 6 | 6 | ||
| 7 | /* Memory management. */ | 7 | /* Memory management. */ |
| 8 | 8 | ||
| 9 | emacs_value (*make_global_ref) (emacs_env *env, | 9 | emacs_value (*make_global_ref) (emacs_env *env, emacs_value value) |
| 10 | emacs_value any_reference) | ||
| 11 | EMACS_ATTRIBUTE_NONNULL(1); | 10 | EMACS_ATTRIBUTE_NONNULL(1); |
| 12 | 11 | ||
| 13 | void (*free_global_ref) (emacs_env *env, | 12 | void (*free_global_ref) (emacs_env *env, emacs_value global_value) |
| 14 | emacs_value global_reference) | ||
| 15 | EMACS_ATTRIBUTE_NONNULL(1); | 13 | EMACS_ATTRIBUTE_NONNULL(1); |
| 16 | 14 | ||
| 17 | /* Non-local exit handling. */ | 15 | /* Non-local exit handling. */ |
| @@ -23,19 +21,15 @@ | |||
| 23 | EMACS_ATTRIBUTE_NONNULL(1); | 21 | EMACS_ATTRIBUTE_NONNULL(1); |
| 24 | 22 | ||
| 25 | enum emacs_funcall_exit (*non_local_exit_get) | 23 | enum emacs_funcall_exit (*non_local_exit_get) |
| 26 | (emacs_env *env, | 24 | (emacs_env *env, emacs_value *symbol, emacs_value *data) |
| 27 | emacs_value *non_local_exit_symbol_out, | ||
| 28 | emacs_value *non_local_exit_data_out) | ||
| 29 | EMACS_ATTRIBUTE_NONNULL(1, 2, 3); | 25 | EMACS_ATTRIBUTE_NONNULL(1, 2, 3); |
| 30 | 26 | ||
| 31 | void (*non_local_exit_signal) (emacs_env *env, | 27 | void (*non_local_exit_signal) (emacs_env *env, |
| 32 | emacs_value non_local_exit_symbol, | 28 | emacs_value symbol, emacs_value data) |
| 33 | emacs_value non_local_exit_data) | ||
| 34 | EMACS_ATTRIBUTE_NONNULL(1); | 29 | EMACS_ATTRIBUTE_NONNULL(1); |
| 35 | 30 | ||
| 36 | void (*non_local_exit_throw) (emacs_env *env, | 31 | void (*non_local_exit_throw) (emacs_env *env, |
| 37 | emacs_value tag, | 32 | emacs_value tag, emacs_value value) |
| 38 | emacs_value value) | ||
| 39 | EMACS_ATTRIBUTE_NONNULL(1); | 33 | EMACS_ATTRIBUTE_NONNULL(1); |
| 40 | 34 | ||
| 41 | /* Function registration. */ | 35 | /* Function registration. */ |
| @@ -43,48 +37,46 @@ | |||
| 43 | emacs_value (*make_function) (emacs_env *env, | 37 | emacs_value (*make_function) (emacs_env *env, |
| 44 | ptrdiff_t min_arity, | 38 | ptrdiff_t min_arity, |
| 45 | ptrdiff_t max_arity, | 39 | ptrdiff_t max_arity, |
| 46 | emacs_value (*function) (emacs_env *env, | 40 | emacs_value (*func) (emacs_env *env, |
| 47 | ptrdiff_t nargs, | 41 | ptrdiff_t nargs, |
| 48 | emacs_value args[], | 42 | emacs_value* args, |
| 49 | void *) | 43 | void *data) |
| 50 | EMACS_NOEXCEPT | 44 | EMACS_NOEXCEPT |
| 51 | EMACS_ATTRIBUTE_NONNULL(1), | 45 | EMACS_ATTRIBUTE_NONNULL(1), |
| 52 | const char *documentation, | 46 | const char *docstring, |
| 53 | void *data) | 47 | void *data) |
| 54 | EMACS_ATTRIBUTE_NONNULL(1, 4); | 48 | EMACS_ATTRIBUTE_NONNULL(1, 4); |
| 55 | 49 | ||
| 56 | emacs_value (*funcall) (emacs_env *env, | 50 | emacs_value (*funcall) (emacs_env *env, |
| 57 | emacs_value function, | 51 | emacs_value func, |
| 58 | ptrdiff_t nargs, | 52 | ptrdiff_t nargs, |
| 59 | emacs_value args[]) | 53 | emacs_value* args) |
| 60 | EMACS_ATTRIBUTE_NONNULL(1); | 54 | EMACS_ATTRIBUTE_NONNULL(1); |
| 61 | 55 | ||
| 62 | emacs_value (*intern) (emacs_env *env, | 56 | emacs_value (*intern) (emacs_env *env, const char *name) |
| 63 | const char *symbol_name) | ||
| 64 | EMACS_ATTRIBUTE_NONNULL(1, 2); | 57 | EMACS_ATTRIBUTE_NONNULL(1, 2); |
| 65 | 58 | ||
| 66 | /* Type conversion. */ | 59 | /* Type conversion. */ |
| 67 | 60 | ||
| 68 | emacs_value (*type_of) (emacs_env *env, | 61 | emacs_value (*type_of) (emacs_env *env, emacs_value arg) |
| 69 | emacs_value value) | ||
| 70 | EMACS_ATTRIBUTE_NONNULL(1); | 62 | EMACS_ATTRIBUTE_NONNULL(1); |
| 71 | 63 | ||
| 72 | bool (*is_not_nil) (emacs_env *env, emacs_value value) | 64 | bool (*is_not_nil) (emacs_env *env, emacs_value arg) |
| 73 | EMACS_ATTRIBUTE_NONNULL(1); | 65 | EMACS_ATTRIBUTE_NONNULL(1); |
| 74 | 66 | ||
| 75 | bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) | 67 | bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) |
| 76 | EMACS_ATTRIBUTE_NONNULL(1); | 68 | EMACS_ATTRIBUTE_NONNULL(1); |
| 77 | 69 | ||
| 78 | intmax_t (*extract_integer) (emacs_env *env, emacs_value value) | 70 | intmax_t (*extract_integer) (emacs_env *env, emacs_value arg) |
| 79 | EMACS_ATTRIBUTE_NONNULL(1); | 71 | EMACS_ATTRIBUTE_NONNULL(1); |
| 80 | 72 | ||
| 81 | emacs_value (*make_integer) (emacs_env *env, intmax_t value) | 73 | emacs_value (*make_integer) (emacs_env *env, intmax_t n) |
| 82 | EMACS_ATTRIBUTE_NONNULL(1); | 74 | EMACS_ATTRIBUTE_NONNULL(1); |
| 83 | 75 | ||
| 84 | double (*extract_float) (emacs_env *env, emacs_value value) | 76 | double (*extract_float) (emacs_env *env, emacs_value arg) |
| 85 | EMACS_ATTRIBUTE_NONNULL(1); | 77 | EMACS_ATTRIBUTE_NONNULL(1); |
| 86 | 78 | ||
| 87 | emacs_value (*make_float) (emacs_env *env, double value) | 79 | emacs_value (*make_float) (emacs_env *env, double d) |
| 88 | EMACS_ATTRIBUTE_NONNULL(1); | 80 | EMACS_ATTRIBUTE_NONNULL(1); |
| 89 | 81 | ||
| 90 | /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 | 82 | /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 |
| @@ -101,13 +93,13 @@ | |||
| 101 | 93 | ||
| 102 | bool (*copy_string_contents) (emacs_env *env, | 94 | bool (*copy_string_contents) (emacs_env *env, |
| 103 | emacs_value value, | 95 | emacs_value value, |
| 104 | char *buffer, | 96 | char *buf, |
| 105 | ptrdiff_t *size_inout) | 97 | ptrdiff_t *len) |
| 106 | EMACS_ATTRIBUTE_NONNULL(1, 4); | 98 | EMACS_ATTRIBUTE_NONNULL(1, 4); |
| 107 | 99 | ||
| 108 | /* Create a Lisp string from a utf8 encoded string. */ | 100 | /* Create a Lisp string from a utf8 encoded string. */ |
| 109 | emacs_value (*make_string) (emacs_env *env, | 101 | emacs_value (*make_string) (emacs_env *env, |
| 110 | const char *contents, ptrdiff_t length) | 102 | const char *str, ptrdiff_t len) |
| 111 | EMACS_ATTRIBUTE_NONNULL(1, 2); | 103 | EMACS_ATTRIBUTE_NONNULL(1, 2); |
| 112 | 104 | ||
| 113 | /* Embedded pointer type. */ | 105 | /* Embedded pointer type. */ |
| @@ -116,25 +108,24 @@ | |||
| 116 | void *ptr) | 108 | void *ptr) |
| 117 | EMACS_ATTRIBUTE_NONNULL(1); | 109 | EMACS_ATTRIBUTE_NONNULL(1); |
| 118 | 110 | ||
| 119 | void *(*get_user_ptr) (emacs_env *env, emacs_value uptr) | 111 | void *(*get_user_ptr) (emacs_env *env, emacs_value arg) |
| 120 | EMACS_ATTRIBUTE_NONNULL(1); | 112 | EMACS_ATTRIBUTE_NONNULL(1); |
| 121 | void (*set_user_ptr) (emacs_env *env, emacs_value uptr, void *ptr) | 113 | void (*set_user_ptr) (emacs_env *env, emacs_value arg, void *ptr) |
| 122 | EMACS_ATTRIBUTE_NONNULL(1); | 114 | EMACS_ATTRIBUTE_NONNULL(1); |
| 123 | 115 | ||
| 124 | void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) | 116 | void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) |
| 125 | (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); | 117 | (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); |
| 126 | void (*set_user_finalizer) (emacs_env *env, | 118 | void (*set_user_finalizer) (emacs_env *env, emacs_value arg, |
| 127 | emacs_value uptr, | ||
| 128 | void (*fin) (void *) EMACS_NOEXCEPT) | 119 | void (*fin) (void *) EMACS_NOEXCEPT) |
| 129 | EMACS_ATTRIBUTE_NONNULL(1); | 120 | EMACS_ATTRIBUTE_NONNULL(1); |
| 130 | 121 | ||
| 131 | /* Vector functions. */ | 122 | /* Vector functions. */ |
| 132 | emacs_value (*vec_get) (emacs_env *env, emacs_value vec, ptrdiff_t i) | 123 | emacs_value (*vec_get) (emacs_env *env, emacs_value vector, ptrdiff_t index) |
| 133 | EMACS_ATTRIBUTE_NONNULL(1); | 124 | EMACS_ATTRIBUTE_NONNULL(1); |
| 134 | 125 | ||
| 135 | void (*vec_set) (emacs_env *env, emacs_value vec, ptrdiff_t i, | 126 | void (*vec_set) (emacs_env *env, emacs_value vector, ptrdiff_t index, |
| 136 | emacs_value val) | 127 | emacs_value value) |
| 137 | EMACS_ATTRIBUTE_NONNULL(1); | 128 | EMACS_ATTRIBUTE_NONNULL(1); |
| 138 | 129 | ||
| 139 | ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vec) | 130 | ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vector) |
| 140 | EMACS_ATTRIBUTE_NONNULL(1); | 131 | EMACS_ATTRIBUTE_NONNULL(1); |
diff --git a/src/module-env-27.h b/src/module-env-27.h index 0fe2557d71b..9ef3c8b33bb 100644 --- a/src/module-env-27.h +++ b/src/module-env-27.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | enum emacs_process_input_result (*process_input) (emacs_env *env) | 3 | enum emacs_process_input_result (*process_input) (emacs_env *env) |
| 4 | EMACS_ATTRIBUTE_NONNULL (1); | 4 | EMACS_ATTRIBUTE_NONNULL (1); |
| 5 | 5 | ||
| 6 | struct timespec (*extract_time) (emacs_env *env, emacs_value value) | 6 | struct timespec (*extract_time) (emacs_env *env, emacs_value arg) |
| 7 | EMACS_ATTRIBUTE_NONNULL (1); | 7 | EMACS_ATTRIBUTE_NONNULL (1); |
| 8 | 8 | ||
| 9 | emacs_value (*make_time) (emacs_env *env, struct timespec time) | 9 | emacs_value (*make_time) (emacs_env *env, struct timespec time) |