ObjFW  Check-in [a4918da65c]

Overview
Comment:Unicode Table Generator: Store used tables in object.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a4918da65c4c5fc0424eec39d4d2322ef193d3200d47d16c95a5985e8b5388e9
User & Date: js on 2009-12-23 22:25:37
Other Links: manifest | tags
Context
2009-12-23
22:30
Documentation improvements. check-in: 19ac0520ae user: js tags: trunk
22:25
Unicode Table Generator: Store used tables in object. check-in: a4918da65c user: js tags: trunk
2009-12-21
16:58
Documentation improvement. check-in: 7cae2b95fb user: js tags: trunk
Changes

Modified generators/TableGenerator.h from [28782a1119] to [9eafd13ad5].

12
13
14
15
16
17
18



19
20
21
22
23
24
25
26
27
28
#import "OFString.h"

@interface TableGenerator: OFObject
{
	of_unichar_t upper[0x110000];
	of_unichar_t lower[0x110000];
	of_unichar_t casefolding[0x110000];



	size_t upper_size;
	size_t lower_size;
	size_t casefolding_size;
}

- (void)readUnicodeDataFile: (OFString*)path;
- (void)readCaseFoldingFile: (OFString*)path;
- (void)writeTablesToFile: (OFString*)file;
- (void)writeHeaderToFile: (OFString*)file;
@end







>
>
>










12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import "OFString.h"

@interface TableGenerator: OFObject
{
	of_unichar_t upper[0x110000];
	of_unichar_t lower[0x110000];
	of_unichar_t casefolding[0x110000];
	BOOL upper_table_used[0x1100];
	BOOL lower_table_used[0x1100];
	BOOL casefolding_table_used[0x1100];
	size_t upper_size;
	size_t lower_size;
	size_t casefolding_size;
}

- (void)readUnicodeDataFile: (OFString*)path;
- (void)readCaseFoldingFile: (OFString*)path;
- (void)writeTablesToFile: (OFString*)file;
- (void)writeHeaderToFile: (OFString*)file;
@end

Modified generators/TableGenerator.m from [4e245e9c8a] to [d15067685c].

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
}

- (void)writeTablesToFile: (OFString*)file
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2;

	of_unichar_t i, j;
	BOOL *upper_table_used;
	BOOL *lower_table_used;
	char *casefolding_table_used;
	OFFile *f = [OFFile fileWithPath: file
				    mode: @"wb"];

	upper_table_used = [self allocMemoryWithSize: 0x1100];
	lower_table_used = [self allocMemoryWithSize: 0x1100];
	casefolding_table_used = [self allocMemoryWithSize: 0x1100];

	memset(upper_table_used, 0, 0x1100);
	memset(lower_table_used, 0, 0x1100);
	memset(casefolding_table_used, 0, 0x1100);

	[f writeString: COPYRIGHT
	    @"#include \"config.h\"\n"
	    @"\n"
	    @"#import \"OFString.h\"\n\n"
	    @"static const of_unichar_t nop_page[0x100] = {};\n\n"];

	pool2 = [[OFAutoreleasePool alloc] init];







<
<
<



<
<
<
<
<
<
<
<







101
102
103
104
105
106
107



108
109
110








111
112
113
114
115
116
117
}

- (void)writeTablesToFile: (OFString*)file
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2;

	of_unichar_t i, j;



	OFFile *f = [OFFile fileWithPath: file
				    mode: @"wb"];









	[f writeString: COPYRIGHT
	    @"#include \"config.h\"\n"
	    @"\n"
	    @"#import \"OFString.h\"\n\n"
	    @"static const of_unichar_t nop_page[0x100] = {};\n\n"];

	pool2 = [[OFAutoreleasePool alloc] init];
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
			[f writeString: @",\n\t"];
		else if (i + 1 < casefolding_size)
			[f writeString: @", "];
	}

	[f writeString: @"\n};\n"];

	[self freeMemory: upper_table_used];
	[self freeMemory: lower_table_used];
	[self freeMemory: casefolding_table_used];

	[pool release];
}

- (void)writeHeaderToFile: (OFString*)file
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFFile *f = [OFFile fileWithPath: file







<
<
<
<







290
291
292
293
294
295
296




297
298
299
300
301
302
303
			[f writeString: @",\n\t"];
		else if (i + 1 < casefolding_size)
			[f writeString: @", "];
	}

	[f writeString: @"\n};\n"];





	[pool release];
}

- (void)writeHeaderToFile: (OFString*)file
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFFile *f = [OFFile fileWithPath: file