[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: branch: master updated (1.3.1-20080110-4-g5d9f431)



The branch, master has been updated
       via  5d9f43178c3846100c149c0baef38c26126ec233 (commit)
       via  a049385144979f770fae60aaa66a86302f82b56e (commit)
       via  c48d7f28e55424ce4e87e34f4de3b5324eb43edf (commit)
       via  c823516a64dc7977fd8542e61a720c52f38d298e (commit)
      from  ec4b6287bbb4f709a7d3258a7474ec716933ca4b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gsymcheck/include/prototype.h               |    3 +-
 gsymcheck/include/struct.h                  |    8 +-
 gsymcheck/src/s_check.c                     |  245 +++++++++++---------------
 gsymcheck/src/s_symstruct.c                 |    4 -
 gsymcheck/tests/Makefile.am                 |   14 +-
 gsymcheck/tests/labelinside.output          |    2 +-
 gsymcheck/tests/lots_of_errors.output       |    2 +-
 gsymcheck/tests/misplaced_attributes.output |   12 ++
 gsymcheck/tests/misplaced_attributes.sym    |   66 +++++++
 gsymcheck/tests/nameinside.output           |    2 +-
 gsymcheck/tests/old_symbol.output           |    2 +-
 gsymcheck/tests/pintypes.output             |    6 +
 gsymcheck/tests/pintypes.sym                |  187 ++++++++++++++++++++
 gsymcheck/tests/typeinside.output           |    2 +-
 gsymcheck/tests/urefinside.output           |    2 +-
 15 files changed, 395 insertions(+), 162 deletions(-)
 create mode 100644 gsymcheck/tests/misplaced_attributes.output
 create mode 100644 gsymcheck/tests/misplaced_attributes.sym
 create mode 100644 gsymcheck/tests/pintypes.output
 create mode 100644 gsymcheck/tests/pintypes.sym


=================
 Commit Messages
=================

commit 5d9f43178c3846100c149c0baef38c26126ec233
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Sat Jan 12 00:08:06 2008 +0100

    gsymcheck: moved obsolete and forbidden attribute checks
    
    This is a code cleanup patch, it moves the tests for obsolete and
    forbidden attributes to the symbol_structure test. Deleted the old
    check s_check_obsolete_forbidden_attributes() function and it's unused
    variables. In the output files, some format changes occured, but the
    meaning is still the same.

:100644 100644 73a4515... 9d96152... M	gsymcheck/include/prototype.h
:100644 100644 3c3c567... 7bd1755... M	gsymcheck/include/struct.h
:100644 100644 8f8c69a... f6483a0... M	gsymcheck/src/s_check.c
:100644 100644 da9df11... 33f04de... M	gsymcheck/src/s_symstruct.c
:100644 100644 4a495b4... 44eee23... M	gsymcheck/tests/labelinside.output
:100644 100644 cc9646b... 4d511e8... M	gsymcheck/tests/lots_of_errors.output
:100644 100644 941ff12... 8a84858... M	gsymcheck/tests/misplaced_attributes.output
:100644 100644 320b2db... 9077d18... M	gsymcheck/tests/nameinside.output
:100644 100644 d8a7296... 85e0318... M	gsymcheck/tests/old_symbol.output
:100644 100644 b912a76... a022cd3... M	gsymcheck/tests/typeinside.output
:100644 100644 a813dc8... aa98c9c... M	gsymcheck/tests/urefinside.output

commit a049385144979f770fae60aaa66a86302f82b56e
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Jan 11 23:15:23 2008 +0100

    gsymcheck: test for misplaced attributes
    
    The tests detect pin attributes are attached to nonpins or are
    detached. And attributes that are attached to any other objects.
    Attributes attached to pins that are not pin attributes

:100644 100644 2322c86... 73a4515... M	gsymcheck/include/prototype.h
:100644 100644 10bbba4... 8f8c69a... M	gsymcheck/src/s_check.c
:100644 100644 975ed71... 7beb753... M	gsymcheck/tests/Makefile.am
:000000 100644 0000000... 941ff12... A	gsymcheck/tests/misplaced_attributes.output
:000000 100644 0000000... 6b2b884... A	gsymcheck/tests/misplaced_attributes.sym

commit c48d7f28e55424ce4e87e34f4de3b5324eb43edf
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Jan 11 19:26:50 2008 +0100

    Added new pintype test symbol and output to EXTRA_DIST

:100644 100644 50741b7... 975ed71... M	gsymcheck/tests/Makefile.am

commit c823516a64dc7977fd8542e61a720c52f38d298e
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Thu Jan 10 22:14:02 2008 +0100

    gsymcheck: improved the pintype check, added test case
    
    added a check that contains all valid and five different case of
    invalid pintype values.
    Removed unused code in s_check_pintype() and added a function to
    check whether a string is in a list of strings.

:100644 100644 8d2c0cc... 2322c86... M	gsymcheck/include/prototype.h
:100644 100644 ae5f059... 10bbba4... M	gsymcheck/src/s_check.c
:000000 100644 0000000... c5dae1b... A	gsymcheck/tests/pintypes.output
:000000 100644 0000000... 2b9328d... A	gsymcheck/tests/pintypes.sym

=========
 Changes
=========

commit 5d9f43178c3846100c149c0baef38c26126ec233
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Sat Jan 12 00:08:06 2008 +0100

    gsymcheck: moved obsolete and forbidden attribute checks
    
    This is a code cleanup patch, it moves the tests for obsolete and
    forbidden attributes to the symbol_structure test. Deleted the old
    check s_check_obsolete_forbidden_attributes() function and it's unused
    variables. In the output files, some format changes occured, but the
    meaning is still the same.

diff --git a/gsymcheck/include/prototype.h b/gsymcheck/include/prototype.h
index 73a4515..9d96152 100644
--- a/gsymcheck/include/prototype.h
+++ b/gsymcheck/include/prototype.h
@@ -30,7 +30,6 @@ void s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_nets_buses(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_connections(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_obsolete_forbidden_attributes(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_missing_attribute(OBJECT *object, char *attribute, SYMCHECK *s_current);
 void s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current);
 void s_check_pintype(OBJECT *object_head, SYMCHECK *s_current);
diff --git a/gsymcheck/include/struct.h b/gsymcheck/include/struct.h
index 3c3c567..7bd1755 100644
--- a/gsymcheck/include/struct.h
+++ b/gsymcheck/include/struct.h
@@ -43,12 +43,12 @@ struct st_symcheck {
   int found_connection;
 
   /* obsolete attribute checks */
-  int found_label;
-  int found_uref;
+  /* int found_label; */
+  /* int found_uref; */
 
   /* forbidden attributes */
-  int found_name;
-  int found_type;
+  /* int found_name; */
+  /* int found_type; */
 
   /* misc attributes */
   int found_footprint;
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index 8f8c69a..f6483a0 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -75,9 +75,6 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
     s_log_message("Checking: %s\n", p_current->page_filename);
   }
   
-  /* check version number */
-  /* s_check_version(object_head, s_symcheck); out */
-
   /* overal symbol structure test */
   s_check_symbol_structure(object_head, s_symcheck);
 
@@ -90,9 +87,6 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
   /* check for missing attributes */
   s_check_missing_attributes(object_head, s_symcheck);
   
-  /* check for obsolete attributes */
-  s_check_obsolete_forbidden_attributes(object_head, s_symcheck);
-
   /* check for pintype attribute (and multiples) on all pins */
   s_check_pintype(object_head, s_symcheck);
     
@@ -198,9 +192,11 @@ s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
 			      "refdes", "slot", "net", "value",
 			      "symversion", "dist-license",
 			      NULL};
-  char *obsolete_attributes[] = {"uref", "name", "label", "type",
-				 "email", /* pin# ?, slot# ? */
+  char *obsolete_attributes[] = {"uref", "label", "email", 
 				 NULL};
+  char *forbidden_attributes[] = {"type", "name", 
+				  NULL};
+  /* pin# ?, slot# ? */
   
   for (o_current = object_head;
        o_current != NULL;
@@ -209,14 +205,19 @@ s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
     if (o_current->type == OBJ_TEXT) {
       tokens = g_strsplit(o_current->text->string,"=", 2);
       if (tokens[0] != NULL && tokens[1] != NULL) {
-	if (s_check_list_has_item(obsolete_attributes, tokens[0])) {
-#if 0
+	if (s_check_list_has_item(forbidden_attributes, tokens[0])) {
+	  message = g_strdup_printf ("Found forbidden %s= attribute: [%s=%s]\n",
+				     tokens[0], tokens[0], tokens[1]);
+	  s_current->error_messages =
+	    g_list_append(s_current->error_messages, message);
+	  s_current->error_count++;
+	}
+	else if (s_check_list_has_item(obsolete_attributes, tokens[0])) {
 	  message = g_strdup_printf ("Found obsolete %s= attribute: [%s=%s]\n",
-				     token[0], tokens[0], tokens[1]);
+				     tokens[0], tokens[0], tokens[1]);
 	  s_current->warning_messages =
 	    g_list_append(s_current->warning_messages, message);
 	  s_current->warning_count++;
-#endif
 	}
 	else if (s_check_list_has_item(valid_pin_attributes, tokens[0])) {
 	  if (o_current->attached_to == NULL 
@@ -248,12 +249,7 @@ s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
       }
       g_strfreev(tokens);
     }
-    else {
-      if (g_list_length(o_current->attribs) != 0) {
-	
-      }
-    }
-  }  
+  }
 }
 
 void
@@ -1223,71 +1219,6 @@ s_check_connections(OBJECT *object_head, SYMCHECK *s_current)
 }
 
 void
-s_check_obsolete_forbidden_attributes(OBJECT *object_head, SYMCHECK *s_current)
-{
-  OBJECT *o_current;
-  char *message;
-  char *attrib;
-  
-  o_current = object_head;
-  while(o_current != NULL)
-  {
-    if (o_current->type == OBJ_TEXT)
-    {
-
-      attrib = strstr(o_current->text->string, "label=");
-      /* make sure we only check for label= and not pinlabel= */
-      if (attrib && attrib == o_current->text->string) {
-        message = g_strdup_printf (
-          "Found obsolete label= attribute: %s\n",
-          o_current->text->string);
-        s_current->warning_messages =
-          g_list_append(s_current->warning_messages, message);
-        s_current->found_label++;
-        s_current->warning_count++;
-      }
-      
-      if (strstr(o_current->text->string, "uref=")) {
-        message = g_strdup_printf (
-          "Found obsolete uref= attribute: %s\n",
-          o_current->text->string);
-        s_current->warning_messages =
-          g_list_append(s_current->warning_messages, message);
-        s_current->found_uref++;
-        s_current->warning_count++;     
-      }
-
-      attrib = strstr(o_current->text->string, "type=");
-      /* make sure we only check for type= and not pintype= */
-      if (attrib && attrib == o_current->text->string) {
-        message = g_strdup_printf (
-          "Found forbidden type= attribute: %s\n",
-          o_current->text->string);
-        s_current->error_messages =
-          g_list_append(s_current->error_messages, message);
-        s_current->found_type++;
-        s_current->error_count++;         
-      }
-
-      attrib = strstr(o_current->text->string, "name=");
-      if (attrib && attrib == o_current->text->string) {
-        message = g_strdup_printf (
-          "Found forbidden name= attribute: %s\n",
-          o_current->text->string);
-        s_current->error_messages =
-          g_list_append(s_current->error_messages, message);
-        s_current->found_name++;
-        s_current->error_count++;
-      }
-    }
-
-    o_current = o_current->next;
-  }
-  
-}
-
-
-void
 s_check_missing_attribute(OBJECT *object, char *attribute, SYMCHECK *s_current)
 {
   char *string;
diff --git a/gsymcheck/src/s_symstruct.c b/gsymcheck/src/s_symstruct.c
index da9df11..33f04de 100644
--- a/gsymcheck/src/s_symstruct.c
+++ b/gsymcheck/src/s_symstruct.c
@@ -64,10 +64,6 @@ s_symstruct_init(void)
   s_symcheck->found_net=FALSE;
   s_symcheck->found_bus=FALSE;
   s_symcheck->found_connection=FALSE;
-  s_symcheck->found_label=FALSE;
-  s_symcheck->found_uref=FALSE;
-  s_symcheck->found_name=FALSE;
-  s_symcheck->found_type=FALSE;
   s_symcheck->found_footprint=FALSE;
   s_symcheck->found_refdes=FALSE;
 
diff --git a/gsymcheck/tests/labelinside.output b/gsymcheck/tests/labelinside.output
index 4a495b4..44eee23 100644
--- a/gsymcheck/tests/labelinside.output
+++ b/gsymcheck/tests/labelinside.output
@@ -1,3 +1,3 @@
-Warning: Found obsolete label= attribute: label=this obsolete
+Warning: Found obsolete label= attribute: [label=this obsolete]
 1 warnings found 
 No errors found
diff --git a/gsymcheck/tests/lots_of_errors.output b/gsymcheck/tests/lots_of_errors.output
index cc9646b..4d511e8 100644
--- a/gsymcheck/tests/lots_of_errors.output
+++ b/gsymcheck/tests/lots_of_errors.output
@@ -1,3 +1,4 @@
+Warning: Found obsolete uref= attribute: [uref=U?]
 Warning: Missing pinlabel= attribute
 Warning: Missing pintype= attribute
 Warning: Missing pinlabel= attribute
@@ -6,7 +7,6 @@ Warning: Missing pinlabel= attribute
 Warning: Missing pintype= attribute
 Warning: Missing footprint= attribute
 Warning: Missing refdes= attribute
-Warning: Found obsolete uref= attribute: uref=U?
 ERROR: Missing device= attribute
 ERROR: Missing pinseq= attribute
 ERROR: Missing pinnumber= attribute
diff --git a/gsymcheck/tests/misplaced_attributes.output b/gsymcheck/tests/misplaced_attributes.output
index 941ff12..8a84858 100644
--- a/gsymcheck/tests/misplaced_attributes.output
+++ b/gsymcheck/tests/misplaced_attributes.output
@@ -1,5 +1,6 @@
-Warning: Found obsolete label= attribute: label=2
+Warning: Found obsolete label= attribute: [label=2]
 ERROR: Found wrongly attached attribute: [footprint=2]
+ERROR: Found forbidden type= attribute: [type=out]
 ERROR: Found misplaced pin attribute: [pintype=io]
 ERROR: Found misplaced pin attribute: [pinlabel=attached to box]
 ERROR: Found wrongly attached attribute: [comment=attached to circle]
@@ -7,6 +8,5 @@ ERROR: Found misplaced pin attribute: [pinlabel=not attached]
 ERROR: Found misplaced pin attribute: [pinseq=3]
 ERROR: Found misplaced pin attribute: [pinnumber=3]
 ERROR: Found misplaced pin attribute: [pintype=io]
-ERROR: Found forbidden type= attribute: type=out
 1 warnings found 
 9 ERRORS found 
diff --git a/gsymcheck/tests/nameinside.output b/gsymcheck/tests/nameinside.output
index 320b2db..9077d18 100644
--- a/gsymcheck/tests/nameinside.output
+++ b/gsymcheck/tests/nameinside.output
@@ -1,2 +1,2 @@
-ERROR: Found forbidden name= attribute: name=this a forbidden attribute
+ERROR: Found forbidden name= attribute: [name=this a forbidden attribute]
 1 ERROR found 
diff --git a/gsymcheck/tests/old_symbol.output b/gsymcheck/tests/old_symbol.output
index d8a7296..85e0318 100644
--- a/gsymcheck/tests/old_symbol.output
+++ b/gsymcheck/tests/old_symbol.output
@@ -1,8 +1,8 @@
+Warning: Found obsolete uref= attribute: [uref=U?]
 Warning: Missing pintype= attribute
 Warning: Missing pintype= attribute
 Warning: Missing pinlabel= attribute
 Warning: Missing refdes= attribute
-Warning: Found obsolete uref= attribute: uref=U?
 ERROR: Invalid pintype=123just a type attribute
 ERROR: Missing pinseq= attribute
 ERROR: Missing pinseq= attribute
diff --git a/gsymcheck/tests/typeinside.output b/gsymcheck/tests/typeinside.output
index b912a76..a022cd3 100644
--- a/gsymcheck/tests/typeinside.output
+++ b/gsymcheck/tests/typeinside.output
@@ -1,2 +1,2 @@
-ERROR: Found forbidden type= attribute: type=this a forbidden attribute
+ERROR: Found forbidden type= attribute: [type=this a forbidden attribute]
 1 ERROR found 
diff --git a/gsymcheck/tests/urefinside.output b/gsymcheck/tests/urefinside.output
index a813dc8..aa98c9c 100644
--- a/gsymcheck/tests/urefinside.output
+++ b/gsymcheck/tests/urefinside.output
@@ -1,4 +1,4 @@
+Warning: Found obsolete uref= attribute: [uref=U?]
 Warning: Missing refdes= attribute
-Warning: Found obsolete uref= attribute: uref=U?
 2 warnings found 
 No errors found

commit a049385144979f770fae60aaa66a86302f82b56e
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Jan 11 23:15:23 2008 +0100

    gsymcheck: test for misplaced attributes
    
    The tests detect pin attributes are attached to nonpins or are
    detached. And attributes that are attached to any other objects.
    Attributes attached to pins that are not pin attributes

diff --git a/gsymcheck/include/prototype.h b/gsymcheck/include/prototype.h
index 2322c86..73a4515 100644
--- a/gsymcheck/include/prototype.h
+++ b/gsymcheck/include/prototype.h
@@ -19,6 +19,7 @@ int parse_commandline(int argc, char *argv[]);
 int s_check_all(TOPLEVEL *pr_current);
 int s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head);
 gboolean s_check_list_has_item(char **list , char *item);
+void s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current);
 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);
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index 10bbba4..8f8c69a 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -78,6 +78,9 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
   /* check version number */
   /* s_check_version(object_head, s_symcheck); out */
 
+  /* overal symbol structure test */
+  s_check_symbol_structure(object_head, s_symcheck);
+
   /* check for graphical attribute */
   s_check_graphical(object_head, s_symcheck);
 
@@ -178,6 +181,80 @@ s_check_list_has_item(char **list , char *item)
   return FALSE;
 }
 
+void
+s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
+{
+  OBJECT *o_current;
+
+  gchar *message;
+  gchar **tokens;
+
+  char *valid_pin_attributes[] = {"pinlabel", "pintype",
+				  "pinseq", "pinnumber",
+				  NULL};
+  char *valid_attributes[] = {"device", "graphical", "description",
+			      "author", "comment", "numslots",
+			      "slotdef", "footprint", "documentation",
+			      "refdes", "slot", "net", "value",
+			      "symversion", "dist-license",
+			      NULL};
+  char *obsolete_attributes[] = {"uref", "name", "label", "type",
+				 "email", /* pin# ?, slot# ? */
+				 NULL};
+  
+  for (o_current = object_head;
+       o_current != NULL;
+       o_current = o_current->next) {
+
+    if (o_current->type == OBJ_TEXT) {
+      tokens = g_strsplit(o_current->text->string,"=", 2);
+      if (tokens[0] != NULL && tokens[1] != NULL) {
+	if (s_check_list_has_item(obsolete_attributes, tokens[0])) {
+#if 0
+	  message = g_strdup_printf ("Found obsolete %s= attribute: [%s=%s]\n",
+				     token[0], tokens[0], tokens[1]);
+	  s_current->warning_messages =
+	    g_list_append(s_current->warning_messages, message);
+	  s_current->warning_count++;
+#endif
+	}
+	else if (s_check_list_has_item(valid_pin_attributes, tokens[0])) {
+	  if (o_current->attached_to == NULL 
+	      || o_current->attached_to->type != OBJ_PIN) {
+	    message = g_strdup_printf ("Found misplaced pin attribute:"
+				       " [%s=%s]\n", tokens[0], tokens[1]);
+	    s_current->error_messages =
+	      g_list_append(s_current->error_messages, message);
+	    s_current->error_count++;
+	  }
+	}
+	else if (!s_check_list_has_item(valid_attributes, tokens[0])) {
+#if 0
+	  message = g_strdup_printf ("Found unknown %s= attribute: [%s=%s]\n",
+				     token[0], tokens[0], tokens[1]);
+	  s_current->warning_messages =
+	    g_list_append(s_current->warning_messages, message);
+	  s_current->warning_count++;
+#endif
+	}
+	else if (o_current->attached_to != NULL) {
+	  message = g_strdup_printf ("Found wrongly attached attribute: "
+				     "[%s=%s]\n",
+				     tokens[0], tokens[1]);
+	  s_current->error_messages =
+	    g_list_append(s_current->error_messages, message);
+	  s_current->error_count++;
+	}	  
+      }
+      g_strfreev(tokens);
+    }
+    else {
+      if (g_list_length(o_current->attribs) != 0) {
+	
+      }
+    }
+  }  
+}
 
 void
 s_check_graphical(OBJECT *o_current, SYMCHECK *s_current)
diff --git a/gsymcheck/tests/Makefile.am b/gsymcheck/tests/Makefile.am
index 975ed71..7beb753 100644
--- a/gsymcheck/tests/Makefile.am
+++ b/gsymcheck/tests/Makefile.am
@@ -12,7 +12,8 @@ EXTRA_DIST = buses.sym connections1.sym connections2.sym connections3.sym \
              nameinside.sym nets.sym noslots.sym old_symbol.sym oldpins.sym \
              oldslot.sym typeinside.sym urefinside.sym zero_pinnumber.sym \
              zero_pinseq.sym zero_slotnum.sym zero_slots.sym \
-	     duplicate_net.sym pin_offgrid.sym pintypes.sym\
+	     duplicate_net.sym pin_offgrid.sym pintypes.sym \
+	     misplaced_attributes.sym \
 	     runtest.sh \
 	     buses.output connections1.output connections2.output \
 	     connections3.output correct.output duplicate_net.output \
@@ -32,7 +33,7 @@ EXTRA_DIST = buses.sym connections1.sym connections2.sym connections3.sym \
 	     oldslot.output old_symbol.output typeinside.output \
 	     urefinside.output zero_pinnumber.output zero_pinseq.output \
 	     zero_slotnum.output zero_slots.output pin_offgrid.output \
-	     pintypes.output
+	     pintypes.output misplaced_attributes.output
 
 check_SCRIPTS = tests
 
diff --git a/gsymcheck/tests/misplaced_attributes.output b/gsymcheck/tests/misplaced_attributes.output
new file mode 100644
index 0000000..941ff12
--- /dev/null
+++ b/gsymcheck/tests/misplaced_attributes.output
@@ -0,0 +1,12 @@
+Warning: Found obsolete label= attribute: label=2
+ERROR: Found wrongly attached attribute: [footprint=2]
+ERROR: Found misplaced pin attribute: [pintype=io]
+ERROR: Found misplaced pin attribute: [pinlabel=attached to box]
+ERROR: Found wrongly attached attribute: [comment=attached to circle]
+ERROR: Found misplaced pin attribute: [pinlabel=not attached]
+ERROR: Found misplaced pin attribute: [pinseq=3]
+ERROR: Found misplaced pin attribute: [pinnumber=3]
+ERROR: Found misplaced pin attribute: [pintype=io]
+ERROR: Found forbidden type= attribute: type=out
+1 warnings found 
+9 ERRORS found 
diff --git a/gsymcheck/tests/misplaced_attributes.sym b/gsymcheck/tests/misplaced_attributes.sym
new file mode 100644
index 0000000..6b2b884
--- /dev/null
+++ b/gsymcheck/tests/misplaced_attributes.sym
@@ -0,0 +1,66 @@
+v 20080110 1
+P 1100 5100 1400 5100 1 0 0
+{
+T 1300 5150 5 8 1 1 0 6 1
+pinnumber=1
+T 1300 5050 5 8 0 1 0 8 1
+pinseq=1
+T 1450 5100 9 8 1 1 0 0 1
+pinlabel=pin_ok
+T 1450 5100 5 8 0 1 0 2 1
+pintype=in
+}
+P 1100 4300 1400 4300 1 0 0
+{
+T 1300 4350 5 8 1 0 0 6 1
+footprint=2
+T 1300 4250 5 8 0 0 0 8 1
+label=2
+T 1450 4300 9 8 1 0 0 0 1
+type=out
+T 1450 4300 5 8 0 0 0 2 1
+xxxxx=out
+T 1500 3600 5 10 1 0 0 0 1
+pintype=io
+T 1500 3400 5 10 1 0 0 0 1
+pinseq=2
+T 1500 4000 5 10 1 0 0 0 1
+pinlabel=xxxx
+T 1500 3800 5 10 1 0 0 0 1
+pinnumber=2
+}
+B 1400 2500 2400 2900 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
+{
+T 2300 2600 5 10 1 0 0 0 1
+pintype=io
+T 2300 2300 5 10 1 0 0 0 1
+pinlabel=attached to box
+}
+T 3800 5600 8 10 1 1 0 6 1
+refdes=U?
+T 1400 5600 9 10 1 0 0 0 1
+symbol structure test
+T 1400 5800 5 10 0 0 0 0 1
+device=symbol_structure_test
+T 1400 6200 5 10 0 0 0 0 1
+documentation=none
+T 1400 6400 5 10 0 0 0 0 1
+description=many attributes are attached the wrong way
+T 1400 6000 5 10 0 0 0 0 1
+numslots=0
+V 5103 3599 600 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
+{
+T 5100 3600 5 10 1 1 0 0 1
+comment=attached to circle
+}
+T 4600 5500 8 10 1 0 0 0 1
+pinlabel=not attached
+T 4600 5200 8 10 1 0 0 0 1
+pinseq=3
+T 4600 4900 8 10 1 0 0 0 1
+pinnumber=3
+T 4600 4600 8 10 1 0 0 0 1
+pintype=io
+B 4500 4500 2200 1200 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
+T 4500 5800 9 10 1 0 0 0 1
+not attached pin labels

commit c48d7f28e55424ce4e87e34f4de3b5324eb43edf
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Jan 11 19:26:50 2008 +0100

    Added new pintype test symbol and output to EXTRA_DIST

diff --git a/gsymcheck/tests/Makefile.am b/gsymcheck/tests/Makefile.am
index 50741b7..975ed71 100644
--- a/gsymcheck/tests/Makefile.am
+++ b/gsymcheck/tests/Makefile.am
@@ -12,14 +12,14 @@ EXTRA_DIST = buses.sym connections1.sym connections2.sym connections3.sym \
              nameinside.sym nets.sym noslots.sym old_symbol.sym oldpins.sym \
              oldslot.sym typeinside.sym urefinside.sym zero_pinnumber.sym \
              zero_pinseq.sym zero_slotnum.sym zero_slots.sym \
-	     duplicate_net.sym pin_offgrid.sym \
+	     duplicate_net.sym pin_offgrid.sym pintypes.sym\
 	     runtest.sh \
 	     buses.output connections1.output connections2.output \
 	     connections3.output correct.output duplicate_net.output \
 	     duplicate_pinnumber.output duplicate_pinseq.output \
 	     graphical_correct.output graphical_incorrect.output \
 	     invalid_slotdef1.output \
-   	     invalid_slotdef2.output invalid_slotdef3.output \
+	     invalid_slotdef2.output invalid_slotdef3.output \
 	     invalid_slotdef4.output labelinside.output lots_of_errors.output \
 	     many_slotdefs.output missing_device.output \
 	     missing_footprint.output missing_numslots.output \
@@ -31,7 +31,8 @@ EXTRA_DIST = buses.sym connections1.sym connections2.sym connections3.sym \
 	     nameinside.output nets.output noslots.output oldpins.output \
 	     oldslot.output old_symbol.output typeinside.output \
 	     urefinside.output zero_pinnumber.output zero_pinseq.output \
-	     zero_slotnum.output zero_slots.output pin_offgrid.output
+	     zero_slotnum.output zero_slots.output pin_offgrid.output \
+	     pintypes.output
 
 check_SCRIPTS = tests
 
@@ -46,12 +47,12 @@ tests:
 	for file in $(SRCDIR)/*.sym; do \
 	  $(SRCDIR)/runtest.sh $$file $(BUILDDIR) $(SRCDIR); \
           if [ $$? -ne 0 ]; then \
- 	     echo "$$file FAILED!"; \
+	     echo "$$file FAILED!"; \
              exit 1; \
 	   else \
- 	     echo "$$file passed."; \
+	     echo "$$file passed."; \
 	   fi; \
- 	done
+	done
 
 # Cleanup
 #	rm -f $(BUILDDIR)/new_*

commit c823516a64dc7977fd8542e61a720c52f38d298e
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Thu Jan 10 22:14:02 2008 +0100

    gsymcheck: improved the pintype check, added test case
    
    added a check that contains all valid and five different case of
    invalid pintype values.
    Removed unused code in s_check_pintype() and added a function to
    check whether a string is in a list of strings.

diff --git a/gsymcheck/include/prototype.h b/gsymcheck/include/prototype.h
index 8d2c0cc..2322c86 100644
--- a/gsymcheck/include/prototype.h
+++ b/gsymcheck/include/prototype.h
@@ -18,6 +18,7 @@ int parse_commandline(int argc, char *argv[]);
 /* s_check.c */
 int s_check_all(TOPLEVEL *pr_current);
 int s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head);
+gboolean s_check_list_has_item(char **list , char *item);
 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);
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index ae5f059..10bbba4 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -167,6 +167,18 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
 }
 
 
+gboolean 
+s_check_list_has_item(char **list , char *item)
+{
+  gint cur;
+  for (cur = 0; list[cur] != NULL; cur++) {
+    if (strcmp(item, list[cur]) == 0)
+      return TRUE;
+  }
+  return FALSE;
+}
+
+
 void
 s_check_graphical(OBJECT *o_current, SYMCHECK *s_current)
 {
@@ -1329,94 +1341,37 @@ s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current)
 void s_check_pintype(OBJECT *object_head, SYMCHECK *s_current)
 {
   OBJECT *o_current;
-  char *string;
-  int missing_pintype_attrib_sum = 0;
-  int multiple_pintype_attrib_sum = 0;
-  int invalid_pintype_attrib_sum = 0;
-  int found_first=FALSE;
   int counter=0;
-
   char *pintype;
   char *message;
+  char *pintypes[] = {"in", "out", "io", "oc", "oe",
+		      "pas", "tp", "tri", "clk", "pwr",
+		      NULL};
   
-  o_current = object_head;
-  while(o_current != NULL)
-  {
+  for (o_current = object_head;
+       o_current != NULL;
+       o_current = o_current->next) {
     
-    if (o_current->type == OBJ_PIN)
-    {
-      missing_pintype_attrib_sum = 0;
-      multiple_pintype_attrib_sum = 0;
-      invalid_pintype_attrib_sum = 0;
-      found_first = FALSE;
-      counter = 0;
-      
-      string = o_attrib_search_name_single_count(o_current, "pintype",
-                                                 counter);
-/*       if (!string) */
-/*       { */
-/*         Missing pintype is already checked. */
-/*         message = g_strdup ("Missing pintype= attribute\n"); */
-/*         s_current->error_messages = g_list_append(s_current->error_messages, */
-/*                                                   message); */
-/*         missing_pintype_attrib_sum++; */
-/*         s_current->error_count++; */
-/*       } */
+    if (o_current->type == OBJ_PIN) {
 
-      while (string)
-      {
+      for (counter = 0;
+	   (pintype = o_attrib_search_name_single_count(o_current, "pintype",
+							counter)) != NULL;
+	   counter++) {
         
-        message = g_strdup_printf("Found pintype=%s attribute\n", string);
+        message = g_strdup_printf("Found pintype=%s attribute\n", pintype);
         s_current->info_messages = g_list_append(s_current->info_messages,
 	 	    			         message);
 
-        pintype = g_strdup (string);
-
-	if ( (strcmp(pintype, "in") != 0) &&
-	     (strcmp(pintype, "out") != 0) &&
-	     (strcmp(pintype, "io") != 0) &&
-	     (strcmp(pintype, "oc") != 0) &&
-	     (strcmp(pintype, "oe") != 0) &&
-	     (strcmp(pintype, "pas") != 0) &&
-	     (strcmp(pintype, "tp") != 0) &&
-	     (strcmp(pintype, "tri") != 0) &&
-	     (strcmp(pintype, "clk") != 0) &&
-	     (strcmp(pintype, "pwr") != 0) ) {
-
+	if ( ! s_check_list_has_item(pintypes, pintype)) {
 	  message = g_strdup_printf ("Invalid pintype=%s attribute\n", pintype);
 	  s_current->error_messages = g_list_append(s_current->error_messages, 
 						    message); 
-	  invalid_pintype_attrib_sum++; 
 	  s_current->error_count++; 
-	  
 	}
 
-/*         if (found_first) { */
-	  /* Multiple pintype attributes already checked. */
-/* 	  message = g_strdup_printf ("Found multiple pintype=%s attributes on one pin\n", string);  */
-/*           s_current->error_messages = g_list_append(s_current->error_messages, */
-/* 	 	    			            message); */
-/*           multiple_pintype_attrib_sum++; */
-/*           s_current->error_count++; */
-/*         } */
-
-        g_free(string);
-        
-	if (pintype)
-	  g_free(pintype);
-        
-        counter++;
-        string = o_attrib_search_name_single_count(o_current, "pintype",
-                                                   counter);
+        g_free(pintype);
       }
-
-      s_current->missing_pintype_attrib += missing_pintype_attrib_sum;
-      s_current->multiple_pintype_attrib += multiple_pintype_attrib_sum;
     }
-
-    
-    o_current = o_current->next;
   }
-
-  
 }
diff --git a/gsymcheck/tests/pintypes.output b/gsymcheck/tests/pintypes.output
new file mode 100644
index 0000000..c5dae1b
--- /dev/null
+++ b/gsymcheck/tests/pintypes.output
@@ -0,0 +1,6 @@
+ERROR: Found multiple pintype=pas attributes on one pin
+ERROR: Found multiple pintype=out attributes on one pin
+ERROR: Invalid pintype=i attribute
+ERROR: Invalid pintype=iox attribute
+ERROR: Invalid pintype=abc attribute
+5 ERRORS found 
diff --git a/gsymcheck/tests/pintypes.sym b/gsymcheck/tests/pintypes.sym
new file mode 100644
index 0000000..2b9328d
--- /dev/null
+++ b/gsymcheck/tests/pintypes.sym
@@ -0,0 +1,187 @@
+v 20080110 1
+P 100 4100 400 4100 1 0 0
+{
+T 300 4150 5 8 1 1 0 6 1
+pinnumber=1
+T 300 4050 5 8 0 1 0 8 1
+pinseq=1
+T 450 4100 9 8 1 1 0 0 1
+pinlabel=in_ok
+T 450 4100 5 8 0 1 0 2 1
+pintype=in
+}
+P 100 3700 400 3700 1 0 0
+{
+T 300 3750 5 8 1 1 0 6 1
+pinnumber=2
+T 300 3650 5 8 0 1 0 8 1
+pinseq=2
+T 450 3700 9 8 1 1 0 0 1
+pinlabel=out_ok
+T 450 3700 5 8 0 1 0 2 1
+pintype=out
+}
+P 100 3300 400 3300 1 0 0
+{
+T 300 3350 5 8 1 1 0 6 1
+pinnumber=3
+T 300 3250 5 8 0 1 0 8 1
+pinseq=3
+T 450 3300 9 8 1 1 0 0 1
+pinlabel=io_ok
+T 450 3300 5 8 0 1 0 2 1
+pintype=io
+}
+P 100 2900 400 2900 1 0 0
+{
+T 300 2950 5 8 1 1 0 6 1
+pinnumber=4
+T 300 2850 5 8 0 1 0 8 1
+pinseq=4
+T 450 2900 9 8 1 1 0 0 1
+pinlabel=oc_ok
+T 450 2900 5 8 0 1 0 2 1
+pintype=oc
+}
+P 100 2500 400 2500 1 0 0
+{
+T 300 2550 5 8 1 1 0 6 1
+pinnumber=5
+T 300 2450 5 8 0 1 0 8 1
+pinseq=5
+T 450 2500 9 8 1 1 0 0 1
+pinlabel=oe_ok
+T 450 2500 5 8 0 1 0 2 1
+pintype=oe
+}
+P 100 2100 400 2100 1 0 0
+{
+T 300 2150 5 8 1 1 0 6 1
+pinnumber=6
+T 300 2050 5 8 0 1 0 8 1
+pinseq=6
+T 450 2100 9 8 1 1 0 0 1
+pinlabel=pas_ok
+T 450 2100 5 8 0 1 0 2 1
+pintype=pas
+}
+P 100 1700 400 1700 1 0 0
+{
+T 300 1750 5 8 1 1 0 6 1
+pinnumber=7
+T 300 1650 5 8 0 1 0 8 1
+pinseq=7
+T 450 1700 9 8 1 1 0 0 1
+pinlabel=tp_ok
+T 450 1700 5 8 0 1 0 2 1
+pintype=tp
+}
+P 100 1300 400 1300 1 0 0
+{
+T 300 1350 5 8 1 1 0 6 1
+pinnumber=8
+T 300 1250 5 8 0 1 0 8 1
+pinseq=8
+T 450 1300 9 8 1 1 0 0 1
+pinlabel=tri_ok
+T 450 1300 5 8 0 1 0 2 1
+pintype=tri
+}
+P 100 900 400 900 1 0 0
+{
+T 300 950 5 8 1 1 0 6 1
+pinnumber=9
+T 300 850 5 8 0 1 0 8 1
+pinseq=9
+T 525 900 9 8 1 1 0 0 1
+pinlabel=clk_ok
+T 525 900 5 8 0 1 0 2 1
+pintype=clk
+}
+L 500 900 400 975 3 0 0 0 -1 -1
+L 500 900 400 825 3 0 0 0 -1 -1
+P 100 500 400 500 1 0 0
+{
+T 300 550 5 8 1 1 0 6 1
+pinnumber=10
+T 300 450 5 8 0 1 0 8 1
+pinseq=10
+T 450 500 9 8 1 1 0 0 1
+pinlabel=clk_ok
+T 450 500 5 8 0 1 0 2 1
+pintype=pwr
+}
+P 3100 4100 2800 4100 1 0 0
+{
+T 2900 4150 5 8 1 1 0 0 1
+pinnumber=11
+T 2900 4050 5 8 0 1 0 2 1
+pinseq=11
+T 2750 4100 9 8 1 1 0 6 1
+pinlabel=substring of valid pintype
+T 2750 4100 5 8 0 1 0 8 1
+pintype=i
+}
+P 3100 3700 2800 3700 1 0 0
+{
+T 2900 3750 5 8 1 1 0 0 1
+pinnumber=12
+T 2900 3650 5 8 0 1 0 2 1
+pinseq=12
+T 2750 3700 9 8 1 1 0 6 1
+pinlabel=superstring of valid pintype
+T 2750 3700 5 8 0 1 0 8 1
+pintype=iox
+}
+P 3100 3300 2800 3300 1 0 0
+{
+T 2900 3350 5 8 1 1 0 0 1
+pinnumber=13
+T 2900 3250 5 8 0 1 0 2 1
+pinseq=13
+T 2750 3300 9 8 1 1 0 6 1
+pinlabel=completely different
+T 2750 3300 5 8 0 1 0 8 1
+pintype=abc
+}
+B 400 100 2400 4400 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
+T 2800 4600 8 10 1 1 0 6 1
+refdes=U?
+T 400 4600 9 10 1 0 0 0 1
+pintype_check
+T 400 4800 5 10 0 0 0 0 1
+device=pintype_check
+T 400 5000 5 10 0 0 0 0 1
+footprint=none
+T 400 5200 5 10 0 0 0 0 1
+documentation=none
+T 400 5400 5 10 0 0 0 0 1
+description=pintype check for gsymcheck
+T 400 5600 5 10 0 0 0 0 1
+numslots=0
+P 3100 2900 2800 2900 1 0 0
+{
+T 2900 2950 5 8 1 1 0 0 1
+pinnumber=14
+T 2900 2850 5 8 0 1 0 2 1
+pinseq=14
+T 2750 2900 9 8 1 1 0 6 1
+pinlabel=duplicate but same
+T 2750 2900 5 8 0 1 0 8 1
+pintype=pas
+T 2100 2800 5 10 0 1 0 0 1
+pintype=pas
+}
+P 3100 2500 2800 2500 1 0 0
+{
+T 2900 2550 5 8 1 1 0 0 1
+pinnumber=15
+T 2900 2450 5 8 0 1 0 2 1
+pinseq=15
+T 2750 2500 9 8 1 1 0 6 1
+pinlabel=duplicate but different
+T 2750 2500 5 8 0 1 0 8 1
+pintype=in
+T 2300 2400 5 10 0 1 0 0 1
+pintype=out
+}




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs