1. 29 Apr, 2017 1 commit
    • Philipp Stephani's avatar
      Integrate module test with normal test suite · bfc0f610
      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.
      bfc0f610
  2. 01 Jan, 2017 1 commit
  3. 10 Mar, 2016 1 commit
    • Paul Eggert's avatar
      Rework C source files to avoid ^( · 7352c6c6
      Paul Eggert authored
      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.
      7352c6c6
  4. 01 Jan, 2016 1 commit
  5. 30 Nov, 2015 2 commits
    • Stefan Monnier's avatar
      Rely on conservative stack scanning to find "emacs_value"s · 3eb93c07
      Stefan Monnier authored
      * 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.
      3eb93c07
    • Paul Eggert's avatar
      Spelling and grammar fixes · 36649e01
      Paul Eggert authored
      36649e01
  6. 24 Nov, 2015 1 commit
  7. 20 Nov, 2015 2 commits
    • Paul Eggert's avatar
      Fix module test to use ptrdiff_t nargs too · 39d13206
      Paul Eggert authored
      * 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.
      39d13206
    • Eli Zaretskii's avatar
      Minor improvements in module test · c0c309e4
      Eli Zaretskii authored
      * 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.
      c0c309e4
  8. 19 Nov, 2015 7 commits
    • Paul Eggert's avatar
      Prefer signed integer types in module code · 92949781
      Paul Eggert authored
      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.
      92949781
    • Paul Eggert's avatar
      Omit ‘const’ on locals · d9b300af
      Paul Eggert authored
      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’.
      d9b300af
    • Paul Eggert's avatar
      Prefer intmax_t to int64_t in module code · 68d58e69
      Paul Eggert authored
      * 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.
      68d58e69
    • Paul Eggert's avatar
      Rename module.c to emacs-module.c, etc. · f2c00259
      Paul Eggert authored
      * src/emacs-module.c: Rename from src/module.c.
      * src/emacs-module.h: Rename from src/module.h.
      All uses changed.
      f2c00259
    • Paul Eggert's avatar
      Style fixes for indenting etc. in module code · c8a972b0
      Paul Eggert authored
      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.
      c8a972b0
    • Paul Eggert's avatar
      Add copyright notices to module code · c8404f48
      Paul Eggert authored
      Put them in the usual format for GNU Emacs copyright notices.
      c8404f48
    • Paul Eggert's avatar
      Rename emacs_module.h to module.h · 80f19fb8
      Paul Eggert authored
      * src/module.h: Rename from src/emacs_module.h.
      All uses changed.
      80f19fb8
  9. 18 Nov, 2015 1 commit
    • Aurélien Aptel's avatar
      Add dynamic module test and helper script · 955e25db
      Aurélien Aptel authored
      
      
      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: default avatarPhilipp Stephani <phst@google.com>
      955e25db