[dia] aadl: fix warnings
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] aadl: fix warnings
- Date: Fri, 27 Mar 2020 19:51:44 +0000 (UTC)
commit 4a46f966f92a4a2b8e2be1dc72474cae3faf1948
Author: Zander Brown <zbrown gnome org>
Date: Fri Mar 27 19:34:18 2020 +0000
aadl: fix warnings
objects/AADL/aadlport.c | 441 +++++++++++++++++++++++++-----------------------
1 file changed, 227 insertions(+), 214 deletions(-)
---
diff --git a/objects/AADL/aadlport.c b/objects/AADL/aadlport.c
index 5ed4ab5a..e32b9322 100644
--- a/objects/AADL/aadlport.c
+++ b/objects/AADL/aadlport.c
@@ -234,194 +234,202 @@ aadlbox_draw_port (Aadlport *port, DiaRenderer *renderer)
{
Point p[5];
- assert(port!=NULL);
- assert(renderer!=NULL);
+ g_return_if_fail (port != NULL);
+ g_return_if_fail (renderer!=NULL);
- switch(port->type) {
-
- case ACCESS_PROVIDER:
- p[0].x = - AADL_ACCESS_WIDTH_A;
- p[0].y = - AADL_ACCESS_HEIGHT/2;
+ switch (port->type) {
- p[1].x = AADL_ACCESS_WIDTH_B;
- p[1].y = - AADL_ACCESS_HEIGHT/2;
+ case ACCESS_PROVIDER:
+ p[0].x = - AADL_ACCESS_WIDTH_A;
+ p[0].y = - AADL_ACCESS_HEIGHT/2;
- p[2].x = AADL_ACCESS_WIDTH_B + AADL_ACCESS_WIDTH_C ;
- p[2].y = 0;
+ p[1].x = AADL_ACCESS_WIDTH_B;
+ p[1].y = - AADL_ACCESS_HEIGHT/2;
- p[3].x = AADL_ACCESS_WIDTH_B;
- p[3].y = AADL_ACCESS_HEIGHT/2;
+ p[2].x = AADL_ACCESS_WIDTH_B + AADL_ACCESS_WIDTH_C ;
+ p[2].y = 0;
- p[4].x = - AADL_ACCESS_WIDTH_A;
- p[4].y = AADL_ACCESS_HEIGHT/2;
+ p[3].x = AADL_ACCESS_WIDTH_B;
+ p[3].y = AADL_ACCESS_HEIGHT/2;
- rotate_around_origin(p, port->angle);
- rotate_around_origin(p+1, port->angle);
- rotate_around_origin(p+2, port->angle);
- rotate_around_origin(p+3, port->angle);
- rotate_around_origin(p+4, port->angle);
+ p[4].x = - AADL_ACCESS_WIDTH_A;
+ p[4].y = AADL_ACCESS_HEIGHT/2;
- point_add(p, &port->handle->pos);
- point_add(p+1, &port->handle->pos);
- point_add(p+2, &port->handle->pos);
- point_add(p+3, &port->handle->pos);
- point_add(p+4, &port->handle->pos);
+ rotate_around_origin (p, port->angle);
+ rotate_around_origin (p+1, port->angle);
+ rotate_around_origin (p+2, port->angle);
+ rotate_around_origin (p+3, port->angle);
+ rotate_around_origin (p+4, port->angle);
- dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
- dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
- dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
+ point_add (p, &port->handle->pos);
+ point_add (p+1, &port->handle->pos);
+ point_add (p+2, &port->handle->pos);
+ point_add (p+3, &port->handle->pos);
+ point_add (p+4, &port->handle->pos);
- dia_renderer_draw_polygon (renderer, p, 5, &color_white, &color_black);
+ dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
+ dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
+ dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
- break;
+ dia_renderer_draw_polygon (renderer, p, 5, &color_white, &color_black);
- case ACCESS_REQUIRER:
- p[0].x = AADL_ACCESS_WIDTH_A;
- p[0].y = - AADL_ACCESS_HEIGHT/2;
+ break;
- p[1].x = - AADL_ACCESS_WIDTH_B;
- p[1].y = - AADL_ACCESS_HEIGHT/2;
+ case ACCESS_REQUIRER:
+ p[0].x = AADL_ACCESS_WIDTH_A;
+ p[0].y = - AADL_ACCESS_HEIGHT/2;
- p[2].x = - AADL_ACCESS_WIDTH_B - AADL_ACCESS_WIDTH_C ;
- p[2].y = 0;
+ p[1].x = - AADL_ACCESS_WIDTH_B;
+ p[1].y = - AADL_ACCESS_HEIGHT/2;
- p[3].x = - AADL_ACCESS_WIDTH_B;
- p[3].y = AADL_ACCESS_HEIGHT/2;
+ p[2].x = - AADL_ACCESS_WIDTH_B - AADL_ACCESS_WIDTH_C ;
+ p[2].y = 0;
- p[4].x = AADL_ACCESS_WIDTH_A;
- p[4].y = AADL_ACCESS_HEIGHT/2;
+ p[3].x = - AADL_ACCESS_WIDTH_B;
+ p[3].y = AADL_ACCESS_HEIGHT/2;
- rotate_around_origin(p, port->angle);
- rotate_around_origin(p+1, port->angle);
- rotate_around_origin(p+2, port->angle);
- rotate_around_origin(p+3, port->angle);
- rotate_around_origin(p+4, port->angle);
+ p[4].x = AADL_ACCESS_WIDTH_A;
+ p[4].y = AADL_ACCESS_HEIGHT/2;
- point_add(p, &port->handle->pos);
- point_add(p+1, &port->handle->pos);
- point_add(p+2, &port->handle->pos);
- point_add(p+3, &port->handle->pos);
- point_add(p+4, &port->handle->pos);
+ rotate_around_origin (p, port->angle);
+ rotate_around_origin (p+1, port->angle);
+ rotate_around_origin (p+2, port->angle);
+ rotate_around_origin (p+3, port->angle);
+ rotate_around_origin (p+4, port->angle);
- dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
- dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
- dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
+ point_add (p, &port->handle->pos);
+ point_add (p+1, &port->handle->pos);
+ point_add (p+2, &port->handle->pos);
+ point_add (p+3, &port->handle->pos);
+ point_add (p+4, &port->handle->pos);
- dia_renderer_draw_polygon (renderer, p, 5, &color_white, &color_black);
+ dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
+ dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
+ dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
- break;
+ dia_renderer_draw_polygon (renderer, p, 5, &color_white, &color_black);
- case IN_DATA_PORT:
- draw_in_data_port();
- break;
+ break;
- case IN_EVENT_PORT:
- draw_in_event_port()
- break;
+ case IN_DATA_PORT:
+ draw_in_data_port ();
+ break;
- case IN_EVENT_DATA_PORT:
- draw_in_data_port();
- draw_in_event_port();
- break;
+ case IN_EVENT_PORT:
+ draw_in_event_port ()
+ break;
- case OUT_DATA_PORT:
- draw_out_data_port();
- break;
+ case IN_EVENT_DATA_PORT:
+ draw_in_data_port ();
+ draw_in_event_port ();
+ break;
- case OUT_EVENT_PORT:
- draw_out_event_port();
- break;
+ case OUT_DATA_PORT:
+ draw_out_data_port ();
+ break;
- case OUT_EVENT_DATA_PORT:
- draw_out_data_port();
- draw_out_event_port();
- break;
+ case OUT_EVENT_PORT:
+ draw_out_event_port ();
+ break;
- case IN_OUT_DATA_PORT:
- draw_in_out_data_port();
- break;
+ case OUT_EVENT_DATA_PORT:
+ draw_out_data_port ();
+ draw_out_event_port ();
+ break;
- case IN_OUT_EVENT_PORT:
- draw_in_out_event_port();
- break;
+ case IN_OUT_DATA_PORT:
+ draw_in_out_data_port ();
+ break;
- case IN_OUT_EVENT_DATA_PORT:
- draw_in_out_data_port();
- draw_in_out_event_port();
- break;
+ case IN_OUT_EVENT_PORT:
+ draw_in_out_event_port ();
+ break;
-#define AADL_PORT_GROUP_SIZE 0.1
+ case IN_OUT_EVENT_DATA_PORT:
+ draw_in_out_data_port ();
+ draw_in_out_event_port ();
+ break;
- case PORT_GROUP: /* quick n dirty - should use macros*/
- {
- BezPoint b[5];
- int i;
+ #define AADL_PORT_GROUP_SIZE 0.1
- p[0].x = 0; p[0].y = 0;
+ case PORT_GROUP: /* quick n dirty - should use macros*/
+ {
+ BezPoint b[5];
+ int i;
- rotate_around_origin(p, port->angle);
- point_add(p, &port->handle->pos);
+ p[0].x = 0; p[0].y = 0;
- dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
- dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
- dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
+ rotate_around_origin (p, port->angle);
+ point_add (p, &port->handle->pos);
- dia_renderer_draw_ellipse (renderer,
- p,
- 6 * AADL_PORT_GROUP_SIZE,
- 6 * AADL_PORT_GROUP_SIZE,
- &color_black, &color_black);
+ dia_renderer_set_linewidth (renderer, AADL_PORT_LINEWIDTH);
+ dia_renderer_set_linejoin (renderer, LINEJOIN_MITER);
+ dia_renderer_set_linestyle (renderer, LINESTYLE_SOLID, 0.0);
+ dia_renderer_draw_ellipse (renderer,
+ p,
+ 6 * AADL_PORT_GROUP_SIZE,
+ 6 * AADL_PORT_GROUP_SIZE,
+ &color_black, &color_black);
- b[0].type = BEZ_MOVE_TO;
- b[1].type = BEZ_CURVE_TO;
- b[2].type = BEZ_LINE_TO;
- b[3].type = BEZ_CURVE_TO;
- b[4].type = BEZ_LINE_TO;
- b[0].p1.x = -2 * AADL_PORT_GROUP_SIZE;
- b[0].p1.y = -6 * AADL_PORT_GROUP_SIZE;
+ b[0].type = BEZ_MOVE_TO;
+ b[1].type = BEZ_CURVE_TO;
+ b[2].type = BEZ_LINE_TO;
+ b[3].type = BEZ_CURVE_TO;
+ b[4].type = BEZ_LINE_TO;
- b[1].p1.x = -6 * AADL_PORT_GROUP_SIZE;
- b[1].p1.y = -4 * AADL_PORT_GROUP_SIZE;
- b[1].p2.x = -6 * AADL_PORT_GROUP_SIZE;
- b[1].p2.y = 4 * AADL_PORT_GROUP_SIZE;
- b[1].p3.x = -2 * AADL_PORT_GROUP_SIZE;
- b[1].p3.y = 6 * AADL_PORT_GROUP_SIZE;
+ b[0].p1.x = -2 * AADL_PORT_GROUP_SIZE;
+ b[0].p1.y = -6 * AADL_PORT_GROUP_SIZE;
- b[2].p1.x = -2 * AADL_PORT_GROUP_SIZE;
- b[2].p1.y = 9 * AADL_PORT_GROUP_SIZE;
+ b[1].p1.x = -6 * AADL_PORT_GROUP_SIZE;
+ b[1].p1.y = -4 * AADL_PORT_GROUP_SIZE;
+ b[1].p2.x = -6 * AADL_PORT_GROUP_SIZE;
+ b[1].p2.y = 4 * AADL_PORT_GROUP_SIZE;
+ b[1].p3.x = -2 * AADL_PORT_GROUP_SIZE;
+ b[1].p3.y = 6 * AADL_PORT_GROUP_SIZE;
- b[3].p1.x = -9 * AADL_PORT_GROUP_SIZE;
- b[3].p1.y = 7 * AADL_PORT_GROUP_SIZE;
- b[3].p2.x = -9 * AADL_PORT_GROUP_SIZE;
- b[3].p2.y = -7 * AADL_PORT_GROUP_SIZE;
- b[3].p3.x = -2 * AADL_PORT_GROUP_SIZE;
- b[3].p3.y = -9 * AADL_PORT_GROUP_SIZE;
+ b[2].p1.x = -2 * AADL_PORT_GROUP_SIZE;
+ b[2].p1.y = 9 * AADL_PORT_GROUP_SIZE;
- b[4].p1.x = -2 * AADL_PORT_GROUP_SIZE;
- b[4].p1.y = -6 * AADL_PORT_GROUP_SIZE;
+ b[3].p1.x = -9 * AADL_PORT_GROUP_SIZE;
+ b[3].p1.y = 7 * AADL_PORT_GROUP_SIZE;
+ b[3].p2.x = -9 * AADL_PORT_GROUP_SIZE;
+ b[3].p2.y = -7 * AADL_PORT_GROUP_SIZE;
+ b[3].p3.x = -2 * AADL_PORT_GROUP_SIZE;
+ b[3].p3.y = -9 * AADL_PORT_GROUP_SIZE;
- for (i=0; i<5; i++) {
- rotate_around_origin (&b[i].p1, port->angle);
- point_add (&b[i].p1, &port->handle->pos);
+ b[4].p1.x = -2 * AADL_PORT_GROUP_SIZE;
+ b[4].p1.y = -6 * AADL_PORT_GROUP_SIZE;
- if (b[i].type == BEZ_CURVE_TO) {
- rotate_around_origin (&b[i].p2, port->angle);
- rotate_around_origin (&b[i].p3, port->angle);
+ for (i=0; i<5; i++) {
+ rotate_around_origin (&b[i].p1, port->angle);
+ point_add (&b[i].p1, &port->handle->pos);
- point_add (&b[i].p2, &port->handle->pos);
- point_add (&b[i].p3, &port->handle->pos);
+ if (b[i].type == BEZ_CURVE_TO) {
+ rotate_around_origin (&b[i].p2, port->angle);
+ rotate_around_origin (&b[i].p3, port->angle);
+
+ point_add (&b[i].p2, &port->handle->pos);
+ point_add (&b[i].p3, &port->handle->pos);
+ }
}
- }
-
- dia_renderer_draw_beziergon (renderer, b, 5, &color_black, &color_black);
- }
- break;
-
- default:
- break;
+ dia_renderer_draw_beziergon (renderer, b, 5, &color_black, &color_black);
+ }
+ break;
+
+ case BUS:
+ case DEVICE:
+ case MEMORY:
+ case PROCESSOR:
+ case PROCESS:
+ case SUBPROGRAM:
+ case SYSTEM:
+ case THREAD:
+ case THREAD_GROUP:
+ default:
+ break;
}
}
@@ -437,72 +445,79 @@ void aadlbox_update_port(Aadlbox *aadlbox, Aadlport *port)
/* FIXME: should i make methods ? */
switch (port->type) {
- case ACCESS_PROVIDER:
- port->in.pos.x = - AADL_ACCESS_WIDTH_A;
- port->in.pos.y=0;
-
- port->out.pos.x= AADL_ACCESS_WIDTH_B + AADL_ACCESS_WIDTH_C;
- port->out.pos.y=0;
- break;
-
- case ACCESS_REQUIRER:
- port->in.pos.x = AADL_ACCESS_WIDTH_A;
- port->in.pos.y=0;
-
- port->out.pos.x= - AADL_ACCESS_WIDTH_B - AADL_ACCESS_WIDTH_C;
- port->out.pos.y=0;
- break;
-
- case IN_DATA_PORT:
- port->in.pos.x = AADL_PORT_WIDTH_A; port->in.pos.y=0;
- port->out.pos.x= -AADL_PORT_WIDTH_B; port->out.pos.y=0;
- break;
-
- case IN_EVENT_PORT:
- case IN_EVENT_DATA_PORT:
- port->in.pos.x = AADL_PORT_WIDTH_A;
- port->in.pos.y=0;
-
- port->out.pos.x= -AADL_PORT_WIDTH_B - AADL_EVENT_DELTA_WIDTH;
- port->out.pos.y=0;
- break;
-
- case OUT_DATA_PORT:
- port->in.pos.x = -AADL_PORT_WIDTH_A; port->in.pos.y=0;
- port->out.pos.x= AADL_PORT_WIDTH_B; port->out.pos.y=0;
- break;
-
- case OUT_EVENT_PORT:
- case OUT_EVENT_DATA_PORT:
- port->in.pos.x = -AADL_PORT_WIDTH_A;
- port->in.pos.y=0;
-
- port->out.pos.x= AADL_PORT_WIDTH_B + AADL_EVENT_DELTA_WIDTH;
- port->out.pos.y=0;
- break;
-
- case IN_OUT_DATA_PORT:
- port->in.pos.x = -AADL_PORT_WIDTH_B; port->in.pos.y=0;
- port->out.pos.x= AADL_PORT_WIDTH_B; port->out.pos.y=0;
- break;
-
- case IN_OUT_EVENT_PORT:
- case IN_OUT_EVENT_DATA_PORT:
- port->in.pos.x = -AADL_PORT_WIDTH_B - AADL_EVENT_DELTA_WIDTH;
- port->in.pos.y=0;
- port->out.pos.x= AADL_PORT_WIDTH_B + AADL_EVENT_DELTA_HEIGHT;
- port->out.pos.y=0;
- break;
-
- case PORT_GROUP: /* quick n dirty */
- port->in.pos.x = -9*AADL_PORT_GROUP_SIZE; port->in.pos.y=0;
- port->out.pos.x = 3*AADL_PORT_GROUP_SIZE; port->out.pos.y=0;
- break;
-
- default:
- break;
-
-
+ case ACCESS_PROVIDER:
+ port->in.pos.x = - AADL_ACCESS_WIDTH_A;
+ port->in.pos.y=0;
+
+ port->out.pos.x= AADL_ACCESS_WIDTH_B + AADL_ACCESS_WIDTH_C;
+ port->out.pos.y=0;
+ break;
+
+ case ACCESS_REQUIRER:
+ port->in.pos.x = AADL_ACCESS_WIDTH_A;
+ port->in.pos.y=0;
+
+ port->out.pos.x= - AADL_ACCESS_WIDTH_B - AADL_ACCESS_WIDTH_C;
+ port->out.pos.y=0;
+ break;
+
+ case IN_DATA_PORT:
+ port->in.pos.x = AADL_PORT_WIDTH_A; port->in.pos.y=0;
+ port->out.pos.x= -AADL_PORT_WIDTH_B; port->out.pos.y=0;
+ break;
+
+ case IN_EVENT_PORT:
+ case IN_EVENT_DATA_PORT:
+ port->in.pos.x = AADL_PORT_WIDTH_A;
+ port->in.pos.y=0;
+
+ port->out.pos.x= -AADL_PORT_WIDTH_B - AADL_EVENT_DELTA_WIDTH;
+ port->out.pos.y=0;
+ break;
+
+ case OUT_DATA_PORT:
+ port->in.pos.x = -AADL_PORT_WIDTH_A; port->in.pos.y=0;
+ port->out.pos.x= AADL_PORT_WIDTH_B; port->out.pos.y=0;
+ break;
+
+ case OUT_EVENT_PORT:
+ case OUT_EVENT_DATA_PORT:
+ port->in.pos.x = -AADL_PORT_WIDTH_A;
+ port->in.pos.y=0;
+
+ port->out.pos.x= AADL_PORT_WIDTH_B + AADL_EVENT_DELTA_WIDTH;
+ port->out.pos.y=0;
+ break;
+
+ case IN_OUT_DATA_PORT:
+ port->in.pos.x = -AADL_PORT_WIDTH_B; port->in.pos.y=0;
+ port->out.pos.x= AADL_PORT_WIDTH_B; port->out.pos.y=0;
+ break;
+
+ case IN_OUT_EVENT_PORT:
+ case IN_OUT_EVENT_DATA_PORT:
+ port->in.pos.x = -AADL_PORT_WIDTH_B - AADL_EVENT_DELTA_WIDTH;
+ port->in.pos.y=0;
+ port->out.pos.x= AADL_PORT_WIDTH_B + AADL_EVENT_DELTA_HEIGHT;
+ port->out.pos.y=0;
+ break;
+
+ case PORT_GROUP: /* quick n dirty */
+ port->in.pos.x = -9*AADL_PORT_GROUP_SIZE; port->in.pos.y=0;
+ port->out.pos.x = 3*AADL_PORT_GROUP_SIZE; port->out.pos.y=0;
+ break;
+
+ case BUS:
+ case DEVICE:
+ case MEMORY:
+ case PROCESSOR:
+ case PROCESS:
+ case SUBPROGRAM:
+ case SYSTEM:
+ case THREAD:
+ case THREAD_GROUP:
+ default:
+ break;
}
rotate_around_origin(&port->in.pos, port->angle);
@@ -525,12 +540,10 @@ void aadlbox_update_port(Aadlbox *aadlbox, Aadlport *port)
}
-void aadlbox_update_ports(Aadlbox *aadlbox)
+void
+aadlbox_update_ports (Aadlbox *aadlbox)
{
- int i;
-
- for (i=0;i<aadlbox->num_ports;i++)
- aadlbox_update_port(aadlbox, aadlbox->ports[i]);
+ for (int i = 0; i < aadlbox->num_ports; i++) {
+ aadlbox_update_port (aadlbox, aadlbox->ports[i]);
+ }
}
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]