Replace $letrec with $rec
[bpt/guile.git] / doc / ref / scheme-scripts.texi
index d1e06b8..7552dba 100644 (file)
@@ -1,10 +1,9 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
-@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004
+@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2010, 2011
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
-@page
 @node Guile Scripting
 @section Guile Scripting
 
@@ -15,7 +14,6 @@ then tells Guile how to handle the Scheme code.
 
 @menu
 * The Top of a Script File::    How to start a Guile script.
-* Invoking Guile::              Command line options understood by Guile.
 * The Meta Switch::             Passing complex argument lists to Guile
                                 from shell scripts.
 * Command Line Handling::       Accessing the command line from a script.
@@ -63,6 +61,12 @@ The second line of the script should contain only the characters
 operating system never reads this far, but Guile treats this as the end
 of the comment begun on the first line by the @samp{#!} characters.
 
+@item
+If this source code file is not ASCII or ISO-8859-1 encoded, a coding
+declaration such as @code{coding: utf-8} should appear in a comment
+somewhere in the first five lines of the file: see @ref{Character
+Encoding of Source Files}.
+
 @item
 The rest of the file should be a Scheme program.
 
@@ -71,121 +75,6 @@ The rest of the file should be a Scheme program.
 Guile reads the program, evaluating expressions in the order that they
 appear.  Upon reaching the end of the file, Guile exits.
 
-
-@node Invoking Guile
-@subsection Invoking Guile
-
-Here we describe Guile's command-line processing in detail.  Guile
-processes its arguments from left to right, recognizing the switches
-described below.  For examples, see @ref{Scripting Examples}.
-
-@table @code
-
-@item -s @var{script} @var{arg...}
-Read and evaluate Scheme source code from the file @var{script}, as the
-@code{load} function would.  After loading @var{script}, exit.  Any
-command-line arguments @var{arg...} following @var{script} become the
-script's arguments; the @code{command-line} function returns a list of
-strings of the form @code{(@var{script} @var{arg...})}.
-
-@item -c @var{expr} @var{arg...}
-Evaluate @var{expr} as Scheme code, and then exit.  Any command-line
-arguments @var{arg...} following @var{expr} become command-line arguments; the
-@code{command-line} function returns a list of strings of the form
-@code{(@var{guile} @var{arg...})}, where @var{guile} is the path of the
-Guile executable.
-
-@item -- @var{arg...}
-Run interactively, prompting the user for expressions and evaluating
-them.  Any command-line arguments @var{arg...} following the @code{--}
-become command-line arguments for the interactive session; the
-@code{command-line} function returns a list of strings of the form
-@code{(@var{guile} @var{arg...})}, where @var{guile} is the path of the
-Guile executable.
-
-@item -L @var{directory}
-Add @var{directory} to the front of Guile's module load path.  The
-given directories are searched in the order given on the command line
-and before any directories in the GUILE_LOAD_PATH environment
-variable.  Paths added here are @emph{not} in effect during execution
-of the user's @file{.guile} file.
-
-@item -l @var{file}
-Load Scheme source code from @var{file}, and continue processing the
-command line.
-
-@item -e @var{function}
-Make @var{function} the @dfn{entry point} of the script.  After loading
-the script file (with @code{-s}) or evaluating the expression (with
-@code{-c}), apply @var{function} to a list containing the program name
-and the command-line arguments --- the list provided by the
-@code{command-line} function.
-
-A @code{-e} switch can appear anywhere in the argument list, but Guile
-always invokes the @var{function} as the @emph{last} action it performs.
-This is weird, but because of the way script invocation works under
-POSIX, the @code{-s} option must always come last in the list.
-
-The @var{function} is most often a simple symbol that names a function
-that is defined in the script.  It can also be of the form @code{(@@
-@var{module-name} @var{symbol})} and in that case, the symbol is
-looked up in the module named @var{module-name}.
-
-@xref{Scripting Examples}.
-
-@item -ds
-Treat a final @code{-s} option as if it occurred at this point in the
-command line; load the script here.
-
-This switch is necessary because, although the POSIX script invocation
-mechanism effectively requires the @code{-s} option to appear last, the
-programmer may well want to run the script before other actions
-requested on the command line.  For examples, see @ref{Scripting
-Examples}.
-
-@item \
-Read more command-line arguments, starting from the second line of the
-script file.  @xref{The Meta Switch}.
-
-@item --emacs
-Assume Guile is running as an inferior process of Emacs, and use a
-special protocol to communicate with Emacs's Guile interaction mode.
-This switch sets the global variable use-emacs-interface to @code{#t}.
-
-This switch is still experimental.
-
-@item --use-srfi=@var{list}
-The option @code{--use-srfi} expects a comma-separated list of numbers,
-each representing a SRFI number to be loaded into the interpreter
-before starting evaluating a script file or the REPL.  Additionally,
-the feature identifier for the loaded SRFIs is recognized by
-`cond-expand' when using this option.
-
-@example
-guile --use-srfi=8,13
-@end example
-
-@item --debug
-Start with the debugging evaluator and enable backtraces.  Using the
-debugging evaluator will give you better error messages but it will
-slow down execution.  By default, the debugging evaluator is only used
-when entering an interactive session.  When executing a script with
-@code{-s} or @code{-c}, the normal, faster evaluator is used by default.
-
-@vnew{1.8}
-@item --no-debug
-Do not use the debugging evaluator, even when entering an interactive
-session.
-
-@item -h@r{, }--help
-Display help on invoking Guile, and then exit.
-
-@item -v@r{, }--version
-Display the current version of Guile, and then exit.
-
-@end table
-
-
 @node The Meta Switch
 @subsection The Meta Switch
 
@@ -442,7 +331,7 @@ Here is a script which prints the factorial of its argument:
 @end example
 In action:
 @example
-$ fact 5
+$ ./fact 5
 120
 $
 @end example
@@ -471,7 +360,7 @@ definitions, without any extraneous computation taking place.  Then we
 used the meta switch @code{\} and the entry point switch @code{-e} to
 tell Guile to call @code{main} after loading the script.
 @example
-$ fact 50
+$ ./fact 50
 30414093201713378043612608166064768844377641568960512000000000000
 @end example
 
@@ -499,17 +388,21 @@ The command-line arguments here tell Guile to first load the file
 point.  In other words, the @code{choose} script can use definitions
 made in the @code{fact} script.  Here are some sample runs:
 @example
-$ choose 0 4
+$ ./choose 0 4
 1
-$ choose 1 4
+$ ./choose 1 4
 4
-$ choose 2 4
+$ ./choose 2 4
 6
-$ choose 3 4
+$ ./choose 3 4
 4
-$ choose 4 4
+$ ./choose 4 4
 1
-$ choose 50 100
+$ ./choose 50 100
 100891344545564193334812497256
 @end example
 
+
+@c Local Variables:
+@c TeX-master: "guile.texi"
+@c End: