Thread View: vmsnet.tpu
1 messages
1 total messages
Started by fairfield
Fri, 18 Dec 1992 23:39
YAEJ: Yet Another Eve Justify procedure (KHF$FORMAT)
Author: fairfield
Date: Fri, 18 Dec 1992 23:39
Date: Fri, 18 Dec 1992 23:39
71 lines
4803 bytes
4803 bytes
Greetings All!
Here's a Holiday gift for everyone in INFO-TPU land. I've been
stimulated by both Hunter Goatley's and Ken Selvia's EVE Justify
procedures to merge paragraph justification with the FILL, FILL RANGE
and FILL PARAGRAPH commands in the current version of EVE. Also,
there's new functionality in TPU that wasn't available when Hunter
and Ken wrote their versions, so hopefully, this version is a little
more compact (e.g., compare Hg$Squeeze_Range and Khf$Fill_Edit).
First, I took Hunter's idea of alternately filling out the lines
from the right and then from the left, and supplemented that with
filling from the center of the line outward, and from both ends of
the line towards the center. Thus, on successive lines in a
paragraph or range, lines are filled from the center-out from the
outside-in, from the right towards the left, and from the left
towards the right. This alternation of filling patterns helps the
paragraph appear more balanced.
Second, I took Ken's idea of using Eve$Current_Word to pick out
each word in a line and store the results in an array. I use the
ranges as returned from Eve$Current_Word rather than the corre-
sponding string that Ken uses, but that's a detail. I also imple-
mented the "extra space following a sentence" which both these
gentlemen had done, if in a slightly different way.
Third, and perhaps most important, I integrated the justify
procedure within EVE's FILL, FILL PARAGRAPH and FILL RANGE
procedures. To do this, I split the original Eve_Fill_Paragraph into
two routines, a "stub" Eve_Fill_Paragraph, and a new
Eve$Fill_Paragraph. The latter contains all of the old code, with my
the small additions, including optional input parameters, which I
required in order to implement the justification. Thus I have added
just a handful of lines to Eve$Fill_Range and Eve$Fill_Paragraph and
have avoided the need to add duplicate code in the justification
procedure just to find and fill paragraphs.
The result is three new EVE commands: JUSTIFY, JUSTIFY PARAGRAPH,
and JUSTIFY RANGE. The three are entirely analogous to the three
corresponding FILL commands. For instance, JUSTIFY and JUSTIFY RANGE
will work on a BOX selection in addition to a normal selection.
Paragraph indention, positive or negative, _is_ respected by JUSTIFY.
Finally, I found there were times I might want to undo the
spacing that JUSTIFY had done. Unlike earlier versions of EVE and
TPU, the current version of FILL leaves embedded spacing intact.
Thus I have supplied three corresponding UNJUSTIFY commands. These
use the same procedure that JUSTIFY uses before filling out lines to
first compress out extra spaces, and then add one extra space at the
end of each sentence. The effect is like Ken's "ragged-right"
justification (I call that NO justification :-).
I have packaged the modified and new FILL, JUSTIFY and UNJUSTIFY
procedures into a single module, KHF$FORMAT, which can be used as-is
to EXTEND TPU *, or can be included in your xxx$MASTER.FILE for use
with EVE$BUILD. I will send out KHF$FORMAT in three VMS_SHARE'd
parts following this note. As I comment in that file, modifications
to EVE procedures are clearly labeled with "! KHF" at the end of
affected lines. Furthermore, comments at the beginning of the
procedure Khf$Justify outline ways the user can modify the pattern of
filling, etc., to suit an individual's taste or needs.
Use and enjoy! Comments are hereby solicited ;-)
Cheers, Ken
--
Dr. Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
SLAC, P.O.Box 4349, MS 98 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
Stanford, CA 94309 | BITNET Fairfield@Slacvx
----------------------------------------------------------------------------
These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads