ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/generic_stamps/MoleculeStamp.cpp
(Generate patch)

Comparing trunk/mdtools/generic_stamps/MoleculeStamp.cpp (file contents):
Revision 165 by mmeineke, Thu Nov 7 17:53:29 2002 UTC vs.
Revision 184 by mmeineke, Thu Nov 21 20:33:06 2002 UTC

# Line 5 | Line 5
5  
6   #include "MoleculeStamp.hpp"
7  
8 + char MoleculeStamp::errMsg[500];
9 +
10   MoleculeStamp::MoleculeStamp(){
11    
12    n_atoms = 0;
# Line 205 | Line 207 | char* MoleculeStamp::addAtom( AtomStamp* the_atom, int
207  
208   char* MoleculeStamp::addAtom( AtomStamp* the_atom, int atomIndex ){
209    
208  char err[200];
209  
210    if( have_atoms && atomIndex < n_atoms ) atoms[atomIndex] = the_atom;
211    else{
212      if( have_atoms ){
213 <      sprintf( err, "MoleculeStamp error, %d out of nAtoms range",
213 >      sprintf( errMsg, "MoleculeStamp error, %d out of nAtoms range",
214                 atomIndex );
215 <      return strdup( err );
215 >      return strdup( errMsg );
216      }
217      else return strdup("MoleculeStamp error, nAtoms not given before"
218                         "first atom declaration." );
# Line 223 | Line 223 | char* MoleculeStamp::addBond( BondStamp* the_bond, int
223  
224   char* MoleculeStamp::addBond( BondStamp* the_bond, int bondIndex ){
225    
226  char err[200];
226    
227    if( have_bonds && bondIndex < n_bonds ) bonds[bondIndex] = the_bond;
228    else{
229      if( have_bonds ){
230 <      sprintf( err, "MoleculeStamp error, %d out of nBonds range",
230 >      sprintf( errMsg, "MoleculeStamp error, %d out of nBonds range",
231                 bondIndex );
232 <      return strdup( err );
232 >      return strdup( errMsg );
233      }
234      else return strdup("MoleculeStamp error, nBonds not given before"
235                         "first bond declaration." );
# Line 241 | Line 240 | char* MoleculeStamp::addBend( BendStamp* the_bend, int
240  
241   char* MoleculeStamp::addBend( BendStamp* the_bend, int bendIndex ){
242    
244  char err[200];
243    
244    if( have_bends && bendIndex < n_bends ) bends[bendIndex] = the_bend;
245    else{
246      if( have_bends ){
247 <      sprintf( err, "MoleculeStamp error, %d out of nBends range",
247 >      sprintf( errMsg, "MoleculeStamp error, %d out of nBends range",
248                 bendIndex );
249 <      return strdup( err );
249 >      return strdup( errMsg );
250      }
251      else return strdup("MoleculeStamp error, nBends not given before"
252                         "first bend declaration." );
# Line 259 | Line 257 | char* MoleculeStamp::addTorsion( TorsionStamp* the_tor
257  
258   char* MoleculeStamp::addTorsion( TorsionStamp* the_torsion, int torsionIndex ){
259    
262  char err[200];
260    
261    if( have_torsions && torsionIndex < n_torsions )
262      torsions[torsionIndex] = the_torsion;
263    else{
264      if( have_torsions ){
265 <      sprintf( err, "MoleculeStamp error, %d out of nTorsions range",
265 >      sprintf( errMsg, "MoleculeStamp error, %d out of nTorsions range",
266                 torsionIndex );
267 <      return strdup( err );
267 >      return strdup( errMsg );
268      }
269      else return strdup("MoleculeStamp error, nTorsions not given before"
270                         "first torsion declaration." );
# Line 280 | Line 277 | char* MoleculeStamp::checkMe( void ){
277    
278    int i;
279    short int no_atom;
283  char err[120];
280    
281    if( !have_name || !have_atoms ){
282      if( !have_name ) return strdup( "MoleculeStamp error. Molecule's name"
# Line 294 | Line 290 | char* MoleculeStamp::checkMe( void ){
290    }
291  
292    if( no_atom ){
293 <    sprintf( err,
293 >    sprintf( errMsg,
294               "MoleculeStamp error. Not all of the atoms were"
295               " declared in molecule \"%s\".\n", name );
296 <    return strdup( err );
296 >    return strdup( errMsg );
297    }
298  
299    return NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines