aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordreammaster2019-05-23 05:25:10 +0100
committerPaul Gilbert2019-05-24 18:21:07 -0700
commit8f9fcec16c41ba4bfc51e7b92bdc701f5a2a2e6b (patch)
tree0dbeaf64dcdbeac567d780a853052e4db01600f8
parent5381930e8b09f61b8c7969db4a657067586be897 (diff)
downloadscummvm-rg350-8f9fcec16c41ba4bfc51e7b92bdc701f5a2a2e6b.tar.gz
scummvm-rg350-8f9fcec16c41ba4bfc51e7b92bdc701f5a2a2e6b.tar.bz2
scummvm-rg350-8f9fcec16c41ba4bfc51e7b92bdc701f5a2a2e6b.zip
GLK: TADS2: Further compilation fixes
-rw-r--r--engines/glk/tads/tads2/built_in.cpp16
-rw-r--r--engines/glk/tads/tads2/data.cpp8
-rw-r--r--engines/glk/tads/tads2/data.h2
-rw-r--r--engines/glk/tads/tads2/debug.cpp35
-rw-r--r--engines/glk/tads/tads2/debug.h2
-rw-r--r--engines/glk/tads/tads2/execute_command.cpp6
-rw-r--r--engines/glk/tads/tads2/get_string.cpp2
-rw-r--r--engines/glk/tads/tads2/line_source_file.cpp4
-rw-r--r--engines/glk/tads/tads2/object.cpp2
-rw-r--r--engines/glk/tads/tads2/object.h2
-rw-r--r--engines/glk/tads/tads2/output.cpp2
-rw-r--r--engines/glk/tads/tads2/run.cpp4
-rw-r--r--engines/glk/tads/tads2/run.h2
-rw-r--r--engines/glk/tads/tads2/runtime_driver.cpp2
-rw-r--r--engines/glk/tads/tads2/text_io.h4
-rw-r--r--engines/glk/tads/tads2/vocabulary.cpp4
-rw-r--r--engines/glk/tads/tads2/vocabulary.h20
-rw-r--r--engines/glk/tads/tads2/vocabulary_parser.cpp55
18 files changed, 86 insertions, 86 deletions
diff --git a/engines/glk/tads/tads2/built_in.cpp b/engines/glk/tads/tads2/built_in.cpp
index 5831903c76..4cc6e155ed 100644
--- a/engines/glk/tads/tads2/built_in.cpp
+++ b/engines/glk/tads/tads2/built_in.cpp
@@ -1189,7 +1189,7 @@ void bifsub(bifcxdef *ctx, int argc)
/* cvtstr - convert value to a string */
void bifcvs(bifcxdef *ctx, int argc)
{
- char *p = nullptr;
+ const char *p = nullptr;
int len = 0;
char buf[30];
@@ -1973,7 +1973,7 @@ void bifsct(bifcxdef *bifctx, int argc)
* Portable keystroke mappings. We map the extended key codes to these
* strings, so that the TADS code can access arrow keys and the like.
*/
-static char *ext_key_names[] =
+static const char *ext_key_names[] =
{
"[up]", /* CMD_UP - 1 */
"[down]", /* CMD_DOWN - 2 */
@@ -2142,8 +2142,8 @@ void bifwrd(bifcxdef *ctx, int argc)
int ob;
vocoldef *v;
uchar buf[128];
- uchar *dst;
- uchar *src;
+ uchar *dst;
+ const uchar *src;
uint len;
runsdef val;
@@ -2169,13 +2169,13 @@ void bifwrd(bifcxdef *ctx, int argc)
/* now build a list of strings from the words, if there are any */
if (v != 0 && voclistlen(v) != 0 && v->vocolfst != 0 && v->vocollst != 0)
{
- for (dst = buf + 2, src = (uchar *)v->vocolfst ;
- src <= (uchar *)v->vocollst ; src += len + 1)
+ for (dst = buf + 2, src = (const uchar *)v->vocolfst ;
+ src <= (const uchar *)v->vocollst ; src += len + 1)
{
*dst++ = DAT_SSTRING;
- len = strlen((char *)src);
+ len = strlen((const char *)src);
oswp2(dst, len + 2);
- strcpy((char *)dst + 2, (char *)src);
+ strcpy((char *)dst + 2, (const char *)src);
dst += len + 2;
}
}
diff --git a/engines/glk/tads/tads2/data.cpp b/engines/glk/tads/tads2/data.cpp
index fe002a3cf7..dfd641c322 100644
--- a/engines/glk/tads/tads2/data.cpp
+++ b/engines/glk/tads/tads2/data.cpp
@@ -32,7 +32,7 @@ namespace TADS {
namespace TADS2 {
/* return size of a data value */
-uint datsiz(dattyp typ, void *val)
+uint datsiz(dattyp typ, const void *val)
{
switch(typ)
{
@@ -45,7 +45,7 @@ uint datsiz(dattyp typ, void *val)
case DAT_SSTRING:
case DAT_DSTRING:
case DAT_LIST:
- return(osrp2((char *)val));
+ return(osrp2((const char *)val));
case DAT_NIL:
case DAT_TRUE:
@@ -59,10 +59,10 @@ uint datsiz(dattyp typ, void *val)
case DAT_TPL:
/* template is counted array of 10-byte entries, plus length byte */
- return(1 + ((*(uchar *)val) * VOCTPLSIZ));
+ return(1 + ((*(const uchar *)val) * VOCTPLSIZ));
case DAT_TPL2:
- return(1 + ((*(uchar *)val) * VOCTPL2SIZ));
+ return(1 + ((*(const uchar *)val) * VOCTPL2SIZ));
default:
return(0);
diff --git a/engines/glk/tads/tads2/data.h b/engines/glk/tads/tads2/data.h
index e573730fb7..6a914cda7b 100644
--- a/engines/glk/tads/tads2/data.h
+++ b/engines/glk/tads/tads2/data.h
@@ -50,7 +50,7 @@ enum DataType {
typedef int dattyp;
/* determine the size of a piece of data */
-uint datsiz(dattyp typ, void *valptr);
+uint datsiz(dattyp typ, const void *valptr);
} // End of namespace TADS2
} // End of namespace TADS
diff --git a/engines/glk/tads/tads2/debug.cpp b/engines/glk/tads/tads2/debug.cpp
index 94e0b3793f..726cbe2c70 100644
--- a/engines/glk/tads/tads2/debug.cpp
+++ b/engines/glk/tads/tads2/debug.cpp
@@ -188,12 +188,12 @@ int dbgnam(dbgcxdef *ctx, char *outbuf, int typ, int val)
}
/* send a buffer value (as from a list) to ui callback for display */
-static void dbgpbval(dbgcxdef *ctx, dattyp typ, uchar *val,
+static void dbgpbval(dbgcxdef *ctx, dattyp typ, const uchar *val,
void (*dispfn)(void *, const char *, int),
void *dispctx)
{
char buf[TOKNAMMAX + 1];
- char *p = buf;
+ const char *p = buf;
uint len;
switch(typ)
@@ -209,7 +209,7 @@ static void dbgpbval(dbgcxdef *ctx, dattyp typ, uchar *val,
case DAT_SSTRING:
len = osrp2(val) - 2;
- p = (char *)val + 2;
+ p = (const char *)val + 2;
break;
case DAT_NIL:
@@ -220,10 +220,10 @@ static void dbgpbval(dbgcxdef *ctx, dattyp typ, uchar *val,
case DAT_LIST:
(*dispfn)(dispctx, "[", 1);
len = osrp2(val) - 2;
- p = (char *)val + 2;
+ p = (const char *)val + 2;
while (len)
{
- dbgpbval(ctx, (dattyp)*p, (uchar *)(p + 1), dispfn, dispctx);
+ dbgpbval(ctx, (dattyp)*p, (const uchar *)(p + 1), dispfn, dispctx);
lstadv((uchar **)&p, &len);
if (len) (*dispfn)(dispctx, " ", 1);
}
@@ -265,8 +265,8 @@ void dbgpval(dbgcxdef *ctx, runsdef *val,
{
uchar buf[TOKNAMMAX + 1];
uint len;
- uchar *p = buf;
- char *typ = 0;
+ const uchar *p = buf;
+ const char *typ = 0;
switch(val->runstyp)
{
@@ -288,27 +288,28 @@ void dbgpval(dbgcxdef *ctx, runsdef *val,
break;
case DAT_NIL:
- p = (uchar *)"nil";
+ p = (const uchar *)"nil";
len = 3;
break;
- case DAT_LIST:
+ case DAT_LIST: {
if (showtype) (*dispfn)(dispctx, "list: ", 6);
(*dispfn)(dispctx, "[", 1);
len = osrp2(val->runsv.runsvstr) - 2;
- p = val->runsv.runsvstr + 2;
+ uchar *up = val->runsv.runsvstr + 2;
while (len)
{
- dbgpbval(ctx, (dattyp)*p, (uchar *)(p + 1), dispfn, dispctx);
- lstadv(&p, &len);
+ dbgpbval(ctx, (dattyp)*up, (const uchar *)(up + 1), dispfn, dispctx);
+ lstadv(&up, &len);
if (len) (*dispfn)(dispctx, " ", 1);
}
(*dispfn)(dispctx, "]", 1);
len = 0;
+ p = up;
break;
-
+ }
case DAT_TRUE:
- p = (uchar *)"true";
+ p = (const uchar *)"true";
len = 4;
break;
@@ -323,7 +324,7 @@ void dbgpval(dbgcxdef *ctx, runsdef *val,
break;
default:
- p = (uchar *)"[unknown type]";
+ p = (const uchar *)"[unknown type]";
len = 14;
break;
}
@@ -356,7 +357,7 @@ void dbgpval(dbgcxdef *ctx, runsdef *val,
/* display the text */
if (len != 0)
- (*dispfn)(dispctx, (char *)p, len);
+ (*dispfn)(dispctx, (const char *)p, len);
/* add a closing quote if it's a string and we showed an open quote */
if (val->runstyp == DAT_SSTRING && !(typ && showtype))
@@ -446,7 +447,7 @@ static void dbgdsdisp(void *ctx, const char *buf, int bufl)
if (buf[0] == '\n')
tioflush((tiocxdef *)ctx);
else
- tioputslen((tiocxdef *)ctx, (char *)buf, bufl);
+ tioputslen((tiocxdef *)ctx, (const char *)buf, bufl);
}
/* dump the stack */
diff --git a/engines/glk/tads/tads2/debug.h b/engines/glk/tads/tads2/debug.h
index 0e7369e232..3c53a89eec 100644
--- a/engines/glk/tads/tads2/debug.h
+++ b/engines/glk/tads/tads2/debug.h
@@ -547,7 +547,7 @@ void trcsho(void);
#ifdef DBG_OFF
#define dbgenter(ctx, bp, self, target, prop, binum, argc)
-#define dbgleave(ctx, exittype)
+#define dbgleave(ctx, exittype) ((void)0)
#define dbgdump(ctx) ((void)0)
#define dbgrst(ctx) ((void)0)
#define dbgframe(ctx, frofs, linofs)
diff --git a/engines/glk/tads/tads2/execute_command.cpp b/engines/glk/tads/tads2/execute_command.cpp
index d8ad6b2e87..63c5f02631 100644
--- a/engines/glk/tads/tads2/execute_command.cpp
+++ b/engines/glk/tads/tads2/execute_command.cpp
@@ -2264,7 +2264,7 @@ static void voc_askobj_indirect(voccxdef *ctx, vocoldef *dolist,
cnt = voclistlen(dolist);
for (len = 0, i = 0 ; i < cnt ; )
{
- char *p;
+ const char *p;
size_t curlen;
int j;
@@ -2331,7 +2331,7 @@ static void voc_askobj_indirect(voccxdef *ctx, vocoldef *dolist,
*/
for (i = 0 ; i < cnt ; )
{
- char *p;
+ const char *p;
uchar *subp;
uchar *subsubp;
size_t curlen;
@@ -3427,7 +3427,7 @@ int execmd(voccxdef *ctx, objnum actor, objnum prep,
int i;
int vcnt;
int distinct;
- char *lastfst;
+ const char *lastfst;
/*
* If possible, tailor the pronoun to the situation
diff --git a/engines/glk/tads/tads2/get_string.cpp b/engines/glk/tads/tads2/get_string.cpp
index 69982fcde1..624b8d95da 100644
--- a/engines/glk/tads/tads2/get_string.cpp
+++ b/engines/glk/tads/tads2/get_string.cpp
@@ -56,7 +56,7 @@ extern int scrquiet;
* output flushing. Prompting is to be done by the caller. This
* routine should be called instead of os_gets.
*/
-int getstring(char *prompt, char *buf, int bufl)
+int getstring(const char *prompt, char *buf, int bufl)
{
char *result;
int savemoremode;
diff --git a/engines/glk/tads/tads2/line_source_file.cpp b/engines/glk/tads/tads2/line_source_file.cpp
index affc3cd587..c2942a8890 100644
--- a/engines/glk/tads/tads2/line_source_file.cpp
+++ b/engines/glk/tads/tads2/line_source_file.cpp
@@ -31,6 +31,7 @@ namespace Glk {
namespace TADS {
namespace TADS2 {
+#define BYTE_MAX 0xff
/* initialize a pre-allocated linfdef, skipping debugger page setup */
void linfini2(mcmcxdef *mctx, linfdef *linf,
@@ -404,7 +405,6 @@ void linfglop2(lindef *lin, uchar *buf)
int linfwrt(lindef *lin, osfildef *fp)
{
#define linf ((linfdef *)lin)
-#define BYTE_MAX 255
uchar buf[BYTE_MAX + 6];
size_t len;
uint pgcnt;
@@ -440,7 +440,7 @@ int linfwrt(lindef *lin, osfildef *fp)
int linfload(osfildef *fp, dbgcxdef *dbgctx, errcxdef *ec, tokpdef *path)
{
linfdef *linf;
- uchar buf[UCHAR_MAX + 6];
+ uchar buf[BYTE_MAX + 6];
uint pgcnt;
uchar *objp;
mcmon *objn;
diff --git a/engines/glk/tads/tads2/object.cpp b/engines/glk/tads/tads2/object.cpp
index 4e6f309883..7bd2f3a279 100644
--- a/engines/glk/tads/tads2/object.cpp
+++ b/engines/glk/tads/tads2/object.cpp
@@ -419,7 +419,7 @@ void objdelp(mcmcxdef *mctx, objnum objn, prpnum prop, int mark_only)
* pointer is null, no undo information is kept.
*/
void objsetp(mcmcxdef *ctx, objnum objn, prpnum prop, dattyp typ,
- void *val, objucxdef *undoctx)
+ const void *val, objucxdef *undoctx)
{
objdef *objptr;
prpdef *p;
diff --git a/engines/glk/tads/tads2/object.h b/engines/glk/tads/tads2/object.h
index 5e2499ccc2..0536f05914 100644
--- a/engines/glk/tads/tads2/object.h
+++ b/engines/glk/tads/tads2/object.h
@@ -275,7 +275,7 @@ objdef *objexp(mcmcxdef *ctx, objnum obj, ushort *siz);
* undo information is retained.
*/
void objsetp(mcmcxdef *ctx, objnum obj, prpnum prop,
- dattyp typ, void *val, objucxdef *undoctx);
+ dattyp typ, const void *val, objucxdef *undoctx);
/*
* Delete a property. If mark_only is true, we'll only mark the
diff --git a/engines/glk/tads/tads2/output.cpp b/engines/glk/tads/tads2/output.cpp
index 6f5cd842e7..79284b7b92 100644
--- a/engines/glk/tads/tads2/output.cpp
+++ b/engines/glk/tads/tads2/output.cpp
@@ -3203,7 +3203,7 @@ int tiologcls(tiocxdef *ctx)
* caller should not include any newlines in the text being displayed
* here.
*/
-void out_logfile_print(char *txt, int nl)
+void out_logfile_print(const char *txt, int nl)
{
/* if there's no log file, there's nothing to do */
if (logfp == 0)
diff --git a/engines/glk/tads/tads2/run.cpp b/engines/glk/tads/tads2/run.cpp
index 4179ff2864..64b52a4d79 100644
--- a/engines/glk/tads/tads2/run.cpp
+++ b/engines/glk/tads/tads2/run.cpp
@@ -298,9 +298,9 @@ void runpstr(runcxdef *ctx, const char *str, int len, int sav)
}
/* push a C-style string, converting escape codes */
-void runpushcstr(runcxdef *ctx, char *str, size_t len, int sav)
+void runpushcstr(runcxdef *ctx, const char *str, size_t len, int sav)
{
- char *p;
+ const char *p;
char *dst;
size_t need;
runsdef val;
diff --git a/engines/glk/tads/tads2/run.h b/engines/glk/tads/tads2/run.h
index 297cb9d540..0a39fca4e2 100644
--- a/engines/glk/tads/tads2/run.h
+++ b/engines/glk/tads/tads2/run.h
@@ -153,7 +153,7 @@ void runpstr(runcxdef *ctx, const char *str, int len, int sav);
* the character contains backslashes, newline, or tab characters, we'll
* convert these characters to their escaped equivalent.
*/
-void runpushcstr(runcxdef *ctx, char *str, size_t len, int sav);
+void runpushcstr(runcxdef *ctx, const char *str, size_t len, int sav);
/*
* Push a property onto the stack. codepp is a pointer to the caller's
diff --git a/engines/glk/tads/tads2/runtime_driver.cpp b/engines/glk/tads/tads2/runtime_driver.cpp
index aec86702ae..6b6a6d7382 100644
--- a/engines/glk/tads/tads2/runtime_driver.cpp
+++ b/engines/glk/tads/tads2/runtime_driver.cpp
@@ -224,7 +224,7 @@ static void trdusage(errcxdef *ec)
errmsg(ec, buf, (uint)sizeof(buf), ERR_TRUSPARM);
/* format in the application name */
- argv[0].errastr = (char *)ec->errcxappctx->usage_app_name;
+ argv[0].errastr = ec->errcxappctx->usage_app_name;
errfmt(buf2, (int)sizeof(buf2), buf, 1, argv);
/* display it */
diff --git a/engines/glk/tads/tads2/text_io.h b/engines/glk/tads/tads2/text_io.h
index d4dd16ff7d..c6ba34c093 100644
--- a/engines/glk/tads/tads2/text_io.h
+++ b/engines/glk/tads/tads2/text_io.h
@@ -111,7 +111,7 @@ void outreset(void);
* (in particular, if no more input is available from the keyboard),
* zero on success.
*/
-int getstring(char *prompt, char *buf, int bufl);
+int getstring(const char *prompt, char *buf, int bufl);
/* set capitalize-next-character mode on/off */
void outcaps(void);
@@ -133,7 +133,7 @@ int tiologcls(tiocxdef *ctx);
* caller should not include any newlines in the text being displayed
* here.
*/
-void out_logfile_print(char *txt, int nl);
+void out_logfile_print(const char *txt, int nl);
/*
diff --git a/engines/glk/tads/tads2/vocabulary.cpp b/engines/glk/tads/tads2/vocabulary.cpp
index 8c4fead31d..e04dcb557d 100644
--- a/engines/glk/tads/tads2/vocabulary.cpp
+++ b/engines/glk/tads/tads2/vocabulary.cpp
@@ -68,7 +68,7 @@ vocwdef *vocwget(voccxdef *ctx, uint idx)
#endif /*VOCW_IN_CACHE */
/* hash value is based on first 6 characters only to allow match-in-6 */
-uint vochsh(uchar *t, int len)
+uint vochsh(const uchar *t, int len)
{
uint ret = 0;
@@ -80,7 +80,7 @@ uint vochsh(uchar *t, int len)
}
/* copy vocabulary word, and convert to lower case */
-static void voccpy(uchar *dst, uchar *src, int len)
+static void voccpy(uchar *dst, const uchar *src, int len)
{
for ( ; len ; --len, ++dst, ++src)
*dst = vocisupper(*src) ? tolower(*src) : *src;
diff --git a/engines/glk/tads/tads2/vocabulary.h b/engines/glk/tads/tads2/vocabulary.h
index d28dcfe0fb..01fcbf38c3 100644
--- a/engines/glk/tads/tads2/vocabulary.h
+++ b/engines/glk/tads/tads2/vocabulary.h
@@ -163,8 +163,8 @@ struct vocddef {
/* vocabulary object list entry */
struct vocoldef {
objnum vocolobj; /* object matching the word */
- char *vocolfst; /* first word in cmd[] that identified object */
- char *vocollst; /* last word in cmd[] that identified object */
+ const char *vocolfst; /* first word in cmd[] that identified object */
+ const char *vocollst; /* last word in cmd[] that identified object */
char *vocolhlst; /* hypothetical last word, if we trimmed a prep */
int vocolflg; /* special flags (ALL, etc) */
};
@@ -346,14 +346,14 @@ void vociren(voccxdef *ctx, objnum oldnum, objnum newnum);
struct vocseadef {
vocdef *v;
vocwdef *vw;
- uchar *wrd1;
+ const uchar *wrd1;
int len1;
- uchar *wrd2;
+ const uchar *wrd2;
int len2;
};
/* find first word matching a given word */
-vocwdef *vocffw(voccxdef *ctx, char *wrd, int len, char *wrd2, int len2,
+vocwdef *vocffw(voccxdef *ctx, const char *wrd, int len, const char *wrd2, int len2,
int p, vocseadef *search_ctx);
/* find next word */
@@ -435,7 +435,7 @@ int try_preparse_cmd(voccxdef *ctx, char **cmd, int wrdcnt,
*/
int try_unknown_verb(voccxdef *ctx, objnum actor,
char **cmd, int *typelist, int wrdcnt, int *next_start,
- int do_fuses, int err, char *msg, ...);
+ int do_fuses, int err, const char *msg, ...);
/* find a template */
int voctplfnd(voccxdef *ctx, objnum verb_in, objnum prep,
@@ -445,7 +445,7 @@ int voctplfnd(voccxdef *ctx, objnum verb_in, objnum prep,
void voc_make_obj_name(voccxdef *ctx, char *namebuf, char *cmd[],
int firstwrd, int lastwrd);
void voc_make_obj_name_from_list(voccxdef *ctx, char *namebuf,
- char *cmd[], char *firstwrd, char *lastwrd);
+ char *cmd[], const char *firstwrd, const char *lastwrd);
/*
* check noun - determines whether the next set of words is a valid noun
@@ -506,7 +506,7 @@ void vocnoreach(voccxdef *ctx, objnum *list1, int cnt,
int multi_base_index, int multi_total_count);
/* set {numObj | strObj}.value, as appropriate */
-void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, void *val,
+void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, const void *val,
vocoldef *inobj, vocoldef *outobj);
/* macros to read values out of templates */
@@ -565,7 +565,7 @@ void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, void *val,
/* structure for special internal word table */
struct vocspdef {
- char *vocspin;
+ const char *vocspin;
char vocspout;
};
@@ -643,7 +643,7 @@ void vocdusave_delobj(voccxdef *ctx, objnum objn);
void vocdusave_me(voccxdef *ctx, objnum old_me);
/* compute vocabulary word hash value */
-uint vochsh(uchar *t, int len);
+uint vochsh(const uchar *t, int len);
/* TADS versions of isalpha, isspace, isdigit, etc */
#define vocisupper(c) ((uchar)(c) <= 127 && Common::isUpper((uchar)(c)))
diff --git a/engines/glk/tads/tads2/vocabulary_parser.cpp b/engines/glk/tads/tads2/vocabulary_parser.cpp
index 0b7bed6db9..a70c6f85d1 100644
--- a/engines/glk/tads/tads2/vocabulary_parser.cpp
+++ b/engines/glk/tads/tads2/vocabulary_parser.cpp
@@ -32,7 +32,7 @@ namespace TADS {
namespace TADS2 {
-static char *type_names[] =
+static const char *type_names[] =
{
"article", "adj", "noun", "prep", "verb", "special", "plural",
"unknown"
@@ -203,10 +203,10 @@ void voc_push_objlist(voccxdef *ctx, objnum objlist[], int cnt)
* byte. The list is bounded by firstwrd and lastwrd, inclusive of
* both.
*/
-static void voc_push_strlist(voccxdef *ctx, char *firstwrd, char *lastwrd)
+static void voc_push_strlist(voccxdef *ctx, const char *firstwrd, const char *lastwrd)
{
size_t curlen;
- char *p;
+ const char *p;
uint lstsiz;
uchar *lstp;
@@ -390,7 +390,7 @@ static void voc_push_toklist(voccxdef *ctx, char *wordlist[], int cnt)
int vocread(voccxdef *ctx, objnum actor, objnum verb,
char *buf, int bufl, int type)
{
- char *prompt;
+ const char *prompt;
int ret;
/* presume we'll return success */
@@ -528,7 +528,7 @@ int vocread(voccxdef *ctx, objnum actor, objnum verb,
* the user's entry, the second is the reference word in the dictionary.)
* Returns TRUE if the words match, FALSE otherwise.
*/
-static int voceq(uchar *s1, uint l1, uchar *s2, uint l2)
+static int voceq(const uchar *s1, uint l1, uchar *s2, uint l2)
{
uint i;
@@ -599,7 +599,7 @@ vocwdef *vocfnw(voccxdef *voccx, vocseadef *search_ctx)
}
/* find the first vocdef matching a set of words */
-vocwdef *vocffw(voccxdef *ctx, char *wrd, int len, char *wrd2, int len2,
+vocwdef *vocffw(voccxdef *ctx, const char *wrd, int len, const char *wrd2, int len2,
int p, vocseadef *search_ctx)
{
uint hshval;
@@ -607,15 +607,15 @@ vocwdef *vocffw(voccxdef *ctx, char *wrd, int len, char *wrd2, int len2,
vocwdef *vw, *vwf = nullptr;
/* get the word's hash value */
- hshval = vochsh((uchar *)wrd, len);
+ hshval = vochsh((const uchar *)wrd, len);
/* scan the hash list until we run out of entries, or find a match */
for (v = ctx->voccxhsh[hshval], vf = 0 ; v != 0 && vf == 0 ;
v = v->vocnxt)
{
/* if this word matches, look at the objects in its list */
- if (voceq((uchar *)wrd, len, v->voctxt, v->voclen)
- && voceq((uchar *)wrd2, len2, v->voctxt + v->voclen, v->vocln2))
+ if (voceq((const uchar *)wrd, len, v->voctxt, v->voclen)
+ && voceq((const uchar *)wrd2, len2, v->voctxt + v->voclen, v->vocln2))
{
/* look for a suitable object in the vocwdef list */
for (vw = vocwget(ctx, v->vocwlst) ; vw ;
@@ -646,9 +646,9 @@ vocwdef *vocffw(voccxdef *ctx, char *wrd, int len, char *wrd2, int len2,
search_ctx->vw = vw;
/* save the search criteria */
- search_ctx->wrd1 = (uchar *)wrd;
+ search_ctx->wrd1 = (const uchar *)wrd;
search_ctx->len1 = len;
- search_ctx->wrd2 = (uchar *)wrd2;
+ search_ctx->wrd2 = (const uchar *)wrd2;
search_ctx->len2 = len2;
}
@@ -970,7 +970,7 @@ void vocerr(voccxdef *ctx, int err, const char *f, ...)
*/
int try_unknown_verb(voccxdef *ctx, objnum actor,
char **cmd, int *typelist, int wrdcnt, int *next_start,
- int do_fuses, int vocerr_err, char *vocerr_msg, ...)
+ int do_fuses, int vocerr_err, const char *vocerr_msg, ...)
{
int show_msg;
va_list argptr;
@@ -1169,7 +1169,7 @@ int try_unknown_verb(voccxdef *ctx, objnum actor,
#define vocisspec(wrd) \
(vocisupper(*wrd) || (!vocisalpha(*wrd) && *wrd != '\'' && *wrd != '-'))
-static vocspdef vocsptab[] =
+static const vocspdef vocsptab[] =
{
{ "of", VOCW_OF },
{ "and", VOCW_AND },
@@ -1191,7 +1191,7 @@ static vocspdef vocsptab[] =
};
/* test a word to see if it's a particular special word */
-static int voc_check_special(voccxdef *ctx, char *wrd, int checktyp)
+static int voc_check_special(voccxdef *ctx, const char *wrd, int checktyp)
{
/* search the user or built-in special table, as appropriate */
if (ctx->voccxspp)
@@ -1219,13 +1219,13 @@ static int voc_check_special(voccxdef *ctx, char *wrd, int checktyp)
}
else
{
- vocspdef *x;
+ const vocspdef *x;
for (x = vocsptab ; x->vocspin ; ++x)
{
/* if it matches in type and text, we have a match */
if (x->vocspout == checktyp
- && !strncmp((char *)wrd, x->vocspin, (size_t)6))
+ && !strncmp((const char *)wrd, x->vocspin, (size_t)6))
return TRUE;
}
}
@@ -1240,7 +1240,7 @@ int voctok(voccxdef *ctx, char *cmd, char *outbuf, char **wrd,
int lower, int cvt_ones, int show_errors)
{
int i;
- vocspdef *x;
+ const vocspdef *x;
int l;
char *p;
char *w;
@@ -1355,8 +1355,7 @@ int voctok(voccxdef *ctx, char *cmd, char *outbuf, char **wrd,
{
for (x = vocsptab ; x->vocspin ; ++x)
{
- if (!strncmp((char *)wrd[i-1], (char *)x->vocspin,
- (size_t)6)
+ if (!strncmp((char *)wrd[i-1], x->vocspin, (size_t)6)
&& (cvt_ones ||
(x->vocspout != VOCW_ONE
&& x->vocspout != VOCW_ONES))
@@ -1933,7 +1932,7 @@ static int vocisect_flags(objnum *list1, uint *flags1,
static int vocgol(voccxdef *ctx, objnum *list, uint *flags, char **wrdlst,
int *typlst, int first, int cur, int last, int ofword)
{
- char *wrd;
+ const char *wrd;
int typ;
vocwdef *v;
int cnt;
@@ -2437,7 +2436,7 @@ void voc_make_obj_name(voccxdef *ctx, char *namebuf, char *cmd[],
* Make an object name from a list entry
*/
void voc_make_obj_name_from_list(voccxdef *ctx, char *namebuf,
- char *cmd[], char *firstwrd, char *lastwrd)
+ char *cmd[], const char *firstwrd, const char *lastwrd)
{
int i, i1, i2;
@@ -2583,7 +2582,7 @@ static int vocg1o(voccxdef *ctx, char *cmd[], int typelist[],
n++;
if (!cmd[n])
{
- char *p;
+ const char *p;
int ver;
if (vocspec(cmd[cur], VOCW_ALL))
@@ -4628,7 +4627,7 @@ int vocchkvis(voccxdef *ctx, objnum obj, objnum cmdActor)
}
/* set {numObj | strObj}.value, as appropriate */
-void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, void *val,
+void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, const void *val,
vocoldef *inobj, vocoldef *outobj)
{
*outobj = *inobj;
@@ -4638,7 +4637,7 @@ void vocsetobj(voccxdef *ctx, objnum obj, dattyp typ, void *val,
/* set up a vocoldef */
static void vocout(vocoldef *outobj, objnum obj, int flg,
- char *fst, char *lst)
+ const char *fst, const char *lst)
{
outobj->vocolobj = obj;
outobj->vocolflg = flg;
@@ -4765,7 +4764,7 @@ static void voc_get_spec_str(voccxdef *ctx, char vocw_id,
/* set it/him/her */
static int vocsetit(voccxdef *ctx, objnum obj, int accprop,
objnum actor, objnum verb, objnum prep,
- vocoldef *outobj, char *default_name, char vocw_id,
+ vocoldef *outobj, const char *default_name, char vocw_id,
prpnum defprop, int silent)
{
if (obj == MCMONINV || !vocchkaccess(ctx, obj, (prpnum)accprop,
@@ -4858,7 +4857,7 @@ static int voc_disambig_hook(voccxdef *ctx, objnum verb, objnum actor,
objnum prep, objnum otherobj,
prpnum accprop, prpnum verprop,
objnum *objlist, uint *flags, int *objcount,
- char *firstwrd, char *lastwrd,
+ const char *firstwrd, const char *lastwrd,
int num_wanted, int is_ambig, char *resp,
int silent)
{
@@ -5477,7 +5476,7 @@ int vocdisambig(voccxdef *ctx, vocoldef *outlist, vocoldef *inlist,
int lpos = inpos;
int i = 0;
int cnt;
- char *p;
+ const char *p;
int cnt2, cnt3;
int trying_again;
int user_count = 0;
@@ -6985,7 +6984,7 @@ int vocdisambig(voccxdef *ctx, vocoldef *outlist, vocoldef *inlist,
* use "such"
*/
if (i != cnt2) {
- char *last;
+ const char *last;
/* clear the word buffer */
newobj[0] = '\0';