Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50202/reusr2.for
There are 6 other files named reusr2.for in the archive. Click here to see a list.
      SUBROUTINE REUSER
C     RENBR(REUSR2/DIALOG OF SWITCHES THEN NAMES 1 PER LINE
C
C     DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C     THIS VERSION  OF THE   USER  COMMAND DIALOG PROCESSOR
C     FOR RENBR RUNS ON THE PDP-10 COMPUTER.  COMMAND TYPED
C     BY THE USER CONSISTS OF 1 OR  SEVERAL  SWITCHES  WITH
C     NUMERIC ARGUMENTS.  FILE NAMES WILL BE ACCEPTED 1 PER
C     LINE IF A /D SWITCH IS ISSUED.  ONLY A  SINGLE  INPUT
C     FILE  CAN  BE  PROCESSED DURING A SINGLE EXECUTION OF
C     THIS PROGRAM.
C
      COMMON/RNBONE/I     ,IALPHA,IBASE ,IBR   ,IBREAK,
     1IEND  ,IENTER,IEOF  ,IERR  ,IFILL ,IFORM ,IHIHDO,
     2IIN   ,ILEVEL,ILPT  ,INCR  ,INCSAV,INDENT,INITOC,
     3INRCPY,INRFND,INIOPR,IOUT  ,IPAGE ,IPASS ,ISPACE,
     4ISPLIT,ISPR  ,ISTART,ISTN  ,ITAB  ,ITBL  ,ITITLE,
     5ITTY  ,J     ,JBGN  ,JBREAK,JEND  ,JEOF  ,JFORM ,
     6JIN   ,JIN1  ,JLEVEL,JMPBGN,JMPEND,JOUT  ,JPASS ,
     7JSPLIT,JSTN  ,JTAB  ,JTTY  ,K     ,KLEVEL,KNDGRP,
     8KNT   ,MAXPRT,KNTONE,KNTPNT,KNTSPL,KNTTOC,KNTTWO,
     9KOMENT,KOMKNT,KOMNUM,KONTRL,KOUNT ,KPAGE
      COMMON/RNBTWO/MASTER,KPYEND,KSTN  ,KTAB  ,KUTNUM,
     1KUTPNT,KUTSPL,L     ,LCLNUM,LCLPNT,LCLSPL,LEFT  ,
     2LIKE  ,LMTTOC,LOW1  ,LOW2  ,LOWDO ,LOWER ,
     3LPTTTY,LRGSPL,LRGNUM,LRGPNT,LRGTOC,LSTKNT,LSTN  ,
     4LSTSTN,LTAB  ,M     ,MANY  ,MAXEND,MAXLIN,MAXPNT,
     5MAXSPL,MAXTOC,MID   ,MOST  ,MOVE  ,MSTN  ,MTAB  ,
     6N     ,NCD   ,NEED  ,NEWNUM,NEWSTN,NONFOR,
     7NSTN  ,NUM   ,LOWTOC,NXTLST,IPOINT,JPOINT,NXTEND,
     8KEND  ,NTAB  ,IFREAR,KPOINT,KBGN  ,LEND  ,LNGNAM,
     9LOWSHO,ININAM,JTBL  ,NOWTOC,LPOINT,INIPRT,JOBNUM
      COMMON/RNBTHR/MODBAS,MODINC,MODMAX,MODMIN,MODNEW,
     1MODOLD,KMDMIN,KMDMAX,ITRACE,LNGCOM,LNGNXT,KPASS
      COMMON/RNBFOU/INRSTR(21)  ,JPNT  (10)  ,MCHOPR(50)  ,
     1 NNEW  (1000),NOLD  (1000),NOTOPR(50)  ,NUMPNT(5000),
     2 NUMPRS(515) ,NUMTOC(112) ,NUMTYP(7)   ,LINREF(9)
      COMMON/RNBFIV/LTRCCC,LTRCLN,LTREQL,LTREXC,LTRHHH,
     1LTRLFT,LTRMNS,LTRPLS,LTRQOT,LTRRIT,LTRSEM,LTRSLA,
     2LTRSPC,LTRTAB,LWRCCC,LWRHHH,LTRNOW,LTR1ST,LTR2ND,
     3LTRREF,LTRDDD,LWRDDD,LTREEE,LWREEE,LTRDOT,LTRSTR
      COMMON/RNBSIX/LTRABC(26)  ,LTRBGN(5)   ,LTRBIG(2211),
     1 LTRDGT(10)  ,LTREND(3)   ,LTRFLG(7)   ,LTRKEY(5)   ,
     2 LTROPR(50)  ,LTRPRS(247) ,LTRSPL(2000),LTRTOC(168) ,
     3 LTRTOP(117) ,LTRTTL(5)   ,LTRTYP(55)  ,LTRUSE(6)   ,
     4 LWRABC(26)  ,LWRBGN(5)   ,LWREND(3)   ,LWRFLG(7)   ,
     5 LWRKEY(5)   ,LWRPRS(247) ,LWRTTL(5)   ,LTRNAM(10)  ,
     6 LTRSRT(26)  ,LWRSRT(26)  ,LTR120(120)
C
      DOUBLE PRECISION FILSRC,FILRNB,FILLPT,FILSPC
      DATA FILSPC/10H          /
C
C     CLEAR DEFAULT VALUES
      JPASS=1
      IF(MASTER.EQ.0)GO TO 2
      IF(MASTER.NE.1)GO TO 78
      WRITE(ITTY,1)
    1 FORMAT(14H RENBR (01/79)/17H Type /H for Help)
    2 JIN=JTAB
      JBGN=IFORM
      JEND=JFORM
    3 IPAGE=0
      ISPACE=0
      INCR=0
      IBASE=0
      INDENT=0
      ISPLIT=0
      IFILL=0
      ITAB=0
      IFORM=JBGN
      JFORM=JEND
      JTAB=JIN
      LTAB=0
      ITBL=1
      JMPEND=0
      JMPBGN=0
      KMDMIN=0
      KMDMAX=0
      ITRACE=0
      WRITE(ITTY,4)
    4 FORMAT(2H *,$)
      READ(JTTY,5)(LTRBIG(I),I=1,70)
    5 FORMAT(70A1)
C
C     INTERPRET OPTIONS
      INDEX=0
      LPTTTY=0
    6 INDEX=INDEX+1
    7 IF(INDEX.GT.70)GO TO 46
      LTRNOW=LTRBIG(INDEX)
      IF(LTRNOW.EQ.LTRSPC)GO TO 6
      IF(LTRNOW.EQ.LTRTAB)GO TO 6
C
C     TEST LETTER TO DETERMINE WHAT OPTION IS DESIRED
    8 KNDFLG=0
    9 KNDFLG=KNDFLG+1
      IF(KNDFLG.GT.26)GO TO 6
      IF(LTRABC(KNDFLG).EQ.LTRNOW)GO TO 10
      IF(LWRABC(KNDFLG).NE.LTRNOW)GO TO 9
C     GO TO( A, B, C, D, E, F, G, H, I, J,
C    1       K, L, M, N, O, P, Q, R, S, T,
C    2       U, V, W, X, Y, Z),KNDFLG
   10 GO TO(21,19,14, 6,20,20,20,45,21,20,
     1      12,20,19, 6, 6,21, 6, 6,20,13,
     2      15,17,21, 6, 6,11),KNDFLG
   11 ITRACE=1
      GO TO 6
   12 ISPLIT=0
      GO TO 18
   13 ITAB=1
      GO TO 16
   14 ITAB=0
      GO TO 16
   15 ITAB=-1
   16 IF(INCR.EQ.0)INCR=1
      GO TO 6
   17 LPTTTY=1
   18 IF(IPAGE.EQ.0)IPAGE=1
      GO TO 6
   19 IF(INCR.EQ.0)INCR=1
      GO TO 21
   20 IF(IPAGE.EQ.0)IPAGE=1
C
C     EVALUATE NUMBER TO RIGHT OF LETTER
   21 NUMFLG=0
      KNDNUM=0
   22 INDEX=INDEX+1
      IF(INDEX.GT.70)GO TO 27
      LTRNOW=LTRBIG(INDEX)
      IF(LTRNOW.EQ.LTRSPC)GO TO 23
      IF(LTRNOW.NE.LTRTAB)GO TO 24
   23 IF(KNDNUM.LE.0)GO TO 22
      GO TO 27
   24 DO 26 L=1,10
      IF(LTRDGT(L).NE.LTRNOW)GO TO 26
      IF(KNDNUM.GT.1)GO TO 25
      KNDNUM=1
      NUMFLG=(10*NUMFLG)+L-1
      GO TO 22
   25 NUMFLG=(10*NUMFLG)-L+1
      GO TO 22
   26 CONTINUE
      IF(KNDNUM.GT.0)GO TO 27
      IF(LTRNOW.EQ.LTRPLS)KNDNUM=1
      IF(LTRNOW.EQ.LTRMNS)KNDNUM=2
      IF(KNDNUM.GT.0)GO TO 22
      IF(KNDNUM.NE.0)GO TO 27
      IF(LTRNOW.EQ.LTRCLN)KNDNUM=-1
      IF(KNDNUM.NE.0)GO TO 22
C     GO TO( A, B, C, D, E, F, G, H, I, J,
C    1       K, L, M, N, O, P, Q, R, S, T,
C    2       U, V, W, X, Y, Z,L/,J/,M/),KNDFLG
   27 INDEX=INDEX-1
      IF(KNDFLG.EQ.9)GO TO 39
      IF(NUMFLG.LT.0)NUMFLG=0
      GO TO(29,31, 6, 6,43,40,30, 6,39,32,
     1       7,41,33, 6, 6,28, 6, 6,44, 6,
     2       7, 6,37, 6, 6, 6,38,34,35),KNDFLG
   28 IPAGE=NUMFLG
      IF(IPAGE.EQ.0)IPAGE=1
      GO TO 6
   29 INDENT=NUMFLG
      IF(INDENT.EQ.0)INDENT=1
      GO TO 6
   30 ISPACE=NUMFLG
      IF(ISPACE.EQ.0)ISPACE=1
      GO TO 6
   31 IBASE=NUMFLG
      GO TO 6
   32 JMPBGN=NUMFLG
      KNDFLG=28
      GO TO 21
   33 KMDMIN=NUMFLG
      KNDFLG=29
      GO TO 21
   34 JMPEND=NUMFLG
      GO TO 6
   35 IF(NUMFLG.GT.0)GO TO 36
      IF(KMDMIN.GT.0)NUMFLG=99999
      IF(KMDMIN.EQ.0)KMDMIN=-1
   36 IF(KMDMIN.EQ.0)KMDMIN=1
      KMDMAX=NUMFLG
      GO TO 6
   37 JTAB=NUMFLG
      IF(JTAB.EQ.0)JTAB=JIN
      LTAB=1
      GO TO 6
   38 IF(NUMFLG.GT.10)IFORM=NUMFLG
      GO TO 6
   39 INCR=NUMFLG
      IF(INCR.EQ.0)INCR=1
      GO TO 6
   40 IFILL=0
      GO TO 42
   41 IFILL=1
   42 JFORM=NUMFLG
      IF(JFORM.LE.10)JFORM=JEND
      IFORM=JBGN
      IF(IFILL.EQ.0)GO TO 6
      IF(ISPLIT.EQ.0)ISPLIT=1
      IF(INDEX.GT.70)GO TO 6
      KNDFLG=27
      GO TO 21
   43 ITBL=NUMFLG+1
      IF(ITBL.EQ.1)ITBL=2
      GO TO 6
   44 ISPLIT=NUMFLG+1
      GO TO 6
C
C     ISSUE HELP MESSAGE
   45 CALL REHELP(ITTY)
      GO TO 3
C
C     REPORT OPTIONS SELECTED
   46 IF(IPAGE.NE.0)GO TO 47
      IF(INCR.NE.0)GO TO 47
      IF(MASTER.EQ.0)GO TO 89
      GO TO 3
   47 IF(INDENT.GT.0)WRITE(ITTY,48)INDENT
   48 FORMAT(4X,16HAdd Block Indent,1I5)
      IF(LTAB.NE.0)WRITE(ITTY,49)JTAB
   49 FORMAT(2X,18HWidth of Tab Stops,1I5)
      IF(IPAGE.EQ.0)GO TO 58
      WRITE(ITTY,50)IPAGE
   50 FORMAT(10X,15HListing Options/9X,11HPage Number,1I5)
      IF(ISPACE.NE.0)WRITE(ITTY,51)ISPACE
   51 FORMAT(2X,18HGap Interstatement,1I5)
      IF(IFILL.EQ.0)WRITE(ITTY,52)JFORM
   52 FORMAT(10X,10HForm Feeds,1I5)
      IF(IFILL.NE.0)WRITE(ITTY,53)JFORM,IFORM
   53 FORMAT(10X,10HLine Feeds,1I5,1H:,1I5)
      IF((JMPBGN+JMPEND).NE.0)WRITE(ITTY,54)JMPBGN,JMPEND
   54 FORMAT(2X,18HJump at Top/Bottom,1I5,1H:,1I5)
      IF(ISPLIT.EQ.0)WRITE(ITTY,55)
   55 FORMAT(3X,17HKeep Lines Intact)
      I=ISPLIT-1
      IF(ISPLIT.NE.0)WRITE(ITTY,56)I
   56 FORMAT(4X,16HSplit Long Lines,1I5)
      I=ITBL-1
      IF(I.NE.0)WRITE(ITTY,57)I
   57 FORMAT(1X,19HExtra Table Content,1I5)
      IF(INCR.EQ.0)GO TO 70
   58 WRITE(ITTY,59)
   59 FORMAT(6X,19HRenumbering Options)
      IF(KMDMIN.GT.0)GO TO 61
      IF(KMDMIN.EQ.0)GO TO 63
      WRITE(ITTY,60)
   60 FORMAT(2X,18HMaintain Numbering)
      GO TO 66
   61 WRITE(ITTY,62)KMDMIN,KMDMAX
   62 FORMAT(3X,17HModify Only Range,1I5,1H:,1I5)
   63 WRITE(ITTY,64)INCR
   64 FORMAT(11X,9HIncrement,1I5)
      IF(IBASE.NE.0)WRITE(ITTY,65)IBASE
   65 FORMAT(16X,4HBase,1I5)
   66 IF(ITAB.LT.0)WRITE(ITTY,67)
   67 FORMAT(20H Uniform Left Margin)
      IF(ITAB.EQ.0)WRITE(ITTY,68)
   68 FORMAT(7X,13HColumn Format)
      IF(ITAB.GT.0)WRITE(ITTY,69)
   69 FORMAT(10X,10HTab Format)
C
C     OPEN LISTING FILE
   70 IF(IPAGE.LE.0)GO TO 76
      WRITE(ITTY,71)
   71 FORMAT(16H Listing Title: ,$)
      READ(JTTY,72)(LTRTOP(I),I=1,54)
   72 FORMAT(54A1)
      IF(LPTTTY.NE.0)GO TO 75
   73 WRITE(ITTY,74)
   74 FORMAT(25H    Output Listing File: ,$)
      READ(JTTY,81)FILLPT
      IF(FILLPT.EQ.FILSPC)GO TO 73
      OPEN(UNIT=ILPT,FILE=FILLPT,ACCESS='SEQOUT',
     1DEVICE='LPT')
      GO TO 76
   75 OPEN(UNIT=ILPT,FILE=FILLPT,ACCESS='SEQOUT',
     1DEVICE='TTY')
C
C     OPEN RENUMBERED OUTPUT FILE
   76 IF(INCR.EQ.0)GO TO 79
      WRITE(ITTY,77)
   77 FORMAT(25H Output Renumbered File: ,$)
      READ(JTTY,81)FILRNB
      IF(FILRNB.EQ.FILSPC)GO TO 76
      OPEN(UNIT=IOUT,FILE=FILRNB,ACCESS='SEQOUT')
      GO TO 79
C
C     OPEN INPUT FILE
   78 CLOSE(UNIT=IIN)
      IF(LPTTTY.NE.0)GO TO 89
   79 WRITE(ITTY,80)
   80 FORMAT(25H      Input Source File: ,$)
      READ(JTTY,81)FILSRC
   81 FORMAT(1A10)
      IF(FILSRC.EQ.FILSPC)GO TO 84
      OPEN(UNIT=IIN,FILE=FILSRC,ACCESS='SEQIN',ERR=82)
      IF(MASTER.EQ.1)GO TO 86
      GO TO 90
   82 WRITE(ITTY,83)
   83 FORMAT(20H File cannot be read)
      GO TO 79
   84 IF(MASTER.NE.1)GO TO 89
      WRITE(ITTY,85)
   85 FORMAT(35H First input file must be specified)
      GO TO 79
C
C     POSITION PAPER IF TELETYPE OUTPUT
   86 IF(IPAGE.EQ.0)GO TO 90
      IF(LPTTTY.EQ.0)GO TO 90
      IF(IFILL.EQ.0)GO TO 90
      WRITE(ITTY,87)
   87 FORMAT(1X/15H Position paper,
     137H (carriage return or local line feed)/
     230H then type non-space character,
     320H and carriage return)
   88 READ(JTTY,5)LTRNOW
      IF(LTRNOW.EQ.LTRSPC)GO TO 88
      GO TO 90
C
C     RETURN TO CALLING PROGRAM
   89 JPASS=0
   90 RETURN
C820263007417$:'
      END
      SUBROUTINE REHELP(ITTY)
C     RENBR(REHLP2/DIALOG OF SWITCHES THEN NAMES 1 PER LINE
      WRITE(ITTY,1)
      WRITE(ITTY,2)
      WRITE(ITTY,3)
      WRITE(ITTY,4)
      WRITE(ITTY,5)
      WRITE(ITTY,6)
      WRITE(ITTY,7)
      WRITE(ITTY,8)
      WRITE(ITTY,9)
    1 FORMAT(42H This program renumbers and/or lists FORTR,
     119HAN programs.  First/26H line  typed by user consi,
     235Hsts of switches having form /letter/10H or /lette,
     349Hr:number  or  /letter:number:number  where  initi,
     42Hal/44H slash  and  colons  are  optional.   Thus  ,
     517HA5 and L60 66 are/28H equivalent to /A:5 and /L:6,
     633H0:66 respectively.  If listing is/12H requested, ,
     749H user  must  on  following  line type title to be/
     849H placed at top of each page of listing.  User  mu,
     912Hst  then  on)
    2 FORMAT(42H subsequent lines type names of output and,
     119H input files.  List/26H of input files must be te,
     235Hrminated by blank input  file  name/10H after  wh,
     349Hich  program will request switches to be applied ,
     42Hto/44H next input files.  Processing is terminated,
     517H if  no  switches/11H are typed./1H /9H Followin,
     626Hg switches are recognized./1H /15H A followed by ,
     746Hnumber of spaces to add left of statements  in/
     849H   IF THEN block or in DO loop.  /A or /A:0 equal,
     96Hs /A:1)
    3 FORMAT(42H B followed by smallest statement number i,
     119Hn renumbered output/26H C column formatted renumb,
     235Hered output with statement  numbers/10H   ending ,
     349Hin column 5.  Statement text will start in column,
     42H 7/44H E followed by number of extra tables  of  c,
     517Hontents.   /E  or/19H   /E:0 equals /E:1/6H F lis,
     649Hting device has form feed.  Pages in  listing  wi,
     76Hll  be/40H   separated  by  form  feeds if output ,
     821His to LPT device.  /F/24H   can be followed by nu,
     937Hmber of lines printable per page.  /F)
    4 FORMAT(23H   or /F:0 equals /F:60/15H G followed by ,
     146Hnumber of blank lines  to  be  listed  between/
     249H   FORTRAN  statements.   No  extra  blank  lines,
     312H  are listed/33H   between comment lines.  /G or ,
     416H/G:0 equals /G:1/29H I followed  by  increment  b,
     532Hetween  statement   numbers   in/13H   renumbered,
     648H  output.  Negative increment, such as specified/
     749H   by  /I:-1,  gives  smallest  number  at  end  ,
     812Hof  program./33H   Smallest number will be absolu,
     928Hte value of increment unless)
    5 FORMAT(42H   /B specifies non-zero smallest number. ,
     119H /I or /I:0  equals/7H   /I:1/16H J followed by n,
     245Humber of blank lines to be at top of 1st,  at/1H ,
     349H  bottom  of  2nd  and  top  of 3rd pages, etc.  ,
     411HThis can be/34H   followed by number of blank lin,
     527Hes to be at bottom of  1st,/18H   at  top  of 2nd,
     643H and bottom of 3rd pages, etc.  These blank/3H   ,
     749Hlines are inserted to allow top binding of unburs,
     89Ht fanfold/37H   paper   and  must  be  included  i,
     924Hn  printing  line  limit)
    6 FORMAT(24H   specified by /F or /L/14H K long lines ,
     132Hare to be kept intact in listing/13H L pages in l,
     248Histing will be separated by counted line  feeds./
     349H   /L  can be followed by number of lines printab,
     412Hle per page./33H   This can be followed by total ,
     528Hnumber of  lines  per  page./17H   /S:0  is  assu,
     644Hmed if /S has not already been selected.  /L/2H  ,
     724H or /L:0 equals /L:60:66/21H M if issued not foll,
     840Howed by a number, old statement  numbers)
    7 FORMAT(42H   are maintained.  If M is followed by 2 ,
     119Hnumbers, then these/26H   are lowest and highest ,
     232Hstatement numbers to be modified/13H P followed b,
     348Hy first page number  in  listing.   /P  or  /P:0/
     414H   equals /P:1/31H S followed by number of charac,
     530Hters printable  beyond  normal/15H   right  margi,
     646Hn.   Excess  characters are right justified on/
     749H   following line.  /S or  /S:0  gives  70  chara,
     812Hcter  lines./18H   /S:13 equals /K)
    8 FORMAT(42H T tab  formatted  renumbered  output.   T,
     119Hab  character  will/25H   precede statement text/
     249H U column formatted renumbered output with statem,
     312Hent  numbers/33H   starting in column 1.  Stateme,
     428Hnt text will start in column/4H   7/10H V listing,
     549H is to be viewed  on this terminal.    Only 1 inp,
     62Hut/24H   file can be specified/16H W followed by w,
     745Hidth of tab stop  columns  to  be  used  when/1H ,
     849H  converting  tabs  to  spaces  in  comment  line,
     911Hs.  Tabs in)
    9 FORMAT(42H   comment lines  are  not  converted  in ,
     119H renumbered  output/26H   unless /W is typed.  /W,
     220H or /W:0 equals /W:8/1H /21H Listing file is iden,
     340Htified by /E, /F, /G, /J,  /K,  /L,  /P,/6H /S an,
     449Hd /V.   Default options are initial page number 1,
     56H, form/40H feeds,  intact long lines,  single spac,
     621Hing,  and 1  table of/10H contents./1H /7H Renumb,
     749Hered output is identified by /B, /C, /I, /M, /T o,
     85Hr /U./41H Default options are smallest statement n,
     920Humber 1, increment 1/19H and column format./1H )
      RETURN
C913598328167:
      END