10 REM     BCSQUASH.BAS   Version 1.0   10/28/83
15 ' COPYRIGHT (C) 1983 BY GREGORY C. DAHL
20 ' THIS PROGRAM REMOVES FROM A BASIC PROGRAM
30 ' ALL COMMENTS BEGINNING WITH A SINGLE QUOTE
40 ' AND MOST EXTRANEOUS BLANKS.
45 ' THE BASIC PROGRAM MUST HAVE BEEN SAVED IN 
48 ' ASCII, I.E.,   SAVE "PROGRAM",A
50 '
55 ' DETAILED INSTRUCTIONS ARE GIVEN IN BCSQUASH.DOC
60 '
70 DEFINT A-Z
100 COMP =  0 ' FLAG FOR COMPILED VERSION
210 IF COMP THEN N=350 ELSE N= 80 ' BLINK SPEED
215 WIDTH 52
220 PRINT CHR$(&H1A);
230 PRINT TAB(16)"BCSQUASH (ver. 1.0)":PRINT
240 PRINT TAB(7)"COPYRIGHT (C) 1983 BY GREGORY C. DAHL
250 IF COMP THEN PRINT TAB(6)CHR$(&H1B)CHR$(&H29)"PORTIONS COPYRIGHTED BY MICROSOFT, 1981"CHR$(&H1B)CHR$(&H28) ELSE PRINT
260 PRINT" This program is "CHR$(&H1B)CHR$(&H6C)"USER SUPPORTED SOFTWARE."CHR$(&H1B)CHR$(&H6D)"  If you
270 PRINT" find it useful and wish to encourage the develop-
280 PRINT" ment of new programs, you are invited to send a
290 PRINT" contribution to the author:
300 PRINT TAB(17) "Gregory C. Dahl
310 PRINT TAB(17)"4050 Arroyo Trail
320 PRINT TAB(17)"Carmel, CA  93923
330 PRINT" All contributors sending $10 or more will receive 
340 PRINT" a diskette with the latest version of this program 
350 PRINT" and its documentation, as well as other programs 
360 PRINT" by the same author.  Contribute as much as you feel
370 PRINT" the program is worth to you, and send your comments
380 PRINT" too!  Be sure to specify double or single density
390 PRINT" and the name of the program you want.
398 PRINT CHR$(&H1B)CHR$(&H29)"      (Offer subject to change without notice)" CHR$(&H1B)CHR$(&H28)
410 PRINT" This program is copyrighted and may not be sold 
420 PRINT" for profit without written permission from the
430 PRINT" author.  However, free copies may be made and 
440 PRINT" distributed without limitation.  Pass it around!
450 PRINT "           Press any key to continue...";
460 FOR I=1 TO N:A$=INKEY$:IF A$<>""THEN 500 ELSE NEXT I
470 PRINT CHR$(13)"                                       "CHR$(13);
480 FOR I=1 TO N:A$=INKEY$:IF A$<>""THEN 500 ELSE NEXT I
490 GOTO 450
500 PRINT CHR$(&H1A):PRINT:PRINT
503 IF COMP THEN PRINT  ELSE PRINT TAB(8)CHR$(&H1B)CHR$(&H29)"ALSO AVAILABLE IN A COMPILED VERSION":PRINT TAB(12)"WHICH RUNS ABOUT 30% FASTER"CHR$(&H1B)CHR$(&H28)
506 PRINT
510 PRINT:PRINT"  DRIVE B: IS ASSUMED UNLESS OTHERWISE SPECIFIED
520 PRINT CHR$(&H22)+"WRITE"+CHR$(&H22)+" FILE IS ASSUMED TYPE .SQ  UNLESS SPECIFIED
530 PRINT:PRINT
540 LINE INPUT "      FILE TO READ FROM:  ";F1$
550 PRINT:PRINT
560 LINE INPUT "      FILE TO WRITE TO:   ";F2$
570 FOR I=1 TO LEN(F1$):IF ASC(MID$(F1$,I))>&H60 THEN MID$(F1$,I,1)=CHR$(ASC(MID$(F1$,I))-&H20)
580 NEXT I
590 FOR I=1 TO LEN(F2$):IF ASC(MID$(F2$,I))>&H60 THEN MID$(F2$,I,1)=CHR$(ASC(MID$(F2$,I))-&H20)
600 NEXT I
610 IF INSTR(1,F1$,":")=0 THEN F1$="B:"+F1$
620 IF INSTR(1,F2$,":")=0 THEN F2$="B:"+F2$
630 IF INSTR(1,F2$,".")=0 THEN F2$=F2$+".SQ"
640 IF F1$=F2$ THEN PRINT:PRINT"WAKE UP!  WRITE FILE MUST BE DIFFERENT":PRINT"  FROM READ FILE.":STOP
650 N1=0:N2=0
2050 WIDTH 51 'SET SCREEN DISPLAY WIDTH FOR OSBORNE 1
2060 OPEN "I",1,F1$
2070 OPEN "O",2,F2$
2080 PRINT CHR$(&H1A);
2090 LINE INPUT#1, S$
2100 N1=N1+LEN(S$)+2 'COMMULATIVE FILE LENGTH (INCLUDING CR LF AFTER EACH LINE)
2110 PRINT CHR$(27)"="CHR$(34)CHR$(33)"LINE BEING PROCESSED IS:":PRINT:PRINT:PRINT S$+STRING$(255-LEN(S$)," ") 'RESET CURSOR POSITION AND DISPLAY LINE BEING PROCESSED
2120 FOR N = 2 TO 8 : IF MID$(S$,N,1)=" " THEN 2240 ELSE NEXT N
2130 '

	SUBROUTINE FOR DELETING BLANKS


2140 IF MID$(S$,B,1)=" " THEN S$=LEFT$(S$,B-1)+RIGHT$(S$,LEN(S$)-B):E=E-1:GOTO 2140 'DELETE LEADING BLANKS
2150 IF E<=B THEN RETURN
2160 IF MID$(S$,E,1)=" " THEN S$=LEFT$(S$,E-1)+RIGHT$(S$,LEN(S$)-E):E=E-1:GOTO 2160 'DELETE TRAILING BLANKS
2165 RETURN
2170 M=INSTR(B,S$,C$) :IF M=0 OR M>=E THEN RETURN
2180 ' TAKE OUT BLANKS BEFORE AND AFTER CHARACTER
2190 IF MID$(S$,M-1,1)=" " THEN S$=LEFT$(S$,M-2)+RIGHT$(S$,LEN(S$)-M+1):M=M-1:E=E-1:GOTO 2190
2200 IF MID$(S$,M+1,1)=" " THEN S$=LEFT$(S$,M)+RIGHT$(S$,LEN(S$)-M-1):E=E-1:GOTO 2200
2210 M=INSTR(M+1,S$,C$) :IF M<>0 AND M<=E THEN 2190
2220 RETURN
2230 '



2240 B=N+1 'BEGINNING POINTER FOR DELETIONS
2250 Q=INSTR(B,S$,CHR$(&H22)):IF Q=0 THEN E=LEN(S$) ELSE E=Q-1 'ENDING POINTER FOR DELETIONS BEFORE " OR END OF LINE
2260 SQ=INSTR(B,S$,"'"):IF SQ<>0 THEN IF E>SQ-1 THEN E=SQ-1 'SET ENDING POINTER AT SINGLE QUOTE LESS ONE
2270 RM = INSTR(B,S$,"REM"):IF RM<>0 THEN IF E>RM-1 THEN E=RM-1 'SET ENDING POINTER BEFORE REM
2280 IF E<B THEN 2350
2285 GOSUB 2140:IF MID$(S$,B,4)="DATA" THEN 2400
2290 C$="=":GOSUB 2170:C$=":":GOSUB 2170:C$=",":GOSUB 2170:C$="+":GOSUB 2170:C$="-":GOSUB 2170:C$="*":GOSUB 2170
2295 C$="/":GOSUB 2170:C$="(":GOSUB 2170:C$=")":GOSUB 2170:C$="<":GOSUB 2170:C$=">":GOSUB 2170 'DELETE BLANKS BEFORE AND AFTER = : , + - / * ( ) < >
2300 'FIND CLOSE QUOTE, SET NEW BEGINNING AND ENDING POINTERS
2310 IF Q=0 OR E>=LEN(S$)-3 THEN 2350
2320 Q=INSTR(E+2,S$,CHR$(&H22))
2330 IF Q=0 THEN 2350 'NO CLOSING QUOTE
2340 B=Q+1:GOTO 2250
2350 SQ = INSTR(E,S$,CHR$(39)) 'CHECK FOR SINGLE QUOTE
2360 RM = INSTR(E,S$,"REM"):IF RM=0 THEN RM=1000 'CHECK FOR REM
2370 IF SQ=0 OR SQ>RM THEN 2400
2380 IF SQ=N+1 THEN 2420
2390 S$=LEFT$(S$,SQ-1) 'ELIMINATE FROM ' TO RIGHT
2400 PRINT#2, S$
2410 N2=N2+LEN(S$)+2 'COMMULATIVE FILE LENGTH AFTER COMPRESSION
2420 PRINT CHR$(27)"="CHR$(45)CHR$(35); 'SET CURSOR POSITION
2430 PRINT TAB(10)"FILE LENGTH BEFORE:  "N1"  CHARACTERS


2440 PRINT TAB(10)"FILE LENGTH AFTER:   "N2"  CHARACTERS


2450 PRINT TAB(10) "SAVINGS              "N1-N2"  CHARACTERS
2460 IF EOF(1) THEN 2470 ELSE 2090
2470 CLOSE
2480 PRINT "


	 A "(1-N2/N1)*100" PERCENT SAVING IN ASCII
2490 PRINT "

	       (more in MBASIC format!)
2090
2470 CLOSE
2480 PRINT "


	 A "(