programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: argc & argv

From: Mike Ghan <mikeghan_at_logix-controls.com>
Date: Sun, 30 Nov 2003 17:37:13 -0800

Carlos,

The following will create an executable utilizing a console box as
I/O.

REQUIRES DOSBOX

: ALL-DONE ( -- ) \ Proper cleanup
   'ONSYSEXIT CALLS \ Execute System Exit Chain
   0 ExitProcess ;

: GO ( -- )
   DOS-CONSOLE OPEN-PERSONALITY
   ." The command line contains" CR
   CMDLINE ARGC 0
   ?DO CMDLINE I ARGV TYPE CR
   LOOP
   CR ." Press any key to exit" KEY DROP
   ALL-DONE ;

' GO 'MAIN !

-1 THRESHOLD \ No Xref file

PROGRAM CMDLINE
BYE

Mike

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On
Behalf
Of Carlos Vergara
Sent: Saturday, November 29, 2003 11:49 PM
To: sftalk_at_forth.com
Subject: [sftalk] Re: argc & argv

=0D
(Sorry, resending in plain text)=0D
=0D
Hi,=0D
 =0D
Jeff, thank you for your code. It guided me to start.f where there are
th=
e
words cmdline, argc, argv and others.=0D
 =0D
I found that on startup SwiftForth interprets the command line which
wind=
ows
passes to it. It means to me that forth will take the first argument
and =
try
to execute it. Then, I wrote a word go which should take the command
line
and show the arguments:=0D
 =0D
: go ( -- )=0D
cmdline argc 0 ?do=0D
cmdline i argv type cr=0D
loop=0D
\ bye=0D
;=0D
 =0D
PROGRAM cmdline.exe=0D
 =0D
If it works it means that I can work with the command line, which is
what=
 I
want. =0D
 =0D
To test it we can write something like=0D
cmdline go one two three four=0D
in a dos box, which would type the lines go, one, two, three and four.
An=
d
it did, but in a SwiftForth window.=0D
 =0D
Now, I don't want it to open the Forth window but to emit directly in
the
dos window I called the program from. Is it possible? If I use the
dosbox
package it will open a different dos box than the one I used to call
the
program, but also the SwiftForth box. I don't want the new dos box
neithe=
r
the SwiftForth box. How can I do it?=0D
 =0D
Regards,=0D
 =0D
Carlos Vergara=0D
=20
----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sun Nov 30 2003 - 17:45:10 PST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:34 PST