aboutsummaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-10-13 06:51:06 +0200
committerLars Ingebrigtsen2020-10-13 06:51:06 +0200
commit12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3 (patch)
treec68e82a585d8a760b569b536d8951e18166a9d9d /test/data
parent45cb0403deeba1cc121147b1884e7fea6cd15338 (diff)
downloademacs-12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3.tar.gz
emacs-12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3.zip
Allow creating unibyte strings from Emacs modules
* doc/lispref/internals.texi (Module Values): Document make_unibyte_string (bug#34873). * src/emacs-module.c (module_make_unibyte_string): New function. (initialize_environment): Export it. * src/module-env-25.h: Define it. * test/data/emacs-module/mod-test.c (Fmod_test_return_unibyte): Test it. * test/src/emacs-module-tests.el (module/unibyte): Test it.
Diffstat (limited to 'test/data')
-rw-r--r--test/data/emacs-module/mod-test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c
index da298d4e398..258a679b207 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -268,6 +268,16 @@ Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
268} 268}
269 269
270 270
271/* Return a unibyte string. */
272static emacs_value
273Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
274 void *data)
275{
276 const char *string = "foo\x00zot";
277 return env->make_unibyte_string (env, string, 7);
278}
279
280
271/* Embedded pointers in lisp objects. */ 281/* Embedded pointers in lisp objects. */
272 282
273/* C struct (pointer to) that will be embedded. */ 283/* C struct (pointer to) that will be embedded. */
@@ -750,6 +760,7 @@ emacs_module_init (struct emacs_runtime *ert)
750 DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, 760 DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL,
751 NULL); 761 NULL);
752 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); 762 DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL);
763 DEFUN ("mod-test-return-unibyte", Fmod_test_return_unibyte, 0, 0, NULL, NULL);
753 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); 764 DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL);
754 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); 765 DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL);
755 DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); 766 DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL);