[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: v3 xpl buffer
- Subject: Re: v3 xpl buffer
- From: "..." adpf@xxxxxxxx
- Date: Fri, 21 Mar 1997 23:39:59 -0500 (EST)
≪ One expression that I've always wished could be manufactured by
concatenation (but can't) is the GoLabel (GL) statement. To take a v4
example, suppose S/G 01 can have three possible values: "red", "blue" and
"green"; you want execution to branch to a different LaBel depending on
the content of 01. How convenient if this were just a matter of
[SX01,"[GL"+[IS01]+"]"[PV01];*;
;*;
[LBred][PRHow embarrassing!][EX]
[LBblue][PRHow depressing!][EX]
[LBgreen][PRHow charming!][EX]
[...] You're relegated to a prolilx series of IF's ... EndIf's. ≫
Carl--Mmm, I dunno. !.LIB's proc {is33} wouldn't be all *that*
obnoxious in that situation:
{sv13,GREENRED}{sx12,{is01}}{pv33}{lb
}{if{pv13}>0}{PRHow embarrassing!}{ex}
{ei}{if{pv13}<0}{PRHow depressing!}{ex}
{ei}{PRHow charming!}{ex}
I lean heavily on {is33} in a multitude of circumstances.
When {is12} is empty, {is33} evaluates each char input on the fly:
{LBcv}{sv12,}{sv13,YSNAQ}{pv33}{if{pv13}<0}{GLcv}{ei}
Proc {is33} sorta joins C's getch and strchr:
{sv33,{lbG}{if@siz({is12})<1!{is12}e{is33}>85}{sx12,{rc}}{glG}
{ei}{sx13,@upr({is12})e{is13}}AR XH SI CI NI NO }
But yeah, xpl is imperfect and the string literal technique *is* demanding
with v3's arduous concatenation, but it solves so many problems it's
worth the hassle. When I was starting to push v3.52 xpl to see what
undocumented stuff it would do, I tried a lot of code that resembled
legal v4 concatenations--fruitlessly. I *still* can't believe v3 strings
must be assigned to variables, especially if some va$s needn't be. ...
Incidentally, proc {is34}'s lay-off of {is10} to {is44} was an
afterthought to enable nesting. Reexamining the code, I see that
the way {is34} was called needed editing--
{lb_MAKE_FOR}{sv44,>0}{sv84,-1}{pv34}{lb
}{lb_FOR}{sv54,BF {gt44}[o|]}{sv84,1}{pv44}
--which lets proc {is34}'s size be reduced somewhat:
{sv34,{sv10,if{pv84}}{sv12,{pv54}}{sv54,sx84,{pv84}}{lb
}{sx12,{is75}+{is74}+{is10}+{is44}+{is75}+{is12}+{is74}+{is54}+{is84}}{lb
}{sv10,lb4}{sv44,gl4}{sv54,ei}{lb
}{sx12,{is10}+{is12}+{is75}+{is74}+{is44}+{is75}+{is74}+{is54}}{lb
}{pv39}{sx44,{is10}}{sv10,}NO }
============================= adpFisher nyc