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
|
%{
/* pl.y: Grammar for reading property list files
This file is part of Omega,
which is based on the web2c distribution of TeX,
Copyright (c) 1994--2001 John Plaice and Yannis Haralambous
Omega is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Omega 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Omega; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include "cpascal.h"
#include "parser.h"
#include "manifests.h"
#include "list_routines.h"
#include "error_routines.h"
#include "out_routines.h"
#include "char_routines.h"
#include "header_routines.h"
#include "param_routines.h"
#include "dimen_routines.h"
#include "ligkern_routines.h"
#include "print_routines.h"
#include "font_routines.h"
#include "extra_routines.h"
%}
/* Basic tokens */
%token LEFT
%token RIGHT
%token NUMBER
%token FIX
%token COMMENT
/* Tokens found in PL, OPL, VF and OVF files */
%token CHECKSUM
%token DESIGNSIZE
%token DESIGNUNITS
%token CODINGSCHEME /* implicit string */
%token FAMILY /* implicit string */
%token FACE
%token SEVENBITSAFEFLAG /* implicit 0 (FALSE) or 1 (TRUE) */
%token HEADER
%token FONTDIMEN
%token LIGTABLE
%token BOUNDARYCHAR
%token CHARACTER
%token NAMEDPARAMETER /* implicit integer */
%token PARAMETER
%token CHARMEASURE /* implicit integer */
%token NEXTLARGER
%token VARCHAR
%token EXTEN /* implicit integer */
%token LABEL
%token LIG /* implicit integer */
%token KRN
%token STOP
%token SKIP
/* Tokens found only in VF and OVF files */
%token VTITLE
%token MAPFONT
%token FONTNAME
%token FONTAREA
%token FONTCHECKSUM
%token FONTAT
%token FONTDSIZE
%token MAP
%token SELECTFONT
%token SETCHAR
%token SETRULE
%token MOVE
%token PUSH
%token POP
%token SPECIAL
%token SPECIALHEX
/* Tokens found only in OPL and OVF files */
%token CHARREPEAT
%token FONTIVALUE
%token FONTFVALUE
%token FONTMVALUE
%token FONTPENALTY
%token FONTRULE
%token FONTGLUE
%token CLABEL
%token CKRN
%token CGLUE
%token CPENALTY
%token CPENGLUE
%token CHARIVALUE
%token CHARFVALUE
%token CHARMVALUE
%token CHARPENALTY
%token CHARRULE
%token CHARGLUE
%token IVALUE
%token IVALUEVAL
%token MVALUE
%token MVALUEVAL
%token FVALUE
%token FVALUEVAL
%token PENALTY
%token PENALTYVAL
%token RULE
%token RULEMEASURE
%token GLUE
%token GLUEWD
%token GLUETYPE
%token GLUEKIND /* Implicit integer */
%token GLUERULE
%token GLUECHAR
%token GLUESHRINKSTRETCH
%token GLUEORDER /* Implicit integer */
%token OFMLEVEL
%token FONTDIR
%token ACCENT
%%
File:
Entries
;
Entries :
/* */
| Entries
LEFT OneEntry RIGHT
;
OneEntry :
/* The following entries are found in PL, OPL, VP and OVP files */
CHECKSUM NUMBER
{ set_check_sum($2.yint); }
| DESIGNSIZE FIX
{ set_design_size($2.yfix); }
| DESIGNUNITS FIX
{ set_design_units($2.yfix); }
| CODINGSCHEME
{ set_coding_scheme($1.ystring); }
| FAMILY
{ set_family($1.ystring); }
| FACE NUMBER
{ set_face($2.yint); }
| SEVENBITSAFEFLAG
{ set_seven_bit_safe_flag($1.yint); }
| HEADER NUMBER NUMBER
{ set_header_word($2.yint, $3.yint); }
| FONTDIMEN
{ init_parameters(); }
FontParameters
| LIGTABLE
{ init_ligkern(); }
LigKernEntries
| BOUNDARYCHAR NUMBER
{ set_boundary_character($2.yint); }
| CHARACTER NUMBER
{ init_character($2.yint, NULL); }
CharacterEntries
| COMMENT
/* The following entries are found only in VP and OVP files */
| VTITLE
{ set_vtitle($1.ystring); }
| MAPFONT NUMBER
{ init_map_font($2.yint); }
MapFontEntries
/* The following entries are found only in OPL and OVP files */
| OFMLEVEL NUMBER
{ set_ofm_level($2.yint); }
| FONTDIR
{ set_font_dir($1.yint); }
| CHARREPEAT NUMBER NUMBER
{ init_character($2.yint,NULL); }
CharacterEntries
{ copy_characters($2.yint,$3.yint); }
| FONTIVALUE NUMBER
{init_font_ivalue($2.yint);}
FontIvalueEntries
| FONTMVALUE NUMBER
{ init_font_mvalue($2.yint);}
FontMvalueEntries
| FONTFVALUE NUMBER
{ init_font_fvalue($2.yint);}
FontFvalueEntries
| FONTPENALTY NUMBER
{ init_font_penalty($2.yint);}
FontPenaltyEntries
| FONTRULE NUMBER
{ init_font_rule($2.yint);}
FontRuleEntries
| FONTGLUE NUMBER
{ init_font_glue($2.yint);}
FontGlueEntries
;
FontParameters :
/* */
| FontParameters
LEFT OneFontParameter RIGHT
;
OneFontParameter :
NAMEDPARAMETER FIX
{ set_param_word($1.yint, $2.yfix); }
| PARAMETER NUMBER FIX
{ set_param_word($2.yint, $3.yfix); }
| COMMENT
;
LigKernEntries :
/* */
| LigKernEntries
LEFT OneLigKernEntry RIGHT
;
OneLigKernEntry :
LABEL NUMBER
{ set_label_command($2.yint); }
| LABEL BOUNDARYCHAR
{ set_label_command(CHAR_BOUNDARY); }
| LIG NUMBER NUMBER
{ set_ligature_command($1.yint, $2.yint, $3.yint); }
| KRN NUMBER FIX
{ set_kerning_command($2.yint, $3.yfix); }
| STOP
{ set_stop_command(); }
| SKIP NUMBER
{ set_skip_command($2.yint); }
| COMMENT
/* The following entries are found only in OPL and OVP files */
| CLABEL NUMBER
{ set_c_label_command($2.yint); }
| CKRN NUMBER FIX
{ set_c_kerning_command($2.yint, $3.yfix); }
| CGLUE NUMBER NUMBER
{ set_c_glue_command($2.yint, $3.yint); }
| CPENALTY NUMBER NUMBER
{ set_c_penalty_command($2.yint, $3.yint); }
| CPENGLUE NUMBER NUMBER NUMBER
{ set_c_penglue_command($2.yint, $3.yint, $4.yint); }
;
CharacterEntries :
/* */
| CharacterEntries
LEFT OneCharacterEntry RIGHT
;
OneCharacterEntry :
CHARMEASURE FIX
{ set_character_measure($1.yint, $2.yfix); }
| NEXTLARGER NUMBER
{ set_next_larger($2.yint); }
| VARCHAR
{ init_var_character(); }
VarCharParameters
| COMMENT
/* The following character entries are found only in VP and OVP files */
| MAP
{ init_map(); }
MapEntries
{ end_map(); }
/* The following entries are found only in OPL and OVP files */
| ACCENT
{ set_accent($1.yint); }
| CHARIVALUE NUMBER NUMBER
{ set_character_ivalue($2.yint, $3.yint); }
| CHARMVALUE NUMBER NUMBER
{ set_character_mvalue($2.yint, $3.yint); }
| CHARFVALUE NUMBER NUMBER
{ set_character_fvalue($2.yint, $3.yint); }
| CHARPENALTY NUMBER NUMBER
{ set_character_penalty($2.yint, $3.yint); }
| CHARRULE NUMBER NUMBER
{ set_character_rule($2.yint, $3.yint); }
| CHARGLUE NUMBER NUMBER
{ set_character_glue($2.yint, $3.yint); }
;
VarCharParameters :
/* */
| VarCharParameters
LEFT OneVarCharParameter RIGHT
;
OneVarCharParameter :
EXTEN NUMBER
{ set_extensible_piece($1.yint, $2.yint); }
| COMMENT
;
/* The following four nonterminals are found only in VP and OVP files */
MapFontEntries :
/* */
| MapFontEntries
LEFT OneMapFontEntry RIGHT
;
OneMapFontEntry :
FONTNAME
{ set_font_name($1.ystring); }
| FONTAREA
{ set_font_area($1.ystring); }
| FONTCHECKSUM NUMBER
{ set_font_check_sum($2.yint); }
| FONTAT FIX
{ set_font_at($2.yfix); }
| FONTDSIZE FIX
{ set_font_design_size($2.yfix); }
| COMMENT
;
MapEntries :
/* */
| MapEntries
LEFT OneMapEntry RIGHT
;
OneMapEntry :
SELECTFONT NUMBER
{ set_select_font($2.yint); }
| SETCHAR NUMBER
{ set_set_char($2.yint); }
| SETRULE FIX FIX
{ set_set_rule($2.yfix, $3.yfix); }
| MOVE FIX
{ set_move($1.yint, $2.yfix); }
| PUSH
{ set_push(); }
| POP
{ set_pop(); }
| SPECIAL
{ set_special($1.ystring); }
| SPECIALHEX
{ set_special_hex($1.ystring); }
;
/* The remaining nonterminals are found only in OPL and OVP files */
FontIvalueEntries :
/* */
| FontIvalueEntries
LEFT OneFontIvalueEntry RIGHT
;
OneFontIvalueEntry :
IVALUE NUMBER
{ init_font_ivalue_entry($2.yint); }
IvalueDefinition
| COMMENT
;
IvalueDefinition :
/* */
| IvalueDefinition
LEFT OneIvalueDefinition RIGHT
;
OneIvalueDefinition :
IVALUEVAL NUMBER
{ set_font_ivalue_definition($2.yint); }
| COMMENT
;
FontMvalueEntries :
/* */
| FontMvalueEntries
LEFT OneFontMvalueEntry RIGHT
;
OneFontMvalueEntry :
MVALUE NUMBER
{ init_font_mvalue_entry($2.yint); }
MvalueDefinition
| COMMENT
;
MvalueDefinition :
/* */
| MvalueDefinition
LEFT OneMvalueDefinition RIGHT
;
OneMvalueDefinition :
MVALUEVAL FIX
{ set_font_mvalue_definition($2.yfix); }
| COMMENT
;
FontFvalueEntries :
/* */
| FontFvalueEntries
LEFT OneFontFvalueEntry RIGHT
;
OneFontFvalueEntry :
FVALUE NUMBER
{ init_font_fvalue_entry($2.yint); }
FvalueDefinition
| COMMENT
;
FvalueDefinition :
/* */
| FvalueDefinition
LEFT OneFvalueDefinition RIGHT
;
OneFvalueDefinition :
FVALUEVAL FIX
{ set_font_fvalue_definition($2.yfix); }
| COMMENT
;
FontPenaltyEntries :
/* */
| FontPenaltyEntries
LEFT OneFontPenaltyEntry RIGHT
;
OneFontPenaltyEntry :
PENALTY NUMBER
{ init_font_penalty_entry($2.yint); }
PenaltyDefinition
| COMMENT
;
PenaltyDefinition :
/* */
| PenaltyDefinition
LEFT OnePenaltyDefinition RIGHT
;
OnePenaltyDefinition :
PENALTYVAL NUMBER
{ set_font_penalty_definition($2.yint); }
| COMMENT
;
FontRuleEntries :
/* */
| FontRuleEntries
LEFT OneFontRuleEntry RIGHT
;
OneFontRuleEntry :
RULE NUMBER
{ init_font_rule_entry($2.yint); }
RuleDefinition
| COMMENT
;
RuleDefinition :
/* */
| RuleDefinition
LEFT OneRuleDefinition RIGHT
;
OneRuleDefinition :
RULEMEASURE FIX
{ set_font_rule_measure($1.yint, $2.yfix); }
| COMMENT
;
FontGlueEntries :
/* */
| FontGlueEntries
LEFT OneFontGlueEntry RIGHT
;
OneFontGlueEntry :
GLUE NUMBER
{ init_font_glue_entry($2.yint); }
GlueDefinition
| COMMENT
;
GlueDefinition :
/* */
| GlueDefinition
LEFT OneGlueDefinition RIGHT
;
OneGlueDefinition :
GLUETYPE GLUEKIND
{ set_font_glue_type($2.yint); }
| GLUEWD FIX
{ set_font_glue_width($2.yfix); }
| GLUECHAR NUMBER
{ set_font_glue_character($2.yint); }
| GLUERULE NUMBER NUMBER
{ set_font_glue_rule($2.yint, $3.yint); }
| GLUESHRINKSTRETCH FIX GLUEORDER
{ set_font_glue_shrink_stretch($1.yint, $2.yfix, $3.yint); }
| COMMENT
;
|