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

v3 xpl buffer [was Case change bug workaround]

≪	Annie, did the UD buffer share the 64K that v3 XPL also used? ≫ --Carl

≪	I belive they did share. [...] What seemed to be shared was UD
space and all S/G's--user and XPL. ≫ --Tim

v3 xpl imposes a real Hobson's choice: I often find myself trying
to decide whether to initialize the new s/g I need or lengthen the pgm
by recycling an existing one. I usually do the latter; at worst, if
the pgm gets too long I can make it modular. Best that can be said
is that it's good discipline.

I've lately been using two techniques to reduce xpl length.
One, libraries, is standard fare in high-level languages. The other
is a wildly improbable, stunningly original and effective method
of forming string literals I lifted from Robert Holmgren's code.
I'd never have thought of it myself in several lifetimes.
Proc {is39} from my !.LIB runtime library illustrates both:
	{sv39,{sv10,{ex}NO }{sx10,{is74}+{is12}+{is75}+{is10}}NO }
where {is22}, another library proc, has earlier saved guillemets as
{is74} and {is75}.

To illustrate proc {is39} at its simplest, say you had a pgm you wanted
to end at one label, with various msgs for various circumstances. Each
situation would s/g a msg before jumping to the end label ...
... etc. After performing whatever common routines at {LBx}, the pgm would:
{pv39} forms the appropriate {PRompt}, {is10} displays it.

In a more complex application, after one of my pgms collects a one-char
CMline arg or {rc}--initially {is12}--these two calls to {pv39} allowed
me to lop off 2K of lookup tables:
I.e., {pv10} = {sx00,{is[unknown]}} or {sx[unknown],{is00}}, where
[unknown] is the char {is12} grabbed. Bravo, Holmgren!

Proc {is34} also calls {is39}, and offloads {is39}'s {is10} as for loop
{is44}. After a call to proc {is34}, if {is84} meets the condition
arg {is44} declared, for loop {is44} performs proc {is54}, increases
or decreases the value of {is84} by the factor arg {is12} declared,
and loops. Usage ([o|] = ascii 13):

		}{sv54,BF {gt44}[o|]}{lb

If a file is open, that proc {is54} prints the loop's code to screen.
The step and condition values are fixed till {is34} is invoked again,
but loop {is44} as is can be recalled reinitialized and with a different
proc {is54}:
		}{sv54,TF {gt44}[o|]{if{pv84}>1}PP XD RP {ei}NO }{lb

Oh, yeah--the print-out ...

... and proc {is34}--
	}{sv10,lb4}{sx12,{is10}+{is12}}{pv39}{sx44,{is10}}{sv10,}NO }
--a good example of recycling variables lengthening code.

Just wanted to see how C language loops would look as xpl procs.
while and do loop procs are similar, and the loops can be nested--
i.e., while in for, etc., but not while in while. Nesting while in while
would just be a matter of hand-coding proc {is45}--
	(obviouly, proc {is55} must change {is85}'s value)
--as a different variable with different variable components. Etc. 	--a

============================= adpFisher  nyc