| 
|  | » |  | 
 |  | 
This HP Pascal/XL program example illustrates the use 
of the HPGETPROCPLABEL intrinsic. 
HPGETPROCPLABEL returns the 
plabel of the COMMAND intrinsic. 
The program requests the user to input the name of a CI command. 
Both the plabel and the CI command are passed to the HP Pascal/XL CALL 
procedure which calls COMMAND and directs it to execute 
the user-specified CI command. 
 | 
$standard_level 'FULL_MODCAL'$ 
   $type_coercion 'NONCOMPATIBLE'$ 
   $tables off$ 
   PROGRAM hpgetprocplabel_test(input, output); 
   
   TYPE 
      c80 = packed array [1..80] of char; 
     mpexl_status = record 
         case integer of 
            0 : (all : integer); 
            1 : (info   : shortint; 
                 subsys : shortint); 
            end; 
      Proc_Type = procedure(VAR command : c80; VAR error, parm : shortint); 
      Proc_Name_Type = string32; 
      File_Name_Type = packed array [1..36] of char; 
      bit32 = minint..maxint; 
   {  bit32 = 0..4294967295; } 
   
   VAR 
      status      : mpexl_status; 
      Proc_Name   : Proc_Name_Type; 
      plabel      : bit32; 
      Invoke_Proc : Proc_Type; 
      command_str : string80; 
      command     : c80; 
      str_cr      : string 1 ; 
      cr          : packed array [1..1] of char; 
      error, parm : shortint; 
      cicat       : shortint; 
      catname     : File_Name_Type; 
   
   PROCEDURE hpgetprocplabel;     INTRINSIC; 
   PROCEDURE fclose;              INTRINSIC; 
   FUNCTION  fopen : shortint;    INTRINSIC; 
   PROCEDURE genmessage;          INTRINSIC; 
   PROCEDURE terminate;           INTRINSIC; 
      
   000  begin 
   001  Proc_Name := ' COMMAND '; 
   002  writeln('About to call hpgetprocplabel'); 
   003 
   004  hpgetprocplabel(Proc_Name, plabel, status); 
   005 
   006  if (status.all <> 0) or 
   007     (ccode <> 2) then 
   008     begin 
   009     writeln('status.subsys:', status.subsys); 
   010     writeln('status.info:  ', status.info); 
   011     end 
   012  else 
   013     begin 
   014     writeln('hpgetprocplabel successfully called'); 
   015     end; 
   016 
   017  Invoke_Proc := Proc_Type(plabel); { coerce 32 bit ptr to 64 bit } 
   018 
   019  prompt('Enter MPE XL Command:'); 
   020  readln(command_str); 
   021  cr 1  := chr(13); 
   022  strmove(1, cr, 1, str_cr, 1); 
   023  strappend(command_str, str_cr); 
   024  strmove(strlen(command_str), command_str, 1, command, 1); 
   025 
   026  CALL(Invoke_Proc, command, error, parm); 
   027 
   028  if error <> 0 then 
   029     begin 
   030     writeln('Error in command:', command); 
   031     catname := 'catalog.pub.sys '; 
   032     cicat   := fopen(catname, 5, octal('420')); 
   033     genmessage(cicat, 2, abs(error)); 
   034     fclose(cicat, 0, 0); 
   035     end; 
   036 
   037  end. 
    | 
 
 |