1 // Copyright (c) 1996 James Clark
2 // See the file copying.txt for copying permission.
3 
4 #ifndef Insn2_INCLUDED
5 #define Insn2_INCLUDED 1
6 
7 #include "Insn.h"
8 #include "SosofoObj.h"
9 #include "Style.h"
10 
11 #ifdef DSSSL_NAMESPACE
12 namespace DSSSL_NAMESPACE {
13 #endif
14 
15 class CheckSosofoInsn : public Insn {
16 public:
CheckSosofoInsn(const Location & loc,InsnPtr next)17   CheckSosofoInsn(const Location &loc, InsnPtr next) : loc_(loc), next_(next) { }
18   const Insn *execute(VM &vm) const;
19 private:
20   Location loc_;
21   InsnPtr next_;
22 };
23 
24 class CheckStyleInsn : public Insn {
25 public:
CheckStyleInsn(const Location & loc,InsnPtr next)26   CheckStyleInsn(const Location &loc, InsnPtr next) : loc_(loc), next_(next) { }
27   const Insn *execute(VM &vm) const;
28 private:
29   Location loc_;
30   InsnPtr next_;
31 };
32 
33 class ProcessingMode;
34 
35 class PushModeInsn : public Insn {
36 public:
PushModeInsn(const ProcessingMode * mode,InsnPtr next)37   PushModeInsn(const ProcessingMode *mode, InsnPtr next)
38     : mode_(mode), next_(next) { }
39   const Insn *execute(VM &) const;
40 private:
41   const ProcessingMode *mode_;
42   InsnPtr next_;
43 };
44 
45 class PopModeInsn : public Insn {
46 public:
PopModeInsn(InsnPtr next)47   PopModeInsn(InsnPtr next) : next_(next) { }
48   const Insn *execute(VM &) const;
49 private:
50   InsnPtr next_;
51 };
52 
53 // This creates a SetNonInheritedCsSosofo
54 // displayLength_ vars are on the top of the stack.
55 // flowObj is next.
56 
57 class SetNonInheritedCsSosofoInsn : public Insn {
58 public:
59   SetNonInheritedCsSosofoInsn(InsnPtr code, int displayLength, InsnPtr next);
60   const Insn *execute(VM &) const;
61 private:
62   InsnPtr code_;
63   int displayLength_;
64   InsnPtr next_;
65 };
66 
67 class CopyFlowObjInsn : public Insn {
68 public:
69   CopyFlowObjInsn(FlowObj *, InsnPtr);
70   const Insn *execute(VM &) const;
71 private:
72   FlowObj *flowObj_;
73   InsnPtr next_;
74 };
75 
76 // Value for characteristic is on top of the stack
77 // Flow object is next down.
78 
79 class SetPseudoNonInheritedCInsn : public Insn {
80 public:
81   SetPseudoNonInheritedCInsn(const Identifier *, const Location &, InsnPtr);
82   const Insn *execute(VM &) const;
83 private:
84   Location loc_;
85   const Identifier *nic_;
86   InsnPtr next_;
87 };
88 
89 class SetNonInheritedCInsn : public SetPseudoNonInheritedCInsn {
90 public:
91   SetNonInheritedCInsn(const Identifier *, const Location &, InsnPtr);
92   const Insn *execute(VM &) const;
93 };
94 
95 // sosofo with content is on top of the stack
96 // flow object is next
97 
98 class SetContentInsn : public Insn {
99 public:
100   SetContentInsn(const CompoundFlowObj *, InsnPtr next);
101   const Insn *execute(VM &vm) const;
102 private:
103   InsnPtr next_;
104   const CompoundFlowObj *flowObj_;
105 };
106 
107 class SetDefaultContentInsn : public Insn {
108 public:
109   SetDefaultContentInsn(const CompoundFlowObj *, const Location &loc, InsnPtr next);
110   const Insn *execute(VM &vm) const;
111 private:
112   Location loc_;
113   InsnPtr next_;
114   const CompoundFlowObj *flowObj_;
115 };
116 
117 class MakeDefaultContentInsn : public Insn {
118 public:
119   MakeDefaultContentInsn(const Location &loc, InsnPtr next);
120   const Insn *execute(VM &vm) const;
121 private:
122   Location loc_;
123   InsnPtr next_;
124 };
125 
126 class SosofoAppendInsn : public Insn {
127 public:
128   SosofoAppendInsn(size_t, InsnPtr);
129   const Insn *execute(VM &vm) const;
130 private:
131   size_t n_;
132   InsnPtr next_;
133 };
134 
135 // This creates a VarStyleObj.
136 // displayLength vars are on the top, then the use StyleObj is there is one.
137 
138 class VarStyleInsn : public Insn {
139 public:
140   VarStyleInsn(const ConstPtr<StyleSpec> &, unsigned, bool, InsnPtr);
141   const Insn *execute(VM &vm) const;
142 private:
143   unsigned displayLength_;
144   bool hasUse_;
145   ConstPtr<StyleSpec> styleSpec_;
146   InsnPtr next_;
147 };
148 
149 // BasicStyleObj is on top of stack.
150 // If there is a current overriding style,
151 // replace it by an OverridenStyleObj.
152 
153 class MaybeOverrideStyleInsn : public Insn {
154 public:
155   MaybeOverrideStyleInsn(InsnPtr next);
156   const Insn *execute(VM &vm) const;
157 private:
158   InsnPtr next_;
159 };
160 
161 // StyleObj is on top
162 // FlowObj is next down
163 // calls set style on the flowobj
164 
165 class SetStyleInsn : public Insn {
166 public:
167   SetStyleInsn(InsnPtr next);
168   const Insn *execute(VM &vm) const;
169 private:
170   InsnPtr next_;
171 };
172 
173 class Expression;
174 
175 // label is on the top
176 // content is next down
177 
178 class LabelSosofoInsn : public Insn {
179 public:
180   LabelSosofoInsn(const Location &, InsnPtr next);
181   const Insn *execute(VM &) const;
182 private:
183   Location loc_;
184   InsnPtr next_;
185 };
186 
187 // Constructs a ContentMapSosofo
188 // content-map is on top
189 // content is next down
190 
191 class ContentMapSosofoInsn : public Insn {
192 public:
193   ContentMapSosofoInsn(const Location &loc, InsnPtr next);
194   const Insn *execute(VM &) const;
195 private:
196   Location loc_;
197   InsnPtr next_;
198 };
199 
200 #ifdef DSSSL_NAMESPACE
201 }
202 #endif
203 
204 #endif /* not Insn2_INCLUDED */
205