1 // editor '93
2 // Copyright (C) 2009 Core Technologies.
3 
4 // This file is part of e93.
5 //
6 // e93 is free software; you can redistribute it and/or modify
7 // it under the terms of the e93 LICENSE AGREEMENT.
8 //
9 // e93 is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // e93 LICENSE AGREEMENT for more details.
13 //
14 // You should have received a copy of the e93 LICENSE AGREEMENT
15 // along with e93; see the file "LICENSE.TXT".
16 
17 #include	"includes.h"
18 
19 static bool
20 	aborting;		// keeps latched abort state
21 
CheckUserAbort()22 bool CheckUserAbort()
23 // See if the user is trying to abort an operation.
24 // NOTE: If an abort input is seen, this latches the abort state
25 // until later cleared by ClearUserAbort. This is done so that if
26 // a Tcl script is within a "catch" function when the abort occurs
27 // (which would cause the script to ignore the error that is inserted
28 // during the abort), we'll keep telling the script to abort with each
29 // new command that is executed until it finally stops.
30 // This is a bit ugly, but Tcl does not provide an uncatchable error.
31 // Perhaps later, we could overload Tcl's catch function with one which
32 // will recognize an abort.
33 {
34 	if(aborting||CheckAbort())
35 	{
36 		aborting=true;
37 	}
38 	return(aborting);
39 }
40 
ClearUserAbort()41 void ClearUserAbort()
42 // Clear any pending user abort
43 {
44 	aborting=false;
45 	ClearAbort();
46 }
47 
UnInitUserAbort()48 void UnInitUserAbort()
49 // Undo what InitUserAbort did
50 {
51 }
52 
InitUserAbort()53 bool InitUserAbort()
54 // Initialize aborting
55 {
56 	ClearUserAbort();
57 	return(true);
58 }
59