1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
Commit Graph

34 Commits

Author SHA1 Message Date
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Syohei YOSHIDA
de68f337e3 modhelp.py: Support Python 3 (Bug#24954)
* modules/modhelp.py: 'print' statement was removed in Python
3.  'print' function should be used instead of 'print' statement.
2017-12-03 10:04:18 -05:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
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.
2017-09-13 15:54:37 -07:00
Philipp Stephani
bfc0f610ba Integrate module test with normal test suite
* 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.
2017-04-29 14:38:53 +02:00
Philipp Stephani
05bfebfc91 Add check for expected backtrace in module calls.
* test.el (mod-test-non-local-exit-signal-test): Compare actual
  backtrace to expected backtrace.
2017-03-26 22:17:34 +02:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Paul Eggert
1228055b32 Fix template for module functions
Reported by Syohei YOSHIDA (Bug#24932).
* modules/modhelp.py (TEMPLATES):
c_func’s 2nd arg is ptrdiff_t, not int.
2016-11-28 07:49:28 -08:00
Paul Eggert
7352c6c695 Rework C source files to avoid ^(
Work around Bug#22884 by rewording comments and strings to avoid ‘(’
at the start of a line unless it starts a function.  This change
is a short-term hack; in the longer run we plan to fix cc-mode’s
performance for C files that have ‘(’ at the start of a line in a
comment or string.
2016-03-10 07:59:19 -08:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Paul Eggert
ace6c2530e Port mod-test to 32-bit Emacs --without-wide-int
* modules/mod-test/test.el (mod-test-sum-test):
Bring back the 2**29 tests, but port them to 32-bit Emacs
--without-wide-int.
2015-12-06 14:55:16 -08:00
Paul Eggert
2b3f5de2b3 Port mod-test to x86-64 GNU/Linux running 32-bit
* modules/mod-test/test.el (mod-test-sum-test):
Don’t attempt to match descriptions to operating systems.
It didn’t work on Fedora x86-64 running a 32-bit executable,
and it’s not worth the trouble anyway.
Port to 32-bit platforms by removing an assumption about
fixnum widths.
2015-12-06 09:09:58 -08:00
Eli Zaretskii
36dbe6fc3e More emacs-module.c fixes for wide ints
* src/emacs-module.c (value_to_lisp) [WIDE_EMACS_INT]: Use
unsigned data types to manipulate pointers, to avoid sign
extension coming after us with a vengeance.

* modules/mod-test/test.el (mod-test-sum-test): Add tests for
Emacs with wide ints that verify integer values near the critical
value that requires us to switch to a cons cell.
2015-12-02 16:06:01 +02:00
Eli Zaretskii
bdebeb77a0 Fix emacs-module.c for wide ints
* src/emacs-module.c (lisp_to_value): Compare the produced value
with the original Lisp object, not with the one potentially
converted into a Lisp_Cons.  Fixes assertion violations when
working with integers larger than fit into a 32-bit value.

* modules/mod-test/test.el (mod-test-sum-test): Add tests for
large integers, to test --with-wide-int.
2015-12-01 20:34:12 +02:00
Stefan Monnier
3eb93c07f7 Rely on conservative stack scanning to find "emacs_value"s
* src/emacs-module.c (struct emacs_value_tag)
(struct emacs_value_frame, struct emacs_value_storage): Remove.
(value_frame_size): Remove constant.
(struct emacs_env_private): Use Lisp_Object for non_local_exit info.
(lisp_to_value): Remove first arg.
(module_nil): New constant.
Use it instead of NULL when returning an emacs_value.
(module_make_function): Adjust to new calling convention of
Qinternal_module_call.
(DEFUN): Receive args in an array rather than a list.
Use SAFE_ALLOCA rather than xnmalloc.  Skip the lisp_to_value loop when
we don't have WIDE_EMACS_INT.  Adjust to new type of non_local_exit info.
(module_non_local_exit_signal_1, module_non_local_exit_throw_1):
Adjust to new type of non_local_exit info.
(ltv_mark) [WIDE_EMACS_INT]: New constant.
(value_to_lisp, lisp_to_value): Rewrite.
(initialize_frame, initialize_storage, finalize_storage): Remove functions.
(allocate_emacs_value): Remove function.
(mark_modules): Gut it.
(initialize_environment): Don't initialize storage any more.
Keep the actual env object on Vmodule_environments.
(finalize_environment): Don't finalize storage any more.
(syms_of_module): Initialize ltv_mark and module_nil.

* src/emacs-module.h (emacs_value): Make it more clear that this type
is really opaque, including the fact that NULL may not be valid.

* modules/mod-test/mod-test.c (Fmod_test_signal, Fmod_test_throw):
Don't assume that NULL is a valid emacs_value.
2015-11-30 14:34:42 -05:00
Paul Eggert
36649e0150 Spelling and grammar fixes 2015-11-29 21:52:17 -08:00
Ken Brown
ff21f455b7 Update mod-test-sum-test
* modules/mod-test/test.el (mod-test-sum-test): Update to
accommodate the lack of dladdr on Cygwin.
2015-11-29 11:23:32 -05:00
Ken Brown
0c517aa613 ; * modules/mod-test/Makefile: Fix typo. 2015-11-28 20:31:17 -05:00
Eli Zaretskii
8dcdca346f Add module tests for wrong-type-argument
* modules/mod-test/test.el (mod-test-sum-test): Add tests for
wrong-type-argument.
2015-11-27 13:11:00 +02:00
Eli Zaretskii
33ec2ff0f8 Add one more mod-test test
* modules/mod-test/test.el (mod-test-sum-test): Test the error
signaled when the function is invoked with a wrong number of
arguments.
2015-11-24 21:13:46 +02:00
Philipp Stephani
298b2b3f35 * modules/mod-test/mod-test.c (Fmod_test_sum): Verify there are 2 args. 2015-11-24 21:08:22 +02:00
Paul Eggert
39d13206f3 Fix module test to use ptrdiff_t nargs too
* modules/mod-test/mod-test.c (Fmod_test_return_t)
(Fmod_test_sum, Fmod_test_signal, Fmod_test_throw)
(Fmod_test_non_local_exit_funcall, Fmod_test_globref_make)
(Fmod_test_string_a_to_b, Fmod_test_userptr_make)
(Fmod_test_userptr_get, Fmod_test_vector_fill)
(Fmod_test_vector_eq): Arg counts are ptrdiff_t, not int.
(finalizer): Remove; no longer used.
2015-11-20 12:18:17 -08:00
Eli Zaretskii
c0c309e4cd Minor improvements in module test
* modules/mod-test/mod-test.c: Include stdlib.h, to avoid warnings
about missing prototype of malloc.
* modules/mod-test/Makefile (CFLAGS): Add -std=gnu99, to avoid
compiler warnings.
2015-11-20 13:37:25 +02:00
Paul Eggert
92949781eb Prefer signed integer types in module code
Generally speaking, at the C level the Emacs source code prefers
signed types like ‘ptrdiff_t’ to unsigned types like ‘size_t’,
partly to avoid the usual signedness confusion when comparing values.
Change the module API to follow this convention.
Use ‘int’ for small values that can’t exceed INT_MAX.
* modules/mod-test/mod-test.c (Fmod_test_globref_make)
(Fmod_test_string_a_to_b, Fmod_test_vector_fill)
(Fmod_test_vector_eq):
* src/emacs-module.c (struct emacs_value_frame)
(module_make_global_ref, module_free_global_ref)
(module_copy_string_contents, module_make_string)
(module_vec_set, module_vec_get, module_vec_size):
* src/emacs-module.h (struct emacs_runtime, struct emacs_env_25):
* src/lread.c (suffix_p):
Prefer signed to unsigned integer types.
2015-11-19 15:01:49 -08:00
Paul Eggert
d9b300af5c Omit ‘const’ on locals
Remove ‘const’ qualifier from locals that were newly added.
We don’t normally bother declaring locals with ‘const’ even
though they are not modified, for the same reason we don’t
bother declaring them with ‘register’ even though their
addresses are not taken; the advantage in compile-time
checking isn’t worth the loss of readability.
* modules/mod-test/mod-test.c (Fmod_test_non_local_exit_funcall)
(Fmod_test_vector_fill, Fmod_test_vector_eq):
* src/emacs-module.c (MODULE_SETJMP_1)
(module_make_global_ref, module_free_global_ref)
(module_non_local_exit_get, module_make_function)
(module_extract_integer, module_extract_float)
(module_get_user_ptr, module_set_user_ptr)
(module_get_user_finalizer, module_set_user_finalizer)
(module_vec_get, Fmodule_call)
(module_non_local_exit_signal_1)
(module_non_local_exit_throw_1, lisp_to_value)
(finalize_storage, allocate_emacs_value, mark_modules)
(module_handle_signal, module_handle_throw)
(module_format_fun_env):
* src/eval.c (push_handler, push_handler_nosignal)
(init_handler):
* src/lread.c (suffix_p):
Omit unnecessary ‘const’.
2015-11-19 14:25:17 -08:00
Paul Eggert
68d58e6973 Prefer intmax_t to int64_t in module code
* modules/mod-test/mod-test.c (sum, Fmod_test_sum):
* src/emacs-module.c (module_extract_integer)
(module_make_integer):
* src/emacs-module.h (struct emacs_env_25):
Prefer intmax_t to int64_t.  This doesn’t change the generated
code on any of the machines Emacs currently ports to, but it’s
at least in theory more future-proof as C99 doesn’t guarantee
that int64_t exists.
2015-11-19 14:04:00 -08:00
Paul Eggert
f2c0025921 Rename module.c to emacs-module.c, etc.
* src/emacs-module.c: Rename from src/module.c.
* src/emacs-module.h: Rename from src/module.h.
All uses changed.
2015-11-19 13:51:24 -08:00
Paul Eggert
c8a972b0c3 Style fixes for indenting etc. in module code
This is mostly indenting and spacing changes.  Also, remove
some unnecessary static decls instead of bothering to reindent them.
* src/module.h (EMACS_EXTERN_C_BEGIN): Remove, and do this inline,
as most other Emacs files do for this sort of thing.
2015-11-19 11:32:21 -08:00
Eli Zaretskii
7cd728c813 Minor improvements in modules testing Makefile
* modules/mod-test/Makefile (EMACS, SO): New variables.
(CFLAGS): When SO = dll, don't use -fPIC.
(check): New target, runs the test.
2015-11-19 19:49:29 +02:00
Paul Eggert
ca3bc790a7 Migrate modules/.gitignore into .gitignore
* .gitignore: Add former contents of modules/.gitignore.
* modules/.gitignore: Remove.
2015-11-19 08:21:41 -08:00
Paul Eggert
c8404f48a3 Add copyright notices to module code
Put them in the usual format for GNU Emacs copyright notices.
2015-11-19 08:14:51 -08:00
Paul Eggert
80f19fb898 Rename emacs_module.h to module.h
* src/module.h: Rename from src/emacs_module.h.
All uses changed.
2015-11-19 07:54:33 -08:00
Aurélien Aptel
955e25dbcd Add dynamic module test and helper script
Add 'modhelp.py' script (python2) to automate module testing and
module generation.

To build and test all modules in the modules/ dir
  $ ./modhelp.py test

To generate a module from template code (good starting point)
  $ ./modhelp init mynewtestmodule

See the script -h option for more documentation.

* modules/modhelp.py: New module helper script.
* modules/mod-test/Makefile: New file. Makefile for the test module.
* modules/mod-test/mod-test.c: New file. Test module source file.
* modules/mod-test/test.el: New file. ert test suite for the test module.
* modules/.gitignore: New file. Local .gitignore file.

Co-authored-by: Philipp Stephani <phst@google.com>
2015-11-18 14:24:35 -05:00