home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / snobol / aisnobol / buildlib.spt < prev    next >
Text File  |  1987-10-18  |  928b  |  34 lines

  1. *    BUILDLIB.SPT
  2. *
  3. *    Build index to functions in spitlib.spt to file spitlib.idx.
  4. *
  5. *    Uses the ability of latest version of Spitbol-68K to return
  6. *    file position from SET function.  If your Spitbol does
  7. *    not have this feature, you will have to modify the program
  8. *    to count characters in each line read, plus 1 for line-feed
  9. *    at end of each line on Un*x systems.
  10. *
  11.  
  12.     &TRIM = 1
  13.     &ANCHOR = 1
  14.     INPUT(.IN,1,'spitlib.spt')    :F(ERROR)
  15.     OUTPUT(.OUT,2,'spitlib.idx')    :F(ERROR)
  16.  
  17.     UCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  18.     PAT = (ANY(UCASE) (BREAK(' ' CHAR(9)) | REM)) . LABEL
  19. * Scan for starting label, noting file position preceeding label.
  20. *
  21. LOOP    FILE_POS = SET(1,0,1)
  22.     LINE = IN                :F(END)
  23.     LINE ? PAT                :F(LOOP)
  24.  
  25. * Found the start of a function.  Record it.
  26.     OUT = LABEL ',' FILE_POS
  27.  
  28. * Scan for end of function
  29.     END_PAT = LABEL '.END'
  30. LOOP2    LINE = IN                :F(END)
  31.     LINE ? END_PAT                :F(LOOP2)S(LOOP)
  32.  
  33. END
  34.