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:
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:
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:
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:
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 class SetImplicitCharInsn : public Insn {
96 public:
97   SetImplicitCharInsn(const Location &, InsnPtr);
98   const Insn *execute(VM &) const;
99 private:
100   Location loc_;
101   InsnPtr next_;
102 };
103 
104 // sosofo with content is on top of the stack
105 // flow object is next
106 
107 class SetContentInsn : public Insn {
108 public:
109   SetContentInsn(const CompoundFlowObj *, InsnPtr next);
110   const Insn *execute(VM &vm) const;
111 private:
112   InsnPtr next_;
113   const CompoundFlowObj *flowObj_;
114 };
115 
116 class SetDefaultContentInsn : public Insn {
117 public:
118   SetDefaultContentInsn(const CompoundFlowObj *, const Location &loc, InsnPtr next);
119   const Insn *execute(VM &vm) const;
120 private:
121   Location loc_;
122   InsnPtr next_;
123   const CompoundFlowObj *flowObj_;
124 };
125 
126 class MakeDefaultContentInsn : public Insn {
127 public:
128   MakeDefaultContentInsn(const Location &loc, InsnPtr next);
129   const Insn *execute(VM &vm) const;
130 private:
131   Location loc_;
132   InsnPtr next_;
133 };
134 
135 class SosofoAppendInsn : public Insn {
136 public:
137   SosofoAppendInsn(size_t, InsnPtr);
138   const Insn *execute(VM &vm) const;
139 private:
140   size_t n_;
141   InsnPtr next_;
142 };
143 
144 // This creates a VarStyleObj.
145 // displayLength vars are on the top, then the use StyleObj is there is one.
146 
147 class VarStyleInsn : public Insn {
148 public:
149   VarStyleInsn(const ConstPtr<StyleSpec> &, unsigned, bool, InsnPtr);
150   const Insn *execute(VM &vm) const;
151 private:
152   unsigned displayLength_;
153   bool hasUse_;
154   ConstPtr<StyleSpec> styleSpec_;
155   InsnPtr next_;
156 };
157 
158 // BasicStyleObj is on top of stack.
159 // If there is a current overriding style,
160 // replace it by an OverridenStyleObj.
161 
162 class MaybeOverrideStyleInsn : public Insn {
163 public:
164   MaybeOverrideStyleInsn(InsnPtr next);
165   const Insn *execute(VM &vm) const;
166 private:
167   InsnPtr next_;
168 };
169 
170 // StyleObj is on top
171 // FlowObj is next down
172 // calls set style on the flowobj
173 
174 class SetStyleInsn : public Insn {
175 public:
176   SetStyleInsn(InsnPtr next);
177   const Insn *execute(VM &vm) const;
178 private:
179   InsnPtr next_;
180 };
181 
182 class Expression;
183 
184 // label is on the top
185 // content is next down
186 
187 class LabelSosofoInsn : public Insn {
188 public:
189   LabelSosofoInsn(const Location &, InsnPtr next);
190   const Insn *execute(VM &) const;
191 private:
192   Location loc_;
193   InsnPtr next_;
194 };
195 
196 // Constructs a ContentMapSosofo
197 // content-map is on top
198 // content is next down
199 
200 class ContentMapSosofoInsn : public Insn {
201 public:
202   ContentMapSosofoInsn(const Location &loc, InsnPtr next);
203   const Insn *execute(VM &) const;
204 private:
205   Location loc_;
206   InsnPtr next_;
207 };
208 
209 #ifdef DSSSL_NAMESPACE
210 }
211 #endif
212 
213 #endif /* not Insn2_INCLUDED */
214