aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Stephani2019-12-23 17:12:56 +0100
committerPhilipp Stephani2019-12-23 17:16:10 +0100
commit94fa7ceb480632fec7dda6d41f63223e4127bd83 (patch)
tree7ac195f5d9bc1c347ba4841c396727c2954a3928 /src
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 'src')
-rw-r--r--src/emacs-module.c146
-rw-r--r--src/emacs-module.h.in4
-rw-r--r--src/module-env-25.h67
-rw-r--r--src/module-env-27.h2
4 files changed, 106 insertions, 113 deletions
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. */
129typedef void (*emacs_finalizer_function) (void *); 129typedef 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
345static emacs_env * 345static emacs_env *
346module_get_environment (struct emacs_runtime *ert) 346module_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)
356static Lisp_Object Vmodule_refs_hash; 356static Lisp_Object Vmodule_refs_hash;
357 357
358static emacs_value 358static emacs_value
359module_make_global_ref (emacs_env *env, emacs_value ref) 359module_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
383static void 383static void
384module_free_global_ref (emacs_env *env, emacs_value ref) 384module_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
432static enum emacs_funcall_exit 432static enum emacs_funcall_exit
433module_non_local_exit_get (emacs_env *env, emacs_value *sym, emacs_value *data) 433module_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. */
447static void 448static void
448module_non_local_exit_signal (emacs_env *env, emacs_value sym, emacs_value data) 449module_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. */
468typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t, 470typedef 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
504static emacs_value 506static emacs_value
505module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, 507module_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
534static emacs_value 535static emacs_value
535module_funcall (emacs_env *env, emacs_value fun, ptrdiff_t nargs, 536module_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
563static emacs_value 564static emacs_value
564module_type_of (emacs_env *env, emacs_value value) 565module_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
570static bool 571static bool
571module_is_not_nil (emacs_env *env, emacs_value value) 572module_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
577static bool 578static bool
@@ -582,14 +583,14 @@ module_eq (emacs_env *env, emacs_value a, emacs_value b)
582} 583}
583 584
584static intmax_t 585static intmax_t
585module_extract_integer (emacs_env *env, emacs_value n) 586module_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
603static double 604static double
604module_extract_float (emacs_env *env, emacs_value f) 605module_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
619static bool 620static bool
620module_copy_string_contents (emacs_env *env, emacs_value value, char *buffer, 621module_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
666static emacs_value 667static emacs_value
667module_make_string (emacs_env *env, const char *str, ptrdiff_t length) 668module_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
676static emacs_value 677static emacs_value
677module_make_user_ptr (emacs_env *env, emacs_finalizer_function fin, void *ptr) 678module_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
683static void * 684static void *
684module_get_user_ptr (emacs_env *env, emacs_value uptr) 685module_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
692static void 693static void
693module_set_user_ptr (emacs_env *env, emacs_value uptr, void *ptr) 694module_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
701static emacs_finalizer_function 702static emacs_finalizer
702module_get_user_finalizer (emacs_env *env, emacs_value uptr) 703module_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
710static void 711static void
711module_set_user_finalizer (emacs_env *env, emacs_value uptr, 712module_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
729static void 730static void
730module_vec_set (emacs_env *env, emacs_value vec, ptrdiff_t i, emacs_value val) 731module_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
738static emacs_value 740static emacs_value
739module_vec_get (emacs_env *env, emacs_value vec, ptrdiff_t i) 741module_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
747static ptrdiff_t 749static ptrdiff_t
748module_vec_size (emacs_env *env, emacs_value vec) 750module_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
773static struct timespec 775static struct timespec
774module_extract_time (emacs_env *env, emacs_value value) 776module_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
780static emacs_value 782static emacs_value
@@ -1088,14 +1090,14 @@ module_assert_thread (void)
1088} 1090}
1089 1091
1090static void 1092static void
1091module_assert_runtime (struct emacs_runtime *ert) 1093module_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. */
129extern int emacs_module_init (struct emacs_runtime *ert) 129extern 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)