40-Column Listing One-Liner: Difference between revisions

From Bitchin100 DocGarden
Jump to navigationJump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
It was used to create the listing of this one-liner. The image was created by printing to VirtualT's FX-80 emulation, and post-processed using Ghostscript and GIMP to crop and scale to 72dpi.
It was used to create the listing of this one-liner. The image was created by printing to VirtualT's FX-80 emulation, and post-processed using Ghostscript and GIMP to crop and scale to 72dpi.


NOTE: This problem has a glitch on lines larger than 255 characters. This will be fixed in a future version.
NOTE: This version has a glitch on lines larger than 255 characters.
 
The following code works for all lines:
 
[[Image:coliz2.png|center|frame|COLIZ2]]
<pre>
10 CLEAR 512
20 INPUT "FILE";F$
30 OPEN F$ FOR INPUT AS 1
32 S$="IDLE"
40 A$=INPUT$(1,1)
50 C=ASC(A$)
60 IF S$="IDLE" AND C=13 THEN S$="SKIP":GOTO 100
70 IF S$="SKIP" AND C=10 THEN LPRINT T$:T$="":S$="IDLE":
  GOTO 100: ELSE IF S$="SKIP" THEN PRINT "CR W/OUT LF": END
80 T$=T$+A$
90 IF LEN(T$)=40 THEN LPRINT T$:T$=""
100 IF EOF(1) THEN LPRINT T$;:END ELSE GOTO 40
</pre>

Latest revision as of 22:28, 11 January 2009

This program, COLIZE

COLIZE

prints out a text file as a non-word wrapped, 40-character column of text.

It was used to create the listing of this one-liner. The image was created by printing to VirtualT's FX-80 emulation, and post-processed using Ghostscript and GIMP to crop and scale to 72dpi.

NOTE: This version has a glitch on lines larger than 255 characters.

The following code works for all lines:

COLIZ2
10 CLEAR 512
20 INPUT "FILE";F$
30 OPEN F$ FOR INPUT AS 1
32 S$="IDLE"
40 A$=INPUT$(1,1)
50 C=ASC(A$)
60 IF S$="IDLE" AND C=13 THEN S$="SKIP":GOTO 100
70 IF S$="SKIP" AND C=10 THEN LPRINT T$:T$="":S$="IDLE":
   GOTO 100: ELSE IF S$="SKIP" THEN PRINT "CR W/OUT LF": END
80 T$=T$+A$
90 IF LEN(T$)=40 THEN LPRINT T$:T$=""
100 IF EOF(1) THEN LPRINT T$;:END ELSE GOTO 40