Freejack <[EMAIL PROTECTED]> writes:
> Args = {Application.getArgs record('in'(single type:string))}
> %% 'out'(single type:string))}
> Status = try
>
> O={New Open.file init(name: stdout flags:[write create
> truncate])}
> in
> local
> proc {PutOut}
> S={Args.'in'}
^^^^^^^^^^^
invoking a string???
> The compiler doesn't give me any problems with this. However, when
> running it with an argument, it pukes. ozecho --foo gives me this error...
>
>
> %***************** Error: application programming ***************
> %**
> %** unknown option `foo'
what do you not understand about this error message? you invoke your
application with an option --foo and it complains that it doesn't know that
option: indeed, it knows only about option --in; that's the way you programmed
it ;-)
> %** procedure in file
> "/home/kost/compile/build-1.3.0/updates/mozart/share/lib/base/Base.oz", line
> 92, column 7, PC = 135883484
> [...]
> However, that last line in the error message looks a little strange. Who's
> kost? Their not on my host, that's for certain. Hardcoded path in the
> compiler perhaps? This is version 1.3.1 that I've downloaded.
"kost" is Kostantin Popov aka "kostja". Likely, he was the one who compiled the
Mozart distro that you downloaded - hence the debugging information that you
see.
> All the other stuff I've written so far seems to work just fine. Any
> pointers would appreciated.
For something that behaves pretty much like traditional "echo", try the code
below; it also supports the -n option to suppress the terminating newline.
functor
import
Application
Open
define
OUT = {New Open.file init(name:stdout flags:[write])}
Args = {Application.getArgs
record(
mode:start
newline(single type:bool default:true)
newline_(char:&n alias:newline#false)
)}
for
Arg in Args.1
Sep in '';' '
do
{OUT write(vs:Sep#Arg)}
end
if Args.newline then {OUT write(vs:'\n')} end
{OUT close}
{Application.exit 0}
end
Cheers,
--
Dr. Denys Duchier - IRI & LIFL - CNRS, Lille, France
+33 (0)6 25 78 25 74 http://www.lifl.fr/~duchier/
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users