Revision: 15152
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15152&view=rev
Author:   hofman
Date:     2009-04-22 12:32:05 +0000 (Wed, 22 Apr 2009)

Log Message:
-----------
use NSInteger and NSUInteger in Cocoa classes of AGRegEx framework

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.h
    trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.m

Modified: trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.h
===================================================================
--- trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.h 2009-04-22 
11:53:34 UTC (rev 15151)
+++ trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.h 2009-04-22 
12:32:05 UTC (rev 15152)
@@ -41,13 +41,13 @@
        AGRegex *regex;
        NSString *string;
        int *matchv;
-       int count;
+       NSInteger count;
 }
 
 /*!
 @method count
 The number of capturing subpatterns, including the pattern itself. */
-- (int)count;
+- (NSInteger)count;
 
 /*!
 @method group
@@ -57,7 +57,7 @@
 /*!
 @method groupAtIndex:
 Returns the part of the target string that matched the subpattern at the given 
index or nil if it wasn't matched. The subpatterns are indexed in order of 
their opening parentheses, 0 is the entire pattern, 1 is the first capturing 
subpattern, and so on. */
-- (NSString *)groupAtIndex:(int)idx;
+- (NSString *)groupAtIndex:(NSInteger)idx;
 
 /*!
 @method groupNamed:
@@ -72,7 +72,7 @@
 /*!
 @method rangeAtIndex:
 Returns the range of the target string that matched the subpattern at the 
given index or {NSNotFound, 0} if it wasn't matched. The subpatterns are 
indexed in order of their opening parentheses, 0 is the entire pattern, 1 is 
the first capturing subpattern, and so on. */
-- (NSRange)rangeAtIndex:(int)idx;
+- (NSRange)rangeAtIndex:(NSInteger)idx;
 
 /*!
 @method rangeNamed:
@@ -149,7 +149,7 @@
 @interface AGRegex : NSObject {
        void *regex;
        void *extra;
-       int groupCount;
+       NSInteger groupCount;
 }
 
 /*!
@@ -160,7 +160,7 @@
 /*!
 @method regexWithPattern:options:
 Creates a new regex using the given pattern string and option flags. Returns 
nil if the pattern string is invalid. */
-+ (id)regexWithPattern:(NSString *)pat options:(int)opts;
++ (id)regexWithPattern:(NSString *)pat options:(NSInteger)opts;
 
 
 /*!
@@ -171,7 +171,7 @@
 /*!
 @method initWithPattern:options:
 Initializes the regex using the given pattern string and option flags. Returns 
nil if the pattern string is invalid. */
-- (id)initWithPattern:(NSString *)pat options:(int)opts;
+- (id)initWithPattern:(NSString *)pat options:(NSInteger)opts;
 
 /*!
 @method findInString:
@@ -213,7 +213,7 @@
 Returns the string created by replacing occurrences of the regex in the target 
string with the replacement string. If the limit is positive, no more than that 
many replacements will be made.
 
 Captured subpatterns can be interpolated into the replacement string using the 
syntax $x or ${x} where x is the index or name of the subpattern. $0 and $& 
both refer to the entire pattern. Additionally, the case modifier sequences 
\U...\E, \L...\E, \u, and \l are allowed in the replacement string. All other 
escape sequences are handled literally. */
-- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str 
limit:(int)limit;
+- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str 
limit:(NSInteger)limit;
 
 /*!
 @method splitString:
@@ -223,6 +223,6 @@
 /*!
 @method splitString:limit:
 Returns an array of strings created by splitting the target string at each 
occurrence of the pattern. If the limit is positive, no more than that many 
splits will be made. If there are captured subpatterns, they are returned in 
the array.  */
-- (NSArray *)splitString:(NSString *)str limit:(int)lim;
+- (NSArray *)splitString:(NSString *)str limit:(NSInteger)lim;
 
 @end

Modified: trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.m
===================================================================
--- trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.m 2009-04-22 
11:53:34 UTC (rev 15151)
+++ trunk/bibdesk_vendorsrc/agkit_sourceforge/agregex/AGRegex.m 2009-04-22 
12:32:05 UTC (rev 15152)
@@ -33,7 +33,7 @@
 
 // information about a case modifier
 typedef struct {
-       unsigned location;
+       NSUInteger location;
        char type;
 } case_modifier_t;
 
@@ -41,8 +41,8 @@
 // count the number of UTF-8 characters in a string
 // there is probably a better way to do this but this works for now
 static inline
-int utf8charcount(UInt8 *str, int len) {
-       int chars, pos;
+NSInteger utf8charcount(UInt8 *str, NSInteger len) {
+       NSInteger chars, pos;
        unsigned char c;
        for (pos = chars = 0; pos < len; pos++) {
                c = str[pos];
@@ -60,14 +60,14 @@
 @end
 
 @interface AGRegexMatch (Private)
-- (id)initWithRegex:(AGRegex *)re string:(NSString *)str vector:(int *)mv 
count:(int)c;
+- (id)initWithRegex:(AGRegex *)re string:(NSString *)str vector:(int *)mv 
count:(NSInteger)c;
 @end
 
 @interface AGRegexMatchEnumerator : NSEnumerator {
     AGRegex *regex;
     NSString *string;
     NSRange range;
-    unsigned end;
+    NSUInteger end;
 }
 - (id)initWithRegex:(AGRegex *)re string:(NSString *)s range:(NSRange)r;
 @end
@@ -87,7 +87,7 @@
 
 + (id)regexWithPattern:(NSString *)pat { return [[[self alloc] 
initWithPattern:pat] autorelease]; }
 
-+ (id)regexWithPattern:(NSString *)pat options:(int)opts { return [[[self 
alloc] initWithPattern:pat options:opts ] autorelease]; }
++ (id)regexWithPattern:(NSString *)pat options:(NSInteger)opts { return 
[[[self alloc] initWithPattern:pat options:opts ] autorelease]; }
 
 - (id)init {
        return [self initWithPattern:@""];
@@ -97,7 +97,7 @@
        return [self initWithPattern:pat options:0];
 }
 
-- (id)initWithPattern:(NSString *)pat options:(int)opts {
+- (id)initWithPattern:(NSString *)pat options:(NSInteger)opts {
        if (self = [super init]) {
                const char *emsg;
                int eloc, copts = 0;
@@ -142,8 +142,9 @@
     if(!str)
         return nil; // we crash when calling strlen(nil)
     
-       int error, length, options, *matchv;
-       length = [str length];
+       int error, options, *matchv;
+       NSUInteger length;
+    length = [str length];
        options = 0;
 #ifndef SUPPORT_UTF8
        // check for valid ASCII string
@@ -223,13 +224,13 @@
        return [self replaceWithString:rep inString:str limit:0];
 }
 
-- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str 
limit:(int)lim {
+- (NSString *)replaceWithString:(NSString *)rep inString:(NSString *)str 
limit:(NSInteger)lim {
        NSMutableString *repBuffer, *result = [NSMutableString string];
        AGRegexMatch *match, *backref;
        NSArray *allMatches, *allBackrefs;
        NSRange remainRange, matchRange, backrefRemainRange, backrefMatchRange;
        case_modifier_t *caseModVector;
-       int i, j, k, l, length, repLength, allCount, allBackrefsCount, 
caseModIdx;
+       NSInteger i, j, k, l, length, repLength, allCount, allBackrefsCount, 
caseModIdx;
        // set remaining range to full range of receiver
        length = [str length];
        remainRange = NSMakeRange(0, length);
@@ -349,13 +350,13 @@
        return [self splitString:str limit:0];
 }
 
-- (NSArray *)splitString:(NSString *)str limit:(int)lim {
+- (NSArray *)splitString:(NSString *)str limit:(NSInteger)lim {
        NSMutableArray *result = [NSMutableArray array];
        AGRegexMatch *match;
        NSArray *allMatches;
        NSString *group;
        NSRange remainRange, matchRange;
-       int i, j, count, allCount, length = [str length];
+       NSInteger i, j, count, allCount, length = [str length];
        // find all matches
        allMatches = [self findAllInString:str]; 
        allCount = [allMatches count];
@@ -388,7 +389,7 @@
 @implementation AGRegexMatch
 
 // takes ownership of the passed match vector, free on dealloc
-- (id)initWithRegex:(AGRegex *)re string:(NSString *)str vector:(int *)mv 
count:(int)c {
+- (id)initWithRegex:(AGRegex *)re string:(NSString *)str vector:(int *)mv 
count:(NSInteger)c {
        if (self = [super init]) {
                regex = [re retain];
                string = [str copy]; // really only copies if the string is 
mutable, immutable strings are just retained
@@ -405,7 +406,7 @@
        [super dealloc];
 }
 
-- (int)count {
+- (NSInteger)count {
        return count;
 }
 
@@ -413,13 +414,13 @@
        return [self groupAtIndex:0];
 }
 
-- (NSString *)groupAtIndex:(int)idx {
+- (NSString *)groupAtIndex:(NSInteger)idx {
        NSRange r = [self rangeAtIndex:idx];
        return r.location == NSNotFound ? nil : [string substringWithRange:r];
 }
 
 - (NSString *)groupNamed:(NSString *)name {
-       int idx = pcre_get_stringnumber([regex pcre], [name UTF8String]);
+       NSInteger idx = pcre_get_stringnumber([regex pcre], [name UTF8String]);
        if (idx == PCRE_ERROR_NOSUBSTRING)
                [NSException raise:NSInvalidArgumentException format:@"no group 
named %@", name];
        return [self groupAtIndex:idx];
@@ -429,8 +430,8 @@
        return [self rangeAtIndex:0];
 }
 
-- (NSRange)rangeAtIndex:(int)idx {
-       int start, end;
+- (NSRange)rangeAtIndex:(NSInteger)idx {
+       NSInteger start, end;
        if (idx >= count)
                [NSException raise:NSRangeException format:@"index %d out of 
bounds", idx];
        start = matchv[2 * idx];
@@ -465,7 +466,7 @@
 }
 
 - (NSRange)rangeNamed:(NSString *)name {
-       int idx = pcre_get_stringnumber([regex pcre], [name UTF8String]);
+       NSInteger idx = pcre_get_stringnumber([regex pcre], [name UTF8String]);
        if (idx == PCRE_ERROR_NOSUBSTRING)
                [NSException raise:NSInvalidArgumentException format:@"no group 
named %@", name];
        return [self rangeAtIndex:idx];
@@ -477,9 +478,9 @@
 
 - (NSString *)description {
        NSMutableString *desc = [NSMutableString stringWithFormat:@"%@ {\n", 
[super description]];
-       int i;
+       NSInteger i;
        for (i = 0; i < count; i++)
-               [desc appendFormat:@"\t%d %@ %...@\n", i, 
NSStringFromRange([self rangeAtIndex:i]), [self groupAtIndex:i]];
+               [desc appendFormat:@"\t%ld %@ %...@\n", (long)i, 
NSStringFromRange([self rangeAtIndex:i]), [self groupAtIndex:i]];
        [desc appendString:@"}"];
        return desc;
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to