Add support for getting the original port names of a UDP definition.
This patch adds support to the compiler/ivl interface for getting the original UDP definition port names. ivl_udp_port() was added to get this information.
This commit is contained in:
parent
757611b8e9
commit
53abd7a5b2
1
ivl.def
1
ivl.def
|
|
@ -288,6 +288,7 @@ ivl_udp_file
|
|||
ivl_udp_lineno
|
||||
ivl_udp_name
|
||||
ivl_udp_nin
|
||||
ivl_udp_port
|
||||
ivl_udp_row
|
||||
ivl_udp_rows
|
||||
ivl_udp_sequ
|
||||
|
|
|
|||
|
|
@ -1040,6 +1040,7 @@ extern unsigned ivl_udp_rows(ivl_udp_t net);
|
|||
extern const char* ivl_udp_name(ivl_udp_t net);
|
||||
extern const char* ivl_udp_file(ivl_udp_t net);
|
||||
extern unsigned ivl_udp_lineno(ivl_udp_t net);
|
||||
extern const char* ivl_udp_port(ivl_udp_t net, unsigned idx);
|
||||
|
||||
extern const char* ivl_lpm_file(ivl_lpm_t net);
|
||||
extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
|
||||
|
|
|
|||
11
net_udp.cc
11
net_udp.cc
|
|
@ -79,3 +79,14 @@ char NetUDP::get_initial() const
|
|||
assert(0);
|
||||
return 'x';
|
||||
}
|
||||
|
||||
unsigned NetUDP::port_count() const
|
||||
{
|
||||
return udp->ports.count();
|
||||
}
|
||||
|
||||
string NetUDP::port_name(unsigned idx) const
|
||||
{
|
||||
assert(idx < udp->ports.count());
|
||||
return udp->ports[idx];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
# include "LineInfo.h"
|
||||
# include "svector.h"
|
||||
# include "Attrib.h"
|
||||
# include "PUdp.h"
|
||||
|
||||
#ifdef HAVE_IOSFWD
|
||||
# include <iosfwd>
|
||||
|
|
@ -2144,7 +2145,6 @@ class NetUReduce : public NetNode {
|
|||
* 1 are listed.
|
||||
*
|
||||
*/
|
||||
#include "PUdp.h"
|
||||
|
||||
class NetUDP : public NetNode {
|
||||
|
||||
|
|
@ -2169,6 +2169,9 @@ class NetUDP : public NetNode {
|
|||
unsigned udp_lineno() const { return udp->get_lineno(); }
|
||||
char get_initial() const;
|
||||
|
||||
unsigned port_count() const;
|
||||
string port_name(unsigned idx) const;
|
||||
|
||||
private:
|
||||
mutable unsigned table_idx;
|
||||
PUdp *udp;
|
||||
|
|
|
|||
|
|
@ -867,6 +867,14 @@ extern "C" char ivl_udp_init(ivl_udp_t net)
|
|||
return net->init;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_udp_port(ivl_udp_t net, unsigned idx)
|
||||
{
|
||||
assert(idx <= net->nin);
|
||||
assert(net->ports);
|
||||
assert(net->ports[idx].c_str());
|
||||
return net->ports[idx].c_str();
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_udp_row(ivl_udp_t net, unsigned idx)
|
||||
{
|
||||
assert(idx < net->nrows);
|
||||
|
|
|
|||
22
t-dll.cc
22
t-dll.cc
|
|
@ -1270,12 +1270,9 @@ void dll_target::udp(const NetUDP*net)
|
|||
static map<perm_string,ivl_udp_t> udps;
|
||||
ivl_udp_t u;
|
||||
|
||||
if (udps.find(net->udp_name()) != udps.end())
|
||||
{
|
||||
if (udps.find(net->udp_name()) != udps.end()) {
|
||||
u = udps[net->udp_name()];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
u = new struct ivl_udp_s;
|
||||
u->nrows = net->rows();
|
||||
u->table = (ivl_udp_s::ccharp_t*)malloc((u->nrows+1)*sizeof(char*));
|
||||
|
|
@ -1284,21 +1281,22 @@ void dll_target::udp(const NetUDP*net)
|
|||
u->sequ = net->is_sequential();
|
||||
u->file = net->udp_file();
|
||||
u->lineno = net->udp_lineno();
|
||||
if (u->sequ)
|
||||
u->init = net->get_initial();
|
||||
else
|
||||
u->init = 'x';
|
||||
if (u->sequ) u->init = net->get_initial();
|
||||
else u->init = 'x';
|
||||
u->name = net->udp_name();
|
||||
string inp;
|
||||
char out;
|
||||
unsigned int i = 0;
|
||||
if (net->first(inp, out))
|
||||
do
|
||||
{
|
||||
if (net->first(inp, out)) do {
|
||||
string tt = inp+out;
|
||||
u->table[i++] = strings_.add(tt.c_str());
|
||||
} while (net->next(inp, out));
|
||||
assert(i==u->nrows);
|
||||
assert((u->nin + 1) == net->port_count());
|
||||
u->ports = new string [u->nin + 1];
|
||||
for(unsigned idx = 0; idx <= u->nin; idx += 1) {
|
||||
u->ports[idx] = net->port_name(idx);
|
||||
}
|
||||
|
||||
udps[net->udp_name()] = u;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue