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