Line justifier (Rainbow 1981-08)
Home / Publications / Rainbow / Rainbow 1981 / Rainbow 1981-08Template:PageName Last month we said that we'd have a line Justification program ready for this month's issue. The listing is included below.
We were writing the RAINBOW last month with a simple word processor that let us enter a whole line and make corrections before it was committed to the print buffer on a printer. That was an improvement over the program that the manual had, mainly because it allowed us to backspace for corrections. In the case or the RAINBOW, where we want to have lines which are right justified, that wrorked only to a degree -- mainly because we had to type the line and then go back and add spaces to make the lines come out even on the right hand side. While the was easier than typing the RAINBOW on a typewriter (which would have required two typings) it was still a hassle. Thus was born the mini word processor below.
What happens here is that, using the INSTR Command, we search for spaces in a line and then "peel off" spaces from the end of each line and add them to the spaces which are already between the words. Each line is entered as A$ and then pulled apart. Spaces are inserted, and then the line is put back together. There are two variations, one for a full-length line and the other for a half-length one.
The program requires the typist to space to a certain spot on the line, in effect, to fill up the line with spaces (a printer might call these space bands). Those spaces are then repositioned in the line to make it come out evenly.
The screen display is set up so that there is a little black block for the typist to "aim" at. Once the typist gets close to the block, he or she just spaces in blanks until the cursor covers the black block. Then, the line is entered into the print buffer and printed on the line printer.
As an added aid, the last line typed is shown on the bottom of the screen. One of the reasons for this is because we felt it would be easier for the typist to begin the next line knowing what was on the previous line — without the need of having to look at the printer.
For short lines, Just hit ENTER when the line ends. However, a bug ray — but will not always -- appear if you type a VERY short line. What can happen is that the one or two words in the line will repeat themselves. If that does occur, just space down and retype the same line. It will go away.
The remainder of the program is devoted to the display and the graphic signature for the program and the software.
10 CLS 20 CLEAR1000 30 GOSUB410 40 GOSUB38:GOSUB390:GOSUB400:PRINTSTRIN$(32,45) 30 PRINT:PRINT"SELECT MODE:" 60 PRINT" (1) ONE-COLUMN FORMAT":PRINT" (2) TWO-COLUMN FORMAT":PRINT:INPUT" ENTER HUMBER";ZZ 65 ON ZZ GOT0100,240 70 PRINT:INPUT "ENTER ONLY 1 OR 2 PLEASE";ZZ 80 ON ZZ GOT0100,240 90 IF ZZ<>l OR ZZ<>2 THEN 70 100 CLS 110 N$=" ":L=4 120 GOSUB380:GOSUB390: GOSUB400:PRINT" ONE-COLUMN FORMAT" 130 PRINT@160, STRING$(32,43);:PRINT@271,CHR$(128); "<--SPACE TO HERE":PRINT@288,STRING$(32,45);:PRINT@322,"••• LAST LINE ••• ":PRINTA$:PRINT@192,"";:LINE INPUTA$ 140 IF RIGHT$(A$,1)="" THEN A$=RIGHT$(A$,1):A$=LEFT$(A$,79):GOTO170 130 PRINT#-2,A$ 160 GOTO100 170 B-INSTR(L,A$,N$) 180 C$=LEFT$(A$,B) 190 E$=RIGHT$(A$,79-B) 201 D$=C$+N$ 210 A$=D$+E$ 220 L=LEN(D$)+4 230 GOTO140 240 CLS 250 N$=" ":L=4 260 GOSUB380:GOSUB390:GOSUB400:PRINT" TWO-COLUMN FORMAT" 270 PRINT@ 160,STRING$(32,45);PRINT@230,CHR$(128);"<--SPACE TO HERE":'PRINT@256,STRING$(32,43);:PRINT@320," ••• LAST LINE •••":PRINTA$:PRINT@192,"";:LINE INPUT A$ 280 IF RIGHT$(A$,1)=" " THEN A$=RIGHT$(A$,1):A$=LEFT$(A$,37):GOT0310 290 PRINT#-2,A$ 300 GOT0240 311 B=INSTR(L,A$,N$) 320 C$=LEFT$(A$,B) 330 E$=RIGHT$(A$,37-B) 340 D$=C$+N$ 330 A$=D$+E$ 360 L=LEN(D$)+3 370 GOTO280 381 Fl$=CHR$(129+CHR$(131)+CHR$(133):F2$=CHR$(132)+CHR$(141):F3$=CHR$(133):F4$=CHR$(128+15):RETURN 390 CLS:PRINT@34,F1$: PRINT@66,F2$:PRINT@98,F3$:RETURN 400 PRINT@99,"ALSOFT MINI -WORD PROCESSOR":RETURN 410 PRINT@198,"(C) FALSOFT, 1981":FORX=1TO200:NEXT 420 GOSUB380 430 FORX=376TO34STEP-32:GOSUB460:NEXTX 440 FORX=51TO34STEP-1:GOSUB460:NEXTX 430 RETURN 460 Y=X+32:Z=Y+32:Q=Z+32 470 PRINT@X,F1$:PRINT@Y,F2$:PRINT@Z,F3$:PRINT@Q,F4$:RETURN