2008-05-28 18:17:39 +02:00
|
|
|
/*
|
|
|
|
|
* VHDL abstract syntax elements.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INC_VHDL_ELEMENT_HH
|
|
|
|
|
#define INC_VHDL_ELEMENT_HH
|
|
|
|
|
|
|
|
|
|
#include <fstream>
|
2008-05-29 17:24:16 +02:00
|
|
|
#include <list>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2008-06-06 18:36:15 +02:00
|
|
|
typedef std::list<std::string> string_list_t;
|
|
|
|
|
|
2008-06-02 01:12:47 +02:00
|
|
|
/*
|
|
|
|
|
* Any VHDL syntax element. Each element can also contain a comment.
|
|
|
|
|
*/
|
2008-05-28 18:17:39 +02:00
|
|
|
class vhdl_element {
|
2008-05-31 16:28:25 +02:00
|
|
|
public:
|
|
|
|
|
virtual ~vhdl_element() {}
|
|
|
|
|
|
2008-05-29 17:24:16 +02:00
|
|
|
virtual void emit(std::ofstream &of, int level=0) const = 0;
|
|
|
|
|
|
|
|
|
|
void set_comment(std::string comment);
|
|
|
|
|
protected:
|
2008-06-03 20:46:10 +02:00
|
|
|
void emit_comment(std::ofstream &of, int level,
|
|
|
|
|
bool end_of_line=false) const;
|
2008-05-29 17:24:16 +02:00
|
|
|
private:
|
|
|
|
|
std::string comment_;
|
2008-05-28 18:17:39 +02:00
|
|
|
};
|
|
|
|
|
|
2008-06-08 14:27:48 +02:00
|
|
|
typedef std::list<vhdl_element*> element_list_t;
|
2008-05-31 16:28:25 +02:00
|
|
|
|
2008-06-08 14:27:48 +02:00
|
|
|
int indent(int level);
|
|
|
|
|
void newline(std::ofstream &of, int level);
|
|
|
|
|
void blank_line(std::ofstream &of, int level);
|
2008-05-31 16:28:25 +02:00
|
|
|
|
2008-05-28 18:17:39 +02:00
|
|
|
#endif
|
2008-05-29 17:24:16 +02:00
|
|
|
|