Skip to content

Commit

Permalink
Уточнение revision 13510.
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Nov 15, 2015
1 parent acb0c9b commit 22654a3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 1, 0, 0, 544 },
Version = { 1, 0, 0, 545 },
MinFarVersion = { 3, 0, 0, 4450 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
6 changes: 5 additions & 1 deletion plugins/luamacro/changelog
@@ -1,4 +1,8 @@
shmuel 11.11.2015 12:17:37 +0200 - build 544
shmuel 15.11.2015 09:10:25 +0200 - build 545

1. Уточнение 543.

shmuel 11.11.2015 12:17:37 +0200 - build 544

1. MoonScript 0.3.2.

Expand Down
54 changes: 23 additions & 31 deletions plugins/luamacro/luafar/luaplug.c
Expand Up @@ -25,39 +25,31 @@ typedef struct
int InitStage;
int Depth;
CRITICAL_SECTION CritSection; // http://forum.farmanager.com/viewtopic.php?f=9&p=107075#p107075
int CSRefCount;
} Global;

static Global G;

#define TRY_ENTER_CS(g) (TryEnterCriticalSection(&g.CritSection) && ++g.CSRefCount)
#define LEAVE_CS(g) { if (--g.CSRefCount==0) LeaveCriticalSection(&g.CritSection); }
#define IS_PLUGIN_READY(g) (g.LS && g.InitStage==2 && TRY_ENTER_CS(g))

#define EXP_INTPTR(Info,Name) \
if (IS_PLUGIN_READY(G)) \
{ \
intptr_t ret = Name(G.LS, Info); \
LEAVE_CS(G) \
return ret; \
} \
return 0;

#define EXP_HANDLE(Info,Name) \
if (IS_PLUGIN_READY(G)) \
{ \
HANDLE ret = Name(G.LS, Info); \
LEAVE_CS(G) \
return ret; \
} \
return NULL;
#define IS_PLUGIN_READY(g) (g.LS && g.InitStage==2 && TryEnterCriticalSection(&g.CritSection))
#define LEAVE_CS(g) LeaveCriticalSection(&g.CritSection)

#define EXP_VOID(Info,Name) \
if (IS_PLUGIN_READY(G)) \
{ \
Name(G.LS, Info); \
LEAVE_CS(G) \
}
{ if (IS_PLUGIN_READY(G)) \
{ \
Name(G.LS, Info); \
LEAVE_CS(G); \
} }

#define EXP_TYPE(Info,Name,Type) \
{ if (IS_PLUGIN_READY(G)) \
{ \
Type ret = Name(G.LS, Info); \
LEAVE_CS(G); \
return ret; \
} \
return (Type)0; }

#define EXP_INTPTR(Info,Name) EXP_TYPE(Info,Name,intptr_t)
#define EXP_HANDLE(Info,Name) EXP_TYPE(Info,Name,HANDLE)

static void InitLuaState2(lua_State *L, TPluginData* PluginData); /* forward declaration */

Expand All @@ -79,7 +71,7 @@ static intptr_t WINAPI DlgProc(HANDLE hDlg, intptr_t Msg, intptr_t Param1, void
if (IS_PLUGIN_READY(G))
{
intptr_t ret = LF_DlgProc(G.LS, hDlg, Msg, Param1, Param2);
LEAVE_CS(G)
LEAVE_CS(G);
return ret;
}
return 0;
Expand Down Expand Up @@ -149,7 +141,7 @@ __declspec(dllexport) lua_State* GetLuaState()
if (IS_PLUGIN_READY(G))
{
lua_State *L = G.LS;
LEAVE_CS(G)
LEAVE_CS(G);
return L;
}
return NULL;
Expand Down Expand Up @@ -271,7 +263,7 @@ HANDLE LUAPLUG OpenW(const struct OpenInfo *Info)
++G.Depth; // prevents crashes (this function can be called recursively)
h = LF_Open(G.LS, Info);
h = --G.Depth==0 && RecreateLuaState(&G) ? NULL : G.LS ? h : NULL;
LEAVE_CS(G)
LEAVE_CS(G);
return h;
}
return NULL;
Expand Down Expand Up @@ -325,7 +317,7 @@ void LUAPLUG ExitFARW(const struct ExitInfo *Info)
G.LS = NULL;
LF_ExitFAR(oldState, Info);
lua_close(oldState);
LEAVE_CS(G)
LEAVE_CS(G);
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 544
#define PLUGIN_BUILD 545
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"
Expand Down

0 comments on commit 22654a3

Please sign in to comment.