DIRECTOR: Rename Lingo::printSTUBWithArglist

This commit is contained in:
Scott Percival 2024-05-04 11:57:54 +08:00 committed by Eugene Sandulenko
parent ce447005da
commit 8b2a30dd65
6 changed files with 24 additions and 21 deletions

View File

@ -306,9 +306,12 @@ void Lingo::cleanupBuiltIns(BuiltinProto protos[]) {
}
}
void Lingo::printSTUBWithArglist(const char *funcname, int nargs, const char *prefix) {
Common::String s(funcname);
void Lingo::printArgs(const char *funcname, int nargs, const char *prefix) {
Common::String s;
if (prefix)
s += Common::String(prefix);
s += Common::String(funcname);
s += '(';
for (int i = 0; i < nargs; i++) {
@ -322,7 +325,7 @@ void Lingo::printSTUBWithArglist(const char *funcname, int nargs, const char *pr
s += ")";
debug(3, "%s %s", prefix, s.c_str());
debug(3, "%s", s.c_str());
}
void Lingo::convertVOIDtoString(int arg, int nargs) {

View File

@ -428,7 +428,7 @@ void LC::cb_localcall() {
if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) {
Common::String name = g_lingo->_state->context->_functionNames[functionId];
if (debugChannelSet(3, kDebugLingoExec))
printWithArgList(name.c_str(), nargs.u.i, "localcall:");
g_lingo->printArgs(name.c_str(), nargs.u.i, "localcall:");
LC::call(name, nargs.u.i, nargs.type == ARGC);

View File

@ -1500,7 +1500,7 @@ void LC::c_callfunc() {
void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
if (debugChannelSet(3, kDebugLingoExec))
printWithArgList(name.c_str(), nargs, "call:");
g_lingo->printArgs(name.c_str(), nargs, "call:");
Symbol funcSym;

View File

@ -51,7 +51,6 @@ class LingoCompiler;
typedef void (*inst)(void);
#define STOP (inst)0
#define ENTITY_INDEX(t,id) ((t) * 100000 + (id))
#define printWithArgList g_lingo->printSTUBWithArglist
int calcStringAlignment(const char *s);
int calcCodeAlignment(int l);
@ -413,7 +412,8 @@ public:
Datum getVoid();
void pushVoid();
void printSTUBWithArglist(const char *funcname, int nargs, const char *prefix = "STUB:");
void printArgs(const char *funcname, int nargs, const char *prefix = nullptr);
inline void printSTUBWithArglist(const char *funcname, int nargs) { printArgs(funcname, nargs, "STUB: "); }
void convertVOIDtoString(int arg, int nargs);
void dropStack(int nargs);
void drop(uint num);

View File

@ -245,7 +245,7 @@ void MMovieXObj::close(ObjectType type) {
}
void MMovieXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_new", nargs);
g_lingo->printArgs("MMovieXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
@ -254,7 +254,7 @@ XOBJSTUB(MMovieXObj::m_Movie, 0)
XOBJSTUBNR(MMovieXObj::m_dispose)
void MMovieXObj::m_openMMovie(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_openMMovie", nargs);
g_lingo->printArgs("MMovieXObj::m_openMMovie", nargs);
if (nargs != 1) {
g_lingo->dropStack(nargs);
g_lingo->push(Datum(-1));
@ -307,7 +307,7 @@ void MMovieXObj::m_openMMovie(int nargs) {
}
void MMovieXObj::m_closeMMovie(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_closeMMovie", nargs);
g_lingo->printArgs("MMovieXObj::m_closeMMovie", nargs);
if (nargs != 1) {
g_lingo->dropStack(nargs);
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_MOVIE_INDEX));
@ -337,7 +337,7 @@ void MMovieXObj::m_closeMMovie(int nargs) {
}
void MMovieXObj::m_playSegment(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_playSegment", nargs);
g_lingo->printArgs("MMovieXObj::m_playSegment", nargs);
if (nargs != 5) {
g_lingo->dropStack(nargs);
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
@ -375,7 +375,7 @@ void MMovieXObj::m_playSegment(int nargs) {
}
void MMovieXObj::m_playSegLoop(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_playSegLoop", nargs);
g_lingo->printArgs("MMovieXObj::m_playSegLoop", nargs);
if (nargs != 5) {
g_lingo->dropStack(nargs);
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
@ -421,7 +421,7 @@ void MMovieXObj::m_idleSegment(int nargs) {
}
void MMovieXObj::m_stopSegment(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_stopSegment", nargs);
g_lingo->printArgs("MMovieXObj::m_stopSegment", nargs);
if (nargs != 0) {
g_lingo->dropStack(nargs);
}
@ -431,7 +431,7 @@ void MMovieXObj::m_stopSegment(int nargs) {
}
void MMovieXObj::m_seekSegment(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_seekSegment", nargs);
g_lingo->printArgs("MMovieXObj::m_seekSegment", nargs);
if (nargs != 1) {
g_lingo->dropStack(nargs);
g_lingo->push(MMovieError::MMOVIE_INVALID_SEGMENT_NAME);
@ -451,7 +451,7 @@ void MMovieXObj::m_seekSegment(int nargs) {
XOBJSTUB(MMovieXObj::m_setSegmentTime, 0)
void MMovieXObj::m_setDisplayBounds(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_setDisplayBounds", nargs);
g_lingo->printArgs("MMovieXObj::m_setDisplayBounds", nargs);
if (nargs != 4) {
warning("MMovieXObj::m_setDisplayBounds: expecting 4 arguments!");
g_lingo->dropStack(nargs);
@ -472,7 +472,7 @@ XOBJSTUB(MMovieXObj::m_getMovieNormalWidth, 0)
XOBJSTUB(MMovieXObj::m_getMovieNormalHeight, 0)
void MMovieXObj::m_getSegCount(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_getSegCount", nargs);
g_lingo->printArgs("MMovieXObj::m_getSegCount", nargs);
if (nargs != 1) {
g_lingo->dropStack(nargs);
g_lingo->push(MMovieError::MMOVIE_INVALID_MOVIE_INDEX);
@ -511,7 +511,7 @@ void MMovieXObj::m_getSegName(int nargs) {
}
void MMovieXObj::m_getMovieRate(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_getMovieRate", nargs);
g_lingo->printArgs("MMovieXObj::m_getMovieRate", nargs);
if (nargs != 0) {
g_lingo->dropStack(nargs);
}
@ -520,7 +520,7 @@ void MMovieXObj::m_getMovieRate(int nargs) {
}
void MMovieXObj::m_setMovieRate(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_setMovieRate", nargs);
g_lingo->printArgs("MMovieXObj::m_setMovieRate", nargs);
if (nargs != 1) {
warning("MMovieXObj::m_setMovieRate: expecting 4 arguments");
g_lingo->dropStack(nargs);
@ -536,7 +536,7 @@ XOBJSTUB(MMovieXObj::m_flushEvents, 0)
XOBJSTUB(MMovieXObj::m_invalidateRect, 0)
void MMovieXObj::m_readFile(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_readFile", nargs);
g_lingo->printArgs("MMovieXObj::m_readFile", nargs);
if (nargs != 2) {
warning("MMovieXObj::m_readFile(): expecting 2 argument");
}
@ -597,7 +597,7 @@ void MMovieXObj::m_readFile(int nargs) {
}
void MMovieXObj::m_writeFile(int nargs) {
g_lingo->printSTUBWithArglist("MMovieXObj::m_writeFile", nargs);
g_lingo->printArgs("MMovieXObj::m_writeFile", nargs);
if (nargs != 3) {
warning("MMovieXObj::m_writeFile(): expecting 3 arguments");
}

View File

@ -292,7 +292,7 @@ void RemixXCMDState::interruptCheck() {
}
void RemixXCMD::m_Remix(int nargs) {
g_lingo->printSTUBWithArglist("RemixXCMD::m_Remix", nargs);
g_lingo->printArgs("RemixXCMD::m_Remix", nargs);
Datum result;
if (nargs != 1) {
result = Datum("Wrong number of params");