ON DISK!
SIFT That File
START's Instant File Translator
BY BRUCE D . NOONAN, M. D.
SIFT converts text files from Word Writer, 1ST Word or WordPerfect into ST Writer Elite and from ST Writer Elite into any of the other three. This program has become an essential here at START, and we knew that if we needed it, lots of our readers would, too--especially those who create flyers, newsletters, etc.
Convert text files to the word processor format you like best. File SIFT.ARC on your START disk.
On television many years ago, I saw an entertaining demonstration. Seven men, each of whom spoke two and only two languages, were asked to translate a humorous story from one language to the next. The first spoke English and Polish, the second Polish and German, the third German and Slovenian, etc., and the last spoke Spanish and English. Each translator in turn repeated the story and the last man interpreted it back into English. As you might expect, the final version of the story bore little resemblance to the original. The humorous aspects had been distorted so much that the humor now lay in how badly the story had been mangled rather than in its punchline.
Even with this in mind, I was excited when START asked me to write a program which would translate files from one word processor format into another. The result is START's Instant File Translator (SIFT). With this handy utility, you can convert files from Word Writer, 1ST Word and WordPerfect into ST Writer Elite format--or from ST Writer format to one of the other three. But what if, for instance, you want to convert a Word Writer file to WordPerfect format? Simple Just convert it to ST Writer format first; then convert the new ST Writer file to WordPerfect format.
To run the program, copy SIFT.ARC and ARCX.TTP onto a blank, formatted disk and un-ARC the file following the Disk Instructions elsewhere in this issue. Double-click on SIFT.PRG, then choose the direction for the translation: either TO STWE or FROM STWE. Next, select the format for conversion: 1ST Word, WordPerfect, or Word Writer. Now you'll select the names of the input and output files using the item selector. You will be told when the translation is complete and then asked if you wish to convert another file. If "Yes," the process is repeated. If "No," you are returned to the Desktop.
Roadblocks
Each of the word processors has features that the others don't--and for which there are no translations. 1ST Word and Word Writer both have a light text feature not found in ST Writer or WordPerfect--and WordPerfect has a strike-out or overstrike feature not found in the other three. In fact, WordPerfect has so many extra features not found in any of the other three word processors--such as footnotes, math columns, indexing and table of contents generation--that clearly no translation (or even approximation) was possible. In these cases, only straight text movement was performed.
I translated as many features of each word processor as I could. Consequently, WordPerfect translations take the longest to convert. My file of the ST Writer Elite manual (over 100K) took 1 minute, 48 seconds to convert to 1ST Word or Word Writer format, but 4 minutes, 13 seconds to WordPerfect.
I was glad to be able to use the outline features of both WordPerfect and ST Writer and swap them without losing information. Likewise, I was able to do this with the outdenting features of all four programs.
When transferring a file to ST Writer, the beginnings of paragraphs are marked with the Control-P character, and if the first line of the paragraph is indented, the paragraph indentation is set with Control-I--if the indentation has changed since the last paragraph. Transferring from ST Writer reverses the procedure.
The centering and right-justification functions of 1ST Word and Word Writer caused a problem. The WYSIWYG text files created in these programs are formatted before they're saved, and a lot of indent spaces and variable spaces are used in front of the text being centered or right-justified. ST Writer, on the other hand, uses one Control-C character to mark centered text and two Control-C characters to mark right-justified text. (ST Writer doesn't center or right-justify the text until you print it.) I elected to remove the space padding from 1ST Word and Word Writer files when translating to or from ST Writer format. After translation, you'll need to inspect the file and alter centering and pagination as needed. WordPerfect files did not present this difficulty and centering and justification translated just fine
1ST Word makes no allowance for writing text in any pitch other than Pica (10 pitch), while Word Writer, which is very similar in file structure, lets you change pitch by embedding printer controls directly in the text. WordPerfect allows Pica, Elite (12 pitch) and condensed (15 pitch) typefaces, but not expanded print, unless you set up a font to represent expanded print. I arbitrarily assigned ST Writer's expanded print to font 2 of WordPerfect and vice versa.
As you can see, if you translated a WordPerfect file to ST Writer, then to 1ST Word, to ST Writer again, then to Word Writer, to ST Writer once more and then back to WordPerfect, it might look very different than it did at the beginning.
Finally you can exchange your word processing files between ST Writer, 1STWord, Word Writer ST and WordPerfect. Simply select whether to convert from or to ST Writer format, click on the cur- rent (or destination) format and then enter the appropriate file names. SIFT does the rest! |
On-The-Fly Translation
I ran into several limitations while writing SIFT.PRG. One is the fact that ST memory configurations vary, ranging from 256K 520STs with TOS on disk to Mega 4s. To make the program more widely acceptable, I had it read the file into RAM and write the translation to disk. This lets SIFT use the maximum amount of memory for files to be converted, but it also means that it must do linear translations--that is, "on the fly," without being able to go back and insert a particular code or text segment in front of text that had already been written to disk. An example could involve writing an ST Writer header into 1ST Word format. 1ST Word writes its header text in a formatting segment which precedes the normal text in the file. If the header occurs later in the ST Writer file after some text has been written to the disk, it cannot be placed in the 1ST Word file. To fit it in would require moving the disk drive read/write head to the appropriate disk sector and byte, then pushing text aside to squeeze it in. This could be done in RAM, but not on disk. Therefore, when converting ST Writer files to Word Writer or 1ST Word, be sure the header and footer lines are written directly after the format line at the top and before any text. Headers and footers occurring later in the ST Writer file will not appear in 1ST Word or Word Writer translations.
Wrap-Up
SIFT is a great utility if you have a RAM disk; if you put your input files on it, you'll save wear and tear on your floppy drives--converting a large WordPerfect will not only take forever, but it will keep your floppy drive's moving parts moving continuously.
The source code was written entirely in C and compiled with the Megamax Laser C compiler.
Bruce Noonan is an opthamologist who lives in Seattle, Washington and is the godfather of Atari's public domain ST Writer.
PRODUCTS MENTIONED
Word Writer ST, $79.95. Timeworks, 444 Lake Cook Road, Deerfield, IL 60015, (312) 948-9200.
WordPerfect for the ST, $395. WordPerfect Corp., 288 West Center Street, Orem, UT 84057,
1ST Word, Atari Corp. $19.95. 1196 Borregas Ave. Sunnyvale, CA 94088 (408) 745-2000.
ST Writer Elite ver. 3.0, April 1989 issue of START. 544 Second St., San Francisco, CA 94107, (800) 234-7001.