Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Location.H

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // File: Location.H 
00020 // Last Modified On Mon Apr 25 12:13:22 EDT 2005 by irina.furman@intel.com 
00021 //      Modified On Fri May 30 16:42:59 PDT 1997 by yuanyu 
00022 //      Modified On Fri Jan 26 18:10:23 PST 1996 by horning
00023 //      Modified On Mon Nov  8 09:32:45 PST 1993 by hanna  
00024 
00025 #ifndef Location_H
00026 #define Location_H
00027 
00028 #include "EvalBasics.H"
00029 #include <VestaSource.H>
00030 
00031 const int None = -1;
00032 
00033 // Source locations are specified by a file name, a line number, and
00034 // a character number within the line.
00035 class SrcLoc {
00036 public:
00037   SrcLoc()
00038     : line(None), character(None), file(emptyText), shortId(NullShortId)
00039       { /*SKIP*/ };
00040   SrcLoc(int linePos, int charPos, const Text& filename, ShortId sid)
00041     : line(linePos), character(charPos), file(filename), shortId(sid)
00042       { /*SKIP*/ };
00043   // 1. Create a location without a position.
00044   // 2. Create a location with a position.
00045   
00046   Text file;       // name of source modelfile
00047   ShortId shortId; // shortid of modelfile
00048   int line;        // line number for start of expression
00049   int character;   // character position in line of start of expression
00050 
00051   SrcLoc* Copy()
00052     { return NEW_CONSTR(SrcLoc, (line, character, file, shortId)); };
00053   // Copy tloc into this.
00054 
00055   void Init(const Text& filename, ShortId sid)
00056     { line = None; character = None; file = filename; shortId = sid; };
00057 
00058   bool IsNone() const
00059     { return (line == None && character == None); };
00060   // Return TRUE if this has no position.
00061 
00062 };
00063 
00064 // Useful constants:
00065 extern SrcLoc *noLoc;
00066 
00067 #endif // Location_H

Generated on Mon May 8 00:48:38 2006 for Vesta by  doxygen 1.4.2