[net.micro.68k] again, nargs

nathan@orstcs.UUCP (01/01/84)

#N:orstcs:8300002:000:323
orstcs!nathan    Dec 31 05:01:00 1983

Am I missing something?  Why don't you just fix the code, so that
the first argument defines the number of arguments passed? (We could
solicit a utility to do that...)

Failing that, wouldn't examining the stack frame be more reliable than
looking at whatever butchery the optimizer produces?

	Just asking,
	Nathan Myers

dave@utcsrgv.UUCP (Dave Sherman) (01/02/84)

Nathan Myers asks why I don't fix the code instead of trying to use nargs.
Two reasons: (1) nargs is all over the place in the code, and I don't
really want to run about the whole thing looking for every reference to
every function called in this way; (2) in some places, the routine called
by nargs is an escape routine to handle interrupts, which will be called
with a single argument equal to the integer value of the signal which
triggered the call to the routine. Yes, I could get around it by having
SIGINT generate intr(), which calls escape(1, SIGINT), or by changing
all other invocations of escape() to use single arguments outside the
range 1-NUMSIG.... but if I can get a working nargs() it's MUCH simpler.
I have a complex CAI package which lets the students operate at any of
several levels, and there are multiple processes kicking around with pipes.
The things WORKS now, and I'd like to be able to port it without changing
things.

Nathan then asks whether "examining the stack frame" wouldn't be more
reliable than "looking at whatever butchery the optimizer produces".
That makes sense to me. Unfortunately, I know less than nothing about
the 68000 and its assembler or microcode. Anyway, I appreciate all the
contributions people have made, and I'll certainly try out the version
which was posted (I can live without the optimizer if that's all it takes.)
Thanks.

Dave Sherman
The Law Society of Upper Canada    (utcsrgv!lsuc!dave)
Toronto
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave

jack@hp-dcde.UUCP (01/05/84)

#R:orstcs:8300002:hp-dcde:21100002:000:488
hp-dcde!jack    Jan  2 19:53:00 1984

The possible solution of examining the stack frame to determine nargs
has been suggested.  Consider this example:

main()
{
	alpha(1, beta(2,3,4), 5);
}

When beta is invoked, either the 1 or the 5 will have already been pushed
onto the stack in preperation for calling alpha (at least with our compiler).
Hence if beta just looks at main's stack frame, it will decide that four
arguments have been pushed for it.  Alas.


					-Jack "have McNelly do it" Applin
					(hplabs!hp-dcd!jack)