summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-02-17 15:38:39 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-02-17 15:38:39 +0000
commit962a3d06bbd73aa7bb46eb8ae3e65c31a1902d5d (patch)
treefdb6bec16074d47e7be2aefea625500e94ff17c6 /plugins/MirLua/Modules
parent08d411ef426d5b630f0f4592be904ab9e1bd5e5a (diff)
MirLua: m_variableas moved to separate lua library
git-svn-id: http://svn.miranda-ng.org/main/trunk@16292 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/Modules')
-rw-r--r--plugins/MirLua/Modules/m_variables/m_variables.vcxproj28
-rw-r--r--plugins/MirLua/Modules/m_variables/src/main.cpp32
-rw-r--r--plugins/MirLua/Modules/m_variables/src/stdafx.cxx1
-rw-r--r--plugins/MirLua/Modules/m_variables/src/stdafx.h14
-rw-r--r--plugins/MirLua/Modules/module.props3
5 files changed, 77 insertions, 1 deletions
diff --git a/plugins/MirLua/Modules/m_variables/m_variables.vcxproj b/plugins/MirLua/Modules/m_variables/m_variables.vcxproj
new file mode 100644
index 0000000000..fedbf4a66c
--- /dev/null
+++ b/plugins/MirLua/Modules/m_variables/m_variables.vcxproj
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>m_variables</ProjectName>
+ <ProjectGuid>{E604CD58-4579-4F69-9D6A-2605FD7CF716}</ProjectGuid>
+ </PropertyGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(ProjectDir)..\module.props" />
+ </ImportGroup>
+</Project>
diff --git a/plugins/MirLua/Modules/m_variables/src/main.cpp b/plugins/MirLua/Modules/m_variables/src/main.cpp
new file mode 100644
index 0000000000..1fb6dd29bb
--- /dev/null
+++ b/plugins/MirLua/Modules/m_variables/src/main.cpp
@@ -0,0 +1,32 @@
+#include "stdafx.h"
+
+static int lua_Parse(lua_State *L)
+{
+ if (!ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ lua_pushvalue(L, 1);
+ return 1;
+ }
+
+ ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1)));
+ MCONTACT hContact = lua_tointeger(L, 2);
+
+ TCHAR *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
+ lua_pushstring(L, T2Utf(res));
+
+ return 1;
+}
+
+static luaL_Reg variablesApi[] =
+{
+ { "Parse", lua_Parse },
+
+ { NULL, NULL }
+};
+
+LUAMOD_API int luaopen_m_variables(lua_State *L)
+{
+ luaL_newlib(L, variablesApi);
+
+ return 1;
+}
diff --git a/plugins/MirLua/Modules/m_variables/src/stdafx.cxx b/plugins/MirLua/Modules/m_variables/src/stdafx.cxx
new file mode 100644
index 0000000000..fd4f341c7b
--- /dev/null
+++ b/plugins/MirLua/Modules/m_variables/src/stdafx.cxx
@@ -0,0 +1 @@
+#include "stdafx.h"
diff --git a/plugins/MirLua/Modules/m_variables/src/stdafx.h b/plugins/MirLua/Modules/m_variables/src/stdafx.h
new file mode 100644
index 0000000000..0293856dbd
--- /dev/null
+++ b/plugins/MirLua/Modules/m_variables/src/stdafx.h
@@ -0,0 +1,14 @@
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+#include <windows.h>
+
+#define VARIABLES_NOHELPER
+
+#include <lua.hpp>
+
+#include <m_core.h>
+#include <m_utils.h>
+#include <m_variables.h>
+
+#endif //_COMMON_H_ \ No newline at end of file
diff --git a/plugins/MirLua/Modules/module.props b/plugins/MirLua/Modules/module.props
index d5ba41546b..6def4559a2 100644
--- a/plugins/MirLua/Modules/module.props
+++ b/plugins/MirLua/Modules/module.props
@@ -18,7 +18,8 @@
<AdditionalLibraryDirectories Condition="'$(VisualStudioVersion)' == '14.0'">$(ProjectDir)..\..\..\..\bin14\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
- <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\include;$(ProjectDir)..\..\..\..\libs\liblua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>LUA_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\include;$(ProjectDir)..\..\..\ExternalAPI;$(ProjectDir)..\..\..\..\libs\liblua\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
</Project>