Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50476/daifll.for
There are 2 other files named daifll.for in the archive. Click here to see a list.
      SUBROUTINE DAIFLL(INITAL,INTRVL,IBEGIN,IFINAL,MAXBFR,
     1IBUFFR,MAXPRT,MAXUSD)
C     RENBR(/EXPAND TABS TO SPACES WITHOUT EXTRA BUFFER)
C
C     DONALD BARTH, HARVARD BUSINESS SCHOOL
C
C     THE TAB CHARACTER IS A  NONPRINTING  CHARACTER  WHICH
C     CAUSES  THE FOLLOWING CHARACTER TO APPEAR IN THE NEXT
C     COLUMN BEYOND THE NEXT MULTIPLE OF THE TAB STOP.
C
C     INITAL = EQUAL TO OR GREATER THAN ZERO, INITAL IS THE
C              NUMBER  OF SPACES TO THE FIRST TAB STOP.  IF
C              INITAL  IS ZERO,  THEN DISTANCE TO FIRST TAB
C              IS VALUE OF INTRVL.   IF  FIRST CHARACTER IN
C              INPUT BUFFER IS A TAB,  IT WILL BE  EXPANDED
C              TO THIS NUMBER  OF SPACES.  INITAL CAN EQUAL
C              EITHER ZERO OR VALUE  OF INTRVL IF FIRST TAB
C              STOP IS TO BE  OF SAME WIDTH  AS THOSE WHICH
C              FOLLOW IT.
C     INTRVL = TAB STOP INTERVAL.  A TAB CHARACTER IN INPUT
C              BUFFER CAUSES THE FOLLOWING CHARACTER TO  GO
C              INTO THE NEXT POSITION BEYOND THE SUM OF THE
C              VALUE OF INITAL AND NEXT MULTIPLE OF INTRVL.
C     IBEGIN = SUBSCRIPT OF THE IBUFFR ARRAY AT WHICH IS TO
C              BE FOUND THE FIRST  CHARACTER OF THE TEXT TO
C              BE PROCESSSED.   FOLLOWING CONVERSION OF TAB
C              CHARACTERS TO PROPER NUMBER  OF SPACES,  THE
C              TEXT  IS PLACED  BACK INTO THE  IBUFFR ARRAY
C              STARTING AT SUBSCRIPT IBEGIN.
C     IFINAL = SUBSCRIPT OF THE IBUFFR ARRAY AT WHICH IS TO
C              BE FOUND THE FINAL  CHARACTER OF THE TEXT TO
C              BE PROCESSED.
C     MAXBFR = MAXIMUM  SUBSCRIPT  OF THE  IBUFFR  ARRAY AT
C              WHICH THE  FINAL CHARACTER  OF THE PROCESSED
C              TEXT CAN BE PLACED.  MAXBFR MUST BE EQUAL TO
C              OR BE GREATER THAN IFINAL.
C     IBUFFR = ARRAY USED FOR  INPUT OF THE TEXT CONTAINING
C              TAB CHARACTERS TO BE  EXPANDED TO THE PROPER
C              NUMBER OF SPACES, AND USED FOR OUTPUT OF THE
C              TEXT AFTER THE EXPANSION HAS BEEN PERFORMED.
C              IBUFFR  CONTAINS  CHARACTERS  READ   BY   A1
C              FORMAT.
C     MAXPRT = RETURNED CONTAINING THE SUBSCRIPT OF HIGHEST
C              LOCATION  IN THE OUTPUT  CONTENTS OF  IBUFFR
C              WHICH CONTAINS A PRINTING CHARACTER.
C     MAXUSD = RETURNED CONTAINING THE SUBSCRIPT OF HIGHEST
C              LOCATION IN  THE IBUFFR  ARRAY  CONTAINING A
C              CHARACTER OF THE TEXT AFTER PROCESSING.  THE
C              MAXIMUM VALUE OF MAXUSD IS MAXBFR.
C
      DIMENSION IBUFFR(MAXBFR)
C
C     ISPACE = THE SPACE CHARACTER
C     ITAB   = THE TAB CHARACTER
      DATA ISPACE,ITAB/1H ,1H	/
C
C     INITIAL POINTERS
      JBEGIN=IBEGIN-1
      NEEDED=INITAL
      JPRINT=JBEGIN
      KPYEND=MAXBFR
      LOKEND=IFINAL
    1 JUSED=JBEGIN
      IF(IFINAL.LE.JBEGIN)GO TO 14
C
C     RESET POINTERS PRIOR TO NEXT SCAN
    2 IF(KPYEND.LE.JBEGIN)GO TO 14
      LOOK=JBEGIN
      KOPY=JBEGIN
      LIMIT=NEEDED
      KIND=-1
C
C     TEST IF HAVE SCANNED TO RIGHT END OF UNPROCESSED TEXT
    3 IF(KOPY.GE.KPYEND)GO TO 10
    4 IF(LOOK.GE.LOKEND)GO TO 10
      LOOK=LOOK+1
C
C     ADJUST NUMBER OF COLUMNS LEFT UNTIL NEXT TAB STOP
      IF(LIMIT.LE.0)LIMIT=INTRVL
C
C     TEST IF NEW CHARACTER IS A SPACE OR A TAB
      IF(IBUFFR(LOOK).EQ.ISPACE)GO TO 7
      IF(IBUFFR(LOOK).NE.ITAB)GO TO 6
C
C     IF FIND A TAB, RECORD NUMBER OF SPACES TO NEXT STOP
      IF(KIND.GT.0)GO TO 5
      LOCATN=KOPY
      KIND=1
    5 KOPY=KOPY+LIMIT
      LIMIT=0
      IF(KOPY.LT.KPYEND)GO TO 4
      KOPY=KPYEND
      GO TO 10
C
C     IF FIND CHARACTER OTHER THAN A TAB, RECORD LOCATION
    6 IF(KOPY.GE.JPRINT)JPRINT=KOPY+1
    7 LIMIT=LIMIT-1
      IF(KIND.EQ.0)GO TO 8
      IF(KIND.LT.0)GO TO 9
      LOCATN=KOPY
      KIND=0
    8 KOPY=KOPY+1
      GO TO 3
    9 NEEDED=LIMIT
      JBEGIN=LOOK
      GO TO 1
C
C     COPY RIGHTMOST GROUP OF CHARACTERS
   10 IF(JUSED.LT.KOPY)JUSED=KOPY
      IF(KIND.GT.0)GO TO 12
   11 IBUFFR(KOPY)=IBUFFR(LOOK)
      KOPY=KOPY-1
      LOOK=LOOK-1
      IF(KOPY.GT.LOCATN)GO TO 11
      GO TO 13
   12 IBUFFR(KOPY)=ISPACE
      KOPY=KOPY-1
      IF(KOPY.GT.LOCATN)GO TO 12
      LOOK=LOOK-1
C
C     SHRINK THE UNPROCESSED REGION AND GO BACK TO DO AGAIN
   13 LOKEND=LOOK
      KPYEND=KOPY
      GO TO 2
C
C     RETURN TO CALLING PROGRAM
   14 MAXUSD=JUSED
      MAXPRT=JPRINT
      RETURN
C281985458052
      END