When I first bought my Archimedes, almost a year ago, I immediately sent for Computer Concepts' Wordwise Plus upgrade, which was a useful stop-gap until I bought 1st Word Plus. The main problem, however, has been transferring files from Wordwise Plus, as the different data formats and encoding of control characters made the task almost impossible and certainly extremely frustrating.
The program included with this article goes some way to rectifying the problem, and caters not only for Wordwise Plus files but View files as well. A text file is read byte by byte and converted into a format readable by 1st Word Plus. After asking for the file names to use, the program writes standard header information to the new 1st Word Plus file, including a default ruler and other appropriate data. Spaces and new lines are dealt with by a simple check and substitution routine. Tabs are converted to "new line" characters so that they stand out well in a block of text (1st Word plus substitutes the appropriate number of spaces for a tab), and can be easily re-instated with an existing or amended ruler.
One major, and obvious, difference between Wordwise and 1st Word Plus is the inclusion of the 'green' embedded commands in Wordwise files. These are translated where possible (ie. the print styles: bold, italic, underline and super/subscript); any others are prefaced by "^^" and surrounded by "new line" characters. This means they stand out in the new file and their intended effect can be replicated by using the 1st Word Plus layout and editing facilities.
Some of Wordwise's embedded commands, particularly those which control print styles, are printer-specific and may need to be altered if your printer is different from mine, a Panasonic KX-P1080 which claims Epson compatability. The relevant lines in the program have been marked with REMs and all you should need to do is change the strings in quotes after the WHEN statements to suit your own printer's commands. The 1st Word Plus equivalents do not need changing, as this is done automatically by the relevant printer driver.
For View, rulers are converted into corresponding 1st Word Plus rulers, and Highlight 1 and Highlight 2 are converted to underline and bold respectively. All other embedded commands in View are treated as for 'green' codes in Wordwise, that is preceded by '^^'.
The resulting file can be read into 1st Word Plus, with many of its characteristics retained. The effects of those which have not been kept are still clearly indicated in the text.
The program sets up a default 1st Word Plus ruler (Pica font, justification off, single line spacing). This, however, can be changed by adjusting the next to last DATA line, where the byte sequence &5D,&30,&30,&31 can be found. &5D marks the end of the ruler, whilst the other three bytes work as follows. The first byte is the print style (&30 = Pica, &31 = Elite, &32 = Condensed and & 33 = Expanded). The next byte controls justification (&30 = justification off, &31 = justification on) and the final byte (&31, i.e. ASCII code for 1) controls the line spacing (&32 gives line spacing of 2 etc.). Should you wish to alter the layout of tabs, the &2E/&7F sequence represents the dots and tabs. If required, it is also possible to alter the page layout, the details of which are in the first two DATA lines, as follows:
bytes 0,1 (&1F,30) File Start bytes 2,3 (&36,&36 = 66) Form Length bytes 4,5 (&30,&31 = 01) Top-of-Form Margin bytes 6,7 (&30,&33 = 03) Header Margin bytes 8,9 (&30,&33 = 03) Footer Margin bytes 10,11 (&30,&35 = 05) Bottom-of-Form Margin
Naturally, all these details can be altered in the usual way from 1st Word Plus, but if you always use different settings from the default, then the DATA lines can be adjusted to take care of these.
The program also allows entry of star commands, useful for checking filenames and ensuring that there is sufficient space on a disc. Escape will always take you back to the start of the program. Use the Quit option to exit.
There is still a fair bit to do if you want to convert all your View or Wordwise files for 1st Word plus, but this utility takes much of the slog and frustration out of the task, and can easily be customised to suit your particular requirements.
10 REM >Converter
20 REM Program View & WW+ to 1WP
30 REM Version A1.3
40 REM Author Doug Morrison
50 REM RISC User June 1989
60 REM Program Subject to copyright
70 :
80 MODE12
90 PROCinit:ON ERROR IF FNerror END
100 REPEAT
110 n%=FNstart
120 IF n%=0 PROCstar
130 IF n%>0 IF FNopenfiles PROCconvert
140 IF n%>=0 PROCcontinue
150 UNTIL n%<0
160 COLOUR 128:COLOUR 7:VDU26,12
170 END
180 :
190 DEF PROCinit
200 DIM name$(3)
210 name$(1)="View":name$(2)="Wordwise"
220 LL%=65:REM default line length
230 VDU28,10,5,69,0
240 COLOUR 132:CLS:COLOUR 3
250 PRINTTAB(20,3)"- TEXT CONVERTER -"
260 PRINTTAB(15,5)"Wordwise Plus to 1st Word Plus"
270 VDU28,0,31,79,8
280 COLOUR 131:COLOUR 4
290 ENDPROC
300 :
310 DEF FNstart:LOCAL A$:CLS
320 PRINTTAB(6,1)"Please select View (V), Wordwise (W), System(*) or Quit (Q)"
330 REPEAT A$=GET$:UNTIL INSTR("QVW*",A$)
340 IF A$="*" THEN =0 ELSE IF A$="Q" THEN =-1 ELSE =ASC(A$)-85
350 :
360 DEF PROCstar
370 LOCAL star$:CLS
380 PRINT"Please enter Operating System command:"'
390 INPUT"*"star$:OSCLI(star$)
400 ENDPROC
410 :
420 DEF FNopenfiles
430 LOCAL A$,byte,count:CLS
440 PRINTTAB(5,1)"Name of ";name$(n%);" file: ";:INPUT"" infile$
450 PRINTTAB(5,3)"Name of 1st Word Plus file: ";:INPUT"" outfile$
460 PRINTTAB(5,5)"Please confirm (Y/N)";
470 REPEAT:A$=CHR$(GET AND &DF):UNTIL A$="N" OR A$="Y"
480 IF A$="N" PRINT:=FALSE
490 IF infile$=outfile$ PROCerr(3,infile$):=FALSE
500 in=OPENIN(infile$)
510 IF in=0 PROCerr(1,infile$):=FALSE
520 out=OPENIN(outfile$)
530 IF out>0 PROCerr(2,outfile$):CLOSE#out:IF NOT FNagain =FALSE
540 out=OPENOUT(outfile$)
550 RESTORE
560 FOR count=1 TO 110
570 READ byte:BPUT#out,byte
580 NEXT
590 =TRUE
600 :
610 DEF PROCconvert
620 LOCAL char%,ct1%,ct2%,hflag%
630 hflag%=FALSE:CLS
640 PRINTTAB(5,1)"Converting ";name$(n%);" file ";infile$;" to ";outfile$
650 ct1%=0:ct2%=0
660 REPEAT
670 char%=BGET#in:ct1%+=1
680 ct2%+=1:IF ct2% MOD100=0 PRINT".";
690 IF char%<33 OR char%>127 THEN PROCtranslate ELSE BPUT#out,char%
700 UNTIL EOF#(in)
710 CLOSE#in:CLOSE#out
720 PRINT''TAB(5)"Conversion finished"
730 ENDPROC
740 :
750 DEF PROCtranslate
760 CASE char% OF
770 WHEN &20: IF ct1%>LL% THEN BPUT#out,&1E:BPUT#out,&0A:ct1%=0 ELSE BPUT#out,&1E
780 WHEN &09,&0D,&DD: BPUT#out,&0A
790 REM WHEN &0D: BPUT#out,&1E:BPUT#out,&0A
800 WHEN &02: PROCgreencode
810 REM WHEN &02,&07: BPUT#out,&0A:BPUT#out,94:BPUT#out,94:BPUT#out,&0A
820 WHEN &81: PROCruler
830 WHEN &1C,&1D: PROChighlight(char%)
840 WHEN &80: PROCembedded
850 ENDCASE
860 ENDPROC
870 :
880 DEF PROCgreencode
890 LOCAL code%,flag%,greenflag%
900 greenflag%=TRUE
910 REPEAT:oc$=""
920 REPEAT:code%=BGET#in
930 IF code%>96 AND code%<132 THEN code%-=32
940 flag%=(code%=&02 OR code%=&07 OR code%=&0D OR EOF#in):IF NOT flag% oc$=oc$+CHR$(code%)
950 UNTIL flag%
960 IF code%<>&02 THEN greenflag%=FALSE
970 CASE oc$ OF
980 WHEN "DS": oc$=CHR$&1B+CHR$&81:REM Bold
990 WHEN "US": oc$=CHR$&1B+CHR$&88:REM Underline
1000 WHEN "ES83,0":oc$=CHR$&1B+CHR$&90:REM Superscript
1010 WHEN "ES83,1":oc$=CHR$&1B+CHR$&A0:REM Subscript
1020 WHEN "ES52": oc$=CHR$&1B+CHR$&84:REM Italics
1030 WHEN "DE","UE","ES84","ES53":oc$=CHR$&1B+CHR$&80:REM Cancel
1040 OTHERWISE
1050 oc$=CHR$(&0A)+"^^"+oc$+CHR$(&0A)
1060 ENDCASE
1070 FOR ocplace=1 TO LEN(oc$)
1080 BPUT#out,ASC(MID$(oc$,ocplace))
1090 NEXT
1100 UNTIL greenflag%=FALSE
1110 ENDPROC
1120 :
1130 DEF PROCruler
1140 LOCAL code%:LL%=0:PTR#in=PTR#in+2
1150 BPUT#out,&0A:BPUT#out,&1F:BPUT#out,&39:BPUT#out,&5B
1160 REPEAT:code%=BGET#in:LL%=LL%+1
1170 CASE code% OF
1180 WHEN &2A: BPUT#out,&7F
1190 WHEN &0D: BPUT#out,&5D:BPUT#out,&30:BPUT#out,&30:BPUT#out,&31:BPUT#out,&0A
1200 OTHERWISE
1210 IF code%<>&3C AND code%<>&3E BPUT#out,code%
1220 ENDCASE
1230 UNTIL code%=&0D OR EOF#in:ct1%=0:LL%=LL%-1
1240 ENDPROC
1250 :
1260 DEF PROChighlight(c%)
1270 BPUT#out,&1B
1280 IF hflag% BPUT#out,&80:hflag%=FALSE ELSE hflag%=TRUE:IF c%=&1C BPUT#out,&88 ELSE IF c%=&1D BPUT#out,&81
1290 ENDPROC
1300 :
1310 DEF PROCembedded
1320 LOCAL code%:BPUT#out,&0A
1330 BPUT#out,&5E:BPUT#out,&5E
1340 REPEAT:code%=BGET#in
1350 IF code%=&1C OR code%=&1D PROChighlight(code%) ELSE IF code%<>&0D BPUT#out,code%
1360 UNTIL code%=&0D OR EOF#in
1370 BPUT#out,&0A:ct1%=0
1380 ENDPROC
1390 :
1400 DEF FNagain
1410 PRINTTAB(5,VPOS+1)"Do you wish to continue (Y/N)?";
1420 REPEAT:A$=CHR$(GET AND &DF):UNTIL A$="N" OR A$="Y"
1430 IF A$="Y" =TRUE ELSE =FALSE
1440 :
1450 DEF PROCerr(n,msg$)
1460 COLOUR 1:PRINT:PRINT
1470 IF n=1 PRINT"File does not exist: ";
1480 IF n=2 PRINT"File already exists: ";
1490 IF n=3 PRINT"File names same: ";
1500 PRINT msg$:COLOUR 4
1510 ENDPROC
1520 :
1530 DEF PROCcontinue
1540 PRINTTAB(5,VPOS+1)"Press any key to continue":A$=GET$
1550 ENDPROC
1560 :
1570 DEF FNerror
1580 CLOSE#0
1590 IF ERR=17 THEN =FALSE
1600 MODE12:REPORT:PRINT" at line ";ERL
1610 =TRUE
1620 :
1630 DATA &1F,&30,&36,&36,&30,&31
1640 DATA &30,&33,&30,&33,&30,&35
1650 DATA &38,&30,&30,&0A,&1F,&31
1660 DATA &1F,&1F,&0A,&1F,&32,&1F
1670 DATA &23,&1F,&0A,&1F,&46,&30
1680 DATA &31,&31,&30,&30,&33,&30
1690 DATA &0A,&1F,&39,&5B,&2E,&2E
1700 DATA &2E,&2E,&7F,&2E,&2E,&2E
1710 DATA &2E,&7F,&2E,&2E,&2E,&2E
1720 DATA &7F,&2E,&2E,&2E,&2E,&7F
1730 DATA &2E,&2E,&2E,&2E,&7F,&2E
1740 DATA &2E,&2E,&2E,&7F,&2E,&2E
1750 DATA &2E,&2E,&7F,&2E,&2E,&2E
1760 DATA &2E,&7F,&2E,&2E,&2E,&2E
1770 DATA &7F,&2E,&2E,&2E,&2E,&7F
1780 DATA &2E,&2E,&2E,&2E,&7F,&2E
1790 DATA &2E,&2E,&2E,&7F,&2E,&2E
1800 DATA &2E,&5D,&30,&30,&31,&0A
1810 DATA &1B,&80