GLK: HUGO: Compilation fixes
This commit is contained in:
parent
96ebd81e5f
commit
88b2b3a166
6 changed files with 30 additions and 12 deletions
|
@ -25,6 +25,8 @@
|
||||||
namespace Glk {
|
namespace Glk {
|
||||||
namespace Hugo {
|
namespace Hugo {
|
||||||
|
|
||||||
|
static char EMPTY[1] = { 0 };
|
||||||
|
|
||||||
void Hugo::AP(const char *a) {
|
void Hugo::AP(const char *a) {
|
||||||
char sticky = false, skipspchar = false, startofline = 0;
|
char sticky = false, skipspchar = false, startofline = 0;
|
||||||
int i, alen, plen, cwidth;
|
int i, alen, plen, cwidth;
|
||||||
|
@ -461,6 +463,7 @@ int Hugo::CallRoutine(unsigned int addr) {
|
||||||
#endif
|
#endif
|
||||||
arg = 0;
|
arg = 0;
|
||||||
tail_recursion = 0;
|
tail_recursion = 0;
|
||||||
|
Common::fill(&temppass[0], &temppass[MAXLOCALS], 0);
|
||||||
|
|
||||||
/* Pass local variables to routine, if specified */
|
/* Pass local variables to routine, if specified */
|
||||||
if (MEM(codeptr)==OPEN_BRACKET_T)
|
if (MEM(codeptr)==OPEN_BRACKET_T)
|
||||||
|
@ -980,7 +983,6 @@ char *Hugo::GetText(long textaddr) {
|
||||||
char *Hugo::GetWord(unsigned int w) {
|
char *Hugo::GetWord(unsigned int w) {
|
||||||
char *b;
|
char *b;
|
||||||
unsigned short a;
|
unsigned short a;
|
||||||
static char *EMPTY = "";
|
|
||||||
|
|
||||||
a = w;
|
a = w;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ namespace Hugo {
|
||||||
|
|
||||||
#define STARTS_AS_NUMBER(a) (((a[0]>='0' && a[0]<='9') || a[0]=='-')?1:0)
|
#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) {
|
void Hugo::AddAllObjects(int loc) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -363,7 +365,7 @@ void Hugo::KillWord(int a) {
|
||||||
|
|
||||||
for (i=a; i<words; i++)
|
for (i=a; i<words; i++)
|
||||||
word[i] = word[i+1];
|
word[i] = word[i+1];
|
||||||
word[words] = "";
|
word[words] = EMPTY;
|
||||||
|
|
||||||
RemoveWord(a);
|
RemoveWord(a);
|
||||||
words--;
|
words--;
|
||||||
|
@ -371,7 +373,7 @@ void Hugo::KillWord(int a) {
|
||||||
|
|
||||||
int Hugo::MatchCommand() {
|
int Hugo::MatchCommand() {
|
||||||
int i, j, flag, a, mw = 0, gotspeaker = 0;
|
int i, j, flag, a, mw = 0, gotspeaker = 0;
|
||||||
int wordnum;
|
int wordnum = 0;
|
||||||
int numverbs = 0;
|
int numverbs = 0;
|
||||||
bool nextverb = false;
|
bool nextverb = false;
|
||||||
unsigned int ptr, verbptr, nextgrammar;
|
unsigned int ptr, verbptr, nextgrammar;
|
||||||
|
@ -2102,7 +2104,8 @@ NextSyn:
|
||||||
{
|
{
|
||||||
if (strcmp(word[i+1], "~and"))
|
if (strcmp(word[i+1], "~and"))
|
||||||
{
|
{
|
||||||
word[i] = "~and";
|
static char *END = "~and";
|
||||||
|
word[i] = END;
|
||||||
wd[i] = FindWord("~and");
|
wd[i] = FindWord("~and");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2112,7 +2115,7 @@ NextSyn:
|
||||||
if (wd[i]==period)
|
if (wd[i]==period)
|
||||||
{
|
{
|
||||||
wd[i] = 0;
|
wd[i] = 0;
|
||||||
word[i] = "";
|
word[i] = EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2331,7 +2334,7 @@ void Hugo::SeparateWords() {
|
||||||
|
|
||||||
for (i=0; i<MAXWORDS+1; i++)
|
for (i=0; i<MAXWORDS+1; i++)
|
||||||
{
|
{
|
||||||
word[i] = "";
|
word[i] = EMPTY;
|
||||||
wd[i] = 0;
|
wd[i] = 0;
|
||||||
}
|
}
|
||||||
word[1] = buffer;
|
word[1] = buffer;
|
||||||
|
|
|
@ -721,7 +721,7 @@ NormalTermination:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hugo::RunIf(char override) {
|
void Hugo::RunIf(char ovrride) {
|
||||||
char t, tempinexpr;
|
char t, tempinexpr;
|
||||||
long enterptr, skip;
|
long enterptr, skip;
|
||||||
|
|
||||||
|
@ -741,8 +741,7 @@ void Hugo::RunIf(char override) {
|
||||||
codeptr += 2;
|
codeptr += 2;
|
||||||
|
|
||||||
/* Check if we've already done an elseif */
|
/* Check if we've already done an elseif */
|
||||||
if (override && t==ELSEIF_T)
|
if (ovrride && (t == ELSEIF_T)) {
|
||||||
{
|
|
||||||
codeptr = skip+enterptr;
|
codeptr = skip+enterptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +788,7 @@ PasstoBlock:
|
||||||
enterptr = codeptr;
|
enterptr = codeptr;
|
||||||
codeptr += 2;
|
codeptr += 2;
|
||||||
|
|
||||||
if (override)
|
if (ovrride)
|
||||||
{
|
{
|
||||||
codeptr = skip+enterptr;
|
codeptr = skip+enterptr;
|
||||||
return;
|
return;
|
||||||
|
@ -2528,7 +2527,7 @@ int Hugo::RunSystem() {
|
||||||
#ifndef NO_STRFTIME
|
#ifndef NO_STRFTIME
|
||||||
TimeDate td;
|
TimeDate td;
|
||||||
g_system->getTimeAndDate(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);
|
td.tm_hour, td.tm_min, td.tm_sec);
|
||||||
#else
|
#else
|
||||||
hugo_gettimeformatted(parseerr);
|
hugo_gettimeformatted(parseerr);
|
||||||
|
@ -2606,7 +2605,7 @@ void Hugo::RunWindow() {
|
||||||
temp_current_text_y = current_text_y;
|
temp_current_text_y = current_text_y;
|
||||||
|
|
||||||
tempscript = script;
|
tempscript = script;
|
||||||
script = false;
|
script = nullptr;
|
||||||
restore_default_bgcolor = default_bgcolor;
|
restore_default_bgcolor = default_bgcolor;
|
||||||
|
|
||||||
/* v2.4 is the first version to support proper windowing */
|
/* v2.4 is the first version to support proper windowing */
|
||||||
|
|
|
@ -1010,6 +1010,12 @@ private:
|
||||||
return _random.getRandomNumber(0xffffff);
|
return _random.getRandomNumber(0xffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *itoa(int value, char *str, int base) {
|
||||||
|
assert(base == 10);
|
||||||
|
sprintf(str, "%d", value);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -106,5 +106,11 @@ char *StringFunctions::GetTempString() {
|
||||||
return r;
|
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 Hugo
|
||||||
} // End of namespace Glk
|
} // End of namespace Glk
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
char *Rtrim(char a[]);
|
char *Rtrim(char a[]);
|
||||||
|
|
||||||
char *hugo_strcpy(char *s, const char *t);
|
char *hugo_strcpy(char *s, const char *t);
|
||||||
|
|
||||||
|
char *strlwr(char *s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue