[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
RE WYXIN: MOV
And for those of us still at 3+, here's an extended version of
the program that I posted earlier (thanks to variables mentioned
by Daniel Say).
It's become a pair of programs now which make use of two friendly
features of XPL. First, an error can terminate a program, but it
will also terminate back into a calling program. Second, whereas
the 3-digit variables stay in memory, 2-digit variables can be
shared by calling programs.
The first is a little test program (and note that it is on alt-z,
but could be placed anywhere--but most be referenced properly):
≪lb-lit-key.pm to check status of 888≫≪gl-doit≫
≪lb-doit≫≪sx51,@SIZ(≪is888≫)≫≪if≪er≫≫≪sx53,0≫≪ex≫≪ ei≫
≪sx53,1≫≪ex≫
This is to cover the point in the main program that upon first use,
SX888 is undefined; that generates an error if one tries to use
it in any way. The @SIZ command generates a friendly error. If
the program has been used, @SIZ has a value, and so a "correct"
code of 1 is returned for the calling program.
The second does the work (I have it on alt-c):
≪lb-define on a key≫≪sx41,≪va$ds≫≫≪sx42,≪va$dn≫≫≪gl-start≫
$ds and $dn give the value of the define; it's picked up later.
≪lb-start≫≪sx53,0≫≪sx55,≪va$df≫≫≪if(≪pv55≫==0)≫
≪gl-alt≫≪ei≫≪gl-half≫
≪lb-alt≫@Z ≪gl-check≫
If there isn't an ongoing define (va$df = 0), then the subprogram
is called (say to put the save-get into the 2d half of a change).
I put it to a save-get, because theoretically someone has put
text on the command line (and we don't want to touch it--calling
a program by a key accomplishes that).
≪lb-check≫≪if(≪pv53≫==1)≫≪gl-put≫≪ei≫BC Define
something≪ex≫
If there was anything on save-get 888, it either gets put on the
command line or the program ends with its message.
≪lb-half≫≪if(≪pv41≫==≪pv42≫)≫≪PRDefine something≫≪ex≫
≪ei≫≪gl-half2≫
Here we check to see if the define is incomplete (no characters
defined and program ends).
≪lb-half2≫GT CR ≪sx43,≪va$dn≫≫CL ≪if(≪pv42≫==≪pv43≫)≫