Index: generators/Makefile ================================================================== --- generators/Makefile +++ generators/Makefile @@ -1,10 +1,9 @@ include ../extra.mk PROG_NOINST = gen_tables${PROG_SUFFIX} -SRCS = main.o \ - TableGenerator.m +SRCS = TableGenerator.m .PHONY: run run: all UnicodeData.txt CaseFolding.txt rm -f libobjfw.so.1 libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} rm -f libobjfw.dll libobjfw.dylib Index: generators/TableGenerator.m ================================================================== --- generators/TableGenerator.m +++ generators/TableGenerator.m @@ -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"] && DELETED generators/main.m Index: generators/main.m ================================================================== --- generators/main.m +++ generators/main.m @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2008 - 2010 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE included in - * the packaging of this file. - */ - -#include "config.h" - -#import "OFAutoreleasePool.h" - -#import "TableGenerator.h" - -int -main() -{ - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - TableGenerator *tgen; - - tgen = [[[TableGenerator alloc] init] autorelease]; - [tgen readUnicodeDataFile: @"UnicodeData.txt"]; - [tgen readCaseFoldingFile: @"CaseFolding.txt"]; - [tgen writeTablesToFile: @"../src/unicode.m"]; - [tgen writeHeaderToFile: @"../src/unicode.h"]; - - [pool release]; - - return 0; -}