aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authordreammaster2019-05-22 05:48:52 +0100
committerPaul Gilbert2019-05-24 18:21:07 -0700
commitaa5fd603b6fd623c138fd3529176847b5b538e49 (patch)
tree1c9003a4ef67b73ae89c5fba0e6024969e710f03 /engines
parent0c02346b48e068dddff81bf4fde57040135deb51 (diff)
downloadscummvm-rg350-aa5fd603b6fd623c138fd3529176847b5b538e49.tar.gz
scummvm-rg350-aa5fd603b6fd623c138fd3529176847b5b538e49.tar.bz2
scummvm-rg350-aa5fd603b6fd623c138fd3529176847b5b538e49.zip
GLK: TADS2: Compilation fixes
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/tads/os_buffer.h2
-rw-r--r--engines/glk/tads/os_filetype.h2
-rw-r--r--engines/glk/tads/os_glk.cpp9
-rw-r--r--engines/glk/tads/os_glk.h2
-rw-r--r--engines/glk/tads/tads2/built_in.cpp6
-rw-r--r--engines/glk/tads/tads2/error.cpp6
-rw-r--r--engines/glk/tads/tads2/error_handling.cpp10
-rw-r--r--engines/glk/tads/tads2/error_handling.h12
-rw-r--r--engines/glk/tads/tads2/line_source_file.cpp3
-rw-r--r--engines/glk/tads/tads2/ltk.cpp4
-rw-r--r--engines/glk/tads/tads2/ltk.h4
-rw-r--r--engines/glk/tads/tads2/memory_cache_heap.cpp2
-rw-r--r--engines/glk/tads/tads2/memory_cache_heap.h2
-rw-r--r--engines/glk/tads/tads2/output.cpp10
-rw-r--r--engines/glk/tads/tads2/text_io.h2
-rw-r--r--engines/glk/tads/tads2/vocabulary.h4
-rw-r--r--engines/glk/tads/tads2/vocabulary_parser.cpp8
17 files changed, 51 insertions, 37 deletions
diff --git a/engines/glk/tads/os_buffer.h b/engines/glk/tads/os_buffer.h
index 3fc2209cec..4fa9662831 100644
--- a/engines/glk/tads/os_buffer.h
+++ b/engines/glk/tads/os_buffer.h
@@ -33,6 +33,8 @@
#ifndef GLK_TADS_OS_BUFFER
#define GLK_TADS_OS_BUFFER
+#include "common/scummsys.h"
+
namespace Glk {
namespace TADS {
diff --git a/engines/glk/tads/os_filetype.h b/engines/glk/tads/os_filetype.h
index 93b101698f..2a48c4b562 100644
--- a/engines/glk/tads/os_filetype.h
+++ b/engines/glk/tads/os_filetype.h
@@ -55,7 +55,7 @@ enum os_filetype_t {
OSFTT3IMG = 12, /* T3 image file (.t3 - formerly .t3x) */
OSFTT3OBJ = 13, /* T3 object file (.t3o) */
OSFTT3SYM = 14, /* T3 symbol export file (.t3s) */
- OSFTT3SAV = 15, /* T3 saved state file (.t3v) */
+ OSFTT3SAV = 15 /* T3 saved state file (.t3v) */
};
} // End of namespace TADS
diff --git a/engines/glk/tads/os_glk.cpp b/engines/glk/tads/os_glk.cpp
index 90a5f00d6a..03d8a3a445 100644
--- a/engines/glk/tads/os_glk.cpp
+++ b/engines/glk/tads/os_glk.cpp
@@ -641,8 +641,10 @@ unsigned char *os_gets(unsigned char *buf, size_t buflen)
* routine with use_timeout==false. The regular os_gets() would not
* satisfy this need, because it cannot resume an interrupted input.)
*/
+#if defined GLK_TIMERS && defined GLK_MODULE_LINE_ECHO
static char * timebuf = NULL;
static size_t timelen = 0;
+#endif
int os_gets_timeout(unsigned char *buf, size_t bufl,
unsigned long timeout_in_milliseconds, int use_timeout)
@@ -1099,5 +1101,12 @@ void os_expause() {
void os_plain(void) {}
+int memicmp(const char *s1, const char *s2, int len) {
+ Common::String cs1(s1, len);
+ Common::String cs2(s2, len);
+
+ return cs1.compareToIgnoreCase(cs2);
+}
+
} // End of namespace TADS
} // End of namespace Glk
diff --git a/engines/glk/tads/os_glk.h b/engines/glk/tads/os_glk.h
index 7b76876001..ac5090f930 100644
--- a/engines/glk/tads/os_glk.h
+++ b/engines/glk/tads/os_glk.h
@@ -3217,6 +3217,8 @@ int os_get_sysinfo(int code, void *param, long *result);
#define os_remainder_long(a, b) ((a) % (b))
#endif
+int memicmp(const char *s1, const char *s2, int len);
+
} // End of namespace TADS
} // End of namespace Glk
diff --git a/engines/glk/tads/tads2/built_in.cpp b/engines/glk/tads/tads2/built_in.cpp
index 30c2772b78..c67399d402 100644
--- a/engines/glk/tads/tads2/built_in.cpp
+++ b/engines/glk/tads/tads2/built_in.cpp
@@ -902,7 +902,7 @@ void bifrnd(bifcxdef *ctx, int argc)
/*
* case-insensitive substring matching
*/
-static char *bif_stristr(const char *s1, const char *s2)
+static const char *bif_stristr(const char *s1, const char *s2)
{
size_t s1len;
size_t s2len;
@@ -913,7 +913,7 @@ static char *bif_stristr(const char *s1, const char *s2)
{
/* if this is a match, return this substring */
if (memicmp(s1, s2, s2len) == 0)
- return (char *)s1;
+ return (const char *)s1;
}
return 0;
@@ -4146,7 +4146,7 @@ void bifinpdlg(bifcxdef *ctx, int argc)
uchar *p;
char prompt[256];
char lblbuf[256];
- char *labels[10];
+ const char *labels[10];
char *dst;
char *xp;
uint len;
diff --git a/engines/glk/tads/tads2/error.cpp b/engines/glk/tads/tads2/error.cpp
index eeb59cda81..62c5e9a3e6 100644
--- a/engines/glk/tads/tads2/error.cpp
+++ b/engines/glk/tads/tads2/error.cpp
@@ -93,7 +93,7 @@ int errfmt(char *outbuf, int outbufl, const char *fmt, int argc, const erradef *
static struct
{
int tokid;
- char *toknam;
+ const char *toknam;
} toklist[] =
{
{ TOKTSEM, "semicolon" },
@@ -106,7 +106,7 @@ int errfmt(char *outbuf, int outbufl, const char *fmt, int argc, const erradef *
{ TOKTWHILE, "\"while\"" },
{ TOKTLPAR, "left paren ('(')" },
{ TOKTEQ, "'='" },
- { 0, (char *)0 }
+ { 0, (const char *)nullptr }
};
for (i = 0 ; toklist[i].toknam ; ++i)
@@ -185,7 +185,7 @@ void errsign(errcxdef *ctx, int e) {
}
/* enter a string argument */
-char *errstr(errcxdef *ctx, char *str, int len) {
+char *errstr(errcxdef *ctx, const char *str, int len) {
char *ret = &ctx->errcxbuf[ctx->errcxofs];
memcpy(ret, str, (size_t)len);
diff --git a/engines/glk/tads/tads2/error_handling.cpp b/engines/glk/tads/tads2/error_handling.cpp
index b71fc8ce11..ac2b01df53 100644
--- a/engines/glk/tads/tads2/error_handling.cpp
+++ b/engines/glk/tads/tads2/error_handling.cpp
@@ -34,7 +34,7 @@ int errfmt(char *outbuf, int outbufl, char *fmt, int argc, erradef *argv)
int argi = 0;
int len;
char buf[20];
- char *p = nullptr;
+ const char *p = nullptr;
char fmtchar;
while (*fmt != '\0' && outbufl > 1)
@@ -148,7 +148,7 @@ void errjmp(jmp_buf buf, int e)
#ifdef ERR_NO_MACRO
/* base error signal function */
-void errsign(errcxdef *ctx, int e, char *facility)
+void errsign(errcxdef *ctx, int e, const char *facility)
{
strncpy(ctx->errcxptr->errfac, facility, ERRFACMAX);
ctx->errcxptr->errfac[ERRFACMAX] = '\0';
@@ -161,7 +161,7 @@ void errsign(errcxdef *ctx, int e, char *facility)
}
/* signal an error with no arguments */
-void errsigf(errcxdef *ctx, char *facility, int e)
+void errsigf(errcxdef *ctx, const char *facility, int e)
{
errargc(ctx, 0);
errsign(ctx, e, facility);
@@ -188,7 +188,7 @@ void errrse1(errcxdef *ctx, errdef *fr)
}
/* log an error: base function */
-void errlogn(errcxdef *ctx, int err, char *facility)
+void errlogn(errcxdef *ctx, int err, const char *facility)
{
ctx->errcxofs = 0;
(*ctx->errcxlog)(ctx->errcxlgc, facility, err, ctx->errcxptr->erraac,
@@ -196,7 +196,7 @@ void errlogn(errcxdef *ctx, int err, char *facility)
}
/* log an error with no arguments */
-void errlogf(errcxdef *ctx, char *facility, int err)
+void errlogf(errcxdef *ctx, const char *facility, int err)
{
errargc(ctx, 0);
errlogn(ctx, err, facility);
diff --git a/engines/glk/tads/tads2/error_handling.h b/engines/glk/tads/tads2/error_handling.h
index 7c56b2f831..8d37929184 100644
--- a/engines/glk/tads/tads2/error_handling.h
+++ b/engines/glk/tads/tads2/error_handling.h
@@ -74,7 +74,7 @@ namespace TADS2 {
union erradef {
int erraint; /* integer argument */
- char *errastr; /* text string argument */
+ const char *errastr; /* text string argument */
};
struct errdef {
@@ -99,7 +99,7 @@ typedef struct errmfdef errmfdef;
struct errcxdef {
errdef *errcxptr; /* current error frame */
- void (*errcxlog)(void *, char *fac, int err, int argc, erradef *);
+ void (*errcxlog)(void *, const char *fac, int err, int argc, erradef *);
/* error logging callback function */
void *errcxlgc; /* context for error logging callback */
int errcxofs; /* offset in argument buffer */
@@ -187,7 +187,7 @@ char *errstr(errcxdef *ctx, const char *str, int len);
/* signal an error with argument count already set */
#ifdef ERR_NO_MACRO
-void errsign(errcxdef *ctx, int e, char *facility);
+void errsign(errcxdef *ctx, int e, const char *facility);
#else /* ERR_NO_MACRO */
# ifdef DEBUG
void errjmp(jmp_buf buf, int e);
@@ -206,7 +206,7 @@ void errjmp(jmp_buf buf, int e);
/* signal an error with no arguments */
#ifdef ERR_NO_MACRO
-void errsigf(errcxdef *ctx, char *facility, int err);
+void errsigf(errcxdef *ctx, const char *facility, int err);
#else /* ERR_NO_MACRO */
#define errsigf(ctx, fac, e) (errargc(ctx,0),errsign(ctx,e,fac))
#endif /* ERR_NO_MACRO */
@@ -270,7 +270,7 @@ void errrse1(errcxdef *ctx, errdef *fr);
/* log an error (no signalling, just reporting) */
#ifdef ERR_NO_MACRO
-void errlogn(errcxdef *ctx, int err, char *facility);
+void errlogn(errcxdef *ctx, int err, const char *facility);
#else /* ERR_NO_MACRO */
#define errlogn(ctx,err,fac) \
@@ -282,7 +282,7 @@ void errlogn(errcxdef *ctx, int err, char *facility);
/* log an error with no arguments */
#ifdef ERR_NO_MACRO
-void errlogf(errcxdef *ctx, char *facility, int err);
+void errlogf(errcxdef *ctx, const char *facility, int err);
#else /* ERR_NO_MACRO */
/* void errlogf(errcxdef *ctx, char *facility, int err); */
diff --git a/engines/glk/tads/tads2/line_source_file.cpp b/engines/glk/tads/tads2/line_source_file.cpp
index b5da3d1a3c..430b1d9767 100644
--- a/engines/glk/tads/tads2/line_source_file.cpp
+++ b/engines/glk/tads/tads2/line_source_file.cpp
@@ -403,7 +403,8 @@ void linfglop2(lindef *lin, uchar *buf)
/* save line source information to binary (.gam) file; TRUE ==> error */
int linfwrt(lindef *lin, osfildef *fp)
{
-# define linf ((linfdef *)lin)
+#define linf ((linfdef *)lin)
+#define UCHAR_MAX 255
uchar buf[UCHAR_MAX + 6];
size_t len;
uint pgcnt;
diff --git a/engines/glk/tads/tads2/ltk.cpp b/engines/glk/tads/tads2/ltk.cpp
index c385ee7999..6961f216ae 100644
--- a/engines/glk/tads/tads2/ltk.cpp
+++ b/engines/glk/tads/tads2/ltk.cpp
@@ -130,7 +130,7 @@ void ltk_free(void *mem) {
* ltk_errlog - ERRor LOGging function. Logs an error from the LER
* system.
*/
-void ltk_errlog(void *ctx, char *fac, int errCode, int argc, erradef *argv) {
+void ltk_errlog(void *ctx, const char *fac, int errCode, int argc, erradef *argv) {
char buf[128]; /* formatted error buffer */
char msg[128]; /* message buffer */
@@ -152,7 +152,7 @@ void ltk_errlog(void *ctx, char *fac, int errCode, int argc, erradef *argv) {
/*
* ltk_dlg - DiaLog. Puts the given message in a dialog box.
*/
-void ltk_dlg(char *title, char *msg, ...) {
+void ltk_dlg(const char *title, const char *msg, ...) {
va_list argp; /* printf args */
char inbuf[80]; /* input buffer */
char outbuf[160]; /* allow inbuf to double in size */
diff --git a/engines/glk/tads/tads2/ltk.h b/engines/glk/tads/tads2/ltk.h
index 2fbe7a853b..fa66b8a7c7 100644
--- a/engines/glk/tads/tads2/ltk.h
+++ b/engines/glk/tads/tads2/ltk.h
@@ -56,13 +56,13 @@ extern void ltkfre();
* printf-style arguments must be passed in also, if the message
* requires them.
*/
-extern void ltk_dlg(char *title, char *msg, ...);
+extern void ltk_dlg(const char *title, const char *msg, ...);
/*
* ltk_errlog - Error logging function for LER routines.
*/
-extern void ltk_errlog(void *ctx, char *fac, int errCode, int agrc, erradef *argv);
+extern void ltk_errlog(void *ctx, const char *fac, int errCode, int agrc, erradef *argv);
/*
diff --git a/engines/glk/tads/tads2/memory_cache_heap.cpp b/engines/glk/tads/tads2/memory_cache_heap.cpp
index fae3c5e080..5704f46a48 100644
--- a/engines/glk/tads/tads2/memory_cache_heap.cpp
+++ b/engines/glk/tads/tads2/memory_cache_heap.cpp
@@ -30,7 +30,7 @@ namespace TADS2 {
/* global to keep track of all allocations */
IF_DEBUG(ulong mchtotmem;)
-uchar *mchalo(errcxdef *ctx, size_t siz, char *comment) {
+uchar *mchalo(errcxdef *ctx, size_t siz, const char *comment) {
uchar *ret;
VARUSED(comment);
diff --git a/engines/glk/tads/tads2/memory_cache_heap.h b/engines/glk/tads/tads2/memory_cache_heap.h
index 269cdec3ad..6405f4957c 100644
--- a/engines/glk/tads/tads2/memory_cache_heap.h
+++ b/engines/glk/tads/tads2/memory_cache_heap.h
@@ -43,7 +43,7 @@ namespace TADS2 {
* An out-of-memory error is signalled if insufficient memory
* is available. The comment is for debugging purposes only.
*/
-uchar *mchalo(errcxdef *ctx, size_t siz, char *comment);
+uchar *mchalo(errcxdef *ctx, size_t siz, const char *comment);
/* allocate a structure */
#define MCHNEW(errctx, typ, comment) \
diff --git a/engines/glk/tads/tads2/output.cpp b/engines/glk/tads/tads2/output.cpp
index 8b9fd74925..6ff2a992a4 100644
--- a/engines/glk/tads/tads2/output.cpp
+++ b/engines/glk/tads/tads2/output.cpp
@@ -192,7 +192,7 @@ static uchar *fmstop; /* format string area top */
static objnum cmdActor; /* current actor */
/* forward declarations of static functions */
-static void outstring_stream(out_stream_info *stream, char *s);
+static void outstring_stream(out_stream_info *stream, const char *s);
static void outchar_noxlat_stream(out_stream_info *stream, char c);
static char out_parse_entity(char *outbuf, size_t outbuf_size,
char **sp, size_t *slenp);
@@ -1077,8 +1077,8 @@ static void outflushn_stream(out_stream_info *stream, int nl)
}
else
{
- char *suffix = nullptr; /* extra text to add after the flushed text */
- int countnl = 0; /* true if line counts for [more] paging */
+ const char *suffix = nullptr; /* extra text to add after the flushed text */
+ int countnl = 0; /* true if line counts for [more] paging */
/* null-terminate the buffer at the current position */
stream->linebuf[++i] = '\0';
@@ -1621,7 +1621,7 @@ static void outchar_stream(out_stream_info *stream, char c)
/*
* write out a string, translating to the local system character set
*/
-static void outstring_stream(out_stream_info *stream, char *s)
+static void outstring_stream(out_stream_info *stream, const char *s)
{
/* write out each character in the string */
for ( ; *s ; ++s)
@@ -1813,7 +1813,7 @@ static char read_tag(char *dst, size_t dstlen, int *is_end_tag,
* display a string of a given length to a given stream
*/
static int outformatlen_stream(out_stream_info *stream,
- char *s, size_t slen)
+ const char *s, size_t slen)
{
char c;
int done = 0;
diff --git a/engines/glk/tads/tads2/text_io.h b/engines/glk/tads/tads2/text_io.h
index 65194654f1..9a0e19885d 100644
--- a/engines/glk/tads/tads2/text_io.h
+++ b/engines/glk/tads/tads2/text_io.h
@@ -92,7 +92,7 @@ uint tiocapturesize(tiocxdef *ctx);
void outfmt(tiocxdef *ctx, uchar *txt);
/* format a null-terminated (C-style) string to the display */
-int outformat(char *s);
+int outformat(const char *s);
/* format a counted-length string, which may not be null-terminated */
int outformatlen(char *s, uint len);
diff --git a/engines/glk/tads/tads2/vocabulary.h b/engines/glk/tads/tads2/vocabulary.h
index f4c058edaf..d28dcfe0fb 100644
--- a/engines/glk/tads/tads2/vocabulary.h
+++ b/engines/glk/tads/tads2/vocabulary.h
@@ -609,7 +609,7 @@ void vocrevert(voccxdef *ctx);
void vocdmnclr(voccxdef *ctx);
/* display a parser error message */
-void vocerr(voccxdef *ctx, int err, char *f, ...);
+void vocerr(voccxdef *ctx, int err, const char *f, ...);
/*
* display a parser informational error message - this will display the
@@ -617,7 +617,7 @@ void vocerr(voccxdef *ctx, int err, char *f, ...);
* words, and should be used when providing information, such as objects
* we're assuming by default
*/
-void vocerr_info(voccxdef *ctx, int err, char *f, ...);
+void vocerr_info(voccxdef *ctx, int err, const char *f, ...);
/* client undo callback - undoes a daemon/fuse/notifier */
void vocdundo(void *ctx, uchar *data);
diff --git a/engines/glk/tads/tads2/vocabulary_parser.cpp b/engines/glk/tads/tads2/vocabulary_parser.cpp
index c0ff75df57..719005851c 100644
--- a/engines/glk/tads/tads2/vocabulary_parser.cpp
+++ b/engines/glk/tads/tads2/vocabulary_parser.cpp
@@ -686,7 +686,7 @@ struct vocerr_va_info
* vocerr_va().
*/
static void vocerr_va_prep(voccxdef *ctx, struct vocerr_va_info *info,
- int err, char *f, va_list argptr)
+ int err, const char *f, va_list argptr)
{
/*
* presume that we'll use the given format string, instead of one
@@ -874,7 +874,7 @@ static void vocerr_va_prep(voccxdef *ctx, struct vocerr_va_info *info,
* property re-initialized for the call to this routine.
*/
static void vocerr_va(voccxdef *ctx, struct vocerr_va_info *info,
- int err, char *f, va_list argptr)
+ int err, const char *f, va_list argptr)
{
char *buf;
@@ -896,7 +896,7 @@ static void vocerr_va(voccxdef *ctx, struct vocerr_va_info *info,
/*
* display a parser informational message
*/
-void vocerr_info(voccxdef *ctx, int err, char *f, ...)
+void vocerr_info(voccxdef *ctx, int err, const char *f, ...)
{
va_list argptr;
struct vocerr_va_info info;
@@ -915,7 +915,7 @@ void vocerr_info(voccxdef *ctx, int err, char *f, ...)
/*
* display a parser error
*/
-void vocerr(voccxdef *ctx, int err, char *f, ...)
+void vocerr(voccxdef *ctx, int err, const char *f, ...)
{
va_list argptr;
struct vocerr_va_info info;