summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2008-07-04 12:01:52 +0000
committerpixel <pixel>2008-07-04 12:01:52 +0000
commitcee868801b55aa4302c91a46df8daf38388163e7 (patch)
tree1bd77d5167f0a18ff7beb603b1b359c7b8c459b1
Adding project files.
-rw-r--r--Makefile188
-rw-r--r--Makefile.mingw32193
-rw-r--r--src/lua-plugin.cc43
-rw-r--r--src/lua-plugin.h9
-rw-r--r--src/plugin-luaconfigfiles.cc9
-rw-r--r--src/plugin-luaftgl.cc9
-rw-r--r--src/plugin-luagl.cc10
-rw-r--r--src/plugin-luahandle.cc12
-rw-r--r--src/plugin-luahttp.cc9
-rw-r--r--src/plugin-lualibs.cc9
-rw-r--r--src/plugin-luaocci.cc9
-rw-r--r--src/plugin-luaregex.cc9
-rw-r--r--src/plugin-luasql.cc9
-rw-r--r--src/plugin-luatask.cc9
-rw-r--r--src/plugin-luaxml.cc10
15 files changed, 537 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..75fecbd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,188 @@
+CC = gcc
+CXX = g++
+LD = g++
+STRIP = strip
+
+INCLUDES = \
+-I ../Mesa-7.0.2/include \
+-I../mogltk/include \
+-I../Baltisot/include \
+-I../Baltisot/lib/zlib/include \
+-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
+-I ../tinyxml \
+-I /usr/include/mysql \
+-I /usr/include/FTGL -I /usr/include/freetype2 \
+-I /usr/include/oracle/11.1.0.1/client/
+
+HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_MYSQL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H
+
+CPPFLAGS += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN -march=i686 $(HAVES)
+
+LDFLAGS += -O4 -fexceptions -shared -fPIC -L/usr/lib/oracle/11.1.0.1/client/lib
+
+vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.lua ../Baltisot/lib:../Baltisot/src
+
+CONFIGFILES_SOURCES = \
+plugin-luaconfigfiles.cc \
+LuaConfigFile.cc \
+
+CONFIGFILES_LIBS =
+
+XML_SOURCES = \
+plugin-luaxml.cc \
+tinystr.cpp \
+tinyxml.cpp \
+tinyxmlerror.cpp \
+tinyxmlparser.cpp \
+LuaXML.cc \
+
+XML_LIBS =
+
+OCCI_SOURCES = \
+plugin-luaocci.cc \
+LuaOCCI.cc \
+
+OCCI_LIBS = -locci -lclntsh
+
+HANDLE_SOURCES = \
+plugin-luahandle.cc \
+
+HANDLE_LIBS =
+
+HTTP_SOURCES = \
+plugin-luahttp.cc \
+LuaHttp.cc \
+
+HTTP_LIBS =
+
+REGEX_SOURCES = \
+plugin-luaregex.cc \
+LuaRegex.cc \
+
+REGEX_LIBS =
+
+TASK_SOURCES = \
+plugin-luatask.cc \
+
+TASK_LIBS =
+
+SQL_SOURCES = \
+plugin-luasql.cc \
+SQL.cc \
+LuaSQL.cc \
+
+SQL_LIBS = /usr/lib/libmysqlclient.a
+
+LUALIBS_SOURCES = \
+plugin-lualibs.cc \
+loadlualibs.cc \
+
+LUA_LIB = \
+supportlib.lua \
+tasklib.lua \
+ajaxlib.lua \
+htmllib.lua \
+xmllib.lua \
+
+GL_SOURCES = \
+plugin-luagl.cc \
+LuaGL.cc \
+
+GL_LIBS = ../Mesa-7.0.2/lib/libGLU.a ../Mesa-7.0.2/lib/libOSMesa.a
+
+FTGL_SOURCES = \
+plugin-luaftgl.cc \
+LuaFTGL.cc \
+
+FTGL_LIBS = -lfreetype -lftgl
+
+WHOLE_SOURCES = \
+$(CONFIGFILES_SOURCES) \
+$(XML_SOURCES) \
+$(OCCI_SOURCES) \
+$(HANDLE_SOURCES) \
+$(HTTP_SOURCES) \
+$(REGEX_SOURCES) \
+$(TASK_SOURCES) \
+$(SQL_SOURCES) \
+$(LUALIBS_SOURCES) \
+$(GL_SOURCES) \
+$(FTGL_SOURCES) \
+
+MODULES_LIST = \
+luaconfigfiles.so \
+luaxml.so \
+luaocci.so \
+luahandle.so \
+luahttp.so \
+luaregex.so \
+luatask.so \
+luasql.so \
+luagl.so \
+luaftgl.so \
+lualibs.so \
+
+ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES) $(LUA_LIB))))
+ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
+
+all: dep modules
+
+modules: $(MODULES_LIST)
+
+dep: $(ALL_DEPS)
+
+luaconfigfiles.so: $(addsuffix .o, $(notdir $(basename $(CONFIGFILES_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(CONFIGFILES_LIBS)
+
+luaxml.so: $(addsuffix .o, $(notdir $(basename $(XML_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(XML_LIBS)
+
+luaocci.so: $(addsuffix .o, $(notdir $(basename $(OCCI_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(OCCI_LIBS)
+
+luahandle.so: $(addsuffix .o, $(notdir $(basename $(HANDLE_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(HANDLE_LIBS)
+
+luahttp.so: $(addsuffix .o, $(notdir $(basename $(HTTP_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(HTTP_LIBS)
+
+luaregex.so: $(addsuffix .o, $(notdir $(basename $(REGEX_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(REGEX_LIBS)
+
+luatask.so: $(addsuffix .o, $(notdir $(basename $(TASK_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(TASK_LIBS)
+
+luasql.so: $(addsuffix .o, $(notdir $(basename $(SQL_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(SQL_LIBS)
+
+luagl.so: $(addsuffix .o, $(notdir $(basename $(GL_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(GL_LIBS)
+
+luaftgl.so: $(addsuffix .o, $(notdir $(basename $(FTGL_SOURCES))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(FTGL_LIBS)
+
+lualibs.so: $(addsuffix .o, $(notdir $(basename $(LUALIBS_SOURCES) $(LUA_LIB))))
+ $(LD) $(LDFLAGS) -o $@ $+ $(LUALIBS_LIBS)
+
+clean:
+ rm -f *.o *.dep *.so
+
+%.dep : %.c
+ $(CC) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cpp
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cc
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.c : %.clua
+ bin2c $< $@ $(basename $@)
+
+%.clua : %.lua
+ ./luac -o $@ $<
+
+-include $(ALL_DEPS)
diff --git a/Makefile.mingw32 b/Makefile.mingw32
new file mode 100644
index 0000000..26d4018
--- /dev/null
+++ b/Makefile.mingw32
@@ -0,0 +1,193 @@
+CC = i586-mingw32msvc-gcc
+CXX = i586-mingw32msvc-g++
+LD = i586-mingw32msvc-g++
+STRIP = i586-mingw32msvc-strip
+
+INCLUDES = \
+-I ../Mesa-7.0.2/include \
+-I../mogltk/include \
+-I../Baltisot/include \
+-I../Baltisot/lib/zlib/include \
+-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
+-I ../tinyxml \
+-I /usr/include/mysql \
+-I /usr/include/FTGL -I /usr/include/freetype2 \
+-I /usr/include/oracle/11.1.0.1/client/ \
+-I ../Baltisot/MSVC/regex \
+
+HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H
+
+CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN -fexceptions -march=i686 $(HAVES)
+
+LDFLAGS += -g -fexceptions -shared -L/usr/lib/oracle/11.1.0.1/client/lib ../lua-interface/lua-interface.a -Wl,--export-dynamic -Wl,--enable-auto-image-base --export-all-symbols -Wl,--enable-auto-import
+
+vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml
+vpath %.lua ../Baltisot/lib:../Baltisot/src
+
+CONFIGFILES_SOURCES = \
+plugin-luaconfigfiles.cc \
+LuaConfigFile.cc \
+
+CONFIGFILES_LIBS =
+
+XML_SOURCES = \
+plugin-luaxml.cc \
+tinystr.cpp \
+tinyxml.cpp \
+tinyxmlerror.cpp \
+tinyxmlparser.cpp \
+LuaXML.cc \
+
+XML_LIBS =
+
+OCCI_SOURCES = \
+plugin-luaocci.cc \
+LuaOCCI.cc \
+
+OCCI_LIBS = -locci -lclntsh
+
+HANDLE_SOURCES = \
+plugin-luahandle.cc \
+
+HANDLE_LIBS =
+
+HTTP_SOURCES = \
+plugin-luahttp.cc \
+LuaHttp.cc \
+
+HTTP_LIBS =
+
+REGEX_SOURCES = \
+plugin-luaregex.cc \
+LuaRegex.cc \
+
+REGEX_LIBS =
+
+TASK_SOURCES = \
+plugin-luatask.cc \
+
+TASK_LIBS =
+
+SQL_SOURCES = \
+plugin-luasql.cc \
+SQL.cc \
+LuaSQL.cc \
+
+SQL_LIBS = /usr/lib/libmysqlclient.a
+
+LUALIBS_SOURCES = \
+plugin-lualibs.cc \
+loadlualibs.cc \
+
+LUA_LIB = \
+supportlib.lua \
+tasklib.lua \
+ajaxlib.lua \
+htmllib.lua \
+xmllib.lua \
+
+GL_SOURCES = \
+plugin-luagl.cc \
+LuaGL.cc \
+
+GL_LIBS = ../Mesa-7.0.2/lib/libGLU.a ../Mesa-7.0.2/lib/libOSMesa.a
+
+FTGL_SOURCES = \
+plugin-luaftgl.cc \
+LuaFTGL.cc \
+
+FTGL_LIBS = -lfreetype -lftgl
+
+WHOLE_SOURCES = \
+$(CONFIGFILES_SOURCES) \
+$(LUALIBS_SOURCES) \
+$(XML_SOURCES) \
+$(TASK_SOURCES) \
+$(HANDLE_SOURCES) \
+$(HTTP_SOURCES) \
+$(REGEX_SOURCES) \
+
+
+#$(OCCI_SOURCES) \
+#$(SQL_SOURCES) \
+#$(GL_SOURCES) \
+#$(FTGL_SOURCES) \
+
+MODULES_LIST = \
+luaconfigfiles.dll \
+lualibs.dll \
+luaxml.dll \
+luatask.dll \
+luahandle.dll \
+luahttp.dll \
+luaregex.dll \
+
+
+#luaocci.dll \
+#luasql.dll \
+#luagl.dll \
+#luaftgl.dll \
+
+ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES) $(LUA_LIB))))
+ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES))))
+
+all: dep modules
+
+modules: $(MODULES_LIST)
+
+dep: $(ALL_DEPS)
+
+luaconfigfiles.dll: $(addsuffix .o, $(notdir $(basename $(CONFIGFILES_SOURCES))))
+ $(LD) -o $@ $+ $(CONFIGFILES_LIBS) $(LDFLAGS)
+
+luaxml.dll: $(addsuffix .o, $(notdir $(basename $(XML_SOURCES))))
+ $(LD) -o $@ $+ $(XML_LIBS) $(LDFLAGS)
+
+luaocci.dll: $(addsuffix .o, $(notdir $(basename $(OCCI_SOURCES))))
+ $(LD) -o $@ $+ $(OCCI_LIBS) $(LDFLAGS)
+
+luahandle.dll: $(addsuffix .o, $(notdir $(basename $(HANDLE_SOURCES))))
+ $(LD) -o $@ $+ $(HANDLE_LIBS) $(LDFLAGS)
+
+luahttp.dll: $(addsuffix .o, $(notdir $(basename $(HTTP_SOURCES))))
+ $(LD) -o $@ $+ $(HTTP_LIBS) $(LDFLAGS)
+
+luaregex.dll: $(addsuffix .o, $(notdir $(basename $(REGEX_SOURCES))))
+ $(LD) -o $@ $+ $(REGEX_LIBS) $(LDFLAGS)
+
+luatask.dll: $(addsuffix .o, $(notdir $(basename $(TASK_SOURCES))))
+ $(LD) -o $@ $+ $(TASK_LIBS) $(LDFLAGS)
+
+luasql.dll: $(addsuffix .o, $(notdir $(basename $(SQL_SOURCES))))
+ $(LD) -o $@ $+ $(SQL_LIBS) $(LDFLAGS)
+
+luagl.dll: $(addsuffix .o, $(notdir $(basename $(GL_SOURCES))))
+ $(LD) -o $@ $+ $(GL_LIBS) $(LDFLAGS)
+
+luaftgl.dll: $(addsuffix .o, $(notdir $(basename $(FTGL_SOURCES))))
+ $(LD) -o $@ $+ $(FTGL_LIBS) $(LDFLAGS)
+
+lualibs.dll: $(addsuffix .o, $(notdir $(basename $(LUALIBS_SOURCES) $(LUA_LIB))))
+ $(LD) -o $@ $+ $(LUALIBS_LIBS) $(LDFLAGS)
+
+clean:
+ rm -f *.o *.dep *.dll
+
+%.dep : %.c
+ $(CC) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cpp
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.dep : %.cc
+ $(CXX) $(CPPFLAGS) -M -MF $@ $<
+
+%.c : %.clua
+ bin2c $< $@ $(basename $@)
+
+%.clua : %.lua
+ ./luac -o $@ $<
+
+-include $(ALL_DEPS)
diff --git a/src/lua-plugin.cc b/src/lua-plugin.cc
new file mode 100644
index 0000000..79968a6
--- /dev/null
+++ b/src/lua-plugin.cc
@@ -0,0 +1,43 @@
+#include <lua-plugin.h>
+
+typedef void(*init_ptr_t)(Lua *);
+
+#ifdef _WIN32
+#include <windows.h>
+
+void LuaLoadPlugin(const String & _fname, Lua * L) throw (GeneralException) {
+ HMODULE handle;
+ String fname = _fname + ".dll";
+
+ if (!(handle = LoadLibraryEx(fname.to_charp(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) &&
+ !(handle = LoadLibraryEx(fname.to_charp(), NULL, NULL))) {
+ throw GeneralException("File not found or error loading shared object file: " + fname + "; Error #" + String((int) GetLastError()));
+ }
+
+ init_ptr_t init_ptr = (init_ptr_t) GetProcAddress(handle, "init_plugin");
+
+ if (!init_ptr) {
+ throw GeneralException("No init pointer on plugin " + fname);
+ }
+
+ init_ptr(L);
+}
+#else
+#include <dlfcn.h>
+
+void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException) {
+ void * handle = dlopen(("./" + fname + ".so").to_charp(), RTLD_NOW | RTLD_GLOBAL);
+
+ if (!handle) {
+ throw GeneralException("File not found or error loading shared object file: " + fname + "; " + dlerror());
+ }
+
+ init_ptr_t init_ptr = (init_ptr_t) dlsym(handle, "init_plugin");
+
+ if (!init_ptr) {
+ throw GeneralException("No init pointer on plugin " + fname);
+ }
+
+ init_ptr(L);
+}
+#endif
diff --git a/src/lua-plugin.h b/src/lua-plugin.h
new file mode 100644
index 0000000..dba8518
--- /dev/null
+++ b/src/lua-plugin.h
@@ -0,0 +1,9 @@
+#ifndef __LUA_PLUGIN_H__
+#define __LUA_PLUGIN_H__
+
+#include <BLua.h>
+#include <Exceptions.h>
+
+void LuaLoadPlugin(const String & fname, Lua * L) throw (GeneralException);
+
+#endif
diff --git a/src/plugin-luaconfigfiles.cc b/src/plugin-luaconfigfiles.cc
new file mode 100644
index 0000000..a174f6a
--- /dev/null
+++ b/src/plugin-luaconfigfiles.cc
@@ -0,0 +1,9 @@
+#include <LuaConfigFile.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaConfigFile::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luaftgl.cc b/src/plugin-luaftgl.cc
new file mode 100644
index 0000000..cd577b6
--- /dev/null
+++ b/src/plugin-luaftgl.cc
@@ -0,0 +1,9 @@
+#include <LuaFTGL.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaFTFont::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luagl.cc b/src/plugin-luagl.cc
new file mode 100644
index 0000000..2f0b55c
--- /dev/null
+++ b/src/plugin-luagl.cc
@@ -0,0 +1,10 @@
+#include <LuaGL.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ luaopen_opengl(L);
+ L->pop();
+}
+
+}
diff --git a/src/plugin-luahandle.cc b/src/plugin-luahandle.cc
new file mode 100644
index 0000000..d2002af
--- /dev/null
+++ b/src/plugin-luahandle.cc
@@ -0,0 +1,12 @@
+#include <LuaHandle.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaInput::pushconstruct(L);
+ LuaOutput::pushconstruct(L);
+ LuaBuffer::pushconstruct(L);
+ LuaHandle::pushconstruct(L);
+}
+
+}
diff --git a/src/plugin-luahttp.cc b/src/plugin-luahttp.cc
new file mode 100644
index 0000000..819a2f3
--- /dev/null
+++ b/src/plugin-luahttp.cc
@@ -0,0 +1,9 @@
+#include <LuaHttp.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaHttpResponse::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-lualibs.cc b/src/plugin-lualibs.cc
new file mode 100644
index 0000000..e364d9b
--- /dev/null
+++ b/src/plugin-lualibs.cc
@@ -0,0 +1,9 @@
+#include <loadlualibs.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LoadLuaLibs(L);
+}
+
+}
diff --git a/src/plugin-luaocci.cc b/src/plugin-luaocci.cc
new file mode 100644
index 0000000..8d9377e
--- /dev/null
+++ b/src/plugin-luaocci.cc
@@ -0,0 +1,9 @@
+#include <LuaOCCI.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaOCCI_pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luaregex.cc b/src/plugin-luaregex.cc
new file mode 100644
index 0000000..694738c
--- /dev/null
+++ b/src/plugin-luaregex.cc
@@ -0,0 +1,9 @@
+#include <LuaRegex.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaRegex::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luasql.cc b/src/plugin-luasql.cc
new file mode 100644
index 0000000..c891942
--- /dev/null
+++ b/src/plugin-luasql.cc
@@ -0,0 +1,9 @@
+#include <LuaSQL.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaSQLConnection::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luatask.cc b/src/plugin-luatask.cc
new file mode 100644
index 0000000..b97e273
--- /dev/null
+++ b/src/plugin-luatask.cc
@@ -0,0 +1,9 @@
+#include <LuaTask.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ LuaTaskMan::pushstatics(L);
+}
+
+}
diff --git a/src/plugin-luaxml.cc b/src/plugin-luaxml.cc
new file mode 100644
index 0000000..2cec871
--- /dev/null
+++ b/src/plugin-luaxml.cc
@@ -0,0 +1,10 @@
+#include <LuaXML.h>
+
+extern "C" {
+
+void init_plugin(Lua * L) {
+ luaopen_xml(L);
+ L->pop();
+}
+
+}