[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/aptel/dynamic-modules-rc3 0526616 04/25: add sampl
From: |
Teodor Zlatanov |
Subject: |
[Emacs-diffs] feature/aptel/dynamic-modules-rc3 0526616 04/25: add sample module `fmod'. |
Date: |
Wed, 04 Feb 2015 22:56:10 +0000 |
branch: feature/aptel/dynamic-modules-rc3
commit 0526616b92d7cd88fbfb27d1b0846be8358d1222
Author: Aurélien Aptel <address@hidden>
Commit: Aurélien Aptel <address@hidden>
add sample module `fmod'.
---
modules/Makefile | 11 +++++++++++
modules/fmod.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/modules/Makefile b/modules/Makefile
new file mode 100644
index 0000000..09aab27
--- /dev/null
+++ b/modules/Makefile
@@ -0,0 +1,11 @@
+
+all: fmod.so fmod.doc
+
+%.so: %.o
+ gcc -shared -o $@ $<
+
+%.o: %.c
+ gcc -ggdb3 -Wall -I../src -I../lib -fPIC -c $<
+
+%.doc: %.c
+ ../lib-src/make-docfile $< > $@
diff --git a/modules/fmod.c b/modules/fmod.c
new file mode 100644
index 0000000..4f591b8
--- /dev/null
+++ b/modules/fmod.c
@@ -0,0 +1,53 @@
+#include <config.h>
+#include <lisp.h>
+
+#include <math.h>
+
+/* emacs checks for this symbol before running the module */
+
+int plugin_is_GPL_compatible;
+
+/* define a new lisp function */
+
+EXFUN (Ffmod, 2);
+DEFUN ("fmod", Ffmod, Sfmod, 2, 2, 0,
+ doc: "Returns the floating-point remainder of NUMER/DENOM")
+ (Lisp_Object numer, Lisp_Object denom)
+{
+ return make_float (fmod (extract_float (numer), extract_float (denom)));
+}
+
+EXFUN (Ffmod_test1, 0);
+DEFUN ("fmod-test1", Ffmod_test1, Sfmod_test1, 0, 0, 0,
+ doc: "Return 1")
+ (void)
+{
+ return make_float (1.);
+}
+
+EXFUN (Ffmod_test2, 0);
+DEFUN ("fmod-test2", Ffmod_test2, Sfmod_test2, 0, 0, 0,
+ doc: "Return 2")
+ (void)
+{
+ return make_float (2.);
+}
+
+
+EXFUN (Ffmod_test3, 0);
+DEFUN ("fmod-test3", Ffmod_test3, Sfmod_test3, 0, 0, 0,
+ doc: "Return 3")
+ (void)
+{
+ return make_float (3.);
+}
+
+/* entry point of the module */
+
+void init ()
+{
+ defsubr (&Sfmod);
+ defsubr (&Sfmod_test1);
+ defsubr (&Sfmod_test2);
+ defsubr (&Sfmod_test3);
+}
- [Emacs-diffs] branch feature/aptel/dynamic-modules-rc3 created (now 9a1d734), Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 6478a32 03/25: intern literal strings as regular string., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 0526616 04/25: add sample module `fmod'.,
Teodor Zlatanov <=
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 19705b8 06/25: alloc.c: protect doc field from GC., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 fc0f6ec 02/25: add `load-module' function to emacs lisp., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 0cfb066 07/25: doc.c: use DOC format sanity checks instead of bytecompiled checks on module doc files., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 79e2c28 05/25: change Subr doc field from char* to Lisp_Object., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 b8286d2 08/25: doc.c: don't prefix doc path by ../etc/ for modules, Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 1b98be3 09/25: move fmod module in modules/fmod/., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 772cb16 01/25: add libltdl configure option/dependency., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 bfe16af 10/25: new module: opaque, Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 89c8287 11/25: opaque: add comments., Teodor Zlatanov, 2015/02/04
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 9330ca6 12/25: new module: elisp, Teodor Zlatanov, 2015/02/04