Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
b6d8d34a
Commit
b6d8d34a
authored
Apr 24, 2019
by
Philipp Stephani
Browse files
* doc/lispref/internals.texi (Module Values): Add a GMP example
parent
c4bacb12
Pipeline
#1437
failed with stage
in 6 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
doc/lispref/internals.texi
doc/lispref/internals.texi
+25
-0
No files found.
doc/lispref/internals.texi
View file @
b6d8d34a
...
...
@@ -1543,6 +1543,31 @@ integral object. After you have finished using
or similar.
@end deftypefn
The following example uses GMP to calculate the next probable prime
after a given integer:
@example
#include <assert.h>
#include <gmp.h>
#define EMACS_MODULE_GMP
#include <emacs-module.h>
static emacs_value
next_prime (emacs_env *env, ptrdiff_t nargs, emacs_value *args,
void *data)
@{
assert (nargs == 1);
emacs_mpz p;
mpz_init (p.value);
env->extract_big_integer (env, args[0], &p);
mpz_nextprime (p.value, p.value);
emacs_value result = env->make_big_integer (env, &p);
mpz_clear (p.value);
return result;
@}
@end example
The @acronym{API} does not provide functions to manipulate Lisp data
structures, for example, create lists with @code{cons} and @code{list}
(@pxref{Building Lists}), extract list members with @code{car} and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment