/* Hardware ports.
- Copyright (C) 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by Andrew Cagney and Cygnus Solutions.
This file is part of GDB, the GNU debugger.
#include <ctype.h>
-#define TRACE(x,y)
-
-struct hw_port_edge {
+struct hw_port_edge
+{
int my_port;
struct hw *dest;
int dest_port;
object_disposition disposition;
};
-struct hw_port_data {
+struct hw_port_data
+{
hw_port_event_method *to_port_event;
const struct hw_port_descriptor *ports;
struct hw_port_edge *edges;
};
-const struct hw_port_descriptor empty_hw_ports[] = {
- { NULL, },
+const struct hw_port_descriptor empty_hw_ports[] =
+{
+ { NULL, 0, 0, 0 },
};
static void
{
if (port_name == NULL || port_name[0] == '\0')
return 0;
- if (isdigit(port_name[0]))
+ if (isdigit (port_name[0]))
{
return strtoul (port_name, NULL, 0);
}
{
const struct hw_port_descriptor *ports =
me->ports_of_hw->ports;
- if (ports != NULL)
+ if (ports != NULL)
{
while (ports->name != NULL)
{
{
if (port_name[len] == '\0')
return ports->number;
- else if(isdigit (port_name[len]))
+ else if (isdigit (port_name[len]))
{
int port = (ports->number
+ strtoul (&port_name[len], NULL, 0));
}
}
}
- hw_abort (me, "Unreconized port %s", port_name);
+ hw_abort (me, "Unrecognized port %s", port_name);
return 0;
}
&& port_number < ports->number + ports->nr_ports)
{
strcpy (buf, ports->name);
- sprintf (buf + strlen(buf), "%d", port_number - ports->number);
+ sprintf (buf + strlen (buf), "%d", port_number - ports->number);
if (strlen (buf) >= sizeof_buf)
hw_abort (me, "hw_port_encode: buffer overflow");
return strlen (buf);
{
if (ports->number == port_number)
{
- if (strlen(ports->name) >= sizeof_buf)
+ if (strlen (ports->name) >= sizeof_buf)
hw_abort (me, "hw_port_encode: buffer overflow");
- strcpy(buf, ports->name);
- return strlen(buf);
+ strcpy (buf, ports->name);
+ return strlen (buf);
}
}
}
}
}
sprintf (buf, "%d", port_number);
- if (strlen(buf) >= sizeof_buf)
+ if (strlen (buf) >= sizeof_buf)
hw_abort (me, "hw_port_encode: buffer overflow");
- return strlen(buf);
+ return strlen (buf);
}