1 diff -Nur RegexKit_0.6.0_source.orig/GNUstep/GNUmakefile RegexKit_0.6.0_source.Linux/GNUstep/GNUmakefile
2 --- RegexKit_0.6.0_source.orig/GNUstep/GNUmakefile 2008-01-23 15:32:38.000000000 -0700
3 +++ RegexKit_0.6.0_source.Linux/GNUstep/GNUmakefile 2008-02-02 20:42:50.000000000 -0700
6 PCRE_LIBS = $(shell pcre-config --libs)
7 PCRE_CFLAGS = $(shell pcre-config --cflags)
8 -PCRE_HEADER = $(shell perl -e '$$x = "${PCRE_CFLAGS}"; $$x =~ /\-I(.*?\/include\b)/; print("$$1/pcre.h");')
10 -ORIGINAL_RK_PCRE_HEADER = $(shell diff -q '${REGEXKIT_HEADERS_DIR}/RegexKit/pcre.h' '${REGEXKIT_SOURCE_DIR}/Build/Distribution/distribution_pcre.h')
12 -ifeq (${ORIGINAL_RK_PCRE_HEADER},)
13 -$(info Copying the installed PCRE's '${PCRE_HEADER}' to RegexKit's Headers directory at '${REGEXKIT_HEADERS_DIR}/RegexKit/pcre.h')
14 -$(shell cp '${PCRE_HEADER}' '${REGEXKIT_HEADERS_DIR}/RegexKit/pcre.h')
17 vpath %.m ${REGEXKIT_SOURCE_DIR}
18 vpath %.h ${REGEXKIT_HEADERS_DIR}/RegexKit
20 LIBRARY_NAME = libRegexKit
21 PACKAGE_NAME = RegexKit
23 -libRegexKit_HEADER_FILES = NSArray.h NSData.h NSDictionary.h NSObject.h NSSet.h NSString.h RKEnumerator.h RKCache.h RKEnumerator.h RKRegex.h RKUtility.h RegexKit.h RegexKitDefines.h RegexKitTypes.h pcre.h
24 +libRegexKit_HEADER_FILES = NSArray.h NSData.h NSDictionary.h NSObject.h NSSet.h NSString.h RKEnumerator.h RKCache.h RKEnumerator.h RKRegex.h RKUtility.h RegexKit.h RegexKitDefines.h RegexKitTypes.h
25 libRegexKit_OBJC_FILES = NSArray.m NSData.m NSDictionary.m NSObject.m NSSet.m NSString.m RKAutoreleasedMemory.m RKCache.m RKCoder.m RKEnumerator.m RKLock.m RKPlaceholder.m RKPrivate.m RKRegex.m RKSortedRegexCollection.m RKThreadPool.m RKUtility.m
26 libRegexKit_HEADER_FILES_DIR = ${REGEXKIT_HEADERS_DIR}/RegexKit
27 libRegexKit_HEADER_FILES_INSTALL_DIR = /RegexKit
28 diff -Nur RegexKit_0.6.0_source.orig/GNUstep/GNUmakefile.postamble RegexKit_0.6.0_source.Linux/GNUstep/GNUmakefile.postamble
29 --- RegexKit_0.6.0_source.orig/GNUstep/GNUmakefile.postamble 2007-10-09 21:03:17.000000000 -0600
30 +++ RegexKit_0.6.0_source.Linux/GNUstep/GNUmakefile.postamble 2008-02-02 20:43:19.000000000 -0700
32 export PERL=${PERL}; \
33 export SHELL=${SHELL}; \
35 - export TARGET_BUILD_DIR=${GNUSTEP_INSTALLATION_DIR}/Library/Headers; \
36 + export TARGET_BUILD_DIR=${GNUSTEP_HEADERS}${GNUSTEP_HEADERS_INSTALL}; \
37 export PUBLIC_HEADERS_FOLDER_PATH=${libRegexKit_HEADER_FILES_INSTALL_DIR}; \
38 export TEMP_FILES_DIR=${GNUSTEP_BUILD_DIR}; \
39 ${REGEXKIT_SOURCE_DIR}/Build/Scripts/stripHeaderdoc.sh $(HEADERDOC_REDIRECT)"$(END_ECHO)
40 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/NSStringPrivate.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/NSStringPrivate.h
41 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/NSStringPrivate.h 2008-01-21 02:28:09.000000000 -0700
42 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/NSStringPrivate.h 2008-02-02 20:42:50.000000000 -0700
44 NSString *RKStringFromReferenceString(id self, const SEL _cmd, RKRegex * const RK_C99(restrict) regex, RK_STRONG_REF const NSRange * const RK_C99(restrict) matchRanges, RK_STRONG_REF const RKStringBuffer * const RK_C99(restrict) matchStringBuffer, RK_STRONG_REF const RKStringBuffer * const RK_C99(restrict) referenceStringBuffer) RK_ATTRIBUTES(malloc, used, visibility("hidden"));
45 BOOL RKExtractCapturesFromMatchesWithKeyArguments(id self, const SEL _cmd, RK_STRONG_REF const RKStringBuffer * const RK_C99(restrict) stringBuffer, RKRegex * const RK_C99(restrict) regex, RK_STRONG_REF const NSRange * const RK_C99(restrict) matchRanges, const RKCaptureExtractOptions captureExtractOptions, NSString * const firstKey, va_list useVarArgsList) RK_ATTRIBUTES(used, visibility("hidden"));
47 -#endif _REGEXKIT_NSSTRINGPRIVATE_H_
48 +#endif // _REGEXKIT_NSSTRINGPRIVATE_H_
52 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitDefines.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitDefines.h
53 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitDefines.h 2008-01-28 17:42:24.000000000 -0700
54 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitDefines.h 2008-02-02 20:42:50.000000000 -0700
56 #ifndef _REGEXKIT_REGEXKITDEFINES_H_
57 #define _REGEXKIT_REGEXKITDEFINES_H_ 1
59 -#import <mach-o/loader.h>
65 #error Unable to determine run time environment, automatic Mac OS X and GNUstep detection failed
68 +#if defined(__MACOSX_RUNTIME__)
69 +#import <mach-o/loader.h>
75 @tocgroup Constants Preprocessor Macros
76 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKit.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKit.h
77 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKit.h 2008-01-21 02:28:12.000000000 -0700
78 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKit.h 2008-02-02 20:42:50.000000000 -0700
80 @class RKRegexPlaceholder;
83 -#import <RegexKit/pcre.h>
86 #import <RegexKit/RKCache.h>
87 #import <RegexKit/RKRegex.h>
88 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitPrivateAtomic.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitPrivateAtomic.h
89 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitPrivateAtomic.h 2008-01-21 02:28:12.000000000 -0700
90 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitPrivateAtomic.h 2008-02-02 20:42:50.000000000 -0700
92 #define RKAtomicIncrementIntBarrier(ptr) __sync_add_and_fetch(ptr, 1)
93 #define RKAtomicDecrementIntBarrier(ptr) __sync_sub_and_fetch(ptr, 1)
94 #define RKAtomicCompareAndSwapInt(oldValue, newValue, ptr) __sync_bool_compare_and_swap(ptr, oldValue, newValue)
95 -#define RKAtomicCompareAndSwapPtr(oldp, newp, ptr) __sync_bool_compare_and_swap(ptr, oldValue, newValue)
96 +#define RKAtomicCompareAndSwapPtr(oldp, newp, ptr) __sync_bool_compare_and_swap(ptr, oldp, newp)
98 #define RKAtomicIncrementInteger(ptr) __sync_add_and_fetch(ptr, 1)
99 #define RKAtomicDecrementInteger(ptr) __sync_sub_and_fetch(ptr, 1)
100 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitPrivateThreads.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitPrivateThreads.h
101 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RegexKitPrivateThreads.h 2008-01-21 02:28:12.000000000 -0700
102 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RegexKitPrivateThreads.h 2008-02-02 20:42:50.000000000 -0700
104 #warning Unable to determine platform specific thread operations. Trying sched_yield() and pthread_main_np().
107 -#import <pthread_np.h>
109 #define HAVE_RKREGEX_THREAD_OPS
111 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RKRegex.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RKRegex.h
112 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RKRegex.h 2008-01-27 02:43:10.000000000 -0700
113 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RKRegex.h 2008-02-02 20:42:50.000000000 -0700
115 #import <RegexKit/RegexKitDefines.h>
116 #import <RegexKit/RegexKitTypes.h>
117 #import <RegexKit/RegexKit.h>
118 -#import <RegexKit/pcre.h>
123 diff -Nur RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RKThreadPool.h RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RKThreadPool.h
124 --- RegexKit_0.6.0_source.orig/Source/Headers/RegexKit/RKThreadPool.h 2008-01-27 02:06:27.000000000 -0700
125 +++ RegexKit_0.6.0_source.Linux/Source/Headers/RegexKit/RKThreadPool.h 2008-02-02 20:42:50.000000000 -0700
129 #import <sys/sysctl.h>
130 +#if defined(__MACOSX_RUNTIME__)
131 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
132 #import <mach/thread_act.h>
133 #import <mach/thread_policy.h>
134 #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
137 @class RKLock, RKConditionLock;
139 diff -Nur RegexKit_0.6.0_source.orig/Source/RKCache.m RegexKit_0.6.0_source.Linux/Source/RKCache.m
140 --- RegexKit_0.6.0_source.orig/Source/RKCache.m 2008-01-25 17:42:50.000000000 -0700
141 +++ RegexKit_0.6.0_source.Linux/Source/RKCache.m 2008-02-02 20:42:50.000000000 -0700
144 as a visual reminder that code within the comments is sensitive to lock based programming problems.
147 #import <RegexKit/RKCache.h>
148 #import <RegexKit/RegexKitPrivate.h>
149 // Not placed in RKCache.h because that's a public include which would require RKLock.h to be public, but it's only used internally.
151 if(RKCacheLoadInitialized == 1) { return; }
153 if(RKAtomicCompareAndSwapInt(0, 1, &RKCacheLoadInitialized)) {
154 - if((cacheMapKeyCallBacks = dlsym(RTLD_DEFAULT, "NSIntegerMapKeyCallBacks")) == NULL) { cacheMapKeyCallBacks = dlsym(RTLD_DEFAULT, "NSIntMapKeyCallBacks"); }
155 + cacheMapKeyCallBacks = &NSIntMapKeyCallBacks;
157 #ifdef ENABLE_MACOSX_GARBAGE_COLLECTION
158 id garbageCollector = objc_getClass("NSGarbageCollector");
159 diff -Nur RegexKit_0.6.0_source.orig/Source/RKLock.m RegexKit_0.6.0_source.Linux/Source/RKLock.m
160 --- RegexKit_0.6.0_source.orig/Source/RKLock.m 2008-01-28 22:11:00.000000000 -0700
161 +++ RegexKit_0.6.0_source.Linux/Source/RKLock.m 2008-02-02 20:42:50.000000000 -0700
164 #import <RegexKit/RKLock.h>
168 #pragma mark Exceptions
172 if((pthreadError = pthread_mutexattr_init(&threadMutexAttribute)) != 0) { NSLog(@"pthread_mutexattr_init returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
173 mutexAttributeInitialized = YES;
174 - if((pthreadError = pthread_mutexattr_settype(&threadMutexAttribute, PTHREAD_MUTEX_ERRORCHECK)) != 0) { NSLog(@"pthread_mutexattr_settype returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
175 + if((pthreadError = pthread_mutexattr_settype(&threadMutexAttribute, PTHREAD_MUTEX_ERRORCHECK_NP)) != 0) { NSLog(@"pthread_mutexattr_settype returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
177 while((pthreadError = pthread_mutex_init(&lock, &threadMutexAttribute)) != 0) {
178 if(pthreadError == EAGAIN) { initTryCount++; if(initTryCount > 5) { NSLog(@"pthread_mutex_init returned EAGAIN 5 times, giving up."); goto errorExit; } RKThreadYield(); continue; }
181 if((pthreadError = pthread_mutexattr_init(&threadMutexAttribute)) != 0) { NSLog(@"pthread_mutexattr_init returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
182 mutexAttributeInitialized = YES;
183 - if((pthreadError = pthread_mutexattr_settype(&threadMutexAttribute, PTHREAD_MUTEX_ERRORCHECK)) != 0) { NSLog(@"pthread_mutexattr_settype returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
184 + if((pthreadError = pthread_mutexattr_settype(&threadMutexAttribute, PTHREAD_MUTEX_ERRORCHECK_NP)) != 0) { NSLog(@"pthread_mutexattr_settype returned #%d, %s.", pthreadError, strerror(pthreadError)); goto errorExit; }
186 while((pthreadError = pthread_mutex_init(&pthreadMutex, &threadMutexAttribute)) != 0) {
187 if(pthreadError == EAGAIN) { initTryCount++; if(initTryCount > 5) { NSLog(@"pthread_mutex_init returned EAGAIN 5 times, giving up."); goto errorExit; } RKThreadYield(); continue; }
188 diff -Nur RegexKit_0.6.0_source.orig/Source/RKRegex.m RegexKit_0.6.0_source.Linux/Source/RKRegex.m
189 --- RegexKit_0.6.0_source.orig/Source/RKRegex.m 2008-01-29 03:18:59.000000000 -0700
190 +++ RegexKit_0.6.0_source.Linux/Source/RKRegex.m 2008-02-02 20:42:50.000000000 -0700
192 NSNumber *kernNumber = [NSNumber numberWithFloat:2.0f];
193 NSNumber *underlineStyleNumber = [NSNumber numberWithInt:(NSSingleUnderlineStyle | NSUnderlinePatternSolid)];
194 NSColor *underlineColor = [[NSColor redColor] colorWithAlphaComponent:0.75f];
195 - NSShadow *errorShadow = [[[NSShadow alloc] init] autorelease];
196 - [errorShadow setShadowOffset:NSMakeSize(0.0f, 0.0f)];
197 - [errorShadow setShadowBlurRadius:3.0f];
198 - [errorShadow setShadowColor:[NSColor redColor]];
201 RKStringBuffer abreviatedRegexStringBuffer = RKStringBufferWithString(abreviatedRegexString);
203 [abreviatedAttributedRegexString addAttribute:NSKernAttributeName value:kernNumber range:abreviatedRegexStringUTF16KernRange];
204 [abreviatedAttributedRegexString addAttribute:NSUnderlineStyleAttributeName value:underlineStyleNumber range:abreviatedRegexStringUTF16ErrorRange];
205 [abreviatedAttributedRegexString addAttribute:NSUnderlineColorAttributeName value:underlineColor range:abreviatedRegexStringUTF16ErrorRange];
206 - [abreviatedAttributedRegexString addAttribute:NSShadowAttributeName value:errorShadow range:abreviatedRegexStringUTF16ErrorRange];
208 NSRange regexStringUTF8KernRange = RKRangeForUTF8CharacterAtLocation(regexStringBuffer, (regexStringUTF8ErrorRange.location > 0) ? regexStringUTF8ErrorRange.location - 1 : 0);
209 regexStringUTF8KernRange = NSMakeRange(regexStringUTF8KernRange.location, NSMaxRange(regexStringUTF8ErrorRange) - regexStringUTF8KernRange.location);
211 [attributedRegexString addAttribute:NSKernAttributeName value:kernNumber range:regexStringUTF16KernRange];
212 [attributedRegexString addAttribute:NSUnderlineStyleAttributeName value:underlineStyleNumber range:regexStringUTF16ErrorRange];
213 [attributedRegexString addAttribute:NSUnderlineColorAttributeName value:underlineColor range:regexStringUTF16ErrorRange];
214 - [attributedRegexString addAttribute:NSShadowAttributeName value:errorShadow range:regexStringUTF16ErrorRange];
216 #else // not defined(__MACOSX_RUNTIME__) || (GNUSTEP_GUI_MINOR_VERSION < 12)
219 if(RK_EXPECTED(compiledRegexStringBuffer.characters == NULL, 0)) { [[NSException rkException:NSInternalInconsistencyException for:self selector:_cmd localizeReason:@"Unable to get string buffer from object '%@', which is a copy of the passed object '%@'.", RKPrettyObjectDescription(compiledRegexString), RKPrettyObjectDescription(regexString)] raise]; }
221 RK_PROBE(BEGINREGEXCOMPILE, self, (unsigned long)hash, (char *)compiledRegexStringBuffer.characters, (int)compileOption);
222 - _compiledPCRE = pcre_compile2(compiledRegexStringBuffer.characters, (int)compileOption, (int *)&compileErrorCode, &errorCharPtr, &(int)compileErrorOffset, NULL);
223 + _compiledPCRE = pcre_compile2(compiledRegexStringBuffer.characters, (int)compileOption, (int *)&compileErrorCode, &errorCharPtr, (int)&compileErrorOffset, NULL);
224 RK_PROBE(ENDREGEXCOMPILE, self, (unsigned long)hash, (char *)compiledRegexStringBuffer.characters, (int)compileOption, (int)compileErrorCode, (char *)RKCharactersFromCompileErrorCode(compileErrorCode), (compileErrorCode == RKCompileErrorNoError) ? "" : (char *)errorCharPtr, (compileErrorCode == RKCompileErrorNoError) ? 0 : (int)compileErrorOffset);
226 if(RK_EXPECTED(RK_EXPECTED((compileErrorCode != RKCompileErrorNoError), 0) || RK_EXPECTED((_compiledPCRE == NULL), 0), 0)) { initRegexError = RKErrorForCompileInitFailure(self, _cmd, &compiledRegexStringBuffer, compileErrorOffset, compileErrorCode, compileOption, 5); NSParameterAssert(initRegexError != NULL); goto errorExit; }
227 diff -Nur RegexKit_0.6.0_source.orig/Source/RKSortedRegexCollection.m RegexKit_0.6.0_source.Linux/Source/RKSortedRegexCollection.m
228 --- RegexKit_0.6.0_source.orig/Source/RKSortedRegexCollection.m 2008-01-25 15:10:00.000000000 -0700
229 +++ RegexKit_0.6.0_source.Linux/Source/RKSortedRegexCollection.m 2008-02-02 20:42:50.000000000 -0700
231 if(collectionType == RKArrayCollection) { CFArrayGetValues((CFArrayRef)collection, (CFRange){0, (CFIndex)collectionCount}, (const void **)(®exObjects[0])); }
232 else { CFSetGetValues((CFSetRef)collection, (const void **)(®exObjects[0])); }
234 - if(collectionType == RKArrayCollection) { [collection getObjects:&arrayObjects[0] range:NSMakeRange(0, collectionCount)]; }
235 + if(collectionType == RKArrayCollection) { [collection getObjects:®exObjects[0] range:NSMakeRange(0, collectionCount)]; }
236 else { [[collection allObjects] getObjects:®exObjects[0]]; }