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

Re: defining words



Reply to note from "Myron Gochnauer"  Thu, 2 Oct 2003
09:00:25 -0300

> ****** begin problem ******
> . . .
>
> Result: "This is a ≪MDIT≫test of the system."
>
> Remode itself would remove the italics properly as long as the
> word is not already defined.
>
> ******** end problem ******

Myron:

That particular problem stems from a defect in func DW. In non-
eXPanded views, when func DW defines a word that starts and ends
with a MoDe statement®MDNM¯, it fails to include the second MoDe command
in the DeFined block! So, for example, if you use func DW to DeFine
the italicized word "test", what actually gets DeFined is
"test" -- not, as you'd expect, "test". (You can
verify this by toggling into eXPanded view after executing func DW.)

The DWonly and DWonly2 routines I posted the other day didn't take
this into account. The revised routines, below, do: the DeFine now
includes a closing MoDe statement if it immediately follows the
DeFined word. Plug them into your U2 file (replacing the old ones,
of course).

Additionally, plug in the new routine, RemodeWordOrBlock, and use it
in place of nn=NOXHJM2,.,D,W,o,n,l,y,2,Q2JM2,.,r,e,m,o,d,e,Q2. In
other words, assign instead:

nn=NOXHJM2,.,R,e,m,o,d,e,W,o,r,d,O,r,B,l,o,c,k,Q2

Instead of calling DWonly2 and Remode mechanically every time, this
routine skips DWonly2 if the cursor is already within a DF block,
allowing Remode to operate on the block instead of the word.

Together, they get around the particular problem you identified
(although they undoubtedly ignore others, and may create some new
ones). Using XPL to manipulate MoDes is damnably difficult, largely
because XyWrite's internal handling of MoDes is somewhat erratic to
begin with. Stray MoDe statements creep in and, sooner or later,
you're stuck. (Robert's meticulous STRIPMD routine solves the
superfluous MoDe problem; highly recommended.)

Anyway, lemme know.

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5RemodeWordOrBlock}} Change MoDe of current word or DF blo
ck [CLD 10/4/03][cr|lf]{002}{<}IF{<}VA$DT{>}<1!{<}VA$DT{>}==8
{>}{<}PRNot available in eXPanded view{>}{<}EX{>}{<}EI{>};*;[
cr|lf][DZ_]{<}IF{<}VA$IN{>}<1{>}[JM_]2.DWonly2[Q2_]{<}SX50,@i
nt(({<}VA$DN{>}-{<}VA$DS{>})/2){>}{<}IF{<}PV50{>}<1{>}{<}SX50
,1{>}{<}EI{>}{<}SX50,{<}VA$DS{>}+{<}PV50{>}{>}[JM_]2.ReJuMP[Q
2_]{<}EI{>}[JM_]2.remode[Q2_]{002}[cr|lf][cr|lf]{{;5DWonly}}{032}
DeFine Word only (no trailing separator, etc.) [CLD rev. 10/4
/03][cr|lf]{002}[YD_][DW_]{<}SV01{>}{<}LBa{>}{<}SX01,{<}IS01{
>}+"[255+192+142]"{>}{<}SV02,{027}S[255+192+142]{>}{<}SV03,{>
}{<}XS01,02,02,03,04{>}{<}IF{<}VA|03{>}>0{>}{<}SX01,{<}IS02{>
}{>}[CL_][DM_][DZ_]{<}GLa{>}{<}EI{>}{<}IF("{<}"{238}({<}IS01{
>}+"{>}")==0{>}{<}SU02,[DX_][TG_]{>}{<}IF{<}VA$DT{>}<1!{<}VA$
DT{>}==8{>}{<}SU02,{>}{<}EI{>}{<}GT02{>}{<}SX03,{<}VA$DS{>}{>
}{<}SX04,{<}VA$DN{>}{>}[DE_][YD_][DF_][CR_][CR_][CR_][DF_]{<}
SV05{>}[YD_]{<}IF"{<}MD"{238}({<}IS05{>}+"{>}")==0{>}[BX_]se{032}
 [w>][Q2_]{<}SX04,{<}CP{>}{>}{<}EI{>}[BX_]jmp {<}PV04{>}[Q2_]
[DF_][BX_]jmp {<}PV03{>}[Q2_][DF_]{<}GT02{>}{<}EI{>}[DE_][FF_
]{002}[cr|lf][cr|lf]{{;5DWonly2}} DeFine Word only (no traili
ng separator, etc.) [CLD rev. 10/4/03][cr|lf]{002};*; This va
riant DeFines hyphenated expressions from cursor onward[cr|lf
][YD_]{<}SX01,-1{>}{<}LBa{>}[DW_]{<}SV02{>}{<}IF({<}IS02{>}+"
[255+192+142]"){240}"-[255+192+142]"{>}{<}IF{<}VA|02{>}-{<}PV
01{>}>1{>}{<}SX01,{<}VA|02{>}{>}{<}GLa{>}{<}EI{>}{<}EI{>}{<}L
Bb{>}{<}SX02,{<}IS02{>}+"[255+192+142]"{>}{<}SV01,{027}S[255+
192+142]{>}{<}SV03,{>}{<}XS02,01,01,03,04{>}{<}IF{<}VA|03{>}>
0{>}{<}SX02,{<}IS01{>}{>}[CL_][DM_][DZ_]{<}GLb{>}{<}EI{>}{<}I
F("{<}"{238}({<}IS02{>}+"{>}")==0{>}{<}SU01,[DX_][TG_]{>}
{<}IF{<}VA$DT{>}<1!{<}VA$DT{>}==8{>}{<}SU01,{>}{<}EI{>}{<}GT0
1{>}{<}SX03,{<}VA$DS{>}{>}{<}SX04,{<}VA$DN{>}{>}[DE_][YD_][DF
_][CR_][CR_][CR_][DF_]{<}SV05{>}[YD_]{<}IF"{<}MD"{238}({<}IS0
5{>}+"{>}")==0{>}[BX_]se [w>][Q2_]{<}SX04,{<}CP{>}{>}{<}EI{>
}[BX_]jmp {<}PV04{>}[Q2_][DF_][BX_]jmp {<}PV03{>}[Q2_][DF_]{<
}GT01{>}{<}EI{>}[DE_][FF_]{002}[cr|lf][cr|lf]
-nd
XPLeNCODE

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