[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Porting DLG funcs $0-$9|$A-$Z to U2
- Subject: Porting DLG funcs $0-$9|$A-$Z to U2
- From: cld@xxxxxxxx (Carl Distefano)
- Date: Sat, 25 Aug 2001 03:26:55 -0400 (EDT)
Last month Annie Fisher, in describing her recent experiments with
NBWin and XyWin, noted that she had "retrieved the $[A-Z/0-9]
options missing from xyWin as well and for all I know from Signature
and all its progeny." The allegedly missing options are Help frames
with names in the form $x, where x is any character in the range 0-9
or A-Z. Any such frame could then be launched by invoking the
eponymous *function*, whether in the keyboard file (nn=$A), on the
command line (func $A) or in XPL (3-byte func $A created with PFUN
$A). In other words, Xy3 provided 36 user-(re)definable functions
($A-$Z|$0-$9) on the same footing with the 360+ other, non-variable
funcs that are the basic building blocks of XPL and of XyWrite
itself -- very nifty indeed. The user-created definitions for these
$x functions resided as XPL programs in Help frames located in the
..HLP file.
Starting with Signature (1991), the $x functions no longer worked --
if, that is, the corresponding Help frames were located in the .HLP
file. They were not, however, lost or "missing". Signature
expanded the Help system from a single .HLP file to up to 12 Help-
file types with distinct file IDs (HL|DG|MN|U1-U9, corresponding to
filename extensions .HLP, .DLG, .MNU, and .U1 - .U9). Although the
$x functions were no longer supported in the .HLP file, they *were*
and continue to be supported in the .DLG (DiaLoG box) Help file (and
only there). This is true of Xy4, XyWin and NBWin.
The reason for moving support for $x funcs to .DLG is obscure. It's
a puzzling choice, given that (a) the factory-issued .DLG file
doesn't use any of these functions and (b) the Help files reserved
for user programming were .U1 and .U2, not .DLG -- although there
was nothing (except perhaps a dearth of documentation) to stop users
from customizing factory-issued DiaLog boxes as well. It's thus
entirely understandable that Xy3 users seeking to port their func $x
definitions to Xy4+ would look for a way to relocate those
definitions from the .DLG file to more familiar territory, that is
to say, to .U2.
Annie explains how she did so at http://www.escape.com/~
yesss/_x45xpl.htm>. (No carriage return, of course, in the preceding
URL.) The technique, in brief, is to have each $x frame in .DLG
point to a corresponding frame in .U2 that contains the operative
code. Thus, the .DLG file might have a frame, $A, that looks like
this ("{2}" represents the Ascii-2 reverse-video smiley face):
{{5$A}}
{2}JM 2.$AQ2 {2}
The JM 2.$AQ2 statement calls a U2 routine, also named $A. The U2
routine is the one that has the code that defines how func $A
behaves. To inspect or edit it, you no longer have to open the .DLG
file; you can open the same file that contains all the rest of your
user programming, .U2. (A Jumbo U2 command, NABFRM [name]
takes you directly to any U2 frame.)
All of this is prefatory to introducing a simple procedure by which
*all* func $x definitions, not merely specific named ones, can be
relocated en masse from .DLG to .U2. All that's required in the
..DLG file is a single Type-5 frame:
{{5$?}}
{2}>JM 2.Q2 {2}
The framename "$?" uses the single-character wildcard (?) to
reference the entire class of $x frames. captures the
specific instance of any $x framename; the .DLG frame then calls the
corresponding .U2 routine. I suggest using Save/Get 00 as the
framename holder in order to minimize the possibility of Save/Get
conflicts when the underlying code of $x acts as a parent calling a
child routine or when $x is itself the child (subroutine). It
works.
-----
Apropos of none of the foregoing, at the URL above Annie complains:
> Just now, e.g., I can't persuade a subroutine to go to a Sig+
> AlternateScreen to open the file listed at the cursor--a
> trivial xpl operation that can be coded in xyWrite 3 literally
> in about 10 seconds. No doubt it can be done in Sig+, but why
> waste more hours--
That's strange, Annie. I assume you mean that a directory is
displayed in the alternate screen and you want to CAll the file
under the cursor in that directory. Why not simply this:
AS >BX ca Q2 ;*;
Takes about 10 seconds to write, and it works.
--
Carl Distefano
cld@xxxxxxxx
http://users.datarealm.com/xywwweb/