         << LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION >>     00000001
   Added functionality to AVREC and  RECOGNIZE  so  that  they <<S9201>>00890000
can be told not to do a REMRITENTRY call. The call AWAKEns the <<S9201>>00895000
user process.  If RECOGNIZE is called by PVPROC on behalf of a <<S9201>>00900000
serial disc coming on line, the user process runs  before  PV- <<S9201>>00901010
PROC has restored its serial disc environment to the LDTX. The <<S9201>>00901020
enhancement (a new entry, RECOGNIZE', and  support  in  AVREC) <<S9201>>00901030
bypasses  the  two REMRITENTRY calls and returns the user pro- <<S9201>>00901040
cess PIN to PVPROC, who will make the REMRITENTRY call when it <<S9201>>00901050
is safe.                                                       <<S9201>>00901060
   Fixed two minor bugs in LINKLABEL and CKFORLDEV--they  were <<S9201>>00901070
setting  CCL in their caller's stack marker, not in the proce- <<S9201>>00901080
dure itself.                                                   <<S9201>>00901090
   Made SETOWNED available outside Labseg.                     <<09418>>00901100
   Restricted VCB'DENSITY check in LINKLABEL to tapes (i.e.,   <<09418>>00901110
no SDISCs).                                                    <<09418>>00901120
   Made BUFFER of REELSWITCH a direct array, because comments  <<09418>>00901130
indicate DB can be anywhere (split-stack callable).            <<09418>>00901140
<< Resequenced source, August, 1984.                        >> <<S9201>>00911000
      L1GENNUM =BTLABEL(35)#, <<only meaningful to IBM system>><<s9513>>01355100
      L1VERSIONNUM                                             <<s9513>>01355200
               =BTLABEL(39)#, <<only meaningful to IBM system>><<s9513>>01355300
   OPTION PRIVILEGED, UNCALLABLE;                              <<09418>>02600000
   MOVE L1GENNUM := "0001";       << default value >>          <<s9513>>05771000
   MOVE L1VERSIONNUM := "00";    <<default value >>            <<s9513>>05772000
$EDIT VOID=08625000                                            <<S9201>>08570000
!   AVREC parses COUNT words in BUFF to see if the record is a <<S9201>>08571000
! tape label.  The action taken depends on the answer  and  on <<S9201>>08572000
! who called us:                                               <<S9201>>08573000
!   DEVREC reads a newly mounted tape, then passes the  record <<S9201>>08574000
! to us to admire. If it's a tape label, and there's a process <<S9201>>08575000
! waiting for that tape, the process is restarted  by  pulling <<S9201>>08576000
! its entry out of the Reply Information Table (RIT).          <<S9201>>08577000
!   LINKLABEL (for tapes) and PVPROC (for  serial  discs)  use <<S9201>>08578000
! RECOGNIZE to read their device.  RECOGNIZE passes us the re- <<S9201>>08579000
! cord it got.  For LINKLABEL, the behavior is the same as for <<S9201>>08580000
! DEVREC.  If this all started with PVPROC, we can't afford to <<S9201>>08581000
! wake the user process, because PVPROC has exchanged the user <<S9201>>08582000
! process SDISC environment (in the device's LDTX  entry)  for <<S9201>>08583000
! one of its own.  For this situation, the user process PIN is <<S9201>>08584000
! passed up to PVPROC, who will AWAKEn the process when it  is <<S9201>>08585000
! safe.                                                        <<S9201>>08586000
!   To constitute a match, both the volume label  and  a  user <<S9201>>08587000
! header label must match their counterparts in the Tape Label <<S9201>>08588000
! Table.  If the volume label fails to match, there is no rea- <<S9201>>08589000
! son to read a header label.  If a header label must be read, <<S9201>>08590000
! AVREC cannot do it. This is because we may be called by DEV- <<S9201>>08591000
! REC, which must not be blocked on our I/O.  Callers must  do <<S9201>>08592000
! any needed I/O.                                              <<S9201>>08593000
!                                                              <<S9201>>08594000
!   Inputs:   LDEV -- the device the record was read from.     <<S9201>>08595000
!             BUFF -- the array containing the record.         <<S9201>>08596000
!             COUNT -- significant words (> 0) in BUFF.        <<S9201>>08597000
!             CMD.(2:14) -- < 2, assume BUFF is volume label.  <<S9201>>08598000
!                           >=2, assume BUFF is header label.  <<S9201>>08599000
!             CMD.(1:1)  -- 0, call REMRITENTRY here if req'd. <<S9201>>08600000
!                           1, don't call, return PIN for  PV- <<S9201>>08601000
!                             PROC to use (new functionality). <<S9201>>08602000
!                                                              <<S9201>>08603000
!   Returns:  AVREC -- FALSE (0).  Processed volume label, and <<S9201>>08604000
!                        caller must  read  header  label  and <<S9201>>08605000
!                        call AVREC again.                     <<S9201>>08606000
!                      TRUE (-1).  Need not call  again.  Tape <<S9201>>08607000
!                        is  unlabeled  (processing volume la- <<S9201>>08608000
!                        bel), or header label has  been  pro- <<S9201>>08609000
!                        cessed.  CMD.(1:1)  was  0 -OR- there <<S9201>>08610000
!                        was no PIN to return to PVPROC.       <<S9201>>08611000
!                      >0 -- The PIN which PVPROC  should  use <<S9201>>08612000
!                        in its REMRITENTRY call. Returned on- <<S9201>>08613000
!                        ly if CMD.(1:1) is 1 -AND- the  local <<S9201>>08614000
!                        REMRITENTRY  call was skipped because <<S9201>>08615000
!                        of it.                                <<S9201>>08616000
!                                                              <<S9201>>08617000
!   The net result of all this is that  DEVREC  and  LINKLABEL <<S9201>>08618000
! continue   as  they  have,  RECOGNIZE  is  enhanced  to  set <<S9201>>08619000
! CMD.(1:1) if the alternate entry point (RECOGNIZE') is used, <<S9201>>08620000
! and PVPROC is enhanced to call RECOGNIZE'.                   <<S9201>>08621000
   RESULT := FALSE;                                            <<S9201>>08729000
   IF CMD.(2:14) >= 2 THEN GO TRYH1;                           <<S9201>>08790000
         IF LOGICAL (CMD.(1:1)) THEN                           <<S9201>>09084000
            RESULT := VCB'PIN                                  <<S9201>>09085000
         ELSE REMRITENTRY (VCB'PIN);                           <<S9201>>09086000
   IF VCB'RSWAIT THEN                                          <<S9201>>09260000
      IF LOGICAL (CMD.(1:1)) THEN                              <<S9201>>09261000
         RESULT := VCB'PIN                                     <<S9201>>09262000
      ELSE REMRITENTRY (VCB'PIN);                              <<S9201>>09263000
$PAGE "RECOGNIZE, RECOGNIZE'"                                  <<S9201>>09275000
INTEGER PROCEDURE RECOGNIZE (LDEV);                            <<S9201>>09280000
$EDIT VOID=09310000                                            <<S9201>>09300000
!   RECOGNIZE, for tapes, is a DEVREC subsitute, used  when  a <<S9201>>09300200
! tape drive is on-line when the system comes up. In this case <<S9201>>09300400
! there is no interrupt to cause DEVREC to run,  so  LINKLABEL <<S9201>>09300600
! calls us and we read the tape instead. We then pass the con- <<S9201>>09300800
! tents to AVREC, just as DEVREC would have.                   <<S9201>>09301000
!   For serial discs it works differently.  At present,  there <<S9201>>09301200
! is  no  way  to handle a serial disc device which is on-line <<S9201>>09301400
! when the system comes up.  An on-line interrupt must  occur, <<S9201>>09301600
! at  which  time  DEVREC runs, wakes PVPROC, and PVPROC calls <<S9201>>09301800
! us.  The original design sought to make the  difference  be- <<S9201>>09302000
! tween  tapes  and serial discs as invisible to RECOGNIZE and <<S9201>>09302200
! AVREC as possible.  To do this, PVPROC set up a serial  disc <<S9201>>09302400
! environment so that RECOGNIZE could make standard ATTACHIO   <<S9201>>09302600
! tape calls and process whatever came back.  Trouble is,  PV- <<S9201>>09302800
! PROC  and  the  user process must share some serial disc re- <<S9201>>09303000
! sources, so the two processes must be carefully synchronized <<S9201>>09303200
! to make sure they don't step on each other.  This fix  takes <<S9201>>09303400
! care of one such problem. A REMRITENTRY call in AVREC caused <<S9201>>09303600
! the user process to run before PVPROC had replaced its seri- <<S9201>>09303800
! al disc environment.                                         <<S9201>>09304000
!   Making RECOGNIZE a functional procedure and adding the al- <<S9201>>09304200
! ternate entry point, RECOGNIZE', together  with  support  in <<S9201>>09304400
! AVREC,  solves this problem.  If RECOGNIZE' is called, AVREC <<S9201>>09304600
! omits the REMRITENTRY call, passing the associated PIN  back <<S9201>>09304800
! to  us  to  pass on to our caller (currently only PVPROC) in <<S9201>>09305000
! the functional result.  The caller is then  responsible  for <<S9201>>09305200
! doing the REMRITENTRY call when it is safe.                  <<S9201>>09305400
!   The functionality of RECOGNIZE and AVREC are  not  changed <<S9201>>09305600
! when the original entry point is used.                       <<S9201>>09305800
                                                               <<S9201>>09321000
ENTRY                                                          <<S9201>>09322000
   RECOGNIZE';                                                 <<S9201>>09323000
                                                               <<S9201>>09324000
   INTEGER RESULT = RECOGNIZE;                                 <<S9201>>09336000
   LOGICAL NOWAKE;                                             <<S9201>>09337000
                                                               <<S9201>>09346000
   NOWAKE := FALSE;                                            <<S9201>>09347000
   WHILE FALSE DO                                              <<S9201>>09348000
                                                               <<S9201>>09349000
RECOGNIZE':                                                    <<S9201>>09349100
                                                               <<S9201>>09349200
      NOWAKE := TRUE;                                          <<S9201>>09349300
   RESULT := 0;                                                <<S9201>>09349400
   IF NOWAKE THEN CMD.(1:1) := 1;                              <<S9201>>09541000
   RESULT := AVREC (LDEV, TLABEL, COUNT, CMD);                 <<S9201>>09640000
   IF RESULT = 0 THEN GO LOOP;                                 <<S9201>>09641000
                                                               <<S9201>>09644100
<< If AVREC is done, but with no PIN to wake, it returns -1 >> <<S9201>>09644200
<< (TRUE). Hide this from caller, so that the test there is >> <<S9201>>09644300
<< simply 0 or non-0.                                       >> <<S9201>>09644400
                                                               <<S9201>>09644500
   IF RESULT = -1 THEN RESULT := 0;                            <<S9201>>09645000
   RECOGNIZE := RESULT;                                        <<S9201>>09646000
      IF NOT LCB'TAPE THEN GO BUGOPR;  << Don't RECOG SDISC >> <<S9201>>10545000
      RECOGNIZE (LDEV);                                        <<S9201>>10550000
      IF TAPE'DEVICE THEN                                      <<09418>>10806000
         IF (LPDT'AUTO'SUBTYPE = HP7976) OR                    <<09418>>10810000
            (LPDT'AUTO'SUBTYPE = HP7978) THEN                  <<09418>>10815000
            VCB'DENSITY := LDT'DENSITY'6250                    <<09418>>10820000
         ELSE    << HP7974 or HP7970 (not used) >>             <<09418>>10825000
            VCB'DENSITY := LDT'DENSITY'1600;                   <<09418>>10830000
   INTEGER ARRAY BUFFER(0:30) = Q;                             <<09418>>11330000
      IF NOT LCB'TAPE THEN GO ERREXIT; << Don't RECOG SDISC >> <<S9201>>16055000
      RECOGNIZE (LDEV);                                        <<S9201>>16060000
