.PROC,COMPCYB*I,
I "- source input file name"         = (*F),
L "- listing output file name"       = (*F),
B "- binary output library name"     = (*F),
LO "- listing options"               = (*S6(AFORSWX),*N=SX),
UN "- NOS/BE perm file id"           = (*F,*N=),
.
.HELP
 The COMPCYB procedure compiles a CYBIL_CC source program and
 places the output binaries into a specified library. This procedure
 is used as the Cyber 170 half of a NOS/VE CYBIL_CC "cross compiler".

 Parameter   Default   Description
   Name       Value

   I          none     Source input file to be assembled
   L          none     Listing output file to be produced
   B          none     Binary library to receive output
   LO          SX      Listing options as per CYBILC assembler
   UN                  perm file id

.HELP,I
 The I parameter specifies the input source file. This file may be
 local or permanent.
.HELP,L
 The L parameter specifies the output listing file. This file will
 be permanent.
.HELP,B
 The B parameter specifies the binary output library. The output
 binary modules will be added to this library, or replaced in this
 library as appropriate.
.HELP,LO
 The LO parameter specifies the listing options. If not supplied
 then source listing only will be used.
.HELP,UN
 The UN parameter specifies a permanent file ID on NOS/BE systems. This
 parameter must not be specified on NOS.
.ENDHELP
.IF,SYS.EQ.NOSB,CHECKUN.
  REQUEST,YYYYYDF,PF.
  REQUEST,L,PF.
  .IF,$UN$.EQ.$$,BADUN.
    NOTE(OUTPUT); THE #UN PARAMETER MUST BE SPECIFIED.
    REVERT,ABORT.
  .ENDIF,BADUN.
.ELSE,CHECKUN.
  .IF,$UN$.NE.$$,BADUN2.
    REVERT,ABORT. NO #UN PARAMETER ON NOS
  .ENDIF,BADUN2.
.ENDIF,CHECKUN.
GETFILE(YCMP,I,UN,READ,NO)
IFE(FILE(YCMP,.NOT.AS),NOSOURCE)
  .IF,SYS.EQ.NOS.NOEXIT.
  DAYFILE(#L=YYYYYDF,FR=COMPCYB,OP=M)
  REPFILE(YYYYYDF,YYYYYDF,PRIVATE,READ,,UN)
  .IF,SYS.EQ.NOS.ONEXIT.
  UNLOAD(YYYYYDF)
  NOTE(OUTPUT,NR); THE #UN PARAMETER MUST BE SPECIFIED.
  REVERT(ABORT) INPUT SOURCE NOT FOUND
ENDIF(NOSOURCE)
.IF,SYS.EQ.NOS,NOSSYS.
  SES.CYBIL,#I=YCMP,#L=L,#B=LGO,#LO=LO.
.ELSE,NOSSYS.
  GETFILE,CYBIL,CYBIL,CYBIL,READ,YES.
  GETFILE,CYBCLIB,CYBCLIB,CYBIL,READ,YES.
CYBIL,#I=YCMP,#L=L,#B=LGO,#LO=LO.
.ENDIF,NOSSYS.
SKIP(ASSEMOK)
  EXIT(S)
  .IF,SYS.EQ.NOS.NOEXIT.
  REPFILE(L,L,PRIVATE,READ,,UN)
  DAYFILE(#L=YYYYYDF,FR=COMPCYB,OP=M)
  REPFILE(YYYYYDF,YYYYYDF,PRIVATE,READ,,UN)
  .IF,SYS.EQ.NOS.ONEXIT.
  UNLOAD(CYBIL,CYBCLIB)
  UNLOAD(YYYYYDF,YCMP,LGO,L)
  NOTE(OUTPUT,NR); COMPILATION ERRORS
  REVERT(ABORT) COMPILATION ERRORS
ENDIF(ASSEMOK)
REPFILE(L,L,PRIVATE,READ,,UN)
SKIP(REPFILEOK)
  EXIT(S)
  .IF,SYS.EQ.NOS.NOEXIT.
  DAYFILE(#L=YYYYYDF,FR=COMPCYB,OP=M)
  REPFILE(YYYYYDF,YYYYYDF,PRIVATE,READ,,UN)
  .IF,SYS.EQ.NOS.ONEXIT.
  UNLOAD(CYBIL,CYBCLIB)
  UNLOAD(YYYYYDF,YCMP,LGO,L,B)
  NOTE(OUTPUT,NR); LISTING REPLACE FAILED
  REVERT(ABORT) LISTING REPLACE FAILED
ENDIF(REPFILEOK)
REPLIB(LGO,B,,UN)
SKIP(REPLIBOK)
  EXIT(S)
  .IF,SYS.EQ.NOS.NOEXIT.
  DAYFILE(#L=YYYYYDF,FR=COMPCYB,OP=M)
  REPFILE(YYYYYDF,YYYYYDF,PRIVATE,READ,,UN)
  .IF,SYS.EQ.NOS.ONEXIT.
  UNLOAD(CYBIL,CYBCLIB)
  UNLOAD(YYYYYDF,YCMP,LGO,L,B)
  NOTE(OUTPUT,NR); LIBRARY UPDATE FAILED
  REVERT(ABORT) LIBRARY UPDATE FAILED
ENDIF(REPLIBOK)
.IF,SYS.EQ.NOS.NOEXIT.
DAYFILE(#L=YYYYYDF,FR=COMPCYB,OP=M)
REPFILE(YYYYYDF,YYYYYDF,PRIVATE,READ,,UN)
.IF,SYS.EQ.NOS.ONEXIT.
UNLOAD(CYBIL,CYBCLIB)
UNLOAD(YYYYYDF,YCMP,LGO,L,B)
REVERT. COMPILED I --> B
/EOR
