93 |
int subst1_count, subst2_count, subst_long_count; |
int subst1_count, subst2_count, subst_long_count; |
94 |
|
|
95 |
to_utf8 = 0; |
to_utf8 = 0; |
96 |
for(;;) { |
for (;;) { |
97 |
c = getopt(argc, argv, "uh"); |
c = getopt(argc, argv, "uh"); |
98 |
if (c == -1) |
if (c == -1) |
99 |
break; |
break; |
100 |
switch(c) { |
switch (c) { |
101 |
case 'h': |
case 'h': |
102 |
help(); |
help(); |
103 |
break; |
break; |
116 |
perror(lig_filename); |
perror(lig_filename); |
117 |
return 1; |
return 1; |
118 |
} |
} |
119 |
for(;;) { |
for (;;) { |
120 |
if (fgets(buf, sizeof(buf), f) == NULL) |
if (fgets(buf, sizeof(buf), f) == NULL) |
121 |
break; |
break; |
122 |
p = buf + strlen(buf) - 1; |
p = buf + strlen(buf) - 1; |
137 |
l = &ligs[nb_ligs++]; |
l = &ligs[nb_ligs++]; |
138 |
|
|
139 |
l->buf_in_size = 0; |
l->buf_in_size = 0; |
140 |
for(;;) { |
for (;;) { |
141 |
while (isspace(*p)) |
while (isspace(*p)) |
142 |
p++; |
p++; |
143 |
if (*p == '=') |
if (*p == '=') |
151 |
p++; |
p++; |
152 |
|
|
153 |
l->buf_out_size = 0; |
l->buf_out_size = 0; |
154 |
for(;;) { |
for (;;) { |
155 |
while (isspace(*p)) |
while (isspace(*p)) |
156 |
p++; |
p++; |
157 |
/* stop at the first comment */ |
/* stop at the first comment */ |
169 |
/* output UTF8 encoded list */ |
/* output UTF8 encoded list */ |
170 |
if (to_utf8) { |
if (to_utf8) { |
171 |
printf("%s // ", buf); |
printf("%s // ", buf); |
172 |
for(i=0;i<l->buf_in_size;i++) { |
for (i = 0; i < l->buf_in_size; i++) { |
173 |
unicode_to_utf8(buf1, l->buf_in[i]); |
unicode_to_utf8(buf1, l->buf_in[i]); |
174 |
printf("%s ", buf1); |
printf("%s ", buf1); |
175 |
} |
} |
176 |
printf("="); |
printf("="); |
177 |
for(i=0;i<l->buf_out_size;i++) { |
for (i = 0; i < l->buf_out_size; i++) { |
178 |
unicode_to_utf8(buf1, l->buf_out[i]); |
unicode_to_utf8(buf1, l->buf_out[i]); |
179 |
printf(" %s", buf1); |
printf(" %s", buf1); |
180 |
} |
} |
203 |
|
|
204 |
/* output the subst table */ |
/* output the subst table */ |
205 |
n = 0; |
n = 0; |
206 |
for(i=0;i<nb_ligs;i++) { |
for (i = 0; i < nb_ligs; i++) { |
207 |
l = &ligs[i]; |
l = &ligs[i]; |
208 |
if (l->buf_in_size == 1) { |
if (l->buf_in_size == 1) { |
209 |
if (l->buf_out_size != 1) { |
if (l->buf_out_size != 1) { |
222 |
l1 = 0; |
l1 = 0; |
223 |
l2 = 0; |
l2 = 0; |
224 |
n = 0; |
n = 0; |
225 |
for(i=0;i<nb_ligs;i++) { |
for (i = 0; i < nb_ligs; i++) { |
226 |
l = &ligs[i]; |
l = &ligs[i]; |
227 |
if (l->buf_in_size >= 2) { |
if (l->buf_in_size >= 2) { |
228 |
if (l->buf_in_size > 2 || l->buf_out_size > 1) { |
if (l->buf_in_size > 2 || l->buf_out_size > 1) { |
249 |
|
|
250 |
/* output the long ligature table */ |
/* output the long ligature table */ |
251 |
n = 0; |
n = 0; |
252 |
for(i=0;i<nb_ligs;i++) { |
for (i = 0; i < nb_ligs; i++) { |
253 |
l = &ligs[i]; |
l = &ligs[i]; |
254 |
if (l->buf_in_size > 2 || l->buf_out_size > 1) { |
if (l->buf_in_size > 2 || l->buf_out_size > 1) { |
255 |
put_be16(outfile, l->buf_in_size); |
put_be16(outfile, l->buf_in_size); |
256 |
put_be16(outfile, l->buf_out_size); |
put_be16(outfile, l->buf_out_size); |
257 |
for(j=0;j<l->buf_in_size;j++) |
for (j = 0; j < l->buf_in_size; j++) |
258 |
put_be16(outfile, l->buf_in[j]); |
put_be16(outfile, l->buf_in[j]); |
259 |
for(j=0;j<l->buf_out_size;j++) |
for (j = 0; j < l->buf_out_size; j++) |
260 |
put_be16(outfile, l->buf_out[j]); |
put_be16(outfile, l->buf_out[j]); |
261 |
n += 2 + l->buf_in_size + l->buf_out_size; |
n += 2 + l->buf_in_size + l->buf_out_size; |
262 |
} |
} |