home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / language / scm / !Scm / docs / MANUAL < prev    next >
Encoding:
Text File  |  1994-04-15  |  53.1 KB  |  1,533 lines

  1. "MANUAL", manual for scm4e1.
  2.    Copyright (C) 1990, 1991, 1992, 1993, 1994 Aubrey Jaffer.
  3.    See the file `COPYING' for terms applying to this program
  4.  
  5. Scm conforms to Revised^4 Report on the Algorithmic Language Scheme
  6. and the IEEE P1178 specification (see BIBLIOGRAPHY at end).  All the
  7. required features of these specifications are supported.  Some of the
  8. optional features are supported as well.
  9.  
  10. Integers use 2 bits less than the long integer type of the host
  11. machine.
  12.  
  13.            OPTIONAL Revised^4 FEATURES SUPPORTED BY SCM
  14.  
  15.     (if <test> <consequent>)
  16.     let*
  17.     do
  18.     (let <variable> <bindings> <body>)
  19.     All varieties of define
  20.     list-tail
  21.     string-copy, string-fill!
  22.     (make-vector k fill)
  23.     vector-fill!
  24.     (apply proc arg1 ... args) of more than 2 arguments
  25.     (- z1 z2 ...) and (/ z1 z2 ...) of more than 2 arguments
  26.     exp, log, sin, cos, tan, asin, acos, atan, sqrt, expt
  27.     make-rectangular, make-polar, real-part, imag-part
  28.     magnitude, angle
  29.     exact->inexact,    inexact->exact
  30.     delay, force
  31.     with-input-from-file, with-output-to-file
  32.     char-ready?
  33.     transcript-on, transcript-off
  34.  
  35.          OPTIONAL Revised^4 FEATURES NOT SUPPORTED BY SCM
  36.  
  37.     numerator
  38.     denominator
  39.     rationalize
  40.     Macros
  41.  
  42. Scm has features not required by the IEEE and Revised^4
  43. specifications:
  44.  
  45.                  ENHANCEMENTS
  46.  
  47. Options, file loading and features can be specified from the command
  48. line.  See the man page (scm.1 or scm.doc) for a description of
  49. initialization and command line processing.
  50.  
  51. Typing the end-of-file character at top level exits from scm.
  52.  
  53. Typing the interrupt character aborts evaluation of the current form
  54. and resumes the top level read-eval-print loop.
  55.  
  56.   (quit)                        procedure
  57.   (quit <n>)                        procedure
  58.  
  59. Exits from scm returning error code <n> to the system.  If <n> is
  60. ommited or #t, an EXIT_SUCCESS is returned to the system.  If <n> is
  61. any other non-integer value EXIT_FAILURE is returned to the system.
  62.  
  63.   (restart)                        procedure
  64.  
  65. Restarts SCM as though it had just been invoked.  The arguments are
  66. the same as the original invocation.
  67.  
  68.   (error <arg1> <arg2> <arg3> ...)            procedure
  69.  
  70. Outputs an error message containing the arguments, aborts evaluation of
  71. the current form and resumes the top level read-eval-print loop.
  72. Error is defined in Init.scm; change it to suit you.
  73.  
  74.   errobj                        variable
  75.  
  76. If scm encounters a non-fatal error it aborts evaluation of the
  77. current form, prints a message explaining the error, and resumes the
  78. top level read-eval-print loop.  The value of `errobj' is the
  79. offending object if appropriate.  errobj is not set from calls to the
  80. error function.
  81.  
  82.   (abort)                        procedure
  83.  
  84. Resumes the top level Read-Eval-Print loop.
  85.  
  86.   (ticks <n>)                        procedure
  87.  
  88. Returns the number of ticks remaining till the next tick interrupt.
  89. Ticks are an arbitrary unit of evaluation.  Ticks can vary greatly in
  90. the amount of time they represent.
  91.  
  92. If <n> is 0, any ticks request is canceled.  Otherwise an
  93. TICKS-INTERRUPT will be signaled <n> from the current time.  TICKS is
  94. supported if SCM is compiled with the TICKS flag defined.
  95.  
  96.   (define (ticks-interrupt) ...)        user procedure
  97.  
  98. Establishes a response for tick interrupts.  Another tick interrupt
  99. will not occur unless TICKS is called again.  Program execution will
  100. resume if the handler returns.  This procedure should (abort) or some
  101. other action which does not return if it does not want processing to
  102. continue.
  103.  
  104.   (alarm <secs>)                    procedure
  105.  
  106. Returns the number of seconds remaining till the next alarm interrupt.
  107. If <secs> is 0, any alarm request is canceled.  Otherwise an
  108. ALARM-INTERRUPT will be signaled <secs> from the current time.  ALARM
  109. is not supported on all systems.
  110.  
  111.   (define (user-interrupt) ...)            user procedure
  112.   (define (alarm-interrupt) ...)        user procedure
  113.  
  114. Establishes a response for SIGINT (control-C interrupt) and SIGALRM
  115. interrupts.  Program execution will resume if the handler returns.
  116. This procedure should (abort) or some other action which does not
  117. return if it does not want processing to continue after it returns.
  118.  
  119. Interrupt handlers are disabled during execution SYSTEM and ED
  120. procedures.
  121.  
  122. To unestablish a response for an interrupt set the handler symbol to
  123. #f.  For instance, (set! user-interrupt #f).
  124.  
  125.   (define (out-of-storage) ...)            user procedure
  126.   (define (could-not-open) ...)            user procedure
  127.   (define (end-of-program) ...)            user procedure
  128.   (define (hang-up) ...)            user procedure
  129.   (define (arithmetic-error) ...)        user procedure
  130.  
  131. Establishes a response for storage allocation error, file opening
  132. error, end of program, SIGHUP (hang up interrupt) and arithmetic
  133. errors respectively.  This procedure should (abort) or some other
  134. action which does not return if it does not want the default error
  135. message to also be displayed.  If no procedure is defined for HANG-UP
  136. then END-OF-PROGRAM (if defined) will be called.
  137.  
  138. To unestablish a response for an error set the handler symbol to
  139. #f.  For instance, (set! could-not-open #f).
  140.  
  141.   (errno)                        procedure
  142.   (errno <n>)                        procedure
  143.  
  144. With no argument returns the current value of the system variable
  145. `errno'.  When given an argument, errno sets the system variable
  146. `errno' to <n> and returns the previous value of `errno'.  (errno 0)
  147. will clear outstanding errors.  This is recommended after try-load
  148. returns #f since this occurs when the file could not be opened.
  149.  
  150.   (perror <string>)                    procedure
  151.  
  152. Prints on standard error output the argument <string>, a colon,
  153. followed by a space, the error message corresponding to the current
  154. value of errno and a newline.  The value returned is unspecified.
  155.  
  156.   (verbose <n>)                        procedure
  157.  
  158. Controls how much monitoring information is printed.
  159.   If <n> is 0 no prompt or information is printed.
  160.   If <n> is 1 or more a prompt is printed.
  161.   If <n> is 2 or more the CPU time is printed after each top level
  162.               form evaluated.
  163.   If <n> is 3 or more messages about heap growth are printed.
  164.   If <n> is 4 or more garbage collection (see gc) messages are
  165.               printed. 
  166.   If <n> is 5 or more a warning will be printed for each top-level
  167.               symbol which is defined more than one time.
  168.  
  169.   (gc)                            procedure
  170.  
  171. Scans all of scm objects and reclaims for further use those that are
  172. no longer accessible.
  173.  
  174.   (room)                        procedure
  175.   (room #t)                        procedure
  176.  
  177. Prints out statistics about SCM's current use of storage.  (ROOM #T)
  178. also gives the hexadecimal heap segment and stack bounds.
  179.  
  180.   (terms)                        procedure
  181.  
  182. This command displays the GNU General Public License.
  183.  
  184.   (list-file "<filename>")                procedure
  185.  
  186. Displays the text contents of <filename>.
  187.  
  188.   (system "<command> <arg1> ...")            procedure
  189.  
  190. Executes the <command> on the computer and returns the integer status
  191. code.
  192.  
  193.   (exec "<command>" "<arg1>" ...)            procedure
  194.  
  195. Transfers control to <command> called with the arguments.  This
  196. procedure does not return.
  197.  
  198.   (ed "<filename>")                    procedure
  199.   (vms-debug)                        procedure
  200.  
  201. If scm is compiled under VMS these commands will invoke the editor or
  202. debugger respectively.
  203.  
  204.   (program-arguments)                    procedure
  205.  
  206. Returns a list of strings of the arguments scm was called with.
  207.  
  208.   (getenv <name>)                    procedure
  209.  
  210. Looks up <name>, a string, in the program environment.  If <name> is
  211. found a string of its value is returned.  Otherwise, #f is returned.
  212.  
  213.   (tmpnam)                        procedure
  214.  
  215. Returns a pathname for a file which will likely not be used by any
  216. other process.  Successive calls to (tmpnam) will return different
  217. pathnames.
  218.  
  219.   (software-type)                    procedure
  220.  
  221. Returns a symbol for the type of operating system scm is running on.
  222.  
  223.   *scm-version*                        constant
  224.  
  225. Contains the version string (e.g. "4e1") of SCM.
  226.  
  227.   (acons obj1 obj2 obj3)                procedure
  228.  
  229. Returns (cons (cons obj1 obj2) obj3).  The expression (set! a-list
  230. (acons key datum a-list)) adds a new association to a-list.
  231.  
  232.   (copy-tree obj)                    procedure
  233.  
  234. If obj is not PAIR?, it is returned; otherwise COPY-TREE returns
  235. (CONS (COPY-TREE (CAR OBJ)) (COPY-TREE (CDR OBJ))).
  236.  
  237.   (eval obj)                        procedure
  238.  
  239. Returns the value of obj evaluated in the current top level
  240. environment.
  241.  
  242.   (dynamic-wind <thunk1> <thunk2> <thunk3>)        procedure
  243.  
  244. The arguments <thunk1>, <thunk2>, and <thunk3> must all be procedures
  245. of no arguments (thunks).
  246.  
  247. DYNAMIC-WIND calls <thunk1>, <thunk2>, and then <thunk3>.  The value
  248. returned by <thunk2> is returned as the result of DYNAMIC-WIND.
  249. <thunk3> is also called just before <thunk2> calls any continuations
  250. created by CALL-WITH-CURRENT-CONTINUATION.  If <thunk2> captures its
  251. continuation as an escape procedure, <thunk1> is invoked just before
  252. continuing that continuation.
  253.  
  254.   char-code-limit                    constant
  255.  
  256. Is an integer 1 larger that the largest value which can be returned by
  257. char->integer.
  258.  
  259.             COMPILING AND LINKING
  260.  
  261.   (compile-file <name1> <name2> ...)            procedure
  262.  
  263. If the HOBBIT compiler is installed in the (IMPLEMENTATION-VICINITY),
  264. compiles the files <name1> <name2> ... to an object file name
  265. <name1><object-suffix>, where <object-suffix> is the object file
  266. suffix for your computer (for instance, ".o").  <name1> must be in the
  267. current directory.  <name2> ... can be in other directories.
  268.  
  269.   (link-named-scm <name> <module1> ...)            procedure
  270.  
  271. Creates a new SCM executable with name <name>.  <name> will include
  272. the object modules <module1> ... which can be produced with
  273. compile-file.
  274.  
  275.   (load    <filename> <lib1> ...)                procedure
  276.  
  277. In addition to the R4RS requirement of loading Scheme expressions if
  278. <filename> is a Scheme source file, LOAD will also dynamically
  279. load/link object files (produced by COMPILE-FILE, for instance).  The
  280. object-suffix need not be given to load.  For example,
  281.  
  282.     (load (in-vicinity (implementation-vicinity) "sc2"))
  283.     (load (in-vicinity (implementation-vicinity) "sc2.o"))
  284.  
  285. will both load/link "sc2.o" if it exists.
  286.  
  287. The <lib1> ... pathnames are for additional libraries which may be
  288. needed for object files not produced by the Hobbit compiler.  For
  289. instance, crs is linked on Linux by
  290.  
  291. (load (in-vicinity (implementation-vicinity) "crs.o")
  292.       "/usr/lib/libncurses.a" "/usr/lib/libc.a")
  293.  
  294. Turtlegr graphics library is linked by:
  295.  
  296. (load (in-vicinity (implementation-vicinity) "turtlegr")
  297.       "/usr/lib/libX11.a" "/usr/lib/libc.a" "/usr/lib/libm.a")
  298.  
  299. And the string regular expression package is linked by:
  300.  
  301. (load (in-vicinity (implementation-vicinity) "rgx") "/usr/lib/libc.a")
  302.  
  303.                    NUMERIC
  304.  
  305.   most-positive-fixnum                    constant
  306.  
  307. Is the Immediate integer closest to positive infinity.
  308.  
  309.   most-negative-fixnum                    constant
  310.  
  311. Is the Immediate integer closest to negative infinity.
  312.  
  313.   (sinh x)                        procedure
  314.   (cosh x)                        procedure
  315.   (tanh x)                        procedure
  316.  
  317. Return the hyperbolic sine, cosine, and tangent of real number x.
  318.  
  319.   ($sqrt x)                        procedure
  320.   ($abs x)                        procedure
  321.   ($exp x)                        procedure
  322.   ($log x)                        procedure
  323.   ($sin x)                        procedure
  324.   ($cos x)                        procedure
  325.   ($tan x)                        procedure
  326.   ($asin x)                        procedure
  327.   ($acos x)                        procedure
  328.   ($atan x)                        procedure
  329.   ($sinh x)                        procedure
  330.   ($cosh x)                        procedure
  331.   ($tanh x)                        procedure
  332.   ($asinh x)                        procedure
  333.   ($acosh x)                        procedure
  334.   ($atanh x)                        procedure
  335.  
  336. Real only versions of these popular functions.
  337.  
  338.   ($atan2 y x)                        procedure
  339.  
  340. Computes (angle (make-rectangular x y)).
  341.  
  342.   ($expt x1 x2)                        procedure
  343.  
  344. Returns real number x1 raised to the real power x2.
  345.  
  346.   (integer-expt z n)                    procedure
  347.  
  348. Returns z raised to the integer power n.
  349.  
  350.                  TIME
  351.  
  352.   internal-time-units-per-second            constant
  353.  
  354. Is the integer number of internal time units in a second.
  355.  
  356.   (get-internal-run-time)                procedure
  357.  
  358. Returns the integer run time in internal time units from an
  359. unspecified starting time.  The difference of two calls to
  360. get-internal-run-time divided by interal-time-units-per-second will
  361. give elapsed run time in seconds.
  362.  
  363.   (get-internal-real-time)                procedure
  364.  
  365. Returns the integer time in internal time units from an unspecified
  366. starting time.  The difference of two calls to get-internal-real-time
  367. divided by interal-time-units-per-second will give elapsed real time
  368. in seconds.
  369.  
  370.   (get-decode-time)                    procedure
  371.  
  372. Returns a vector of integers for the local time.  The elements of the
  373. returned vector are as follows:
  374.  
  375.   0  seconds,
  376.   1  minutes,
  377.   2  hours since midnight,
  378.   3  day of month,
  379.   4  month,
  380.   5  year,
  381.   6  day of week,
  382.   7  day of year,
  383.   8  nonzero implies daylight savings
  384.  
  385.   (get-universal-time)                    procedure
  386.  
  387. The number of seconds since a reference time is returned.  This
  388. reference time is 00:00:00 Jan 1, 1970 GMT on most systems.
  389.  
  390.   (decode-universal-time time)                procedure
  391.  
  392. Converts time to a vector of integers.  The elements of the returned
  393. vector are as follows:
  394.  
  395.   0  seconds,
  396.   1  minutes,
  397.   2  hours since midnight,
  398.   3  day of month,
  399.   4  month,
  400.   5  year,
  401.   6  day of week,
  402.   7  day of year,
  403.   8  nonzero implies daylight savings
  404.  
  405.                 ARRAYS
  406.  
  407. When constructing an array, BOUND is either an inclusive range of
  408. indices expressed as a two element list, or an upper bound expressed
  409. as a single integer.  So
  410.     (make-array 'foo 3 3) and
  411.     (make-array 'foo '(0 2) '(0 2)) are equivalent
  412.  
  413.   (array? obj)                        procedure
  414.   (array? obj prototype)                procedure
  415.  
  416. Returns a boolean indicating whether obj is an array
  417. (corresponding to the prototype if given).
  418.  
  419. Returns `#t' if the OBJ is an array, and `#f' if not.
  420.  
  421.   (make-array INITIAL-VALUE BOUND1 BOUND2 ...)        procedure
  422.  
  423. Creates and returns an array that has as many dimensions as there are
  424. BOUNDs and fills it with INITIAL-VALUE.
  425.  
  426.   (make-uniform-array PROTOTYPE BOUND1 BOUND2 ...)    procedure
  427.  
  428. Creates and returns a uniform array of uniform type corresponding to
  429. PROTOTYPE that has as many dimensions as there are BOUNDs and fills it
  430. with PROTOTYPE.
  431.  
  432.   (array-ref ARRAY INDEX1 INDEX2 ...)            procedure
  433.  
  434. Returns the element at the `(INDEX1, INDEX2)' element in ARRAY.
  435.  
  436.   (array-in-bounds? ARRAY INDEX1 INDEX2 ...)        procedure
  437.  
  438. Returns #t if its arguments would be acceptable to array-ref.
  439.  
  440.   (array-set! ARRAY NEW-VALUE INDEX1 INDEX2 ...)    procedure
  441.  
  442. Sets the element at the `(INDEX1, INDEX2)' element in ARRAY to
  443. NEW-VALUE.  The value returned by array-set! is unspecified.
  444.  
  445.   (make-shared-array ARRAY MAPPER BOUND1 BOUND2 ...)    procedure
  446.  
  447. `make-shared-array' can be used to create shared subarrays of other
  448. arrays.  The MAPPER is a function that translates coordinates in the
  449. new array into coordinates in the old array.  A MAPPER must be linear,
  450. and its range must stay within the bounds of the old array, but it can
  451. be otherwise arbitrary.  A simple example:
  452.     (define fred (make-array #f 8 8))
  453.     (define freds-diagonal
  454.       (make-shared-array fred (lambda (i) (list i i)) 8))
  455.     (array-set! freds-diagonal 'foo 3)
  456.     (array-ref fred 3 3) => FOO
  457.     (define freds-center
  458.       (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))
  459.     (array-ref freds-center 0 0) => FOO
  460.  
  461.   (array-shape ARRAY)                    procedure
  462.  
  463. Returns a list of inclusive bounds of integers.
  464.     (array-shape (make-array 'foo '(-1 3) 5)) => ((-1 3) (0 4))
  465.  
  466.   (array-dimensions ARRAY)                procedure
  467.  
  468. Array-dimensions is similar to array-shape but replaces elements with
  469. a 0 minimum with one greater than the maximum. So:
  470.     (array-dimensions (make-array 'foo '(-1 3) 5)) => ((-1 3) 5)
  471.  
  472.   (array-rank obj)                    procedure
  473.  
  474. Returns the number of dimensions of obj.  If obj is not an array, 0 is
  475. returned.
  476.  
  477.   (array-prototype ARRAY)                procedure
  478.  
  479. Returns an object that would produce an array of the same type as ARRAY,
  480. if used as the PROTOTYPE for make-uniform-array.
  481.  
  482.   (array->list array)                    procedure
  483.  
  484. Returns a list consisting of all the elements, in order, of array.
  485.  
  486.   (list->uniform-array rank prot lst)            procedure
  487.   (list->uniform-vector prot lst)            procedure
  488.  
  489. Returns a uniform array of the type indicated by prototype with
  490. elements the same as those of lst.  Elements must be of the
  491. appropriate type, no coercions are done.
  492.  
  493.   (array-copy! SOURCE DESTINATION)            procedure
  494.  
  495. Copies every element from vector or array SOURCE to the corresponding
  496. element of DESTINATION.  DESTINATION must have the same rank as SOURCE,
  497. and be at least as large in each dimension.  The order is unspecified.
  498.  
  499.   (serial-array-copy! SOURCE DESTINATION)        procedure
  500.  
  501. Same as ARRAY-COPY! but guaranteed to copy in row-major order.
  502.  
  503.   (array-fill! ARRAY FILL)                procedure
  504.  
  505. Stores FILL in every element of ARRAY.  The value returned is unspecified.
  506.  
  507.   (array-equal? ARRAY0 ARRAY1 ...)            procedure
  508.  
  509. Returns #T iff all arguments are arrays with the same shape, the same
  510. type, and have corresponding elements which are either EQUAL? or
  511. ARRAY-EQUAL?.  This function differs from EQUAL? in that a one
  512. dimensional shared array may be ARRAY-EQUAL? but not EQUAL? to a
  513. vector or uniform vector.
  514.  
  515.   (array-contiguous? ARRAY)                procedure
  516.  
  517. Returns #t if ARRAY is stored internally in lexicographic order, and,
  518. for bit-arrays, properly aligned.  This will be true of strings,
  519. vectors, and all arrays created by make-array or make-uniform-array, but
  520. may be false for arrays created by make-shared-array.
  521.  
  522.   (array-map! ARRAY0 PROC ARRAY1 ... )            procedure
  523.  
  524. ARRAY1, ... must have the same number of dimensions as ARRAY0 and 
  525. have a range for each index which includes the range for the 
  526. corresponding index in ARRAY0.  PROC is applied to each tuple of 
  527. elements of ARRAY1 ... and the result is stored as the corresponding 
  528. element in ARRAY0.  The value returned is unspecified.  The order of
  529. application is unspecified.
  530.  
  531.   (serial-array-map! ARRAY0 PROC ARRAY1 ... )        procedure
  532.  
  533. Same as ARRAY-MAP!, but guaranteed to apply PROC in row-major order.
  534.  
  535.   (array-for-each PROC ARRAY0 ... )            procedure
  536.  
  537. PROC is applied to each tuple of elements of ARRAY0 ... in
  538. row-major order.  The value returned is unspecified.
  539.  
  540.   (array-index-map! ARRAY PROC)                procedure
  541.  
  542. applies PROC to the indices of each element of ARRAY in turn, storing the
  543. result in the corresponding element.  The value returned and the order
  544. of application are unspecified.
  545.  
  546. You can implement ARRAY-INDEXES as
  547.  
  548. (define (array-indexes array)
  549.     (let ((ra (apply make-array #f (array-shape array))))
  550.       (array-index-map! ra (lambda x x))
  551.       ra))
  552.  
  553. Another example:
  554.  
  555. (define (apl:index-generator n)
  556.     (let ((v (make-uniform-vector n 1)))
  557.       (array-index-map! v (lambda (i) i))
  558.       v))
  559.  
  560.   (dimensions->uniform-array dims prot fill)        procedure
  561.   (dimensions->uniform-array dims prot)            procedure
  562.  
  563.                 UNIFORM VECTOR
  564.  
  565. Uniform vectors are vectors whose elements are all of the same type.
  566. For types boolean, char, integer, and inexact numbers uniform vectors
  567. occupy less storage than conventional vectors.  Uniform-vector
  568. functions also work on vectors.
  569.  
  570.   (make-uniform-vector length prototype)        procedure
  571.  
  572. Returns a uniform vector whose elements are as specified by the
  573. prototype argument according to the following table:
  574.     prototype    type                printing character
  575.  
  576.     #t        boolean (bit-vector)            b
  577.     #\a        char (string)                a
  578.     integer >0    unsigned integer            u
  579.     integer <0    signed integer                e
  580.     1.0        float (single precision)        s
  581.     1/3        double (double precision float)        i
  582.     +i        complex (double precision)        c
  583.     ()        conventional vector
  584.  
  585. Uniform vectors are written in a form similar to that of vectors,
  586. except that a single character from the above table is put between
  587. `#' and '(', for example,
  588.  
  589.   '#e(3 5 9)
  590.  
  591. returns a uniform vector of signed integers.
  592. Bit vectors will be printed as, for example,
  593.  
  594.   #*0001010
  595.  
  596. for a vector of length 7, but this may be read as
  597.  
  598.   #b(#f #f #f #t #f #t #f)
  599.  
  600.   (uniform-vector-length uve)                procedure
  601.  
  602. Returns the number of elements in uve.
  603.  
  604.   (uniform-vector-fill! uve fill)            procedure
  605.  
  606. Stores fill in every element of vector.  The value returned by
  607. uniform-vector-fill! is unspecified.
  608.  
  609.   (uniform-vector-read! uve)                procedure
  610.   (uniform-vector-read! uve port)            procedure
  611.  
  612. Reads (uniform-vector-length uve) binary objects from port.  If an end
  613. of file is encountered during uniform-vector-read! the objects up to
  614. that point only are put into uve (starting at the beginning) and the
  615. remainder of the string is unchanged.
  616.  
  617. uniform-vector-read! returns the number of objects read.  Port may
  618. be omitted, in which case it defaults to the value returned by
  619. current-input-port.
  620.  
  621. uniform-vector-read! may be used to read multidimensional uniform-arrays, 
  622. if array-contiguous? returns #t for them.
  623.  
  624.   (uniform-vector-write uve)                procedure
  625.   (uniform-vector-write uve port)            procedure
  626.  
  627. Writes (uniform-vector-length uve) binary objects to port.  The number
  628. of objects actually written is returned.
  629.  
  630. uniform-vector-write returns the number of objects writen.  Port may
  631. be omitted, in which case it defaults to the value returned by
  632. current-output-port.
  633.  
  634. uniform-vector-write may be used to write multidimensional uniform-arrays,
  635. if array-contiguous? returns #t for them.
  636.  
  637.   (vector-set-length! uve length)            procedure
  638.  
  639. Change the length of the first argument to the second.  If this
  640. shortens the object then the remaining contents are lost.  If it
  641. enlarges the object then the contents of the extended part are
  642. undefined but the original part is unchanged.  It is an error to
  643. change the length of literal datums.  The new object is returned.
  644.  
  645.                  BIT VECTORS
  646.  
  647. Some of these operations will eventually be generalized to other
  648. uniform-arrays.
  649.  
  650.   (bit-count bool bv)                    procedure
  651.  
  652. Returns the number occurences of bool in bv.
  653.  
  654.   (bit-position bool bv k)                procedure
  655.  
  656. Returns the minimum index of an occurence of bool in bv which is at
  657. least k.  If no bool occurs within the specified range #f is returned.
  658.  
  659.   (bit-invert! bv)                    procedure
  660.  
  661. Modifies bv by replacing each element with its negation.
  662.  
  663.   (bit-set*! bv uve bool)                procedure
  664.  
  665. If uve is a bit-vector bv and uve must be of the same length.  If bool
  666. is #t, uve is OR'ed into bv; If bool is #f, the inversion of uve is
  667. AND'ed into bv.
  668.  
  669. If uve is a unsigned integer vector all the elements of uve must be
  670. between 0 and the length of bv.  The bits of bv corresponding to the
  671. indexes in uve are set to bool.
  672.  
  673. The return value is unspecified.
  674.  
  675.   (bit-count* bv uve bool)                procedure
  676.  
  677. Returns (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t)
  678. #t).  Bv is not modified.
  679.  
  680.                    VICINITY
  681.  
  682. A vicinity is a descriptor for a place in the file system.  Vicinities
  683. hide from the programmer the concepts of host, volume, directory, and
  684. version.  Vicinities express only the concept of a file environment
  685. where a file name can be resolved to a file in a system independent
  686. manner.  Vicinities can even be used on `flat' file systems (which
  687. have no directory structure) by having the vicinity express
  688. constraints on the file name.  On most systems a vicinity would be a
  689. string.  All of these procedures are file system dependent.
  690.  
  691. NOTE: a more complete implementation of VICINITY is in the Scheme
  692. Library.
  693.  
  694.   (program-vicinity)                    procedure
  695.  
  696. Returns the vicinity of the currently loading Scheme code.  For an
  697. interpreter this would be the directory containing source code.  For a
  698. compiled system (with multiple files) this would be the directory
  699. where the object or executable files are.  If no file is currently
  700. loading it the result is undefined.
  701.  
  702.   (library-vicinity)                    procedure
  703.  
  704. Returns the vicinity of the shared Scheme library.
  705.  
  706.   (implementation-vicinity)                procedure
  707.  
  708. Returns the vicinity of the underlying Scheme implementation.  This
  709. vicinity will likely contain startup code and messages and a compiler.
  710.  
  711.   (in-vicinity <vicinity> <filename>)            procedure
  712.  
  713. Returns a filename suitable for use by load, open-input-file,
  714. open-output-file, etc.  The returned filename is <filename> in
  715. <vicinity>.  For most systems in-vicinity is string-append.
  716.  
  717.   (try-load <filename>)                    procedure
  718.  
  719. Filename should be a string.  If filename names an existing file, the
  720. try-load procedure reads Scheme source code expressions and
  721. definintions from the file and evaluates them sequentially and returns
  722. #t.  If not, try-load returns #f.  The try-load procedure does not
  723. affect the values returned by current-input-port and current-output-port.
  724.  
  725.   *load-pathname*                    variable
  726.  
  727. Is set to the pathname given as argument to load try-load.
  728.  
  729.   (line-number)                        procedure
  730.  
  731. Returns the current line number of the file currently being loaded.
  732.  
  733.   *features*                        variable
  734.  
  735. Is a list of symbols denoting features supported in this
  736. implementation.
  737.  
  738.                SYNTAX EXTENSIONS
  739.  
  740.   (read:sharp c port)                user procedure
  741.  
  742. If a "#" followed by a character (not handled by read) is encountered
  743. by read, read will call the value of the symbol "read:sharp" with
  744. arguments the character and the port being read from.  The value
  745. returned by this function will be the value read for this expression
  746. unless the function returns <unspecified> in which case the expression
  747. will be treated as whitespace.  <unspecified> is the value returned by
  748. the expression (if #f #f).
  749.  
  750.   #.<expression>                    read syntax
  751.  
  752. Is read as the object resulting from the evaluation of <expression>.
  753. This substitution occurs even inside quoted structure.
  754.  
  755. In order to allow compiled code to work with #. it is good practice to
  756. define those symbols used inside of <expression> with #.(define ...).
  757. For example:
  758.  
  759.     #.(define foo 9)            ==> #<unspecified>
  760.     '(#.foo #.(+ foo foo))        ==> (9 18)
  761.  
  762.   #+feature form                    read syntax
  763.  
  764. If feature is "provided" (by *features*) then form is read as a scheme
  765. expression.  If not, then form is treated as whitespace.
  766.  
  767. Feature is a boolean expression composed of symbols and AND, OR, and
  768. NOT of boolean expressions.
  769.  
  770.   #-feature form                    read syntax
  771.  
  772. is equivalent to #+(NOT feature) expression.
  773.  
  774.   #'form                        read syntax
  775.  
  776. is equivalent to form (for compatability with common-lisp).
  777.  
  778.   #|<anything>|#                    read syntax
  779.  
  780. Is a balanced comment.  Everything up to the matching |# is ignored by
  781. the reader.  Nested #|...|# can occur inside <anything>.
  782.  
  783.   #!<anything>                        read syntax
  784.  
  785. On the first line of a file will be ignored when loaded by SCM.  This
  786. makes SCM files usable as POSIX shell scripts if the first line is:
  787.  
  788.     #!/usr/local/bin/scm
  789.  
  790. When such a file is invoked it exectues /usr/local/bin/scm with the
  791. name of this file as the first argument.  The following shell script
  792. will print factorial of its argument:
  793.  
  794.     #!/usr/local/bin/scm
  795.     ;;; -*-scheme-*- tells emacs this is a scheme file.
  796.     (define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
  797.     (display (fact (string->number (caddr (program-arguments)))))
  798.     (newline)
  799.     (quit)
  800.  
  801.   (procedure->syntax <proc>)                procedure
  802.  
  803. Returns a "macro" which, when a symbol defined to this value appears
  804. as the first symbol in an expression, returns the result of applying
  805. <proc> to the expression and the environment.
  806.  
  807.   (procedure->macro <proc>)                procedure
  808.   (procedure->memoizing-macro <proc>)            procedure
  809.  
  810. Returns a "macro" which, when a symbol defined to this value appears
  811. as the first symbol in an expression, evaluates the result of applying
  812. <proc> to the expression and the environment.  The value returned from
  813. <proc> which has been passed to PROCEDURE->MEMOIZING-MACRO replaces
  814. the form passed to <proc>.  For example:
  815.  
  816.   (define trace
  817.     (procedure->macro
  818.      (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
  819.  
  820. When invoked, (trace foo) will evaluate (set! foo (tracef foo 'foo)).
  821.  
  822. There are 2 types of environment frames.  The one produced by LAMBDAs,
  823. LETs and LETRECs consists of ((varlist . vallist) . nextframe).  the
  824. one produced by LET* (and single variable LETs) is ((var1 . val1)
  825. (var2 .  val2) ... . nextframe).
  826.  
  827.   (@apply procedure argument-list)            syntax
  828.  
  829. Returns the result of applying procedure to argument-list.  (apply
  830. procedure argument-list) will produce the same result.
  831.  
  832.   (@call-with-current-continutation procedure)        syntax
  833.  
  834. Returns the result of applying procedure to the current continuation.
  835. (call-with-current-continutation procedure) will have the same effect.
  836.  
  837.   (defined? <symbol>)                    syntax
  838.  
  839. Equivalent to #t if <symbol> is a syntactic keyword (such as IF) or a
  840. symbol with a top-level value.  Otherwise equivalent to #f.
  841.  
  842. SCM also supports the following constructs from Common Lisp: defmacro,
  843. macroexpand, macroexpand1, macro?, gentemp, and defvar.
  844.  
  845.                 REV2_PROCEDURES
  846.  
  847.   If sc2.c is compiled and linked into SCM then the following
  848. functions are also defined:
  849.  
  850.   (last-pair <list>)                    procedure
  851.  
  852. Returns the last pair in the nonempty, possily improper, list <list>.
  853.  
  854.   (substring-move-left! <string1> <start1> <end1> <string2> <start2>)
  855.   (substring-move-right! <string1> <start1> <end1> <string2> <start2>)
  856.                             procedure
  857.  
  858. <String1> and <string2> must be strings, and <start1>, <start2> and
  859. <end1> must be exact integers satisfying
  860.  
  861.     0 <= start1 <= end1 <= (string-length <string1>)
  862.     0 <= start2 <= end1-start1+start2 <= (string-length <string2>).
  863.  
  864. Substring-move-left! and substring-move-right! store characters of
  865. <string1> beginning with index <start1> (inclusive) and ending with
  866. index <end1> (exclusive) into <string2> beginning with index <start2>
  867. (inclusive).
  868.  
  869. Substring-move-left! stores characters in time order of increasing
  870. indeces.  Substring-move-right! stores characters in time order of
  871. decreasing indeces.
  872.  
  873.   (substring-fill! <string> <start> <end> <fill>)    procedure
  874.  
  875. Substring-fill! stores character <fill> into <string> beginning with
  876. index <start> (inclusive) and ending with index <end) (exclusive).
  877.  
  878.   (object-hash obj)                    procedure
  879.  
  880. Returns an integer for obj.  (= (object-hash obj) (object-hash obj))
  881. will always be #t.  Object-hash does not cause obj to continue to
  882. exist if there are no more references to obj.  At most 2 different
  883. objects map to any integer.
  884.  
  885.   (object-unhash k)                    procedure
  886.  
  887. Returns an object whose (object-hash obj) is k or #f if that object no
  888. longer exists.
  889.  
  890.   (string-null? <string>)                procedure
  891.  
  892. Returns #t if the string <string> has length 0.
  893.  
  894.   (append! <list1> ...)                    procedure
  895.  
  896. Returns a list the is the argument <list>s concatenated together.  The
  897. arguments are modified rather than copied.
  898.  
  899.                  STRING PORTS
  900.  
  901.   (call-with-output-string <proc>)            procedure
  902.  
  903. <proc> must be a procedure of one argument.  This procedure calls
  904. <proc> with one argument: a (newly created) output port.  When the
  905. function returns, the string composed of the characters written into
  906. the port is returned.
  907.  
  908.   (call-with-input-string <string> <proc>)        procedure
  909.  
  910. <proc> must be a procedure of one argument.  This procedure calls
  911. <proc> with one argument: an (newly created) input port from which
  912. <string>'s contents may be read.  When <proc> returns, the port is
  913. closed and the value yielded by the procedure <proc> is returned.
  914.  
  915.                   SOFT PORTS
  916.  
  917. A soft port is a port based on a vector of procedures capable of
  918. accepting or delivering characters.
  919.  
  920.   (make-soft-port <vector> <modes>)            procedure
  921.  
  922. Returns a port capable of receiving or delivering characters as
  923. specified by the <modes> string (see open-file below).  <vector> must
  924. be a vector of length 6.  Its components are as follows:
  925.  
  926.   0 procedure accepting one character for output
  927.   1 procedure accepting a string for output
  928.   2 thunk for flushing output
  929.   3 thunk for getting one character
  930.   4 thunk for closing port (not by garbage collection)
  931.  
  932. For an output-only port only elements 0, 1, 2, and 4 need be
  933. procedures.  For an input-only port only elements 3 and 4 need be
  934. procedures.  Thunks 2 and 4 can instead be #f if there is no useful
  935. operation for them to perform.
  936.  
  937. If thunk 3 returns #f or `eof-object' it indicates that the port has
  938. reached end-of-file.
  939.  
  940.                 IO_EXTENSIONS
  941.  
  942.   (open-file <string> <modes>)                procedure
  943.  
  944. Returns a port capable of receiving or delivering characters as
  945. specified by the <modes> string.  If a file cannot be opened #f is
  946. returned.
  947.  
  948.   OPEN_READ                        constant
  949.   OPEN_WRITE                        constant
  950.   OPEN_BOTH                        constant
  951.  
  952. Contain modes strings specifying that a file is to be opened for
  953. reading, writing, and both reading and writing respectively.
  954.  
  955.   (close-port <port>)                    procedure
  956.  
  957. Closes <port>.  The same as close-input-port and close-output-port.
  958.  
  959.   (open-io-file <filename>)                procedure
  960.   (close-io-port <port>)                procedure
  961.  
  962. These functions are analogous to the standard scheme file functions.
  963. The ports are open to <filename> in read/write mode.  Both input and
  964. output functions can be used with io-ports.  An end of file must be
  965. read or a file-set-position done on the port between a read operation
  966. and a write operation or vice-versa.
  967.  
  968.   (current-error-port)                    procedure
  969.  
  970. Returns the current port to which diagnostic output is directed.
  971.  
  972.   (with-erorr-to-file <string> <thunk>)            procedure
  973.  
  974. <Thunk> must be a procedre of no arguments, and string must be a
  975. string naming a file.  The file is opened for output, an output port
  976. connected to it is made the default value returned by
  977. current-error-port, and the <thunk> is called with no arguments.  When
  978. the thunk returns, the port is closed and the previous default is
  979. restored.  With-error-to-file returns the value yielded by <thunk>.
  980.  
  981.   (with-input-from-port <port> <thunk>)            procedure
  982.   (with-output-to-port <port> <thunk>)            procedure
  983.   (with-error-to-port <port> <thunk>)            procedure
  984.  
  985. These routines differ from with-input-from-file, with-output-to-file,
  986. and with-error-to-file in that the first argument is a port, rather
  987. than a string naming a file.
  988.  
  989.   (file-exists? <filename>)                procedure
  990.  
  991. Returns #t if the specified file exists.  Otherwise, returns #f.
  992.  
  993.   If IO_EXTENSIONS is #defined in scmfig.h or the makefile the
  994. following functions are also defined:
  995.  
  996.   (isatty? <port>)                    procedure
  997.  
  998. Returns #t if <port> is input or output to a serial non-file device.
  999.  
  1000.   (stat <port-or-string>)                procedure
  1001.  
  1002. Returns a vector of integers describing the argument.  The argument
  1003. can be either a string or an open input port. If the argument is an
  1004. open port then the returned vector describes the file to which the
  1005. port is opened; If the argument is a string then the returned vector
  1006. describes the file named by that string.  If there exists no file with
  1007. the name string, or if the file cannot be accessed #f is returnd.
  1008. The elements of the returned vector are as follows:
  1009.  
  1010.   0  st_dev    ID of device containing a
  1011.         directory entry for this file
  1012.   1  st_ino    Inode number
  1013.   2  st_mode    File type, attributes, and
  1014.         access control summary
  1015.   3  st_nlink    Number of links
  1016.   4  st_uid    User ID of file owner
  1017.   5  st_gid    Group ID of file group
  1018.   6  st_rdev    Device ID; this entry defined
  1019.         only for char or blk spec files
  1020.   7  st_size    File size (bytes)
  1021.   8  st_atime    Time of last access
  1022.   9  st_mtime    Last modification time
  1023.   10 st_ctime    Last file status change time
  1024.  
  1025.   (open-pipe <string> <modes>)                procedure
  1026.  
  1027. If the string <modes> contains an "r" returns an input port capable of
  1028. delivering characters from the standard output of the system command
  1029. <string>.  Otherwise, returns an output port capable of receiving
  1030. characters which become the standard input of the system command
  1031. <string>.  If a pipe cannot be created #f is returned.
  1032.  
  1033.   (open-input-pipe <string>)                procedure
  1034.  
  1035. Returns an input port capable of delivering characters from the
  1036. standard output of the system command <string>.  If a pipe cannot be
  1037. created #f is returned.
  1038.  
  1039.   (open-output-pipe <string>)                procedure
  1040.  
  1041. Returns an output port capable of receiving characters which become
  1042. the standard input of the system command <string>.  If a pipe cannot
  1043. be created #f is returned.
  1044.  
  1045.   (close-port <pipe>)                    procedure
  1046.  
  1047. Closes the <pipe>, rendering it incapable of delivering or accepting
  1048. characters.  This routine has no effect if the pipe has already been
  1049. closed.  The value returned is unspecified.
  1050.  
  1051.   (file-position <port>)                procedure
  1052.  
  1053. Returns the current position of the character in <port> which will
  1054. next be read or written.  If <port> is not open to a file the result
  1055. is unspecified.
  1056.  
  1057.   (file-set-position <port> <integer>)            procedure
  1058.  
  1059. Sets the current position in <port> which will next be read or
  1060. written.  If <port> is not open to a file the action of
  1061. file-set-position is unspecified.  The result of file-set-position is
  1062. unspecified.
  1063.  
  1064.   (force-output)                    procedure
  1065.   (force-output <port>)                    procedure
  1066.  
  1067. Forces any pending output on <port> to be delivered to the output
  1068. device and returns an unspecified value.  The <port> argument may be
  1069. omitted, in which case it defaults to the value returned by
  1070. CURRENT-OUTPUT-PORT.
  1071.  
  1072.   (chdir <filename>)                    procedure
  1073.  
  1074. Changes the current directory to <filename>.  If <filename> does not
  1075. exist or is not a directory, #f is returned.  Otherwise, #t is
  1076. returned.
  1077.  
  1078.   (delete-file <filename>)                procedure
  1079.  
  1080. Deletes the file specified by <filename>.  If <filename> can not be
  1081. deleted, #f is returned.  Otherwise, #t is returned.
  1082.  
  1083.   (rename-file <oldfilename> <newfilename>)        procedure
  1084.  
  1085. Renames the file specified by <oldfilename> to <newfilename>.  If the
  1086. renaming is successful, #t is returned.  Otherwise, #f is returned.
  1087.  
  1088.   (read-line port)                    procedure
  1089.   (read-line)                        procedure
  1090.  
  1091. Returns a string of the characters up to, but not including a newline
  1092. or end of file, updating the port to point to the character following
  1093. the newline.  If no characters are available, an end of file object is
  1094. returned.  Port may be omitted, in which case it defaults to the value
  1095. returned by current-input-port.
  1096.  
  1097.   (read-line! string port)                procedure
  1098.   (read-line! string)                    procedure
  1099.  
  1100. Fills string with characters up to, but not including a newline or end
  1101. of file, updating the port to point to the last character read or
  1102. following the newline if it was read.  If no characters are available,
  1103. an end of file object is returned.  If a newline or end of file was
  1104. found, the number of characters read is returned.  Otherwise, #f is
  1105. returned.  Port may be omitted, in which case it defaults to the value
  1106. returned by current-input-port.
  1107.  
  1108.   (write-line string port)                procedure
  1109.   (write-line string)                    procedure
  1110.  
  1111. Writes string followed by a newline to the given port and returns an
  1112. unspecified value.  Port may be omitted, in which case it defaults to
  1113. the value returned by current-output-port.
  1114.  
  1115.                PROCESS SYNCHRONIZATION
  1116.  
  1117.   (make-arbiter <name>)                    procedure
  1118.  
  1119. Returns an oject of type arbiter and name <name>.  Its state is
  1120. initially unlocked.
  1121.  
  1122.   (try-arbiter <arbiter>)                procedure
  1123.  
  1124. Returns #t and locks <arbiter> if <arbiter> was unlocked.  Otherwise,
  1125. returns #f.
  1126.  
  1127.   (release-arbiter <arbiter>)                procedure
  1128.  
  1129. Returns #t and unlocks <arbiter> if <arbiter> was locked.  Otherwise,
  1130. returns #f.
  1131.  
  1132.          REGULAR EXPRESSION PATTERN MATCHING
  1133.  
  1134. These functions are defined in rgx.c using a POSIX C regex library.
  1135. If your computer does not support regex a package is available via ftp
  1136. from prep.ai.mit.edu:/pub/gnu/regex-0.12.tar.gz.  See the
  1137. documentation for the regex library for a description of regular
  1138. expressions.
  1139.  
  1140.   (regcomp <pattern>)                    procedure
  1141.  
  1142. Given a string <pattern>, Returns an integer error code or an object
  1143. of type regexp which is suitable as an argument to regexec.
  1144.  
  1145.   (regerror <errno>)                    procedure
  1146.  
  1147. Returns a string describing the integer <errno> returned by regcomp in
  1148. case <pattern> could not be compiled.
  1149.  
  1150.   (regmatch? <regexp> <string>)                procedure
  1151.  
  1152. Returns #t if the <pattern> such that <regexp> = (regcomp <pattern>)
  1153. matches <string> as a POSIX extended regular expressions.  Returns #f
  1154. otherwise.
  1155.  
  1156.   (regexec <regexp> <string>)                procedure
  1157.  
  1158. Returns #f or a vector of integers.  These integers are in doublets.
  1159. The first of each doublet is the index of <string> of the start of the
  1160. matching expression or sub-expression (delimited by parentheses in the
  1161. pattern).  The last of each doublet is index of <string> o the end of
  1162. that expression.  #f is returned if the string does not match.
  1163.  
  1164.                 CURSES
  1165.  
  1166. These functions are defined in crs.c using a "curses" library.  Unless
  1167. otherwise noted these routines return #t for successful completion and
  1168. #f for failure.
  1169.  
  1170.   (initscr)                        procedure
  1171.  
  1172. Returns a port for a full screen window.  This routine must be called
  1173. to initialize curses.
  1174.  
  1175.   (endwin)                        procedure
  1176.  
  1177. A program should call endwin before exiting or escaping from curses
  1178. mode temporarily, to do a system call, for example.  This routine will
  1179. restore termio modes, move the cursor to the lower left corner of the
  1180. screen and reset the terminal into the proper non-visual mode.  To
  1181. resume after a temporary escape, call refresh.
  1182.  
  1183.     OUTPUT OPTIONS SETTING
  1184.  
  1185. These routines set options within curses that deal with output.  All
  1186. options are initially #F, unless otherwise stated.  It is not
  1187. necessary to turn these options off before calling endwin.
  1188.  
  1189.   (clearok win bf)                    procedure
  1190.  
  1191. If enabled (bf is #T), the next call to force-output with this window
  1192. will clear the screen completely and redraw the entire screen from
  1193. scratch.  This is useful when the contents of the screen are
  1194. uncertain, or in some cases for a more pleasing visual effect.
  1195.  
  1196.   (idlok win bf)                    procedure
  1197.  
  1198. If enabled (bf is #T), curses will consider using the hardware
  1199. "insert/delete-line" feature of terminals so equipped.  If disabled
  1200. (bf is #F), curses will very seldom use this feature.  The
  1201. "insert/delete-character" feature is always considered.  This option
  1202. should be enabled only if your application needs "insert/delete-line",
  1203. for example, for a screen editor.  It is disabled by default because
  1204.  
  1205. "insert/delete-line" tends to be visually annoying when used in
  1206. applications where it is not really needed.  If "insert/delete-line"
  1207. cannot be used, curses will redraw the changed portions of all lines.
  1208.  
  1209.   (leaveok win bf)                    procedure
  1210.  
  1211. Normally, the hardware cursor is left at the location of the window
  1212. cursor being refreshed.  This option allows the cursor to be left
  1213. wherever the update happens to leave it.  It is useful for
  1214. applications where the cursor is not used, since it reduces the need
  1215. for cursor motions.  If possible, the cursor is made invisible when
  1216. this option is enabled.
  1217.  
  1218.   (scrollok win bf)                    procedure
  1219.  
  1220. This option controls what happens when the cursor of a window is moved
  1221. off the edge of the window or scrolling region, either from a newline
  1222. on the bottom line, or typing the last character of the last line.  If
  1223. disabled (bf is #F), the cursor is left on the bottom line at the
  1224. location where the offending character was entered.  If enabled (bf is
  1225. #T), force-output is called on the window, and then the physical
  1226. terminal and window are scrolled up one line.  Note: in order to get
  1227. the physical scrolling effect on the terminal, it is also necessary to
  1228. call idlok.
  1229.  
  1230.   (nodelay win bf)                    procedure
  1231.  
  1232. This option causes wgetch to be a non-blocking call.  If no input is
  1233. ready, wgetch will return an eof-object. If disabled, wgetch will hang
  1234. until a key is pressed.
  1235.  
  1236.     TERMINAL MODE SETTING
  1237.  
  1238. These routines set options within curses that deal with input.  The
  1239. options involve using ioctl(2) and therefore interact with curses
  1240. routines.  It is not necessary to turn these options off before
  1241. calling endwin.  The routines in this section all return an
  1242. unspecified value.
  1243.  
  1244.   (cbreak)                        procedure
  1245.   (nocbreak)                        procedure
  1246.  
  1247. These two routines put the terminal into and out of CBREAK mode,
  1248. respectively.  In CBREAK mode, characters typed by the user are
  1249. immediately available to the program and erase/kill character
  1250. processing is not performed.  When in NOCBREAK mode, the tty driver
  1251. will buffer characters typed until a NEWLINE or RETURN is typed.
  1252. Interrupt and flowcontrol characters are unaffected by this mode.
  1253. Initially the terminal may or may not be in CBREAK mode, as it is
  1254. inherited, therefore, a program should call cbreak or nocbreak
  1255. explicitly.  Most interactive programs using curses will set CBREAK
  1256. mode.
  1257.  
  1258. Note: cbreak overrides raw.  See read-char under Input for a
  1259. discussion of how these routines interact with echo and noecho.
  1260.  
  1261.   (raw)                            procedure
  1262.   (noraw)                        procedure
  1263.  
  1264. The terminal is placed into or out of RAW mode.  RAW mode is similar
  1265. to CBREAK mode, in that characters typed are immediately passed
  1266. through to the user program.  The differences are that in RAW mode,
  1267. the interrupt, quit, suspend, and flow control characters are passed
  1268. through uninterpreted, instead of generating a signal.  RAW mode also
  1269. causes 8-bit input and output.  The behavior of the BREAK key depends
  1270. on other bits in the terminal driver that are not set by curses.
  1271.  
  1272.   (echo)                        procedure
  1273.   (noecho)                        procedure
  1274.  
  1275. These routines control whether characters typed by the user are echoed
  1276. by read-char as they are typed.  Echoing by the tty driver is always
  1277. disabled, but initially read-char is in ECHO mode, so characters typed
  1278. are echoed.  Authors of most interactive programs prefer to do their
  1279. own echoing in a controlled area of the screen, or not to echo at all,
  1280. so they disable echoing by calling noecho.  See read-char under Input
  1281. for a discussion of how these routines interact with cbreak and
  1282. nocbreak.
  1283.  
  1284.   (nl)                            procedure
  1285.   (nonl)                        procedure
  1286.  
  1287. These routines control whether NEWLINE is translated into RETURN and
  1288. LINEFEED on output, and whether RETURN is translated into NEWLINE on
  1289. input.  Initially, the translations do occur.  By disabling these
  1290. translations using nonl, curses is able to make better use of the
  1291. linefeed capability, resulting in faster cursor motion.
  1292.  
  1293.   (resetty)                        procedure
  1294.   (savetty)                        procedure
  1295.  
  1296. These routines save and restore the state of the terminal modes.
  1297. savetty saves the current state of the terminal in a buffer and
  1298. resetty restores the state to what it was at the last call to savetty.
  1299.  
  1300.     WINDOW MANIPULATION
  1301.  
  1302.   (newwin nlines ncols begy begx)            procedure
  1303.  
  1304. Create and return a new window with the given number of lines (or
  1305. rows), nlines, and columns, ncols.  The upper left corner of the
  1306. window is at line begy, column begx.  If either nlines or ncols is 0,
  1307. they will be set to the value of LINES-begy and COLS-begx.  A new
  1308. full-screen window is created by calling newwin(0,0,0,0).
  1309.  
  1310.   (subwin orig nlines ncols begy begx)            procedure
  1311.  
  1312. Create and return a pointer to a new window with the given number of
  1313. lines (or rows), nlines, and columns, ncols.  The window is at
  1314. position ( begy, begx) on the screen.  This position is relative to
  1315. the screen, and not to the window orig.  The window is made in the
  1316. middle of the window orig, so that changes made to one window will
  1317. affect both windows.  When using this routine, often it will be
  1318. necessary to call touchwin or touchline on orig before calling
  1319. force-output.
  1320.  
  1321.   (close-port win)                    procedure
  1322.  
  1323. Deletes the named window, freeing up all memory associated with it.
  1324. In the case of sub-windows, they should be deleted before the main
  1325. window.
  1326.  
  1327.   (refresh)                        procedure
  1328.   (force-output win)                    procedure
  1329.  
  1330. These routines are called to write output to the terminal, as most
  1331. other routines merely manipulate data structures.  force-output copies
  1332. the named window to the physical terminal screen, taking into account
  1333. what is already there in order to minimize the amount of information
  1334. that's sent to the terminal (called optimization).  Unless leaveok has
  1335. been enabled, the physical cursor of the terminal is left at the
  1336. location of the window's cursor.  With refresh, the number of
  1337. characters output to the terminal is returned.
  1338.  
  1339.   (mvwin win y x)                    procedure
  1340.  
  1341. Move the window so that the upper left corner will be at position (y,
  1342. x).  If the move would cause the window to be off the screen, it is an
  1343. error and the window is not moved.
  1344.  
  1345.   (overlay srcwin dstwin)                procedure
  1346.   (overwrite srcwin dstwin)                procedure
  1347.  
  1348. These routines overlay srcwin on top of dstwin; that is, all text in
  1349. srcwin is copied into dstwin.  scrwin and dstwin need not be the same
  1350. size; only text where the two windows overlap is copied.  The
  1351. difference is that overlay is non-destructive (blanks are not copied),
  1352. while overwrite is destructive.
  1353.  
  1354.   (touchwin win)                    procedure
  1355.   (touchline win start count)                procedure
  1356.  
  1357. Throw away all optimization information about which parts of the
  1358. window have been touched, by pretending that the entire window has
  1359. been drawn on.  This is sometimes necessary when using
  1360.  
  1361. overlapping windows, since a change to one window will affect the
  1362. other window, but the records of which lines have been changed in the
  1363. other window will not reflect the change.  touchline only pretends
  1364. that count lines have been changed, beginning with line start.
  1365.  
  1366.   (wmove win y x)                    procedure
  1367.  
  1368. The cursor associated with the window is moved to line (row) y, column
  1369. x.  This does not move the physical cursor of the terminal until
  1370. refresh is called.  The position specified is relative to the upper
  1371. left corner of the window, which is (0, 0).
  1372.  
  1373.     OUTPUT (These routines are used to "draw" text on windows)
  1374.  
  1375.   (display ch win)                    procedure
  1376.   (display str win)                    procedure
  1377.   (wadd win ch)                        procedure
  1378.   (wadd win str)                    procedure
  1379.  
  1380. The character ch or characters in str are put into the window at the
  1381. current cursor position of the window and the position of the window
  1382. cursor is advanced.  At the right margin, an automatic newline is
  1383. performed.  At the bottom of the scrolling region, if scrollok is
  1384. enabled, the scrolling region will be scrolled up one line.
  1385.  
  1386. If ch is a TAB, NEWLINE, or backspace, the cursor will be moved
  1387. appropriately within the window.  A NEWLINE also does a clrtoeol
  1388. before moving.  TAB characters are considered to be at every eighth
  1389. column.  If ch is another control character, it will be drawn in the
  1390. CTRL-X notation.  (Calling winch after adding a control character will
  1391. not return the control character, but instead will return the
  1392. representation of the control character.)
  1393.  
  1394. Video attributes can be combined with a character by or-ing them into
  1395. the parameter.  This will result in these attributes also being set.
  1396. The intent here is that text, including attributes, can be copied from
  1397. one place to another using inch and display.  See standout, below.
  1398.  
  1399. Note: For wadd ch can be an integer and will insert the character of
  1400. the corresponding value.
  1401.  
  1402.   (werase win)                        procedure
  1403.  
  1404. This routine copies blanks to every position in the window.
  1405.  
  1406.   (wclear win)                        procedure
  1407.  
  1408. This routine is like werase, but it also calls clearok, arranging that
  1409. the screen will be cleared completely on the next call to force-output
  1410. for that window, and repainted from scratch.
  1411.  
  1412.   (wclrtobot win)                    procedure
  1413.  
  1414. All lines below the cursor in this window are erased.  Also, the
  1415. current line to the right of the cursor, inclusive, is erased.
  1416.  
  1417.   (wclrtoeol win)                    procedure
  1418.  
  1419. The current line to the right of the cursor, inclusive, is erased.
  1420.  
  1421.   (wdelch win)                        procedure
  1422.  
  1423. The character under the cursor in the window is deleted.  All
  1424. characters to the right on the same line are moved to the left one
  1425. position and the last character on the line is filled with a blank.
  1426. The cursor position does not change.  This does not imply use of the
  1427. hardware "delete-character" feature.
  1428.  
  1429.   (wdeleteln win)                    procedure
  1430.  
  1431. The line under the cursor in the window is deleted.  All lines below
  1432. the current line are moved up one line.  The bottom line of the window
  1433. is cleared.  The cursor position does not change.  This does not imply
  1434. use of the hardware "deleteline" feature.
  1435.  
  1436.   (winsch win ch)                    procedure
  1437.  
  1438. The character ch is inserted before the character under the cursor.
  1439. All characters to the right are moved one SPACE to the right, possibly
  1440. losing the rightmost character of the line.  The cursor position does
  1441. not change .  This does not imply use of the hardware
  1442. "insertcharacter" feature.
  1443.  
  1444.   (winsertln win)                    procedure
  1445.  
  1446. A blank line is inserted above the current line and the bottom line is
  1447. lost.  This does not imply use of the hardware "insert-line" feature.
  1448.  
  1449.   (scroll win)                        procedure
  1450.  
  1451. The window is scrolled up one line.  This involves moving the lines in
  1452. the window data structure.  As an optimization, if the window is
  1453. stdscr and the scrolling region is the entire window, the physical
  1454. screen will be scrolled at the same time.
  1455.  
  1456.     INPUT
  1457.  
  1458.   (read-char win)                    procedure
  1459.  
  1460. A character is read from the terminal associated with the window.
  1461. Depending on the setting of cbreak, this will be after one character
  1462. (CBREAK mode), or after the first newline (NOCBREAK mode).  Unless
  1463. noecho has been set, the character will also be echoed into the
  1464. designated window.
  1465.  
  1466. When using read-char, do not set both NOCBREAK mode (nocbreak) and
  1467. ECHO mode (echo) at the same time.  Depending on the state of the
  1468. terminal driver when each character is typed, the program may produce
  1469. undesirable results.
  1470.  
  1471.   (winch win)                        procedure
  1472.  
  1473. The character, of type chtype, at the current position in the named
  1474. window is returned.  If any attributes are set for that position,
  1475. their values will be OR'ed into the value returned.
  1476.  
  1477.   (getyx win)                        procedure
  1478.  
  1479. A list of the y and x coordinates of the cursor position of the window
  1480. is returned
  1481.  
  1482.     MISCELLANEOUS
  1483.  
  1484.   (wstandout win)                    procedure
  1485.   (wstandend win)                    procedure
  1486.  
  1487. These functions set the current attributes of the named window.  The
  1488. current attributes of a window are applied to all characters that are
  1489. written into the window.  Attributes are a property of the character,
  1490. and move with the character through any scrolling and insert/delete
  1491. line/character operations.  To the extent possible on the particular
  1492. terminal, they will be displayed as the graphic rendition of
  1493. characters put on the screen.
  1494.  
  1495. Wstandout sets the current attributes of the given window to be
  1496. visibly different from other text.  Wstandend turns off the
  1497. attributes.
  1498.  
  1499.   (box win vertch horch)                procedure
  1500.  
  1501. A box is drawn around the edge of the window, win.  vertch and horch
  1502. are the characters the box is to be drawn with.  If vertch and horch
  1503. are 0, then appropriate default characters, ACS_VLINE and ACS_HLINE,
  1504. will be used.
  1505.  
  1506. Note: vertch and horch can be an integers and will insert the
  1507. character (with attributes) of the corresponding values.
  1508.  
  1509.   (unctrl c)                        procedure
  1510.  
  1511. This macro expands to a character string which is a printable
  1512. representation of the character c.  Control characters are displayed
  1513. in the ^X notation.  Printing characters are displayed as is.
  1514.  
  1515.              SCHEME BIBLIOGRAPHY
  1516.  
  1517. Revised^4 Report on the Algorithmic Language Scheme can be obtained
  1518. via anonymous ftp from: altdorf.ai.mit.edu:archive/scheme-reports/
  1519.  
  1520. IEEE Std 1178-1990,
  1521. IEEE Standard for the Scheme Programming Language,
  1522. Institute of Electrical and Electronic Engineers, Inc.,
  1523. New York, NY, 1991
  1524.  
  1525. Two books about Scheme are:
  1526.  
  1527. R. Kent Dybvig, The Scheme Programming Language,
  1528. Prentice-Hall Inc, Englewood Cliffs, New Jersey 07632, USA
  1529.  
  1530. H. Abelson, G. J. Sussman, and J. Sussman,
  1531. Structure and Interpretation of Computer Programs,
  1532. The MIT Press, Cambridge, Massachusetts, USA, 1985
  1533.