version 1.173, 2007/02/22 19:37:06
|
version 1.174, 2007/02/23 22:33:21
|
Line 5732 ENDTRY
|
Line 5732 ENDTRY
|
The cleanup example from above in this syntax: |
The cleanup example from above in this syntax: |
|
|
@example |
@example |
base @ @{ oldbase @} |
base @@ @{ oldbase @} |
TRY |
TRY |
hex foo \ now the hex is placed correctly |
hex foo \ now the hex is placed correctly |
0 \ value for throw |
0 \ value for throw |
Line 7692 number. Examples are 1e 1e0 1.e 1.e0 +1e
|
Line 7692 number. Examples are 1e 1e0 1.e 1.e0 +1e
|
number) +12.E-4 |
number) +12.E-4 |
@end itemize |
@end itemize |
|
|
By default, the number base used for integer number conversion is given |
By default, the number base used for integer number conversion is |
by the contents of the variable @code{base}. Note that a lot of |
given by the contents of the variable @code{base}. Note that a lot of |
confusion can result from unexpected values of @code{base}. If you |
confusion can result from unexpected values of @code{base}. If you |
change @code{base} anywhere, make sure to save the old value and restore |
change @code{base} anywhere, make sure to save the old value and |
it afterwards. In general I recommend keeping @code{base} decimal, and |
restore it afterwards; better yet, use @code{base-execute}, which does |
|
this for you. In general I recommend keeping @code{base} decimal, and |
using the prefixes described below for the popular non-decimal bases. |
using the prefixes described below for the popular non-decimal bases. |
|
|
doc-dpl |
doc-dpl |
|
doc-base-execute |
doc-base |
doc-base |
doc-hex |
doc-hex |
doc-decimal |
doc-decimal |
Line 8400 doc-stderr
|
Line 8402 doc-stderr
|
|
|
You can redirect the output of @code{type} and @code{emit} and all the |
You can redirect the output of @code{type} and @code{emit} and all the |
words that use them (all output words that don't have an explicit |
words that use them (all output words that don't have an explicit |
target file) to an arbitrary file with the @code{>outfile |
target file) to an arbitrary file with the @code{outfile-execute}, |
... outfile<} construct, used like this: |
used like this: |
|
|
@example |
@example |
|
: some-warning ( n -- ) |
|
cr ." warning# " . ; |
|
|
: print-some-warning ( n -- ) |
: print-some-warning ( n -- ) |
stderr >outfile cr ." warning# " . outfile< ; |
['] some-warning stderr outfile-execute ; |
@end example |
@end example |
|
|
After the @code{outfile<}, the original output direction is restored; |
After @code{some-warning} is executed, the original output direction |
this construct is nestable and safe against exceptions. Similarly, |
is restored; this construct is safe against exceptions. Similarly, |
there is a construct @code{>infile ... infile<} for redirecting the |
there is @code{infile-execute} for redirecting the input of @code{key} |
input of @code{key} and its users (any input word that does not take a |
and its users (any input word that does not take a file explicitly). |
file explicitly). |
|
|
doc-outfile-execute |
|
doc-infile-execute |
|
|
If you do not want to redirect the input or output to a file, you can |
If you do not want to redirect the input or output to a file, you can |
also make use of the fact that @code{key}, @code{emit} and @code{type} |
also make use of the fact that @code{key}, @code{emit} and @code{type} |
Line 8421 you have to worry about the restoration
|
Line 8428 you have to worry about the restoration
|
exceptions yourself; also, note that for redirecting the output in |
exceptions yourself; also, note that for redirecting the output in |
this way, you have to redirect both @code{emit} and @code{type}. |
this way, you have to redirect both @code{emit} and @code{type}. |
|
|
doc->outfile |
|
doc-outfile< |
|
doc->infile |
|
doc-infile< |
|
|
|
@c --------------------------------------------------------- |
@c --------------------------------------------------------- |
@node Search Paths, , Redirection, Files |
@node Search Paths, , Redirection, Files |
@subsection Search Paths |
@subsection Search Paths |