ObjFW  Diff

Differences From Artifact [24b546a549]:

To Artifact [45cdda8f55]:


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
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 *splitted;
		OFString **splittedCArray;
		of_unichar_t codep;

		splitted = [line componentsSeparatedByString: @";"];
		if ([splitted count] != 15) {
			of_log(@"Invalid line: %@\n", line);
			[OFApplication terminateWithStatus: 1];
		}
		splittedCArray = [splitted cArray];

		codep = (of_unichar_t)[splittedCArray[0] hexadecimalValue];
		upperTable[codep] =
		    (of_unichar_t)[splittedCArray[12] hexadecimalValue];
		lowerTable[codep] =
		    (of_unichar_t)[splittedCArray[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 *splitted;
		OFString **splittedCArray;
		of_unichar_t codep;

		if ([line characterAtIndex: 0] == '#')
			continue;

		splitted = [line componentsSeparatedByString: @"; "];
		if ([splitted count] != 4) {
			of_log(@"Invalid line: %s\n", line);
			[OFApplication terminateWithStatus: 1];
		}
		splittedCArray = [splitted cArray];

		if (![splittedCArray[1] isEqual: @"S"] &&
		    ![splittedCArray[1] isEqual: @"C"])
			continue;

		codep = (of_unichar_t)[splittedCArray[0] hexadecimalValue];
		casefoldingTable[codep] =
		    (of_unichar_t)[splittedCArray[2] hexadecimalValue];

		[pool2 releaseObjects];
	}

	[pool release];
}








|
|








>


>













|
|


|
|



|

|

|

|
















|
|





|
|



|

|
|


|

|







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];
}