diff options
Diffstat (limited to 'scm.texi')
-rw-r--r-- | scm.texi | 280 |
1 files changed, 164 insertions, 116 deletions
@@ -16,7 +16,7 @@ This manual is for SCM (version @value{SCMVERSION}, @value{SCMDATE}), and algorithmic language Scheme implementation. @noindent -Copyright @copyright{} 1990-2006 Free Software Foundation, Inc. +Copyright @copyright{} 1990-2007 Free Software Foundation, Inc. @quotation Permission is granted to make and distribute verbatim copies of @@ -154,6 +154,7 @@ timing information printed interactively (the @code{verbose} function). @code{Restart}, @code{quit}, and @code{exec}. @end itemize + @node SCM Authors, Copying, SCM Features, Overview @section Authors @@ -179,6 +180,7 @@ C-stack and being able to garbage collect off the C-stack There are many other contributors to SCM. They are acknowledged in the file @file{ChangeLog}, a log of changes that have been made to scm. + @node Copying, Bibliography, SCM Authors, Overview @section Copyright @@ -310,6 +312,7 @@ Paradigm Associates Inc Cambridge, MA 02138 @end flushleft + @node Bibliography, , Copying, Overview @section Bibliography @@ -334,8 +337,7 @@ Revised(4) Report on the Algorithmic Language Scheme. pp. 1-55. @ifinfo -@ref{Top, , , r4rs, Revised(4) Report on the Algorithmic Language -Scheme}. +@ref{Top, , , r4rs, Revised(4) Report on the Algorithmic Language Scheme}. @end ifinfo @item [R5RS] @@ -353,8 +355,7 @@ pp. 7-105, and @cite{ACM SIGPLAN Notices} 33(9), September 1998. @ifinfo -@ref{Top, , , r5rs, Revised(5) Report on the Algorithmic Language -Scheme}. +@ref{Top, , , r5rs, Revised(5) Report on the Algorithmic Language Scheme}. @end ifinfo @item [Exrename] @@ -455,6 +456,7 @@ include @code{scm} in other programs. Documentation of the Xlib - SCM Language X Interface. @end table + @node Installing SCM, Operational Features, Overview, Top @chapter Installing SCM @@ -476,10 +478,10 @@ Documentation of the Xlib - SCM Language X Interface. @node Making SCM, SLIB, Installing SCM, Installing SCM @section Making SCM -The SCM distribution has @dfn{Makefile} which contains rules for making -@dfn{scmlit}, a ``bare-bones'' version of SCM sufficient for running -@file{build}. @file{build} is used to compile (or create scripts to -compile) full featured versions. +The SCM distribution has @dfn{Makefile} which contains rules for +making @dfn{scmlit}, a ``bare-bones'' version of SCM sufficient for +running @file{build}. @file{build} is used to compile (or create +scripts to compile) full featured versions (@pxref{Building SCM}). Makefiles are not portable to the majority of platforms. If @file{Makefile} works for you, good; If not, I don't want to hear about @@ -517,34 +519,28 @@ low priority. SLIB is available from the same sites as SCM: @ifclear html @itemize @bullet @item -swiss.csail.mit.edu:/pub/scm/slib3a4.tar.gz -@item -ftp.gnu.org:/pub/gnu/jacal/slib3a4.tar.gz +swiss.csail.mit.edu:/pub/scm/slib3a5.tar.gz @item -ftp.cs.indiana.edu:/pub/scheme-repository/imp/slib3a4.tar.gz +ftp.gnu.org:/pub/gnu/jacal/slib3a5.tar.gz @end itemize @end ifclear @ifset html @itemize @bullet @item -<A HREF="http://swiss.csail.mit.edu/ftpdir/scm/slib3a4.zip"> -http://swiss.csail.mit.edu/ftpdir/scm/slib3a4.zip +<A HREF="http://swiss.csail.mit.edu/ftpdir/scm/slib3a5.zip"> +http://swiss.csail.mit.edu/ftpdir/scm/slib3a5.zip </A> @item -<A HREF="ftp://ftp.gnu.org/pub/gnu/jacal/slib3a4.tar.gz"> -ftp.gnu.org:/pub/gnu/jacal/slib3a4.tar.gz -</A> -@item -<A HREF="ftp://ftp.cs.indiana.edu/pub/scheme-repository/code/lib/slib3a4.tar.gz"> -ftp.cs.indiana.edu:/pub/scheme-repository/code/lib/slib3a4.tar.gz +<A HREF="ftp://ftp.gnu.org/pub/gnu/jacal/slib3a5.tar.gz"> +ftp.gnu.org:/pub/gnu/jacal/slib3a5.tar.gz </A> @end itemize @end ifset @noindent -Unpack SLIB (@samp{tar xzf slib3a4.tar.gz} or @samp{unzip -ao -slib3a4.zip}) in an appropriate directory for your system; both +Unpack SLIB (@samp{tar xzf slib3a5.tar.gz} or @samp{unzip -ao +slib3a5.zip}) in an appropriate directory for your system; both @code{tar} and @code{unzip} will create the directory @file{slib}. @noindent @@ -835,6 +831,7 @@ features are: @end table @end deffn + @node Compiling and Linking Custom Files, , Build Options, Building SCM @subsection Compiling and Linking Custom Files @@ -895,6 +892,7 @@ dynamic-loading), you can load the compiled file with the Scheme command @code{(load "./foo.so")}. See @ref{Configure Module Catalog} for how to add a compiled dll file to SLIB's catalog. + @node Installing Dynamic Linking, Configure Module Catalog, Building SCM, Installing SCM @section Installing Dynamic Linking @@ -907,10 +905,10 @@ proposed POSIX standard and may be available on other machines with finishing the port to VMS @ref{VMS Dynamic Linking}. @noindent -@dfn{DLD} is a library package of C functions that performs @dfn{dynamic -link editing} on Linux, VAX (Ultrix), Sun 3 (SunOS 3.4 and 4.0), -SPARCstation (SunOS 4.0), Sequent Symmetry (Dynix), and Atari ST. It is -available from: +@dfn{DLD} is a library package of C functions that performs +@dfn{dynamic link editing} on GNU/Linux, VAX (Ultrix), Sun 3 (SunOS +3.4 and 4.0), SPARCstation (SunOS 4.0), Sequent Symmetry (Dynix), and +Atari ST. It is available from: @ifclear html @itemize @bullet @@ -1005,6 +1003,7 @@ will be @code{load}ed. An unspecified value is returned. Remember to delete the file @file{slibcat} after modifying the file @file{mkimpcat.scm} in order to force SLIB to rebuild its cache. + @node Saving Images, Automatic C Preprocessor Definitions, Configure Module Catalog, Installing SCM @section Saving Images @@ -1023,7 +1022,7 @@ The @samp{dscm4} and @samp{dscm5} targets in the SCM @file{Makefile} save images from @file{udscm4} and @file{udscm5} executables respectively. -Recent Linux innovations interfere with @code{dump}. For: +Recent GNU/Linux innovations interfere with @code{dump}. For: @table @asis @item Fedora-Core-1 @@ -1054,6 +1053,7 @@ either set @file{randomize_va_space} to 0 or run as root to dump. @end table + @node Automatic C Preprocessor Definitions, Problems Compiling, Saving Images, Installing SCM @section Automatic C Preprocessor Definitions @@ -1093,11 +1093,12 @@ __APPLE__ Apple Darwin AMIGA SAS/C 5.10 or Dice C on AMIGA __amigaos__ Gnu CC on AMIGA atarist ATARI-ST under Gnu CC +__DragonflyBSD__ DragonflyBSD __FreeBSD__ FreeBSD GNUDOS DJGPP (obsolete in version 1.08) __GO32__ DJGPP (future?) hpux HP-UX -linux Linux +linux GNU/Linux macintosh Macintosh (THINK_C and __MWERKS__ define) MCH_AMIGA Aztec_c 5.2a on AMIGA __MACH__ Apple Darwin @@ -1107,6 +1108,7 @@ _MSDOS Microsoft CLARM and CLTHUMB compilers. __MSDOS__ Turbo C, Borland C, and DJGPP __NetBSD__ NetBSD nosve Control Data NOS/VE +__OpenBSD__ OpenBSD SVR2 System V Revision 2. sun SunOS __SVR4 SunOS @@ -1146,6 +1148,7 @@ vax VAX processor __x86_64 AMD Opteron @end example + @node Problems Compiling, Problems Linking, Automatic C Preprocessor Definitions, Installing SCM @section Problems Compiling @@ -1200,6 +1203,7 @@ __x86_64 AMD Opteron @tab @t{#define SYSTNAME} to your system type in scl.c (softtype). @end multitable + @node Problems Linking, Problems Running, Problems Compiling, Installing SCM @section Problems Linking @@ -1210,6 +1214,7 @@ __x86_64 AMD Opteron @tab Uncomment @t{LIBS} in makefile. @end multitable + @node Problems Running, Testing, Problems Linking, Installing SCM @section Problems Running @@ -1248,6 +1253,7 @@ __x86_64 AMD Opteron @tab Make sure the value of @t{(library-vicinity)} has a trailing file separator (like @t{/} or @t{\}). @end multitable + @node Testing, Reporting Problems, Problems Running, Installing SCM @section Testing @@ -1334,6 +1340,7 @@ exacerbated by using lots of call-with-current-continuations. A possible fix for dynthrow() is commented out in @file{continue.c}. @end table + @node Reporting Problems, , Testing, Installing SCM @section Reporting Problems @@ -1361,6 +1368,7 @@ and date of that distribution. In this case, corresponding with the vendor is recommended. @end enumerate + @node Operational Features, The Language, Installing SCM, Top @chapter Operational Features @@ -1384,7 +1392,8 @@ vendor is recommended. @example @exdent @b{ scm } [-a @i{kbytes}] [-muvbiq] @w{[--version]} @w{[--help]} -@w{[[-]-no-init-file]} @w{[-p @i{int}]} @w{[-r @i{feature}]} @w{[-h @i{feature}]} +@w{[[-]-no-init-file]} @w{[--no-symbol-case-fold]} +@w{[-p @i{int}]} @w{[-r @i{feature}]} @w{[-h @i{feature}]} @w{[-d @i{filename}]} @w{[-f @i{filename}]} @w{[-l @i{filename}]} @w{[-c @i{expression}]} @w{[-e @i{expression}]} @w{[-o @i{dumpname}]} @w{[-- | - | -s]} @w{[@i{filename}]} @w{[@i{arguments} @dots{}]} @@ -1428,6 +1437,7 @@ This explanation applies to SCMLIT or other builds of SCM. Scheme-code files can also invoke SCM and its variants. @xref{Lexical Conventions, #!}. + @node SCM Options, Invocation Examples, Invoking SCM, Operational Features @section Options @@ -1447,6 +1457,10 @@ file @file{setjump.h} which the distribution sets at Inhibits the loading of @file{ScmInit.scm} as described above. @end deffn +@deffn {Command Option} --no-symbol-case-fold +Symbol (and identifier) names will be case sensitive. +@end deffn + @deffn {Command Option} ---help prints usage information and URI; then exit. @end deffn @@ -1556,6 +1570,7 @@ aguments. specifies that further options are to be treated as program aguments. @end deffn + @node Invocation Examples, SCM Variables, SCM Options, Operational Features @section Invocation Examples @@ -1588,6 +1603,7 @@ enters interactive (with macros) session. Like above but @code{rev4-optional-procedures} are also loaded. @end table + @node SCM Variables, SCM Session, Invocation Examples, Operational Features @section Environment Variables @@ -1633,14 +1649,15 @@ command line. This can be overridden by subsequent @code{-i} and @code{-b} options. @end defvar + @node SCM Session, Editing Scheme Code, SCM Variables, Operational Features @section SCM Session @itemize @bullet @item Options, file loading and features can be specified from the command -line. @xref{System interface, , , scm, SCM}. @xref{Require, , , slib, -SLIB}. +line. +@xref{System interface, , , scm, SCM}. @xref{Require, , , slib, SLIB}. @item Typing the end-of-file character at the top level session (while SCM is not waiting for parenthesis closure) causes SCM to exit. @@ -1654,8 +1671,8 @@ and resumes the top level read-eval-print loop. @defunx exit @defunx exit n Aliases for @code{exit} (@pxref{System, exit, , slib, SLIB}). On many -systems, SCM can also tail-call another program. @xref{I/O-Extensions, -execp}. +systems, SCM can also tail-call another program. +@xref{I/O-Extensions, execp}. @end defun @deffn {Callback procedure} boot-tail dumped? @@ -1755,9 +1772,10 @@ expressions. Also as the result of the @samp{CAUTIOUS} flag, both @code{error} and @code{user-interrupt} (invoked by @key{C-c}) to print stack traces and -conclude by calling @code{breakpoint} (@pxref{Breakpoints, , , slib, -SLIB}) instead of aborting to top level. Under either condition, -program execution can be resumed by @code{(continue)}. +conclude by calling @code{breakpoint} +(@pxref{Breakpoints, , , slib, SLIB}) instead of aborting to top +level. Under either condition, program execution can be resumed by +@code{(continue)}. In this configuration one can interrupt a running Scheme program with @key{C-c}, inspect or modify top-level values, trace or untrace @@ -1858,6 +1876,7 @@ ftp.maths.tcd.ie:pub/bosullvn/jacal/slib-psd1-3.tar.gz ftp.cs.indiana.edu:/pub/scheme-repository/utl/slib-psd1-3.tar.gz @end lisp + @node Debugging Continuations, Errors, Debugging Scheme Code, Operational Features @section Debugging Continuations @@ -2075,9 +2094,9 @@ expressions. @noindent Also as the result of the @samp{CAUTIOUS} flag, both @code{error} and @code{user-interrupt} (invoked by @key{C-c}) are defined to print stack -traces and conclude by calling @code{breakpoint} (@pxref{Breakpoints, , -, slib, SLIB}). This allows the user to interract with SCM as with Lisp -systems. +traces and conclude by calling @code{breakpoint} +(@pxref{Breakpoints, , , slib, SLIB}). This allows the user to +interract with SCM as with Lisp systems. @defun stack-trace Prints information describing the stack of partially evaluated @@ -2086,6 +2105,7 @@ printed and @code{#f} otherwise. See @file{Init@value{SCMVERSION}.scm} for an example of the use of @code{stack-trace}. @end defun + @node Memoized Expressions, Internal State, Errors, Operational Features @section Memoized Expressions @@ -2117,7 +2137,7 @@ For instance, @code{open-input-file} is defined as follows in @example (define (open-input-file str) - (or (open-file str OPEN_READ) + (or (open-file str open_read) (and (procedure? could-not-open) (could-not-open) #f) (error "OPEN-INPUT-FILE couldn't open file " str))) @end example @@ -2254,8 +2274,8 @@ is returned. @end defun @noindent -For other configuration constants and procedures @xref{Configuration, , -, slib, SLIB}. +For other configuration constants and procedures +@xref{Configuration, , , slib, SLIB}. @node Scripting, , Internal State, Operational Features @@ -2533,8 +2553,7 @@ and </A> @end ifset @ifinfo -@ref{Top, , , r5rs, Revised(5) Report on the Algorithmic Language -Scheme}. +@ref{Top, , , r5rs, Revised(5) Report on the Algorithmic Language Scheme}. @end ifinfo All the required features of these specifications are supported. Many of the optional features are supported as well. @@ -2728,6 +2747,7 @@ seconds. @xref{Time and Date, current-time, , slib, SLIB}. @code{current-time} used in @ref{Time and Date, , , slib, SLIB}. @end defun + @node Interrupts, Process Synchronization, Time, The Language @section Interrupts @@ -2908,8 +2928,8 @@ Contain modes strings specifying that a file is to be opened for reading, writing, and both reading and writing respectively. Both input and output functions can be used with io-ports. An end of -file must be read or a file-set-position done on the port between a read -operation and a write operation or vice-versa. +file must be read or a two-argument file-position done on the port +between a read operation and a write operation or vice-versa. @end defvr @defun _ionbf modestr @@ -2965,6 +2985,18 @@ Returns the filename @var{port} was opened with. If @var{port} is not open to a file the result is unspecified. @end defun +@defun file-position port +@defunx file-position port #f +Returns the current position of the character in @var{port} which will +next be read or written. If @var{port} is open to a non-file then +@code{#f} is returned. + +@defunx file-position port k +Sets the current position in @var{port} which will next be read or +written. If successful, @code{#f} is returned. If @var{port} is open +to a non-file, then @code{file-position} returns @code{#f}. +@end defun + @defun port-line port @defunx port-column port If @var{port} is a tracked port, return the current line (column) number, @@ -3094,9 +3126,9 @@ procedures. For an input-only port only elements 3 and 4 need be procedures. Thunks 2 and 4 can instead be @code{#f} if there is no useful operation for them to perform. -If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input, -eof-object?, ,r5rs, Revised(5) Scheme}) it indicates that the port has -reached end-of-file. For example: +If thunk 3 returns @code{#f} or an @code{eof-object} +(@pxref{Input, eof-object?, ,r5rs, Revised(5) Scheme}) it indicates +that the port has reached end-of-file. For example: If it is necessary to explicitly close the port when it is garbage collected, (@pxref{Interrupts, add-finalizer}). @@ -3117,7 +3149,6 @@ collected, (@pxref{Interrupts, add-finalizer}). @end defun - @node Eval and Load, Lexical Conventions, Files and Ports, The Language @section Eval and Load @@ -3528,7 +3559,6 @@ expansion. @code{defconst} constants should be defined before use. @end defspec - @node Defmacro, Syntax-Rules, Define and Set, Syntax @subsection Defmacro @@ -3758,15 +3788,16 @@ Thus a mutable environment can be treated as both a list and local bindings. @end defspec + @node Syntactic Hooks for Hygienic Macros, , Environment Frames, Syntax @subsection Syntactic Hooks for Hygienic Macros SCM provides a synthetic identifier type for efficient implementation of -hygienic macros (for example, @code{syntax-rules} @pxref{Macros, , , -r5rs, Revised(5) Scheme}) A synthetic identifier may be inserted in -Scheme code by a macro expander in any context where a symbol would -normally be used. Collectively, symbols and synthetic identifiers are -@emph{identifiers}. +hygienic macros (for example, @code{syntax-rules} +@pxref{Macros, , , r5rs, Revised(5) Scheme}) A synthetic identifier +may be inserted in Scheme code by a macro expander in any context +where a symbol would normally be used. Collectively, symbols and +synthetic identifiers are @emph{identifiers}. @defun identifier? obj Returns @code{#t} if @var{obj} is a symbol or a synthetic @@ -3929,6 +3960,7 @@ identifier renamed in the definition environment of the new syntax. both denote the same binding in the usage environment of the new syntax. @end defspec + @node Packages, The Implementation, The Language, Top @chapter Packages @@ -4009,7 +4041,7 @@ will load/link @file{sc2.o} if it exists. The @var{lib1} @dots{} pathnames specify additional libraries which may be needed for object files not produced by the Hobbit compiler. For -instance, crs is linked on Linux by +instance, crs is linked on GNU/Linux by @example (load (in-vicinity (implementation-vicinity) "crs.o") @@ -4027,8 +4059,8 @@ or (require 'turtle-graphics) @ftindex turtle-graphics @end example -And the string regular expression (@pxref{Regular Expression Pattern -Matching}) package is linked by: +And the string regular expression +(@pxref{Regular Expression Pattern Matching}) package is linked by: @example (load (in-vicinity (implementation-vicinity) "rgx") (usr:lib "c")) @@ -4205,6 +4237,7 @@ bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)" bash$ @end example + @node Numeric, Arrays, Dump, Packages @section Numeric @@ -4223,8 +4256,8 @@ The ratio of the circumference to the diameter of a circle. @end defvr @noindent -These procedures augment the standard capabilities in @ref{Numerical -operations, , ,r5rs, Revised(5) Scheme}. +These procedures augment the standard capabilities in +@ref{Numerical operations, , ,r5rs, Revised(5) Scheme}. @defun pi* z @code{(* pi @var{z})} @@ -4282,6 +4315,7 @@ an error if the value which should be returned by a call to @code{real-expt} is not real. @end defun + @node Arrays, Records, Numeric, Packages @section Arrays @@ -4400,8 +4434,8 @@ are equivalent to (and can't be distinguished from) strings. @noindent Unshared uniform boolean 0-based arrays of rank 1 (dimension) are -equivalent to (and can't be distinguished from) @ref{Bit Vectors, -bit-vectors}. +equivalent to (and can't be distinguished from) +@ref{Bit Vectors, bit-vectors}. @example (make-array '#1at() 3) @result{} #*000 @equiv{} @@ -4505,6 +4539,7 @@ if the array element is not an exact integer or if @var{val} is not boolean. @end defun + @node Bit Vectors, Array Mapping, Uniform Array, Arrays @subsection Bit Vectors @@ -4573,9 +4608,9 @@ Same as @code{array:copy!} but guaranteed to copy in row-major order. @end defun @defun array-equal? array0 array1 @dots{} -Returns @code{#t} iff all arguments are arrays with the same shape, the -same type, and have corresponding elements which are either -@code{equal?} or @code{array-equal?}. This function differs from +Returns @code{#t} iff all arguments are arrays with the same shape, +the same type, and have corresponding elements which are either +@code{equal?} or @code{array-equal?}. This function differs from @code{equal?} in that a one dimensional shared array may be @var{array-equal?} but not @var{equal?} to a vector or uniform vector. @end defun @@ -4641,6 +4676,7 @@ A @var{printer} value of #f means use the default printer. Only the default printer will be used when printing error messages. @end defun + @node I/O-Extensions, Posix Extensions, Records, Packages @section I/O-Extensions @@ -4688,19 +4724,6 @@ Last file status change time Returns the process ID of the current process. @end defun -@defun file-position port -Returns the current position of the character in @var{port} which will -next be read or written. If @var{port} is not open to a file the result -is unspecified. -@end defun - -@defun file-set-position port integer -Sets the current position in @var{port} which will next be read or -written. If @var{port} is not open to a file the action of -@code{file-set-position} is unspecified. The result of -@code{file-set-position} is unspecified. -@end defun - @defun try-create-file name modes perms If the file with name @var{name} already exists, return @code{#f}, otherwise try to create and open the file like @code{try-open-file}, @@ -4781,8 +4804,9 @@ Applies @var{proc} only to those filenames for which @defun mkdir path mode The @code{mkdir} function creates a new, empty directory whose name is @var{path}. The integer argument @var{mode} specifies the file -permissions for the new directory. @xref{The Mode Bits for Access -Permission, , , libc, Gnu C Library}, for more information about this. +permissions for the new directory. +@xref{The Mode Bits for Access Permission, , , libc, Gnu C Library}, +for more information about this. @code{mkdir} returns if successful, @code{#f} if not. @end defun @@ -4901,10 +4925,11 @@ invariably uppercase. @code{execl}, @code{execlp}, @code{execv}, @code{execvp}, @code{system}, or @code{open-pipe} (@pxref{Posix Extensions, open-pipe}). -To access environment variables, use @code{getenv} (@pxref{System -Interface, getenv, , slib, SLIB}). +To access environment variables, use @code{getenv} +(@pxref{System Interface, getenv, , slib, SLIB}). @end defun + @node Posix Extensions, Unix Extensions, I/O-Extensions, Packages @section Posix Extensions @@ -4963,8 +4988,8 @@ process's @code{fork} returns 0. @end defun @noindent -For a discussion of @dfn{ID}s @xref{Process Persona, , , GNU C Library, -libc}. +For a discussion of @dfn{ID}s +@xref{Process Persona, , , GNU C Library, libc}. @defun getppid Returns the process ID of the parent of the current process. @@ -5219,6 +5244,7 @@ string containing the file name of termainal device; otherwise @code{#f}. @end defun + @node Unix Extensions, Sequence Comparison, Posix Extensions, Packages @section Unix Extensions @@ -5282,7 +5308,6 @@ writing is done. The value returned is unspecified. @end defun - @node Sequence Comparison, Regular Expression Pattern Matching, Unix Extensions, Packages @section Sequence Comparison @@ -5300,8 +5325,8 @@ These functions are defined in @file{rgx.c} using a POSIX or GNU @dfn{regex} library. If your computer does not support regex, a package is available via ftp from @file{ftp.gnu.org:/pub/gnu/regex-0.12.tar.gz}. For a description of -regular expressions, @xref{syntax, , , regex, "regex" regular expression -matching library}. +regular expressions, +@xref{syntax, , , regex, "regex" regular expression matching library}. @defun regcomp @var{pattern} [@var{flags}] Compile a @dfn{regular expression}. Return a compiled regular @@ -5416,6 +5441,7 @@ to perform one substitution. @end table @end defun + @node Line Editing, Curses, Regular Expression Pattern Matching, Packages @section Line Editing @@ -5424,8 +5450,9 @@ These procedures provide input line editing and recall. @noindent These functions are defined in @file{edline.c} and @file{Iedline.scm} -using the @dfn{editline} or GNU @dfn{readline} (@pxref{Top, , Overview -,readline ,GNU Readline Library}) libraries available from: +using the @dfn{editline} or GNU @dfn{readline} +(@pxref{Top, , Overview ,readline ,GNU Readline Library}) libraries +available from: @itemize @bullet @item @@ -5476,6 +5503,7 @@ input and output ports to an edited line port and returns the previous value of @code{(line-editing)}. @end defun + @node Curses, Sockets, Line Editing, Packages @section Curses @@ -5494,8 +5522,7 @@ A program should call @code{endwin} before exiting or escaping from curses mode temporarily, to do a system call, for example. This routine will restore termio modes, move the cursor to the lower left corner of the screen and reset the terminal into the proper non-visual mode. To -resume after a temporary escape, call @ref{Window Manipulation, -refresh}. +resume after a temporary escape, call @ref{Window Manipulation, refresh}. @end defun @menu @@ -5566,6 +5593,7 @@ ready, wgetch will return an eof-object. If disabled, wgetch will hang until a key is pressed. @end defun + @node Terminal Mode Setting, Window Manipulation, Output Options Setting, Curses @subsection Terminal Mode Setting @@ -5635,6 +5663,7 @@ These routines save and restore the state of the terminal modes. @code{savetty}. @end defun + @node Window Manipulation, Output, Terminal Mode Setting, Curses @subsection Window Manipulation @@ -5712,6 +5741,7 @@ specified is relative to the upper left corner of the window @var{win}, which is (0, 0). @end defun + @node Output, Input, Window Manipulation, Curses @subsection Output @@ -5752,10 +5782,10 @@ This routine copies blanks to every position in the window @var{win}. @end defun @defun wclear win -This routine is like @code{werase}, but it also calls @ref{Output -Options Setting, clearok}, arranging that the screen will be cleared -completely on the next call to @code{refresh} or @code{force-output} for -window @var{win}, and repainted from scratch. +This routine is like @code{werase}, but it also calls +@ref{Output Options Setting, clearok}, arranging that the screen will +be cleared completely on the next call to @code{refresh} or +@code{force-output} for window @var{win}, and repainted from scratch. @end defun @defun wclrtobot win @@ -5802,6 +5832,7 @@ is stdscr and the scrolling region is the entire window, the physical screen will be scrolled at the same time. @end defun + @node Input, Curses Miscellany, Output, Curses @subsection Input @@ -5829,6 +5860,7 @@ A list of the y and x coordinates of the cursor position of the window @var{win} is returned @end defun + @node Curses Miscellany, , Input, Curses @subsection Curses Miscellany @@ -5865,6 +5897,7 @@ displayed in the @kbd{C-x} notation. Printing characters are displayed as is. @end defun + @node Sockets, SCMDB, Curses, Packages @section Sockets @@ -5989,6 +6022,7 @@ between calls to getserv. Otherwise, the table stays open. When called without an argument, the service table is closed. @end defun + @node Internet Addresses and Socket Names, Socket, Host and Other Inquiries, Sockets @subsection Internet Addresses and Socket Names @@ -6125,9 +6159,9 @@ port) if successful, @code{#f} if not. @defun char-ready? listen-socket The input port returned by a successful call to @code{socket:listen} can -be polled for connections by @code{char-ready?} (@pxref{Files and Ports, -char-ready?}). This avoids blocking on connections by -@code{socket:accept}. +be polled for connections by @code{char-ready?} +(@pxref{Files and Ports, char-ready?}). This avoids blocking on +connections by @code{socket:accept}. @end defun @defun socket:accept socket @@ -6184,9 +6218,9 @@ sockets for multiple connections without input blocking. (next (cdr con-list))) (else (for-each (lambda (con) - (file-set-position con 0) + (file-position con 0) (write-char c con) - (file-set-position con 0)) + (file-position con 0)) connections) (cons con (next (cdr con-list))))))) (else (cons con (next (cdr con-list))))))))))))) @@ -6217,9 +6251,9 @@ or you can use a client written in scheme: (ct (and actives (memq (current-input-port) actives) (read-char)))) (cond ((or (eof-object? cs) (eof-object? ct)) (close-port con)) (else (cond (cs (display cs))) - (cond (ct (file-set-position con 0) + (cond (ct (file-position con 0) (display ct con) - (file-set-position con 0))) + (file-position con 0))) (go))))) (cond (con (display "Connecting to ") (display (getpeername con)) @@ -6229,6 +6263,7 @@ or you can use a client written in scheme: (newline))) @end example + @node SCMDB, , Sockets, Packages @section SCMDB @@ -6485,6 +6520,7 @@ A @dfn{CAR Immediate} is an Immediate point which can only occur in the @code{CAR}s of evaluated code (as a result of @code{ceval}'s memoization process). + @node Cells, Header Cells, Immediates, Data Types @subsection Cells @@ -6555,6 +6591,7 @@ Returns the a lower bound on the number of required arguments to closure @end deftp + @node Header Cells, Subr Cells, Cells, Data Types @subsection Header Cells @@ -6691,6 +6728,7 @@ Expands to the length of @var{cclo}. @end defmac @end deftp + @node Subr Cells, Ptob Cells, Header Cells, Data Types @subsection Subr Cells @@ -6767,16 +6805,18 @@ C function of 2 arguments and a list of (rest of) @code{SCM} arguments. C function of list of @code{SCM} arguments. @end deftp + @node Ptob Cells, Smob Cells, Subr Cells, Data Types @subsection Ptob Cells @noindent A @dfn{ptob} is a port object, capable of delivering or accepting @tindex ptob -characters. @xref{Ports, , , r5rs, Revised(5) Report on the Algorithmic -Language Scheme}. Unlike the types described so far, new varieties of -ptobs can be defined dynamically (@pxref{Defining Ptobs}). These are -the initial ptobs: +characters. +@xref{Ports, , , r5rs, Revised(5) Report on the Algorithmic Language Scheme}. +Unlike the types described so far, new varieties of ptobs can be +defined dynamically (@pxref{Defining Ptobs}). These are the initial +ptobs: @deftp ptob tc16_inport input port. @@ -6838,6 +6878,7 @@ Returns non-zero if @var{x} is a port, open port, open input-port, or open output-port, respectively. @end defmac + @node Smob Cells, Data Type Representations, Ptob Cells, Data Types @subsection Smob Cells @@ -7027,6 +7068,7 @@ macro 000000000000000mxxxxxxxxG1111111 ...........SCM name............. array ...short rank..cxxxxxxxxG1111111 ............*array..............} @end format + @node Operations, Program Self-Knowledge, Data Types, The Implementation @section Operations @@ -7110,6 +7152,7 @@ used. This has not been a problem in practice and the advantage of using the c-stack far outweighs it. @end deftypefun + @node Sweeping the Heap, , Marking Cells, Garbage Collection @subsubsection Sweeping the Heap @@ -7132,6 +7175,7 @@ object is freed. If the type header of smob is collected, the smob's @code{free} procedure is called to free its storage. @end deftypefun + @node Memory Management for Environments, Signals, Garbage Collection, Operations @subsection Memory Management for Environments @@ -7246,8 +7290,6 @@ into garbage collection techniques about which a considerable amount of literature is available. - - @node Signals, C Macros, Memory Management for Environments, Operations @subsection Signals @cindex signals @@ -7290,6 +7332,7 @@ that this constraint is satisfied @code{#define CAREFUL_INTS} in @file{scmfig.h}. @end defmac + @node C Macros, Changing Scm, Signals, Operations @subsection C Macros @@ -7559,6 +7602,7 @@ void init_gsubr211() @end example @end defun + @node Defining Smobs, Defining Ptobs, Defining Subrs, Operations @subsection Defining Smobs @@ -7633,6 +7677,7 @@ provide examples of SMOBs. There are a maximum of 256 SMOBs. Smobs that must allocate blocks of memory should use, for example, @code{must_malloc} rather than @code{malloc} @xref{Allocating memory}. + @node Defining Ptobs, Allocating memory, Defining Smobs, Operations @subsection Defining Ptobs @@ -7665,6 +7710,7 @@ for examples of how to define ptobs. Ptobs that must allocate blocks of memory should use, for example, @code{must_malloc} rather than @code{malloc} @xref{Allocating memory}. + @node Allocating memory, Embedding SCM, Defining Ptobs, Operations @subsection Allocating memory SCM maintains a count of bytes allocated using malloc, and calls the @@ -7713,7 +7759,6 @@ instead. @end deftypefun - @node Embedding SCM, Callbacks, Allocating memory, Operations @subsection Embedding SCM @cindex Embedding SCM @@ -7944,8 +7989,8 @@ Loads the Scheme source file @code{(in-vicinity (program-vicinity) This function is useful for compiled code init_ functions to load non-compiled Scheme (source) files. @code{program-vicinity} is the -directory from which the calling code was loaded (@pxref{Vicinity, , , -slib, SLIB}). +directory from which the calling code was loaded +(@pxref{Vicinity, , , slib, SLIB}). @end deftypefun @deftypefun SCM scm_evstr (char *@var{str}) @@ -7980,7 +8025,6 @@ can use a wrapper like this for your Scheme procedures: Calls to procedures so wrapped will return even if an error occurs. - @node Type Conversions, Continuations, Callbacks, Operations @subsection Type Conversions @@ -8071,6 +8115,7 @@ Frees the storage allocated to create @var{argv} by a call to @code{makargvfrmstrs}. @end deftypefun + @node Continuations, Evaluation, Type Conversions, Operations @subsection Continuations @cindex continuations @@ -8079,8 +8124,8 @@ Frees the storage allocated to create @var{argv} by a call to The source files @file{continue.h} and @file{continue.c} are designed to function as an independent resource for programs wishing to use continuations, but without all the rest of the SCM machinery. The -concept of continuations is explained in @ref{Control features, -call-with-current-continuation, , r5rs, Revised(5) Scheme}. +concept of continuations is explained in +@ref{Control features, call-with-current-continuation, , r5rs, Revised(5) Scheme}. @noindent The C constructs @code{jmp_buf}, @code{setjmp}, and @code{longjmp} @@ -8184,6 +8229,7 @@ the saved stack is copied back into it's original position. @end itemize @end deftypefun + @node Evaluation, , Continuations, Operations @subsection Evaluation @@ -8294,6 +8340,7 @@ environment. @code{eval} copies @code{expression} so that memoization does not modify @code{expression}. @end deftypefun + @node Program Self-Knowledge, Improvements To Make, Operations, The Implementation @section Program Self-Knowledge @@ -8435,6 +8482,7 @@ executable file. in any of the directories listed in @code{PATH}. @end deftypefun + @node Script Support, , Executable Pathname, Program Self-Knowledge @subsection Script Support |