From: <arj...@us...> - 2010-08-17 06:36:15
|
Revision: 11136 http://plplot.svn.sourceforge.net/plplot/?rev=11136&view=rev Author: arjenmarkus Date: 2010-08-17 06:36:08 +0000 (Tue, 17 Aug 2010) Log Message: ----------- Correct C++-isms that caused MSVisual C/C++ 2008 compiler to complain. These were variable declarations in the middle of a block. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c trunk/examples/c/x19c.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-08-17 06:10:27 UTC (rev 11135) +++ trunk/bindings/tcl/tclAPI.c 2010-08-17 06:36:08 UTC (rev 11136) @@ -3344,15 +3344,19 @@ static void Tcl_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { + Tcl_Obj *objx, *objy; + int code; + double dx, dy; + // Set Tcl x to x - Tcl_Obj *objx = Tcl_NewDoubleObj( x ); + objx = Tcl_NewDoubleObj( x ); Tcl_IncrRefCount( objx ); Tcl_SetVar2Ex( tcl_xform_interp, "_##_x", NULL, objx, 0 ); Tcl_DecrRefCount( objx ); // Set Tcl y to y - Tcl_Obj *objy = Tcl_NewDoubleObj( y ); + objy = Tcl_NewDoubleObj( y ); Tcl_IncrRefCount( objy ); Tcl_SetVar2Ex( tcl_xform_interp, "_##_y", NULL, objy, 0 ); @@ -3365,7 +3369,7 @@ // Call identified Tcl proc. Forget data, Tcl can use namespaces and custom // procs to manage transmission of the custom client data. // Proc should return a two element list which is xt yt. - int code = Tcl_Eval( tcl_xform_interp, tcl_xform_code ); + code = Tcl_Eval( tcl_xform_interp, tcl_xform_code ); if ( code != TCL_OK ) { @@ -3380,8 +3384,6 @@ // In case PLFLT != double, we have to make sure we perform the extraction in // a safe manner. - double dx, dy; - if ( Tcl_GetDoubleFromObj( tcl_xform_interp, objx, &dx ) != TCL_OK || Tcl_GetDoubleFromObj( tcl_xform_interp, objy, &dy ) != TCL_OK ) { @@ -3417,12 +3419,13 @@ } else { + int len; const char *data = argc > 2 ? argv[2] : 0; tcl_xform_interp = interp; tcl_xform_procname = strdup( argv[1] ); - int len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); + len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname ); tcl_xform_code = malloc( len ); sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname ); Modified: trunk/examples/c/x19c.c =================================================================== --- trunk/examples/c/x19c.c 2010-08-17 06:10:27 UTC (rev 11135) +++ trunk/examples/c/x19c.c 2010-08-17 06:36:08 UTC (rev 11136) @@ -120,6 +120,7 @@ main( int argc, const char **argv ) { PLFLT minx, maxx, miny, maxy; + PLFLT x, y; /* Parse and process command line arguments */ @@ -187,8 +188,8 @@ /* Show Baltimore, MD on the map */ plcol0( 2 ); plssym( 0.0, 2.0 ); - PLFLT x = -76.6125; - PLFLT y = 39.2902778; + x = -76.6125; + y = 39.2902778; plpoin( 1, &x, &y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |