HPlogo System Debug Reference Manual > Chapter 10 System Debug Standard Functions

func cmproc

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Returns the CM procedure name and offset corresponding to a CM logical code address.

Syntax



   cmproc (cmlogaddr)

The string returned by CMPROC can be either of the two following formats:
  • ?entrypoint_name

  • or

  • procedure_name + base offset

Detailed descriptions of each of the above return strings follow:
entrypoint_name

The name of the CM entry point (primary/secondary).

procedure_name

The name of the CM procedure.

base

The output radix used to represent offset, which depends on the current output base.


   %    Octal
   $    Hexadecimal
   #    Decimal

offset

If the offset is nonzero, then it is returned, appended to the procedure name. The offset is formatted based on the current fill, justification, and output base values.

Formal Declaration



   cmproc:str (cmlogaddr:lcptr)

Parameters


cmlogaddr

The CM logical code address for which the CM symbolic procedure name/offset is to be returned.

Cmlogaddr must be a full CM logical code address (LCPTR). For example:

CMPC

Current CM program counter

CMPW+4

Top of CM program window + 4

PROG(2.102)

Program file logical seg 2 offset 102

fopen+102

CM procedure fopen + %102 (assumes CM mode)

cmaddr('fopen')+%102

CM procedure fopen + %102 (NM or CM mode)

Examples


Assume that the following single-segment CM program has been compiled, linked with the PMAP and FPMAP options, and is now being executed:

   PROGRAM test (input,output);

   PROCEDURE one;
   begin {one}
     writeln('ONE');
   end;  {one}

   PROCEDURE two;

       PROCEDURE three;
       begin {three}
         writeln('THREE');
       end;  {three}

   begin {two}
     writeln('TWO');
     three;
   end;  {two}

   begin {main body}  { Outer block is named "ob'" by the compiler }
     one;
     two;
   end.  {main body}


  PROGRAM FILE PTEST.DEMO.TELESUP

  SEG'              0
     NAME            STT  CODE ENTRY SEG
     OB'               1     0    13
     TERMINATE'        5               ?
     P'RESET           6               ?
     P'REWRITE         7               ?
     P'CLOSEIO        10               ?
     P'INITHEAP'3000  11               ?
     TWO               2    71   123
     P'WRITELN        12               ?
     P'WRITESTR       13               ?
     ONE               3   142   155
     SEGMENT LENGTH        210

  PRIMARY DB        2   INITIAL STACK  10240   CAPABILITY      600
  SECONDARY DB    430   INITIAL DL         0   TOTAL CODE      210
  TOTAL DB        432   MAXIMUM DATA       ?   TOTAL RECORDS    11
  ELAPSED TIME   00:00:01.365          PROCESSOR TIME   00:00.740

  END OF PREPARE


   %cmdebug > wl cmproc(prog(0.142))
   ONE+%0

   %cmdebug > wl cmproc(prog(0.155))
   ?ONE

   %cmdebug > wl cmproc(prog(0.147))
   ONE+%5

   %cmdebug > wl cmproc(prog(0.66))
   OB'+%66

   %cmdebug > wl cmproc(prog(0.101))
   TWO+%10


   %cmdebug > wl cmproc(sys(22.5000))
   ?FOPEN

   %cmdebug > wl cmproc(sys(22.5035))
   FOPEN+%41

   %cmdebug > wl cmproc(sys(22.5036))
   ?MUSTOPEN

   %cmdebug > wl cmproc(sys(22.5037))
   FOPEN+%43

The primary entry point ?FOPEN, and the secondary entry point ?MUSTOPEN are located, along with two other offsets within system SL procedure FOPEN.

Limitations, Restrictions


The names and addresses of nested CM procedures, such as procedure three, are not available within the CM FPMAP records. Addresses which fall within nested procedures (three) are returned as offsets relative to the parent procedure (two).




func cmnode


func cmproclen