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

Re: Error checking in XPL



Reply to note from "R Tennenbaum"  Wed,
03 Jun 98 18:55:29 -0500

-> The other question I've got is surely a long shot: Since I tend
-> to have several Xy sessions open, does anyone happen to know
-> whether there's any way to ensure that if a file is opened in
-> one session, it can only be called up in read-only mode if it's
-> called up in another?

Rafe:

The short answer to your question is: No. The longer answer is,
well, Yes. There's no "native" way to do it, but I can think of at
least one kludge-y, inelegant, non-foolproof procedure that *will*
work. It would involve creating and manipulating a disk file -- a
common resource that's available to concurrent sessions -- that
lists the names of all files open in any XyWrite session.

Here's what I have in mind: Create two XPL routines, Open and
Close. Before CAlling a file, Open would check the file list; if
the filename is there, it would REad rather than CAll the file;
otherwise, it would CAll the file and add the filename to the list.
The companion program Close would first check whether the file is
displayed in Read-Write mode; if it is, it would remove the filename
from the list before SToring or ABorting the file.

It's pretty simple; in fact, I worked out a prototype (appended to
this message in UUencoded form). The procedure is, I think, good;
the main caveat is that you must *unfailingly* use Open and Close
instead of their native equivalents. Once you starting CAlling or
ABorting files in concurrent sessions, the system breaks down.

Attached and UUencoded are a set of routines, which must be run from
a U2 Help file with a Helpkey installed (visit XyWWWeb for
instructions). The usages are:

 OPEN [filename]
and
 CLOSE S[tore]|A[bort]

If you omit the argument from CLOSE, it will prompt you for the
desired option. A third routine, GetFileList, is called by both
Open and Close to read the file list.


begin 644 OPENCLOS.PM
MKD=,8:^N3$VOKE)-KPT*>WLU;W!E;GU]#0H"KE-8,#`LKDE3-3"OKZY,0F&O
M_X*G_X*K*&5S(#$I.RH[#0JN4U@P,2RN5D$D5T&OKZY)1JY05C`QKSPQKZY0
M4DYO('=I;F1O=Z^N15BOKD5)K_^"JRAF=6YC(".N4%8P,:\IKE-8,#$LKDE3
M,#"OKZY36#`R+*Y)4S`QKZ^N24:N25,P,:_P(CHBKZY36#`Q+*Y604`P,3HR
MKZ^N14FOKDQ"8J^N24:N25,P,:_P(EPBKZY35C`S+%ROKEA3,#$L,#,L,#0L
M+#`UKZY36#`Q+*Y)4S`TKRNN25,P-:^OKD=,8J^N14FOKE-8,#$L0'5POKZY04D`P,:^N
M15BO`@T*#0JN1TQEKPT*>WLU8VQOJ^N4U@P,2RN5D$D15*OKZY36#`Q+"*N5D%<(BNN25,P,:\K
M(J\BKZY36#`Q+*Y05C`QKZ^N4%)`,#&OKD58,:^N14FO.RH[#0H[*CL-"JY)
M1JY602121:\\,:__@J,H,BY'971&:6QE3&ES="D[*CL-"CLJ.PT*KDE&KDE3
M,#:O\*Y)4S`QKZ^N4U8P-"ROKEA3,#8L,#$L,#(L+#`TKZY36#`V+*Y)4S`R
MKRLB#0HB*ZY)4S`TKZ^N14FO_X*KJ^N14FO_X*K*'=A:70IKD5)KZY36#`Q+*Y6021-1Z^OKE!20#`QKZY%
M6*\"#0H-"GM[-4=E=$9I;&5,:7-T?7T-"@*N4U@P,RRN5D%$4J\K(D]014Y#
M3$]3+E1-4"*O_X*K97AIhttp://users.datarealm.com/xywwweb/