----- Original Message -----
From: "Jos Visser" <[EMAIL PROTECTED]>
To: "Leopold Toetsch" <[EMAIL PROTECTED]>
Cc: "P6I" <[EMAIL PROTECTED]>
Sent: Friday, August 29, 2003 4:35 AM
Subject: Re: [CVS ci] exit opcode
> On Fri, Aug 29, 2003 at 01:29:18PM +0200 it came to pass that Leopold
Toetsch wrote:
> > I'd like to change the startup parameters too: move the ARGV array from
> > P0 to P5. This would allow main to be:
> >
> > .pcc_sub _main prototyped
> > .param SArray ARGV
> > .local int ARGC
> > ARGC = ARGV
> > ...
>
> This seems a quite logical thing to do (to me)...
>
Also, this way a Parrot program is somewhat like a subroutine call from the
shell (just like in C : main() ). I occurred to me that one could do the
exact same thing when returning to the shell (which means the Parrot program
exits: "end" ). (does anyone agree?)
It *then* occurred to me that this returning to the shell (or exiting the
program, whatever name you'd call it) could be written as:
.pcc_sub _main prototyped # something like
.param SArray ARGV # int main(int argc, char *argv[])
.local int ARGC # {
ARGC = ARGV #
#
# do your stuff here
#
#
$I0 = 0 #
.pcc_begin_return #
.return $I0; # return 0; /* return to
shell */
.pcc_end_return # }
.end
(I don't know for sure if I got the syntax right)
Just an idea.
Klaas-Jan