1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
-*-text-*-
Guile Hacking Guide
Copyright (c) 1996-2002,2008,2012,2015,2017 Free Software Foundation, Inc.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and permission notice are preserved,
and that the distributor grants the recipient permission
for further redistribution as permitted by this notice.
Permission is granted to distribute modified versions
of this document, or of portions of it,
under the above conditions, provided also that they
carry prominent notices stating who last changed them,
and that any new or changed statements about the activities
of the Free Software Foundation are approved by the Foundation.
What to Hack =========================================================
You can hack whatever you want, thank GNU.
It's a good idea to join the guile-devel@gnu.org mailing list. See
http://www.gnu.org/software/guile/mail/mail.html for more info.
Hacking It Yourself ==================================================
When Guile is obtained from Git, a few extra steps must be taken
before the usual configure, make, make install. You will need to have
up-to-date versions of the tools as listed below, correctly installed.
Sometimes older or newer versions will work. (See below for versions
to avoid.)
Then you must run the autogen.sh script, as described below.
The same procedure can be used to regenerate the files in released
versions of Guile. In that case the headers of the original generated
files (e.g., configure, Makefile.in, ltmain.sh) can be used to
identify which tool versions may be required.
Autoconf --- a system for automatically generating `configure'
scripts from templates which list the non-portable features a
program would like to use. Available in
"ftp://ftp.gnu.org/pub/gnu/autoconf"
Automake --- a system for automatically generating Makefiles that
conform to the (rather Byzantine) GNU coding standards. The
nice thing is that it takes care of hairy targets like 'make
dist' and 'make distclean', and automatically generates
Makefile dependencies. Automake is available in
"ftp://ftp.gnu.org/pub/gnu/automake"
libtool --- a system for managing the zillion hairy options needed
on various systems to produce shared libraries. Available in
"ftp://ftp.gnu.org/pub/gnu/libtool". Version 2.2 (or
later) is recommended (for correct AIX support, and correct
interaction with the Gnulib module for using libunistring).
gettext --- a system for rigging a program so that it can output its
messages in the local tongue. Guile presently only exports
the gettext functionality to Scheme, it does not use it
itself.
flex --- a scanner generator. It's probably not essential to have the
latest version; Flex 2.5.37 is known to work.
One false move and you will be lost in a little maze of automatically
generated files, all different.
Here is the authoritative list of tool/version/platform tuples that
have been known to cause problems, and a short description of the problem.
Sample GDB Initialization File=========================================
In GDB, you probably want to load the gdbinit file included with Guile,
which defines a number of GDB helpers to inspect Scheme values.
Contributing Your Changes ============================================
- If you have put together a change that meets the coding standards
described below, we encourage you to submit it to Guile. Post your
patch to guile-devel@gnu.org.
- We prefer patches generated using 'git format-patch'.
- Provide a description in the commit message, like so:
1-line description of change
More extensive discussion of your change. Document why you are
changing things.
* filename (function name): file specific change comments.
- For proper credit, also make sure you update the AUTHORS file
(for new files for which you've assigned copyright to the FSF), or
the THANKS file (for everything else).
Coding standards =====================================================
- As for any part of Project GNU, changes to Guile should follow the
GNU coding standards, available at
https://www.gnu.org/prep/standards/standards.html.
- The Guile tree should compile without warnings under the following
GCC switches, which are the default in the current configure script:
-O2 -Wall -Wpointer-arith -Wmissing-prototypes
To make sure of this, you can use the --enable-error-on-warning option
to configure. This option will make GCC fail if it hits a warning.
Note that the warnings generated vary from one version of GCC to the
next, and from one architecture to the next. For this reason,
--enable-error-on-warning is not enabled by default.
- If you add code which uses functions or other features that are not
entirely portable, please make sure the rest of Guile will still
function properly on systems where they are missing. This usually
entails adding a test to configure.in, and then adding #ifdefs to your
code to disable it if the system's features are missing. Do check first
if the function has a Gnulib wrapper, though.
- The normal way of removing a function, macro or variable is to mark
it as "deprecated", keep it for a while, and remove it in a later
release. If a function or macro is marked as "deprecated" it
indicates that people shouldn't use it in new programs, and should try
to remove it in old. Make sure that an alternative exists unless it
is our purpose to remove functionality. Don't deprecate definitions
if it is unclear when they will be removed. (This is to ensure that a
valid way of implementing some functionality always exists.)
When deprecating a definition, always follow this procedure:
1. Mark the definition using
#if (SCM_DEBUG_DEPRECATED == 0)
...
#endif
or, for Scheme code, wrap it using
(begin-deprecated
...)
2. Make the deprecated code issue a warning when it is used, by using
scm_c_issue_deprecation_warning (in C) or issue-deprecation-warning
(in Scheme).
3. Write a comment at the definition explaining how a programmer can
manage without the deprecated definition.
4. Add an entry that the definition has been deprecated in NEWS and
explain what to do instead.
- Write commit messages for functions written in C using the
functions' C names, and write entries for functions written in Scheme
using the functions' Scheme names. For example,
* foo.c: Moved scm_procedure_documentation from eval.c.
is preferred over
* foo.c: Moved procedure-documentation from eval.c.
Changes like adding this line are special:
SCM_PROC (s_map_in_order, "map-in-order", 2, 0, 1, scm_map);
Since the change here is about the name itself --- we're adding a new
alias for scm_map that guarantees the order in which we process list
elements, but we're not changing scm_map at all --- it's appropriate
to use the Scheme name in the commit message.
- Make sure you have papers from people before integrating their
changes or contributions. This is very frustrating, but very
important to do right. From maintain.texi, "Information for
Maintainers of GNU Software":
When incorporating changes from other people, make sure to follow the
correct procedures. Doing this ensures that the FSF has the legal
right to distribute and defend GNU software.
For the sake of registering the copyright on later versions ofthe
software you need to keep track of each person who makes significant
changes. A change of ten lines or so, or a few such changes, in a
large program is not significant.
*Before* incorporating significant changes, make sure that the person
has signed copyright papers, and that the Free Software Foundation has
received them.
If you receive contributions you want to use from someone, let a
maintainer know and they will take care of the administrivia. Put the
contributions aside until we have the necessary papers.
Once you accept a contribution, be sure to keep the files AUTHORS and
THANKS up-to-date.
- When you make substantial changes to a file, add the current year to
the list of years in the copyright notice at the top of the file.
- When you get bug reports or patches from people, be sure to list
them in THANKS.
- Do not introduce trailing whitespace (and feel free to clean it up
opportunistically, that is, if doing so is part of some other change).
The goal is to reduce (and over time, eliminate) spurious diffs.
For Emacs users:
(add-hook 'before-save-hook 'delete-trailing-whitespace)
Naming conventions =================================================
We use certain naming conventions to structure the considerable number
of global identifiers. All identifiers should be either all lower
case or all upper case. Syllables are separated by underscores `_'.
All non-static identifiers should start with scm_ or SCM_. Then might
follow zero or more syllables giving the category of the identifier.
The currently used category identifiers are
t - type name
c,C - something with a interface suited for C use. This is used
to name functions that behave like Scheme primitives but
have a more C friendly calling convention.
i,I - internal to libguile. It is global, but not considered part
of the libguile API.
f - a SCM variable pointing to a Scheme function object.
F - a bit mask for a flag.
m - a macro transformer procedure
n,N - a count of something
s - a constant C string
k - a SCM variable pointing to a keyword.
sym - a SCM variable pointing to a symbol.
var - a SCM variable pointing to a variable object.
The follwing syllables also have a technical meaning:
str - this denotes a zero terminated C string
mem - a C string with an explicit count
|