Trailing-Edge - PDP-10 Archives - decuslib20-11 - decus/20-192/curel.doc
There are no other files named curel.doc in the archive.

7.2 CUrel Utility Subroutines

CUrel.rel is an indexed library that can be searched for the handlers for the
Columbia UUOs for COMND Jsys calls and formatted printing (described in
CUUOs.doc) and for the routines described below.

7.2.1 Helper

Types the desired help file at the job's controlling terminal.  Actually, it
will type any 7-bit ASCII file, but the error messages all refer to help

  t2/ 7-bit byte pointer to ASCIZ filespec.

  If the specified file is found and accessible then it is typed,
  otherwise an appropriate error message is typed.

Returns +1 always.

Calling sequence:

        search  CUsym
        extern  helper
        move    t2, [point 7, [asciz\HLP:FILE.HLP\]]
        call    helper

- F. da Cruz, CUCCA, 1978

7.2.2 GetOK

Get affirmative or negative response to a question, using the COMND Jsys (help
is given on '?', recognition on ESC).

A default answer can be specified, which will be supplied automatically if the
user types carriage return alone in response to the question.


  t1/ 7-bit byte pointer to ASCIZ string posing the question.
  t2/ zero -- no default answer.
      positive (nonzero) -- default answer is "yes".
      negative -- default is "no".

  +1 if response was negative.
  +2 if response was affirmative.

  Don't call this routine while processing
  another COMND Jsys (i.e. after .CMINI but before .CMCFM).


        move t1, [point 7, [asciz\Really delete all your files? \]]
        move t2, [-1]           ; default is 'no'.
        call getok
         jrst dont              ; answer was no, don't do it.

        ; code here will be executed if answer was 'yes'.

- F. da Cruz, C. Ryland, CUCCA, 1978

7.2.3 Gfcpg

This routine will allocate a page to the user.  This is useful, for instance,
when PMAPping is to be done to a single page in memory.

 +1: error, no free core pages;
 +2: success, page number in t1.

        call %gfcpg
         %ermsg <couldn't get a page>,nopage ; do this on +1 return

        ; come here when a page has been successfully allocated

- George Lotridge (DEC), CUCCA, 1977

7.2.4 pagMgr

A page management facility.  Gives greater functionality that gfcpg at a
slightly greater cost in overhead.  Allows allocation and deallocation of
consecutive blocks of pages.  Keeps an internal 'own' page table for page

Call with:

  Function codes in t1:
        0: Get pages, searching from 770 -> 0.
        1: Get pages, searching from 0 -> 770.
        2: Free pages.
        3: Initialize the pages-in-use vector.
             (this is done automatically the first time this routine
              is called, before the selected function is executed).

  Arguments in t2:
        For get-page functions:
          Left half contains number of consecutive pages to get,
          Right half contains starting page number to search from.

        For free-page function:
          Left half contains number of consecutive pages to free,
          Right half contains starting page number to free from.

        (in these functions, if the number of pages given is 0,
         it will be treated as 1.)

        For reinitialize function:
          t2 is not examined.

  +1: Not enough pages available; t2 contains maximum
      number available of type requested.
      If there was an error on initialization (e.g. invalid argument),
      a message is typed at the terminal, and t1 is set to -1.

  +2: t1/ Address of block of pages in right half, and page
          number in the left.
      t2/ page count.

Joel Rosenblatt, CUCCA, 1978.

7.2.5 Subbp

Subroutine to subtract two byte pointers, i.e. to tell the number of bytes
between the bytes pointed by the first one and the second one.  The two byte
pointers must point to bytes of the same size.  Indirection (@) and indexing
is handled properly.

Call with:
  t1/ First byte pointer.
  t2/ Second byte pointer.

  +1 if the byte sizes are different, with t1-t3 unchanged, or else
  +2 with:
    t1/ Unchanged.
    t2/ Unchanged.
    t3/ The number of bytes of the specified bytesize in
        thee string pointed to by the first byte pointer (in t1)
        up to, but  not including, the byte pointed to by the
        second byte pointer (in t2).


        ; assume a SIN has just been done to get a string into location
        ;  'buffer'. SIN returns the updated byte pointer in t2.  This
        ;  call to Subbp will tell how many characters were in the string.

        move t1, [point 7, buffer] ; Point to beginning of buffer.
        call subbp              ; (t2 already has the pointer to the end).
         %ermsg <bytesize error>,error  ; Do this on error.
        movem t3, count         ; Save the byte count.

- F. da Cruz, CUCCA, November 1977

7.2.6 Rescan

Allow arguments to be passed to programs via the Exec command line.

Look in the rescan buffer for the name of the calling program followed by any
arguments.  If the first field found in the rescan buffer is not the same as
the program name, or if the program name matches but there are no arguments
after it then this routine returns +2 with no other effect.  Otherwise it
returns +1 to indicate that special handling (usually the setting of a flag)
can be done.

Enter with:
   t1/  Byte pointer to asciz program name.

   +1: If arguments found in rescan buffer,
        with updated pointer in t1.
           +2: otherwise.

        extern Rescan

        %trnOff rscFlg          ; Assume no rescan args.
        move t1, [point 7, [asciz/foo/]] ; Name of this program.
        call rescan             ; Rescan args on command line?
         %trnOn rscFlg          ;  Yes, turn on the flag.

If arguments were detected then subsequent requests for tty input will be
satisfied by the data in the rescan buffer until the rescan buffer is
exhausted or the program issues a .CMINI (or otherwise clears the input
buffer), at which time tty input will automatically revert to the physical
tty.  The caller should skip over the first .CMINI after return from this
routine, which has already issued a .CMINI.

The contents of the rescan buffer are discarded if the first field found on
rescan does not match the program name passed in t1.

- Jeff Langer, CUCCA, April 1979


          Byte Pointer   146

          COMND   144
          CUrel   144

          GetOK   144

          Help Message   144

          Page   145

          Rescan   147

          SIN   147

          UUO   144

                              Table of Contents

7.2 CUrel Utility Subroutines                                              144
     7.2.1 Helper                                                          144
     7.2.2 GetOK                                                           144
     7.2.3 Gfcpg                                                           145
     7.2.4 pagMgr                                                          145
     7.2.5 Subbp                                                           146
     7.2.6 Rescan                                                          147

Index                                                                      149