Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 199 lines (166 sloc) 4.683 kb
a9461cd initializing repo from version 0.10.2 minus the example files
Julian authored
1 #ifndef INCLUDE_BLASSIC_SYSVAR_H
2 #define INCLUDE_BLASSIC_SYSVAR_H
3
4 // sysvar.h
5 // Revision 6-feb-2005
6
7 #if defined __BORLANDC__
8 #pragma warn -8058
9 #endif
10
11 #include "blassic.h"
12
13
14 namespace blassic {
15
16 namespace sysvar {
17
18 void init ();
19 size_t address ();
20
21 void set (size_t var, BlChar value);
22 void set16 (size_t var, short value);
23 void set32 (size_t var, BlInteger value);
24
25 BlChar get (size_t var);
26 unsigned short get16 (size_t var);
27 unsigned long get32 (size_t var);
28
29 const size_t
30 GraphicsWidth= 0,
31 GraphicsHeight= 2,
32 NumArgs= 4,
33 VersionMajor= 6,
34 VersionMinor= 8,
35 VersionRelease= 10,
36 AutoInit= 12,
37 AutoInc= 16,
38 CharGen= 20,
39 ShellResult= 24,
40 TypeOfVal= 25, // 0: simple, 1: expression evluation,
41 // else unimplemented.
42 TypeOfNextCheck= 26, // 0: normal, else ZX-type
43 TypeOfDimCheck= 27, // 0: cannot dim already dimensioned
44 // 1: Silently redim
45 MaxHistory= 28, // Max size of history buffer.
46 Flags1= 30, // Bit 0: LOCATE style. 0 Microsoft, 1 Amstrad CPC.
47 // Bit 1: TAB style: 0 normal, 1 Spectrum.
48 // Bit 2: THEN omitted: 0 is not accepted, 1 accepted.
49 // Bit 3: space before number in PRINT, 0 No, 1 Yes.
50 // Bit 4: initial space in STR$, 0 No, 1 Yes.
51 // Bit 5: convert LF to CR in GET and INKEY$
52 // Bit 6: Show debug info on certain errors.
53 // Bit 7: Relaxed GOTO mode.
54 PrinterLine= 31, // Type of printer line feed.
55 // 0 LF only.
56 // 1 CR + LF
57 // 2 CR only.
58 MaxFnLevel= 32, // Max level of FN calls.
59 DebugLevel= 36, // Level for IF_DEBUG
60 Zone= 38, // Size of zone for the , separator of PRINT.
61 GraphRotate= 40, // Type of graphics rotation:
62 // 0 no rotation.
63 // 1 90 degrees.
64 // Other: undefined
65 Flags2= 41, // Bit 0: GO TO and GO SUB separated in listings.
66 // Bit 1: if set true is positive.
67 // Bit 2: if set logical ops are boolean.
68 // Bit 3: if set blank lines in .bas text files
69 // are converted to comments.
70 // Bits 4-7: reserved.
71 TronChannel= 42, // Last channel used for tron or tron line.
72 TronFlags= 44, // Tron flags.
73 // Bit 0: tron ot tron line is active.
74 // Bit 1: tron line is active.
75 // Bits 2-7: reserved.
76 // 45: reserved
77 EndSysVar= 46;
78
79 // Flags masks.
80 // Implemented as classes to improve type safety
81 // and avoid silly mistakes.
82
83 class Flags1Bit {
84 public:
85 explicit Flags1Bit (BlChar f) :
86 f (f)
87 { }
88 BlChar get () const { return f; }
89 bool has (const Flags1Bit f1bit) const;
90 friend bool operator == (const Flags1Bit f1, const Flags1Bit f2);
91 friend bool operator != (const Flags1Bit f1, const Flags1Bit f2);
92 friend Flags1Bit operator | (const Flags1Bit f1, const Flags1Bit f2);
93 friend Flags1Bit operator & (const Flags1Bit f1, const Flags1Bit f2);
94 private:
95 BlChar f;
96 };
97
98 inline bool Flags1Bit::has (const Flags1Bit f1bit) const
99 {
100 return (f & f1bit.f);
101 }
102
103 inline bool operator == (const Flags1Bit f1, const Flags1Bit f2)
104 {
105 return f1.f == f2.f;
106 }
107
108 inline bool operator != (const Flags1Bit f1, const Flags1Bit f2)
109 {
110 return f1.f != f2.f;
111 }
112
113 inline Flags1Bit operator | (const Flags1Bit f1, const Flags1Bit f2)
114 {
115 return Flags1Bit (f1.f | f2.f);
116 }
117
118 inline Flags1Bit operator & (const Flags1Bit f1, const Flags1Bit f2)
119 {
120 return Flags1Bit (f1.f & f2.f);
121 }
122
123 class Flags2Bit {
124 public:
125 explicit Flags2Bit (BlChar f) :
126 f (f)
127 { }
128 BlChar get () const { return f; }
129 bool has (const Flags2Bit f2bit) const;
130 friend bool operator == (const Flags2Bit f1, const Flags2Bit f2);
131 friend bool operator != (const Flags2Bit f1, const Flags2Bit f2);
132 friend Flags2Bit operator | (const Flags2Bit f1, const Flags2Bit f2);
133 friend Flags2Bit operator & (const Flags2Bit f1, const Flags2Bit f2);
134 private:
135 BlChar f;
136 };
137
138 inline bool Flags2Bit::has (const Flags2Bit f2bit) const
139 {
140 return (f & f2bit.f);
141 }
142
143 inline bool operator == (const Flags2Bit f1, const Flags2Bit f2)
144 {
145 return f1.f == f2.f;
146 }
147
148 inline bool operator != (const Flags2Bit f1, const Flags2Bit f2)
149 {
150 return f1.f != f2.f;
151 }
152
153 inline Flags2Bit operator | (const Flags2Bit f1, const Flags2Bit f2)
154 {
155 return Flags2Bit (f1.f | f2.f);
156 }
157
158 inline Flags2Bit operator & (const Flags2Bit f1, const Flags2Bit f2)
159 {
160 return Flags2Bit (f1.f & f2.f);
161 }
162
163 const Flags1Bit
164 Flags1Clean (0),
165 LocateStyle (1),
166 TabStyle (2),
167 ThenOmitted (4),
168 SpaceBefore (8),
169 SpaceStr_s (16),
170 ConvertLFCR (32),
171 ShowDebugInfo (64),
172 RelaxedGoto (128),
173 Flags1Full (255);
174
175 const Flags2Bit
176 Flags2Clean (0),
177 SeparatedGoto (1),
178 TruePositive (2),
179 BoolMode (4),
180 BlankComment (8),
181 Flags2Full (255);
182
183 Flags1Bit getFlags1 ();
184 Flags2Bit getFlags2 ();
185
186 bool hasFlags1 (Flags1Bit f);
187 bool hasFlags2 (Flags2Bit f);
188
189 void setFlags1 (Flags1Bit f);
190 void setFlags2 (Flags2Bit f);
191
192 } // namespace sysvar
193
194 } // namespace blassic
195
196 #endif
197
198 // Fin de sysvar.h
Something went wrong with that request. Please try again.