COMMON: Move isFoo functions to namespace Common, add doxygen comments
This commit is contained in:
parent
658080deed
commit
4f8665fc83
34 changed files with 131 additions and 83 deletions
|
@ -277,7 +277,7 @@ void registerDefaults() {
|
||||||
// resp. between "--some-option" and "--no-some-option".
|
// resp. between "--some-option" and "--no-some-option".
|
||||||
#define DO_OPTION_BOOL(shortCmd, longCmd) \
|
#define DO_OPTION_BOOL(shortCmd, longCmd) \
|
||||||
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
|
if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
|
||||||
bool boolValue = (isLower(s[1]) != 0); \
|
bool boolValue = (Common::isLower(s[1]) != 0); \
|
||||||
s += 2; \
|
s += 2; \
|
||||||
if (isLongCmd) { \
|
if (isLongCmd) { \
|
||||||
boolValue = !strcmp(s, longCmd); \
|
boolValue = !strcmp(s, longCmd); \
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
static bool isValidDomainName(const Common::String &domName) {
|
static bool isValidDomainName(const Common::String &domName) {
|
||||||
const char *p = domName.c_str();
|
const char *p = domName.c_str();
|
||||||
while (*p && (isAlnum(*p) || *p == '-' || *p == '_'))
|
while (*p && (Common::isAlnum(*p) || *p == '-' || *p == '_'))
|
||||||
p++;
|
p++;
|
||||||
return *p == 0;
|
return *p == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,9 +415,6 @@ void updateGameGUIOptions(const String &options, const String &langOption) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Common
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Instead of a blind cast, we might want to verify
|
// TODO: Instead of a blind cast, we might want to verify
|
||||||
// if c equals EOS; and/or is in the range -255..+255;
|
// if c equals EOS; and/or is in the range -255..+255;
|
||||||
|
@ -435,10 +432,6 @@ bool isDigit(int c) {
|
||||||
return isdigit((byte)c);
|
return isdigit((byte)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNumber(int c) {
|
|
||||||
return isnumber((byte)c);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLower(int c) {
|
bool isLower(int c) {
|
||||||
return islower((byte)c);
|
return islower((byte)c);
|
||||||
}
|
}
|
||||||
|
@ -450,3 +443,5 @@ bool isSpace(int c) {
|
||||||
bool isUpper(int c) {
|
bool isUpper(int c) {
|
||||||
return isupper((byte)c);
|
return isupper((byte)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
|
@ -34,17 +34,6 @@
|
||||||
((((size_t)value) & ((alignment) - 1)) == 0)
|
((((size_t)value) & ((alignment) - 1)) == 0)
|
||||||
|
|
||||||
|
|
||||||
//namespace{
|
|
||||||
bool isAlnum(int c);
|
|
||||||
bool isAlpha(int c);
|
|
||||||
bool isDigit(int c);
|
|
||||||
bool isNumber(int c);
|
|
||||||
bool isLower(int c);
|
|
||||||
bool isSpace(int c);
|
|
||||||
bool isUpper(int c);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MIN
|
#ifdef MIN
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#endif
|
#endif
|
||||||
|
@ -144,6 +133,70 @@ extern void hexdump(const byte * data, int len, int bytesPerLine = 16, int start
|
||||||
*/
|
*/
|
||||||
bool parseBool(const String &val, bool &valAsBool);
|
bool parseBool(const String &val, bool &valAsBool);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is alphanumeric (a-z, A-Z, 0-9).
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is alphanumeric, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isAlnum(int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is an alphabetic letter (a-z, A-Z).
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is TODO, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isAlpha(int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is a decimal-digit (0-9).
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is a decimal-digit, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isDigit(int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is a lower-case letter (a-z).
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is a lower-case letter, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isLower(int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is a white-space.
|
||||||
|
* White-space characters are ' ', '\t', '\r', '\n', '\v', '\f'.
|
||||||
|
*
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is a white-space, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isSpace(int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test whether the given character is an upper-case letter (A-Z).
|
||||||
|
* If the parameter is outside the range of a signed or unsigned char, then
|
||||||
|
* false is returned.
|
||||||
|
*
|
||||||
|
* @param c the character to test
|
||||||
|
* @return true if the character is an upper-case letter, false otherwise.
|
||||||
|
*/
|
||||||
|
bool isUpper(int c);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of game language.
|
* List of game language.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -250,7 +250,7 @@ void AgiEngine::processEvents() {
|
||||||
// Not a special key, so get the ASCII code for it
|
// Not a special key, so get the ASCII code for it
|
||||||
key = event.kbd.ascii;
|
key = event.kbd.ascii;
|
||||||
|
|
||||||
if (isAlpha(key)) {
|
if (Common::isAlpha(key)) {
|
||||||
// Key is A-Z.
|
// Key is A-Z.
|
||||||
// Map Ctrl-A to 1, Ctrl-B to 2, etc.
|
// Map Ctrl-A to 1, Ctrl-B to 2, etc.
|
||||||
if (event.kbd.flags & Common::KBD_CTRL) {
|
if (event.kbd.flags & Common::KBD_CTRL) {
|
||||||
|
|
|
@ -112,11 +112,11 @@ WagFileParser::~WagFileParser() {
|
||||||
bool WagFileParser::checkAgiVersionProperty(const WagProperty &version) const {
|
bool WagFileParser::checkAgiVersionProperty(const WagProperty &version) const {
|
||||||
if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property
|
if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property
|
||||||
version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y"
|
version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y"
|
||||||
isDigit(version.getData()[0]) && // And the first character must be a digit
|
Common::isDigit(version.getData()[0]) && // And the first character must be a digit
|
||||||
(version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period
|
(version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period
|
||||||
|
|
||||||
for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits
|
for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits
|
||||||
if (!isDigit(version.getData()[i]))
|
if (!Common::isDigit(version.getData()[i]))
|
||||||
return false; // Bail out if found a non-digit after the decimal point
|
return false; // Bail out if found a non-digit after the decimal point
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -466,8 +466,8 @@ void AGOSEngine_PN::opn_opcode35() {
|
||||||
void AGOSEngine_PN::opn_opcode36() {
|
void AGOSEngine_PN::opn_opcode36() {
|
||||||
for (int i = 0; i < _dataBase[57] + 1; ++i)
|
for (int i = 0; i < _dataBase[57] + 1; ++i)
|
||||||
_wordcp[i] = 0;
|
_wordcp[i] = 0;
|
||||||
if (isSpace(*_inpp))
|
if (Common::isSpace(*_inpp))
|
||||||
while ((*_inpp) && (isSpace(*_inpp)))
|
while ((*_inpp) && (Common::isSpace(*_inpp)))
|
||||||
_inpp++;
|
_inpp++;
|
||||||
if (*_inpp == 0) {
|
if (*_inpp == 0) {
|
||||||
setScriptReturn(false);
|
setScriptReturn(false);
|
||||||
|
@ -481,7 +481,7 @@ void AGOSEngine_PN::opn_opcode36() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ct = 1;
|
int ct = 1;
|
||||||
while ((*_inpp != '.') && (*_inpp != ',') && (!isSpace(*_inpp)) && (*_inpp != '\0') &&
|
while ((*_inpp != '.') && (*_inpp != ',') && (!Common::isSpace(*_inpp)) && (*_inpp != '\0') &&
|
||||||
(*_inpp!='"')) {
|
(*_inpp!='"')) {
|
||||||
if (ct < _dataBase[57])
|
if (ct < _dataBase[57])
|
||||||
_wordcp[ct++] = *_inpp;
|
_wordcp[ct++] = *_inpp;
|
||||||
|
@ -581,7 +581,7 @@ void AGOSEngine_PN::opn_opcode46() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
while ((*x != '.') && (*x != ',') && (*x != '"') && (!isSpace(*x)) && (*x != '\0'))
|
while ((*x != '.') && (*x != ',') && (*x != '"') && (!Common::isSpace(*x)) && (*x != '\0'))
|
||||||
pcf(*x++);
|
pcf(*x++);
|
||||||
setScriptReturn(true);
|
setScriptReturn(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upperCase && *dst) {
|
if (upperCase && *dst) {
|
||||||
if (isLower(*dst))
|
if (Common::isLower(*dst))
|
||||||
*dst = toupper(*dst);
|
*dst = toupper(*dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ void AGOSEngine_PN::pcf(uint8 ch) {
|
||||||
if ((ch != 32) || (_bp + _xofs != 50))
|
if ((ch != 32) || (_bp + _xofs != 50))
|
||||||
_buffer[_bp++] = ch;
|
_buffer[_bp++] = ch;
|
||||||
}
|
}
|
||||||
if ((ch != 254) && (!isSpace(ch)) && (_bp < 60))
|
if ((ch != 254) && (!Common::isSpace(ch)) && (_bp < 60))
|
||||||
return;
|
return;
|
||||||
/* We know have a case of needing to print the text */
|
/* We know have a case of needing to print the text */
|
||||||
if (_bp + _xofs > 50) {
|
if (_bp + _xofs > 50) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ int16 Text::count() {
|
||||||
strcpy(tmpStr, line.c_str());
|
strcpy(tmpStr, line.c_str());
|
||||||
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
|
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!isDigit(*s))
|
if (!Common::isDigit(*s))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -105,7 +105,7 @@ void Text::load() {
|
||||||
strcpy(tmpStr, line.c_str());
|
strcpy(tmpStr, line.c_str());
|
||||||
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
|
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!isDigit(*s))
|
if (!Common::isDigit(*s))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int r = atoi(s);
|
int r = atoi(s);
|
||||||
|
|
|
@ -141,7 +141,7 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const {
|
||||||
|
|
||||||
for (file = filenames.begin(); file != filenames.end(); ++file) {
|
for (file = filenames.begin(); file != filenames.end(); ++file) {
|
||||||
// Jump over savegame files that don't end with a digit (e.g. "fw.3" is ok, "fw.a" is not).
|
// Jump over savegame files that don't end with a digit (e.g. "fw.3" is ok, "fw.a" is not).
|
||||||
if (!isDigit(file->lastChar()))
|
if (!Common::isDigit(file->lastChar()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Obtain the last digit of the filename, since they correspond to the save slot
|
// Obtain the last digit of the filename, since they correspond to the save slot
|
||||||
|
|
|
@ -119,7 +119,7 @@ char *strlwr(char *buffer) {
|
||||||
char *result = buffer;
|
char *result = buffer;
|
||||||
|
|
||||||
while (*buffer != '\0') {
|
while (*buffer != '\0') {
|
||||||
if (isUpper(*buffer))
|
if (Common::isUpper(*buffer))
|
||||||
*buffer = tolower(*buffer);
|
*buffer = tolower(*buffer);
|
||||||
buffer++;
|
buffer++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves)
|
||||||
s1 = (*i)[i->size() - 3];
|
s1 = (*i)[i->size() - 3];
|
||||||
s2 = (*i)[i->size() - 2];
|
s2 = (*i)[i->size() - 2];
|
||||||
s3 = (*i)[i->size() - 1];
|
s3 = (*i)[i->size() - 1];
|
||||||
if (!isDigit(s1) || !isDigit(s2) || !isDigit(s3))
|
if (!Common::isDigit(s1) || !Common::isDigit(s2) || !Common::isDigit(s3))
|
||||||
continue;
|
continue;
|
||||||
s1 -= '0';
|
s1 -= '0';
|
||||||
s2 -= '0';
|
s2 -= '0';
|
||||||
|
|
|
@ -1766,7 +1766,7 @@ uint LBCode::parseCode(const Common::String &source) {
|
||||||
{
|
{
|
||||||
Common::String tempString;
|
Common::String tempString;
|
||||||
while (pos < source.size()) {
|
while (pos < source.size()) {
|
||||||
if (!isAlpha(source[pos]) && !isDigit(source[pos]))
|
if (!Common::isAlpha(source[pos]) && !Common::isDigit(source[pos]))
|
||||||
break;
|
break;
|
||||||
tempString += source[pos++];
|
tempString += source[pos++];
|
||||||
}
|
}
|
||||||
|
@ -1777,7 +1777,7 @@ uint LBCode::parseCode(const Common::String &source) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isDigit(token)) {
|
if (Common::isDigit(token)) {
|
||||||
const char *in = source.c_str() + pos - 1;
|
const char *in = source.c_str() + pos - 1;
|
||||||
// FIXME: handle floats?
|
// FIXME: handle floats?
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
@ -1792,11 +1792,11 @@ uint LBCode::parseCode(const Common::String &source) {
|
||||||
WRITE_BE_UINT16(tmp, (int16)intValue);
|
WRITE_BE_UINT16(tmp, (int16)intValue);
|
||||||
code.push_back(tmp[0]);
|
code.push_back(tmp[0]);
|
||||||
code.push_back(tmp[1]);
|
code.push_back(tmp[1]);
|
||||||
} else if (isAlpha(token)) {
|
} else if (Common::isAlpha(token)) {
|
||||||
Common::String tempString;
|
Common::String tempString;
|
||||||
tempString += token;
|
tempString += token;
|
||||||
while (pos < source.size()) {
|
while (pos < source.size()) {
|
||||||
if (!isAlpha(source[pos]) && !isDigit(source[pos]))
|
if (!Common::isAlpha(source[pos]) && !Common::isDigit(source[pos]))
|
||||||
break;
|
break;
|
||||||
tempString += source[pos++];
|
tempString += source[pos++];
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
void accumPassword(uint16 ascii) {
|
void accumPassword(uint16 ascii) {
|
||||||
if (!isDigit(ascii)) {
|
if (!Common::isDigit(ascii)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -524,14 +524,14 @@ DECLARE_COMMAND_PARSER(location) {
|
||||||
ctxt.cmd->_startPos.x = -1000;
|
ctxt.cmd->_startPos.x = -1000;
|
||||||
ctxt.cmd->_startPos2.x = -1000;
|
ctxt.cmd->_startPos2.x = -1000;
|
||||||
if (_tokens[ctxt.nextToken][0] != '\0') {
|
if (_tokens[ctxt.nextToken][0] != '\0') {
|
||||||
if (isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
|
if (Common::isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
|
||||||
ctxt.cmd->_startPos.x = atoi(_tokens[ctxt.nextToken]);
|
ctxt.cmd->_startPos.x = atoi(_tokens[ctxt.nextToken]);
|
||||||
ctxt.nextToken++;
|
ctxt.nextToken++;
|
||||||
ctxt.cmd->_startPos.y = atoi(_tokens[ctxt.nextToken]);
|
ctxt.cmd->_startPos.y = atoi(_tokens[ctxt.nextToken]);
|
||||||
ctxt.nextToken++;
|
ctxt.nextToken++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
|
if (Common::isDigit(_tokens[ctxt.nextToken][0]) || _tokens[ctxt.nextToken][0] == '-') {
|
||||||
ctxt.cmd->_startPos2.x = atoi(_tokens[ctxt.nextToken]);
|
ctxt.cmd->_startPos2.x = atoi(_tokens[ctxt.nextToken]);
|
||||||
ctxt.nextToken++;
|
ctxt.nextToken++;
|
||||||
ctxt.cmd->_startPos2.y = atoi(_tokens[ctxt.nextToken]);
|
ctxt.cmd->_startPos2.y = atoi(_tokens[ctxt.nextToken]);
|
||||||
|
@ -677,7 +677,7 @@ DECLARE_COMMAND_PARSER(text) {
|
||||||
|
|
||||||
createCommand(_parser->_lookup);
|
createCommand(_parser->_lookup);
|
||||||
|
|
||||||
if (isDigit(_tokens[1][1])) {
|
if (Common::isDigit(_tokens[1][1])) {
|
||||||
ctxt.cmd->_zeta0 = atoi(_tokens[1]);
|
ctxt.cmd->_zeta0 = atoi(_tokens[1]);
|
||||||
ctxt.nextToken++;
|
ctxt.nextToken++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -714,7 +714,7 @@ DECLARE_COMMAND_PARSER(unary) {
|
||||||
DECLARE_ZONE_PARSER(limits) {
|
DECLARE_ZONE_PARSER(limits) {
|
||||||
debugC(7, kDebugParser, "ZONE_PARSER(limits) ");
|
debugC(7, kDebugParser, "ZONE_PARSER(limits) ");
|
||||||
|
|
||||||
if (isAlpha(_tokens[1][1])) {
|
if (Common::isAlpha(_tokens[1][1])) {
|
||||||
ctxt.z->_flags |= kFlagsAnimLinked;
|
ctxt.z->_flags |= kFlagsAnimLinked;
|
||||||
ctxt.z->_linkedName = _tokens[1];
|
ctxt.z->_linkedName = _tokens[1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1003,7 +1003,7 @@ DECLARE_INSTRUCTION_PARSER(text) {
|
||||||
|
|
||||||
int _si = 1;
|
int _si = 1;
|
||||||
|
|
||||||
if (isDigit(_tokens[1][1])) {
|
if (Common::isDigit(_tokens[1][1])) {
|
||||||
ctxt.inst->_y = atoi(_tokens[1]);
|
ctxt.inst->_y = atoi(_tokens[1]);
|
||||||
_si = 2;
|
_si = 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1066,7 +1066,7 @@ DECLARE_INSTRUCTION_PARSER(endif) {
|
||||||
|
|
||||||
void ProgramParser_br::parseRValue(ScriptVar &v, const char *str) {
|
void ProgramParser_br::parseRValue(ScriptVar &v, const char *str) {
|
||||||
|
|
||||||
if (isDigit(str[0]) || str[0] == '-') {
|
if (Common::isDigit(str[0]) || str[0] == '-') {
|
||||||
v.setImmediate(atoi(str));
|
v.setImmediate(atoi(str));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ DECLARE_INSTRUCTION_PARSER(endscript) {
|
||||||
|
|
||||||
void ProgramParser_ns::parseRValue(ScriptVar &v, const char *str) {
|
void ProgramParser_ns::parseRValue(ScriptVar &v, const char *str) {
|
||||||
|
|
||||||
if (isDigit(str[0]) || str[0] == '-') {
|
if (Common::isDigit(str[0]) || str[0] == '-') {
|
||||||
v.setImmediate(atoi(str));
|
v.setImmediate(atoi(str));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -657,7 +657,7 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i
|
||||||
} else if (parameters->animation[0] == 'E') {
|
} else if (parameters->animation[0] == 'E') {
|
||||||
// Talking head animation
|
// Talking head animation
|
||||||
return;
|
return;
|
||||||
} else if (!isDigit(parameters->animation[0])) {
|
} else if (!Common::isDigit(parameters->animation[0])) {
|
||||||
debug(6, "Error in speak string animation: '%s'", parameters->animation);
|
debug(6, "Error in speak string animation: '%s'", parameters->animation);
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ void Interface::processStatusTextInput(Common::KeyState keystate) {
|
||||||
if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX) {
|
if (_statusTextInputPos >= STATUS_TEXT_INPUT_MAX) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isAlnum(keystate.ascii) || (keystate.ascii == ' ')) {
|
if (Common::isAlnum(keystate.ascii) || (keystate.ascii == ' ')) {
|
||||||
_statusTextInputString[_statusTextInputPos++] = keystate.ascii;
|
_statusTextInputString[_statusTextInputPos++] = keystate.ascii;
|
||||||
_statusTextInputString[_statusTextInputPos] = 0;
|
_statusTextInputString[_statusTextInputPos] = 0;
|
||||||
}
|
}
|
||||||
|
@ -1209,7 +1209,7 @@ bool Interface::processTextInput(Common::KeyState keystate) {
|
||||||
_textInputPos = _textInputStringLength + 1;
|
_textInputPos = _textInputStringLength + 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (((keystate.ascii <= 255) && (isAlnum(keystate.ascii))) || (keystate.ascii == ' ') ||
|
if (((keystate.ascii <= 255) && (Common::isAlnum(keystate.ascii))) || (keystate.ascii == ' ') ||
|
||||||
(keystate.ascii == '-') || (keystate.ascii == '_')) {
|
(keystate.ascii == '-') || (keystate.ascii == '_')) {
|
||||||
if (_textInputStringLength < save_title_size - 1) {
|
if (_textInputStringLength < save_title_size - 1) {
|
||||||
ch[0] = keystate.ascii;
|
ch[0] = keystate.ascii;
|
||||||
|
|
|
@ -147,7 +147,7 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
|
||||||
Common::String source_str = s->_segMan->getString(argv[0]);
|
Common::String source_str = s->_segMan->getString(argv[0]);
|
||||||
const char *source = source_str.c_str();
|
const char *source = source_str.c_str();
|
||||||
|
|
||||||
while (isSpace(*source))
|
while (Common::isSpace(*source))
|
||||||
source++; /* Skip whitespace */
|
source++; /* Skip whitespace */
|
||||||
|
|
||||||
int16 result = 0;
|
int16 result = 0;
|
||||||
|
@ -246,14 +246,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
|
||||||
|
|
||||||
/* int writelength; -- unused atm */
|
/* int writelength; -- unused atm */
|
||||||
|
|
||||||
if (xfer && (isDigit(xfer) || xfer == '-' || xfer == '=')) {
|
if (xfer && (Common::isDigit(xfer) || xfer == '-' || xfer == '=')) {
|
||||||
char *destp;
|
char *destp;
|
||||||
|
|
||||||
if (xfer == '0')
|
if (xfer == '0')
|
||||||
fillchar = '0';
|
fillchar = '0';
|
||||||
else if (xfer == '=')
|
else if (xfer == '=')
|
||||||
align = ALIGN_CENTER;
|
align = ALIGN_CENTER;
|
||||||
else if (isDigit(xfer) || (xfer == '-'))
|
else if (Common::isDigit(xfer) || (xfer == '-'))
|
||||||
source--; // Go to start of length argument
|
source--; // Go to start of length argument
|
||||||
|
|
||||||
strLength = strtol(source, &destp, 10);
|
strLength = strtol(source, &destp, 10);
|
||||||
|
|
|
@ -100,7 +100,7 @@ int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int1
|
||||||
// cX -> sets textColor to _textColors[X-1]
|
// cX -> sets textColor to _textColors[X-1]
|
||||||
curCode = textCode[0];
|
curCode = textCode[0];
|
||||||
curCodeParm = textCode[1];
|
curCodeParm = textCode[1];
|
||||||
if (isDigit(curCodeParm)) {
|
if (Common::isDigit(curCodeParm)) {
|
||||||
curCodeParm -= '0';
|
curCodeParm -= '0';
|
||||||
} else {
|
} else {
|
||||||
curCodeParm = -1;
|
curCodeParm = -1;
|
||||||
|
|
|
@ -534,7 +534,7 @@ bool Vocabulary::tokenizeString(ResultWordListList &retval, const char *sentence
|
||||||
do {
|
do {
|
||||||
|
|
||||||
c = sentence[pos_in_sentence++];
|
c = sentence[pos_in_sentence++];
|
||||||
if (isAlnum(c) || (c == '-' && wordLen) || (c >= 0x80)) {
|
if (Common::isAlnum(c) || (c == '-' && wordLen) || (c >= 0x80)) {
|
||||||
currentWord[wordLen] = lowerCaseMap[c];
|
currentWord[wordLen] = lowerCaseMap[c];
|
||||||
++wordLen;
|
++wordLen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1558,7 +1558,7 @@ void ResourceManager::readResourcePatches() {
|
||||||
name = (*x)->getName();
|
name = (*x)->getName();
|
||||||
|
|
||||||
// SCI1 scheme
|
// SCI1 scheme
|
||||||
if (isDigit(name[0])) {
|
if (Common::isDigit(name[0])) {
|
||||||
char *end = 0;
|
char *end = 0;
|
||||||
resourceNr = strtol(name.c_str(), &end, 10);
|
resourceNr = strtol(name.c_str(), &end, 10);
|
||||||
bAdd = (*end == '.'); // Ensure the next character is the period
|
bAdd = (*end == '.'); // Ensure the next character is the period
|
||||||
|
@ -1566,7 +1566,7 @@ void ResourceManager::readResourcePatches() {
|
||||||
// SCI0 scheme
|
// SCI0 scheme
|
||||||
int resname_len = strlen(szResType);
|
int resname_len = strlen(szResType);
|
||||||
if (scumm_strnicmp(name.c_str(), szResType, resname_len) == 0
|
if (scumm_strnicmp(name.c_str(), szResType, resname_len) == 0
|
||||||
&& !isAlpha(name[resname_len + 1])) {
|
&& !Common::isAlpha(name[resname_len + 1])) {
|
||||||
resourceNr = atoi(name.c_str() + resname_len + 1);
|
resourceNr = atoi(name.c_str() + resname_len + 1);
|
||||||
bAdd = true;
|
bAdd = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ void ResourceManager::readWaveAudioPatches() {
|
||||||
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
|
for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
|
||||||
Common::String name = (*x)->getName();
|
Common::String name = (*x)->getName();
|
||||||
|
|
||||||
if (isDigit(name[0]))
|
if (Common::isDigit(name[0]))
|
||||||
processWavePatch(ResourceId(kResourceTypeAudio, atoi(name.c_str())), name);
|
processWavePatch(ResourceId(kResourceTypeAudio, atoi(name.c_str())), name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ public:
|
||||||
assert(def_end != NULL);
|
assert(def_end != NULL);
|
||||||
|
|
||||||
char *id_end = def_end;
|
char *id_end = def_end;
|
||||||
while (id_end >= def_start && !isDigit(*(id_end-1))) {
|
while (id_end >= def_start && !Common::isDigit(*(id_end-1))) {
|
||||||
id_end--;
|
id_end--;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(id_end > def_start);
|
assert(id_end > def_start);
|
||||||
char *id_start = id_end;
|
char *id_start = id_end;
|
||||||
while (isDigit(*(id_start - 1))) {
|
while (Common::isDigit(*(id_start - 1))) {
|
||||||
id_start--;
|
id_start--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1389,10 +1389,10 @@ void ScummEngine_v7::loadLanguageBundle() {
|
||||||
} else if (*ptr == '#') {
|
} else if (*ptr == '#') {
|
||||||
// Number of subtags following a given basetag. We don't need that
|
// Number of subtags following a given basetag. We don't need that
|
||||||
// information so we just skip it
|
// information so we just skip it
|
||||||
} else if (isDigit(*ptr)) {
|
} else if (Common::isDigit(*ptr)) {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
// A number (up to three digits)...
|
// A number (up to three digits)...
|
||||||
while (isDigit(*ptr)) {
|
while (Common::isDigit(*ptr)) {
|
||||||
idx = idx * 10 + (*ptr - '0');
|
idx = idx * 10 + (*ptr - '0');
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
@ -1430,12 +1430,12 @@ void ScummEngine_v7::loadLanguageBundle() {
|
||||||
for (i = 0; i < _languageIndexSize; i++) {
|
for (i = 0; i < _languageIndexSize; i++) {
|
||||||
// First 8 chars in the line give the string ID / 'tag'
|
// First 8 chars in the line give the string ID / 'tag'
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 8 && !isSpace(*ptr); j++, ptr++)
|
for (j = 0; j < 8 && !Common::isSpace(*ptr); j++, ptr++)
|
||||||
_languageIndex[i].tag[j] = toupper(*ptr);
|
_languageIndex[i].tag[j] = toupper(*ptr);
|
||||||
_languageIndex[i].tag[j] = 0;
|
_languageIndex[i].tag[j] = 0;
|
||||||
|
|
||||||
// After that follows a single space which we skip
|
// After that follows a single space which we skip
|
||||||
assert(isSpace(*ptr));
|
assert(Common::isSpace(*ptr));
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
// Then comes the translated string: we record an offset to that.
|
// Then comes the translated string: we record an offset to that.
|
||||||
|
|
|
@ -974,7 +974,7 @@ void Control::handleKeyPress(Common::KeyState kbd, Common::String &textBuf) {
|
||||||
|
|
||||||
// Allow the key only if is a letter, a digit, or one of a selected
|
// Allow the key only if is a letter, a digit, or one of a selected
|
||||||
// list of extra characters
|
// list of extra characters
|
||||||
if (isAlnum(kbd.ascii) || strchr(" ,().='-&+!?\"", kbd.ascii) != 0) {
|
if (Common::isAlnum(kbd.ascii) || strchr(" ,().='-&+!?\"", kbd.ascii) != 0) {
|
||||||
textBuf += kbd.ascii;
|
textBuf += kbd.ascii;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
|
||||||
// Extract the extension
|
// Extract the extension
|
||||||
Common::String ext = file->c_str() + file->size() - 3;
|
Common::String ext = file->c_str() + file->size() - 3;
|
||||||
ext.toUppercase();
|
ext.toUppercase();
|
||||||
if (isDigit(ext[0]) && isDigit(ext[1]) && isDigit(ext[2])) {
|
if (Common::isDigit(ext[0]) && Common::isDigit(ext[1]) && Common::isDigit(ext[2])) {
|
||||||
int slotNum = atoi(ext.c_str());
|
int slotNum = atoi(ext.c_str());
|
||||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||||
if (in) {
|
if (in) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ bool MoviePlayer::load(uint32 id) {
|
||||||
int startFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
int startFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
||||||
int endFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
int endFrame = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
||||||
|
|
||||||
while (*ptr && isSpace(*ptr))
|
while (*ptr && Common::isSpace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if (startFrame > endFrame) {
|
if (startFrame > endFrame) {
|
||||||
|
@ -132,7 +132,7 @@ bool MoviePlayer::load(uint32 id) {
|
||||||
if (*ptr == '@') {
|
if (*ptr == '@') {
|
||||||
++ptr;
|
++ptr;
|
||||||
color = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
color = strtoul(ptr, const_cast<char **>(&ptr), 10);
|
||||||
while (*ptr && isSpace(*ptr))
|
while (*ptr && Common::isSpace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static int luaB_tonumber (lua_State *L) {
|
||||||
luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
|
luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
|
||||||
n = strtoul(s1, &s2, base);
|
n = strtoul(s1, &s2, base);
|
||||||
if (s1 != s2) { /* at least one valid digit? */
|
if (s1 != s2) { /* at least one valid digit? */
|
||||||
while (isSpace(*s2)) s2++; /* skip trailing spaces */
|
while (Common::isSpace(*s2)) s2++; /* skip trailing spaces */
|
||||||
if (*s2 == '\0') { /* no invalid trailing characters? */
|
if (*s2 == '\0') { /* no invalid trailing characters? */
|
||||||
lua_pushnumber(L, (lua_Number)n);
|
lua_pushnumber(L, (lua_Number)n);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -186,7 +186,7 @@ static void trydecpoint (LexState *ls, SemInfo *seminfo) {
|
||||||
sprintf(buf, "%.1f", 1.0);
|
sprintf(buf, "%.1f", 1.0);
|
||||||
ls->decpoint = '.';
|
ls->decpoint = '.';
|
||||||
for (i = 0; buf[i]; i++) {
|
for (i = 0; buf[i]; i++) {
|
||||||
if (!isSpace(buf[i]) && !isDigit(buf[i])) {
|
if (!Common::isSpace(buf[i]) && !Common::isDigit(buf[i])) {
|
||||||
ls->decpoint = buf[i];
|
ls->decpoint = buf[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -202,13 +202,13 @@ static void trydecpoint (LexState *ls, SemInfo *seminfo) {
|
||||||
|
|
||||||
/* LUA_NUMBER */
|
/* LUA_NUMBER */
|
||||||
static void read_numeral (LexState *ls, SemInfo *seminfo) {
|
static void read_numeral (LexState *ls, SemInfo *seminfo) {
|
||||||
lua_assert(isDigit(ls->current));
|
lua_assert(Common::isDigit(ls->current));
|
||||||
do {
|
do {
|
||||||
save_and_next(ls);
|
save_and_next(ls);
|
||||||
} while (isDigit(ls->current) || ls->current == '.');
|
} while (Common::isDigit(ls->current) || ls->current == '.');
|
||||||
if (check_next(ls, "Ee")) /* `E'? */
|
if (check_next(ls, "Ee")) /* `E'? */
|
||||||
check_next(ls, "+-"); /* optional exponent sign */
|
check_next(ls, "+-"); /* optional exponent sign */
|
||||||
while (isAlnum(ls->current) || ls->current == '_')
|
while (Common::isAlnum(ls->current) || ls->current == '_')
|
||||||
save_and_next(ls);
|
save_and_next(ls);
|
||||||
save(ls, '\0');
|
save(ls, '\0');
|
||||||
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
|
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
|
||||||
|
@ -311,7 +311,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
|
||||||
case '\r': save(ls, '\n'); inclinenumber(ls); continue;
|
case '\r': save(ls, '\n'); inclinenumber(ls); continue;
|
||||||
case EOZ: continue; /* will raise an error next loop */
|
case EOZ: continue; /* will raise an error next loop */
|
||||||
default: {
|
default: {
|
||||||
if (!isDigit(ls->current))
|
if (!Common::isDigit(ls->current))
|
||||||
save_and_next(ls); /* handles \\, \", \', and \? */
|
save_and_next(ls); /* handles \\, \", \', and \? */
|
||||||
else { /* \xxx */
|
else { /* \xxx */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -319,7 +319,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
|
||||||
do {
|
do {
|
||||||
c = 10*c + (ls->current-'0');
|
c = 10*c + (ls->current-'0');
|
||||||
next(ls);
|
next(ls);
|
||||||
} while (++i<3 && isDigit(ls->current));
|
} while (++i<3 && Common::isDigit(ls->current));
|
||||||
if (c > UCHAR_MAX)
|
if (c > UCHAR_MAX)
|
||||||
luaX_lexerror(ls, "escape sequence too large", TK_STRING);
|
luaX_lexerror(ls, "escape sequence too large", TK_STRING);
|
||||||
save(ls, c);
|
save(ls, c);
|
||||||
|
@ -410,7 +410,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
|
||||||
return TK_DOTS; /* ... */
|
return TK_DOTS; /* ... */
|
||||||
else return TK_CONCAT; /* .. */
|
else return TK_CONCAT; /* .. */
|
||||||
}
|
}
|
||||||
else if (!isDigit(ls->current)) return '.';
|
else if (!Common::isDigit(ls->current)) return '.';
|
||||||
else {
|
else {
|
||||||
read_numeral(ls, seminfo);
|
read_numeral(ls, seminfo);
|
||||||
return TK_NUMBER;
|
return TK_NUMBER;
|
||||||
|
@ -420,21 +420,21 @@ static int llex (LexState *ls, SemInfo *seminfo) {
|
||||||
return TK_EOS;
|
return TK_EOS;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (isSpace(ls->current)) {
|
if (Common::isSpace(ls->current)) {
|
||||||
lua_assert(!currIsNewline(ls));
|
lua_assert(!currIsNewline(ls));
|
||||||
next(ls);
|
next(ls);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (isDigit(ls->current)) {
|
else if (Common::isDigit(ls->current)) {
|
||||||
read_numeral(ls, seminfo);
|
read_numeral(ls, seminfo);
|
||||||
return TK_NUMBER;
|
return TK_NUMBER;
|
||||||
}
|
}
|
||||||
else if (isAlpha(ls->current) || ls->current == '_') {
|
else if (Common::isAlpha(ls->current) || ls->current == '_') {
|
||||||
/* identifier or reserved word */
|
/* identifier or reserved word */
|
||||||
TString *ts;
|
TString *ts;
|
||||||
do {
|
do {
|
||||||
save_and_next(ls);
|
save_and_next(ls);
|
||||||
} while (isAlnum(ls->current) || ls->current == '_');
|
} while (Common::isAlnum(ls->current) || ls->current == '_');
|
||||||
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
|
ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
|
||||||
luaZ_bufflen(ls->buff));
|
luaZ_bufflen(ls->buff));
|
||||||
if (ts->tsv.reserved > 0) /* reserved word? */
|
if (ts->tsv.reserved > 0) /* reserved word? */
|
||||||
|
|
|
@ -90,7 +90,7 @@ int luaO_str2d (const char *s, lua_Number *result) {
|
||||||
if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
|
if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
|
||||||
*result = cast_num(strtoul(s, &endptr, 16));
|
*result = cast_num(strtoul(s, &endptr, 16));
|
||||||
if (*endptr == '\0') return 1; /* most common case */
|
if (*endptr == '\0') return 1; /* most common case */
|
||||||
while (isSpace(*endptr)) endptr++;
|
while (Common::isSpace(*endptr)) endptr++;
|
||||||
if (*endptr != '\0') return 0; /* invalid trailing characters? */
|
if (*endptr != '\0') return 0; /* invalid trailing characters? */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co
|
||||||
// 'wrap point' where wrapping could take place. Everything that
|
// 'wrap point' where wrapping could take place. Everything that
|
||||||
// came before it can now safely be added to the line, as we know
|
// came before it can now safely be added to the line, as we know
|
||||||
// that it will not have to be wrapped.
|
// that it will not have to be wrapped.
|
||||||
if (isSpace(c)) {
|
if (Common::isSpace(c)) {
|
||||||
line += tmpStr;
|
line += tmpStr;
|
||||||
lineWidth += tmpWidth;
|
lineWidth += tmpWidth;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co
|
||||||
if (lineWidth > 0) {
|
if (lineWidth > 0) {
|
||||||
wrapper.add(line, lineWidth);
|
wrapper.add(line, lineWidth);
|
||||||
// Trim left side
|
// Trim left side
|
||||||
while (tmpStr.size() && isSpace(tmpStr[0])) {
|
while (tmpStr.size() && Common::isSpace(tmpStr[0])) {
|
||||||
tmpStr.deleteChar(0);
|
tmpStr.deleteChar(0);
|
||||||
// This is not very fast, but it is the simplest way to
|
// This is not very fast, but it is the simplest way to
|
||||||
// assure we do not mess something up because of kerning.
|
// assure we do not mess something up because of kerning.
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool tryInsertChar(byte c, int pos) {
|
bool tryInsertChar(byte c, int pos) {
|
||||||
if (isAlnum(c) || c == '-' || c == '_') {
|
if (Common::isAlnum(c) || c == '-' || c == '_') {
|
||||||
_editString.insertChar(c, pos);
|
_editString.insertChar(c, pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue