source: project/release/3/misc-extn/tags/3.1/misc-extn.html @ 8075

Last change on this file since 8075 was 8075, checked in by Kon Lovett, 12 years ago

Rel 3.1, adds -directory stuff.

File size: 35.7 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<!-- Generated by eggdoc Revision: 1.20  -->
3<html>
4<head>
5<title>Eggs Unlimited - misc-extn</title><style type="text/css"> <!--
6      CODE {
7            color: #666666;
8          }
9/*   DT.definition EM { font-weight: bold; font-style: normal; } */
10
11     DT.definition { 
12                   background: #eee;
13                   color: black;
14                   padding: 0.2em 1em 0.2em 0.7em;
15                   margin-left: 0.2em;
16border: 1px solid #bbc;
17                   font-family: "Andale Mono", monospace;
18                   /* font-size: 1.2em; */
19                   
20                 }
21     DD {
22                   margin-top: 0.8em;
23                   margin-bottom: 0.8em;
24     }
25     DIV.subsection {
26                    border-top: 1px solid #448;
27                    padding-left: 1em;
28                    margin-bottom: 1.2em;
29     }
30     DIV.subsubsection {
31                    border-top: 1px dotted #99c;
32                    /* border-left: 1px solid #99c; */
33                    padding-left: 1em;
34                    margin-bottom: 1.2em;
35     }
36     DIV.subsubsubsection {
37                    border-top: 1px solid #ddf;
38                    padding-left: 1em;
39                    margin-bottom: 1.2em;
40     }
41
42         DIV.section {
43                 margin-bottom: 1.5em;
44         }
45         a:link {
46                 color: #336;
47         }
48         a:visited { color: #666; }
49         a:active  { color: #966; }
50         a:hover   { color: #669; }
51         body { margin: 0; padding: 0; background: #fff; color: #000; font: 9pt "Lucida Grande", "Verdana", sans-serif; }
52         H2 {
53                 background: #336;
54                 color: #fff;
55                 padding-top: 0.5em;
56                 padding-bottom: 0.5em;
57                 padding-left: 16px;
58                 margin: 0 0 1em 0;
59        }
60        UL LI {
61                list-style: none;
62        }
63        TT {
64                font-family: "Andale Mono", monospace;
65                /* font-size: 1.2em; */
66        }
67        H3 {
68                color: #113;
69                margin-bottom: 0.5em;
70        }
71        H4, H5, H6 {
72                color: #113;
73                margin-bottom: 1.0em;
74        }
75        H5 {
76                font-weight: normal;
77                font-style: italic;
78                font-size: 100%;
79                margin-top: 1.2em;
80        }
81        H6 {
82                font-weight: bold;
83                font-size: 85%;
84                margin-top: 1.2em;
85        }
86     DIV#eggheader {
87         text-align: center;
88                 float: right;
89                 margin-right: 2em;
90     }
91     DIV#header IMG {
92            /* display: block; margin-left: auto; margin-right: auto;  */
93            /* float: right; */
94            border: none;  /* firefox */
95     }
96     DIV#footer {
97                background: #bbd;
98                padding: 0.7em ;
99                border-top: 1px solid #cce;
100     }
101     DIV#footer hr {
102                display: none;
103     }
104     DIV#footer a {
105                float: left;
106     }
107     DIV#revision-history {
108         float: right;
109     }
110     
111     DIV#body {
112                 margin: 1em 1em 1em 16px;
113         }
114
115     DIV#examples PRE {
116       background: #eef;
117       padding: 0.1em;
118       border: 1px solid #aac;
119     }
120     PRE#license, DIV#examples PRE {
121       padding: 0.5em;
122     }
123     DIV#examples PRE {
124       /* font-size: 85%; */
125     }
126     PRE { font-family: "Andale Mono", monospace; }
127     TABLE {
128       background: #eef;
129       padding: 0.2em;
130       border: 1px solid #aac;
131       border-collapse: collapse;
132       width: 100%;
133     }
134     TABLE.symbol-table TD.symbol {
135          width: 15em;
136          font-family: "Andale Mono", monospace;
137          /* font-size: 1.2em; */
138     }
139     TH {
140       text-align: left;
141       border-bottom: 1px solid #aac;
142       padding: 0.25em 0.5em 0.25em 0.5em;
143     } 
144     TD { padding: 0.25em 0.5em 0.25em 0.5em; }
145     --></style></head>
146<body>
147<div id="header">
148<h2>misc-extn</h2>
149<div id="eggheader"><a href="index.html">
150<img src="egg.jpg" alt="[Picture of an egg]" /></a></div></div>
151<div id="body">
152<div class="section">
153<h3>Description</h3>
154<p>Provides miscellaneous useful stuff.</p></div>
155<div class="section">
156<h3>Author</h3><a href="mailto:klovett@pacbell.net">Kon Lovett</a></div>
157<div class="section">
158<h3>Download</h3><a href="misc-extn.egg">misc-extn.egg</a></div>
159<div class="section">
160<h3>Documentation</h3>
161<div class="subsection">
162<h4>Record Types</h4>
163<div class="section">
164<h3>Usage</h3>(require-extension misc-extn-record)</div>
165<dt class="definition"><strong>macro:</strong> (define-unchecked-record-type T CTOR PRED [SLOT ...])</dt>
166<dd>
167<p>SRFI-9 '(define-record-type T CTOR PRED [SLOT ...])', except no checks are made for correct record type before slot access, and the record type symbol is not defined.</p>
168<p>For use when slot access is attempted <i>only</i> after determining the correct record type explicitly. Do <i>not</i> make constructed slot access procedures part of a public API.</p></dd>
169<dt class="definition"><strong>macro:</strong> (define-inline-unchecked-record-type T CTOR PRED [SLOT ...])</dt>
170<dd>
171<p>SRFI-9 '(define-record-type T CTOR PRED [SLOT ...])', except no checks are made for correct record type before slot access, the record type symbol is not defined, and  procedures are inline.</p>
172<p>For use when slot access is attempted <i>only</i> after determining the correct record type explicitly.</p></dd></div>
173<div class="subsection">
174<h4>Control Forms</h4>
175<div class="section">
176<h3>Usage</h3>(require-extension misc-extn-control)</div>
177<dt class="definition"><strong>macro:</strong> (typecase EXPRESSION [(TYPE-TEST BODY ...) ...])</dt>
178<dd>
179<p>Expands into a <code>cond</code> form where every case test is a type test.</p>
180<p>A <tt>TYPE-TEST</tt> is either a symbol, which must be the base symbol of a type predicate, a non-null list, which must be a list of the base symbols of type predicates, or the symbol <code>else</code>. An example of a base symbol of a type predicate is <code>symbol</code> and the procedure <code>(symbol? OBJECT)</code> is used for the test.</p>
181<p>The <tt>BODY</tt> is not processed. It must be legal as the body of a <code>cond</code> case.</p></dd>
182<dt class="definition"><strong>macro:</strong> (typecase* EXPRESSION [(TYPE-TEST BODY ...) ...])</dt>
183<dd>
184<p>Like <code>typecase</code> but binds local variable <code>it</code> to the value of <tt>EXPRESSION</tt>.</p></dd>
185<dt class="definition"><strong>macro:</strong> (whennot TEST [BODY ...])</dt>
186<dd>
187<p>Synonym for <code>unless</code>.</p></dd>
188<dt class="definition"><strong>macro:</strong> (swap-set! VAR1 VAR2)</dt>
189<dd>
190<p>Swap settings of <tt>VAR1</tt> &amp; <tt>VAR2</tt>.</p></dd>
191<dt class="definition"><strong>macro:</strong> (fluid-set! VAR VAL ...)</dt>
192<dd>
193<p>Set each variable <tt>VAR</tt> to the value <tt>VAL</tt> in parallel.</p></dd>
194<dt class="definition"><strong>macro:</strong> (stiff-set! VAR VAL ...)</dt>
195<dd>
196<p>Set each variable <tt>VAR</tt> to the value <tt>VAL</tt> in series.</p></dd>
197<dt class="definition"><strong>macro:</strong> (hash-let (([VAR | (VAR KEY)] ...) HASH-TABLE) BODY ...)</dt>
198<dd>
199<p>Decompose <tt>HASH-TABLE</tt> entries into variable bindings. Should the <tt>KEY</tt> not be symbol, or the desired variable name <tt>VAR</tt> should not be the key, the '(VAR KEY)' form can be used. The <tt>BODY ...</tt> is evaluated with the specified bindings.</p></dd>
200<dt class="definition"><strong>macro:</strong> (set!/op VAR OP ARG ...)</dt>
201<dd>
202<p>Sets <tt>VAR</tt> to the value of <code>(OP ARG ...)</code>, where the first occurrence of <code>&lt;&gt;</code> in <tt>ARG ...</tt> is replaced with <tt>VAR</tt>.</p>
203<p>When there is no occurrence of <code>&lt;&gt;</code> in <tt>ARG ...</tt>the template <tt>(OP &lt;&gt; ARG ...)</tt> is used.</p></dd>
204<dt class="definition"><strong>procedure:</strong> (assure EXPRESSION [ERROR-ARGUMENT ...])</dt>
205<dd>
206<p>When <tt>EXPRESSION</tt> yields <code>#f</code> invoke <code>(error ERROR-ARGUMENT ...)</code>, otherwise return value.</p></dd>
207<dt class="definition"><strong>procedure:</strong> (identify-error [CALLER] MSG ARGS ...)</dt>
208<dd>
209<p>Prints a message like <tt>(error ...)</tt> to <tt>(current-error-port)</tt> but does not throw an exception.</p></dd>
210<dt class="definition"><strong>procedure:</strong> (errorf [ID] [FORMAT-STRING ARGS ...])</dt>
211<dd>
212<p>Same as '(error [ID] (sprintf FORMAT-STRING ARGS ...))'.</p>
213<p>The actual argument for the returned procedure is to be a procedure which will be applied with the evaluated expressions as the actual argument list.</p></dd></div>
214<div class="subsection">
215<h4>Lists</h4>
216<div class="section">
217<h3>Usage</h3>(require-extension misc-extn-list)</div>
218<p>The following macros are also availabe as procedures.</p>
219<dt class="definition"><strong>macro:</strong> (length=0? LIST)</dt>
220<dd>
221<p>List of length zero?</p></dd>
222<dt class="definition"><strong>macro:</strong> (length=1? LIST)</dt>
223<dd>
224<p>List of length one?</p></dd>
225<dt class="definition"><strong>macro:</strong> (length=2? LIST)</dt>
226<dd>
227<p>List of length two?</p></dd>
228<dt class="definition"><strong>macro:</strong> (length&gt;1? LIST)</dt>
229<dd>
230<p>List of length greater than one?</p></dd>
231<dt class="definition"><strong>macro:</strong> (shift!/set VARIABLE [WHEN-EMPTY])</dt>
232<dd>
233<p>Like <code>shift!</code> in the utils unit but assigns the <tt>VARIABLE</tt> <code>'()</code> after shifting from a list of length 1.</p>
234<p><tt>WHEN-EMPTY</tt>, which defaults to <code>#f</code> is returned when the list bound to <tt>VARIABLE</tt> is empty.</p></dd>
235<dt class="definition"><strong>macro:</strong> (ensure-list OBJECT)</dt>
236<dd>
237<p>Returns a list, either the list <tt>OBJECT</tt> or <code>(list OBJECT)</code>.</p></dd>
238<dt class="definition"><strong>macro:</strong> (not-null? LIST)</dt>
239<dd>
240<p>Returns <code>#f</code> if the given <tt>LIST</tt> is empty, and <tt>LIST</tt> otherwise.</p></dd></div>
241<div class="subsection">
242<h4>Association Lists</h4>
243<div class="section">
244<h3>Usage</h3>(require-extension misc-extn-list)</div>
245<dt class="definition"><strong>procedure:</strong> (alist-inverse-ref VALUE ALIST [TEST? [NOT-FOUND]])</dt>
246<dd>
247<p>Returns the first key associated with <tt>VALUE</tt> in the <tt>ALIST</tt> using the <tt>TEST?</tt> predicate, else <tt>NOT-FOUND</tt>.</p>
248<p><tt>TEST?</tt> is <code>eqv?</code> and <tt>NOT-FOUND</tt> is <code>#f</code>.</p></dd>
249<dt class="definition"><strong>procedure:</strong> (alist-delete/count KEY ALIST [TEST? [COUNT]])</dt>
250<dd>
251<p>Deletes the first (tt COUNT) associations from alist <tt>ALIST</tt>with the given key <tt>KEY</tt>, using key-comparison procedure <tt>TEST?</tt>. The dynamic order in which the various applications of equality are made is from the alist head to the tail.</p>
252<p>Returns a new alist. The alist is not disordered - elements that appear in the result alist occur in the same order as they occur in the argument alist.</p>
253<p>The equality procedure is used to compare the element keys, 'key[i: 0 &lt;= i &lt; (length ALIST)]', of the alist's entries to the key parameter in this way: '(TEST? KEY key[i])'.</p>
254<p><tt>COUNT</tt> defaults to essentially, infinity, and <tt>EQUALITY?</tt> defaults to <code>eqv?</code>.</p></dd>
255<dt class="definition"><strong>procedure:</strong> (alist-delete!/count KEY ALIST [TEST? [COUNT]])</dt>
256<dd>
257<p>Destructive version of <code>alist-delete/count</code>.</p></dd>
258<p><code>alist-delete-first</code> and <code>alist-delete-first!</code> are also available as procedures.</p>
259<dt class="definition"><strong>macro:</strong> (alist-delete-first KEY ALIST [TEST?])</dt>
260<dd>
261<p>Returns <code>(alist-delete/count KEY ALIST 1 [TEST?])</code>.</p></dd>
262<dt class="definition"><strong>macro:</strong> (alist-delete-first! KEY ALIST [TEST?])</dt>
263<dd>
264<p>Destructive version of <code>alist-delete-first</code>.</p></dd>
265<dt class="definition"><strong>procedure:</strong> (unzip-alist ALIST)</dt>
266<dd>
267<p>Returns 2 values, a list of the keys &amp; a list of the values from
268          the <tt>ALIST</tt>.</p></dd>
269<dt class="definition"><strong>procedure:</strong> (zip-alist KEYS VALUES)</dt>
270<dd>
271<p>Returns an association list with elements from the corresponding items of <tt>KEYS</tt> and <tt>VALUES</tt>.</p></dd>
272<p>Error signaling versions of the standard association lookup functions. When the <tt>KEY</tt> is not found and a <tt>NOT-FOUND</tt> value is not supplied an <code>error</code> is invoked.</p>
273<dt class="definition"><strong>macro:</strong> (assoc-def KEY ALIST [TEST] [NOT-FOUND])</dt>
274<dd>
275<p>The assoc procedure with an optional test and default value.</p></dd>
276<dt class="definition"><strong>macro:</strong> (assv-def KEY ALIST [NOT-FOUND])</dt>
277<dd>
278<p>The assv procedure with a default value.</p></dd>
279<dt class="definition"><strong>macro:</strong> (assq-def KEY ALIST [NOT-FOUND])</dt>
280<dd>
281<p>The assq procedure with a default value.</p></dd></div>
282<div class="subsection">
283<h4>DSSSL Extended Lambda List</h4>
284<div class="section">
285<h3>Usage</h3>(require-extension misc-extn-dsssl)</div>
286<dt class="definition"><strong>procedure:</strong> (fixup-extended-lambda-list-rest LIST-OF-KEYWORD REST-LIST)</dt>
287<dd>
288<p>Returns a list from <tt>REST-LIST</tt> with all key'ed pairs from <tt>LIST-OF-KEYWORD</tt> removed.</p></dd>
289<dt class="definition"><strong>procedure:</strong> (fixup-extended-lambda-list-optional LIST-OF-KEYWORD OPTIONAL ...)</dt>
290<dd>
291<p>Returns N+1 values from <tt>OPTIONAL ...</tt>, where N is the number of optionals, with all key'ed pairs from <tt>LIST-OF-KEYWORD</tt> removed. The first return value is the 'skip?' flag, the remaining are the &quot;fixed&quot; optional values.</p>
292<p><tt>OPTIONAL</tt> is a list of the form <code>(VALUE DEFAULT)</code>.</p>
293<p>The optionals run left-to-right, and the key/value pairs are assumed to bind left-to-right.</p></dd>
294<dt class="definition"><strong>procedure:</strong> (fixup-extended-lambda-list LIST-OF-KEYWORD REST-LIST [OPTIONAL ...])</dt>
295<dd>
296<p>Returns N+1 values where the 1st value is the &quot;fixed&quot; <tt>REST-LIST</tt> and the remaining values are the &quot;fixed&quot; <tt>OPTIONAL ...</tt>.</p></dd>
297<dt class="definition"><strong>macro:</strong> (dsssl-fixup LIST-OF-KEYWORD LIST-OF-OPTIONAL REST-VARIABLE BODY ...)</dt>
298<dd>
299<p>Expands the <tt>BODY ...</tt> in a new lexical scope with the optional and rest variables bound to the &quot;fixed&quot; values.</p>
300<p><tt>LIST-OF-OPTIONAL</tt> is a list of elements of the form <code>(VARIABLE DEFAULT)</code> where <tt>VARIABLE</tt> is the optional variable name and <tt>DEFAULT</tt> is the optional variable default value.</p></dd></div>
301<div class="subsection">
302<h4>Arithmetic</h4>
303<div class="section">
304<h3>Usage</h3>(require-extension misc-extn-numeric)</div>
305<dt class="definition"><strong>macro:</strong> (inc VAL)</dt>
306<dd>
307<p>Read-only increment.</p></dd>
308<dt class="definition"><strong>macro:</strong> (dec VAL)</dt>
309<dd>
310<p>Read-only decrement.</p></dd>
311<dt class="definition"><strong>macro:</strong> (++ VAL)</dt>
312<dd>
313<p>Read-only increment.</p></dd>
314<dt class="definition"><strong>macro:</strong> (-- VAL)</dt>
315<dd>
316<p>Read-only decrement.</p></dd>
317<dt class="definition"><strong>macro:</strong> (fx++ VAL)</dt>
318<dd>
319<p>Read-only fixnum increment.</p></dd>
320<dt class="definition"><strong>macro:</strong> (fx-- VAL)</dt>
321<dd>
322<p>Read-only fixnum decrement.</p></dd>
323<dt class="definition"><strong>macro:</strong> (fp++ VAL)</dt>
324<dd>
325<p>Read-only flonum increment.</p></dd>
326<dt class="definition"><strong>macro:</strong> (fp-- VAL)</dt>
327<dd>
328<p>Read-only flonum decrement.</p></dd>
329<dt class="definition"><strong>macro:</strong> (++! VAR)</dt>
330<dd>
331<p>Mutable increment.</p></dd>
332<dt class="definition"><strong>macro:</strong> (--! VAR)</dt>
333<dd>
334<p>Mutable decrement.</p></dd>
335<dt class="definition"><strong>macro:</strong> (fx++! VAR)</dt>
336<dd>
337<p>Mutable fixnum increment.</p></dd>
338<dt class="definition"><strong>macro:</strong> (fx--! VAR)</dt>
339<dd>
340<p>Mutable fixnum decrement.</p></dd>
341<dt class="definition"><strong>macro:</strong> (fp++! VAR)</dt>
342<dd>
343<p>Mutable flonum increment.</p></dd>
344<dt class="definition"><strong>macro:</strong> (fp--! VAR)</dt>
345<dd>
346<p>Mutable flonum decrement.</p></dd></div>
347<div class="subsection">
348<h4>Directories</h4>
349<dt class="definition"><strong>procedure:</strong> (push-directory DIRECTORY)</dt>
350<dd>
351<p>Push the current directory and change to the <tt>DIRECTORY</tt>.</p></dd>
352<dt class="definition"><strong>procedure:</strong> (pop-directory)</dt>
353<dd>
354<p>Pop the last directory and change to it.</p></dd>
355<dt class="definition"><strong>procedure:</strong> (pop-toplevel-directory)</dt>
356<dd>
357<p>Pop the earliest directory and change to it.</p></dd>
358<dt class="definition"><strong>procedure:</strong> (create-directory/parents DIRECTORY)</dt>
359<dd>
360<p>Ensures the directory pathname <tt>DIRECTORY</tt> exists.</p>
361<p>Like the UNIX `&quot;mkdir -p DIRECTORY&quot; command.</p></dd>
362<dt class="definition"><strong>procedure:</strong> (create-pathname-directory PATHNAME)</dt>
363<dd>
364<p>Ensures the directory component of <tt>PATHNAME</tt> exist.</p>
365<p>Like the UNIX `&quot;mkdir -p `dirname PATHNAME`&quot; command.</p></dd>
366<dt class="definition"><strong>procedure:</strong> (make-program-filename COMMAND)</dt>
367<dd>
368<p>Returns the platform specific form of an executable command filename.</p>
369<p>On Windows the <code>exe</code> extension is added unless an extension is already present. Does nothing on other platforms.</p></dd>
370<dt class="definition"><strong>procedure:</strong> (file-exists/directory? FILENAME [DIRECTORY | DIRECTORY-LIST])</dt>
371<dd>
372<p>Returns the pathname when <tt>FILENAME</tt> exists in the <tt>DIRECTORY</tt>, otherwise <code>#f</code>.</p>
373<p><tt>DIRECTORY-LIST</tt> is as for <code>make-pathname</code>.</p>
374<p>When only the <tt>FILENAME</tt> parameter supplied then the same as <code>file-exists?</code>.</p></dd>
375<dt class="definition"><strong>procedure:</strong> (find-file-pathnames FILENAME [DIRECTORY | DIRECTORY-LIST] ...)</dt>
376<dd>
377<p>Returns a list of all pathnames found for <tt>FILENAME</tt> in the supplied directory/directories, or <code>#f</code> when not found.</p>
378<p>The list of pathnames is in the same relative order as that of the directory parameter(s).</p></dd>
379<dt class="definition"><strong>procedure:</strong> (find-program-pathnames COMMAND-NAME [DIRECTORY | DIRECTORY-LIST] ...)</dt>
380<dd>
381<p>Returns a list of all pathnames found for <tt>COMMAND-NAME</tt> in the supplied directory/directories, or <code>#f</code> when not found.</p>
382<p>Uses <code>make-program-filename</code> to make a filename.</p>
383<p>Does not ensure that the file is executable!</p></dd>
384<dt class="definition"><strong>procedure:</strong> (which-command-pathname COMMAND-NAME [ENVIRONMENT-VARIABLE PATH])</dt>
385<dd>
386<p>Returns the first directory in the <tt>ENVIRONMENT-VARIABLE</tt> where a file named <tt>COMMAND-NAME</tt> exists, or <code>#f</code> when nothing found.</p>
387<p>Uses the platform specific PATH environment variable element separator - a semi-colon for Windows, &amp; a colon otherwise.</p>
388<p>Like the UNIX &quot;which COMMAND-NAME&quot; command.</p></dd>
389<dt class="definition"><strong>procedure:</strong> (remove-dotfiles FILES)</dt>
390<dd>
391<p>Remove dot files from a directory list. Useful with <code>glob</code>.</p></dd></div>
392<div class="subsection">
393<h4>Posix</h4>
394<div class="section">
395<h3>Usage</h3>(require-extension misc-extn-posix)</div>
396<div class="subsubsection">
397<h5>File Descriptors</h5>
398<dt class="definition"><strong>procedure:</strong> (replace-fileno NEW-FILENO KNOWN-FILENO)</dt>
399<dd>
400<p>Replaces the meaning of <tt>KNOWN-FILENO</tt> with <tt>NEW-FILENO</tt>. I/O Redirection.</p></dd></div>
401<div class="subsubsection">
402<h5>Scheduling Priority</h5>
403<p>Parameter Descriptions</p><table class="symbol-table">
404<tr>
405<td class="symbol">priority/process</td>
406<td>Process WHICH - WHO is 0 for current process or a process identifier.</td></tr>
407<tr>
408<td class="symbol">priority/process-group</td>
409<td>Process Group WHICH - WHO is 0 for current process group or a process group identifier.</td></tr>
410<tr>
411<td class="symbol">priority/user</td>
412<td>User WHICH - WHO is 0 for current user or a user identifier.</td></tr>
413<tr>
414<td class="symbol">PRIORITY</td>
415<td>An integer [-20 20].</td></tr></table>
416<br />
417<dt class="definition"><strong>procedure:</strong> (scheduling-priority WHICH WHO)</dt>
418<dd>
419<p>Returns the priority of <tt>WHO</tt> of kind <tt>WHICH</tt>.</p></dd>
420<dt class="definition"><strong>procedure:</strong> (set-scheduling-priority! WHICH WHO PRIORITY)</dt>
421<dd>
422<p>Sets the priority of <tt>WHO</tt> of kind <tt>WHICH</tt> to <tt>PRIORITY</tt>.</p></dd></div>
423<div class="subsubsection">
424<h5>Pseudo-TTY</h5>
425<p>Currently a thin wrapper around the C interface. Scheme bindings for the necessary C constants are not provided.</p>
426<dt class="definition"><strong>procedure:</strong> (alloc-winsize)</dt>
427<dd>
428<p>Returns the pointer to a new C struct winsize.</p></dd>
429<dt class="definition"><strong>procedure:</strong> (free-winsize (nonnull-pointer WINSIZE))</dt>
430<dd>
431<p>Releases a C struct winsize.</p></dd>
432<p>Accessors for a struct winsize</p><table class="symbol-table">
433<tr>
434<td class="symbol">winsize-col</td>
435<td>Returns ws_col</td></tr>
436<tr>
437<td class="symbol">winsize-col-set!</td>
438<td>Sets ws_col</td></tr>
439<tr>
440<td class="symbol">winsize-row</td>
441<td>Returns ws_row</td></tr>
442<tr>
443<td class="symbol">winsize-row-set!</td>
444<td>Sets ws_row</td></tr>
445<tr>
446<td class="symbol">winsize-xpixel</td>
447<td>Returns ws_xpixel</td></tr>
448<tr>
449<td class="symbol">winsize-xpixel-set!</td>
450<td>Sets ws_xpixel</td></tr>
451<tr>
452<td class="symbol">winsize-ypixel</td>
453<td>Returns ws_ypixel</td></tr>
454<tr>
455<td class="symbol">winsize-ypixel-set!</td>
456<td>Sets ws_ypixel</td></tr></table>
457<br />
458<dt class="definition"><strong>procedure:</strong> (alloc-termios)</dt>
459<dd>
460<p>Returns the pointer to a new C struct termios.</p></dd>
461<dt class="definition"><strong>procedure:</strong> (free-termios (nonnull-pointer TERMIOS))</dt>
462<dd>
463<p>Releases a C struct termios.</p></dd>
464<p>Accessors for a struct termios</p><table class="symbol-table">
465<tr>
466<td class="symbol">termios-cc</td>
467<td>Returns c_cc[idx]</td></tr>
468<tr>
469<td class="symbol">termios-cc-set!</td>
470<td>Sets c_cc[idx]</td></tr>
471<tr>
472<td class="symbol">termios-cflag</td>
473<td>Returns c_cflag</td></tr>
474<tr>
475<td class="symbol">termios-cflag-set!</td>
476<td>Sets c_cflag</td></tr>
477<tr>
478<td class="symbol">termios-iflag</td>
479<td>Returns c_iflag</td></tr>
480<tr>
481<td class="symbol">termios-iflag-set!</td>
482<td>Sets c_iflag</td></tr>
483<tr>
484<td class="symbol">termios-lflag</td>
485<td>Returns c_lflag</td></tr>
486<tr>
487<td class="symbol">termios-lflag-set!</td>
488<td>Sets c_lflag</td></tr>
489<tr>
490<td class="symbol">termios-oflag</td>
491<td>Returns c_oflag</td></tr>
492<tr>
493<td class="symbol">termios-oflag-set!</td>
494<td>Sets c_oflag</td></tr>
495<tr>
496<td class="symbol">termios-ispeed</td>
497<td>Returns c_ispeed</td></tr>
498<tr>
499<td class="symbol">termios-ispeed-set!</td>
500<td>Sets c_ispeed</td></tr>
501<tr>
502<td class="symbol">termios-ospeed</td>
503<td>Returns c_ospeed</td></tr>
504<tr>
505<td class="symbol">termios-ospeed-set!</td>
506<td>Sets c_ospeed</td></tr></table>
507<br />
508<dt class="definition"><strong>procedure:</strong> (login-tty SLAVE-FILENO)</dt>
509<dd>
510<p>The C procedure.</p></dd>
511<dt class="definition"><strong>procedure:</strong> (open-pty (nonnull-pointer MASTER-FILENO) (nonnull-pointer SLAVE-FILENO) (c-string NAME) (pointer WINSIZE) (pointer TERMIOS))</dt>
512<dd>
513<p>The C procedure.</p></dd></div></div>
514<div class="subsection">
515<h4>Symbol</h4>
516<div class="section">
517<h3>Usage</h3>(require-extension misc-extn-symbol)</div>
518<dt class="definition"><strong>macro:</strong> (unbound-value)</dt>
519<dd>
520<p>Returns the value representing &quot;unbound&quot;.</p></dd>
521<dt class="definition"><strong>macro:</strong> (unbound-value? OBJECT)</dt>
522<dd>
523<p>Is the <tt>OBJECT</tt> the unbound value?</p></dd>
524<dt class="definition"><strong>macro:</strong> (unbound? SYMBOL)</dt>
525<dd>
526<p>Is the <tt>SYMBOL</tt> unbound?</p>
527<p><tt>SYMBOL</tt> is <b>not</b> treated as a literal, be sure to quote if a literal desired.</p></dd>
528<dt class="definition"><strong>macro:</strong> (symbol-value SYMBOL [NOT-FOUND #f])</dt>
529<dd>
530<p>Returns the <tt>SYMBOL</tt> binding when bound, otherwise the <tt>NOT-FOUND</tt>.</p>
531<p><tt>SYMBOL</tt> is <b>not</b> treated as a literal, be sure to quote if a literal desired.</p></dd>
532<dt class="definition"><strong>macro:</strong> (undefined-value)</dt>
533<dd>
534<p>Returns the value representing &quot;undefined&quot;.</p></dd>
535<dt class="definition"><strong>macro:</strong> (undefined-value? OBJECT)</dt>
536<dd>
537<p>Is the <tt>OBJECT</tt> the undefined value?</p></dd>
538<dt class="definition"><strong>macro:</strong> (undefined? OBJECT)</dt>
539<dd>
540<p>Is the <tt>OBJECT</tt> the undefined value?</p></dd>
541<dt class="definition"><strong>procedure:</strong> (make-qualified-symbol NAMESPACE SYMBOL)</dt>
542<dd>
543<p>Returns the Chicken namespace qualified <tt>SYMBOL</tt> for the <tt>NAMESPACE</tt>.</p>
544<p>An exception is generated when the <tt>NAMESPACE</tt> length exceeds the system limit.</p></dd>
545<dt class="definition"><strong>procedure:</strong> (make-qualified-uninterned-symbol NAMESPACE SYMBOL)</dt>
546<dd>
547<p>Returns the Chicken namespace qualified <tt>SYMBOL</tt> for the <tt>NAMESPACE</tt>.</p></dd>
548<dt class="definition"><strong>procedure:</strong> (qualified-symbol? SYMBOL)</dt>
549<dd>
550<p>Is the <tt>SYMBOL</tt> a Chicken namespace qualified symbol.</p></dd>
551<dt class="definition"><strong>procedure:</strong> (symbol-&gt;qualified-string SYMBOL)</dt>
552<dd>
553<p>Returns the printname of a Chicken namespace qualified <tt>SYMBOL</tt>.</p></dd>
554<dt class="definition"><strong>procedure:</strong> (interned-symbol? SYMBOL)</dt>
555<dd>
556<p>Is the <tt>SYMBOL</tt> interned?</p></dd></div>
557<div class="subsection">
558<h4>Conditions</h4>
559<div class="section">
560<h3>Usage</h3>(require-extension misc-extn-condition)</div>
561<p>The build condition API macros are currently <b>unavailable</b> when using <b>hygienic</b> macros.</p>
562<dt class="definition"><strong>macro:</strong> (build-condition-naming-api FORM ...)</dt>
563<dd>
564<p>Expands into one or more macros that expand into a condition specification form, suitable for use with <code>build-property-condition-api</code> and <code>build-composite-condition-api</code>.</p>
565<p>Example: <code>(build-condition-naming (exn location message arguments) foo (bar rope))</code></p>
566<p>Creates the following:</p>
567<ul>
568<li><code>(define-macro (exn-condition) '(exn location message arguments))</code></li>
569<li><code>(define-macro (foo-condition) 'foo)</code></li>
570<li><code>(define-macro (bar-condition) '(bar rope))</code></li></ul></dd>
571<dt class="definition"><strong>macro:</strong> (build-property-condition-api FORM ...)</dt>
572<dd>
573<p>Expands into a suite of procedures to construct and test SRFI-12 property condition objects.</p>
574<p>When only one <tt>FORM</tt> is supplied a single property condition API is built. When more than one <tt>FORM</tt> are supplied then all the property condition APIs are built.</p>
575<p>When <tt>FORM</tt> is a symbol it is a condition <tt>KIND-KEY</tt> and identifies a condition without properties. When <tt>FORM</tt> is a list the first element is the condition <tt>KIND-KEY</tt> and the following elements are property keys.</p>
576<p>A condition constructor is named as <tt>make-KIND-KEY-condition</tt> and has 0 or more formal parameters, which are the property keys.</p>
577<p>A condition predicate is named as <tt>KIND-KEY-condition?</tt> and has 1 formal parameter, the object to test.</p>
578<p>Property condition constructors without properties always return the same condition object!</p>
579<p>Example: <code>(build-property-condition-api (exn location message arguments) foo (bar rope))</code></p>
580<p>Creates the following:</p>
581<ul>
582<li><code>(make-exn-condition location message arguments)</code></li>
583<li><code>(exn-condition? object)</code></li>
584<li><code>(make-foo-condition)</code></li>
585<li><code>(foo-condition? object)</code></li>
586<li><code>(make-bar-condition rope)</code></li>
587<li><code>(bar-condition? object)</code></li></ul></dd>
588<dt class="definition"><strong>macro:</strong> (build-composite-condition-api FORM ...)</dt>
589<dd>
590<p>Expands into a suite of procedures to construct and test SRFI-12 a composite condition object.</p>
591<p><tt>FORM</tt> is the same as <tt>FORM</tt> in the <code>build-property-condition-api</code> definition.</p>
592<p>When zero or one <tt>FORM</tt> are supplied nothing is built. When more than one <tt>FORM</tt> are supplied then a composite API is built.</p>
593<p>A composite condition constructor is like a property condition constructor, except that the <tt>KIND-KEY</tt> is a concatenation of every condition <tt>KEY</tt>, interspersed with a hyphen.</p>
594<p>A composite condition predicate is like a property condition predicate, except that the <tt>KIND-KEY</tt> is a concatenation of every condition <tt>KEY</tt>, interspersed with a hyphen.</p>
595<p>Example: <code>(build-composite-condition-api (exn location message arguments) foo (bar rope))</code></p>
596<p>Creates the following:</p>
597<ul>
598<li><code>(make-exn-foo-bar-condition location message arguments rope)</code></li>
599<li><code>(exn-foo-bar-condition? object)</code></li></ul></dd>
600<dt class="definition"><strong>procedure:</strong> (handle-condition THUNK [HANDLER identity])</dt>
601<dd>
602<p>Simplified <code>with-exception-handler</code> where the <tt>HANDLER</tt> result is always returned to the caller.</p>
603<p><tt>HANDLER</tt> is (-&gt; condition object).</p></dd>
604<dt class="definition"><strong>procedure:</strong> (composite-condition? OBJECT [KIND-KEY ...])</dt>
605<dd>
606<p>Is the <tt>OBJECT</tt> a SRFI-12 composite condition?</p>
607<p>When one or more <tt>KIND-KEY</tt> are supplied then the composite condition must compose at least those kind keys.</p></dd>
608<dt class="definition"><strong>procedure:</strong> (condition-kind-keys CONDITION)</dt>
609<dd>
610<p>Returns a list of the kind-keys of the SRFI-12 <tt>CONDITION</tt>.</p></dd>
611<dt class="definition"><strong>procedure:</strong> (condition-property-keys CONDITION [KIND-KEY])</dt>
612<dd>
613<p>Returns a list of the property-keys for <tt>KIND-KEY</tt> of the SRFI-12 <tt>CONDITION</tt>, or <code>#f</code> when no property keys or the <tt>CONDITION</tt> is not of the kind <tt>KIND-KEY</tt>.</p>
614<p>When <tt>KIND-KEY</tt> is missing some kind-key of the <tt>CONDITION</tt> is used.</p></dd>
615<dt class="definition"><strong>procedure:</strong> (condition-properties CONDITION [KIND-KEY])</dt>
616<dd>
617<p>Returns an association list of the property keys &amp; values for <tt>KIND-KEY</tt> of the SRFI-12 <tt>CONDITION</tt>, or <code>#f</code> when no property keys or the <tt>CONDITION</tt> is not of the kind <tt>KIND-KEY</tt>.</p>
618<p>When <tt>KIND-KEY</tt> is missing some kind-key of the <tt>CONDITION</tt> is used.</p></dd>
619<dt class="definition"><strong>procedure:</strong> (condition-explode CONDITION)</dt>
620<dd>
621<p>Returns an association list of every kind-key of the SRFI-12 <tt>CONDITION</tt>. The value of each entry is the result of <code>(condition-properties CONDITION KIND-KEY</code> for that <tt>KIND-KEY</tt>.</p></dd>
622<dt class="definition"><strong>procedure:</strong> (make-property-condition/list KIND-LIST PROPERTY-LIST)</dt>
623<dd>
624<p>Returns a new condition.</p>
625<p><tt>KIND-LIST</tt> is a list of kind-key.</p>
626<p><tt>PROPERTY-LIST</tt> is a property list, where the key element is a pair, (&lt;kind-key&gt; . &lt;property-key&gt;).</p></dd></div>
627<div class="subsection">
628<h4>Input/Output</h4>
629<div class="section">
630<h3>Usage</h3>(require-extension misc-extn-io)</div>
631<dt class="definition"><strong>procedure:</strong> (cout EXPR ...)</dt>
632<dd>
633<p>Like cout &lt;&lt; arguments &lt;&lt; args where argument can be any Scheme object. If it's a procedure (without args) it's executed rather than printed (like newline).</p></dd>
634<dt class="definition"><strong>procedure:</strong> (cerr EXPR ...)</dt>
635<dd>
636<p>Like cerr &lt;&lt; arguments &lt;&lt; args where argument can be any Scheme object. If it's a procedure (without args) it's executed rather than printed (like newline).</p></dd>
637<dt class="definition"><strong>constant:</strong> nl</dt>
638<dd>
639<p>String form of the newline character.</p></dd></div></div>
640<div class="section">
641<h3>Contributions</h3>
642<p>William Annis - hash-let.</p>
643<p>Oleg Kiselyov's Standard Scheme &quot;Prelude&quot; - ++, ...</p></div>
644<div class="section">
645<h3>Examples</h3>
646<div id="examples">
647<pre>(use misc-extn-control misc-extn-dsssl)
648
649(hash-let ([name (foo &quot;wow&quot;)] some-hashtable)
650  (print name &quot; &quot; foo #\newline))
651
652(stiff-set! x 1 y 2)  ; x = 1 y = 2
653(fluid-set! x y y x)  ; x = 2 y = 1
654(swap-set! x y)       ; x = 1 y = 2
655
656; Silly example
657(typecase* (foo bar)
658  [(procedure macro) #f]
659  [symbol #t]
660  [(vector list) #f]
661  [else
662    (error &quot;not what I want&quot; it)])
663
664;
665(define (a1 a2 #!optional o1 o2 #!rest rest #!key k1 k2)
666  (dsssl-fixup '(#:k1 #:k2) ((o1 'x) (o2 'y)) rest
667    (list o1 o2 rest) ) )
668; expands into something similar to
669#;
670(define (a1 a2 #!optional o1 o2 #!rest rest #!key k1 k2)
671  (let-values ([(rest o1 o2)
672                (fixup-extended-lambda-list '(#:k1 #:k2) rest (list o1 'x) (list o2 'y))])
673    (list o1 o2 rest) ) )</pre></div></div>
674<div class="section">
675<h3>Version</h3>
676<ul>
677<li>3.004 Added misc-extn-directory; moved file-exists/directory, find-file-pathnames, find-program-pathnames, whch-command-pathname, remove-dotfiles from misc-extn-posix.</li>
678<li>3.003 Added list macros. Deprecated alist-delete*, filter-rest-argument!. Added misc-extn-dsssl.</li>
679<li>3.002 Reverted to 3.0 behavior for unbound Wasn't a bug.</li>
680<li>3.001 Bugfix for unbound</li>
681<li>3.0 Split into macro/procedure files, file renames. Incompatible!</li>
682<li>2.9.3 Added priority, termios, and winsize for Solaris. Patch for pty header file on BSD. [From Peter Bex]</li>
683<li>2.9.2 Deprecated chain-implicit-exit-handler - use library unit 'on-exit'. Replace which-command-directory with which-command-pathname. Removed make-program-pathname. Added ensure-list, file-exists/directory?, find-file-pathnames, find-program-pathnames</li>
684<li>2.9.1 Added create-directory/parents, make-program-filename, make-program-pathname. Removed pseudo-tty for Solaris.</li>
685<li>2.9 Added 'typecase' macro, pseudo-tty procedures.</li>
686<li>2.8 Removed 'define-structure'. Added srfi-12 api macros.</li>
687<li>2.7 Split -procs into -list, -sym, -control, -io, with -procs an umbrella. Added -srfi-12.</li>
688<li>2.62 Added which-command-directory.</li>
689<li>2.61 Added set!/op, removed set-op!, fix for shift!/set, errorf.</li>
690<li>2.6 Added priority routines to posix extension.</li>
691<li>2.5 Removed defined-symbol? &amp; make-log-function, added alist-delete*, shift!/set, unzip-alist</li>
692<li>2.4 Bug fix for defined-symbol?</li>
693<li>2.3 Added undefined &amp; unbound stuff</li>
694<li>2.2 Added 'chain-implicit-exit-handler'</li>
695<li>2.1 Added 'whennot', 'inc', 'dec','create-pathname-directory'</li>
696<li>2.0 Added 'define-inline-unchecked-record-type'</li>
697<li>1.9 Rename ++f* -&gt; f*++, remove mu &amp; nu; me stupid</li>
698<li>1.8 Moved procedures to own extension</li>
699<li>1.7 Exports, additions</li>
700<li>1.6 More stuff, rename fp++, etc -&gt; ++fp</li>
701<li>1.5 Added alist-delete-first</li>
702<li>1.4 Added mu, nu, moved looping constructs to miscmacros</li>
703<li>1.3 Removed use of define-syntax</li>
704<li>1.2 Added assure, nl, rename set*! to stiff-set!, fp++, etc.</li>
705<li>1.1 Added plain repeat, assoc macros signal errors</li>
706<li>1.0 Initial release</li></ul></div>
707<div class="section">
708<h3>License</h3>
709<pre>&quot;Copyright (c) 2006-2007, Kon Lovett.  All rights reserved.
710
711Permission is hereby granted, free of charge, to any person obtaining a
712copy of this software and associated documentation files (the Software),
713to deal in the Software without restriction, including without limitation
714the rights to use, copy, modify, merge, publish, distribute, sublicense,
715and/or sell copies of the Software, and to permit persons to whom the
716Software is furnished to do so, subject to the following conditions:
717
718The above copyright notice and this permission notice shall be included
719in all copies or substantial portions of the Software.
720
721THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
722IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
723FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
724THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
725OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
726ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
727OTHER DEALINGS IN THE SOFTWARE.</pre></div></div>
728<div id="footer">
729<hr /><a href="index.html">&lt; Egg index</a>
730<div id="revision-history">$Revision$ $Date$</div>&nbsp;</div></body></html>
Note: See TracBrowser for help on using the repository browser.