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

Re: XYwrite macro please.... -- Thanks



Reply to note from "Yo Intl. YK"  Tue, 3 Sep 2002
07:14:17 +0900

> >Here it is. DECODE it, DeFine it, and issue ADD2U2 to add
> >it to U2 (v112 and later). To list all words containing an
> >ampersand, the command is SORTWDS &. To list all words
> >containing any instring: SORTWDS [instring].
>
> Thanks! I'll need this soon, it will come in very handy indeed.

Use the following revision instead, please; same instructions as
above. SORTWDS depends on func DW (Define Word) to do its work. The
revision deals rigorously with the quirk of func DW that causes white
space and some (but not all) punctuation marks to be highlighted as
trailers to the DeFined word. This behavior is defensible when func
DW is used for normal editing (viz, to DeFine several words
consecutively without gaps due to white space or punctuation). But
trailing separators have no place in the kind of sorted list that
SORTWDS generates.

So I did some testing -- wrote a separate diagnostic routine, actually
-- to identify the non-alphanumeric characters that func DW includes
as trailers, and rewrote SORTWDS so that it strips out any such
trailing character. For example, in the sentence "This cat has many
(nine) lives", with the cursor on the fifth word, func DW highlights
"nine)". In listing that word, however, SORTWDS drops the extraneous
paren.

Here's SORTWDS:

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5sortwds}} List and sort all words-containing specified st
ring [CLD rev. 9/3/02][cr|lf]{2}[XH_][BX_]es 1[Q2_]{<}IF{<}VA
|50{>}<1{>}{<}PRSORTWDS [instring]{>}{<}EX{>}{<}EI{>
}{<}IF{<}VA$WS{>}<>1{>}{<}PRNo file{>}{<}EX{>}{<}EI{>}{<}IF{<
}VA$WA{>}<1{>}{<}PRNo window{>}{<}EX{>}{<}EI{>}{<}SX01,{<}VA$
WA{>}{>}[BX_]func #{<}PV01{>}[Q2_][BX_]ne/1[Q2_][AS_][XP_][TF
_][TF_][XD_][XD_][XD_][YD_]{<}SV02,{3}{8}{tab} "()+,-/:;<=>[\
]^`{|}~{158}{<}{>}{176}{177}{178}{179}{180}{185}{186}{187}{1
88}{191}{192}{193}{194}{195}{196}{197}{200}{201}{202}{203}{20
4}{205}{206}{217}{218}{219}{220}{221}{223}{238}{239}{240}{241
}{242}{244}{245}{246}{247}{248}{249}{250}{>}{<}LBa{>}[BX_]se/
f [999]{<}PV50{>}[999][Q2_]{<}IF@not({<}ER{>}){>}[DW_]{<}SV01
{>}[YD_]{<}LBb{>}{<}SX03,{<}IS01{>}+"[255+192+142]"{>}{<}SV04
,{27}X[255+192+142]{>}{<}XS03,04,04,05,06{>}{<}SV06,{27}X{>}{
<}XS05,06,,06,07{>}{<}IF{<}IS02{>}{240}{<}IS06{>}{>}{<}SX01,{
<}IS04{>}{>}{<}GLb{>}{<}EI{>}[AS_]{<}GT01{>}[255+48+68][AS_]{
<}GLa{>}{<}EI{>}[AS_][DF_][TF_][TF_][DF_]{<}SV01,{>};*;[cr|lf
];*;[cr|lf];*; Comment out (;*;) next line to retain duplicat
es in list[cr|lf]{<}SX01,{<}VA$SK{>}{>}{<}SX01,"[BX_]d sk="+{
<}IS01{>}+"[Q2_]"{>}[BX_]d sk=4,80[Q2_];*;[cr|lf];*;[cr|lf][B
X_]sort[Q2_][BX_]wait[Q2_]{<}PV01{>}[TF_][TF_][AS_][TF_][TF_]
[AS_]{<}PRDone{>}{2}[cr|lf][cr|lf]
-nd
XPLeNCODE

For the record, here's the func DW diagnostic code (included FYI only;
it's not needed to run SORTWDS):

XPLeNCODE v2.0
b-gin [UNTITLED]
;*; TESTDW.PM -- CLD 9/3/02[cr|lf];*; Test func DW (Define Wo
rd) for trailing non-alpha characters included[cr|lf];*;  in
 DeFined word[cr|lf];*; Usage: RUN TESTDW.PM (requires 1{32}
available window)[cr|lf];*;[cr|lf]{<}SX01,{<}VA$WA{>}{>}{<}IF
{<}PV01{>}<1{>}{<}PRNo window{>}{<}EX{>}{<}EI{>}[BX_]func #{<
}PV01{>}[Q2_][BX_]ne/100[Q2_]{<}SV01,{1}{2}{3}{4}{5}{6}{7}{8}
{tab}{11}{12}{14}{15}{16}{17}{18}{19}{20}{21}{22}{23}{24}{25}
{27}{28}{29}{30}{31} !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~{157}{1
58}{160}{161}{162}{163}{164}{165}{166}{167}{168}{169}{170}{17
1}{172}{173}{<}{>}{176}{177}{178}{179}{180}{181}{182}{183}{18
4}{185}{186}{187}{188}{189}{190}{191}{192}{193}{194}{195}{196
}{197}{198}{199}{200}{201}{202}{203}{204}{205}{206}{207}{208}
{209}{210}{211}{212}{213}{214}{215}{216}{217}{218}{219}{220}{
221}{222}{223}{224}{225}{226}{227}{228}{229}{230}{231}{232}{2
33}{234}{235}{236}{237}{238}{239}{240}{241}{242}{243}{244}{24
5}{246}{247}{248}{249}{250}{251}{252}{>}{<}SV02,{27}X{>}{<}SV
03,{>}[BF_]{<}SV04,!{>}{<}LBa{>}{<}IF{<}VA|04{>}>0{>}{<}IF{<}
VA|01{>}>1{>}{<}XS01,02,,05,04{>}{<}SX01,{<}IS04{>}{>}{<}SX06
,{<}IS05{>}+"word"+{<}IS05{>}{>}{<}GT06{>}[LE_][255+48+68][LU
_][LB_][CR_][YD_][DW_]{<}SV06{>}[DE_][YD_][LD_][LB_]{<}IF{<}I
S05{>}{238}{<}IS06{>}<>0{>}{<}IF({<}IS06{>}+"[255+192+142]"){
240}({<}IS05{>}+"[255+192+142]"){>}{<}SX03,{<}IS03{>}+{<}IS05
{>}{>}{<}EI{>}{<}EI{>}{<}GLa{>}{<}EI{>}{<}SX05,{<}IS04{>}{>}{
<}SV04,{>}{<}GLa{>}{<}EI{>}[TF_]Func DW trailers:[255+48+68]{
<}GT03{>}[DF_][BF_][DF_][DN_][TF_]{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

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