From f8c9f9165f78d2bbfa5c9465b2af1d13dad05671 Mon Sep 17 00:00:00 2001 From: Joseph Spiros Date: Thu, 28 Aug 2003 07:34:05 +0000 Subject: [PATCH] Removing incomplete/warning/broken classes from the framework target, and removing the LGPL-ed classes Alex put in, as well as those classes that depended on them. Also fixed some warnings in the classes that remain in the target. --- ArrayQueue.h | 59 ----------------- ArrayQueue.m | 144 ------------------------------------------ ITAppleEventCenter.m | 10 +-- ITChunkedByteStream.h | 28 -------- ITChunkedByteStream.m | 63 ------------------ ITFoundation.h | 5 +- ITStringScanner.h | 14 ++-- ITStringScanner.m | 59 ++++++++--------- 8 files changed, 41 insertions(+), 341 deletions(-) delete mode 100755 ArrayQueue.h delete mode 100755 ArrayQueue.m delete mode 100755 ITChunkedByteStream.h delete mode 100755 ITChunkedByteStream.m diff --git a/ArrayQueue.h b/ArrayQueue.h deleted file mode 100755 index 34a3e80..0000000 --- a/ArrayQueue.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************ -A Cocoa DataStructuresFramework -Copyright (C) 2002 Phillip Morelock in the United States -http://www.phillipmorelock.com -Other copyrights for this specific file as acknowledged herein. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*******************************/ -/* - * ArrayQueue.h - * Data Structures Framework -/////SEE LICENSE FILE FOR LICENSE INFORMATION/////// - * - */ - -////////// -//A fairly basic queue implementation that puts its data in an NSMutableArray -//See the protocol definition for Queue to understand the contract. -///////// - -#import -#import "Queue.h" - -@interface ArrayQueue : NSObject -{ - NSMutableArray *theQ; - - int backIndex; //where to place the next element - int frontIndex; //the current front of the queue - unsigned int qSize; //the current size - unsigned int arrsz; - - id niller; //the marker for dead spots in the queue -} - -- init; -- initWithCapacity:(unsigned)capacity; - -//returns the size of the queue currently --(unsigned int) count; - -/** - * see protocol declaration for Queue - */ -+(ArrayQueue *)queueWithArray:(NSArray *)array - ofOrder:(BOOL)direction; -@end \ No newline at end of file diff --git a/ArrayQueue.m b/ArrayQueue.m deleted file mode 100755 index 400ef4f..0000000 --- a/ArrayQueue.m +++ /dev/null @@ -1,144 +0,0 @@ -/************************ -A Cocoa DataStructuresFramework -Copyright (C) 2002 Phillip Morelock in the United States -http://www.phillipmorelock.com -Other copyrights for this specific file as acknowledged herein. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*******************************/ - -/////SEE LICENSE FILE FOR LICENSE INFORMATION/////// - -#import "ArrayQueue.h" - -@implementation ArrayQueue - -- init -{ - return [self initWithCapacity:10]; -} - --initWithCapacity:(unsigned)capacity -{ - self = [super init]; - - theQ = [[NSMutableArray alloc] initWithCapacity:capacity]; - - backIndex = -1; - frontIndex = 0; - qSize = 0; - - niller = [[NSString stringWithFormat:@"nothing"] retain]; - - return self; -} - --(void) dealloc -{ - [theQ release]; - [niller release]; - [super dealloc]; -} - --(BOOL) enqueue: (id)enqueuedObj -{ - if ( enqueuedObj == nil ) - return NO; - - ++backIndex; - [theQ insertObject:enqueuedObj atIndex:backIndex]; - ++qSize; - return YES; -} - -- dequeue -{ - id theObj; - - if ( qSize < 1 ) - return nil; - - //decrement the size of the Q - --qSize; - - //get it and retain it - theObj = [[theQ objectAtIndex:frontIndex] retain]; - [theQ replaceObjectAtIndex:frontIndex withObject:niller]; - - //now increment front -- if we have large array and we've "caught up" with - //the back, then let's dealloc and start over. - ++frontIndex; - if (frontIndex > 25 && qSize < 0) - { - [self removeAllObjects]; - } - - return [theObj autorelease]; -} - --(unsigned) count -{ - return qSize; -} - -//simple BOOL for whether the queue is empty or not. --(BOOL) isEmpty -{ - if ( qSize < 1) - return YES; - else - return NO; -} - --(void) removeAllObjects -{ - if (theQ) - [theQ release]; - - theQ = [[NSMutableArray alloc] initWithCapacity:10]; - backIndex = -1; - frontIndex = 0; - qSize = 0; - -} - -+(ArrayQueue *)queueWithArray:(NSArray *)array - ofOrder:(BOOL)direction -{ - ArrayQueue *q; - int i,s; - - q = [[ArrayQueue alloc] init]; - s = [array count]; - i = 0; - - if (!array || !s) - {}//nada - else if (direction)//so the order to dequeue will be from 0...n - { - while (i < s) - [q enqueue: [array objectAtIndex: i++]]; - } - else //order to dequeue will be n...0 - { - while (s > i) - [q enqueue: [array objectAtIndex: --s]]; - } - - return [q autorelease]; -} - - -@end diff --git a/ITAppleEventCenter.m b/ITAppleEventCenter.m index bceb1ab..8ad8af5 100755 --- a/ITAppleEventCenter.m +++ b/ITAppleEventCenter.m @@ -24,7 +24,7 @@ static ITAppleEventCenter *_sharedAECenter = nil; - (id)init { - if (self = [super init]) { + if ( ( self = [super init] ) ) { idleUPP = NewAEIdleUPP(MyAEIdleCallback); } return self; @@ -440,10 +440,10 @@ static ITAppleEventCenter *_sharedAECenter = nil; OSStatus cerr,cerr2,err; //AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, kAnyTransactionID, &event, nil, ""); if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) { - //NSLog(@"Error getting PID of application! Exiting."); - return nil; - } - cerr = AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest); + //NSLog(@"Error getting PID of application! Exiting."); + return; + } + cerr = AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest); cerr2 = AECreateAppleEvent(eClass,eID,&dest,kAutoGenerateReturnID,kAnyTransactionID,&event); //[self printCarbonDesc:&event]; err = AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, idleUPP, nil); diff --git a/ITChunkedByteStream.h b/ITChunkedByteStream.h deleted file mode 100755 index f8f9e17..0000000 --- a/ITChunkedByteStream.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ITChunkedByteStream.h -// ITFoundation -// -// Created by Alexander Strange on Tue Jul 22 2003. -// Copyright (c) 2003 __MyCompanyName__. All rights reserved. -// - -#import -#import "ITByteStream.h" -#import "ArrayQueue.h" - -@interface ITChunkedByteStream : NSObject { - @public - ArrayQueue *q; - @private - NSLock *lock; - id delegate; -} --(BOOL)empty; --(NSData*) readData; --(oneway void) writeData:(in NSData*)data; --(oneway void) writeBytesNoCopy:(in char *)b len:(unsigned long)length; --(oneway void) writeBytes:(in char *)b len:(unsigned long)length; --initWithDelegate:(id)delegate; --setDelegate:(id)delegate; --delegate; -@end diff --git a/ITChunkedByteStream.m b/ITChunkedByteStream.m deleted file mode 100755 index cb31795..0000000 --- a/ITChunkedByteStream.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// ITChunkedByteStream.m -// ITFoundation -// -// Created by Alexander Strange on Tue Jul 22 2003. -// Copyright (c) 2003 __MyCompanyName__. All rights reserved. -// - -#import "ITChunkedByteStream.h" - - -@implementation ITChunkedByteStream --initWithDelegate:(id)d -{ - if (self = [super init]) { - q = [[ArrayQueue alloc] init]; - lock = [[NSLock alloc] init]; - delegate = [d retain]; - } - return self; -} - --(BOOL)empty -{ - BOOL a; - [lock lock]; - a = [q isEmpty]; - [lock unlock]; - return a; -} - --(NSData*) readData -{ - NSData *d; - [lock lock]; - d = (NSData*)[q dequeue]; - [lock unlock]; - return d; -} - --(oneway void) writeData:(in NSData*)d -{ - [lock lock]; - [q enqueue:d]; - [lock unlock]; -} - --(oneway void) writeBytesNoCopy:(in char *)b len:(unsigned long)length -{ - [lock lock]; - [q enqueue:[NSData dataWithBytesNoCopy:b length:length]]; - [lock unlock]; -} - --(oneway void) writeBytes:(in char *)b len:(unsigned long)length -{ - [lock lock]; - [q enqueue:[NSData dataWithBytes:b length:length]]; - [lock unlock]; -} --delegate {return delegate;} --setDelegate:(id)d {id old = delegate; [delegate release]; delegate = [d retain]; return old;} -@end diff --git a/ITFoundation.h b/ITFoundation.h index b172868..637061d 100755 --- a/ITFoundation.h +++ b/ITFoundation.h @@ -14,8 +14,5 @@ #import -//#import -#import #import -//import -//import +#import diff --git a/ITStringScanner.h b/ITStringScanner.h index cfa745d..910c6a9 100755 --- a/ITStringScanner.h +++ b/ITStringScanner.h @@ -21,12 +21,12 @@ */ @interface ITStringScanner : NSObject { - NSString *str; - char *strCStr; - size_t curPos; - size_t size; + NSString *_string; + char *_cString; + size_t _currentPosition; + size_t _size; } --(id)initWithString:(NSString*)str2; --(NSString *)scanUpToCharacter:(char)c; --(NSString *)scanUpToString:(NSString*)str; +- (id)initWithString:(NSString*)string; +- (NSString *)scanUpToCharacter:(char)character; +- (NSString *)scanUpToString:(NSString*)string; @end diff --git a/ITStringScanner.m b/ITStringScanner.m index c40b81b..0e71ff7 100755 --- a/ITStringScanner.m +++ b/ITStringScanner.m @@ -2,56 +2,53 @@ #import "ITStringScanner.h" -static NSString *AString(void) -{ - return @""; -} - @implementation ITStringScanner --(id)init + +- (id)init { - if (self = [super init]) + if ( ( self = [super init] ) ) { - strCStr = NULL; - str = nil; - curPos = size = 0; + _cString = NULL; + _string = nil; + _currentPosition = 0; + _size = 0; } return self; } --(id)initWithString:(NSString*)str2 +- (id)initWithString:(NSString*)string { - if (self = [super init]) + if ( ( self = [super init] ) ) { - strCStr = (char *)[str2 cString]; - str = [str2 retain]; - curPos = 0; - size = [str2 length]; + _cString = (char *)[string cString]; + _string = [string retain]; + _currentPosition = 0; + _size = [string length]; } return self; } --(NSString *)scanUpToCharacter:(char)c +- (NSString *)scanUpToCharacter:(char)character { - size_t i=curPos,j=0; + size_t i=_currentPosition,j=0; - if (strCStr[i] == c) + if (_cString[i] == character) { i++; - return AString(); + return @""; } else { NSRange r = {i,0}; NSString *tmpStr = nil; - const size_t tmp = size; + const size_t tmp = _size; unsigned char foundIt = NO; do { i++,j++; - if (strCStr[i] == c) + if (_cString[i] == character) { foundIt = YES; r.length = j; @@ -62,17 +59,17 @@ static NSString *AString(void) if (foundIt) { - tmpStr = [str substringWithRange:r]; - curPos = i; + tmpStr = [_string substringWithRange:r]; + _currentPosition = i; } return tmpStr; } } --(NSString *)scanUpToString:(NSString*)str2 +- (NSString *)scanUpToString:(NSString*)string { - size_t i=curPos,j=0, len = [str2 length]; - const char *str2cstr = [str2 cString]; + size_t i=_currentPosition,j=0, len = [string length]; + const char *str2cstr = [string cString]; if (len <= 1) @@ -80,13 +77,13 @@ static NSString *AString(void) if (len) return [self scanUpToCharacter:str2cstr[0]]; else - return AString(); + return @""; } else { NSRange r = {i,0}; NSString *tmpStr = nil; - const size_t tmp = size; + const size_t tmp = _size; unsigned char foundIt = NO; do @@ -104,8 +101,8 @@ static NSString *AString(void) if (foundIt) { - tmpStr = [str substringWithRange:r]; - curPos = i; + tmpStr = [_string substringWithRange:r]; + _currentPosition = i; } return tmpStr; } -- 2.20.1