From e2af46aeef15112a027980b1ee3d6fdbec732dab Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 01:13:33 +0000 Subject: [PATCH 01/80] (am_frags): Add "maintainer-dirs". --- am/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/am/Makefile.am b/am/Makefile.am index a4bfbc415..f8fd41ae4 100644 --- a/am/Makefile.am +++ b/am/Makefile.am @@ -21,7 +21,7 @@ AUTOMAKE_OPTIONS = gnu -am_frags = pre-inst-guile +am_frags = pre-inst-guile maintainer-dirs EXTRA_DIST = $(am_frags) From 01025ac452f28dc536bd0f2f9a89dd07217ab00a Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 01:14:29 +0000 Subject: [PATCH 02/80] *** empty log message *** --- am/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/am/ChangeLog b/am/ChangeLog index 16ea39030..baed421b7 100644 --- a/am/ChangeLog +++ b/am/ChangeLog @@ -1,3 +1,9 @@ +2002-03-30 Thien-Thi Nguyen + + * maintainer-dirs: New file. + + * Makefile.am (am_frags): Add "maintainer-dirs". + 2002-02-26 Thien-Thi Nguyen * pre-inst-guile, Makefile.am, README: New files. From 0520dabb0374165071766cae9b65adf361864e64 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 10:33:22 +0000 Subject: [PATCH 03/80] Update copyright. (dist-hook): Add, including related am/maintainers-dirs, surrounded by "if MAINTAINER_MODE". --- Makefile.am | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 5ea356b15..08b5efea0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in. ## -## Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. ## ## This file is part of GUILE. ## @@ -36,3 +36,13 @@ TESTS = check-guile # The rule will cd to $(top_srcdir). ACLOCAL = ./guile-aclocal.sh + +if MAINTAINER_MODE +# Fill dist tree. +include $(top_srcdir)/am/maintainer-dirs +dist-hook: + ( echo 'This is a snapshot of the TODO file.' ; date ; echo ; \ + cat $(workbook)/tasks/TODO ) > TODO +endif + +# Makefile.am ends here From 412f1928a6d9358498ae7386c8fe2f197f59cd48 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 10:34:14 +0000 Subject: [PATCH 04/80] *** empty log message *** --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index b68846df5..e493467f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-03-31 Thien-Thi Nguyen + + * Makefile.am: Update copyright. + (dist-hook): Add, including related am/maintainers-dirs, + surrounded by "if MAINTAINER_MODE". + 2002-03-06 Thien-Thi Nguyen * guile-tools.in: Handle "--source" option. From a4e827b8fb26b6d177e65ebb55968e74af93b13d Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 11:59:20 +0000 Subject: [PATCH 05/80] bye bye --- TODO | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index e69de29bb..000000000 From 94478b888a4fac2294d9107a92b8bc3aebeeb1d2 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 12:00:32 +0000 Subject: [PATCH 06/80] *** empty log message *** --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index e493467f7..5b54d8f16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ (dist-hook): Add, including related am/maintainers-dirs, surrounded by "if MAINTAINER_MODE". + * TODO: bye bye + 2002-03-06 Thien-Thi Nguyen * guile-tools.in: Handle "--source" option. From 3be5cdf247470688e44391b8a91d608c47cf1d2c Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 23:18:06 +0000 Subject: [PATCH 07/80] Add usage comment. Add workbook specification. Add dist-files symlinking. --- autogen.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 163fb9359..7d0382061 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,12 +1,35 @@ #!/bin/sh +# Usage: sh -x ./autogen.sh [WORKBOOK] set -e [ -f GUILE-VERSION ] || { - echo "autogen.sh: run this command only at the top of a Guile source tree." + echo "autogen.sh: run this command only at the top of guile-core." exit 1 } +###################################################################### +### Find workbook and make symlinks. + +workbook=../workbook # assume "cvs co hack" +test x$1 = x || workbook=$1 +if [ ! -d $workbook ] ; then + echo "ERROR: could not find workbook dir" + echo " re-run like so: $0 WORKBOOK" + exit 1 +fi +: found workbook at $workbook +workbook=`(cd $workbook ; pwd)` + +workbookdistfiles="ANON-CVS HACKING INSTALL SNAPSHOTS" +for f in $workbookdistfiles ; do + rm -f $f + ln -s $workbook/build/dist-files/$f $f +done +rm -f examples/example.gdbinit +ln -s $workbook/build/dist-files/.gdbinit examples/example.gdbinit +###################################################################### + ./guile-aclocal.sh ###################################################################### @@ -38,3 +61,5 @@ echo "guile-readline..." echo "Now run configure and make." echo "You must pass the \`--enable-maintainer-mode' option to configure." + +# autogen.sh ends here From 7634d02017d58e4d82ba9397389f0aa8c9c9e699 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 23:19:23 +0000 Subject: [PATCH 08/80] bye bye --- ANON-CVS | 0 HACKING | 0 INSTALL | 0 SNAPSHOTS | 0 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ANON-CVS delete mode 100644 HACKING delete mode 100644 INSTALL delete mode 100644 SNAPSHOTS diff --git a/ANON-CVS b/ANON-CVS deleted file mode 100644 index e69de29bb..000000000 diff --git a/HACKING b/HACKING deleted file mode 100644 index e69de29bb..000000000 diff --git a/INSTALL b/INSTALL deleted file mode 100644 index e69de29bb..000000000 diff --git a/SNAPSHOTS b/SNAPSHOTS deleted file mode 100644 index e69de29bb..000000000 From ef5bdc2e9debda2b4c8296e4d9a80febc2baea84 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 31 Mar 2002 23:20:17 +0000 Subject: [PATCH 09/80] *** empty log message *** --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5b54d8f16..cf90a444d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,12 @@ * TODO: bye bye + * autogen.sh: Add usage comment. + Add workbook specification. + Add dist-files symlinking. + + * ANON-CVS, HACKING, INSTALL, SNAPSHOTS: bye bye + 2002-03-06 Thien-Thi Nguyen * guile-tools.in: Handle "--source" option. From 755de645575d233e191808d8963c18af9d9b4867 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Mon, 1 Apr 2002 14:44:02 +0000 Subject: [PATCH 10/80] Improve docs on symbols. --- doc/ref/ChangeLog | 16 + doc/ref/scheme-data.texi | 647 ++++++++++++++++++++++++------------ doc/ref/scheme-modules.texi | 4 + 3 files changed, 449 insertions(+), 218 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 765348f94..62ca7919b 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,5 +1,21 @@ +2002-04-01 Neil Jerram + + * scheme-data.texi (Symbols): Reorganized node substructure and + added lots of explanatory text around the @deffn's. + 2002-03-29 Neil Jerram + * scheme-modules.texi (Variables): Mention obarrays. + + * scheme-data.texi (Symbol Tables, Symbol Props): Remove vgone + markers for deprecated symbol items. + (Symbol Props): Remove doc for obsolete 2 arg version of + symbol-interned?. + (String Miscellanea): Removed, since it only contained duplicate + doc for string-ci->symbol. + (Symbol Tables): Move doc for gensym to Symbol Primitives; rest of + section removed. + * posix.texi (Ports and File Descriptors), scheme-evaluation.texi (Fly Evaluation): Remove vgone markers for close-all-ports-except, eval2 and read-and-eval!. diff --git a/doc/ref/scheme-data.texi b/doc/ref/scheme-data.texi index b935dd952..fac7f0753 100755 --- a/doc/ref/scheme-data.texi +++ b/doc/ref/scheme-data.texi @@ -1462,7 +1462,6 @@ called with string containing unusual characters. * String Searching:: Searching in strings. * Alphabetic Case Mapping:: Convert the alphabetic case of strings. * Appending Strings:: Appending strings to form a new string. -* String Miscellanea:: Miscellaneous string procedures. @end menu @node String Syntax @@ -1858,19 +1857,6 @@ concatenation of the given strings, @var{args}. @end deffn -@node String Miscellanea -@subsection String Miscellanea - -This section contains all remaining string procedures. - -@deffn {Scheme Procedure} string-ci->symbol str -@deffnx {C Function} scm_string_ci_to_symbol (str) -Return the symbol whose name is @var{str}. @var{str} is -converted to lowercase before the conversion is done, if Guile -is currently reading symbols case-insensitively. -@end deffn - - @node Regular Expressions @section Regular Expressions @tpindex Regular expressions @@ -2213,47 +2199,230 @@ to this cumbersome escape syntax. @section Symbols @tpindex Symbols -Symbols have two main uses. Crucially, they are used for denoting -variables in a Scheme program. In addition, they are very useful for -describing discrete literal data. +Symbols in Scheme are widely used in three ways: as items of discrete +data, as lookup keys for alists and hash tables, and to denote variable +references. -A symbol is an object with a name that consists of a string of -characters. In the usual case (where the name doesn't include any -characters that could be confused with other elements of Scheme syntax) -a symbol can be written in a Scheme program by writing the sequence of -characters that make up the symbol's name. For example, the read syntax -for the symbol named "multiply-by-2" is simply +A @dfn{symbol} is similar to a string in that it is defined by a +sequence of characters. The sequence of characters is known as the +symbol's @dfn{name}. In the usual case --- that is, where the symbol's +name doesn't include any characters that could be confused with other +elements of Scheme syntax --- a symbol is written in a Scheme program by +writing the sequence of characters that make up the name, @emph{without} +any quotation marks or other special syntax. For example, the symbol +whose name is ``multiply-by-2'' is written, simply: @lisp multiply-by-2 @end lisp -Symbols, then, look rather like strings but without any quotation marks. -But there are several functional differences between them. The first -big functional difference between symbols and strings concerns -uniqueness. If the same-looking string is read twice from two different -places in a program, the result is two @emph{distinguishable} string -objects whose contents just happen to be the same. If, on the other -hand, the same-looking symbol is read twice from two different places in -a program, the result is the @emph{same} symbol object both times. +Notice how this differs from a @emph{string} with contents +``multiply-by-2'', which is written with double quotation marks, like +this: @lisp -(define str1 "hello") -(define str2 "hello") -(eq? str1 str2) @result{} #f +"multiply-by-2" +@end lisp +Looking beyond how they are written, symbols are different from strings +in two important respects. + +The first important difference is uniqueness. If the same-looking +string is read twice from two different places in a program, the result +is two @emph{different} string objects whose contents just happen to be +the same. If, on the other hand, the same-looking symbol is read twice +from two different places in a program, the result is the @emph{same} +symbol object both times. + +Given two read symbols, you can use @code{eq?} to test whether they are +the same (that is, have the same name). @code{eq?} is the most +efficient comparison operator in Scheme, and comparing two symbols like +this is as fast as comparing, for example, two numbers. Given two +strings, on the other hand, you must use @code{equal?} or +@code{string=?}, which are much slower comparison operators, to +determine whether the strings have the same contents. + +@lisp (define sym1 (quote hello)) (define sym2 (quote hello)) (eq? sym1 sym2) @result{} #t + +(define str1 "hello") +(define str2 "hello") +(eq? str1 str2) @result{} #f +(equal? str1 str2) @result{} #t @end lisp The second important difference is that symbols, unlike strings, are not -self-evaluating. An unquoted symbol is interpreted as a variable -reference, and the result of evaluating that symbol is the corresponding -variable's value. (By the way, this is why we needed the @code{(quote -@dots{})}s in the example above: @code{(quote hello)} returns the symbol -object named "hello" itself, whereas an unquoted @code{hello} would try -to find and dereference a variable associated with that symbol.) +self-evaluating. This is why we need the @code{(quote @dots{})}s in the +example above: @code{(quote hello)} evaluates to the symbol named +"hello" itself, whereas an unquoted @code{hello} is @emph{read} as the +symbol named "hello" and evaluated as a variable reference @dots{} about +which more below (@pxref{Symbol Variables}). + +@menu +* Symbol Data:: Symbols as discrete data. +* Symbol Keys:: Symbols as lookup keys. +* Symbol Variables:: Symbols as denoting variables. +* Symbol Primitives:: Operations related to symbols. +* Symbol Props:: Function slots and property lists. +* Symbol Read Syntax:: Extended read syntax for symbols. +* Symbol Uninterned:: Uninterned symbols. +@end menu + + +@node Symbol Data +@subsection Symbols as Discrete Data + +Numbers and symbols are similar to the extent that they both lend +themselves to @code{eq?} comparison. But symbols are more descriptive +than numbers, because a symbol's name can be used directly to describe +the concept for which that symbol stands. + +For example, imagine that you need to represent some colours in a +computer program. Using numbers, you would have to choose arbitrarily +some mapping between numbers and colours, and then take care to use that +mapping consistently: + +@lisp +;; 1=red, 2=green, 3=purple + +(if (eq? (colour-of car) 1) + ...) +@end lisp + +@noindent +You can make the mapping more explicit and the code more readable by +defining constants: + +@lisp +(define red 1) +(define green 2) +(define purple 3) + +(if (eq? (colour-of car) red) + ...) +@end lisp + +@noindent +But the simplest and clearest approach is not to use numbers at all, but +symbols whose names specify the colours that they refer to: + +@lisp +(if (eq? (colour-of car) 'red) + ...) +@end lisp + +The descriptive advantages of symbols over numbers increase as the set +of concepts that you want to describe grows. Suppose that a car object +can have other properties as well, such as whether it has or uses: + +@itemize @bullet +@item +automatic or manual transmission +@item +leaded or unleaded fuel +@item +power steering (or not). +@end itemize + +@noindent +Then a car's combined property set could be naturally represented and +manipulated as a list of symbols: + +@lisp +(properties-of car1) +@result{} +(red manual unleaded power-steering) + +(if (memq 'power-steering (properties-of car1)) + (display "Unfit people can drive this car.\n") + (display "You'll need strong arms to drive this car!\n")) +@print{} +Unfit people can drive this car. +@end lisp + +Remember, the fundamental property of symbols that we are relying on +here is that an occurrence of @code{'red} in one part of a program is an +@emph{indistinguishable} symbol from an occurrence of @code{'red} in +another part of a program; this means that symbols can usefully be +compared using @code{eq?}. At the same time, symbols have naturally +descriptive names. This combination of efficiency and descriptive power +makes them ideal for use as discrete data. + + +@node Symbol Keys +@subsection Symbols as Lookup Keys + +Given their efficiency and descriptive power, it is natural to use +symbols as the keys in an association list or hash table. + +To illustrate this, consider a more structured representation of the car +properties example from the preceding subsection. Rather than +mixing all the properties up together in a flat list, we could use an +association list like this: + +@lisp +(define car1-properties '((colour . red) + (transmission . manual) + (fuel . unleaded) + (steering . power-assisted))) +@end lisp + +Notice how this structure is more explicit and extensible than the flat +list. For example it makes clear that @code{manual} refers to the +transmission rather than, say, the windows or the locking of the car. +It also allows further properties to use the same symbols among their +possible values without becoming ambiguous: + +@lisp +(define car1-properties '((colour . red) + (transmission . manual) + (fuel . unleaded) + (steering . power-assisted) + (seat-colour . red) + (locking . manual))) +@end lisp + +With a representation like this, it is easy to use the efficient +@code{assq-XXX} family of procedures (@pxref{Association Lists}) to +extract or change individual pieces of information: + +@lisp +(assq-ref car1-properties 'fuel) @result{} unleaded +(assq-ref car1-properties 'transmission) @result{} manual + +(assq-set! car1-properties 'seat-colour 'black) +@result{} +((colour . red) + (transmission . manual) + (fuel . unleaded) + (steering . power-assisted) + (seat-colour . black) + (locking . manual))) +@end lisp + +Hash tables also have keys, and exactly the same arguments apply to the +use of symbols in hash tables as in association lists. The hash value +that Guile uses to decide where to add a symbol-keyed entry to a hash +table can be obtained by calling the @code{symbol-hash} procedure: + +@deffn {Scheme Procedure} symbol-hash symbol +@deffnx {C Function} scm_symbol_hash (symbol) +Return a hash value for @var{symbol}. +@end deffn + +See @ref{Hash Tables} for information about hash tables in general, and +for why you might choose to use a hash table rather than an association +list. + + +@node Symbol Variables +@subsection Symbols as Denoting Variables + +When an unquoted symbol in a Scheme program is evaluated, it is +interpreted as a variable reference, and the result of the evaluation is +the appropriate variable's value. For example, when the expression @code{(string-length "abcd")} is read and evaluated, the sequence of characters @code{string-length} is read @@ -2262,23 +2431,211 @@ with a variable whose value is the procedure that implements string length calculation. Therefore evaluation of the @code{string-length} symbol results in that procedure. -Although the use of symbols for variable references is undoubtedly their -most important role in Scheme, it is not documented further here. See -instead @ref{Binding Constructs}, for how associations between symbols -and variables are created, and @ref{Modules}, for how those associations -are affected by Guile's module system. The rest of this section -explains how symbols can also be used to represent discrete values, and -documents the procedures available that relate to symbols as data -objects @i{per se}. +The details of the connection between an unquoted symbol and the +variable to which it refers are explained elsewhere. See @ref{Binding +Constructs}, for how associations between symbols and variables are +created, and @ref{Modules}, for how those associations are affected by +Guile's module system. -@menu -* Symbol Read Syntax:: Extended read syntax for symbols. -* Symbol Primitives:: Operations related to symbols. -* Symbol Tables:: Collecting symbols into obarrays. -* Symbol Discrete:: Using symbols as discrete values. -* Symbol Props:: Function slots and property lists. -* Symbol Uninterned:: Uninterned symbols. -@end menu + +@node Symbol Primitives +@subsection Operations Related to Symbols + +Given any Scheme value, you can determine whether it is a symbol using +the @code{symbol?} primitive: + +@rnindex symbol? +@deffn {Scheme Procedure} symbol? obj +@deffnx {C Function} scm_symbol_p (obj) +Return @code{#t} if @var{obj} is a symbol, otherwise return +@code{#f}. +@end deffn + +Once you know that you have a symbol, you can obtain its name as a +string by calling @code{symbol->string}. Note that Guile differs by +default from R5RS on the details of @code{symbol->string} as regards +case-sensitivity: + +@rnindex symbol->string +@deffn {Scheme Procedure} symbol->string s +@deffnx {C Function} scm_symbol_to_string (s) +Return the name of symbol @var{s} as a string. By default, Guile reads +symbols case-sensitively, so the string returned will have the same case +variation as the sequence of characters that caused @var{s} to be +created. + +If Guile is set to read symbols case-insensitively (as specified by +R5RS), and @var{s} comes into being as part of a literal expression +(@pxref{Literal expressions,,,r5rs, The Revised^5 Report on Scheme}) or +by a call to the @code{read} or @code{string-ci->symbol} procedures, +Guile converts any alphabetic characters in the symbol's name to +lower case before creating the symbol object, so the string returned +here will be in lower case. + +If @var{s} was created by @code{string->symbol}, the case of characters +in the string returned will be the same as that in the string that was +passed to @code{string->symbol}, regardless of Guile's case-sensitivity +setting at the time @var{s} was created. + +It is an error to apply mutation procedures like @code{string-set!} to +strings returned by this procedure. +@end deffn + +Most symbols are created by writing them literally in code. However it +is also possible to create symbols programmatically using the following +@code{string->symbol} and @code{string-ci->symbol} procedures: + +@rnindex string->symbol +@deffn {Scheme Procedure} string->symbol string +@deffnx {C Function} scm_string_to_symbol (string) +Return the symbol whose name is @var{string}. This procedure can create +symbols with names containing special characters or letters in the +non-standard case, but it is usually a bad idea to create such symbols +because in some implementations of Scheme they cannot be read as +themselves. +@end deffn + +@deffn {Scheme Procedure} string-ci->symbol str +@deffnx {C Function} scm_string_ci_to_symbol (str) +Return the symbol whose name is @var{str}. If Guile is currently +reading symbols case-insensitively, @var{str} is converted to lowercase +before the returned symbol is looked up or created. +@end deffn + +The following examples illustrate Guile's detailed behaviour as regards +the case-sensitivity of symbols: + +@lisp +(read-enable 'case-insensitive) ; R5RS compliant behaviour + +(symbol->string 'flying-fish) @result{} "flying-fish" +(symbol->string 'Martin) @result{} "martin" +(symbol->string + (string->symbol "Malvina")) @result{} "Malvina" + +(eq? 'mISSISSIppi 'mississippi) @result{} #t +(string->symbol "mISSISSIppi") @result{} mISSISSIppi +(eq? 'bitBlt (string->symbol "bitBlt")) @result{} #f +(eq? 'LolliPop + (string->symbol (symbol->string 'LolliPop))) @result{} #t +(string=? "K. Harper, M.D." + (symbol->string + (string->symbol "K. Harper, M.D."))) @result{} #t + +(read-disable 'case-insensitive) ; Guile default behaviour + +(symbol->string 'flying-fish) @result{} "flying-fish" +(symbol->string 'Martin) @result{} "Martin" +(symbol->string + (string->symbol "Malvina")) @result{} "Malvina" + +(eq? 'mISSISSIppi 'mississippi) @result{} #f +(string->symbol "mISSISSIppi") @result{} mISSISSIppi +(eq? 'bitBlt (string->symbol "bitBlt")) @result{} #t +(eq? 'LolliPop + (string->symbol (symbol->string 'LolliPop))) @result{} #t +(string=? "K. Harper, M.D." + (symbol->string + (string->symbol "K. Harper, M.D."))) @result{} #t +@end lisp + +Finally, some applications, especially those that generate new Scheme +code dynamically, need to generate symbols for use in the generated +code. The @code{gensym} primitive meets this need: + +@deffn {Scheme Procedure} gensym [prefix] +@deffnx {C Function} scm_gensym (prefix) +Create a new symbol with a name constructed from a prefix and a counter +value. The string @var{prefix} can be specified as an optional +argument. Default prefix is @samp{ g}. The counter is increased by 1 +at each call. There is no provision for resetting the counter. +@end deffn + +The symbols generated by @code{gensym} are @emph{likely} to be unique, +since their names begin with a space and it is only otherwise possible +to generate such symbols if a programmer goes out of their way to do +so. The 1.8 release of Guile will include a way of creating +symbols that are @emph{guaranteed} to be unique. + + +@node Symbol Props +@subsection Function Slots and Property Lists + +In traditional Lisp dialects, symbols are often understood as having +three kinds of value at once: + +@itemize @bullet +@item +a @dfn{variable} value, which is used when the symbol appears in +code in a variable reference context + +@item +a @dfn{function} value, which is used when the symbol appears in +code in a function name position (i.e. as the first element in an +unquoted list) + +@item +a @dfn{property list} value, which is used when the symbol is given as +the first argument to Lisp's @code{put} or @code{get} functions. +@end itemize + +Although Scheme (as one of its simplifications with respect to Lisp) +does away with the distinction between variable and function namespaces, +Guile currently retains some elements of the traditional structure in +case they turn out to be useful when implementing translators for other +languages, in particular Emacs Lisp. + +Specifically, Guile symbols have two extra slots. for a symbol's +property list, and for its ``function value.'' The following procedures +are provided to access these slots. + +@deffn {Scheme Procedure} symbol-fref symbol +@deffnx {C Function} scm_symbol_fref (symbol) +Return the contents of @var{symbol}'s @dfn{function slot}. +@end deffn + +@deffn {Scheme Procedure} symbol-fset! symbol value +@deffnx {C Function} scm_symbol_fset_x (symbol, value) +Set the contents of @var{symbol}'s function slot to @var{value}. +@end deffn + +@deffn {Scheme Procedure} symbol-pref symbol +@deffnx {C Function} scm_symbol_pref (symbol) +Return the @dfn{property list} currently associated with @var{symbol}. +@end deffn + +@deffn {Scheme Procedure} symbol-pset! symbol value +@deffnx {C Function} scm_symbol_pset_x (symbol, value) +Set @var{symbol}'s property list to @var{value}. +@end deffn + +@deffn {Scheme Procedure} symbol-property sym prop +From @var{sym}'s property list, return the value for property +@var{prop}. The assumption is that @var{sym}'s property list is an +association list whose keys are distinguished from each other using +@code{equal?}; @var{prop} should be one of the keys in that list. If +the property list has no entry for @var{prop}, @code{symbol-property} +returns @code{#f}. +@end deffn + +@deffn {Scheme Procedure} set-symbol-property sym prop val +In @var{sym}'s property list, set the value for property @var{prop} to +@var{val}, or add a new entry for @var{prop}, with value @var{val}, if +none already exists. For the structure of the property list, see +@code{symbol-property}. +@end deffn + +@deffn {Scheme Procedure} symbol-property-remove! sym prop +From @var{sym}'s property list, remove the entry for property +@var{prop}, if there is one. For the structure of the property list, +see @code{symbol-property}. +@end deffn + +Support for these extra slots may be removed in a future release, and it +is probably better to avoid using them. (In release 1.6, Guile itself +uses the property list slot sparingly, and the function slot not at +all.) For a more modern and Schemely approach to properties, see +@ref{Object Properties}. @node Symbol Read Syntax @@ -2334,164 +2691,13 @@ widespread usage of it is discouraged because it is not portable and not very readable. -@node Symbol Primitives -@subsection Operations Related to Symbols - -@rnindex symbol? -@deffn {Scheme Procedure} symbol? obj -@deffnx {C Function} scm_symbol_p (obj) -Return @code{#t} if @var{obj} is a symbol, otherwise return -@code{#f}. -@end deffn - -@rnindex string->symbol -@deffn {Scheme Procedure} string->symbol string -@deffnx {C Function} scm_string_to_symbol (string) -Return the symbol whose name is @var{string}. This procedure -can create symbols with names containing special characters or -letters in the non-standard case, but it is usually a bad idea -to create such symbols because in some implementations of -Scheme they cannot be read as themselves. See -@code{symbol->string}. - -The following examples assume that the implementation's -standard case is lower case: - -@lisp -(eq? 'mISSISSIppi 'mississippi) @result{} #t -(string->symbol "mISSISSIppi") @result{} @r{the symbol with name "mISSISSIppi"} -(eq? 'bitBlt (string->symbol "bitBlt")) @result{} #f -(eq? 'LolliPop - (string->symbol (symbol->string 'LolliPop))) @result{} #t -(string=? "K. Harper, M.D." - (symbol->string - (string->symbol "K. Harper, M.D."))) @result{}#t -@end lisp -@end deffn - -@deffn {Scheme Procedure} string-ci->symbol str -@deffnx {C Function} scm_string_ci_to_symbol (str) -Return the symbol whose name is @var{str}. @var{str} is -converted to lowercase before the conversion is done, if Guile -is currently reading symbols case-insensitively. -@end deffn - -@rnindex symbol->string -@deffn {Scheme Procedure} symbol->string s -@deffnx {C Function} scm_symbol_to_string (s) -Return the name of @var{symbol} as a string. If the symbol was -part of an object returned as the value of a literal expression -(section @pxref{Literal expressions,,,r5rs, The Revised^5 -Report on Scheme}) or by a call to the @code{read} procedure, -and its name contains alphabetic characters, then the string -returned will contain characters in the implementation's -preferred standard case---some implementations will prefer -upper case, others lower case. If the symbol was returned by -@code{string->symbol}, the case of characters in the string -returned will be the same as the case in the string that was -passed to @code{string->symbol}. It is an error to apply -mutation procedures like @code{string-set!} to strings returned -by this procedure. - -The following examples assume that the implementation's -standard case is lower case: - -@lisp -(symbol->string 'flying-fish) @result{} "flying-fish" -(symbol->string 'Martin) @result{} "martin" -(symbol->string - (string->symbol "Malvina")) @result{} "Malvina" -@end lisp -@end deffn - -@node Symbol Tables -@subsection Symbol Tables - -@c FIXME::martin: Are all these procedures still relevant? - -Guile symbol tables are hash tables. Each hash table, also called an -@dfn{obarray} (for `object array'), is a vector of association lists. -Each entry in the alists is a pair (@var{SYMBOL} . @var{VALUE}). To -@dfn{intern} a symbol in a symbol table means to return its -(@var{SYMBOL} . @var{VALUE}) pair, adding a new entry to the symbol -table (with an undefined value) if none is yet present. - -@deffn {Scheme Procedure} gensym [prefix] -@deffnx {C Function} scm_gensym (prefix) -Create a new symbol with a name constructed from a prefix and -a counter value. The string @var{prefix} can be specified as -an optional argument. Default prefix is @code{ g}. The counter -is increased by 1 at each call. There is no provision for -resetting the counter. -@end deffn - -@vgone{gentemp,1.6} -@vgone{intern-symbol,1.6} -@vgone{string->obarray-symbol,1.6} -@vgone{symbol-binding,1.6} -@vgone{symbol-bound?,1.6} - - -@node Symbol Discrete -@subsection Using Symbols as Discrete Values - -Symbols are especially useful because two symbols which are spelled the -same way are equivalent in the sense of @code{eq?}. That means that -they are actually the same Scheme object. The advantage is that symbols -can be compared extremely efficiently, although they carry more -information for the human reader than, say, numbers. - -It is very common in Scheme programs to use symbols as keys in -association lists (@pxref{Association Lists}) or hash tables -(@pxref{Hash Tables}), because this usage improves the readability a -lot, and does not cause any performance loss. - - -@node Symbol Props -@subsection Function Slots and Property Lists - -@deffn {Scheme Procedure} symbol-fref symbol -@deffnx {C Function} scm_symbol_fref (symbol) -Return the contents of @var{symbol}'s @dfn{function slot}. -@end deffn - -@deffn {Scheme Procedure} symbol-fset! symbol value -@deffnx {C Function} scm_symbol_fset_x (symbol, value) -Change the binding of @var{symbol}'s function slot. -@end deffn - -@deffn {Scheme Procedure} symbol-hash symbol -@deffnx {C Function} scm_symbol_hash (symbol) -Return a hash value for @var{symbol}. -@end deffn - -@deffn {Scheme Procedure} symbol-interned? obarray string -@deffnx {C Function} scm_symbol_interned_p (obarray, string) -Return @code{#t} if @var{obarray} contains a symbol with name -@var{string}, and @code{#f} otherwise. -@end deffn - -@deffn {Scheme Procedure} symbol-pref symbol -@deffnx {C Function} scm_symbol_pref (symbol) -Return the @dfn{property list} currently associated with @var{symbol}. -@end deffn - -@deffn {Scheme Procedure} symbol-pset! symbol value -@deffnx {C Function} scm_symbol_pset_x (symbol, value) -Change the binding of @var{symbol}'s property slot. -@end deffn - -@vgone{symbol-set!,1.6} -@vgone{unintern-symbol,1.6} - - @node Symbol Uninterned @subsection Uninterned Symbols What makes symbols useful is that they are automatically kept unique. There are no two symbols that are distinct objects but have the same name. But of course, there is no rule without exception. In addition -to the normal symbols that have been discussed upto now, you can also +to the normal symbols that have been discussed up to now, you can also create special @dfn{uninterned} symbols that behave slightly differently. @@ -2551,25 +2757,30 @@ For example: (define foo-4 (make-symbol "foo")) (eq? foo-1 foo-2) -@result{#t} ; Two interned symbols with the same name are the same object, +@result{} #t +; Two interned symbols with the same name are the same object, (eq? foo-1 foo-3) -@result{#f} ; but a call to make-symbol with the same name returns a - ; distinct object. +@result{} #f +; but a call to make-symbol with the same name returns a +; distinct object. (eq? foo-3 foo-4) -@result{#f} ; A call to make-symbol always returns a new object, even for - ; the same name. +@result{} #f +; A call to make-symbol always returns a new object, even for +; the same name. foo-3 -@result{#} - ; Uninterned symbols print different from interned symbols, +@result{} # +; Uninterned symbols print differently from interned symbols, + (symbol? foo-3) -@result{#t} ; but they are still symbols. +@result{} #t +; but they are still symbols, (symbol-interned? foo-3) -@result{#f} ; Just not interned. - +@result{} #f +; just not interned. @end lisp diff --git a/doc/ref/scheme-modules.texi b/doc/ref/scheme-modules.texi index 0865f992d..06bb813af 100644 --- a/doc/ref/scheme-modules.texi +++ b/doc/ref/scheme-modules.texi @@ -835,6 +835,10 @@ anyway). @section Variables @tpindex Variables +Each module has its own hash table, sometimes known as an @dfn{obarray}, +that maps the names defined in that module to their corresponding +variable objects. + A variable is a box-like object that can hold any Scheme value. It is said to be @dfn{undefined} if its box holds a special Scheme value that denotes undefined-ness (which is different from all other Scheme values, From 0624ce33f3a258013fb58c124941315e007352b9 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Mon, 1 Apr 2002 18:46:26 +0000 Subject: [PATCH 11/80] Update vector docs. Remove Guile extensions index. A few other odds and ends. --- doc/ref/ChangeLog | 15 ++++ doc/ref/guile.texi | 38 +++------- doc/ref/scheme-compound.texi | 137 +++++++++++++++++++++-------------- doc/ref/scheme-indices.texi | 7 -- doc/ref/scheme-intro.texi | 5 +- 5 files changed, 110 insertions(+), 92 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 62ca7919b..fcd198edf 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,5 +1,20 @@ 2002-04-01 Neil Jerram + * scheme-intro.texi (Scheme Layout): Remove reference to defunct + Guile Extensions index. + + * guile.texi: Removed Guile Extensions index. + + * scheme-indices.texi (Guile Extensions Index): Removed. + + * guile.texi: Remove vgone, vdeprecated, vchanged and vnote + macros; they're not actually useful after all. Update copyright + years. + + * scheme-compound.texi (Vectors): Make subsections into nodes. + (Vectors): Review, slightly reorg and clarify docs in this + section. + * scheme-data.texi (Symbols): Reorganized node substructure and added lots of explanatory text around the @deffn's. diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi index cd83b3e79..25f9ef264 100644 --- a/doc/ref/guile.texi +++ b/doc/ref/guile.texi @@ -46,37 +46,15 @@ @c reference manual to group stuff according to whether it is R5RS or a @c Guile extension. @defcodeindex rn -@defcodeindex ge @include version.texi -@c Macros for describing version information. I've initially defined -@c all of these to expand to nothing, but they could perhaps be made to -@c expand to something like "New in Guile 45!" in future. - -@c vnew - indicates the Guile version in which item first appeared. +@c vnew - For (some) new items, indicates the Guile version in which +@c item first appeared. In future, this could be made to expand to +@c something like a "New in Guile 45!" banner. @macro vnew{VERSION} @end macro -@c vdeprecated - indicates that the item has been deprecated, and the -@c Guile version in which the deprecation started. -@macro vdeprecated{VERSION} -@end macro - -@c vgone - a way of tracking items that are no longer here. In this -@c case, VERSION is the last Guile version in which the item was present. -@macro vgone{WHAT, VERSION} -@end macro - -@c vchanged - indicates the Guile version in which item's behaviour -@c significantly changed. -@macro vchanged{VERSION} -@end macro - -@c vnote - catchall for any additional notes. -@macro vnote{NOTE} -@end macro - @c @iftex @c @cropmarks @c @end iftex @@ -93,7 +71,8 @@ Guile Reference Manual Copyright (C) 1996 Free Software Foundation @* Copyright (C) 1997 Free Software Foundation @* Copyright (C) 2000 Free Software Foundation @* -Copyright (C) 2001 Free Software Foundation +Copyright (C) 2001 Free Software Foundation @* +Copyright (C) 2002 Free Software Foundation Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -121,7 +100,7 @@ by the Free Software Foundation. @sp 10 @comment The title is printed in a large font. @title Guile Reference Manual -@subtitle $Id: guile.texi,v 1.16 2002-03-27 21:55:31 ossau Exp $ +@subtitle $Id: guile.texi,v 1.17 2002-04-01 18:46:26 ossau Exp $ @subtitle For use with Guile @value{VERSION} @c AUTHORS @@ -186,6 +165,10 @@ Copyright @copyright{} 1997 Free Software Foundation Copyright @copyright{} 2000 Free Software Foundation +Copyright @copyright{} 2001 Free Software Foundation + +Copyright @copyright{} 2002 Free Software Foundation + Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. @@ -291,7 +274,6 @@ Indices * Variable Index:: * Type Index:: * R5RS Index:: -* Guile Extensions Index:: @end menu diff --git a/doc/ref/scheme-compound.texi b/doc/ref/scheme-compound.texi index 75623563b..b39ea76ca 100644 --- a/doc/ref/scheme-compound.texi +++ b/doc/ref/scheme-compound.texi @@ -528,11 +528,6 @@ return value is not specified. @section Vectors @tpindex Vectors -@c FIXME::martin: Review me! - -@c FIXME::martin: Should the subsections of this section be nodes -@c of their own, or are the resulting nodes too short, then? - Vectors are sequences of Scheme objects. Unlike lists, the length of a vector, once the vector is created, cannot be changed. The advantage of vectors over lists is that the time required to access one element of a vector @@ -545,7 +540,15 @@ different types of objects in the same vector. For vectors containing vectors, you may wish to use arrays, instead. Note, too, that some array procedures operate happily on vectors (@pxref{Arrays}). -@subsection Vector Read Syntax +@menu +* Vector Syntax:: Read syntax for vectors. +* Vector Creation:: Dynamic vector creation and validation. +* Vector Accessors:: Accessing and modifying vector contents. +@end menu + + +@node Vector Syntax +@subsection Read Syntax for Vectors Vectors can literally be entered in source code, just like strings, characters or some of the other data types. The read syntax for vectors @@ -561,25 +564,15 @@ number in hexadecimal notation. #("Hello" foo #xdeadbeef) @end lisp -@subsection Vector Predicates -@rnindex vector? -@deffn {Scheme Procedure} vector? obj -@deffnx {C Function} scm_vector_p (obj) -Return @code{#t} if @var{obj} is a vector, otherwise return -@code{#f}. -@end deffn +@node Vector Creation +@subsection Dynamic Vector Creation and Validation -@subsection Vector Constructors - -@rnindex make-vector -@deffn {Scheme Procedure} make-vector k [fill] -@deffnx {C Function} scm_make_vector (k, fill) -Return a newly allocated vector of @var{k} elements. If a -second argument is given, then each position is initialized to -@var{fill}. Otherwise the initial contents of each position is -unspecified. -@end deffn +Instead of creating a vector implicitly by using the read syntax just +described, you can create a vector dynamically by calling one of the +@code{vector} and @code{list->vector} primitives with the list of Scheme +values that you want to place into a vector. The size of the vector +thus created is determined implicitly by the number of arguments given. @rnindex vector @rnindex list->vector @@ -594,6 +587,14 @@ given arguments. Analogous to @code{list}. @end lisp @end deffn +(As an aside, an interesting implementation detail is that the Guile +reader reads the @code{#(@dots{})} syntax by reading everything but the +initial @code{#} as a @emph{list}, and then passing the list that +results to @code{list->vector}. Notice how neatly this fits with the +similarity between the read (and print) syntaxes for lists and vectors.) + +The inverse operation is @code{vector->list}: + @rnindex vector->list @deffn {Scheme Procedure} vector->list v @deffnx {C Function} scm_vector_to_list (v) @@ -605,19 +606,71 @@ Return a newly allocated list composed of the elements of @var{v}. @end lisp @end deffn -@subsection Vector Modification +To allocate a vector with an explicitly specified size, use +@code{make-vector}. With this primitive you can also specify an initial +value for the vector elements (the same value for all elements, that +is): -A vector created by any of the vector constructor procedures -(@pxref{Vectors}) documented above can be modified using the -following procedures. +@rnindex make-vector +@deffn {Scheme Procedure} make-vector k [fill] +@deffnx {C Function} scm_make_vector (k, fill) +Return a newly allocated vector of @var{k} elements. If a +second argument is given, then each position is initialized to +@var{fill}. Otherwise the initial contents of each position is +unspecified. +@end deffn -@emph{NOTE:} According to R5RS, using any of these procedures on -literally entered vectors is an error, because these vectors are -considered to be constant, although Guile currently does not detect this +To check whether an arbitrary Scheme value @emph{is} a vector, use the +@code{vector?} primitive: + +@rnindex vector? +@deffn {Scheme Procedure} vector? obj +@deffnx {C Function} scm_vector_p (obj) +Return @code{#t} if @var{obj} is a vector, otherwise return +@code{#f}. +@end deffn + + +@node Vector Accessors +@subsection Accessing and Modifying Vector Contents + +@code{vector-length} and @code{vector-ref} return information about a +given vector, respectively its size and the elements that are contained +in the vector. + +@rnindex vector-length +@deffn {Scheme Procedure} vector-length vector +@deffnx {C Function} scm_vector_length vector +Return the number of elements in @var{vector} as an exact integer. +@end deffn + +@rnindex vector-ref +@deffn {Scheme Procedure} vector-ref vector k +@deffnx {C Function} scm_vector_ref vector k +Return the contents of position @var{k} of @var{vector}. +@var{k} must be a valid index of @var{vector}. +@lisp +(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8 +(vector-ref '#(1 1 2 3 5 8 13 21) + (let ((i (round (* 2 (acos -1))))) + (if (inexact? i) + (inexact->exact i) + i))) @result{} 13 +@end lisp +@end deffn + +A vector created by one of the dynamic vector constructor procedures +(@pxref{Vector Creation}) can be modified using the following +procedures. + +@emph{NOTE:} According to R5RS, it is an error to use any of these +procedures on a literally read vector, because such vectors should be +considered as constants. Currently, however, Guile does not detect this error. @rnindex vector-set! @deffn {Scheme Procedure} vector-set! vector k obj +@deffnx {C Function} scm_vector_set_x vector k obj Store @var{obj} in position @var{k} of @var{vector}. @var{k} must be a valid index of @var{vector}. The value returned by @samp{vector-set!} is unspecified. @@ -659,30 +712,6 @@ same vector, @code{vector-move-right!} is usually appropriate when @var{start1} is less than @var{start2}. @end deffn -@subsection Vector Selection - -These procedures return information about a given vector, such as the -size or what elements are contained in the vector. - -@rnindex vector-length -@deffn {Scheme Procedure} vector-length vector -Return the number of elements in @var{vector} as an exact integer. -@end deffn - -@rnindex vector-ref -@deffn {Scheme Procedure} vector-ref vector k -Return the contents of position @var{k} of @var{vector}. -@var{k} must be a valid index of @var{vector}. -@lisp -(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8 -(vector-ref '#(1 1 2 3 5 8 13 21) - (let ((i (round (* 2 (acos -1))))) - (if (inexact? i) - (inexact->exact i) - i))) @result{} 13 -@end lisp -@end deffn - @node Records @section Records diff --git a/doc/ref/scheme-indices.texi b/doc/ref/scheme-indices.texi index 46a87b3d8..acecb3ff4 100644 --- a/doc/ref/scheme-indices.texi +++ b/doc/ref/scheme-indices.texi @@ -5,13 +5,6 @@ @printindex rn -@page -@node Guile Extensions Index -@unnumbered Guile Extensions Index - -@printindex ge - - @c Local Variables: @c TeX-master: "guile.texi" @c End: diff --git a/doc/ref/scheme-intro.texi b/doc/ref/scheme-intro.texi index 5bac00086..3cd9967b4 100644 --- a/doc/ref/scheme-intro.texi +++ b/doc/ref/scheme-intro.texi @@ -45,9 +45,8 @@ parts and Guile-specific extensions, the text indicates which parts of the documentation describe R5RS behaviour and which parts describe Guile extensions. -For a breakdown of Guile's core language and features in terms of what -is R5RS-compliant and what is Guile-specific, see the corresponding -indices: @ref{R5RS Index} and @ref{Guile Extensions Index}. +For a quick way of identifying the parts of Guile that implement +R5RS-compliant features, see the R5RS index: @ref{R5RS Index}. @c Local Variables: From bd327d570e1c9caef536f3c00b0e6201518e89e1 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 1 Apr 2002 20:00:25 +0000 Subject: [PATCH 12/80] Remove "if MAINTAINER_MODE" conditional. --- am/maintainer-dirs | 3 --- 1 file changed, 3 deletions(-) diff --git a/am/maintainer-dirs b/am/maintainer-dirs index b5ec2998a..1733ae2d7 100644 --- a/am/maintainer-dirs +++ b/am/maintainer-dirs @@ -22,16 +22,13 @@ ## Commentary: ## This fragment defines two variables: workbook and mscripts. -## These are only defined in MAINTAINER_MODE. ## It can be included in any Makefile.am by adding the line: ## include $(top_srcdir)/am/maintainer-dirs ## See $(workbook)/build/maintainer-dirs.text for more info. ## Code: -if MAINTAINER_MODE workbook = $(top_srcdir_absolute)/../workbook mscripts = $(top_srcdir_absolute)/../scripts -endif ## am/maintainer-dirs ends here From de77aeb79b65caf1013278a01718f945bc13eaf6 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 1 Apr 2002 20:01:11 +0000 Subject: [PATCH 13/80] *** empty log message *** --- am/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/am/ChangeLog b/am/ChangeLog index baed421b7..562e6ac86 100644 --- a/am/ChangeLog +++ b/am/ChangeLog @@ -1,3 +1,7 @@ +2002-04-01 Thien-Thi Nguyen + + * maintainer-dirs: Remove "if MAINTAINER_MODE" conditional. + 2002-03-30 Thien-Thi Nguyen * maintainer-dirs: New file. From ab87b4590d6a70eeafceb250a79e37a919593939 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 10:41:53 +0000 Subject: [PATCH 14/80] Update copyright; nfc. --- scripts/PROGRAM | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/PROGRAM b/scripts/PROGRAM index 69a655949..9ce5f022a 100755 --- a/scripts/PROGRAM +++ b/scripts/PROGRAM @@ -5,7 +5,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" !# ;;; PROGRAM --- Does something -;; Copyright (C) 2001 Free Software Foundation, Inc. +;; Copyright (C) 2002 Free Software Foundation, Inc. ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as From ff9b6a84706653c15c28bb32fae6ea1723043805 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 10:42:35 +0000 Subject: [PATCH 15/80] *** empty log message *** --- scripts/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 484c62c67..bee294c38 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2002-04-02 Thien-Thi Nguyen + + * PROGRAM: Update copyright; nfc. + 2002-03-12 Neil Jerram * snarf-check-and-output-texi (snarf-check-and-output-texi): If From 773ea2fb32501a29edb93be17662d64fbd9c2855 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 11:13:48 +0000 Subject: [PATCH 16/80] Initial revision. --- scripts/read-text-outline | 161 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100755 scripts/read-text-outline diff --git a/scripts/read-text-outline b/scripts/read-text-outline new file mode 100755 index 000000000..74cc8d6d6 --- /dev/null +++ b/scripts/read-text-outline @@ -0,0 +1,161 @@ +#!/bin/sh +# aside from this initial boilerplate, this is actually -*- scheme -*- code +main='(module-ref (resolve-module '\''(scripts read-text-outline)) '\'main')' +exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" +!# +;;; read-text-outline --- Read a text outline and display it as a sexp + +;; Copyright (C) 2002 Free Software Foundation, Inc. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this software; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, +;; Boston, MA 02111-1307 USA + +;;; Author: Thien-Thi Nguyen + +;;; Commentary: + +;; Usage: read-text-outline OUTLINE +;; +;; Scan OUTLINE file and display a list of trees, the structure of +;; each reflecting the "levels" in OUTLINE. The recognized outline +;; format (used to indicate outline headings) is zero or more pairs of +;; leading spaces followed by "-" or "+". Something like: +;; +;; - a 0 +;; - b 1 +;; - c 2 +;; - d 1 +;; - e 0 +;; - f 1 +;; - g 2 +;; -h 1 +;; +;; In this example the levels are shown to the right. The output for +;; such a file would be the single line: +;; +;; (("a" ("b" "c") "d") ("e" ("f" "g") "h")) +;; +;; +;; Usage from a Scheme program: These three procs are exported: +;; +;; (read-text-outline . args) ; only first arg is used +;; (read-text-outline-silently port) +;; (display-outline-tree tree) +;; +;; Don't forget to iterate (say, `display-outline-tree') over the list of +;; trees that `read-text-outline-silently' returns. +;; +;; +;; Bugs and caveats: +;; +;; (1) Only the first file specified on the command line is scanned. +;; (2) TAB characters at the beginnings of lines are not recognized. +;; (3) Outlines that "skip" levels signal an error. In other words, +;; this will fail: +;; +;; - a 0 +;; - b 1 +;; - c 3 <-- skipped 2 -- error! +;; - d 1 +;; +;; +;; TODO: Determine what's the right thing to do for skips. +;; Handle TABs. +;; Handle follow-on lines. +;; Make line/display format customizable via longopts. + +;;; Code: + +(define-module (scripts read-text-outline) + :export (read-text-outline read-text-outline-silently display-outline-tree) + :use-module (ice-9 regex) + :use-module (ice-9 rdelim)) + +;; todo: make customizable +(define *depth-cue-rx* (make-regexp "(([ ][ ])*)[-+] *")) +(define *subm-number* 1) +(define *level-divisor* 2) + +(define (>> level line) + (format #t "\t~A\t~A- ~A\n" level (make-string level #\space) line)) + +(define (display-outline-tree level tree) + (cond ((list? tree) + (>> level (car tree)) + (for-each (lambda (kid) + (display-outline-tree (+ *level-divisor* level) kid)) + (cdr tree))) + (else (>> level tree)))) + +(define (read-text-outline-silently port) + (let* ((all '(start)) + (pchain (list)) ; parents chain + (tp all)) ; tail pointer + (let loop ((line (read-line port)) (prev-level -1)) + (or (eof-object? line) + (cond ((regexp-exec *depth-cue-rx* line) + => (lambda (m) + (let* ((words (list (match:suffix m))) + (level (/ (string-length + (or (match:substring m *subm-number*) + "")) + *level-divisor*)) + (diff (- level prev-level)) + (saved-tp tp)) + (cond + + ;; sibling + ((zero? diff) + (set-cdr! tp words) + (set! tp words)) + + ;; child + ((positive? diff) + (or (= 1 diff) + (error "unhandled diff not 1:" diff line)) + (set-object-property! tp 'level prev-level) + (set! pchain (cons tp pchain)) + (set-car! tp (cons (car tp) words)) + (set! tp words)) + + ;; uncle + ((negative? diff) + (do ((p pchain (cdr p))) + ((= level (object-property (car p) 'level)) + (set! pchain p))) + (set-cdr! (car pchain) words) + (set! pchain (cdr pchain)) + (set! tp words))) + + (loop (read-line port) level)))) + (else (loop (read-line port) prev-level))))) + (set! all (car all)) + (if (eq? 'start all) + '() + (cdr all)))) + +(define (read-text-outline . args) + (let ((trees (read-text-outline-silently (open-file (car args) "r")))) + ;; try this + ;; (for-each (lambda (tree) + ;; (display-outline-tree 0 tree)) + ;; trees)) + (write trees) + (newline)) + #t) ; exit val + +(define main read-text-outline) + +;;; read-text-outline ends here From 33ba17324b406e6212aedb976a398cdea2c9c5f4 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 11:15:03 +0000 Subject: [PATCH 17/80] (scripts_sources): Add "read-text-outline". --- scripts/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index e3cb57e0d..edf91616c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -31,6 +31,7 @@ scripts_sources = \ generate-autoload \ punify \ read-scheme-source \ + read-text-outline \ use2dot \ snarf-check-and-output-texi From 20e7ab652e4ba8dd7759176962a49b982a608e91 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 11:16:13 +0000 Subject: [PATCH 18/80] *** empty log message *** --- scripts/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index bee294c38..94cecb38e 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -2,6 +2,10 @@ * PROGRAM: Update copyright; nfc. + * read-text-outline: New script. + + * Makefile.am (scripts_sources): Add "read-text-outline". + 2002-03-12 Neil Jerram * snarf-check-and-output-texi (snarf-check-and-output-texi): If From 04ab3b74fa3cf9149adbafe58b2557b7834b7b74 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 20:50:38 +0000 Subject: [PATCH 19/80] (read-text-outline-silently): Move `tp' inside `loop'; nfc. --- scripts/read-text-outline | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/scripts/read-text-outline b/scripts/read-text-outline index 74cc8d6d6..bbfbac5e1 100755 --- a/scripts/read-text-outline +++ b/scripts/read-text-outline @@ -101,9 +101,16 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (define (read-text-outline-silently port) (let* ((all '(start)) - (pchain (list)) ; parents chain - (tp all)) ; tail pointer - (let loop ((line (read-line port)) (prev-level -1)) + (pchain (list))) ; parents chain + (let loop ((line (read-line port)) + (prev-level -1) ; how this relates to the first input + ; level determines whether or not we + ; start in "sibling" or "child" mode. + ; in the end, `start' is ignored and + ; it's much easier to ignore parents + ; than siblings (sometimes). this is + ; not to encourage ignorance, however. + (tp all)) ; tail pointer (or (eof-object? line) (cond ((regexp-exec *depth-cue-rx* line) => (lambda (m) @@ -112,38 +119,40 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (or (match:substring m *subm-number*) "")) *level-divisor*)) - (diff (- level prev-level)) - (saved-tp tp)) + (diff (- level prev-level))) (cond ;; sibling ((zero? diff) - (set-cdr! tp words) - (set! tp words)) + ;; just extend the chain + (set-cdr! tp words)) ;; child ((positive? diff) (or (= 1 diff) (error "unhandled diff not 1:" diff line)) + ;; parent may be contacted by uncle later (kids + ;; these days!) so save its level (set-object-property! tp 'level prev-level) (set! pchain (cons tp pchain)) - (set-car! tp (cons (car tp) words)) - (set! tp words)) + ;; "push down" car into hierarchy + (set-car! tp (cons (car tp) words))) ;; uncle ((negative? diff) + ;; prune back to where levels match (do ((p pchain (cdr p))) ((= level (object-property (car p) 'level)) (set! pchain p))) + ;; resume at this level (set-cdr! (car pchain) words) - (set! pchain (cdr pchain)) - (set! tp words))) + (set! pchain (cdr pchain)))) - (loop (read-line port) level)))) - (else (loop (read-line port) prev-level))))) + (loop (read-line port) level words)))) + (else (loop (read-line port) prev-level tp))))) (set! all (car all)) (if (eq? 'start all) - '() + '() ; wasteland (cdr all)))) (define (read-text-outline . args) From 9df9c8159097c40532d68b633b1e18b4afaa81e5 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 2 Apr 2002 20:51:33 +0000 Subject: [PATCH 20/80] *** empty log message *** --- scripts/ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 94cecb38e..8d7491fab 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -6,6 +6,9 @@ * Makefile.am (scripts_sources): Add "read-text-outline". + * read-text-outlint (read-text-outline-silently): + Move `tp' inside `loop'; nfc. + 2002-03-12 Neil Jerram * snarf-check-and-output-texi (snarf-check-and-output-texi): If From f8be0483f6a95a68bac9539785b9f822ed5d26d3 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 3 Apr 2002 02:26:18 +0000 Subject: [PATCH 21/80] List commands in commentary; nfc. --- doc/maint/docstring.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/maint/docstring.el b/doc/maint/docstring.el index 9177d33c5..dddc8ba92 100644 --- a/doc/maint/docstring.el +++ b/doc/maint/docstring.el @@ -50,10 +50,18 @@ ;; The approaches are as follows. ;; ;; 1. Comparison of MANUAL-DOC, SOURCE-DOC and TRACK-DOC, to produce a -;; summary output buffer in which keystrokes are defined to bring up -;; detailed comparisons. +;; summary output buffer in which keystrokes are defined to bring up +;; detailed comparisons. ;; ;; 2. Comparison of MANUAL-DOC, SOURCE-DOC and TRACK-DOC using Ediff. +;; +;; Here is a brief list of commands available (via "M-x COMMAND"): +;; +;; docstring-process-current-buffer +;; docstring-process-current-region BEG END +;; docstring-process-module MODULE +;; docstring-ediff-this-line +;; docstring-show-source ;;; Code: From 47783ace02fbe39533dc3b30aa157cf4d4ee2aff Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 3 Apr 2002 02:27:01 +0000 Subject: [PATCH 22/80] *** empty log message *** --- doc/maint/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/maint/ChangeLog b/doc/maint/ChangeLog index a01af41b7..7e8cd2eae 100644 --- a/doc/maint/ChangeLog +++ b/doc/maint/ChangeLog @@ -1,3 +1,7 @@ +2002-04-02 Thien-Thi Nguyen + + * doctring.el: List commands in commentary; nfc. + 2002-03-15 Neil Jerram * guile.texi: Replaced by regenerated libguile version. From 0356467389419973ce16506f333d73f13c25a593 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 3 Apr 2002 02:58:54 +0000 Subject: [PATCH 23/80] bye bye --- doc/sources/snarf.texi | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 doc/sources/snarf.texi diff --git a/doc/sources/snarf.texi b/doc/sources/snarf.texi deleted file mode 100644 index e69de29bb..000000000 From ec62760eb948dbbf2a23cbb7b4f2b397efc516b6 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 3 Apr 2002 10:22:44 +0000 Subject: [PATCH 24/80] bye bye --- RELEASE | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 RELEASE diff --git a/RELEASE b/RELEASE deleted file mode 100644 index e69de29bb..000000000 From dd1ed1ad06b5a5714b31754fbcc03a6225268a87 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 3 Apr 2002 10:23:35 +0000 Subject: [PATCH 25/80] *** empty log message *** --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index cf90a444d..eff81628e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-04-03 Thien-Thi Nguyen + + * RELEASE: bye bye + 2002-03-31 Thien-Thi Nguyen * Makefile.am: Update copyright. From b3f349b1cc2082e94bb326033bfdeb14c420b4aa Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 4 Apr 2002 23:56:21 +0000 Subject: [PATCH 26/80] Initial revision (forward ported from branch_release-1-6). --- scripts/lint | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100755 scripts/lint diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 000000000..a43cfc065 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,319 @@ +#!/bin/sh +# aside from this initial boilerplate, this is actually -*- scheme -*- code +main='(module-ref (resolve-module '\''(scripts lint)) '\'main')' +exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" +!# +;;; lint --- Preemptive checks for coding errors in Guile Scheme code + +;; Copyright (C) 2002 Free Software Foundation, Inc. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this software; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, +;; Boston, MA 02111-1307 USA + +;;; Author: Neil Jerram + +;;; Commentary: + +;; Usage: lint FILE1 FILE2 ... +;; +;; Perform various preemptive checks for coding errors in Guile Scheme +;; code. +;; +;; Right now, there is only one check available, for unresolved free +;; variables. The intention is that future lint-like checks will be +;; implemented by adding to this script file. +;; +;; Unresolved free variables +;; ------------------------- +;; +;; Free variables are those whose definitions come from outside the +;; module under investigation. In Guile, these definitions are +;; imported from other modules using `#:use-module' forms. +;; +;; This tool scans the specified files for unresolved free variables - +;; i.e. variables for which you may have forgotten the appropriate +;; `#:use-module', or for which the module that is supposed to export +;; them forgot to. +;; +;; It isn't guaranteed that the scan will find absolutely all such +;; errors. Quoted (and quasiquoted) expressions are skipped, since +;; they are most commonly used to describe constant data, not code, so +;; code that is explicitly evaluated using `eval' will not be checked. +;; For example, the `unresolved-var' in `(eval 'unresolved-var +;; (current-module))' would be missed. +;; +;; False positives are also possible. Firstly, the tool doesn't +;; understand all possible forms of implicit quoting; in particular, +;; it doesn't detect and expand uses of macros. Secondly, it picks up +;; explicit compatibility code like `(if (defined? 'x) (define y x))'. +;; Thirdly, there are occasional oddities like `next-method'. +;; However, the number of false positives for realistic code is +;; hopefully small enough that they can be individually considered and +;; ignored. +;; +;; Example +;; ------- +;; +;; Note: most of the unresolved variables found in this example are +;; false positives, as you would hope. => scope for improvement. +;; +;; $ guile-tools lint `guile-tools` +;; No unresolved free variables in PROGRAM +;; No unresolved free variables in autofrisk +;; No unresolved free variables in display-commentary +;; Unresolved free variables in doc-snarf: +;; doc-snarf-version +;; No unresolved free variables in frisk +;; No unresolved free variables in generate-autoload +;; No unresolved free variables in lint +;; No unresolved free variables in punify +;; No unresolved free variables in read-scheme-source +;; Unresolved free variables in snarf-check-and-output-texi: +;; name +;; pos +;; line +;; x +;; rest +;; ... +;; do-argpos +;; do-command +;; do-args +;; type +;; num +;; file +;; do-arglist +;; req +;; opt +;; var +;; command +;; do-directive +;; s +;; ? +;; No unresolved free variables in use2dot + +;;; Code: + +(define-module (scripts lint) + #:use-module (ice-9 common-list) + #:use-module (ice-9 format) + #:export (lint)) + +(define (lint filename) + (let ((module-name (scan-file-for-module-name filename)) + (free-vars (uniq (scan-file-for-free-variables filename)))) + (let ((module (resolve-module module-name)) + (all-resolved? #t)) + (let loop ((free-vars free-vars)) + (or (null? free-vars) + (begin + (catch #t + (lambda () + (eval (car free-vars) module)) + (lambda args + (if all-resolved? + (format #t + "Unresolved free variables in ~A:\n" + filename)) + (write-char #\tab) + (write (car free-vars)) + (newline) + (set! all-resolved? #f))) + (loop (cdr free-vars))))) + (if all-resolved? + (format #t + "No unresolved free variables in ~A\n" + filename))))) + +(define (scan-file-for-module-name filename) + (with-input-from-file filename + (lambda () + (let loop ((x (read))) + (cond ((eof-object? x) #f) + ((and (pair? x) + (eq? (car x) 'define-module)) + (cadr x)) + (else (loop (read)))))))) + +(define (scan-file-for-free-variables filename) + (with-input-from-file filename + (lambda () + (let loop ((x (read)) (fvlists '())) + (if (eof-object? x) + (apply append fvlists) + (loop (read) (cons (detect-free-variables x '()) fvlists))))))) + +; guile> (detect-free-variables '(let ((a 1)) a) '()) +; () +; guile> (detect-free-variables '(let ((a 1)) b) '()) +; (b) +; guile> (detect-free-variables '(let ((a 1) (b a)) b) '()) +; (a) +; guile> (detect-free-variables '(let* ((a 1) (b a)) b) '()) +; () +; guile> (detect-free-variables '(define a 1) '()) +; () +; guile> (detect-free-variables '(define a b) '()) +; (b) +; guile> (detect-free-variables '(define (a b c) b) '()) +; () +; guile> (detect-free-variables '(define (a b c) e) '()) +; (e) + +(define (detect-free-variables x locals) + ;; Given an expression @var{x} and a list @var{locals} of local + ;; variables (symbols) that are in scope for @var{x}, return a list + ;; of free variable symbols. + (cond ((symbol? x) + (if (memq x locals) '() (list x))) + + ((pair? x) + (case (car x) + ((define-module define-generic quote quasiquote) + ;; No code of interest in these expressions. + '()) + + ((let letrec) + ;; Check for named let. If there is a name, transform the + ;; expression so that it looks like an unnamed let with + ;; the name as one of the bindings. + (if (symbol? (cadr x)) + (set-cdr! x (cons (cons (list (cadr x) #f) (caddr x)) + (cdddr x)))) + ;; Unnamed let processing. + (let ((letrec? (eq? (car x) 'letrec)) + (locals-for-let-body (append locals (map car (cadr x))))) + (append (apply append + (map (lambda (binding) + (detect-free-variables (cadr binding) + (if letrec? + locals-for-let-body + locals))) + (cadr x))) + (apply append + (map (lambda (bodyform) + (detect-free-variables bodyform + locals-for-let-body)) + (cddr x)))))) + + ((let* and-let*) + ;; Handle bindings recursively. + (if (null? (cadr x)) + (apply append + (map (lambda (bodyform) + (detect-free-variables bodyform locals)) + (cddr x))) + (append (detect-free-variables (cadr (caadr x)) locals) + (detect-free-variables `(let* ,(cdadr x) ,@(cddr x)) + (cons (caaadr x) locals))))) + + ((define define-public define-macro) + (if (pair? (cadr x)) + (begin + (set! locals (cons (caadr x) locals)) + (detect-free-variables `(lambda ,(cdadr x) ,@(cddr x)) + locals)) + (begin + (set! locals (cons (cadr x) locals)) + (detect-free-variables (caddr x) locals)))) + + ((lambda lambda*) + (let ((locals-for-lambda-body (let loop ((locals locals) + (args (cadr x))) + (cond ((null? args) locals) + ((pair? args) + (loop (cons (car args) locals) + (cdr args))) + (else + (cons args locals)))))) + (apply append + (map (lambda (bodyform) + (detect-free-variables bodyform + locals-for-lambda-body)) + (cddr x))))) + + ((receive) + (let ((locals-for-receive-body (append locals (cadr x)))) + (apply append + (detect-free-variables (caddr x) locals) + (map (lambda (bodyform) + (detect-free-variables bodyform + locals-for-receive-body)) + (cdddr x))))) + + ((define-method define*) + (let ((locals-for-method-body (let loop ((locals locals) + (args (cdadr x))) + (cond ((null? args) locals) + ((pair? args) + (loop (cons (if (pair? (car args)) + (caar args) + (car args)) + locals) + (cdr args))) + (else + (cons args locals)))))) + (apply append + (map (lambda (bodyform) + (detect-free-variables bodyform + locals-for-method-body)) + (cddr x))))) + + ((define-class) + ;; Avoid picking up slot names at the start of slot + ;; definitions. + (apply append + (map (lambda (slot/option) + (detect-free-variables-noncar (if (pair? slot/option) + (cdr slot/option) + slot/option) + locals)) + (cdddr x)))) + + ((case) + (apply append + (detect-free-variables (cadr x) locals) + (map (lambda (case) + (detect-free-variables (cdr case) locals)) + (cddr x)))) + + ((unquote unquote-splicing else =>) + (detect-free-variables-noncar (cdr x) locals)) + + (else (append (detect-free-variables (car x) locals) + (detect-free-variables-noncar (cdr x) locals))))) + + (else '()))) + +(define (detect-free-variables-noncar x locals) + ;; Given an expression @var{x} and a list @var{locals} of local + ;; variables (symbols) that are in scope for @var{x}, return a list + ;; of free variable symbols. + (cond ((symbol? x) + (if (memq x locals) '() (list x))) + + ((pair? x) + (case (car x) + ((=>) + (detect-free-variables-noncar (cdr x) locals)) + + (else (append (detect-free-variables (car x) locals) + (detect-free-variables-noncar (cdr x) locals))))) + + (else '()))) + +(define (main . files) + (for-each lint files)) + +;;; lint ends here From 984fe98790f6a380d4ca4d09babb9e04326400a2 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 4 Apr 2002 23:57:10 +0000 Subject: [PATCH 27/80] *** empty log message *** --- scripts/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 8d7491fab..b090bf0e7 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2002-04-04 Thien-Thi Nguyen + + * lint: New script. + 2002-04-02 Thien-Thi Nguyen * PROGRAM: Update copyright; nfc. From 3fe8f82f5e3750a3b21b6c84cbd24a4ae3435890 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 4 Apr 2002 23:58:09 +0000 Subject: [PATCH 28/80] (scripts_sources): Add lint. --- scripts/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index edf91616c..97aba0adb 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -29,6 +29,7 @@ scripts_sources = \ doc-snarf \ frisk \ generate-autoload \ + lint \ punify \ read-scheme-source \ read-text-outline \ From eb4311e620a4d93c136063c3fb74f87a97c96112 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 4 Apr 2002 23:59:04 +0000 Subject: [PATCH 29/80] *** empty log message *** --- scripts/ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index b090bf0e7..ec8555178 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -2,6 +2,8 @@ * lint: New script. + * Makefile.am (scripts_sources): Add "lint". + 2002-04-02 Thien-Thi Nguyen * PROGRAM: Update copyright; nfc. @@ -10,7 +12,7 @@ * Makefile.am (scripts_sources): Add "read-text-outline". - * read-text-outlint (read-text-outline-silently): + * read-text-outline (read-text-outline-silently): Move `tp' inside `loop'; nfc. 2002-03-12 Neil Jerram From 088b528512a6c3179e206d5be9997e2fa1f827e9 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sat, 6 Apr 2002 01:55:20 +0000 Subject: [PATCH 30/80] (display-outline-tree): No longer export this proc. (*depth-cue-rx*, *subm-number*, *level-divisor*, >>, display-outline-tree): Delete these vars and procs. (??, msub, ??-predicates, make-line-parser, make-text-outline-reader): New procs. (make-text-outline-reader): Export. (read-text-outline-silently): Rewrite using `make-text-outline-reader'. --- scripts/read-text-outline | 235 ++++++++++++++++++++++++++------------ 1 file changed, 160 insertions(+), 75 deletions(-) diff --git a/scripts/read-text-outline b/scripts/read-text-outline index bbfbac5e1..1a88f205e 100755 --- a/scripts/read-text-outline +++ b/scripts/read-text-outline @@ -31,7 +31,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; Scan OUTLINE file and display a list of trees, the structure of ;; each reflecting the "levels" in OUTLINE. The recognized outline ;; format (used to indicate outline headings) is zero or more pairs of -;; leading spaces followed by "-" or "+". Something like: +;; leading spaces followed by "-". Something like: ;; ;; - a 0 ;; - b 1 @@ -40,22 +40,60 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; - e 0 ;; - f 1 ;; - g 2 -;; -h 1 +;; - h 1 ;; ;; In this example the levels are shown to the right. The output for ;; such a file would be the single line: ;; ;; (("a" ("b" "c") "d") ("e" ("f" "g") "h")) ;; +;; Basically, anything at the beginning of a list is a parent, and the +;; remaining elements of that list are its children. ;; -;; Usage from a Scheme program: These three procs are exported: +;; +;; Usage from a Scheme program: These two procs are exported: ;; ;; (read-text-outline . args) ; only first arg is used ;; (read-text-outline-silently port) -;; (display-outline-tree tree) +;; (make-text-outline-reader re specs) ;; -;; Don't forget to iterate (say, `display-outline-tree') over the list of -;; trees that `read-text-outline-silently' returns. +;; `make-text-outline-reader' returns a proc that reads from PORT and +;; returns a list of trees (similar to `read-text-outline-silently'). +;; +;; RE is a regular expression (string) that is used to identify a header +;; line of the outline (as opposed to a whitespace line or intervening +;; text). RE must begin w/ a sub-expression to match the "level prefix" +;; of the line. You can use `level-submatch-number' in SPECS (explained +;; below) to specify a number other than 1, the default. +;; +;; Normally, the level of the line is taken directly as the length of +;; its level prefix. This often results in adjacent levels not mapping +;; to adjacent numbers, which confuses the tree-building portion of the +;; program, which expects top-level to be 0, first sub-level to be 1, +;; etc. You can use `level-substring-divisor' or `compute-level' in +;; SPECS to specify a constant scaling factor or specify a completely +;; alternative procedure, respectively. +;; +;; SPECS is an alist which may contain the following key/value pairs: +;; +;; - level-submatch-number NUMBER +;; - level-substring-divisor NUMBER +;; - compute-level PROC +;; - body-submatch-number NUMBER +;; - extra-fields ((FIELD-1 . SUBMATCH-1) (FIELD-2 . SUBMATCH-2) ...) +;; +;; The PROC value associated with key `compute-level' should take a +;; Scheme match structure (as returned by `regexp-exec') and return a +;; number, the normalized level for that line. If this is specified, +;; it takes precedence over other level-computation methods. +;; +;; Use `body-submatch-number' if RE specifies the whole body, or if you +;; want to make use of the extra fields parsing. The `extra-fields' +;; value is a sub-alist, whose keys name additional fields that are to +;; be recognized. These fields along with `level' are set as object +;; properties of the final string ("body") that is consed into the tree. +;; If a field name ends in "?" the field value is set to be #t if there +;; is a match and the result is not an empty string, and #f otherwise. ;; ;; ;; Bugs and caveats: @@ -73,96 +111,143 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; ;; TODO: Determine what's the right thing to do for skips. ;; Handle TABs. -;; Handle follow-on lines. -;; Make line/display format customizable via longopts. +;; Make line format customizable via longopts. ;;; Code: (define-module (scripts read-text-outline) - :export (read-text-outline read-text-outline-silently display-outline-tree) + :export (read-text-outline + read-text-outline-silently + make-text-outline-reader) :use-module (ice-9 regex) - :use-module (ice-9 rdelim)) + :autoload (ice-9 rdelim) (read-line) + :autoload (ice-9 getopt-long) (getopt-long)) -;; todo: make customizable -(define *depth-cue-rx* (make-regexp "(([ ][ ])*)[-+] *")) -(define *subm-number* 1) -(define *level-divisor* 2) +(define (?? symbol) + (let ((name (symbol->string symbol))) + (string=? "?" (substring name (1- (string-length name)))))) -(define (>> level line) - (format #t "\t~A\t~A- ~A\n" level (make-string level #\space) line)) +(define (msub n) + (lambda (m) + (match:substring m n))) -(define (display-outline-tree level tree) - (cond ((list? tree) - (>> level (car tree)) - (for-each (lambda (kid) - (display-outline-tree (+ *level-divisor* level) kid)) - (cdr tree))) - (else (>> level tree)))) +(define (??-predicates pair) + (cons (car pair) + (if (?? (car pair)) + (lambda (m) + (not (string=? "" (match:substring m (cdr pair))))) + (msub (cdr pair))))) -(define (read-text-outline-silently port) - (let* ((all '(start)) - (pchain (list))) ; parents chain - (let loop ((line (read-line port)) - (prev-level -1) ; how this relates to the first input +(define (make-line-parser re specs) + (let* ((rx (let ((fc (substring re 0 1))) + (make-regexp (if (string=? "^" fc) + re + (string-append "^" re))))) + (check (lambda (key) + (assq-ref specs key))) + (level-substring (msub (or (check 'level-submatch-number) 1))) + (extract-level (cond ((check 'compute-level) + => (lambda (proc) + (lambda (m) + (proc m)))) + ((check 'level-substring-divisor) + => (lambda (n) + (lambda (m) + (/ (string-length (level-substring m)) + n)))) + (else + (lambda (m) + (string-length (level-substring m)))))) + (extract-body (cond ((check 'body-submatch-number) + => msub) + (else + (lambda (m) (match:suffix m))))) + (misc-props! (cond ((check 'extra-fields) + => (lambda (alist) + (let ((new (map ??-predicates alist))) + (lambda (obj m) + (for-each + (lambda (pair) + (set-object-property! + obj (car pair) + ((cdr pair) m))) + new))))) + (else + (lambda (obj m) #t))))) + ;; retval + (lambda (line) + (cond ((regexp-exec rx line) + => (lambda (m) + (let ((level (extract-level m)) + (body (extract-body m))) + (set-object-property! body 'level level) + (misc-props! body m) + body))) + (else #f))))) + +(define (make-text-outline-reader re specs) + (let ((parse-line (make-line-parser re specs))) + ;; retval + (lambda (port) + (let* ((all '(start)) + (pchain (list))) ; parents chain + (let loop ((line (read-line port)) + (prev-level -1) ; how this relates to the first input ; level determines whether or not we ; start in "sibling" or "child" mode. ; in the end, `start' is ignored and ; it's much easier to ignore parents ; than siblings (sometimes). this is ; not to encourage ignorance, however. - (tp all)) ; tail pointer - (or (eof-object? line) - (cond ((regexp-exec *depth-cue-rx* line) - => (lambda (m) - (let* ((words (list (match:suffix m))) - (level (/ (string-length - (or (match:substring m *subm-number*) - "")) - *level-divisor*)) - (diff (- level prev-level))) - (cond + (tp all)) ; tail pointer + (or (eof-object? line) + (cond ((parse-line line) + => (lambda (w) + (let* ((words (list w)) + (level (object-property w 'level)) + (diff (- level prev-level))) + (cond - ;; sibling - ((zero? diff) - ;; just extend the chain - (set-cdr! tp words)) + ;; sibling + ((zero? diff) + ;; just extend the chain + (set-cdr! tp words)) - ;; child - ((positive? diff) - (or (= 1 diff) - (error "unhandled diff not 1:" diff line)) - ;; parent may be contacted by uncle later (kids - ;; these days!) so save its level - (set-object-property! tp 'level prev-level) - (set! pchain (cons tp pchain)) - ;; "push down" car into hierarchy - (set-car! tp (cons (car tp) words))) + ;; child + ((positive? diff) + (or (= 1 diff) + (error "unhandled diff not 1:" diff line)) + ;; parent may be contacted by uncle later (kids + ;; these days!) so save its level + (set-object-property! tp 'level prev-level) + (set! pchain (cons tp pchain)) + ;; "push down" car into hierarchy + (set-car! tp (cons (car tp) words))) - ;; uncle - ((negative? diff) - ;; prune back to where levels match - (do ((p pchain (cdr p))) - ((= level (object-property (car p) 'level)) - (set! pchain p))) - ;; resume at this level - (set-cdr! (car pchain) words) - (set! pchain (cdr pchain)))) + ;; uncle + ((negative? diff) + ;; prune back to where levels match + (do ((p pchain (cdr p))) + ((= level (object-property (car p) 'level)) + (set! pchain p))) + ;; resume at this level + (set-cdr! (car pchain) words) + (set! pchain (cdr pchain)))) - (loop (read-line port) level words)))) - (else (loop (read-line port) prev-level tp))))) - (set! all (car all)) - (if (eq? 'start all) - '() ; wasteland - (cdr all)))) + (loop (read-line port) level words)))) + (else (loop (read-line port) prev-level tp))))) + (set! all (car all)) + (if (eq? 'start all) + '() ; wasteland + (cdr all)))))) + +(define read-text-outline-silently + (make-text-outline-reader "(([ ][ ])*)- *" + '((level-substring-divisor . 2)))) (define (read-text-outline . args) - (let ((trees (read-text-outline-silently (open-file (car args) "r")))) - ;; try this - ;; (for-each (lambda (tree) - ;; (display-outline-tree 0 tree)) - ;; trees)) - (write trees) - (newline)) + (write (read-text-outline-silently (open-file (car args) "r"))) + (newline) #t) ; exit val (define main read-text-outline) From 6e0ae869bb7da5111ebe0b57feaa35761670f41c Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sat, 6 Apr 2002 01:57:01 +0000 Subject: [PATCH 31/80] *** empty log message *** --- scripts/ChangeLog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index ec8555178..65a6d8d37 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,17 @@ +2002-04-05 Thien-Thi Nguyen + + * read-text-outline (display-outline-tree): No longer export this proc. + + (*depth-cue-rx*, *subm-number*, *level-divisor*, >>, + display-outline-tree): Delete these vars and procs. + + (??, msub, ??-predicates, make-line-parser, + make-text-outline-reader): New procs. + + (make-text-outline-reader): Export. + (read-text-outline-silently): Rewrite + using `make-text-outline-reader'. + 2002-04-04 Thien-Thi Nguyen * lint: New script. From 89c8775916596dc37da1b71380535311e4b1b71f Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sat, 6 Apr 2002 08:18:43 +0000 Subject: [PATCH 32/80] Initial revision --- scripts/summarize-guile-TODO | 107 +++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 scripts/summarize-guile-TODO diff --git a/scripts/summarize-guile-TODO b/scripts/summarize-guile-TODO new file mode 100755 index 000000000..c7c0efe02 --- /dev/null +++ b/scripts/summarize-guile-TODO @@ -0,0 +1,107 @@ +#!/bin/sh +# aside from this initial boilerplate, this is actually -*- scheme -*- code +main='(module-ref (resolve-module '\''(scripts summarize-guile-TODO)) '\'main')' +exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" +!# +;;; summarize-guile-TODO --- Display Guile TODO list in various ways + +;; Copyright (C) 2002 Free Software Foundation, Inc. +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this software; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, +;; Boston, MA 02111-1307 USA + +;;; Author: Thien-Thi Nguyen + +;;; Commentary: + +;; Usage: summarize-guile-TODO TODOFILE +;; +;; The TODOFILE is typically Guile's (see workbook/tasks/README) +;; presumed to serve as our signal to ourselves (lest we want real +;; bosses hassling us) wrt to the overt message "items to do" as well as +;; the messages that can be inferred from its structure. +;; +;; This program reads TODOFILE and displays interpretations on its +;; structure, including registered markers and ownership, in various +;; ways. [TODO] +;; +;; A primary interest in any task is its parent task. The output +;; summarization by default lists every item and its parent chain. +;; Top-level parents are not items. +;; +;; +;; Usage from a Scheme program: +;; (summrize-guile-TODO . args) ; uses first arg only + +;; TODO: Implement the various ways. (Patches welcome.) + +;;; Code: + +(define-module (scripts summarize-guile-TODO) + :use-module (scripts read-text-outline) + :export (summarize-guile-TODO)) + +(define put set-object-property!) +(define get object-property) + +(define (hang-by-the-leaves trees) + (let ((leaves '())) + (letrec ((hang (lambda (tree parent) + (if (list? tree) + (begin + (put (car tree) 'parent parent) + (for-each (lambda (child) + (hang child (car tree))) + (cdr tree))) + (begin + (put tree 'parent parent) + (set! leaves (cons tree leaves))))))) + (for-each (lambda (tree) + (hang tree #f)) + trees)) + leaves)) + + +(define (read-TODO file) + (hang-by-the-leaves + ((make-text-outline-reader "(([ ][ ])*)([-+])(R*) *([^[]*)(.*)" + '((level-substring-divisor . 2) + (body-submatch-number . 5) + (extra-fields . ((status . 3) + (review? . 4) + (who . 6))))) + (open-file file "r")))) + +(define (display-item item) + (format #t "status: ~A~A\nitem : ~A\n" (get item 'status) + (if (get item 'review?) "R" "") item) + (let loop ((parent (get item 'parent)) (indent 2)) + (and parent + (begin + (format #t "under : ~A~A\n" + (make-string indent #\space) + parent) + (loop (get parent 'parent) (+ 2 indent)))))) + +(define (display-items items) + (for-each display-item items)) + +(define (summarize-guile-TODO . args) + (display-items (read-TODO (car args))) + #t) ; exit val + +(define main summarize-guile-TODO) + +;;; summarize-guile-TODO ends here From 785c30676e5d9dea961a80d64b8650fe4604c5fa Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sat, 6 Apr 2002 08:19:49 +0000 Subject: [PATCH 33/80] (scripts_sources): Add "summarize-guile-TODO". --- scripts/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 97aba0adb..a0abbfddc 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in. ## -## Copyright (C) 2001 Free Software Foundation, Inc. +## Copyright (C) 2002 Free Software Foundation, Inc. ## ## This file is part of GUILE. ## @@ -34,7 +34,8 @@ scripts_sources = \ read-scheme-source \ read-text-outline \ use2dot \ - snarf-check-and-output-texi + snarf-check-and-output-texi \ + summarize-guile-TODO subpkgdatadir = $(pkgdatadir)/$(VERSION)/scripts subpkgdata_SCRIPTS = $(scripts_sources) From 2589defad47d3f37fdf639ca06580a0f34d8c946 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sat, 6 Apr 2002 08:21:24 +0000 Subject: [PATCH 34/80] *** empty log message *** --- scripts/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 65a6d8d37..7d1cf2d9e 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2002-04-06 Thien-Thi Nguyen + + * summarize-guile-TODO: New script. + + * Makefile.am (scripts_sources): Add "summarize-guile-TODO". + 2002-04-05 Thien-Thi Nguyen * read-text-outline (display-outline-tree): No longer export this proc. From fb1cdefe5c049c2c4897b0083dc5e4e97c181592 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 7 Apr 2002 21:37:14 +0000 Subject: [PATCH 35/80] Add "Bugs" section to commentary. Autoload (srfi srfi-13) on `string-tokenize'. (as-leaf): New proc. (hang-by-the-leaves): Use `as-leaf'. (read-TODO-file): Expand regexp and specs to handle "D", "X" and "N%". Fix regexp to make isolating `who' easier. (display-item): Handle "D", "X" and "N%". --- scripts/summarize-guile-TODO | 51 +++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/scripts/summarize-guile-TODO b/scripts/summarize-guile-TODO index c7c0efe02..7e8b824f3 100755 --- a/scripts/summarize-guile-TODO +++ b/scripts/summarize-guile-TODO @@ -44,6 +44,14 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; ;; Usage from a Scheme program: ;; (summrize-guile-TODO . args) ; uses first arg only +;; +;; +;; Bugs: (1) Markers are scanned in sequence: D R X N%. This means "XD" +;; and the like are completely dropped. However, such strings +;; are unlikely to be used if the markers are chosen to be +;; somewhat exclusive, which is currently the case for D R X. +;; N% used w/ these needs to be something like: "D25%" (this +;; means discussion accounts for 1/4 of the task). ;; TODO: Implement the various ways. (Patches welcome.) @@ -51,11 +59,23 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (define-module (scripts summarize-guile-TODO) :use-module (scripts read-text-outline) + :autoload (srfi srfi-13) (string-tokenize) ; string library :export (summarize-guile-TODO)) (define put set-object-property!) (define get object-property) +(define (as-leaf x) + (cond ((get x 'who) + => (lambda (who) + (put x 'who + (map string->symbol + (string-tokenize who #\:)))))) + (cond ((get x 'pct-done) + => (lambda (pct-done) + (put x 'pct-done (string->number pct-done))))) + x) + (define (hang-by-the-leaves trees) (let ((leaves '())) (letrec ((hang (lambda (tree parent) @@ -67,26 +87,37 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (cdr tree))) (begin (put tree 'parent parent) - (set! leaves (cons tree leaves))))))) + (set! leaves (cons (as-leaf tree) leaves))))))) (for-each (lambda (tree) (hang tree #f)) trees)) leaves)) - (define (read-TODO file) (hang-by-the-leaves - ((make-text-outline-reader "(([ ][ ])*)([-+])(R*) *([^[]*)(.*)" - '((level-substring-divisor . 2) - (body-submatch-number . 5) - (extra-fields . ((status . 3) - (review? . 4) - (who . 6))))) + ((make-text-outline-reader + "(([ ][ ])*)([-+])(D*)(R*)(X*)(([0-9]+)%)* *([^[]*)(\\[(.*)\\])*" + '((level-substring-divisor . 2) + (body-submatch-number . 9) + (extra-fields . ((status . 3) + (design? . 4) + (review? . 5) + (extblock? . 6) + (pct-done . 8) + (who . 11))))) (open-file file "r")))) (define (display-item item) - (format #t "status: ~A~A\nitem : ~A\n" (get item 'status) - (if (get item 'review?) "R" "") item) + (format #t "status: ~A~A~A~A~A\nitem : ~A\n" + (get item 'status) + (if (get item 'design?) "D" "") + (if (get item 'review?) "R" "") + (if (get item 'extblock?) "X" "") + (cond ((get item 'pct-done) + => (lambda (pct-done) + (format #f " ~A%" pct-done))) + (else "")) + item) (let loop ((parent (get item 'parent)) (indent 2)) (and parent (begin From e4fcbe23b816c8f1392be9285bd6b663c4240d8f Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Sun, 7 Apr 2002 21:44:28 +0000 Subject: [PATCH 36/80] *** empty log message *** --- scripts/ChangeLog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 7d1cf2d9e..f4661fac3 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,15 @@ +2002-04-07 Thien-Thi Nguyen + + * summarize-guile-TODO: Add "Bugs" section to commentary. + Autoload (srfi srfi-13) on `string-tokenize'. + + (as-leaf): New proc. + (hang-by-the-leaves): Use `as-leaf'. + (read-TODO-file): Expand regexp and specs + to handle "D", "X" and "N%". Fix regexp + to make isolating `who' easier. + (display-item): Handle "D", "X" and "N%". + 2002-04-06 Thien-Thi Nguyen * summarize-guile-TODO: New script. From b262538585038fd7dcace41aa853d5af88b00128 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 8 Apr 2002 17:03:57 +0000 Subject: [PATCH 37/80] Use (ice-9 getopt-long). Autoload (ice-9 common-list). (select-items): New proc. (make-display-item): New proc. (display-item): Delete. (display-items): Use `make-display-item'. (summarize-guile-TODO): Add option handling. --- scripts/summarize-guile-TODO | 120 +++++++++++++++++++++++++++-------- 1 file changed, 95 insertions(+), 25 deletions(-) diff --git a/scripts/summarize-guile-TODO b/scripts/summarize-guile-TODO index 7e8b824f3..8f8d37da4 100755 --- a/scripts/summarize-guile-TODO +++ b/scripts/summarize-guile-TODO @@ -35,11 +35,22 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; ;; This program reads TODOFILE and displays interpretations on its ;; structure, including registered markers and ownership, in various -;; ways. [TODO] +;; ways. ;; ;; A primary interest in any task is its parent task. The output ;; summarization by default lists every item and its parent chain. -;; Top-level parents are not items. +;; Top-level parents are not items. You can use these command-line +;; options to modify the selection and display (selection criteria +;; are ANDed together): +;; +;; -i, --involved USER -- select USER-involved items +;; -p, --personal USER -- select USER-responsible items +;; -t, --todo -- select unfinished items (status "-") +;; -t, --done -- select finished items (status "+") +;; -r, --review -- select review items (marker "R") +;; +;; -w, --who -- also show who is associated w/ the item +;; -n, --no-parent -- do not show parent chain ;; ;; ;; Usage from a Scheme program: @@ -52,14 +63,18 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" ;; somewhat exclusive, which is currently the case for D R X. ;; N% used w/ these needs to be something like: "D25%" (this ;; means discussion accounts for 1/4 of the task). - -;; TODO: Implement the various ways. (Patches welcome.) +;; +;; TODO: Implement more various ways. (Patches welcome.) +;; Add support for ORing criteria. ;;; Code: +(debug-enable 'debug 'backtrace) (define-module (scripts summarize-guile-TODO) :use-module (scripts read-text-outline) + :use-module (ice-9 getopt-long) :autoload (srfi srfi-13) (string-tokenize) ; string library + :autoload (ice-9 common-list) (remove-if-not) :export (summarize-guile-TODO)) (define put set-object-property!) @@ -107,30 +122,85 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (who . 11))))) (open-file file "r")))) -(define (display-item item) - (format #t "status: ~A~A~A~A~A\nitem : ~A\n" - (get item 'status) - (if (get item 'design?) "D" "") - (if (get item 'review?) "R" "") - (if (get item 'extblock?) "X" "") - (cond ((get item 'pct-done) - => (lambda (pct-done) - (format #f " ~A%" pct-done))) - (else "")) - item) - (let loop ((parent (get item 'parent)) (indent 2)) - (and parent - (begin - (format #t "under : ~A~A\n" - (make-string indent #\space) - parent) - (loop (get parent 'parent) (+ 2 indent)))))) +(define (select-items p items) + (let ((sub '())) + (cond ((option-ref p 'involved #f) + => (lambda (u) + (let ((u (string->symbol u))) + (set! sub (cons + (lambda (x) + (and (get x 'who) + (memq u (get x 'who)))) + sub)))))) + (cond ((option-ref p 'personal #f) + => (lambda (u) + (let ((u (string->symbol u))) + (set! sub (cons + (lambda (x) + (cond ((get x 'who) + => (lambda (ls) + (eq? (car (reverse ls)) + u))) + (else #f))) + sub)))))) + (for-each (lambda (pair) + (cond ((option-ref p (car pair) #f) + (set! sub (cons (cdr pair) sub))))) + `((todo . ,(lambda (x) (string=? (get x 'status) "-"))) + (done . ,(lambda (x) (string=? (get x 'status) "+"))) + (review . ,(lambda (x) (get x 'review?))))) + (let loop ((sub (reverse sub)) (items items)) + (if (null? sub) + (reverse items) + (loop (cdr sub) (remove-if-not (car sub) items)))))) -(define (display-items items) - (for-each display-item items)) +(define (make-display-item show-who? show-parent?) + (lambda (item) + (format #t "status: ~A~A~A~A~A~A\nitem : ~A\n" + (get item 'status) + (if (get item 'design?) "D" "") + (if (get item 'review?) "R" "") + (if (get item 'extblock?) "X" "") + (cond ((get item 'pct-done) + => (lambda (pct-done) + (format #f " ~A%" pct-done))) + (else "")) + (cond ((get item 'who) + => (lambda (who) + (if show-who? + (format #f " ~A" who) + ""))) + (else "")) + item) + (and show-parent? + (let loop ((parent (get item 'parent)) (indent 2)) + (and parent + (begin + (format #t "under : ~A~A\n" + (make-string indent #\space) + parent) + (loop (get parent 'parent) (+ 2 indent)))))))) + +(define (display-items p items) + (let ((display-item (make-display-item (option-ref p 'who #f) + (not (option-ref p 'no-parent #f)) + ))) + (for-each display-item items))) (define (summarize-guile-TODO . args) - (display-items (read-TODO (car args))) + (let ((p (getopt-long (cons "summarize-guile-TODO" args) + '((who (single-char #\w)) + (no-parent (single-char #\n)) + (involved (single-char #\i) + (value #t)) + (personal (single-char #\p) + (value #t)) + (todo (single-char #\t)) + (done (single-char #\d)) + (review (single-char #\d)) + ;; Add options here. + )))) + (display-items p (select-items p (read-TODO (car (option-ref p '() #f)))))) #t) ; exit val (define main summarize-guile-TODO) From e2012b459cf61516ddcd3c8959280dbf58b2f302 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 8 Apr 2002 17:05:05 +0000 Subject: [PATCH 38/80] *** empty log message *** --- scripts/ChangeLog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/ChangeLog b/scripts/ChangeLog index f4661fac3..8ab057831 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,14 @@ +2002-04-08 Thien-Thi Nguyen + + * summarize-guile-TODO: Use (ice-9 getopt-long). + Autoload (ice-9 common-list). + + (select-items): New proc. + (make-display-item): New proc. + (display-item): Delete. + (display-items): Use `make-display-item'. + (summarize-guile-TODO): Add option handling. + 2002-04-07 Thien-Thi Nguyen * summarize-guile-TODO: Add "Bugs" section to commentary. From 7e3521747db5bbab63ade6d038ed12a64299e79d Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 8 Apr 2002 17:07:18 +0000 Subject: [PATCH 39/80] Fix typo. --- scripts/summarize-guile-TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/summarize-guile-TODO b/scripts/summarize-guile-TODO index 8f8d37da4..af4cdd6c3 100755 --- a/scripts/summarize-guile-TODO +++ b/scripts/summarize-guile-TODO @@ -197,7 +197,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (value #t)) (todo (single-char #\t)) (done (single-char #\d)) - (review (single-char #\d)) + (review (single-char #\r)) ;; Add options here. )))) (display-items p (select-items p (read-TODO (car (option-ref p '() #f)))))) From 2db9b0b647173f37de4ed92ddb92f04336d6a587 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:29:10 +0000 Subject: [PATCH 40/80] * .cvsignore: add Makefile and Makefile.in. --- am/.cvsignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 am/.cvsignore diff --git a/am/.cvsignore b/am/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/am/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in From 812dbd5d4a44111b2dba9826dd1b856b5b3b5a35 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:30:09 +0000 Subject: [PATCH 41/80] * .cvsignore: add version-tutorial.texi, version.texi, and stamp-vti1. --- doc/.cvsignore | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/doc/.cvsignore b/doc/.cvsignore index a7fc35803..86d66d588 100644 --- a/doc/.cvsignore +++ b/doc/.cvsignore @@ -1,21 +1,23 @@ +*.aux +*.cp +*.cps +*.dvi +*.fn +*.fns +*.html +*.info* +*.ky +*.log +*.pg +*.ps +*.toc +*.tp +*.tps +*.vr +*.vrs Makefile Makefile.in stamp-vti -stamp-vti.1 -*.log -*.dvi -*.aux -*.toc -*.cp -*.fn -*.vr -*.tp -*.ky -*.pg -*.cps -*.fns -*.tps -*.vrs -*.ps -*.info* -*.html +stamp-vti1 +version-tutorial.texi +version.texi From f3dc9ef28872053de8c56fadf59e8d3208b5074b Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:30:47 +0000 Subject: [PATCH 42/80] * .cvsignore: add versiondat.h and *.c.clean.c. --- libguile/.cvsignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libguile/.cvsignore b/libguile/.cvsignore index 45a60e238..d5d8f2a5e 100644 --- a/libguile/.cvsignore +++ b/libguile/.cvsignore @@ -1,5 +1,6 @@ *.bb *.bbg +*.c.clean.c *.da *.doc *.gcov @@ -40,3 +41,4 @@ stamp-h stamp-h.in stamp-h1 version.h +versiondat.h From caa6d6ecec22adcd18d6a5ab86d0869b88be7b50 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:31:09 +0000 Subject: [PATCH 43/80] * .cvsignore: add *.c.clean.c. --- srfi/.cvsignore | 1 + 1 file changed, 1 insertion(+) diff --git a/srfi/.cvsignore b/srfi/.cvsignore index 6c4e65b0c..30ce6d616 100644 --- a/srfi/.cvsignore +++ b/srfi/.cvsignore @@ -1,3 +1,4 @@ +*.c.clean.c *.la *.lo *.x From 587cd12650085f353eaf7b0bb5e3add0b34aaa1f Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:36:52 +0000 Subject: [PATCH 44/80] * configure.in: add definitions to AC_DEFINE calls for new autoconf. --- guile-readline/configure.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guile-readline/configure.in b/guile-readline/configure.in index ea51027cb..c2056712c 100644 --- a/guile-readline/configure.in +++ b/guile-readline/configure.in @@ -108,7 +108,8 @@ AC_CACHE_CHECK([for rl_getc_function pointer in readline], [ac_cv_var_rl_getc_function=yes], [ac_cv_var_rl_getc_function=no])]) if test "${ac_cv_var_rl_getc_function}" = "yes"; then - AC_DEFINE(HAVE_RL_GETC_FUNCTION) + AC_DEFINE(HAVE_RL_GETC_FUNCTION, 1, + [Define if your readline library has the rl_getc_function variable.]) fi if test $ac_cv_lib_readline_readline = yes \ From 64839c6b7a873f1c5c97f62569da50ba5e101e1b Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:37:08 +0000 Subject: [PATCH 45/80] * .cvsignore: add autom4te.cache and *.c.clean.c. --- guile-readline/.cvsignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guile-readline/.cvsignore b/guile-readline/.cvsignore index 50ae7fa50..9bf5eb05e 100644 --- a/guile-readline/.cvsignore +++ b/guile-readline/.cvsignore @@ -1,3 +1,4 @@ +*.c.clean.c *.la *.lo *.x @@ -6,9 +7,10 @@ Makefile Makefile.in aclocal.m4 +autom4te.cache +config.guess config.log config.status -config.guess config.sub configure libtool From 16023445b41b3a34c58b39b4881a44f39f71a09d Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:41:09 +0000 Subject: [PATCH 46/80] * .cvsignore: add autom4te.cache and pre-inst-guile. --- .cvsignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cvsignore b/.cvsignore index 994f72bbc..cdcf44864 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,6 +1,7 @@ Makefile Makefile.in aclocal.m4 +autom4te.cache check-guile check-guile.log config.build-subdirs @@ -17,3 +18,4 @@ libltdl libtool ltconfig ltmain.sh +pre-inst-guile From dd678f28807109a75ce74bb793a047fa6f44d057 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:41:16 +0000 Subject: [PATCH 47/80] * acconfig.h: removed -- newer autoconf doesn't like it, and now we don't need it. --- acconfig.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 acconfig.h diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index e69de29bb..000000000 From e103c6b4ee2f94429ec3b5a87d97a04e965e088c Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:41:23 +0000 Subject: [PATCH 48/80] * acinclude.m4: add definitions to AC_DEFINE calls for new autoconf. --- acinclude.m4 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index f0ec6d03c..ac7544b27 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -15,7 +15,9 @@ struct utime blah; guile_cv_struct_utimbuf_needs_posix=no, guile_cv_struct_utimbuf_needs_posix=yes)]) if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then - AC_DEFINE(UTIMBUF_NEEDS_POSIX) + AC_DEFINE([UTIMBUF_NEEDS_POSIX], 1, + [Define this if doesn't define struct utimbuf unless + _POSIX_SOURCE is defined. See GUILE_STRUCT_UTIMBUF in aclocal.m4.]) fi]) @@ -53,7 +55,11 @@ AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD], ] ) if test "$guile_cv_header_libc_with_unistd" = yes; then - AC_DEFINE(LIBC_H_WITH_UNISTD_H) + AC_DEFINE(LIBC_H_WITH_UNISTD_H, 1, + [Define this if we should include when we've already + included . On some systems, they conflict, and libc.h + should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in + aclocal.m4.]) fi ] ) From eede3dbc075c4a341cd9cfe90c33d6ddd30f3eec Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:41:30 +0000 Subject: [PATCH 49/80] * configure.in: updates for new autoconf -- add definitions to AC_DEFINE calls, and convert occurences of LIBOBJS to AC_LIBOBJ calls. --- configure.in | 133 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 89 insertions(+), 44 deletions(-) diff --git a/configure.in b/configure.in index 6c6d44197..1a632ac5d 100644 --- a/configure.in +++ b/configure.in @@ -51,22 +51,26 @@ AC_ARG_ENABLE(error-on-warning, *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;; esac]) + AC_ARG_ENABLE(debug-freelist, [ --enable-debug-freelist include garbage collector freelist debugging code], if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then - AC_DEFINE(GUILE_DEBUG_FREELIST) + AC_DEFINE(GUILE_DEBUG_FREELIST, 1, + [Define this if you want to debug the free list (helps w/ GC bugs).]) fi) AC_ARG_ENABLE(debug-malloc, [ --enable-debug-malloc include malloc debugging code], if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then - AC_DEFINE(GUILE_DEBUG_MALLOC) + AC_DEFINE(GUILE_DEBUG_MALLOC, 1, + [Define this if you want to debug scm_must_malloc/realloc/free calls.]) fi) AC_ARG_ENABLE(guile-debug, [ --enable-guile-debug include internal debugging functions], if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then - AC_DEFINE(GUILE_DEBUG) + AC_DEFINE(GUILE_DEBUG, 1, + [Define this to include various undocumented functions used to debug.]) fi) AC_ARG_ENABLE(arrays, @@ -110,6 +114,9 @@ AM_CONDITIONAL(HTMLDOC, test x$htmldoc_enabled = xyes) AC_ARG_ENABLE(deprecated, [ --disable-deprecated omit deprecated features [no]]) +AH_TEMPLATE([SCM_ENABLE_DEPRECATED], + [Define this to 1 if you want to include deprecated features.]) + if test "$enable_deprecated" = no; then AC_DEFINE(SCM_ENABLE_DEPRECATED, 0) else @@ -121,13 +128,16 @@ else warn_default=$enable_deprecated fi AC_DEFINE(SCM_ENABLE_DEPRECATED, 1) - AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default") + AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default", + [Define this to control the default warning level for deprecated features.]) fi dnl The --disable-debug used to control these two. But now they are dnl a required part of the distribution. -AC_DEFINE(DEBUG_EXTENSIONS) -AC_DEFINE(READER_EXTENSIONS) +AC_DEFINE(DEBUG_EXTENSIONS, 1, + [Define if you want support for debugging Scheme programs.]) +AC_DEFINE(READER_EXTENSIONS, 1, + [Define if you want support for debugging Scheme programs.]) AC_ARG_ENABLE(elisp, [ --disable-elisp omit Emacs Lisp support],, @@ -136,26 +146,33 @@ AC_ARG_ENABLE(elisp, dnl files which are destined for separate modules. if test "$enable_arrays" = yes; then - LIBOBJS="$LIBOBJS ramap.o unif.o" - AC_DEFINE(HAVE_ARRAYS) + AC_LIBOBJ([ramap]) + AC_LIBOBJ([unif]) + AC_DEFINE(HAVE_ARRAYS, 1, + [Define this if you want support for arrays and uniform arrays.]) fi if test "$enable_posix" = yes; then - LIBOBJS="$LIBOBJS filesys.o posix.o" - AC_DEFINE(HAVE_POSIX) + AC_LIBOBJ([filesys]) + AC_LIBOBJ([posix]) + AC_DEFINE(HAVE_POSIX, 1, + [Define this if you want support for POSIX system calls in Guile.]) fi if test "$enable_networking" = yes; then - LIBOBJS="$LIBOBJS net_db.o socket.o" - AC_DEFINE(HAVE_NETWORKING) + AC_LIBOBJ([net_db]) + AC_LIBOBJ([socket]) + AC_DEFINE(HAVE_NETWORKING, 1, + [Define this if you want support for networking in Guile.]) fi if test "$enable_debug_malloc" = yes; then - LIBOBJS="$LIBOBJS debug-malloc.o" + AC_LIBOBJ([debug-malloc]) fi if test "$enable_elisp" = yes; then - AC_DEFINE(SCM_ENABLE_ELISP) + AC_DEFINE(SCM_ENABLE_ELISP, 1, + [Define this if you want Elisp support (in addition to Scheme).]) fi #-------------------------------------------------------------------- @@ -188,7 +205,8 @@ AC_C_INLINE AC_C_BIGENDIAN if test "$ac_cv_c_inline" != no; then - AC_DEFINE(HAVE_INLINE) + AC_DEFINE(HAVE_INLINE, 1, + [Define if the compiler supports inline functions.]) fi AC_CHECK_SIZEOF(short) @@ -242,9 +260,10 @@ if test "$MINGW32" = "yes" ; then AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1, [Define if you have the header file.])]) AC_CHECK_LIB(ws2_32, main) - LIBOBJS="$LIBOBJS win32-uname.o win32-dirent.o" + AC_LIBOBJ([win32-uname]) + AC_LIBOBJ([win32-dirent]) if test "$enable_networking" = yes ; then - LIBOBJS="$LIBOBJS win32-socket.o" + AC_LIBOBJ([win32-socket]) fi if test "$enable_shared" = yes ; then EXTRA_DEFS="-DSCM_IMPORT" @@ -266,7 +285,8 @@ use_modules="$withval") test -z "$use_modules" && use_modules=yes DLPREOPEN= if test "$use_modules" != no; then - AC_DEFINE(DYNAMIC_LINKING) + AC_DEFINE(DYNAMIC_LINKING, 1, + [Define if you want support for dynamic linking.]) if test "$use_modules" = yes; then DLPREOPEN="-dlpreopen force" else @@ -300,7 +320,8 @@ AC_DEFUN(GUILE_FUNC_DECLARED, [ guile_cv_func_$1_declared=yes, guile_cv_func_$1_declared=no)) if test [x$guile_cv_func_]$1[_declared] = xno; then - AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL]) + AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1, + [Define if the operating system supplies $1 without declaring it.]) fi ]) @@ -317,13 +338,15 @@ AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type, [guile_cv_func_usleep_return_type=int])]) case "$guile_cv_func_usleep_return_type" in "void" ) - AC_DEFINE(USLEEP_RETURNS_VOID) + AC_DEFINE(USLEEP_RETURNS_VOID, 1, + [Define if the system headers declare usleep to return void.]) ;; esac AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1) if test -n "$have_sys_un_h" ; then -AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS) + AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1, + [Define if the system supports Unix-domain (file-domain) sockets.]) fi AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset) @@ -346,7 +369,7 @@ AC_CACHE_VAL(guile_cv_have_h_errno, guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)]) AC_MSG_RESULT($guile_cv_have_h_errno) if test $guile_cv_have_h_errno = yes; then - AC_DEFINE(HAVE_H_ERRNO) + AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.]) fi AC_MSG_CHECKING(whether uint32_t is defined) @@ -362,7 +385,8 @@ AC_CACHE_VAL(guile_cv_have_uint32_t, guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)]) AC_MSG_RESULT($guile_cv_have_uint32_t) if test $guile_cv_have_uint32_t = yes; then - AC_DEFINE(HAVE_UINT32_T) + AC_DEFINE(HAVE_UINT32_T, 1, + [Define if uint32_t typedef is defined when netdb.h is include.]) fi AC_MSG_CHECKING(for working IPv6 support) @@ -373,7 +397,7 @@ AC_CACHE_VAL(guile_cv_have_ipv6, guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)]) AC_MSG_RESULT($guile_cv_have_ipv6) if test $guile_cv_have_ipv6 = yes; then - AC_DEFINE(HAVE_IPV6) + AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.]) fi # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3. @@ -384,7 +408,8 @@ AC_CACHE_VAL(guile_cv_have_sin6_scope_id, guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)]) AC_MSG_RESULT($guile_cv_have_sin6_scope_id) if test $guile_cv_have_sin6_scope_id = yes; then - AC_DEFINE(HAVE_SIN6_SCOPE_ID) + AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1, + [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.]) fi AC_MSG_CHECKING(whether localtime caches TZ) @@ -431,7 +456,7 @@ else fi])dnl AC_MSG_RESULT($guile_cv_localtime_cache) if test $guile_cv_localtime_cache = yes; then - AC_DEFINE(LOCALTIME_CACHE) + AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.]) fi dnl Test whether system calls are restartable by default on the @@ -450,18 +475,19 @@ if test "$enable_regex" = yes; then if test "$ac_cv_header_regex_h" = yes || test "$ac_cv_header_rxposix_h" = yes || test "$ac_cv_header_rx_rxposix_h" = yes; then - GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"], + GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])], [AC_CHECK_LIB(rx, main) - GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"], + GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])], [AC_CHECK_LIB(regex, main) - GUILE_NAMED_CHECK_FUNC(regcomp, regex, [LIBOBJS="regex-posix.o $LIBOBJS"])])] + GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])] ) dnl The following should not be necessary, but for some reason dnl autoheader misses it if we don't include it! if test "$ac_cv_func_regcomp_norx" = yes || test "$ac_cv_func_regcomp_regex" = yes || test "$ac_cv_func_regcomp_rx" = yes; then - AC_DEFINE(HAVE_REGCOMP) + AC_DEFINE(HAVE_REGCOMP, 1, + [This is included as part of a workaround for a autoheader bug.]) fi fi fi @@ -472,7 +498,7 @@ AC_REPLACE_FUNCS(inet_aton putenv strerror memmove mkstemp) # explicitly to LIBOBJS to make sure that it is translated to # `alloca.lo' for libtool later on. This can and should be done more cleanly. AC_FUNC_ALLOCA -if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi +if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi AC_CHECK_MEMBERS([struct stat.st_rdev]) AC_CHECK_MEMBERS([struct stat.st_blksize]) @@ -487,7 +513,8 @@ AC_CACHE_CHECK([for S_ISLNK in sys/stat.h], ac_cv_macro_S_ISLNK, ac_cv_macro_S_ISLNK=yes, ac_cv_macro_S_ISLNK=no)]) if test $ac_cv_macro_S_ISLNK = yes; then - AC_DEFINE(HAVE_S_ISLNK) + AC_DEFINE(HAVE_S_ISLNK, 1, + [Define this if your system defines S_ISLNK in sys/stat.h.]) fi AC_STRUCT_TIMEZONE @@ -502,7 +529,15 @@ GUILE_STRUCT_UTIMBUF AC_TRY_RUN(aux (l) unsigned long l; { int x; exit (l >= ((unsigned long)&x)); } main () { int q; aux((unsigned long)&q); }, - AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)) + [AC_DEFINE([SCM_STACK_GROWS_UP], 1, + [Define this if a callee's stack frame has a higher address + than the caller's stack frame. On most machines, this is + not the case.])], + [], + [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)]) + +AH_TEMPLATE([SCM_SINGLES], + [Define this if floats are the same size as longs.]) AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long, [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }], @@ -531,7 +566,9 @@ AC_CACHE_VAL(scm_cv_struct_linger, scm_cv_struct_linger="no")) AC_MSG_RESULT($scm_cv_struct_linger) if test $scm_cv_struct_linger = yes; then - AC_DEFINE(HAVE_STRUCT_LINGER) + AC_DEFINE(HAVE_STRUCT_LINGER, 1, + [Define this if your system defines struct linger, for use with the + getsockopt and setsockopt system calls.]) fi @@ -544,7 +581,8 @@ AC_CACHE_VAL(scm_cv_struct_timespec, scm_cv_struct_timespec="no")) AC_MSG_RESULT($scm_cv_struct_timespec) if test $scm_cv_struct_timespec = yes; then - AC_DEFINE(HAVE_STRUCT_TIMESPEC) + AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, + [Define this if your system defines struct timespec via .]) fi #-------------------------------------------------------------------- @@ -586,15 +624,16 @@ esac ## If we're using threads, bring in some other parts of Guile which ## work with them. if test "${THREAD_PACKAGE}" != "" ; then - AC_DEFINE(USE_THREADS, 1) + AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.]) ## Include the Guile thread interface in the library... - LIBOBJS="$LIBOBJS threads.o" + AC_LIBOBJ([threads]) ## ... and tell it which package to talk to. case "${THREAD_PACKAGE}" in "QT" ) - AC_DEFINE(USE_COOP_THREADS, 1) + AC_DEFINE(USE_COOP_THREADS, 1, + [Define if using cooperative multithreading.]) ;; * ) AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE}) @@ -604,7 +643,7 @@ if test "${THREAD_PACKAGE}" != "" ; then ## Bring in scm_internal_select, if appropriate. if test $ac_cv_func_gettimeofday = yes && test $ac_cv_func_select = yes; then - AC_DEFINE(GUILE_ISELECT, 1) + AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.]) fi AC_ARG_ENABLE(linuxthreads, @@ -613,7 +652,8 @@ if test "${THREAD_PACKAGE}" != "" ; then ## Workaround for linuxthreads (optionally disabled) if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then - AC_DEFINE(GUILE_PTHREAD_COMPAT, 1) + AC_DEFINE(GUILE_PTHREAD_COMPAT, 1, + [Define to enable workaround for COOP-linuxthreads compatibility.]) AC_CHECK_LIB(pthread, main) fi fi @@ -631,18 +671,23 @@ esac AC_PROG_AWK +## NOTE the code below sets LIBOBJS directly and so is now forbidden +## -- I'm disabling it for now in the hopes that the newer autoconf +## will DTRT -- if not, we need to fix up the sed command to match the +## others... +## ## Remove fileblocks.o from the object list. This file gets added by ## the Autoconf macro AC_STRUCT_ST_BLOCKS. But there is no need. -LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`" +#LIBOBJS="`echo ${LIBOBJS} | sed 's/fileblocks\.o//g'`" ## If we're creating a shared library (using libtool!), then we'll ## need to generate a list of .lo files corresponding to the .o files ## given in LIBOBJS. We'll call it LIBLOBJS. -LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`" +LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`" ## We also need to create corresponding .doc and .x files -EXTRA_DOT_DOC_FILES="`echo ${LIBOBJS} | sed 's/\.o/.doc/g'`" -EXTRA_DOT_X_FILES="`echo ${LIBOBJS} | sed 's/\.o/.x/g'`" +EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`" +EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`" AC_SUBST(GUILE_MAJOR_VERSION) AC_SUBST(GUILE_MINOR_VERSION) From 21550b108e47d7fa97fea93aeb70f9fdacd94132 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Thu, 11 Apr 2002 04:41:40 +0000 Subject: [PATCH 50/80] *** empty log message *** --- ChangeLog | 14 ++++++++++++++ am/ChangeLog | 4 ++++ doc/ChangeLog | 5 +++++ guile-readline/ChangeLog | 7 +++++++ libguile/ChangeLog | 4 ++++ srfi/ChangeLog | 4 ++++ 6 files changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index eff81628e..4f665bbf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-04-10 Rob Browning + + * configure.in: updates for new autoconf -- add definitions to + AC_DEFINE calls, and convert occurences of LIBOBJS to AC_LIBOBJ + calls. + + * acinclude.m4: add definitions to AC_DEFINE calls for new + autoconf. + + * acconfig.h: removed -- newer autoconf doesn't like it, and now + we don't need it. + + * .cvsignore: add autom4te.cache and pre-inst-guile. + 2002-04-03 Thien-Thi Nguyen * RELEASE: bye bye diff --git a/am/ChangeLog b/am/ChangeLog index 562e6ac86..3b0cdcdb8 100644 --- a/am/ChangeLog +++ b/am/ChangeLog @@ -1,3 +1,7 @@ +2002-04-10 Rob Browning + + * .cvsignore: add Makefile and Makefile.in. + 2002-04-01 Thien-Thi Nguyen * maintainer-dirs: Remove "if MAINTAINER_MODE" conditional. diff --git a/doc/ChangeLog b/doc/ChangeLog index 8dfc503c0..fb4e587ca 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2002-04-10 Rob Browning + + * .cvsignore: add version-tutorial.texi, version.texi, and + stamp-vti1. + 2002-03-01 Thien-Thi Nguyen * guile-api.alist: Update. diff --git a/guile-readline/ChangeLog b/guile-readline/ChangeLog index 9e5e55fc6..c185ba4cb 100644 --- a/guile-readline/ChangeLog +++ b/guile-readline/ChangeLog @@ -1,3 +1,10 @@ +2002-04-10 Rob Browning + + * configure.in: add definitions to AC_DEFINE calls for new + autoconf. + + * .cvsignore: add autom4te.cache and *.c.clean.c. + 2002-03-24 Marius Vollmer * Makefile.am (.c.x): Pass "-o $@" to guile-snarf. diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 3623a11f3..97851ce7e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,7 @@ +2002-04-10 Rob Browning + + * .cvsignore: add versiondat.h and *.c.clean.c. + 2002-03-26 Dirk Herrmann * srcprop.[ch] (scm_c_source_property_breakpoint_p): New diff --git a/srfi/ChangeLog b/srfi/ChangeLog index af8ccb223..214f71f6e 100644 --- a/srfi/ChangeLog +++ b/srfi/ChangeLog @@ -1,3 +1,7 @@ +2002-04-10 Rob Browning + + * .cvsignore: add *.c.clean.c. + 2002-03-27 Thien-Thi Nguyen * srfi-1.scm, srfi-13.scm, srfi-17.scm, srfi-4.scm, srfi-9.scm, From 3be0d96d0f9d79a65b92824736be0a295e9386b7 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 16 Apr 2002 20:12:10 +0000 Subject: [PATCH 51/80] Install the trap for removing $cleanfile only when the value of $cleanfile is actually known. --- libguile/guile-snarf.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in index 67fbddda7..aaa6926d6 100644 --- a/libguile/guile-snarf.in +++ b/libguile/guile-snarf.in @@ -107,7 +107,7 @@ cpp_ok_p=false temp="/tmp/snarf.$$" if [ x"$CPP" = x ] ; then cpp="@CPP@" ; else cpp="$CPP" ; fi -trap "rm -f $temp $clean_infile" 0 1 2 15 +trap "rm -f $temp" 0 1 2 15 if [ ! "$outfile" = "-" ]; then self_blind_regexp='^#include ".*'`basename $outfile`'"' @@ -117,6 +117,7 @@ if [ ! "$outfile" = "-" ]; then # use .c to satisfy cpp heuristics. # clean input file + trap "rm -f $cleanfile" 0 1 2 15 grep -v "$self_blind_regexp" $infile > $clean_infile modern_snarf "$@" $clean_infile > $outfile else From 6f79b6ccebe4edd23a9e0ae202def5320bf59eae Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 16 Apr 2002 20:12:21 +0000 Subject: [PATCH 52/80] *** empty log message *** --- libguile/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 97851ce7e..21e358b66 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2002-03-31 Marius Vollmer + + * guile-snarf: Install the trap for removing $cleanfile only when + the value of $cleanfile is actually known. + 2002-04-10 Rob Browning * .cvsignore: add versiondat.h and *.c.clean.c. From 9ea1cfc656bcf0afe444eb163904b306257eba61 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:35:56 +0000 Subject: [PATCH 53/80] (AUTOMAKE_OPTIONS): New, to request version 1.5. (EXTRA_DIST): Don't distribute acconfig.h, which is gone. (dist-hook): Removed. (DISTCLEANFILES): Added check-guile.log. (EXTRA_DIST): Don't distribute TODO. --- Makefile.am | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 08b5efea0..604508f9e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,7 @@ ## to the Free Software Foundation, Inc., 59 Temple Place, Suite ## 330, Boston, MA 02111-1307 USA +AUTOMAKE_OPTIONS = 1.5 SUBDIRS = oop qt libltdl libguile ice-9 guile-config guile-readline \ scripts srfi doc examples test-suite lang am @@ -29,20 +30,14 @@ include_HEADERS = libguile.h # automake sometimes forgets to distribute acconfig.h, # apparently depending on the phase of the moon. -EXTRA_DIST = qthreads.m4 HACKING GUILE-VERSION ANON-CVS SNAPSHOTS TODO \ - $(ACLOCAL) acconfig.h BUGS +EXTRA_DIST = qthreads.m4 HACKING GUILE-VERSION ANON-CVS SNAPSHOTS \ + $(ACLOCAL) BUGS TESTS = check-guile # The rule will cd to $(top_srcdir). ACLOCAL = ./guile-aclocal.sh -if MAINTAINER_MODE -# Fill dist tree. -include $(top_srcdir)/am/maintainer-dirs -dist-hook: - ( echo 'This is a snapshot of the TODO file.' ; date ; echo ; \ - cat $(workbook)/tasks/TODO ) > TODO -endif +DISTCLEANFILES = check-guile.log # Makefile.am ends here From a44e61ac793a7ab443681cfee01797a3b83d75ee Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:37:29 +0000 Subject: [PATCH 54/80] Bump required autoconf version to 2.53. Move uses of AC_LIBOBJ after AC_PROG_CC. AC_LIBOBJ needs OBJEXT which is set by AC_PROG_CC. --- configure.in | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/configure.in b/configure.in index 1a632ac5d..c25778ee6 100644 --- a/configure.in +++ b/configure.in @@ -20,7 +20,7 @@ dnl along with GUILE; see the file COPYING. If not, write to the dnl Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. -AC_PREREQ(2.50) +AC_PREREQ(2.53) AC_INIT AC_CONFIG_SRCDIR([Makefile.in]) @@ -143,6 +143,31 @@ AC_ARG_ENABLE(elisp, [ --disable-elisp omit Emacs Lisp support],, enable_elisp=yes) +#-------------------------------------------------------------------- + +dnl Some more checks for Win32 +AC_CYGWIN +AC_MINGW32 +AC_LIBTOOL_WIN32_DLL + +AC_LIBLTDL_INSTALLABLE +AC_CONFIG_SUBDIRS(libltdl) + +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_CPP +AC_LIBTOOL_DLOPEN + +AC_AIX +AC_ISC_POSIX +AC_MINIX + +AM_PROG_CC_STDC +AM_PROG_LIBTOOL + +AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no) +AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes) + dnl files which are destined for separate modules. if test "$enable_arrays" = yes; then @@ -175,30 +200,6 @@ if test "$enable_elisp" = yes; then [Define this if you want Elisp support (in addition to Scheme).]) fi -#-------------------------------------------------------------------- - -dnl Some more checks for Win32 -AC_CYGWIN -AC_MINGW32 -AC_LIBTOOL_WIN32_DLL - -AC_LIBLTDL_INSTALLABLE -AC_CONFIG_SUBDIRS(libltdl) - -AC_PROG_INSTALL -AC_PROG_CC -AC_PROG_CPP -AC_LIBTOOL_DLOPEN - -AC_AIX -AC_ISC_POSIX -AC_MINIX - -AM_PROG_CC_STDC -AM_PROG_LIBTOOL - -AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no) -AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes) AC_C_CONST AC_C_INLINE From 595f15f48d19d1fb177bad417d9f3bead95d942f Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:38:41 +0000 Subject: [PATCH 55/80] (dist-hook): Simplified to not use "cd"; now it works for relative pathnames in $(distdir). --- doc/Makefile.am | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 30fa5521a..19e3a1333 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -32,12 +32,11 @@ EXAMPLE_SMOB_FILES = \ OLDFMT = oldfmt.c dist-hook: + cp $(srcdir)/$(OLDFMT) $(distdir)/ mkdir $(distdir)/example-smob - (cd $(srcdir); \ - cp $(OLDFMT) $(distdir); \ - dest="`cd $(distdir)/example-smob; pwd`"; \ - cd example-smob; \ - cp $(EXAMPLE_SMOB_FILES) $$dest) + for f in $(EXAMPLE_SMOB_FILES); do \ + cp $(srcdir)/example-smob/$$f $(distdir)/example-smob/; \ + done # pending the papers from Robert Merkel # EXTRA_DIST = guile.1 From edf7d832d5068cbfbc98d609816ca7d0a50a44b6 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:39:44 +0000 Subject: [PATCH 56/80] (CLEANFILES): Added goops.tmp, goops.cps. --- doc/goops/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/goops/Makefile.am b/doc/goops/Makefile.am index c9edf88b8..3a58df577 100644 --- a/doc/goops/Makefile.am +++ b/doc/goops/Makefile.am @@ -39,3 +39,5 @@ goops_toc.html: goops.texi $(goops_TEXINFOS) $(TEXI2HTML) -split_chapter goops.texi endif + +CLEANFILES = goops.tmp goops.cps From 07b15be28b39aa998cee5b1615929f5949d5292c Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:40:57 +0000 Subject: [PATCH 57/80] (CLEANFILES): Added guile.cps, guile.fns, guile.rns, guile.tps, guile.vrs, guile.tmp. --- doc/ref/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ref/Makefile.am b/doc/ref/Makefile.am index 8459b4b16..584bd8229 100644 --- a/doc/ref/Makefile.am +++ b/doc/ref/Makefile.am @@ -58,4 +58,5 @@ guile_toc.html: guile.texi $(guile_TEXINFOS) endif -CLEANFILES = autoconf-macros.texi +CLEANFILES = autoconf-macros.texi \ + guile.cps guile.fns guile.rns guile.tps guile.vrs guile.tmp From 7ceac84eea5975e32e0e80c4e9fdfd5d3e1a61cd Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:41:43 +0000 Subject: [PATCH 58/80] (dist-hook): Make sure $(distdir)/Makefile.in is writable before modifying it. --- guile-readline/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guile-readline/Makefile.am b/guile-readline/Makefile.am index 2b13b6dc6..22f9acfb2 100644 --- a/guile-readline/Makefile.am +++ b/guile-readline/Makefile.am @@ -63,4 +63,4 @@ dist-hook: sed -e 's|\([ ]\)\(\.\./\(\|libguile/\|guile-readline/\)[a-z_-]*\.h\)|\1$$(srcdir)/\2|g' $(distdir)/Makefile.in \ | sed -e 's|\$$(srcdir)/\(\.\./libguile/\(libpath\|scmconfig\|versiondat\)\)|\1|g' \ | sed -e 's|\.\./guile-readline/\([a-z_-]*\.x\)|\1|g' > $$temp \ - && cp -p $$temp $(distdir)/Makefile.in) + && chmod u+w $(distdir)/Makefile.in && cp -p $$temp $(distdir)/Makefile.in) From dc00662795746fe6c0e8c17066bb75cb951d06c0 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:41:51 +0000 Subject: [PATCH 59/80] *** empty log message *** --- ChangeLog | 12 ++++++++++++ doc/ChangeLog | 5 +++++ doc/goops/ChangeLog | 4 ++++ doc/ref/ChangeLog | 6 ++++++ guile-readline/ChangeLog | 5 +++++ 5 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4f665bbf8..a101dc44f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-04-16 Marius Vollmer + + * Makefile.am (AUTOMAKE_OPTIONS): New, to request version 1.5. + (EXTRA_DIST): Don't distribute acconfig.h, which is gone. + (dist-hook): Removed. + (DISTCLEANFILES): Added check-guile.log. + (EXTRA_DIST): Don't distribute TODO. + + * configure.in: Bump required autoconf version to 2.53. Move uses + of AC_LIBOBJ after AC_PROG_CC. AC_LIBOBJ needs OBJEXT which is + set by AC_PROG_CC. + 2002-04-10 Rob Browning * configure.in: updates for new autoconf -- add definitions to diff --git a/doc/ChangeLog b/doc/ChangeLog index fb4e587ca..9363ad84d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2002-04-16 Marius Vollmer + + * Makefile.am (dist-hook): Simplified to not use "cd"; now it + works for relative pathnames in $(distdir). + 2002-04-10 Rob Browning * .cvsignore: add version-tutorial.texi, version.texi, and diff --git a/doc/goops/ChangeLog b/doc/goops/ChangeLog index e95e04352..9c3cd22a9 100644 --- a/doc/goops/ChangeLog +++ b/doc/goops/ChangeLog @@ -1,3 +1,7 @@ +2002-04-17 Marius Vollmer + + * Makefile.am (CLEANFILES): Added goops.tmp, goops.cps. + 2001-12-03 Thien-Thi Nguyen * goops.texi: Grammar fix. diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index fcd198edf..1715a337c 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,9 @@ +2002-04-17 Marius Vollmer + + * Makefile.am (CLEANFILES): Added guile.cps, guile.fns, guile.rns, + guile.tps, guile.vrs, guile.tmp. + + 2002-04-01 Neil Jerram * scheme-intro.texi (Scheme Layout): Remove reference to defunct diff --git a/guile-readline/ChangeLog b/guile-readline/ChangeLog index c185ba4cb..e7bca2fb9 100644 --- a/guile-readline/ChangeLog +++ b/guile-readline/ChangeLog @@ -1,3 +1,8 @@ +2002-04-16 Marius Vollmer + + * Makefile.am (dist-hook): Make sure $(distdir)/Makefile.in is + writable before modifying it. + 2002-04-10 Rob Browning * configure.in: add definitions to AC_DEFINE calls for new From a3451a590ef1bac98521566eb81179d46515fe17 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:42:50 +0000 Subject: [PATCH 60/80] (EXTRA_DIST): Added cpp_err_symbols.c and cpp_sig_symbols.c. --- libguile/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libguile/Makefile.am b/libguile/Makefile.am index ec9be0c86..13dd676d9 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -149,7 +149,8 @@ noinst_SCRIPTS = guile-doc-snarf guile-snarf-docs guile-func-name-check EXTRA_DIST = ChangeLog-gh ChangeLog-scm ChangeLog-threads \ ChangeLog-1996-1999 ChangeLog-2000 cpp_signal.c \ - cpp_errno.c cpp_err_symbols.in cpp_sig_symbols.in cpp_cnvt.awk \ + cpp_errno.c cpp_err_symbols.in cpp_err_symbols.c \ + cpp_sig_symbols.c cpp_sig_symbols.in cpp_cnvt.awk \ c-tokenize.lex # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \ # guile-procedures.txt guile.texi From 9d2cce766ddd2055021fc55b0866a0a89f33966e Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:44:28 +0000 Subject: [PATCH 61/80] Do not clean input file. This would write to the $(srcdir) during a VPATH build, which is not allowed. It also isn't needed since it only works when an output filename has been specified and in that case we don't need to clean the input file because the output file will already exist. --- libguile/ChangeLog | 13 +++++++++++++ libguile/guile-snarf.in | 17 ++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 21e358b66..af1374da2 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,16 @@ +2002-04-17 Marius Vollmer + + * Makefile.am (EXTRA_DIST): Added cpp_err_symbols.c and + cpp_sig_symbols.c. + +2002-04-16 Marius Vollmer + + * guile-snarf.in: Do not clean input file. This would write to + the $(srcdir) during a VPATH build, which is not allowed. It also + isn't needed since it only works when an output filename has been + specified and in that case we don't need to clean the input file + because the output file will already exist. + 2002-03-31 Marius Vollmer * guile-snarf: Install the trap for removing $cleanfile only when diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in index aaa6926d6..3d9ac957b 100644 --- a/libguile/guile-snarf.in +++ b/libguile/guile-snarf.in @@ -24,11 +24,7 @@ # # Process INFILE using the C pre-processor and some other programs. # Write output to a file named OUTFILE or to the standard output when no -# OUTFILE has been specified or when OUTFILE is "-". When writing -# to a file, ignore lines from the input matching the following grep(1) -# regular expression: -# -# ^#include ".*OUTFILE" +# OUTFILE has been specified or when OUTFILE is "-". # # If there are errors during processing, delete OUTFILE and exit with # non-zero status. @@ -110,16 +106,7 @@ if [ x"$CPP" = x ] ; then cpp="@CPP@" ; else cpp="$CPP" ; fi trap "rm -f $temp" 0 1 2 15 if [ ! "$outfile" = "-" ]; then - self_blind_regexp='^#include ".*'`basename $outfile`'"' - clean_infile=$infile.clean.c # temp file in same dir as infile - # so that #include "foo" works - # (e.g., see libguile/eval.c). - # use .c to satisfy cpp heuristics. - - # clean input file - trap "rm -f $cleanfile" 0 1 2 15 - grep -v "$self_blind_regexp" $infile > $clean_infile - modern_snarf "$@" $clean_infile > $outfile + modern_snarf "$@" $infile > $outfile else modern_snarf "$@" $infile fi From 3c540af4681598c8695b48fff9310824826ba840 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:45:05 +0000 Subject: [PATCH 62/80] (SCM_TESTS_DIRS, dist-hook): New, distribute directories manually. --- test-suite/ChangeLog | 5 +++++ test-suite/Makefile.am | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index 68cc4bef1..66bf17e02 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,3 +1,8 @@ +2002-04-16 Marius Vollmer + + * Makefile.am (SCM_TESTS_DIRS, dist-hook): New, distribute + directories manually. + 2002-02-09 Thien-Thi Nguyen * guile-test (main): Handle `--flag-unresolved'. No longer set diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index 09e8d8a3b..727601ecd 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -1,7 +1,5 @@ SCM_TESTS = tests/alist.test \ - tests/asmobs \ tests/bit-operations.test \ - tests/c-api \ tests/c-api.test \ tests/chars.test \ tests/common-list.test \ @@ -40,4 +38,15 @@ SCM_TESTS = tests/alist.test \ tests/version.test \ tests/weaks.test +SCM_TESTS_DIRS = tests/asmobs \ + tests/c-api + EXTRA_DIST = guile-test lib.scm $(SCM_TESTS) + +## Automake should be able to handle the distribution of tests/asmobs +## etc without any help, but not all version can handle 'deep' +## directories. So we do it on our own. +dist-hook: + for d in $(SCM_TESTS_DIRS); do \ + cp -pR $(srcdir)/$$d $(distdir)/$$d; \ + done From e744af123417444e498c35c6863d512d92adf522 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 17 Apr 2002 17:47:19 +0000 Subject: [PATCH 63/80] *** empty log message *** --- doc/ref/ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 1715a337c..d73231252 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -3,7 +3,6 @@ * Makefile.am (CLEANFILES): Added guile.cps, guile.fns, guile.rns, guile.tps, guile.vrs, guile.tmp. - 2002-04-01 Neil Jerram * scheme-intro.texi (Scheme Layout): Remove reference to defunct From 1901873ffb81ae1ed8af0f3972adf7b718323800 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Thu, 18 Apr 2002 07:51:36 +0000 Subject: [PATCH 64/80] Call automake twice for guile-core so that two copies of mdate-sh get a chance of being installed (one in doc/ref/ and one in doc/tutorial/). --- autogen.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autogen.sh b/autogen.sh index 7d0382061..cd14e9fe8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -48,6 +48,12 @@ rm libltdl/configure.tmp autoheader autoconf + +# Automake has a bug that will let it only add one copy of a missing +# file. We need two mdate-sh, tho, one in doc/ref/ and one in +# doc/tutorial/. We run automake twice as a workaround. + +automake --add-missing automake --add-missing # Make sure that libltdl uses the same autoconf version as the rest. From 7fd1bad4967d1f43d31ff344c7e7a545e67a2741 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Thu, 18 Apr 2002 07:51:45 +0000 Subject: [PATCH 65/80] *** empty log message *** --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index a101dc44f..abf075fed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-04-18 Marius Vollmer + + * autogen.sh: Call automake twice for guile-core so that two + copies of mdate-sh get a chance of being installed (one in + doc/ref/ and one in doc/tutorial/). + 2002-04-16 Marius Vollmer * Makefile.am (AUTOMAKE_OPTIONS): New, to request version 1.5. From 1982a56a975e0cc3a8c5e93ced9e7fa4ffc757d8 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Sat, 20 Apr 2002 11:13:18 +0000 Subject: [PATCH 66/80] * New manual material: example of extending Dia using Guile. --- doc/ref/ChangeLog | 8 + doc/ref/program.texi | 526 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 521 insertions(+), 13 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index d73231252..1b3c63622 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,11 @@ +2002-04-20 Neil Jerram + + * program.texi (Scheme vs C): New node, with existing material + taken from chapter intro. + (Programming Overview): New intro para to introduce example of + Guile integration: + (Extending Dia): New node. + 2002-04-17 Marius Vollmer * Makefile.am (CLEANFILES): Added guile.cps, guile.fns, guile.rns, diff --git a/doc/ref/program.texi b/doc/ref/program.texi index 61aa69096..eba3fdf83 100644 --- a/doc/ref/program.texi +++ b/doc/ref/program.texi @@ -11,10 +11,516 @@ as the application developer, @emph{and your users}, reap the benefits that flow from being able to extend the application in a high level extension language rather than in plain old C. -Underlying this argument is the assumption that programming in a high -level language, specifically Guile's implementation of Scheme, is -necessarily better in some way than programming in C. What do we mean -by this claim, and how can we be so sure? +In abstract terms, it's difficult to explain what this really means and +what the integration process involves, so instead let's begin by jumping +straight into an example of how you might integrate Guile into an +existing program, and what you could expect to gain by so doing. With +that example under our belts, we'll then return to a more general +analysis of the arguments involved and the range of programming options +available. + +@menu +* Extending Dia:: How one might extend Dia using Guile. +* Scheme vs C:: Why Scheme is more hackable than C. +* Testbed Example:: Example: using Guile in a testbed. +* Programming Options:: Options for Guile programming. +* User Programming:: How about application users? +@end menu + + +@node Extending Dia +@section How One Might Extend Dia Using Guile + +Dia is a free software program for drawing schematic diagrams like flow +charts and floor plans (REFFIXME). This section conducts the thought +experiment of adding Guile to Dia. In so doing, it aims to illustrate +several of the steps and considerations involved in adding Guile to +applications in general. + +@menu +* Dia Objective:: Deciding why you want to add Guile. +* Dia Steps:: Four steps required to add Guile. +* Dia Smobs:: How to represent Dia data in Scheme. +* Dia Primitives:: Writing Guile primitives for Dia. +* Dia Hook:: Providing a hook for Scheme evaluation. +* Dia Structure:: Overall structure for adding Guile. +* Dia Advanced:: Going further with Dia and Guile. +@end menu + + +@node Dia Objective +@subsection Deciding Why You Want to Add Guile + +First off, you should understand why you want to add Guile to Dia at +all, and that means forming a picture of what Dia does and how it does +it. So, what are the constituents of the Dia application? + +@itemize @bullet +@item +Most importantly, the @dfn{application domain objects} --- in other +words, the concepts that differentiate Dia from another application such +as a word processor or spreadsheet: shapes, templates, connectors, +pages, plus the properties of all these things. + +@item +The code that manages the graphical face of the application, including +the layout and display of the objects above. + +@item +The code that handles input events, which indicate that the application +user is wanting to do something. +@end itemize + +@noindent +(In other words, a textbook example of the @dfn{model - view - +controller} paradigm.) + +Next question: how will Dia benefit once the Guile integration is +complete? Several (positive!) answers are possible here, and the choice +is obviously up to the application developers. Still, one answer is +that the main benefit will be the ability to manipulate Dia's +application domain objects from Scheme. + +Suppose that Dia made a set of procedures available in Scheme, +representing the most basic operations on objects such as shapes, +connectors, and so on. Using Scheme, the application user could then +write code that builds upon these basic operations to create more +complex procedures. For example, given basic procedures to enumerate +the objects on a page, to determine whether an object is a square, and +to change the fill pattern of a single shape, the user can write a +Scheme procedure to change the fill pattern of all squares on the +current page: + +@lisp +(define (change-squares'-fill-pattern new-pattern) + (for-each-shape current-page + (lambda (shape) + (if (square? shape) + (change-fill-pattern shape new-pattern))))) +@end lisp + + +@node Dia Steps +@subsection Four Steps Required to Add Guile + +Assuming this objective, four steps are needed to achieve it. + +First, you need a way of representing your application-specific objects +--- such as @code{shape} in the previous example --- when they are +passed into the Scheme world. Unless your objects are so simple that +they map naturally into builtin Scheme data types like numbers and +strings, you will probably want to use Guile's @dfn{SMOB} interface to +create a new Scheme data type for your objects. + +Second, you need to write code for the basic operations like +@code{for-each-shape} and @code{square?} such that they access and +manipulate your existing data structures correctly, and then make these +operations available as @dfn{primitives} on the Scheme level. + +Third, you need to provide some mechanism within the Dia application +that a user can hook into to cause arbitrary Scheme code to be +evaluated. + +Finally, you need to restructure your top-level application C code a +little so that it initializes the Guile interpreter correctly and +declares your @dfn{SMOBs} and @dfn{primitives} to the Scheme world. + +The following subsections expand on these four points in turn. + + +@node Dia Smobs +@subsection How to Represent Dia Data in Scheme + +For all but the most trivial applications, you will probably want to +allow some representation of your domain objects to exist on the Scheme +level. This is where the idea of SMOBs comes in, and with it issues of +lifetime management and garbage collection. + +To get more concrete about this, let's look again at the example we gave +earlier of how application users can use Guile to build higher-level +functions from the primitives that Dia itself provides. + +@lisp +(define (change-squares'-fill-pattern new-pattern) + (for-each-shape current-page + (lambda (shape) + (if (square? shape) + (change-fill-pattern shape new-pattern))))) +@end lisp + +Consider what is stored here in the variable @code{shape}. For each +shape on the current page, the @code{for-each-shape} primitive calls +@code{(lambda (shape) @dots{})} with an argument representing that +shape. Question is: how is that argument represented on the Scheme +level? The issues are as follows. + +@itemize @bullet +@item +Whatever the representation, it has to be decodable again by the C code +for the @code{square?} and @code{change-fill-pattern} primitives. In +other words, a primitive like @code{square?} has somehow to be able to +turn the value that it receives back into something that points to the +underlying C structure describing a shape. + +@item +The representation must also cope with Scheme code holding on to the +value for later use. What happens if the Scheme code stores +@code{shape} in a global variable, but then that shape is deleted (in a +way that the Scheme code is not aware of), and later on some other +Scheme code uses that global variable again in a call to, say, +@code{square?}? + +@item +The lifetime and memory allocation of objects that exist @emph{only} in +the Scheme world is managed automatically by Guile's garbage collector +using one simple rule: when there are no remaining references to an +object, the object is considered dead and so its memory is freed. But +for objects that exist in both C and Scheme, the picture is more +complicated; in the case of Dia, where the @code{shape} argument passes +transiently in and out of the Scheme world, it would be quite wrong the +@strong{delete} the underlying C shape just because the Scheme code has +finished evaluation. How do we avoid this happening? +@end itemize + +One resolution of these issues is for the Scheme-level representation of +a shape to be a new, Scheme-specific C structure wrapped up as a SMOB. +The SMOB is what is passed into and out of Scheme code, and the +Scheme-specific C structure inside the SMOB points to Dia's underlying C +structure so that the code for primitives like @code{square?} can get at +it. + +To cope with an underlying shape being deleted while Scheme code is +still holding onto a Scheme shape value, the underlying C structure +should have a new field that points to the Scheme-specific SMOB. When a +shape is deleted, the relevant code chains through to the +Scheme-specific structure and sets its pointer back to the underlying +structure to NULL. Thus the SMOB value for the shape continues to +exist, but any primitive code that tries to use it will detect that the +underlying shape has been deleted because the underlying structure +pointer is NULL. + +So, to summarize the steps involved in this resolution of the problem +(and assuming that the underlying C structure for a shape is +@code{struct dia_shape}): + +@itemize @bullet +@item +Define a new Scheme-specific structure that @emph{points} to the +underlying C structure: + +@lisp +struct dia_guile_shape +@{ + struct dia_shape * c_shape; /* NULL => deleted */ +@} +@end lisp + +@item +Add a field to @code{struct dia_shape} that points to its @code{struct +dia_guile_shape} if it has one --- + +@lisp +struct dia_shape +@{ + @dots{} + struct dia_guile_shape * guile_shape; +@} +@end lisp + +@noindent +--- so that C code can set @code{guile_shape->c_shape} to NULL when the +underlying shape is deleted. + +@item +Wrap @code{struct dia_guile_shape} as a SMOB type. + +@item +Whenever you need to represent a C shape onto the Scheme level, create a +SMOB instance for it, and pass that. + +@item +In primitive code that receives a shape SMOB instance, check the +@code{c_shape} field when decoding it, to find out whether the +underlying C shape is still there. +@end itemize + +As far as memory management is concerned, the SMOB values and their +Scheme-specific structures are under the control of the garbage +collector, whereas the underlying C structures are explicitly managed in +exactly the same way that Dia managed them before we thought of adding +Guile. + +When the garbage collector decides to free a shape SMOB value, it calls +the @dfn{SMOB free} function that was specified when defining the shape +SMOB type. To maintain the correctness of the @code{guile_shape} field +in the underlying C structure, this function should chain through to the +underlying C structure (if it still exists) and set its +@code{guile_shape} field to NULL. + +For full documentation on defining and using SMOB types, see +@ref{Defining New Types (Smobs)}. + + +@node Dia Primitives +@subsection Writing Guile Primitives for Dia + +Once the details of object representation are decided, writing the +primitive function code that you need is usually straightforward. + +A primitive is simply a C function whose arguments and return value are +all of type @code{SCM}, and whose body does whatever you want it to do. +As an example, here is a possible implementation of the @code{square?} +primitive: + +@lisp +#define FUNC_NAME "square?" +static SCM square_p (SCM shape) +@{ + struct dia_guile_shape * guile_shape; + + /* Check that arg is really a shape SMOB. */ + SCM_VALIDATE_SHAPE (SCM_ARG1, shape); + + /* Access Scheme-specific shape structure. */ + guile_shape = SCM_SMOB_DATA (shape); + + /* Find out if underlying shape exists and is a + square; return answer as a Scheme boolean. */ + return SCM_BOOL (guile_shape->c_shape && + (guile_shape->c_shape->type == DIA_SQUARE)); +@} +#undef FUNC_NAME +@end lisp + +Notice how easy it is to chain through from the @code{SCM shape} +parameter that @code{square_p} receives --- which is a SMOB --- to the +Scheme-specific structure inside the SMOB, and thence to the underlying +C structure for the shape. + +In this code, @code{SCM_SMOB_DATA} and @code{SCM_BOOL} are macros from +the standard Guile API. @code{SCM_VALIDATE_SHAPE} is a macro that you +should define as part of your SMOB definition: it checks that the passed +parameter is of the expected type. This is needed to guard against +Scheme code using the @code{square?} procedure incorrectly, as in +@code{(square? "hello")}; Scheme's latent typing means that usage errors +like this must be caught at run time. + +Having written the C code for your primitives, you need to make them +available as Scheme procedures by calling the @code{scm_c_define_gsubr} +function. @code{scm_c_define_gsubr} (REFFIXME) takes arguments that +specify the Scheme-level name for the primitive and how many required, +optional and rest arguments it can accept. The @code{square?} primitive +always requires exactly one argument, so the call to make it available +in Scheme reads like this: + +@lisp +scm_c_define_gsubr ("square?", 1, 0, 0, square_p); +@end lisp + +For where to put this call, see the subsection after next on the +structure of Guile-enabled code (@pxref{Dia Structure}). + + +@node Dia Hook +@subsection Providing a Hook for the Evaluation of Scheme Code + +To make the Guile integration useful, you have to design some kind of +hook into your application that application users can use to cause their +Scheme code to be evaluated. + +Technically, this is straightforward; you just have to decide on a +mechanism that is appropriate for your application. Think of Emacs, for +example: when you type @kbd{@key{ESC} :}, you get a prompt where you can +type in any Elisp code, which Emacs will then evaluate. Or, again like +Emacs, you could provide a mechanism (such as an init file) to allow +Scheme code to be associated with a particular key sequence, and +evaluate the code when that key sequence is entered. + +In either case, once you have the Scheme code that you want to evaluate, +as a null terminated string, you can tell Guile to evaluate it by +calling the @code{scm_c_eval_string} function. + + +@node Dia Structure +@subsection Top-level Structure of Guile-enabled Dia + +Let's assume that the pre-Guile Dia code looks structurally like this: + +@itemize @bullet +@item +@code{main ()} + +@itemize @bullet +@item +do lots of initialization and setup stuff +@item +enter Gtk main loop +@end itemize +@end itemize + +When you add Guile to a program, one (rather technical) requirement is +that Guile's garbage collector needs to know where the bottom of the C +stack is. The easiest way to ensure this is to use +@code{scm_boot_guile} like this: + +@itemize @bullet +@item +@code{main ()} + +@itemize @bullet +@item +do lots of initialization and setup stuff +@item +@code{scm_boot_guile (argc, argv, inner_main, NULL)} +@end itemize + +@item +@code{inner_main ()} + +@itemize @bullet +@item +define all SMOB types +@item +export primitives to Scheme using @code{scm_c_define_gsubr} +@item +enter Gtk main loop +@end itemize +@end itemize + +In other words, you move the guts of what was previously in your +@code{main} function into a new function called @code{inner_main}, and +then add a @code{scm_boot_guile} call, with @code{inner_main} as a +parameter, to the end of @code{main}. + +Assuming that you are using SMOBs and have written primitive code as +described in the preceding subsections, you also need to insert calls to +declare your new SMOBs and export the primitives to Scheme. These +declarations must happen @emph{inside} the dynamic scope of the +@code{scm_boot_guile} call, but also @emph{before} any code is run that +could possibly use them --- the beginning of @code{inner_main} is an +ideal place for this. + + +@node Dia Advanced +@subsection Going Further with Dia and Guile + +The steps described so far implement an initial Guile integration that +already gives a lot of additional power to Dia application users. But +there are further steps that you could take, and it's interesting to +consider a few of these. + +In general, you could progressively move more of Dia's source code from +C into Scheme. This might make the code more maintainable and +extensible, and it could open the door to new programming paradigms that +are tricky to effect in C but straightforward in Scheme. + +A specific example of this is that you could use the guile-gtk package, +which provides Scheme-level procedures for most of the Gtk+ library, to +move the code that lays out and displays Dia objects from C to Scheme. + +As you follow this path, it naturally becomes less useful to maintain a +distinction between Dia's original non-Guile-related source code, and +its later code implementing SMOBs and primitives for the Scheme world. + +For example, suppose that the original source code had a +@code{dia_change_fill_pattern} function: + +@lisp +void dia_change_fill_pattern (struct dia_shape * shape, + struct dia_pattern * pattern) +@{ + /* real pattern change work */ +@} +@end lisp + +During initial Guile integration, you add a @code{change_fill_pattern} +primitive for Scheme purposes, which accesses the underlying structures +from its SMOB values and uses @code{dia_change_fill_pattern} to do the +real work: + +@lisp +SCM change_fill_pattern (SCM shape, SCM pattern) +@{ + struct dia_shape * d_shape; + struct dia_pattern * d_pattern; + + @dots{} + + dia_change_fill_pattern (d_shape, d_pattern); + + return SCM_UNSPECIFIED; +@} +@end lisp + +At this point, it makes sense to keep @code{dia_change_fill_pattern} and +@code{change_fill_pattern} separate, because +@code{dia_change_fill_pattern} can also be called without going through +Scheme at all, say because the user clicks a button which causes a +C-registered Gtk+ callback to be called. + +But, if the code for creating buttons and registering their callbacks is +moved into Scheme (using guile-gtk), it may become true that +@code{dia_change_fill_pattern} can no longer be called other than +through Scheme. In which case, it makes sense to abolish it and move +its contents directly into @code{change_fill_pattern}, like this: + +@lisp +SCM change_fill_pattern (SCM shape, SCM pattern) +@{ + struct dia_shape * d_shape; + struct dia_pattern * d_pattern; + + @dots{} + + /* real pattern change work */ + + return SCM_UNSPECIFIED; +@} +@end lisp + +So further Guile integration progressively @emph{reduces} the amount of +functional C code that you have to maintain over the long term. + +A similar argument applies to data representation. In the discussion of +SMOBs earlier, issues arose because of the different memory management +and lifetime models that normally apply to data structures in C and in +Scheme. However, with further Guile integration, you can resolve this +issue in a more radical way by allowing all your data structures to be +under the control of the garbage collector, and kept alive by references +from the Scheme world. Instead of maintaining an array or linked list +of shapes in C, you would instead maintain a list in Scheme. + +Rather like the coalescing of @code{dia_change_fill_pattern} and +@code{change_fill_pattern}, the practical upshot of such a change is +that you would no longer have to keep the @code{dia_shape} and +@code{dia_guile_shape} structures separate, and so wouldn't need to +worry about the pointers between them. Instead, you could change the +SMOB definition to wrap the @code{dia_shape} structure directly, and +send @code{dia_guile_shape} off to the scrap yard. Cut out the middle +man! + +Finally, we come to the holy grail of Guile's free software / extension +language approach. Once you have a Scheme representation for +interesting Dia data types like shapes, and a handy bunch of primitives +for manipulating them, it suddenly becomes clear that you have a bundle +of functionality that could have far-ranging use beyond Dia itself. In +other words, the data types and primitives could now become a library, +and Dia becomes just one of the many possible applications using that +library --- albeit, at this early stage, a rather important one! + +In this model, Guile becomes just the glue that binds everything +together. Imagine an application that usefully combined functionality +from Dia, Gnumeric and GnuCash --- it's tricky right now, because no +such application yet exists; but it'll happen some day @dots{} + + +@node Scheme vs C +@section Why Scheme is More Hackable Than C + +Underlying Guile's value proposition is the assumption that programming +in a high level language, specifically Guile's implementation of Scheme, +is necessarily better in some way than programming in C. What do we +mean by this claim, and how can we be so sure? One class of advantages applies not only to Scheme, but more generally to any interpretable, high level, scripting language, such as Emacs @@ -36,9 +542,9 @@ They provide high level features such as container objects and exception handling that make common programming tasks easier. @end itemize -In the case of Scheme, further features that make programming easier --- -and more fun! --- are its powerful mechanisms for abstracting parts of -programs (closures --- @pxref{About Closure}) and for iteration +In the case of Scheme, particular features that make programming easier +--- and more fun! --- are its powerful mechanisms for abstracting parts +of programs (closures --- @pxref{About Closure}) and for iteration (@pxref{while do}). The evidence in support of this argument is empirical: the huge amount @@ -51,12 +557,6 @@ GnuCash. It is close to inconceivable that similar amounts of functionality could have been added to these applications just by writing new code in their base implementation languages. -@menu -* Testbed Example:: Example: using Guile in a testbed. -* Programming Options:: Options for Guile programming. -* User Programming:: How about application users? -@end menu - @node Testbed Example @section Example: Using Guile for an Application Testbed From f2ba76aea59136a8d1ca15456c8c96545ae468da Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Sat, 20 Apr 2002 15:52:13 +0000 Subject: [PATCH 67/80] * Manual work on debugging infrastructure --- doc/ref/ChangeLog | 20 +++ doc/ref/debugging.texi | 6 + doc/ref/scheme-control.texi | 11 ++ doc/ref/scheme-debug.texi | 255 +++++++++++++++------------------ doc/ref/scheme-memory.texi | 14 +- doc/ref/scheme-procedures.texi | 24 +++- 6 files changed, 180 insertions(+), 150 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 1b3c63622..ced89de8c 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,5 +1,25 @@ 2002-04-20 Neil Jerram + * scheme-debug.texi (Debugging): Rename chapter `Debugging + Infrastructure' and reorganize its contents. + + * scheme-debug.texi (Debugging), scheme-control.texi (Handling + Errors): Move display-error to error-focussed section. + + * scheme-debug.texi (Debugging), debugging.texi (Backtrace): Move + backtrace to user-level debugging chapter. + + * scheme-debug.texi (Debugging), scheme-procedures.texi (Procedure + Properties): Move procedure-name, procedure-source and + procedure-environment to procedures chapter. + + * scheme-debug.texi (Debugging), scheme-memory.texi (Memory + Blocks): Move malloc-stats to memory management chapter. + + * scheme-procedures.texi (Syntax Rules): Remove mention of + use-modules for loading syncase; only use-syntax really works. + Thanks to Panagiotis Vossos for spotting this. + * program.texi (Scheme vs C): New node, with existing material taken from chapter intro. (Programming Overview): New intro para to introduce example of diff --git a/doc/ref/debugging.texi b/doc/ref/debugging.texi index 45fef5082..0a2471ca8 100644 --- a/doc/ref/debugging.texi +++ b/doc/ref/debugging.texi @@ -109,6 +109,12 @@ iteration. Using @code{trace} here helps us see why this is so. @node Backtrace @section Backtrace +@deffn {Scheme Procedure} backtrace +@deffnx {C Function} scm_backtrace () +Display a backtrace of the stack saved by the last error +to the current output port. +@end deffn + @node Stacks and Frames @section Stacks and Frames diff --git a/doc/ref/scheme-control.texi b/doc/ref/scheme-control.texi index e8d70e449..184ccae9d 100644 --- a/doc/ref/scheme-control.texi +++ b/doc/ref/scheme-control.texi @@ -878,6 +878,17 @@ Throw an error using the key @code{'misc-error}. The error message is created by displaying @var{msg} and writing the @var{args}. @end deffn +@deffn {Scheme Procedure} display-error stack port subr message args rest +@deffnx {C Function} scm_display_error (stack, port, subr, message, args, rest) +Display an error message to the output port @var{port}. +@var{stack} is the saved stack for the error, @var{subr} is +the name of the procedure in which the error occurred and +@var{message} is the actual error message, which may contain +formatting instructions. These will format the arguments in +the list @var{args} accordingly. @var{rest} is currently +ignored. +@end deffn + The following are the error keys defined by libguile and the situations in which they are used: diff --git a/doc/ref/scheme-debug.texi b/doc/ref/scheme-debug.texi index f3dde5a35..ce0be8907 100644 --- a/doc/ref/scheme-debug.texi +++ b/doc/ref/scheme-debug.texi @@ -1,51 +1,6 @@ @page @node Debugging -@chapter Internal Debugging Interface - ---- The name of this chapter needs to clearly distinguish it - from the appendix describing the debugger UI. The intro - should have a pointer to the UI appendix. - -@deffn {Scheme Procedure} display-error stack port subr message args rest -@deffnx {C Function} scm_display_error (stack, port, subr, message, args, rest) -Display an error message to the output port @var{port}. -@var{stack} is the saved stack for the error, @var{subr} is -the name of the procedure in which the error occurred and -@var{message} is the actual error message, which may contain -formatting instructions. These will format the arguments in -the list @var{args} accordingly. @var{rest} is currently -ignored. -@end deffn - -@deffn {Scheme Procedure} display-application frame [port [indent]] -@deffnx {C Function} scm_display_application (frame, port, indent) -Display a procedure application @var{frame} to the output port -@var{port}. @var{indent} specifies the indentation of the -output. -@end deffn - -@deffn {Scheme Procedure} display-backtrace stack port [first [depth]] -@deffnx {C Function} scm_display_backtrace (stack, port, first, depth) -Display a backtrace to the output port @var{port}. @var{stack} -is the stack to take the backtrace from, @var{first} specifies -where in the stack to start and @var{depth} how much frames -to display. Both @var{first} and @var{depth} can be @code{#f}, -which means that default values will be used. -@end deffn - -@deffn {Scheme Procedure} backtrace -@deffnx {C Function} scm_backtrace () -Display a backtrace of the stack saved by the last error -to the current output port. -@end deffn - -@deffn {Scheme Procedure} malloc-stats -Return an alist ((@var{what} . @var{n}) ...) describing number -of malloced objects. -@var{what} is the second argument to @code{scm_gc_malloc}, -@var{n} is the number of objects of that type currently -allocated. -@end deffn +@chapter Debugging Infrastructure @deffn {Scheme Procedure} debug-options-interface [setting] @deffnx {C Function} scm_debug_options (setting) @@ -54,110 +9,21 @@ this procedure directly, use the procedures @code{debug-enable}, @code{debug-disable}, @code{debug-set!} and @code{debug-options}. @end deffn + +@section Using Traps + @deffn {Scheme Procedure} with-traps thunk @deffnx {C Function} scm_with_traps (thunk) Call @var{thunk} with traps enabled. @end deffn -@deffn {Scheme Procedure} memoized? obj -@deffnx {C Function} scm_memoized_p (obj) -Return @code{#t} if @var{obj} is memoized. -@end deffn - -@deffn {Scheme Procedure} unmemoize m -@deffnx {C Function} scm_unmemoize (m) -Unmemoize the memoized expression @var{m}, -@end deffn - -@deffn {Scheme Procedure} memoized-environment m -@deffnx {C Function} scm_memoized_environment (m) -Return the environment of the memoized expression @var{m}. -@end deffn - -@deffn {Scheme Procedure} procedure-name proc -@deffnx {C Function} scm_procedure_name (proc) -Return the name of the procedure @var{proc} -@end deffn - -@deffn {Scheme Procedure} procedure-source proc -@deffnx {C Function} scm_procedure_source (proc) -Return the source of the procedure @var{proc}. -@end deffn - -@deffn {Scheme Procedure} procedure-environment proc -@deffnx {C Function} scm_procedure_environment (proc) -Return the environment of the procedure @var{proc}. -@end deffn - @deffn {Scheme Procedure} debug-object? obj @deffnx {C Function} scm_debug_object_p (obj) Return @code{#t} if @var{obj} is a debug object. @end deffn -@deffn {Scheme Procedure} frame-arguments frame -@deffnx {C Function} scm_frame_arguments (frame) -Return the arguments of @var{frame}. -@end deffn -@deffn {Scheme Procedure} frame-evaluating-args? frame -@deffnx {C Function} scm_frame_evaluating_args_p (frame) -Return @code{#t} if @var{frame} contains evaluated arguments. -@end deffn - -@deffn {Scheme Procedure} frame-next frame -@deffnx {C Function} scm_frame_next (frame) -Return the next frame of @var{frame}, or @code{#f} if -@var{frame} is the last frame in its stack. -@end deffn - -@deffn {Scheme Procedure} frame-number frame -@deffnx {C Function} scm_frame_number (frame) -Return the frame number of @var{frame}. -@end deffn - -@deffn {Scheme Procedure} frame-overflow? frame -@deffnx {C Function} scm_frame_overflow_p (frame) -Return @code{#t} if @var{frame} is an overflow frame. -@end deffn - -@deffn {Scheme Procedure} frame-previous frame -@deffnx {C Function} scm_frame_previous (frame) -Return the previous frame of @var{frame}, or @code{#f} if -@var{frame} is the first frame in its stack. -@end deffn - -@deffn {Scheme Procedure} frame-procedure frame -@deffnx {C Function} scm_frame_procedure (frame) -Return the procedure for @var{frame}, or @code{#f} if no -procedure is associated with @var{frame}. -@end deffn - -@deffn {Scheme Procedure} frame-procedure? frame -@deffnx {C Function} scm_frame_procedure_p (frame) -Return @code{#t} if a procedure is associated with @var{frame}. -@end deffn - -@deffn {Scheme Procedure} frame-real? frame -@deffnx {C Function} scm_frame_real_p (frame) -Return @code{#t} if @var{frame} is a real frame. -@end deffn - -@deffn {Scheme Procedure} frame-source frame -@deffnx {C Function} scm_frame_source (frame) -Return the source of @var{frame}. -@end deffn - -@deffn {Scheme Procedure} frame? obj -@deffnx {C Function} scm_frame_p (obj) -Return @code{#t} if @var{obj} is a stack frame. -@end deffn - -@deffn {Scheme Procedure} last-stack-frame obj -@deffnx {C Function} scm_last_stack_frame (obj) -Return a stack which consists of a single frame, which is the -last stack frame for @var{obj}. @var{obj} must be either a -debug object or a continuation. -@end deffn +@section Capturing the Stack or Innermost Stack Frame @deffn {Scheme Procedure} make-stack obj . args @deffnx {C Function} scm_make_stack (obj, args) @@ -191,6 +57,21 @@ If the @var{outer_cut_N} of the last pair is missing, it is taken as 0. @end deffn +@deffn {Scheme Procedure} last-stack-frame obj +@deffnx {C Function} scm_last_stack_frame (obj) +Return a stack which consists of a single frame, which is the +last stack frame for @var{obj}. @var{obj} must be either a +debug object or a continuation. +@end deffn + + +@section Examining the Stack + +@deffn {Scheme Procedure} stack? obj +@deffnx {C Function} scm_stack_p (obj) +Return @code{#t} if @var{obj} is a calling stack. +@end deffn + @deffn {Scheme Procedure} stack-id stack @deffnx {C Function} scm_stack_id (stack) Return the identifier given to @var{stack} by @code{start-stack}. @@ -206,9 +87,99 @@ Return the length of @var{stack}. Return the @var{index}'th frame from @var{stack}. @end deffn -@deffn {Scheme Procedure} stack? obj -@deffnx {C Function} scm_stack_p (obj) -Return @code{#t} if @var{obj} is a calling stack. +@deffn {Scheme Procedure} display-backtrace stack port [first [depth]] +@deffnx {C Function} scm_display_backtrace (stack, port, first, depth) +Display a backtrace to the output port @var{port}. @var{stack} +is the stack to take the backtrace from, @var{first} specifies +where in the stack to start and @var{depth} how much frames +to display. Both @var{first} and @var{depth} can be @code{#f}, +which means that default values will be used. +@end deffn + + +@section Examining Stack Frames + +@deffn {Scheme Procedure} frame? obj +@deffnx {C Function} scm_frame_p (obj) +Return @code{#t} if @var{obj} is a stack frame. +@end deffn + +@deffn {Scheme Procedure} frame-number frame +@deffnx {C Function} scm_frame_number (frame) +Return the frame number of @var{frame}. +@end deffn + +@deffn {Scheme Procedure} frame-previous frame +@deffnx {C Function} scm_frame_previous (frame) +Return the previous frame of @var{frame}, or @code{#f} if +@var{frame} is the first frame in its stack. +@end deffn + +@deffn {Scheme Procedure} frame-next frame +@deffnx {C Function} scm_frame_next (frame) +Return the next frame of @var{frame}, or @code{#f} if +@var{frame} is the last frame in its stack. +@end deffn + +@deffn {Scheme Procedure} frame-source frame +@deffnx {C Function} scm_frame_source (frame) +Return the source of @var{frame}. +@end deffn + +@deffn {Scheme Procedure} frame-procedure? frame +@deffnx {C Function} scm_frame_procedure_p (frame) +Return @code{#t} if a procedure is associated with @var{frame}. +@end deffn + +@deffn {Scheme Procedure} frame-procedure frame +@deffnx {C Function} scm_frame_procedure (frame) +Return the procedure for @var{frame}, or @code{#f} if no +procedure is associated with @var{frame}. +@end deffn + +@deffn {Scheme Procedure} frame-arguments frame +@deffnx {C Function} scm_frame_arguments (frame) +Return the arguments of @var{frame}. +@end deffn + +@deffn {Scheme Procedure} frame-evaluating-args? frame +@deffnx {C Function} scm_frame_evaluating_args_p (frame) +Return @code{#t} if @var{frame} contains evaluated arguments. +@end deffn + +@deffn {Scheme Procedure} frame-overflow? frame +@deffnx {C Function} scm_frame_overflow_p (frame) +Return @code{#t} if @var{frame} is an overflow frame. +@end deffn + +@deffn {Scheme Procedure} frame-real? frame +@deffnx {C Function} scm_frame_real_p (frame) +Return @code{#t} if @var{frame} is a real frame. +@end deffn + +@deffn {Scheme Procedure} display-application frame [port [indent]] +@deffnx {C Function} scm_display_application (frame, port, indent) +Display a procedure application @var{frame} to the output port +@var{port}. @var{indent} specifies the indentation of the +output. +@end deffn + + +@section Decoding Memoized Source Expressions + +@deffn {Scheme Procedure} memoized? obj +@deffnx {C Function} scm_memoized_p (obj) +Return @code{#t} if @var{obj} is memoized. +@end deffn + +@deffn {Scheme Procedure} unmemoize m +@deffnx {C Function} scm_unmemoize (m) +Unmemoize the memoized expression @var{m}, +@end deffn + +@deffn {Scheme Procedure} memoized-environment m +@deffnx {C Function} scm_memoized_environment (m) +Return the environment of the memoized expression @var{m}. @end deffn diff --git a/doc/ref/scheme-memory.texi b/doc/ref/scheme-memory.texi index af0088692..d6f0584c6 100644 --- a/doc/ref/scheme-memory.texi +++ b/doc/ref/scheme-memory.texi @@ -26,6 +26,7 @@ Return an association list of statistics about Guile's current use of storage. @end deffn + @node Memory Blocks @section Memory Blocks @@ -80,7 +81,6 @@ When not enough memory is available, signal an error. This function runs the GC to free up some memory when it deems it appropriate. @end deftypefn - @deftypefn {C Function} void scm_gc_register_collectable_memory (void *@var{mem}, size_t @var{size}, const char *@var{what}) Informs the GC that the memory at @var{mem} of size @var{size} can potentially be freed during a GC. That is, announce that @var{mem} is @@ -108,7 +108,6 @@ this, the GC might have a wrong impression of what is going on and run much less efficiently than it could. @end deftypefn - @deftypefn {C Function} void *scm_gc_malloc (size_t @var{size}, const char *@var{what}) @deftypefnx {C Function} void *scm_gc_realloc (void *@var{mem}, size_t @var{old_size}, size_t @var{new_size}, const char *@var{what}); Like @code{scm_malloc} or @code{scm_realloc}, but also call @@ -127,8 +126,16 @@ frees us from tracking this value in the GC itself, which will keep the memory management overhead very low. @end deftypefn +@deffn {Scheme Procedure} malloc-stats +Return an alist ((@var{what} . @var{n}) ...) describing number +of malloced objects. +@var{what} is the second argument to @code{scm_gc_malloc}, +@var{n} is the number of objects of that type currently +allocated. +@end deffn -@subsection Upgrading from scm_must_malloc et al + +@subsection Upgrading from scm_must_malloc et al. Version 1.6 of Guile and earlier did not have the functions from the previous section. In their place, it had the functions @@ -184,6 +191,7 @@ The important thing is to always pair @code{scm_malloc} with The same reasoning applies to @code{scm_must_realloc} and @code{scm_realloc} versus @code{scm_gc_realloc}. + @node Weak References @section Weak References diff --git a/doc/ref/scheme-procedures.texi b/doc/ref/scheme-procedures.texi index 3da356f4f..36f840ecc 100644 --- a/doc/ref/scheme-procedures.texi +++ b/doc/ref/scheme-procedures.texi @@ -368,6 +368,21 @@ Procedure properties are general properties to be attached to procedures. These can be the name of a procedure or other relevant information, such as debug hints. +@deffn {Scheme Procedure} procedure-name proc +@deffnx {C Function} scm_procedure_name (proc) +Return the name of the procedure @var{proc} +@end deffn + +@deffn {Scheme Procedure} procedure-source proc +@deffnx {C Function} scm_procedure_source (proc) +Return the source of the procedure @var{proc}. +@end deffn + +@deffn {Scheme Procedure} procedure-environment proc +@deffnx {C Function} scm_procedure_environment (proc) +Return the environment of the procedure @var{proc}. +@end deffn + @deffn {Scheme Procedure} procedure-properties proc @deffnx {C Function} scm_procedure_properties (proc) Return @var{obj}'s property list. @@ -627,11 +642,10 @@ example of the previous section looks like this: In Guile, the @code{syntax-rules} system is provided by the @code{(ice-9 syncase)} module. To make these facilities available in your code, -include the expression @code{(use-modules (ice-9 syncase))} or -@code{(use-syntax (ice-9 syncase))} (@pxref{Using Guile Modules}) -before the first usage of @code{define-syntax} etc. If you are writing -a Scheme module, you can alternatively use one of the keywords -@code{#:use-module} and @code{#:use-syntax} in your @code{define-module} +include the expression @code{(use-syntax (ice-9 syncase))} (@pxref{Using +Guile Modules}) before the first usage of @code{define-syntax} etc. If +you are writing a Scheme module, you can alternatively include the form +@code{#:use-syntax (ice-9 syncase)} in your @code{define-module} declaration (@pxref{Creating Guile Modules}). @menu From ce9d056227b0548cf5c1ca11dab10dfe0b8e491c Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Sat, 20 Apr 2002 19:26:40 +0000 Subject: [PATCH 68/80] Manual debugging and refactoring work. --- doc/ref/ChangeLog | 24 ++++++++++ doc/ref/debugging.texi | 76 +------------------------------ doc/ref/guile.texi | 90 +++++++++++++++++++++++-------------- doc/ref/preface.texi | 21 ++++----- doc/ref/scheme-debug.texi | 18 ++++++++ doc/ref/scheme-intro.texi | 22 +-------- doc/ref/scheme-modules.texi | 2 +- doc/ref/scm.texi | 17 ++++++- 8 files changed, 130 insertions(+), 140 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index ced89de8c..235c53373 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,5 +1,29 @@ 2002-04-20 Neil Jerram + * scheme-intro.texi (Scheme Layout), scm.texi (Reference Layout): + Node moved from a to b. + + * guile.texi (Scheme Intro, Basic Ideas, Guile Scripting, Command + Line Handling, Debugging Features, Autoconf Support, Miscellaneous + Tools, Further Reading): Moved to new Part II. + + * preface.texi (Manual Layout): Part numbers updated accordingly. + + * guile.texi (Top): Move API Overview node to beginning of Guile + API Reference part. + (Part II: Writing and Running Guile Scheme): New part; will + contain content from `Programming with Guile' that pertains to + writing and using Guile on the Scheme level. + + * scm.texi (API Overview): Renamed from `Guile API'. + + * guile.texi (Top), scheme-modules.texi (Included Guile Modules): + Debugger User Interface node renamed Debugging Features. + + * debugging.texi (Stacks and Frames): Node deleted; non-duplicated + material moved to scheme-debug.texi. + (Debugging Features): Renamed from `Debugger User Interface'. + * scheme-debug.texi (Debugging): Rename chapter `Debugging Infrastructure' and reorganize its contents. diff --git a/doc/ref/debugging.texi b/doc/ref/debugging.texi index 0a2471ca8..06a61473d 100644 --- a/doc/ref/debugging.texi +++ b/doc/ref/debugging.texi @@ -1,6 +1,6 @@ @page -@node Debugger User Interface -@chapter Debugger User Interface +@node Debugging Features +@chapter Debugging Features @c --- The title and introduction of this appendix need to @c distinguish this clearly from the chapter on the internal @@ -23,7 +23,6 @@ and explain why they can't be used to debug interpreted Scheme or Lisp?] * Single-Step:: Execute a program or function one step at a time. * Trace:: Print a report each time a given function is called. * Backtrace:: See a list of the statements that caused an error. -* Stacks and Frames:: Examine the state of an interrupted program. @end menu @@ -114,74 +113,3 @@ iteration. Using @code{trace} here helps us see why this is so. Display a backtrace of the stack saved by the last error to the current output port. @end deffn - - -@node Stacks and Frames -@section Stacks and Frames - -When a running program is interrupted, usually upon reaching an error or -breakpoint, its state is represented by a @dfn{stack} of suspended -function calls, each of which is called a @dfn{frame}. The programmer -can learn more about the program's state at the point of interruption by -inspecting and modifying these frames. - -@deffn {Scheme Procedure} stack? obj -Return @code{#t} if @var{obj} is a calling stack. -@end deffn - -@deffn {Scheme Procedure} make-stack -@end deffn - -@deffn syntax start-stack id exp -Evaluate @var{exp} on a new calling stack with identity @var{id}. If -@var{exp} is interrupted during evaluation, backtraces will not display -frames farther back than @var{exp}'s top-level form. This macro is a -way of artificially limiting backtraces and stack procedures, largely as -a convenience to the user. -@end deffn - -@deffn {Scheme Procedure} stack-id stack -Return the identifier given to @var{stack} by @code{start-stack}. -@end deffn - -@deffn {Scheme Procedure} stack-ref -@end deffn - -@deffn {Scheme Procedure} stack-length -@end deffn - -@deffn {Scheme Procedure} frame? -@end deffn - -@deffn {Scheme Procedure} last-stack-frame -@end deffn - -@deffn {Scheme Procedure} frame-number -@end deffn - -@deffn {Scheme Procedure} frame-source -@end deffn - -@deffn {Scheme Procedure} frame-procedure -@end deffn - -@deffn {Scheme Procedure} frame-arguments -@end deffn - -@deffn {Scheme Procedure} frame-previous -@end deffn - -@deffn {Scheme Procedure} frame-next -@end deffn - -@deffn {Scheme Procedure} frame-real? -@end deffn - -@deffn {Scheme Procedure} frame-procedure? -@end deffn - -@deffn {Scheme Procedure} frame-evaluating-args? -@end deffn - -@deffn {Scheme Procedure} frame-overflow -@end deffn diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi index 25f9ef264..c819fb53d 100644 --- a/doc/ref/guile.texi +++ b/doc/ref/guile.texi @@ -100,8 +100,8 @@ by the Free Software Foundation. @sp 10 @comment The title is printed in a large font. @title Guile Reference Manual -@subtitle $Id: guile.texi,v 1.17 2002-04-01 18:46:26 ossau Exp $ -@subtitle For use with Guile @value{VERSION} +@subtitle Edition @value{MANUAL_EDITION}, for use with Guile @value{VERSION} +@subtitle $Id: guile.texi,v 1.18 2002-04-20 19:26:40 ossau Exp $ @c AUTHORS @@ -217,26 +217,30 @@ Part I: Introduction to Guile * Obtaining and Installing Guile:: * Reporting Bugs:: Reporting bugs in Guile or this manual. -Part II: Programming with Guile +Part II: Writing and Running Guile Scheme -* Programming Intro:: Introduction to this part. -* Programming Overview:: An overview of Guile programming. -* Scheme Intro:: Introduction to Guile Scheme. -* Basic Ideas:: Basic ideas in Scheme. +* Running Intro:: Introduction to this part. +* Guile Scheme:: Guile's implementation of Scheme. * Guile Scripting:: How to write Guile scripts. * Command Line Handling:: Command line options and arguments. -* Libguile Intro:: Using Guile as an extension language. -* Guile API:: Overview of the Guile API. -* Data Representation:: Data representation in Guile. -* GH:: The deprecated GH interface. -* Debugger User Interface:: +* Debugging Features:: Features for debugging errors. * Autoconf Support:: Guile-specific configure.in macros. * Miscellaneous Tools:: Snarfing, linting, etc. -* Further Reading:: Where to find out more about Scheme programming. +* Basic Ideas:: Basic ideas in Scheme. +* Further Reading:: Where to find out more about Scheme. -Part III: Guile API Reference +Part III: Guile as an Extension Language + +* Programming Intro:: Introduction to this part. +* Libguile Intro:: Using Guile as an extension language. +* Programming Overview:: An overview of Guile programming. +* Data Representation:: Data representation in Guile. +* GH:: The deprecated GH interface. + +Part IV: Guile API Reference * Reference Intro:: Introduction to the Guile API reference. +* API Overview:: Overview of the Guile API. * Simple Data Types:: Numbers, strings, booleans and so on. * Compound Data Types:: Data types for holding other data. * Procedures and Macros:: Procedures and macros. @@ -254,7 +258,7 @@ Part III: Guile API Reference * Debugging:: Internal debugging interface. * Deprecated:: Features that are planned to disappear. -Part IV: Guile Modules +Part V: Guile Modules * SLIB:: Using the SLIB Scheme library. * POSIX:: POSIX system calls and networking. @@ -287,43 +291,61 @@ Indices @include intro.texi @page -@node Programming Intro -@unnumbered Part II: Programming with Guile +@node Running Intro +@unnumbered Part II: Writing and Running Guile Scheme -In this part of the manual, we aim to present a wide ranging picture of -what it means to program using Guile, to provide guidance, practical -guidelines and tips for @emph{how} to program in Guile, and to document -the tools that are available to help you with your programming. For -detailed reference information on the variables, functions etc. that +Guile's core language is Scheme, and an awful lot can be achieved simply +by using Guile to write and run Scheme programs. In this part of the +manual, we explain how to use Guile in this mode, and describe the tools +that Guile provides to help you with script writing, debugging and +packaging your programs for distribution. + +For readers who are not yet familiar with the Scheme language, this part +includes a chapter that presents the basic concepts of the language, and +gives references to freely available Scheme tutorial material on the +web. + +For detailed reference information on the variables, functions etc. that make up Guile's application programming interface (API), please refer to -Part III (@pxref{Reference Intro,,Part III --- Guile API Reference}). +Part IV (@pxref{Reference Intro,,Part IV --- Guile API Reference}). -We begin in the first chapter of this part by looking at the programming -options available. - -@include program.texi @include scheme-intro.texi -@include scheme-ideas.texi @include scripts.texi @include script-getopt.texi -@include extend.texi -@include scm.texi -@include data-rep.texi -@include gh.texi @include debugging.texi @include autoconf.texi @include tools.texi +@include scheme-ideas.texi @include scheme-reading.texi +@page +@node Programming Intro +@unnumbered Part III: Guile as an Extension Language + +In this part of the manual, we aim to present a wide ranging picture of +what it means to use Guile as an application extension language, to +provide guidance, practical guidelines and tips for @emph{how} to +program in Guile, and to document the tools that are available to help +you with your programming. For detailed reference information on the +variables, functions etc. that make up Guile's application programming +interface (API), please refer to Part IV (@pxref{Reference Intro,,Part +IV --- Guile API Reference}). + +@include extend.texi +@include program.texi +@include data-rep.texi +@include gh.texi + @page @node Reference Intro -@unnumbered Part III: Guile API Reference +@unnumbered Part IV: Guile API Reference Guile provides an application programming interface (@dfn{API}) to developers in two core languages: Scheme and C. This part of the manual contains reference documentation for all of the functionality that is available through both Scheme and C interfaces. +@include scm.texi @include scheme-data.texi @include scheme-compound.texi @include scheme-procedures.texi @@ -343,7 +365,7 @@ available through both Scheme and C interfaces. @iftex @page -@unnumbered{Part IV: Guile Modules} +@unnumbered{Part V: Guile Modules} @end iftex @include slib.texi diff --git a/doc/ref/preface.texi b/doc/ref/preface.texi index 0a6ce32ba..bcabb411a 100644 --- a/doc/ref/preface.texi +++ b/doc/ref/preface.texi @@ -74,7 +74,7 @@ do not wish that, delete this exception notice. @chapter Layout of this Manual @end ifnottex -The manual is divided into three parts. +The manual is divided into five parts. @strong{Part I: Introduction to Guile} provides an overview of what Guile is and how you can use it. A whirlwind tour shows how Guile can @@ -85,13 +85,14 @@ documented again and in full by the later parts of the manual. This part also explains how to obtain and install new versions of Guile, and how to report bugs effectively. -@strong{Part II: Programming with Guile} documents all aspects of -practical programming using Guile. This covers both the Scheme level ---- where we provide an introduction to the key ideas of the Scheme -language --- and use of Guile's @code{scm} interface to write new -primitives and objects in C, and to incorporate Guile into a C -application. It also covers the use of Guile as a POSIX compliant -script interpreter, and how to use the Guile debugger. +@strong{Part II: Writing and Running Guile Scheme} and @strong{Part III: +Programming with Guile} document all aspects of practical programming +using Guile. This covers both the Scheme level --- where we provide an +introduction to the key ideas of the Scheme language --- and use of +Guile's @code{scm} interface to write new primitives and objects in C, +and to incorporate Guile into a C application. It also covers the use +of Guile as a POSIX compliant script interpreter, and how to use the +Guile debugger. @c @strong{Part V: Extending Applications Using Guile} explains the options @c available for using Guile as a application extension language. At the @@ -106,7 +107,7 @@ script interpreter, and how to use the Guile debugger. @c This part of the manual covers the complete range of application @c extension options. -@strong{Part III: Guile API Reference} documents Guile's core API. Most +@strong{Part IV: Guile API Reference} documents Guile's core API. Most of the variables and procedures in Guile's core programming interface are available in both Scheme and C, and are related systematically such that the C interface can be inferred from the Scheme interface and vice @@ -127,7 +128,7 @@ together. @c all documented from scratch, and organized by functionality rather than @c by the defining standards. -@strong{Part IV: Guile Modules} describes some important modules, +@strong{Part V: Guile Modules} describes some important modules, distributed as part of the Guile distribution, that extend the functionality provided by the Guile Scheme core. Two important examples are: diff --git a/doc/ref/scheme-debug.texi b/doc/ref/scheme-debug.texi index ce0be8907..670bd0884 100644 --- a/doc/ref/scheme-debug.texi +++ b/doc/ref/scheme-debug.texi @@ -25,6 +25,13 @@ Return @code{#t} if @var{obj} is a debug object. @section Capturing the Stack or Innermost Stack Frame +When an error occurs in a running program, or the program hits a +breakpoint, its state at that point can be represented by a @dfn{stack} +of all the evaluations and procedure applications that are logically in +progress at that time, each of which is known as a @dfn{frame}. The +programmer can learn more about the program's state at the point of +interruption or error by inspecting the stack and its frames. + @deffn {Scheme Procedure} make-stack obj . args @deffnx {C Function} scm_make_stack (obj, args) Create a new stack. If @var{obj} is @code{#t}, the current @@ -183,6 +190,17 @@ Return the environment of the memoized expression @var{m}. @end deffn +@section Starting a New Stack + +@deffn {Scheme Syntax} start-stack id exp +Evaluate @var{exp} on a new calling stack with identity @var{id}. If +@var{exp} is interrupted during evaluation, backtraces will not display +frames farther back than @var{exp}'s top-level form. This macro is a +way of artificially limiting backtraces and stack procedures, largely as +a convenience to the user. +@end deffn + + @c Local Variables: @c TeX-master: "guile.texi" @c End: diff --git a/doc/ref/scheme-intro.texi b/doc/ref/scheme-intro.texi index 3cd9967b4..22e875339 100644 --- a/doc/ref/scheme-intro.texi +++ b/doc/ref/scheme-intro.texi @@ -1,6 +1,6 @@ @page -@node Scheme Intro -@chapter Introduction to Guile Scheme +@node Guile Scheme +@chapter Guile's Implementation of Scheme Guile's core language is Scheme, which is specified and described in the series of reports known as @dfn{RnRS}. @dfn{RnRS} is shorthand for the @@ -30,24 +30,6 @@ Guile's support for POSIX-compliant network programming GOOPS -- Guile's framework for object oriented programming. @end itemize -@menu -* Scheme Layout:: The layout of this part of the manual. -@end menu - - -@node Scheme Layout -@section Layout - -This part of the reference manual documents all of Guile's core -Scheme-level language and features in functionally-related groups. -Where a particular section of the manual includes both R5RS-compliant -parts and Guile-specific extensions, the text indicates which parts of -the documentation describe R5RS behaviour and which parts describe Guile -extensions. - -For a quick way of identifying the parts of Guile that implement -R5RS-compliant features, see the R5RS index: @ref{R5RS Index}. - @c Local Variables: @c TeX-master: "guile.texi" diff --git a/doc/ref/scheme-modules.texi b/doc/ref/scheme-modules.texi index 06bb813af..b2895f636 100644 --- a/doc/ref/scheme-modules.texi +++ b/doc/ref/scheme-modules.texi @@ -389,7 +389,7 @@ Guile starts up. @item (ice-9 debug) Mikael Djurfeldt's source-level debugging support for Guile -(@pxref{Debugger User Interface}). +(@pxref{Debugging Features}). @item (ice-9 threads) Guile's support for multi threaded execution (@pxref{Scheduling}). diff --git a/doc/ref/scm.texi b/doc/ref/scm.texi index 06a3b19a3..d4a634eb9 100644 --- a/doc/ref/scm.texi +++ b/doc/ref/scm.texi @@ -1,5 +1,5 @@ @page -@node Guile API +@node API Overview @chapter Overview of the Guile API Guile's application programming interface (@dfn{API}) makes @@ -40,6 +40,7 @@ primitives on which it is based. * Primitives:: Identical function for Scheme and C. * C Only:: Elements only available in C. * Scheme Only:: Elements only available in Scheme. +* Reference Layout:: The layout of this part of the manual. @end menu @@ -164,3 +165,17 @@ generic @code{SCM}. @node Scheme Only @section Elements Available Only in Scheme + + +@node Reference Layout +@section Reference Material Layout + +This part of the reference manual documents all of Guile's core +Scheme-level language and features in functionally-related groups. +Where a particular section of the manual includes both R5RS-compliant +parts and Guile-specific extensions, the text indicates which parts of +the documentation describe R5RS behaviour and which parts describe Guile +extensions. + +For a quick way of identifying the parts of Guile that implement +R5RS-compliant features, see the R5RS index: @ref{R5RS Index}. From 5e423a39aba9c1a7a1e47ef6016c6ed19abf8ed4 Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 20 Apr 2002 20:57:09 +0000 Subject: [PATCH 69/80] * removal of unused fields in root state (thanks to Christopher Cramer for pointing out the disuse.) * root.h (scm_root_state): removed def_inp, def_outp, def_errp. * root.c (root_mark): don't mark them. (scm_make_root): don't set them to #f. * init.c (scm_init_standard_ports): don't initialise with the default ports. --- libguile/ChangeLog | 10 ++++++++++ libguile/init.c | 9 +++------ libguile/root.c | 6 ------ libguile/root.h | 3 --- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index af1374da2..e36b42275 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,13 @@ +2002-04-20 Gary Houston + + * removal of unused fields in root state (thanks to Christopher + Cramer for pointing out the disuse.) + * root.h (scm_root_state): removed def_inp, def_outp, def_errp. + * root.c (root_mark): don't mark them. + (scm_make_root): don't set them to #f. + * init.c (scm_init_standard_ports): don't initialise with the + default ports. + 2002-04-17 Marius Vollmer * Makefile.am (EXTRA_DIST): Added cpp_err_symbols.c and diff --git a/libguile/init.c b/libguile/init.c index 71d737e45..e4567600c 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -311,20 +311,17 @@ scm_init_standard_ports () buffered input on stdin can reset \ex{(current-input-port)} to block buffering for higher performance. */ - scm_def_inp + scm_cur_inp = scm_standard_stream_to_port (0, isatty (0) ? "r0" : "r", "standard input"); - scm_def_outp = scm_standard_stream_to_port (1, + scm_cur_outp = scm_standard_stream_to_port (1, isatty (1) ? "w0" : "w", "standard output"); - scm_def_errp = scm_standard_stream_to_port (2, + scm_cur_errp = scm_standard_stream_to_port (2, isatty (2) ? "w0" : "w", "standard error"); - scm_cur_inp = scm_def_inp; - scm_cur_outp = scm_def_outp; - scm_cur_errp = scm_def_errp; scm_cur_loadp = SCM_BOOL_F; } diff --git a/libguile/root.c b/libguile/root.c index f26843ea3..dd174db5b 100644 --- a/libguile/root.c +++ b/libguile/root.c @@ -78,9 +78,6 @@ root_mark (SCM root) scm_gc_mark (s->cur_inp); scm_gc_mark (s->cur_outp); scm_gc_mark (s->cur_errp); - scm_gc_mark (s->def_inp); - scm_gc_mark (s->def_outp); - scm_gc_mark (s->def_errp); /* No need to gc mark def_loadp */ scm_gc_mark (s->fluids); return SCM_ROOT_STATE (root) -> parent; @@ -125,9 +122,6 @@ scm_make_root (SCM parent) = root_state->cur_inp = root_state->cur_outp = root_state->cur_errp - = root_state->def_inp - = root_state->def_outp - = root_state->def_errp = root_state->cur_loadp = root_state->fluids = root_state->handle diff --git a/libguile/root.h b/libguile/root.h index ca4a7ef62..bc474039f 100644 --- a/libguile/root.h +++ b/libguile/root.h @@ -100,9 +100,6 @@ typedef struct scm_root_state SCM cur_inp; SCM cur_outp; SCM cur_errp; - SCM def_inp; - SCM def_outp; - SCM def_errp; SCM cur_loadp; SCM fluids; From 867cf9bedd977c9a70fd9349cb0e550e5f6f44df Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 20 Apr 2002 20:57:40 +0000 Subject: [PATCH 70/80] *** empty log message *** --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 13ab506ca..f31db5422 100644 --- a/NEWS +++ b/NEWS @@ -114,6 +114,9 @@ instead. Use scm_c_source_property_breakpoint_p instead. +** Removed from scm_root_state: def_inp, def_outp, def_errp. These were +unused copies of the standard ports when Guile was initialised. + ** Removed definitions: scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify, scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify, scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2, scm_tc16_allocated, From b6287a25bdbfbefb22251aca09f4c4e11ba42a9f Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 20 Apr 2002 21:23:48 +0000 Subject: [PATCH 71/80] *** empty log message *** --- libguile/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index e36b42275..92668efc4 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -3,6 +3,8 @@ * removal of unused fields in root state (thanks to Christopher Cramer for pointing out the disuse.) * root.h (scm_root_state): removed def_inp, def_outp, def_errp. + (scm_def_inp, scm_def_oup, scm_def_errp): removed. + * root.c (root_mark): don't mark them. (scm_make_root): don't set them to #f. * init.c (scm_init_standard_ports): don't initialise with the From 1841c44acc43407cdb5fca3db962d81a5fcfe4c6 Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sat, 20 Apr 2002 21:26:05 +0000 Subject: [PATCH 72/80] *** empty log message *** --- NEWS | 4 +++- libguile/ChangeLog | 2 +- libguile/root.h | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index f31db5422..8fe4a2b38 100644 --- a/NEWS +++ b/NEWS @@ -115,7 +115,9 @@ instead. Use scm_c_source_property_breakpoint_p instead. ** Removed from scm_root_state: def_inp, def_outp, def_errp. These were -unused copies of the standard ports when Guile was initialised. +unused copies of the standard ports when Guile was initialised. The +corresponding macros scm_def_inp, scm_def_outp and scm_def_errp were also +removed. ** Removed definitions: scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify, scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify, diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 92668efc4..96e206c83 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -3,7 +3,7 @@ * removal of unused fields in root state (thanks to Christopher Cramer for pointing out the disuse.) * root.h (scm_root_state): removed def_inp, def_outp, def_errp. - (scm_def_inp, scm_def_oup, scm_def_errp): removed. + (scm_def_inp, scm_def_outp, scm_def_errp): removed. * root.c (root_mark): don't mark them. (scm_make_root): don't set them to #f. diff --git a/libguile/root.h b/libguile/root.h index bc474039f..7b0fb2a43 100644 --- a/libguile/root.h +++ b/libguile/root.h @@ -122,9 +122,6 @@ typedef struct scm_root_state #define scm_cur_inp (scm_root->cur_inp) #define scm_cur_outp (scm_root->cur_outp) #define scm_cur_errp (scm_root->cur_errp) -#define scm_def_inp (scm_root->def_inp) -#define scm_def_outp (scm_root->def_outp) -#define scm_def_errp (scm_root->def_errp) #define scm_cur_loadp (scm_root->cur_loadp) #ifdef USE_THREADS From 6d77c894fe85505f57b32a511a44586114e792d0 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 22 Apr 2002 17:46:06 +0000 Subject: [PATCH 73/80] (scm_slot_exists_p): Rename from scm_slots_exists_p. (s_scm_slot_exists_p): Rename from s_scm_slots_exists_p. --- libguile/goops.c | 144 +++++++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/libguile/goops.c b/libguile/goops.c index 03acdb516..fcb8ee3ed 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -1,15 +1,15 @@ /* Copyright (C) 1998,1999,2000,2001 Free Software Foundation, Inc. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this software; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, @@ -247,12 +247,12 @@ remove_duplicate_slots (SCM l, SCM res, SCM slots_already_seen) tmp = SCM_CAAR (l); if (!SCM_SYMBOLP (tmp)) scm_misc_error ("%compute-slots", "bad slot name ~S", scm_list_1 (tmp)); - + if (SCM_FALSEP (scm_c_memq (tmp, slots_already_seen))) { res = scm_cons (SCM_CAR (l), res); slots_already_seen = scm_cons (tmp, slots_already_seen); } - + return remove_duplicate_slots (SCM_CDR (l), res, slots_already_seen); } @@ -288,7 +288,7 @@ SCM_DEFINE (scm_sys_compute_slots, "%compute-slots", 1, 0, 0, (SCM class), "Return a list consisting of the names of all slots belonging to\n" "class @var{class}, i. e. the slots of @var{class} and of all of\n" - "its superclasses.") + "its superclasses.") #define FUNC_NAME s_scm_sys_compute_slots { SCM_VALIDATE_CLASS (1, class); @@ -301,8 +301,8 @@ SCM_DEFINE (scm_sys_compute_slots, "%compute-slots", 1, 0, 0, /****************************************************************************** * * compute-getters-n-setters - * - * This version doesn't handle slot options. It serves only for booting + * + * This version doesn't handle slot options. It serves only for booting * classes and will be overloaded in Scheme. * ******************************************************************************/ @@ -406,10 +406,10 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0, SCM_VALIDATE_INSTANCE (1, obj); n_initargs = scm_ilength (initargs); SCM_ASSERT ((n_initargs & 1) == 0, initargs, SCM_ARG2, FUNC_NAME); - + get_n_set = SCM_SLOT (class, scm_si_getters_n_setters); slots = SCM_SLOT (class, scm_si_slots); - + /* See for each slot how it must be initialized */ for (; !SCM_NULLP (slots); @@ -417,7 +417,7 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0, { SCM slot_name = SCM_CAR (slots); SCM slot_value = 0; - + if (!SCM_NULLP (SCM_CDR (slot_name))) { /* This slot admits (perhaps) to be initialized at creation time */ @@ -466,7 +466,7 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0, } } } - + return obj; } #undef FUNC_NAME @@ -494,7 +494,7 @@ SCM_DEFINE (scm_sys_prep_layout_x, "%prep-layout!", 1, 0, 0, && SCM_SUBCLASSP (class, scm_class_class)) SCM_MISC_ERROR ("class object doesn't have enough fields: ~S", scm_list_1 (nfields)); - + s = n > 0 ? scm_malloc (n) : 0; for (i = 0; i < n; i += 2) { @@ -595,7 +595,7 @@ SCM_DEFINE (scm_sys_inherit_magic_x, "%inherit-magic!", 2, 0, 0, SCM_SET_CLASS_FLAGS (class, flags); prep_hashsets (class); - + return SCM_UNSPECIFIED; } #undef FUNC_NAME @@ -753,7 +753,7 @@ create_basic_classes (void) SCM_SET_SLOT (scm_class_class, scm_si_direct_supers, SCM_EOL); /* will be changed */ /* SCM_SET_SLOT (scm_class_class, scm_si_direct_slots, slots_of_class); */ SCM_SET_SLOT (scm_class_class, scm_si_direct_subclasses, SCM_EOL); - SCM_SET_SLOT (scm_class_class, scm_si_direct_methods, SCM_EOL); + SCM_SET_SLOT (scm_class_class, scm_si_direct_methods, SCM_EOL); SCM_SET_SLOT (scm_class_class, scm_si_cpl, SCM_EOL); /* will be changed */ /* SCM_SET_SLOT (scm_class_class, scm_si_slots, slots_of_class); */ SCM_SET_SLOT (scm_class_class, scm_si_nfields, SCM_MAKINUM (SCM_N_CLASS_SLOTS)); @@ -775,7 +775,7 @@ create_basic_classes (void) SCM_EOL)); DEFVAR(name, scm_class_top); - + /**** ****/ name = scm_str2symbol (""); scm_class_object = scm_permanent_object (scm_basic_make_class (scm_class_class, @@ -805,7 +805,7 @@ SCM_DEFINE (scm_instance_p, "instance?", 1, 0, 0, /****************************************************************************** - * + * * Meta object accessors * ******************************************************************************/ @@ -1077,7 +1077,7 @@ get_slot_value (SCM class SCM_UNUSED, SCM obj, SCM slotdef) return SCM_SLOT (obj, SCM_INUM (access)); else { - /* We must evaluate (apply (car access) (list obj)) + /* We must evaluate (apply (car access) (list obj)) * where (car access) is known to be a closure of arity 1 */ register SCM code, env; @@ -1273,10 +1273,10 @@ SCM_DEFINE (scm_slot_bound_p, "slot-bound?", 2, 0, 0, } #undef FUNC_NAME -SCM_DEFINE (scm_slots_exists_p, "slot-exists?", 2, 0, 0, +SCM_DEFINE (scm_slot_exists_p, "slot-exists?", 2, 0, 0, (SCM obj, SCM slot_name), "Return @code{#t} if @var{obj} has a slot named @var{slot_name}.") -#define FUNC_NAME s_scm_slots_exists_p +#define FUNC_NAME s_scm_slot_exists_p { SCM class; @@ -1301,7 +1301,7 @@ static SCM wrap_init (SCM class, SCM *m, long n) { long i; - + /* Set all slots to unbound */ for (i = 0; i < n; i++) m[i] = SCM_GOOPS_UNBOUND; @@ -1329,13 +1329,13 @@ SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, m = (SCM *) scm_gc_malloc (n * sizeof (SCM), "struct"); return wrap_init (class, m, n); } - + /* Foreign objects */ if (SCM_CLASS_FLAGS (class) & SCM_CLASSF_FOREIGN) return scm_make_foreign_object (class, initargs); n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); - + /* Entities */ if (SCM_CLASS_FLAGS (class) & SCM_CLASSF_ENTITY) { @@ -1353,7 +1353,7 @@ SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, else return wrap_init (class, m, n); } - + /* Class objects */ if (SCM_CLASS_FLAGS (class) & SCM_CLASSF_METACLASS) { @@ -1373,7 +1373,7 @@ SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0, return z; } - + /* Non-light instances */ { m = (SCM *) scm_alloc_struct (n, scm_struct_n_extra_words, "heavy struct"); @@ -1404,7 +1404,7 @@ SCM_DEFINE (scm_sys_set_object_setter_x, "%set-object-setter!", 2, 0, 0, /****************************************************************************** * * %modify-instance (used by change-class to modify in place) - * + * ******************************************************************************/ SCM_DEFINE (scm_sys_modify_instance, "%modify-instance", 2, 0, 0, @@ -1415,7 +1415,7 @@ SCM_DEFINE (scm_sys_modify_instance, "%modify-instance", 2, 0, 0, SCM_VALIDATE_INSTANCE (1, old); SCM_VALIDATE_INSTANCE (2, new); - /* Exchange the data contained in old and new. We exchange rather than + /* Exchange the data contained in old and new. We exchange rather than * scratch the old value with new to be correct with GC. * See "Class redefinition protocol above". */ @@ -1528,7 +1528,7 @@ SCM_SYMBOL (scm_sym_change_class, "change-class"); static SCM purgatory (void *args) { - return scm_apply_0 (GETVAR (scm_sym_change_class), + return scm_apply_0 (GETVAR (scm_sym_change_class), SCM_PACK ((scm_t_bits) args)); } @@ -1543,16 +1543,16 @@ scm_change_object_class (SCM obj, SCM old_class SCM_UNUSED, SCM new_class) /****************************************************************************** * - * GGGG FFFFF - * G F - * G GG FFF - * G G F + * GGGG FFFFF + * G F + * G GG FFF + * G G F * GGG E N E R I C F U N C T I O N S * * This implementation provides * - generic functions (with class specializers) * - multi-methods - * - next-method + * - next-method * - a hard-coded MOP for standard gf, which can be overloaded for non-std gf * ******************************************************************************/ @@ -1660,17 +1660,17 @@ SCM_DEFINE (scm_primitive_generic_generic, "primitive-generic-generic", 1, 0, 0, #undef FUNC_NAME /****************************************************************************** - * + * * Protocol for calling a generic fumction - * This protocol is roughly equivalent to (parameter are a little bit different + * This protocol is roughly equivalent to (parameter are a little bit different * for efficiency reasons): * * + apply-generic (gf args) * + compute-applicable-methods (gf args ...) * + sort-applicable-methods (methods args) * + apply-methods (gf methods args) - * - * apply-methods calls make-next-method to build the "continuation" of a a + * + * apply-methods calls make-next-method to build the "continuation" of a a * method. Applying a next-method will call apply-next-method which in * turn will call apply again to call effectively the following method. * @@ -1688,14 +1688,14 @@ more_specificp (SCM m1, SCM m2, SCM *targs) { register SCM s1, s2; register long i; - /* - * Note: - * m1 and m2 can have != length (i.e. one can be one element longer than the + /* + * Note: + * m1 and m2 can have != length (i.e. one can be one element longer than the * other when we have a dotted parameter list). For instance, with the call * (M 1) * with * (define-method M (a . l) ....) - * (define-method M (a) ....) + * (define-method M (a) ....) * * we consider that the second method is more specific. * @@ -1709,7 +1709,7 @@ more_specificp (SCM m1, SCM m2, SCM *targs) if (SCM_NULLP(s2)) return 0; if (SCM_CAR(s1) != SCM_CAR(s2)) { register SCM l, cs1 = SCM_CAR(s1), cs2 = SCM_CAR(s2); - + for (l = SCM_SLOT (targs[i], scm_si_cpl); ; l = SCM_CDR(l)) { if (cs1 == SCM_CAR(l)) return 1; @@ -1729,7 +1729,7 @@ scm_i_vector2list (SCM l, long len) { long j; SCM z = scm_c_make_vector (len, SCM_UNDEFINED); - + for (j = 0; j < len; j++, l = SCM_CDR (l)) { SCM_VELTS (z)[j] = SCM_CAR (l); } @@ -1756,7 +1756,7 @@ sort_applicable_methods (SCM method_list, long size, SCM *targs) method_list = SCM_CDR (method_list); } v = buffer; - } + } else { /* Too many elements in method_list to keep everything locally */ @@ -1764,7 +1764,7 @@ sort_applicable_methods (SCM method_list, long size, SCM *targs) v = SCM_VELTS (vector); } - /* Use a simple shell sort since it is generally faster than qsort on + /* Use a simple shell sort since it is generally faster than qsort on * small vectors (which is probably mostly the case when we have to * sort a list of applicable methods). */ @@ -1796,7 +1796,7 @@ sort_applicable_methods (SCM method_list, long size, SCM *targs) } return save; } - /* If we are here, that's that we did it the hard way... */ + /* If we are here, that's that we did it the hard way... */ return scm_vector_to_list (vector); } @@ -1809,7 +1809,7 @@ scm_compute_applicable_methods (SCM gf, SCM args, long len, int find_method_p) SCM save = args; SCM buffer[BUFFSIZE], *types, *p; SCM tmp; - + /* Build the list of arguments types */ if (len >= BUFFSIZE) { tmp = scm_c_make_vector (len, SCM_UNDEFINED); @@ -1820,10 +1820,10 @@ scm_compute_applicable_methods (SCM gf, SCM args, long len, int find_method_p) } else types = p = buffer; - - for ( ; !SCM_NULLP (args); args = SCM_CDR (args)) + + for ( ; !SCM_NULLP (args); args = SCM_CDR (args)) *p++ = scm_class_of (SCM_CAR (args)); - + /* Build a list of all applicable methods */ for (l = SCM_SLOT (gf, scm_si_methods); !SCM_NULLP (l); l = SCM_CDR (l)) { @@ -1992,7 +1992,7 @@ scm_memoize_method (SCM x, SCM args) * A simple make (which will be redefined later in Scheme) * This version handles only creation of gf, methods and classes (no instances) * - * Since this code will disappear when Goops will be fully booted, + * Since this code will disappear when Goops will be fully booted, * no precaution is taken to be efficient. * ******************************************************************************/ @@ -2051,19 +2051,19 @@ SCM_DEFINE (scm_make, "make", 0, 0, 1, || class == scm_class_simple_method || class == scm_class_accessor) { - SCM_SET_SLOT (z, scm_si_generic_function, + SCM_SET_SLOT (z, scm_si_generic_function, scm_i_get_keyword (k_gf, args, len - 1, SCM_BOOL_F, FUNC_NAME)); - SCM_SET_SLOT (z, scm_si_specializers, + SCM_SET_SLOT (z, scm_si_specializers, scm_i_get_keyword (k_specializers, args, len - 1, SCM_EOL, FUNC_NAME)); - SCM_SET_SLOT (z, scm_si_procedure, + SCM_SET_SLOT (z, scm_si_procedure, scm_i_get_keyword (k_procedure, args, len - 1, @@ -2074,19 +2074,19 @@ SCM_DEFINE (scm_make, "make", 0, 0, 1, else { /* In all the others case, make a new class .... No instance here */ - SCM_SET_SLOT (z, scm_si_name, + SCM_SET_SLOT (z, scm_si_name, scm_i_get_keyword (k_name, args, len - 1, scm_str2symbol ("???"), FUNC_NAME)); - SCM_SET_SLOT (z, scm_si_direct_supers, + SCM_SET_SLOT (z, scm_si_direct_supers, scm_i_get_keyword (k_dsupers, args, len - 1, SCM_EOL, FUNC_NAME)); - SCM_SET_SLOT (z, scm_si_direct_slots, + SCM_SET_SLOT (z, scm_si_direct_slots, scm_i_get_keyword (k_slots, args, len - 1, @@ -2140,12 +2140,12 @@ SCM_DEFINE (scm_sys_method_more_specific_p, "%method-more-specific?", 3, 0, 0, return more_specificp (m1, m2, SCM_VELTS(v)) ? SCM_BOOL_T: SCM_BOOL_F; } #undef FUNC_NAME - - + + /****************************************************************************** * - * Initializations + * Initializations * ******************************************************************************/ @@ -2154,7 +2154,7 @@ static void make_stdcls (SCM *var, char *name, SCM meta, SCM super, SCM slots) { SCM tmp = scm_str2symbol (name); - + *var = scm_permanent_object (scm_basic_make_class (meta, tmp, SCM_CONSP (super) @@ -2171,8 +2171,8 @@ static void create_standard_classes (void) { SCM slots; - SCM method_slots = scm_list_4 (scm_str2symbol ("generic-function"), - scm_str2symbol ("specializers"), + SCM method_slots = scm_list_4 (scm_str2symbol ("generic-function"), + scm_str2symbol ("specializers"), sym_procedure, scm_str2symbol ("code-table")); SCM amethod_slots = scm_list_1 (scm_list_3 (scm_str2symbol ("slot-definition"), @@ -2227,13 +2227,13 @@ create_standard_classes (void) scm_class_class, scm_class_foreign_slot, SCM_EOL); /* Continue initialization of class */ - + slots = build_class_class_slots (); SCM_SET_SLOT (scm_class_class, scm_si_direct_slots, slots); SCM_SET_SLOT (scm_class_class, scm_si_slots, slots); SCM_SET_SLOT (scm_class_class, scm_si_getters_n_setters, compute_getters_n_setters (slots)); - + make_stdcls (&scm_class_foreign_class, "", scm_class_class, scm_class_class, scm_list_2 (scm_list_3 (scm_str2symbol ("constructor"), @@ -2277,7 +2277,7 @@ create_standard_classes (void) SCM_EOL); #if 0 /* Patch cpl since compute_cpl doesn't support multiple inheritance. */ - SCM_SET_SLOT (scm_class_generic_with_setter, scm_si_cpl, + SCM_SET_SLOT (scm_class_generic_with_setter, scm_si_cpl, scm_append (scm_list_3 (scm_list_2 (scm_class_generic_with_setter, scm_class_generic), SCM_SLOT (scm_class_entity_with_setter, @@ -2385,7 +2385,7 @@ create_smob_classes (void) scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_real)] = scm_class_real; scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_complex)] = scm_class_complex; scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_keyword)] = scm_class_keyword; - + for (i = 0; i < scm_numsmob; ++i) if (!scm_smob_class[i]) scm_smob_class[i] = scm_make_extended_class (SCM_SMOBNAME (i)); @@ -2429,7 +2429,7 @@ create_port_classes (void) } static SCM -make_struct_class (void *closure SCM_UNUSED, SCM key SCM_UNUSED, +make_struct_class (void *closure SCM_UNUSED, SCM key SCM_UNUSED, SCM data, SCM prev SCM_UNUSED) { if (!SCM_FALSEP (SCM_STRUCT_TABLE_NAME (data))) @@ -2502,7 +2502,7 @@ scm_make_class (SCM meta, char *s_name, SCM supers, size_t size, SCM_SET_CLASS_DESTRUCTOR (class, scm_struct_free_light); SCM_SET_CLASS_INSTANCE_SIZE (class, size); } - + SCM_SET_SLOT (class, scm_si_layout, scm_str2symbol ("")); SCM_SET_SLOT (class, scm_si_constructor, (SCM) constructor); @@ -2561,7 +2561,7 @@ scm_add_slot (SCM class, char *slot_name, SCM slot_class, k_procedure, setm))); DEFVAR (aname, gf); - + SCM_SET_SLOT (class, scm_si_slots, scm_append_x (scm_list_2 (SCM_SLOT (class, scm_si_slots), scm_list_1 (slot)))); @@ -2570,7 +2570,7 @@ scm_add_slot (SCM class, char *slot_name, SCM slot_class, scm_list_1 (gns)))); } } - { + { long n = SCM_INUM (SCM_SLOT (class, scm_si_nfields)); SCM_SET_SLOT (class, scm_si_nfields, SCM_MAKINUM (n + 1)); @@ -2664,7 +2664,7 @@ scm_init_goops_builtins (void) scm_module_goops = scm_current_module (); scm_goops_lookup_closure = scm_module_lookup_closure (scm_module_goops); - /* Not really necessary right now, but who knows... + /* Not really necessary right now, but who knows... */ scm_permanent_object (scm_module_goops); scm_permanent_object (scm_goops_lookup_closure); From 7a0c65ebca78de3858c35321ae9c57d96eedd335 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 22 Apr 2002 17:47:38 +0000 Subject: [PATCH 74/80] *** empty log message *** --- libguile/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 96e206c83..690a7398f 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,9 @@ +2002-04-22 Thien-Thi Nguyen + + * goops.c (scm_slot_exists_p): Rename from scm_slots_exists_p. + (s_scm_slot_exists_p): Rename from s_scm_slots_exists_p. + Thanks to Andreas Rottmann. + 2002-04-20 Gary Houston * removal of unused fields in root state (thanks to Christopher From 0b607675c2885dcf7b8173604dba97cbe02df1e3 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 22 Apr 2002 18:00:24 +0000 Subject: [PATCH 75/80] (scm_slot_exists_p): Rename from scm_slots_exists_p. --- libguile/goops.h | 78 ++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/libguile/goops.h b/libguile/goops.h index 6f4b48c1d..655b727cf 100644 --- a/libguile/goops.h +++ b/libguile/goops.h @@ -64,10 +64,10 @@ #define SCM_CLASS_CLASS_LAYOUT "prsrpwpopopwururururururururpwpwpwpwpwpwpwpwpwpwpwpw" #define scm_si_layout 0 /* the struct layout */ -#define scm_si_vtable 1 +#define scm_si_vtable 1 #define scm_si_print 2 /* the struct print closure */ #define scm_si_proc 3 -#define scm_si_setter 4 +#define scm_si_setter 4 #define scm_si_goops_fields 5 @@ -81,10 +81,10 @@ #define scm_si_direct_subclasses 17 /* (class ...) */ #define scm_si_direct_methods 18 /* (methods ...) */ #define scm_si_cpl 19 /* (class ...) */ -#define scm_si_slotdef_class 20 +#define scm_si_slotdef_class 20 #define scm_si_slots 21 /* ((name . options) ...) */ -#define scm_si_name_access 22 -#define scm_si_keyword_access 23 +#define scm_si_name_access 22 +#define scm_si_keyword_access 23 #define scm_si_nfields 24 /* an integer */ #define scm_si_environment 25 /* The environment in which class is built */ #define SCM_N_CLASS_SLOTS 26 @@ -257,37 +257,37 @@ SCM_API SCM scm_m_atdispatch (SCM xorig, SCM env); SCM_API SCM scm_pure_generic_p (SCM obj); #endif -SCM_API SCM scm_sys_compute_slots (SCM c); -SCM_API SCM scm_i_get_keyword (SCM key, SCM l, long len, SCM default_value, const char *subr); -SCM_API SCM scm_get_keyword (SCM key, SCM l, SCM default_value); -SCM_API SCM scm_sys_initialize_object (SCM obj, SCM initargs); -SCM_API SCM scm_sys_prep_layout_x (SCM c); -SCM_API SCM scm_sys_inherit_magic_x (SCM c, SCM dsupers); -SCM_API SCM scm_instance_p (SCM obj); -SCM_API SCM scm_class_name (SCM obj); -SCM_API SCM scm_class_direct_supers (SCM obj); -SCM_API SCM scm_class_direct_slots (SCM obj); -SCM_API SCM scm_class_direct_subclasses (SCM obj); -SCM_API SCM scm_class_direct_methods (SCM obj); -SCM_API SCM scm_class_precedence_list (SCM obj); -SCM_API SCM scm_class_slots (SCM obj); -SCM_API SCM scm_class_environment (SCM obj); -SCM_API SCM scm_generic_function_name (SCM obj); -SCM_API SCM scm_generic_function_methods (SCM obj); -SCM_API SCM scm_method_generic_function (SCM obj); -SCM_API SCM scm_method_specializers (SCM obj); -SCM_API SCM scm_method_procedure (SCM obj); +SCM_API SCM scm_sys_compute_slots (SCM c); +SCM_API SCM scm_i_get_keyword (SCM key, SCM l, long len, SCM default_value, const char *subr); +SCM_API SCM scm_get_keyword (SCM key, SCM l, SCM default_value); +SCM_API SCM scm_sys_initialize_object (SCM obj, SCM initargs); +SCM_API SCM scm_sys_prep_layout_x (SCM c); +SCM_API SCM scm_sys_inherit_magic_x (SCM c, SCM dsupers); +SCM_API SCM scm_instance_p (SCM obj); +SCM_API SCM scm_class_name (SCM obj); +SCM_API SCM scm_class_direct_supers (SCM obj); +SCM_API SCM scm_class_direct_slots (SCM obj); +SCM_API SCM scm_class_direct_subclasses (SCM obj); +SCM_API SCM scm_class_direct_methods (SCM obj); +SCM_API SCM scm_class_precedence_list (SCM obj); +SCM_API SCM scm_class_slots (SCM obj); +SCM_API SCM scm_class_environment (SCM obj); +SCM_API SCM scm_generic_function_name (SCM obj); +SCM_API SCM scm_generic_function_methods (SCM obj); +SCM_API SCM scm_method_generic_function (SCM obj); +SCM_API SCM scm_method_specializers (SCM obj); +SCM_API SCM scm_method_procedure (SCM obj); SCM_API SCM scm_accessor_method_slot_definition (SCM obj); SCM_API SCM scm_sys_tag_body (SCM body); -SCM_API SCM scm_sys_fast_slot_ref (SCM obj, SCM index); -SCM_API SCM scm_sys_fast_slot_set_x (SCM obj, SCM index, SCM value); -SCM_API SCM scm_slot_ref_using_class (SCM cls, SCM obj, SCM slot_name); -SCM_API SCM scm_slot_set_using_class_x (SCM cls, SCM obj, SCM slot_name, SCM value); -SCM_API SCM scm_slot_bound_using_class_p (SCM cls, SCM obj, SCM slot_name); -SCM_API SCM scm_slot_exists_using_class_p (SCM cls, SCM obj, SCM slot_name); -SCM_API SCM scm_slot_bound_p (SCM obj, SCM slot_name); -SCM_API SCM scm_slots_exists_p (SCM obj, SCM slot_name); -SCM_API SCM scm_sys_modify_instance (SCM old, SCM newinst); +SCM_API SCM scm_sys_fast_slot_ref (SCM obj, SCM index); +SCM_API SCM scm_sys_fast_slot_set_x (SCM obj, SCM index, SCM value); +SCM_API SCM scm_slot_ref_using_class (SCM cls, SCM obj, SCM slot_name); +SCM_API SCM scm_slot_set_using_class_x (SCM cls, SCM obj, SCM slot_name, SCM value); +SCM_API SCM scm_slot_bound_using_class_p (SCM cls, SCM obj, SCM slot_name); +SCM_API SCM scm_slot_exists_using_class_p (SCM cls, SCM obj, SCM slot_name); +SCM_API SCM scm_slot_bound_p (SCM obj, SCM slot_name); +SCM_API SCM scm_slot_exists_p (SCM obj, SCM slot_name); +SCM_API SCM scm_sys_modify_instance (SCM old, SCM newinst); SCM_API SCM scm_sys_modify_class (SCM old, SCM newcls); SCM_API SCM scm_sys_invalidate_class (SCM cls); SCM_API SCM scm_make_method_cache (SCM gf); @@ -295,13 +295,13 @@ SCM_API SCM scm_sys_invalidate_method_cache_x (SCM gf); SCM_API SCM scm_generic_capability_p (SCM proc); SCM_API SCM scm_enable_primitive_generic_x (SCM subrs); SCM_API SCM scm_primitive_generic_generic (SCM subr); -SCM_API SCM stklos_version (void); -SCM_API SCM scm_make (SCM args); -SCM_API SCM scm_find_method (SCM args); -SCM_API SCM scm_sys_method_more_specific_p (SCM m1, SCM m2, SCM targs); +SCM_API SCM stklos_version (void); +SCM_API SCM scm_make (SCM args); +SCM_API SCM scm_find_method (SCM args); +SCM_API SCM scm_sys_method_more_specific_p (SCM m1, SCM m2, SCM targs); SCM_API SCM scm_init_goops_builtins (void); -SCM_API void scm_init_goops (void); +SCM_API void scm_init_goops (void); #if (SCM_ENABLE_DEPRECATED == 1) From 87b7206327327374de6e9524894c2f9c74d99557 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Mon, 22 Apr 2002 18:01:17 +0000 Subject: [PATCH 76/80] *** empty log message *** --- libguile/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 690a7398f..1e1b5f56d 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,6 @@ 2002-04-22 Thien-Thi Nguyen + * goops.h (scm_slot_exists_p): Rename from scm_slots_exists_p. * goops.c (scm_slot_exists_p): Rename from scm_slots_exists_p. (s_scm_slot_exists_p): Rename from s_scm_slots_exists_p. Thanks to Andreas Rottmann. From dc78ae2a3422f4d26fc5d5e03b39a34e0e848514 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 23 Apr 2002 22:29:23 +0000 Subject: [PATCH 77/80] Update. --- doc/guile-api.alist | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/guile-api.alist b/doc/guile-api.alist index 10983d0bd..c7b875d78 100644 --- a/doc/guile-api.alist +++ b/doc/guile-api.alist @@ -1,7 +1,7 @@ -;; Generated Thu Feb 28 23:33:42 PST 2002 by guile-scripts/scan-api -- do not edit! +;; Generated Tue Apr 23 15:24:08 PDT 2002 by guile-scripts/scan-api -- do not edit! ( (meta (GUILE_LOAD_PATH . "") - (LTDL_LOAD_PATH . "") + (LTDL_LIBRARY_PATH . "") (guile . "pre-inst-guile") (sofile . "libguile/.libs/libguile.so.15.0.0")) (scheme @@ -1488,8 +1488,7 @@ (yield "#") (zero? "#") ) ;; end of scheme -(C -(collisionp B) +(C (coop_abort T) (coop_condition_variable_destroy T) (coop_condition_variable_init T) @@ -1534,7 +1533,6 @@ (gdb_print T) (gdb_read T) (gdb_result B) -(gexceptfds B) (gh_append T) (gh_append2 T) (gh_append3 T) @@ -1646,12 +1644,6 @@ (gh_vector_ref T) (gh_vector_set_x T) (gh_write T) -(gnfds B) -(greadfds B) -(gwritefds B) -(rexceptfds B) -(rreadfds B) -(rwritefds B) (scm_I_am_dead B) (scm_abs T) (scm_accept T) @@ -1809,6 +1801,7 @@ (scm_c_scm2shorts T) (scm_c_shorts2scm T) (scm_c_shorts2svect T) +(scm_c_source_property_breakpoint_p T) (scm_c_string2str T) (scm_c_substring2str T) (scm_c_symbol2str T) @@ -2269,6 +2262,7 @@ (scm_i_ptrdiff2big T) (scm_i_short2big T) (scm_i_size2big T) +(scm_i_terminating B) (scm_i_uint2big T) (scm_i_ulong2big T) (scm_i_ulong_long2big T) @@ -2897,12 +2891,12 @@ (scm_sloppy_assv T) (scm_slot_bound_p T) (scm_slot_bound_using_class_p T) +(scm_slot_exists_p T) (scm_slot_exists_using_class_p T) (scm_slot_ref T) (scm_slot_ref_using_class T) (scm_slot_set_using_class_x T) (scm_slot_set_x T) -(scm_slots_exists_p T) (scm_smob_class D) (scm_smob_free T) (scm_smob_prehistory T) @@ -3208,6 +3202,5 @@ (scm_yield T) (scm_your_base D) (scm_zero_p T) -(terminating B) ) ;; end of C ) ;; eof From 6336047f2bf1747882231a8d53e3ebfa394deeb4 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Tue, 23 Apr 2002 22:30:07 +0000 Subject: [PATCH 78/80] *** empty log message *** --- doc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9363ad84d..eef3458bb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2002-04-23 Thien-Thi Nguyen + + * guile-api.alist: Update. + 2002-04-16 Marius Vollmer * Makefile.am (dist-hook): Simplified to not use "cd"; now it From 3587b26daa404163850d0a355875ae616e982efd Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Fri, 26 Apr 2002 18:02:24 +0000 Subject: [PATCH 79/80] Moved to guile-config/. --- qthreads.m4 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 qthreads.m4 diff --git a/qthreads.m4 b/qthreads.m4 deleted file mode 100644 index e69de29bb..000000000 From 63355c80d2bffe83fee78381eae59aab31b40bbe Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Fri, 26 Apr 2002 18:03:21 +0000 Subject: [PATCH 80/80] * Makefile.am (EXTRA_DIST): Added qthreads.m4. * qthreads.m4: Moved here from top directory. --- guile-config/Makefile.am | 2 +- guile-config/qthreads.m4 | 158 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 guile-config/qthreads.m4 diff --git a/guile-config/Makefile.am b/guile-config/Makefile.am index 19c7a6fbf..5007c700b 100644 --- a/guile-config/Makefile.am +++ b/guile-config/Makefile.am @@ -22,7 +22,7 @@ bin_SCRIPTS=guile-config CLEANFILES=guile-config -EXTRA_DIST=guile-config.in guile.m4 +EXTRA_DIST=guile-config.in guile.m4 qthreads.m4 ## FIXME: in the future there will be direct automake support for ## doing this. When that happens, switch over. diff --git a/guile-config/qthreads.m4 b/guile-config/qthreads.m4 new file mode 100644 index 000000000..e169f1cb5 --- /dev/null +++ b/guile-config/qthreads.m4 @@ -0,0 +1,158 @@ +dnl Autoconf macros for configuring the QuickThreads package +dnl Jim Blandy --- July 1998 +dnl +dnl Copyright (C) 1998, 1999 Free Software Foundation, Inc. +dnl +dnl This file is part of GUILE. +dnl +dnl GUILE is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as +dnl published by the Free Software Foundation; either version 2, or +dnl (at your option) any later version. +dnl +dnl GUILE is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public +dnl License along with GUILE; see the file COPYING. If not, write +dnl to the Free Software Foundation, Inc., 59 Temple Place, Suite +dnl 330, Boston, MA 02111-1307 USA + + + +dnl QTHREADS_CONFIGURE configures the QuickThreads package. The QT +dnl sources should be in $srcdir/qt. If configuration succeeds, this +dnl macro creates the appropriate symlinks in the qt object directory, +dnl and sets the following variables, used in building libqthreads.a: +dnl QTHREAD_LTLIBS --- set to libqthreads.la if configuration +dnl succeeds, or the empty string if configuration fails. +dnl qtmd_h, qtmds_s, qtmdc_c, qtdmdb_s --- the names of the machine- +dnl dependent source files. +dnl qthread_asflags --- flags to pass to the compiler when processing +dnl assembly-language files. +dnl +dnl It also sets the following variables, which describe how clients +dnl can link against libqthreads.a: +dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or +dnl the empty string if configuration fails. +dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree +dnl THREAD_LIBS_INSTALLED --- linker options for use after this package +dnl is installed +dnl It would be nice if all thread configuration packages for Guile +dnl followed the same conventions. +dnl +dnl All of the above variables will be substituted into Makefiles in +dnl the usual autoconf fashion. +dnl +dnl We distinguish between THREAD_LIBS_LOCAL and +dnl THREAD_LIBS_INSTALLED because the thread library might be in +dnl this tree, and be built using libtool. This means that: +dnl 1) when building other executables in this tree, one must +dnl pass the relative path to the ../libfoo.la file, but +dnl 2) once the whole package has been installed, users should +dnl link using -lfoo. +dnl Normally, we only care about the first case, but since the +dnl guile-config script needs to give users all the flags they need +dnl to link programs against guile, the GUILE_WITH_THREADS macro +dnl needs to supply the second piece of information as well. +dnl +dnl This whole thing is a little confused about what ought to be +dnl done in the top-level configure script, and what ought to be +dnl taken care of in the subdirectory. For example, qtmds_s and +dnl friends really ought not to be even mentioned in the top-level +dnl configure script, but here they are. + +AC_DEFUN([QTHREADS_CONFIGURE],[ + AC_REQUIRE([AC_PROG_LN_S]) + + AC_MSG_CHECKING(QuickThreads configuration) + + changequote(,)dnl We use [ and ] in a regexp in the case + + THREAD_PACKAGE=QT + qthread_asflags='' + case "$host" in + i[3456]86-*-*) + port_name=i386 + qtmd_h=md/i386.h + qtmds_s=md/i386.s + qtmdc_c=md/null.c + qtdmdb_s= + case "$host" in + *-*-netbsd* ) + ## NetBSD needs to be told to pass the assembly code through + ## the C preprocessor. Other GCC installations seem to do + ## this by default, but NetBSD's doesn't. We could get the + ## same effect by giving the file a name ending with .S + ## instead of .s, but I don't see how to tell automake to do + ## that. + qthread_asflags='-x assembler-with-cpp' + ;; + esac + ;; + mips-sgi-irix[56]*) + port_name=irix + qtmd_h=md/mips.h + qtmds_s=md/mips-irix5.s + qtmdc_c=md/null.c + qtdmdb_s=md/mips_b.s + ;; + mips-*-*) + port_name=mips + qtmd_h=md/mips.h + qtmds_s=md/mips.s + qtmdc_c=md/null.c + qtdmdb_s=md/mips_b.s + ;; + sparc-*-sunos*) + port_name=sparc-sunos + qtmd_h=md/sparc.h + qtmds_s=md/_sparc.s + qtmdc_c=md/null.c + qtdmdb_s=md/_sparc_b.s + ;; + sparc*-*-*) + port_name=sparc + qtmd_h=md/sparc.h + qtmds_s=md/sparc.s + qtmdc_c=md/null.c + qtdmdb_s=md/sparc_b.s + ;; + alpha*-*-*) + port_name=alpha + qtmd_h=md/axp.h + qtmds_s=md/axp.s + qtmdc_c=md/null.c + qtdmdb_s=md/axp_b.s + ;; + *) + echo "Unknown configuration; threads package disabled" + THREAD_PACKAGE="" + ;; + esac + changequote([, ]) + + # Did configuration succeed? + if test -n "$THREAD_PACKAGE"; then + AC_MSG_RESULT($port_name) + QTHREAD_LTLIBS=libqthreads.la + THREAD_LIBS_LOCAL="../qt/libqthreads.la" + THREAD_LIBS_INSTALLED="-lqthreads" + else + AC_MSG_RESULT(none; disabled) + fi + + AC_SUBST(QTHREAD_LTLIBS) + AC_SUBST(qtmd_h) + AC_SUBST(qtmds_s) + AC_SUBST(qtmdc_c) + AC_SUBST(qtdmdb_s) + AC_SUBST(qthread_asflags) + AC_SUBST(THREAD_PACKAGE) + AC_SUBST(THREAD_LIBS_LOCAL) + AC_SUBST(THREAD_LIBS_INSTALLED) +]) + +dnl qthreads.m4 ends here