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

Re: Handling of 00h bytes by XyWrite



Reply to note from wbass@xxxxxxxxxxxx Fri, 23 Aug 2024 23:59:47 +0000 (UTC)

Wally,

I didn't want your fascinating post to slip by unnoticed, just have not had the time to focus on it.

> But what is it that makes you think that the bytes weren't
> stripped out as the file was being loaded into the edit buffer for
> editing, rather than as it was being saved back to disk?

No, I agree: the NULs are stripped out as the file is loaded into the edit buffer.

> So what I did was
> <SV04,{escape}X><XSmm,04,03,01,02><SX01,<IS01>+<ISO2>>, which
uses
> the XS parse function and a "wildcard" as a way to do the copy --
> we use the "any byte" wildcard to break up the string into "the
> first byte" and "the rest", and then put the parts back together.
> 
> And that worked, when followed by a <GTnn> operation to transfer
> the data to the edit buffer. The NULs don't show on the screen,
> but they were present after saving the file to disk.

The XS parser is indispensable for manipulating XyWrite control characters. That's been community
knowledge and basic XPL procedure ever since Holmgren's 1990 CTRLCHAR.TXT <https://ammaze.net/xywwweb/dls/CTRLCHAR.ZIP>.
If there's another way, no one's proposed it in 34 years. Hence I see XS as natural and in no way
bizarre. It allows XPL to construct, save to Save/Gets and write to disk strings that could not in a
million years be displayed in a XyWrite edit buffer. Call it one of XPL's hidden superpowers.

> that is the first time I have ever seen XyWrite write a file that
> had an EOF anywhere other than as the last byte of the file.

Again, it doesn't surprise me that *writing* such a concatenation of bytes is possible in XyWrite.
You can't compose it in a Xy edit buffer, but you absolutely can use XPL to construct it in memory
and then save it to disk as a file. 

Next question: What are the practical applications, if any? Or is it all just fun with theory? One
practical app that comes to mind is my U2 routine SEFU. It stands for SEarch For Unsearchable and
allows you to do things like search for wildcard literals in a file displayed in XyWrite. It uses XS
to parse a 3-byte "wildcard-like" character to get Ascii 254 and 255 into Save/Gets. Xy4
code (of course); here it is in pseudo-code, decodable with xdecode.exe (https://ammaze.net/xywwweb/dls/xencode.zip).
But the real star in SEFU is the epsilon containment operator.

XPLeNCODE v2.0 (xencode.exe)
b-gin [UNTITLED]
{123}{123}5SEfu{125}{125} Search for "unSEarchable" strings {091}
CLD rev.3/2/09; rev.5/23/12 to put exit code in S/G 51 (-1=no fil
e; 0=not found; 1=found){093}[cr|lf]{002}{<}IF{<}VA$WS{>}==1{>}{<
}SX01,0{>}[DZ_]{<}IF{<}VA$DE{>}>0{>}{<}SV50{>}{<}SX01,{<}VA$DN{>}
-{<}VA$DS{>}{>}{<}EI{>}{<}IF{<}VA|50{>}>0{>}[BX_]es 1[Q2_][XP_]{<
}SV02,[255+252+254]{>}[255+129+163]{<}SV03,{252}{>}{<}XS02,03,04,
05,05{>}{<}SV06,{>}{<}SV07,{>}{<}IF@upr({<}IS50{>})=="F"!@upr({<}
IS50{>})=="W"{>}{<}SV06,{027}X{>}{<}IF@upr({<}IS50{>})=="F"{>}{<}
SV07,{128}{129}{130}{>}{<}IF{<}VA$ED{>}{240}"DLL"{>}{<}SX07,{<}IS
07{>}+"{131}"{>}{<}EI{>}{<}EI{>}{<}EI{>}{<}IF{<}IS50{>}=="255"!{<
}VA|06{>}>1{>}{<}SX50,{<}IS04{>}{>}{<}GLa{>}{<}EI{>}{<}IF{<}IS50{
>}=="254"{>}{<}SX50,{<}IS05{>}{>}{<}EI{>}{<}LBa{>}{<}SX02,{<}CP{>
}{>}[DX_]{<}PRSearching{>}{<}LBb{>}[YD_][CR_]{<}IF{<}VA$FE{>}<1{>
}{<}SX03,{<}CP{>}+1024{>}[DF_][BX_]jmp {<}PV03{>}[Q2_]{<}IF{<}VA$
FE{>}<1{>}[CR_][CL_]{<}EI{>}[DF_]{<}SV08{>};*;[cr|lf];*; Arg {091
}search_string{093}, 254, 255, F or W:[cr|lf]{<}IF{<}IS50{>}<>"3"
{>}{<}SV09,{>}{<}XS08,50,03,10,09{>}{<}SX09,{<}IS50{>}{238}{<}IS0
8{>}{>}{<}IF{<}IS10{>}<>{<}IS50{>}&{<}PV09{>}<0{>}{<}GLb{>}{<}EI{
>};*;[cr|lf];*; Possible hit:[cr|lf]{<}SX03,{<}VA$DS{>}+{<}VA|03{
>}{>}{<}LBc{>}{<}IF{<}PV09{>}>-1{>};*;[cr|lf];*; Wild func or wil
d wildcard (arg F or W):[cr|lf]{<}IF{<}VA|06{>}>1{>}{<}SX03,{<}VA
$DS{>}+{<}PV09{>}+3{>}[BX_]jmp {<}PV03{>}[Q2_][YD_][DF_][CL_];*;[
cr|lf];*;   Tame erratic cursor on "hot" 3-byter:[cr|lf]{<}IF{<}C
P{>}<>{<}PV03{>}-3{>}{<}SX03,{<}PV03{>}-3{>}[BX_]jmp
{<}PV03{>}[Q
2_]{<}EI{>};*;[cr|lf][DF_]{<}SV09{>}[YD_]{<}SX08,{<}IS50{>}+"{252
}"+{<}IS09{>}{>}{<}XS08,06,10,10,10{>}{<}XS10,06,09,09,08{>};*;[c
r|lf]{<}IF{<}VA|07{>}>0&{<}IS09{>}{238}{<}IS07{>}<0{>}{<}GLb{>}{<
}EI{>};*; Not a
func[cr|lf]{<}IF{<}VA|07{>}<1&({<}IS09{>}<"{192}"
!{<}IS09{>}=="{192}"&{<}IS08{>}<"{128}"){>};*; Not a
wildcard[cr|
lf]{<}GLb{>}{<}EI{>};*;[cr|lf]{<}SX03,{<}CP{>}{>}{<}GLd{>}{<}EI{>
};*; Func or wildcard found[cr|lf];*; Search_string found:[cr|lf]
{<}SX03,{<}VA$DS{>}+{<}PV09{>}{>}{<}EI{>}[YD_][BX_]jmp {<}PV03{>}
[Q2_]{<}IF{<}PV01{>}>0{>}{<}SX01,{<}CP{>}+{<}PV01{>}{>}[DO_][FF_]
[DF_][BX_]jmp {<}PV01{>}[Q2_][DF_][DB_]{<}EI{>}[DX_]{<}LBd{>}{<}I
F{<}VA$CY{>}>7{>}[MU_]{<}GLd{>}{<}EI{>}{<}SX02,"Found:
{<}CP{>}="
+{<}IS03{>}{>}[DO_][FF_]{<}SX51,1{>}{<}PR@02{>}{<}EX{>}{<}EI{>};*
;[cr|lf];*; Wild 3-byter (arg 3):[cr|lf]{<}SX09,-1{>}{<}IF{<}IS08
{>}{240}{<}IS04{>}{>}{<}SX09,{<}IS04{>}{238}{<}IS08{>}{>}{<}EI{>}
{<}IF{<}IS08{>}{240}{<}IS05{>}{>}{<}IF{<}PV09{>}<0!{<}IS05{>}{238
}{<}IS08{>}<{<}PV09{>}{>}{<}SX09,{<}IS05{>}{238}{<}IS08{>}{>}{<}E
I{>}{<}EI{>}{<}IF{<}PV09{>}<0{>}{<}GLb{>}{<}EI{>}{<}GLc{>}{<}EI{>
}[BX_]jmp {<}PV02{>}[Q2_][DO_][FF_]{<}SX51,0{>}{<}PRNot found{>}{
<}EX{>}{<}EI{>}{<}PRSEFU {091}search_string{093}|3|254|255|F|W<He
lpkey>{>}{<}EX{>}{<}EI{>}{<}SX51,-1{>}{<}PRNo file{>}{002}[cr|lf]
[cr|lf]{026}
-nd
XPLeNCODE

Any other ideas?

-- 
Carl Distefano
cld@xxxxxxxxxx