Skip to content

Commit

Permalink
Removed USE_LUA definition as it is redundant now
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Jul 28, 2010
1 parent 84fae24 commit 6750ba5
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 50 deletions.
4 changes: 0 additions & 4 deletions dialogs/plugins/PluginWizard.cpp
Expand Up @@ -708,11 +708,9 @@ int nItem = -1;
if (m_strLanguage.CompareNoCase ("tclscript") == 0)
nItem = 4;
#endif
#ifdef USE_LUA
else
if (m_strLanguage.CompareNoCase ("lua") == 0)
nItem = 5;
#endif
#ifdef USE_PHP
else
if (m_strLanguage.CompareNoCase ("phpscript") == 0)
Expand Down Expand Up @@ -745,9 +743,7 @@ int nItem = m_ctlLanguage.GetCurSel ();
#ifdef USE_TCL
case SCRIPT_TCL: m_strLanguage = "TclScript"; break;
#endif
#ifdef USE_LUA
case SCRIPT_LUA: m_strLanguage = "Lua"; break;
#endif
#ifdef USE_PHP
case SCRIPT_PHP: m_strLanguage = "PhpScript"; break;
#endif
Expand Down
2 changes: 0 additions & 2 deletions dialogs/world_prefs/prefspropertypages.cpp
Expand Up @@ -6555,11 +6555,9 @@ int nItem = m_ctlLanguage.GetCurSel ();
strPrompt = "Tcl source files (*.tcl)|*.tcl";
break;
#endif
#ifdef USE_LUA
case SCRIPT_LUA: strSubscript = "lua";
strPrompt = "Lua source files (*.lua)|*.lua";
break;
#endif
#ifdef USE_PHP
case SCRIPT_PHP: strSubscript = "phpscript";
strPrompt = "PHP source files (*.php)|*.php";
Expand Down
9 changes: 3 additions & 6 deletions scripting/lua_methods.cpp
Expand Up @@ -9,8 +9,6 @@
#include "..\sendvw.h"
#include "..\dialogs\DebugLuaDlg.h"

#ifdef USE_LUA

const char mushclient_typename[] = "mushclient.world";

/*------------------------------------------------------------------------
Expand Down Expand Up @@ -1018,7 +1016,7 @@ static int L_CallPlugin (lua_State *L)

}

// new in 4.55 - Lua to Lua calls can handle multiple arguments and a return value
// new in 4.55 - Lua to Lua calls can handle multiple arguments and multiple return values

// don't need to check *our* scripting language, we must be Lua, duh, or we wouldn't be here.

Expand Down Expand Up @@ -1129,7 +1127,7 @@ static int L_CallPlugin (lua_State *L)
if (CallLuaWithTraceBack (pL, n - 2, LUA_MULTRET)) // true on error
{

// here for executioin error in plugin function ...
// here for execution error in plugin function ...

CString strType = TFormat ("Plugin %s", (LPCTSTR) pPlugin->m_strName);
CString strReason = TFormat ("Executing plugin %s sub %s",
Expand Down Expand Up @@ -1244,7 +1242,7 @@ static int L_CallPlugin (lua_State *L)
// old fashioned way ...
lua_pushnumber (L, pDoc->CallPlugin (
sPluginID, // PluginID
sRoutine, // Routine
sRoutine, // Routine
my_optstring (L, 3, "") // Argument - optional
));
return 1; // number of result fields
Expand Down Expand Up @@ -7739,4 +7737,3 @@ int DisableDLLs (lua_State * L)
return 0;
} // end of DisableDLLs

#endif // LUA
3 changes: 0 additions & 3 deletions scripting/lua_scripting.cpp
Expand Up @@ -8,8 +8,6 @@
#include "..\pcre\config.h"
#include "..\pcre\pcre_internal.h"

#ifdef USE_LUA

set<string> LuaFunctionsSet;
set<string> LuaTablesSet;

Expand Down Expand Up @@ -957,4 +955,3 @@ int win_io_pclose (lua_State *L) {

#endif // POPEN_STUFF_WHICH_DOESNT_WORK

#endif // USE_LUA
3 changes: 0 additions & 3 deletions scripting/lua_utils.cpp
Expand Up @@ -11,8 +11,6 @@
#include "..\dmetaph.h"
#include <direct.h>

#ifdef USE_LUA

extern char working_dir [_MAX_PATH];

// recursive node outputter
Expand Down Expand Up @@ -1398,4 +1396,3 @@ static const struct luaL_reg xmllib [] =

const struct luaL_reg *ptr_xmllib = xmllib;

#endif // LUA
19 changes: 0 additions & 19 deletions scripting/scriptengine.cpp
Expand Up @@ -21,7 +21,6 @@ bool CScriptEngine::Execute (DISPID & dispid, // dispatch ID, will be set to DI
)
{

#ifdef USE_LUA

// If Lua, we may have been called with no arguments, so just do that
if (L)
Expand All @@ -48,8 +47,6 @@ bool CScriptEngine::Execute (DISPID & dispid, // dispatch ID, will be set to DI
return status;
} // have Lua

#endif // USE_LUA

// don't do it if no routine address
if (dispid == DISPID_UNKNOWN)
return false;
Expand Down Expand Up @@ -258,17 +255,13 @@ STDMETHODIMP CActiveScriptSite::OnScriptError(IActiveScriptError *pscripterror)
bool CScriptEngine::CreateScriptEngine (void)
{

#ifdef USE_LUA

// Lua does not use scripting engine
if (m_strLanguage.CompareNoCase ("Lua") == 0)
{
OpenLua ();
return false;
} // end of Lua

#endif // USE_LUA

// not under Wine
if (bWine)
return true;
Expand Down Expand Up @@ -406,14 +399,10 @@ bool CScriptEngine::Parse (const CString & strCode, const CString & strWhat)
else
bImmediate = true;

#ifdef USE_LUA

// Do Lua differently
if (L)
return ParseLua (strCode, strWhat);

#endif // USE_LUA

if (!m_IActiveScriptParse || !m_IActiveScript)
return true; // no script engine

Expand Down Expand Up @@ -475,14 +464,10 @@ SCRIPTSTATE ss;
DISPID CScriptEngine::GetDispid (const CString & strName)
{

#ifdef USE_LUA

// Do Lua differently
if (L)
return GetLuaDispid (strName);

#endif // USE_LUA

if (!m_pDispatch)
return DISPID_UNKNOWN; // no script engine

Expand Down Expand Up @@ -586,17 +571,13 @@ CString str;
void CScriptEngine::DisableScripting (void)
{

#ifdef USE_LUA

// Do Lua differently
if (L)
{
CloseLua ();
return;
}

#endif // USE_LUA

// release engine

if (m_IActiveScript)
Expand Down
10 changes: 0 additions & 10 deletions scripting/scripting.h
@@ -1,7 +1,5 @@
#pragma once

#ifdef USE_LUA

extern "C"
{
#include "lua.h"
Expand All @@ -21,8 +19,6 @@ void LuaError (lua_State *L,
LPCTSTR strReason = "",
CMUSHclientDoc * pDoc = NULL);

#endif // USE_LUA

class CScriptEngine : public CObject
{

Expand All @@ -36,9 +32,7 @@ class CScriptEngine : public CObject
m_IActiveScriptParse = NULL;
m_site = NULL;
m_pDispatch = NULL;
#ifdef USE_LUA
L = NULL;
#endif // USE_LUA
}; // end of constructor

~CScriptEngine () // destructor
Expand All @@ -65,8 +59,6 @@ class CScriptEngine : public CObject
bool ShowError (const HRESULT result, const CString strMsg);
void DisableScripting (void);

#ifdef USE_LUA

void OpenLua ();
void OpenLuaDelayed ();
void CloseLua ();
Expand Down Expand Up @@ -103,8 +95,6 @@ class CScriptEngine : public CObject
const bool IsLua () const { return L != NULL; }
lua_State * L; // Lua state

#endif // USE_LUA

private:

IActiveScript * m_IActiveScript; // VBscript interface
Expand Down
1 change: 0 additions & 1 deletion stdafx.h
Expand Up @@ -23,7 +23,6 @@

#define USE_PYTHON // Nick's "use Python" extension ;)
#define USE_TCL // Nick's "use TCL" extension ;)
#define USE_LUA // Nick's "use LUA" extension ;)
#define USE_PHP // Nick's "use PHP" extension ;)
#define USE_RUBY // Nick's "use Ruby" extension ;)

Expand Down
2 changes: 0 additions & 2 deletions xml/xml_load_world.cpp
Expand Up @@ -2340,9 +2340,7 @@ void CMUSHclientDoc::Load_Plugin_XML (CXMLelement & parent)
#ifdef USE_TCL
&& m_CurrentPlugin->m_strLanguage != "tclscript"
#endif
#ifdef USE_LUA
&& m_CurrentPlugin->m_strLanguage != "lua"
#endif
#ifdef USE_PHP
&& m_CurrentPlugin->m_strLanguage != "phpscript"
#endif
Expand Down

0 comments on commit 6750ba5

Please sign in to comment.