home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / pwbfix.zip / CLNPWB.BAS next >
BASIC Source File  |  1993-11-15  |  2KB  |  85 lines

  1.  
  2.  
  3. DEFINT A-Z
  4. '15-Nov-93-chh
  5. 'PWB-run program to remove #$(OBJS) from inline file output since
  6. 'this causes an error on subsequent .MAK read by PWB. The #$(OBJS)
  7. 'is always placed there by the "Library" template and each "save list"
  8. 'of a project edit does it. Customizing the template does not work since
  9. 'the #$(OBJS) must be there when editing the project list.
  10.  
  11. 'This program creates a list of all *.MAK files and reads each file in
  12. 'the list scanning for #$(OBJS) and replaces those eight characters with
  13. 'ASCII 32 (space). File is modified there only, and not re-written.
  14.  
  15. DIM MakeName$(1 TO 128)
  16. DIM MatchLoc&(1 TO 16)
  17.  
  18. version$ = "CLNPWB 1.00 15-Nov-93"
  19.   match$ = "#$(OBJS)"
  20. replace$ = "        "
  21.  
  22. PRINT
  23.  
  24. location$ = COMMAND$
  25. IF location$ = "" THEN location$ = ".\"
  26. IF RIGHT$(location$, 1) <> "\" THEN location$ = location$ + "\"
  27. path$ = location$
  28. location$ = location$ + "*.MAK"
  29. index = 1
  30.  
  31. MakeName$(index) = DIR$(location$)
  32. DO WHILE LEN(MakeName$(index))
  33.    index = index + 1
  34.    MakeName$(index) = DIR$
  35. LOOP
  36.  
  37. PRINT version$
  38. PRINT "Using "; location$
  39. PRINT "Cleaning"; index - 1; "PWB project make files, Library template, of "; match$
  40. PRINT
  41.  
  42. FOR i = 1 TO index - 1
  43.  
  44.    'find matches within file
  45.  
  46.    matches = 0
  47.    PRINT MakeName$(i),
  48.    OPEN path$ + MakeName$(i) FOR INPUT AS #1 LEN = 8192
  49.    SEEK #1, 1
  50.    curPos& = SEEK(1)
  51.    LINE INPUT #1, ln$
  52.    DO WHILE NOT EOF(1)
  53.       IF ln$ = match$ THEN
  54.          matches = matches + 1
  55.          PRINT RIGHT$("     " + HEX$(curPos&), 6);
  56.          MatchLoc&(matches) = curPos&
  57.       END IF
  58.       curPos& = SEEK(1)
  59.       LINE INPUT #1, ln$
  60.    LOOP
  61.    CLOSE #1
  62.    
  63.    'process, if required
  64.  
  65.    IF matches = 0 THEN
  66.       PRINT "  none"
  67.    ELSE
  68.       OPEN path$ + MakeName$(i) FOR APPEND AS #1 LEN = 8192
  69.       SEEK #1, MatchLoc&(1)
  70.       PRINT #1, replace$
  71.       FOR j = 2 TO matches
  72.          SEEK #1, MatchLoc&(j)
  73.          PRINT #1, replace$
  74.       NEXT
  75.       PRINT " - Updated"
  76.       CLOSE #1
  77.    END IF
  78. NEXT
  79.  
  80. PRINT "ok"
  81. CLOSE
  82.  
  83.  
  84.  
  85.