GLK: Standardizing uint vs uint32 usage

This commit is contained in:
Paul Gilbert 2018-12-09 14:46:57 -08:00
parent fc8b55578b
commit e232d024c5
22 changed files with 207 additions and 215 deletions

View file

@ -142,7 +142,7 @@ void Events::getEvent(event_t *event, bool polled) {
_currentEvent = nullptr; _currentEvent = nullptr;
} }
void Events::store(EvType type, Window *win, uint32 val1, uint32 val2) { void Events::store(EvType type, Window *win, uint val1, uint val2) {
Event ev(type, win, val1, val2); Event ev(type, win, val1, val2);
switch (type) { switch (type) {

View file

@ -110,7 +110,7 @@ enum CursorId {
struct Event { struct Event {
EvType type; EvType type;
Window *window; Window *window;
uint32 val1, val2; uint val1, val2;
/** /**
* Constructor * Constructor
@ -122,7 +122,7 @@ struct Event {
/** /**
* Constructor * Constructor
*/ */
Event(EvType evType, Window *evWindow, uint32 evVal1, uint32 evVal2) { Event(EvType evType, Window *evWindow, uint evVal1, uint evVal2) {
type = evType; type = evType;
window = evWindow; window = evWindow;
val1 = evVal1; val1 = evVal1;
@ -241,7 +241,7 @@ public:
/** /**
* Store an event for retrieval * Store an event for retrieval
*/ */
void store(EvType type, Window *win, uint32 val1 = 0, uint32 val2 = 0); void store(EvType type, Window *win, uint val1 = 0, uint val2 = 0);
/** /**
* Wait for a keyboard or mouse press * Wait for a keyboard or mouse press

View file

@ -202,7 +202,7 @@ enum FontStyle {
#define MENU_REMOVE 2 #define MENU_REMOVE 2
typedef byte zbyte; typedef byte zbyte;
typedef uint zchar; typedef uint32 zchar;
typedef uint16 zword; typedef uint16 zword;
#define MAX_NESTING 16 #define MAX_NESTING 16

View file

@ -425,7 +425,7 @@ void GlkInterface::packspaces(zchar *src, zchar *dst) {
void GlkInterface::smartstatusline() { void GlkInterface::smartstatusline() {
zchar packed[256]; zchar packed[256];
uint buf[256]; uint32 buf[256];
zchar *a, *b, *c, *d; zchar *a, *b, *c, *d;
int roomlen, scorelen, scoreofs; int roomlen, scorelen, scoreofs;
int len, tmp; int len, tmp;

View file

@ -764,7 +764,7 @@ void GlkAPI::glk_set_echo_line_event(winid_t win, uint val) {
} }
} }
void GlkAPI::glk_set_terminators_line_event(winid_t win, uint *keycodes, uint count) { void GlkAPI::glk_set_terminators_line_event(winid_t win, const uint32 *keycodes, uint count) {
if (!win) { if (!win) {
warning("set_terminators_line_event: invalid ref"); warning("set_terminators_line_event: invalid ref");
} else { } else {
@ -772,32 +772,32 @@ void GlkAPI::glk_set_terminators_line_event(winid_t win, uint *keycodes, uint co
} }
} }
uint GlkAPI::glk_buffer_to_lower_case_uni(uint *buf, uint len, uint numchars) { uint GlkAPI::glk_buffer_to_lower_case_uni(uint32 *buf, uint len, uint numchars) {
return bufferChangeCase(buf, len, numchars, CASE_LOWER, COND_ALL, true); return bufferChangeCase(buf, len, numchars, CASE_LOWER, COND_ALL, true);
} }
uint GlkAPI::glk_buffer_to_upper_case_uni(uint *buf, uint len, uint numchars) { uint GlkAPI::glk_buffer_to_upper_case_uni(uint32 *buf, uint len, uint numchars) {
return bufferChangeCase(buf, len, numchars, CASE_UPPER, COND_ALL, true); return bufferChangeCase(buf, len, numchars, CASE_UPPER, COND_ALL, true);
} }
uint GlkAPI::glk_buffer_to_title_case_uni(uint *buf, uint len, uint GlkAPI::glk_buffer_to_title_case_uni(uint32 *buf, uint len,
uint numchars, uint lowerrest) { uint numchars, uint lowerrest) {
return bufferChangeCase(buf, len, numchars, CASE_TITLE, COND_LINESTART, lowerrest); return bufferChangeCase(buf, len, numchars, CASE_TITLE, COND_LINESTART, lowerrest);
} }
void GlkAPI::glk_put_char_uni(uint ch) { void GlkAPI::glk_put_char_uni(uint32 ch) {
_streams->getCurrent()->putCharUni(ch); _streams->getCurrent()->putCharUni(ch);
} }
void GlkAPI::glk_put_string_uni(uint *s) { void GlkAPI::glk_put_string_uni(const uint32 *s) {
_streams->getCurrent()->putBufferUni(s, strlen_uni(s)); _streams->getCurrent()->putBufferUni(s, strlen_uni(s));
} }
void GlkAPI::glk_put_buffer_uni(uint *buf, uint len) { void GlkAPI::glk_put_buffer_uni(const uint32 *buf, uint len) {
_streams->getCurrent()->putBufferUni(buf, len); _streams->getCurrent()->putBufferUni(buf, len);
} }
void GlkAPI::glk_put_char_stream_uni(strid_t str, uint ch) { void GlkAPI::glk_put_char_stream_uni(strid_t str, uint32 ch) {
if (str) { if (str) {
str->putCharUni(ch); str->putCharUni(ch);
} else { } else {
@ -805,7 +805,7 @@ void GlkAPI::glk_put_char_stream_uni(strid_t str, uint ch) {
} }
} }
void GlkAPI::glk_put_string_stream_uni(strid_t str, const uint *s) { void GlkAPI::glk_put_string_stream_uni(strid_t str, const uint32 *s) {
if (str) { if (str) {
str->putBufferUni(s, strlen_uni(s)); str->putBufferUni(s, strlen_uni(s));
} else { } else {
@ -813,7 +813,7 @@ void GlkAPI::glk_put_string_stream_uni(strid_t str, const uint *s) {
} }
} }
void GlkAPI::glk_put_buffer_stream_uni(strid_t str, const uint *buf, uint len) { void GlkAPI::glk_put_buffer_stream_uni(strid_t str, const uint32 *buf, uint len) {
if (str) { if (str) {
str->putBufferUni(buf, len); str->putBufferUni(buf, len);
} else { } else {
@ -830,7 +830,7 @@ int GlkAPI::glk_get_char_stream_uni(strid_t str) {
} }
} }
uint GlkAPI::glk_get_buffer_stream_uni(strid_t str, uint *buf, uint len) { uint GlkAPI::glk_get_buffer_stream_uni(strid_t str, uint32 *buf, uint len) {
if (str) { if (str) {
return str->getBufferUni(buf, len); return str->getBufferUni(buf, len);
} else { } else {
@ -839,7 +839,7 @@ uint GlkAPI::glk_get_buffer_stream_uni(strid_t str, uint *buf, uint len) {
} }
} }
uint GlkAPI::glk_get_line_stream_uni(strid_t str, uint *buf, uint len) { uint GlkAPI::glk_get_line_stream_uni(strid_t str, uint32 *buf, uint len) {
if (str) { if (str) {
return str->getLineUni(buf, len); return str->getLineUni(buf, len);
} else { } else {
@ -852,7 +852,7 @@ strid_t GlkAPI::glk_stream_open_file_uni(frefid_t fileref, FileMode fmode, uint
return _streams->openFileStream(fileref, fmode, rock, true); return _streams->openFileStream(fileref, fmode, rock, true);
} }
strid_t GlkAPI::glk_stream_open_memory_uni(uint *buf, uint buflen, FileMode fmode, uint rock) { strid_t GlkAPI::glk_stream_open_memory_uni(uint32 *buf, uint buflen, FileMode fmode, uint rock) {
return _streams->openMemoryStream(buf, buflen, fmode, rock, true); return _streams->openMemoryStream(buf, buflen, fmode, rock, true);
} }
@ -867,7 +867,7 @@ void GlkAPI::glk_request_char_event_uni(winid_t win) {
} }
} }
void GlkAPI::glk_request_line_event_uni(winid_t win, uint *buf, uint maxlen, uint initlen) { void GlkAPI::glk_request_line_event_uni(winid_t win, uint32 *buf, uint maxlen, uint initlen) {
if (!win) { if (!win) {
warning("request_line_event_uni: invalid ref"); warning("request_line_event_uni: invalid ref");
} else if (win->_charRequest || win->_lineRequest || win->_charRequestUni } else if (win->_charRequest || win->_lineRequest || win->_charRequestUni
@ -878,13 +878,12 @@ void GlkAPI::glk_request_line_event_uni(winid_t win, uint *buf, uint maxlen, uin
} }
} }
uint GlkAPI::glk_buffer_canon_decompose_uni(uint *buf, uint len, uint GlkAPI::glk_buffer_canon_decompose_uni(uint32 *buf, uint len, uint numchars) {
uint numchars) {
// TODO // TODO
return 0; return 0;
} }
uint GlkAPI::glk_buffer_canon_normalize_uni(uint *buf, uint len, uint numchars) { uint GlkAPI::glk_buffer_canon_normalize_uni(uint32 *buf, uint len, uint numchars) {
return 0; return 0;
} }
@ -1181,7 +1180,7 @@ void GlkAPI::garglk_unput_string(const char *str) {
_streams->getCurrent()->unputBuffer(str, strlen(str)); _streams->getCurrent()->unputBuffer(str, strlen(str));
} }
void GlkAPI::garglk_unput_string_uni(const uint *str) { void GlkAPI::garglk_unput_string_uni(const uint32 *str) {
_streams->getCurrent()->unputBufferUni(str, strlen_uni(str)); _streams->getCurrent()->unputBufferUni(str, strlen_uni(str));
} }

View file

@ -145,47 +145,40 @@ public:
#endif /* GLK_MODULE_LINE_ECHO */ #endif /* GLK_MODULE_LINE_ECHO */
#ifdef GLK_MODULE_LINE_TERMINATORS #ifdef GLK_MODULE_LINE_TERMINATORS
void glk_set_terminators_line_event(winid_t win, uint *keycodes, void glk_set_terminators_line_event(winid_t win, const uint32 *keycodes, uint count);
uint count);
#endif /* GLK_MODULE_LINE_TERMINATORS */ #endif /* GLK_MODULE_LINE_TERMINATORS */
/** \addtogroup Unicode /** \addtogroup Unicode
* @{ * @{
*/ */
uint glk_buffer_to_lower_case_uni(uint *buf, uint len, uint glk_buffer_to_lower_case_uni(uint32 *buf, uint len, uint numchars);
uint numchars); uint glk_buffer_to_upper_case_uni(uint32 *buf, uint len, uint numchars);
uint glk_buffer_to_upper_case_uni(uint *buf, uint len, uint glk_buffer_to_title_case_uni(uint32 *buf, uint len, uint numchars, uint lowerrest);
uint numchars);
uint glk_buffer_to_title_case_uni(uint *buf, uint len,
uint numchars, uint lowerrest);
void glk_put_char_uni(uint ch); void glk_put_char_uni(uint32 ch);
void glk_put_string_uni(uint *s); void glk_put_string_uni(const uint32 *s);
void glk_put_buffer_uni(uint *buf, uint len); void glk_put_buffer_uni(const uint32 *buf, uint len);
void glk_put_char_stream_uni(strid_t str, uint ch); void glk_put_char_stream_uni(strid_t str, uint32 ch);
void glk_put_string_stream_uni(strid_t str, const uint *s); void glk_put_string_stream_uni(strid_t str, const uint32 *s);
void glk_put_buffer_stream_uni(strid_t str, const uint *buf, uint len); void glk_put_buffer_stream_uni(strid_t str, const uint32 *buf, uint len);
int glk_get_char_stream_uni(strid_t str); int glk_get_char_stream_uni(strid_t str);
uint glk_get_buffer_stream_uni(strid_t str, uint *buf, uint len); uint glk_get_buffer_stream_uni(strid_t str, uint32 *buf, uint len);
uint glk_get_line_stream_uni(strid_t str, uint *buf, uint len); uint glk_get_line_stream_uni(strid_t str, uint32 *buf, uint len);
strid_t glk_stream_open_file_uni(frefid_t fileref, FileMode fmode, uint rock = 0); strid_t glk_stream_open_file_uni(frefid_t fileref, FileMode fmode, uint rock = 0);
strid_t glk_stream_open_memory_uni(uint *buf, uint buflen, FileMode fmode, uint rock = 0); strid_t glk_stream_open_memory_uni(uint32 *buf, uint buflen, FileMode fmode, uint rock = 0);
void glk_request_char_event_uni(winid_t win); void glk_request_char_event_uni(winid_t win);
void glk_request_line_event_uni(winid_t win, uint *buf, void glk_request_line_event_uni(winid_t win, uint32 *buf, uint maxlen, uint initlen);
uint maxlen, uint initlen);
/** @}*/ /** @}*/
#ifdef GLK_MODULE_UNICODE_NORM #ifdef GLK_MODULE_UNICODE_NORM
uint glk_buffer_canon_decompose_uni(uint *buf, uint len, uint glk_buffer_canon_decompose_uni(uint32 *buf, uint len, uint numchars);
uint numchars); uint glk_buffer_canon_normalize_uni(uint32 *buf, uint len, uint numchars);
uint glk_buffer_canon_normalize_uni(uint *buf, uint len,
uint numchars);
#endif /* GLK_MODULE_UNICODE_NORM */ #endif /* GLK_MODULE_UNICODE_NORM */
@ -281,7 +274,7 @@ public:
* Removes the specified string from the end of the output buffer, if * Removes the specified string from the end of the output buffer, if
* indeed it is there. * indeed it is there.
*/ */
void garglk_unput_string_uni(const uint *str); void garglk_unput_string_uni(const uint32 *str);
void garglk_set_zcolors(uint fg, uint bg); void garglk_set_zcolors(uint fg, uint bg);
void garglk_set_zcolors_stream(strid_t str, uint fg, uint bg); void garglk_set_zcolors_stream(strid_t str, uint fg, uint bg);

View file

@ -199,10 +199,10 @@ enum giDisp {
}; };
enum zcolor { enum zcolor {
zcolor_Transparent = (uint32) - 4, zcolor_Transparent = (uint)-4,
zcolor_Cursor = (uint32) - 3, zcolor_Cursor = (uint)-3,
zcolor_Current = (uint32) - 2, zcolor_Current = (uint)-2,
zcolor_Default = (uint32) - 1 zcolor_Default = (uint)-1
}; };
#ifdef GLK_MODULE_IMAGE #ifdef GLK_MODULE_IMAGE

View file

@ -34,7 +34,7 @@ namespace Glk {
struct Picture : Graphics::ManagedSurface { struct Picture : Graphics::ManagedSurface {
public: public:
int _refCount; int _refCount;
uint32 _id; uint _id;
bool _scaled; bool _scaled;
/** /**

View file

@ -39,7 +39,7 @@ protected:
void gli_tts_purge(void) {} void gli_tts_purge(void) {}
void gli_tts_speak(const uint *buf, size_t len) {} void gli_tts_speak(const uint32 *buf, size_t len) {}
void gli_free_tts(void) {} void gli_free_tts(void) {}
}; };

View file

@ -33,7 +33,7 @@
namespace Glk { namespace Glk {
Stream::Stream(Streams *streams, bool readable, bool writable, uint32 rock, bool unicode) : Stream::Stream(Streams *streams, bool readable, bool writable, uint rock, bool unicode) :
_streams(streams), _readable(readable), _writable(writable), _rock(0), _unicode(unicode), _streams(streams), _readable(readable), _writable(writable), _rock(0), _unicode(unicode),
_readCount(0), _writeCount(0), _prev(nullptr), _next(nullptr) { _readCount(0), _writeCount(0), _prev(nullptr), _next(nullptr) {
} }
@ -42,7 +42,7 @@ Stream::~Stream() {
_streams->removeStream(this); _streams->removeStream(this);
} }
Stream *Stream::getNext(uint32 *rock) const { Stream *Stream::getNext(uint *rock) const {
Stream *stream = _next; Stream *stream = _next;
if (rock) if (rock)
*rock = stream ? stream->_rock : 0; *rock = stream ? stream->_rock : 0;
@ -188,9 +188,9 @@ void WindowStream::unputBuffer(const char *buf, size_t len) {
_window->_echoStream->unputBuffer(buf, len); _window->_echoStream->unputBuffer(buf, len);
} }
void WindowStream::unputBufferUni(const uint *buf, size_t len) { void WindowStream::unputBufferUni(const uint32 *buf, size_t len) {
uint lx; uint lx;
const uint *cx; const uint32 *cx;
if (!_writable) if (!_writable)
return; return;
@ -306,7 +306,7 @@ void WindowStream::setReverseVideo(bool reverse) {
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
MemoryStream::MemoryStream(Streams *streams, void *buf, size_t buflen, FileMode mode, uint32 rock, bool unicode) : MemoryStream::MemoryStream(Streams *streams, void *buf, size_t buflen, FileMode mode, uint rock, bool unicode) :
Stream(streams, mode != filemode_Write, mode != filemode_Read, rock, unicode), Stream(streams, mode != filemode_Write, mode != filemode_Read, rock, unicode),
_buf(buf), _bufLen(buflen), _bufPtr(buf) { _buf(buf), _bufLen(buflen), _bufPtr(buf) {
assert(_buf && _bufLen); assert(_buf && _bufLen);
@ -326,8 +326,8 @@ void MemoryStream::putChar(unsigned char ch) {
if (_bufPtr < _bufEnd) { if (_bufPtr < _bufEnd) {
if (_unicode) { if (_unicode) {
*((uint *)_bufPtr) = ch; *((uint32 *)_bufPtr) = ch;
_bufPtr = ((uint *)_bufPtr) + 1; _bufPtr = ((uint32 *)_bufPtr) + 1;
} else { } else {
*((unsigned char *)_bufPtr) = ch; *((unsigned char *)_bufPtr) = ch;
_bufPtr = ((unsigned char *)_bufPtr) + 1; _bufPtr = ((unsigned char *)_bufPtr) + 1;
@ -345,8 +345,8 @@ void MemoryStream::putCharUni(uint32 ch) {
if (_bufPtr < _bufEnd) { if (_bufPtr < _bufEnd) {
if (_unicode) { if (_unicode) {
*((uint *)_bufPtr) = ch; *((uint32 *)_bufPtr) = ch;
_bufPtr = ((uint *)_bufPtr) + 1; _bufPtr = ((uint32 *)_bufPtr) + 1;
} else { } else {
*((unsigned char *)_bufPtr) = (unsigned char)ch; *((unsigned char *)_bufPtr) = (unsigned char)ch;
_bufPtr = ((unsigned char *)_bufPtr) + 1; _bufPtr = ((unsigned char *)_bufPtr) + 1;
@ -383,9 +383,9 @@ void MemoryStream::putBuffer(const char *buf, size_t len) {
} }
_bufPtr = bp; _bufPtr = bp;
} else { } else {
uint *bp = (uint *)_bufPtr; uint32 *bp = (uint32 *)_bufPtr;
if (bp + len > (uint *)_bufEnd) { if (bp + len > (uint32 *)_bufEnd) {
lx = (bp + len) - (uint *)_bufEnd; lx = (bp + len) - (uint32 *)_bufEnd;
if (lx < len) if (lx < len)
len -= lx; len -= lx;
else else
@ -396,7 +396,7 @@ void MemoryStream::putBuffer(const char *buf, size_t len) {
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
bp[i] = buf[i]; bp[i] = buf[i];
bp += len; bp += len;
if (bp > (uint *)_bufEof) if (bp > (uint32 *)_bufEof)
_bufEof = bp; _bufEof = bp;
} }
_bufPtr = bp; _bufPtr = bp;
@ -426,7 +426,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
if (len) { if (len) {
uint i; uint i;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
uint ch = buf[i]; uint32 ch = buf[i];
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
bp[i] = (unsigned char)ch; bp[i] = (unsigned char)ch;
@ -437,9 +437,9 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
} }
_bufPtr = bp; _bufPtr = bp;
} else { } else {
uint *bp = (uint *)_bufPtr; uint32 *bp = (uint32 *)_bufPtr;
if (bp + len > (uint *)_bufEnd) { if (bp + len > (uint32 *)_bufEnd) {
lx = (bp + len) - (uint *)_bufEnd; lx = (bp + len) - (uint32 *)_bufEnd;
if (lx < len) if (lx < len)
len -= lx; len -= lx;
else else
@ -448,7 +448,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
if (len) { if (len) {
memmove(bp, buf, len * 4); memmove(bp, buf, len * 4);
bp += len; bp += len;
if (bp > (uint *)_bufEof) if (bp > (uint32 *)_bufEof)
_bufEof = bp; _bufEof = bp;
} }
_bufPtr = bp; _bufPtr = bp;
@ -458,7 +458,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
uint MemoryStream::getPosition() const { uint MemoryStream::getPosition() const {
if (_unicode) if (_unicode)
return ((uint *)_bufPtr - (uint *)_buf); return ((uint32 *)_bufPtr - (uint32 *)_buf);
else else
return ((unsigned char *)_bufPtr - (unsigned char *)_buf); return ((unsigned char *)_bufPtr - (unsigned char *)_buf);
} }
@ -480,15 +480,15 @@ void MemoryStream::setPosition(int pos, uint seekMode) {
_bufPtr = (unsigned char *)_buf + pos; _bufPtr = (unsigned char *)_buf + pos;
} else { } else {
if (seekMode == seekmode_Current) if (seekMode == seekmode_Current)
pos = ((uint *)_bufPtr - (uint *)_buf) + pos; pos = ((uint32 *)_bufPtr - (uint32 *)_buf) + pos;
else if (seekMode == seekmode_End) else if (seekMode == seekmode_End)
pos = ((uint *)_bufEof - (uint *)_buf) + pos; pos = ((uint32 *)_bufEof - (uint32 *)_buf) + pos;
if (pos < 0) if (pos < 0)
pos = 0; pos = 0;
if (pos > ((uint *)_bufEof - (uint *)_buf)) if (pos > ((uint32 *)_bufEof - (uint32 *)_buf))
pos = ((uint *)_bufEof - (uint *)_buf); pos = ((uint32 *)_bufEof - (uint32 *)_buf);
_bufPtr = (uint *)_buf + pos; _bufPtr = (uint32 *)_buf + pos;
} }
} }
@ -504,9 +504,9 @@ int MemoryStream::getChar() {
_readCount++; _readCount++;
return ch; return ch;
} else { } else {
uint ch; uint32 ch;
ch = *((uint *)_bufPtr); ch = *((uint32 *)_bufPtr);
_bufPtr = ((uint *)_bufPtr) + 1; _bufPtr = ((uint32 *)_bufPtr) + 1;
_readCount++; _readCount++;
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
@ -529,9 +529,9 @@ int MemoryStream::getCharUni() {
_readCount++; _readCount++;
return ch; return ch;
} else { } else {
uint ch; uint32 ch;
ch = *((uint *)_bufPtr); ch = *((uint32 *)_bufPtr);
_bufPtr = ((uint *)_bufPtr) + 1; _bufPtr = ((uint32 *)_bufPtr) + 1;
_readCount++; _readCount++;
return ch; return ch;
} }
@ -568,10 +568,10 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
_readCount += len; _readCount += len;
_bufPtr = bp; _bufPtr = bp;
} else { } else {
uint *bp = (uint *)_bufPtr; uint32 *bp = (uint32 *)_bufPtr;
if (bp + len > (uint *)_bufEnd) { if (bp + len > (uint32 *)_bufEnd) {
uint lx; uint lx;
lx = (bp + len) - (uint *)_bufEnd; lx = (bp + len) - (uint32 *)_bufEnd;
if (lx < len) if (lx < len)
len -= lx; len -= lx;
else else
@ -580,12 +580,12 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
if (len) { if (len) {
uint i; uint i;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
uint ch = *bp++; uint32 ch = *bp++;
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
*buf++ = (char)ch; *buf++ = (char)ch;
} }
if (bp > (uint *)_bufEof) if (bp > (uint32 *)_bufEof)
_bufEof = bp; _bufEof = bp;
} }
@ -597,7 +597,7 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
return len; return len;
} }
uint MemoryStream::getBufferUni(uint *buf, uint len) { uint MemoryStream::getBufferUni(uint32 *buf, uint len) {
if (!_readable) if (!_readable)
return 0; return 0;
@ -625,10 +625,10 @@ uint MemoryStream::getBufferUni(uint *buf, uint len) {
_readCount += len; _readCount += len;
_bufPtr = bp; _bufPtr = bp;
} else { } else {
uint *bp = (uint *)_bufPtr; uint32 *bp = (uint32 *)_bufPtr;
if (bp + len > (uint *)_bufEnd) { if (bp + len > (uint32 *)_bufEnd) {
uint lx; uint lx;
lx = (bp + len) - (uint *)_bufEnd; lx = (bp + len) - (uint32 *)_bufEnd;
if (lx < len) if (lx < len)
len -= lx; len -= lx;
else else
@ -637,7 +637,7 @@ uint MemoryStream::getBufferUni(uint *buf, uint len) {
if (len) { if (len) {
memcpy(buf, bp, len * 4); memcpy(buf, bp, len * 4);
bp += len; bp += len;
if (bp > (uint *)_bufEof) if (bp > (uint32 *)_bufEof)
_bufEof = bp; _bufEof = bp;
} }
_readCount += len; _readCount += len;
@ -692,8 +692,8 @@ uint MemoryStream::getLine(char *buf, uint len) {
gotNewline = false; gotNewline = false;
for (lx = 0; lx < len && !gotNewline; lx++) { for (lx = 0; lx < len && !gotNewline; lx++) {
uint ch; uint32 ch;
ch = ((uint *)_bufPtr)[lx]; ch = ((uint32 *)_bufPtr)[lx];
if (ch >= 0x100) if (ch >= 0x100)
ch = '?'; ch = '?';
buf[lx] = (char)ch; buf[lx] = (char)ch;
@ -701,14 +701,14 @@ uint MemoryStream::getLine(char *buf, uint len) {
} }
buf[lx] = '\0'; buf[lx] = '\0';
_bufPtr = ((uint *)_bufPtr) + lx; _bufPtr = ((uint32 *)_bufPtr) + lx;
} }
_readCount += lx; _readCount += lx;
return lx; return lx;
} }
uint MemoryStream::getLineUni(uint *ubuf, uint len) { uint MemoryStream::getLineUni(uint32 *ubuf, uint len) {
bool gotNewline; bool gotNewline;
int lx; int lx;
@ -739,8 +739,8 @@ uint MemoryStream::getLineUni(uint *ubuf, uint len) {
if (_bufPtr >= _bufEnd) { if (_bufPtr >= _bufEnd) {
len = 0; len = 0;
} else { } else {
if ((uint *)_bufPtr + len > (uint *)_bufEnd) { if ((uint32 *)_bufPtr + len > (uint32 *)_bufEnd) {
lx = ((uint *)_bufPtr + len) - (uint *)_bufEnd; lx = ((uint32 *)_bufPtr + len) - (uint32 *)_bufEnd;
if (lx < (int)len) if (lx < (int)len)
len -= lx; len -= lx;
else else
@ -749,13 +749,13 @@ uint MemoryStream::getLineUni(uint *ubuf, uint len) {
} }
gotNewline = false; gotNewline = false;
for (lx = 0; lx < (int)len && !gotNewline; lx++) { for (lx = 0; lx < (int)len && !gotNewline; lx++) {
uint ch; uint32 ch;
ch = ((uint *)_bufPtr)[lx]; ch = ((uint32 *)_bufPtr)[lx];
ubuf[lx] = ch; ubuf[lx] = ch;
gotNewline = (ch == '\n'); gotNewline = (ch == '\n');
} }
ubuf[lx] = '\0'; ubuf[lx] = '\0';
_bufPtr = ((uint *)_bufPtr) + lx; _bufPtr = ((uint32 *)_bufPtr) + lx;
} }
_readCount += lx; _readCount += lx;
@ -885,7 +885,7 @@ void FileStream::putBufferUni(const uint32 *buf, size_t len) {
ensureOp(filemode_Write); ensureOp(filemode_Write);
for (size_t lx = 0; lx < len; lx++) { for (size_t lx = 0; lx < len; lx++) {
uint ch = buf[lx]; uint32 ch = buf[lx];
if (!_unicode) { if (!_unicode) {
if (ch >= 0x100) if (ch >= 0x100)
ch = '?'; ch = '?';
@ -1035,7 +1035,7 @@ int FileStream::getChar() {
} else if (_textFile) { } else if (_textFile) {
res = getCharUtf8(); res = getCharUtf8();
} else { } else {
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (_inStream->eos()) if (_inStream->eos())
return -1; return -1;
@ -1075,7 +1075,7 @@ int FileStream::getCharUni() {
} else if (_textFile) { } else if (_textFile) {
res = getCharUtf8(); res = getCharUtf8();
} else { } else {
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
return -1; return -1;
@ -1112,7 +1112,7 @@ uint FileStream::getBuffer(char *buf, uint len) {
} else if (_textFile) { } else if (_textFile) {
uint lx; uint lx;
for (lx = 0; lx < len; lx++) { for (lx = 0; lx < len; lx++) {
uint ch; uint32 ch;
ch = getCharUtf8(); ch = getCharUtf8();
if (ch == (uint)-1) if (ch == (uint)-1)
break; break;
@ -1126,7 +1126,7 @@ uint FileStream::getBuffer(char *buf, uint len) {
uint lx; uint lx;
for (lx = 0; lx < len; lx++) { for (lx = 0; lx < len; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1152,7 +1152,7 @@ uint FileStream::getBuffer(char *buf, uint len) {
} }
} }
uint FileStream::getBufferUni(uint *buf, uint len) { uint FileStream::getBufferUni(uint32 *buf, uint len) {
if (!_readable) if (!_readable)
return 0; return 0;
@ -1161,7 +1161,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
uint lx; uint lx;
for (lx = 0; lx < len; lx++) { for (lx = 0; lx < len; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1173,7 +1173,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
} else if (_textFile) { } else if (_textFile) {
uint lx; uint lx;
for (lx = 0; lx < len; lx++) { for (lx = 0; lx < len; lx++) {
uint ch; uint32 ch;
ch = getCharUtf8(); ch = getCharUtf8();
if (ch == (uint)-1) if (ch == (uint)-1)
break; break;
@ -1185,7 +1185,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
uint lx; uint lx;
for (lx = 0; lx < len; lx++) { for (lx = 0; lx < len; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1233,7 +1233,7 @@ uint FileStream::getLine(char *buf, uint len) {
len -= 1; // for the terminal null len -= 1; // for the terminal null
gotNewline = false; gotNewline = false;
for (lx = 0; lx < len && !gotNewline; lx++) { for (lx = 0; lx < len && !gotNewline; lx++) {
uint ch; uint32 ch;
ch = getCharUtf8(); ch = getCharUtf8();
if (ch == (uint)-1) if (ch == (uint)-1)
break; break;
@ -1250,7 +1250,7 @@ uint FileStream::getLine(char *buf, uint len) {
gotNewline = false; gotNewline = false;
for (lx = 0; lx < len && !gotNewline; lx++) { for (lx = 0; lx < len && !gotNewline; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1279,7 +1279,7 @@ uint FileStream::getLine(char *buf, uint len) {
} }
} }
uint FileStream::getLineUni(uint *ubuf, uint len) { uint FileStream::getLineUni(uint32 *ubuf, uint len) {
bool gotNewline; bool gotNewline;
int lx; int lx;
@ -1292,7 +1292,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
gotNewline = false; gotNewline = false;
for (lx = 0; lx < (int)len && !gotNewline; lx++) { for (lx = 0; lx < (int)len && !gotNewline; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1307,7 +1307,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
len -= 1; // for the terminal null len -= 1; // for the terminal null
gotNewline = false; gotNewline = false;
for (lx = 0; lx < (int)len && !gotNewline; lx++) { for (lx = 0; lx < (int)len && !gotNewline; lx++) {
uint ch; uint32 ch;
ch = getCharUtf8(); ch = getCharUtf8();
if (ch == (uint)-1) if (ch == (uint)-1)
break; break;
@ -1322,7 +1322,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
gotNewline = false; gotNewline = false;
for (lx = 0; lx < (int)len && !gotNewline; lx++) { for (lx = 0; lx < (int)len && !gotNewline; lx++) {
int res; int res;
uint ch; uint32 ch;
res = _inStream->readByte(); res = _inStream->readByte();
if (res == -1) if (res == -1)
break; break;
@ -1439,7 +1439,7 @@ WindowStream *Streams::openWindowStream(Window *window) {
return stream; return stream;
} }
MemoryStream *Streams::openMemoryStream(void *buf, size_t buflen, FileMode mode, uint32 rock, bool unicode) { MemoryStream *Streams::openMemoryStream(void *buf, size_t buflen, FileMode mode, uint rock, bool unicode) {
MemoryStream *stream = new MemoryStream(this, buf, buflen, mode, rock, unicode); MemoryStream *stream = new MemoryStream(this, buf, buflen, mode, rock, unicode);
addStream(stream); addStream(stream);
return stream; return stream;
@ -1470,7 +1470,7 @@ void Streams::removeStream(Stream *stream) {
} }
} }
Stream *Streams::getFirst(uint32 *rock) { Stream *Streams::getFirst(uint *rock) {
if (rock) if (rock)
*rock = _streamList ? _streamList->_rock : 0; *rock = _streamList ? _streamList->_rock : 0;
return _streamList; return _streamList;

View file

@ -61,8 +61,8 @@ enum SeekMode {
}; };
struct StreamResult { struct StreamResult {
uint32 _readCount; uint _readCount;
uint32 _writeCount; uint _writeCount;
}; };
typedef StreamResult stream_result_t; typedef StreamResult stream_result_t;
@ -135,16 +135,16 @@ public:
Streams *_streams; Streams *_streams;
Stream *_prev; Stream *_prev;
Stream *_next; Stream *_next;
uint32 _rock; uint _rock;
bool _unicode; bool _unicode;
uint32 _readCount; uint _readCount;
uint32 _writeCount; uint _writeCount;
bool _readable, _writable; bool _readable, _writable;
public: public:
/** /**
* Constructor * Constructor
*/ */
Stream(Streams *streams, bool readable, bool writable, uint32 rock, bool unicode); Stream(Streams *streams, bool readable, bool writable, uint rock, bool unicode);
/** /**
* Destructor * Destructor
@ -154,12 +154,12 @@ public:
/** /**
* Get the next stream * Get the next stream
*/ */
Stream *getNext(uint32 *rock) const; Stream *getNext(uint *rock) const;
/** /**
* Get the rock value for the stream * Get the rock value for the stream
*/ */
uint32 getRock() const { uint getRock() const {
return _rock; return _rock;
} }
@ -181,7 +181,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) = 0; virtual void putCharUni(uint32 ch) = 0;
/** /**
* Write a buffer * Write a buffer
@ -191,7 +191,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putBufferUni(const uint *buf, size_t len) = 0; virtual void putBufferUni(const uint32 *buf, size_t len) = 0;
/** /**
* Remove a string from the end of the stream, if indeed it is at the end * Remove a string from the end of the stream, if indeed it is at the end
@ -201,7 +201,7 @@ public:
/** /**
* Remove a string from the end of the stream, if indeed it is at the end * Remove a string from the end of the stream, if indeed it is at the end
*/ */
virtual void unputBufferUni(const uint *buf, size_t len) {} virtual void unputBufferUni(const uint32 *buf, size_t len) {}
/** /**
* Send a line to the stream with a trailing newline * Send a line to the stream with a trailing newline
@ -214,7 +214,7 @@ public:
/** /**
* Send a line to the stream with a trailing newline * Send a line to the stream with a trailing newline
*/ */
void echoLineUni(const uint *buf, uint len) { void echoLineUni(const uint32 *buf, uint len) {
putBufferUni(buf, len); putBufferUni(buf, len);
putCharUni('\n'); putCharUni('\n');
} }
@ -251,7 +251,7 @@ public:
/** /**
* Get a unicode buffer * Get a unicode buffer
*/ */
virtual uint getBufferUni(uint *buf, uint len) { virtual uint getBufferUni(uint32 *buf, uint len) {
return 0; return 0;
} }
@ -265,7 +265,7 @@ public:
/** /**
* Get a unicode line * Get a unicode line
*/ */
virtual uint getLineUni(uint *ubuf, uint len) { virtual uint getLineUni(uint32 *ubuf, uint len) {
return 0; return 0;
} }
@ -306,7 +306,7 @@ public:
/** /**
* Constructor * Constructor
*/ */
WindowStream(Streams *streams, Window *window, uint32 rock = 0, bool unicode = true) : WindowStream(Streams *streams, Window *window, uint rock = 0, bool unicode = true) :
Stream(streams, false, true, rock, unicode), _window(window) {} Stream(streams, false, true, rock, unicode), _window(window) {}
/** /**
@ -327,7 +327,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) override; virtual void putCharUni(uint32 ch) override;
/** /**
* Write a buffer * Write a buffer
@ -337,7 +337,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putBufferUni(const uint *buf, size_t len) override; virtual void putBufferUni(const uint32 *buf, size_t len) override;
/** /**
* Remove a string from the end of the stream, if indeed it is at the end * Remove a string from the end of the stream, if indeed it is at the end
@ -347,7 +347,7 @@ public:
/** /**
* Remove a string from the end of the stream, if indeed it is at the end * Remove a string from the end of the stream, if indeed it is at the end
*/ */
virtual void unputBufferUni(const uint *buf, size_t len) override; virtual void unputBufferUni(const uint32 *buf, size_t len) override;
virtual void setStyle(uint val) override; virtual void setStyle(uint val) override;
@ -381,7 +381,7 @@ public:
/** /**
* Constructor * Constructor
*/ */
MemoryStream(Streams *streams, void *buf, size_t buflen, FileMode mode, uint32 rock = 0, bool unicode = true); MemoryStream(Streams *streams, void *buf, size_t buflen, FileMode mode, uint rock = 0, bool unicode = true);
/** /**
* Write a character * Write a character
@ -391,7 +391,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) override; virtual void putCharUni(uint32 ch) override;
/** /**
* Write a buffer * Write a buffer
@ -401,7 +401,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putBufferUni(const uint *buf, size_t len) override; virtual void putBufferUni(const uint32 *buf, size_t len) override;
virtual uint getPosition() const override; virtual uint getPosition() const override;
@ -425,7 +425,7 @@ public:
/** /**
* Get a unicode buffer * Get a unicode buffer
*/ */
virtual uint getBufferUni(uint *buf, uint len) override; virtual uint getBufferUni(uint32 *buf, uint len) override;
/** /**
* Get a line * Get a line
@ -435,7 +435,7 @@ public:
/** /**
* Get a unicode line * Get a unicode line
*/ */
virtual uint getLineUni(uint *ubuf, uint len) override; virtual uint getLineUni(uint32 *ubuf, uint len) override;
}; };
/** /**
@ -447,7 +447,7 @@ private:
Common::OutSaveFile *_outFile; Common::OutSaveFile *_outFile;
Common::InSaveFile *_inFile; Common::InSaveFile *_inFile;
Common::SeekableReadStream *_inStream; Common::SeekableReadStream *_inStream;
uint32 _lastOp; ///< 0, filemode_Write, or filemode_Read uint _lastOp; ///< 0, filemode_Write, or filemode_Read
bool _textFile; bool _textFile;
private: private:
/** /**
@ -493,7 +493,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) override; virtual void putCharUni(uint32 ch) override;
/** /**
* Write a buffer * Write a buffer
@ -503,7 +503,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putBufferUni(const uint *buf, size_t len) override; virtual void putBufferUni(const uint32 *buf, size_t len) override;
virtual uint getPosition() const override; virtual uint getPosition() const override;
@ -527,7 +527,7 @@ public:
/** /**
* Get a unicode buffer * Get a unicode buffer
*/ */
virtual uint getBufferUni(uint *buf, uint len) override; virtual uint getBufferUni(uint32 *buf, uint len) override;
/** /**
* Get a line * Get a line
@ -537,7 +537,7 @@ public:
/** /**
* Get a unicode line * Get a unicode line
*/ */
virtual uint getLineUni(uint *ubuf, uint len) override; virtual uint getLineUni(uint32 *ubuf, uint len) override;
/** /**
* Cast a stream to a ScummVM write stream * Cast a stream to a ScummVM write stream
@ -593,7 +593,7 @@ public:
/** /**
* Open a memory stream * Open a memory stream
*/ */
MemoryStream *openMemoryStream(void *buf, size_t buflen, FileMode mode, uint32 rock = 0, bool unicode = true); MemoryStream *openMemoryStream(void *buf, size_t buflen, FileMode mode, uint rock = 0, bool unicode = true);
/** /**
* Delete a stream * Delete a stream
@ -605,7 +605,7 @@ public:
/** /**
* Start an Iteration through streams * Start an Iteration through streams
*/ */
Stream *getFirst(uint32 *rock); Stream *getFirst(uint *rock);
/** /**
* Set the current output stream * Set the current output stream

View file

@ -33,11 +33,11 @@ size_t strlen_uni(const uint32 *s) {
return len; return len;
} }
uint bufferChangeCase(uint *buf, uint len, uint numchars, BufferChangeCase destcase, uint bufferChangeCase(uint32 *buf, uint len, uint numchars, BufferChangeCase destcase,
BufferChangeCond cond, int changerest) { BufferChangeCond cond, int changerest) {
uint ix, jx; uint ix, jx;
uint *outbuf; uint32 *outbuf;
uint *newoutbuf; uint32 *newoutbuf;
uint outcount; uint outcount;
int dest_block_rest = 0, dest_block_first = 0; int dest_block_rest = 0, dest_block_first = 0;
int dest_spec_rest = 0, dest_spec_first = 0; int dest_spec_rest = 0, dest_spec_first = 0;
@ -74,7 +74,7 @@ uint bufferChangeCase(uint *buf, uint len, uint numchars, BufferChangeCase destc
uint *special; uint *special;
uint *ptr; uint *ptr;
uint speccount; uint speccount;
uint ch = buf[ix]; uint32 ch = buf[ix];
isfirst = (ix == 0); isfirst = (ix == 0);
@ -121,11 +121,11 @@ uint bufferChangeCase(uint *buf, uint len, uint numchars, BufferChangeCase destc
// Now we have to allocate a new buffer, if we haven't already. // Now we have to allocate a new buffer, if we haven't already.
if (!newoutbuf) { if (!newoutbuf) {
newoutbuf = new uint[len + 1]; newoutbuf = new uint32[len + 1];
if (!newoutbuf) if (!newoutbuf)
return 0; return 0;
if (outcount) if (outcount)
memcpy(newoutbuf, buf, outcount * sizeof(uint)); memcpy(newoutbuf, buf, outcount * sizeof(uint32));
outbuf = newoutbuf; outbuf = newoutbuf;
} }

View file

@ -43,7 +43,7 @@ size_t strlen_uni(const uint32 *s);
* the return value will be the full number of characters that the * the return value will be the full number of characters that the
*converted string should have contained. *converted string should have contained.
*/ */
extern uint bufferChangeCase(uint *buf, uint len, extern uint bufferChangeCase(uint32 *buf, uint len,
uint numchars, BufferChangeCase destcase, BufferChangeCond cond, int changerest); uint numchars, BufferChangeCase destcase, BufferChangeCond cond, int changerest);
} // End of namespace Glk } // End of namespace Glk

View file

@ -27,7 +27,7 @@
namespace Glk { namespace Glk {
GraphicsWindow::GraphicsWindow(Windows *windows, uint32 rock) : Window(windows, rock), GraphicsWindow::GraphicsWindow(Windows *windows, uint rock) : Window(windows, rock),
_w(0), _h(0), _dirty(false), _surface(nullptr) { _w(0), _h(0), _dirty(false), _surface(nullptr) {
_type = wintype_Graphics; _type = wintype_Graphics;
Common::copy(&_bgColor[0], &_bgColor[3], _bgnd); Common::copy(&_bgColor[0], &_bgColor[3], _bgnd);

View file

@ -45,7 +45,7 @@ public:
/** /**
* Constructor * Constructor
*/ */
GraphicsWindow(Windows *windows, uint32 rock); GraphicsWindow(Windows *windows, uint rock);
/** /**
* Destructor * Destructor

View file

@ -36,7 +36,7 @@ namespace Glk {
#define SLOP (2 * GLI_SUBPIX) #define SLOP (2 * GLI_SUBPIX)
TextBufferWindow::TextBufferWindow(Windows *windows, uint32 rock) : Window(windows, rock), TextBufferWindow::TextBufferWindow(Windows *windows, uint rock) : Window(windows, rock),
_historyPos(0), _historyFirst(0), _historyPresent(0), _lastSeen(0), _scrollPos(0), _historyPos(0), _historyFirst(0), _historyPresent(0), _lastSeen(0), _scrollPos(0),
_scrollMax(0), _scrollBack(SCROLLBACK), _width(-1), _height(-1), _inBuf(nullptr), _scrollMax(0), _scrollBack(SCROLLBACK), _width(-1), _height(-1), _inBuf(nullptr),
_lineTerminators(nullptr), _echoLineInput(true), _ladjw(0), _radjw(0), _ladjn(0), _lineTerminators(nullptr), _echoLineInput(true), _ladjw(0), _radjw(0), _ladjn(0),
@ -105,7 +105,7 @@ void TextBufferWindow::rearrange(const Rect &box) {
// allocate copy buffer // allocate copy buffer
if (_copyBuf) if (_copyBuf)
delete[] _copyBuf; delete[] _copyBuf;
_copyBuf = new uint[_height * TBLINELEN]; _copyBuf = new uint32[_height * TBLINELEN];
for (int i = 0; i < (_height * TBLINELEN); i++) for (int i = 0; i < (_height * TBLINELEN); i++)
_copyBuf[i] = 0; _copyBuf[i] = 0;
@ -127,7 +127,7 @@ void TextBufferWindow::reflow() {
// allocate temp buffers // allocate temp buffers
Attributes *attrbuf = new Attributes[SCROLLBACK * TBLINELEN]; Attributes *attrbuf = new Attributes[SCROLLBACK * TBLINELEN];
uint *charbuf = new uint[SCROLLBACK * TBLINELEN]; uint32 *charbuf = new uint32[SCROLLBACK * TBLINELEN];
int *alignbuf = new int[SCROLLBACK]; int *alignbuf = new int[SCROLLBACK];
Picture **pictbuf = new Picture *[SCROLLBACK]; Picture **pictbuf = new Picture *[SCROLLBACK];
uint *hyperbuf = new uint[SCROLLBACK]; uint *hyperbuf = new uint[SCROLLBACK];
@ -330,7 +330,7 @@ void TextBufferWindow::putText(const char *buf, int len, int pos, int oldlen) {
touch(0); touch(0);
} }
void TextBufferWindow::putTextUni(const uint *buf, int len, int pos, int oldlen) { void TextBufferWindow::putTextUni(const uint32 *buf, int len, int pos, int oldlen) {
int diff = len - oldlen; int diff = len - oldlen;
if (_numChars + diff >= TBLINELEN) if (_numChars + diff >= TBLINELEN)
@ -374,7 +374,7 @@ uint TextBufferWindow::getSplit(uint size, bool vertical) const {
return (vertical) ? size * g_conf->_cellW : size * g_conf->_cellH; return (vertical) ? size * g_conf->_cellW : size * g_conf->_cellH;
} }
void TextBufferWindow::putCharUni(uint ch) { void TextBufferWindow::putCharUni(uint32 ch) {
uint bchars[TBLINELEN]; uint bchars[TBLINELEN];
Attributes battrs[TBLINELEN]; Attributes battrs[TBLINELEN];
int pw; int pw;
@ -655,7 +655,7 @@ void TextBufferWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn"); _inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn");
} }
void TextBufferWindow::requestLineEventUni(uint *buf, uint maxlen, uint initlen) { void TextBufferWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
if (_charRequest || _lineRequest || _charRequestUni || _lineRequestUni) { if (_charRequest || _lineRequest || _charRequestUni || _lineRequestUni) {
warning("request_line_event_uni: window already has keyboard request"); warning("request_line_event_uni: window already has keyboard request");
return; return;
@ -742,7 +742,7 @@ void TextBufferWindow::cancelLineEvent(Event *ev) {
if (!unicode) { if (!unicode) {
for (ix = 0; ix < len; ix++) { for (ix = 0; ix < len; ix++) {
uint ch = _chars[_inFence + ix]; uint32 ch = _chars[_inFence + ix];
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
((char *)inbuf)[ix] = (char)ch; ((char *)inbuf)[ix] = (char)ch;
@ -1238,7 +1238,7 @@ void TextBufferWindow::acceptReadChar(uint arg) {
g_vm->_events->store(evtype_CharInput, this, key, 0); g_vm->_events->store(evtype_CharInput, this, key, 0);
} }
void TextBufferWindow::acceptReadLine(uint arg) { void TextBufferWindow::acceptReadLine(uint32 arg) {
uint *cx; uint *cx;
Common::U32String s; Common::U32String s;
int len; int len;
@ -1368,7 +1368,7 @@ void TextBufferWindow::acceptReadLine(uint arg) {
touch(0); touch(0);
} }
void TextBufferWindow::acceptLine(uint keycode) { void TextBufferWindow::acceptLine(uint32 keycode) {
int ix; int ix;
int len, olen; int len, olen;
void *inbuf; void *inbuf;
@ -1392,7 +1392,7 @@ void TextBufferWindow::acceptLine(uint keycode) {
if (g_conf->_speakInput) { if (g_conf->_speakInput) {
const uint32 NEWLINE = '\n'; const uint32 NEWLINE = '\n';
gli_tts_speak(_chars + _inFence, len); gli_tts_speak(_chars + _inFence, len);
gli_tts_speak((const uint *)&NEWLINE, 1); gli_tts_speak((const uint32 *)&NEWLINE, 1);
} }
/* /*
@ -1429,7 +1429,7 @@ void TextBufferWindow::acceptLine(uint keycode) {
if (!unicode) { if (!unicode) {
for (ix = 0; ix < len; ix++) { for (ix = 0; ix < len; ix++) {
uint ch = _chars[_inFence + ix]; uint32 ch = _chars[_inFence + ix];
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
((char *)inbuf)[ix] = (char)ch; ((char *)inbuf)[ix] = (char)ch;
@ -1468,7 +1468,7 @@ void TextBufferWindow::acceptLine(uint keycode) {
(*g_vm->gli_unregister_arr)(inbuf, inmax, unicode ? "&+#!Iu" : "&+#!Cn", inarrayrock); (*g_vm->gli_unregister_arr)(inbuf, inmax, unicode ? "&+#!Iu" : "&+#!Cn", inarrayrock);
} }
bool TextBufferWindow::leftquote(uint c) { bool TextBufferWindow::leftquote(uint32 c) {
switch (c) { switch (c) {
case '(': case '(':
case '[': case '[':
@ -1580,7 +1580,7 @@ void TextBufferWindow::scrollResize() {
_scrollBack += SCROLLBACK; _scrollBack += SCROLLBACK;
} }
int TextBufferWindow::calcWidth(uint *chars, Attributes *attrs, int startchar, int TextBufferWindow::calcWidth(uint32 *chars, Attributes *attrs, int startchar,
int numChars, int spw) { int numChars, int spw) {
Screen &screen = *g_vm->_screen; Screen &screen = *g_vm->_screen;
int w = 0; int w = 0;

View file

@ -39,7 +39,7 @@ class TextBufferWindow : public Window, Speech {
* Structure for a row within the window * Structure for a row within the window
*/ */
struct TextBufferRow { struct TextBufferRow {
uint _chars[TBLINELEN]; uint32 _chars[TBLINELEN];
Attributes _attrs[TBLINELEN]; Attributes _attrs[TBLINELEN];
int _len, _newLine; int _len, _newLine;
bool _dirty, _repaint; bool _dirty, _repaint;
@ -66,12 +66,12 @@ private:
/** /**
* @remarks Only for input text * @remarks Only for input text
*/ */
void putTextUni(const uint *buf, int len, int pos, int oldlen); void putTextUni(const uint32 *buf, int len, int pos, int oldlen);
/** /**
* Return or enter, during line input. Ends line input. * Return or enter, during line input. Ends line input.
*/ */
void acceptLine(uint keycode); void acceptLine(uint32 keycode);
/** /**
* Return true if a following quotation mark should be an opening mark, * Return true if a following quotation mark should be an opening mark,
@ -79,7 +79,7 @@ private:
* appear following an open parenthesis, open square bracket, or * appear following an open parenthesis, open square bracket, or
* whitespace. * whitespace.
*/ */
bool leftquote(uint c); bool leftquote(uint32 c);
/** /**
* Mark a given text row as modified * Mark a given text row as modified
@ -88,7 +88,7 @@ private:
void scrollOneLine(bool forced); void scrollOneLine(bool forced);
void scrollResize(); void scrollResize();
int calcWidth(uint *chars, Attributes *attrs, int startchar, int numchars, int spw); int calcWidth(uint32 *chars, Attributes *attrs, int startchar, int numchars, int spw);
public: public:
int _width, _height; int _width, _height;
int _spaced; int _spaced;
@ -98,7 +98,7 @@ public:
int _scrollBack; int _scrollBack;
int _numChars; ///< number of chars in last line: lines[0] int _numChars; ///< number of chars in last line: lines[0]
uint *_chars; ///< alias to lines[0].chars uint32 *_chars; ///< alias to lines[0].chars
Attributes *_attrs; ///< alias to lines[0].attrs Attributes *_attrs; ///< alias to lines[0].attrs
///< adjust margins temporarily for images ///< adjust margins temporarily for images
@ -132,13 +132,13 @@ public:
WindowStyle _styles[style_NUMSTYLES]; WindowStyle _styles[style_NUMSTYLES];
// for copy selection // for copy selection
uint *_copyBuf; uint32 *_copyBuf;
int _copyPos; int _copyPos;
public: public:
/** /**
* Constructor * Constructor
*/ */
TextBufferWindow(Windows *windows, uint32 rock); TextBufferWindow(Windows *windows, uint rock);
/** /**
* Destructor * Destructor
@ -162,7 +162,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) override; virtual void putCharUni(uint32 ch) override;
/** /**
* Unput a unicode character * Unput a unicode character
@ -187,7 +187,7 @@ public:
/** /**
* Prepare for inputing a line * Prepare for inputing a line
*/ */
virtual void requestLineEventUni(uint *buf, uint maxlen, uint initlen) override; virtual void requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) override;
/** /**
* Cancel an input line event * Cancel an input line event
@ -206,7 +206,7 @@ public:
*/ */
virtual void redraw() override; virtual void redraw() override;
virtual void acceptReadLine(uint arg) override; virtual void acceptReadLine(uint32 arg) override;
virtual void acceptReadChar(uint arg) override; virtual void acceptReadChar(uint arg) override;

View file

@ -28,7 +28,7 @@
namespace Glk { namespace Glk {
TextGridWindow::TextGridWindow(Windows *windows, uint32 rock) : Window(windows, rock) { TextGridWindow::TextGridWindow(Windows *windows, uint rock) : Window(windows, rock) {
_type = wintype_TextGrid; _type = wintype_TextGrid;
_width = _height = 0; _width = _height = 0;
_curX = _curY = 0; _curX = _curY = 0;
@ -254,10 +254,10 @@ void TextGridWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
} }
if (_lineTerminatorsBase && _termCt) { if (_lineTerminatorsBase && _termCt) {
_lineTerminators = new uint[_termCt + 1]; _lineTerminators = new uint32[_termCt + 1];
if (_lineTerminators) { if (_lineTerminators) {
memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint)); memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint32));
_lineTerminators[_termCt] = 0; _lineTerminators[_termCt] = 0;
} }
} }
@ -266,7 +266,7 @@ void TextGridWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn"); _inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn");
} }
void TextGridWindow::requestLineEventUni(uint *buf, uint maxlen, uint initlen) { void TextGridWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
if (_charRequest || _lineRequest || _charRequestUni || _lineRequestUni) { if (_charRequest || _lineRequest || _charRequestUni || _lineRequestUni) {
warning("requestLineEventUni: window already has keyboard request"); warning("requestLineEventUni: window already has keyboard request");
return; return;
@ -306,7 +306,7 @@ void TextGridWindow::requestLineEventUni(uint *buf, uint maxlen, uint initlen) {
} }
if (_lineTerminatorsBase && _termCt) { if (_lineTerminatorsBase && _termCt) {
_lineTerminators = new uint[_termCt + 1]; _lineTerminators = new uint32[_termCt + 1];
if (_lineTerminators) { if (_lineTerminators) {
memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint)); memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint));
@ -342,7 +342,7 @@ void TextGridWindow::cancelLineEvent(Event *ev) {
if (!unicode) { if (!unicode) {
for (ix = 0; ix < _inLen; ix++) { for (ix = 0; ix < _inLen; ix++) {
uint ch = ln->_chars[_inOrgX + ix]; uint32 ch = ln->_chars[_inOrgX + ix];
if (ch > 0xff) if (ch > 0xff)
ch = '?'; ch = '?';
((char *)inbuf)[ix] = (char)ch; ((char *)inbuf)[ix] = (char)ch;
@ -353,7 +353,7 @@ void TextGridWindow::cancelLineEvent(Event *ev) {
for (ix = 0; ix < _inLen; ix++) for (ix = 0; ix < _inLen; ix++)
((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix]; ((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix];
if (_echoStream) if (_echoStream)
_echoStream->echoLineUni((uint *)inbuf, _inLen); _echoStream->echoLineUni((uint32 *)inbuf, _inLen);
} }
_curY = _inOrgY + 1; _curY = _inOrgY + 1;
@ -406,7 +406,7 @@ void TextGridWindow::acceptReadChar(uint arg) {
g_vm->_events->store(evtype_CharInput, this, key, 0); g_vm->_events->store(evtype_CharInput, this, key, 0);
} }
void TextGridWindow::acceptLine(uint keycode) { void TextGridWindow::acceptLine(uint32 keycode) {
int ix; int ix;
void *inbuf; void *inbuf;
int inmax; int inmax;
@ -430,7 +430,7 @@ void TextGridWindow::acceptLine(uint keycode) {
for (ix = 0; ix < _inLen; ix++) for (ix = 0; ix < _inLen; ix++)
((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix]; ((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix];
if (_echoStream) if (_echoStream)
_echoStream->echoLineUni((uint *)inbuf, _inLen); _echoStream->echoLineUni((const uint32 *)inbuf, _inLen);
} }
_curY = _inOrgY + 1; _curY = _inOrgY + 1;
@ -458,7 +458,7 @@ void TextGridWindow::acceptLine(uint keycode) {
(*g_vm->gli_unregister_arr)(inbuf, inmax, unicode ? "&+#!Iu" : "&+#!Cn", inarrayrock); (*g_vm->gli_unregister_arr)(inbuf, inmax, unicode ? "&+#!Iu" : "&+#!Cn", inarrayrock);
} }
void TextGridWindow::acceptReadLine(uint arg) { void TextGridWindow::acceptReadLine(uint32 arg) {
int ix; int ix;
TextGridRow *ln = &(_lines[_inOrgY]); TextGridRow *ln = &(_lines[_inOrgY]);
@ -466,7 +466,7 @@ void TextGridWindow::acceptReadLine(uint arg) {
return; return;
if (_lineTerminators && checkTerminator(arg)) { if (_lineTerminators && checkTerminator(arg)) {
uint *cx; const uint32 *cx;
for (cx = _lineTerminators; *cx; cx++) { for (cx = _lineTerminators; *cx; cx++) {
if (*cx == arg) { if (*cx == arg) {
acceptLine(arg); acceptLine(arg);

View file

@ -59,7 +59,7 @@ private:
/** /**
* Return or enter, during line input. Ends line input. * Return or enter, during line input. Ends line input.
*/ */
void acceptLine(uint keycode); void acceptLine(uint32 keycode);
public: public:
int _width, _height; int _width, _height;
TextGridRows _lines; TextGridRows _lines;
@ -67,20 +67,20 @@ public:
int _curX, _curY; ///< the window cursor position int _curX, _curY; ///< the window cursor position
///< for line input ///< for line input
void *_inBuf; ///< unsigned char* for latin1, uint* for unicode void *_inBuf; ///< unsigned char* for latin1, uint32* for unicode
int _inOrgX, _inOrgY; int _inOrgX, _inOrgY;
int _inMax; int _inMax;
int _inCurs, _inLen; int _inCurs, _inLen;
Attributes _origAttr; Attributes _origAttr;
gidispatch_rock_t _inArrayRock; gidispatch_rock_t _inArrayRock;
uint *_lineTerminators; uint32 *_lineTerminators;
WindowStyle _styles[style_NUMSTYLES]; ///< style hints and settings WindowStyle _styles[style_NUMSTYLES]; ///< style hints and settings
public: public:
/** /**
* Constructor * Constructor
*/ */
TextGridWindow(Windows *windows, uint32 rock); TextGridWindow(Windows *windows, uint rock);
/** /**
* Destructor * Destructor
@ -100,7 +100,7 @@ public:
/** /**
* Write a unicode character * Write a unicode character
*/ */
virtual void putCharUni(uint ch) override; virtual void putCharUni(uint32 ch) override;
/** /**
* Unput a unicode character * Unput a unicode character
@ -139,7 +139,7 @@ public:
*/ */
virtual void redraw() override; virtual void redraw() override;
virtual void acceptReadLine(uint arg) override; virtual void acceptReadLine(uint32 arg) override;
virtual void acceptReadChar(uint arg) override; virtual void acceptReadChar(uint arg) override;
@ -157,7 +157,7 @@ public:
/** /**
* Prepare for inputing a line * Prepare for inputing a line
*/ */
virtual void requestLineEventUni(uint *buf, uint maxlen, uint initlen) override; virtual void requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) override;
/** /**
* Cancel an input line event * Cancel an input line event

View file

@ -574,7 +574,7 @@ void Window::requestLineEvent(char *buf, uint maxlen, uint initlen) {
warning("requestLineEvent: window does not support keyboard input"); warning("requestLineEvent: window does not support keyboard input");
} }
void Window::requestLineEventUni(uint *buf, uint maxlen, uint initlen) { void Window::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
warning("requestLineEventUni: window does not support keyboard input"); warning("requestLineEventUni: window does not support keyboard input");
} }
@ -586,7 +586,7 @@ void Window::redraw() {
} }
} }
void Window::acceptReadLine(uint arg) { void Window::acceptReadLine(uint32 arg) {
warning("acceptReadLine:: window does not support keyboard input"); warning("acceptReadLine:: window does not support keyboard input");
} }
@ -631,7 +631,7 @@ const WindowStyle *Window::getStyles() const {
return nullptr; return nullptr;
} }
void Window::setTerminatorsLineEvent(uint *keycodes, uint count) { void Window::setTerminatorsLineEvent(const uint32 *keycodes, uint count) {
if (dynamic_cast<TextBufferWindow *>(this) || dynamic_cast<TextGridWindow *>(this)) { if (dynamic_cast<TextBufferWindow *>(this) || dynamic_cast<TextGridWindow *>(this)) {
delete _lineTerminatorsBase; delete _lineTerminatorsBase;
_lineTerminatorsBase = nullptr; _lineTerminatorsBase = nullptr;
@ -651,7 +651,7 @@ void Window::setTerminatorsLineEvent(uint *keycodes, uint count) {
} }
} }
bool Window::checkTerminator(uint ch) { bool Window::checkTerminator(uint32 ch) {
if (ch == keycode_Escape) if (ch == keycode_Escape)
return true; return true;
else if (ch >= keycode_Func12 && ch <= keycode_Func1) else if (ch >= keycode_Func12 && ch <= keycode_Func1)
@ -684,7 +684,7 @@ void Window::getSize(uint *width, uint *height) const {
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
BlankWindow::BlankWindow(Windows *windows, uint32 rock) : Window(windows, rock) { BlankWindow::BlankWindow(Windows *windows, uint rock) : Window(windows, rock) {
_type = wintype_Blank; _type = wintype_Blank;
} }

View file

@ -396,12 +396,12 @@ public:
gidispatch_rock_t _dispRock; gidispatch_rock_t _dispRock;
public: public:
static bool checkTerminator(uint ch); static bool checkTerminator(uint32 ch);
public: public:
/** /**
* Constructor * Constructor
*/ */
Window(Windows *windows, uint32 rock); Window(Windows *windows, uint rock);
/** /**
* Destructor * Destructor
@ -430,7 +430,7 @@ public:
/** /**
* Write a character * Write a character
*/ */
virtual void putCharUni(uint ch) {} virtual void putCharUni(uint32 ch) {}
/** /**
* Unput a unicode character * Unput a unicode character
@ -467,7 +467,7 @@ public:
/** /**
* Prepare for inputing a line * Prepare for inputing a line
*/ */
virtual void requestLineEventUni(uint *buf, uint maxlen, uint initlen); virtual void requestLineEventUni(uint32 *buf, uint maxlen, uint initlen);
/** /**
* Cancel an input line event * Cancel an input line event
@ -498,9 +498,9 @@ public:
int acceptScroll(uint arg); int acceptScroll(uint arg);
void setTerminatorsLineEvent(uint *keycodes, uint count); void setTerminatorsLineEvent(const uint32 *keycodes, uint count);
virtual void acceptReadLine(uint arg); virtual void acceptReadLine(uint32 arg);
virtual void acceptReadChar(uint arg); virtual void acceptReadChar(uint arg);
@ -543,7 +543,7 @@ public:
/** /**
* Constructor * Constructor
*/ */
BlankWindow(Windows *windows, uint32 rock); BlankWindow(Windows *windows, uint rock);
}; };
} // End of namespace Glk } // End of namespace Glk

View file

@ -448,7 +448,7 @@ void MacTextWindow::drawInput() {
// Now recalc new text height // Now recalc new text height
_fontRef->wordWrapText(_inputText, _maxWidth, text); _fontRef->wordWrapText(_inputText, _maxWidth, text);
_inputTextHeight = MAX(1u, text.size()); // We always have line to clean _inputTextHeight = MAX((uint)1, text.size()); // We always have line to clean
// And add new input line to the text // And add new input line to the text
appendText(_inputText, _font, true); appendText(_inputText, _font, true);