Changeset 13659 in project for chicken/trunk/manual/Unit library


Ignore:
Timestamp:
03/10/09 10:11:14 (11 years ago)
Author:
felix winkelmann
Message:

small manual fixes; merged wiki changes (rev. 13647) into manual

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/manual/Unit library

    r13562 r13659  
    3434==== bit-set?
    3535
    36  [procedure] (bit-set? N INDEX)
     36<procedure>(bit-set? N INDEX)</procedure>
    3737
    3838Returns {{#t}} if the bit at the position {{INDEX}} in the integer {{N}} is
     
    8787==== Arithmetic floating-point operations
    8888
    89 In safe mode, these procedures throw a type error with non-float arguments. In
    90 unsafe mode, these procedures do not check their arguments. A non-flonum
    91 argument in unsafe mode can crash the system.
     89arguments (except {{flonum?}}, which returns {{#f}}). In unsafe mode,
     90these procedures do not check their arguments. A non-flonum argument
     91in unsafe mode can crash the system.
    9292
    9393; [procedure] (flonum? X)
     
    126126==== finite?
    127127
    128  [procedure] (finite? N)
     128<procedure>(finite? N)</procedure>
    129129
    130130Returns {{#f}} if {{N}} is negative or positive infinity, and {{#t}} otherwise.
     
    143143==== current-output-port
    144144
    145  [procedure] (current-output-port [PORT])
     145<procedure>(current-output-port [PORT])</procedure>
    146146
    147147Returns default output port. If {{PORT}} is given, then that port is selected
     
    153153==== current-error-port
    154154
    155  [procedure] (current-error-port [PORT])
     155<procedure>(current-error-port [PORT])</procedure>
    156156
    157157Returns default error output port. If {{PORT}} is given, then that port is
     
    164164==== flush-output
    165165
    166  [procedure] (flush-output [PORT])
     166<procedure>(flush-output [PORT])</procedure>
    167167
    168168Write buffered output to the given output-port. {{PORT}} defaults
     
    172172==== port-name
    173173
    174  [procedure] (port-name [PORT])
     174<procedure>(port-name [PORT])</procedure>
    175175
    176176Fetch filename from {{PORT}}. This returns the filename that was used to open
     
    181181==== port-position
    182182
    183  [procedure] (port-position [PORT])
     183<procedure>(port-position [PORT])</procedure>
    184184
    185185Returns the current position of {{PORT}} as two values: row and column number.
     
    191191==== set-port-name!
    192192
    193  [procedure] (set-port-name! PORT STRING)
     193<procedure>(set-port-name! PORT STRING)</procedure>
    194194
    195195Sets the name of {{PORT}} to {{STRING}}.
     
    201201==== delete-file
    202202
    203  [procedure] (delete-file STRING)
     203<procedure>(delete-file STRING)</procedure>
    204204
    205205Deletes the file with the pathname {{STRING}}. If the file does
     
    209209==== file-exists?
    210210
    211  [procedure] (file-exists? STRING)
     211<procedure>(file-exists? STRING)</procedure>
    212212
    213213Returns {{STRING}} if a file with the given pathname exists, or
     
    217217==== rename-file
    218218
    219  [procedure] (rename-file OLD NEW)
     219<procedure>(rename-file OLD NEW)</procedure>
    220220
    221221Renames the file or directory with the pathname {{OLD}} to
     
    227227==== get-output-string
    228228
    229  [procedure] (get-output-string PORT)
     229<procedure>(get-output-string PORT)</procedure>
    230230
    231231Returns accumulated output of a port created with
     
    235235==== open-input-string
    236236
    237  [procedure] (open-input-string STRING)
     237<procedure>(open-input-string STRING)</procedure>
    238238
    239239Returns a port for reading from {{STRING}}.
     
    242242==== open-output-string
    243243
    244  [procedure] (open-output-string)
     244<procedure>(open-output-string)</procedure>
    245245
    246246Returns a port for accumulating output in a string.
     
    266266==== features
    267267
    268  [procedure] (features)
     268<procedure>(features)</procedure>
    269269
    270270Returns a list of all registered features that will be accepted as valid
     
    274274==== feature?
    275275
    276  [procedure] (feature? ID ...)
     276<procedure>(feature? ID ...)</procedure>
    277277
    278278Returns {{#t}} if all features with the given feature-identifiers {{ID ...}}
     
    282282==== register-feature!
    283283
    284  [procedure] (register-feature! FEATURE ...)
     284<procedure>(register-feature! FEATURE ...)</procedure>
    285285
    286286Register one or more features that will be accepted as valid
     
    291291==== unregister-feature!
    292292
    293  [procedure] (unregister-feature! FEATURE ...)
     293<procedure>(unregister-feature! FEATURE ...)</procedure>
    294294
    295295Unregisters the specified feature-identifiers. {{FEATURE ...}}
     
    314314==== get-keyword
    315315
    316  [procedure] (get-keyword KEYWORD ARGLIST [THUNK])
     316<procedure>(get-keyword KEYWORD ARGLIST [THUNK])</procedure>
    317317
    318318Returns the argument from {{ARGLIST}} specified under the keyword
     
    333333==== keyword?
    334334
    335  [procedure] (keyword? X)
     335<procedure>(keyword? X)</procedure>
    336336
    337337Returns {{#t}} if {{X}} is a keyword symbol, or {{#f}}
     
    341341==== keyword->string
    342342
    343  [procedure] (keyword->string KEYWORD)
     343<procedure>(keyword->string KEYWORD)</procedure>
    344344
    345345Transforms {{KEYWORD}} into a string.
     
    348348==== string->keyword
    349349
    350  [procedure] (string->keyword STRING)
     350<procedure>(string->keyword STRING)</procedure>
    351351
    352352Returns a keyword with the name {{STRING}}.
     
    402402==== breakpoint
    403403
    404  [procedure] (breakpoint [NAME])
     404<procedure>(breakpoint [NAME])</procedure>
    405405
    406406Programmatically triggers a breakpoint (similar to the {{,br}} top-level csi
     
    494494==== argv
    495495
    496  [procedure] (argv)
     496<procedure>(argv)</procedure>
    497497
    498498Return a list of all supplied command-line arguments. The first item in
     
    505505==== exit
    506506
    507  [procedure] (exit [CODE])
     507<procedure>(exit [CODE])</procedure>
    508508
    509509Exit the running process and return exit-code, which defaults to 0
     
    514514==== build-platform
    515515
    516  [procedure] (build-platform)
     516<procedure>(build-platform)</procedure>
    517517
    518518Returns a symbol specifying the toolset which has been used for
     
    528528==== chicken-version
    529529
    530  [procedure] (chicken-version [FULL])
     530<procedure>(chicken-version [FULL])</procedure>
    531531
    532532Returns a string containing the version number of the CHICKEN runtime
     
    537537==== errno
    538538
    539  [procedure] (errno)
     539<procedure>(errno)</procedure>
    540540
    541541Returns the error code of the last system call.
     
    554554==== machine-byte-order
    555555
    556  [procedure] (machine-byte-order)
     556<procedure>(machine-byte-order)</procedure>
    557557
    558558Returns the symbol {{little-endian}} or {{big-endian}}, depending on the
     
    562562==== machine-type
    563563
    564  [procedure] (machine-type)
     564<procedure>(machine-type)</procedure>
    565565
    566566Returns a symbol specifying the processor on which this process is
     
    582582==== on-exit
    583583
    584  [procedure] (on-exit THUNK)
     584<procedure>(on-exit THUNK)</procedure>
    585585
    586586Schedules the zero-argument procedures {{THUNK}} to be executed before
     
    592592==== software-type
    593593
    594  [procedure] (software-type)
     594<procedure>(software-type)</procedure>
    595595
    596596Returns a symbol specifying the operating system on which this process
     
    606606==== software-version
    607607
    608  [procedure] (software-version)
     608<procedure>(software-version)</procedure>
    609609
    610610Returns a symbol specifying the operating system version on which this
     
    625625==== c-runtime
    626626
    627  [procedure] (c-runtime)
     627<procedure>(c-runtime)</procedure>
    628628
    629629Returns a symbol that designates what kind of C runtime library has been linked
     
    635635==== system
    636636
    637  [procedure] (system STRING)
     637<procedure>(system STRING)</procedure>
    638638
    639639Execute shell command. The functionality offered by this procedure
     
    643643
    644644
    645 
     645On a UNIX system, that value is the raw return value of waitpid(2), which contains signal, core dump and exit status.    It is 0 on success.  To pull out the signal number or exit status portably requires POSIX calls, but in a pinch you can use something like this:
     646
     647 ;; Returns two values: #t if the process exited normally or #f otherwise;
     648 ;; and either the exit status, or the signal number if terminated via signal.
     649 (define (process-status rc)
     650   (define (wait-signaled? x) (not (= 0 (bitwise-and x 127))))
     651   (define (wait-signal x) (bitwise-and x 127))
     652   (define (wait-exit-status x) (arithmetic-shift x -8))
     653   (if (wait-signaled? rc)
     654       (values #f (wait-signal rc))
     655       (values #t (wait-exit-status rc))))
     656
     657 #;> (process-status (system "exit 42"))
     658 #t
     659 42
    646660
    647661=== Execution time
     
    651665==== cpu-time
    652666
    653  [procedure] (cpu-time)
     667<procedure>(cpu-time)</procedure>
    654668
    655669Returns the used CPU time of the current process in milliseconds as
     
    661675==== current-milliseconds
    662676
    663  [procedure] (current-milliseconds)
     677<procedure>(current-milliseconds)</procedure>
    664678
    665679Returns the number of milliseconds since process- or machine startup.
     
    668682==== current-seconds
    669683
    670  [procedure] (current-seconds)
     684<procedure>(current-seconds)</procedure>
    671685
    672686Returns the number of seconds since midnight, Jan. 1, 1970.
     
    675689==== current-gc-milliseconds
    676690
    677  [procedure] (current-gc-milliseconds)
     691<procedure>(current-gc-milliseconds)</procedure>
    678692
    679693Returns the number of milliseconds spent in major garbage collections since
     
    689703==== enable-warnings
    690704
    691  [procedure] (enable-warnings [BOOL])
     705<procedure>(enable-warnings [BOOL])</procedure>
    692706
    693707Enables or disables warnings, depending on wether {{BOOL}} is true or false.
     
    700714==== error
    701715
    702  [procedure] (error [LOCATION] [STRING] EXP ...)
     716<procedure>(error [LOCATION] [STRING] EXP ...)</procedure>
    703717
    704718Prints error message, writes all extra arguments to the
     
    713727==== get-call-chain
    714728
    715  [procedure] (get-call-chain [START [THREAD]])
     729<procedure>(get-call-chain [START [THREAD]])</procedure>
    716730
    717731Returns a list with the call history. Backtrace information
     
    726740==== print-call-chain
    727741
    728  [procedure] (print-call-chain [PORT [START [THREAD]]])
     742<procedure>(print-call-chain [PORT [START [THREAD]]])</procedure>
    729743
    730744Prints a backtrace of the procedure call history to {{PORT}},
     
    734748==== print-error-message
    735749
    736  [procedure] (print-error-message EXN [PORT [STRING]])
     750<procedure>(print-error-message EXN [PORT [STRING]])</procedure>
    737751
    738752Prints an appropriate error message to {{PORT}} (which defaults to the
     
    746760==== procedure-information
    747761
    748  [procedure] (procedure-information PROC)
     762<procedure>(procedure-information PROC)</procedure>
    749763
    750764Returns an s-expression with debug information for the procedure {{PROC}}, or
     
    754768==== reset
    755769
    756  [procedure] (reset)
     770<procedure>(reset)</procedure>
    757771
    758772Reset program (Invokes {{reset-handler}}).
     
    761775==== warning
    762776
    763  [procedure] (warning STRING EXP ...)
     777<procedure>(warning STRING EXP ...)</procedure>
    764778
    765779Displays a warning message (if warnings are enabled with {{enable-warnings}}) and
     
    769783==== singlestep
    770784
    771  [procedure] (singlestep THUNK)
     785<procedure>(singlestep THUNK)</procedure>
    772786
    773787Executes the code in the zero-procedure {{THUNK}} in single-stepping mode.
     
    781795==== gc
    782796
    783  [procedure] (gc [FLAG])
     797<procedure>(gc [FLAG])</procedure>
    784798
    785799Invokes a garbage-collection and returns the number of free bytes in the heap.
     
    790804==== memory-statistics
    791805
    792  [procedure] (memory-statistics)
     806<procedure>(memory-statistics)</procedure>
    793807
    794808Performs a major garbage collection and returns a three element vector
     
    801815==== set-finalizer!
    802816
    803  [procedure] (set-finalizer! X PROC)
     817<procedure>(set-finalizer! X PROC)</procedure>
    804818
    805819Registers a procedure of one argument {{PROC}}, that will be
     
    815829==== set-gc-report!
    816830
    817  [procedure] (set-gc-report! FLAG)
     831<procedure>(set-gc-report! FLAG)</procedure>
    818832
    819833Print statistics after every GC, depending on {{FLAG}}. A value of
     
    832846==== promise?
    833847
    834  [procedure] (promise? X)
     848<procedure>(promise? X)</procedure>
    835849
    836850Returns {{#t}} if {{X}} is a promise returned by {{delay}}, or
     
    844858==== reverse-list->string
    845859
    846  [procedure] (reverse-list->string LIST)
     860<procedure>(reverse-list->string LIST)</procedure>
    847861
    848862Returns a string with the characters in {{LIST}} in reverse order. This is
     
    855869==== gensym
    856870
    857  [procedure] (gensym [STRING-OR-SYMBOL])
     871<procedure>(gensym [STRING-OR-SYMBOL])</procedure>
    858872
    859873Returns a newly created uninterned symbol. If an argument is provided,
     
    863877==== string->uninterned-symbol
    864878
    865  [procedure] (string->uninterned-symbol STRING)
     879<procedure>(string->uninterned-symbol STRING)</procedure>
    866880
    867881Returns a newly created, unique symbol with the name {{STRING}}.
     
    873887==== port?
    874888
    875  [procedure] (port? X)
     889<procedure>(port? X)</procedure>
    876890
    877891Returns {{#t}} if {{X}} is a port object or {{#f}}
     
    881895==== print
    882896
    883  [procedure] (print [EXP1 ...])
     897<procedure>(print [EXP1 ...])</procedure>
    884898
    885899Outputs the optional arguments {{EXP1 ...}} using {{display}} and
     
    890904==== print*
    891905
    892  [procedure] (print* [EXP1 ...])
     906<procedure>(print* [EXP1 ...])</procedure>
    893907
    894908Similar to {{print}}, but does not output a terminating newline
     
    902916==== char-name
    903917
    904  [procedure] (char-name SYMBOL-OR-CHAR [CHAR])
     918<procedure>(char-name SYMBOL-OR-CHAR [CHAR])</procedure>
    905919
    906920This procedure can be used to inquire about character names or to
     
    936950==== make-blob
    937951
    938  [procedure] (make-blob SIZE)
     952<procedure>(make-blob SIZE)</procedure>
    939953
    940954Returns a blob object of {{SIZE}} bytes, aligned on an 8-byte boundary,
     
    943957==== blob?
    944958
    945  [procedure] (blob? X)
     959<procedure>(blob? X)</procedure>
    946960
    947961Returns {{#t}} if {{X}} is a blob object, or
     
    950964==== blob-size
    951965
    952  [procedure] (blob-size BLOB)
     966<procedure>(blob-size BLOB)</procedure>
    953967
    954968Returns the number of bytes in {{BLOB}}.
     
    956970==== blob->string
    957971
    958  [procedure] (blob->string BLOB)
     972<procedure>(blob->string BLOB)</procedure>
    959973
    960974Returns a string with the contents of {{BLOB}}.
     
    962976==== string->blob
    963977
    964  [procedure] (string->blob STRING)
     978<procedure>(string->blob STRING)</procedure>
    965979
    966980Returns a blob with the contents of {{STRING}}.
     
    968982==== blob=?
    969983
    970  [procedure] (blob=? BLOB1 BLOB2)
     984<procedure>(blob=? BLOB1 BLOB2)</procedure>
    971985
    972986Returns {{#t}} if the two argument blobs are of the same
     
    979993==== vector-copy!
    980994
    981  [procedure] (vector-copy! VECTOR1 VECTOR2 [COUNT])
     995<procedure>(vector-copy! VECTOR1 VECTOR2 [COUNT])</procedure>
    982996
    983997Copies contents of {{VECTOR1}} into {{VECTOR2}}. If the
     
    9911005==== vector-resize
    9921006
    993  [procedure] (vector-resize VECTOR N [INIT])
     1007<procedure>(vector-resize VECTOR N [INIT])</procedure>
    9941008
    9951009Creates and returns a new vector with the contents of {{VECTOR}} and length
     
    10041018==== void
    10051019
    1006  [procedure] (void)
     1020<procedure>(void)</procedure>
    10071021
    10081022Returns an unspecified value.
     
    10141028==== call/cc
    10151029
    1016  [procedure] (call/cc PROCEDURE)
     1030<procedure>(call/cc PROCEDURE)</procedure>
    10171031
    10181032An alias for {{call-with-current-continuation}}.
     
    10211035==== continuation-capture
    10221036
    1023  [procedure] (continuation-capture PROCEDURE)
     1037<procedure>(continuation-capture PROCEDURE)</procedure>
    10241038
    10251039Creates a continuation object representing the current continuation and
     
    10331047==== continuation?
    10341048
    1035  [procedure] (continuation? X)
     1049<procedure>(continuation? X)</procedure>
    10361050
    10371051Returns {{#t}} if {{X}} is a continuation object, or {{#f}} otherwise. Please
     
    10441058==== continuation-graft
    10451059
    1046  [procedure] (continuation-graft CONT THUNK)
     1060<procedure>(continuation-graft CONT THUNK)</procedure>
    10471061
    10481062Calls the procedure {{THUNK}} with no arguments and the implicit continuation
     
    10521066==== continuation-return
    10531067
    1054  [procedure] (continuation-return CONT VALUE ...)
     1068<procedure>(continuation-return CONT VALUE ...)</procedure>
    10551069
    10561070Returns the value(s) to the continuation {{CONT}}. {{continuation-return}} could
     
    10731087==== setter
    10741088
    1075  [procedure] (setter PROCEDURE)
     1089<procedure>(setter PROCEDURE)</procedure>
    10761090
    10771091Returns the setter-procedure of {{PROCEDURE}}, or signals an error if
     
    10851099==== getter-with-setter
    10861100
    1087  [procedure] (getter-with-setter GETTER SETTER)
     1101<procedure>(getter-with-setter GETTER SETTER)</procedure>
    10881102
    10891103Returns a copy of the procedure {{GETTER}} with the associated setter procedure
     
    10971111==== define-reader-ctor
    10981112
    1099  [procedure] (define-reader-ctor SYMBOL PROC)
     1113<procedure>(define-reader-ctor SYMBOL PROC)</procedure>
    11001114
    11011115Define new read-time constructor for {{#,}} read syntax. For further information, see
     
    11051119==== set-read-syntax!
    11061120
    1107  [procedure] (set-read-syntax! CHAR-OR-SYMBOL PROC)
     1121<procedure>(set-read-syntax! CHAR-OR-SYMBOL PROC)</procedure>
    11081122
    11091123When the reader encounters the non-whitespace character {{CHAR}} while reading
     
    11421156==== set-sharp-read-syntax!
    11431157
    1144  [procedure] (set-sharp-read-syntax! CHAR-OR-SYMBOL PROC)
     1158<procedure>(set-sharp-read-syntax! CHAR-OR-SYMBOL PROC)</procedure>
    11451159
    11461160Similar to {{set-read-syntax!}}, but allows defining new {{#<CHAR> ...}} reader syntax.
     
    11501164==== set-parameterized-read-syntax!
    11511165
    1152  [procedure] (set-parameterized-read-syntax! CHAR-OR-SYMBOL PROC)
     1166<procedure>(set-parameterized-read-syntax! CHAR-OR-SYMBOL PROC)</procedure>
    11531167
    11541168Similar to {{set-sharp-read-syntax!}}, but intended for defining reader syntax of the
     
    11611175==== copy-read-table
    11621176
    1163  [procedure] (copy-read-table READ-TABLE)
     1177<procedure>(copy-read-table READ-TABLE)</procedure>
    11641178
    11651179Returns a copy of the given read-table. You can access the currently active read-table
Note: See TracChangeset for help on using the changeset viewer.