aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPhilipp Stephani2019-12-23 17:12:56 +0100
committerPhilipp Stephani2019-12-23 17:16:10 +0100
commit94fa7ceb480632fec7dda6d41f63223e4127bd83 (patch)
tree7ac195f5d9bc1c347ba4841c396727c2954a3928 /doc
parent64fe67beff937fe6279f073dcfe28b15a2a811f9 (diff)
downloademacs-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.texi97
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
1230int 1230int
1231emacs_module_init (struct emacs_runtime *ert) 1231emacs_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
1247above: 1247above:
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
1264known sizes, like this: 1264known 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
1388look like this, as part of the module initialization function: 1388look 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})
1529This function, which is available since Emacs 27, interprets 1529This function, which is available since Emacs 27, interprets @var{arg}
1530@var{time} as an Emacs Lisp time value and returns the corresponding 1530as an Emacs Lisp time value and returns the corresponding @code{struct
1531@code{struct timespec}. @xref{Time of Day}. @code{struct timespec} 1531timespec}. @xref{Time of Day}. @code{struct timespec} represents a
1532represents a timestamp with nanosecond precision. It has the 1532timestamp with nanosecond precision. It has the following members:
1533following 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
1730int 1729int
1731emacs_module_init (struct emacs_runtime *ert) 1730emacs_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})
1761This function creates an Emacs string from C text string pointed by 1760This 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
1763byte, is @var{strlen}. The original string in @var{str} can be either 1762byte, is @var{len}. The original string in @var{str} can be either an
1764an @acronym{ASCII} string or a UTF-8 encoded non-@acronym{ASCII} 1763@acronym{ASCII} string or a UTF-8 encoded non-@acronym{ASCII} string;
1765string; it can include embedded null bytes, and doesn't have to end in 1764it can include embedded null bytes, and doesn't have to end in a
1766a terminating null byte at @code{@var{str}[@var{strlen}]}. The 1765terminating null byte at @code{@var{str}[@var{len}]}. The function
1767function raises the @code{overflow-error} error condition if 1766raises the @code{overflow-error} error condition if @var{len} is
1768@var{strlen} is negative or exceeds the maximum length of an Emacs 1767negative or exceeds the maximum length of an Emacs string.
1769string.
1770@end deftypefn 1768@end deftypefn
1771 1769
1772The @acronym{API} does not provide functions to manipulate Lisp data 1770The @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,
1823because GC must finish quickly to keep Emacs responsive. 1821because 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})
1827This function extracts the C pointer from the Lisp object represented 1825This function extracts the C pointer from the Lisp object represented
1828by @var{val}. 1826by @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})
1832This function sets the C pointer embedded in the @code{user-ptr} 1830This function sets the C pointer embedded in the @code{user-ptr}
1833object represented by @var{value} to @var{ptr}. 1831object 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})
1837This function returns the finalizer of the @code{user-ptr} object 1835This function returns the finalizer of the @code{user-ptr} object
1838represented by @var{val}, or @code{NULL} if it doesn't have a finalizer. 1836represented by @var{arg}, or @code{NULL} if it doesn't have a
1837finalizer.
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})
1842This function changes the finalizer of the @code{user-ptr} object 1841This function changes the finalizer of the @code{user-ptr} object
1843represented by @var{val} to be @var{fin}. If @var{fin} is a 1842represented 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
1844finalizer.
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
1854that were introduced after Emacs 25 calls out the first version where 1854that were introduced after Emacs 25 calls out the first version where
1855they became available. 1855they 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})
1858This function returns @code{true} if the Lisp objects represented by 1858This 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
1860is the same as the Lisp function @code{eq} (@pxref{Equality 1860the same as the Lisp function @code{eq} (@pxref{Equality Predicates}),
1861Predicates}), but avoids the need to intern the objects represented by 1861but avoids the need to intern the objects represented by the
1862the arguments. 1862arguments.
1863 1863
1864There are no @acronym{API} functions for other equality predicates, so 1864There are no @acronym{API} functions for other equality predicates, so
1865you will need to use @code{intern} and @code{funcall}, described 1865you will need to use @code{intern} and @code{funcall}, described
1866below, to perform more complex equality tests. 1866below, 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})
1870This function tests whether the Lisp object represented by @var{val} 1870This function tests whether the Lisp object represented by @var{arg}
1871is non-@code{nil}; it returns @code{true} or @code{false} accordingly. 1871is non-@code{nil}; it returns @code{true} or @code{false} accordingly.
1872 1872
1873Note that you could implement an equivalent test by using 1873Note 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
1876this function is more convenient. 1876this 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})
1880This function returns the type of @var{object} as a value that 1880This function returns the type of @var{arg} as a value that represents
1881represents a symbol: @code{string} for a string, @code{integer} for an 1881a symbol: @code{string} for a string, @code{integer} for an integer,
1882integer, @code{process} for a process, etc. @xref{Type Predicates}. 1882@code{process} for a process, etc. @xref{Type Predicates}. You can
1883You can use @code{intern} and @code{eq} to compare against known type 1883use @code{intern} and @code{eq} to compare against known type symbols,
1884symbols, if your code needs to depend on the object type. 1884if 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
2055from one of the called @acronym{API} or Lisp functions. 2055from 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})
2059This function signals the error represented by @var{error} with the 2059This function signals the error represented by the error symbol
2060specified error data @var{data}. The module function should return 2060@var{symbol} with the specified error data @var{data}. The module
2061soon after calling this function. This function could be useful, 2061function should return soon after calling this function. This
2062e.g., for signaling errors from module functions to Emacs. 2062function could be useful, e.g., for signaling errors from module
2063functions to Emacs.
2063@end deftypefn 2064@end deftypefn
2064 2065
2065 2066