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

Re: convert _ _ to ital etc.



Reply to note from Bill Troop  Sun, 23 Sep 2001
18:34:55 -0400

> What the program misses in my test file is end pairs such as
> !_, ._, etc., but that's easy enough to fix.

Sure, just delete all the alpha wildcards, like this:

XPLeNCODE v2.0
b-gin [UNTITLED]
[BX_]cv /[wS]_[wO][wS]*/[wS][w<]MD+IT[w>]/[Q2_];*;[cr|lf][BX_
]cv /_[wS][wO]*[wS]/[w<]MD-IT[w>][wS]/[Q2_];*;[cr|lf]{<}EX{>}
[cr|lf]
-nd
XPLeNCODE

> I confess I am still curious how to make a simple xpl program
> that does something until it gets to the end, then stops.

Typically it's done with a loop, i.e., a command or other operation
that keeps repeating until an error (or some other stated condition)
is encountered, then stops. In the above code, the loop is built
into the CV command. But most of the time you need to construct it
yourself, controlling the flow of execution with a LaBel-GoLabel
pair. To take a trivial example, here's a routine that counts the
number of occurrences of the word "the" in the current file, then
reports the total. The loop is the second line of code, which keeps
repeating the SEarch command and incrementing the counter (Save/Get
01) as long as the SEarch command succeeds (looping back from
GoLabel "a" to LaBel "a"). When the SEarch fails, the program
proceeds to the next instruction.

XPLeNCODE v2.0
b-gin [UNTITLED]
[TF_]{<}SX01,0{>};*;[cr|lf]{<}LBa{>}[BX_]se/w "the"[Q2_]{<}IF
@not({<}ER{>}){>}{<}SX01,{<}PV01{>}+1{>}{<}GLa{>}{<}EI{>};*;[
cr|lf]{<}PRTotal: @01{>}{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx
http://users.datarealm.com/xywwweb/