00001 00007 /* 00008 Copyright (C) 2000 The Exult Team 00009 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef INCL_UCLOC 00026 #define INCL_UCLOC 1 00027 00028 #include <vector> 00029 00030 /* 00031 * Location in source code. 00032 */ 00033 class Uc_location 00034 { 00035 static std::vector<char *> source_names;// All filenames. 00036 static char *cur_source; // Source filename. 00037 static int cur_line; // Line #. 00038 static int num_errors; // Total #. 00039 char *source; 00040 int line; 00041 public: 00042 Uc_location() // Use current location. 00043 : source(cur_source), line(cur_line) 00044 { } 00045 static void set_cur(const char *s, int l); 00046 static void increment_cur_line() 00047 { cur_line++; } 00048 const int get_line() 00049 { return line; } 00050 const char *get_source() 00051 { return source; } 00052 void error(char *s); // Print error. 00053 static void yyerror(char *s); // Print error at cur. location. 00054 static int get_num_errors() 00055 { return num_errors; } 00056 }; 00057 00058 #endif