-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_ucd_headers.c
624 lines (529 loc) · 26 KB
/
generate_ucd_headers.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
/*
This file is part of Hamza.
Hamza is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Hamza is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with Hamza. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#if _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <regex.h>
#include <assert.h>
#define INTS_PER_LINE 6
typedef struct {
uint32_t codepoint;
char *comment;
int comment_len;
char joining_type;
char *joining_group;
int joining_group_len;
} arabic_joining_data_t;
typedef struct {
uint32_t codepoint;
char name[25];
} jamo_t;
typedef struct {
char *txt[5];
size_t sizes[5];
} property_value_alias_t;
#define BUCKET_MAX_INDICES 64
typedef struct {
int size;
uint32_t indices[BUCKET_MAX_INDICES];
} mph_bucket_t;
typedef struct {
int32_t *k2;
void *values;
size_t value_size;
size_t size;
} mph_table_t;
// 32-bit hash functions
uint32_t hash2_lowbias32(uint32_t k1, uint32_t k2)
{
uint32_t h = k1;
h ^= h >> 16;
h *= 0x7feb352d;
h ^= h >> 15;
h *= 0x846ca68b;
h ^= h >> 16;
h ^= k2;
h ^= h >> 16;
h *= 0x7feb352d;
h ^= h >> 15;
h *= 0x846ca68b;
h ^= h >> 16;
return h;
}
int compare_mph_buckets(const void *lhs, const void *rhs)
{
return ((const mph_bucket_t*)rhs)->size - ((const mph_bucket_t*)lhs)->size;
}
int popvalue(int *arr, int *size, int index)
{
int val = arr[index];
for (int i = index; i < (*size); ++i) {
arr[i] = arr[i+1];
}
(*size) --;
return val;
}
int binsearch(int *arr,int size, int val) {
int low,mid,high;
low = 0; high = size;
while (low <= high) {
mid = (low + high) >> 1;
if (val < arr[mid]) { // less
high = mid-1;
} else if (val > arr[mid]) { // greater
low = mid+1;
} else { // equal
return mid;
}
}
return -1;
}
void arraypush(int *arr, int *size, int val) {
arr[(*size)++] = val;
}
void bininsert(int *arr, int *size, int val) {
int low,mid,high;
low = 0; high = *size;
mid = (low + high) >> 1;
while (low <= high) {
mid = (low + high) >> 1;
if (val < arr[mid]) { // lesser
high = mid-1;
} else if (val > arr[mid]) { // greater
low = mid+1;
} else { // equal
break;
}
}
(*size) ++;
for (int i = (*size)-1; i > mid; --i) {
arr[i] = arr[i-1];
}
arr[mid] = val;
}
int occurcnt(int *arr, int size, int val)
{
int cnt = 0;
for (int i =0; i < size; ++i) {
cnt += (arr[i] == val);
}
return cnt;
}
void mph_table_init(mph_table_t t[static 1], uint32_t *keys, void *values,
size_t value_size, size_t num_values, uint32_t (*hash)(uint32_t, uint32_t))
{
mph_bucket_t *buckets = calloc(num_values, sizeof(mph_bucket_t)); // Index buckets
t->k2 = calloc(num_values, sizeof(int32_t)); // Secondary Hash Array (for Collision Resolution)
t->value_size = value_size;
t->size = num_values;
t->values = malloc(num_values * value_size); // Ordered values
// Store keys in appropriate buckets
for (int i=0; i<num_values; ++i) {
uint32_t h = hash(keys[i],0)%num_values;
mph_bucket_t *bucket = &buckets[h];
bucket->indices[bucket->size++] = i;
}
// Sort the buckets and process in decreasing order (largest -> smallest)
qsort(buckets, num_values, sizeof(mph_bucket_t), compare_mph_buckets);
// Freeslots array
int *freeslots = malloc(num_values * sizeof(int));
int freeslots_size = num_values;
for (int i = 0; i < num_values; ++i) {
freeslots[i] = i;
}
int ones = 0, multi = 0;
for (int i = 0; i < num_values; ++i) {
if (buckets[i].size < 1)
break;
else if (buckets[i].size == 1) {
// Only buckets with one item remain, place them directly into a free slot
// k2 list already initialized to 0 so no need to set here
int idx = buckets[i].indices[0];
uint32_t k1 = keys[idx];
// uint32_t k1 = keys[idx];
assert(freeslots_size);
int slot = popvalue(freeslots, &freeslots_size, 0);
// printf("%d\n", slot);
// We subtract one to ensure it's negative even if the zeroeth slot was
// used.
t->k2[hash(k1,0)%num_values] = -(int32_t)(slot+1);
memcpy((char*)t->values + slot*value_size, (char*)values+idx*value_size, value_size);//Store value in slot
++ones;
} else {
// Try different values of k2 until we find a hash function that places
// all the items in the buckets into free slots
int32_t k2 = 0;
int slots[BUCKET_MAX_INDICES];
int slots_size = 0;
while (slots_size < buckets[i].size) {
int idx = buckets[i].indices[slots_size];
uint32_t k1 = keys[idx];
int slot = hash(k1,k2)%num_values;
if (occurcnt(slots, slots_size, slot) >= 1 || binsearch(freeslots, freeslots_size, slot) == -1) {
++k2;
slots_size = 0; // Clear
} else {
slots[slots_size] = slot;
++slots_size;
}
}
// printf("SLOTS SIZE: %d\n", slots_size);
// for (int z = 0; z < slots_size; ++z) {
// printf("%d ", slots[z]);
// }printf("\n\n");
assert(slots_size == buckets[i].size);
// Set k2 param for bucket
uint32_t k1 = keys[buckets[i].indices[0]];
t->k2[hash(k1,0)%num_values] = k2;
// Copy values from source table to their slots
for (int j = 0; j < slots_size; ++j){
int idx = buckets[i].indices[j];
memcpy((char*)t->values + slots[j]*value_size, (char*)values+idx*value_size, value_size); // Store value in slot
int slot_index = binsearch(freeslots, freeslots_size, slots[j]);
assert(slot_index != -1);
int popped = popvalue(freeslots, &freeslots_size, slot_index);
// printf("[%d] : %d\n", slot_index, popped);
}
multi += slots_size;
}
}
// Verify if MPH table was built correctly
int matches = 0, mismatches = 0;
for (int i = 0; i < num_values; ++i) {
uint32_t k1 = keys[i];
uint32_t h = hash(k1,0)%num_values;
int32_t k2 = t->k2[h];
uint32_t slot;
if (k2 < 0) {
slot = (-k2)-1;
} else {
slot = hash(keys[i],k2)%num_values;
}
char *val = (char*)t->values + slot*value_size;
uint32_t codepoint = ((arabic_joining_data_t*) val)->codepoint;
if (codepoint != k1) {
mismatches ++;
} else {
matches ++;
}
}
printf(" MATCHES: %d/%d , multi:%d, ones:%d\n", matches, mismatches, multi,ones);
free(freeslots);
free(buckets);
}
void mph_table_deinit(mph_table_t *t)
{
free(t->k2);
free(t->values);
}
int generate() {
int err;
char errbuf[512];
regex_t ver_regex,
arabic_shaping_regex,
jamo_regex,
property_value_aliases_regex;
if ((err = regcomp(&ver_regex, "^([0-9]+)\\.([0-9]+)(?:\\.([0-9]+)|-(Update(?:[0-9]+)?))$", REG_EXTENDED|REG_NEWLINE)) != 0) {
regerror(err, &arabic_shaping_regex, errbuf, 512);
fprintf(stderr, "Failed to compile regex err:\n%s\n", errbuf);
return -1;
}
if ((err = regcomp(&arabic_shaping_regex, "^([[:xdigit:]]*)[[:space:]]*;[[:space:]]*((?:[[:alnum:]][[:space:]]?)*)[[:space:]]*;[[:space:]]*([[:alpha:]])[[:space:]]*;[[:space:]]*((?:[[:space:]]?[[:alpha:]_])*)[[:space:]]*$", REG_EXTENDED|REG_NEWLINE)) != 0) {
regerror(err, &arabic_shaping_regex, errbuf, 512);
fprintf(stderr, "Failed to compile regex err:\n%s\n", errbuf);
return -1;
}
if ((err = regcomp(&jamo_regex, "^([[:xdigit:]]*)[[:space:]]*;[[:space:]]*([[:alpha:]]*)[[:space:]#^\\n]*", REG_EXTENDED|REG_NEWLINE)) != 0) {
regerror(err, &jamo_regex, errbuf, 512);
fprintf(stderr, "Failed to compile regex err:\n%s\n", errbuf);
return -1;
}
if ((err = regcomp(&property_value_aliases_regex, "^([[:alnum:]_\\-\\.]*)(?:[[:space:]]*;[[:space:]]*([[:alnum:]_\\-\\.\\/\\\\]*)(?:[[:space:]]*;[[:space:]]*([[:alnum:]_\\-\\.\\/\\\\]*)(?:[[:space:]]*;[[:space:]]*([[:alnum:]_\\-\\.\\/\\\\]*)[[:space:]]*)?)?)(?:[[:space:]]*#[^\\n]*)?", REG_EXTENDED|REG_NEWLINE)) != 0) {
regerror(err, &property_value_aliases_regex, errbuf, 512);
fprintf(stderr, "Failed to compile regex err:\n%s\n", errbuf);
return -1;
}
#ifdef _WIN32
WIN32_FIND_DATA fdFile;
HANDLE hFind;
char *sDir = ".\\UCD";
char sPath[2048] = ".\\UCD\\*.*";
if((hFind = FindFirstFile(sPath, &fdFile)) == INVALID_HANDLE_VALUE) {
printf("Path not found: [%s]\n", sDir);
return -1;
}
printf("Path found: [%s]\n", sDir);
do {
//Find first file will always return "."
// and ".." as the first two directories.
if(strcmp(fdFile.cFileName, ".") != 0
&& strcmp(fdFile.cFileName, "..") != 0) {
//Build up our file path using the passed in
// [sDir] and the file/foldername we just found:
snprintf(sPath, 2048, "%s\\%s", sDir, fdFile.cFileName);
//Is the entity a Folder?
if(fdFile.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY) {
printf("Directory: %s\n", sPath);
regmatch_t match[5];
if (regexec(&ver_regex, fdFile.cFileName, 5, match, 0) != REG_NOMATCH) {
// Regex match, generate UCD file
char filename[100];
int major = atoi(fdFile.cFileName + match[1].rm_so);
int minor = atoi(fdFile.cFileName + match[2].rm_so);
int patch = atoi(fdFile.cFileName + match[3].rm_so);
snprintf(filename,sizeof(filename),"hz_ucd_%d_%d_%.*s%d.h", major, minor,
match[4].rm_eo-match[4].rm_so, fdFile.cFileName + match[4].rm_so,
patch);
char filename2[100];
snprintf(filename2,100,"./hz/%s", filename);
FILE *f = fopen(filename2, "w+");
if (f) {
char macro[100]; strcpy(macro,filename);
for (char *p = macro; *p != '\0'; ++p) {
if (*p == '.') *p = '_';
}
strupr(macro);
fprintf(f, "#ifndef %s\n", macro);
fprintf(f, "#define %s\n\n", macro);
fprintf(f, "#include <stdint.h>\n\n");
fprintf(f, "#define HZ_UCD_VERSION HZ_MAKE_VERSION(%d,%d,%d)\n\n",major,minor,patch);
{
// Add enum definitions from PropertyValueAliases.txt
char tmp[100];
snprintf(tmp,100,"%s\\ucd\\PropertyValueAliases.txt", sPath);
printf("%s\n", tmp);
FILE *property_value_aliases = fopen(tmp,"r");
if (property_value_aliases) { // Read entire file data, then split into lines and parse
fseek(property_value_aliases,0,SEEK_END);
size_t filesize = ftell(property_value_aliases);
fseek(property_value_aliases,0,SEEK_SET);
char *str = malloc(filesize+1);
fread(str, 1, filesize, property_value_aliases);
str[filesize] = '\0';
// Allocate big enough buffer for joining groups
#define MAX_PROPERTY_VALUE_ALIASES 2048
property_value_alias_t *aliases = malloc(sizeof(aliases[0]) * MAX_PROPERTY_VALUE_ALIASES);
char *s = str;
int off, len;
int cnt;
for (cnt=0; ; ++cnt) {
regmatch_t match[6];
if (regexec(&property_value_aliases_regex, s, 6, match, 0) == REG_NOMATCH)
break;
off = match[0].rm_so + (s - str);
len = match[0].rm_eo - match[0].rm_so;
property_value_alias_t alias;
for (int k = 0; k < 5; ++k) {
alias.txt[k] = s + match[k+1].rm_so;
alias.sizes[k] = match[k+1].rm_eo - match[k+1].rm_so;
}
aliases[cnt] = alias;
s += match[0].rm_eo;
}
fprintf(f, "typedef enum {");
int v = 16;
for (int j = 0; j < cnt; ++j) {
if (aliases[j].sizes[0] == 2 && !strncmp(aliases[j].txt[0], "jt", 2)) {
char enum_name[50];
snprintf(enum_name, 50, "\n HZ_JOINING_TYPE_%.*s = 1 << %d,", aliases[j].sizes[1], aliases[j].txt[1], v);
fprintf(f, strupr(enum_name));
++v;
}
}
fprintf(f, "\n} hz_joining_type_t;\n\n");
fprintf(f, "typedef enum {");
fprintf(f, "\n HZ_JOINING_GROUP_NONE,");
for (int j = 0; j < cnt; ++j) {
if (aliases[j].sizes[0] == 2 && !strncmp(aliases[j].txt[0], "jg", 2)) {
char enum_name[50]="";
strncat(enum_name, aliases[j].txt[2], aliases[j].sizes[2]);
enum_name[aliases[j].sizes[2]] = '\0';
if (strcmp(enum_name,"No_Joining_Group")) {
fprintf(f,"\n HZ_JOINING_GROUP_%s,", strupr(enum_name));
}
}
}
fprintf(f, "\n} hz_joining_group_t;\n\n");
free(aliases);
fclose(property_value_aliases);
}
}
if (0) { // Add Korean Jamo table from Jamo.txt
char tmp[100];
snprintf(tmp,100,"%s\\ucd\\Jamo.txt", sPath);
printf("%s\n", tmp);
FILE *jamo = fopen(tmp,"r");
if (jamo) { // Read entire file data, then split into lines and parse
mph_table_t jamo_mph_table;
fseek(jamo,0,SEEK_END);
size_t filesize = ftell(jamo);
fseek(jamo,0,SEEK_SET);
char *str = malloc(filesize+1);
fread(str,1,filesize,jamo);
str[filesize] = '\0';
// Allocate big enough buffer for joining data
#define JAMO_SIZE 2048
jamo_t *jamo_data = malloc(sizeof(*jamo_data) * JAMO_SIZE);
uint32_t *jamo_data_keys = malloc(sizeof(uint32_t) * JAMO_SIZE);
char *s = str;
int off, len, cnt;
for (cnt=0; ; ++cnt) {
regmatch_t match[3];
if (regexec(&jamo_regex, s, 3, match, 0) == REG_NOMATCH)
break;
off = match[0].rm_so + (s - str);
len = match[0].rm_eo - match[0].rm_so;
jamo_data_keys[cnt] = strtol(s+match[1].rm_so,NULL,16);
jamo_data[cnt].codepoint = jamo_data_keys[cnt];
memset(jamo_data[cnt].name, 0, sizeof jamo_data[cnt].name);
snprintf(jamo_data[cnt].name, sizeof jamo_data[cnt].name, "%.*s", match[2].rm_eo - match[2].rm_so, s + match[2].rm_so);
printf("%s\n", jamo_data[cnt].name);
s += match[0].rm_eo;
}
mph_table_init(&jamo_mph_table,
jamo_data_keys,
jamo_data,
sizeof(jamo_data[0]),
cnt,
hash2_lowbias32);
/*
fprintf(f, "int32_t hz_ucd_jamo_short_names_k2[%d] = {", cnt);
for (int i = 0; i < jamo_mph_table.size; ++i) {
int k2 = jamo_mph_table.k2[i];
if (!(i % INTS_PER_LINE)) fprintf(f,"\n ");
fprintf(f, "%4d,", k2);
}
fprintf(f,"\n};\n\n");
// Short Names
fprintf(f, "uint32_t hz_ucd_jamo_short_names[%d] = {",cnt);
for (int i = 0; i < jamo_mph_table.size; ++i) {
jamo_t dat = ((jamo_t*)jamo_mph_table.values)[i];
fprintf(f, "\n HZ_JAMO_SHORT_NAME_%s,", dat.name);
}
fprintf(f,"\n};\n\n");
*/
}
}
{ // Add arabic table
char tmp[100];
snprintf(tmp,100,"%s\\ucd\\ArabicShaping.txt", sPath);
printf("%s\n", tmp);
FILE *arabic_shaping = fopen(tmp,"r");
if (arabic_shaping) { // Read entire file data, then split into lines and parse
mph_table_t arabic_shaping_table;
fseek(arabic_shaping,0,SEEK_END);
size_t filesize = ftell(arabic_shaping);
fseek(arabic_shaping,0,SEEK_SET);
char *str = malloc(filesize+1);
fread(str,1,filesize,arabic_shaping);
str[filesize] = '\0';
// Allocate big enough buffer for joining data
#define ARABIC_JOINING_SIZE 2048
arabic_joining_data_t *arabic_data = malloc(sizeof(*arabic_data) * ARABIC_JOINING_SIZE);
uint32_t *arabic_data_keys = malloc(sizeof(uint32_t) * ARABIC_JOINING_SIZE);
char *s = str;
int off, len, cnt;
for (cnt=0; ; ++cnt) {
regmatch_t match[5];
if (regexec(&arabic_shaping_regex, s, 5, match, 0) == REG_NOMATCH)
break;
off = match[0].rm_so + (s - str);
len = match[0].rm_eo - match[0].rm_so;
// Create joining data
arabic_joining_data_t jd;
memset(&jd,0,sizeof(jd));
jd.codepoint = strtol(s + match[1].rm_so, NULL, 16);
// printf("%d -> %.*s : %04x\n", cnt, match[1].rm_eo - match[1].rm_so, s + match[1].rm_so, jd.codepoint);
jd.joining_type = s[match[3].rm_so]; // Joining type
if (match[2].rm_so != -1) {
jd.comment = s + match[2].rm_so;
jd.comment_len = match[2].rm_eo - match[2].rm_so;
}
if (match[4].rm_so != -1) {
jd.joining_group = s + match[4].rm_so;
jd.joining_group_len = match[4].rm_eo - match[4].rm_so;
}
arabic_data[cnt] = jd;
arabic_data_keys[cnt] = jd.codepoint;
s += match[0].rm_eo;
}
mph_table_init(&arabic_shaping_table,
arabic_data_keys,
arabic_data,
sizeof(arabic_joining_data_t),
cnt,
hash2_lowbias32);
printf("ArabicShaping.txt MPH table created\n");
fprintf(f, "static int32_t hz_ucd_arabic_joining_k2[%d] = {", cnt);
for (int i = 0; i < arabic_shaping_table.size; ++i) {
int k2 = arabic_shaping_table.k2[i];
if (!(i % INTS_PER_LINE)) fprintf(f,"\n ");
fprintf(f, "%4d,", k2);
}
fprintf(f,"\n};\n\n");
// UCS
fprintf(f, "static uint32_t hz_ucd_arabic_joining_ucs_codepoints[%d] = {",cnt);
for (int i = 0; i < arabic_shaping_table.size; ++i) {
arabic_joining_data_t dat = ((arabic_joining_data_t*)arabic_shaping_table.values)[i];
if (!(i % INTS_PER_LINE))
fprintf(f,"\n ");
fprintf(f, "%8d,", dat.codepoint);
}
fprintf(f,"\n};\n\n");
printf("UCS Done\n");
fprintf(f, "static uint32_t hz_ucd_arabic_joining_data[%d] = {",cnt);
for (int i = 0; i < arabic_shaping_table.size; ++i) {
arabic_joining_data_t dat = ((arabic_joining_data_t*)arabic_shaping_table.values)[i];
fprintf(f,"\n ");
char jg[50]="";
strncat(jg, dat.joining_group, dat.joining_group_len);
if (!strcmp("No_Joining_Group", jg)) {
fprintf(f, "HZ_JOINING_TYPE_%c | HZ_JOINING_GROUP_NONE,", dat.joining_type);
} else {
strupr(jg); // uppercase
// Change spaces to underscores
for (char *p = jg; *p != '\0'; ++p) {
if (*p == ' ') *p = '_';
}
fprintf(f, "HZ_JOINING_TYPE_%c | HZ_JOINING_GROUP_%s,", dat.joining_type, jg);
}
}
fprintf(f,"\n};\n\n");
#if 0
fprintf(f, "static char const* const hz_ucd_arabic_joining_ucs_names[%d] = {",cnt);
for (int i = 0; i < arabic_shaping_table.size; ++i) {
arabic_joining_data_t dat = ((arabic_joining_data_t*)arabic_shaping_table.values)[i];
fprintf(f,"\n ");
fprintf(f, "\"%.*s\",", dat.comment_len, dat.comment);
}
fprintf(f,"\n};\n\n");
#endif
free(arabic_data);
free(str);
mph_table_deinit(&arabic_shaping_table);
fclose(arabic_shaping);
}
}
fprintf(f, "#endif /* %s */", macro);
fclose(f);
}
printf("%s\n",filename);
}
}
}
}
while(FindNextFile(hFind, &fdFile)); //Find the next file.
#endif
}
int main(int argc, char *argv[]) {
generate();
return EXIT_SUCCESS;
}