Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56684 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates
From: rutger_at_[hidden]
Date: 2009-10-09 16:42:09


Author: rutger
Date: 2009-10-09 16:42:08 EDT (Fri, 09 Oct 2009)
New Revision: 56684
URL: http://svn.boost.org/trac/boost/changeset/56684

Log:
added support for include hierarchy for lapack bindings

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py | 46 +++++++++++++++++++++++++++++++++++++++
   sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 2 +
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 2
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp | 18 +++++++++++++++
   4 files changed, 66 insertions(+), 2 deletions(-)

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/bindings.py 2009-10-09 16:42:08 EDT (Fri, 09 Oct 2009)
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
 #
 # Copyright (c) 2008 Thomas Klimpel and Rutger ter Borg
 #
@@ -77,7 +78,10 @@
     result = result + input_line[ prev_slice : cur_index ]
     all_results += [ result ]
 
- return "\n".join( all_results ) + "\n"
+ final_result = "\n".join( all_results ) + "\n"
+ final_result = final_result.replace( '( )', '()' )
+
+ return final_result
 
 
 
@@ -188,3 +192,43 @@
   #result = result.replace( "$PARSERMODE", template_map[ "PARSERMODE" ] )
 
   open( dest_file, 'wb' ).write( result )
+
+
+
+#
+# Write the include hierarchy header(s)
+#
+def write_include_hierarchy( global_info_map, routines, template_map, dest_path ):
+
+ parsermode = template_map[ 'PARSERMODE' ].lower()
+
+ for level, level_properties in routines.iteritems():
+ content = ''
+ dest_file = dest_path + '/' + level + '.hpp'
+
+ if template_map[ 'PARSERMODE' ] == 'BLAS':
+ print "something"
+ else:
+ # problem type = general_eigen, etc.
+ # problem properties = the mapped stuff
+ for problem_type, problem_properties in level_properties.iteritems():
+ # the key routines_by_value_type usually has 4 routines for a group of routines
+ if problem_properties.has_key( 'routines_by_value_type' ):
+ group_keys = problem_properties[ 'routines_by_value_type' ].keys()
+ group_keys.sort()
+
+ for r in group_keys:
+ content += '#include <boost/numeric/bindings/' + parsermode + '/' + level + \
+ '/' + r.lower() + '.hpp>\n'
+
+ result = template_map[ parsermode + '_include_hierarchy' ]
+ result = result.replace( "$CONTENT", content )
+ result = result.replace( "$LEVEL", level.upper() )
+
+ open( dest_file, 'wb' ).write( result )
+
+
+
+
+
+

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py 2009-10-09 16:42:08 EDT (Fri, 09 Oct 2009)
@@ -564,6 +564,8 @@
 bindings.write_names_header( function_info_map, routines, templates, bindings_target_path + 'detail/lapack_names.h' )
 bindings.write_header( function_info_map, routines, templates, bindings_target_path + 'detail/lapack.h' )
 
+bindings.write_include_hierarchy( function_info_map, routines, templates, bindings_target_path )
+
 for level, level_properties in routines.iteritems():
   target_path = bindings_target_path + level
   if not os.path.exists( target_path ):

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py 2009-10-09 16:42:08 EDT (Fri, 09 Oct 2009)
@@ -284,7 +284,7 @@
     
   if arg[0] == 'max' or arg[0] == 'min':
     print "arg1: ", arg[1]
- result = 'std::' + arg[0] + '('
+ result = 'std::' + arg[0] + '< std::ptrdiff_t >('
     i = 0
     for a in arg[1]:
       result += expand_nested_list( a, arg_map, use_arg_map )

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp 2009-10-09 16:42:08 EDT (Fri, 09 Oct 2009)
@@ -41,7 +41,25 @@
 inline void $groupname( $LEVEL0 ) {
     LAPACK_$SUBROUTINE( $CALL_BLAS_HEADER );
 }
+$TEMPLATE[lapack_include_hierarchy]
+//
+// Copyright (c) 2003--2009
+// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
+// Thomas Klimpel and Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// THIS FILE IS AUTOMATICALLY GENERATED
+// PLEASE DO NOT EDIT!
+//
 
+#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_$LEVEL_HPP
+#define BOOST_NUMERIC_BINDINGS_LAPACK_$LEVEL_HPP
+
+$CONTENT
+#endif
 $TEMPLATE[level1_pre_header]
 // value-type based template
 template< typename ValueType, typename Enable = void >


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk