         Edinburgh IMP77 Compiler - Version 8.4

    1  !***********************************************************************
    2  !*
    3  !*                    BCPL compiler steering routines
    4  !*
    5  !*                             Version E1.11
    6  !*
    7  !*       Copyright R.D. Eager   University of Kent   MCMLXXXIV
    8  !*
    9  !***********************************************************************
   10  !
   11  !
   12  !***********************************************************************
   13  !*
   14  !*          External references
   15  !*
   16  !***********************************************************************
   17  !
   18  %externalroutine compile(%string(255) s,%string(32) entry, %integername flag)
   19  %end
?FLAG unused
?ENTRY unused
?S unused
   20  %externalintegermap comreg(%integer n)
   21    %owninteger i
   22    %result == i
   23  %end
?N unused
   24  %externalstring(255)%function failuremessage(%integer mess)
   25    %result = "FAILURE: ".itos(mess, 0)
   26  %end
   27  %externalintegerfunction return code
   28    %result = 0
   29  %end
   30  %externalroutine setfname(%string(40) file)
   31  %end
?FILE unused
   32  !
   33  %externalintegerfunction icl9cezbcplx(%string(255) parms)
   34    %result = 0
   35  %end
?PARMS unused
   36  !
   37  !
   38  !***********************************************************************
   39  !*
   40  !*          S H U F F L E
   41  !*
   42  !*    This routine:
   43  !*      a) Moves any keyword parameters out of the first four parameter
   44  !*         positions
   45  !*      b) Puts the first four parameters into CPARMS (for COMPILE)
   46  !*      c) Puts the rest of the parameters into S (for passing over
   47  !*         via COMREG(9))
   48  !*
   49  !***********************************************************************
   50  !
   51  %routine shuffle(%string(*)%name s,cparms)
   52  %integer i
   53  %string(255) work1,work2
   54  %string(255)%array p(1:4)
   55  !
   56  %if s = "?" %then %start;               ! Handle this specially
   57     cparms = ".IN,.NULL,.NULL,.NULL";    ! Never used really
   58  %else
   59     %for i = 1,1,4 %cycle
   60        p(i) = "";                        ! Initialise
   61     %repeat
   62     !
   63     s <- s.","
   64     %for i = 1,1,4 %cycle
   65        %exit %unless s -> p(i).(",").s
   66     %repeat
   67     !
   68     %cycle i = 1,1,4
   69        %if p(i) -> work1.("=").work2 %then %start
   70           s = p(i).",".s
   71           p(i) = ""
   72        %finish
   73     %repeat
   74     !
   75     cparms = p(1).",".p(2).",".p(3).",".p(4)
   76  %finish
   77  %end;   ! of shuffle
   78  !
   79  !
   80  !***********************************************************************
   81  !*
   82  !*          B C P L
   83  !*
   84  !***********************************************************************
   85  !
   86  %externalroutine bcpl(%string(255) parms)
   87  %integer flag
   88  %string(255) cparms,auxparms
   89  !
   90  setfname("")
   91  shuffle(parms,cparms)
   92  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
   93  comreg(9) = addr(auxparms);             ! Picked up by compiler
   94  !
   95  compile(cparms,"ICL9CEZBCPL1",flag)
   96  flag = return code
   97  flag = 0 %if flag = -1;                 ! INT:A
   98  %if 0 # flag < 1000 %then %start 
   99     newline
  100     printstring("BCPL fails -".failuremessage(flag))
  101  %finish
  102  %end;   ! of bcpl
  103  !
  104  !
  105  !***********************************************************************
  106  !*
  107  !*          B C P L C G E N
  108  !*
  109  !***********************************************************************
  110  !
  111  %externalroutine bcplcgen(%string(255) parms)
  112  %integer flag
  113  %string(255) cparms,auxparms
  114  !
  115  setfname("")
  116  shuffle(parms,cparms)
  117  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  118  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  119  !
  120  compile(cparms,"ICL9CEZBCPL2",flag)
  121  flag = return code
  122  flag = 0 %if flag = -1;                 ! INT:A
  123  %if 0 # flag < 1000 %then %start
  124     newline
  125     printstring("BCPLCGEN fails -".failuremessage(flag))
  126  %finish
  127  %end;   ! of bcplcgen
  128  !
  129  !
  130  !***********************************************************************
  131  !*
  132  !*          B C P L V
  133  !*
  134  !***********************************************************************
  135  !
  136  %externalroutine bcplv(%string(255) parms)
  137  %integer flag
  138  %string(255) cparms,auxparms
  139  !
  140  setfname("")
  141  shuffle(parms,cparms)
  142  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  143  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  144  !
  145  compile(cparms,"ICL9CEZBCPLV",flag)
  146  flag = return code
  147  flag = 0 %if flag = -1;                 ! INT:A
  148  %if 0 # flag < 1000 %then %start
  149     newline
  150     printstring("BCPLV fails -".failuremessage(flag))
  151  %finish
  152  %end;   ! of bcplv
  153  !
  154  !
  155  !***********************************************************************
  156  !*
  157  !*          B C P L W
  158  !*
  159  !***********************************************************************
  160  !
  161  %externalroutine bcplw(%string(255) parms)
  162  %integer flag
  163  %string(255) cparms,auxparms
  164  !
  165  setfname("")
  166  shuffle(parms,cparms)
  167  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  168  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  169  !
  170  compile(cparms,"ICL9CEZBCPLW",flag)
  171  flag = return code
  172  flag = 0 %if flag = -1;                 ! INT:A
  173  %if 0 # flag < 1000 %then %start
  174     newline
  175     printstring("BCPLW fails -".failuremessage(flag))
  176  %finish
  177  %end;   ! of bcplw
  178  !
  179  !
  180  !***********************************************************************
  181  !*
  182  !*          B C P L Z
  183  !*
  184  !***********************************************************************
  185  !
  186  %externalroutine bcplz(%string(255) parms)
  187  %integer flag
  188  %string(255) cparms,auxparms
  189  !
  190  setfname("")
  191  shuffle(parms,cparms)
  192  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  193  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  194  !
  195  compile(cparms,"ICL9CEZBCPLZ",flag)
  196  flag = return code
  197  flag = 0 %if flag = -1;                 ! INT:A
  198  %if 0 # flag < 1000 %then %start
  199     newline
  200     printstring("BCPLZ fails -".failuremessage(flag))
  201  %finish
  202  %end;   ! of bcplz
  203  !
  204  !
  205  !***********************************************************************
  206  !*
  207  !*          B C P L R
  208  !*
  209  !***********************************************************************
  210  !
  211  %externalroutine bcplr(%string(255) parms)
  212  %integer flag
  213  %string(255) cparms,auxparms
  214  !
  215  setfname("")
  216  shuffle(parms,cparms)
  217  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  218  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  219  !
  220  compile(cparms,"ICL9CEZBCPLR",flag)
  221  flag = return code
  222  flag = 0 %if flag = -1;                 ! INT:A
  223  %if 0 # flag < 1000 %then %start
  224     newline
  225     printstring("BCPLR fails -".failuremessage(flag))
  226  %finish
  227  %end;   ! of bcplr
  228  !
  229  !
  230  !***********************************************************************
  231  !*
  232  !*          B C P L Q
  233  !*
  234  !***********************************************************************
  235  !
  236  %externalroutine bcplq(%string(255) parms)
  237  %integer flag
  238  %string(255) cparms,auxparms
  239  !
  240  setfname("")
  241  shuffle(parms,cparms)
  242  auxparms = parms;                       ! Make copy, to ensure string is word-aligned
  243  comreg(9) = addr(auxparms);             ! Picked up by codegenerator
  244  !
  245  compile(cparms,"ICL9CEZBCPLQ",flag)
  246  flag = return code
  247  flag = 0 %if flag = -1;                 ! INT:A
  248  %if 0 # flag < 1000 %then %start
  249     newline
  250     printstring("BCPLQ fails -".failuremessage(flag))
  251  %finish
  252  %end;   ! of bcplq
  253  !
  254  !
  255  !***********************************************************************
  256  !*
  257  !*          B C P L X R E F
  258  !*
  259  !***********************************************************************
  260  !
  261  %externalroutine bcplxref(%string(255) parms)
  262  %integer flag
  263  !
  264  setfname("")
  265  flag = icl9cezbcplx(parms)
  266  flag = 0 %if flag = -1;                 ! INT:A
  267  %if 0 # flag < 1000 %then %start
  268     newline
  269     printstring("BCPLXREF fails -".failuremessage(flag))
  270  %finish
  271  %end;   ! of bcplxref
  272  
  273  %begin
  274    bcpl("")
  275  %end
  276  
  277  %endoffile

  159 Statements compiled
