25 #include "common/memorypool.h" 26 #include "common/memstream.h" 27 #include "common/ptr.h" 28 #include "common/str.h" 29 #include "common/stream.h" 30 #include "common/ustr.h" 31 #include "graphics/macgui/macwindow.h" 32 #include "graphics/mactoolbox/toolbox.h" 43 uint64 mantissaBits = 0;
44 uint8 mantissaSize = 0;
48 ZBasicBCD(uint16 e, uint64 mb, uint8 ms) {
50 this->mantissaBits = mb;
51 this->mantissaSize = ms;
55 this->exponent = obj.exponent;
56 this->mantissaBits = obj.mantissaBits;
57 this->mantissaSize = obj.mantissaSize;
65 }
else if (size == 4) {
68 bcd.mantissaSize = 16;
69 }
else if (size == 6) {
72 bcd.mantissaSize = 32;
73 }
else if (size == 8) {
77 bcd.mantissaSize = 48;
79 warning(
"ZBasicBCD::read: unexpected size for bcd %d", size);
87 int64 expSigned = this->exponent <= 0x3fff ? (int64)this->exponent : ((int64)this->exponent - 0x8000);
88 if (expSigned > 0x7ff) {
90 }
else if (expSigned < -0x800) {
93 int sign = expSigned < 0 ? -1 : 1;
94 uint64 mantissaRaw = this->mantissaBits;
95 for (
int i = 0; i < this->mantissaSize; i += 4) {
99 result.d += (double)(mantissaRaw & 0xf);
102 result.d *= sign * pow((
double)10, (
double)expSigned);
108 enum ZBasicTextFont {
110 kFontApplication = 1,
117 kFontSanFrancisco = 8,
124 enum ZBasicDatumType {
132 enum ZBasicWindowType {
134 kWindowDialogTwoLine = 2,
135 kWindowDialogOneLine = 3,
137 kWindowDocumentFixed = 5,
141 ZBasicDatumType type = kDatumNULL;
153 if (this->type == kDatumBCD) {
154 delete this->data.bcd;
156 }
else if (this->type == kDatumSTR) {
157 delete this->data.str;
164 result->type = kDatumNULL;
165 result->offset = offset;
166 result->data.bcd = 0;
172 result->type = kDatumINT;
173 result->offset = offset;
174 result->data.i16 = value;
180 result->type = kDatumDBLINT;
181 result->offset = offset;
182 result->data.i32 = value;
188 result->type = kDatumBCD;
189 result->offset = offset;
196 result->type = kDatumSTR;
197 result->offset = offset;
239 void blockMove(
void *srcptr,
void *destptr, uint16 size)
243 void close(int16 fileNo);
244 void coordinateWindow();
250 int finderInfo(int16 &count,
Common::U32String &var, Graphics::MacToolbox::OSType &type, uint16 volume);
252 uint32 mem(int16 index);
253 void menu(uint16 menuNo, uint16 itemNo, uint16 state,
const Common::U32String &title);
262 void openR(int16 fileNo,
const Common::U32String &fileName, uint32 lineSize, int16 volNo);
263 void openW(int16 fileNo,
const Common::U32String &fileName, uint32 lineSize, int16 volNo);
269 int32 readDataDblInt();
272 uint32 readFile(int16 fileNo, byte *dest, uint32 length);
273 int32 readFileDblInt(int16 fileNo);
274 int16 readFileInt(int16 fileNo);
276 void record(int16 fileNo, int16 recordNo, int16 location);
277 void restore(uint32 index);
278 int16 rndInt(int16 max);
280 void swapInt(int16 &a, int16 &b);
282 void text(uint16 font, uint16 size, uint16 face, Graphics::MacToolbox::SourceMode mode);
283 void window(int16 windowNumber,
const Common::String &title, int16 x1, int16 y1, int16 x2, int16 y2, ZBasicWindowType type);
285 void writeFileInt(int16 fileNo, int16 data);
286 void writeFileDblInt(int16 fileNo, int32 data);
295 void sound(int16 frequency, int32 duration, int16 volume, int16 voice);
298 void unk_11(int16 unk1);
300 bool incrAndCheck(int16 &a0, int16 d1, int16 d0);
301 void unk_44(int16 unk1);
304 void unk_130(int16 unk1);
307 void unk_331(uint16 unk1, int16 unk2);
308 void indexClear(int16 table);
310 void indexRawSet(
const Common::String &value, int16 table, int16 index);
314 int16 getFileId() {
return _fileId; }
315 void injectFOND(
const byte *data,
const size_t size,
const Common::String &name);
316 void setMenuFont(uint16 font, uint16 size);
Definition: memorypool.h:49
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: macwindow.h:205
byte readByte()
Definition: stream.h:434
Definition: detection.h:27
uint32 readUint32BE()
Definition: stream.h:515
uint16 readUint16BE()
Definition: stream.h:501
virtual bool skip(uint32 offset)
Definition: stream.h:793