HP3000-L Archives

September 1996, Week 4

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:
Wed, 25 Sep 1996 13:21:38 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (76 lines)
David asks:
>
> In an attempt to convert an old spl program to Pascal, I came across a
> need(ok a want!) for an alternate entry point; but was unable to find
> any documentation. I tried $entry...$ & $entry_point...$ to no avail.
 
Yep.  Unfortunate, isn't it.  Particularly since the Native Mode
program format / loader *SUPPORT* alternate entry points!
 
SPLash! (definitely) and COBOL/iX (probably) have alternate entry points.
 
You can get alternate entry points with Pascal programs, sort of.
(We've done it for those Toolbox programs that are in Pascal, since we have
a standard of having a ",HELP" entry point in them)
...but it's ugly, since you have to use assembler, which isn't officially
available on MPE/iX.
 
The basic technique is to assemble something like the example below, and
link the .o  (NMOBJ) file along with the rest of the program.
Note: if you have a PA-RISC HP-UX box, you can assemble the code there
and move the .o file back to your 3000!
 
NOTE: because it is an alternate entry point, the normal Pascal (or C)
program initialization is *NOT* done!  This, of course, could have
significant affects on your program :)
 
We avoid the problem by having entry points that initialize everything
they need.  We use only 2 entry points: HELP (which prints help info
and terminates), and VERSION (which prints version info and terminates)...
anything more complicated is done via the INFO= string or PARM= value.
 
Another possibility is to skip the assembler stuff, and write your program
with the outer block in a language that supports entry points cleanly,
and then call the stuff you write in Pascal...which is a little awkward
if you have a lot of global variables you want to use :(
 
Personally, I favor lobbying HP to enhance Pascal/iX to support
entrypoints...but I doubt it will ever happen.
 
The following example has an entry point "HELP", which calls "dohelp"
and then terminates the program.
 
Sample assembler code:
 
      .SPACE  $TEXT$
      .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
      .SUBSPA $CODE$
 
 ;****************************************************
HELP
      .PROC
      .CALLINFO CALLER,SAVE_RP,SAVE_SP
      .ENTRY
      .EXPORT HELP,SEC_PROG
 
         ; pcal dohelp...
 
      BL          dohelp,2
      NOP
      .IMPORT     dohelp,CODE
 
         ; pcal TERMINATE
 
      BL,N       TERMINATE,2
      NOP
      .IMPORT      TERMINATE,CODE
 
      .EXIT     ; program
      .PROCEND
 ;****************************************************
      .END
 
--
Stan Sieler                                          [log in to unmask]
                                     http://www.allegro.com/sieler.html

ATOM RSS1 RSS2