Fix for assertion error when expanding macro.
[iverilog.git] / LineInfo.cc
blob98f7541ceae3530503c581b568a4b76a5763ee01
1 /*
2 * Copyright (c) 2000 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: LineInfo.cc,v 1.4 2003/01/17 05:49:03 steve Exp $"
21 #endif
23 # include "config.h"
25 # include "LineInfo.h"
26 # include <sstream>
28 LineInfo::LineInfo()
29 : file_(0), lineno_(0)
33 LineInfo::~LineInfo()
37 string LineInfo::get_line() const
39 ostringstream buf;
40 buf << (file_? file_ : "") << ":" << lineno_;
42 string res = buf.str();
43 return res;
46 void LineInfo::set_line(const LineInfo&that)
48 file_ = that.file_;
49 lineno_ = that.lineno_;
52 void LineInfo::set_file(const char*f)
54 file_ = f;
57 void LineInfo::set_lineno(unsigned n)
59 lineno_ = n;
63 * $Log: LineInfo.cc,v $
64 * Revision 1.4 2003/01/17 05:49:03 steve
65 * Use stringstream in place of sprintf.
67 * Revision 1.3 2002/08/12 01:34:58 steve
68 * conditional ident string using autoconfig.
70 * Revision 1.2 2001/07/25 03:10:48 steve
71 * Create a config.h.in file to hold all the config
72 * junk, and support gcc 3.0. (Stephan Boettcher)
74 * Revision 1.1 2000/11/30 17:31:42 steve
75 * Change LineInfo to store const C strings.