From: <ai...@us...> - 2011-02-12 20:11:31
|
Revision: 11561 http://plplot.svn.sourceforge.net/plplot/?rev=11561&view=rev Author: airwin Date: 2011-02-12 20:11:25 +0000 (Sat, 12 Feb 2011) Log Message: ----------- Create custom target check_tcl_parameters that uses the sed script bindings/tcl/global_defines.sed to check the consistency of bindings/tcl/plplot_parameters.h with the #defines in bindings/swig-support/plplotcapi.i. Modified Paths: -------------- trunk/bindings/tcl/CMakeLists.txt Added Paths: ----------- trunk/bindings/tcl/global_defines.sed Modified: trunk/bindings/tcl/CMakeLists.txt =================================================================== --- trunk/bindings/tcl/CMakeLists.txt 2011-02-12 18:24:09 UTC (rev 11560) +++ trunk/bindings/tcl/CMakeLists.txt 2011-02-12 20:11:25 UTC (rev 11561) @@ -20,6 +20,22 @@ if(ENABLE_tcl) + # Check consistency of plplot_parameters.h. + add_custom_target( + check_tcl_parameters + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_CURRENT_BINARY_DIR}/plplot_parameters.h_compare + COMMAND + sed -f ${CMAKE_CURRENT_SOURCE_DIR}/global_defines.sed < + ${CMAKE_SOURCE_DIR}/bindings/swig-support/plplotcapi.i > + ${CMAKE_CURRENT_BINARY_DIR}/plplot_parameters.h_compare + COMMAND + ${CMAKE_COMMAND} -E echo "Check that plplot_parameters.h is consistent with the #defines in bindings/swig-support/plplotcapi.i" + COMMAND + cmp ${CMAKE_CURRENT_SOURCE_DIR}/plplot_parameters.h + ${CMAKE_CURRENT_BINARY_DIR}/plplot_parameters.h_compare + ) + # tclmatrix set(tclmatrix${LIB_TAG}_LIB_SRCS tclMatrix.c Added: trunk/bindings/tcl/global_defines.sed =================================================================== --- trunk/bindings/tcl/global_defines.sed (rev 0) +++ trunk/bindings/tcl/global_defines.sed 2011-02-12 20:11:25 UTC (rev 11561) @@ -0,0 +1,43 @@ +# sed script specifically designed to parse the #define statements in +# bindings/swig-support/plplotcapi.i into a file that can be used for +# global variable definitions for tcl. + +# Insert text at the start: +1 i\ +// Do not edit this generated file. Instead, check its consistency\ +// with the #defines in bindings/swig-support/plplotcapi.i using the\ +// (Unix) target "check_tcl_parameters". If that target reports an\ +// inconsistency (via a cmp message) between the generated\ +// plplot_parameters.h_compare file in the build tree and\ +// plplot_parameters.h in the source tree, then copy\ +// plplot_parameters.h_compare on top of plplot_parameters.h and\ +// check in that result.\ +\ +// This file contains a function to set the various global variables\ +// used by PLplot\ +\ +static void set_plplot_parameters( Tcl_Interp *interp ) {\ +\ + Tcl_Eval( interp, "namespace eval ::PLPLOT { \\n\\ + +# Append text at the end: +$ a\ +}" );\ +\ +} +# Drop every line that is not a #define +/^#define/! d + +# Drop specific #defines from the file that are not available +# because of specific #if statements. +/^#define ZEROW/ d +/^#define ONEW/ d +/OBJECT_DATA/ d +/^#define pltr_img/ d + +# Translate trailing comment identifier into # trailing comment. +/^#define/ s?//?#? + +# Parse what is left while preserving trailing comments. Watch out +# for parentheses around value as well. +/^#define/ s?^#define *\([^ ]*\)[ (]*\([^ ]*\)[ )]*\(.*\)$?\\n\\\n\3\\n\\\nvariable \1 \2 \\n\\? Property changes on: trunk/bindings/tcl/global_defines.sed ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |