Changeset 152


Ignore:
Timestamp:
1999-02-08T14:26:11+13:00 (25 years ago)
Author:
rjmcnab
Message:

Improved the error reporting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/display.cpp

    r118 r152  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/02/08 01:26:11  rjmcnab
     15
     16   Improved the error reporting.
     17
    1418   Revision 1.6  1999/01/19 08:30:23  rjmcnab
    1519
     
    752756        }
    753757
    754       if (!err && c == '_')
    755         {
    756           c = my_get(fin, line); // skip the _
    757 
    758           // skip all white space
    759           while (!fin.eof() && my_isspace(c)) c = my_get(fin, line);
    760         }
    761       else err = 1;
     758      if (!err && c == '_') {
     759        c = my_get(fin, line); // skip the _
     760       
     761        // skip all white space
     762        while (!fin.eof() && my_isspace(c)) c = my_get(fin, line);
     763      } else if (!err) err = 1;
    762764
    763765      // get the macro parameters (optional)
     
    779781          while (!fin.eof() && my_isspace(c)) c = my_get(fin, line);
    780782        }
    781           else err = 2;
     783          else if (!err) err = 2;
    782784        }
    783785
     
    833835     
    834836          err = 0; // for the test below
    835         } 
    836           else err = 3;
    837         } 
    838       else err = 4;
     837        }
     838          else if (!err) err = 3;
     839        }
     840      else if (!err) err = 4;
    839841
    840842      if (err)
     
    842844          // found an error, skip to the end of the line
    843845          if (logout != NULL) {
    844         (*logout) << text_t2ascii << "Err: Unexpected input on line ";
    845         (*logout) << line;
    846         (*logout) << text_t2ascii << " (";
    847         (*logout) << err;
    848         (*logout) << text_t2ascii << ")\n";
     846        (*logout) << text_t2ascii << "Error: ";
     847        if (err == 1) (*logout) << text_t2ascii << "'_'";
     848        else if (err == 2) (*logout) << text_t2ascii << "']'";
     849        else if (err == 3) (*logout) << text_t2ascii << "'}'";
     850        else if (err == 4) (*logout) << text_t2ascii << "'{'";
     851        (*logout) << text_t2ascii << " expected on line ";
     852        (*logout) << line ;
     853        (*logout) << text_t2ascii << " of " << thisfilename << "\n";
    849854          }
    850855          while (!fin.eof ())
Note: See TracChangeset for help on using the changeset viewer.