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

Re: NR (no ruler)



Reply to note from Harry Binswanger  Thu, 31 Jan 2008
11:44:51 -0800

Harry:

> >Later, you restore the original value with , which
> executes >the manufactured routine "BX d xx=vQ2 "
>
> I'm still shaky on this. Is the BX (and the Q2) a Pfunc or
> text? How do you execute it with the ?

They're real, 3-byte functions! The manufactured routine couldn't
later be executed (and do its intended job) otherwise. A more
specific example might help. Here's a routine that sets default NW
(which, as you know, controls window opening|closing behavior) to a
value of 3, and manufactures a routine in S/G 01 to restore the
original value (with ):

XPLeNCODE v2.0
b-gin [UNTITLED]
Force Default NW=3; restore original value with {<}PV01{>}[cr
|lf]{<}SV01,{>}{<}IF{<}VA$NW{>}<>3{>}{<}SX01,{<}VA$NW{>}{>}{<
}SX01,"[BX_]d nw="+{<}IS01{>}+"[Q2_]"{>}[BX_]d nw=3[Q2_]{<}EI
{>};*;[cr|lf]
-nd
XPLeNCODE

> Why would one do this rather than just, at the end, having the
> code do [BX] d xx=v[Q2]?

Fair question. If the program has a single EXit point, simply writing
BX d nw=Q2  is fine, perhaps preferable. If the routine has
multiple EXit points, though, it's more efficient to manufacture the
subroutine and do  wherever necessary.

There are, of course, other ways to skin the cat. You could
manufacture a conventional SUbroutine, +"Q2 ">,
and execute it with  -- or , take your pick. (The reverse
does not hold, however. If you use  to manufacture your
code, you MUST use  to execute it;  would simply print the
code to screen.) More conventional still (and wasteful of resources)
would be to save the current value to one S/G, >, and use
another S/G for the SUbroutine, thus: Q2 >. But
that needlessly multiplies the number of S/Gs (two versus one) and
bloats the code. Ockham's razor skins the cat best.

> I'm confused about what's inside or outside a S/G--and why.

I hope this helps. But, really, Harry, to get a firm grasp on these
basic -- and powerful -- concepts, there's no substitute for the
horse's mouth: you've got to peruse Robert's ground-breaking texts,
CTRLCHAR.TXT and KBD-PM.TXT -- especially CTRLCHAR.TXT. They're the
magna carta of XPL technique, and they've been around for two decades,
yet it never ceases to amaze me how many serious XyWriters are
unfamiliar with these essential texts.

--
Carl Distefano
cld@xxxxxxxx