Hi Ales and all,

I've added test to check offgrid pins.

If there are no objections, I'd commit it to the master repo.

Regards
Werner
From 7fa854ce519498782f90bb390910112fb8d6bb09 Mon Sep 17 00:00:00 2001
From: Werner Hoch <[EMAIL PROTECTED]>
Date: Sat, 5 Jan 2008 16:13:41 +0100
Subject: [PATCH] gsymcheck: added checks for offgrid pins

The check prints an error message if the active end is offgrid and a
warning message if the not active end is offgrid. The active end is
detected with the whichend property.
This fixes the feature request [#1565593]

diff --git a/gsymcheck/include/prototype.h b/gsymcheck/include/prototype.h
index 1e675e3..48d9d82 100644
--- a/gsymcheck/include/prototype.h
+++ b/gsymcheck/include/prototype.h
@@ -22,6 +22,7 @@ void s_check_graphical(OBJECT *o_current, SYMCHECK *s_current);
 void s_check_device(OBJECT *o_current, SYMCHECK *s_current);
 void s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current);
+void s_check_pin_ongrid(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current);
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index 6e936fe..f41ec20 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -100,6 +100,9 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
   /* check for pinnumber attribute (and multiples) on all pins */
   s_check_pinnumber(object_head, s_symcheck);
 
+  /* check for whether all pins are on grid */
+  s_check_pin_ongrid(object_head, s_symcheck);
+
   /* check for slotdef attribute on all pins (if numslots exists) */
   s_check_slotdef(object_head, s_symcheck);
 
@@ -566,6 +569,56 @@ s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current)
                                            message);
 
 }
+void
+s_check_pin_ongrid(OBJECT *object_head, SYMCHECK *s_current)
+{
+  int x1, x2, y1, y2;
+  OBJECT *o_current;
+  char *message;
+
+  
+  for (o_current = object_head;
+       o_current != NULL;
+       o_current = o_current->next) {
+    if (o_current->type == OBJ_PIN) {
+      x1 = o_current->line->x[0];
+      y1 = o_current->line->y[0];
+      x2 = o_current->line->x[1];
+      y2 = o_current->line->y[1];
+      
+      if (x1 % 100 != 0 || y1 % 100 != 0) {
+	message = g_strdup_printf("Found offgrid pin at location"
+				  " (x1=%d,y1=%d)\n", x1, y1);
+	/* error if it is the whichend, warning if not */
+	if (o_current->whichend == 0) {
+	  s_current->error_messages = g_list_append(s_current->error_messages,
+						    message);
+	  s_current->error_count++;
+	}
+	else {
+	  s_current->warning_messages = g_list_append(s_current->warning_messages,
+						      message);
+	  s_current->warning_count++;
+	}
+      }
+      if (x2 % 100 != 0 || y2 % 100 != 0) {
+	message = g_strdup_printf("Found offgrid pin at location"
+				  " (x2=%d,y2=%d)\n", x2, y2);
+	/* error when whichend, warning if not */
+	if (o_current-> whichend != 0) {
+	  s_current->error_messages = g_list_append(s_current->error_messages,
+						    message);
+	  s_current->error_count++;
+	}
+	else {
+	  s_current->warning_messages = g_list_append(s_current->warning_messages,
+						      message);
+	  s_current->warning_count++;
+	}
+      }
+    }
+  }
+}
 
 
 void
-- 
1.5.2.4

From 20f81d3f3c6d9cbf426eeb134e418ebe2cd0e64e Mon Sep 17 00:00:00 2001
From: Werner Hoch <[EMAIL PROTECTED]>
Date: Sat, 5 Jan 2008 17:13:16 +0100
Subject: [PATCH] gsymcheck: add test for the pin_ongrid test

Testfile and a golden output file added

diff --git a/gsymcheck/tests/pin_offgrid.output b/gsymcheck/tests/pin_offgrid.output
new file mode 100644
index 0000000..8642024
--- /dev/null
+++ b/gsymcheck/tests/pin_offgrid.output
@@ -0,0 +1,12 @@
+Warning: Found offgrid pin at location (x1=701,y1=3600)
+Warning: Found offgrid pin at location (x2=710,y2=2000)
+Warning: Found offgrid pin at location (x2=700,y2=1620)
+Warning: Found offgrid pin at location (x2=706,y2=806)
+Warning: Found offgrid pin at location (x2=700,y2=3204)
+ERROR: Found offgrid pin at location (x2=401,y2=3600)
+ERROR: Found offgrid pin at location (x1=410,y1=2800)
+ERROR: Found offgrid pin at location (x1=400,y1=2420)
+ERROR: Found offgrid pin at location (x1=404,y1=1204)
+ERROR: Found offgrid pin at location (x1=400,y1=3204)
+5 warnings found 
+5 ERRORS found 
diff --git a/gsymcheck/tests/pin_offgrid.sym b/gsymcheck/tests/pin_offgrid.sym
new file mode 100644
index 0000000..f3f72f0
--- /dev/null
+++ b/gsymcheck/tests/pin_offgrid.sym
@@ -0,0 +1,111 @@
+v 20071229 1
+P 701 3600 401 3600 1 0 1
+{
+T 400 3600 5 10 0 0 0 0 1
+pintype=in
+T 755 3595 5 10 1 1 0 0 1
+pinlabel=Test: pin x1, x2 offgrid, whichend 1
+T 605 3645 5 10 1 1 0 6 1
+pinnumber=1
+T 400 3600 5 10 0 0 0 0 1
+pinseq=1
+}
+P 400 4000 700 4000 1 0 0
+{
+T 400 4000 5 10 0 0 0 0 1
+pintype=in
+T 755 3995 5 10 1 1 0 0 1
+pinlabel=Test: Pin OK
+T 605 4045 5 10 1 1 0 6 1
+pinnumber=2
+T 400 4000 5 10 0 0 0 0 1
+pinseq=2
+}
+P 410 2800 700 2800 1 0 0
+{
+T 400 2800 5 10 0 0 0 0 1
+pintype=in
+T 755 2795 5 10 1 1 0 0 1
+pinlabel=Test: x1 offgrid
+T 605 2845 5 10 1 1 0 6 1
+pinnumber=3
+T 400 2800 5 10 0 0 0 0 1
+pinseq=3
+}
+P 400 2420 700 2400 1 0 0
+{
+T 400 2400 5 10 0 0 0 0 1
+pintype=in
+T 755 2395 5 10 1 1 0 0 1
+pinlabel=Test: y1 offgrid
+T 605 2445 5 10 1 1 0 6 1
+pinnumber=4
+T 400 2400 5 10 0 0 0 0 1
+pinseq=4
+}
+P 400 2000 710 2000 1 0 0
+{
+T 400 2000 5 10 0 0 0 0 1
+pintype=in
+T 755 1995 5 10 1 1 0 0 1
+pinlabel=Test: x2 offgrid
+T 605 2045 5 10 1 1 0 6 1
+pinnumber=5
+T 400 2000 5 10 0 0 0 0 1
+pinseq=5
+}
+P 400 1600 700 1620 1 0 0
+{
+T 400 1600 5 10 0 0 0 0 1
+pintype=in
+T 755 1595 5 10 1 1 0 0 1
+pinlabel=Test: y2 offgrid
+T 605 1645 5 10 1 1 0 6 1
+pinnumber=6
+T 400 1600 5 10 0 0 0 0 1
+pinseq=6
+}
+P 404 1204 700 1200 1 0 0
+{
+T 400 1200 5 10 0 0 0 0 1
+pintype=in
+T 755 1195 5 10 1 1 0 0 1
+pinlabel=Test: x1, y1 offgrid
+T 605 1245 5 10 1 1 0 6 1
+pinnumber=7
+T 400 1200 5 10 0 0 0 0 1
+pinseq=7
+}
+P 400 800 706 806 1 0 0
+{
+T 400 800 5 10 0 0 0 0 1
+pintype=in
+T 755 795 5 10 1 1 0 0 1
+pinlabel=Test: x2, y2 offgrid
+T 605 845 5 10 1 1 0 6 1
+pinnumber=8
+T 400 800 5 10 0 0 0 0 1
+pinseq=8
+}
+P 400 3204 700 3204 1 0 0
+{
+T 400 3200 5 10 0 0 0 0 1
+pintype=in
+T 755 3195 5 10 1 1 0 0 1
+pinlabel=Test: pin y1,y2 offgrid, whichend 0
+T 605 3245 5 10 1 1 0 6 1
+pinnumber=9
+T 400 3200 5 10 0 0 0 0 1
+pinseq=9
+}
+B 700 500 3100 3900 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
+T 700 4500 9 10 1 0 0 0 1
+pin_ongrid test
+T 700 4700 9 10 1 0 0 0 1
+refdes=X?
+T 700 4900 9 10 1 0 0 0 1
+footprint=xx
+T 700 5100 9 10 1 0 0 0 1
+device=xx
+T 700 5300 9 10 1 0 0 0 1
+numslots=0
-- 
1.5.2.4


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to