version 1.22, 2006/01/31 15:25:44
|
version 1.23, 2006/02/04 19:26:37
|
Line 71 Variable argc ( -- addr ) \ gforth
|
Line 71 Variable argc ( -- addr ) \ gforth
|
\g there is no argument left, return @code{0 0}. |
\g there is no argument left, return @code{0 0}. |
1 arg shift-args ; |
1 arg shift-args ; |
|
|
|
\ processing args on Gforth startup |
|
\ helper words |
|
|
|
: os-execute-parsing ( ... addr u xt -- ... ) |
|
s" *OS command line*" execute-parsing-wrapper ; |
|
|
|
: args-required1 ( addr u -- ) |
|
dup >in ! required ; |
|
|
|
: args-required ( i*x addr u -- i*x ) \ gforth |
|
2dup ['] args-required1 os-execute-parsing ; |
|
|
|
: args-evaluate ( i*x addr u -- j*x ) \ gforth |
|
['] interpret os-execute-parsing ; |
|
|
|
\ main words |
|
|
: process-option ( addr u -- ) |
: process-option ( addr u -- ) |
\ process option, possibly consuming further arguments |
\ process option, possibly consuming further arguments |
2dup s" -e" str= >r |
2dup s" -e" str= >r |
2dup s" --evaluate" str= r> or if |
2dup s" --evaluate" str= r> or if |
2drop next-arg evaluate exit endif |
2drop next-arg args-evaluate exit endif |
2dup s" -h" str= >r |
2dup s" -h" str= >r |
2dup s" --help" str= r> or if |
2dup s" --help" str= r> or if |
." Image Options:" cr |
." Image Options:" cr |
Line 91 Variable argc ( -- addr ) \ gforth
|
Line 108 Variable argc ( -- addr ) \ gforth
|
BEGIN |
BEGIN |
argc @ 1 > WHILE |
argc @ 1 > WHILE |
next-arg over c@ [char] - <> IF |
next-arg over c@ [char] - <> IF |
required |
args-required |
else |
else |
process-option |
process-option |
then |
then |