[AD] Fix to makesci.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Looking at one of the betas I noticed the scite api file that is spit out from the makesci.c that I made includes defines and structs, due to a buggy string comparison. I added a modified version of mystricmp from makemisc.c to makesci.c, to compare x characters. Please add this patch to the CVS. Thanks, BAF
--- docs/src/makedoc/makesci.c	Sun Apr  3 19:03:12 2005 UTC
+++ docs/src/makedoc/makesci.c	Tue Jun 28 14:00:16 2005 UTC
@@ -25,6 +25,22 @@
 #include "makesci.h"
 #include "makemisc.h"
 
+/* mystrnicmp:
+ * Ignoring case, checks the first x chars between the strings to see if they are equal, returning 1 if they are, 0 if they aren't
+ */
+int mystrnicmp(const char *s1, const char *s2, int x)
+{
+   int c1, c2, i = 0;
+
+   for(i = 0; i < x; ++i)
+   {
+     if(mytolower(*(s1++)) != mytolower(*(s2++)))
+       return 0;
+   }
+  
+   return 1;
+}
+
 /* _file_size:
  * Returns the size of the file specified.
  */
@@ -48,11 +64,12 @@ static int _file_size(const char *filena
  */
 static int _ignore_line(char *x)
 {
-  return mystricmp(x, "typedef") == 0 ||
-         mystricmp(x, "extern")  == 0 ||
-         mystricmp(x, "struct")  == 0 ||
-         mystricmp(x, "example") == 0 ||
-         mystricmp(x, "drivers") == 0;
+  return mystrnicmp(x, "typedef", 7) ||
+         mystrnicmp(x, "extern", 6) ||
+         mystrnicmp(x, "struct", 6) ||
+         mystrnicmp(x, "example", 7) ||
+         mystrnicmp(x, "drivers", 7) ||
+         mystrnicmp(x, "#define", 7);
 }
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/