Re:
> When calling an option extensible procedure, the first
> parameter is a count of the number of parameters you are
> passing to that intrinsic -- generated by your compiler,
> in my case, HP-C.
The CSEQ tool, from Lund, does a good job of reporting
this very vital information!
IIRC, you can also use it to get a fairly good C-style header.
> HP-C seems to count all parameters that are provided with a
> leading comma -- even those that are missing.
>
> HPGETPROCPTR ( name, &ptr, ierr, libstring, 1,,,,,);
>
> This counts 10 parameters.
And well it should!
> The idea being that the same source code should compile on
> MPE and the other platforms.
> HPGETPROCPTR ( EXTCNT(5) name, &ptr, ierr, libstring, 1,
> NOARG, NOARG, NOARG, NOARG, NOARG );
(Note: I'm assuming "HPGETPROCPTR" is a repeated typo for the
"HPGETPROCPLABEL" intrinsic name.)
You could get what you wanted via:
HPGETPROCPLABEL (EXTCNT(5) name, &ptr, ierr, libstring, 1 NOARG5)
Where NOARG5 is defined as ", NULL, NULL, NULL, NULL, NULL" for gcc
and empty for HP-C.
Wait...your HP-C calling sequence implies that it's aware of
#pragma intrinsic (because your MPE define omits the #parameters,
we can conclude that the compiler is aware of "extensible" and
is putting the argument count in for you).
So, we have to ask: what does the non-MPE HPGETPROCPLABEL's
parameter sequence look like? If it has just the first five
parameters, then why can't you just do:
HPGETPROCPLABEL (name, &ptr, ierr, libstring, 1)
on *all* platforms? For MPE, the #pragma intrinsic tells HP-C
to insert the parameter count, and for non-MPE you don't need it.
For people with older manuals, the calling sequence
for HPGETPROCPLABEL (on MPE/iX 5.5 and later) is:
Parm_0 : (# actual parameters) {R26}
procname : anyvar record ; {R25, @32 -> 272}
plabel : anyvar int32 ; {R24}
status : anyvar record ; {R23, @32 -> 32} := nil
firstfile : anyvar record ; {SP-$0034, @32 -> 8192} := nil
casesensitive: boolean ; {SP-$0035, #bits = 8} := 0
symbol_type : int32 ; {SP-$003c} := 0
data_size : var int32 ; {SP-$0040} := nil
position : int32 ; {SP-$0044} := 0
search_path : int32 ; {SP-$0048} := 0
binding : int32 ) {SP-$004c} := 0
Finally, an alternative way to get identical code ... with *NO*
funny defines ... to compile on all platforms is to declare
the extern for HPGETPROCPLABEL yourself as follows:
extern void HPGETPROCPLABEL (
int32 num_actual_parms, /* R26 */
/* you must pass at least 5, and up */
/* to 10, depending upon values for the */
/* last 5 parameters below. */
void *procname, /* R25, @32 -> 272 */
int32 *plabel, /* R24 */
void *status, /* R23, @32 -> 32 = NIL */
void *firstfile, /* SP-$0034, @32 -> 8192 = NIL */
boolean casesensitive, /* SP-$0035, #bits = 8 = 0 */
int32 symbol_type, /* SP-$003c = 0 */
int32 *data_size, /* SP-$0040 = NIL */
int32 position, /* SP-$0044 = 0 */
int32 search_path, /* SP-$0048 = 0 */
int32 binding); /* SP-$004c = 0 */
I.e., DO NOT use "#pragma intrinsic".
Then, the a 5-parameter call (as above) would be:
HPGETPROCPLABEL (5, name, &ptr, ierr, libstring, 1,
0, /* symbol_type */
NULL, /* data_size (output) */
0, /* position */
0, /* search_path */
0); /* binding */
or, for what we'd have considered to be a 7 paramter call:
HPGETPROCPLABEL (7, name, &ptr, ierr, libstring, 1,
my_symbol_type, /* symbol_type */
&num_bytes, /* data_size (output) */
0, /* position */
0, /* search_path */
0); /* binding */
on *all* platforms, *all* versions of C.
Stan
--
Stan Sieler
[log in to unmask]
www.allegro.com/sieler/wanted/index.html
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|