diff options
Diffstat (limited to 'test/data')
| -rw-r--r-- | test/data/emacs-module/mod-test.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index dbdbfecfe6a..85a7f28e50d 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c | |||
| @@ -27,8 +27,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 27 | #include <string.h> | 27 | #include <string.h> |
| 28 | #include <time.h> | 28 | #include <time.h> |
| 29 | 29 | ||
| 30 | #define EMACS_MODULE_GMP | ||
| 30 | #include <emacs-module.h> | 31 | #include <emacs-module.h> |
| 31 | 32 | ||
| 33 | #include <gmp.h> | ||
| 34 | |||
| 32 | #include "timespec.h" | 35 | #include "timespec.h" |
| 33 | 36 | ||
| 34 | int plugin_is_GPL_compatible; | 37 | int plugin_is_GPL_compatible; |
| @@ -378,6 +381,21 @@ Fmod_test_add_nanosecond (emacs_env *env, ptrdiff_t nargs, emacs_value *args, | |||
| 378 | return env->make_time (env, time); | 381 | return env->make_time (env, time); |
| 379 | } | 382 | } |
| 380 | 383 | ||
| 384 | static emacs_value | ||
| 385 | Fmod_test_double (emacs_env *env, ptrdiff_t nargs, emacs_value *args, | ||
| 386 | void *data) | ||
| 387 | { | ||
| 388 | assert (nargs == 1); | ||
| 389 | emacs_value arg = args[0]; | ||
| 390 | struct emacs_mpz value; | ||
| 391 | mpz_init (value.value); | ||
| 392 | env->extract_big_integer (env, arg, &value); | ||
| 393 | mpz_mul_ui (value.value, value.value, 2); | ||
| 394 | emacs_value result = env->make_big_integer (env, &value); | ||
| 395 | mpz_clear (value.value); | ||
| 396 | return result; | ||
| 397 | } | ||
| 398 | |||
| 381 | /* Lisp utilities for easier readability (simple wrappers). */ | 399 | /* Lisp utilities for easier readability (simple wrappers). */ |
| 382 | 400 | ||
| 383 | /* Provide FEATURE to Emacs. */ | 401 | /* Provide FEATURE to Emacs. */ |
| @@ -447,6 +465,7 @@ emacs_module_init (struct emacs_runtime *ert) | |||
| 447 | NULL, NULL); | 465 | NULL, NULL); |
| 448 | DEFUN ("mod-test-sleep-until", Fmod_test_sleep_until, 2, 2, NULL, NULL); | 466 | DEFUN ("mod-test-sleep-until", Fmod_test_sleep_until, 2, 2, NULL, NULL); |
| 449 | DEFUN ("mod-test-add-nanosecond", Fmod_test_add_nanosecond, 1, 1, NULL, NULL); | 467 | DEFUN ("mod-test-add-nanosecond", Fmod_test_add_nanosecond, 1, 1, NULL, NULL); |
| 468 | DEFUN ("mod-test-double", Fmod_test_double, 1, 1, NULL, NULL); | ||
| 450 | 469 | ||
| 451 | #undef DEFUN | 470 | #undef DEFUN |
| 452 | 471 | ||