GLK: Standardizing uint vs uint32 usage
This commit is contained in:
parent
fc8b55578b
commit
e232d024c5
22 changed files with 207 additions and 215 deletions
|
@ -142,7 +142,7 @@ void Events::getEvent(event_t *event, bool polled) {
|
|||
_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);
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -110,7 +110,7 @@ enum CursorId {
|
|||
struct Event {
|
||||
EvType type;
|
||||
Window *window;
|
||||
uint32 val1, val2;
|
||||
uint val1, val2;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -122,7 +122,7 @@ struct Event {
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Event(EvType evType, Window *evWindow, uint32 evVal1, uint32 evVal2) {
|
||||
Event(EvType evType, Window *evWindow, uint evVal1, uint evVal2) {
|
||||
type = evType;
|
||||
window = evWindow;
|
||||
val1 = evVal1;
|
||||
|
@ -241,7 +241,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
|
|
@ -202,7 +202,7 @@ enum FontStyle {
|
|||
#define MENU_REMOVE 2
|
||||
|
||||
typedef byte zbyte;
|
||||
typedef uint zchar;
|
||||
typedef uint32 zchar;
|
||||
typedef uint16 zword;
|
||||
|
||||
#define MAX_NESTING 16
|
||||
|
|
|
@ -425,7 +425,7 @@ void GlkInterface::packspaces(zchar *src, zchar *dst) {
|
|||
|
||||
void GlkInterface::smartstatusline() {
|
||||
zchar packed[256];
|
||||
uint buf[256];
|
||||
uint32 buf[256];
|
||||
zchar *a, *b, *c, *d;
|
||||
int roomlen, scorelen, scoreofs;
|
||||
int len, tmp;
|
||||
|
|
|
@ -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) {
|
||||
warning("set_terminators_line_event: invalid ref");
|
||||
} 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
void GlkAPI::glk_put_string_uni(uint *s) {
|
||||
void GlkAPI::glk_put_string_uni(const uint32 *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);
|
||||
}
|
||||
|
||||
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) {
|
||||
str->putCharUni(ch);
|
||||
} 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) {
|
||||
str->putBufferUni(s, strlen_uni(s));
|
||||
} 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) {
|
||||
str->putBufferUni(buf, len);
|
||||
} 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) {
|
||||
return str->getBufferUni(buf, len);
|
||||
} 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) {
|
||||
return str->getLineUni(buf, len);
|
||||
} 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
warning("request_line_event_uni: invalid ref");
|
||||
} 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 numchars) {
|
||||
uint GlkAPI::glk_buffer_canon_decompose_uni(uint32 *buf, uint len, uint numchars) {
|
||||
// TODO
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1181,7 +1180,7 @@ void GlkAPI::garglk_unput_string(const char *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));
|
||||
}
|
||||
|
||||
|
|
|
@ -145,47 +145,40 @@ public:
|
|||
#endif /* GLK_MODULE_LINE_ECHO */
|
||||
|
||||
#ifdef GLK_MODULE_LINE_TERMINATORS
|
||||
void glk_set_terminators_line_event(winid_t win, uint *keycodes,
|
||||
uint count);
|
||||
void glk_set_terminators_line_event(winid_t win, const uint32 *keycodes, uint count);
|
||||
#endif /* GLK_MODULE_LINE_TERMINATORS */
|
||||
|
||||
/** \addtogroup Unicode
|
||||
* @{
|
||||
*/
|
||||
|
||||
uint glk_buffer_to_lower_case_uni(uint *buf, uint len,
|
||||
uint numchars);
|
||||
uint glk_buffer_to_upper_case_uni(uint *buf, uint len,
|
||||
uint numchars);
|
||||
uint glk_buffer_to_title_case_uni(uint *buf, uint len,
|
||||
uint numchars, uint lowerrest);
|
||||
uint glk_buffer_to_lower_case_uni(uint32 *buf, uint len, uint numchars);
|
||||
uint glk_buffer_to_upper_case_uni(uint32 *buf, uint len, uint numchars);
|
||||
uint glk_buffer_to_title_case_uni(uint32 *buf, uint len, uint numchars, uint lowerrest);
|
||||
|
||||
void glk_put_char_uni(uint ch);
|
||||
void glk_put_string_uni(uint *s);
|
||||
void glk_put_buffer_uni(uint *buf, uint len);
|
||||
void glk_put_char_stream_uni(strid_t str, uint ch);
|
||||
void glk_put_string_stream_uni(strid_t str, const uint *s);
|
||||
void glk_put_buffer_stream_uni(strid_t str, const uint *buf, uint len);
|
||||
void glk_put_char_uni(uint32 ch);
|
||||
void glk_put_string_uni(const uint32 *s);
|
||||
void glk_put_buffer_uni(const uint32 *buf, uint len);
|
||||
void glk_put_char_stream_uni(strid_t str, uint32 ch);
|
||||
void glk_put_string_stream_uni(strid_t str, const uint32 *s);
|
||||
void glk_put_buffer_stream_uni(strid_t str, const uint32 *buf, uint len);
|
||||
|
||||
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_line_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, uint32 *buf, uint len);
|
||||
|
||||
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_line_event_uni(winid_t win, uint *buf,
|
||||
uint maxlen, uint initlen);
|
||||
void glk_request_line_event_uni(winid_t win, uint32 *buf, uint maxlen, uint initlen);
|
||||
|
||||
/** @}*/
|
||||
|
||||
#ifdef GLK_MODULE_UNICODE_NORM
|
||||
|
||||
uint glk_buffer_canon_decompose_uni(uint *buf, uint len,
|
||||
uint numchars);
|
||||
uint glk_buffer_canon_normalize_uni(uint *buf, uint len,
|
||||
uint numchars);
|
||||
uint glk_buffer_canon_decompose_uni(uint32 *buf, uint len, uint numchars);
|
||||
uint glk_buffer_canon_normalize_uni(uint32 *buf, uint len, uint numchars);
|
||||
|
||||
#endif /* GLK_MODULE_UNICODE_NORM */
|
||||
|
||||
|
@ -281,7 +274,7 @@ public:
|
|||
* Removes the specified string from the end of the output buffer, if
|
||||
* 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_stream(strid_t str, uint fg, uint bg);
|
||||
|
|
|
@ -199,10 +199,10 @@ enum giDisp {
|
|||
};
|
||||
|
||||
enum zcolor {
|
||||
zcolor_Transparent = (uint32) - 4,
|
||||
zcolor_Cursor = (uint32) - 3,
|
||||
zcolor_Current = (uint32) - 2,
|
||||
zcolor_Default = (uint32) - 1
|
||||
zcolor_Transparent = (uint)-4,
|
||||
zcolor_Cursor = (uint)-3,
|
||||
zcolor_Current = (uint)-2,
|
||||
zcolor_Default = (uint)-1
|
||||
};
|
||||
|
||||
#ifdef GLK_MODULE_IMAGE
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Glk {
|
|||
struct Picture : Graphics::ManagedSurface {
|
||||
public:
|
||||
int _refCount;
|
||||
uint32 _id;
|
||||
uint _id;
|
||||
bool _scaled;
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
|||
|
||||
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) {}
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
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),
|
||||
_readCount(0), _writeCount(0), _prev(nullptr), _next(nullptr) {
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ Stream::~Stream() {
|
|||
_streams->removeStream(this);
|
||||
}
|
||||
|
||||
Stream *Stream::getNext(uint32 *rock) const {
|
||||
Stream *Stream::getNext(uint *rock) const {
|
||||
Stream *stream = _next;
|
||||
if (rock)
|
||||
*rock = stream ? stream->_rock : 0;
|
||||
|
@ -188,9 +188,9 @@ void WindowStream::unputBuffer(const char *buf, size_t 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;
|
||||
const uint *cx;
|
||||
const uint32 *cx;
|
||||
|
||||
if (!_writable)
|
||||
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),
|
||||
_buf(buf), _bufLen(buflen), _bufPtr(buf) {
|
||||
assert(_buf && _bufLen);
|
||||
|
@ -326,8 +326,8 @@ void MemoryStream::putChar(unsigned char ch) {
|
|||
|
||||
if (_bufPtr < _bufEnd) {
|
||||
if (_unicode) {
|
||||
*((uint *)_bufPtr) = ch;
|
||||
_bufPtr = ((uint *)_bufPtr) + 1;
|
||||
*((uint32 *)_bufPtr) = ch;
|
||||
_bufPtr = ((uint32 *)_bufPtr) + 1;
|
||||
} else {
|
||||
*((unsigned char *)_bufPtr) = ch;
|
||||
_bufPtr = ((unsigned char *)_bufPtr) + 1;
|
||||
|
@ -345,8 +345,8 @@ void MemoryStream::putCharUni(uint32 ch) {
|
|||
|
||||
if (_bufPtr < _bufEnd) {
|
||||
if (_unicode) {
|
||||
*((uint *)_bufPtr) = ch;
|
||||
_bufPtr = ((uint *)_bufPtr) + 1;
|
||||
*((uint32 *)_bufPtr) = ch;
|
||||
_bufPtr = ((uint32 *)_bufPtr) + 1;
|
||||
} else {
|
||||
*((unsigned char *)_bufPtr) = (unsigned char)ch;
|
||||
_bufPtr = ((unsigned char *)_bufPtr) + 1;
|
||||
|
@ -383,9 +383,9 @@ void MemoryStream::putBuffer(const char *buf, size_t len) {
|
|||
}
|
||||
_bufPtr = bp;
|
||||
} else {
|
||||
uint *bp = (uint *)_bufPtr;
|
||||
if (bp + len > (uint *)_bufEnd) {
|
||||
lx = (bp + len) - (uint *)_bufEnd;
|
||||
uint32 *bp = (uint32 *)_bufPtr;
|
||||
if (bp + len > (uint32 *)_bufEnd) {
|
||||
lx = (bp + len) - (uint32 *)_bufEnd;
|
||||
if (lx < len)
|
||||
len -= lx;
|
||||
else
|
||||
|
@ -396,7 +396,7 @@ void MemoryStream::putBuffer(const char *buf, size_t len) {
|
|||
for (i = 0; i < len; i++)
|
||||
bp[i] = buf[i];
|
||||
bp += len;
|
||||
if (bp > (uint *)_bufEof)
|
||||
if (bp > (uint32 *)_bufEof)
|
||||
_bufEof = bp;
|
||||
}
|
||||
_bufPtr = bp;
|
||||
|
@ -426,7 +426,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
|
|||
if (len) {
|
||||
uint i;
|
||||
for (i = 0; i < len; i++) {
|
||||
uint ch = buf[i];
|
||||
uint32 ch = buf[i];
|
||||
if (ch > 0xff)
|
||||
ch = '?';
|
||||
bp[i] = (unsigned char)ch;
|
||||
|
@ -437,9 +437,9 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
|
|||
}
|
||||
_bufPtr = bp;
|
||||
} else {
|
||||
uint *bp = (uint *)_bufPtr;
|
||||
if (bp + len > (uint *)_bufEnd) {
|
||||
lx = (bp + len) - (uint *)_bufEnd;
|
||||
uint32 *bp = (uint32 *)_bufPtr;
|
||||
if (bp + len > (uint32 *)_bufEnd) {
|
||||
lx = (bp + len) - (uint32 *)_bufEnd;
|
||||
if (lx < len)
|
||||
len -= lx;
|
||||
else
|
||||
|
@ -448,7 +448,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
|
|||
if (len) {
|
||||
memmove(bp, buf, len * 4);
|
||||
bp += len;
|
||||
if (bp > (uint *)_bufEof)
|
||||
if (bp > (uint32 *)_bufEof)
|
||||
_bufEof = bp;
|
||||
}
|
||||
_bufPtr = bp;
|
||||
|
@ -458,7 +458,7 @@ void MemoryStream::putBufferUni(const uint32 *buf, size_t len) {
|
|||
|
||||
uint MemoryStream::getPosition() const {
|
||||
if (_unicode)
|
||||
return ((uint *)_bufPtr - (uint *)_buf);
|
||||
return ((uint32 *)_bufPtr - (uint32 *)_buf);
|
||||
else
|
||||
return ((unsigned char *)_bufPtr - (unsigned char *)_buf);
|
||||
}
|
||||
|
@ -480,15 +480,15 @@ void MemoryStream::setPosition(int pos, uint seekMode) {
|
|||
_bufPtr = (unsigned char *)_buf + pos;
|
||||
} else {
|
||||
if (seekMode == seekmode_Current)
|
||||
pos = ((uint *)_bufPtr - (uint *)_buf) + pos;
|
||||
pos = ((uint32 *)_bufPtr - (uint32 *)_buf) + pos;
|
||||
else if (seekMode == seekmode_End)
|
||||
pos = ((uint *)_bufEof - (uint *)_buf) + pos;
|
||||
pos = ((uint32 *)_bufEof - (uint32 *)_buf) + pos;
|
||||
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
if (pos > ((uint *)_bufEof - (uint *)_buf))
|
||||
pos = ((uint *)_bufEof - (uint *)_buf);
|
||||
_bufPtr = (uint *)_buf + pos;
|
||||
if (pos > ((uint32 *)_bufEof - (uint32 *)_buf))
|
||||
pos = ((uint32 *)_bufEof - (uint32 *)_buf);
|
||||
_bufPtr = (uint32 *)_buf + pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,9 +504,9 @@ int MemoryStream::getChar() {
|
|||
_readCount++;
|
||||
return ch;
|
||||
} else {
|
||||
uint ch;
|
||||
ch = *((uint *)_bufPtr);
|
||||
_bufPtr = ((uint *)_bufPtr) + 1;
|
||||
uint32 ch;
|
||||
ch = *((uint32 *)_bufPtr);
|
||||
_bufPtr = ((uint32 *)_bufPtr) + 1;
|
||||
_readCount++;
|
||||
if (ch > 0xff)
|
||||
ch = '?';
|
||||
|
@ -529,9 +529,9 @@ int MemoryStream::getCharUni() {
|
|||
_readCount++;
|
||||
return ch;
|
||||
} else {
|
||||
uint ch;
|
||||
ch = *((uint *)_bufPtr);
|
||||
_bufPtr = ((uint *)_bufPtr) + 1;
|
||||
uint32 ch;
|
||||
ch = *((uint32 *)_bufPtr);
|
||||
_bufPtr = ((uint32 *)_bufPtr) + 1;
|
||||
_readCount++;
|
||||
return ch;
|
||||
}
|
||||
|
@ -568,10 +568,10 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
|
|||
_readCount += len;
|
||||
_bufPtr = bp;
|
||||
} else {
|
||||
uint *bp = (uint *)_bufPtr;
|
||||
if (bp + len > (uint *)_bufEnd) {
|
||||
uint32 *bp = (uint32 *)_bufPtr;
|
||||
if (bp + len > (uint32 *)_bufEnd) {
|
||||
uint lx;
|
||||
lx = (bp + len) - (uint *)_bufEnd;
|
||||
lx = (bp + len) - (uint32 *)_bufEnd;
|
||||
if (lx < len)
|
||||
len -= lx;
|
||||
else
|
||||
|
@ -580,12 +580,12 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
|
|||
if (len) {
|
||||
uint i;
|
||||
for (i = 0; i < len; i++) {
|
||||
uint ch = *bp++;
|
||||
uint32 ch = *bp++;
|
||||
if (ch > 0xff)
|
||||
ch = '?';
|
||||
*buf++ = (char)ch;
|
||||
}
|
||||
if (bp > (uint *)_bufEof)
|
||||
if (bp > (uint32 *)_bufEof)
|
||||
_bufEof = bp;
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ uint MemoryStream::getBuffer(char *buf, uint len) {
|
|||
return len;
|
||||
}
|
||||
|
||||
uint MemoryStream::getBufferUni(uint *buf, uint len) {
|
||||
uint MemoryStream::getBufferUni(uint32 *buf, uint len) {
|
||||
if (!_readable)
|
||||
return 0;
|
||||
|
||||
|
@ -625,10 +625,10 @@ uint MemoryStream::getBufferUni(uint *buf, uint len) {
|
|||
_readCount += len;
|
||||
_bufPtr = bp;
|
||||
} else {
|
||||
uint *bp = (uint *)_bufPtr;
|
||||
if (bp + len > (uint *)_bufEnd) {
|
||||
uint32 *bp = (uint32 *)_bufPtr;
|
||||
if (bp + len > (uint32 *)_bufEnd) {
|
||||
uint lx;
|
||||
lx = (bp + len) - (uint *)_bufEnd;
|
||||
lx = (bp + len) - (uint32 *)_bufEnd;
|
||||
if (lx < len)
|
||||
len -= lx;
|
||||
else
|
||||
|
@ -637,7 +637,7 @@ uint MemoryStream::getBufferUni(uint *buf, uint len) {
|
|||
if (len) {
|
||||
memcpy(buf, bp, len * 4);
|
||||
bp += len;
|
||||
if (bp > (uint *)_bufEof)
|
||||
if (bp > (uint32 *)_bufEof)
|
||||
_bufEof = bp;
|
||||
}
|
||||
_readCount += len;
|
||||
|
@ -692,8 +692,8 @@ uint MemoryStream::getLine(char *buf, uint len) {
|
|||
|
||||
gotNewline = false;
|
||||
for (lx = 0; lx < len && !gotNewline; lx++) {
|
||||
uint ch;
|
||||
ch = ((uint *)_bufPtr)[lx];
|
||||
uint32 ch;
|
||||
ch = ((uint32 *)_bufPtr)[lx];
|
||||
if (ch >= 0x100)
|
||||
ch = '?';
|
||||
buf[lx] = (char)ch;
|
||||
|
@ -701,14 +701,14 @@ uint MemoryStream::getLine(char *buf, uint len) {
|
|||
}
|
||||
|
||||
buf[lx] = '\0';
|
||||
_bufPtr = ((uint *)_bufPtr) + lx;
|
||||
_bufPtr = ((uint32 *)_bufPtr) + lx;
|
||||
}
|
||||
|
||||
_readCount += lx;
|
||||
return lx;
|
||||
}
|
||||
|
||||
uint MemoryStream::getLineUni(uint *ubuf, uint len) {
|
||||
uint MemoryStream::getLineUni(uint32 *ubuf, uint len) {
|
||||
bool gotNewline;
|
||||
int lx;
|
||||
|
||||
|
@ -739,8 +739,8 @@ uint MemoryStream::getLineUni(uint *ubuf, uint len) {
|
|||
if (_bufPtr >= _bufEnd) {
|
||||
len = 0;
|
||||
} else {
|
||||
if ((uint *)_bufPtr + len > (uint *)_bufEnd) {
|
||||
lx = ((uint *)_bufPtr + len) - (uint *)_bufEnd;
|
||||
if ((uint32 *)_bufPtr + len > (uint32 *)_bufEnd) {
|
||||
lx = ((uint32 *)_bufPtr + len) - (uint32 *)_bufEnd;
|
||||
if (lx < (int)len)
|
||||
len -= lx;
|
||||
else
|
||||
|
@ -749,13 +749,13 @@ uint MemoryStream::getLineUni(uint *ubuf, uint len) {
|
|||
}
|
||||
gotNewline = false;
|
||||
for (lx = 0; lx < (int)len && !gotNewline; lx++) {
|
||||
uint ch;
|
||||
ch = ((uint *)_bufPtr)[lx];
|
||||
uint32 ch;
|
||||
ch = ((uint32 *)_bufPtr)[lx];
|
||||
ubuf[lx] = ch;
|
||||
gotNewline = (ch == '\n');
|
||||
}
|
||||
ubuf[lx] = '\0';
|
||||
_bufPtr = ((uint *)_bufPtr) + lx;
|
||||
_bufPtr = ((uint32 *)_bufPtr) + lx;
|
||||
}
|
||||
|
||||
_readCount += lx;
|
||||
|
@ -885,7 +885,7 @@ void FileStream::putBufferUni(const uint32 *buf, size_t len) {
|
|||
|
||||
ensureOp(filemode_Write);
|
||||
for (size_t lx = 0; lx < len; lx++) {
|
||||
uint ch = buf[lx];
|
||||
uint32 ch = buf[lx];
|
||||
if (!_unicode) {
|
||||
if (ch >= 0x100)
|
||||
ch = '?';
|
||||
|
@ -1035,7 +1035,7 @@ int FileStream::getChar() {
|
|||
} else if (_textFile) {
|
||||
res = getCharUtf8();
|
||||
} else {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (_inStream->eos())
|
||||
return -1;
|
||||
|
@ -1075,7 +1075,7 @@ int FileStream::getCharUni() {
|
|||
} else if (_textFile) {
|
||||
res = getCharUtf8();
|
||||
} else {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
return -1;
|
||||
|
@ -1112,7 +1112,7 @@ uint FileStream::getBuffer(char *buf, uint len) {
|
|||
} else if (_textFile) {
|
||||
uint lx;
|
||||
for (lx = 0; lx < len; lx++) {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
ch = getCharUtf8();
|
||||
if (ch == (uint)-1)
|
||||
break;
|
||||
|
@ -1126,7 +1126,7 @@ uint FileStream::getBuffer(char *buf, uint len) {
|
|||
uint lx;
|
||||
for (lx = 0; lx < len; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
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)
|
||||
return 0;
|
||||
|
||||
|
@ -1161,7 +1161,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
|
|||
uint lx;
|
||||
for (lx = 0; lx < len; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
break;
|
||||
|
@ -1173,7 +1173,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
|
|||
} else if (_textFile) {
|
||||
uint lx;
|
||||
for (lx = 0; lx < len; lx++) {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
ch = getCharUtf8();
|
||||
if (ch == (uint)-1)
|
||||
break;
|
||||
|
@ -1185,7 +1185,7 @@ uint FileStream::getBufferUni(uint *buf, uint len) {
|
|||
uint lx;
|
||||
for (lx = 0; lx < len; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
break;
|
||||
|
@ -1233,7 +1233,7 @@ uint FileStream::getLine(char *buf, uint len) {
|
|||
len -= 1; // for the terminal null
|
||||
gotNewline = false;
|
||||
for (lx = 0; lx < len && !gotNewline; lx++) {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
ch = getCharUtf8();
|
||||
if (ch == (uint)-1)
|
||||
break;
|
||||
|
@ -1250,7 +1250,7 @@ uint FileStream::getLine(char *buf, uint len) {
|
|||
gotNewline = false;
|
||||
for (lx = 0; lx < len && !gotNewline; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
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;
|
||||
int lx;
|
||||
|
||||
|
@ -1292,7 +1292,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
|
|||
gotNewline = false;
|
||||
for (lx = 0; lx < (int)len && !gotNewline; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
break;
|
||||
|
@ -1307,7 +1307,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
|
|||
len -= 1; // for the terminal null
|
||||
gotNewline = false;
|
||||
for (lx = 0; lx < (int)len && !gotNewline; lx++) {
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
ch = getCharUtf8();
|
||||
if (ch == (uint)-1)
|
||||
break;
|
||||
|
@ -1322,7 +1322,7 @@ uint FileStream::getLineUni(uint *ubuf, uint len) {
|
|||
gotNewline = false;
|
||||
for (lx = 0; lx < (int)len && !gotNewline; lx++) {
|
||||
int res;
|
||||
uint ch;
|
||||
uint32 ch;
|
||||
res = _inStream->readByte();
|
||||
if (res == -1)
|
||||
break;
|
||||
|
@ -1439,7 +1439,7 @@ WindowStream *Streams::openWindowStream(Window *window) {
|
|||
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);
|
||||
addStream(stream);
|
||||
return stream;
|
||||
|
@ -1470,7 +1470,7 @@ void Streams::removeStream(Stream *stream) {
|
|||
}
|
||||
}
|
||||
|
||||
Stream *Streams::getFirst(uint32 *rock) {
|
||||
Stream *Streams::getFirst(uint *rock) {
|
||||
if (rock)
|
||||
*rock = _streamList ? _streamList->_rock : 0;
|
||||
return _streamList;
|
||||
|
|
|
@ -61,8 +61,8 @@ enum SeekMode {
|
|||
};
|
||||
|
||||
struct StreamResult {
|
||||
uint32 _readCount;
|
||||
uint32 _writeCount;
|
||||
uint _readCount;
|
||||
uint _writeCount;
|
||||
};
|
||||
typedef StreamResult stream_result_t;
|
||||
|
||||
|
@ -135,16 +135,16 @@ public:
|
|||
Streams *_streams;
|
||||
Stream *_prev;
|
||||
Stream *_next;
|
||||
uint32 _rock;
|
||||
uint _rock;
|
||||
bool _unicode;
|
||||
uint32 _readCount;
|
||||
uint32 _writeCount;
|
||||
uint _readCount;
|
||||
uint _writeCount;
|
||||
bool _readable, _writable;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Stream(Streams *streams, bool readable, bool writable, uint32 rock, bool unicode);
|
||||
Stream(Streams *streams, bool readable, bool writable, uint rock, bool unicode);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -154,12 +154,12 @@ public:
|
|||
/**
|
||||
* Get the next stream
|
||||
*/
|
||||
Stream *getNext(uint32 *rock) const;
|
||||
Stream *getNext(uint *rock) const;
|
||||
|
||||
/**
|
||||
* Get the rock value for the stream
|
||||
*/
|
||||
uint32 getRock() const {
|
||||
uint getRock() const {
|
||||
return _rock;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) = 0;
|
||||
virtual void putCharUni(uint32 ch) = 0;
|
||||
|
||||
/**
|
||||
* Write a buffer
|
||||
|
@ -191,7 +191,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -214,7 +214,7 @@ public:
|
|||
/**
|
||||
* 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);
|
||||
putCharUni('\n');
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public:
|
|||
/**
|
||||
* Get a unicode buffer
|
||||
*/
|
||||
virtual uint getBufferUni(uint *buf, uint len) {
|
||||
virtual uint getBufferUni(uint32 *buf, uint len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
/**
|
||||
* Get a unicode line
|
||||
*/
|
||||
virtual uint getLineUni(uint *ubuf, uint len) {
|
||||
virtual uint getLineUni(uint32 *ubuf, uint len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
/**
|
||||
* 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) {}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +327,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) override;
|
||||
virtual void putCharUni(uint32 ch) override;
|
||||
|
||||
/**
|
||||
* Write a buffer
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -347,7 +347,7 @@ public:
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -381,7 +381,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -391,7 +391,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) override;
|
||||
virtual void putCharUni(uint32 ch) override;
|
||||
|
||||
/**
|
||||
* Write a buffer
|
||||
|
@ -401,7 +401,7 @@ public:
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -425,7 +425,7 @@ public:
|
|||
/**
|
||||
* Get a unicode buffer
|
||||
*/
|
||||
virtual uint getBufferUni(uint *buf, uint len) override;
|
||||
virtual uint getBufferUni(uint32 *buf, uint len) override;
|
||||
|
||||
/**
|
||||
* Get a line
|
||||
|
@ -435,7 +435,7 @@ public:
|
|||
/**
|
||||
* 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::InSaveFile *_inFile;
|
||||
Common::SeekableReadStream *_inStream;
|
||||
uint32 _lastOp; ///< 0, filemode_Write, or filemode_Read
|
||||
uint _lastOp; ///< 0, filemode_Write, or filemode_Read
|
||||
bool _textFile;
|
||||
private:
|
||||
/**
|
||||
|
@ -493,7 +493,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) override;
|
||||
virtual void putCharUni(uint32 ch) override;
|
||||
|
||||
/**
|
||||
* Write a buffer
|
||||
|
@ -503,7 +503,7 @@ public:
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -527,7 +527,7 @@ public:
|
|||
/**
|
||||
* Get a unicode buffer
|
||||
*/
|
||||
virtual uint getBufferUni(uint *buf, uint len) override;
|
||||
virtual uint getBufferUni(uint32 *buf, uint len) override;
|
||||
|
||||
/**
|
||||
* Get a line
|
||||
|
@ -537,7 +537,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -593,7 +593,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -605,7 +605,7 @@ public:
|
|||
/**
|
||||
* Start an Iteration through streams
|
||||
*/
|
||||
Stream *getFirst(uint32 *rock);
|
||||
Stream *getFirst(uint *rock);
|
||||
|
||||
/**
|
||||
* Set the current output stream
|
||||
|
|
|
@ -33,11 +33,11 @@ size_t strlen_uni(const uint32 *s) {
|
|||
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) {
|
||||
uint ix, jx;
|
||||
uint *outbuf;
|
||||
uint *newoutbuf;
|
||||
uint32 *outbuf;
|
||||
uint32 *newoutbuf;
|
||||
uint outcount;
|
||||
int dest_block_rest = 0, dest_block_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 *ptr;
|
||||
uint speccount;
|
||||
uint ch = buf[ix];
|
||||
uint32 ch = buf[ix];
|
||||
|
||||
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.
|
||||
if (!newoutbuf) {
|
||||
newoutbuf = new uint[len + 1];
|
||||
newoutbuf = new uint32[len + 1];
|
||||
if (!newoutbuf)
|
||||
return 0;
|
||||
if (outcount)
|
||||
memcpy(newoutbuf, buf, outcount * sizeof(uint));
|
||||
memcpy(newoutbuf, buf, outcount * sizeof(uint32));
|
||||
outbuf = newoutbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ size_t strlen_uni(const uint32 *s);
|
|||
* the return value will be the full number of characters that the
|
||||
*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);
|
||||
|
||||
} // End of namespace Glk
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
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) {
|
||||
_type = wintype_Graphics;
|
||||
Common::copy(&_bgColor[0], &_bgColor[3], _bgnd);
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
GraphicsWindow(Windows *windows, uint32 rock);
|
||||
GraphicsWindow(Windows *windows, uint rock);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Glk {
|
|||
#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),
|
||||
_scrollMax(0), _scrollBack(SCROLLBACK), _width(-1), _height(-1), _inBuf(nullptr),
|
||||
_lineTerminators(nullptr), _echoLineInput(true), _ladjw(0), _radjw(0), _ladjn(0),
|
||||
|
@ -105,7 +105,7 @@ void TextBufferWindow::rearrange(const Rect &box) {
|
|||
// allocate copy buffer
|
||||
if (_copyBuf)
|
||||
delete[] _copyBuf;
|
||||
_copyBuf = new uint[_height * TBLINELEN];
|
||||
_copyBuf = new uint32[_height * TBLINELEN];
|
||||
|
||||
for (int i = 0; i < (_height * TBLINELEN); i++)
|
||||
_copyBuf[i] = 0;
|
||||
|
@ -127,7 +127,7 @@ void TextBufferWindow::reflow() {
|
|||
|
||||
// allocate temp buffers
|
||||
Attributes *attrbuf = new Attributes[SCROLLBACK * TBLINELEN];
|
||||
uint *charbuf = new uint[SCROLLBACK * TBLINELEN];
|
||||
uint32 *charbuf = new uint32[SCROLLBACK * TBLINELEN];
|
||||
int *alignbuf = new int[SCROLLBACK];
|
||||
Picture **pictbuf = new Picture *[SCROLLBACK];
|
||||
uint *hyperbuf = new uint[SCROLLBACK];
|
||||
|
@ -330,7 +330,7 @@ void TextBufferWindow::putText(const char *buf, int len, int pos, int oldlen) {
|
|||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void TextBufferWindow::putCharUni(uint ch) {
|
||||
void TextBufferWindow::putCharUni(uint32 ch) {
|
||||
uint bchars[TBLINELEN];
|
||||
Attributes battrs[TBLINELEN];
|
||||
int pw;
|
||||
|
@ -655,7 +655,7 @@ void TextBufferWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
|
|||
_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) {
|
||||
warning("request_line_event_uni: window already has keyboard request");
|
||||
return;
|
||||
|
@ -742,7 +742,7 @@ void TextBufferWindow::cancelLineEvent(Event *ev) {
|
|||
|
||||
if (!unicode) {
|
||||
for (ix = 0; ix < len; ix++) {
|
||||
uint ch = _chars[_inFence + ix];
|
||||
uint32 ch = _chars[_inFence + ix];
|
||||
if (ch > 0xff)
|
||||
ch = '?';
|
||||
((char *)inbuf)[ix] = (char)ch;
|
||||
|
@ -1238,7 +1238,7 @@ void TextBufferWindow::acceptReadChar(uint arg) {
|
|||
g_vm->_events->store(evtype_CharInput, this, key, 0);
|
||||
}
|
||||
|
||||
void TextBufferWindow::acceptReadLine(uint arg) {
|
||||
void TextBufferWindow::acceptReadLine(uint32 arg) {
|
||||
uint *cx;
|
||||
Common::U32String s;
|
||||
int len;
|
||||
|
@ -1368,7 +1368,7 @@ void TextBufferWindow::acceptReadLine(uint arg) {
|
|||
touch(0);
|
||||
}
|
||||
|
||||
void TextBufferWindow::acceptLine(uint keycode) {
|
||||
void TextBufferWindow::acceptLine(uint32 keycode) {
|
||||
int ix;
|
||||
int len, olen;
|
||||
void *inbuf;
|
||||
|
@ -1392,7 +1392,7 @@ void TextBufferWindow::acceptLine(uint keycode) {
|
|||
if (g_conf->_speakInput) {
|
||||
const uint32 NEWLINE = '\n';
|
||||
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) {
|
||||
for (ix = 0; ix < len; ix++) {
|
||||
uint ch = _chars[_inFence + ix];
|
||||
uint32 ch = _chars[_inFence + ix];
|
||||
if (ch > 0xff)
|
||||
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);
|
||||
}
|
||||
|
||||
bool TextBufferWindow::leftquote(uint c) {
|
||||
bool TextBufferWindow::leftquote(uint32 c) {
|
||||
switch (c) {
|
||||
case '(':
|
||||
case '[':
|
||||
|
@ -1580,7 +1580,7 @@ void TextBufferWindow::scrollResize() {
|
|||
_scrollBack += SCROLLBACK;
|
||||
}
|
||||
|
||||
int TextBufferWindow::calcWidth(uint *chars, Attributes *attrs, int startchar,
|
||||
int TextBufferWindow::calcWidth(uint32 *chars, Attributes *attrs, int startchar,
|
||||
int numChars, int spw) {
|
||||
Screen &screen = *g_vm->_screen;
|
||||
int w = 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ class TextBufferWindow : public Window, Speech {
|
|||
* Structure for a row within the window
|
||||
*/
|
||||
struct TextBufferRow {
|
||||
uint _chars[TBLINELEN];
|
||||
uint32 _chars[TBLINELEN];
|
||||
Attributes _attrs[TBLINELEN];
|
||||
int _len, _newLine;
|
||||
bool _dirty, _repaint;
|
||||
|
@ -66,12 +66,12 @@ private:
|
|||
/**
|
||||
* @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.
|
||||
*/
|
||||
void acceptLine(uint keycode);
|
||||
void acceptLine(uint32 keycode);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* whitespace.
|
||||
*/
|
||||
bool leftquote(uint c);
|
||||
bool leftquote(uint32 c);
|
||||
|
||||
/**
|
||||
* Mark a given text row as modified
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
void scrollOneLine(bool forced);
|
||||
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:
|
||||
int _width, _height;
|
||||
int _spaced;
|
||||
|
@ -98,8 +98,8 @@ public:
|
|||
int _scrollBack;
|
||||
|
||||
int _numChars; ///< number of chars in last line: lines[0]
|
||||
uint *_chars; ///< alias to lines[0].chars
|
||||
Attributes *_attrs; ///< alias to lines[0].attrs
|
||||
uint32 *_chars; ///< alias to lines[0].chars
|
||||
Attributes *_attrs; ///< alias to lines[0].attrs
|
||||
|
||||
///< adjust margins temporarily for images
|
||||
int _ladjw;
|
||||
|
@ -132,13 +132,13 @@ public:
|
|||
WindowStyle _styles[style_NUMSTYLES];
|
||||
|
||||
// for copy selection
|
||||
uint *_copyBuf;
|
||||
uint32 *_copyBuf;
|
||||
int _copyPos;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
TextBufferWindow(Windows *windows, uint32 rock);
|
||||
TextBufferWindow(Windows *windows, uint rock);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) override;
|
||||
virtual void putCharUni(uint32 ch) override;
|
||||
|
||||
/**
|
||||
* Unput a unicode character
|
||||
|
@ -187,7 +187,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
*/
|
||||
virtual void redraw() override;
|
||||
|
||||
virtual void acceptReadLine(uint arg) override;
|
||||
virtual void acceptReadLine(uint32 arg) override;
|
||||
|
||||
virtual void acceptReadChar(uint arg) override;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace Glk {
|
||||
|
||||
TextGridWindow::TextGridWindow(Windows *windows, uint32 rock) : Window(windows, rock) {
|
||||
TextGridWindow::TextGridWindow(Windows *windows, uint rock) : Window(windows, rock) {
|
||||
_type = wintype_TextGrid;
|
||||
_width = _height = 0;
|
||||
_curX = _curY = 0;
|
||||
|
@ -254,10 +254,10 @@ void TextGridWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
|
|||
}
|
||||
|
||||
if (_lineTerminatorsBase && _termCt) {
|
||||
_lineTerminators = new uint[_termCt + 1];
|
||||
_lineTerminators = new uint32[_termCt + 1];
|
||||
|
||||
if (_lineTerminators) {
|
||||
memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint));
|
||||
memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint32));
|
||||
_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");
|
||||
}
|
||||
|
||||
void TextGridWindow::requestLineEventUni(uint *buf, uint maxlen, uint initlen) {
|
||||
void TextGridWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
|
||||
if (_charRequest || _lineRequest || _charRequestUni || _lineRequestUni) {
|
||||
warning("requestLineEventUni: window already has keyboard request");
|
||||
return;
|
||||
|
@ -306,7 +306,7 @@ void TextGridWindow::requestLineEventUni(uint *buf, uint maxlen, uint initlen) {
|
|||
}
|
||||
|
||||
if (_lineTerminatorsBase && _termCt) {
|
||||
_lineTerminators = new uint[_termCt + 1];
|
||||
_lineTerminators = new uint32[_termCt + 1];
|
||||
|
||||
if (_lineTerminators) {
|
||||
memcpy(_lineTerminators, _lineTerminatorsBase, _termCt * sizeof(uint));
|
||||
|
@ -342,7 +342,7 @@ void TextGridWindow::cancelLineEvent(Event *ev) {
|
|||
|
||||
if (!unicode) {
|
||||
for (ix = 0; ix < _inLen; ix++) {
|
||||
uint ch = ln->_chars[_inOrgX + ix];
|
||||
uint32 ch = ln->_chars[_inOrgX + ix];
|
||||
if (ch > 0xff)
|
||||
ch = '?';
|
||||
((char *)inbuf)[ix] = (char)ch;
|
||||
|
@ -353,7 +353,7 @@ void TextGridWindow::cancelLineEvent(Event *ev) {
|
|||
for (ix = 0; ix < _inLen; ix++)
|
||||
((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix];
|
||||
if (_echoStream)
|
||||
_echoStream->echoLineUni((uint *)inbuf, _inLen);
|
||||
_echoStream->echoLineUni((uint32 *)inbuf, _inLen);
|
||||
}
|
||||
|
||||
_curY = _inOrgY + 1;
|
||||
|
@ -406,7 +406,7 @@ void TextGridWindow::acceptReadChar(uint arg) {
|
|||
g_vm->_events->store(evtype_CharInput, this, key, 0);
|
||||
}
|
||||
|
||||
void TextGridWindow::acceptLine(uint keycode) {
|
||||
void TextGridWindow::acceptLine(uint32 keycode) {
|
||||
int ix;
|
||||
void *inbuf;
|
||||
int inmax;
|
||||
|
@ -430,7 +430,7 @@ void TextGridWindow::acceptLine(uint keycode) {
|
|||
for (ix = 0; ix < _inLen; ix++)
|
||||
((uint *)inbuf)[ix] = ln->_chars[_inOrgX + ix];
|
||||
if (_echoStream)
|
||||
_echoStream->echoLineUni((uint *)inbuf, _inLen);
|
||||
_echoStream->echoLineUni((const uint32 *)inbuf, _inLen);
|
||||
}
|
||||
|
||||
_curY = _inOrgY + 1;
|
||||
|
@ -458,7 +458,7 @@ void TextGridWindow::acceptLine(uint keycode) {
|
|||
(*g_vm->gli_unregister_arr)(inbuf, inmax, unicode ? "&+#!Iu" : "&+#!Cn", inarrayrock);
|
||||
}
|
||||
|
||||
void TextGridWindow::acceptReadLine(uint arg) {
|
||||
void TextGridWindow::acceptReadLine(uint32 arg) {
|
||||
int ix;
|
||||
TextGridRow *ln = &(_lines[_inOrgY]);
|
||||
|
||||
|
@ -466,7 +466,7 @@ void TextGridWindow::acceptReadLine(uint arg) {
|
|||
return;
|
||||
|
||||
if (_lineTerminators && checkTerminator(arg)) {
|
||||
uint *cx;
|
||||
const uint32 *cx;
|
||||
for (cx = _lineTerminators; *cx; cx++) {
|
||||
if (*cx == arg) {
|
||||
acceptLine(arg);
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
/**
|
||||
* Return or enter, during line input. Ends line input.
|
||||
*/
|
||||
void acceptLine(uint keycode);
|
||||
void acceptLine(uint32 keycode);
|
||||
public:
|
||||
int _width, _height;
|
||||
TextGridRows _lines;
|
||||
|
@ -67,20 +67,20 @@ public:
|
|||
int _curX, _curY; ///< the window cursor position
|
||||
|
||||
///< 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 _inMax;
|
||||
int _inCurs, _inLen;
|
||||
Attributes _origAttr;
|
||||
gidispatch_rock_t _inArrayRock;
|
||||
uint *_lineTerminators;
|
||||
uint32 *_lineTerminators;
|
||||
|
||||
WindowStyle _styles[style_NUMSTYLES]; ///< style hints and settings
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
TextGridWindow(Windows *windows, uint32 rock);
|
||||
TextGridWindow(Windows *windows, uint rock);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
/**
|
||||
* Write a unicode character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) override;
|
||||
virtual void putCharUni(uint32 ch) override;
|
||||
|
||||
/**
|
||||
* Unput a unicode character
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
*/
|
||||
virtual void redraw() override;
|
||||
|
||||
virtual void acceptReadLine(uint arg) override;
|
||||
virtual void acceptReadLine(uint32 arg) override;
|
||||
|
||||
virtual void acceptReadChar(uint arg) override;
|
||||
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
|
|
@ -574,7 +574,7 @@ void Window::requestLineEvent(char *buf, uint maxlen, uint initlen) {
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ const WindowStyle *Window::getStyles() const {
|
|||
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)) {
|
||||
delete _lineTerminatorsBase;
|
||||
_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)
|
||||
return true;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -396,12 +396,12 @@ public:
|
|||
|
||||
gidispatch_rock_t _dispRock;
|
||||
public:
|
||||
static bool checkTerminator(uint ch);
|
||||
static bool checkTerminator(uint32 ch);
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Window(Windows *windows, uint32 rock);
|
||||
Window(Windows *windows, uint rock);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -430,7 +430,7 @@ public:
|
|||
/**
|
||||
* Write a character
|
||||
*/
|
||||
virtual void putCharUni(uint ch) {}
|
||||
virtual void putCharUni(uint32 ch) {}
|
||||
|
||||
/**
|
||||
* Unput a unicode character
|
||||
|
@ -467,7 +467,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
@ -498,9 +498,9 @@ public:
|
|||
|
||||
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);
|
||||
|
||||
|
@ -543,7 +543,7 @@ public:
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
BlankWindow(Windows *windows, uint32 rock);
|
||||
BlankWindow(Windows *windows, uint rock);
|
||||
};
|
||||
|
||||
} // End of namespace Glk
|
||||
|
|
|
@ -448,7 +448,7 @@ void MacTextWindow::drawInput() {
|
|||
|
||||
// Now recalc new text height
|
||||
_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
|
||||
appendText(_inputText, _font, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue