[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Need XPL help



** Reply to note from xywrite@xxxxxxxx Mon, 15 Feb 1999 08:08:12 -0500 (EST)
> 
> 
> Well, I finally got around to purchasing XY4 from the TTG along with the
> XPL programming book. The XPL book is helpful but I have a couple of
> questions for the group.
>
> 1. I wish to write a program to put ">" marks at the beginning of each
> line to quote a message. I have no problem writing an XPL program to
> place a quote every time I press a certain key. What I would like to do
> is to have the program place quotes until it gets to the end of the file
> and then quit. The "ER" function is not supposed to work for this since
> it only returns values for commands, not functions. Can anyone help me
> with this?

What are you asking here? How to loop, and thus insert the ">" before a
bunch of lines? How to get it to stop when it reaches EOF End_Of_File?
If it's the latter, there are a couple of techniques. One is to capture
the  CharacterPosition of the cursor, issue an instruction to move
down (such as CD, LD, NP NextPara, or whatever), and then compare the the
new  with the old one. If they haven't changed, i.e. if the move down
instruction hasn't succeeded in moving down, then guess what! A simpler
way is to just poll VAriable $FE FileEnd. >0> then you're at
EOF; otherwise continue looping.

> 2. Along the same lines, I wish to be able to mark a block text and put
> quote marks at the beginning of each line, stopping when the end of the
> block is reached. I suppose I could open a temp file, quote the text and
> replace the orginal. But I was wondering if there was another way I
> could do this.

Use funcs DB and DE to jump to the beginning and the end of the DF block.

---------
Robert Holmgren
holmgren@xxxxxxxx
---------