Index: WCHeaderParser.m
===================================================================
--- WCHeaderParser.m	(revision 31118)
+++ WCHeaderParser.m	(working copy)
@@ -33,18 +33,21 @@
 static NSCharacterSet *whiteSpaceOrEndMethod = nil;
 static NSCharacterSet *whiteSpaceOrAtSymbol = nil;
 static NSCharacterSet *whiteSpaceOrBeginEnum = nil;
+static NSCharacterSet *whiteSpaceOrOpenParenthesis = nil;
+static NSCharacterSet *whiteSpaceOrPointerSymbol = nil;
 static NSCharacterSet *endEnumBodyKey = nil;
 static NSCharacterSet *endEnumBodyValue = nil;
 static NSCharacterSet *atSymbol = nil;
 static NSCharacterSet *endClassName = nil;
 static NSCharacterSet *subclassSymbol = nil;
+static NSCharacterSet *pointerSymbol = nil;
 
-static inline void skipObjcType (NSScanner *scanner)
+static inline void skipParenthesisBlockIfAny (NSScanner *scanner)
 {
   /* Skip spaces */
   [scanner scanCharactersFromSet: whiteSpace intoString: NULL];
   
-  /* Look for the return type now */
+  /* Look for the closing bracket now */
   if ([scanner scanCharactersFromSet: openBracket intoString: NULL] == YES)
     {
       [scanner scanUpToCharactersFromSet: closeBracket  intoString: NULL];
@@ -52,6 +55,47 @@
     }
 }
 
+static inline void skipObjcType (NSScanner *scanner)
+{
+  skipParenthesisBlockIfAny(scanner);
+}
+
+
+static inline NSArray * getPropertyAttributes (NSScanner * scanner)
+{
+	NSString * attributes;
+
+  /* Skip spaces */
+  [scanner scanCharactersFromSet: whiteSpace intoString: NULL];
+  
+  /* Look for the closing bracket now */
+  if ([scanner scanCharactersFromSet: openBracket intoString: NULL] == YES)
+    {
+      [scanner scanUpToCharactersFromSet: closeBracket  intoString: &attributes];
+      [scanner scanCharactersFromSet: closeBracket intoString: NULL];
+    }
+
+	return [attributes componentsSeparatedByString:@", "];
+}
+
+static inline NSString * getPropertyType (NSScanner *scanner)
+{
+  /* Skip spaces */
+  [scanner scanCharactersFromSet: whiteSpace intoString: NULL];
+
+  /* Capture the property type, which may be a pointer */
+  NSString * type;
+  [scanner scanUpToCharactersFromSet: whiteSpaceOrPointerSymbol  intoString: &type];
+  if ([scanner scanCharactersFromSet: pointerSymbol intoString: NULL] == YES)
+    {
+      [scanner scanCharactersFromSet: pointerSymbol intoString: NULL];
+      return [type stringByAppendingFormat: @"*"];
+    }
+
+  return type;
+}
+
+
 /* We remove any space character from the string */
 static NSString *trimString (NSString *string)
 {
@@ -101,6 +145,8 @@
 
       plusMinusOrEndClass = [NSCharacterSet 
 			      characterSetWithCharactersInString: @"+-@"];
+      endClassName = [NSCharacterSet 
+                              characterSetWithCharactersInString: @"+-@;"];
       argOrEndMethod = [NSCharacterSet characterSetWithCharactersInString: @":;"];
       endMethod = [NSCharacterSet characterSetWithCharactersInString: @";"];
       endEnumBodyKey = [NSCharacterSet characterSetWithCharactersInString: 
@@ -109,6 +155,7 @@
 					   @",}"];
       atSymbol = [NSCharacterSet characterSetWithCharactersInString: @"@"];
       subclassSymbol = [NSCharacterSet characterSetWithCharactersInString: @":"];
+      pointerSymbol = [NSCharacterSet characterSetWithCharactersInString: @"*"];
 
       tmpSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
       [tmpSet addCharactersInString: @";"];
@@ -130,16 +177,28 @@
       endClassName = [tmpSet copy];
       RELEASE (tmpSet);
 
+      tmpSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
+      [tmpSet addCharactersInString: @"("];
+      whiteSpaceOrOpenParenthesis = [tmpSet copy];
+      RELEASE (tmpSet);
+
+      tmpSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
+      [tmpSet addCharactersInString: @"*"];
+      whiteSpaceOrPointerSymbol = [tmpSet copy];
+      RELEASE (tmpSet);
+
       RETAIN (whiteSpace);
       RETAIN (openBracket);
       RETAIN (closeBracket);
       RETAIN (plusMinusOrEndClass);
+      RETAIN (endClassName);
       RETAIN (argOrEndMethod);
       RETAIN (endMethod);
       RETAIN (endEnumBodyKey);
       RETAIN (endEnumBodyValue);
       RETAIN (atSymbol);
       RETAIN (subclassSymbol);
+      RETAIN (pointerSymbol);
     }
 }
 
@@ -295,13 +354,28 @@
 	{ 
 	  continue;
 	}
-     
       if ([WCLibrary verboseOutput] == YES)
 	{
-	  printf ("X");
 	  fflush (stdout);
 	}
  
+      NSString *classname;
+      [scanner scanUpToCharactersFromSet: endClassName 
+               intoString: &classname];
+
+      if ([WCLibrary verboseOutput] == YES)
+        {
+          printf("Found class : %s\n", [classname cString]);
+        }
+
+      /* Now check if next character it is a ; */
+      if ([scanner scanCharactersFromSet: endMethod 
+                   intoString: &string] == YES)
+        {
+          // With stumbled on a forward declaration. Skip it. It has no method we can use.
+          continue;
+        }
+
       /* Loop on the list of methods */
       while (1)	
 	{
@@ -318,14 +392,52 @@
 	  /* @end */
 	  if ([string isEqualToString: @"@"] == YES)
 	    {
-	      [scanner scanUpToCharactersFromSet: whiteSpace 
+              [scanner scanUpToCharactersFromSet: whiteSpaceOrOpenParenthesis 
 		       intoString: &string];
+           if ([string isEqualToString: @"property"] == YES)
+                {
+									NSArray * attributes = getPropertyAttributes(scanner);
+                  NSString * propertyType = getPropertyType(scanner);
 	      
-	      if (([string isEqualToString: @"private"] == NO) 
-		  && ([string isEqualToString: @"protected"] == NO)
-		  && ([string isEqualToString: @"public"] == NO))
+                  NSString * propertyName;
+                  [scanner scanUpToString: @";"
+                    intoString: &propertyName];
+
+									// Create getter
+                  NSMutableString * accessorName = [NSString stringWithFormat: @"-(%@) %@;", propertyType, propertyName];
+
+                  [instanceMethods setObject: accessorName  forKey: propertyName];
+
+                  if ([WCLibrary verboseOutput] == YES)
 		{
+                          printf(" %s for property %s\n", [accessorName cString], [propertyName cString]);
+                    }
+
+									// Create setter for property that can be assigned
+									if ([attributes containsObject: @"assign"])
+										{
+											NSString * capital = [[propertyName substringToIndex:1] uppercaseString];
+											NSString * rest = [propertyName substringFromIndex:1];
+											NSString * methodName = [NSString stringWithFormat: @"set%@%@:", capital, rest];
+				              NSString * accessorName = [NSString stringWithFormat: @"-(void) %@(%@) %@;", methodName, propertyType, propertyName];
+
+		                  [instanceMethods setObject: accessorName  forKey: methodName];
+
+				              if ([WCLibrary verboseOutput] == YES)
+				                {
+				                  printf(" %s for property %s\n", [accessorName cString], [propertyName cString]);
+												}
+										}
+
+                  continue;
+                }
+              else if (([string isEqualToString: @"end"] == YES))
+                {
 		  methodName = nil;
+                  if ([WCLibrary verboseOutput] == YES)
+                    {
+                      printf("\n@%s - end of class\n", [string cString]);
+                    }
 		  break;
 		}
 	      else
@@ -398,7 +510,7 @@
 	      if ([scanner scanCharactersFromSet: endMethod 
 			   intoString: &string] == YES)
 		{
-		  if ([string length] > 0)
+                  if ([string isEqualToString: @";"])
 		    {
 		      break;
 		    }
@@ -406,7 +518,7 @@
 		    {
 
 		      [NSException raise: @"WCHeaderParserException"
-			format: @"Error while parsing the header file"];
+                                   format: @"Error while parsing the header file : found '%@' instead of ';'", string];
 		    }
 		}
 	      argument++;
@@ -430,9 +542,14 @@
 		{
 		  [instanceMethods setObject: string  forKey: methodName];
 		}
+
+              if ([WCLibrary verboseOutput] == YES)
+                {
+                  printf("%s can be used in JIGS file as %s", [string cString], [methodName cString]);
 	    }
 	}
     }
+    }
 
   if ([WCLibrary verboseOutput] == YES)
     {
@@ -972,13 +1089,16 @@
     {
       returnString = [instanceMethods objectForKey: objcMethodName];
     }
-  
   if (returnString == nil)
     {
       [NSException raise: @"WCHeaderParserException"
 		   format: @"Could not find method %@ in the header file", 
 		   objcMethodName];
     }
+  if ([WCLibrary verboseOutput] == YES)
+    {
+      printf ("Found method %s\n", [returnString cString]);  
+    }
 
   return returnString;
 }
