annotate modules/sample/sample.c @ 613:023b83f4e54b
[xemacs-hg @ 2001-06-10 10:42:16 by ben]
------ signal-code changes ------
data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c,
process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h:
use EMACS_SIGNAL everywhere instead of playing preprocessing
games with signal().
s\windowsnt.h, s\mingw32.h, syssignal.h:
Remove mswindows signal code from s+m headers and move to
syssignal.h as one of the five ways of signal handling,
instead of playing preprocessing games.
fileio.c, sysdep.c:
Rename sys_do_signal to qxe_reliable_signal.
signal.c, process-unix.c, profile.c:
Create set_timeout_signal(); use instead of just EMACS_SIGNAL
to establish a signal handler on a timeout signal; this does
special things under Cygwin.
nt.c:
Eliminate term_ntproc(), which is blank; used as a SIGABRT
handler, which was wrong anyway.
nt.c, win32.c:
Move signal code from nt.c to win32.c, since Cygwin needs it
too when dealing with timeout signals.
s\cygwin32.h:
Define CYGWIN_BROKEN_SIGNALS.
------ other changes ------
s\mingw32.h:
Fix problems with NOT_C_CODE being in the wrong place and
excluding defines needed when building Makefile.in.in.
filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c,
unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c,
unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h,
s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h,
s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h,
s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h,
s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h,
s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h,
s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h,
s\usg5-4.h, s\windowsnt.h, s\xenix.h:
Rename 'GNU Emacs' to XEmacs in the copyright and comments.
nas.c:
Stylistic cleanup. Avoid preprocessing games with names such
as play_sound_file.
------ signal-code changes ------
data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c,
process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h:
use EMACS_SIGNAL everywhere instead of playing preprocessing
games with signal().
s\windowsnt.h, s\mingw32.h, syssignal.h:
Remove mswindows signal code from s+m headers and move to
syssignal.h as one of the five ways of signal handling,
instead of playing preprocessing games.
fileio.c, sysdep.c:
Rename sys_do_signal to qxe_reliable_signal.
signal.c, process-unix.c, profile.c:
Create set_timeout_signal(); use instead of just EMACS_SIGNAL
to establish a signal handler on a timeout signal; this does
special things under Cygwin.
nt.c:
Eliminate term_ntproc(), which is blank; used as a SIGABRT
handler, which was wrong anyway.
nt.c, win32.c:
Move signal code from nt.c to win32.c, since Cygwin needs it
too when dealing with timeout signals.
s\cygwin32.h:
Define CYGWIN_BROKEN_SIGNALS.
------ other changes ------
s\mingw32.h:
Fix problems with NOT_C_CODE being in the wrong place and
excluding defines needed when building Makefile.in.in.
filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c,
unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c,
unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h,
s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h,
s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h,
s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h,
s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h,
s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h,
s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h,
s\usg5-4.h, s\windowsnt.h, s\xenix.h:
Rename 'GNU Emacs' to XEmacs in the copyright and comments.
nas.c:
Stylistic cleanup. Avoid preprocessing games with names such
as play_sound_file.
xemacs-faq.texi:
Update sections on Windows and MacOS availability.
alist.el, apropos.el, autoload.el, bytecomp.el, cl-compat.el, cl-extra.el, cl-macs.el, cl-seq.el, cl.el, cmdloop.el, cus-edit.el, derived.el, gpm.el, itimer.el, lisp-mode.el, shadow.el, version.el, wid-browse.el:
Rename 'GNU Emacs' to XEmacs in the copyright. Fix other
references to GNU Emacs that should be XEmacs or just Emacs.
files.el:
Fix warning.
simple.el:
transpose-line-up/down will now move the region up or down by
a line if active.
cvtmail.c, fakemail.c, gnuserv.c, gnuserv.h, gnuslib.c, make-msgfile.c, make-path.c, pop.c, pop.h, profile.c, tcp.c:
Rename 'GNU Emacs' to XEmacs in the copyright.
Fix comments in similar ways.
digest-doc.c, sorted-doc.c:
Fix program and author name to reflect XEmacs.
| author |
ben |
| date |
Sun, 10 Jun 2001 10:42:39 +0000 |
| parents |
abe6d1db359e |
| children |
|
| rev |
line source |
|
388
|
1 /*
|
|
|
2 * Very simple sample module. Illustrates most of the salient features
|
|
|
3 * of Emacs dynamic modules.
|
|
|
4 * (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved.
|
|
|
5 */
|
|
|
6
|
|
|
7 #include <emodules.h>
|
|
|
8
|
|
|
9 /*
|
|
|
10 * This sample introduces three new Lisp objects to the Lisp reader.
|
|
|
11 * The first, a simple boolean value, and the second a string. The
|
|
|
12 * Third is a sample function that simply prints a message.
|
|
|
13 */
|
|
|
14 int sample_bool;
|
|
|
15 Lisp_Object Vsample_string;
|
|
|
16
|
|
|
17 DEFUN ("sample-function", Fsample_function, 0, 0, "", /*
|
|
|
18 This is a sample function loaded dynamically.
|
|
|
19
|
|
|
20 You will notice in the source code for this module that the
|
|
|
21 declaration is identical to internal Emacs functions. This
|
|
|
22 makes it possible to use the exact same code in a dumped
|
|
|
23 version of Emacs.
|
|
|
24 */
|
|
|
25 ())
|
|
|
26 {
|
|
|
27 message ("Eureka! It worked");
|
|
|
28 return Qt;
|
|
|
29 }
|
|
|
30
|
|
|
31 /*
|
|
|
32 * Each dynamically loaded Emacs module is given a name at compile
|
|
|
33 * time. This is a short name, and must be a valid part of a C
|
|
442
|
34 * identifier. This name is used to construct the name of several
|
|
388
|
35 * functions which must appear in the module source code.
|
|
442
|
36 * The first such function, modules_of_XXXX, should load in any dependent
|
|
388
|
37 * modules. This function is optional, and the module will still load if
|
|
|
38 * it is not present in the module.
|
|
|
39 *
|
|
|
40 * The second function, which is NOT optional, is syms_of_XXXX, in which
|
|
|
41 * all functions that the module will be provided are declared. This
|
|
|
42 * function will contain calls to DEFSUBR().
|
|
|
43 *
|
|
|
44 * The third function, which is also NOT optional, is vars_of_XXXX, in
|
|
|
45 * which you declare all variables that the module provides. This
|
|
|
46 * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc.
|
|
|
47 *
|
|
|
48 * When declaring functions and variables in the syms_of_XXXX and
|
|
|
49 * vars_of_XXXX functions, you use the exact same syntax that you
|
|
|
50 * would as if this module were being compiled into the pure Emacs.
|
|
|
51 *
|
|
|
52 * All three of these functions are declared as void functions,
|
|
|
53 * taking no parameters. Since this sample module is called 'sample',
|
|
|
54 * the functions will be named 'modules_of_sample', 'syms_of_sample'
|
|
|
55 * and 'vars_of_sample'.
|
|
|
56 */
|
|
|
57
|
|
|
58 void
|
|
|
59 modules_of_sample()
|
|
|
60 {
|
|
|
61 /*
|
|
|
62 * This function isn't actually required as we will not be loading
|
|
442
|
63 * in any dependent modules, but if we were, we would do something like:
|
|
|
64 * emodules_load ("dependent.ell", "sample2", "1.0.0");
|
|
388
|
65 */
|
|
|
66 }
|
|
|
67
|
|
|
68 void
|
|
|
69 syms_of_sample()
|
|
|
70 {
|
|
|
71 DEFSUBR(Fsample_function);
|
|
|
72 }
|
|
|
73
|
|
|
74 void
|
|
|
75 vars_of_sample()
|
|
|
76 {
|
|
|
77 DEFVAR_LISP ("sample-string", &Vsample_string /*
|
|
|
78 This is a sample string, declared in a dynamic module.
|
|
|
79
|
|
|
80 The syntax and conventions used for all normal Emacs variables
|
|
|
81 apply equally to modules, using an identical syntax.
|
|
|
82 */ );
|
|
|
83
|
|
|
84 DEFVAR_BOOL ("sample-boolean", &sample_bool /*
|
|
|
85 *Sample boolean value, in a dynamic module.
|
|
|
86
|
|
|
87 This is a user-settable variable, as indicated by the *
|
|
|
88 as the first character of the description. Declared in
|
|
|
89 a module exactly as it would be internally in Emacs.
|
|
|
90 */ );
|
|
|
91 }
|
|
|
92
|