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

Re: Error checking in XPL



Rafe wanted to know how to open a file but go to it if it's already open.
Actually, the most straightforward way is backwards:

BX (or BC) gofile [filename] Q2 (or XC)
)>
BX ca [filename] Q2 

In English: Go to [filename]. If you DON'T get an error, you're done.
Otherwise try to open it. It's a bit too simple; what if XyWrite can't find
[filename]? (Add if  and then create it with NEW? Exit with an error
message? Go to the Find routine?)

(All the < > chars are the programming chevrons; BX BC Q@ XC are function
calls.)

You can look at some really complicated and somewhat spaghetti-ish code in the
DLG file at {{5,Mempd}}. It has lots of other features, mostly ones you don't
need. But the general outline above should do the trick anyway.

Tim Baehr
tbaehr@xxxxxxxx