Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site amiga.amiga.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!pyramid!amiga!robp From: robp@amiga.UUCP (Robert A. Peck) Newsgroups: net.micro.amiga Subject: Re: Processes and return values Message-ID: <979@amiga.amiga.UUCP> Date: Thu, 10-Apr-86 19:57:44 EST Article-I.D.: amiga.979 Posted: Thu Apr 10 19:57:44 1986 Date-Received: Sat, 12-Apr-86 22:45:32 EST References: <11701@watnot.UUCP> <974@amiga.amiga.UUCP> Reply-To: robp@dudley.UUCP (Robert A. Peck) Distribution: net Organization: Commodore-Amiga Inc., 983 University Ave #D, Los Gatos CA 95030 Lines: 67 Responding further to Matt and Rico .... AmigaDOS has been flamed for the way it does certain things and people have, along the way, either found or been given the tools that are needed to perform various operations in a more suitable ( Un*x-like?) manner. People who write things like CLI's most probably will be building in various command ability rather than asking the DOS to load the command such as type, copy, and so on. I venture to say that there will be very (very very very???) few applications released based purely on BCPL and developed with the full background of knowing AmigaDOS-related TRIPOS process internals, since the experts therein are very few and far between. So why not concentrate on applications for and in the languages with which we are all most familiar. **** small flame-on ***** Why should it be necessary to spend the X-pages of code to set up the BCPL process model and associated CLI data structures when, by a small amount of code as I've already released, one can run most any program without any of the CLI overhead. It is simply unnecessary for the small amount of return one gets. **** small flame-off **** A second thing to note... only if a program ends by "exit(value)" rather than "return(value)" can that value be sensed ..... EVEN BY THE CLI! (See the Amiga C startup code: Astartup.asm .... little piece of it here to show why this happens... so a program has to be intelligent enough in the first place to be capable of "returning" a code). So any program that uses the standard C startup has a choice of whether it can or cannot return a code to the starting process or CLI. domain: jsr _main ; arrives here if return(value) ; from _main. Notice that the ; value is ignored. moveq.l #0,d0 ; Successful return code ; See, return code = 0 no matter ; what value is return()'ed. bra.s exit2 _exit: move.l 4(SP),d0 ; extract return code from stack ; because the C code translated ; exit(value) as a function, that ; pushes value on the stack before ; calling the underlying function ; named _exit. exit2: move.l initialSP,SP ; restore stack pointer move.l d0,-(SP) ; save return code ; ****** ( more stuff here ) ************** ;------ this rts sends us back to DOS: exitToDOS: move.l (SP)+,d0 rts Nuff said. robp. Disclaimer: The opinions expressed above are mine and do not necessarily reflect the opinions of my employer. But so far C-A hasnt released the source code of the CLI, so I suppose I shouldn't do it either.