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

Re: Countchars



Reply to note from "M.C."  Sat, 12 Feb 2005 14:48:46
+0100

> Don't worry. Countchars, in its current version, it's perfectly
> suitable for my needs

Well, Manuel, since we've headed down the road of exclusions and
carve-outs, we might as well go all the way. (I had an exception
for footnotes in the back of my mind all along.)

So, here is a revision that has the option to modify the /NF switch
by counting footnotes, headers, footers, any embedded text (just the
text, not nested formatting). Instructions are in the new Help
screen, also below.

Decode the entire block (DECODE). Add the U2 frame to your
U2 file (with cursor anywhere in the frame, issue DFFR and
then ADD2U2). CoPy the Help frame into XYWWWEB.INF (bottom
of file is OK); STore XYWWWEB.INF.

I think this fairly exhausts the possibilities for this routine.
Well... one _could_ add the ability to suppress counting of
character sequences ($trings), in addition to individual chars (with
exceptions for alternate Wednesdays and rainy days). But since no
one is asking and I can't imagine any real-world need for it, I
think I'll leave it here.

XPLeNCODE v2.0
b-gin [UNTITLED]
Add to U2 file:[cr|lf][cr|lf]{{;5countchars*}} Count number o
f chars|bytes in DF block [CLD rev. 2/12/05][cr|lf]{002}[XH_]
[BX_]es 1[Q2_][DZ_]{<}IF{<}VA$DE{>}<1{>}{<}PRNothing DeFined{
>}{<}EX{>}{<}EI{>}[DX_]{<}SV51,{>}{<}SV52,{>}{<}SX53,0{>}{<}S
X54,0{>}{<}SV55,{>}{<}IF@upr({<}VA$FR{>}){240}"/NF"!"-"{238}{
<}VA@50{>}==0{>}{<}SV55, [exclusions: {>}{<}SX56,@upr({<}VA$
FR{>}){>}{<}IF{<}IS56{>}{240}"/"{>}{<}SX55,{<}IS55{>}+"/"+{<}
VA@56/2{>}{>}{<}EI{>}{<}IF{<}VA|50{>}>0{>}{<}SX57,{<}IS50{>}{
>}{<}EI{>}[Q2_]{<}IF{<}VA$WA{>}<1{>}{<}PRNo window{>}{<}EX{>}
{<}EI{>}{<}SX58,{<}VA$WA{>}{>}[BX_]func #{<}PV58{>}[Q2_][BX_]
ne/100[Q2_][CP_][TF_][TF_]{<}IF{<}IS56{>}{240}"/NF"{>}{<}IF{<
}IS56{>}{240}"-"{>}{<}SX58,{<}VA@56-2{>}+","{>}{<}SV59,,{>}{<
}LBa{>}{<}IF{<}VA|58{>}>1{>}{<}SV60,{>}{<}XS58,59,61,,60{>}{<
}SX58,{<}IS60{>}{>}{<}SX62,4{>}{<}IF"|FN|RF|RH|"{240}("|"+{<}
IS61{>}+"|"){>}{<}SX62,5{>}{<}EI{>}[BX_]ch [w<]{<}PV61{>} [2
54+232+002]{<}PV61{>}[Q2_][BX_]wait[Q2_]{<}SX53,{<}PV53{>}+{<
}PV62{>}*(0+{<}VA$WC{>}){>}{<}SX54,{<}PV54{>}+(2*(0+{<}VA$WC{
>})){>}{<}GLa{>}{<}EI{>}{<}EI{>}[JM_]2.daf[Q2_]{<}EI{>}{<}IF"
-"{238}{<}VA@57{>}==0{>}{<}SV58,-{>}{<}SV51,{>}{<}XS57,58,,58
,51{>}{<}SV58,"{>}{<}XS51,58,,57,52{>}{<}SX52,{<}IS52{>}+"{01
4}"{>}{<}SV58,"{014}{>}{<}XS52,58,51,,57{>}{<}IF{<}VA|55{>}>1
5{>}{<}SX55,{<}IS55{>}+" "{>}{<}EI{>}{<}SX55,{<}IS55{>}+""""+
{<}IS51{>}+"""{>}{<}SV58,{027}X{>}{<}LBb{>}{<}IF{<}VA|51{>}>0
{>}{<}SV52,{>}{<}XS51,58,,57,52{>}{<}SX51,{<}IS52{>}{>}{<}LBc
{>}[BX_]cha [999]{<}PV57{>}[999][999][Q2_]{<}IF@not({<}ER{>})
{>}[BX_]wait[Q2_]{<}GLc{>}{<}EI{>}{<}GLb{>}{<}EI{>}{<}EI{>}[B
F_][BF_][DF_][TF_][TF_][DF_]{<}EI{>}{<}IF{<}VA$DT{>}
>0&{<}VA$DT{>}<>8{>}[TG_]{<}SV63,[TG_]{>}{<}EI{>}[DB_]{<}SX57
,0{>}{<}PRWorking...{>}{<}LBd{>}{<}IF0+{<}VA$IN{>}>0&0+{<}VA$
FE{>}<1{>}{<}SX51,{<}CP{>}{>}[CR_]{<}IF{<}CP{>}>{<}PV51{>}&{<
}CP{>}<1+{<}VA$DN{>}{>}{<}SX57,{<}PV57{>}+1{>}{<}GLd{>}{<}EI{
>}{<}EI{>}{<}SX57,{<}PV57{>}-{<}PV53{>}{>}{<}SX58,{<}VA$DN{>}
-{<}VA$DS{>}-{<}PV53{>}-{<}PV54{>}{>}{<}IF{<}VA|56{>}>0{>}[JM
_]2.ab/nv[Q2_]{<}EI{>}[DB_]{<}IF{<}VA|55{>}>0{>}{<}SX55,{<}IS
55{>}+"]"{>}{<}EI{>}{<}SX57,{<}IS57{>}+" chars | "+{<}IS58{>}
+" bytes"+{<}IS55{>}{>}{<}PV63{>}{<}PR@57{>}{002}[cr|lf][cr|l
f]Add to XYWWWEB.INF:[cr|lf][cr|lf]{countchars,countchars*}[c
r|lf][cr|lf]COUNTCHARS -- C.L.Distefano rev. 2/12/05[cr|lf]Fo
r XyWrite 4+ and Nota Bene for Windows[cr|lf][cr|lf]Purpose:[
cr|lf]Count characters|bytes in DeFined block[cr|lf]Optionall
y, exclude embedded commands and/or specified characters from
 the count. Further option to include text in footnotes, hea
ders, footers, etc., while excluding embedded commands from c
ount[cr|lf][cr|lf]Basic usage:[cr|lf]With block DeFined: [cr|
lf] COUNTCHARS[cr|lf][cr|lf]Complete usage:[cr|lf]W
ith block DeFined: [cr|lf] COUNTCHARS[/NF[-FM1,FM2,...]] [-"
aBc"][cr|lf][cr|lf]Options:[cr|lf] Switch /NF exclu
des all embedded formatting from count (including footnotes,{032}
headers, footers, etc.)[cr|lf] Additional parameter -FM1,FM2
 modifies the /NF option by counting text within the specifie
d embedded commands FM1,FM2, etc.[cr|lf] Parameter -"aBc" ex
cludes chars a, B and c (cAsE-sEnSiTiVe); use double quotes (
mandatory) around characters_to_exclude, which may include (s
ingle) SEarch wildcards (see Examples, below)[cr|lf][cr|lf]Ex
amples:[cr|lf] COUNTCHARS[cr|lf]  All-inclusive c
haracter|byte count[cr|lf] COUNTCHARS/NF[cr|lf]  {032}
Exclude embedded commands from count[cr|lf] COUNTCHARS/NF-FN
[cr|lf]  Exclude embedded commands, count text in footnote
s[cr|lf] COUNTCHARS/NF-FN,RH,RF[cr|lf]  Exclude e
mbedded commands, count text in footnotes, headers and footer
s[cr|lf] COUNTCHARS/NF-FN -" "[cr|lf]  Excluded e
mbedded commands, count text in footnotes; exclude spaces[cr|
lf] COUNTCHARS -"[wN][wS]"[cr|lf]  Exclude number
s and separators[cr|lf] [cr|lf]One available window required
 for /NF and -"" exclude options[cr|lf][cr|lf]{<}FC{>}[cr|lf]
For use by RENUMBER.PM[cr|lf]Renumber COUNTCHARS* in PACK mod
e[cr|lf]OPTIONs: FREEZE 50-52[cr|lf]Do NOT renumber to any S/
G range overlapping 01-06[cr|lf](used by child frame DEFDELIM
)[cr|lf][cr|lf]{<}US0{>}{<}FL{>}[cr|lf]-{tab}-{tab}-{tab}-{ta
b}-{tab}-{tab}-{tab}-{tab}-{tab}-[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx