File: mzscheme-Z-H-15.html

package info (click to toggle)
drscheme 1%3A352-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 71,608 kB
  • ctags: 55,284
  • sloc: ansic: 278,966; cpp: 63,318; sh: 32,265; lisp: 14,530; asm: 7,327; makefile: 4,846; pascal: 4,363; perl: 2,920; java: 1,632; yacc: 755; lex: 258; sed: 93; xml: 12
file content (558 lines) | stat: -rw-r--r-- 36,901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--

Generated from mzscheme.tex by tex2page, v 20050501
(running on MzScheme 352, unix), 
(c) Dorai Sitaram, 
http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html

-->
<head>
<title>
PLT MzScheme: Language Manual
</title>
<link rel="stylesheet" type="text/css" href="mzscheme-Z-S.css" title=default>
<meta name=robots content="noindex,follow">
</head>
<body>
<div id=content>
<div align=right class=navigation><i>[Go to <span><a href="mzscheme.html">first</a>, <a href="mzscheme-Z-H-14.html">previous</a></span><span>, <a href="mzscheme-Z-H-16.html">next</a></span> page<span>; &nbsp;&nbsp;</span><span><a href="mzscheme.html#node_toc_start">contents</a></span><span><span>; &nbsp;&nbsp;</span><a href="mzscheme-Z-H-22.html#node_index_start">index</a></span>]</i></div>
<p></p>
<a name="node_chap_15"></a>
<h1 class=chapter>
<div class=chapterheading><a href="mzscheme.html#node_toc_node_chap_15">Chapter 15</a></div><br>
<a href="mzscheme.html#node_toc_node_chap_15">System Utilities</a></h1>
<p><a name="node_idx_3292"></a></p>
<p>
</p>
<a name="node_sec_15.1"></a>
<h2><a href="mzscheme.html#node_toc_node_sec_15.1">15.1&nbsp;&nbsp;Time</a></h2>
<p><a name="node_idx_3294"></a></p>
<p>
<a name="node_idx_3296"></a></p>
<p>
</p>
<a name="node_sec_15.1.1"></a>
<h3><a href="mzscheme.html#node_toc_node_sec_15.1.1">15.1.1&nbsp;&nbsp;Real Time and Date</a></h3>
<p><a name="node_idx_3298"></a>
<a name="node_idx_3300"></a><a name="node_kw_definitioncurrent-seconds"></a><code class=scheme>(current-seconds</code><code class=scheme>)</code> returns the current time in seconds. This time
is always an exact integer based on a platform-specific starting date
(with a platform-specific minimum and maximum value).</p>
<p>
The value of <code class=scheme>(<code class=scheme>current-seconds</code>)</code> increases as time passes
(increasing by 1 for each second that passes). The current time in
seconds can be compared with a time returned by
<code class=scheme><code class=scheme>file-or-directory-modify-seconds</code></code> (see section&nbsp;<a href="mzscheme-Z-H-11.html#node_sec_11.3.3">11.3.3</a>).</p>
<p>
<a name="node_idx_3302"></a><a name="node_kw_definitionseconds->date"></a><code class=scheme>(seconds-&gt;date</code><tt>&nbsp;</tt><code class=scheme><span class=variable>secs-n</span></code><code class=scheme>)</code> takes <code class=scheme><span class=variable>secs-n</span></code>, a platform-specific
time in seconds (an exact integer) returned by
<a name="node_idx_3304"></a><code class=scheme>current-seconds</code> or
<a name="node_idx_3306"></a><code class=scheme>file-or-directory-modify-seconds</code>, and returns an instance
of the <code class=scheme>date</code> structure type, as described below.  If
<code class=scheme><span class=variable>secs-n</span></code> is too small or large, the <a name="node_idx_3308"></a><code class=scheme>exn:fail</code> exception is raised.</p>
<p>
The value returned by <a name="node_idx_3310"></a><code class=scheme>current-seconds</code> or
<a name="node_idx_3312"></a><code class=scheme>file-or-directory-modify-seconds</code> is not portable among
platforms. Convert a time in seconds using <code class=scheme><code class=scheme>seconds-&gt;date</code></code> when
portability is needed.</p>
<p>
The <a name="node_kw_definitiondate"></a><a name="node_idx_3314"></a><code class=scheme><span class=keyword>date</span></code> <a name="node_idx_3316"></a> <a name="node_idx_3318"></a> <a name="node_idx_3320"></a>
structure type has the following fields:
</p>
<ul><li><p><a name="node_idx_3322"></a> <a name="node_idx_3324"></a> <code class=scheme>second</code> : <code class=scheme><span class=selfeval>0</span></code> to <code class=scheme><span class=selfeval>61</span></code> (<code class=scheme><span class=selfeval>60</span></code> and <code class=scheme><span class=selfeval>61</span></code> are for unusual leap-seconds)
</p>
<li><p><a name="node_idx_3326"></a> <a name="node_idx_3328"></a> <code class=scheme>minute</code> : <code class=scheme><span class=selfeval>0</span></code> to <code class=scheme><span class=selfeval>59</span></code>
</p>
<li><p><a name="node_idx_3330"></a> <a name="node_idx_3332"></a> <code class=scheme>hour</code> : <code class=scheme><span class=selfeval>0</span></code> to <code class=scheme><span class=selfeval>23</span></code>
</p>
<li><p><a name="node_idx_3334"></a> <a name="node_idx_3336"></a> <code class=scheme>day</code> : <code class=scheme><span class=selfeval>1</span></code> to <code class=scheme><span class=selfeval>31</span></code>
</p>
<li><p><a name="node_idx_3338"></a> <a name="node_idx_3340"></a> <code class=scheme>month</code> : <code class=scheme><span class=selfeval>1</span></code> to <code class=scheme><span class=selfeval>12</span></code>
</p>
<li><p><a name="node_idx_3342"></a> <a name="node_idx_3344"></a> <code class=scheme>year</code> : e.g., <code class=scheme><span class=selfeval>1996</span></code>
</p>
<li><p><a name="node_idx_3346"></a> <a name="node_idx_3348"></a> <code class=scheme>week-day</code> : <code class=scheme><span class=selfeval>0</span></code> (Sunday) to <code class=scheme><span class=selfeval>6</span></code> (Saturday)
</p>
<li><p><a name="node_idx_3350"></a> <a name="node_idx_3352"></a> <code class=scheme>year-day</code> : <code class=scheme><span class=selfeval>0</span></code> to <code class=scheme><span class=selfeval>365</span></code> (<code class=scheme><span class=selfeval>364</span></code> in non-leap years)
</p>
<li><p><a name="node_idx_3354"></a> <a name="node_idx_3356"></a> <code class=scheme>dst?</code> : <code class=scheme><span class=selfeval>#t</span></code> (daylight savings time) or <code class=scheme><span class=selfeval>#f</span></code>
</p>
<li><p><a name="node_idx_3358"></a> <a name="node_idx_3360"></a> <code class=scheme>time-zone-offset</code> : the number of seconds east of
GMT for this time zone (e.g., Pacific Standard Time
is <code class=scheme><span class=selfeval>-28800</span></code>), an exact integer
<a name="node_call_footnote_52"></a><a href="#node_footnote_52"><sup><small>52</small></sup></a></p>
<p>
</p>
</ul><p>
The <code class=scheme>date</code> structure type is transparent to all inspectors (see
section&nbsp;<a href="mzscheme-Z-H-4.html#node_sec_4.5">4.5</a>).</p>
<p>
See also Chapter&nbsp;<a href="../mzlib/mzlib-Z-H-13.html#node_chap_13">13</a>
in <a href="../mzlib/mzlib.html"><i>PLT MzLib: Libraries Manual</i></a> for additional date utilities.</p>
<p>
</p>
<a name="node_sec_15.1.2"></a>
<h3><a href="mzscheme.html#node_toc_node_sec_15.1.2">15.1.2&nbsp;&nbsp;Machine Time</a></h3>
<p></p>
<p>
<a name="node_idx_3362"></a></p>
<p>
<a name="node_idx_3364"></a><a name="node_kw_definitioncurrent-milliseconds"></a><code class=scheme>(current-milliseconds</code><code class=scheme>)</code> returns the current ``time'' in fixnum
milliseconds (possibly negative). This time is based on a
platform-specific starting date or on the machine's startup
time. Since the result is a fixnum, the value increases only over a
limited (though reasonably long) time.</p>
<p>
<a name="node_idx_3366"></a><a name="node_kw_definitioncurrent-inexact-milliseconds"></a><code class=scheme>(current-inexact-milliseconds</code><code class=scheme>)</code> returns the current ``time'' in
positive milliseconds, not necessarily an integer. This time is based
on a platform-specific starting date or on the machine's startup
time, but it never decreases (until the machine is turned off).</p>
<p>
<a name="node_idx_3368"></a><a name="node_kw_definitioncurrent-process-milliseconds"></a><code class=scheme>(current-process-milliseconds</code><code class=scheme>)</code> returns the amount of processor
time in fixnum milliseconds that has been consumed by the MzScheme
process on the underlying operating system. (Under Unix and Mac OS X, this
includes both user and system time.) The precision of the result is
platform-specific, and since the result is a fixnum, the value
increases only over a limited (though reasonably long) time.</p>
<p>
<a name="node_idx_3370"></a><a name="node_kw_definitioncurrent-gc-milliseconds"></a><code class=scheme>(current-gc-milliseconds</code><code class=scheme>)</code> returns the amount of processor time in
fixnum milliseconds that has been consumed by MzScheme's garbage
collection so far. This time is a portion of the time reported by
<code class=scheme>(<code class=scheme>current-process-milliseconds</code>)</code>.</p>
<p>
</p>
<a name="node_sec_15.1.3"></a>
<h3><a href="mzscheme.html#node_toc_node_sec_15.1.3">15.1.3&nbsp;&nbsp;Timing Execution</a></h3>
<p>The <code class=scheme><code class=scheme>time-apply</code></code> procedure collects timing information for a
procedure application:
</p>
<ul><p>
</p>
<li><p><a name="node_idx_3372"></a><a name="node_kw_definitiontime-apply"></a><code class=scheme>(time-apply</code><tt>&nbsp;</tt><code class=scheme><span class=variable>proc arg-list</span></code><code class=scheme>)</code> invokes the procedure <code class=scheme><span class=variable>proc</span></code>
with the arguments in <code class=scheme><span class=variable>arg-list</span></code>. Four values are returned: a
list containing the result(s) of applying <code class=scheme><span class=variable>proc</span></code>, the number of
milliseconds of CPU time required to obtain this result, the number
of ``real'' milliseconds required for the result, and the number of
milliseconds of CPU time (included in the first result) spent on
garbage collection.</p>
<p>
</p>
</ul><p></p>
<p>
The reliability of the timing numbers depends on the platform; see
section&nbsp;<a href="#node_sec_15.1.2">15.1.2</a> for more information on time accounting. If
multiple MzScheme threads are running, then the reported time may
include work performed by other threads.</p>
<p>
The <a name="node_kw_definitiontime"></a><a name="node_idx_3374"></a><code class=scheme><span class=keyword>time</span></code> syntactic form reports timing information
directly to the current output port:
</p>
<ul><p>
</p>
<li><p><code class=scheme>(time <code class=scheme><span class=variable>expr</span></code>)</code> times the evaluation of <code class=scheme><span class=variable>expr</span></code>,
printing timing information to the current output port. The result of
the <code class=scheme><code class=scheme>time</code></code> expression is the result of <code class=scheme><span class=variable>expr</span></code>.</p>
<p>
</p>
</ul><p></p>
<p>
</p>
<a name="node_sec_15.2"></a>
<h2><a href="mzscheme.html#node_toc_node_sec_15.2">15.2&nbsp;&nbsp;Operating System Processes</a></h2>
<p><a name="node_idx_3376"></a></p>
<p>
<a name="node_idx_3378"></a>
<a name="node_idx_3380"></a>
<a name="node_idx_3382"></a><a name="node_kw_definitionsubprocess"></a><code class=scheme>(subprocess</code><tt>&nbsp;</tt><code class=scheme><span class=variable>stdout-output-port stdin-input-port
stderr-output-port command-path arg-string</span></code><tt>&nbsp;</tt><tt>&middot;&middot;&middot;</tt><code class=scheme>)</code> creates a new process in
the underlying operating system to execute <code class=scheme><span class=variable>command-path</span></code>
asynchronously. The <code class=scheme><span class=variable>command-path</span></code> argument is a path to a
program executable, and the <code class=scheme><span class=variable>arg-string</span></code>s are command-line
arguments for the program. Under Unix and Mac OS X, command-line
arguments are passed as byte strings using the current locale's
encoding (see section&nbsp;<a href="mzscheme-Z-H-1.html#node_sec_1.2.3">1.2.3</a>).</p>
<p>
Under Windows, the first <code class=scheme><span class=variable>arg-string</span></code> can be <code class=scheme><span class=selfeval>'exact</span></code><a name="node_idx_3384"></a>,
which triggers a Windows-specific hack: the second <code class=scheme><span class=variable>arg-string</span></code>
is used exactly as the command-line for the subprocess, and no
additional <code class=scheme><span class=variable>arg-string</span></code>s can be supplied.  Otherwise, a
command-line string is constructed from <code class=scheme><span class=variable>command-path</span></code> and
<code class=scheme><span class=variable>arg-string</span></code> so that a typical Windows console application can
parse it back to an array of arguments.<a name="node_call_footnote_53"></a><a href="#node_footnote_53"><sup><small>53</small></sup></a> If <code class=scheme><span class=selfeval>'exact</span></code> is
provided on a non-Windows platform, the
<a name="node_idx_3386"></a><code class=scheme>exn:fail:contract</code> exception is raised.</p>
<p>
Unless it is <code class=scheme><span class=selfeval>#f</span></code>, <code class=scheme><span class=variable>stdout-output-port</span></code> is used for the
launched process's standard output, <code class=scheme><span class=variable>stdin-input-port</span></code> is used
for the process's standard input, and <code class=scheme><span class=variable>stderr-output-port</span></code> is
used for the process's standard error.  All provided ports must be
file-stream ports. Any of the ports can be <code class=scheme><span class=selfeval>#f</span></code>, in which case
a system pipe is created and returned by <code class=scheme><code class=scheme>subprocess</code></code>. For
each port that is provided, no pipe is created and the corresponding
returned value is <code class=scheme><span class=selfeval>#f</span></code>.</p>
<p>
The <code class=scheme><code class=scheme>subprocess</code></code> procedure returns four values:
</p>
<ul> <p>
</p>
<li><p>a subprocess value representing the created process;</p>
<p>
</p>
<li><p>an input port piped from the process's standard output, or
<code class=scheme><span class=selfeval>#f</span></code> if <code class=scheme><span class=variable>stdout-output-port</span></code> was a port;</p>
<p>
</p>
<li><p>an output port piped to the process standard input, or
<code class=scheme><span class=selfeval>#f</span></code> if <code class=scheme><span class=variable>stdin-input-port</span></code> was a port;</p>
<p>
</p>
<li><p>an input port piped from the process's standard error, or
<code class=scheme><span class=selfeval>#f</span></code> if <code class=scheme><span class=variable>stderr-output-port</span></code> was a port.</p>
<p>
</p>
</ul><p>
<strong>Important:</strong> All ports returned from <code class=scheme><code class=scheme>subprocess</code></code> must be
explicitly closed with <code class=scheme><code class=scheme>close-input-port</code></code> and
<code class=scheme><code class=scheme>close-output-port</code></code>.</p>
<p>
The returned ports are file-stream ports (see section&nbsp;<a href="mzscheme-Z-H-11.html#node_sec_11.1.6">11.1.6</a>),
and they are placed into the management of the current custodian (see
section&nbsp;<a href="mzscheme-Z-H-9.html#node_sec_9.2">9.2</a>).  The <a name="node_idx_3388"></a><code class=scheme>exn:fail</code> exception is raised when a low-level error
prevents the spawning of a process or the creation of operating
system pipes for process communication.</p>
<p>
A subprocess value can be used to obtain further information about the
process:
</p>
<ul><p>
</p>
<li><p><a name="node_idx_3390"></a><a name="node_kw_definitionsubprocess-wait"></a><code class=scheme>(subprocess-wait</code><tt>&nbsp;</tt><code class=scheme><span class=variable>subprocess</span></code><code class=scheme>)</code> blocks until the process
terminates, then returns void.</p>
<p>
</p>
<li><p><a name="node_idx_3392"></a><a name="node_kw_definitionsubprocess-status"></a><code class=scheme>(subprocess-status</code><tt>&nbsp;</tt><code class=scheme><span class=variable>subprocess</span></code><code class=scheme>)</code> returns
<code class=scheme><span class=selfeval>'running</span></code><a name="node_idx_3394"></a> if the process is still running, or its exit
code otherwise. The exit code is an exact integer, and <code class=scheme><span class=selfeval>0</span></code>
typically indicates success. If the process terminated due to a fault
or signal, the exit code is non-zero.</p>
<p>
</p>
<li><p><a name="node_idx_3396"></a><a name="node_kw_definitionsubprocess-kill"></a><code class=scheme>(subprocess-kill</code><tt>&nbsp;</tt><code class=scheme><span class=variable>subprocess force?</span></code><code class=scheme>)</code> terminates the
subprocess if <code class=scheme><span class=variable>force?</span></code> is true and if the process still
running, then returns void. If an error occurs during termination,
the <a name="node_idx_3398"></a><code class=scheme>exn:fail</code> exception is raised.</p>
<p>
If <code class=scheme><span class=variable>force?</span></code> is <code class=scheme><span class=selfeval>#f</span></code> under Unix and Mac OS X, the subprocess is
sent an interrupt signal instead of a kill signal (and the subprocess
might handle the signal without terminating). Under Windows, no
action is taken when <code class=scheme><span class=variable>force?</span></code> is <code class=scheme><span class=selfeval>#f</span></code>.</p>
<p>
</p>
<li><p><a name="node_idx_3400"></a><a name="node_kw_definitionsubprocess-pid"></a><code class=scheme>(subprocess-pid</code><tt>&nbsp;</tt><code class=scheme><span class=variable>subprocess</span></code><code class=scheme>)</code> returns the operating system's
numerical ID for the process (if any), valid only as long as the
process is running. The ID is an exact integer.</p>
<p>
</p>
<li><p><a name="node_idx_3402"></a><a name="node_kw_definitionsubprocess_Q_"></a><code class=scheme>(subprocess?</code><tt>&nbsp;</tt><code class=scheme><span class=variable>v</span></code><code class=scheme>)</code> returns <code class=scheme><span class=selfeval>#t</span></code> if <code class=scheme><span class=variable>v</span></code> is a
subprocess value, <code class=scheme><span class=selfeval>#f</span></code> otherwise.</p>
<p>
</p>
</ul><p>
MzLib provides procedures for executing shell commands (as opposed to
directly executing a program); see Chapter&nbsp;<a href="../mzlib/mzlib-Z-H-35.html#node_chap_35">35</a>
in <a href="../mzlib/mzlib.html"><i>PLT MzLib: Libraries Manual</i></a> for details.</p>
<p>
</p>
<a name="node_sec_15.3"></a>
<h2><a href="mzscheme.html#node_toc_node_sec_15.3">15.3&nbsp;&nbsp;Windows Actions</a></h2>
<p><a name="node_idx_3404"></a></p>
<p>
<a name="node_idx_3406"></a>
<a name="node_idx_3408"></a><a name="node_kw_definitionshell-execute"></a><code class=scheme>(shell-execute</code><tt>&nbsp;</tt><code class=scheme><span class=variable>verb-string target-string parameters-string dir-path show-mode-symbol</span></code><code class=scheme>)</code>
performs the action specified by <code class=scheme><span class=variable>verb-string</span></code> on <code class=scheme><span class=variable>target-string</span></code>
in Windows. For example, 
</p>
<div align=left><pre class=scheme>(<code class=scheme>shell-execute</code> <span class=selfeval>#f</span> <span class=selfeval>&quot;http://www.plt-scheme.org&quot;</span> <span class=selfeval>&quot;&quot;</span> (<code class=scheme>current-directory</code>) <span class=keyword>'</span><span class=variable>sw_shownormal</span>)
</pre></div><p>
opens the PLT Scheme home page in a browser window. For platforms
other than Windows, the <a name="node_idx_3410"></a><code class=scheme>exn:fail:unsupported</code> exception is raised.</p>
<p>
The <code class=scheme><span class=variable>verb-string</span></code> can be <code class=scheme><span class=selfeval>#f</span></code>, in which case the operating
system will use a default verb. Common verbs include <code class=scheme><span class=selfeval>&quot;open&quot;</span></code>,
<code class=scheme><span class=selfeval>&quot;edit&quot;</span></code>, <code class=scheme><span class=selfeval>&quot;find&quot;</span></code>, <code class=scheme><span class=selfeval>&quot;explore&quot;</span></code>, and
<code class=scheme><span class=selfeval>&quot;print&quot;</span></code>.</p>
<p>
The <code class=scheme><span class=variable>target-string</span></code> is the target for the action, usually a
filename path. The file could be executable, or it could be a file
with a recognized extension that can be handled by an installed
application.</p>
<p>
The <code class=scheme><span class=variable>parameters-string</span></code> argument is passed on to the system to
perform the action. For example, in the case of opening an
executable, the <code class=scheme><span class=variable>parameters-string</span></code> is used as the command line
(after the executable name).</p>
<p>
The <code class=scheme><span class=variable>dir-path</span></code> is used as the current directory when performing
the action.</p>
<p>
The <code class=scheme><span class=variable>show-mode-symbol</span></code> sets the display mode for a Window
affected by the action. It must be one of the following symbols; the
description of each symbol's meaning is taken from the Windows API
documentation.
</p>
<ul><p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_hide</span></code><a name="node_idx_3412"></a> or <code class=scheme><span class=selfeval>'SW_HIDE</span></code><a name="node_idx_3414"></a>  --  Hides the
window and activates another window.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_maximize</span></code><a name="node_idx_3416"></a> or <code class=scheme><span class=selfeval>'SW_MAXIMIZE</span></code><a name="node_idx_3418"></a>  -- 
Maximizes the window.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_minimize</span></code><a name="node_idx_3420"></a> or <code class=scheme><span class=selfeval>'SW_MINIMIZE</span></code><a name="node_idx_3422"></a>  -- 
Minimizes the window and activates the next top-level window in the
z-order.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_restore</span></code><a name="node_idx_3424"></a> or <code class=scheme><span class=selfeval>'SW_RESTORE</span></code><a name="node_idx_3426"></a>  -- 
Activates and displays the window. If the window is minimized or
maximized, Windows restores it to its original size and position.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_show</span></code><a name="node_idx_3428"></a> or <code class=scheme><span class=selfeval>'SW_SHOW</span></code><a name="node_idx_3430"></a>  --  Activates
the window and displays it in its current size and position.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_showdefault</span></code><a name="node_idx_3432"></a> or <code class=scheme><span class=selfeval>'SW_SHOWDEFAULT</span></code><a name="node_idx_3434"></a>
 --  Uses a default.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_showmaximized</span></code><a name="node_idx_3436"></a>
or <code class=scheme><span class=selfeval>'SW_SHOWMAXIMIZED</span></code><a name="node_idx_3438"></a>  --  Activates the window and
displays it as a maximized window.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_showminimized</span></code><a name="node_idx_3440"></a>
or <code class=scheme><span class=selfeval>'SW_SHOWMINIMIZED</span></code><a name="node_idx_3442"></a>  --  Activates the window and
displays it as a minimized window.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_showminnoactive</span></code><a name="node_idx_3444"></a>
or <code class=scheme><span class=selfeval>'SW_SHOWMINNOACTIVE</span></code><a name="node_idx_3446"></a>  --  Displays the window as a
minimized window. The active window remains active.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_showna</span></code><a name="node_idx_3448"></a> or <code class=scheme><span class=selfeval>'SW_SHOWNA</span></code><a name="node_idx_3450"></a>  -- 
Displays the window in its current state. The active window remains
active.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_shownoactivate</span></code><a name="node_idx_3452"></a>
or <code class=scheme><span class=selfeval>'SW_SHOWNOACTIVATE</span></code><a name="node_idx_3454"></a>  --  Displays a window in its most
recent size and position. The active window remains active.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>'sw_shownormal</span></code><a name="node_idx_3456"></a> or <code class=scheme><span class=selfeval>'SW_SHOWNORMAL</span></code><a name="node_idx_3458"></a>
 --  Activates and displays a window. If the window is minimized or
maximized, Windows restores it to its original size and position.</p>
<p>
</p>
</ul><p></p>
<p>
If the action fails, the <a name="node_idx_3460"></a><code class=scheme>exn:fail</code> exception is raised. If the action succeeds,
the result is <code class=scheme><span class=selfeval>#f</span></code>. In future versions of MzScheme, the
result may be a subprocess value (see section&nbsp;<a href="#node_sec_15.2">15.2</a>) if the
operating system did returns a process handle (but if a subprocess
value is returned, its process ID will be <code class=scheme><span class=selfeval>0</span></code> instead of the
real process ID).</p>
<p>
</p>
<a name="node_sec_15.4"></a>
<h2><a href="mzscheme.html#node_toc_node_sec_15.4">15.4&nbsp;&nbsp;Operating System Environment Variables</a></h2>
<p><a name="node_idx_3462"></a></p>
<p>
<a name="node_idx_3464"></a><a name="node_kw_definitiongetenv"></a><code class=scheme>(getenv</code><tt>&nbsp;</tt><code class=scheme><span class=variable>name-string</span></code><code class=scheme>)</code> gets the value of an operating system
environment variable. The <code class=scheme><span class=variable>name-string</span></code> argument cannot contain a
null character; if an environment variable named by <code class=scheme><span class=variable>name-string</span></code>
exists, its value is returned (as a string); otherwise, <code class=scheme><span class=selfeval>#f</span></code> is
returned.</p>
<p>
<a name="node_idx_3466"></a><a name="node_kw_definitionputenv"></a><code class=scheme>(putenv</code><tt>&nbsp;</tt><code class=scheme><span class=variable>name-string value-string</span></code><code class=scheme>)</code> sets the value of an operating
system environment variable. The <code class=scheme><span class=variable>name-string</span></code> and
<code class=scheme><span class=variable>value-string</span></code> arguments are strings that cannot contain a null
character; the environment variable named by <code class=scheme><span class=variable>name-string</span></code> is set
to <code class=scheme><span class=variable>value-string</span></code>. The return value is <code class=scheme><span class=selfeval>#t</span></code> if the
assignment succeeds, <code class=scheme><span class=selfeval>#f</span></code> otherwise.</p>
<p>
</p>
<a name="node_sec_15.5"></a>
<h2><a href="mzscheme.html#node_toc_node_sec_15.5">15.5&nbsp;&nbsp;Runtime Information</a></h2>
<p><a name="node_idx_3468"></a></p>
<p>
<a name="node_idx_3470"></a> 
<a name="node_idx_3472"></a><a name="node_kw_definitionsystem-type"></a><code class=scheme>(system-type</code><tt>&nbsp;</tt>[<code class=scheme><span class=variable>mode</span></code>]<code class=scheme>)</code> returns information about the operating
system, build mode, or machine for a running MzScheme. The <code class=scheme><span class=variable>mode</span></code>
argument must be either <code class=scheme><span class=selfeval>'os</span></code><a name="node_idx_3474"></a> (the default),
<code class=scheme><span class=selfeval>'link</span></code><a name="node_idx_3476"></a>, or <code class=scheme><span class=selfeval>'machine</span></code><a name="node_idx_3478"></a>. In <code class=scheme><span class=selfeval>'os</span></code> mode,
the possible symbol results are:
</p>
<ul><li><p><code class=scheme><span class=selfeval>'unix</span></code><a name="node_idx_3480"></a>
</p>
<li><p><code class=scheme><span class=selfeval>'windows</span></code><a name="node_idx_3482"></a>
</p>
<li><p><code class=scheme><span class=selfeval>'macosx</span></code><a name="node_idx_3484"></a>
</p>
</ul><p>
In <code class=scheme><span class=selfeval>'link</span></code> mode, the possible symbol results are:
</p>
<ul><li><p><code class=scheme><span class=selfeval>'static</span></code><a name="node_idx_3486"></a> (Unix)
</p>
<li><p><code class=scheme><span class=selfeval>'shared</span></code><a name="node_idx_3488"></a> (Unix)
</p>
<li><p><code class=scheme><span class=selfeval>'dll</span></code><a name="node_idx_3490"></a> (Windows)
</p>
<li><p><code class=scheme><span class=selfeval>'framework</span></code><a name="node_idx_3492"></a> (Mac OS X)
</p>
</ul><p>
(Future ports of MzScheme may expand the list of system and link symbol
results.)
In <code class=scheme><span class=selfeval>'machine</span></code> mode, then the result is a string, which contains
further details about the current machine in a platform-specific
format.</p>
<p>
<a name="node_idx_3494"></a><a name="node_kw_definitionsystem-language+country"></a><code class=scheme>(system-language+country</code><code class=scheme>)</code> returns a string to identify the
current user's language and country. Under Unix and Mac OS X, the
string is five characters: two lowercase ASCII letters for the
language, an underscore, and two uppercase ASCII letters for the
country. Under Windows, the string can be arbitrarily long, but the
language and country are in English (all ASCII letters or spaces)
separated by an underscore. Under Unix, the result is determined by
checking the <tt><strong>LC_ALL</strong></tt>, <tt><strong>LC_TYPE</strong></tt>, and <tt><strong>LANG</strong></tt>
environment variables, in that order (and the result is used if the
environment variable's value starts with two lowercase ASCII letters,
an underscore, and two uppercase ASCII letters, followed by either
nothing or a period). Under Windows and Mac OS X, the result is
determined by system calls.</p>
<p>
<a name="node_idx_3496"></a><a name="node_kw_definitionsystem-library-subpath"></a><code class=scheme>(system-library-subpath</code><tt>&nbsp;</tt>[<code class=scheme><span class=variable>variant?</span></code>]<code class=scheme>)</code> returns a relative directory
path string. This string can be used to build paths to
system-specific files. For example, when MzScheme is running under
Solaris on a Sparc architecture, the subpath is
<code class=scheme><span class=selfeval>&quot;sparc-solaris&quot;</span></code>, while the subpath for Windows on an Intel
architecture is <code class=scheme><span class=selfeval>&quot;win32\\i386&quot;</span></code>. The subpath also
distinguishes among MzScheme variants (e.g., the ``3m'' variant with
more precise garbage collection) by extending the ``normal'' variant
path with a subdirectory. If <code class=scheme><span class=variable>variant?</span></code> is <code class=scheme><span class=selfeval>#f</span></code>, then
the returned path is for the ``normal'' variant.</p>
<p>
<a name="node_idx_3498"></a><a name="node_kw_definitionversion"></a><code class=scheme>(version</code><code class=scheme>)</code> returns an immutable string indicating the currently
executing version of MzScheme.</p>
<p>
<a name="node_idx_3500"></a><a name="node_kw_definitionbanner"></a><code class=scheme>(banner</code><code class=scheme>)</code> returns an immutable string for MzScheme's start-up
banner text (or the banner text for an embedding program, such as
MrEd). The banner string ends with a newline.</p>
<p>
<a name="node_idx_3502"></a><a name="node_kw_definitionvector-set-performance-stats!"></a><code class=scheme>(vector-set-performance-stats!</code><tt>&nbsp;</tt><code class=scheme><span class=variable>mutable-vector</span></code><tt>&nbsp;</tt>[<code class=scheme><span class=variable>thread</span></code>]<code class=scheme>)</code> sets
elements in <code class=scheme><span class=variable>mutable-vector</span></code> to report current performance
statistics. If <code class=scheme><span class=variable>thread</span></code> is specified, a particular set of
thread-specific statistics are reported, otherwise a different set of
global statics are reported.</p>
<p>
For global statistics, up to 8 elements are set in the vector,
starting from the beginning. (In future versions of MzScheme,
additional elements will be set.) If <code class=scheme><span class=variable>mutable-vector</span></code> has <em>n</em>
elements where <em>n</em> &lt; 8, then the <em>n</em> elements are set to the first
<em>n</em> performance-statistics values. The reported statistics values are
as follows, in the order that they are set within
<code class=scheme><span class=variable>mutable-vector</span></code>:</p>
<p>
</p>
<ul><p>
</p>
<li><p><code class=scheme><span class=selfeval>0</span></code>: The same value as returned
by <code class=scheme>current-process-milliseconds</code> (see section&nbsp;<a href="#node_sec_15.1.2">15.1.2</a>).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>1</span></code>: The same value as returned
by <code class=scheme>current-milliseconds</code> (see section&nbsp;<a href="#node_sec_15.1.2">15.1.2</a>).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>2</span></code>: The same value as returned
by <code class=scheme>current-gc-milliseconds</code> (see section&nbsp;<a href="#node_sec_15.1.2">15.1.2</a>).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>3</span></code>: The number of garbage collections performed since
start-up.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>4</span></code>: The number of thread context switches performed since
start-up.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>5</span></code>: The number of internal stack overflows handled since
start-up.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>6</span></code>: The number of threads currently scheduled for
execution (i.e., threads that are running, not suspended, and not
unscheduled due to a synchronization).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>7</span></code>: The number of syntax objects read from compiled code
since start-up.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>8</span></code>: The number of hash-table searches performed.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>9</span></code>: The number of additional hash slots searched to complete
hash searches (using double hashing).</p>
<p>
</p>
</ul><p></p>
<p>
For thread-specific statistics, up to 4 elements are set in the
vector:</p>
<p>
</p>
<ul><p>
</p>
<li><p><code class=scheme><span class=selfeval>0</span></code>: <code class=scheme><span class=selfeval>#t</span></code> if the thread is running, <code class=scheme><span class=selfeval>#f</span></code>
otherwise (same result as <code class=scheme>thread-running?</code>).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>1</span></code>: <code class=scheme><span class=selfeval>#t</span></code> if the thread has terminated,
<code class=scheme><span class=selfeval>#f</span></code> otherwise (same result as <code class=scheme>thread-dead?</code>).</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>2</span></code>: <code class=scheme><span class=selfeval>#t</span></code> if the thread is currently blocked on a
synchronizable event (or sleeping for some number of milliseconds),
<code class=scheme><span class=selfeval>#f</span></code> otherwise.</p>
<p>
</p>
<li><p><code class=scheme><span class=selfeval>3</span></code>: The number of bytes currently in use for the
thread's continuation.</p>
<p>
</p>
</ul><p></p>
<p>
</p>
<p>
</p>
<div class=footnoterule><hr></div><p></p>
<div class=footnote><p><a name="node_footnote_52"></a><a href="#node_call_footnote_52"><sup><small>52</small></sup></a> The value produced for the <code class=scheme>time-zone-offset</code> field
tends to be sensitive to the value of the <code class=scheme><span class=selfeval>&quot;TZ&quot;</span></code>
environment variable, especially on Unix
platforms. Consult the system documentation (usually
under <tt>tzset</tt>) for details.</p>
<p><a name="node_footnote_53"></a><a href="#node_call_footnote_53"><sup><small>53</small></sup></a> For information on
the Windows command-line conventions, search for ``command line
parsing'' at <tt><a href="http://msdn.microsoft.com/">http://msdn.microsoft.com/</a></tt>.</p>
</div>
<div align=right class=navigation><i>[Go to <span><a href="mzscheme.html">first</a>, <a href="mzscheme-Z-H-14.html">previous</a></span><span>, <a href="mzscheme-Z-H-16.html">next</a></span> page<span>; &nbsp;&nbsp;</span><span><a href="mzscheme.html#node_toc_start">contents</a></span><span><span>; &nbsp;&nbsp;</span><a href="mzscheme-Z-H-22.html#node_index_start">index</a></span>]</i></div>
<p></p>
</div>
</body>
</html>