1 // 2 // utils.h 3 // CocoaTams 4 // 5 // Created by matthew on Mon Apr 15 2002. 6 // Copyright (c) 2002 M. Weinstein. All rights reserved. 7 // 8 9 #import <Foundation/Foundation.h> 10 #import <AppKit/AppKit.h> 11 #define ADDCHAR(X) appendFormat: @"%C",X 12 //#define ADDCHAR(X) appendString: charToNSS(X) 13 #define FORALL(X) {id temp; unsigned __cnt, __i; __cnt = [X count]; for( __i = 0; __i < __cnt; __i++) {temp = [X objectAtIndex: __i]; 14 #define ENDFORALL }} 15 #define ISQUOTE(X) ([X characterAtIndex: 0] == '\"' && [X characterAtIndex: ([X length] -1)] == '\"') 16 #define NSWARNING(X) NSRunAlertPanel(@"Warning!", X, @"Ok", nil, nil); 17 #define NSMESSAGE(X) NSRunAlertPanel(@"Note:", X, @"Ok", nil, nil); 18 #define NSYESNOQUESTION(X) ((NSRunAlertPanel(@"Question:", X, @"No", @"Yes", nil) == 0) ? YES : NO) 19 #define NSSETHEADER(T,C,S) [[[T tableColumnWithIdentifier: C] headerCell] setStringValue: S] 20 NSString *charToNSS(char c); 21 NSMutableString *trimNSS(NSMutableString *s); 22 NSMutableString *trimCharNSS(NSMutableString *s, unichar ch); 23 NSMutableArray *convertStringToArray(NSString *theString, char breakChar); 24 int nsSubString(NSString *first, NSString *sec, BOOL caseInsensitive); 25 int menuStringComp(id first, id second, void *key); 26 #define NSALLOC(X,Y) X *Y = [[X alloc] init] 27 BOOL addUniqueToArray(NSMutableArray *who, NSString *what); 28