Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59047 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates
From: rutger_at_[hidden]
Date: 2010-01-15 10:08:31


Author: rutger
Date: 2010-01-15 10:08:30 EST (Fri, 15 Jan 2010)
New Revision: 59047
URL: http://svn.boost.org/trac/boost/changeset/59047

Log:
added initial support for user-definable grouping of subroutines (for dzasum and scasum initially)

Added:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_grouping.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py | 23 ++++++++++++-----------
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 18 +++++++++++++++---
   2 files changed, 27 insertions(+), 14 deletions(-)

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/blas_generator.py 2010-01-15 10:08:30 EST (Fri, 15 Jan 2010)
@@ -22,20 +22,21 @@
 # group them in the same .hpp file as well. Sort these subroutines based on
 # routine_cmp above.
 #
-def group_by_value_type( global_info_map ):
+def group_by_value_type( global_info_map, template_map ):
   group_map = {}
- for i in global_info_map.keys():
- short_name = i[ 1: ]
- if not group_map.has_key( short_name ):
- group_map[ short_name ] = []
- group_map[ short_name ] += [ i ]
+ for subroutine_name in global_info_map.keys():
+ subroutine_group_key = 'blas.group.' + subroutine_name
+ subroutine_group_name = None
+ if subroutine_group_key in template_map:
+ subroutine_group_name = template_map[ subroutine_group_key ].strip()
+ else:
+ subroutine_group_name = subroutine_name[ 1: ]
+ if not group_map.has_key( subroutine_group_name ):
+ group_map[ subroutine_group_name ] = []
+ group_map[ subroutine_group_name ] += [ subroutine_name ]
   for value in group_map.values():
     value.sort( bindings.routine_cmp )
   return group_map
-
-
-
-
  
 #
 # Write the (many) routine file(s).
@@ -497,7 +498,7 @@
 print "Grouping subroutines..."
 
 value_type_groups = {}
-value_type_groups = group_by_value_type( function_info_map )
+value_type_groups = group_by_value_type( function_info_map, templates )
 
 routines = {}
 routines[ 'level1' ] = {}

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 2010-01-15 10:08:30 EST (Fri, 15 Jan 2010)
@@ -847,6 +847,9 @@
 #
 def parse_file( filename, template_map ):
 
+ # the current parser mode
+ parser_mode = template_map[ 'PARSERMODE' ]
+
   # for nice printing
   pp = pprint.PrettyPrinter( indent = 2 )
 
@@ -921,11 +924,20 @@
   #
   # Do some further analysis as to what kind of routine this is
   #
- subroutine_group_name = subroutine_name[ 1: ]
+ subroutine_group_key = parser_mode.lower() + '.group.' + subroutine_name
+ subroutine_group_name = None
+ if subroutine_group_key in template_map:
+ subroutine_group_name = template_map[ subroutine_group_key ].strip()
+ else:
+ subroutine_group_name = subroutine_name[ 1: ]
+
+ subroutine_value_key = parser_mode.lower() + '.value.' + subroutine_name
   subroutine_value_type = None
- if subroutine_name[0] == 'C' or subroutine_name[0] == 'Z':
+ if my_has_key( subroutine_value_key, template_map ):
+ subroutine_value_type = template_map[ my_has_key( subroutine_value_key, template_map ) ].strip()
+ elif subroutine_name[0] == 'C' or subroutine_name[0] == 'Z':
     subroutine_value_type = 'complex'
- if subroutine_name[0] == 'S' or subroutine_name[0] == 'D':
+ elif subroutine_name[0] == 'S' or subroutine_name[0] == 'D':
     subroutine_value_type = 'real'
 
   print "Subroutine: ", subroutine_name

Added: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_grouping.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/blas_grouping.hpp 2010-01-15 10:08:30 EST (Fri, 15 Jan 2010)
@@ -0,0 +1,9 @@
+$TEMPLATE[blas.group.DZASUM]
+ASUM
+$TEMPLATE[blas.value.DZASUM]
+complex
+$TEMPLATE[blas.group.SCASUM]
+ASUM
+$TEMPLATE[blas.value.SCASUM]
+complex
+$TEMPLATE[end]


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