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