changeset 39:380444ea0f28 lp-trunk

Added --enable-float-matrices option. Some VPATH building issues fixed. Changelog now more standardized.
author David Grundberg <individ@acc.umu.se>
date Sat, 09 May 2009 15:52:59 +0200
parents 25f49207de46 (current diff) 798efee55cd0 (diff)
children 824354efaa1a f3680a8edacc
files
diffstat 6 files changed, 139 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 07 08:28:22 2009 +0200
+++ b/ChangeLog	Sat May 09 15:52:59 2009 +0200
@@ -1,13 +1,21 @@
+2009-05-09  David Grundberg  <individ@acc.umu.se>
+
+	* ax_octave_float.m4: New file.
+	* configure.ac: Added --enable-float-matrices configure option.
+
 2009-05-07  Jaroslav Hajek  <highegg@gmail.com>
 
-	* exceptions.h: Added octave_parse_exception class.
-	* package/pytave.py: Added ParseError exception and eval method.
-	* pytave.cc: Extracted make_error_message from func_eval. Added
-	str_eval
+	* exceptions.h (octave_parse_exception): New class.
+	* package/pytave.py: Added ParseError exception.
+	(eval): New function.
+	* pytave.cc (func_eval, make_error_message): Extracted
+	make_error_message from func_eval.
+	(str_eval): New function.
 
 2009-05-05  David Grundberg  <individ@acc.umu.se>
 
-	* python_to_octave.cc: Function pydict_to_octmap modified.
+	* python_to_octave.cc (pydict_to_octmap): Improved semantics and
+	error control.
 	* m4/ax_octave.m4, m4/ax_python_devel.m4: New files.
 	* m4/ax_python.m4: Removed.
 	* m4/ax_boost_python.m4, README, INSTALL: Rewritten.
@@ -16,14 +24,14 @@
 
 2008-11-17  HÃ¥kan Fors Nilsson  <c04hfn@cs.umu.se>
 
-	* octave_to_python.cc: Added functions octcell_to_pyobject and 
-	octmap_to_pyobject.
-	* python_to_octave.cc: Added functions pydict_to_octmap and 
-	pylist_to_cellarray.
+	* octave_to_python.cc (octcell_to_pyobject, octmap_to_pyobject):
+	New functions.
+	* python_to_octave.cc (pylist_to_cellarray, pydict_to_octmap):
+	New functions.
 
 2008-11-17  David Grundberg  <individ@acc.umu.se>
 
-	* pytave.cc: func_eval: Improved pytave.OctaveError messages, now
+	* pytave.cc (func_eval): Improved pytave.OctaveError messages, now
 	includes filename, function and line of offending m-file.
 
 2008-11-10  David Grundberg  <individ@acc.umu.se>
--- a/Jamfile.in	Thu May 07 08:28:22 2009 +0200
+++ b/Jamfile.in	Sat May 09 15:52:59 2009 +0200
@@ -15,5 +15,5 @@
  	<cxxflags>"-Wall"
 ;
 
-python-extension _pytave : @srcdir@/octave_to_python.cc @srcdir@/pytave.cc @srcdir@/exceptions.cc @srcdir@/python_to_octave.cc @srcdir@/arrayobjectdefs.h @srcdir@/config.h @srcdir@/octave_to_python.h @srcdir@/pytavedefs.h @srcdir@/exceptions.h @srcdir@/python_to_octave.h ;
+python-extension _pytave : @srcdir@/octave_to_python.cc @srcdir@/pytave.cc @srcdir@/exceptions.cc @srcdir@/python_to_octave.cc @srcdir@/arrayobjectdefs.h @abs_builddir@/config.h @srcdir@/octave_to_python.h @srcdir@/pytavedefs.h @srcdir@/exceptions.h @srcdir@/python_to_octave.h ;
 
--- a/NEWS	Thu May 07 08:28:22 2009 +0200
+++ b/NEWS	Sat May 09 15:52:59 2009 +0200
@@ -21,7 +21,7 @@
 * Added functionality for one-row cell arrays.  The Python list is
   converted to a one-row cell array and vice versa.
 
-* Added functionality for structs.  The Python distionary is converted
+* Added functionality for structs.  The Python dictionary is converted
   to a Octave struct and vice versa.  The implementation tries to be
   as true as possible to Octave's struct constructor.
 
--- a/configure.ac	Thu May 07 08:28:22 2009 +0200
+++ b/configure.ac	Sat May 09 15:52:59 2009 +0200
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT(pytave, 0.1.1, c04dgg@cs.umu.se)
+AC_INIT(pytave, 0.1.1, [[https://bugs.launchpad.net/pytave]])
 
 # Some important programs.
 AC_LANG(C++)
@@ -17,9 +17,37 @@
 
 AC_PRESERVE_HELP_ORDER
 
+AC_ARG_ENABLE(float-matrices,
+	[AS_HELP_STRING([--enable-float-matrices],
+		[use Octave float matrices (experimental)
+		@<:@default=no@:>@])],
+	[pytave_enable_float="$enableval"],
+	[pytave_enable_float=no]) dnl TODO: Change to check someday
+
 pytave_libs_ok=
 
 AX_OCTAVE([], [], [pytave_libs_ok=no])
+
+AS_IF([test "x$pytave_enable_float" = "xcheck" dnl
+            -o "x$pytave_enable_float" = "xyes"], [
+	AX_OCTAVE_FLOAT([
+		AC_DEFINE([PYTAVE_USE_OCTAVE_FLOATS], [],
+			[Define to enable conversion of Octave float
+			matrices. If not defined, float matrices are
+			expanded to double matrices])
+	], [
+		AS_IF([test "x$pytave_enable_float" = "xyes"], [
+			AC_WARN([[
+========================================================================
+Float matrices enabled, but could not compile test program against
+Octave.
+========================================================================]])
+			pytave_libs_ok=no
+		])
+	])
+])
+
+# Pick a Python library to use
 AX_PYTHON_DEVEL([], [], [pytave_libs_ok=no])
 
 # Look for boost::python
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/ax_octave_float.m4	Sat May 09 15:52:59 2009 +0200
@@ -0,0 +1,89 @@
+# ===========================================================================
+#
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_OCTAVE_FLOAT([ACTION_IF_FOUND], [ACTION_IF_NOT_FOUND])
+#
+# DESCRIPTION
+#
+#   Runs a simple test to determine whether or not the FloatNDArray
+#   class is available.
+#
+#   Requires AX_OCTAVE.
+#
+# LAST MODIFICATION
+#
+#   2009-05-06
+#
+# COPYING
+#
+#   Copyright (c) 2009 David Grundberg
+#
+#   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, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Macro Archive. When you make and
+#   distribute a modified version of the Autoconf Macro, you may extend this
+#   special exception to the GPL to apply to your modified version as well.
+
+AC_DEFUN([AX_OCTAVE_FLOAT], [
+	AC_REQUIRE([AX_OCTAVE])
+
+	AS_IF([test -z "$ax_octave_ok" -a -n "$OCTAVE_CPPFLAGS"], [
+		AC_CACHE_CHECK([whether Octave has float support],
+		[ax_octave_float_cv_supported],
+		[
+			ax_octave_float_cv_supported=no
+
+			AC_LANG_PUSH([C++])
+
+			ax_octave_old_ldflags="$LDFLAGS"
+			ax_octave_old_cppflags="$CPPFLAGS"
+			ax_octave_old_libs="$LIBS"
+			LDFLAGS="$OCTAVE_LDFLAGS $LDFLAGS"
+			CPPFLAGS="$OCTAVE_CPPFLAGS $CPPFLAGS"
+			LIBS="$OCTAVE_LIBS $LIBS"
+
+			AC_LANG_ASSERT(C++)
+			AC_COMPILE_IFELSE(
+			AC_LANG_PROGRAM(
+				[[#include <octave/oct.h>
+				#include <octave/Matrix.h> ]],
+				[[FloatNDArray()]]),
+				[ax_octave_float_cv_supported=yes],
+				[ax_octave_float_cv_supported=no])
+			LDFLAGS="$ax_octave_old_ldflags"
+			CPPFLAGS="$ax_octave_old_cppflags"
+			LIBS="$ax_octave_old_libs"
+
+			AC_LANG_POP([C++])
+		])
+	])
+
+	# Execute ACTION_IF_FOUND or ACTION_IF_NOT_FOUND
+	if test "x$ax_octave_float_cv_supported" = "xyes"; then
+		m4_ifvaln([$1],[$1],[:])dnl
+		m4_ifvaln([$2],[else $2])dnl
+	fi
+])
--- a/setup.py.in	Thu May 07 08:28:22 2009 +0200
+++ b/setup.py.in	Sat May 09 15:52:59 2009 +0200
@@ -22,7 +22,7 @@
          ],
          depends = [
          '@srcdir@/arrayobjectdefs.h',
-         '@srcdir@/config.h',
+         '@abs_builddir@/config.h',
          '@srcdir@/octave_to_python.h',
          '@srcdir@/pytavedefs.h',
          '@srcdir@/exceptions.h',