Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/vaclgui/openfile.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 * AnaGram, A System for Syntax Directed Programming | |
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
4 * See the file COPYING for license and usage terms. | |
5 * | |
6 * openfile.cpp | |
7 */ | |
8 | |
9 #include <icritsec.hpp> | |
10 | |
11 #include "data.h" | |
12 #include "error.h" | |
13 #include "openfile.hpp" | |
14 #include "operations.h" | |
15 #include "vaclgui.hpp" | |
16 | |
17 //#define INCLUDE_LOGGING | |
18 #include "log.h" | |
19 | |
20 | |
21 int analyzeThreadActive = 0; | |
22 | |
23 /***********************************************************/ | |
24 /* Overriding run() method for the file open thread */ | |
25 /* function class. This function is called implicitly */ | |
26 /* when a thread to open a file is dispatched. */ | |
27 /***********************************************************/ | |
28 void AnalyzeGrammarFn::run() { | |
29 LOGSECTION("Analyzing input file"); | |
30 LOGV((int) &IThread::current()); | |
31 IThread::current().setVariable("Error Message", ""); | |
32 try { | |
33 { | |
34 ICritSec cookie; | |
35 analyzeThreadActive = 1; | |
36 } | |
37 errorList.reset(); | |
38 analyzeGrammar(inputFile.text, 1 /* has GUI */); | |
39 LOGS("Normal return from analyzeGrammar"); | |
40 } | |
41 catch(IException &ie) { | |
42 LOGSECTION("catch(IException &)"); | |
43 LOGV(ie.text()); | |
44 IThread::current().setVariable("Error Message", ie.text()); | |
45 } | |
46 catch(Problem &p) { | |
47 LOGSECTION("catch(Problem &)"); | |
48 LOGV(p.msg); | |
49 IThread::current().setVariable("Error Message", p.msg); | |
50 } | |
51 ICritSec cookie; | |
52 analyzeThreadActive = 0; | |
53 } | |
54 | |
55 void BuildParserFn::run() { | |
56 LOGSECTION("BuildParserFn::run"); | |
57 try { | |
58 { | |
59 ICritSec cookie; | |
60 analyzeThreadActive = 1; | |
61 } | |
62 if (syntax_state != syntax_analyzed) { | |
63 errorList.reset(); | |
64 analyzeGrammar(inputFile.text, 1 /* has GUI, will travel */); | |
65 } | |
66 buildParser(); | |
67 LOGS("returned from buildParser"); | |
68 } | |
69 catch(IException &ie) { | |
70 LOGV(ie.text()); | |
71 IThread::current().setVariable("Error Message", ie.text()); | |
72 } | |
73 catch(Problem &p) { | |
74 LOGV(p.msg); | |
75 IThread::current().setVariable("Error Message", p.msg); | |
76 } | |
77 ICritSec cookie; | |
78 analyzeThreadActive = 0; | |
79 LOGS("Ready to exit"); | |
80 } | |
81 |