Design::get_flag returns const char* instead of string.

This commit is contained in:
steve 2003-11-10 20:59:03 +00:00
parent 995cd449c5
commit 43f28b53a3
7 changed files with 57 additions and 23 deletions

29
main.cc
View File

@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: main.cc,v 1.74 2003/11/01 04:22:30 steve Exp $" #ident "$Id: main.cc,v 1.75 2003/11/10 20:59:03 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -81,7 +81,8 @@ const char*target = "null";
generation_t generation_flag = GN_DEFAULT; generation_t generation_flag = GN_DEFAULT;
map<string,string> flags; map<string,const char*> flags;
char*vpi_module_list = 0;
map<string,unsigned> missing_modules; map<string,unsigned> missing_modules;
@ -280,10 +281,22 @@ static void read_iconfig_file(const char*ipath)
ivlpp_string = strdup(cp); ivlpp_string = strdup(cp);
} else if (strcmp(buf,"module") == 0) { } else if (strcmp(buf,"module") == 0) {
flags["VPI_MODULE_LIST"] = flags["VPI_MODULE_LIST"]+","+cp; if (vpi_module_list == 0) {
vpi_module_list = strdup(cp);
} else {
char*tmp = (char*)realloc(vpi_module_list,
strlen(vpi_module_list)
+ strlen(cp)
+ 2);
strcat(tmp, ",");
strcat(tmp, cp);
vpi_module_list = tmp;
}
flags["VPI_MODULE_LIST"] = vpi_module_list;
} else if (strcmp(buf, "out") == 0) { } else if (strcmp(buf, "out") == 0) {
flags["-o"] = cp; flags["-o"] = strdup(cp);
} else if (strcmp(buf, "root") == 0) { } else if (strcmp(buf, "root") == 0) {
roots.push_back(strdup(cp)); roots.push_back(strdup(cp));
@ -335,7 +348,8 @@ static void read_iconfig_file(const char*ipath)
static void parm_to_flagmap(const string&flag) static void parm_to_flagmap(const string&flag)
{ {
string key, value; string key;
const char*value;
unsigned off = flag.find('='); unsigned off = flag.find('=');
if (off > flag.size()) { if (off > flag.size()) {
key = flag; key = flag;
@ -343,7 +357,7 @@ static void parm_to_flagmap(const string&flag)
} else { } else {
key = flag.substr(0, off); key = flag.substr(0, off);
value = flag.substr(off+1); value = strdup(flag.substr(off+1).c_str());
} }
flags[key] = value; flags[key] = value;
@ -702,6 +716,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.cc,v $ * $Log: main.cc,v $
* Revision 1.75 2003/11/10 20:59:03 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.74 2003/11/01 04:22:30 steve * Revision 1.74 2003/11/01 04:22:30 steve
* Accept functors in the config file. * Accept functors in the config file.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: net_design.cc,v 1.41 2003/09/20 01:05:36 steve Exp $" #ident "$Id: net_design.cc,v 1.42 2003/11/10 20:59:03 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -462,9 +462,9 @@ void NetScope::evaluate_parameters(Design*des)
} }
string Design::get_flag(const string&key) const const char* Design::get_flag(const string&key) const
{ {
map<string,string>::const_iterator tmp = flags_.find(key); map<string,const char*>::const_iterator tmp = flags_.find(key);
if (tmp == flags_.end()) if (tmp == flags_.end())
return ""; return "";
else else
@ -617,6 +617,9 @@ void Design::delete_process(NetProcTop*top)
/* /*
* $Log: net_design.cc,v $ * $Log: net_design.cc,v $
* Revision 1.42 2003/11/10 20:59:03 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.41 2003/09/20 01:05:36 steve * Revision 1.41 2003/09/20 01:05:36 steve
* Obsolete find_symbol and find_event from the Design class. * Obsolete find_symbol and find_event from the Design class.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: netlist.h,v 1.305 2003/11/08 20:06:21 steve Exp $" #ident "$Id: netlist.h,v 1.306 2003/11/10 20:59:03 steve Exp $"
#endif #endif
/* /*
@ -3165,9 +3165,9 @@ class Design {
steps can then use the get_flag() function to get the value steps can then use the get_flag() function to get the value
of an interesting key. */ of an interesting key. */
void set_flags(const map<string,string>&f) { flags_ = f; } void set_flags(const map<string,const char*>&f) { flags_ = f; }
string get_flag(const string&key) const; const char* get_flag(const string&key) const;
NetScope* make_root_scope(const char*name); NetScope* make_root_scope(const char*name);
NetScope* find_root_scope(); NetScope* find_root_scope();
@ -3259,7 +3259,7 @@ class Design {
NetProcTop*procs_; NetProcTop*procs_;
NetProcTop*procs_idx_; NetProcTop*procs_idx_;
map<string,string> flags_; map<string,const char*> flags_;
int des_precision_; int des_precision_;
@ -3310,6 +3310,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.306 2003/11/10 20:59:03 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.305 2003/11/08 20:06:21 steve * Revision 1.305 2003/11/08 20:06:21 steve
* Spelling fixes in comments. * Spelling fixes in comments.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.104 2003/09/03 23:33:30 steve Exp $" #ident "$Id: t-dll-api.cc,v 1.105 2003/11/10 20:59:03 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -32,7 +32,7 @@
extern "C" const char*ivl_design_flag(ivl_design_t des, const char*key) extern "C" const char*ivl_design_flag(ivl_design_t des, const char*key)
{ {
return des->self->get_flag(key).c_str(); return des->self->get_flag(key);
} }
extern "C" int ivl_design_process(ivl_design_t des, extern "C" int ivl_design_process(ivl_design_t des,
@ -1913,6 +1913,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
/* /*
* $Log: t-dll-api.cc,v $ * $Log: t-dll-api.cc,v $
* Revision 1.105 2003/11/10 20:59:03 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.104 2003/09/03 23:33:30 steve * Revision 1.104 2003/09/03 23:33:30 steve
* Pass FF synchronous set values to code generator. * Pass FF synchronous set values to code generator.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll.cc,v 1.121 2003/09/03 23:33:29 steve Exp $" #ident "$Id: t-dll.cc,v 1.122 2003/11/10 20:59:04 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -562,8 +562,8 @@ void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
bool dll_target::start_design(const Design*des) bool dll_target::start_design(const Design*des)
{ {
list<NetScope *> root_scopes; list<NetScope *> root_scopes;
dll_path_ = des->get_flag("DLL"); const char*dll_path_ = des->get_flag("DLL");
dll_ = ivl_dlopen(dll_path_.c_str()); dll_ = ivl_dlopen(dll_path_);
if (dll_ == 0) { if (dll_ == 0) {
cerr << "error: " << dll_path_ << " failed to load." << endl; cerr << "error: " << dll_path_ << " failed to load." << endl;
cerr << dll_path_ << ": " << dlerror() << endl; cerr << dll_path_ << ": " << dlerror() << endl;
@ -2159,6 +2159,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/* /*
* $Log: t-dll.cc,v $ * $Log: t-dll.cc,v $
* Revision 1.122 2003/11/10 20:59:04 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.121 2003/09/03 23:33:29 steve * Revision 1.121 2003/09/03 23:33:29 steve
* Pass FF synchronous set values to code generator. * Pass FF synchronous set values to code generator.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll.h,v 1.106 2003/09/03 23:33:29 steve Exp $" #ident "$Id: t-dll.h,v 1.107 2003/11/10 20:59:04 steve Exp $"
#endif #endif
# include "target.h" # include "target.h"
@ -95,7 +95,6 @@ struct dll_target : public target_t, public expr_scan_t {
void memory(const NetMemory*); void memory(const NetMemory*);
ivl_dll_t dll_; ivl_dll_t dll_;
string dll_path_;
ivl_design_s des_; ivl_design_s des_;
@ -684,6 +683,9 @@ struct ivl_variable_s {
/* /*
* $Log: t-dll.h,v $ * $Log: t-dll.h,v $
* Revision 1.107 2003/11/10 20:59:04 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.106 2003/09/03 23:33:29 steve * Revision 1.106 2003/09/03 23:33:29 steve
* Pass FF synchronous set values to code generator. * Pass FF synchronous set values to code generator.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: t-xnf.cc,v 1.49 2003/07/05 20:42:08 steve Exp $" #ident "$Id: t-xnf.cc,v 1.50 2003/11/10 20:59:04 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -225,7 +225,7 @@ void target_xnf::draw_sym_with_lcaname(ostream&os, string lca,
bool target_xnf::start_design(const Design*des) bool target_xnf::start_design(const Design*des)
{ {
out_.open(des->get_flag("-o").c_str(), ios::out | ios::trunc); out_.open(des->get_flag("-o"), ios::out | ios::trunc);
string ncfpath = des->get_flag("ncf"); string ncfpath = des->get_flag("ncf");
if (ncfpath != "") if (ncfpath != "")
@ -235,7 +235,7 @@ bool target_xnf::start_design(const Design*des)
out_ << "PROG,verilog,$Name: $,\"Icarus Verilog\"" << endl; out_ << "PROG,verilog,$Name: $,\"Icarus Verilog\"" << endl;
ncf_ << "# Generated by Icarus Verilog $Name: $" << endl; ncf_ << "# Generated by Icarus Verilog $Name: $" << endl;
if (des->get_flag("part") != "") { if (des->get_flag("part") != 0) {
out_ << "PART," << des->get_flag("part") << endl; out_ << "PART," << des->get_flag("part") << endl;
ncf_ << "CONFIG PART=" << des->get_flag("part") << ";" << endl; ncf_ << "CONFIG PART=" << des->get_flag("part") << ";" << endl;
} }
@ -932,6 +932,9 @@ extern const struct target tgt_xnf = { "xnf", &target_xnf_obj };
/* /*
* $Log: t-xnf.cc,v $ * $Log: t-xnf.cc,v $
* Revision 1.50 2003/11/10 20:59:04 steve
* Design::get_flag returns const char* instead of string.
*
* Revision 1.49 2003/07/05 20:42:08 steve * Revision 1.49 2003/07/05 20:42:08 steve
* Fix some enumeration warnings. * Fix some enumeration warnings.
* *