Changeset 39078 in project


Ignore:
Timestamp:
10/29/20 11:07:49 (4 weeks ago)
Author:
lassik
Message:

Clarify and add details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/srfi-193

    r39077 r39078  
    1818
    1919Like the standard {{command-line}} procedure in R7RS and R6RS, this
    20 gives the command line as list of strings. The first element (always
     20returns the command line as list of strings. The first element (always
    2121present) is the command name and the remaining elements (if any) are
    22 command arguments.
     22command arguments. Neither the strings nor the list should be mutated.
    2323
    24 Unlike RnRS {{command-line}}, this is a parameter that can be bound to
    25 another value by the Scheme programmer if desired, for example for
    26 subcommand processing.
     24Unlike RnRS {{command-line}} this is a parameter that can be bound to
     25another value, e.g. for subcommand processing. If the parameter is
     26rebound to another list, the new list may share structure with the old
     27list.
    2728
    28 The value of this parameter should be a list of one or more strings at
    29 all times. Neither the strings nor the list should be mutated. If the
    30 parameter is rebound to another list, the new list is permitted to
    31 share structure with the old list.
     29The initial command line is more precisely specified than the value of
     30RnRS {{command-line}}:
    3231
    33 The default value of the parameter is more precisely specified than
    34 the value of RnRS {{command-line}}. When evaluating code in the csi
    35 REPL, the command line is a one-element list whose only element is a
    36 zero-length string.
     32* When running a standalone program compiled by csc, the first element
     33  is the operating system's {{argv[0]}} and the remaining elements are
     34  {{argv[1]}} and up. However, any {{-:}} arguments that give options
     35  for the Chicken runtime system are not part of the list.
    3736
    38 When running a standalone program compiled via csc, the first element
    39 is the operating system's {{argv[0]}} and the remaining elements are
    40 {{argv[1]}} and up. However, any {{-:}} arguments that give options
    41 for the Chicken runtime system are not part of the list.
     37* When running a script via {{csi -script file.scm a b c}} or {{csi -s
     38  file.scm a b c}} then {{command-line}} is bound to {{'("file.scm"
     39  "a" "b" "c")}}.
     40
     41* When not running a command, {{command-line}} is bound to {{'("")}}.
     42  This happens when:
     43
     44** Loading source files into the {{csi}} REPL via {{csi file.scm}}.
     45** Loading source files into the {{csi}} REPL via {{(load "file.scm")}}.
     46** Evaluating code in the {{csi}} REPL.
    4247
    4348<procedure>(command-name)</procedure>
     
    4954For example, {{/path/to/foo.scm}} is simplified into {{foo}}.
    5055
    51 However, if {{(car (command-line))}} is a zero-length string (such as
    52 at the csi REPL), {{#f}} is returned to signify "not a command".
     56However, if {{(car (command-line))}} is a zero-length string, {{#f}}
     57is returned to signify "not a command".
    5358
    5459<procedure>(command-args)</procedure>
     
    6166<parameter>(script-file [string?])</parameter>
    6267
    63 If running a Scheme source file in csi, returns an absolute pathname
    64 of that file as a string. Otherwise returns {{#f}}.
     68If running a source file as a script via {{csi -script file.scm}} or
     69{{csi -s file.scm}}, returns an absolute pathname of that file as a
     70string. Otherwise returns {{#f}}.
    6571
    6672In Chicken, this is actually a parameter object and may be set by the
     
    7076
    7177Returns {{(script-file)}} without the filename part, respecting the
    72 current binding of the {{script-file}} parameter. Returns {{#f}} in
    73 any situation where {{(script-file)}} returns {{#f}}.
     78current binding of the {{script-file}} parameter.
    7479
    75 Returned strings end with a directory separator so {{string-append}}
    76 can be used to build pathnames to refer to files in the same directory
    77 as the script.
     80The string ends with a directory separator so {{string-append}} can be
     81used to build pathnames to refer to files in the same directory as the
     82script.
     83
     84Returns {{#f}} in any situation where {{(script-file)}} returns
     85{{#f}}.
    7886
    7987=== Version History
     
    8189* 0.1.3: Add Chicken 4 egg
    8290* 0.1.2: Fix tests
    83 * 0.1.1: Fix bug where pre-compiled .so gave incorrect results in csi
     91* 0.1.1: Fix bug where pre-compiled .so gave incorrect results in {{csi}}
    8492* 0.1: First release
    8593
Note: See TracChangeset for help on using the changeset viewer.