1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 12:17:12 +01:00

Prepare the script container for the revised script loading system.

This commit is contained in:
Sandu Liviu Catalin 2016-06-18 20:29:28 +03:00
parent c8d5200dc0
commit b59710ddeb
2 changed files with 26 additions and 11 deletions

View File

@ -136,27 +136,31 @@ void ScriptSrc::Process()
{
mLine.push_back(line);
}
// Specify that this script contains line information
mInfo = true;
}
// ------------------------------------------------------------------------------------------------
ScriptSrc::ScriptSrc(HSQUIRRELVM vm, const String & path, bool info)
ScriptSrc::ScriptSrc(HSQUIRRELVM vm, String && path, bool delay, bool info)
: mExec(vm)
, mPath(path)
, mPath(std::move(path))
, mData()
, mLine()
, mInfo(info)
, mDelay(delay)
{
// Is the specified path empty?
if (mPath.empty())
{
throw std::runtime_error("Invalid or empty script path");
}
// Is the specified virtual machine invalid?
else if (!vm)
if (!vm)
{
throw std::runtime_error("Invalid virtual machine pointer");
}
// Is the specified path empty?
else if (mPath.empty())
{
throw std::runtime_error("Invalid or empty script path");
}
// Should we load the file contents for debugging purposes?
else if (info)
else if (mInfo)
{
Process();
}

View File

@ -29,6 +29,8 @@ public:
String mPath; // Path to the script file.
String mData; // The contents of the script file.
Line mLine; // List of lines of code in the data.
bool mInfo; // Whether this script contains line information.
bool mDelay; // Don't execute immediately after compilation.
/* --------------------------------------------------------------------------------------------
* Read file contents and calculate information about the lines of code.
@ -36,9 +38,18 @@ public:
void Process();
/* --------------------------------------------------------------------------------------------
* Default constructor.
* Base constructor.
*/
ScriptSrc(HSQUIRRELVM vm, const String & path, bool info = false);
ScriptSrc(HSQUIRRELVM vm, const String & path, bool delay = false, bool info = false)
: ScriptSrc(vm, String(path), delay, info)
{
/* ... */
}
/* --------------------------------------------------------------------------------------------
* Base constructor.
*/
ScriptSrc(HSQUIRRELVM vm, String && path, bool delay = false, bool info = false);
/* --------------------------------------------------------------------------------------------
* Copy constructor.