ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/SimCreator.cpp
(Generate patch)

Comparing trunk/src/brains/SimCreator.cpp (file contents):
Revision 770 by tim, Fri Dec 2 15:38:03 2005 UTC vs.
Revision 845 by tim, Wed Jan 11 19:01:20 2006 UTC

# Line 46 | Line 46
46   * @time 13:51am
47   * @version 1.0
48   */
49 <
49 > #include <exception>
50   #include <iostream>
51   #include <sstream>
52   #include <string>
# Line 63 | Line 63
63   #include "mdParser/MDParser.hpp"
64   #include "mdParser/MDTreeParser.hpp"
65   #include "mdParser/SimplePreprocessor.hpp"
66 + #include "antlr/ANTLRException.hpp"
67 + #include "antlr/TokenStreamRecognitionException.hpp"
68 + #include "antlr/TokenStreamIOException.hpp"
69 + #include "antlr/TokenStreamException.hpp"
70 + #include "antlr/RecognitionException.hpp"
71 + #include "antlr/CharStreamException.hpp"
72  
73 + #include "antlr/MismatchedCharException.hpp"
74 + #include "antlr/MismatchedTokenException.hpp"
75 + #include "antlr/NoViableAltForCharException.hpp"
76 + #include "antlr/NoViableAltException.hpp"
77  
78   #ifdef IS_MPI
79   #include "math/ParallelRandNumGen.hpp"
# Line 92 | Line 102 | Globals* SimCreator::parseFile(const std::string mdFil
102                  streamSize = ppStream.str().size() +1;
103                  commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD);                  
104  
105 <                commStatus = MPI_Bcast(ppStream.str().c_str(), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);
105 >                commStatus = MPI_Bcast(static_cast<void*>(const_cast<char*>(ppStream.str().c_str())), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD);
106              
107                  
108              } else {
# Line 137 | Line 147 | Globals* SimCreator::parseFile(const std::string mdFil
147               simParams = treeParser.walkTree(parser.getAST());
148  
149          }
140        catch (exception& e) {
141            cerr << "parser exception: " << e.what() << endl;
142        }
150  
151 +      
152 +      catch(antlr::MismatchedCharException& e) {
153 +          sprintf(painCave.errMsg,
154 +                  "parser exception: %s %s:%d:%d\n",
155 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
156 +          painCave.isFatal = 1;
157 +          simError();          
158 +      }
159 +      catch(antlr::MismatchedTokenException &e) {
160 +          sprintf(painCave.errMsg,
161 +                  "parser exception: %s %s:%d:%d\n",
162 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
163 +          painCave.isFatal = 1;
164 +          simError();  
165 +      }
166 +      catch(antlr::NoViableAltForCharException &e) {
167 +          sprintf(painCave.errMsg,
168 +                  "parser exception: %s %s:%d:%d\n",
169 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
170 +          painCave.isFatal = 1;
171 +          simError();  
172 +      }
173 +      catch(antlr::NoViableAltException &e) {
174 +          sprintf(painCave.errMsg,
175 +                  "parser exception: %s %s:%d:%d\n",
176 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
177 +          painCave.isFatal = 1;
178 +          simError();  
179 +      }
180 +      
181 +        catch(antlr::TokenStreamRecognitionException& e) {
182 +          sprintf(painCave.errMsg,
183 +                  "parser exception: %s %s:%d:%d\n",
184 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
185 +          painCave.isFatal = 1;
186 +          simError();  
187 +        }
188 +        
189 +        catch(antlr::TokenStreamIOException& e) {
190 +          sprintf(painCave.errMsg,
191 +                  "parser exception: %s\n",
192 +                  e.getMessage().c_str());
193 +          painCave.isFatal = 1;
194 +          simError();
195 +        }
196 +        
197 +        catch(antlr::TokenStreamException& e) {
198 +          sprintf(painCave.errMsg,
199 +                  "parser exception: %s\n",
200 +                  e.getMessage().c_str());
201 +          painCave.isFatal = 1;
202 +          simError();
203 +        }        
204 +       catch (antlr::RecognitionException& e) {
205 +          sprintf(painCave.errMsg,
206 +                  "parser exception: %s %s:%d:%d\n",
207 +                  e.getMessage().c_str(),e.getFilename().c_str(), e.getLine(), e.getColumn());
208 +          painCave.isFatal = 1;
209 +          simError();          
210 +       }
211 +       catch (antlr::CharStreamException& e) {
212 +          sprintf(painCave.errMsg,
213 +                  "parser exception: %s\n",
214 +                  e.getMessage().c_str());
215 +          painCave.isFatal = 1;
216 +          simError();        
217 +       }
218 +       catch (OOPSEException& e) {
219 +          sprintf(painCave.errMsg,
220 +                  "%s\n",
221 +                  e.getMessage().c_str());
222 +          painCave.isFatal = 1;
223 +          simError();
224 +       }
225 +       catch (std::exception& e) {
226 +          sprintf(painCave.errMsg,
227 +                  "parser exception: %s\n",
228 +                  e.what());
229 +          painCave.isFatal = 1;
230 +          simError();
231 +       }
232 +
233          return simParams;
234    }
235    
# Line 186 | Line 275 | Globals* SimCreator::parseFile(const std::string mdFil
275      }
276      
277      ff->parse(forcefieldFileName);
278 <        
278 >    ff->setFortranForceOptions();
279      //create SimInfo
280      SimInfo * info = new SimInfo(ff, simParams);
281      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines