GLK: HUGO: Compilation fixes

This commit is contained in:
Paul Gilbert 2019-05-11 16:38:31 +10:00
parent 96ebd81e5f
commit 88b2b3a166
6 changed files with 30 additions and 12 deletions

View file

@ -25,6 +25,8 @@
namespace Glk {
namespace Hugo {
static char EMPTY[1] = { 0 };
void Hugo::AP(const char *a) {
char sticky = false, skipspchar = false, startofline = 0;
int i, alen, plen, cwidth;
@ -461,6 +463,7 @@ int Hugo::CallRoutine(unsigned int addr) {
#endif
arg = 0;
tail_recursion = 0;
Common::fill(&temppass[0], &temppass[MAXLOCALS], 0);
/* Pass local variables to routine, if specified */
if (MEM(codeptr)==OPEN_BRACKET_T)
@ -980,7 +983,6 @@ char *Hugo::GetText(long textaddr) {
char *Hugo::GetWord(unsigned int w) {
char *b;
unsigned short a;
static char *EMPTY = "";
a = w;

View file

@ -27,6 +27,8 @@ namespace Hugo {
#define STARTS_AS_NUMBER(a) (((a[0]>='0' && a[0]<='9') || a[0]=='-')?1:0)
static char EMPTY[1] = { 0 };
void Hugo::AddAllObjects(int loc) {
int i;
@ -363,7 +365,7 @@ void Hugo::KillWord(int a) {
for (i=a; i<words; i++)
word[i] = word[i+1];
word[words] = "";
word[words] = EMPTY;
RemoveWord(a);
words--;
@ -371,7 +373,7 @@ void Hugo::KillWord(int a) {
int Hugo::MatchCommand() {
int i, j, flag, a, mw = 0, gotspeaker = 0;
int wordnum;
int wordnum = 0;
int numverbs = 0;
bool nextverb = false;
unsigned int ptr, verbptr, nextgrammar;
@ -2102,7 +2104,8 @@ NextSyn:
{
if (strcmp(word[i+1], "~and"))
{
word[i] = "~and";
static char *END = "~and";
word[i] = END;
wd[i] = FindWord("~and");
}
else
@ -2112,7 +2115,7 @@ NextSyn:
if (wd[i]==period)
{
wd[i] = 0;
word[i] = "";
word[i] = EMPTY;
}
}
@ -2331,7 +2334,7 @@ void Hugo::SeparateWords() {
for (i=0; i<MAXWORDS+1; i++)
{
word[i] = "";
word[i] = EMPTY;
wd[i] = 0;
}
word[1] = buffer;

View file

@ -721,7 +721,7 @@ NormalTermination:
#endif
}
void Hugo::RunIf(char override) {
void Hugo::RunIf(char ovrride) {
char t, tempinexpr;
long enterptr, skip;
@ -741,8 +741,7 @@ void Hugo::RunIf(char override) {
codeptr += 2;
/* Check if we've already done an elseif */
if (override && t==ELSEIF_T)
{
if (ovrride && (t == ELSEIF_T)) {
codeptr = skip+enterptr;
return;
}
@ -789,7 +788,7 @@ PasstoBlock:
enterptr = codeptr;
codeptr += 2;
if (override)
if (ovrride)
{
codeptr = skip+enterptr;
return;
@ -2528,7 +2527,7 @@ int Hugo::RunSystem() {
#ifndef NO_STRFTIME
TimeDate td;
g_system->getTimeAndDate(td);
sprintf(parseerr, "%Y-%m-%d %H:%M:%S", td.tm_year, td.tm_mon, td.tm_mday,
sprintf(parseerr, "%d-%.2d-%.2d %d:%.2d:%.2d", td.tm_year, td.tm_mon, td.tm_mday,
td.tm_hour, td.tm_min, td.tm_sec);
#else
hugo_gettimeformatted(parseerr);
@ -2606,7 +2605,7 @@ void Hugo::RunWindow() {
temp_current_text_y = current_text_y;
tempscript = script;
script = false;
script = nullptr;
restore_default_bgcolor = default_bgcolor;
/* v2.4 is the first version to support proper windowing */

View file

@ -1010,6 +1010,12 @@ private:
return _random.getRandomNumber(0xffffff);
}
char *itoa(int value, char *str, int base) {
assert(base == 10);
sprintf(str, "%d", value);
return str;
}
/**@}*/
private:
/**

View file

@ -106,5 +106,11 @@ char *StringFunctions::GetTempString() {
return r;
}
char *StringFunctions::strlwr(char *s) {
for (char *sp = s; *sp; ++sp)
*sp = tolower(*sp);
return s;
}
} // End of namespace Hugo
} // End of namespace Glk

View file

@ -56,6 +56,8 @@ public:
char *Rtrim(char a[]);
char *hugo_strcpy(char *s, const char *t);
char *strlwr(char *s);
};