@@ -9,22 +9,24 @@ * the packaging of this file. */ #include "config.h" -#include #include #include #import "OFString.h" #import "OFArray.h" #import "OFFile.h" #import "OFAutoreleasePool.h" +#import "OFApplication.h" #import "OFExceptions.h" #import "TableGenerator.h" #import "copyright.h" + +OF_APPLICATION_DELEGATE(TableGenerator) @implementation TableGenerator - init { self = [super init]; @@ -33,10 +35,19 @@ lower_size = SIZE_MAX; casefolding_size = SIZE_MAX; return self; } + +- (void)applicationDidFinishLaunching +{ + TableGenerator *tgen = [[[TableGenerator alloc] init] autorelease]; + [tgen readUnicodeDataFile: @"UnicodeData.txt"]; + [tgen readCaseFoldingFile: @"CaseFolding.txt"]; + [tgen writeTablesToFile: @"../src/unicode.m"]; + [tgen writeHeaderToFile: @"../src/unicode.h"]; +} - (void)readUnicodeDataFile: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2; OFFile *file = [OFFile fileWithPath: path @@ -47,13 +58,14 @@ while ((line = [file readLine])) { OFArray *splitted; OFString **splitted_carray; of_unichar_t codep; - splitted = [line splitWithDelimiter: @";"]; + splitted = [line componentsSeparatedByString: @";"]; if ([splitted count] != 15) { - fprintf(stderr, "Invalid line: %s\n", [line cString]); + [of_stderr writeFormat: @"Invalid line: %s\n", + [line cString]]; exit(1); } splitted_carray = [splitted cArray]; codep = [splitted_carray[0] hexadecimalValueAsInteger]; @@ -80,13 +92,14 @@ of_unichar_t codep; if ([line characterAtIndex: 0] == '#') continue; - splitted = [line splitWithDelimiter: @"; "]; + splitted = [line componentsSeparatedByString: @"; "]; if ([splitted count] != 4) { - fprintf(stderr, "Invalid line: %s\n", [line cString]); + [of_stderr writeFormat: @"Invalid line: %s\n", + [line cString]]; exit(1); } splitted_carray = [splitted cArray]; if (![splitted_carray[1] isEqual: @"S"] &&