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

Re: Ascii 255, 64k limit, Off the record



Reply to note from Morris Krok  Tue, 07 Nov
2000 04:50:44 -0800

-> Is there a way to ovecome the 64k limit when loading a
-> pers.spl file in Xy4?

*Is* there a 64K limit for .SPL files? (Tim?) I don't know any way
around the limit, whatever it is.

-> In a Xy3 program, BC se /R0 NO BD BD/ XC enables one to search
-> for Acii 255 and so locate an embedded function. Is there a way
-> to do so in Xy4?

There is, but it can't be done with a simple SEarch command. You
need to do some programming. This is a by-product of a fundamental
change in the way that functions and other 3-byte characters are
handled on the command line, introduced in Xy4 to make it easier to
search for Speedo characters (the ones that display in draft view as
a boldface number in square brackets). Overall, searching for
3-byte characters became more intuitive (what you put in the SEarch
command is what's found in the file). But a simple search to find
any 3-byter was lost in the process.

A few months ago I posted some code (WILDFUNC.PM) which finds any
embedded function in Xy4|XyW|NBW. Here it is again, in slightly
expanded form. Note that your Xy3 command finds not only functions,
but any 3-byte entity. WILDFUNC is dedicated to functions only.
(Another Jumbo U2 routine will find any 3-byter. Command
F3.)

WILDFUNC now provides an exit code (saved to Save/Get 50), to make
it easier to use as a U2-based subroutine which can be called by
other programs. The exit codes are as follows: -1=No file open;
0=Func not found; 1=Non-standard func found; 2=Regular func found.
So, whereas in Xy3 you'd write:

BC se /R0 NO BD BD/ XC )>


Now, in Xy4++, you can write:

JM 2.wildfuncQ2 (>)1>;*;


Command DECode to convert the following into working code.

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}GLa{>}[cr|lf]{{;5wildfunc}} Template for "wild" function s
earch [CLD][cr|lf]{2};*;     Working code with comments{32}
(rev 07.XI.2000);[cr|lf];*;       read in eXPanded view
[cr|lf];*;      RUN WILDFUNC.PM against itself to see it
 work[cr|lf];*;[cr|lf];*; Preliminaries[cr|lf];*; Cancel any{32}
displayed menu or dialog box (func XH). Check for a file[cr|l
f];*; in the current window; if none, report the error and EX
it[cr|lf]{<}LBa{>}[XH_]{<}IF{<}VA$WS{>}<>1{>}{<}SV50,-1{>}{<}
PRNo file{>}{<}EX{>}{<}EI{>};*;[cr|lf];*;[cr|lf];*; Freeze th
e display (DX) (optional); no need to unfreeze (DO) later,[cr
|lf];*; because we EXit when func is found (or not found); Xy
|NBWin restores[cr|lf];*; the display automatically on EXit.{32}
Enable Error Suppression (ES 1)[cr|lf][DX_][BX_]es 1[Q2_];*;[
cr|lf];*;[cr|lf];*; Put a 1-byte Ascii-255 into Save/Get (S/G
) 52 for later use[cr|lf];*; (procedure: parse func NO [;255+
129+163] around Ascii-129)[cr|lf]{<}SV51,[NO_]{>}{<}SV52,{129
}{>}{<}XS51,52,52,,53{>};*; <== S/G 52 has Ascii-255![cr|lf];
*;[cr|lf];*; Set some initial values (don't overwrite S/G 52{32}
-- we need it!)[cr|lf];*; 51=single-char parsing wildcard; 53
=initial cursor position[cr|lf]{<}SV51,{27}X{>}{<}SX53,{<}CP{
>}{>};*;[cr|lf];*;[cr|lf];*; Now let's save an array of all o
dd-numbered 1-byte Ascii chars[cr|lf];*; to S/G 54. First, w
e use an indirect method to save Ascii-1[cr|lf];*; to S/G 55.
 We do this to make WILDFUNC.PM "U2-friendly"; Ascii-1[cr|lf
];*; and -2 act as code delimiters in Help files, so they can
't[cr|lf];*; appear literally in XPL routines stored in such{32}
files (e.g.,[cr|lf];*; XYWWWEB.U2). So let's parse a func @0{32}
[;255-128-1] around Ascii-128:[cr|lf]{<}SV54,[@0_]{>}{<}SV55,
{128}{>}{<}XS54,55,,56,55{>};*; <== S/G 55 has Ascii-1![cr|lf
];*;[cr|lf];*; Next, we use an indirect method to save an Asc
ii-175 right guillemet[cr|lf];*; ([255+65+70]) to S/G 54. Thi
s avoids unbalanced guillemets ([255+65+69] [255+65+70] [255+
65+70]) in the[cr|lf];*; concatenation that follows[cr|lf]
{<}SV54,{<}|{>}{>}{<}SX54,{<}VA@54|2{>}{>};*; <== S/G 54 has{32}
Ascii-175![cr|lf];*;[cr|lf];*; Now we're ready to string the{32}
whole array together, in S/G 54[cr|lf]{<}SX54,{<}IS55{>}+"{3}
{5}{7}{tab}{11}{13}{15}{17}{19}{21}{23}{25}{27}{29}{31}!#%')+
-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}{129}{131}{133}{135
}{137}{139}{141}{143}{145}{147}{149}{151}{153}{155}{157}{159}
{161}{163}{165}{167}{169}{171}{173}"+{<}IS54{>}+"{177}{179}{1
81}{183}{185}{187}{189}{191}{193}{195}{197}{199}{201}{203}{20
5}{207}{209}{211}{213}{215}{217}{219}{221}{223}{225}{227}{229
}{231}{233}{235}{237}{239}{241}{243}{245}{247}{249}{251}{253}
"+{<}IS52{>}{>};*; <==last in series is 255[cr|lf];*;[cr|lf];
*; We're ready to roll![cr|lf];*; Report "Working" on the PRo
mpt line, to avoid a "brain-dead"[cr|lf];*; appearance while{32}
covering long stretches of function-less code[cr|lf]{<}PRWork
ing{>};*;[cr|lf];*;[cr|lf];*; Begin loop with a threshold con
dition, to wit:[cr|lf];*; Cursor NOT at end of file ({32}
must be 0)[cr|lf]{<}LBb{>}{<}IF{<}VA$FE{>}<1{>};*;[cr|lf];*;[
cr|lf];*; Move the cursor forward one char at a time, noting{32}
the difference[cr|lf];*; between cursor positions. If the di
fference isn't 3, we haven't[cr|lf];*; passed a 3-byte charac
ter, so loop back to LaBel "b"[cr|lf]{<}SX55,{<}CP{>}{>}[CR_]
{<}IF{<}CP{>}-{<}PV55{>}<>3{>}{<}GLb{>}{<}EI{>};*;[cr|lf];*;[
cr|lf];*; Otherwise, eureka, we found a 3-byter: DeFine it an
d save to a[cr|lf];*; S/G (55 is available for re-use)[cr|lf]
[DF_][CL_][DF_]{<}SV55{>}[YD_][CR_];*;[cr|lf];*;[cr|lf];*; Is
 it a function? We apply a three-pronged test:[cr|lf];*;[cr|l
f];*; Prong 1: The first byte must be an Ascii-255![cr|lf]{<}
IF{<}IS52{>}{238}{<}IS55{>}==0{>};*;[cr|lf];*;[cr|lf];*; Next
, to test bytes 2 and 3, we parse them into discrete S/Gs[cr|
lf];*; (55 -- re-used yet again -- and 58, respectively). Thi
s parsing[cr|lf];*; procedure is interesting, but let's leave
 the full explanation for[cr|lf];*; another day. The double{32}
commas in the XS statements deno
te a[cr|lf];*; throwaway segment (actually, it's saved to S/G
 00). This avoids[cr|lf];*; introducing a new S/G number for{32}
a mere by-product of our code[cr|lf]{<}SX56,{<}IS52{>}+"{252}
"+{<}IS55{>}{>}{<}XS56,51,,55,57{>}{<}XS57,51,,55,58{>};*;[cr
|lf];*;              S/G 55 has byte 2 --^ ^--{32}
S/G 58 has byte 3[cr|lf];*;[cr|lf];*; Prong 2: The second byt
e must be Ascii 128, 129 or 130![cr|lf]{<}IF"{128}{129}{130}"
{240}{<}IS55{>}{>};*;[cr|lf];*;[cr|lf];*; Prong 3: The third{32}
byte must be an odd-numbered Ascii char![cr|lf];*; If it's ev
en-numbered, we have a non-standard func.[cr|lf];*; Here we u
se the array of odd-numbered chars set up earlier[cr|lf];*; i
n S/G 54 and test for the absence of S/G 58 (byte 3)[cr|lf]{<
}IF{<}IS58{>}{238}{<}IS54{>}<0{>};*; <== If TRUE, we have a n
on-standard func[cr|lf];*;[cr|lf];*; A non-standard func is a
 rare occurrence, so let's flag it by beeping[cr|lf];*; 3 tim
es (we don't need S/G 51 anymore, so let's re-use it)...[cr|l
f]{<}SX51,3{>}{<}CUc,51{>}[BX_]beep[Q2_]{<}LBc{>};*;[cr|lf];*
;[cr|lf];*; ...as well as reporting our find on the PRompt li
ne[cr|lf]{<}PRNon-standard func here!{>}{<}SV50,1{>}{<}EX{>}{
<}EI{>};*;[cr|lf];*;[cr|lf];*; Note: Funcs with an even-numbe
red third byte look and behave like[cr|lf];*; regular funcs.{32}
Compare "[BC_]" (standard) with "[255+129+30]" (non-standard)
:[cr|lf];*; put cursor on each func and issue V3 to{32}
view the constituent[cr|lf];*; bytes. Run each func (by DeFin
ing it and issuing RUNCODE) to[cr|lf];*; see that th
ey both blank the command line[cr|lf];*;[cr|lf];*; If all thr
ee tests are passed, report Func found and EXit[cr|lf]{<}PRFu
nc here{>}{<}SV50,2{>}{<}EX{>}{<}EI{>};*;[cr|lf];*;[cr|lf];*;
 Otherwise, it's not a func, so move on (loop back to LaBel "
b")[cr|lf]{<}EI{>}{<}GLb{>};*;[cr|lf];*;[cr|lf];*; At this po
int, the threshold condition <1, at LaBel "b"[cr|lf];*
; above, is FALSE and we're at the End of File. Return cursor
 to[cr|lf];*; initial position
, beep once, report Func not found, and EXit[cr|lf]{<}EI{>}[B
X_]jmp {<}PV53{>}[Q2_][BX_]beep[Q2_]{<}SV50,0{>}{<}PRNo func{
>}{<}EX{>}{2}[cr|lf][cr|lf]
-nd
XPLeNCODE


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