From 92efe73791d0998536042bfab5a1babc67d168c7 Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Thu, 9 Sep 2010 01:06:43 +0200
Subject: Upgrading to IM 3.6.2, and doing some cleanup at the same time.

---
 im/src/lua5/imlua.c           |  7 +------
 im/src/lua5/imlua.def         |  1 -
 im/src/lua5/imlua_aux.c       |  6 +++++-
 im/src/lua5/imlua_aux.h       |  7 ++++++-
 im/src/lua5/imlua_avi.c       |  5 -----
 im/src/lua5/imlua_avi.def     |  1 -
 im/src/lua5/imlua_capture.c   | 21 +++++++++++++--------
 im/src/lua5/imlua_capture.def |  1 -
 im/src/lua5/imlua_convert.c   |  2 +-
 im/src/lua5/imlua_fftw.c      | 31 ++++++++++---------------------
 im/src/lua5/imlua_fftw.def    |  1 -
 im/src/lua5/imlua_image.c     |  8 ++++----
 im/src/lua5/imlua_jp2.c       |  5 -----
 im/src/lua5/imlua_jp2.def     |  1 -
 im/src/lua5/imlua_palette.c   |  4 ++--
 im/src/lua5/imlua_process.c   | 11 +++++------
 im/src/lua5/imlua_process.def |  1 -
 im/src/lua5/imlua_wmv.c       |  5 -----
 im/src/lua5/imlua_wmv.def     |  1 -
 19 files changed, 47 insertions(+), 72 deletions(-)

(limited to 'im/src/lua5')

diff --git a/im/src/lua5/imlua.c b/im/src/lua5/imlua.c
index 7e5c328..48224c2 100755
--- a/im/src/lua5/imlua.c
+++ b/im/src/lua5/imlua.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua.c,v 1.2 2008/12/11 19:02:49 scuri Exp $
+ * $Id: imlua.c,v 1.3 2010/06/07 20:59:32 scuri Exp $
  */
 
 #include <string.h>
@@ -245,8 +245,3 @@ int luaopen_imlua(lua_State *L)
 {
   return imlua_open(L);
 }
-
-int luaopen_imlua51(lua_State *L)
-{
-  return imlua_open(L);
-}
diff --git a/im/src/lua5/imlua.def b/im/src/lua5/imlua.def
index 259c822..deb5584 100755
--- a/im/src/lua5/imlua.def
+++ b/im/src/lua5/imlua.def
@@ -1,6 +1,5 @@
 EXPORTS
   luaopen_imlua
-  luaopen_imlua51
   imlua_open
   imlua_checkimage
   imlua_newarrayulong
diff --git a/im/src/lua5/imlua_aux.c b/im/src/lua5/imlua_aux.c
index b26df93..ef972b2 100755
--- a/im/src/lua5/imlua_aux.c
+++ b/im/src/lua5/imlua_aux.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_aux.c,v 1.3 2010/01/21 18:24:22 scuri Exp $
+ * $Id: imlua_aux.c,v 1.4 2010/06/10 20:17:40 scuri Exp $
  */
 
 #include <memory.h>
@@ -27,7 +27,11 @@ int imlua_getn (lua_State *L, int index)
 {
   int n;
   lua_pushstring(L, "table");
+#if LUA_VERSION_NUM > 501
+  lua_pushglobaltable(L);
+#else
   lua_gettable(L, LUA_GLOBALSINDEX);
+#endif
   lua_pushstring(L, "getn");
   lua_gettable(L, -2);
   lua_pushvalue(L, index);
diff --git a/im/src/lua5/imlua_aux.h b/im/src/lua5/imlua_aux.h
index 2dc4466..c1cbdb5 100755
--- a/im/src/lua5/imlua_aux.h
+++ b/im/src/lua5/imlua_aux.h
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_aux.h,v 1.1 2008/10/17 06:16:32 scuri Exp $
+ * $Id: imlua_aux.h,v 1.2 2010/06/11 17:43:52 scuri Exp $
  */
 
 #ifndef __IMLUA_AUX_H
@@ -75,6 +75,11 @@ void imlua_open_convert(lua_State *L);  /* imlua_convert.c */
 void imlua_open_util(lua_State *L);     /* imlua_util.c    */
 void imlua_open_file(lua_State *L);     /* imlua_file.c    */
 
+#if LUA_VERSION_NUM < 502
+#define luaL_typeerror luaL_typerror
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/im/src/lua5/imlua_avi.c b/im/src/lua5/imlua_avi.c
index f2cd7f4..c6ffff1 100755
--- a/im/src/lua5/imlua_avi.c
+++ b/im/src/lua5/imlua_avi.c
@@ -37,8 +37,3 @@ int luaopen_imlua_avi(lua_State* L)
 {
   return imlua_avi_open(L);
 }
-
-int luaopen_imlua_avi51(lua_State* L)
-{
-  return imlua_avi_open(L);
-}
diff --git a/im/src/lua5/imlua_avi.def b/im/src/lua5/imlua_avi.def
index 3086a0d..9287d69 100755
--- a/im/src/lua5/imlua_avi.def
+++ b/im/src/lua5/imlua_avi.def
@@ -1,4 +1,3 @@
 EXPORTS
   luaopen_imlua_avi
-  luaopen_imlua_avi51
  
\ No newline at end of file
diff --git a/im/src/lua5/imlua_capture.c b/im/src/lua5/imlua_capture.c
index 59ec0fb..181cbd0 100755
--- a/im/src/lua5/imlua_capture.c
+++ b/im/src/lua5/imlua_capture.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_capture.c,v 1.2 2009/08/12 04:09:17 scuri Exp $
+ * $Id: imlua_capture.c,v 1.4 2010/06/07 20:59:32 scuri Exp $
  */
 
 #include <string.h>
@@ -68,7 +68,7 @@ static int imluaVideoCaptureDeviceDesc (lua_State *L)
 }
 
 /*****************************************************************************\
- im.VideoCaptureDeviceDesc(device)
+ im.VideoCaptureReloadDevices()
 \*****************************************************************************/
 static int imluaVideoCaptureReloadDevices (lua_State *L)
 {
@@ -76,6 +76,16 @@ static int imluaVideoCaptureReloadDevices (lua_State *L)
   return 1;
 }
 
+/*****************************************************************************\
+ im.VideoCaptureReleaseDevices()
+\*****************************************************************************/
+static int imluaVideoCaptureReleaseDevices (lua_State *L)
+{
+  (void)L;
+  imVideoCaptureReleaseDevices();
+  return 0;
+}
+
 /*****************************************************************************\
  im.VideoCaptureCreate()
 \*****************************************************************************/
@@ -381,6 +391,7 @@ static const luaL_reg imcapture_lib[] = {
   {"VideoCaptureDeviceCount", imluaVideoCaptureDeviceCount},
   {"VideoCaptureDeviceDesc", imluaVideoCaptureDeviceDesc},
   {"VideoCaptureReloadDevices", imluaVideoCaptureReloadDevices},
+  {"VideoCaptureReleaseDevices", imluaVideoCaptureReleaseDevices},
   {"VideoCaptureCreate", imluaVideoCaptureCreate},
   {"VideoCaptureDestroy", imluaVideoCaptureDestroy},
   {NULL, NULL}
@@ -435,9 +446,3 @@ int luaopen_imlua_capture(lua_State *L)
 {
   return imlua_open_capture(L);
 }
-
-int luaopen_imlua_capture51(lua_State *L)
-{
-  return imlua_open_capture(L);
-}
-
diff --git a/im/src/lua5/imlua_capture.def b/im/src/lua5/imlua_capture.def
index 1b279cf..5d247cf 100755
--- a/im/src/lua5/imlua_capture.def
+++ b/im/src/lua5/imlua_capture.def
@@ -1,5 +1,4 @@
 EXPORTS
   imlua_open_capture
   luaopen_imlua_capture
-  luaopen_imlua_capture51
   
\ No newline at end of file
diff --git a/im/src/lua5/imlua_convert.c b/im/src/lua5/imlua_convert.c
index 3c3f146..1bc4ab3 100755
--- a/im/src/lua5/imlua_convert.c
+++ b/im/src/lua5/imlua_convert.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_convert.c,v 1.3 2009/08/18 02:23:33 scuri Exp $
+ * $Id: imlua_convert.c,v 1.4 2010/06/07 20:59:32 scuri Exp $
  */
 
 #include "im.h"
diff --git a/im/src/lua5/imlua_fftw.c b/im/src/lua5/imlua_fftw.c
index c8ad3df..f25f9c3 100755
--- a/im/src/lua5/imlua_fftw.c
+++ b/im/src/lua5/imlua_fftw.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_fftw.c,v 1.2 2008/11/26 17:25:51 scuri Exp $
+ * $Id: imlua_fftw.c,v 1.3 2010/06/07 20:59:32 scuri Exp $
  */
 
 #include <memory.h>
@@ -131,23 +131,17 @@ static const luaL_reg imfftw_lib[] = {
 int imlua_open_fftw (lua_State *L)
 {
   luaL_register(L, "im", imfftw_lib);  /* leave "im" table at the top of the stack */
-#ifdef TEC_BIGENDIAN
-#ifdef TEC_64
-#include "loh/im_fftw_be64.loh"
-#else
-#include "loh/im_fftw_be32.loh"
-#endif  
-#else
-#ifdef TEC_64
-#ifdef WIN64
-#include "loh/im_fftw_le64w.loh"
+
+#ifdef IMLUA_USELOH
+#include "im_fftw.loh"
 #else
-#include "loh/im_fftw_le64.loh"
-#endif  
+#ifdef IMLUA_USELZH
+#include "im_fftw.lzh"
 #else
-#include "loh/im_fftw.loh"
-#endif  
-#endif  
+  luaL_dofile(L, "im_fftw.lua");
+#endif
+#endif
+
   return 1;
 }
 
@@ -155,8 +149,3 @@ int luaopen_imlua_fftw(lua_State *L)
 {
   return imlua_open_fftw(L);
 }
-
-int luaopen_imlua_fftw51(lua_State *L)
-{
-  return imlua_open_fftw(L);
-}
diff --git a/im/src/lua5/imlua_fftw.def b/im/src/lua5/imlua_fftw.def
index 216c967..b364103 100755
--- a/im/src/lua5/imlua_fftw.def
+++ b/im/src/lua5/imlua_fftw.def
@@ -1,4 +1,3 @@
 EXPORTS
   imlua_open_fftw
   luaopen_imlua_fftw
-  luaopen_imlua_fftw51
\ No newline at end of file
diff --git a/im/src/lua5/imlua_image.c b/im/src/lua5/imlua_image.c
index 0e8676d..dd00d87 100755
--- a/im/src/lua5/imlua_image.c
+++ b/im/src/lua5/imlua_image.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_image.c,v 1.9 2010/01/17 18:18:12 scuri Exp $
+ * $Id: imlua_image.c,v 1.11 2010/06/07 20:59:32 scuri Exp $
  */
 
 #include <string.h>
@@ -674,7 +674,7 @@ static int imluaImageColorSpace(lua_State *L)
 static int imluaImageHasAlpha(lua_State *L)
 {
   imImage *im = imlua_checkimage(L, 1);
-  lua_pushnumber(L, im->has_alpha);
+  lua_pushboolean(L, im->has_alpha);
   return 1;
 }
 
@@ -785,14 +785,14 @@ static int imluaImage_tostring (lua_State *L)
   if (*image_p)
   {
     imImage *image = *image_p;
-    lua_pushfstring(L, "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d,has_alpha=%d]", 
+    lua_pushfstring(L, "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d,has_alpha=%s]", 
       image_p,
       image->width, 
       image->height,
       imColorModeSpaceName(image->color_space),
       imDataTypeName(image->data_type),
       image->depth,
-      image->has_alpha
+      image->has_alpha? "yes": "no"
     );
   }
   else
diff --git a/im/src/lua5/imlua_jp2.c b/im/src/lua5/imlua_jp2.c
index d69ba7e..fc694d5 100755
--- a/im/src/lua5/imlua_jp2.c
+++ b/im/src/lua5/imlua_jp2.c
@@ -37,8 +37,3 @@ int luaopen_imlua_jp2(lua_State* L)
 {
   return imlua_jp2_open(L);
 }
-
-int luaopen_imlua_jp251(lua_State* L)
-{
-  return imlua_jp2_open(L);
-}
diff --git a/im/src/lua5/imlua_jp2.def b/im/src/lua5/imlua_jp2.def
index 29aa05c..c5713d3 100755
--- a/im/src/lua5/imlua_jp2.def
+++ b/im/src/lua5/imlua_jp2.def
@@ -1,4 +1,3 @@
 EXPORTS
   luaopen_imlua_jp2
-  luaopen_imlua_jp251
  
\ No newline at end of file
diff --git a/im/src/lua5/imlua_palette.c b/im/src/lua5/imlua_palette.c
index 80d23eb..135fe9a 100755
--- a/im/src/lua5/imlua_palette.c
+++ b/im/src/lua5/imlua_palette.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_palette.c,v 1.1 2008/10/17 06:16:32 scuri Exp $
+ * $Id: imlua_palette.c,v 1.2 2010/06/11 17:43:52 scuri Exp $
  */
 
 #include <string.h>
@@ -42,7 +42,7 @@ static imluaPalette* imlua_rawcheckpalette(lua_State *L, int param)
       }
     }
   }
-  luaL_typerror(L, param, "imPalette");  /* else error */
+  luaL_typeerror(L, param, "imPalette");  /* else error */
   return NULL;  /* to avoid warnings */
 }
 
diff --git a/im/src/lua5/imlua_process.c b/im/src/lua5/imlua_process.c
index 978428b..b8c435c 100755
--- a/im/src/lua5/imlua_process.c
+++ b/im/src/lua5/imlua_process.c
@@ -2,7 +2,7 @@
  * \brief IM Lua 5 Binding
  *
  * See Copyright Notice in im_lib.h
- * $Id: imlua_process.c,v 1.11 2010/03/21 22:29:10 scuri Exp $
+ * $Id: imlua_process.c,v 1.13 2010/06/10 20:17:40 scuri Exp $
  */
 
 #include <memory.h>
@@ -1805,7 +1805,11 @@ static int imluaProcessMultipleStdDev (lua_State *L)
     luaL_argerror(L, 1, "must be a table");
 
   lua_pushstring(L, "table");
+#if LUA_VERSION_NUM > 501
+  lua_pushglobaltable(L);
+#else
   lua_gettable(L, LUA_GLOBALSINDEX);
+#endif
   lua_pushstring(L, "getn");
   lua_gettable(L, -2);
   src_image_count = luaL_checkint(L, -1);
@@ -3139,8 +3143,3 @@ int luaopen_imlua_process(lua_State *L)
 {
   return imlua_open_process(L);
 }
-
-int luaopen_imlua_process51(lua_State *L)
-{
-  return imlua_open_process(L);
-}
diff --git a/im/src/lua5/imlua_process.def b/im/src/lua5/imlua_process.def
index 2b77e77..bac2cf7 100755
--- a/im/src/lua5/imlua_process.def
+++ b/im/src/lua5/imlua_process.def
@@ -1,4 +1,3 @@
 EXPORTS
   imlua_open_process
   luaopen_imlua_process
-  luaopen_imlua_process51
\ No newline at end of file
diff --git a/im/src/lua5/imlua_wmv.c b/im/src/lua5/imlua_wmv.c
index 7f61030..d715b37 100755
--- a/im/src/lua5/imlua_wmv.c
+++ b/im/src/lua5/imlua_wmv.c
@@ -37,8 +37,3 @@ int luaopen_imlua_wmv(lua_State* L)
 {
   return imlua_wmv_open(L);
 }
-
-int luaopen_imlua_wmv51(lua_State* L)
-{
-  return imlua_wmv_open(L);
-}
diff --git a/im/src/lua5/imlua_wmv.def b/im/src/lua5/imlua_wmv.def
index 0c05563..96f7128 100755
--- a/im/src/lua5/imlua_wmv.def
+++ b/im/src/lua5/imlua_wmv.def
@@ -1,4 +1,3 @@
 EXPORTS
   luaopen_imlua_wmv
-  luaopen_imlua_wmv51
  
\ No newline at end of file
-- 
cgit v1.2.3