version 1.121, 2004/01/16 21:27:30
|
version 1.122, 2004/01/18 22:00:21
|
Line 8906 doc-argc
|
Line 8906 doc-argc
|
doc-argv |
doc-argv |
doc-arg |
doc-arg |
|
|
If you are using these words from @code{'cold}, the (image-specific) |
@code{0 arg} is the program name with which you started Gforth. The |
arguments start at index 1. If you are using these words during |
next unprocessed argument is always @code{1 arg}, the one after that is |
Gforth's argument processing (e.g., while including a file on the |
@code{2 arg} etc. All arguments already processed by the system are |
command line), you can use @code{arg#} to get the current index and for |
deleted. After you have processed an argument, you can delete it with |
skipping arguments. |
@code{shift-args}. |
|
|
doc-arg# |
doc-shift-args |
|
|
Here's an example program using @code{arg#}: |
Here's an example program @file{echo.fs} using @code{arg} etc.: |
|
|
@example |
@example |
: echo ( -- ) |
: echo ( -- ) |
argc @ arg# @ 1+ +do |
begin |
i arg type space |
argc @ 1 > while |
1 arg# +! |
1 arg type space |
loop ; |
shift-args |
|
repeat ; |
|
|
echo cr bye |
echo cr bye |
@end example |
@end example |