[Scummvm-git-logs] scummvm master -> ee4a8f8515a658f4944a1a855d283c441ef0aafd

sev- sev at scummvm.org
Mon Jun 15 22:17:15 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7b74d387b1 DIRECTOR: LINGO: Process more special symbols in IDs
ee4a8f8515 DIRECTOR: LINGO: Preprocess seldom macro calls


Commit: 7b74d387b18e83f2f0a8842c3c370fbfaf028c4a
    https://github.com/scummvm/scummvm/commit/7b74d387b18e83f2f0a8842c3c370fbfaf028c4a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-16T00:16:54+02:00

Commit Message:
DIRECTOR: LINGO: Process more special symbols in IDs

Changed paths:
    engines/director/lingo/lingo-preprocessor.cpp


diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index cbe62fa328..4c33aa078f 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -49,9 +49,9 @@ static Common::String nexttok(const char *s, const char **newP = nullptr) {
 
 		if (*s == '"')
 			res += *s++;
-	} else if (Common::isAlnum(*s)) {
+	} else if (Common::isAlnum(*s) || *s == '#') {
 		// Now copy everything till whitespace
-		while (*s && (Common::isAlnum(*s) || *s == '.'))
+		while (*s && (Common::isAlnum(*s) || *s == '.' || *s == '#' || *s == '_'))
 			res += *s++;
 	} else {
 		while (*s && isspec(*s))
@@ -85,7 +85,7 @@ static Common::String prevtok(const char *s, const char *lineStart, const char *
 			res = *s-- + res;
 	} else if (Common::isAlnum(*s)) { 	// Now copy everything till whitespace
 		// Now copy everything till whitespace
-		while (s >= lineStart && (Common::isAlnum(*s) || *s == '.'))
+		while (s >= lineStart && (Common::isAlnum(*s) || *s == '.' || *s == '#' || *s == '_'))
 			res = *s-- + res;
 	} else {
 		while (s >= lineStart && isspec(*s))


Commit: ee4a8f8515a658f4944a1a855d283c441ef0aafd
    https://github.com/scummvm/scummvm/commit/ee4a8f8515a658f4944a1a855d283c441ef0aafd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-16T00:16:54+02:00

Commit Message:
DIRECTOR: LINGO: Preprocess seldom macro calls

Changed paths:
    engines/director/lingo/lingo-preprocessor.cpp


diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index 4c33aa078f..9669c2977e 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -29,6 +29,7 @@ Common::String preprocessWhen(Common::String in, bool *changed);
 Common::String preprocessReturn(Common::String in);
 Common::String preprocessPlay(Common::String in);
 Common::String preprocessSound(Common::String in);
+Common::String preprocessSimpleMacro(Common::String in);
 
 bool isspec(char c) {
 	return strchr("-+*/%%^:,()><&[]=", c) != NULL;
@@ -246,6 +247,7 @@ Common::String Lingo::codePreprocessor(const char *s, ScriptType type, uint16 id
 			res1 = preprocessReturn(res1);
 			res1 = preprocessPlay(res1);
 			res1 = preprocessSound(res1);
+			res1 = preprocessSimpleMacro(res1);
 		}
 
 		res += res1;
@@ -658,4 +660,19 @@ Common::String preprocessSound(Common::String in) {
 	return res;
 }
 
+// <macro> '\n' -> <macro>() '\n'
+Common::String preprocessSimpleMacro(Common::String in) {
+	const char *second;
+	Common::String next = nexttok(in.c_str(), &second);
+
+	if (!next.empty() && Common::isAlpha(next[0]))
+		if (nexttok(second).empty() && !next.equals("end") && !next.equals("exit") && !next.equals("else")) {
+			debugC(2, kDebugParse | kDebugPreprocess, "MACRO: in: %s\nout: %s()", in.c_str(), in.c_str());
+
+			return in + "()";
+		}
+
+	return in;
+}
+
 } // End of namespace Director




More information about the Scummvm-git-logs mailing list