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

Re: XPL Program Glitch



Nathan:

The reason your code always toggles into graphics view is
that it fails to EXit after resetting the original
display type. Without an  statement after funcs WG,
SP and WZ, execution will always continue to func WZ --
hence the persistent graphical display. The fix is easy.
Move the instruction that cancels the DeFine (ES in your
code, YD below) to just before LaBel "end", and insert
's after the display-restoring functions, thus:

....YD ==1>WG ;*;
==2>SP ;*;
==4>WZ 

But -- aside from the fact that there are many
display-type values that this code won't restore --
there's a larger problem. Absent a DeFine block, as soon
as you toggle the display back to a non-eXPanded view,
XyWrite forces the cursor to move past the 
instruction, so that any newly-inserted text is NOT in
italics as expected, but in the MoDe prevailing
immediately before ! Therefore, where no text is
DeFined, you need to toggle eXPanded view and *stay
there*, so that any inserted text takes on the desired
MoDe. Thus, the code to restore the display type can and
should be eliminated.

To simplify matters further, recall that when text is
DeFined, a lone MD +IT command automatically inserts
 and  at the beginning and end of the
block, irrespective of the current display type. Thus,
the MD -IT command and the toggle to eXPanded view are
needed only when no DF block is present.

A couple of additional refinements: VAlue $DF can be an
inaccurate indicator of DeFined text, in that it returns
0 where text has been DeFined but the DeFine hasn't been
"closed" with a second func DF. The foolproof test for a
DF block is to execute func DZ (which closes any
partially DeFined block but otherwise does nothing) and
then test for $DE, which returns 1 if text is
(completely) DeFined, else 0. Finally, to position the
cursor in eXPanded view, I'd replace the seven Cursor
Left instructions with a single SEarch backwards for a
left guillemet. Thus, in pseudo-code (where "[w<]"
represents the left guillemet wildcard character and
"(>)" represents the greater-than sign), you'd have:

DZ BX md +itQ2 (>)0>DE YD ;*;
XP BX md -itQ2 BX seb [w<]Q2 

The working version of the above is attached as ITAL2.PM.

--
Carl Distefano
cld@xxxxxxxx
http://users.datarealm.com/xywwweb/


Attachment: ital2.pm
Description: Binary data