List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:July 27 2007 10:12pm
Subject:Rev 133: Added first stab at lua support so that we can play with MySQL Proxy in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/addlua
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/addlua

------------------------------------------------------------
revno: 133
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: addlua
timestamp: Fri 2007-07-27 15:11:44 -0700
message:
  Added first stab at lua support so that we can play with MySQL Proxy
added:
  lua/                           lua-20070727221140-30x3yi1g0lf9rflk-1
  lua/Makefile.am                makefile.am-20070727221140-30x3yi1g0lf9rflk-2
  lua/ndbapi.i                   ndbapi.i-20070727221140-30x3yi1g0lf9rflk-3
modified:
  configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
  swig/globals.i                 globals.i-20070528224404-qscgbkcvhcru9u2o-2
=== added directory 'lua'
=== added file 'lua/Makefile.am'
--- a/lua/Makefile.am	1970-01-01 00:00:00 +0000
+++ b/lua/Makefile.am	2007-07-27 22:11:44 +0000
@@ -0,0 +1,23 @@
+# -*- Mode: Makefile -*-
+
+luaarchdir=/usr/local/lub/lua
+luaarch_DATA=mysql/cluster/ndbapi.so
+
+CLEANFILES=*.db test-out.rdf core* \
+	$(rubyarch_DATA) ndbapi.cpp
+
+SWIG_OPTS=-I$(srcdir) -I$(SWIG_DIR) @MYSQL_INCLUDES@ 
+
+%.cpp: %.i $(SWIG_SOURCES)
+	$(SWIG) -c++ -lua $(SWIG_OPTS) -o $@ $<
+
+$(srcdir)/%.o: $(srcdir)/%.cpp
+	$(CXX) $(SWIG_OPTS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
$(AM_CFLAGS) $(STANDARD_CFLAGS) -fPIC -DPIC $(LUA_CFLAGS) $< -c -o $@
+
+$(srcdir)/mysql/cluster/%.so: %.o
+	mkdir -p mysql/cluster
+	echo $(CXX) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -shared $< $(LUA_LDFLAGS)
-o $@ 
+	$(CXX) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -shared $< $(LUA_LDFLAGS) -o
$@ 
+
+clean-local:
+	rm -rf mysql

=== added file 'lua/ndbapi.i'
--- a/lua/ndbapi.i	1970-01-01 00:00:00 +0000
+++ b/lua/ndbapi.i	2007-07-27 22:11:44 +0000
@@ -0,0 +1,47 @@
+// -*- mode: c++ -*- 
+/*  ndb-connectors: Wrappers for the NDBAPI
+    Copyright (C) 2006 MySQL, Inc.
+    
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or 
+    (at your option) any later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+/* Not using directors with lua - they don't seem to work and the 
+   custom code is really clean anyway. */
+%module ndbapi
+
+%include "ndbglobals.i"
+
+//#define NDB_exception(code,msg) do { ndb_raise_exception(code, msg); SWIG_fail; }
while(0);
+#define NDB_exception(code,msg) do { SWIG_fail; } while(0);
+
+%include "NdbFactory.i"
+%include "NdbClusterConnection.i"
+%include "Ndb.i"
+%include "NdbDictionary.i"
+%include "NdbTransaction.i"
+
+%include "NdbOperation.i"
+%include "NdbScanOperation.i"
+%include "NdbIndexOperation.i"
+%include "NdbIndexScanOperation.i"
+%include "NdbEventOperation.i"
+
+%include "NdbRecAttr.i"
+%include "NdbError.i"
+%include "NdbBlob.i"
+%include "NdbScanFilter.i"
+
+
+

=== modified file 'configure.in'
--- a/configure.in	2007-07-12 20:28:26 +0000
+++ b/configure.in	2007-07-27 22:11:44 +0000
@@ -36,6 +36,35 @@
 
 WITH_JAVA()
 
+dnl Check for lua
+AC_MSG_CHECKING(for lua)
+AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua]),
+[WITH_LUA=$withval],[WITH_LUA=yes])
+
+AC_MSG_RESULT($WITH_LUA)
+if test "$WITH_LUA" != "no"; then
+ # try pkgconfig
+ if test "$WITH_LUA" = "yes"; then
+    LUAPC=lua
+  else
+    LUAPC=$WITH_LUA
+  fi
+
+ PKG_CHECK_MODULES(LUA, $LUAPC >= 5.1, [
+   AC_DEFINE([HAVE_LUA], [1], [liblua])
+   AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+ ],[
+   PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
+     AC_DEFINE([HAVE_LUA], [1], [liblua])
+     AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+   ])
+ ])
+
+ AC_SUBST(LUA_CFLAGS)
+ AC_SUBST(LUA_LIBS)
+fi
+
+
 # TODO: check for Python.h
 # Check for setuptools
 AM_PATH_PYTHON()
@@ -95,4 +124,5 @@
 csharp/Makefile \
 ruby/Makefile \
 php/Makefile \
+lua/Makefile \
 java/ndbj.props)

=== modified file 'swig/globals.i'
--- a/swig/globals.i	2007-05-29 15:45:11 +0000
+++ b/swig/globals.i	2007-07-27 22:11:44 +0000
@@ -17,8 +17,12 @@
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
+#if !defined(SWIGLUA)
 %include "typemaps.i"
+#endif
+
 %include "exception.i"
+
 //%include "cstring.i"
 
 %include "ndberror.h"

Thread
Rev 133: Added first stab at lua support so that we can play with MySQL Proxy in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/addluaMonty Taylor28 Jul