source: project/chicken/trunk/manual/Unit utils @ 15708

Last change on this file since 15708 was 15708, checked in by felix winkelmann, 10 years ago

deprecated for-each[-argv]-line; bumped version to 4.1.7

File size: 2.7 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4
5== Unit utils
6
7This unit contains a "grab bag" of procedures without a good home, and which
8don't have to be available by default (as compared to the [[Unit
9extras|extras]] unit).
10
11This unit uses the {{extras}} and {{srfi-13}} units.
12
13
14=== Executing shell commands with formatstring and error checking
15
16==== system*
17
18 [procedure] (system* FORMATSTRING ARGUMENT1 ...)
19
20Similar to {{(system (sprintf FORMATSTRING ARGUMENT1 ...))}},
21but signals an error if the invoked program should return a nonzero
22exit status.
23
24=== Reading a file's contents
25
26==== read-all
27
28 [procedure] (read-all [FILE-OR-PORT])
29
30If {{FILE-OR-PORT}} is a string, then this procedure returns the contents of the file
31as a string. If {{FILE-OR-PORT}} is a port, all remaining input is read and returned as
32a string. The port is not closed. If no argument is provided, input will be read from the
33port that is the current value of {{(current-input-port)}}.
34
35
36=== Shell argument quoting
37
38==== qs
39
40 [procedure] (qs STRING [PLATFORM])
41
42Escapes {{STRING}} suitably for passing to a shell command on {{PLATFORM}}.
43{{PLATFORM}} defaults to the value of {{(build-platform)}} and indicates in
44which style the argument should be quoted. On Windows systems, the string
45is simply enclosed in double-quote ({{"}}) characters, on UNIXish systems,
46characters that would have a special meaning to the shell are escaped
47using backslash ({{\}}).
48
49
50=== Dynamic compilation
51
52==== compile-file
53
54 [procedure] (compile-file FILENAME #!key options output-file load)
55
56Compiles the Scheme source file {{FILENAME}} into a dynamically
57loadable library by invoking the {{csc}} compiler driver. If the
58library can be successfully created and {{load}} is not given or
59true, the file is loaded into the current
60Scheme process. {{options}} may be a list of strings which are passed
61as additional command line options to {{csc}}. If {{output-file}} is
62not given, then the compiled file is stored in a temporary location
63and will be deleted when the process exits successfully.
64When compilation and loading succeeds, the name of the compiled file
65is returned.
66
67Notes:
68
69* loading the same compiled file multiple times is only supported on Linux
70  in the moment and should be considered unreliable. For this reason, a new temporary
71  file is created for every invocation of {{compile-file}}, unless an explicit
72  output file name is given.
73
74* this procedure is compatible to the {{scheme-compile-file}} command in {{emacs}}' {{scheme-mode}}.
75
76==== compile-file-options
77
78 [parameter] compile-file-options
79
80A parameter that holds a list of default options that should be given
81to {{csc}} after invocation of the {{compile-file}} procedure.
82The initial default options are {{-scrutinize -O2 -d2}}.
83
84
85---
86Previous: [[Unit posix]]
87
88Next: [[Unit tcp]]
Note: See TracBrowser for help on using the repository browser.