* Re-introduces the unused member "documentation" of struct scm_subr_entry.
[bpt/guile.git] / HACKING
CommitLineData
b0749d03
MV
1Hacking It Yourself ==================================================
2
3As distributed, Guile needs only an ANSI C compiler and a Unix system
4to compile. However, Guile's makefiles, configuration scripts, and a
5few other files are automatically generated, not written by hand. If
6you want to make changes to the system (which we encourage!) you will
7find it helpful to have the tools we use to develop Guile. They
8are the following:
9
10Autoconf 2.13 --- a system for automatically generating `configure'
11 scripts from templates which list the non-portable features a
12 program would like to use. Available in
13 "ftp://ftp.gnu.org/pub/gnu/autoconf"
14
15Automake 1.4 --- a system for automatically generating Makefiles that
16 conform to the (rather Byzantine) GNU coding standards. The
17 nice thing is that it takes care of hairy targets like 'make
18 dist' and 'make distclean', and automatically generates
19 Makefile dependencies. Automake is available in
20 "ftp://ftp.gnu.org/pub/gnu/automake"
21
22 Before using automake, you may need to copy `threads.m4' and
23 `guile.m4' from the top directory of the Guile core disty to
24 `/usr/local/share/aclocal.
25
f43aac9a 26libtool 1.3.5 --- a system for managing the zillion hairy options needed
b0749d03
MV
27 on various systems to produce shared libraries. Available in
28 "ftp://ftp.gnu.org/pub/gnu/libtool"
29
30You are lost in a little maze of automatically generated files, all
31different.
32>
33
795b4217 34
0822a9c1
JB
35Contributing Your Changes ============================================
36
37- If you have put together a change that meets the coding standards
38described below, we encourage you to submit it to Guile. The best
ee2bf8b8 39place to post it is guile-devel@gnu.org. Please don't send it
c5ee0952
JB
40directly to me; I often don't have time to look things over. If you
41have tested your change, then you don't need to be shy.
0822a9c1
JB
42
43- Please submit patches using either context or unified diffs (diff -c
44or diff -u). Don't include a patch for ChangeLog; such patches don't
45apply cleanly, since we've probably changed the top of ChangeLog too.
46Instead, provide the unaltered text at the top of your patch.
47
48Please don't include patches for generated files like configure,
49aclocal.m4, or any Makefile.in. Such patches are often large, and
50we're just going to regenerate those files anyway.
51
52
d2bd3d8d
JB
53CVS conventions ======================================================
54
eb4194d6 55- We use CVS to manage the Guile sources. The repository lives on
ee2bf8b8 56subversions.gnu.org, in /cvs; you will need an
aa31443a 57account on that machine to access the repository. Also, for security
ee2bf8b8 58reasons, subversions presently only supports CVS connections via the SSH
aa31443a
JB
59protocol, so you must first install the SSH client. Then, you should
60set your CVS_RSH environment variable to ssh, and use the following as
61your CVS root:
eb4194d6 62
ee2bf8b8 63 :ext:USER@subversions.gnu.org:/cvs
eb4194d6
JB
64
65Either set your CVSROOT environment variable to that, or give it as
66the value of the global -d option to CVS when you check out a working
67directory.
68
848f2a01 69For more information on SSH, see http://www.cs.hut.fi/ssh.
eb4194d6
JB
70
71The Guile sources live in several modules:
72
73 - guile-core --- the interpreter, QuickThreads, and ice-9
e19268af
JB
74 - guile-doc --- documentation in progress. When complete, this will
75 be incorporated into guile-core.
eb4194d6 76 - guile-tcltk --- the Guile/Tk interface
b1f4ddc1 77 - guile-tk --- the new Guile/Tk interface, based on STk's modified Tk
eb4194d6
JB
78 - guile-rgx-ctax --- the Guile/Rx interface, and the ctax implementation
79 - guile-scsh --- the port of SCSH to guile, talk to Gary Houston
b1f4ddc1 80 - guile-www --- A Guile module for making HTTP requests.
eb4194d6 81
afdfe3f4
JB
82There is a mailing list for CVS commit messages; see README for details.
83
b5f69988
GB
84- We check Makefile.am and configure.in files into CVS, but the
85"autogen.sh" script must be run from the top-level to generate the
86actual "configure" script that then must be run to create the various
87Makefile-s to build guile. The general rule is that you should be able
88to check out a working directory of Guile from CVS, and then type
294a61d3
MV
89"./autogen.sh", then "configure", and finally "make". No
90automatically generated files should be checked into the CVS
91repository.
92
93- The .cvsignore file is contained in the repository, to provide a
94reasonable list of auto-generated files that should not be checked in.
95This, however, prohibits one from having local additions to the
96.cvsignore file (yes, you can modify it and never check it in, but
97that doesn't seem to be a good solution to me). To get around this
98problem, you might want to patch your cvs program so that it uses a
99.cvsignore-local file (say) instead of the one from the repository. A
100patch for this can be found at the very end of this file.
350294b1 101
d4c83f63
JB
102- (Automake 1.4 only) Be sure to run automake at the top of the tree
103with no arguments. Do not use `automake Makefile' to regenerate
104specific Makefile.in files, and do not trust the Makefile rules to
105rebuild them when they are out of date. Automake 1.4 will add
106extraneous rules to the top-level Makefile if you specify specific
107Makefiles to rebuild on the command line. Running the command
108`autoreconf --force' should take care of everything correctly.
109
795b4217
JB
110- Make sure your changes compile and work, at least on your own
111machine, before checking them into the main branch of the Guile
112repository. If you really need to check in untested changes, make a
113branch.
114
d2bd3d8d
JB
115- Include each log entry in both the ChangeLog and in the CVS logs.
116If you're using Emacs, the pcl-cvs interface to CVS has features to
117make this easier; it checks the ChangeLog, and generates good default
118CVS log entries from that.
119
120
121Coding standards =====================================================
122
b80e8a60
MD
123- Before contributing larger amounts of code to Guile, please read the
124documents in `guile-core/devel/policy' in the CVS source tree.
125
d2bd3d8d
JB
126- As for any part of Project GNU, changes to Guile should follow the
127GNU coding standards. The standards are available via anonymous FTP
128from prep.ai.mit.edu, as /pub/gnu/standards/standards.texi and
129make-stds.texi.
130
99be3450
JB
131- The Guile tree should compile without warnings under the following
132GCC switches, which are the default in the current configure script:
ee2bf8b8
MV
133 -O2 -Wall -Wpointer-arith -Wmissing-prototypes The only warnings
134which can be tolerated are those about variables being clobbered by
135longjmp/vfork in eval.c. The variables in question are critical to
136the interpreter's performance; as far as I can tell, it is
137difficult/annoying to avoid these warnings without slowing the system
138down substantially. (If you can figure out a good fix, I'd be happy
139to see it.)
99be3450 140
d043e0bb
JB
141Note that the warnings generated vary from one version of GCC to the
142next, and from one architecture to the next (apparently). To provide
143a concrete common standard, Guile should compile without warnings from
18fa97f8 144GCC 2.7.2.3 in a Red Hat 5.2 i386 Linux machine. Furthermore, each
d043e0bb
JB
145developer should pursue any additional warnings noted by on their
146compiler. This means that people using more stringent compilers will
147have more work to do, and assures that everyone won't switch to the
41d368d9 148most lenient compiler they can find. :)
d043e0bb 149
afdfe3f4
JB
150Note also that EGCS (as of November 3 1998) doesn't handle the
151`noreturn' attribute properly, so it doesn't understand that functions
152like scm_error won't return. This may lead to some silly warnings
153about uninitialized variables. You should look into these warnings to
154make sure they are indeed spurious, but you needn't correct warnings
155caused by this EGCS bug.
156
0822a9c1
JB
157- If you add code which uses functions or other features that are not
158entirely portable, please make sure the rest of Guile will still
159function properly on systems where they are missing. This usually
160entails adding a test to configure.in, and then adding #ifdefs to your
161code to disable it if the system's features are missing.
afdfe3f4 162
f2f551af
MD
163- The normal way of removing a function, macro or variable is to mark
164it as "deprecated", keep it for a while, and remove it in a later
165release. If a function or macro is marked as "deprecated" it
166indicates that people shouldn't use it in new programs, and should try
167to remove it in old. Make sure that an alternative exists unless it
168is our purpose to remove functionality. Don't deprecate definitions
169if it is unclear when they will be removed. (This is to ensure that a
170valid way of implementing some functionality always exists.)
171
ee2bf8b8 172When deprecating a definition, always follow this procedure:
f2f551af
MD
173
1741. Mark the definition using
175
176#if (SCM_DEBUG_DEPRECATED == 0)
177...
178#endif
179
1802. Write a comment at the definition explaining how a programmer
181can manage without the deprecated definition.
182
1833. Add an entry that the definition has been deprecated in NEWS
184
ee2bf8b8 1854. At the top of RELEASE, there is a list of releases with reminders
f2f551af
MD
186about what to do at each release. Add a reminder about the removal of
187the deprecated defintion at the appropriate release.
188
795b4217
JB
189- When you make a user-visible change (i.e. one that should be
190documented, and appear in NEWS, put an asterisk in column zero of the
191start of the ChangeLog entry, like so:
192
193Sat Aug 3 01:27:14 1996 Gary Houston <ghouston@actrix.gen.nz>
194
195* * fports.c (scm_open_file): don't return #f, throw error.
196
fa3f45cc
JB
197When you've written a NEWS entry and updated the documentation, go
198ahead and remove the asterisk. I will use the asterisks to find and
199document changes that haven't been dealt with before a release.
200
d49a7907
JB
201- Please write log entries for functions written in C under the
202functions' C names, and write log entries for functions written in
203Scheme under the functions' Scheme names. Please don't do this:
204
205 * procs.c, procs.h (procedure-documentation): Moved from eval.c.
206
207Entries like this make it harder to search the ChangeLogs, because you
afdfe3f4
JB
208can never tell which name the entry will refer to. Instead, write this:
209
210 * procs.c, procs.h (scm_procedure_documentation): Moved from eval.c.
d49a7907 211
4085a3da
JB
212Changes like adding this line are special:
213
3243bcc0 214 SCM_PROC (s_map_in_order, "map-in-order", 2, 0, 1, scm_map);
4085a3da
JB
215
216Since the change here is about the name itself --- we're adding a new
217alias for scm_map that guarantees the order in which we process list
218elements, but we're not changing scm_map at all --- it's appropriate
219to use the Scheme name in the log entry.
220
30d14d55
JB
221- There's no need to keep a change log for documentation files. This
222is because documentation is not susceptible to bugs that are hard to
223fix. Documentation does not consist of parts that must interact in a
224precisely engineered fashion; to correct an error, you need not know
225the history of the erroneous passage. (This is copied from the GNU
226coding standards.)
227
795b4217
JB
228- Make sure you have papers from people before integrating their
229changes or contributions. This is very frustrating, but very
230important to do right. From maintain.texi, "Information for
231Maintainers of GNU Software":
232
233 When incorporating changes from other people, make sure to follow the
234 correct procedures. Doing this ensures that the FSF has the legal
235 right to distribute and defend GNU software.
236
237 For the sake of registering the copyright on later versions ofthe
238 software you need to keep track of each person who makes significant
239 changes. A change of ten lines or so, or a few such changes, in a
240 large program is not significant.
241
242 *Before* incorporating significant changes, make sure that the person
243 has signed copyright papers, and that the Free Software Foundation has
244 received them.
245
246If you receive contributions you want to use from someone, let me know
247and I'll take care of the administrivia. Put the contributions aside
248until we have the necessary papers.
249
fa3f45cc
JB
250- When you make substantial changes to a file, add the current year to
251the list of years in the copyright notice at the top of the file.
795b4217 252
d2bd3d8d
JB
253
254Helpful hints ========================================================
255
f84f77f5
JB
256- [From Mikael Djurfeldt] When working on the Guile internals, it is
257quite often practical to implement a scheme-level procedure which
258helps you examine the feature you're working on.
259
260Examples of such procedures are: pt-size, debug-hand and
261current-pstate.
262
263I've now put #ifdef GUILE_DEBUG around all such procedures, so that
264they are not compiled into the "normal" Guile library. Please do the
265same when you add new procedures/C functions for debugging purpose.
266
267You can define the GUILE_DEBUG flag by passing --enable-guile-debug to
268the configure script.
269
52591c80
JB
270- You'll see uses of the macro SCM_P scattered throughout the code;
271those are vestiges of a time when Guile was meant to compile on
272pre-ANSI compilers. Guile now requires ANSI C, so when you write new
273functions, feel free to use ANSI declarations, and please provide
1cf84ea5 274prototypes for everything. You don't need to use SCM_P in new code.
52591c80 275
795b4217 276
7e2cb69c 277Jim Blandy, and others
294a61d3
MV
278
279
280Patches ===========================================================
281
282This one makes cvs-1.10 consider the file $CVSDOTIGNORE instead of
283.cvsignore when that environment variable is set.
284
285=== patch start ===
286diff -r -u cvs-1.10/src/cvs.h cvs-1.10.ignore-hack/src/cvs.h
287--- cvs-1.10/src/cvs.h Mon Jul 27 04:54:11 1998
288+++ cvs-1.10.ignore-hack/src/cvs.h Sun Jan 23 12:58:09 2000
289@@ -516,7 +516,7 @@
290
291 extern int ign_name PROTO ((char *name));
292 void ign_add PROTO((char *ign, int hold));
293-void ign_add_file PROTO((char *file, int hold));
294+int ign_add_file PROTO((char *file, int hold));
295 void ign_setup PROTO((void));
296 void ign_dir_add PROTO((char *name));
297 int ignore_directory PROTO((char *name));
298diff -r -u cvs-1.10/src/ignore.c cvs-1.10.ignore-hack/src/ignore.c
299--- cvs-1.10/src/ignore.c Mon Sep 8 01:04:15 1997
300+++ cvs-1.10.ignore-hack/src/ignore.c Sun Jan 23 12:57:50 2000
301@@ -99,9 +99,9 @@
302 /*
303 * Open a file and read lines, feeding each line to a line parser. Arrange
304 * for keeping a temporary list of wildcards at the end, if the "hold"
305- * argument is set.
306+ * argument is set. Return true when the file exists and has been handled.
307 */
308-void
309+int
310 ign_add_file (file, hold)
311 char *file;
312 int hold;
313@@ -149,8 +149,8 @@
314 if (fp == NULL)
315 {
316 if (! existence_error (errno))
317- error (0, errno, "cannot open %s", file);
318- return;
319+ error (0, errno, "cannot open %s", file);
320+ return 0;
321 }
322 while (getline (&line, &line_allocated, fp) >= 0)
323 ign_add (line, hold);
324@@ -159,6 +159,7 @@
325 if (fclose (fp) < 0)
326 error (0, errno, "cannot close %s", file);
327 free (line);
328+ return 1;
329 }
330
331 /* Parse a line of space-separated wildcards and add them to the list. */
332@@ -375,6 +376,7 @@
333 struct stat sb;
334 char *file;
335 char *xdir;
336+ char *cvsdotignore;
337
338 /* Set SUBDIRS if we have subdirectory information in ENTRIES. */
339 if (entries == NULL)
340@@ -397,7 +399,10 @@
341 if (dirp == NULL)
342 return;
343
344- ign_add_file (CVSDOTIGNORE, 1);
345+ cvsdotignore = getenv("CVSDOTIGNORE");
346+ if (cvsdotignore == NULL || !ign_add_file (cvsdotignore, 1))
347+ ign_add_file (CVSDOTIGNORE, 1);
348+
349 wrap_add_file (CVSDOTWRAPPER, 1);
350
351 while ((dp = readdir (dirp)) != NULL)
352=== patch end ===
353
354This one is for pcl-cvs-2.9.2, so that `i' adds to the local
355.cvsignore file.
356
357=== patch start ===
358--- pcl-cvs.el~ Mon Nov 1 12:33:46 1999
359+++ pcl-cvs.el Tue Jan 25 21:46:27 2000
360@@ -1177,7 +1177,10 @@
361 "Append the file in FILEINFO to the .cvsignore file.
362 Can only be used in the *cvs* buffer."
363 (save-window-excursion
364- (set-buffer (find-file-noselect (expand-file-name ".cvsignore" dir)))
365+ (set-buffer (find-file-noselect
366+ (expand-file-name (or (getenv "CVSDOTIGNORE")
367+ ".cvsignore")
368+ dir)))
369 (goto-char (point-max))
370 (unless (zerop (current-column)) (insert "\n"))
371 (insert str "\n")
372=== patch end ===