1 // Copyright (c) 1996 James Clark
2 // See the file copying.txt for copying permission.
3 
4 #include "stylelib.h"
5 #include "Style.h"
6 #include "VM.h"
7 #include "Interpreter.h"
8 #include "InterpreterMessages.h"
9 #include "macros.h"
10 
11 #ifdef DSSSL_NAMESPACE
12 namespace DSSSL_NAMESPACE {
13 #endif
14 
15 InheritedC::InheritedC(const Identifier *ident, unsigned index)
16 : ident_(ident), index_(index)
17 {
18 }
19 
20 InheritedC::~InheritedC()
21 {
22 }
new(size_t,Collector & c)23 
24 void InheritedC::invalidValue(const Location &loc,
25 			      Interpreter &interp) const
26 {
27   interp.invalidCharacteristicValue(identifier(), loc);
28 }
29 
30 class BoolInheritedC : public InheritedC {
31 public:
32   BoolInheritedC(const Identifier *, unsigned index, bool);
33   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
34 protected:
35   bool value_;
36 };
37 
38 BoolInheritedC::BoolInheritedC(const Identifier *ident, unsigned index, bool value)
39 : InheritedC(ident, index), value_(value)
40 {
41 }
42 
43 ELObj *BoolInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
44 {
45   if (value_)
46     return vm.interp->makeTrue();
47   else
48     return vm.interp->makeFalse();
49 }
50 
51 class IntegerInheritedC : public InheritedC {
52 public:
53   IntegerInheritedC(const Identifier *, unsigned index, long);
54   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
55 protected:
56   long n_;
57 };
58 
59 IntegerInheritedC::IntegerInheritedC(const Identifier *ident, unsigned index, long n)
60 : InheritedC(ident, index), n_(n)
61 {
62 }
63 
64 ELObj *IntegerInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
65 {
66   return vm.interp->makeInteger(n_);
67 }
68 
69 class LengthInheritedC : public InheritedC {
70 public:
71   LengthInheritedC(const Identifier *, unsigned index, FOTBuilder::Length);
72   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
73 protected:
74   FOTBuilder::Length size_;
75 };
76 
77 LengthInheritedC::LengthInheritedC(const Identifier *ident, unsigned index, FOTBuilder::Length size)
78 : InheritedC(ident, index), size_(size)
79 {
80 }
81 
82 ELObj *LengthInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
83 {
84   return new (*vm.interp) LengthObj(size_);
85 }
86 
87 class SymbolInheritedC : public InheritedC {
88 public:
89   SymbolInheritedC(const Identifier *, unsigned index, FOTBuilder::Symbol);
90   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
91 protected:
92   FOTBuilder::Symbol sym_;
93 };
94 
95 SymbolInheritedC::SymbolInheritedC(const Identifier *ident, unsigned index, FOTBuilder::Symbol sym)
96 : InheritedC(ident, index), sym_(sym)
97 {
98 }
99 
100 ELObj *SymbolInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
101 {
102   return vm.interp->cValueSymbol(sym_);
103 }
104 
105 class PublicIdInheritedC : public InheritedC {
106 public:
107   PublicIdInheritedC(const Identifier *, unsigned index,
108 		     FOTBuilder::PublicId = 0);
109   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
110 protected:
111   FOTBuilder::PublicId pubid_;
112 };
113 
114 PublicIdInheritedC::PublicIdInheritedC(const Identifier *ident, unsigned index, FOTBuilder::PublicId pubid)
115 : InheritedC(ident, index), pubid_(pubid)
116 {
117 }
118 
119 ELObj *PublicIdInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
120 {
121   Interpreter &interp = *vm.interp;
122   if (pubid_)
123     return new (interp) StringObj(interp.makeStringC(pubid_));
124   else
125     return interp.makeFalse();
126 }
127 
128 class Letter2InheritedC : public InheritedC {
129 public:
130   Letter2InheritedC(const Identifier *, unsigned index,
131 		     FOTBuilder::Letter2 = 0);
132   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
133 protected:
134   FOTBuilder::Letter2 code_;
135 };
136 
137 Letter2InheritedC::Letter2InheritedC(const Identifier *ident, unsigned index,
138 				     FOTBuilder::Letter2 code)
139 : InheritedC(ident, index), code_(code)
140 {
141 }
142 
143 ELObj *Letter2InheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
144 {
145   Interpreter &interp = *vm.interp;
146   if (code_) {
147     StringC buf;
148     buf += (code_ >> 8) & 0xff;
149     buf += code_ & 0xff;
150     buf += 0;
151     return interp.makeSymbol(buf);
152   }
153   else
154     return interp.makeFalse();
155 }
156 
157 class LengthSpecInheritedC : public InheritedC {
158 public:
159   LengthSpecInheritedC(const Identifier *, unsigned index, FOTBuilder::Length);
160   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
161 protected:
162   bool setValue(ELObj *, const Location &, Interpreter &);
163   FOTBuilder::LengthSpec value_;
164 };
165 
166 
167 LengthSpecInheritedC::LengthSpecInheritedC(const Identifier *ident,
168 					   unsigned index, FOTBuilder::Length n)
169 : InheritedC(ident, index), value_(n)
170 {
171 }
172 
173 ELObj *LengthSpecInheritedC::value(VM &vm, const VarStyleObj *,
174 				   Vector<size_t> &) const
175 {
176   return vm.interp->makeLengthSpec(value_);
177 }
178 
179 bool LengthSpecInheritedC::setValue(ELObj *obj, const Location &loc,
180 				    Interpreter &interp)
181 {
182   return interp.convertLengthSpecC(obj, identifier(), loc, value_);
183 }
184 
185 class OptLengthSpecInheritedC : public InheritedC {
186 public:
187   OptLengthSpecInheritedC(const Identifier *, unsigned index);
188   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
189 protected:
190   bool setValue(ELObj *, const Location &, Interpreter &);
191   FOTBuilder::OptLengthSpec value_;
192 };
193 
194 
195 OptLengthSpecInheritedC::OptLengthSpecInheritedC(const Identifier *ident,
196 						 unsigned index)
197 : InheritedC(ident, index)
198 {
199 }
200 
201 ELObj *OptLengthSpecInheritedC::value(VM &vm, const VarStyleObj *,
202 				      Vector<size_t> &) const
203 {
204   if (!value_.hasLength)
205     return vm.interp->makeFalse();
206   else
207     return vm.interp->makeLengthSpec(value_.length);
208 }
209 
210 bool OptLengthSpecInheritedC::setValue(ELObj *obj, const Location &loc,
211 				    Interpreter &interp)
212 {
213   return interp.convertOptLengthSpecC(obj, identifier(), loc, value_);
214 }
215 
216 class StringInheritedC : public InheritedC {
217 public:
218   StringInheritedC(const Identifier *, unsigned index, const Char *, size_t );
219   StringInheritedC(const Identifier *, unsigned index, const StringC &);
220   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
221 protected:
222   StringC str_;
223 };
224 
225 StringInheritedC::StringInheritedC(const Identifier *ident, unsigned index,
226 				   const Char *s, size_t n)
227 : InheritedC(ident, index), str_(s, n)
228 {
229 }
230 
231 StringInheritedC::StringInheritedC(const Identifier *ident, unsigned index,
232 				   const StringC &s)
233 : InheritedC(ident, index), str_(s)
234 {
235 }
236 
237 ELObj *StringInheritedC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
238 {
239   return new(*vm.interp) StringObj(str_);
240 }
241 
242 class GenericInlineSpaceInheritedC : public InheritedC {
243 public:
244   typedef void (FOTBuilder::*Setter)(const FOTBuilder::InlineSpace &);
245   GenericInlineSpaceInheritedC(const Identifier *, unsigned index, Setter setter);
246   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
247   void set(VM &, const VarStyleObj *, FOTBuilder &,
248            ELObj *&value, Vector<size_t> &dependencies) const;
249   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
250 private:
251   FOTBuilder::InlineSpace value_;
252   Setter setter_;
253 };
254 
255 GenericInlineSpaceInheritedC::GenericInlineSpaceInheritedC(const Identifier *ident,
256 							   unsigned index,
257 							   Setter setter)
258 : InheritedC(ident, index), setter_(setter)
259 {
260 }
261 
262 ELObj *GenericInlineSpaceInheritedC::value(VM &vm, const VarStyleObj *,
263 				    Vector<size_t> &) const
264 {
265   return new (*vm.interp) InlineSpaceObj(value_);
266 }
267 
268 void GenericInlineSpaceInheritedC::set(VM &, const VarStyleObj *,
269 				      FOTBuilder &fotb,
270 				      ELObj *&,
271 				      Vector<size_t> &) const
272 {
273   (fotb.*setter_)(value_);
274 }
275 
276 ConstPtr<InheritedC>
277 GenericInlineSpaceInheritedC::make(ELObj *obj, const Location &loc,
278 				   Interpreter &interp) const
279 {
280   GenericInlineSpaceInheritedC *copy
281     = new GenericInlineSpaceInheritedC(identifier(), index(), setter_);
282   InlineSpaceObj *iso = obj->asInlineSpace();
283   if (iso) {
284     copy->value_ = iso->inlineSpace();
285     return copy;
286   }
287   else if (interp.convertLengthSpecC(obj, identifier(), loc, copy->value_.nominal))  {
288     copy->value_.min = copy->value_.nominal;
289     copy->value_.max = copy->value_.nominal;
290     return copy;
291   }
292   delete copy;
293   return 0;
294 }
295 
296 
297 class GenericBoolInheritedC : public BoolInheritedC {
298 public:
299   typedef void (FOTBuilder::*Setter)(bool);
300   GenericBoolInheritedC(const Identifier *, unsigned index, Setter,
301 			bool = 0);
302   void set(VM &, const VarStyleObj *, FOTBuilder &,
303            ELObj *&value, Vector<size_t> &dependencies) const;
304   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
305 private:
306   Setter setter_;
307 };
308 
309 GenericBoolInheritedC
310 ::GenericBoolInheritedC(const Identifier *ident, unsigned index,
311 			Setter setter, bool b)
312 : BoolInheritedC(ident, index, b), setter_(setter)
313 {
314 }
315 
316 void GenericBoolInheritedC::set(VM &, const VarStyleObj *,
317 				FOTBuilder &fotb,
318 				ELObj *&,
319 				Vector<size_t> &) const
320 {
321   (fotb.*setter_)(value_);
322 }
323 
324 ConstPtr<InheritedC>
325 GenericBoolInheritedC::make(ELObj *obj, const Location &loc,
326 			    Interpreter &interp) const
327 {
328   bool b;
329   if (interp.convertBooleanC(obj, identifier(), loc, b))
330     return new GenericBoolInheritedC(identifier(), index(), setter_, b);
331   return ConstPtr<InheritedC>();
332 }
333 
334 class ExtensionBoolInheritedC : public BoolInheritedC {
335 public:
336   typedef void (FOTBuilder::*Setter)(bool);
337   ExtensionBoolInheritedC(const Identifier *, unsigned index, Setter,
338 			  bool = 0);
339   void set(VM &, const VarStyleObj *, FOTBuilder &,
340            ELObj *&value, Vector<size_t> &dependencies) const;
341   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
342 private:
343   Setter setter_;
344 };
345 
346 ExtensionBoolInheritedC
347 ::ExtensionBoolInheritedC(const Identifier *ident, unsigned index,
348 			  Setter setter, bool b)
349 : BoolInheritedC(ident, index, b), setter_(setter)
350 {
351 }
352 
353 void ExtensionBoolInheritedC::set(VM &, const VarStyleObj *,
354 				  FOTBuilder &fotb,
355 				  ELObj *&,
356 				  Vector<size_t> &) const
357 {
358   fotb.extensionSet(setter_, value_);
359 }
360 
361 ConstPtr<InheritedC>
362 ExtensionBoolInheritedC::make(ELObj *obj, const Location &loc,
363 			    Interpreter &interp) const
364 {
365   bool b;
366   if (interp.convertBooleanC(obj, identifier(), loc, b))
367     return new ExtensionBoolInheritedC(identifier(), index(), setter_, b);
368   return ConstPtr<InheritedC>();
369 }
370 
371 class ExtensionStringInheritedC : public StringInheritedC {
372 public:
373   typedef void (FOTBuilder::*Setter)(const StringC &);
374   ExtensionStringInheritedC(const Identifier *, unsigned index, Setter);
375   ExtensionStringInheritedC(const Identifier *, unsigned index, Setter,
376 			    const Char *, size_t);
377   void set(VM &, const VarStyleObj *, FOTBuilder &,
378            ELObj *&value, Vector<size_t> &dependencies) const;
379   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
380 private:
381   Setter setter_;
382 };
383 
384 ExtensionStringInheritedC
385 ::ExtensionStringInheritedC(const Identifier *ident, unsigned index,
386 			    Setter setter)
387 : StringInheritedC(ident, index, StringC()), setter_(setter)
388 {
389 }
390 
391 ExtensionStringInheritedC
392 ::ExtensionStringInheritedC(const Identifier *ident, unsigned index,
393 			    Setter setter, const Char *s, size_t n)
394 : StringInheritedC(ident, index, s, n), setter_(setter)
395 {
396 }
397 
398 void ExtensionStringInheritedC::set(VM &, const VarStyleObj *,
399 				  FOTBuilder &fotb,
400 				  ELObj *&,
401 				  Vector<size_t> &) const
402 {
403   fotb.extensionSet(setter_, str_);
404 }
405 
406 ConstPtr<InheritedC>
407 ExtensionStringInheritedC::make(ELObj *obj, const Location &loc,
408 			    Interpreter &interp) const
409 {
410   const Char *s;
411   size_t n;
412   if (obj->stringData(s, n))
413     return new ExtensionStringInheritedC(identifier(), index(), setter_, s, n);
414   invalidValue(loc, interp);
415   return ConstPtr<InheritedC>();
416 }
417 
418 class ExtensionIntegerInheritedC : public IntegerInheritedC {
419 public:
420   typedef void (FOTBuilder::*Setter)(long);
421   ExtensionIntegerInheritedC(const Identifier *, unsigned index, Setter,
422 			  long = 0);
423   void set(VM &, const VarStyleObj *, FOTBuilder &,
424            ELObj *&value, Vector<size_t> &dependencies) const;
425   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
426 private:
427   Setter setter_;
428 };
429 
430 ExtensionIntegerInheritedC
431 ::ExtensionIntegerInheritedC(const Identifier *ident, unsigned index,
432 			     Setter setter, long n)
433 : IntegerInheritedC(ident, index, n), setter_(setter)
434 {
435 }
436 
437 void ExtensionIntegerInheritedC::set(VM &, const VarStyleObj *,
438 				     FOTBuilder &fotb,
439 				     ELObj *&,
440 				     Vector<size_t> &) const
441 {
442   fotb.extensionSet(setter_, n_);
443 }
444 
445 ConstPtr<InheritedC>
446 ExtensionIntegerInheritedC::make(ELObj *obj, const Location &loc,
447 	  			 Interpreter &interp) const
448 {
449   long n;
450   if (interp.convertIntegerC(obj, identifier(), loc, n))
451     return new ExtensionIntegerInheritedC(identifier(), index(), setter_, n);
452   return ConstPtr<InheritedC>();
453 }
454 
455 class ExtensionLengthInheritedC : public LengthInheritedC {
456 public:
457   typedef void (FOTBuilder::*Setter)(FOTBuilder::Length);
458   ExtensionLengthInheritedC(const Identifier *, unsigned index, Setter, FOTBuilder::Length = 0);
459   void set(VM &, const VarStyleObj *, FOTBuilder &,
460            ELObj *&value, Vector<size_t> &dependencies) const;
461   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
462 private:
463   Setter setter_;
464 };
465 
466 ExtensionLengthInheritedC
467 ::ExtensionLengthInheritedC(const Identifier *ident, unsigned index,
468 			    Setter setter, FOTBuilder::Length n)
469 : LengthInheritedC(ident, index, n), setter_(setter)
470 {
471 }
472 
473 void ExtensionLengthInheritedC::set(VM &, const VarStyleObj *,
474 				    FOTBuilder &fotb,
475 				    ELObj *&,
476 				    Vector<size_t> &) const
477 {
478   fotb.extensionSet(setter_, size_);
479 }
480 
481 ConstPtr<InheritedC>
482 ExtensionLengthInheritedC::make(ELObj *obj, const Location &loc,
483 				Interpreter &interp) const
484 {
485   FOTBuilder::Length n;
486   if (interp.convertLengthC(obj, identifier(), loc, n))
487     return new ExtensionLengthInheritedC(identifier(), index(), setter_, n);
488   return ConstPtr<InheritedC>();
489 }
490 
491 class GenericLengthInheritedC : public LengthInheritedC {
492 public:
493   typedef void (FOTBuilder::*Setter)(FOTBuilder::Length);
494   GenericLengthInheritedC(const Identifier *, unsigned index, Setter,
495 			  FOTBuilder::Length = 0);
496   void set(VM &, const VarStyleObj *, FOTBuilder &,
497            ELObj *&value, Vector<size_t> &dependencies) const;
498   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
499 private:
500   Setter setter_;
501 };
502 
503 GenericLengthInheritedC
504 ::GenericLengthInheritedC(const Identifier *ident, unsigned index,
505 			  Setter setter, FOTBuilder::Length n)
506 : LengthInheritedC(ident, index, n), setter_(setter)
507 {
508 }
509 
510 void GenericLengthInheritedC::set(VM &, const VarStyleObj *,
511 				  FOTBuilder &fotb,
512 				  ELObj *&,
513 				  Vector<size_t> &) const
514 {
515   (fotb.*setter_)(size_);
516 }
517 
518 ConstPtr<InheritedC>
519 GenericLengthInheritedC::make(ELObj *obj, const Location &loc,
520 			      Interpreter &interp) const
521 {
522   FOTBuilder::Length n;
523   if (interp.convertLengthC(obj, identifier(), loc, n))
524     return new GenericLengthInheritedC(identifier(), index(), setter_, n);
525   return ConstPtr<InheritedC>();
526 }
527 
528 class GenericIntegerInheritedC : public IntegerInheritedC {
529 public:
530   typedef void (FOTBuilder::*Setter)(long);
531   GenericIntegerInheritedC(const Identifier *, unsigned index, Setter, long);
532   void set(VM &, const VarStyleObj *, FOTBuilder &,
533            ELObj *&value, Vector<size_t> &dependencies) const;
534   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
535 protected:
536   Setter setter_;
537 };
538 
539 GenericIntegerInheritedC
540 ::GenericIntegerInheritedC(const Identifier *ident, unsigned index,
541 			  Setter setter, long n)
542 : IntegerInheritedC(ident, index, n), setter_(setter)
543 {
544 }
545 
546 void GenericIntegerInheritedC::set(VM &, const VarStyleObj *,
547 				  FOTBuilder &fotb,
548 				  ELObj *&,
549 				  Vector<size_t> &) const
550 {
551   (fotb.*setter_)(n_);
552 }
553 
554 ConstPtr<InheritedC>
555 GenericIntegerInheritedC::make(ELObj *obj, const Location &loc,
556 			      Interpreter &interp) const
557 {
558   long n;
559   if (interp.convertIntegerC(obj, identifier(), loc, n))
560     return new GenericIntegerInheritedC(identifier(), index(), setter_, n);
561   return ConstPtr<InheritedC>();
562 }
563 
564 class GenericMaybeIntegerInheritedC : public GenericIntegerInheritedC {
565 public:
566   GenericMaybeIntegerInheritedC(const Identifier *, unsigned index,
567 				Setter, long);
568   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
569   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
570 };
571 
572 GenericMaybeIntegerInheritedC
573 ::GenericMaybeIntegerInheritedC(const Identifier *ident, unsigned index,
574 				Setter setter, long n)
575 : GenericIntegerInheritedC(ident, index, setter, n)
576 {
577 }
578 
579 ELObj *GenericMaybeIntegerInheritedC::value(VM &vm, const VarStyleObj *style,
580 					    Vector<size_t> &dep) const
581 {
582   if (!n_)
583     return vm.interp->makeFalse();
584   else
585     return IntegerInheritedC::value(vm, style, dep);
586 }
587 
588 ConstPtr<InheritedC>
589 GenericMaybeIntegerInheritedC::make(ELObj *obj, const Location &loc,
590 				    Interpreter &interp) const
591 {
592   long n;
593   if (interp.convertOptPositiveIntegerC(obj, identifier(), loc, n))
594     return new GenericMaybeIntegerInheritedC(identifier(), index(),
595 					     setter_, n);
596   return ConstPtr<InheritedC>();
597 }
598 
599 class GenericSymbolInheritedC : public SymbolInheritedC {
600 public:
601   typedef void (FOTBuilder::*Setter)(FOTBuilder::Symbol);
602   GenericSymbolInheritedC(const Identifier *, unsigned index, Setter,
603 		          FOTBuilder::Symbol = FOTBuilder::symbolFalse);
604   void set(VM &, const VarStyleObj *, FOTBuilder &,
605            ELObj *&value, Vector<size_t> &dependencies) const;
606   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
607 private:
608   Setter setter_;
609 };
610 
611 GenericSymbolInheritedC
612 ::GenericSymbolInheritedC(const Identifier *ident, unsigned index,
613 			  Setter setter, FOTBuilder::Symbol sym)
614 : SymbolInheritedC(ident, index, sym), setter_(setter)
615 {
616 }
617 
618 void GenericSymbolInheritedC::set(VM &, const VarStyleObj *,
619 				  FOTBuilder &fotb,
620 				  ELObj *&,
621 				  Vector<size_t> &) const
622 {
623   (fotb.*setter_)(sym_);
624 }
625 
626 ConstPtr<InheritedC>
627 GenericSymbolInheritedC::make(ELObj *obj, const Location &loc,
628 			      Interpreter &interp) const
629 {
630   FOTBuilder::Symbol sym;
631   if (interp.convertEnumC(obj, identifier(), loc, sym))
632     return new GenericSymbolInheritedC(identifier(), index(), setter_, sym);
633   return ConstPtr<InheritedC>();
634 }
635 
636 class GenericPublicIdInheritedC : public PublicIdInheritedC {
637 public:
638   typedef void (FOTBuilder::*Setter)(FOTBuilder::PublicId);
639   GenericPublicIdInheritedC(const Identifier *, unsigned index, Setter,
640 			    FOTBuilder::PublicId = 0);
641   void set(VM &, const VarStyleObj *, FOTBuilder &,
642            ELObj *&value, Vector<size_t> &dependencies) const;
643   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
644 private:
645   Setter setter_;
646 };
647 
648 GenericPublicIdInheritedC
649 ::GenericPublicIdInheritedC(const Identifier *ident, unsigned index,
650 			  Setter setter, FOTBuilder::PublicId pubid)
651 : PublicIdInheritedC(ident, index, pubid), setter_(setter)
652 {
653 }
654 
655 void GenericPublicIdInheritedC::set(VM &, const VarStyleObj *,
656 				    FOTBuilder &fotb,
657 				    ELObj *&,
658 				    Vector<size_t> &) const
659 {
660   (fotb.*setter_)(pubid_);
661 }
662 
663 ConstPtr<InheritedC>
664 GenericPublicIdInheritedC::make(ELObj *obj, const Location &loc,
665 				Interpreter &interp) const
666 {
667   FOTBuilder::PublicId pubid;
668   if (interp.convertPublicIdC(obj, identifier(), loc, pubid))
669     return new GenericPublicIdInheritedC(identifier(), index(), setter_,
670 					 pubid);
671   return ConstPtr<InheritedC>();
672 }
673 
674 class GenericLetter2InheritedC : public Letter2InheritedC {
675 public:
676   typedef void (FOTBuilder::*Setter)(FOTBuilder::Letter2);
677   GenericLetter2InheritedC(const Identifier *, unsigned index, Setter,
678 			    FOTBuilder::Letter2 = 0);
679   void set(VM &, const VarStyleObj *, FOTBuilder &,
680            ELObj *&value, Vector<size_t> &dependencies) const;
681   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
682 private:
683   Setter setter_;
684 };
685 
686 GenericLetter2InheritedC
687 ::GenericLetter2InheritedC(const Identifier *ident, unsigned index,
688 			   Setter setter, FOTBuilder::Letter2 code)
689 : Letter2InheritedC(ident, index, code), setter_(setter)
690 {
691 }
692 
693 void GenericLetter2InheritedC::set(VM &, const VarStyleObj *,
694 				   FOTBuilder &fotb,
695 				   ELObj *&,
696 				   Vector<size_t> &) const
697 {
698   (fotb.*setter_)(code_);
699 }
700 
701 ConstPtr<InheritedC>
702 GenericLetter2InheritedC::make(ELObj *obj, const Location &loc,
703 				Interpreter &interp) const
704 {
705   FOTBuilder::Letter2 code;
706   if (interp.convertLetter2C(obj, identifier(), loc, code))
707     return new GenericLetter2InheritedC(identifier(), index(), setter_, code);
708   return ConstPtr<InheritedC>();
709 }
710 
711 class GenericLengthSpecInheritedC : public LengthSpecInheritedC {
712 public:
713   typedef void (FOTBuilder::*Setter)(const FOTBuilder::LengthSpec &);
714   GenericLengthSpecInheritedC(const Identifier *, unsigned index, Setter,
715 			      long = 0);
716   void set(VM &, const VarStyleObj *, FOTBuilder &,
717            ELObj *&value, Vector<size_t> &dependencies) const;
718   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
719 private:
720   Setter setter_;
721 };
722 
723 GenericLengthSpecInheritedC
724 ::GenericLengthSpecInheritedC(const Identifier *ident, unsigned index,
725 			      Setter setter, long n)
726 : LengthSpecInheritedC(ident, index, n), setter_(setter)
727 {
728 }
729 
730 void GenericLengthSpecInheritedC::set(VM &, const VarStyleObj *,
731 				      FOTBuilder &fotb,
732 				      ELObj *&,
733 				      Vector<size_t> &) const
734 {
735   (fotb.*setter_)(value_);
736 }
737 
738 ConstPtr<InheritedC>
739 GenericLengthSpecInheritedC::make(ELObj *obj, const Location &loc,
740 				  Interpreter &interp) const
741 {
742   GenericLengthSpecInheritedC *copy
743     = new GenericLengthSpecInheritedC(identifier(), index(), setter_);
744   if (!copy->setValue(obj, loc, interp)) {
745     delete copy;
746     copy = 0;
747   }
748   return copy;
749 }
750 
751 class GenericOptInlineSpaceInheritedC : public InheritedC {
752 public:
753   typedef void (FOTBuilder::*Setter)(const FOTBuilder::OptInlineSpace &);
754   GenericOptInlineSpaceInheritedC(const Identifier *, unsigned index, Setter);
755   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
756   void set(VM &, const VarStyleObj *, FOTBuilder &,
757            ELObj *&value, Vector<size_t> &dependencies) const;
758   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
759 private:
760   FOTBuilder::OptInlineSpace value_;
761   Setter setter_;
762 };
763 
764 GenericOptInlineSpaceInheritedC
765 ::GenericOptInlineSpaceInheritedC(const Identifier *ident, unsigned index,
766                                   Setter setter)
767 : InheritedC(ident, index), setter_(setter)
768 {
769 }
770 
771 ELObj *GenericOptInlineSpaceInheritedC::value(VM &vm, const VarStyleObj *,
772                                               Vector<size_t> &) const
773 {
774   if (!value_.hasSpace)
775     return vm.interp->makeFalse();
776   else
777     return new (*vm.interp) InlineSpaceObj(value_.space);
778 }
779 
780 
781 void GenericOptInlineSpaceInheritedC::set(VM &, const VarStyleObj *,
782                                           FOTBuilder &fotb,
783                                           ELObj *&,
784                                           Vector<size_t> &) const
785 {
786   (fotb.*setter_)(value_);
787 }
788 
789 ConstPtr<InheritedC>
790 GenericOptInlineSpaceInheritedC::make(ELObj *obj, const Location &loc,
791                                       Interpreter &interp) const
792 {
793   GenericOptInlineSpaceInheritedC *copy
794     = new GenericOptInlineSpaceInheritedC(identifier(), index(), setter_);
795   InlineSpaceObj *iso = obj->asInlineSpace();
796   if (iso) {
797     copy->value_.space = iso->inlineSpace();
798     copy->value_.hasSpace = 1;
799   }
800   else {
801     FOTBuilder::OptLengthSpec res;
802     if (interp.convertOptLengthSpecC(obj, identifier(), loc, res))  {
803       if (res.hasLength) {
804         copy->value_.space.nominal = res.length;
805         copy->value_.space.min     = res.length;
806         copy->value_.space.max     = res.length;
807         copy->value_.hasSpace = 1;
808       } else
809         copy->value_.hasSpace = 0;
810     } else {
811       delete copy;
812       copy = 0;
813     }
814   }
815   return copy;
816 }
817 
818 
819 class GenericOptLengthSpecInheritedC : public OptLengthSpecInheritedC {
820 public:
821   typedef void (FOTBuilder::*Setter)(const FOTBuilder::OptLengthSpec &);
822   GenericOptLengthSpecInheritedC(const Identifier *, unsigned index, Setter);
823   void set(VM &, const VarStyleObj *, FOTBuilder &,
824            ELObj *&value, Vector<size_t> &dependencies) const;
825   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
826 private:
827   Setter setter_;
828 };
829 
830 GenericOptLengthSpecInheritedC
831 ::GenericOptLengthSpecInheritedC(const Identifier *ident, unsigned index,
832 				 Setter setter)
833 : OptLengthSpecInheritedC(ident, index), setter_(setter)
834 {
835 }
836 
837 void GenericOptLengthSpecInheritedC::set(VM &, const VarStyleObj *,
838 				      FOTBuilder &fotb,
839 				      ELObj *&,
840 				      Vector<size_t> &) const
841 {
842   (fotb.*setter_)(value_);
843 }
844 
845 ConstPtr<InheritedC>
846 GenericOptLengthSpecInheritedC::make(ELObj *obj, const Location &loc,
847 				     Interpreter &interp) const
848 {
849   GenericOptLengthSpecInheritedC *copy
850     = new GenericOptLengthSpecInheritedC(identifier(), index(), setter_);
851   if (!copy->setValue(obj, loc, interp)) {
852     delete copy;
853     copy = 0;
854   }
855   return copy;
856 }
857 
858 class FontSizeC : public LengthInheritedC {
859 public:
860   FontSizeC(const Identifier *, unsigned index, long);
861   void set(VM &, const VarStyleObj *, FOTBuilder &,
862            ELObj *&value, Vector<size_t> &dependencies) const;
863   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
864 };
865 
866 FontSizeC::FontSizeC(const Identifier *ident, unsigned index, long size)
867 : LengthInheritedC(ident, index, size)
868 {
869 }
870 
871 void FontSizeC::set(VM &vm, const VarStyleObj *, FOTBuilder &fotb, ELObj *&,
872 		    Vector<size_t> &) const
873 {
874   fotb.setFontSize(size_);
875 }
876 
877 ConstPtr<InheritedC> FontSizeC::make(ELObj *obj, const Location &loc,
878 				     Interpreter &interp) const
879 {
880   long n;
881   if (interp.convertLengthC(obj, identifier(), loc, n))
882     return new FontSizeC(identifier(), index(), n);
883   return ConstPtr<InheritedC>();
884 }
885 
886 class FontFamilyNameC : public StringInheritedC {
887 public:
888   FontFamilyNameC(const Identifier *, unsigned index, const Char *, size_t);
889   FontFamilyNameC(const Identifier *, unsigned index, const StringC &);
890   void set(VM &, const VarStyleObj *, FOTBuilder &,
891            ELObj *&value, Vector<size_t> &dependencies) const;
892   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
893 };
894 
895 FontFamilyNameC::FontFamilyNameC(const Identifier *ident, unsigned index, const Char *s, size_t n)
896 : StringInheritedC(ident, index, s, n)
897 {
898 }
899 
900 FontFamilyNameC::FontFamilyNameC(const Identifier *ident, unsigned index, const StringC &s)
901 : StringInheritedC(ident, index, s)
902 {
903 }
904 
905 void FontFamilyNameC::set(VM &vm, const VarStyleObj *, FOTBuilder &fotb, ELObj *&,
906 		      Vector<size_t> &) const
907 {
908   fotb.setFontFamilyName(str_);
909 }
910 
911 ConstPtr<InheritedC> FontFamilyNameC::make(ELObj *obj, const Location &loc,
912 				       Interpreter &interp) const
913 {
914   const Char *s;
915   size_t n;
916   if (obj->stringData(s, n))
917     return new FontFamilyNameC(identifier(), index(), s, n);
918   invalidValue(loc, interp);
919   return ConstPtr<InheritedC>();
920 }
921 
922 class ColorC : public InheritedC, private Collector::DynamicRoot {
923 public:
924   ColorC(const Identifier *, unsigned index, ColorObj *, Interpreter &);
925   void set(VM &, const VarStyleObj *, FOTBuilder &,
926            ELObj *&value, Vector<size_t> &dependencies) const;
927   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
928   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
929   void trace(Collector &) const;
930 private:
931   ColorObj *color_;
932 };
933 
934 ColorC::ColorC(const Identifier *ident, unsigned index, ColorObj *color,
935 	       Interpreter &interp)
936 : InheritedC(ident, index), Collector::DynamicRoot(interp), color_(color)
937 {
938 }
939 
940 void ColorC::set(VM &, const VarStyleObj *, FOTBuilder &fotb,
941 		 ELObj *&, Vector<size_t> &) const
942 {
943   color_->set(fotb);
944 }
945 
946 ConstPtr<InheritedC> ColorC::make(ELObj *obj, const Location &loc,
947 				  Interpreter &interp) const
948 {
949   ColorObj *color;
950   if (interp.convertColorC(obj, identifier(), loc, color))
951     return new ColorC(identifier(), index(), color, interp);
952   return ConstPtr<InheritedC>();
953 }
954 
955 ELObj *ColorC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
956 {
957   if (!color_)
958     return vm.interp->makeFalse();
959   else
960     return color_;
961 }
962 
963 void ColorC::trace(Collector &c) const
964 {
965   c.trace(color_);
966 }
967 
968 class BackgroundColorC : public InheritedC, private Collector::DynamicRoot {
969 public:
970   BackgroundColorC(const Identifier *, unsigned index, ColorObj *,
971 		   Interpreter &);
972   void set(VM &, const VarStyleObj *, FOTBuilder &,
973            ELObj *&value, Vector<size_t> &dependencies) const;
974   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
975   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
976   void trace(Collector &) const;
977 private:
978   ColorObj *color_;
979 };
980 
981 BackgroundColorC::BackgroundColorC(const Identifier *ident, unsigned index,
982 				   ColorObj *color, Interpreter &interp)
983 : InheritedC(ident, index), Collector::DynamicRoot(interp), color_(color)
984 {
985 }
986 
987 void BackgroundColorC::set(VM &, const VarStyleObj *, FOTBuilder &fotb,
988 			   ELObj *&, Vector<size_t> &) const
989 {
990   if (color_)
991     color_->setBackground(fotb);
992   else
993     fotb.setBackgroundColor();
994 }
995 
996 ConstPtr<InheritedC> BackgroundColorC::make(ELObj *obj, const Location &loc,
997 					    Interpreter &interp) const
998 {
999   ColorObj *color;
1000   if (interp.convertOptColorC(obj, identifier(), loc, color))
1001     return new BackgroundColorC(identifier(), index(), color, interp);
1002   return ConstPtr<InheritedC>();
1003 }
1004 
1005 ELObj *
1006 BackgroundColorC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
1007 {
1008   if (color_)
1009     return color_;
1010   else
1011     return vm.interp->makeFalse();
1012 }
1013 
1014 void BackgroundColorC::trace(Collector &c) const
1015 {
1016   c.trace(color_);
1017 }
1018 
1019 class GlyphSubstTableC : public InheritedC {
1020 public:
1021   GlyphSubstTableC(const Identifier *, unsigned index, bool isList);
1022   void set(VM &, const VarStyleObj *, FOTBuilder &,
1023            ELObj *&value, Vector<size_t> &dependencies) const;
1024   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
1025   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
1026   void append(const ConstPtr<FOTBuilder::GlyphSubstTable> &table) { tables_.push_back(table); }
1027 private:
1028   // Distinguish between #f and () for inherited-glyph-subst-table
1029   bool isList_;
1030   Vector<ConstPtr<FOTBuilder::GlyphSubstTable> > tables_;
1031 };
1032 
1033 GlyphSubstTableC::GlyphSubstTableC(const Identifier *ident, unsigned index, bool isList)
1034 : InheritedC(ident, index), isList_(isList)
1035 {
1036 }
1037 
1038 void GlyphSubstTableC::set(VM &, const VarStyleObj *, FOTBuilder &fotb,
1039 			   ELObj *&, Vector<size_t> &) const
1040 {
1041   fotb.setGlyphSubstTable(tables_);
1042 }
1043 
1044 ConstPtr<InheritedC> GlyphSubstTableC::make(ELObj *obj, const Location &loc,
1045 					    Interpreter &interp) const
1046 {
1047   if (obj == interp.makeFalse())
1048     return new GlyphSubstTableC(identifier(), index(), 0);
1049   GlyphSubstTableObj *table = obj->asGlyphSubstTable();
1050   if (table) {
1051     Ptr<InheritedC> tem = new GlyphSubstTableC(identifier(), index(), 0);
1052     ((GlyphSubstTableC *)tem.pointer())->append(table->glyphSubstTable());
1053     return tem;
1054   }
1055   Ptr<InheritedC> tem = new GlyphSubstTableC(identifier(), index(), 1);
1056   for (;;) {
1057     if (obj->isNil())
1058       return tem;
1059     PairObj *pair = obj->asPair();
1060     if (!pair)
1061       break;
1062     obj = pair->cdr();
1063     table = pair->car()->asGlyphSubstTable();
1064     if (!table)
1065       break;
1066     ((GlyphSubstTableC *)tem.pointer())->append(table->glyphSubstTable());
1067   }
1068   invalidValue(loc, interp);
1069   return ConstPtr<InheritedC>();
1070 }
1071 
1072 ELObj *GlyphSubstTableC::value(VM &vm, const VarStyleObj *, Vector<size_t> &) const
1073 {
1074   if (!isList_) {
1075     if (tables_.size())
1076       return new (*vm.interp) GlyphSubstTableObj(tables_[0]);
1077     else
1078       return vm.interp->makeFalse();
1079   }
1080   else {
1081     ELObj *list = vm.interp->makeNil();
1082     ELObjDynamicRoot protect(*vm.interp, list);
1083     for (size_t i = tables_.size(); i > 0; i--) {
1084       ELObj *tableObj = new (*vm.interp) GlyphSubstTableObj(tables_[i - 1]);
1085       ELObjDynamicRoot protect2(*vm.interp, tableObj);
1086       list = vm.interp->makePair(tableObj, list);
1087       protect = list;
1088     }
1089     return list;
1090   }
1091 }
1092 
1093 class IgnoredC : public InheritedC, private Collector::DynamicRoot {
1094 public:
1095   IgnoredC(const Identifier *, unsigned index, ELObj *, Interpreter &);
1096   void set(VM &, const VarStyleObj *, FOTBuilder &,
1097            ELObj *&, Vector<size_t> &) const;
1098   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
1099   ELObj *value(VM &, const VarStyleObj *, Vector<size_t> &) const;
1100   void trace(Collector &) const;
1101 private:
1102   ELObj *value_;
1103 };
1104 
1105 
1106 IgnoredC::IgnoredC(const Identifier *ident, unsigned index, ELObj *value, Interpreter &interp)
1107 : InheritedC(ident, index), Collector::DynamicRoot(interp), value_(value)
1108 {
1109 }
1110 
1111 void IgnoredC::set(VM &, const VarStyleObj *, FOTBuilder &fotb,
1112 		   ELObj *&, Vector<size_t> &) const
1113 {
1114 }
1115 
1116 ConstPtr<InheritedC> IgnoredC::make(ELObj *obj, const Location &, Interpreter &interp) const
1117 {
1118   return new IgnoredC(identifier(), index(), obj, interp);
1119 }
1120 
1121 ELObj *IgnoredC::value(VM &, const VarStyleObj *, Vector<size_t> &) const
1122 {
1123   return value_;
1124 }
1125 
1126 void IgnoredC::trace(Collector &c) const
1127 {
1128   c.trace(value_);
1129 }
1130 
1131 class BorderC : public IgnoredC {
1132 public:
1133   BorderC(const Identifier *, unsigned index, ELObj *, Interpreter &);
1134   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
1135 };
1136 
1137 BorderC::BorderC(const Identifier *ident, unsigned index, ELObj *value, Interpreter &interp)
1138 : IgnoredC(ident, index, value, interp)
1139 {
1140 }
1141 
1142 ConstPtr<InheritedC> BorderC::make(ELObj *obj, const Location &loc, Interpreter &interp) const
1143 {
1144   StyleObj *tem;
1145   SosofoObj *sosofo = obj->asSosofo();
1146   if (sosofo && sosofo->tableBorderStyle(tem))
1147     return new BorderC(identifier(), index(), obj, interp);
1148   bool b;
1149   if (interp.convertBooleanC(obj, identifier(), loc, b)) {
1150     if (b)
1151       obj = interp.makeTrue();
1152     else
1153       obj = interp.makeFalse();
1154     return new BorderC(identifier(), index(), obj, interp);
1155   }
1156   return ConstPtr<InheritedC>();
1157 }
1158 
1159 class RuleC : public IgnoredC {
1160 public:
1161   RuleC(const Identifier *, unsigned index, ELObj *, Interpreter &);
1162   ConstPtr<InheritedC> make(ELObj *, const Location &, Interpreter &) const;
1163 };
1164 
1165 RuleC::RuleC(const Identifier *ident, unsigned index, ELObj *value, Interpreter &interp)
1166 : IgnoredC(ident, index, value, interp)
1167 {
1168 }
1169 
1170 ConstPtr<InheritedC> RuleC::make(ELObj *obj, const Location &loc, Interpreter &interp) const
1171 {
1172   SosofoObj *sosofo = obj->asSosofo();
1173   if (sosofo && sosofo->isRule())
1174     return new RuleC(identifier(), index(), obj, interp);
1175   invalidValue(loc, interp);
1176   return ConstPtr<InheritedC>();
1177 }
1178 
1179 class InheritedCPrimitiveObj : public PrimitiveObj {
1180 public:
1181   void *operator new(size_t, Collector &c) {
1182     return c.allocateObject(1);
1183   }
1184   static const Signature signature_;
1185   InheritedCPrimitiveObj(const ConstPtr<InheritedC> &ic)
1186     : PrimitiveObj(&signature_), inheritedC_(ic) { }
1187   ELObj *primitiveCall(int, ELObj **, EvalContext &, Interpreter &, const Location &);
1188 private:
1189   ConstPtr<InheritedC> inheritedC_;
1190 };
1191 
1192 const Signature InheritedCPrimitiveObj::signature_ = { 0, 0, 0 };
1193 
1194 ELObj *InheritedCPrimitiveObj::primitiveCall(int, ELObj **, EvalContext &ec,
1195 					     Interpreter &interp,
1196 					     const Location &loc)
1197 {
1198   if (!ec.styleStack) {
1199     interp.setNextLocation(loc);
1200     interp.message(InterpreterMessages::notInCharacteristicValue);
1201     return interp.makeError();
1202   }
1203   ELObj *obj = ec.styleStack->inherited(inheritedC_, ec.specLevel, interp,
1204 				        *ec.actualDependencies);
1205   interp.makeReadOnly(obj);
1206   return obj;
1207 }
1208 
1209 class ActualCPrimitiveObj : public PrimitiveObj {
1210 public:
1211   void *operator new(size_t, Collector &c) {
1212     return c.allocateObject(1);
1213   }
1214   static const Signature signature_;
1215   ActualCPrimitiveObj(const ConstPtr<InheritedC> &ic)
1216     : PrimitiveObj(&signature_), inheritedC_(ic) { }
1217   ELObj *primitiveCall(int, ELObj **, EvalContext &, Interpreter &, const Location &);
1218 private:
1219   ConstPtr<InheritedC> inheritedC_;
1220 };
1221 
1222 const Signature ActualCPrimitiveObj::signature_ = { 0, 0, 0 };
1223 
1224 ELObj *ActualCPrimitiveObj::primitiveCall(int, ELObj **, EvalContext &ec, Interpreter &interp,
1225 					  const Location &loc)
1226 {
1227   if (!ec.styleStack) {
1228     interp.setNextLocation(loc);
1229     interp.message(InterpreterMessages::notInCharacteristicValue);
1230     return interp.makeError();
1231   }
1232   ELObj *obj = ec.styleStack->actual(inheritedC_, loc, interp, *ec.actualDependencies);
1233   const Char *s;
1234   size_t n;
1235   interp.makeReadOnly(obj);
1236   return obj;
1237 }
1238 
1239 #define INHERITED_C(name, C, init) \
1240     installInheritedC(name, new C(0, nInheritedC_++, init))
1241 #define INHERITED_C2(name, C, init1, init2) \
1242     installInheritedC(name, new C(0, nInheritedC_++, init1, init2))
1243 #define STORE_INHERITED_C2(var, name, C, init1, init2) \
1244    { InheritedC *ic = new C(0, nInheritedC_++, init1, init2); \
1245      installInheritedC(name, ic); \
1246      var = ic; }
1247 
1248 #define IGNORED_C(name, init) INHERITED_C2(name, IgnoredC, init, *this)
1249 
1250 static StyleObj *makeBorderStyle(bool b, unsigned index, Interpreter &interp)
1251 {
1252   Vector<ConstPtr<InheritedC> > forceSpecs;
1253   Vector<ConstPtr<InheritedC> > specs;
1254   specs.push_back(
1255     new GenericBoolInheritedC(interp.lookup(interp.makeStringC("border-present?")),
1256 			      index, &FOTBuilder::setBorderPresent, b));
1257 
1258   StyleObj *style
1259     = new (interp) VarStyleObj(new StyleSpec(forceSpecs, specs), 0, 0, NodePtr());
1260   interp.makePermanent(style);
1261   return style;
1262 }
1263 
1264 void Interpreter::installInheritedCs()
1265 {
1266   INHERITED_C("font-size", FontSizeC, (unitsPerInch()*10)/72);
1267   INHERITED_C("font-family-name", FontFamilyNameC, makeStringC("iso-serif"));
1268   INHERITED_C2("font-weight", GenericSymbolInheritedC, &FOTBuilder::setFontWeight,
1269                FOTBuilder::symbolMedium);
1270   INHERITED_C2("font-posture", GenericSymbolInheritedC, &FOTBuilder::setFontPosture,
1271                FOTBuilder::symbolUpright);
1272   INHERITED_C2("quadding", GenericSymbolInheritedC, &FOTBuilder::setQuadding,
1273                FOTBuilder::symbolStart);
1274   INHERITED_C2("display-alignment", GenericSymbolInheritedC, &FOTBuilder::setDisplayAlignment,
1275                FOTBuilder::symbolStart);
1276   INHERITED_C2("field-align", GenericSymbolInheritedC, &FOTBuilder::setFieldAlign,
1277                FOTBuilder::symbolStart);
1278   INHERITED_C2("lines", GenericSymbolInheritedC, &FOTBuilder::setLines, FOTBuilder::symbolWrap);
1279   INHERITED_C("start-indent", GenericLengthSpecInheritedC,
1280 	      &FOTBuilder::setStartIndent);
1281   INHERITED_C("first-line-start-indent", GenericLengthSpecInheritedC,
1282 	      &FOTBuilder::setFirstLineStartIndent);
1283   INHERITED_C("end-indent", GenericLengthSpecInheritedC,
1284 	      &FOTBuilder::setEndIndent);
1285   INHERITED_C("last-line-end-indent", GenericLengthSpecInheritedC,
1286 	      &FOTBuilder::setLastLineEndIndent);
1287   INHERITED_C2("line-spacing", GenericLengthSpecInheritedC,
1288 	       &FOTBuilder::setLineSpacing, unitsPerInch()*12/72);
1289   INHERITED_C("field-width", GenericLengthSpecInheritedC,
1290 	      &FOTBuilder::setFieldWidth);
1291   INHERITED_C("left-margin", GenericLengthInheritedC,
1292 	      &FOTBuilder::setLeftMargin);
1293   INHERITED_C("right-margin", GenericLengthInheritedC,
1294 	      &FOTBuilder::setRightMargin);
1295   INHERITED_C("top-margin", GenericLengthInheritedC,
1296 	      &FOTBuilder::setTopMargin);
1297   INHERITED_C("bottom-margin", GenericLengthInheritedC,
1298 	      &FOTBuilder::setBottomMargin);
1299   INHERITED_C("header-margin", GenericLengthInheritedC,
1300 	      &FOTBuilder::setHeaderMargin);
1301   INHERITED_C("footer-margin", GenericLengthInheritedC,
1302 	      &FOTBuilder::setFooterMargin);
1303   INHERITED_C2("page-width", GenericLengthInheritedC,
1304 	       &FOTBuilder::setPageWidth,
1305 	       unitsPerInch()*8 + unitsPerInch()/2);
1306   INHERITED_C2("page-height", GenericLengthInheritedC,
1307 	       &FOTBuilder::setPageHeight,
1308 	       unitsPerInch()*11);
1309   INHERITED_C2("color", ColorC, new (*this) DeviceRGBColorObj(0, 0, 0), *this);
1310   INHERITED_C2("background-color", BackgroundColorC, 0, *this);
1311   INHERITED_C2("border-present?", GenericBoolInheritedC,
1312 	       &FOTBuilder::setBorderPresent, 1);
1313   borderTrueStyle_ = makeBorderStyle(1, nInheritedC_ - 1, *this);
1314   borderFalseStyle_ = makeBorderStyle(0, nInheritedC_ - 1, *this);
1315   STORE_INHERITED_C2(tableBorderC_, "table-border", BorderC, makeFalse(), *this);
1316   STORE_INHERITED_C2(cellBeforeRowBorderC_, "cell-before-row-border",
1317 		     BorderC, makeFalse(), *this);
1318   STORE_INHERITED_C2(cellAfterRowBorderC_, "cell-after-row-border",
1319 		     BorderC, makeFalse(), *this);
1320   STORE_INHERITED_C2(cellBeforeColumnBorderC_, "cell-before-column-border",
1321 		     BorderC, makeFalse(), *this);
1322   STORE_INHERITED_C2(cellAfterColumnBorderC_, "cell-after-column-border",
1323 		     BorderC, makeFalse(), *this);
1324   STORE_INHERITED_C2(fractionBarC_, "fraction-bar",
1325 		     RuleC, lookup(makeStringC("rule"))->flowObj(), *this);
1326   INHERITED_C2("line-thickness", GenericLengthInheritedC, &FOTBuilder::setLineThickness,
1327                unitsPerInch()/72);
1328   INHERITED_C2("cell-before-row-margin", GenericLengthInheritedC,
1329                &FOTBuilder::setCellBeforeRowMargin, 0);
1330   INHERITED_C2("cell-after-row-margin", GenericLengthInheritedC,
1331                &FOTBuilder::setCellAfterRowMargin, 0);
1332   INHERITED_C2("cell-before-column-margin", GenericLengthInheritedC,
1333 	       &FOTBuilder::setCellBeforeColumnMargin, 0);
1334   INHERITED_C2("cell-after-column-margin", GenericLengthInheritedC,
1335 	       &FOTBuilder::setCellAfterColumnMargin, 0);
1336   INHERITED_C2("line-sep", GenericLengthInheritedC,
1337 	       &FOTBuilder::setLineSep, unitsPerInch()/72);
1338   INHERITED_C2("box-size-before", GenericLengthInheritedC, &FOTBuilder::setBoxSizeBefore,
1339                8*unitsPerInch()/72);
1340   INHERITED_C2("box-size-after", GenericLengthInheritedC, &FOTBuilder::setBoxSizeAfter,
1341                4*unitsPerInch()/72);
1342   INHERITED_C2("position-point-shift", GenericLengthSpecInheritedC,
1343                &FOTBuilder::setPositionPointShift, 0);
1344   INHERITED_C2("start-margin", GenericLengthSpecInheritedC, &FOTBuilder::setStartMargin, 0);
1345   INHERITED_C2("end-margin", GenericLengthSpecInheritedC, &FOTBuilder::setEndMargin, 0);
1346   INHERITED_C2("sideline-sep", GenericLengthSpecInheritedC, &FOTBuilder::setSidelineSep,
1347                4*unitsPerInch()/72);
1348   INHERITED_C2("asis-wrap-indent", GenericLengthSpecInheritedC, &FOTBuilder::setAsisWrapIndent, 0);
1349   INHERITED_C2("line-number-sep", GenericLengthSpecInheritedC, &FOTBuilder::setLineNumberSep, 0);
1350   INHERITED_C2("last-line-justify-limit", GenericLengthSpecInheritedC,
1351                &FOTBuilder::setLastLineJustifyLimit, 0);
1352   INHERITED_C2("justify-glyph-space-max-add", GenericLengthSpecInheritedC,
1353                &FOTBuilder::setJustifyGlyphSpaceMaxAdd, 0);
1354   INHERITED_C2("justify-glyph-space-max-remove", GenericLengthSpecInheritedC,
1355                &FOTBuilder::setJustifyGlyphSpaceMaxRemove, 0);
1356   INHERITED_C2("table-corner-radius", GenericLengthSpecInheritedC,
1357                &FOTBuilder::setTableCornerRadius, 3*unitsPerInch()/72);
1358   INHERITED_C2("box-corner-radius", GenericLengthSpecInheritedC,
1359                &FOTBuilder::setBoxCornerRadius, 3*unitsPerInch()/72);
1360   INHERITED_C2("marginalia-sep", GenericLengthSpecInheritedC,
1361                &FOTBuilder::setMarginaliaSep, 0);
1362   INHERITED_C2("inhibit-line-breaks?", GenericBoolInheritedC, &FOTBuilder::setInhibitLineBreaks, 0);
1363   INHERITED_C2("hyphenate?", GenericBoolInheritedC, &FOTBuilder::setHyphenate, 0);
1364   INHERITED_C2("kern?", GenericBoolInheritedC, &FOTBuilder::setKern, 0);
1365   INHERITED_C2("ligature?", GenericBoolInheritedC, &FOTBuilder::setLigature, 0);
1366   INHERITED_C2("score-spaces?", GenericBoolInheritedC, &FOTBuilder::setScoreSpaces, 0);
1367   INHERITED_C2("float-out-sidelines?", GenericBoolInheritedC, &FOTBuilder::setFloatOutSidelines, 0);
1368   INHERITED_C2("float-out-marginalia?", GenericBoolInheritedC, &FOTBuilder::setFloatOutMarginalia, 0);
1369   INHERITED_C2("float-out-line-numbers?", GenericBoolInheritedC, &FOTBuilder::setFloatOutLineNumbers, 0);
1370   INHERITED_C2("cell-background?", GenericBoolInheritedC, &FOTBuilder::setCellBackground, 0);
1371   INHERITED_C2("span-weak?", GenericBoolInheritedC, &FOTBuilder::setSpanWeak, 0);
1372   INHERITED_C2("ignore-record-end?", GenericBoolInheritedC, &FOTBuilder::setIgnoreRecordEnd, 0);
1373   INHERITED_C2("numbered-lines?", GenericBoolInheritedC, &FOTBuilder::setNumberedLines, 1);
1374   INHERITED_C2("hanging-punct?", GenericBoolInheritedC, &FOTBuilder::setHangingPunct, 0);
1375   INHERITED_C2("box-open-end?", GenericBoolInheritedC, &FOTBuilder::setBoxOpenEnd, 0);
1376   INHERITED_C2("truncate-leader?", GenericBoolInheritedC, &FOTBuilder::setTruncateLeader, 0);
1377   INHERITED_C2("align-leader?", GenericBoolInheritedC, &FOTBuilder::setAlignLeader, 1);
1378   INHERITED_C2("table-part-omit-middle-header?", GenericBoolInheritedC,
1379 	       &FOTBuilder::setTablePartOmitMiddleHeader, 0);
1380   INHERITED_C2("table-part-omit-middle-footer?", GenericBoolInheritedC,
1381 	       &FOTBuilder::setTablePartOmitMiddleFooter, 0);
1382   INHERITED_C2("border-omit-at-break?", GenericBoolInheritedC, &FOTBuilder::setBorderOmitAtBreak, 0);
1383   INHERITED_C2("principal-mode-simultaneous?", GenericBoolInheritedC,
1384 	       &FOTBuilder::setPrincipalModeSimultaneous, 0);
1385   INHERITED_C2("marginalia-keep-with-previous?", GenericBoolInheritedC,
1386 	       &FOTBuilder::setMarginaliaKeepWithPrevious, 0);
1387   INHERITED_C2("grid-equidistant-rows?", GenericBoolInheritedC, &FOTBuilder::setGridEquidistantRows, 0);
1388   INHERITED_C2("grid-equidistant-columns?", GenericBoolInheritedC, &FOTBuilder::setGridEquidistantColumns, 0);
1389   INHERITED_C2("line-join", GenericSymbolInheritedC, &FOTBuilder::setLineJoin,
1390 	       FOTBuilder::symbolMiter);
1391   INHERITED_C2("line-cap", GenericSymbolInheritedC, &FOTBuilder::setLineCap,
1392 	       FOTBuilder::symbolButt);
1393   INHERITED_C2("line-number-side", GenericSymbolInheritedC, &FOTBuilder::setLineNumberSide,
1394 	       FOTBuilder::symbolStart);
1395   INHERITED_C2("kern-mode", GenericSymbolInheritedC, &FOTBuilder::setKernMode,
1396 	       FOTBuilder::symbolNormal);
1397   INHERITED_C2("input-whitespace-treatment", GenericSymbolInheritedC,
1398 	       &FOTBuilder::setInputWhitespaceTreatment, FOTBuilder::symbolPreserve);
1399   INHERITED_C2("filling-direction", GenericSymbolInheritedC, &FOTBuilder::setFillingDirection,
1400 	       FOTBuilder::symbolTopToBottom );
1401   INHERITED_C2("writing-mode", GenericSymbolInheritedC, &FOTBuilder::setWritingMode,
1402 	       FOTBuilder::symbolLeftToRight );
1403   INHERITED_C2("last-line-quadding", GenericSymbolInheritedC, &FOTBuilder::setLastLineQuadding,
1404 	       FOTBuilder::symbolRelative);
1405   INHERITED_C2("math-display-mode", GenericSymbolInheritedC, &FOTBuilder::setMathDisplayMode,
1406 	       FOTBuilder::symbolDisplay);
1407   INHERITED_C2("script-pre-align", GenericSymbolInheritedC, &FOTBuilder::setScriptPreAlign,
1408                FOTBuilder::symbolIndependent);
1409   INHERITED_C2("script-post-align", GenericSymbolInheritedC, &FOTBuilder::setScriptPostAlign,
1410                FOTBuilder::symbolIndependent);
1411   INHERITED_C2("script-mid-sup-align", GenericSymbolInheritedC, &FOTBuilder::setScriptMidSupAlign,
1412                FOTBuilder::symbolCenter);
1413   INHERITED_C2("script-mid-sub-align", GenericSymbolInheritedC, &FOTBuilder::setScriptMidSubAlign,
1414                FOTBuilder::symbolCenter);
1415   INHERITED_C2("numerator-align", GenericSymbolInheritedC, &FOTBuilder::setNumeratorAlign,
1416                FOTBuilder::symbolCenter);
1417   INHERITED_C2("denominator-align", GenericSymbolInheritedC, &FOTBuilder::setDenominatorAlign,
1418                FOTBuilder::symbolCenter);
1419   INHERITED_C2("grid-position-cell-type", GenericSymbolInheritedC, &FOTBuilder::setGridPositionCellType,
1420                FOTBuilder::symbolRowMajor);
1421   INHERITED_C2("grid-column-alignment", GenericSymbolInheritedC, &FOTBuilder::setGridColumnAlignment,
1422                FOTBuilder::symbolCenter);
1423   INHERITED_C2("grid-row-alignment", GenericSymbolInheritedC, &FOTBuilder::setGridRowAlignment,
1424                FOTBuilder::symbolCenter);
1425   INHERITED_C2("box-type", GenericSymbolInheritedC, &FOTBuilder::setBoxType,
1426 	       FOTBuilder::symbolBorder);
1427   INHERITED_C2("glyph-alignment-mode", GenericSymbolInheritedC, &FOTBuilder::setGlyphAlignmentMode,
1428 	       FOTBuilder::symbolFont);
1429   INHERITED_C2("box-border-alignment", GenericSymbolInheritedC, &FOTBuilder::setBoxBorderAlignment,
1430 	       FOTBuilder::symbolOutside);
1431   INHERITED_C2("cell-row-alignment", GenericSymbolInheritedC, &FOTBuilder::setCellRowAlignment,
1432 	       FOTBuilder::symbolStart);
1433   INHERITED_C2("border-alignment", GenericSymbolInheritedC, &FOTBuilder::setBorderAlignment,
1434 	       FOTBuilder::symbolCenter);
1435   INHERITED_C2("sideline-side", GenericSymbolInheritedC, &FOTBuilder::setSidelineSide,
1436 	       FOTBuilder::symbolStart);
1437   INHERITED_C2("hyphenation-keep", GenericSymbolInheritedC, &FOTBuilder::setHyphenationKeep,
1438 	       FOTBuilder::symbolFalse);
1439   INHERITED_C2("font-structure", GenericSymbolInheritedC, &FOTBuilder::setFontStructure,
1440 	       FOTBuilder::symbolSolid);
1441   INHERITED_C2("font-proportionate-width", GenericSymbolInheritedC,
1442 	       &FOTBuilder::setFontProportionateWidth, FOTBuilder::symbolMedium);
1443   INHERITED_C2("cell-crossed", GenericSymbolInheritedC, &FOTBuilder::setCellCrossed,
1444 	       FOTBuilder::symbolFalse);
1445   INHERITED_C2("marginalia-side", GenericSymbolInheritedC, &FOTBuilder::setMarginaliaSide,
1446 	       FOTBuilder::symbolStart);
1447   INHERITED_C2("layer", GenericIntegerInheritedC, &FOTBuilder::setLayer, 0);
1448   INHERITED_C2("background-layer", GenericIntegerInheritedC, &FOTBuilder::setBackgroundLayer, -1);
1449   INHERITED_C2("border-priority", GenericIntegerInheritedC, &FOTBuilder::setBorderPriority, 0);
1450   INHERITED_C2("line-repeat", GenericIntegerInheritedC, &FOTBuilder::setLineRepeat, 1);
1451   INHERITED_C2("span", GenericIntegerInheritedC, &FOTBuilder::setSpan, 1);
1452   INHERITED_C2("min-leader-repeat", GenericIntegerInheritedC, &FOTBuilder::setMinLeaderRepeat, 1);
1453   INHERITED_C2("hyphenation-remain-char-count", GenericIntegerInheritedC,
1454 	       &FOTBuilder::setHyphenationRemainCharCount, 2);
1455   INHERITED_C2("hyphenation-push-char-count", GenericIntegerInheritedC,
1456 	       &FOTBuilder::setHyphenationPushCharCount, 2);
1457   INHERITED_C2("widow-count", GenericIntegerInheritedC, &FOTBuilder::setWidowCount, 2);
1458   INHERITED_C2("orphan-count", GenericIntegerInheritedC, &FOTBuilder::setOrphanCount, 2);
1459   // #f or strictly positive integer
1460   INHERITED_C2("expand-tabs?", GenericMaybeIntegerInheritedC,
1461 	       &FOTBuilder::setExpandTabs, 8);
1462   INHERITED_C2("hyphenation-ladder-count", GenericMaybeIntegerInheritedC,
1463 	       &FOTBuilder::setHyphenationLadderCount, 0);
1464   INHERITED_C("background-tile", GenericPublicIdInheritedC, &FOTBuilder::setBackgroundTile);
1465   INHERITED_C("line-breaking-method", GenericPublicIdInheritedC, &FOTBuilder::setLineBreakingMethod);
1466   INHERITED_C("line-composition-method", GenericPublicIdInheritedC, &FOTBuilder::setLineCompositionMethod);
1467   INHERITED_C("implicit-bidi-method", GenericPublicIdInheritedC, &FOTBuilder::setImplicitBidiMethod);
1468   INHERITED_C("glyph-subst-method", GenericPublicIdInheritedC, &FOTBuilder::setGlyphSubstMethod);
1469   INHERITED_C("glyph-reorder-method", GenericPublicIdInheritedC, &FOTBuilder::setGlyphReorderMethod);
1470   INHERITED_C("hyphenation-method", GenericPublicIdInheritedC, &FOTBuilder::setHyphenationMethod);
1471   INHERITED_C("table-auto-width-method", GenericPublicIdInheritedC, &FOTBuilder::setTableAutoWidthMethod);
1472   INHERITED_C("font-name", GenericPublicIdInheritedC, &FOTBuilder::setFontName);
1473   // 2 letter symbol or #f
1474   INHERITED_C("language", GenericLetter2InheritedC, &FOTBuilder::setLanguage);
1475   INHERITED_C("country", GenericLetter2InheritedC, &FOTBuilder::setCountry);
1476   // Ignored characteristics
1477   ELObjDynamicRoot length0(*this, new (*this) LengthObj(0));
1478   // #f or length-spec
1479   INHERITED_C("min-pre-line-spacing", GenericOptLengthSpecInheritedC, &FOTBuilder::setMinPreLineSpacing);
1480   INHERITED_C("min-post-line-spacing", GenericOptLengthSpecInheritedC, &FOTBuilder::setMinPostLineSpacing);
1481   INHERITED_C("min-leading", GenericOptLengthSpecInheritedC, &FOTBuilder::setMinLeading);
1482   // inline spaces
1483   INHERITED_C("escapement-space-before", GenericInlineSpaceInheritedC, &FOTBuilder::setEscapementSpaceBefore);
1484   INHERITED_C("escapement-space-after", GenericInlineSpaceInheritedC, &FOTBuilder::setEscapementSpaceAfter);
1485   // #f or glyph-subst-table
1486   INHERITED_C("glyph-subst-table", GlyphSubstTableC, 0);
1487 
1488   // #f or inline-space
1489   INHERITED_C("inline-space-space", GenericOptInlineSpaceInheritedC, &FOTBuilder::setInlineSpaceSpace);
1490 
1491   //page-sequence IC
1492   INHERITED_C("page-category", GenericSymbolInheritedC, &FOTBuilder::setPageCategory);
1493   INHERITED_C("force-last-page", GenericSymbolInheritedC, &FOTBuilder::setForceLastPage);
1494   INHERITED_C("force-first-page", GenericSymbolInheritedC, &FOTBuilder::setForceFirstPage);
1495   INHERITED_C("first-page-type", GenericSymbolInheritedC, &FOTBuilder::setFirstPageType);
1496   INHERITED_C2("justify-spread?", GenericBoolInheritedC, &FOTBuilder::setJustifySpread, 0);
1497   INHERITED_C("binding-edge", GenericSymbolInheritedC, &FOTBuilder::setBindingEdge);
1498 
1499   //anchor IC
1500   INHERITED_C2("anchor-keep-with-previous?", GenericBoolInheritedC, &FOTBuilder::setAnchorKeepWithPrevious, 0);
1501 
1502   //included-container-area IC
1503   INHERITED_C("contents-alignment", GenericSymbolInheritedC, &FOTBuilder::setContentsAlignment);
1504   INHERITED_C("overflow-action", GenericSymbolInheritedC, &FOTBuilder::setOverflowAction);
1505 
1506   //glyph-annotation IC
1507   INHERITED_C("annotation-glyph-placement", GenericSymbolInheritedC, &FOTBuilder::setAnnotationGlyphPlacement);
1508   INHERITED_C("annotation-glyph-style", GenericPublicIdInheritedC, &FOTBuilder::setAnnotationGlyphStyle);
1509 
1510   //multi-line-inline-note IC
1511   INHERITED_C2("inline-note-line-count", GenericIntegerInheritedC, &FOTBuilder::setInlineNoteLineCount, 2);
1512   INHERITED_C("inline-note-style", GenericPublicIdInheritedC, &FOTBuilder::setInlineNoteStyle);
1513 
1514   //emphasizing-mark IC
1515   INHERITED_C("mark-distribution", GenericSymbolInheritedC, &FOTBuilder::setMarkDistribution);
1516   INHERITED_C("mark-style", GenericPublicIdInheritedC, &FOTBuilder::setMarkStyle);
1517 
1518   //side-by-side IC
1519   INHERITED_C("side-by-side-overlap-control", GenericSymbolInheritedC, &FOTBuilder::setSideBySideOverlapControl);
1520 
1521   //side-by-side-item IC
1522   INHERITED_C("side-by-side-pre-align", GenericSymbolInheritedC, &FOTBuilder::setSideBySidePreAlign);
1523   INHERITED_C("side-by-side-post-align", GenericSymbolInheritedC, &FOTBuilder::setSideBySidePostAlign);
1524 
1525   // integers
1526   // float
1527   IGNORED_C("line-miter-limit", makeInteger(10));
1528   // #f or percentage
1529   IGNORED_C("alignment-point-offset", makeInteger(50));
1530   // char
1531   IGNORED_C("hyphenation-char", new (*this) CharObj('-'));
1532   // char or #f
1533   IGNORED_C("asis-truncate-char", makeFalse());
1534   IGNORED_C("asis-wrap-char", makeFalse());
1535   // #f, #t or char
1536   IGNORED_C("first-line-align", makeFalse());
1537   // list of strings
1538   IGNORED_C("hyphenation-exceptions", makeNil());
1539   // set of corners
1540   IGNORED_C("box-corner-rounded", makeFalse());
1541   IGNORED_C("table-corner-rounded", makeFalse());
1542   // list of lengths
1543   IGNORED_C("line-dash", new (*this) PairObj(length0, makeNil()));
1544   // list of glyphs/chars
1545   IGNORED_C("allowed-ligatures", makeNil());
1546   // #f or sosofo
1547   IGNORED_C("line-number", makeFalse());
1548   // integer or 'force
1549   IGNORED_C("line-spacing-priority", makeInteger(0));
1550   // procedure or #f
1551   IGNORED_C("char-map", makeFalse());
1552 }
1553 
1554 void Interpreter::installInheritedC(const char *s, InheritedC *ic)
1555 {
1556   StringC name(makeStringC(s));
1557   Identifier *ident = lookup(name);
1558   ic->setIdentifier(ident);
1559   ident->setInheritedC(ic);
1560   installInheritedCProc(ident);
1561   if (dsssl2() && name.size() && name[name.size() - 1] == '?') {
1562     name.resize(name.size() - 1);
1563     Identifier *ident2 = lookup(name);
1564     ASSERT(ident2->inheritedC().isNull());
1565     ident2->setInheritedC(ic);
1566     installInheritedCProc(ident2);
1567   }
1568 }
1569 
1570 void Interpreter::installExtensionInheritedC(Identifier *ident,
1571 					     const StringC &pubid,
1572 					     const Location &loc)
1573 {
1574   ConstPtr<InheritedC> ic;
1575   if (pubid.size() != 0 && extensionTable_) {
1576     for (const FOTBuilder::Extension *ep = extensionTable_; ep->pubid; ep++) {
1577       if (pubid == ep->pubid) {
1578 	if (ep->boolSetter)
1579 	  ic = new ExtensionBoolInheritedC(ident, nInheritedC_++, ep->boolSetter);
1580 	else if (ep->stringSetter)
1581 	  ic = new ExtensionStringInheritedC(ident, nInheritedC_++, ep->stringSetter);
1582 	else if (ep->integerSetter)
1583 	  ic = new ExtensionIntegerInheritedC(ident, nInheritedC_++, ep->integerSetter);
1584 	else if (ep->lengthSetter)
1585 	  ic = new ExtensionLengthInheritedC(ident, nInheritedC_++, ep->lengthSetter);
1586 	break;
1587       }
1588     }
1589   }
1590   if (ic.isNull())
1591     // FIXME should call FOTBuilder with PublicId argument
1592     ic = new IgnoredC(ident, nInheritedC_++, makeFalse(), *this);
1593   ident->setInheritedC(ic, currentPartIndex(), loc);
1594   installInheritedCProc(ident);
1595 }
1596 
1597 void Interpreter::installInheritedCProc(const Identifier *ident)
1598 {
1599   const ConstPtr<InheritedC> &ic = ident->inheritedC();
1600   StringC tem(makeStringC("inherited-"));
1601   tem += ident->name();
1602   Identifier *inhIdent = lookup(tem);
1603   PrimitiveObj *prim = new (*this) InheritedCPrimitiveObj(ic);
1604   makePermanent(prim);
1605   prim->setIdentifier(inhIdent);
1606   inhIdent->setValue(prim);
1607   tem = makeStringC("actual-");
1608   tem += ident->name();
1609   Identifier *actIdent = lookup(tem);
1610   prim = new (*this) ActualCPrimitiveObj(ic);
1611   makePermanent(prim);
1612   prim->setIdentifier(actIdent);
1613   actIdent->setValue(prim);
1614 }
1615 
1616 #ifdef DSSSL_NAMESPACE
1617 }
1618 #endif
1619