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

Re: Long strings in CI ///



Reply to note from Harry Binswanger  Fri, 03 Dec
2010 09:01:04 -0500

> Your (earlier) BIGCI is working beautifully.

Here's an update. The routine is now called LCI -- Long Change
Invisible -- which I feel is more Xydiomatic. I've added a Help
screen as well (add to XYWWWEB.INF).

Operation is the same as before. I made a slight adjustment to the
program logic, too boring to explain, that will avoid an error in
the rare situation where the search string is front-loaded with 3-
byte characters. Use this version, please, and discard all earlier.

I must say, it's pretty darn fast. Tested successfully with search
and replace strings totaling 2KB, or about 25 times the length of
the CMline.

XPLeNCODE v2.0
b-gin [UNTITLED]
Help screen (add to XYWWWEB.INF):[cr|lf][cr|lf]{LCI,LCIA,LCI/
T,LCIA/T,LCI*}[cr|lf][cr|lf]LCI -- C.L.Distefano rev.12/3/10{032}
(successor to BIGCHG)[cr|lf]Change Invisible on Long strings:
 Substitute for native CI command when the search and replace
 strings are too long for the command line (CMLine)[cr|lf][cr
|lf]LCI takes arguments in the same form as the CI command:[c
r|lf]{separator}string_to_find{separator}replacement_string{s
eparator}[cr|lf]The {separator} can be any character not cont
ained in either the string_to_find or the replacement_string{032}
(same as CI).[cr|lf][cr|lf]For simplicity's sake, the followi
ng documentation uses "/old_string/new_string/" as the argume
nt.[cr|lf][cr|lf]Usages (2)[cr|lf]----------[cr|lf]1) XPL usa
ge:[cr|lf][≪_]SV50,/old_string/new_string/[≫_]JM 2.LCI[A][/
T]Q2 [cr|lf][cr|lf]2) Command usage:[cr|lf]With the subject f
ile -- the file you want to change -- in the[cr|lf]current wi
ndow, open a blank NEw file:[cr|lf] NE[cr|lf]The subj
ect file should now be in the alternate screen.[cr|lf]At the{032}
very top of the NEw file, put the argument:[cr|lf]/old_string
/new_string/[cr|lf](A text window is needed because the argum
ent is too long for the CMline!)[cr|lf]Now, on the CMline, wi
th the NEw file (search argument) still in the[cr|lf]current{032}
window and the subject file still in the alternate screen,[cr
|lf]issue:[cr|lf]LCI[A][/T][cr|lf][cr|lf]Framename v
ariants[cr|lf]------------------[cr|lf]LCI = Change Invisible
[cr|lf]LCIA = Change Invisible, case Absolute search[cr|lf]LC
I/T = Change Invisible, start from Top of subject file[cr|lf]
LCIA/T = Change Invisible, case Absolute search, start from T
op of[cr|lf]subject file[cr|lf][cr|lf]Notes:[cr|lf]1. Operati
on is from cursor position to end of file (unless option T is
 used).[cr|lf]2. Wildcards are NOT allowed in either the sear
ch or the replace string. "Wildcard" means ANY red reverse-vi
deo character that stands for one or more other characters.[c
r|lf]3. Frame {<}MDSO{>}{<}LBLin
k{<}SV50,U2L{>}[JM_]2.help[Q2_]{>}U2L{<}MDNM{>} can be used t
o execute this routine. Be aware, however, that the U2L comma
nd window has a 660-character limit. Usage 2 above avoids thi
s limit, but the usual out-of-memory considerations applicabl
e to XPL programs are still in play. The routine has been tes
ted successfully with arguments of about 2KB in length.[cr|lf
][cr|lf]{<}FC{>}[cr|lf]For use by RENUMBER.PM:[cr|lf]Renumber
 frame LCI* in PACK mode[cr|lf]Default Save/Get Range = 01-05
; 50-51[cr|lf]OPTIONs(1): FREEZE 50-51[cr|lf]{<}FL{>}[cr|lf][
cr|lf]U2 frame (add to U2):[cr|lf][cr|lf]{{;5LCI*}} ChangeInv
isible on long strings [CLD rev.12/3/10][cr|lf]{002}[BX_]es 1
[Q2_]{<}LBa{>}{<}IF{<}VA$WS{>}==1{>}{<}IF{<}VA|50{>}<1{>}[XD_
][YD_][XP_][TF_][DF_][BF_][DF_]{<}SV50{>}[YD_][AS_]{<}GLa{>}{
<}EI{>}[DX_]{<}IF{<}VA|50{>}>0{>}{<}SV01,{027}X{>}{<}SV02,{>}
{<}XS50,01,,01,02{>}{<}IF{<}IS02{>}{240}{<}IS01{>}{>}{<}SV03,
{>}{<}XS02,01,50,,03{>}{<}SX51,{<}IS03{>}{>}{<}IF{<}IS03{>}{2
40}{<}IS01{>}{>}{<}SV51,{>}{<}XS03,01,51,,02{>}{<}EI{>}{<}SU0
1,{<}SX02,0{>}{<}IF@upr({<}IS03{>})==@upr({<}IS50{>}){>}{<}SX
02,1{>}{<}EI{>}{>}{<}IF@upr({<}VA$FR{>}){240}"A"{>}{<}SU01,{<
}SX02,0{>}{<}IF{<}IS03{>}=={<}IS50{>}{>}{<}SX02,1{>}{<}EI{>}{
{062}}{<}EI{>};*;[cr|lf]{<}SV03,{027}X{027}X{027}X{027}X{027}X{02
7}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027
}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}
X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X
{>}{<}SV04,{>}{<}XS50,03,03,04,03{>}{<}IF{<}VA|04{>}<1{>}{<}S
X04,{<}IS50{>}{>}{<}EI{>}{<}IF@upr({<}VA$FR{>}){240}"T"{>}[TF
_][TF_]{<}EI{>}{<}SX05,0{>}{<}LBb{>}[BX_]se [999]{<}PV04{>}[9
99][Q2_]{<}IF@not({<}ER{>}){>}[BX_]seb [999]{<}PV04{>}[999][Q
2_]{<}SX03,{<}CP{>}+{<}VA|50{>}{>}[YD_][DF_][BX_]jmp {<}PV03{
{062}}[Q2_]
[DF_]{<}SV03{>}{<}GT01{>}{<}IF{<}PV02{>}>0{>}[DN_]{<}GT51{>}{
<}SX05,{<}PV05{>}+1{>}{<}EI{>}{<}IF{<}VA$DE{>}>0{>}[DB_][YD_]
[CR_]{<}EI{>}{<}GLb{>}{<}EI{>}{<}SX50,{<}IS05{>}{>}{<}SX01,{<
}IS05{>}+" changes"{>}{<}LBc{>}{<}PR@01{>}{<}EX{>}{<}EI{>}{<}
EI{>}{<}SX50,-2{>}{<}SV01,Bad or missing search input{>}{<}GL
c{>}{<}EI{>}{<}SX50,-1{>}{<}SV01,No file{>}{<}GLc{>}{002}[cr|
lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx