- 28 Apr, 2019 2 commits
-
-
Philipp Stephani authored
* test/src/emacs-module-tests.el: Add package name and standard sections. (multiply-string): Add a docstring.
-
Philipp Stephani authored
-
- 24 Apr, 2019 4 commits
-
-
Philipp Stephani authored
* doc/lispref/internals.texi (Module Values): Clarify that the truncation is towards negative infinity. * test/data/emacs-module/mod-test.c (Fmod_test_nanoseconds): Add test function. (emacs_module_init): Define it. * test/src/emacs-module-tests.el (mod-test-nanoseconds): New unit test.
-
Philipp Stephani authored
make_time is documented to return a (TICKS . HZ) pair, so we can’t use make_lisp_time. Introduce a new conversion function instead. * src/emacs-module.c (module_make_time): Use timespec_to_lisp to correct return type. * src/timefns.c (timespec_to_lisp): New function. (make_lisp_time): Use it. * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid): Check return type.
-
Philipp Stephani authored
* src/module-env-27.h: Add new module functions to convert big integers. * src/emacs-module.h.in (emacs_mpz): Define if GMP is available. * src/emacs-module.c (module_extract_big_integer) (module_make_big_integer): New functions. (initialize_environment): Use them. * test/data/emacs-module/mod-test.c (Fmod_test_double): New test function. (emacs_module_init): Define it. * test/src/emacs-module-tests.el (mod-test-double): New unit test. * doc/lispref/internals.texi (Module Values): Document new functions.
-
Philipp Stephani authored
Time values are a fundamental data type, and such conversions are hard to implement within modules because of the various forms of time values in Emacs Lisp. Adding dedicated conversion functions can significantly simplify module code dealing with times. This approach uses nanosecond precision. While Emacs in theory has support for higher-precision time values, in practice most languages and standards, such as POSIX, C, Java, and Go, have settled on nanosecond-precision integers to represent time. * src/emacs-module.h.in: Add header for struct timespec. * src/module-env-27.h: Add module functions for time conversion. * src/emacs-module.c (module_extract_time, module_make_time): New functions. (initialize_environment): Use them. * test/data/emacs-module/mod-test.c (Fmod_test_add_nanosecond): New test function. (emacs_module_init): Define it. * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid) (mod-test-add-nanosecond/nil, mod-test-add-nanosecond/invalid): New unit tests. * doc/lispref/internals.texi (Module Values): Document time conversion functions.
-
- 22 Mar, 2019 1 commit
-
-
Eli Zaretskii authored
This reverts commit 093d3e78, which reverted ee7ad83f, which reverted 3eb93c07.
-
- 21 Mar, 2019 2 commits
-
-
Eli Zaretskii authored
This reverts commit ee7ad83f. There was no consensus on reverting 3eb93c07, so doing that will have to wait until the discussion ends.
-
Philipp Stephani authored
This reverts commit 3eb93c07. There was no consensus for that commit, see https://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00150.html. Also, reverting this commit should fix Bug#31238.
-
- 24 Feb, 2019 1 commit
-
-
Philipp Stephani authored
pending_signals is often set if no quit is pending. This results in bugs in module code if the module returns but no quit is actually pending. As a better alternative, add a new process_input environment function for Emacs 27. That function processes signals (like maybe_quit). * configure.ac: Add module snippet for Emacs 27. * src/module-env-27.h: New file. * src/emacs-module.h.in: Add process_input function to environment interface. * src/emacs-module.c (module_should_quit): Use QUITP macro to check whether the caller should quit. (module_process_input): New function. (initialize_environment): Use it. * src/eval.c: Remove obsolete comment. * test/data/emacs-module/mod-test.c (signal_wrong_type_argument) (signal_errno): New helper functions. (Fmod_test_sleep_until): New test module function. * test/src/emacs-module-tests.el (mod-test-sleep-until): New unit test. * doc/lispref/internals.texi (Module Misc): Document process_input.
-
- 01 Jan, 2019 1 commit
-
-
Paul Eggert authored
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
-
- 25 Aug, 2018 1 commit
-
-
Sergey Vinokurov authored
* src/emacs-module.c (module_free_global_ref): Compare a value to be freed with all entries of the list. * test/data/emacs-module/mod-test.c (Fmod_test_globref_free): New function. (emacs_module_init): Make it accessible from Lisp. * test/src/emacs-module-tests.el (mod-test-globref-free-test): New test which uses it.
-
- 08 Aug, 2018 1 commit
-
-
Tom Tromey authored
* test/src/emacs-module-tests.el (mod-test-sum-test): Update for bignums.
-
- 28 Apr, 2018 1 commit
-
-
Juri Linkov authored
* doc/lispref/control.texi (Iteration): * doc/misc/cl.texi (Iteration): Document deprecation of its use. * doc/lispintro/emacs-lisp-intro.texi (dotimes): * test/src/emacs-module-tests.el (multiply-string): * test/lisp/filenotify-tests.el (file-notify-test07-many-events): Place RESULT field after the form.
-
- 22 Mar, 2018 1 commit
-
-
Paul Eggert authored
Fix a portability bug when emacs-module-tests.el is byte-compiled with a 32-bit Emacs (where #x20000000 evaluates to a floating-point number) and then is run on a 64-bit Emacs (where the floating-point number causes a test failure). * test/src/emacs-module-tests.el (mod-test-sum-test): Don’t assume #x20000000 can be represented as an Emacs integer.
-
- 02 Feb, 2018 3 commits
-
-
Philipp Stephani authored
* src/lread.c (Fload): Don't defer to module-load immediately when encountering a module, but use the normal loading machinery to properly set up load-history, check for recursive loads, print messages, etc. * test/src/emacs-module-tests.el (module/load-history): New test. (module/describe-function-1): Adapt test. * etc/NEWS: Mention fixed behavior.
-
Philipp Stephani authored
This puts functions defined in the module into the 'load-history'. * test/data/emacs-module/mod-test.c (bind_function): Use 'defalias' instead of 'fset'. * test/src/emacs-module-tests.el (module/describe-function-1): Adapt unit test.
-
Philipp Stephani authored
* lisp/help-fns.el (help-fns-function-description-header): Handle module functions. * test/src/emacs-module-tests.el (module/describe-function-1): New test.
-
- 28 Jan, 2018 2 commits
-
-
Philipp Stephani authored
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add module types. * test/src/emacs-module-tests.el (emacs-module-tests--generic): New helper function. (module-function-object, mod-test-userptr-fun-test): Test that type dispatching works with module types.
-
Philipp Stephani authored
* test/src/emacs-module-tests.el (module-function-object): Verify that a module function is treated as a function.
-
- 26 Jan, 2018 1 commit
-
-
Andy Moreton authored
* test/Makefile.in (test_module_dir): Build the test module library in a subdirectory of the build directory (not the source tree). (MODULE_CFLAGS): Fix location of emacs-module.h header file. (test_module): Move built library out of the source tree. * test/src/emacs-module-tests.el (mod-test-file): Locate the test module library relative to the running Emacs executable.
-
- 01 Jan, 2018 1 commit
-
-
Paul Eggert authored
Run admin/update-copyright.
-
- 20 Dec, 2017 1 commit
-
-
Glenn Morris authored
-
- 13 Sep, 2017 1 commit
-
-
Paul Eggert authored
Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
-
- 09 Aug, 2017 1 commit
-
-
Eli Zaretskii authored
* src/w32fns.c (syms_of_w32fns) <w32-disable-abort-dialog>: New variable. (emacs_abort): If w32-disable-abort-dialog is non-nil, abort right away, without displaying the Abort dialog, which waits for the user. * test/src/emacs-module-tests.el (module--test-assertion): Run the inferior Emacs with the w32 abort dialog disabled. Expect the status of the aborted Emacs sub-process to be 3 on MS-Windows and 2 on MS-DOS.
-
- 09 Jul, 2017 1 commit
-
-
Glenn Morris authored
* test/src/emacs-module-tests.el (module--test-assertions--load-non-live-object) (module--test-assertions--call-emacs-from-gc): Avoid test failures due to backtraces.
-
- 08 Jul, 2017 1 commit
-
-
Philipp Stephani authored
It's technically possible to write a user pointer finalizer that calls into Emacs module functions. This would be disastrous because it would allow arbitrary Lisp code to run during garbage collection. Therefore extend the module assertions to check for this case. * src/emacs-module.c (module_assert_thread): Also check whether a garbage collection is in progress. * test/data/emacs-module/mod-test.c (invalid_finalizer) (Fmod_test_invalid_finalizer): New test module functions. (emacs_module_init): Register new test function. * test/src/emacs-module-tests.el (module--test-assertion) (module--with-temp-directory): New helper macros. (module--test-assertions--load-non-live-object): Rename existing unit test, use helper macros. (module--test-assertions--call-emacs-from-gc): New unit test.
-
- 12 Jun, 2017 4 commits
-
-
Glenn Morris authored
* test/src/emacs-module-tests.el (module--test-assertions): Rephrase final check to give a more informative failure.
-
Glenn Morris authored
* test/src/emacs-module-tests.el (module--test-assertions): Use a temporary directory to contain any core dumps.
-
Glenn Morris authored
* test/src/emacs-module-tests.el (module--test-assertions): Don't rely on the precise form of an "Abort" message.
-
Philipp Stephani authored
Add a new command-line option '-module-assertions' that users can enable developing or debugging a module. If this option is present, Emacs performs additional checks to verify that modules fulfill their requirements. These checks are expensive and crash Emacs if modules are invalid, so disable them by default. This is a command-line option instead of an ordinary variable because changing it while Emacs is running would cause data structure imbalances. * src/emacs.c (main): New command line option '-module-assertions'. * src/emacs-module.c (module_assert_main_thread) (module_assert_runtime, module_assert_env, module_assert_value): New functions to assert module requirements. (syms_of_module): New uninterned variable 'module-runtimes'. (init_module_assertions, in_main_thread, module_abort): New helper functions. (initialize_environment): Initialize value list. If assertions are enabled, use a heap-allocated environment object. (finalize_environment): Add assertion that environment list is never empty. (finalize_runtime_unwind): Pop module runtime object stack. (value_to_lisp): Assert that the value is valid. (lisp_to_value): Record new value if assertions are enabled. (mark_modules): Mark allocated object list. (MODULE_FUNCTION_BEGIN_NO_CATCH) (module_non_local_exit_check, module_non_local_exit_clear) (module_non_local_exit_get, module_non_local_exit_signal) (module_non_local_exit_throw): Assert thread and environment. (module_get_environment): Assert thread and runtime. (module_make_function, module_funcall, module_intern) (module_funcall, module_make_integer, module_make_float) (module_make_string, module_make_user_ptr, module_vec_get) (funcall_module, Fmodule_load): Adapt callers. (module_make_global_ref): If assertions are enabled, use the global environment to store global values. (module_free_global_ref): Remove value from global value list. * test/Makefile.in (EMACSOPT): Enable module assertions when testing modules. * test/data/emacs-module/mod-test.c (Fmod_test_invalid_store) (Fmod_test_invalid_load): New functions to test module assertions. (emacs_module_init): Bind the new functions. * test/src/emacs-module-tests.el (mod-test-emacs): New constant for the Emacs binary file. (mod-test-file): New constant for the test module file name. (module--test-assertions): New unit test.
-
- 04 Jun, 2017 1 commit
-
-
Philipp Stephani authored
Fix a FIXME in emacs-module.c. Put the printing into print.c, like other types. * src/print.c (print_vectorlike): Add code to print module functions. * src/emacs-module.c (funcall_module): Stop calling 'module_format_fun_env'. Now that module functions are first-class objects, they can be added to signal data directly. (module_handle_signal): Remove now-unused function 'module_format_fun_env'. * test/src/emacs-module-tests.el (mod-test-sum-test): Adapt unit test. * src/eval.c (funcall_lambda): Adapt call to changed signature of 'funcall_module'.
-
- 20 May, 2017 1 commit
-
-
Philipp Stephani authored
Instead of a lambda, create a new type containing all data required to call the function, and support it in the evaluator. Because this type now also needs to store the function documentation, it is too big for Lisp_Misc; use a pseudovector instead. That also has the nice benefit that we don't have to add special support to the garbage collector. Since the new type is user-visible, give it a predicate. Now we can easily support 'help-function-args' and 'func-arity'; add unit tests for these. * src/lisp.h (allocate_module_function, MODULE_FUNCTIONP) (XMODULE_FUNCTION): New pseudovector type 'module function'. * src/eval.c (FUNCTIONP): Also treat module functions as functions. (funcall_lambda, Ffuncall, eval_sub): Add support for calling module functions. (Ffunc_arity): Add support for detecting the arity of module functions. * src/emacs-module.c (module_make_function): Adapt to new structure. Return module function object directly instead of wrapping it in a lambda; remove FIXME. (funcall_module): New function to call module functions. Replaces `internal--module-call' and is called directly from eval.c. (syms_of_module): Remove internal helper function, which is no longer needed. (module_function_arity): New helper function. * src/data.c (Ftype_of): Adapt to new implementation. (Fmodule_function_p, syms_of_data): New user-visible function. Now that module functions are first-class objects, they deserve a predicate. Define it even if not compiled with --enable-modules so that Lisp code doesn't have to check for the function's existence. * src/doc.c (Fdocumentation): Support module functions. * src/print.c (print_object): Adapt to new implementation. * src/alloc.c (mark_object): Specialized garbage collector support is no longer needed. * lisp/help.el (help-function-arglist): Support module functions. While there, simplify the arity calculation by using `func-arity', which does the right thing for all kinds of functions. * test/data/emacs-module/mod-test.c: Amend docstring so we can test the argument list. * test/src/emacs-module-tests.el (mod-test-sum-docstring): Adapt to new docstring. (mod-test-non-local-exit-signal-test): Because `internal--module-call' is gone, the backtrace has changed and no longer leaks the implementation. (module--func-arity): New test for `func-arity'. (module--help-function-arglist): New test for `help-function-arglist'.
-
- 19 May, 2017 1 commit
-
-
Philipp Stephani authored
If dladdr(3) isn't available or didn't work, the printed representation of a module function will not include the file name, but only the address. Make the tests pass in that case. * test/src/emacs-module-tests.el (module-function-object): Fix match for module function printed representation
-
- 06 May, 2017 3 commits
-
-
Eli Zaretskii authored
* test/src/emacs-module-tests.el (module-function-object): Fix thinko in last change.
-
Eli Zaretskii authored
* test/src/emacs-module-tests.el (module-function-object): Port to MS-Windows.
-
Philipp Stephani authored
This resolves a couple of FIXMEs in emacs-module.c. * src/lisp.h (MODULE_FUNCTIONP, XMODULE_FUNCTION): New functions. * src/alloc.c (make_module_function): New function. (mark_object): GC support. * src/data.c (Ftype_of, syms_of_data): Handle module function type. * src/print.c (print_object): Print support for new type. * src/emacs-module.c (module_make_function, Finternal_module_call): Use new module function type, remove FIXMEs. (module_format_fun_env): Adapt and give it external linkage. * test/src/emacs-module-tests.el (module-function-object): Add unit test.
-
- 29 Apr, 2017 1 commit
-
-
Philipp Stephani authored
* test/Makefile.in (ELFILES): Exclude module test if modules aren't configured. (EMACS_TEST_DIRECTORY): Expand test directory so that it's set correctly even if Emacs changes the current directory. ($(srcdir)/src/emacs-module-tests.log) ($(test_module)): Proper dependency tracking for test module. * test/data/emacs-module/Makefile (ROOT): Adapt to new location. Remove 'check' target and EMACS variable, which are no longer necessary. (SO): Change to include period. * test/src/emacs-module-tests.el (mod-test): Use EMACS_TEST_DIRECTORY environment variable to reliably find test data. * configure.ac (HAVE_MODULES, MODULES_SUFFIX): Add necessary substitutions.
-
- 26 Mar, 2017 1 commit
-
-
Philipp Stephani authored
* test.el (mod-test-non-local-exit-signal-test): Compare actual backtrace to expected backtrace.
-
- 01 Jan, 2017 1 commit
-
-
Paul Eggert authored
Run admin/update-copyright.
-