David,
Just realised that the CNF_PVAL-ification of POLBIN doesn't work at all.
The problem is that it uses pointer arithmetic extensively whilst storing
the answers to that pointer arithmetic in INTEGER*4.
I started fixing up POLBIN to store the offsets in the variables that
were previously treated as pointers (eg IPI and IPX) and this will work
except there are a lot of them and the code isn't going to be very neat
when I'm done, or as flexible (since the subroutines will need to be
called with both the base pointer and the offset so switching data arrays
may require if blocks on both the base and the offset).
ie things such as
IF( CIRC ) THEN
CALL PSX_CALLOC( NBIN*2, '_REAL', IPBIN, STATUS )
IPIBN = IPBIN
IPVBN = IPBIN + NBIN*VAL__NBR
NSTOKE = 2
STOKES = 'IV'
ELSE
CALL PSX_CALLOC( NBIN*3, '_REAL', IPBIN, STATUS )
IPIBN = IPBIN
IPQBN = IPBIN + NBIN*VAL__NBR
IPUBN = IPBIN + 2*NBIN*VAL__NBR
NSTOKE = 3
STOKES = 'IQU'
END IF
become
IF( CIRC ) THEN
CALL PSX_CALLOC( NBIN*2, '_REAL', IPBIN, STATUS )
IPIBN = 0
IPVBN = NBIN*VAL__NBR
NSTOKE = 2
STOKES = 'IV'
ELSE
CALL PSX_CALLOC( NBIN*3, '_REAL', IPBIN, STATUS )
IPIBN = 0
IPQBN = NBIN*VAL__NBR
IPUBN = 2*NBIN*VAL__NBR
NSTOKE = 3
STOKES = 'IQU'
END IF
CALL BLAH( %VAL( CNF_PVAL( IPBIN ) + IPIBN ),
%VAL( CNF_PVAL( IPBIN ) + IPQBN ))
The neatest approach would be to edit POLBIN so that it uses
a "FPOINTER" type in the decalrations and then make sure that
sed or cpp pre-process the file to convert FPOINTER to either INTEGER*8
or INTEGER*4. Then the only edit will be to change the code above to
read something like
CALL PSX_CALLOC( NBIN*3, '_REAL', IPBIN, STATUS )
IPIBN = CNF_PVAL( IPBIN )
IPQBN = CNF_PVAL( IPBIN ) + NBIN*VAL__NBR
IPUBN = CNF_PVAL( IPBIN ) + 2*NBIN*VAL__NBR
since PSX_CALLOC won't be returning a pointer.
David, which approach is preferred by you? ["ignore 64bit" is not an
option :-)]
I've given this a wide audience since if the pre-processing approach is
adopted we really should agree on the notation for "FPOINTER" and have
a standard way of dealing with this in configure.
--
Tim Jenness
JAC software
http://www.jach.hawaii.edu/~timj
|