I'm not having any luck writing a switch stub for passing a real
number from cm pascal/v to nm c/ix. The c code doesn't get the number
or change the number (via the parameter list). It looked easy enough
in the manuals, although, I'm not that experienced in either pascal or c.
Thanks - Jim
1. source for pascal/v (version hp32106 a.01.32):
$segment 'TESTLIB', subprogram$
PROGRAM x;
TYPE
smlint = -32768..32767;
FUNCTION HPSWTONMNAME : INTEGER; INTRINSIC;
PROCEDURE testfunc (VAR X1 : real);
VAR
returnstat: INTEGER;
procname: PACKED ARRAY [1..8] OF CHAR;
procnamelen: smlint;
libname: PACKED ARRAY [1..8] OF CHAR;
libnamelen: smlint;
numparms: smlint;
arglistarray: ARRAY [1..1] OF smlint;
argdescary: ARRAY [1..1] OF smlint;
functype: smlint;
BEGIN
X1 := 2.2;
procname := 'testfunc';
procnamelen := 8;
libname := 'SWXLR';
libnamelen := 5;
numparms := 1;
functype := 0;
arglistarray[1] := BADDRESS (X1);
argdescary[1] := 5;
returnstat := HPSWTONMNAME (procname, procnamelen,
libname, libnamelen, numparms, arglistarray, argdescary, functype);
END;
BEGIN
END.
2. source for c/ix (version hp31506 a.05.10, compiled with ;info="-Aa"):
/* all header files included, just not listed */
#pragma intrinsic HPFPCONVERT
void testfunc(float *x1)
{
float x2;
short sformat,dformat;
sformat=1;
dformat=3;
HPFPCONVERT(&x1,&x2,sformat,dformat);
printf("parm rec'd = %f\n",x2);
x2=3.3;
sformat=3;
dformat=1;
HPFPCONVERT(&x2,&x1,sformat,dformat);
return;
}
|