Initial commit
[profile/ivi/openjade.git] / style / Interpreter.h
1 // Copyright (c) 1996 James Clark
2 // See the file copying.txt for copying permission.
3
4 #ifndef Interpreter_INCLUDED
5 #define Interpreter_INCLUDED 1
6
7 #include "ELObj.h"
8 #include "Expression.h"
9 #include "Message.h"
10 #include "PointerTable.h"
11 #include "NamedTable.h"
12 #include "Collector.h"
13 #include "InputSource.h"
14 #include "XcharMap.h"
15 #include "Owner.h"
16 #include "Style.h"
17 #include "SosofoObj.h"
18 #include "ProcessingMode.h"
19 #include "NumberCache.h"
20 #include "HashTable.h"
21 #include "FOTBuilder.h"
22 #include "Owner.h"
23 #include "Boolean.h"
24 #include "Node.h"
25 #include "GroveManager.h"
26 #include "Pattern.h"
27 #include "CharMap.h"
28
29 #ifdef DSSSL_NAMESPACE
30 namespace DSSSL_NAMESPACE {
31 #endif
32
33 class Interpreter;
34
35 class Identifier : public Named {
36 public:
37   enum SyntacticKey {
38     notKey,
39     keyQuote,
40     keyLambda,
41     keyIf,
42     keyCond,
43     keyAnd, 
44     keyOr,
45     keyCase,
46     keyLet, 
47     keyLetStar, 
48     keyLetrec,
49     keyQuasiquote,
50     keyUnquote, 
51     keyUnquoteSplicing,
52     keyDefine,
53     keyElse,
54     keyArrow,
55     keySet,
56     keyBegin,
57     keyThereExists,
58     keyForAll,
59     keySelectEach,
60     keyUnionForEach,
61     keyMake,
62     keyStyle,
63     keyWithMode,
64     keyDefineUnit,
65     keyQuery,
66     keyElement,
67     keyDefault,
68     keyRoot,
69     keyId,
70     keyMode,
71     keyDeclareInitialValue,
72     keyDeclareCharacteristic,
73     keyDeclareFlowObjectClass,
74     keyDeclareCharCharacteristicAndProperty,
75     keyDeclareReferenceValueType,
76     keyDeclareDefaultLanguage,
77     keyDeclareCharProperty,
78     keyDefinePageModel,
79     keyDefineColumnSetModel,
80     keyDefineLanguage,
81     keyAddCharProperties,
82     keyUse,
83     keyLabel,
84     keyContentMap,
85     keyIsKeepWithPrevious,
86     keyIsKeepWithNext,
87     keySpaceBefore,
88     keySpaceAfter,
89     keyLeftHeader,
90     keyCenterHeader,
91     keyRightHeader,
92     keyLeftFooter,
93     keyCenterFooter,
94     keyRightFooter,
95     keyDestination,
96     keyType,
97     keyCoalesceId,
98     keyIsDisplay,
99     keyScale,
100     keyMaxWidth,
101     keyMaxHeight,
102     keyEntitySystemId,
103     keyNotationSystemId,
104     keyPositionPointX,
105     keyPositionPointY,
106     keyEscapementDirection,
107     keyBreakBeforePriority,
108     keyBreakAfterPriority,
109     keyOrientation,
110     keyLength,
111     keyChar,
112     keyGlyphId,
113     keyIsSpace,
114     keyIsRecordEnd,
115     keyIsInputTab,
116     keyIsInputWhitespace,
117     keyIsPunct,
118     keyIsDropAfterLineBreak,
119     keyIsDropUnlessBeforeLineBreak,
120     keyMathClass,
121     keyMathFontPosture,
122     keyScript,
123     keyStretchFactor,
124     keyKeep,
125     keyBreakBefore,
126     keyBreakAfter,
127     keyIsMayViolateKeepBefore,
128     keyIsMayViolateKeepAfter,
129     keyBeforeRowBorder,
130     keyAfterRowBorder,
131     keyBeforeColumnBorder,
132     keyAfterColumnBorder,
133     keyColumnNumber,
134     keyRowNumber,
135     keyNColumnsSpanned,
136     keyNRowsSpanned,
137     keyWidth,
138     keyIsStartsRow,
139     keyIsEndsRow,
140     keyTableWidth,
141     keyMultiModes,
142     keyData,
143     keyMin,
144     keyMax,
145     keyIsConditional,
146     keyPriority,
147     keyGridNRows,
148     keyGridNColumns,
149     keyRadical,
150     keyNull,
151     keyIsRcs,
152     keyParent,
153     keyActive,
154     keyAttributes,
155     keyChildren,
156     keyRepeat,
157     keyPosition,
158     keyOnly,
159     keyClass,
160     keyImportance,
161     keyDeclareClassAttribute,
162     keyDeclareIdAttribute,
163     keyDeclareFlowObjectMacro,
164     keyOrElement,
165     keyPositionPreference,
166     keyCollate,
167     keyToupper,
168     keyTolower,
169     keySymbol,
170     keyOrder,
171     keyForward,
172     keyBackward,
173     keyWhitePoint,
174     keyBlackPoint,
175     keyRange,
176     keyRangeAbc,
177     keyRangeLmn,
178     keyRangeA,
179     keyDecodeAbc,
180     keyDecodeLmn,
181     keyDecodeA, 
182     keyMatrixAbc,
183     keyMatrixLmn,
184     keyMatrixA,
185     keyArchitecture
186   };
187   enum { lastSyntacticKey = keyWithMode };
188   Identifier(const StringC &name);
189   // Return 0 is value can't yet be computed.
190   ELObj *computeValue(bool force, Interpreter &) const;
191   ELObj *computeBuiltinValue(bool force, Interpreter &) const;
192   bool syntacticKey(SyntacticKey &) const;
193   void setSyntacticKey(SyntacticKey);
194   bool defined(unsigned &, Location &) const;
195   void setDefinition(Owner<Expression> &, unsigned part,
196                      const Location &);
197   void setValue(ELObj *, unsigned defPart = unsigned(-1));
198   bool evaluated() const;
199   const ConstPtr<InheritedC> &inheritedC() const;
200   bool inheritedCDefined(unsigned &, Location &) const;
201   bool charNICDefined(unsigned &, Location &) const;
202   void setCharNIC(unsigned, const Location &);
203   void setInheritedC(const ConstPtr<InheritedC> &);
204   void setInheritedC(const ConstPtr<InheritedC> &, unsigned, const Location &);
205   FlowObj *flowObj() const;
206   bool flowObjDefined(unsigned &, Location &) const;
207   void setFlowObj(FlowObj *);
208   void setFlowObj(FlowObj *, unsigned part, const Location &);
209 private:
210   unsigned defPart_;
211   Owner<Expression> def_;
212   InsnPtr insn_;
213   // Value in top-level environment.
214   ELObj *value_;                // must be permanent
215   FlowObj *flowObj_;    // prototype FlowObj with this name
216   unsigned flowObjPart_;
217   Location flowObjLoc_;
218   Location defLoc_;
219   SyntacticKey syntacticKey_;
220   bool beingComputed_;
221   bool charNIC_;
222   ConstPtr<InheritedC> inheritedC_;
223   unsigned inheritedCPart_;
224   Location inheritedCLoc_;
225   void maybeSaveBuiltin();
226   Identifier *builtin_;
227   static bool preferBuiltin_;
228 };
229
230 class Unit : public Named {
231 public:
232   Unit(const StringC &);
233   void setValue(long);
234   void setValue(double);
235   bool defined(unsigned &, Location &) const;
236   // return 0 if it can't be done
237   ELObj *resolveQuantity(bool force, Interpreter &, double val, int unitExp);
238   ELObj *resolveQuantity(bool force, Interpreter &, long val, int valExp);
239   void setDefinition(Owner<Expression> &, unsigned part, const Location &);
240 private:
241   void tryCompute(bool force, Interpreter &);
242   static bool scale(long val, int valExp, long num, long &result);
243
244   unsigned defPart_;
245   Location defLoc_;
246   Owner<Expression> def_;
247   InsnPtr insn_;
248   enum {
249     notComputed,
250     beingComputed,
251     computedExact,
252     computedInexact,
253     computedError
254     } computed_;
255   union {
256     long exact_;
257     double inexact_;
258   };
259   int dim_;
260 };
261
262 class ELObjDynamicRoot : public Collector::DynamicRoot {
263 public:
264   ELObjDynamicRoot(Collector &c, ELObj *obj = 0)
265     : Collector::DynamicRoot(c), obj_(obj) { }
266   void operator=(ELObj *obj) { obj_ = obj; }
267   operator ELObj *() const { return obj_; }
268 private:
269   void trace(Collector &) const;
270   ELObj *obj_;
271 };
272
273 struct CharPart {
274   Char c;
275   unsigned defPart;
276 };
277
278 struct ELObjPart {
279   ELObjPart();
280   ELObjPart(ELObj *x, unsigned y);
281   void operator=(const ELObjPart &);
282   bool operator==(const ELObjPart &) const;
283   bool operator!=(const ELObjPart &) const;
284   ELObj *obj;
285   unsigned defPart;
286 };
287
288 struct CharProp {
289   CharMap<ELObjPart> *map;
290   ELObjPart def;
291   Location loc;
292 };
293
294 class Interpreter : 
295   public Collector,
296   public Pattern::MatchContext,
297   public NumberCache,
298   public Messenger {
299 public:
300   enum PortName {
301     portNumerator,
302     portDenominator,
303     portPreSup,
304     portPreSub,
305     portPostSup,
306     portPostSub,
307     portMidSup,
308     portMidSub,
309     portOverMark,
310     portUnderMark,
311     portOpen,
312     portClose,
313     portDegree,
314     portOperator,
315     portLowerLimit,
316     portUpperLimit,
317     portHeader,
318     portFooter
319   };
320   enum { nPortNames = portFooter + 1 };
321   Interpreter(GroveManager *, Messenger *, int unitsPerInch, bool debugMode,
322               bool dsssl2, bool strictMode, const FOTBuilder::Extension *);
323   void endPart();
324   void dEndPart();
325   FalseObj *makeFalse();
326   TrueObj *makeTrue();
327   NilObj *makeNil();
328   SymbolObj *makeSymbol(const StringC &);
329   KeywordObj *makeKeyword(const StringC &);
330   IntegerObj *makeInteger(long n);
331   ErrorObj *makeError();
332   UnspecifiedObj *makeUnspecified();
333   PairObj *makePair(ELObj *, ELObj *);
334   ELObj *convertGlyphId(const Char *, size_t, const Location &);
335   bool isError(const ELObj *) const;
336   bool isUnspecified(const ELObj *) const;
337   CharObj *makeChar(Char);
338   ELObj *makeLengthSpec(const FOTBuilder::LengthSpec &);
339   AddressObj *makeAddressNone();
340   NodeListObj *makeEmptyNodeList();
341   void dispatchMessage(Message &);
342   void dispatchMessage(const Message &);
343   Identifier *lookup(const StringC &);
344   Unit *lookupUnit(const StringC &);
345   FunctionObj *lookupExternalProc(const StringC &);
346   int unitsPerInch() const;
347   unsigned currentPartIndex() const;
348   void compile();
349   static StringC makeStringC(const char *);
350   SymbolObj *portName(PortName);
351   ELObj *cValueSymbol(FOTBuilder::Symbol);
352   ELObj *charProperty(const StringC &, Char, const Location &, ELObj *);
353   void addCharProperty(const Identifier *, Owner<Expression> &);
354   void setCharProperty(const Identifier *, Char, Owner<Expression> &);
355   void compileCharProperties();
356   // Map of LexCategory
357   XcharMap<char> lexCategory_;
358   static void normalizeGeneralName(const NodePtr &, StringC &);
359   GroveManager *groveManager() const;
360   StyleObj *initialStyle() const;
361   StyleObj *borderTrueStyle() const;
362   StyleObj *borderFalseStyle() const;
363   bool convertBooleanC(ELObj *, const Identifier *, const Location &, bool &);
364   bool convertPublicIdC(ELObj *, const Identifier *, const Location &,
365                         FOTBuilder::PublicId &);
366   bool convertStringC(ELObj *, const Identifier *, const Location &, StringC &);
367   bool convertLengthC(ELObj *, const Identifier *, const Location &, FOTBuilder::Length &);
368   bool convertLengthSpecC(ELObj *, const Identifier *, const Location &, FOTBuilder::LengthSpec &);
369   bool convertLetter2C(ELObj *, const Identifier *, const Location &, FOTBuilder::Letter2 &);
370   bool convertOptLengthSpecC(ELObj *, const Identifier *, const Location &, FOTBuilder::OptLengthSpec &);
371   bool convertCharC(ELObj *, const Identifier *, const Location &, Char &);
372   bool convertColorC(ELObj *, const Identifier *, const Location &, ColorObj *&);
373   bool convertOptColorC(ELObj *, const Identifier *, const Location &, ColorObj *&);
374   // FIXME allow inexact value
375   bool convertIntegerC(ELObj *, const Identifier *, const Location &, long &);
376   bool convertOptPositiveIntegerC(ELObj *, const Identifier *, const Location &, long &);
377   bool convertRealC(ELObj *, const Identifier *, const Location &, double &);
378   bool convertEnumC(const FOTBuilder::Symbol *, size_t,
379                     ELObj *, const Identifier *, const Location &, FOTBuilder::Symbol &);
380   bool convertEnumC(ELObj *, const Identifier *, const Location &, FOTBuilder::Symbol &);
381   void invalidCharacteristicValue(const Identifier *ident, const Location &loc);
382   bool convertLengthSpec(ELObj *, FOTBuilder::LengthSpec &);
383   bool convertToPattern(ELObj *, const Location &, Pattern &);
384   const ConstPtr<InheritedC> &tableBorderC() const;
385   const ConstPtr<InheritedC> &cellBeforeRowBorderC() const;
386   const ConstPtr<InheritedC> &cellAfterRowBorderC() const;
387   const ConstPtr<InheritedC> &cellBeforeColumnBorderC() const;
388   const ConstPtr<InheritedC> &cellAfterColumnBorderC() const;
389   const ConstPtr<InheritedC> &fractionBarC() const;
390   const char *storePublicId(const Char *, size_t, const Location &);
391   unsigned allocGlyphSubstTableUniqueId();
392   bool lookupNodeProperty(const StringC &, ComponentName::Id &);
393   bool debugMode() const;
394   bool dsssl2() const;
395   bool strictMode() const;
396   void setNodeLocation(const NodePtr &);
397   void setDefaultLanguage(Owner<Expression> &,unsigned part,const Location &);
398   ELObj *defaultLanguage() const;
399   bool defaultLanguageSet(unsigned &,Location &) const;
400   void compileDefaultLanguage();
401   void makeReadOnly(ELObj *);
402   ProcessingMode *lookupProcessingMode(const StringC &);
403   ProcessingMode *initialProcessingMode();
404   void addClassAttributeName(const StringC &name);
405   void addIdAttributeName(const StringC &name);
406   void installInitialValue(Identifier *, Owner<Expression> &);
407   void installExtensionInheritedC(Identifier *, const StringC &, const Location &);
408   void installExtensionCharNIC(Identifier *, const StringC &, const Location &);
409   void installExtensionFlowObjectClass(Identifier *, const StringC &, const Location &);
410   // Return 0 if an invalid number.
411   ELObj *convertNumber(const StringC &, int radix = 10);
412   bool convertCharName(const StringC &str, Char &c) const;
413   enum LexCategory {
414     lexLetter,                  // a - z A - Z
415     lexOtherNameStart,          // !$%&*/<=>?~_^:
416     lexAddNameStart,
417     lexDigit,                   // 0-9
418     lexOtherNumberStart,        // -+.
419     lexOther,
420     lexDelimiter,               // ;()"
421     lexWhiteSpace,
422     lexAddWhiteSpace
423   };
424   LexCategory lexCategory(Xchar);
425   void addStandardChar(const StringC &, const StringC &);
426   void addSdataEntity(const StringC &, const StringC &, const StringC &);
427   void addNameChar(const StringC &);
428   void addSeparatorChar(const StringC &);
429   void setCharRepertoire(const StringC &);
430 private:
431   Interpreter(const Interpreter &); // undefined
432   void operator=(const Interpreter &); // undefined
433   void installSyntacticKeys();
434   void installPortNames();
435   void installCValueSymbols();
436   void installPrimitives();
437   void installPrimitive(const char *, PrimitiveObj *);
438   void installXPrimitive(const char *, const char *, PrimitiveObj *);
439   void installBuiltins();
440   void installUnits();
441   void installCharNames();
442   void installInheritedCs();
443   void installInheritedC(const char *, InheritedC *);
444   void installInheritedCProc(const Identifier *);
445   void installFlowObjs();
446   void installSdata();
447   void installNodeProperties();
448   void installCharProperties();
449   void compileInitialValues();
450   bool sdataMap(GroveString, GroveString, GroveChar &) const;
451   static bool convertUnicodeCharName(const StringC &str, Char &c);
452   bool convertToPattern(ELObj *obj, const Location &loc,
453                         bool isChild, IList<Pattern::Element> &list);
454   bool patternAddAttributeQualifiers(ELObj *obj,
455                                      const Location &loc,
456                                      Pattern::Element &elem);
457   enum {
458     convertAllowBoolean = 01,
459     convertAllowSymbol = 02,
460     convertAllowNumber = 04
461   };
462   ELObj *convertFromString(ELObj *, unsigned hints, const Location &);
463   ELObj *convertNumberFloat(const StringC &);
464   bool scanSignDigits(const StringC &str, size_t &i, int &n);
465   Unit *scanUnit(const StringC &str, size_t i, int &unitExp);
466
467   NilObj *theNilObj_;
468   TrueObj *theTrueObj_;
469   FalseObj *theFalseObj_;
470   ErrorObj *theErrorObj_;
471   UnspecifiedObj *theUnspecifiedObj_;
472   typedef PointerTable<SymbolObj *, StringC, Hash, SymbolObj>
473     SymbolTable;
474   SymbolTable symbolTable_;
475   NamedTable<Identifier> identTable_;
476   NamedTable<Unit> unitTable_;
477   HashTable<StringC,FunctionObj *> externalProcTable_;
478   Messenger *messenger_;
479   const FOTBuilder::Extension *extensionTable_;
480   unsigned partIndex_;
481   unsigned dPartIndex_;
482   int unitsPerInch_;
483   unsigned nInheritedC_;
484   GroveManager *groveManager_;
485   ProcessingMode initialProcessingMode_;
486   NamedTable<ProcessingMode> processingModeTable_;
487   SymbolObj *portNames_[nPortNames];
488   ELObj *cValueSymbols_[FOTBuilder::nSymbols];
489   HashTable<StringC, CharPart> namedCharTable_;
490   HashTable<StringC, CharPart> sdataEntityNameTable_;
491   HashTable<StringC, CharPart> sdataEntityTextTable_;
492   Vector<const Identifier *> initialValueNames_;
493   NCVector<Owner<Expression> > initialValueValues_;
494   size_t currentPartFirstInitialValue_;
495   StyleObj *initialStyle_;
496   StyleObj *borderTrueStyle_;
497   StyleObj *borderFalseStyle_;
498   ConstPtr<InheritedC> tableBorderC_;
499   ConstPtr<InheritedC> cellBeforeRowBorderC_;
500   ConstPtr<InheritedC> cellAfterRowBorderC_;
501   ConstPtr<InheritedC> cellBeforeColumnBorderC_;
502   ConstPtr<InheritedC> cellAfterColumnBorderC_;
503   ConstPtr<InheritedC> fractionBarC_;
504   class StringSet {
505   public:
506     StringSet();
507     const char *store(String<char> &);
508     static unsigned long hash(const String<char> &);
509     static inline const String<char> &key(const String<char> &str) { return str; }
510   private:
511     OwnerTable<String<char>, String<char>, StringSet, StringSet> table_;
512   };
513   StringSet publicIds_;
514   unsigned nextGlyphSubstTableUniqueId_;
515   AddressObj *addressNoneObj_;
516   NodeListObj *emptyNodeListObj_;
517   HashTable<StringC,int> nodePropertyTable_;
518   bool debugMode_;
519   bool dsssl2_;
520   bool strictMode_;
521   ELObj *defaultLanguage_;
522   Owner<Expression> defaultLanguageDef_;
523   unsigned defaultLanguageDefPart_;
524   Location defaultLanguageDefLoc_;
525   friend class Identifier;
526   HashTable<StringC, CharProp> charProperties_;
527 };
528
529 inline
530 ErrorObj *Interpreter::makeError()
531 {
532   return theErrorObj_;
533 }
534
535 inline
536 bool Interpreter::isError(const ELObj *obj) const
537 {
538   return obj == theErrorObj_;
539 }
540
541 inline
542 bool Interpreter::isUnspecified(const ELObj *obj) const
543 {
544   return obj == theUnspecifiedObj_;
545 }
546
547 inline
548 FalseObj *Interpreter::makeFalse()
549 {
550   return theFalseObj_;
551 }
552
553 inline
554 TrueObj *Interpreter::makeTrue()
555 {
556   return theTrueObj_;
557 }
558
559 inline
560 NilObj *Interpreter::makeNil()
561 {
562   return theNilObj_;
563 }
564
565 inline
566 UnspecifiedObj *Interpreter::makeUnspecified()
567 {
568   return theUnspecifiedObj_;
569 }
570
571 inline
572 IntegerObj *Interpreter::makeInteger(long n)
573 {
574   return new (*this) IntegerObj(n);
575 }
576
577 inline
578 PairObj *Interpreter::makePair(ELObj *car, ELObj *cdr)
579 {
580   return new (*this) PairObj(car, cdr);
581 }
582
583 inline
584 CharObj *Interpreter::makeChar(Char c)
585 {
586   return new (*this) CharObj(c);
587 }
588
589 inline
590 AddressObj *Interpreter::makeAddressNone()
591 {
592   return addressNoneObj_;
593 }
594
595 inline
596 NodeListObj *Interpreter::makeEmptyNodeList()
597 {
598   return emptyNodeListObj_;
599 }
600
601 inline
602 ELObj *Interpreter::cValueSymbol(FOTBuilder::Symbol sym)
603 {
604   return cValueSymbols_[sym];
605 }
606
607 inline
608 SymbolObj *Interpreter::portName(PortName i)
609 {
610   return portNames_[i];
611 }
612
613 inline
614 ProcessingMode *Interpreter::initialProcessingMode()
615 {
616   return &initialProcessingMode_;
617 }
618
619 inline
620 int Interpreter::unitsPerInch() const
621 {
622   return unitsPerInch_;
623 }
624
625 inline
626 unsigned Interpreter::currentPartIndex() const
627 {
628   return partIndex_;
629 }
630
631 inline
632 KeywordObj *Interpreter::makeKeyword(const StringC &str)
633 {
634   return new (*this) KeywordObj(lookup(str));
635 }
636
637 inline
638 StyleObj *Interpreter::initialStyle() const
639 {
640   return initialStyle_;
641 }
642
643 inline
644 StyleObj *Interpreter::borderTrueStyle() const
645 {
646   return borderTrueStyle_;
647 }
648
649 inline
650 StyleObj *Interpreter::borderFalseStyle() const
651 {
652   return borderFalseStyle_;
653 }
654
655 inline
656 GroveManager *Interpreter::groveManager() const
657 {
658   return groveManager_;
659 }
660
661 inline
662 const ConstPtr<InheritedC> &Interpreter::tableBorderC() const
663 {
664   return tableBorderC_;
665 }
666
667 inline
668 const ConstPtr<InheritedC> &Interpreter::cellBeforeRowBorderC() const
669 {
670   return cellBeforeRowBorderC_;
671 }
672
673 inline
674 const ConstPtr<InheritedC> &Interpreter::cellAfterRowBorderC() const
675 {
676   return cellAfterRowBorderC_;
677 }
678
679 inline
680 const ConstPtr<InheritedC> &Interpreter::cellBeforeColumnBorderC() const
681 {
682   return cellBeforeColumnBorderC_;
683 }
684
685 inline
686 const ConstPtr<InheritedC> &Interpreter::cellAfterColumnBorderC() const
687 {
688   return cellAfterColumnBorderC_;
689 }
690
691 inline
692 const ConstPtr<InheritedC> &Interpreter::fractionBarC() const
693 {
694   return fractionBarC_;
695 }
696
697 inline
698 FunctionObj *Interpreter::lookupExternalProc(const StringC &pubid)
699 {
700   FunctionObj *const *func = externalProcTable_.lookup(pubid);
701   return func ? *func : 0;
702 }
703
704 inline
705 unsigned Interpreter::allocGlyphSubstTableUniqueId()
706 {
707   return nextGlyphSubstTableUniqueId_++;
708 }
709
710 inline
711 bool Interpreter::debugMode() const
712 {
713   return debugMode_;
714 }
715
716 inline
717 bool Interpreter::dsssl2() const
718 {
719   return dsssl2_;
720 }
721
722 inline
723 bool Interpreter::strictMode() const
724 {
725   return strictMode_;
726 }
727
728 inline
729 void Interpreter::makeReadOnly(ELObj *obj)
730 {
731   if (dsssl2())
732     Collector::makeReadOnly(obj);
733 }
734
735 inline
736 void Interpreter::addClassAttributeName(const StringC &name)
737 {
738   classAttributeNames_.push_back(name);
739 }
740
741 inline
742 void Interpreter::addIdAttributeName(const StringC &name)
743 {
744   idAttributeNames_.push_back(name);
745 }
746
747 inline
748 Interpreter::LexCategory Interpreter::lexCategory(Xchar c)
749 {
750   return LexCategory(lexCategory_[c]);
751 }
752
753 inline
754 bool Identifier::syntacticKey(SyntacticKey &key) const
755 {
756   if (syntacticKey_ == notKey)
757     return 0;
758   key = syntacticKey_;
759   return 1;
760 }
761
762 inline
763 void Identifier::setSyntacticKey(SyntacticKey key)
764 {
765   syntacticKey_ = key;
766 }
767
768 inline
769 bool Identifier::evaluated() const
770 {
771   return value_ != 0;
772 }
773
774 inline
775 const ConstPtr<InheritedC> &Identifier::inheritedC() const
776 {
777   return inheritedC_;
778 }
779
780 inline
781 bool Identifier::inheritedCDefined(unsigned &part, Location &loc) const
782 {
783   if (inheritedC_.isNull())
784     return 0;
785   part = inheritedCPart_;
786   loc = inheritedCLoc_;
787   return 1;
788 }
789
790 inline
791 bool Identifier::charNICDefined(unsigned &part, Location &loc) const
792 {
793   if (!charNIC_)
794     return 0;
795   part = inheritedCPart_;
796   loc = inheritedCLoc_;
797   return 1;
798 }
799
800 inline
801 void Identifier::setCharNIC(unsigned part,
802                             const Location &loc)
803 {
804   charNIC_ = 1;
805   inheritedC_ = ConstPtr<InheritedC>(0);
806   inheritedCPart_ = part;
807   inheritedCLoc_ = loc;
808 }
809
810 inline
811 void Identifier::setInheritedC(const ConstPtr<InheritedC> &ic, unsigned part,
812                                const Location &loc)
813 {
814   inheritedC_ = ic;
815   inheritedCPart_ = part;
816   inheritedCLoc_ = loc;
817 }
818
819 inline
820 void Identifier::setInheritedC(const ConstPtr<InheritedC> &ic)
821 {
822   inheritedC_ = ic;
823   inheritedCPart_ = unsigned(-1);
824   inheritedCLoc_ = Location();
825 }
826
827 inline
828 FlowObj *Identifier::flowObj() const
829 {
830   return flowObj_;
831 }
832
833 inline
834 bool Identifier::flowObjDefined(unsigned &part, Location &loc) const
835 {
836   if (!flowObj_)
837     return 0;
838   part = flowObjPart_;
839   loc = flowObjLoc_;
840   return 1;
841 }
842
843 inline
844 void Identifier::setFlowObj(FlowObj *fo)
845 {
846   flowObj_ = fo;
847   flowObjPart_ = unsigned(-1);
848 }
849
850 inline
851 void Identifier::setFlowObj(FlowObj *fo, unsigned part, const Location &loc)
852 {
853   flowObj_ = fo;
854   flowObjPart_ = part;
855   flowObjLoc_ = loc;
856 }
857
858 inline
859 ELObjPart::ELObjPart()
860 : obj(0), defPart(0)
861 {
862 }
863
864 inline
865 ELObjPart::ELObjPart(ELObj *o, unsigned p)
866 : obj(o), defPart(p)
867 {
868 }
869
870 inline
871 void ELObjPart::operator=(const ELObjPart &x)
872 {
873   obj = x.obj;
874   defPart = x.defPart;
875 }
876
877 inline
878 bool ELObjPart::operator==(const ELObjPart &x) const
879 {
880   return defPart == x.defPart && obj && x.obj && ELObj::eqv(*obj, *x.obj);
881 }
882
883 inline
884 bool ELObjPart::operator!=(const ELObjPart &x) const
885 {
886   return !(*this == x);
887 }
888
889
890 #ifdef DSSSL_NAMESPACE
891 }
892 #endif
893
894 #endif /* not Interpreter_INCLUDED */