Overview
| Comment: | Style improvements in TableGenerator.m. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
5131770885f82feec48b9a6b2d1793cd |
| User & Date: | js on 2011-09-11 02:55:06 |
| Other Links: | manifest | tags |
Context
|
2011-09-11
| ||
| 12:15 | Add OFArray_subarray and OFArray_adjacenSubarray. (check-in: 9e0ca2f627 user: js tags: trunk) | |
| 02:55 | Style improvements in TableGenerator.m. (check-in: 5131770885 user: js tags: trunk) | |
| 01:28 | Fix ObjC++. (check-in: f786163cf8 user: js tags: trunk) | |
Changes
Modified generators/TableGenerator.m from [24b546a549] to [45cdda8f55].
| ︙ | ︙ | |||
30 31 32 33 34 35 36 |
OF_APPLICATION_DELEGATE(TableGenerator)
@implementation TableGenerator
- init
{
self = [super init];
| | | > > | | | | | | | | | | | | | | | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
OF_APPLICATION_DELEGATE(TableGenerator)
@implementation TableGenerator
- init
{
self = [super init];
upperTableSize = SIZE_MAX;
lowerTableSize = SIZE_MAX;
casefoldingTableSize = SIZE_MAX;
return self;
}
- (void)applicationDidFinishLaunching
{
TableGenerator *generator = [[[TableGenerator alloc] init] autorelease];
[generator readUnicodeDataFileAtPath: @"UnicodeData.txt"];
[generator readCaseFoldingFileAtPath: @"CaseFolding.txt"];
[generator writeTablesToFileAtPath: @"../src/unicode.m"];
[generator writeHeaderToFileAtPath: @"../src/unicode.h"];
}
- (void)readUnicodeDataFileAtPath: (OFString*)path
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2;
OFFile *file = [OFFile fileWithPath: path
mode: @"rb"];
OFString *line;
pool2 = [[OFAutoreleasePool alloc] init];
while ((line = [file readLine])) {
OFArray *split;
OFString **splitCArray;
of_unichar_t codep;
split = [line componentsSeparatedByString: @";"];
if ([split count] != 15) {
of_log(@"Invalid line: %@\n", line);
[OFApplication terminateWithStatus: 1];
}
splitCArray = [split cArray];
codep = (of_unichar_t)[splitCArray[0] hexadecimalValue];
upperTable[codep] =
(of_unichar_t)[splitCArray[12] hexadecimalValue];
lowerTable[codep] =
(of_unichar_t)[splitCArray[13] hexadecimalValue];
[pool2 releaseObjects];
}
[pool release];
}
- (void)readCaseFoldingFileAtPath: (OFString*)path
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2;
OFFile *file = [OFFile fileWithPath: path
mode: @"rb"];
OFString *line;
pool2 = [[OFAutoreleasePool alloc] init];
while ((line = [file readLine])) {
OFArray *split;
OFString **splitCArray;
of_unichar_t codep;
if ([line characterAtIndex: 0] == '#')
continue;
split = [line componentsSeparatedByString: @"; "];
if ([split count] != 4) {
of_log(@"Invalid line: %s\n", line);
[OFApplication terminateWithStatus: 1];
}
splitCArray = [split cArray];
if (![splitCArray[1] isEqual: @"S"] &&
![splitCArray[1] isEqual: @"C"])
continue;
codep = (of_unichar_t)[splitCArray[0] hexadecimalValue];
casefoldingTable[codep] =
(of_unichar_t)[splitCArray[2] hexadecimalValue];
[pool2 releaseObjects];
}
[pool release];
}
|
| ︙ | ︙ |