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

Re: Lines in Startup.Int



Reply to note from jr_fox@xxxxxxxx Wed, 20 Sep 2000 10:38:39 -
0400

-> > The comment symbol is ;*; (semi-colon, star, semi-colon).
-> ...
-> I thought there _had_ to be something of this nature,
-> documented or not. Is anything like this employed inside XPL
-> routines or Help Frames, while you are designing or debugging
-> them ? (The XPL stuff I've looked at has always been
-> continuous code, rather than in any sort of structured-line
-> format.)

It's documented in "Signature: Making the Transition" at page 5-9.
Comments are not just for debugging, of course; they serve to
elucidate the code and make it easier on the eye. We use them
routinely in XYWWWEB.U2, in frames that have User Variables and
elsewhere. It's important to note that there's no speed penalty
whatsoever, even in programs that are heavily commented.

I recently wrote some demo code for one of the Nota Bene people who
asked about a procedure for locating functions. It's laden with
comments highlighting features that were added to XPL in Signature
and Xy4, which only recently became available to NB users with the
release of Nota Bene for Windows last year. One of the features
highlighted, come to think of it, is the availability of comments
themselves. You may find it instructive.

XyWWWeb users can issue DECode to decode what's below.
I've also appended it as an attachment to a separate message (re
WILDFUNC.PM).

Enjoy!

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}GLa{>}{<}LM{>}{<}RM{>}[cr|lf]{{;5wildfunc}} Template for "
wild" function search [CLD][cr|lf]{2};*;     Working cod
e with comments (rev 20.IX.2000);[cr|lf];*;       read{32}
in eXPanded view[cr|lf];*;      RUN WILDFUNC.PM against{32}
itself to see it work[cr|lf];*;[cr|lf];*; Preliminaries[cr|lf
];*; Cancel any displayed menu or dialog box (func XH). Check
 for a file[cr|lf];*; in the current window; if none, report{32}
the error and EXit[cr|lf]{<}LBa{>}[XH_]{<}IF{<}VA$WS{>}<>1{>}
{<}PRNo file{>}{<}EX{>}{<}EI{>};*;[cr|lf];*;[cr|lf];*; Freeze
 the 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 EXi
t. 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 [;2
55+129+163] around Ascii-129)[cr|lf]{<}SV51,[NO_]{>}{<}SV52,{
129}{>}{<}XS51,52,52,,53{>};*; <== S/G 52 has Ascii-255![cr|l
f];*;[cr|lf];*; Set some initial values (don't overwrite S/G{32}
52 -- 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 al
l odd-numbered 1-byte Ascii chars[cr|lf];*; to S/G 54. First
, we use an indirect method to save Ascii-1[cr|lf];*; to S/G{32}
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{32}
can't[cr|lf];*; appear literally in XPL routines stored in su
ch files (e.g.,[cr|lf];*; XYWWWEB.U2). So let's parse a func{32}
@0 [;255-128-1] around Ascii-128:[cr|lf]{<}SV54,[@0_]{>}{<}SV
55,{128}{>}{<}XS54,55,,56,55{>};*; <== S/G 55 has Ascii-1![cr
|lf];*;[cr|lf];*; Next, we use an indirect method to save an{32}
Ascii-175 right guillemet[cr|lf];*; ([255+65+70]) to S/G 54.{32}
This avoids unbalanced guillemets ([255+65+69] [255+65+70] [2
55+65+70]) in the[cr|lf];*; concatenation that fol
lows[cr|lf]{<}SV54,{<}|{>}{>}{<}SX54,{<}VA@54|2{>}{>};*; <=={32}
S/G 54 has Ascii-175![cr|lf];*;[cr|lf];*; Now we're ready to{32}
string the whole array together, in S/G 54[cr|lf]{<}SX54,{<}I
S55{>}+"{3}{5}{7}{tab}{11}{13}{15}{17}{19}{21}{23}{25}{27}{29
}{31}!#%')+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}{129}{13
1}{133}{135}{137}{139}{141}{143}{145}{147}{149}{151}{153}{155
}{157}{159}{161}{163}{165}{167}{169}{171}{173}"+{<}IS54{>}+"{
177}{179}{181}{183}{185}{187}{189}{191}{193}{195}{197}{199}{2
01}{203}{205}{207}{209}{211}{213}{215}{217}{219}{221}{223}{22
5}{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 PRompt line, to avoid a "brain-dead"[cr|lf];*; appear
ance while covering long stretches of function-less code[cr|l
f]{<}PRWorking{>};*;[cr|lf];*;[cr|lf];*; Begin loop with a th
reshold condition, to wit:[cr|lf];*; Cursor NOT at end of fil
e ( must be 0)[cr|lf]{<}LBb{>}{<}IF{<}VA$FE{>}<1{>};*;
[cr|lf];*;[cr|lf];*; Move the cursor forward one char at a ti
me, noting the difference[cr|lf];*; between cursor positions.
 If the difference isn't 3, we haven't[cr|lf];*; passed a 3-
byte character, 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: D
eFine it and save to a[cr|lf];*; S/G (55 is available for re-
use)[cr|lf][DF_][CL_][DF_]{<}SV55{>}[YD_][CR_];*;[cr|lf];*;[c
r|lf];*; Is it a function? We apply a three-pronged test:[cr|
lf];*;[cr|lf];*; 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 discre
te S/Gs[cr|lf];*; (55 -- re-used yet again -- and 58, respect
ively). This parsing[cr|lf];*; procedure is interesting, but{32}
let's leave the full explanation for[cr|lf];*; another day. {32}
The double commas in the XS stat
ements denote a[cr|lf];*; throwaway segment (actually, it's s
aved to S/G 00). This avoids[cr|lf];*; introducing a new S/G{32}
number for a mere by-product of our code[cr|lf]{<}SX56,{<}IS5
2{>}+"{252}"+{<}IS55{>}{>}{<}XS56,51,,55,57{>}{<}XS57,51,,55,
58{>};*;[cr|lf];*;              S/G 55 has byte
 2 --^ ^-- S/G 58 has byte 3[cr|lf];*;[cr|lf];*; Prong 2: The
 second byte must be Ascii 128, 129 or 130![cr|lf]{<}IF"{128}
{129}{130}"{240}{<}IS55{>}{>};*;[cr|lf];*;[cr|lf];*; Prong 3:
 The third byte must be an odd-numbered Ascii char![cr|lf];*;
 If it's even-numbered, we have a non-standard func.[cr|lf];*
; Here we use the array of odd-numbered chars set up earlier[
cr|lf];*; in S/G 54 and test for the absence of S/G 58 (byte{32}
3)[cr|lf]{<}IF{<}IS58{>}{238}{<}IS54{>}<0{>};*; <== If TRUE,{32}
we have a non-standard func[cr|lf];*;[cr|lf];*; A non-standar
d func is a rare occurrence, so let's flag it by beeping[cr|l
f];*; 3 times (we don't need S/G 51 anymore, so let's re-use{32}
it)...[cr|lf]{<}SX51,3{>}{<}CUc,51{>}[BX_]beep[Q2_]{<}LBc{>};
*;[cr|lf];*;[cr|lf];*; ...as well as reporting our find on th
e PRompt line[cr|lf]{<}PRNon-standard func here!{>}{<}EX{>}{<
}EI{>};*;[cr|lf];*;[cr|lf];*; Note: Funcs with an even-number
ed third byte look and behave like[cr|lf];*; regular funcs. C
ompare "[BC_]" (standard) with "[255+129+30]" (non-standard):
[cr|lf];*; put cursor on each func and issue V3 to v
iew the constituent[cr|lf];*; bytes. Run each func (by DeFini
ng it and issuing RUNCODE) to[cr|lf];*; see that the
y both blank the command line[cr|lf];*;[cr|lf];*; If all thre
e tests are passed, report Func found and EXit[cr|lf]{<}PRFun
c here{>}{<}EX{>}{<}EI{>};*;[cr|lf];*;[cr|lf];*; Otherwise, i
t's not a func, so move on (loop back to LaBel "b")[cr|lf]{<}
EI{>}{<}GLb{>};*;[cr|lf];*;[cr|lf];*; At this point, the thre
shold condition <1, at LaBel "b"[cr|lf];*; above, is F
ALSE and we're at the End of File. Return cursor to[cr|lf];*;
 initial position, beep once, report F
unc not found, and EXit[cr|lf]{<}EI{>}[BX_]jmp {<}PV53{>}[Q2_
][BX_]beep[Q2_]{<}PRNo func{>}{<}EX{>}{2}[cr|lf][cr|lf]
-nd
XPLeNCODE

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