Beginnings of the "pass everything using a native type wrapper" console code.

- ConsoleValue class is now the base value class.
- ConsoleValueRef is now used to supply function parameters. Values are disposable.
- Script functions return values instead of just strings where possible.
- Variables can be disposable strings
- Bytecode changed

Fix the issues with console method parameters and fields which prevented missions from loading.
This commit is contained in:
James Urquhart 2012-09-23 09:59:48 +01:00
parent 394d87cd54
commit 38c8e52c1d
68 changed files with 1511 additions and 529 deletions

View file

@ -90,7 +90,9 @@ const char *DynamicConsoleMethodComponent::callMethod( S32 argc, const char* met
argv[1] = methodName;
argv[2] = methodName;
return callMethodArgList( argc , argv );
StringStackConsoleWrapper argsw(argc, argv);
return callMethodArgList( argsw.count() , argsw );
}
#ifdef TORQUE_DEBUG
@ -117,7 +119,7 @@ void DynamicConsoleMethodComponent::injectMethodCall( const char* method )
}
#endif
const char* DynamicConsoleMethodComponent::callMethodArgList( U32 argc, const char *argv[], bool callThis /* = true */ )
const char* DynamicConsoleMethodComponent::callMethodArgList( U32 argc, ConsoleValueRef argv[], bool callThis /* = true */ )
{
#ifdef TORQUE_DEBUG
injectMethodCall( argv[0] );
@ -128,7 +130,7 @@ const char* DynamicConsoleMethodComponent::callMethodArgList( U32 argc, const ch
// Call all components that implement methodName giving them a chance to operate
// Components are called in reverse order of addition
const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, const char *argv[], bool callThis /* = true */ )
const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, ConsoleValueRef argv[], bool callThis /* = true */ )
{
// Set Owner
SimObject *pThis = dynamic_cast<SimObject *>( this );

View file

@ -62,7 +62,7 @@ protected:
/// Internal callMethod : Actually does component notification and script method execution
/// @attention This method does some magic to the argc argv to make Con::execute act properly
/// as such it's internal and should not be exposed or used except by this class
virtual const char* _callMethod( U32 argc, const char *argv[], bool callThis = true );
virtual const char* _callMethod( U32 argc, ConsoleValueRef argv[], bool callThis = true );
public:
@ -75,7 +75,7 @@ public:
#endif
/// Call Method
virtual const char* callMethodArgList( U32 argc, const char *argv[], bool callThis = true );
virtual const char* callMethodArgList( U32 argc, ConsoleValueRef argv[], bool callThis = true );
/// Call Method format string
const char* callMethod( S32 argc, const char* methodName, ... );

View file

@ -171,7 +171,7 @@ void SimComponent::onRemove()
//////////////////////////////////////////////////////////////////////////
bool SimComponent::processArguments(S32 argc, const char **argv)
bool SimComponent::processArguments(S32 argc, ConsoleValueRef *argv)
{
for(S32 i = 0; i < argc; i++)
{

View file

@ -150,7 +150,7 @@ public:
static void initPersistFields();
virtual bool processArguments(S32 argc, const char **argv);
virtual bool processArguments(S32 argc, ConsoleValueRef *argv);
bool isEnabled() const { return mEnabled; }