HOW A WORD PROCESSING
PROGRAM WORKS

by Paul Lutus

Word Program

Computers do word processing almost naturally, and nearly every personal computer installation includes some kind of word processing program. When the computer is manipulating text, the keyboard and display take the place of a typewriter, putting us on relatively familiar terrain.
    Basic word processing functions can be broken into two main categories: text editing and print formating. Text editing features include the ability to enter, edit and delete text with ease, speed and flexibility. Also necessary is the ability to find any arbitrary character string and replace it with another. Advanced functions include the ability to automate completely certain text editing tasks and to define sentences or control sequences that are then made available with a single keystroke.
    Print formating functions include the ability to print the file created with the text editor, read embedded formating commands and carry them out, and provide various margins and text justifications (e.g., left and right flush, centered, fill). Early text editors intended for use by programmers were mated with print formaters and sold as word processors. The newer products are fully integrated software packages in which the text editor and print formater functions are simultaneously available without changing program environments.
    Following is a description of the simplest text editing function and the computer's accompanying actions. In this example, the cursor (the text editor's point of action) is moved into a line of text, then a word is added. The text editor's file is normally retained in the computer's memory while the work is being performed. Each typed character is placed, as a number, in the next available memory location.

Display
The quick brown fox
Memory
Address
 
Number
 
Character
1
84
T
2
104
h
3
101
e
4
32
 
5
113
q
6
117
u
7
105
i
8
99
c
9
107
k
10
32
 
11
98
b
12
114
r
13
111
o
14
119
w
15
110
n
16
32
 
17
102
f
18
111
o
19
120
x
20
32
 

Note that spaces in the example are represented by the number 32. Each character or text formating action has a number. The command to move the printer's carriage down and to the left, for instance, is assigned the number 13. When you press RETURN, the number 13 is placed in the computer's memory.
    Now the cursor is moved left along the typed line. When the cursor position is changed, some of the characters are moved up into higher memory locations to make room for subsequent text insertions:

Display
The quick brown fox
Memory
Address
 
Number
 
Character
1
84
T
2
104
h
3
101
e
4
32
 
985
113
q
986
117
u
987
105
i
988
99
c
989
107
k
990
32
 
991
98
b
992
114
r
993
111
o
994
119
w
995
110
n
996
32
 
997
102
f
998
111
o
999
120
x
1000
32
 

Now a new word is typed at the cursor position

Display
The very quick brown fox
Memory
Address
 
 Number
 
Character
1
84
T
2
104
h
3
101
e
4
32
 
5
118
v
6
101
e
7
114
r
8
121
y
9
32
 
985
113
q
986
117
u
987
105
i
988
99
c
989
107
k
990
32
 
991
98
b
992
114
r
993
111
o
994
119
w
995
110
n
996
32
 
997
102
f
998
111
o
999
120
x
1000
32
 

    Even though the file has two memory segments, the display shows them as an integrated whole. This has the advantage that in most common text manipulation actions only one character needs to be moved or saved, adding to program speed. Most text editing functions include this basic scheme. Text search and replacement involves moving characters between the file's high and low memory segments, searching for the desired text, then performing deletions and insertions as instructed by the user's entry.
    Placing the text in the computer's memory makes it possible to perform fast text manipulation and .display. The drawback is that file length cannot exceed available memory. The normal solution to this problem is to break the file into segments, each of which can fit in memory. An alternate method is to read and write to a mass storage device as text editing takes place. This method shields the user from memory limitations but is often very slow.
    The word processor should work consistently no matter which function is being performed. There should also be consistency in how the characters are typed in, moved or deleted and while the cursor is being moved about, and it should not be necessary to shift from one function to another. This type of "mode-free" design is included in only about a quarter of personal computer word processors. In order to be mode-free, a word processor must work overtime. For example, pressing a key in Apple Writer often changes only one displayed character, but 1,920 characters are drawn from memory, formated and placed on display. (This is always done, even for functions that don't need it, so the user won't have to think about modes.) Such a display requirement mandates the use of the fastest possible computer code: assembly language. Other functions, such as search and replace, greatly benefit from fast coding. For these and other reasons, word processors written in slow high-level languages are almost never mode-free.
    Let's discuss program control for a moment, using Apple Writer as an example. In its normal state, the program takes keyboard entries and adds them to a memory buffer, updates the display, then awaits the next typed character. This sequence accompanies the typing of normal characters such as upper- and lowercase alphabetic, numeric and punctuation characters.
    Another kind of keyboard entry is accompanied by the control key. Control entries, and the use of the arrow keys on newer Apple machines, cause special control subroutines to be executed. The selected control subroutine may move the cursor, load or save a file, change display characteristics, format and print a file or perform some more exotic function. These subroutines are designed to be unobtrusive in direct proportion to their likelihood of use. Text search, file loading and saving, and a handful of other functions carry out their tasks without erasing the text display, while other less frequently used commands may display a selection menu of their own.
    There are many fundamental improvements yet to be made in word processing. The most important is to replace the keyboard with the human voice, a task that is currently receiving a lot of attention in computer labs across the country. Some improvements will have to wait for faster machines with more memory, although a few existing programs seem to have resigned themselves to making you wait.
    Remember this about word processing: if the program mystifies you, if its actions aren't obvious, if it displays cryptic error messages, if an hourglass appears and stays like a dying relative, it's not your fault. Computers are powerful enough, and programmers get paid well enough, to no longer excuse program actions that are comprehensible only to another computer. If the program won't hold your hand, don't turn in your hand-turn in the program.

PRINTER'S DEVILS
Printer's Devils
Sooner or later, the computer prints what you've typed. Most word processor headaches begin at this point, since printing requires the computer hardware and software to cooperate with the printer. For example, you have to connect them to one another so they can communicate. Sound easy? Nowadays you can buy relatively inexpensive printer connections (or "interfaces"), but the old way was so unworkable that I had to provide instructions with Apple Writer on how to wire the printer to the joystick port.
    The two main printer types available today use either the serial or the parallel method, depending on how the characters are transmitted to it. The serial method takes fewer wires but slows down some of the faster printers; the less common parallel method is quicker but takes more wires.
    Printers respond individually to special control characters. While one printer might use a given character to move to the top of the next page, another might use that character to select a different print style. One way of dealing with this problem is to provide special add-on software modules to accommodate different printers. In other words, when you buy the Model 19-19 printer from Redundant Equipment, Inc., you must also get the word processor software company to send its Model 19-19 module.
    Another approach is to use only control characters with universally recognized meanings. This method, found in Apple Writer and a few other programs, works with every printer but cannot take full advantage of the four-color, three-dimensional, two-directional, one-drive, zero-noise models that take off from time to time.

P.L.


Return to Table of Contents | Previous Article | Next Article