Changeset 39078 in project
- Timestamp:
- 10/29/20 11:07:49 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/srfi-193
r39077 r39078 18 18 19 19 Like the standard {{command-line}} procedure in R7RS and R6RS, this 20 gives the command line as list of strings. The first element (always20 returns the command line as list of strings. The first element (always 21 21 present) is the command name and the remaining elements (if any) are 22 command arguments. 22 command arguments. Neither the strings nor the list should be mutated. 23 23 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. 24 Unlike RnRS {{command-line}} this is a parameter that can be bound to 25 another value, e.g. for subcommand processing. If the parameter is 26 rebound to another list, the new list may share structure with the old 27 list. 27 28 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. 29 The initial command line is more precisely specified than the value of 30 RnRS {{command-line}}: 32 31 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. 37 36 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. 42 47 43 48 <procedure>(command-name)</procedure> … … 49 54 For example, {{/path/to/foo.scm}} is simplified into {{foo}}. 50 55 51 However, if {{(car (command-line))}} is a zero-length string (such as52 at the csi REPL), {{#f}}is returned to signify "not a command".56 However, if {{(car (command-line))}} is a zero-length string, {{#f}} 57 is returned to signify "not a command". 53 58 54 59 <procedure>(command-args)</procedure> … … 61 66 <parameter>(script-file [string?])</parameter> 62 67 63 If running a Scheme source file in csi, returns an absolute pathname 64 of that file as a string. Otherwise returns {{#f}}. 68 If 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 70 string. Otherwise returns {{#f}}. 65 71 66 72 In Chicken, this is actually a parameter object and may be set by the … … 70 76 71 77 Returns {{(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}}. 78 current binding of the {{script-file}} parameter. 74 79 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. 80 The string ends with a directory separator so {{string-append}} can be 81 used to build pathnames to refer to files in the same directory as the 82 script. 83 84 Returns {{#f}} in any situation where {{(script-file)}} returns 85 {{#f}}. 78 86 79 87 === Version History … … 81 89 * 0.1.3: Add Chicken 4 egg 82 90 * 0.1.2: Fix tests 83 * 0.1.1: Fix bug where pre-compiled .so gave incorrect results in csi91 * 0.1.1: Fix bug where pre-compiled .so gave incorrect results in {{csi}} 84 92 * 0.1: First release 85 93
Note: See TracChangeset
for help on using the changeset viewer.