Prechádzať zdrojové kódy

Remove CInterface script hooks, superseded by console refactor

Lukas Aldershaab 2 rokov pred
rodič
commit
5615cc33d8

+ 0 - 6
Engine/source/app/mainLoop.cpp

@@ -60,7 +60,6 @@
 
 // For the TickMs define... fix this for T2D...
 #include "T3D/gameBase/processList.h"
-#include "cinterface/cinterface.h"
 #include "console/script.h"
 
 #ifdef TORQUE_ENABLE_VFS
@@ -443,11 +442,6 @@ bool StandardMainLoop::handleCommandLine( S32 argc, const char **argv )
    // directly because the resource system restricts
    // access to the "root" directory.
 
-   bool foundExternalMain = false;
-   CInterface::CallMain(&foundExternalMain);
-   if (foundExternalMain)
-      return true;
-
 #ifdef TORQUE_ENABLE_VFS
    Zip::ZipArchive *vfs = openEmbeddedVFSArchive();
    bool useVFS = vfs != NULL;

+ 0 - 95
Engine/source/cinterface/cinterface.cpp

@@ -1,95 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-#include "cinterface.h"
-
-#include "windowManager/platformWindow.h"
-
-CInterface& CInterface::GetCInterface()
-{
-   static CInterface INSTANCE;
-   return INSTANCE;
-}
-
-bool CInterface::isMethod(const char* className, const char* methodName)
-{
-   return GetCInterface()._isMethod(className, methodName);
-}
-
-const char* CInterface::CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result)
-{
-   return GetCInterface()._CallFunction(nameSpace, name, argv, argc, result);
-}
-
-const char* CInterface::CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res)
-{
-   return GetCInterface()._CallMethod(obj->getClassName(), obj->getClassNamespace(), obj->getId(), name, argv, argc, res);
-}
-
-void CInterface::CallMain(bool *res)
-{
-   GetCInterface()._CallMain(res);
-}
-
-bool CInterface::_isMethod(const char* className, const char* methodName) const
-{
-   if (mIsMethodCallback)
-      return mIsMethodCallback(className, methodName);
-
-   return false;
-}
-
-const char* CInterface::_CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const
-{
-   if (mFunctionCallback)
-      return mFunctionCallback(nameSpace, name, argv, argc, result);
-
-   *result = false;
-   return NULL;
-}
-
-const char* CInterface::_CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const
-{
-   if (mMethodCallback)
-      return mMethodCallback(className, classNamespace, object, name, argv, argc, res);
-
-   *res = false;
-   return NULL;
-}
-
-void CInterface::_CallMain(bool *res) const
-{
-   if (mMainCallback)
-   {
-      *res = true;
-      mMainCallback();
-      return;
-   }
-
-   *res = false;
-}
-
-TORQUE_API void SetCallbacks(void* ptr, void* methodPtr, void* isMethodPtr, void* mainPtr) {
-   CInterface::GetCInterface().SetCallFunctionCallback(ptr);
-   CInterface::GetCInterface().SetCallMethodCallback(methodPtr);
-   CInterface::GetCInterface().SetCallIsMethodCallback(isMethodPtr);
-   CInterface::GetCInterface().SetMainCallback(mainPtr);
-}

+ 0 - 61
Engine/source/cinterface/cinterface.h

@@ -1,61 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#pragma once
-#include "platform/platformDlibrary.h"
-#include "console/engineAPI.h"
-#include "console/simBase.h"
-
-#define CALL_CINTERFACE_FUNCTION(name, ...){const char *v[] = { __VA_ARGS__ }; CInterface::CallFunction(name, v, sizeof(v) / sizeof(*v));}
-
-class CInterface {
-   typedef bool(*IsMethodCallback)(const char* className, const char* methodName);
-   typedef void(*CallMainCallback)();
-   typedef const char* (*CallFunctionCallback)(const char* nameSpace, const char* name, const char **argv, int argc, bool *result);
-   typedef const char* (*CallMethodCallback)(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *result);
-   IsMethodCallback mIsMethodCallback;
-   CallFunctionCallback mFunctionCallback;
-   CallMethodCallback mMethodCallback;
-   CallMainCallback mMainCallback;
-   const char* _CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const;
-   const char* _CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const;
-   void _CallMain(bool *res) const;
-   bool _isMethod(const char* className, const char* methodName) const;
-public:
-   CInterface()
-   {
-      mFunctionCallback = NULL;
-      mMethodCallback = NULL;
-      mIsMethodCallback = NULL;
-      mMainCallback = NULL;
-   }
-
-   static const char* CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result);
-   static const char* CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res);
-   static void CallMain(bool *res);
-   static bool isMethod(const char* className, const char* methodName);
-   static CInterface& GetCInterface();
-   void SetCallFunctionCallback(void* ptr) { mFunctionCallback = (CallFunctionCallback)ptr; };
-   void SetCallMethodCallback(void* ptr) { mMethodCallback = (CallMethodCallback)ptr; };
-   void SetCallIsMethodCallback(void* ptr) { mIsMethodCallback = (IsMethodCallback)ptr; };
-   void SetMainCallback(void* ptr) { mMainCallback = (CallMainCallback)ptr; };
-};

+ 0 - 45
Engine/source/console/console.cpp

@@ -40,7 +40,6 @@
 #include "returnBuffer.h"
 #include "platform/threads/mutex.h"
 #include "core/util/journal/journal.h"
-#include "cinterface/cinterface.h"
 #include "console/consoleValueStack.h"
 
 extern StringStack STR;
@@ -1193,27 +1192,6 @@ void addCommand( const char *name,BoolCallback cb,const char *usage, S32 minArgs
 ConsoleValue _internalExecute(S32 argc, ConsoleValue argv[])
 {
    StringTableEntry funcName = StringTable->insert(argv[0].getString());
-   if (argc > 1)
-   {
-      const char** argv_str = static_cast<const char**>(malloc(size_t(argc) * sizeof(char*)));
-      if (argv_str)
-      {
-         for (int i = 0; i < argc - 1; i++)
-         {
-            argv_str[i] = argv[i + 1].getString();
-         }
-      }
-      bool result;
-      const char* methodRes = CInterface::CallFunction(NULL, funcName, argv_str, argc - 1, &result);
-
-      free(argv_str);
-      if (result)
-      {
-         ConsoleValue ret;
-         ret.setString(methodRes);
-         return ret;
-      }
-   }
    Namespace::Entry *ent;
    
    ent = Namespace::global()->lookup(funcName);
@@ -1288,28 +1266,6 @@ static ConsoleValue _internalExecute(SimObject *object, S32 argc, ConsoleValue a
    }
 
    StringTableEntry funcName = StringTable->insert(argv[0].getString());
-   if (argc > 2)
-   {
-      const char** argv_str = static_cast<const char**>(malloc(size_t(argc - 1) * sizeof(char*)));
-      if (argv_str)
-      {
-         for (int i = 0; i < argc - 2; i++)
-         {
-            argv_str[i] = argv[i + 2].getString();
-         }
-      }
-      bool result;
-      const char* methodRes = CInterface::CallMethod(object, funcName, argv_str, argc - 2, &result);
-
-      free(argv_str);
-
-      if (result)
-      {
-         ConsoleValue val;
-         val.setString(methodRes);
-         return val;
-      }
-   }
 
    if(object->getNamespace())
    {
@@ -1401,7 +1357,6 @@ inline ConsoleValue _executef(S32 checkArgc, S32 argc, ConsoleValue *argv)
 //------------------------------------------------------------------------------
 bool isFunction(const char *fn)
 {
-   if (CInterface::isMethod(NULL, fn)) return true;
    const char *string = StringTable->lookup(fn);
    if(!string)
       return false;

+ 0 - 5
Engine/source/console/consoleFunctions.cpp

@@ -30,7 +30,6 @@
 #endif
 
 #include "script.h"
-#include "cinterface/cinterface.h"
 #include "core/strings/findMatch.h"
 #include "core/strings/stringUnit.h"
 #include "core/strings/unicode.h"
@@ -2407,10 +2406,6 @@ DefineEngineFunction( isMethod, bool, ( const char* nameSpace, const char* metho
    "@return True if the method exists, false if not\n"
    "@ingroup Scripting\n")
 {
-   if (CInterface::isMethod(nameSpace, method)) {
-      return true;
-   }
-
    Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
    Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
    if( !nse )

+ 0 - 5
Engine/source/console/simObject.cpp

@@ -42,7 +42,6 @@
 #include "gui/editor/guiInspector.h"
 
 #include "sim/netObject.h"
-#include "cinterface/cinterface.h"
 
 IMPLEMENT_CONOBJECT( SimObject );
 
@@ -859,10 +858,6 @@ bool SimObject::isMethod( const char* methodName )
    if( !methodName || !methodName[0] )
       return false;
 
-   if (CInterface::isMethod(this->getName(), methodName) || CInterface::isMethod(this->getClassName(), methodName)) {
-      return true;
-   }
-
    StringTableEntry stname = StringTable->insert( methodName );
 
    if( getNamespace() )

+ 0 - 2
Engine/source/module/moduleManager.cpp

@@ -38,8 +38,6 @@
 #include "console/consoleTypes.h"
 #endif
 
-#include "cinterface/cinterface.h"
-
 #ifndef _MODULE_DEFINITION_H
 #include "module/moduleDefinition.h"
 #endif