From: <and...@us...> - 2007-10-17 17:23:35
|
Revision: 7939 http://plplot.svn.sourceforge.net/plplot/?rev=7939&view=rev Author: andrewross Date: 2007-10-17 10:23:38 -0700 (Wed, 17 Oct 2007) Log Message: ----------- Add octave versioning support to matwrap. This alters the syntax of print_usage between octave 2.1 and octave 2.9. Removes a load of compile time warnings. Modified Paths: -------------- trunk/bindings/octave/CMakeLists.txt trunk/bindings/octave/matwrap/wrap_octave.pl Added Paths: ----------- trunk/bindings/octave/octave_version.pl.in Modified: trunk/bindings/octave/CMakeLists.txt =================================================================== --- trunk/bindings/octave/CMakeLists.txt 2007-10-17 01:40:22 UTC (rev 7938) +++ trunk/bindings/octave/CMakeLists.txt 2007-10-17 17:23:38 UTC (rev 7939) @@ -108,6 +108,11 @@ ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave.h @ONLY ) +configure_file( +${CMAKE_CURRENT_SOURCE_DIR}/octave_version.pl.in +${CMAKE_CURRENT_BINARY_DIR}/octave_version.pl +@ONLY +) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot_octave.cc Modified: trunk/bindings/octave/matwrap/wrap_octave.pl =================================================================== --- trunk/bindings/octave/matwrap/wrap_octave.pl 2007-10-17 01:40:22 UTC (rev 7938) +++ trunk/bindings/octave/matwrap/wrap_octave.pl 2007-10-17 17:23:38 UTC (rev 7939) @@ -11,9 +11,12 @@ # perl artistic license (http://language.perl.com/misc/Artistic.html). # # Modifications 2007 Andrew Ross -# This version contains two local fixes for plplot +# This version contains three local fixes for plplot # 1) Change _dim function to allow a zero length array (required by plstyl) # 2) Alter string to std::string for compatibility with gcc3.2 and later +# 3) Add octave version checking - the syntax of print_usage has changed +# from v2.1 to v2.9. This requires a file octave_version.pl which defines +# the variable octave_version. # package octave; # Everything should be in this package. @@ -122,6 +125,10 @@ # 1) The %function_def array. # sub function_start { + + require "octave_version.pl"; + our $octave_version; + my $faa = $_[0]; # Access the argument. my $retstr; @@ -150,11 +157,21 @@ unless (@{$faa->{outputs}}+@{$faa->{modifies}}) <= 1; # Permissible not to specify output args # if there is only one. - $retstr .= (")\n" . + @ver = split(/\./,$octave_version); + if ($ver[0] >= 2 && $ver[1] >= 9) { + $retstr .= (")\n" . " {\n" . + " print_usage();\n" . # Give an error. + " return retval;\n" . # Quit now. + " }\n\n"); + } + else { + $retstr .= (")\n" . + " {\n" . " print_usage(\"$fname\");\n" . # Give an error. " return retval;\n" . # Quit now. " }\n\n"); + } # # Now go through and store the octave expression to get each argument, so # we can access them later: Added: trunk/bindings/octave/octave_version.pl.in =================================================================== --- trunk/bindings/octave/octave_version.pl.in (rev 0) +++ trunk/bindings/octave/octave_version.pl.in 2007-10-17 17:23:38 UTC (rev 7939) @@ -0,0 +1,5 @@ +# + +our $octave_version = "@OCTAVE_VERSION@"; + +1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |