HP3000-L Archives

February 1996, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Michael P. Smith" <[log in to unmask]>
Reply To:
Michael P. Smith
Date:
Mon, 5 Feb 1996 21:40:05 GMT
Content-Type:
text/plain
Parts/Attachments:
text/plain (52 lines)
Ooops...
 
   I feel rather foolish today.  I was working on my HPCICOMMAND replacement
procedure today and noticed that I was getting a data memory protection trap.
Upon further investigation I found that I was trying to access memory address
4.
 
   That did it.  4.  4 isn't a reachable memory address for normal programs.
But 4 just so happens to be the number of parameters that the HPCICOMMAND
intrinsic accepts and then it dawned on me.  Pascal, COBOL, and Fortran all
handle the 'hidden' parameter count intrinsic for you.  C doesn't.  So when I
modified my function to include a number_of_parms parameter, it all worked
fine.
 
  For those of you who are interested, here is a code snippet showing how to
call an intrinsic from a function of the same name.
 
 
#include <stdio.h>
#include <string.h>
#pragma intrinsic HPGETPROCPLABEL
void HPCICOMMAND(number_of_parms, cmdimage, cmderror, parmnum, msglvl)
  short  number_of_parms;
  char  *cmdimage;
  short *cmderror;
  short *parmnum;
  short  msglvl;
{
  char procedure_name[14];
  void (*hpcicommand_plabel)();
  long status;
  strcpy(procedure_name, " HPCICOMMAND ");
  HPGETPROCPLABEL(procedure_name, (int*) &hpcicommand_plabel, &status);
  printf("calling HPCICOMMAND intrinsic, again.\n");
  (*hpcicommand_plabel) (number_of_parms, cmdimage, cmderror, parmnum, msglvl);
  printf("thats it folks.\n");
}
 
 
 
-------------------------------------------------------------------
Michael P. Smith                        [log in to unmask]
HP Systems Programmer                   [log in to unmask]
Hertz Corporation, Oklahoma City, OK
-------------------------------------------------------------------
 
 'Be a team player, it diffuses the blame'  - Dilbert
 
-------------------------------------------------------------------
The views and opinions expressed in this document are expressly
my own.  So get off the couch, I obviously need more help than you.

ATOM RSS1 RSS2