HP3000-L Archives

July 2008, Week 2

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:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Mon, 14 Jul 2008 12:44:12 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (81 lines)
You didn't mention if you solved your problem
with HPCICOMMAND (AFAIK).

(best viewed with fixed font)

In:
   //cmd is put on the stack and a command line like LISTFILE is put into it
   *(cmdline+strlen(cmdline)+1) = (char)15;
   HPCICOMMAND(cmdline, &createstatus);

   This should overwrite the null terminator with a carriage return. I have
   also tried strcat(cmdline , "\r

there are a number of problems:

1. readability in C

   You always want:  cmdline [...] = ...
   where possible ... it makes things easier for the reader,
   and produces the same for the emitted code.

2. the index calculation is wrong.

   Combining #1 and #2 we should get:

      cmdline [strlen (cmdline)] = (char) 15;

   Of course, from the viewpoint of getting a CR at the end,
   that's similar to the strcat you tried (of course, the strcat
   also appends a null, but HPCICOMMAND won't care).

   I.e., this fix won't solve your problem by itself, so ...

3. calling sequence

   I didn't see if you were using "#pragma intrinsic HPCICOMMAND", which
   is only in HP's C compiler.

   Assuming you aren't, then you've got a major problem with
   the parameters ... you're missing the first (and hidden) parameter.

   Here's the real calling sequence from gcc's viewpoint (or HP C if
   you don't use #pragma intrinsic HPCICOMMAND)...
 
   extern void HPCICOMMAND (
      int32     num_actual_parms,            
      void     *cmdimage,   
      int16_t  *cmderror,   
      int16_t  *parmnum,    
      int16_t   msglevel);  

   Thus, your call should be:

      HPCICOMMAND (2, cmdimage, &cmderror, NULL, 0);

        you could use "4" instead of "2", in this case;
        you may want a msglevel other than 0

Now, you're saying "how do I find out which intrinsics have a hidden
'# of parameters' parameter at the start?".  Good question!

The CSEQ tool, a product from Lund Peformance Solutions, provides the 
information.  I got the above by entering:

   :cseq -gcc hpcicommand

Although I wrote CSEQ, I don't think we have a financial interest
in it so I'm not going to say <plug>.  :)

CSEQ is **HIGHLY** recommended if you're doing calls to intrinsics from 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 *

ATOM RSS1 RSS2