Newsgroups: comp.sys.transputer
From: ashdown@mpr.ca (Scott Ashdown)
Subject: Maintaining a call frame / is there a jump instruction?
Organization: MPR Teltech Ltd., Burnaby, B.C., Canada
Date: Tue, 1 Nov 1994 16:27:06 GMT
Message-ID: <1994Nov1.162706.18587@mprgate.mpr.ca>


My system is a box of T805s, and I'm using INMOS C.

What I want to do is call a function with a particular set of parameters, and
then have those parameters passed on to another function, which has the
same prototype. That is, I have the following functions:

 int my_func_1 (int a, void *b, char c);
 int my_func_2 (int a, void *b, char c);

And when I call my_func_1, I want to be able to pass control to my_func_2
using the original parameter list, so I don't have to rebuild it. 

Obviously, I could simply make a normal call to the function. This is great
until I have to handle a variable number of args. I'm aware that in the case
of var args I could alter the second function to accept a void * to the 
array of args, but as it turns out, I don't have access to the source of
several of the routines I want to call.

I *was* planning to use the 'gcall' instruction, but it appears to modify the
call frame (or am I wrong - I'm aware it switches the Areg and Iptr). What I 
really need is to be able to enter my first function, and then jump to the 
start of the second, leaving the call frame undisturbed. Is there a jump 
instruction which does this (I am currently without much documentaation, and 
am hating every minute of it), i.e. lets me jump to an absolute address? (Or
possibly some kludge that will accomplish the same thing?)

So, what do I do?

Thanks in advance.





-- 
Scott Ashdown
Engineer, MPR Teltech Ltd.
Burnaby, British Columbia, Canada.
ashdown@mprgate.mpr.ca

