Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56262 - sandbox/numeric_bindings/libs/numeric/bindings/tools
From: rutger_at_[hidden]
Date: 2009-09-17 03:52:09


Author: rutger
Date: 2009-09-17 03:52:07 EDT (Thu, 17 Sep 2009)
New Revision: 56262
URL: http://svn.boost.org/trac/boost/changeset/56262

Log:
Added const qualifiers to matrix and vector types.

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/netlib.py | 12 +++++++++---
   1 files changed, 9 insertions(+), 3 deletions(-)

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-09-17 03:52:07 EDT (Thu, 17 Sep 2009)
@@ -50,7 +50,7 @@
 
   result = m_type_map[ properties[ 'value_type' ] ];
   if properties[ 'io' ] == [ 'input' ]:
- result += ' const'
+ result = 'const ' + result
   result += '*'
   result += ' ' + name.lower() # is this really needed?
   
@@ -67,15 +67,17 @@
   
   if properties[ 'type' ] == 'scalar':
     if properties[ 'io' ] == [ 'input' ]:
- result += ' const'
+ result = 'const ' + result
     elif properties[ 'io' ] == [ 'external procedure' ]:
       result += '*'
     else:
       result += '&'
     
   if properties[ 'type' ] == 'vector' or properties[ 'type' ] == 'matrix':
+ if properties[ 'io' ] == [ 'input' ]:
+ result += ' const'
     result += '*'
-
+
   result += ' ' + name.lower()
     
   return result
@@ -136,8 +138,12 @@
   if not properties.has_key( 'trait_of' ) and 'workspace' not in properties[ 'io' ]:
     if properties[ 'type' ] == 'matrix':
       result = "Matrix" + name + "& " + name.lower()
+ if properties[ 'io' ] == [ 'input' ]:
+ result = 'const ' + result
     elif properties[ 'type' ] == 'vector':
       result = "Vector" + name + "& " + name.lower()
+ if properties[ 'io' ] == [ 'input' ]:
+ result = 'const ' + result
     else:
       result = cpp_type( name, properties )
       if properties[ 'value_type' ] == 'REAL':


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