home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
editor
/
gal210a4.arc
/
GALCH6.GAL
< prev
next >
Wrap
Text File
|
1987-07-27
|
17KB
|
548 lines
.a lp=12,js=y,ct=n bo=51 te=12 to=90 nm=1 pn=1
.st3,14,1
&dChapter%Six:%%Programming%Galahad .jc
&d[%Chapter%Six%] .hc
.t36 6 - .zl
&d6.1%INTRODUCTION .jr
.sto3,11,1
NOTE: Most Galahad users will have no need to program Galahad and therefore do
not need to read this chapter. However, if you would like to customize the
word processor to your own particular uses, you will learn most of what you
need from the next few pages.
.st3,11,1
Galahad II is a highly programmable word processor. This means that you
can create functions and assign them to particular keys. You can even make
your changes a permanent part of Galahad so that your special key assignments
are activated automatically, whenever you invoke Galahad at the MS-DOS A>
prompt.
.st3,14,1
&d6.2%TEMPORARY%ASSIGNMENTS .jr
.st3,11,1 .x-5
.st3,12,1
&dThe%Read%Command
.st3,11,1
Not every Galahad command is tied to a key. As we saw in Chapter Five,
commands such as DefaultExtension must be entered at the Command prompt. It is
possible to assign such commands to a key temporarily. Such temporary key
assignments last until you exit Galahad, or until you reassign the key:
.std3,12,1
PROCEDURE FOR ASSIGNING KEYS (Temporarily) .jc
.st3,11,1
.i10
.u3 1. .t10 On an empty screen (use NEW Command if your screen has text) enter
a list of key assignments with this syntax:
key==command;
-"key" is the key assignment
-"command" is the Galahad command
-the assignment ends with a semicolon and carriage return
.u3 2. .t10 Display the Command prompt
.u3 3. .t10 Enter the command
ReadInitBuffer
.i
The listed key assignment will be made. Keys not listed will remain as
they were. Check Appendix F for a list of the Galahad Default Key assignments.
These are the key assignments described in this manual. Use them as examples
for making your own key assignments. You may also use the Help Command and the
CDFIMOSW keys (or see Appendix E) for a list of Galahad commands.
If a key assignment is written improperly the following message appears:
Error in init file!
The the abbreviation &iinit&s. stands for &iinitialization&s. Notice that you
can save your key assignments in a file for use whenever you need them. If you
do save an assignment file, be sure to give it the following extension:
=.INI
Files with this extension are called &iinitialization &ifiles&n.
.st3,12,1
&dSample%Key%Assignments
.st3,11,1 .x-5
Suppose you would like to change a number of letters in your text to
uppercase regardless of their current case. The easiest way would be to assign
the UpperCase function to a key. To do so place the following command on a
blank screen:
sF8==UpperCase;
Use the "Procedure for Assigning Keys;" to assign the UpperCase command to
<%SHIFT%>%<%F8%>. The assignment is made immediately. When you press
<%SHIFT%>%<%F8%> the UpperCase command will be performed. Try it on some text
with mixed uppercase and lowercase. Notice the difference between the new
<%SHIFT%>%<%F8%> and <%F10%> (ChangeCase).
This single key assignment can be saved as a file for use on another day.
If you do save it, be sure to use a =.INI extension.
Before we continue we need a little lesson about the key names which are
acceptable to the ReadInitBuffer function for key assignment. Consider the
following examples:
.n10
.t12 _Key .t29 _Key%Name .t45 _Restrictions
<F1> .y1,20 .t30 F1
<KP1> .y1,20 .t30 KP1
<1> .y1,20 .t30 "1"
<a> .y1,20 .t30 "a"
<G> .y1,20 .t30 "G"
<SHIFT> <F6> .y2,20 .t30 sF6
<CTRL> <B> .y2,20 .t30 ^B .t40 Only Uppercase Letters Allowed
<CTRL> <F8> .y2,20 .t30 mCF8 .t40 Only Function Keys -- Not Keypad
<ALT> <a> .y2,20 .t30 mA"a" .t40 Only Lowercase Letters and Numbers
<ALT> <F2> .y2,20 .t30 mAF2 .t40 Only Function Keys -- Not Keypad
.i
.st3,12,1
&dReassigning%Keys
.st3,11,1 .x-5
The preceding example assigned UpperCase to a key, <%SHIFT%><%F8%>, which
had the previous key assignment of ToggleSplit. ToggleSplit is no longer
assigned to a key. There may be times that you simply want to change the
current assignment to different key.
As an example, assume that we want to exchange <%F9%> and <%F10%>.
To exchange these assignment enter two commands in your initialization file:
F9==ChangeCase;
F10==TransposeChars;
By adding more and more key reassignments you can change the entire keypad, but
remember to keep track of the changes you make. If your temporary changes get
out of control you can always exit Galahad and start over again.
You can see that your assignment have taken effect simply by entering the
HELP command (or <%SHIFT%>%<%KP5%>). Then press the newly assigned keys and
see which functions are assigned to the keys.
.sto3,11,1
NOTE: This manual describes only a default set of key assignments. Be sure
to keep track of any reassignments that you make.
.st3,12,1
&dMeta-Key%Assignments
.st3,11,1
Initial key assignment in Galahad, that is, the functions described in
Chapters One through Five, were designed for the convenience of the word
processor user. As a rule of thumb, don't change keys that have already been
assigned. For instance, it is probably best to leave the ChangeCase function
bound to <%F10%>.
So that the user can make new key assignments without changing existing
assignments, Galahad provides the Meta-Key. The Meta-Key is bound to <%ESC%>
on the numeric keypad. In Chapter One you saw how to configure Galahad for
various printers by using <%ESC%> <p>. You can assign any key in the same
Esc--Key sequence by entering the letters M1 before the key in your key
assignment. Consider the following key assignments:
M1F1==UpperCase;
M1F2==ChangeCase;
With these assignments you can press <%ESC%> <%F1%> then change a character to
uppercase. The <%F1%> key by itself will retain its ordinary function. To
change the case of a letter you can press either <F10>, which remains
unchanged, or <%ESC%> <%F2%>. The <%F2%> key by itself will remain unchanged.
.sto3,11,1
NOTE: When <%ESC%> is pressed, the message: Meta Active - Press Companion Key
appears on the lower left of the screen.
.st3,11,1
The standard Galahad described in this manual also assigns a special
function to <%ESC%> <%TAB%>. The <%ESC%> <%TAB%> sequence places five blank
spaces on the line. This function is useful for indenting paragraphs.
Ordinarily <%TAB%> moves the carriage to the next tabulation. Tabulations
are 8 spaces apart at columns 1, 9, 17, 25, 33, and so forth. But <%ESC%>
<%TAB%> simply adds five spaces to the line without moving to any absolute
tabulation column.
To see which Meta keys have been assigned in the standard Galahad press
<%ESC%> <m>.
Consider the following key assignments:
M1F1==UnderscoreCursor;
M1F2==ChangeCase;
M1F3=="%%%%%%%%%%";
M1"9"==DisplayString "Hello There.";
The first two we have discussed. <%ESC%> <%F3%> now inserts 10 blank spaces at
the cursor position and <%ESC%> <%F9%> displays the message "Hello There" on a
separate screen--a screen that functions much as a Help text.
Notice that the 9 is in quotes. Any of the typewriter keyboard keys must
be entered in quotes. To assign the left parenthesis mark, just above the 9,
put it in quotes too, as in
M1"("=="message";
Using quotes around the keys also enables you to distinguish between upper and
lower case letters, as in <C> and <c>. Consider the following example:
M1F1==UnderscoreCursor;
M1F2==ChangeCase;
M1F3=="%%%%%%%%%%";
M1"9"==DisplayString "Hello There.";
M1"C"==" Clarkson Clarkson Clarkson Clarkson Clarkson Clarkson
Clarkson Clarkson Clarkson Clarkson Clarkson Clarkson ";
M1"c"==DisplayString "This is lower case d.";
Here uppercase C, that is <%ESC%> <%SHIFT%> <C>, is assigned to display the two
lines in quotes. Such lines might be used as your personal letterhead. Notice
that the key assignment takes two lines. Any number of lines might be entered
between quotation marks as long as the assignment ends with a semicolon. If
you were writing a number of letters you might want to use this capability to
assign your inside address to a Meta-Key.
.st3,12,1
&dThe%HELP%Text
.st3,11,1
Once you have used the Read command, any newly assigned keys will be
reflected in the Help screens. For instance, use Read to assign the following
keys:
M1F1==UnderscoreCursor;
M1F2==ChangeCase;
M1F3=="%%%%%%%%%%";
Now when <%SHIFT%> <%KP5%> (HELP) is pressed then <%ESC%>, the following
is displayed:
.rh1,78
=.......
=.......
Press any key for help or CDFIMOSW for categories of help
Pressing the Esc key will Meta Key "1"
Enter a key to describe (Space to exit, Help for menu) ?
.rh1,78
Figure 6.1 HELP (<%SHIFT%> <%KP5%>) <%ESC%> .jc
.g
When HELP (<%SHIFT%> <%KP5%>) <%ESC%> <%F3%> is pressed, the following is
displayed:
.rh1,78
Press any key for help or CDFIMOSW for categories of help
Pressing the Home key will Meta Key "1"
Pressing the M1F3 key will "%%%%%%%%%%"
Enter a key to describe (Space to exit, Help for menu) ?
.rh1,78
Figure 6.2 <HELP> (<%SHIFT%> <%KP5%>) <%ESC%> <%F3%> .jc
Automatic HELP is particularly useful when you forget which key you have
assigned to which function.
.st3,12,1
&dMultiple%Function%Assignments
.st3,11,1
The ReadInitBuffer command allows the user to assign multiple functions to
a single key. For instance, suppose that you typed in the following message
before realizing that you wanted to underline it:
Beware of Hidden Rocks Beneath the Boat
To underline you can use the arrow keys and underline sign to place the
underline character in front of each word. Or you might find in more
convenient to assign multiple functions to a single key. For instance, you
could use the the Read command to make the following key assignment:
sF8==MoveWordRight%%MoveWordRight "=_";
The first "MoveWordRight" takes the cursor to the end of the word that the
cursor is resting on. The second takes the cursor through one or more spaces
to the next word. Here is how your new function works: Move the cursor to
the "B" in "Beware" and enter an underline mark.
=_Beware of Hidden Rocks Beneath the Boat
Now each time you press <%SHIFT%> <%F8%> the cursor will move to the next word
and enter an underline.
=_Beware =_of =_Hidden =_Rocks =_Beneath =_the =_Boat
Another Example of a Multiple Function Assignment
In the previous chapter we saw how to use <%ESC%> <%F8%>, RecordKey, to
write a dashed line around a line of text. Here is how we might perform the
same task with the read command:
sF8==MoveToLeft Moveup .b
"--------------------------WARNING------------------------------" .b
MoveDown MoveDown .b
"------------------------------------------------------------------------" .b
InsertNewLine;
Now enter the message:
Beware of Hidden Rocks Beneath the Boat
While the cursor is on the same line press <%SHIFT%> <%F8%>:
.a js=n
--------------------------WARNING------------------------------
Beware of Hidden Rocks Beneath the Boat
------------------------------------------------------------------------
.a js=y
Study each command of the dashed lines example to see how it was done.
.st3,14,1
&d6.3%MAKING%YOUR%OWN%GALAHAD .jr
.st3,11,1 .x-5
.st3,12,1
&dMaking%Your%Changes%Permanent
.st3,11,1
Any of your key assignments can be saved in an =.INI (initialization) file
and invoked with the ReadInitBuffer command whenever you need them, but you may
want to make a few functions a permanent part of your customized Galahad. To
do this you will need on your disk:
&h7 GAL2.COM
&h7 GAL207IP.INI
&h7 CONFPER.COM
Appendix F is a listing of the default initialization file, GAL207IP.INI. This
file contains almost all the default key assignments and parameters for the
Galahad described in this manual. See Appendix E for a list of all Gal2
functions. The program CONFPER.COM combines the initialization file with Gal2
to produce a Galahad that contains all of the key assignments of the
initialization file.
To customize Gal2 with your own key assignments:
.std3,12,1
PROCEDURE FOR CUSTOMIZING GALAHAD .jc
.st3,11,1
.i10
.u3 1. .t10 Use Gal2 to Load GAL207IP.INI
.u3 2. .t10 Add, change, or delete key assignments as you desire
.u3 3. .t10 Save your modified file under a new name:
newname.INI
.u3 4. .t10 Exit Galahad
.u3 5. .t10 From the A: prompt enter CONFPER and follow the prompts, being sure
that you
-enter your new =.INI file name when prompted
-name your customized Galahad something other than Gal2
.i
The following dialogue shows how CONFPER.COM operates.
_User .t35 _Computer%Prompt
Enters
CONFPER
.t25 Input Galahad or Percival file name [GAL2.COM]:
Presses
<%RETURN%>
.t25 Init file name [DEFAULT.INI]:
Enters name of new
=.INI file or <RETURN>
if correct
.t25 Output Galahad or Percival file name [GAL2.COM]:
Enters name of new
Gal2 or <RETURN>
if correct
.t25 List File [NUL.LST]
Provides filename
for error messages
Be sure to give a name to the List File. If there is an error message in your
=.INI file, an error message will appear. You can then look at the last line
of the List File to discover the line containing your error. Rather than
sending the errors to a file you can use the name CON. This is print the
errors to the screen.
.st3,12,1
&dPrinting%Defaults
.st3,11,1
You can change the printer defaults (margins, page numbers, etc.) of your
customized Galahad by modifying the next to last line of Default.INI. This is
setting the default values for the dot A command. From Galahad LOAD
GAL207IP.INI and use <%END%> to move to the bottom of the Edit screen. The
file will appear similar to Figure 6.3.
.rh1,78
Init.==
BlockCursor
Options "10" "80" "12"
WindowMargin "10" "10"
NameText "NONAME.GAL"
DisplayString "
GALAHAD II
Customed Configured for Operations with a Z-200 in PC Mode
To Edit (or Create) Text - Press Alt F3, then Enter; or Ctrl Enter
For HELP press the Shifted KeyPad 5 Key
"
DisplayString" NOTE: This Galahad is NOT configured for your printer.
Press ESC p for Temporary Configuration.
See Appendix D for Permanent Configuration.
"
PrinterConfig ""
DefaultDotA "HY=N"
LoadCommand;
.rh1,78
Figure 6.3 DefaultDotA: The Next to Last Line of Default.INI .jc
To set default Dot A commands simply enter them inside the double quotes
just after the command DefaultDotA. You may use more than one line, as long
as you keep your commands between a single set of double quotes.
.n6
The Dot A defaults for Gal2 are as follows:
AD==Y PS==N BH==3 AH==2 BN==2 AN==3 PN==1 LL==78 PL==66 SP==1 LM==0 LP==15
JS==N HY==Y IP==Y SS==Y CL==Y CT==Y AL==N TO==0 TE==0 BO==50 BE==0
.sto3,11,1
NOTE: All the functions shown in Figure 6.3 are assigned to
Init.==
They end with the single semicolon at the end of the file. USE ONLY THIS ONE
SEMICOLON. (Semicolons in sequences are OK as long as they remain inside
quotation marks.)
.st3,12,1
&dDefault%Printer%Configuration
.st3,11,1
In Chapter One we saw how to configure Galahad for your printer using
<%ESC%> and <p>. With Confper you can configure Galahad to your printer
automatically, whenever Galahad is invoked. Note in Figure 6.3 that the
PrinterConfig line is the empty string -- that is there is no printer
configuration. Also, note again that there is only one semicolon in the
figure--all the functions here are assigned to Init. They are performed when
Galahad is first invoked, from the A: prompt.
Scroll up the screen (about 20 lines) until you find the other printer
configuration assignments. If your printer is not in the file, look on the
disk file PRINTCFG.INI supplied on your Galahad distribution disk.
To make your printer configuration automatic:
.i10
.u3 1. .t10 Replace the Init. configuration with the configuration that
corresponds to your printer--the printer name appears in the assignment. (Use
<%SHIFT%> <%F9> and <%SHIFT%> <%F10%>)
.u3 2. .t10 Change the Init. DisplayString message (see Figure 6.3) so that it
reports the name of your printer. Your new message will appear each time you
invoke Galahad.
.u3 3. .t10 Save your =.INI file under a special name.
.u3 4. .t10 Use Confper to create your own Galahad. You might want to give it
a special name such as Galjuki, or Mygal.