Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gideros/gideros
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed Dec 11, 2016
2 parents c6919f3 + 5a2261c commit 3fa2087
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 30 deletions.
9 changes: 9 additions & 0 deletions lua/luac.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TEMPLATE = app
CONFIG += console
DESTDIR = bin
TARGET = luac
SOURCES += src/luac.c
INCLUDEPATH += src
win32 {
DEFINES += LUA_BUILD_AS_DLL
}
23 changes: 23 additions & 0 deletions lua/src/luac.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
** See Copyright Notice in lua.h
*/

#include "lapi.c"
#include "lcode.c"
#include "ldebug.c"
#include "ldo.c"
#include "ldump.c"
#include "lfunc.c"
#include "lgc.c"
#include "llex.c"
#include "lmem.c"
#include "lobject.c"
#include "lopcodes.c"
#include "lparser.c"
#include "lstate.c"
#include "lstring.c"
#include "ltable.c"
#include "ltm.c"
#include "lundump.c"
#include "lvm.c"
#include "lzio.c"

#include "lauxlib.c"
#include "print.c"

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
8 changes: 5 additions & 3 deletions plugins/controller/source/Android/jni/controllerbinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -62,7 +64,7 @@ static char keyWeak = ' ';
class Controller : public GEventDispatcherProxy
{
public:
Controller(lua_State *L) : L(L)
Controller(lua_State *L)
{
ghid_init();
ghid_addCallback(callback_s, this);
Expand Down Expand Up @@ -212,7 +214,6 @@ class Controller : public GEventDispatcherProxy
}

private:
lua_State *L;
bool initialized_;
};

Expand Down Expand Up @@ -367,6 +368,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -378,7 +380,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{

::L = NULL;
}

REGISTER_PLUGIN("Controller", "1.0")
8 changes: 5 additions & 3 deletions plugins/controller/source/controllerbinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -45,7 +47,7 @@ static char keyWeak = ' ';
class Controller : public GEventDispatcherProxy
{
public:
Controller(lua_State *L) : L(L)
Controller(lua_State *L)
{
ghid_init();
ghid_addCallback(callback_s, this);
Expand Down Expand Up @@ -214,7 +216,6 @@ class Controller : public GEventDispatcherProxy
}

private:
lua_State *L;
bool initialized_;
};

Expand Down Expand Up @@ -372,6 +373,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -383,7 +385,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{

::L = NULL;
}

REGISTER_PLUGIN("Controller", "1.0")
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -44,7 +46,7 @@ static char keyWeak = ' ';
class Controller : public GEventDispatcherProxy
{
public:
Controller(lua_State *L) : L(L)
Controller(lua_State *L)
{
ghid_init();
ghid_addCallback(callback_s, this);
Expand Down Expand Up @@ -194,7 +196,6 @@ class Controller : public GEventDispatcherProxy
}

private:
lua_State *L;
bool initialized_;
};

Expand Down Expand Up @@ -349,6 +350,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -360,7 +362,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{

::L = NULL;
}

REGISTER_PLUGIN("Controller", "1.0")
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -45,7 +47,7 @@ static char keyWeak = ' ';
class GoogleLVL : public GEventDispatcherProxy
{
public:
GoogleLVL(lua_State *L) : L(L)
GoogleLVL(lua_State *L)
{
ggooglelvl_init();
ggooglelvl_addCallback(callback_s, this);
Expand Down Expand Up @@ -173,7 +175,6 @@ class GoogleLVL : public GEventDispatcherProxy
}

private:
lua_State *L;
bool initialized_;
};

Expand Down Expand Up @@ -281,6 +282,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -292,7 +294,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{

::L = NULL;
}

REGISTER_PLUGIN("Google Licensing", "1.0")
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ else if(sdkAvailable == 0)

@Override
public void request(Hashtable<String, String> products) {
mHelper.flagEndAsync();
List<String> skuList = new ArrayList<String>();
Enumeration<String> e = products.keys();
while(e.hasMoreElements())
{
String prodName = e.nextElement();
skuList.add(products.get(prodName));
}
mHelper.queryInventoryAsync(true, skuList, this);
if (sdkAvailable == 1) {
mHelper.flagEndAsync();
List<String> skuList = new ArrayList<String>();
Enumeration<String> e = products.keys();
while(e.hasMoreElements())
{
String prodName = e.nextElement();
skuList.add(products.get(prodName));
}
mHelper.queryInventoryAsync(true, skuList, this);
}
}

@Override
Expand Down Expand Up @@ -210,4 +212,4 @@ public void onQueryInventoryFinished(IabResult result, Inventory inv) {
}


}
}
7 changes: 5 additions & 2 deletions plugins/iab/source/IOS/Plugins/iab/iabbinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -89,7 +91,7 @@ static char keyWeak = ' ';
class IAB : public GEventDispatcherProxy
{
public:
IAB(lua_State *L, const char *iab) : L(L)
IAB(lua_State *L, const char *iab)
{
iab_ = strdup(iab);
giab_initialize(iab);
Expand Down Expand Up @@ -278,7 +280,6 @@ class IAB : public GEventDispatcherProxy
}

private:
lua_State *L;
const char* iab_;
};

Expand Down Expand Up @@ -479,6 +480,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -491,6 +493,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{
::L = NULL;
giab_cleanup();
}

Expand Down
7 changes: 5 additions & 2 deletions plugins/microphone/source/Android/jni/gmicrophonebinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
microphone:stop()
*/

static lua_State *L = NULL;

namespace {

static const char* DATA_AVAILABLE = "dataAvailable";
Expand Down Expand Up @@ -52,7 +54,7 @@ static char keyWeak = ' ';
class GMicrophone : public GEventDispatcherProxy
{
public:
GMicrophone(lua_State *L, const char *deviceName, int numChannels, int sampleRate, int bitsPerSample, gmicrophone_Error *error) : L(L)
GMicrophone(lua_State *L, const char *deviceName, int numChannels, int sampleRate, int bitsPerSample, gmicrophone_Error *error)
{
if (++instanceCount_ == 1)
gmicrophone_Init();
Expand Down Expand Up @@ -214,7 +216,6 @@ class GMicrophone : public GEventDispatcherProxy
}

private:
lua_State *L;
g_id microphone_;
int numChannels_, sampleRate_, bitsPerSample_;
g_id outputFile_;
Expand Down Expand Up @@ -394,6 +395,7 @@ static int loader(lua_State* L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -405,6 +407,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{
::L = NULL;
}

REGISTER_PLUGIN("Microphone", "1.0")
7 changes: 5 additions & 2 deletions plugins/microphone/source/gmicrophonebinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
microphone:stop()
*/

static lua_State *L = NULL;

namespace {

static const char* DATA_AVAILABLE = "dataAvailable";
Expand Down Expand Up @@ -52,7 +54,7 @@ static char keyWeak = ' ';
class GMicrophone : public GEventDispatcherProxy
{
public:
GMicrophone(lua_State *L, const char *deviceName, int numChannels, int sampleRate, int bitsPerSample, gmicrophone_Error *error) : L(L)
GMicrophone(lua_State *L, const char *deviceName, int numChannels, int sampleRate, int bitsPerSample, gmicrophone_Error *error)
{
if (++instanceCount_ == 1)
gmicrophone_Init();
Expand Down Expand Up @@ -214,7 +216,6 @@ class GMicrophone : public GEventDispatcherProxy
}

private:
lua_State *L;
g_id microphone_;
int numChannels_, sampleRate_, bitsPerSample_;
g_id outputFile_;
Expand Down Expand Up @@ -394,6 +395,7 @@ static int loader(lua_State* L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -405,6 +407,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{
::L = NULL;
}

REGISTER_PLUGIN("Microphone", "1.0")
Loading

0 comments on commit 3fa2087

Please sign in to comment.