From: <ai...@us...> - 2010-11-28 20:54:03
|
Revision: 11354 http://plplot.svn.sourceforge.net/plplot/?rev=11354&view=rev Author: airwin Date: 2010-11-28 20:53:56 +0000 (Sun, 28 Nov 2010) Log Message: ----------- Introduce new plstring3 API for plotting a glyph for a whole range of 3D coordinates. This API is designed to largely supersede plpoin3 since many(!) more glyphs are available with plstring3. Convert C example 18 to replace plpoin3 with plstring3. This plstring3 API addition and example 18 change needs to be propagated to all our languages. Modified Paths: -------------- trunk/examples/c/x18c.c trunk/include/plplot.h trunk/src/plsym.c Modified: trunk/examples/c/x18c.c =================================================================== --- trunk/examples/c/x18c.c 2010-11-28 18:40:34 UTC (rev 11353) +++ trunk/examples/c/x18c.c 2010-11-28 20:53:56 UTC (rev 11354) @@ -1,3 +1,4 @@ +// -*- coding: utf-8; -*- // $Id$ // // 3-d line and point plot demo. Adapted from x08c.c. @@ -72,9 +73,14 @@ plcol0( 2 ); if ( opt[k] ) + { plline3( NPTS, x, y, z ); + } else - plpoin3( NPTS, x, y, z, 1 ); + { + // U+22C5 DOT OPERATOR. + plstring3( NPTS, x, y, z, "⋅" ); + } plcol0( 3 ); sprintf( title, "#frPLplot Example 18 - Alt=%.0f, Az=%.0f", Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-11-28 18:40:34 UTC (rev 11353) +++ trunk/include/plplot.h 2010-11-28 20:53:56 UTC (rev 11354) @@ -765,6 +765,7 @@ #define plstart c_plstart #define plstransform c_plstransform #define plstring c_plstring +#define plstring3 c_plstring3 #define plstripa c_plstripa #define plstripc c_plstripc #define plstripd c_plstripd @@ -1748,6 +1749,15 @@ PLDLLIMPEXP void c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *string ); +// Prints out the same string repeatedly at the n points in world +// coordinates given by the x, y, and z arrays. Supersedes plpoin3 +// for the case where text refers to a unicode glyph either directly +// as UTF-8 or indirectly via the standard text escape sequences +// allowed for PLplot input strings. + +PLDLLIMPEXP void +c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char *string ); + // Add a point to a stripchart. PLDLLIMPEXP void Modified: trunk/src/plsym.c =================================================================== --- trunk/src/plsym.c 2010-11-28 18:40:34 UTC (rev 11353) +++ trunk/src/plsym.c 2010-11-28 20:53:56 UTC (rev 11354) @@ -204,16 +204,17 @@ //-------------------------------------------------------------------------- //! Plot a glyph at the specified 3D points. Setup the call to this -//! function similar to what is done for plline3. code=-1 means try -//! to just draw a point. Right now it's just a move and a draw at -//! the same place. Not ideal, since a sufficiently intelligent -//! output device may optimize it away, or there may be faster ways of -//! doing it. This is OK for now, though, and offers a 4X speedup -//! over drawing a Hershey font "point" (which is actually diamond -//! shaped and therefore takes 4 strokes to draw). If 0 < code < 32, -//! then a useful (but small subset) of Hershey symbols is plotted. -//! If 32 <= code <= 127 the corresponding printable ASCII character -//! is plotted. +//! function similar to what is done for plline3. This function is +//! largely superseded by plstring3 which gives access to many(!) more +//! glyphs. code=-1 means try to just draw a point. Right now it's +//! just a move and a draw at the same place. Not ideal, since a +//! sufficiently intelligent output device may optimize it away, or +//! there may be faster ways of doing it. This is OK for now, though, +//! and offers a 4X speedup over drawing a Hershey font "point" (which +//! is actually diamond shaped and therefore takes 4 strokes to draw). +//! If 0 < code < 32, then a useful (but small subset) of Hershey +//! symbols is plotted. If 32 <= code <= 127 the corresponding +//! printable ASCII character is plotted. //! @param n : number of points in x, y, and z arrays. //! @param x : pointer to an array with X coordinates of points. //! @param y : pointer to an array with Y coordinates of points. @@ -277,10 +278,55 @@ } } } - return; } //-------------------------------------------------------------------------- +//! Plot glyphs (normally just one of them) at the specified 3D +//! coordinates. Setup the call to this function similar to what is +//! done for plline3. This function largely supersedes plpoin3 +//! because many(!) more glyphs are accessible with plstring3. The +//! glyph is specified with a PLplot user string. As with plmtex and +//! plptex, the user string can contain FCI escapes to determine the +//! font, UTF-8 code to determine the glyph or else PLplot escapes for +//! Hershey or unicode text to determine the glyph. +//! @param n : number of points in x, y, and z arrays. +//! @param x : array of X coordinates of points. +//! @param y : array of Y coordinates of points. +//! @param z : array of Z coordinates of points. +//! @param string : PLplot user string corresponding to the glyph to +//! be plotted at each of the n points. +//-------------------------------------------------------------------------- + +void +c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char * string ) +{ + PLINT i; + PLFLT u, v; + PLFLT xmin, xmax, ymin, ymax, zmin, zmax, zscale; + + if ( plsc->level < 3 ) + { + plabort( "plstring3: Please set up window first" ); + return; + } + + plP_gdom( &xmin, &xmax, &ymin, &ymax ); + plP_grange( &zscale, &zmin, &zmax ); + + for ( i = 0; i < n; i++ ) + { + if ( x[i] >= xmin && x[i] <= xmax && + y[i] >= ymin && y[i] <= ymax && + z[i] >= zmin && z[i] <= zmax ) + { + u = plP_w3wcx( x[i], y[i], z[i] ); + v = plP_w3wcy( x[i], y[i], z[i] ); + c_plptex( u, v, 1., 0., 0.5, string ); + } + } +} + +//-------------------------------------------------------------------------- // static void plhrsh(PLINT ch, PLINT x, PLINT y) // PLINT ch - hershey code to plot // PLINT x - device-world x coordinate of hershey character This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-11-28 21:38:30
|
Revision: 11355 http://plplot.svn.sourceforge.net/plplot/?rev=11355&view=rev Author: airwin Date: 2010-11-28 21:38:24 +0000 (Sun, 28 Nov 2010) Log Message: ----------- Propagate plstring3 to Python bindings and examples. Modified Paths: -------------- trunk/bindings/swig-support/plplotcapi.i trunk/examples/python/xw18.py Modified: trunk/bindings/swig-support/plplotcapi.i =================================================================== --- trunk/bindings/swig-support/plplotcapi.i 2010-11-28 20:53:56 UTC (rev 11354) +++ trunk/bindings/swig-support/plplotcapi.i 2010-11-28 21:38:24 UTC (rev 11355) @@ -878,6 +878,10 @@ void plstring( PLINT n, PLFLT *Array, PLFLT *ArrayCk, const char *string ); +%feature( "autodoc", "Prints out the same string repeatedly at the n 3D points in world coordinates given by the x, y, and z arrays. Supersedes plpoin3 for the case where text refers to a unicode glyph either directly as UTF-8 or indirectly via the standard text escape sequences allowed for PLplot input strings." ) plstring3; +void +plstring3( PLINT n, PLFLT *Array, PLFLT *ArrayCk, PLFLT *ArrayCk, const char *string ); + %feature( "autodoc", "Add a point to a stripchart." ) plstripa; void plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y ); Modified: trunk/examples/python/xw18.py =================================================================== --- trunk/examples/python/xw18.py 2010-11-28 20:53:56 UTC (rev 11354) +++ trunk/examples/python/xw18.py 2010-11-28 21:38:24 UTC (rev 11355) @@ -1,3 +1,4 @@ +# -*- coding: utf-8; -*- # $Id$ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin @@ -63,7 +64,8 @@ if opt[k]: plline3(x, y, z) else: - plpoin3(x, y, z, 1) + # U+22C5 DOT OPERATOR. + plstring3(x, y, z, "⋅") plcol0(3) title = "#frPLplot Example 18 - Alt=%.0f, Az=%.0f" % (alt[k], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2010-12-01 15:52:41
|
Revision: 11357 http://plplot.svn.sourceforge.net/plplot/?rev=11357&view=rev Author: arjenmarkus Date: 2010-12-01 15:52:34 +0000 (Wed, 01 Dec 2010) Log Message: ----------- Implementation of plstring3 in Fortran 77, 95 and Tcl. Example 18 not yet adjusted. Modified Paths: -------------- trunk/bindings/f77/plplotf77.def trunk/bindings/f77/plplotf77_ifort.def trunk/bindings/f77/plplotf77_mingw.def trunk/bindings/f77/plstubs.h trunk/bindings/f77/scstubs.c trunk/bindings/f95/plplotf95.def trunk/bindings/f95/plplotf95_ifort.def trunk/bindings/f95/plplotf95_mingw.def trunk/bindings/f95/plstubs.h trunk/bindings/f95/scstubs.c trunk/bindings/tcl/plapi.tpl trunk/scripts/comprehensive_test.sh Modified: trunk/bindings/f77/plplotf77.def =================================================================== --- trunk/bindings/f77/plplotf77.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f77/plplotf77.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -41,6 +41,7 @@ _PLSTART@16 _PLSTRC2F@16 _PLSTRING@16 + _PLSTRING3@20 _PLSTRIPC@104 _PLTIMEFMT@8 _PLVEC0@20 Modified: trunk/bindings/f77/plplotf77_ifort.def =================================================================== --- trunk/bindings/f77/plplotf77_ifort.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f77/plplotf77_ifort.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -41,6 +41,7 @@ PLSTART PLSTRC2F PLSTRING + PLSTRING3 PLSTRIPC PLTIMEFMT PLVEC0 Modified: trunk/bindings/f77/plplotf77_mingw.def =================================================================== --- trunk/bindings/f77/plplotf77_mingw.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f77/plplotf77_mingw.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -42,6 +42,7 @@ plstart_ plstrc2f_ plstring_ + plstring3_ plstripc_ pltimefmt_ plvec0_ Modified: trunk/bindings/f77/plstubs.h =================================================================== --- trunk/bindings/f77/plstubs.h 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f77/plstubs.h 2010-12-01 15:52:34 UTC (rev 11357) @@ -330,6 +330,7 @@ #define PLSTRANSFORM_NONE FNAME( PLSTRANSFORM_NONE, plstransform_none ) #define PLSTRANSFORM_NONE_ FNAME( PLSTRANSFORM_NONE_, plstransform_none_ ) #define PLSTRING7 FNAME( PLSTRING7, plstring7 ) +#define PLSTRING37 FNAME( PLSTRING37, plstring37 ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC7 FNAME( PLSTRIPC7, plstripc7 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f77/scstubs.c 2010-12-01 15:52:34 UTC (rev 11357) @@ -1002,6 +1002,12 @@ } void +PLSTRING37( PLINT *n, PLFLT *x, PLFLT *y, PLFLT *z, const char *string ) +{ + c_plstring3( *n, x, y, z, string ); +} + +void PLSTRIPA( PLINT *id, PLINT *pen, PLFLT *x, PLFLT *y ) { c_plstripa( *id, *pen, *x, *y ); Modified: trunk/bindings/f95/plplotf95.def =================================================================== --- trunk/bindings/f95/plplotf95.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f95/plplotf95.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -76,6 +76,7 @@ _PLPLOT_mp_PLSCMAP1LA2@24 _PLPLOT_mp_PLSCMAP1L2@20 _PLPLOT_mp_PLSTRING@16 + _PLPLOT_mp_PLSTRING3@20 _PLPLOT_mp_PLSTRIPC@104 _PLPLOT_mp_PLSVECT@12 _PLPLOT_mp_PLSYM@12 Modified: trunk/bindings/f95/plplotf95_ifort.def =================================================================== --- trunk/bindings/f95/plplotf95_ifort.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f95/plplotf95_ifort.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -78,6 +78,7 @@ PLPLOT_mp_PLSCMAP1LA2 PLPLOT_mp_PLSCMAP1L2 PLPLOTP_mp_PLSTRING + PLPLOTP_mp_PLSTRING3 PLPLOT_mp_PLSTRIPC PLPLOT_mp_PLSVECT PLPLOT_mp_PLSYM Modified: trunk/bindings/f95/plplotf95_mingw.def =================================================================== --- trunk/bindings/f95/plplotf95_mingw.def 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f95/plplotf95_mingw.def 2010-12-01 15:52:34 UTC (rev 11357) @@ -76,6 +76,7 @@ __plplot_MOD_plscmap1la2 __plplot_MOD_plscmap1l2 __plplot_MOD_plstring + __plplot_MOD_plstring3 __plplot_MOD_plstripc __plplot_MOD_plsvect __plplot_MOD_plsym Modified: trunk/bindings/f95/plstubs.h =================================================================== --- trunk/bindings/f95/plstubs.h 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f95/plstubs.h 2010-12-01 15:52:34 UTC (rev 11357) @@ -342,6 +342,7 @@ #define PLSTRANSFORM2 FNAME( PLSTRANSFORM2, plstransform2 ) #define PLSTRANSFORM3 FNAME( PLSTRANSFORM3, plstransform3 ) #define PLSTRING7 FNAME( PLSTRING7, plstring7 ) +#define PLSTRING37 FNAME( PLSTRING37, plstring37 ) #define PLSTRIPA FNAME( PLSTRIPA, plstripa ) #define PLSTRIPC FNAME( PLSTRIPCF77, plstripcf77 ) #define PLSTRIPD FNAME( PLSTRIPD, plstripd ) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/f95/scstubs.c 2010-12-01 15:52:34 UTC (rev 11357) @@ -1083,6 +1083,12 @@ } void +PLSTRING37( PLINT *n, PLFLT *x, PLFLT *y, PLFLT *z, const char *string ) +{ + c_plstring3( *n, x, y, z, string ); +} + +void PLSTRIPA( PLINT *id, PLINT *pen, PLFLT *x, PLFLT *y ) { c_plstripa( *id, *pen, *x, *y ); Modified: trunk/bindings/tcl/plapi.tpl =================================================================== --- trunk/bindings/tcl/plapi.tpl 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/bindings/tcl/plapi.tpl 2010-12-01 15:52:34 UTC (rev 11357) @@ -931,6 +931,15 @@ y PLFLT * string const char * +# Plot the same string at a series of 3D locations (x(i),y(i),z(i)) + +pltclcmd plstring3 void +n PLINT +x PLFLT * +y PLFLT * +z PLFLT * +string const char * + # Add data to the strip chart pltclcmd plstripa void Modified: trunk/scripts/comprehensive_test.sh =================================================================== --- trunk/scripts/comprehensive_test.sh 2010-11-28 22:13:16 UTC (rev 11356) +++ trunk/scripts/comprehensive_test.sh 2010-12-01 15:52:34 UTC (rev 11357) @@ -23,7 +23,7 @@ [--do_nondynamic (yes/no, defaults to yes)] [--do_static (yes/no, defaults to yes)] - The next six control which of seven kinds of tests are done for + The next six control which of seven kinds of tests are done for each kind of build. [--do_ctest (yes/no, defaults to yes)] [--do_test_noninteractive (yes/no, defaults to yes)] @@ -353,7 +353,7 @@ # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" -# This is the parent tree for the BUILD_TREE, INSTALL_TREE, +# This is the parent tree for the BUILD_TREE, INSTALL_TREE, # INSTALL_BUILD_TREE, and OUTPUT_TREE. It is disposable. PARENT_TREE="${SOURCE_TREE}/comprehensive_test_disposeable" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-12-27 07:25:58
|
Revision: 11394 http://plplot.svn.sourceforge.net/plplot/?rev=11394&view=rev Author: hezekiahcarty Date: 2010-12-27 07:25:51 +0000 (Mon, 27 Dec 2010) Log Message: ----------- Initial steps toward a plcolorbar implementation The eventual plan is to use this function to support color bars for plimage, plshades and possibly plgradient. At this point, plimage is partially supported. Support for plshades and plgradient are next on my TODO list. - The position of the color bar can be specified relative to any one of the four sides of the plot sub-page. - The length and width of the color bar are specified by the user. - An array with a high and low value can be passed, which will result in a plimage-based color bar with automatically-interpolated steps between the low and high values. - A label can be drawn on a user-specified side of the color bar - End-caps can be drawn on either end of the color bar - Two new pages have been added to example 33, illustrating some basic functionality. This requires a lot of testing, particularly the various combinations of color bar position, label positions and inclusion/exclusion of end caps. Modified Paths: -------------- trunk/examples/c/x33c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2010-12-27 05:39:23 UTC (rev 11393) +++ trunk/examples/c/x33c.c 2010-12-27 07:25:51 UTC (rev 11394) @@ -60,6 +60,100 @@ "✦" }; +void +plcolorbar_example_1() +{ + pladv( 0 ); + // Setup color palette 1 + plspal1( "cmap1_blue_red.pal", 1 ); + + PLINT n; + n = 2; + + PLFLT colors[n]; + colors[0] = 0.0; + colors[1] = 1.0; + PLFLT values[n]; + values[0] = 6.0; + values[1] = 13.0; + + PLINT opt; + opt = PL_COLORBAR_LEFT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LEFT | + PL_COLORBAR_CAP_HIGH; + + plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + "tv", "Test label - Left, High Cap", + n, colors, values ); + + opt = PL_COLORBAR_RIGHT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_RIGHT | + PL_COLORBAR_CAP_LOW; + + plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, + "tv", "Test label - Right, Low Cap", + n, colors, values ); + + opt = PL_COLORBAR_UPPER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_UPPER | + PL_COLORBAR_CAP_HIGH; + + plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + "t", "Test label - Upper, High Cap", + n, colors, values ); + + opt = PL_COLORBAR_LOWER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LOWER | + PL_COLORBAR_CAP_LOW; + + plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, + "t", "Test label - Lower, Low Cap", + n, colors, values ); +} + +void +plcolorbar_example_2() +{ + pladv( 0 ); + // Setup color palette 1 + plspal1( "cmap1_blue_yellow.pal", 1 ); + + PLINT n; + n = 2; + + PLFLT colors[n]; + colors[0] = 0.0; + colors[1] = 1.0; + PLFLT values[n]; + values[0] = 6.0; + values[1] = 13.0; + + PLINT opt; + opt = PL_COLORBAR_LEFT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LEFT | + PL_COLORBAR_CAP_LOW; + + plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + "tv", "Test label - Left, Low Cap", + n, colors, values ); + + opt = PL_COLORBAR_RIGHT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_RIGHT | + PL_COLORBAR_CAP_HIGH; + + plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, + "tv", "Test label - Right, High Cap", + n, colors, values ); + + opt = PL_COLORBAR_UPPER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_UPPER | + PL_COLORBAR_CAP_LOW; + + plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, + "t", "Test label - Upper, Low Cap", + n, colors, values ); + + opt = PL_COLORBAR_LOWER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LOWER | + PL_COLORBAR_CAP_HIGH; + + plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, + "t", "Test label - Lower, High Cap", + n, colors, values ); +} + //-------------------------------------------------------------------------- // main // @@ -602,9 +696,14 @@ NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); + // Color bar examples + plcolorbar_example_1(); + plcolorbar_example_2(); + // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) free( (void *) text[k] ); plend(); exit( 0 ); } + Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-12-27 05:39:23 UTC (rev 11393) +++ trunk/include/plplot.h 2010-12-27 07:25:51 UTC (rev 11394) @@ -633,6 +633,7 @@ #define plclear c_plclear #define plcol0 c_plcol0 #define plcol1 c_plcol1 +#define plcolorbar c_plcolorbar #define plconfigtime c_plconfigtime #define plcont c_plcont #define plcpstrm c_plcpstrm @@ -1226,6 +1227,21 @@ #define PL_LEGEND_INSIDE 4096 #define PL_LEGEND_OUTSIDE 8192 +// Flags for plcolorbar +#define PL_COLORBAR_LEFT 1 +#define PL_COLORBAR_RIGHT 2 +#define PL_COLORBAR_UPPER 4 +#define PL_COLORBAR_LOWER 8 +#define PL_COLORBAR_LABEL_LEFT 16 +#define PL_COLORBAR_LABEL_RIGHT 32 +#define PL_COLORBAR_LABEL_UPPER 64 +#define PL_COLORBAR_LABEL_LOWER 128 +#define PL_COLORBAR_IMAGE 256 +#define PL_COLORBAR_SHADE 512 +#define PL_COLORBAR_GRADIENT 1024 +#define PL_COLORBAR_CAP_LOW 2048 +#define PL_COLORBAR_CAP_HIGH 4096 + PLDLLIMPEXP void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, @@ -1242,6 +1258,11 @@ const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char **symbols ); +PLDLLIMPEXP void +c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + const char *axis_opts, const char *label, + PLINT n_colors, PLFLT *colors, PLFLT *values ); + // Sets position of the light source PLDLLIMPEXP void c_pllightsource( PLFLT x, PLFLT y, PLFLT z ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-12-27 05:39:23 UTC (rev 11393) +++ trunk/src/pllegend.c 2010-12-27 07:25:51 UTC (rev 11394) @@ -800,3 +800,431 @@ return; } +void +draw_cap( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, PLFLT color ) +{ + // Save drawing color + PLINT col0_save = plsc->icol0; + + // Save window and viewport + // Saved normalized coordinates of viewport. + PLFLT xdmin_save, xdmax_save, ydmin_save, ydmax_save; + // Saved world coordinates of viewport. + PLFLT xwmin_save, xwmax_save, ywmin_save, ywmax_save; + plgvpd( &xdmin_save, &xdmax_save, &ydmin_save, &ydmax_save ); + plgvpw( &xwmin_save, &xwmax_save, &ywmin_save, &ywmax_save ); + + // Use the entire sub-page, and make world coordinates 0.0 -> 1.0 + // This way the location and orientation of the cap can be easily + // defined by a combination of opt, x and y. + plvpor( 0.0, 1.0, 0.0, 1.0 ); + plwind( 0.0, 1.0, 0.0, 1.0 ); + + // Points for the triangle + PLFLT xs[3]; + PLFLT ys[3]; + + plcol1( color ); + + if ( opt & PL_COLORBAR_CAP_LOW ) + { + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + // Draw the cap on the bottom + if ( opt & PL_COLORBAR_LEFT ) + xs[0] = x; + else if ( opt & PL_COLORBAR_RIGHT ) + xs[0] = 1.0 - x - width; + ys[0] = y; + xs[2] = xs[0] + width; + ys[2] = ys[0]; + xs[1] = (xs[0] + xs[2]) / 2.0; + ys[1] = ys[0] - 0.05; + + plfill( 3, xs, ys ); + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + // Draw the cap on the left + xs[0] = x; + if ( opt & PL_COLORBAR_UPPER ) + ys[0] = 1.0 - y - width; + else if ( opt & PL_COLORBAR_LOWER ) + ys[0] = y; + xs[2] = xs[0]; + ys[2] = ys[0] + width; + xs[1] = xs[0] - 0.05; + ys[1] = (ys[0] + ys[2]) / 2.0; + + plfill( 3, xs, ys ); + } + } + else if ( opt & PL_COLORBAR_CAP_HIGH ) + { + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + // Draw the cap on the top + if ( opt & PL_COLORBAR_LEFT ) + xs[0] = x; + else if ( opt & PL_COLORBAR_RIGHT ) + xs[0] = 1.0 - x - width; + ys[0] = y + length; + xs[2] = xs[0] + width; + ys[2] = ys[0]; + xs[1] = (xs[0] + xs[2]) / 2.0; + ys[1] = ys[0] + 0.05; + + plfill( 3, xs, ys ); + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + // Draw the cap on the right + xs[0] = x + length; + if ( opt & PL_COLORBAR_UPPER ) + ys[0] = 1.0 - y - width; + else if ( opt & PL_COLORBAR_LOWER ) + ys[0] = y; + xs[2] = xs[0]; + ys[2] = ys[0] + width; + xs[1] = xs[0] + 0.05; + ys[1] = (ys[0] + ys[2]) / 2.0; + + plfill( 3, xs, ys ); + } + } + + // Restore the drawing color + plcol0( col0_save ); + + // Draw cap outline + plline( 3, xs, ys ); + + // Restore window and viewport + plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); + plwind( xwmin_save, xwmax_save, ywmin_save, ywmax_save ); +} + +void +c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + const char *axis_opts, const char *label, + PLINT n_colors, PLFLT *colors, PLFLT *values ) +{ + // Min and max values + // Assumes that the values array is sorted from smallest to largest + // OR from largest to smallest. + PLFLT min_value, max_value; + min_value = values[0]; + max_value = values[ n_colors - 1 ]; + + // Saved normalized coordinates of viewport. + PLFLT xdmin_save, xdmax_save, ydmin_save, ydmax_save; + // Saved world coordinates of viewport. + PLFLT xwmin_save, xwmax_save, ywmin_save, ywmax_save; + plgvpd( &xdmin_save, &xdmax_save, &ydmin_save, &ydmax_save ); + plgvpw( &xwmin_save, &xwmax_save, &ywmin_save, &ywmax_save ); + + // Active attributes to be saved and restored afterward. + PLINT col0_save = plsc->icol0; + PLFLT text_scale_save = plsc->chrht / plsc->chrdef; + // Axis tick spacing + PLFLT maj_save = plsc->majht / plsc->majdef; + PLFLT min_save = plsc->minht / plsc->mindef; + + // Position of the color bar in normalized viewport (= normalized subpage + // coordinates). + PLFLT vx_min, vx_max, vy_min, vy_max; + PLFLT wx_min, wx_max, wy_min, wy_max; + // Build the proper viewport and window dimensions + if ( opt & PL_COLORBAR_LEFT ) + { + vx_min = x; + vy_min = y; + vx_max = vx_min + width; + vy_max = vy_min + length; + wx_min = 0.0; + wy_min = min_value; + wx_max = 1.0; + wy_max = max_value; + } + else if ( opt & PL_COLORBAR_RIGHT ) + { + vx_min = 1.0 - x - width; + vy_min = y; + vx_max = vx_min + width; + vy_max = vy_min + length; + wx_min = 0.0; + wy_min = min_value; + wx_max = 1.0; + wy_max = max_value; + } + else if ( opt & PL_COLORBAR_UPPER ) + { + vx_min = x; + vy_min = 1.0 - y - width; + vx_max = vx_min + length; + vy_max = vy_min + width; + wx_min = min_value; + wy_min = 0.0; + wx_max = max_value; + wy_max = 1.0; + } + else if ( opt & PL_COLORBAR_LOWER ) + { + vx_min = x; + vy_min = y; + vx_max = vx_min + length; + vy_max = vy_min + width; + wx_min = min_value; + wy_min = 0.0; + wx_max = max_value; + wy_max = 1.0; + } + else + { + plabort( "plcolorbar: Invalid or missing side" ); + } + + // The window should take up the whole viewport + plvpor( vx_min, vx_max, vy_min, vy_max ); + plwind( wx_min, wx_max, wy_min, wy_max ); + + // The data to plot + PLFLT **color_data; + // Setting up the data for display + PLINT i, j, ni, nj, n_steps; + PLFLT step_size; + + // What kind of color bar are we making? + if ( opt & PL_COLORBAR_IMAGE ) + { + // Interpolate + // TODO: Should this be decided with an extra opt option instead of by + // counting n_colors? + if ( n_colors == 2 ) + { + // Use the same number of steps as there are steps in + // color palette 1. + // TODO: Determine a better way to specify the steps here? + n_steps = plsc->ncol1; + step_size = ( max_value - min_value ) / (PLFLT)n_steps; + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + ni = 2; + nj = n_steps; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = min_value + (PLFLT)j * step_size; + } + } + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + ni = n_steps; + nj = 2; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = min_value + (PLFLT)i * step_size; + } + } + } + else + { + plabort( "plcolorbar: Invalid side" ); + } + } + // No interpolation - use values array as-is + else + { + n_steps = n_colors; + // Use the provided values in this case. + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + ni = 2; + nj = n_steps; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = values[j]; + } + } + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + ni = n_steps; + nj = 2; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = values[i]; + } + } + } + else + { + plabort( "plcolorbar: Invalid side" ); + } + } + // Draw the color bar + plimage( color_data, ni, nj, wx_min, wx_max, wy_min, wy_max, + min_value, max_value, wx_min, wx_max, wy_min, wy_max ); + plFree2dGrid( color_data, ni, nj ); + } + else if ( opt & PL_COLORBAR_SHADE ) + { + plabort( "PL_COLORBAR_SHADE is not implemented yet" ); + } + else if ( opt & PL_COLORBAR_GRADIENT ) + { + plabort( "PL_COLORBAR_GRADIENT is not implemented yet" ); + } + + // Smaller text + plschr( 0.0, 0.75 ); + // Small ticks on the vertical axis + plsmaj( 0.0, 0.5); + plsmin( 0.0, 0.5); + + // For building axis option string + PLINT max_opts = 25; + char opt_string[max_opts]; + + // Draw the boxes, ticks and tick labels + if ( opt & PL_COLORBAR_LEFT ) + { + snprintf( opt_string, max_opts, "bcn%s", axis_opts ); + plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_RIGHT ) + { + snprintf( opt_string, max_opts, "bcm%s", axis_opts ); + plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_UPPER ) + { + snprintf( opt_string, max_opts, "bcm%s", axis_opts ); + plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_LOWER ) + { + snprintf( opt_string, max_opts, "bcn%s", axis_opts ); + plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + } + + // How far away from the axis should the label be drawn? + PLFLT label_offset; + label_offset = 0.0; + + // Draw end-caps + if ( opt & PL_COLORBAR_CAP_LOW ) + { + // Add an extra offset for the label so it does not bump in to the + // cap. + if ( ( ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) && + opt & PL_COLORBAR_LABEL_LOWER ) || + ( ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) && + opt & PL_COLORBAR_LABEL_LEFT ) ) + { + label_offset += 2.5; + } + // Draw a filled triangle (cap/arrow) at the low end of the scale + draw_cap( opt, x, y, length, width, 0.0 ); + } + else if ( opt & PL_COLORBAR_CAP_HIGH ) + { + // Add an extra offset for the label so it does not bump in to the + // cap. + if ( ( ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) && + opt & PL_COLORBAR_LABEL_UPPER ) || + ( ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) && + opt & PL_COLORBAR_LABEL_RIGHT ) ) + { + label_offset += 2.5; + } + // Draw a filled triangle (cap/arrow) at the high end of the scale + draw_cap( opt, x, y, length, width, 1.0 ); + } + + // Draw a title + char perp; + if ( opt & PL_COLORBAR_LABEL_LEFT ) + { + if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) + { + label_offset += 4.0; + perp = '\0'; + } + else + { + label_offset += 1.5; + perp = 'v'; + } + snprintf( opt_string, max_opts, "l%c", perp); + plmtex( opt_string, label_offset, 0.5, 0.5, label ); + } + else if ( opt & PL_COLORBAR_LABEL_RIGHT ) + { + if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) + { + label_offset += 4.0; + perp = '\0'; + } + else + { + label_offset += 1.5; + perp = 'v'; + } + snprintf( opt_string, max_opts, "r%c", perp); + plmtex( opt_string, label_offset, 0.5, 0.5, label ); + } + else if ( opt & PL_COLORBAR_LABEL_UPPER ) + { + if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) + { + label_offset += 1.5; + perp = 'v'; + } + else + { + label_offset += 4.0; + perp = '\0'; + } + snprintf( opt_string, max_opts, "t%c", perp); + plmtex( opt_string, label_offset, 0.5, 0.5, label ); + } + else if ( opt & PL_COLORBAR_LABEL_LOWER ) + { + if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) + { + label_offset += 1.5; + perp = 'v'; + } + else + { + label_offset += 4.0; + perp = '\0'; + } + snprintf( opt_string, max_opts, "b%c", perp ); + plmtex( opt_string, label_offset, 0.5, 0.5, label ); + } + + // Restore + plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); + plwind( xwmin_save, xwmax_save, ywmin_save, ywmax_save ); + plsmaj( 0.0, maj_save ); + plsmin( 0.0, min_save ); + plschr( 0.0, text_scale_save ); + plcol0( col0_save ); + + return; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-12-29 00:16:59
|
Revision: 11396 http://plplot.svn.sourceforge.net/plplot/?rev=11396&view=rev Author: airwin Date: 2010-12-29 00:16:53 +0000 (Wed, 29 Dec 2010) Log Message: ----------- Add typemaps corresponding to most floating-point arrays. This allows expanding the examples for the ENABLE_swig_octave case from just example 10 to examples 3, 4, 5, 6, 10. The results agree with the C counterparts except for example 4 where pllegend has not been propagated yet to octave. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2010-12-29 00:10:50 UTC (rev 11395) +++ trunk/bindings/octave/plplot_octave.i 2010-12-29 00:16:53 UTC (rev 11396) @@ -43,13 +43,76 @@ typedef unsigned int PLUNICODE; typedef PLINT PLBOOL; -/* I hate global variables but this is the best way I can think of to manage consistency - checking among function arguments. */ %{ +// I hate global variables but this is the best way I can think of +// to manage consistency checking among function arguments. static PLINT Alen = 0; static PLINT Xlen = 0, Ylen = 0; %} +%{ +// Convenience functions copied from matwrap-based approach (currently +// stored in bindings/octave/matwrap/wrap_octave.pl) to take care of the +// tricky scalar case and also adopted so that the resulting +// swig-generated source code will look similar to the matwrap-generated +// source code. + +inline int max(int a, int b) { return a >= b ? a : b; } +inline int min(int a, int b) { return a >= b ? a : b; } + +// +// Function to get the total length (rows*columns) of an octave object of +// arbitrary type. +// Arguments: +// 1) The octave object. +// +// If the object is a scalar, the array length is 1. +// +static int +_arraylen(const octave_value &o_obj) +{ + return max(o_obj.rows(),1) * max(o_obj.columns(),1); // Return the size. + // max is necessary because sometimes + // rows() or columns() return -1 or 0 for + // scalars. +} + +// +// Function to get the number of dimensions of an object. +// +static int +_n_dims(const octave_value &o_obj) +{ + if (max(o_obj.columns(),1) > 1) + return 2; + // max is necessary because sometimes + // rows() or columns() return -1 or 0 for + // scalars. + else if (max(o_obj.rows(),1) > 1) + return 1; + else + return 0; +} + +// +// Return the n'th dimension of an object. Dimension 0 is the 1st dimension. +// +static inline int +_dim(const octave_value &o_obj, int dim_idx) +{ + if (dim_idx == 0) + return max(o_obj.rows(), 0); + // max is necessary because sometimes + // rows() or columns() return -1 or 0 for + // scalars. + else if (dim_idx == 1) + return max(o_obj.columns(), 0); + else + return 1; +} + +%} + /* The following typemaps take care of marshaling values into and out of PLplot functions. The Array rules are trickly because of the need for length checking. These rules manage some global variables (above) to handle consistency checking amoung parameters. @@ -73,7 +136,9 @@ **********************************************************************************/ /* With preceding count */ -%typemap(in) (PLINT n, PLINT *Array) {} +%typemap(in) (PLINT n, PLINT *Array) { + + } %typemap(freearg) (PLINT n, PLINT *Array) {} @@ -105,57 +170,80 @@ PLFLT Arrays ******************************************************************************/ -/* with preceding count */ -%typemap(in) (PLINT n, PLFLT *Array) {} +// With preceding count and remember size to check others +%typemap(in) (PLINT n, PLFLT *Array) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + $1 = Alen = (PLINT)(_dim($input, 0)); + temp = $input.matrix_value(); + $2 = &temp(0,0); +} %typemap(freearg) (PLINT n, PLFLT *Array) {} - -/* Trailing count and check consistency with previous */ -%typemap(in) (PLFLT *ArrayCk, PLINT n) {} +// With trailing count and check consistency with previous +%typemap(in) (PLFLT *ArrayCk, PLINT n) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Alen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = (PLINT)(_dim($input, 0)); +} %typemap(freearg) (PLFLT *ArrayCk, PLINT n) {} - -/* no count, but check consistency with previous */ -%typemap(in) PLFLT *ArrayCk (int temp) {} +// No count but check consistency with previous +%typemap(in) PLFLT *ArrayCk (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Alen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); +} %typemap(freearg) PLFLT *ArrayCk {} - -/* No length but remember size to check others */ -%typemap(in) PLFLT *Array {} +// No count but remember size to check others +%typemap(in) PLFLT *Array (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + Alen = (PLINT)(_dim($input, 0)); + temp = $input.matrix_value(); + $1 = &temp(0,0); +} %typemap(freearg) (PLFLT *Array) {} - -/* with trailing count */ -%typemap(in) (PLFLT *Array, PLINT n) {} +// With trailing count but remember size to check others +%typemap(in) (PLFLT *Array, PLINT n) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = Alen = (PLINT)(_dim($input, 0)); +} %typemap(freearg) (PLFLT *Array, PLINT n) {} - -/* check consistency with X dimension of previous */ +// No X count but check consistency with previous %typemap(in) PLFLT *ArrayCkX {} %typemap(freearg) PLFLT *ArrayCkX {} - -/* check consistency with Y dimension of previous */ +// No Y count but check consistency with previous %typemap(in) PLFLT *ArrayCkY {} %typemap(freearg) PLFLT *ArrayCkY {} - -/* set X length for later consistency checking, with trailing count */ +// With trailing X count but remember X size to check others %typemap(in) (PLFLT *ArrayX, PLINT nx) {} %typemap(freearg) (PLFLT *ArrayX, PLINT nx) {} - -/* set X length for later consistency checking */ +// No X count but remember X size to check others %typemap(in) PLFLT *ArrayX {} %typemap(freearg) PLFLT *ArrayX {} - -/* Set Y length for later consistency checking, with trailing count */ +// With trailing Y count but remember Y size to check others %typemap(in) (PLFLT *ArrayY, PLINT ny) {} %typemap(freearg) (PLFLT *ArrayY, PLINT ny) {} - -/* set Y length for later consistency checking */ +// No Y count but remember Y size to check others %typemap(in) PLFLT *ArrayY {} %typemap(freearg) (PLFLT *ArrayY) {} Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2010-12-29 00:10:50 UTC (rev 11395) +++ trunk/plplot_test/test_octave.sh.in 2010-12-29 00:16:53 UTC (rev 11396) @@ -28,7 +28,9 @@ # when this script is launched from the install tree. lang="o" export lang -TOPDIR=`pwd`/.. +# Normalize to leading-slash form of drive-letter just in case that is +# essential for Windows platforms. +TOPDIR="$(pwd |sed 's?^/\(.\)/?\1:/?')"/.. echo "$TOPDIR" export LD_LIBRARY_PATH="$TOPDIR"/src:"$TOPDIR"/lib/csa:"$TOPDIR"/lib/nn @@ -72,7 +74,7 @@ failed = [] ; # Temporarily drop everything that involves arrays or returned values # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[10] ; +@swig_octave_comment@for i=[3 4 5 06 10] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-12-29 05:51:55
|
Revision: 11398 http://plplot.svn.sourceforge.net/plplot/?rev=11398&view=rev Author: airwin Date: 2010-12-29 05:51:49 +0000 (Wed, 29 Dec 2010) Log Message: ----------- Add typemaps for integer arrays and convenience functions to help out with those typemaps. This allows almost half the standard octave examples to run correctly now. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2010-12-29 00:24:34 UTC (rev 11397) +++ trunk/bindings/octave/plplot_octave.i 2010-12-29 05:51:49 UTC (rev 11398) @@ -111,6 +111,55 @@ return 1; } +// +// The following function converts an array of doubles into some other +// numeric type. Arguments: +// 1) Where to store the result. The type is determined from the type of +// this pointer. +// 2) A vector of doubles to convert. +// 3) The number of doubles. +// +template <class FLOAT> +static inline void +_cvt_double_to(FLOAT *out_arr, double *in_arr, unsigned n_el) +{ + while (n_el-- > 0) + *out_arr++ = (FLOAT)(*in_arr++); +} + +template void _cvt_double_to(int *, double *, unsigned); +template void _cvt_double_to(unsigned *, double *, unsigned); +template void _cvt_double_to(long *, double *, unsigned); +template void _cvt_double_to(unsigned long *, double *, unsigned); +template void _cvt_double_to(short *, double *, unsigned); +template void _cvt_double_to(unsigned short *, double *, unsigned); +template void _cvt_double_to(float *, double *, unsigned); + // Instantiate our templates. Octave uses + // manual template instantiation. + +// +// Convert an array of some other type into an array of doubles. Arguments: +// 1) The array of objects of other type. +// 2) The output array of doubles. +// 3) The number of elements to convert. +// +template <class FLOAT> +static inline void +_cvt_to_double(FLOAT *arr, double *d_arr, unsigned n_el) +{ + while (n_el-- > 0) + *d_arr++ = double(*arr++); +} + +template void _cvt_to_double(int *, double *, unsigned); +template void _cvt_to_double(unsigned *, double *, unsigned); +template void _cvt_to_double(long *, double *, unsigned); +template void _cvt_to_double(unsigned long *, double *, unsigned); +template void _cvt_to_double(short *, double *, unsigned); +template void _cvt_to_double(unsigned short *, double *, unsigned); +template void _cvt_to_double(float *, double *, unsigned); + // Instantiate our templates. Octave uses + // manual template instantiation. %} /* The following typemaps take care of marshaling values into and out of PLplot functions. The @@ -135,37 +184,80 @@ PLINT arrays **********************************************************************************/ -/* With preceding count */ -%typemap(in) (PLINT n, PLINT *Array) { - - } -%typemap(freearg) (PLINT n, PLINT *Array) {} +// With preceding count and remember size to check others +%typemap(in) (PLINT n, PLINT *Array) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + $1 = Alen = (PLINT)(_dim($input, 0)); + $2 = new PLINT[Alen]; + temp = $input.matrix_value(); + _cvt_double_to($2, &temp(0,0), Alen); +} +%typemap(freearg) (PLINT n, PLINT *Array) {delete [] $2;} +// With trailing count and check consistency with previous +%typemap(in) (PLINT *ArrayCk, PLINT n) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Alen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to($1, &temp(0,0), Alen); + $2 = Alen; +} +%typemap(freearg) (PLINT *ArrayCk, PLINT n) {delete [] $1;} -/* Trailing count and check consistency with previous */ -%typemap(in) (PLINT *ArrayCk, PLINT n) (int temp) {} -%typemap(freearg) (PLINT *ArrayCk, PLINT n) {} +// No count but check consistency with previous +%typemap(in) PLINT *ArrayCk (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Alen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to($1, &temp(0,0), Alen); +} +%typemap(freearg) PLINT *ArrayCk {delete [] $1;} +// No count but remember size to check others +%typemap(in) PLINT *Array (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + Alen = (PLINT)(_dim($input, 0)); + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to($1, &temp(0,0), Alen); +} +%typemap(freearg) (PLINT *Array) {delete [] $1;} -/* No count but check consistency with previous */ -%typemap(in) PLINT *ArrayCk (int temp) {} -%typemap(freearg) PLINT *ArrayCk {} +// No count but check consistency with previous +// Variation to allow argument to be one shorter than others. +%typemap(in) PLINT *ArrayCkMinus1 (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( ! (_dim($input, 0) == Alen || _dim($input, 0) == Alen-1) ) + { error("argument vector must be same length or one less"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to($1, &temp(0,0), Alen); +} +%typemap(freearg) PLINT *ArrayCkMinus1 {delete [] $1;} +// For octave there is no provision for dropping the last argument +// so this typemap is identical to the previous one. +%typemap(in) PLINT *ArrayCkMinus1Null (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( ! (_dim($input, 0) == Alen || _dim($input, 0) == Alen-1) ) + { error("argument vector must be same length or one less"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = new PLINT[Alen]; + _cvt_double_to($1, &temp(0,0), Alen); +} +%typemap(freearg) PLINT *ArrayCkMinus1Null {delete [] $1;} -/* Weird case to allow argument to be one shorter than others */ -%typemap(in) PLINT *ArrayCkMinus1 (int temp) {} -%typemap(freearg) PLINT *ArrayCkMinus1 {} -%typemap(in) PLINT *ArrayCkMinus1Null (int temp) {} -%typemap(freearg) PLINT *ArrayCkMinus1Null {} -%typemap(default) PLINT *ArrayCkMinus1Null {} - - -/* No length but remember size to check others */ -%typemap(in) PLINT *Array (int temp) {} -%typemap(freearg) (PLINT *Array) {} - - /****************************************************************************** PLFLT Arrays ******************************************************************************/ Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2010-12-29 00:24:34 UTC (rev 11397) +++ trunk/plplot_test/test_octave.sh.in 2010-12-29 05:51:49 UTC (rev 11398) @@ -72,9 +72,9 @@ #plot equivalent of x??c examples. These only required octave-2.0.x #Example 19 is not yet implemented failed = [] ; -# Temporarily drop everything that involves arrays or returned values +# Temporarily drop everything that involves 2D arrays or returned values # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[3 4 5 06 10] ; +@swig_octave_comment@for i=[3 4 5 06 07 10 12 13 18 24:27 30 ] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-12-30 02:51:46
|
Revision: 11402 http://plplot.svn.sourceforge.net/plplot/?rev=11402&view=rev Author: hezekiahcarty Date: 2010-12-30 02:51:39 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Add support for uneven steps in plshades support in plcolorbar Modified Paths: -------------- trunk/examples/c/x33c.c trunk/src/pllegend.c Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2010-12-30 01:58:51 UTC (rev 11401) +++ trunk/examples/c/x33c.c 2010-12-30 02:51:39 UTC (rev 11402) @@ -61,22 +61,19 @@ }; void -plcolorbar_example_1( PLINT bar_type, PLINT n, const char *title ) +plcolorbar_example_1( PLINT bar_type, PLINT n, PLFLT *values, const char *title ) { pladv( 0 ); // Setup color palette 1 plspal1( "cmap1_blue_red.pal", 1 ); PLFLT colors[n]; - PLFLT values[n]; int i; - PLFLT color_step, value_step; + PLFLT color_step; color_step = 1.0 / (PLFLT)(n - 1); - value_step = 8.0 / (PLFLT)(n - 1); for ( i = 0; i < n; i++ ) { colors[i] = 0.0 + color_step * (PLFLT)( i ); - values[i] = 6.0 + value_step * (PLFLT)( i ); } PLINT opt; @@ -114,22 +111,19 @@ } void -plcolorbar_example_2( PLINT bar_type, PLINT n, const char *title ) +plcolorbar_example_2( PLINT bar_type, PLINT n, PLFLT *values, const char *title ) { pladv( 0 ); // Setup color palette 1 plspal1( "cmap1_blue_yellow.pal", 1 ); PLFLT colors[n]; - PLFLT values[n]; int i; - PLFLT color_step, value_step; + PLFLT color_step; color_step = 1.0 / (PLFLT)(n - 1); - value_step = 8.0 / (PLFLT)(n - 1); for ( i = 0; i < n; i++ ) { colors[i] = 0.0 + color_step * (PLFLT)( i ); - values[i] = 6.0 + value_step * (PLFLT)( i ); } PLINT opt; @@ -709,12 +703,19 @@ max_height = MAX( max_height, legend_height ); // Color bar examples - plcolorbar_example_1( PL_COLORBAR_IMAGE, 2, "Image Color Bars" ); - plcolorbar_example_2( PL_COLORBAR_IMAGE, 2, "Image Color Bars" ); - plcolorbar_example_1( PL_COLORBAR_SHADE, 9, "Shade Color Bars" ); - plcolorbar_example_2( PL_COLORBAR_SHADE, 9, "Shade Color Bars" ); - plcolorbar_example_1( PL_COLORBAR_GRADIENT, 2, "Gradient Color Bars" ); - plcolorbar_example_2( PL_COLORBAR_GRADIENT, 2, "Gradient Color Bars" ); + PLFLT values_small[2] = { 0.0, 1.0 }; + PLFLT values_uneven[9] = { 0.0, 2.0, 2.5, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; + PLFLT values_even[9] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + plcolorbar_example_1( PL_COLORBAR_IMAGE, 2, values_small, "Image Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_IMAGE, 2, values_small, "Image Color Bars" ); + plcolorbar_example_1( PL_COLORBAR_SHADE, 9, values_uneven, + "Shade Color Bars - Uneven Steps" ); + plcolorbar_example_2( PL_COLORBAR_SHADE, 9, values_even, + "Shade Color Bars - Even Steps" ); + plcolorbar_example_1( PL_COLORBAR_GRADIENT, 2, values_small, + "Gradient Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_GRADIENT, 2, values_small, + "Gradient Color Bars" ); // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-12-30 01:58:51 UTC (rev 11401) +++ trunk/src/pllegend.c 2010-12-30 02:51:39 UTC (rev 11402) @@ -1081,10 +1081,17 @@ } else if ( opt & PL_COLORBAR_SHADE ) { + // Transform grid + PLcGrid grid; + PLFLT grid_axis[2] = { 0.0, 1.0 }; n_steps = n_colors; // Use the provided values. if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) { + grid.xg = grid_axis; + grid.yg = values; + grid.nx = 2; + grid.ny = n_steps; ni = 2; nj = n_steps; plAlloc2dGrid( &color_data, ni, nj ); @@ -1098,6 +1105,10 @@ } else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) { + grid.xg = values; + grid.yg = grid_axis; + grid.nx = n_steps; + grid.ny = 2; ni = n_steps; nj = 2; plAlloc2dGrid( &color_data, ni, nj ); @@ -1113,9 +1124,11 @@ { plabort( "plcolorbar: Invalid side" ); } + // Draw the color bar plshades( color_data, ni, nj, NULL, wx_min, wx_max, wy_min, wy_max, - values, n_colors, 0, 0, 0, plfill, TRUE, NULL, NULL ); + values, n_colors, 0, 0, 0, plfill, TRUE, + pltr1, (void *)(&grid) ); plFree2dGrid( color_data, ni, nj ); } else if ( opt & PL_COLORBAR_GRADIENT ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2010-12-30 08:35:34
|
Revision: 11404 http://plplot.svn.sourceforge.net/plplot/?rev=11404&view=rev Author: arjenmarkus Date: 2010-12-30 08:35:28 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Introduce workaround for a problem with gfortran on Windows: COMMON blocks are not exported from the DLL, despite a compiler directive. Modified Paths: -------------- trunk/bindings/f77/sfstubs.fm4 trunk/examples/f77/x09f.fm4 Modified: trunk/bindings/f77/sfstubs.fm4 =================================================================== --- trunk/bindings/f77/sfstubs.fm4 2010-12-30 08:33:24 UTC (rev 11403) +++ trunk/bindings/f77/sfstubs.fm4 2010-12-30 08:35:28 UTC (rev 11404) @@ -36,6 +36,23 @@ c c*********************************************************************** + subroutine plsettransform(trcoef) + + implicit none + real*8 trcoef(*) + + integer i +cDEC$ ATTRIBUTES DLLEXPORT :: PLPLOT + real*8 tr(6) + common /plplot/ tr + + do 100 i = 1,6 + tr(i) = trcoef(i) + 100 continue + + end + +c*********************************************************************** subroutine plsetopt(opt, optarg) implicit none Modified: trunk/examples/f77/x09f.fm4 =================================================================== --- trunk/examples/f77/x09f.fm4 2010-12-30 08:33:24 UTC (rev 11403) +++ trunk/examples/f77/x09f.fm4 2010-12-30 08:35:28 UTC (rev 11404) @@ -51,6 +51,14 @@ tr(5) = 2.d0/dble(nptsy-1) tr(6) = -1.0d0 +c +c At least one compiler (gfortran) on Windows does not +c unite the COMMON blocks in the main program and the +c shared library (DLL). The call to plsettransform +c is a workaround for this + + call plsettransform(tr) + c Calculate the data matrices. do i=1,nptsx xx = dble(i-1-(nptsx/2))/dble (nptsx/2) @@ -105,6 +113,7 @@ c Plot using 1d coordinate transform call plenv(-1.0d0, 1.0d0, -1.0d0, 1.0d0, 0, 0) call plcol0(2) + call plcon1(z,xdim,ydim,1,nptsx,1,nptsy,clevel,11, xg1, yg1) call plstyl(1,1500,1500) call plcol0(3) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2010-12-30 08:41:10
|
Revision: 11405 http://plplot.svn.sourceforge.net/plplot/?rev=11405&view=rev Author: arjenmarkus Date: 2010-12-30 08:41:03 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Implement a flexible scheme for dealing with large polygons: instead of accepting only polygons of moderate size (defined by PL_MAXPOLY) the functions involved now either use small statically defined arrays if the polygon is small enough or allocate arrays of an appropriate size that later get freed again. It should therefore no longer matter how large the polygons are. Note: not all source code has been compiled and the current tests do not involve such large polygons. The "ordinary" case, small polygons, has been tested though. Modified Paths: -------------- trunk/bindings/tk/plr.c trunk/drivers/tkwin.c trunk/drivers/xfig.c trunk/drivers/xwin.c trunk/src/plbuf.c trunk/src/plfill.c trunk/src/plgradient.c trunk/src/plot3d.c trunk/utils/plrender.c Modified: trunk/bindings/tk/plr.c =================================================================== --- trunk/bindings/tk/plr.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/bindings/tk/plr.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -323,9 +323,21 @@ static int get_ncoords( PLRDev *plr, PLFLT *x, PLFLT *y, PLINT n ) { - int i; - short xs[PL_MAXPOLY], ys[PL_MAXPOLY]; + PLINT i; + short _xs[PL_MAXPOLY], _ys[PL_MAXPOLY]; + short *xs, *ys; + if ( n > PL_MAXPOLY ) + { + xs = (short *) malloc( sizeof(short) * n ); + ys = (short *) malloc( sizeof(short) * n ); + } + else + { + xs = _xs; + ys = _ys; + } + plr_rdn( pdf_rd_2nbytes( plr->pdfs, (U_SHORT *) xs, n ) ); plr_rdn( pdf_rd_2nbytes( plr->pdfs, (U_SHORT *) ys, n ) ); @@ -334,6 +346,13 @@ x[i] = xs[i]; y[i] = ys[i]; } + + if ( n > PL_MAXPOLY ) + { + free( xs ); + free( ys ); + } + return 0; } Modified: trunk/drivers/tkwin.c =================================================================== --- trunk/drivers/tkwin.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/drivers/tkwin.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -487,13 +487,20 @@ TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; PLINT i; - XPoint pts[PL_MAXPOLY]; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; if ( dev->flags & 1 ) return; if ( npts > PL_MAXPOLY ) - plexit( "plD_polyline_tkw: Too many points in polyline\n" ); + { + pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + } + else + { + pts = _pts; + } for ( i = 0; i < npts; i++ ) { @@ -508,6 +515,11 @@ if ( dev->write_to_pixmap ) XDrawLines( tkwd->display, dev->pixmap, dev->gc, pts, npts, CoordModeOrigin ); + + if ( npts > PL_MAXPOLY ) + { + free( pts ); + } } //-------------------------------------------------------------------------- @@ -838,13 +850,19 @@ { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; - XPoint pts[PL_MAXPOLY]; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; int i; if ( pls->dev_npts > PL_MAXPOLY ) - plexit( "FillPolygonCmd: Too many points in polygon\n" ); + { + pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + } + else + { + pts = _pts; + } - for ( i = 0; i < pls->dev_npts; i++ ) { pts[i].x = (short) ( dev->xscale * pls->dev_x[i] ); @@ -878,6 +896,11 @@ XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); } #endif + + if ( pls->dev_npts > PL_MAXPOLY ) + { + free( pts ); + } } //-------------------------------------------------------------------------- Modified: trunk/drivers/xfig.c =================================================================== --- trunk/drivers/xfig.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/drivers/xfig.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -431,8 +431,6 @@ case PLESC_FILL: npts = pls->dev_npts; - if ( npts > PL_MAXPOLY ) - plexit( "FillPolygonCmd: Too many points in polygon\n" ); flushbuffer( pls ); fprintf( pls->OutFile, "2 1 0 1 %d %d 50 0 20 0.0 0 0 0 0 0 %d\n", Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/drivers/xwin.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -421,10 +421,17 @@ XwDisplay *xwd = (XwDisplay *) dev->xwd; PLINT i; - XPoint pts[PL_MAXPOLY]; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; if ( npts > PL_MAXPOLY ) - plexit( "plD_polyline_xw: Too many points in polyline\n" ); + { + pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + } + else + { + pts = _pts; + } dbug_enter( "plD_polyline_xw" ); @@ -453,6 +460,11 @@ if ( usepthreads ) pthread_mutex_unlock( &events_mutex ); #endif + + if ( npts > PL_MAXPOLY ) + { + free( pts ); + } } //-------------------------------------------------------------------------- @@ -830,11 +842,18 @@ { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; - XPoint pts[PL_MAXPOLY]; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; int i; if ( pls->dev_npts > PL_MAXPOLY ) - plexit( "FillPolygonCmd: Too many points in polygon\n" ); + { + pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + } + else + { + pts = _pts; + } CheckForEvents( pls ); @@ -871,6 +890,11 @@ XSetForeground( xwd->display, dev->gc, dev->curcolor.pixel ); } #endif + + if ( npts > PL_MAXPOLY ) + { + free( pts ); + } } //-------------------------------------------------------------------------- Modified: trunk/src/plbuf.c =================================================================== --- trunk/src/plbuf.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/src/plbuf.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -490,16 +490,40 @@ static void rdbuf_polyline( PLStream *pls ) { - short xpl[PL_MAXPOLY], ypl[PL_MAXPOLY]; + short _xpl[PL_MAXPOLY], _ypl[PL_MAXPOLY]; + short *xpl, *ypl; PLINT npts; dbug_enter( "rdbuf_polyline" ); rd_data( pls, &npts, sizeof ( PLINT ) ); + + if ( npts > PL_MAXPOLY ) { + xpl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + ypl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + + if (( xpl == NULL ) || ( ypl == NULL )) + { + plexit( "rdbuf_polyline: Insufficient memory for large polyline" ); + } + } + else + { + xpl = _xpl; + ypl = _ypl; + } + + rd_data( pls, xpl, sizeof ( short ) * npts ); rd_data( pls, ypl, sizeof ( short ) * npts ); plP_polyline( xpl, ypl, npts ); + + if ( npts > PL_MAXPOLY ) + { + free(xpl); + free(ypl); + } } //-------------------------------------------------------------------------- @@ -701,16 +725,39 @@ static void rdbuf_fill( PLStream *pls ) { - short xpl[PL_MAXPOLY], ypl[PL_MAXPOLY]; + short _xpl[PL_MAXPOLY], _ypl[PL_MAXPOLY]; + short *xpl, *ypl; PLINT npts; dbug_enter( "rdbuf_fill" ); rd_data( pls, &npts, sizeof ( PLINT ) ); + + if ( npts > PL_MAXPOLY ) { + xpl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + ypl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + + if (( xpl == NULL ) || ( ypl == NULL )) + { + plexit( "rdbuf_polyline: Insufficient memory for large polyline" ); + } + } + else + { + xpl = _xpl; + ypl = _ypl; + } + rd_data( pls, xpl, sizeof ( short ) * npts ); rd_data( pls, ypl, sizeof ( short ) * npts ); plP_fill( xpl, ypl, npts ); + + if ( npts > PL_MAXPOLY ) + { + free(xpl); + free(ypl); + } } //-------------------------------------------------------------------------- Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/src/plfill.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -130,7 +130,8 @@ void c_plfill( PLINT n, PLFLT *x, PLFLT *y ) { - PLINT xpoly[PL_MAXPOLY], ypoly[PL_MAXPOLY]; + PLINT _xpoly[PL_MAXPOLY], _ypoly[PL_MAXPOLY]; + PLINT *xpoly, *ypoly; PLINT i; PLFLT xt, yt; @@ -146,9 +147,20 @@ } if ( n > PL_MAXPOLY - 1 ) { - plwarn( "plfill: too many points in polygon" ); - n = PL_MAXPOLY; + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + + if (( xpoly == NULL ) || ( ypoly == NULL )) + { + plexit( "plfill: Insufficient memory for large polygon" ); + } } + else + { + xpoly = _xpoly; + ypoly = _ypoly; + } + for ( i = 0; i < n; i++ ) { TRANSFORM( x[i], y[i], &xt, &yt ); @@ -158,8 +170,7 @@ if ( x[0] != x[n - 1] || y[0] != y[n - 1] ) { - if ( n < PL_MAXPOLY ) - n++; + n++; TRANSFORM( x[0], y[0], &xt, &yt ); xpoly[n - 1] = plP_wcpcx( xt ); ypoly[n - 1] = plP_wcpcy( yt ); @@ -167,6 +178,12 @@ plP_plfclp( xpoly, ypoly, n, plsc->clpxmi, plsc->clpxma, plsc->clpymi, plsc->clpyma, plP_fill ); + + if ( n > PL_MAXPOLY - 1 ) + { + free(xpoly); + free(ypoly); + } } //-------------------------------------------------------------------------- @@ -181,10 +198,13 @@ void c_plfill3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z ) { - PLFLT tx[PL_MAXPOLY], ty[PL_MAXPOLY], tz[PL_MAXPOLY]; + PLFLT _tx[PL_MAXPOLY], _ty[PL_MAXPOLY], _tz[PL_MAXPOLY]; + PLFLT *tx, *ty, *tz; PLFLT *V[3]; - PLINT xpoly[PL_MAXPOLY], ypoly[PL_MAXPOLY]; + PLINT _xpoly[PL_MAXPOLY], _ypoly[PL_MAXPOLY]; + PLINT *xpoly, *ypoly; PLINT i; + PLINT npts; PLFLT xmin, xmax, ymin, ymax, zmin, zmax, zscale; if ( plsc->level < 3 ) @@ -197,11 +217,30 @@ plabort( "plfill3: Not enough points in object" ); return; } + + npts = n; if ( n > PL_MAXPOLY - 1 ) { - plwarn( "plfill3: too many points in polygon" ); - n = PL_MAXPOLY; + tx = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); + ty = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); + ty = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + + if (( tx == NULL ) || ( ty == NULL ) || ( tz == NULL ) || + ( xpoly == NULL ) || ( ypoly == NULL )) + { + plexit( "plfill3: Insufficient memory for large polygon" ); + } } + else + { + tx = _tx; + ty = _ty; + tz = _tz; + xpoly = _xpoly; + ypoly = _ypoly; + } plP_gdom( &xmin, &xmax, &ymin, &ymax ); plP_grange( &zscale, &zmin, &zmax ); @@ -213,8 +252,7 @@ } if ( tx[0] != tx[n - 1] || ty[0] != ty[n - 1] || tz[0] != tz[n - 1] ) { - if ( n < PL_MAXPOLY ) - n++; + n++; tx[n - 1] = tx[0]; ty[n - 1] = ty[0]; tz[n - 1] = tz[0]; } V[0] = tx; V[1] = ty; V[2] = tz; @@ -244,6 +282,16 @@ // plP_plfclp( xpoly, ypoly, n, plsc->clpxmi, plsc->clpxma, plsc->clpymi, plsc->clpyma, plP_fill ); + +// If the original number of points is large, then free the arrays + if ( npts > PL_MAXPOLY - 1 ) + { + free(tx); + free(ty); + free(tz); + free(xpoly); + free(ypoly); + } } //-------------------------------------------------------------------------- Modified: trunk/src/plgradient.c =================================================================== --- trunk/src/plgradient.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/src/plgradient.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -78,13 +78,15 @@ { #define NGRAD 2 int i, irot_min, irot_max; - PLINT xpoly[PL_MAXPOLY], ypoly[PL_MAXPOLY]; + PLINT _xpoly[PL_MAXPOLY], _ypoly[PL_MAXPOLY]; + PLINT *xpoly, *ypoly; PLINT xgrad[NGRAD], ygrad[NGRAD], clpxmi, clpxma, clpymi, clpyma; PLFLT dxgrad[NGRAD], dygrad[NGRAD], xrot, xrot_min, xrot_max; + PLINT npts; // Find (x1, y1) and (x2, y2) corresponding to beginning and end // of gradient vector. - double cosangle = cos( PI * angle / 180. ); + double cosangle = cos( PI * angle / 10. ); double sinangle = sin( PI * angle / 180. ); xrot = x[0] * cosangle + y[0] * sinangle; xrot_min = xrot; @@ -126,12 +128,23 @@ plsc->ygradient = ygrad; plsc->ngradient = NGRAD; - + npts = n; if ( n > PL_MAXPOLY - 1 ) { - plwarn( "plgradient: too many points in polygon" ); - n = PL_MAXPOLY; + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + + if (( xpoly == NULL ) || ( ypoly == NULL )) + { + plexit( "plgradient: Insufficient memory for large polygon" ); + } } + else + { + xpoly = _xpoly; + ypoly = _ypoly; + } + for ( i = 0; i < n; i++ ) { xpoly[i] = plP_wcpcx( x[i] ); @@ -139,8 +152,7 @@ } if ( x[0] != x[n - 1] || y[0] != y[n - 1] ) { - if ( n < PL_MAXPOLY ) - n++; + n++; xpoly[n - 1] = plP_wcpcx( x[0] ); ypoly[n - 1] = plP_wcpcy( y[0] ); } @@ -149,6 +161,13 @@ // Plot line corresponding to gradient to give visual // debugging cue. plline( NGRAD, dxgrad, dygrad ); + + // Check the original number of points + if ( npts > PL_MAXPOLY - 1 ) + { + free(xpoly); + free(ypoly); + } } } @@ -231,7 +250,8 @@ // Define NEDGE shade edges (or NEDGE-1 shade levels) // from 0. to 1. if ( ( edge = (PLFLT *) malloc( NEDGE * sizeof ( PLFLT ) ) ) == NULL ) - plexit( "plgradient_soft: Insufficient memory" ); + plexit( "plgradient_soft: Insufficient memory for large polygon" +); for ( i = 0; i < NEDGE; i++ ) edge[i] = (PLFLT) i / (PLFLT) ( NEDGE - 1 ); Modified: trunk/src/plot3d.c =================================================================== --- trunk/src/plot3d.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/src/plot3d.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -164,10 +164,32 @@ plP_clip_poly( int Ni, PLFLT *Vi[3], int axis, PLFLT dir, PLFLT offset ) { int anyout = 0; - PLFLT in[PL_MAXPOLY], T[3][PL_MAXPOLY]; + PLFLT _in[PL_MAXPOLY], _T[3][PL_MAXPOLY]; + PLFLT *in, *T[3], *TT; int No = 0; int i, j, k; + if ( Ni > PL_MAXPOLY ) + { + in = (PLFLT *) malloc( sizeof(PLFLT) * Ni ); + TT = (PLFLT *) malloc( 3 * sizeof(PLFLT) * Ni ); + + if ( in == NULL || TT == NULL ) { + plexit("plP_clip_poly: insufficient memory for large polygon"); + } + + T[0] = &TT[0]; + T[1] = &TT[Ni]; + T[2] = &TT[2*Ni]; + } + else + { + in = _in; + T[0] = &_T[0][0]; + T[1] = &_T[1][0]; + T[2] = &_T[2][0]; + } + for ( i = 0; i < Ni; i++ ) { in[i] = Vi[axis][i] * dir + offset; @@ -222,6 +244,13 @@ No++; } } + + if ( Ni > PL_MAXPOLY ) + { + free(in); + free(TT); + } + return No; } Modified: trunk/utils/plrender.c =================================================================== --- trunk/utils/plrender.c 2010-12-30 08:35:28 UTC (rev 11404) +++ trunk/utils/plrender.c 2010-12-30 08:41:03 UTC (rev 11405) @@ -833,17 +833,37 @@ static void get_ncoords( PLFLT *x, PLFLT *y, PLINT n ) { - short xs[PL_MAXPOLY], ys[PL_MAXPOLY]; PLINT i; + short _xs[PL_MAXPOLY], _ys[PL_MAXPOLY]; + short *xs, *ys; - plm_rd( pdf_rd_2nbytes( pdfs, (U_SHORT *) xs, n ) ); - plm_rd( pdf_rd_2nbytes( pdfs, (U_SHORT *) ys, n ) ); + if ( n > PL_MAXPOLY ) + { + xs = (short *) malloc( sizeof(short) * n ); + ys = (short *) malloc( sizeof(short) * n ); + } + else + { + xs = _xs; + ys = _ys; + } + plr_rdn( pdf_rd_2nbytes( pdfs, (U_SHORT *) xs, n ) ); + plr_rdn( pdf_rd_2nbytes( pdfs, (U_SHORT *) ys, n ) ); + for ( i = 0; i < n; i++ ) { x[i] = xs[i]; y[i] = ys[i]; } + + if ( n > PL_MAXPOLY ) + { + free( xs ); + free( ys ); + } + + return 0; } //-------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-12-31 23:58:56
|
Revision: 11408 http://plplot.svn.sourceforge.net/plplot/?rev=11408&view=rev Author: airwin Date: 2010-12-31 23:58:49 +0000 (Fri, 31 Dec 2010) Log Message: ----------- Make traditional plplot_stub command available for firing up PLplot from octave for the new swig-generated octave bindings. Modified Paths: -------------- trunk/bindings/octave/CMakeLists.txt trunk/bindings/octave/plplot_stub_hand_crafted.m trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/CMakeLists.txt =================================================================== --- trunk/bindings/octave/CMakeLists.txt 2010-12-31 22:06:42 UTC (rev 11407) +++ trunk/bindings/octave/CMakeLists.txt 2010-12-31 23:58:49 UTC (rev 11408) @@ -122,6 +122,23 @@ # Build octave interface. if(ENABLE_swig_octave) + + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/plplot_stub_hand_crafted.m + ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/plplot_stub_hand_crafted.m + ) + + add_custom_target( + plplot_stub.m_built ALL + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m + ) + set(octave_interface_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib/qsastime @@ -153,6 +170,10 @@ "${OCTINTERP_LIBRARIES}" ) + # Make sure plplot_stub.m is copied to build tree before plplot_octave + # is created so can use plplot_octave in normal way. + add_dependencies(plplot_octave plplot_stub.m_built) + else(ENABLE_swig_octave) set(octave_interface_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/include @@ -234,19 +255,19 @@ # don't interfere with each other. add_dependencies(plplot_stub.m_built make_documentation) - # Need access elsewhere (examples/octave) to the file depends of - # this custom target. - set_property(GLOBAL PROPERTY - FILES_plplot_stub.m_built - ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m - ) + endif(ENABLE_swig_octave) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m - DESTINATION ${PLPLOT_OCTAVE_DIR} - ) + # Need access elsewhere (examples/octave) to the file depends of + # this custom target. + set_property(GLOBAL PROPERTY + FILES_plplot_stub.m_built + ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m + ) - endif(ENABLE_swig_octave) + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/plplot_stub.m + DESTINATION ${PLPLOT_OCTAVE_DIR} + ) if(USE_RPATH) get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) Modified: trunk/bindings/octave/plplot_stub_hand_crafted.m =================================================================== --- trunk/bindings/octave/plplot_stub_hand_crafted.m 2010-12-31 22:06:42 UTC (rev 11407) +++ trunk/bindings/octave/plplot_stub_hand_crafted.m 2010-12-31 23:58:49 UTC (rev 11408) @@ -1,559 +1,4 @@ -# Hand-crafted file to drop plplot_octave name space. -# The first approximation to this file was obtained from the -# the matwrap-generated plplot_stub.m as follows: -# egrep "(^function|^endfunction|^ plplot_octave| = plplot_octave)" ../temp_traditional_bindings_octave/plplot_stub.m >|bindings/octave/plplot_stub_hand_crafted.m -# Further editing done under emacs with a keyboard macro to -# replace numerical calls to plplot_octave with namespace ones. -# Returned functions not transformed yet. +# Hand-crafted file to set up running swig-generated octave bindings for +# PLplot. So far it is extremely simple; -1; - -function pl_setcontlabelformat(lexp, sigdig) - plplot_octave.pl_setcontlabelformat(lexp, sigdig); -endfunction -function pl_setcontlabelparam(offset, size, spacing, active) - plplot_octave.pl_setcontlabelparam(offset, size, spacing, active); -endfunction -function pladv(page) - plplot_octave.pladv(page); -endfunction -function plarc(x, y, a, b, angle1, angle2, fill) - plplot_octave.plarc(x, y, a, b, angle1, angle2, fill); -endfunction -function plaxes(x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub) - plplot_octave.plaxes(x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub); -endfunction -function plbin(x, y, center) - plplot_octave.plbin(x, y, center); -endfunction -function plbop() - plplot_octave.plbop(); -endfunction -function plbox(xopt, xtick, nxsub, yopt, ytick, nysub) - plplot_octave.plbox(xopt, xtick, nxsub, yopt, ytick, nysub); -endfunction -function plbox3(xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby, zopt, zlabel, ztick, nsubz) - plplot_octave.plbox3(xopt, xlabel, xtick, nsubx, yopt, ylabel, ytick, nsuby, zopt, zlabel, ztick, nsubz); -endfunction -function [year, month, day, hour, min, sec] = plbtime(ctime) - [year, month, day, hour, min, sec] = plplot_octave(9, ctime); -endfunction -function [wx, wy, window] = plcalc_world(rx, ry) - [wx, wy, window] = plplot_octave(10, rx, ry); -endfunction -function plclear() - plplot_octave.plclear(); -endfunction -function plcol0(icol0) - plplot_octave.plcol0(icol0); -endfunction -function plcol1(col1) - plplot_octave.plcol1(col1); -endfunction -function plconfigtime(scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day, hour, min, sec) - plplot_octave.plconfigtime(scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day, hour, min, sec); -endfunction -function plcpstrm(iplsr, flags) - plplot_octave.plcpstrm(iplsr, flags); -endfunction -function ctime = plctime(year, month, day, hour, min, sec) - ctime = plplot_octave(16, year, month, day, hour, min, sec); -endfunction -function plend() -plplot_octave.plgra(); -endfunction -function plend1() - plplot_octave.plend1(); -endfunction -function plenv(xmin, xmax, ymin, ymax, just, axis) - plplot_octave.plenv(xmin, xmax, ymin, ymax, just, axis); -endfunction -function plenv0(xmin, xmax, ymin, ymax, just, axis) - plplot_octave.plenv0(xmin, xmax, ymin, ymax, just, axis); -endfunction -function pleop() - plplot_octave.pleop(); -endfunction -function plerrx(xmin, xmax, y) - plplot_octave.plerrx(xmin, xmax, y); -endfunction -function plerry(x, ymin, ymax) - plplot_octave.plerry(x, ymin, ymax); -endfunction -function plfamadv() - plplot_octave.plfamadv(); -endfunction -function plfill(x, y) - plplot_octave.plfill(x, y); -endfunction -function plfill3(x, y, z) - plplot_octave.plfill3(x, y, z); -endfunction -function plflush() - plplot_octave.plflush(); -endfunction -function plfont(ifont) - plplot_octave.plfont(ifont); -endfunction -function plfontld(fnt) - plplot_octave.plfontld(fnt); -endfunction -function [p_def, p_ht] = plgchr() - [p_def, p_ht] = plplot_octave(30); -endfunction -function [r, g, b] = plgcol0(icol0) - [r, g, b] = plplot_octave(31, icol0); -endfunction -function [r, g, b, a] = plgcol0a(icol0) - [r, g, b, a] = plplot_octave(32, icol0); -endfunction -function [r, g, b] = plgcolbg() - [r, g, b] = plplot_octave(33); -endfunction -function [r, g, b, a] = plgcolbga() - [r, g, b, a] = plplot_octave(34); -endfunction -function compression = plgcompression() - compression = plplot_octave(35); -endfunction -function p_dev = plgdev() - p_dev = plplot_octave(36); -endfunction -function [p_mar, p_aspect, p_jx, p_jy] = plgdidev() - [p_mar, p_aspect, p_jx, p_jy] = plplot_octave(37); -endfunction -function p_rot = plgdiori() - p_rot = plplot_octave(38); -endfunction -function [p_xmin, p_ymin, p_xmax, p_ymax] = plgdiplt() - [p_xmin, p_ymin, p_xmax, p_ymax] = plplot_octave(39); -endfunction -function [p_fam, p_num, p_bmax] = plgfam() - [p_fam, p_num, p_bmax] = plplot_octave(40); -endfunction -function pfci = plgfci() - pfci = plplot_octave(41); -endfunction -function fnam = plgfnam() - fnam = plplot_octave(42); -endfunction -function [p_family, p_style, p_weight] = plgfont() - [p_family, p_style, p_weight] = plplot_octave(43); -endfunction -function p_level = plglevel() - p_level = plplot_octave(44); -endfunction -function [p_xp, p_yp, p_xleng, p_yleng, p_xoff, p_yoff] = plgpage() - [p_xp, p_yp, p_xleng, p_yleng, p_xoff, p_yoff] = plplot_octave(45); -endfunction -function plgra() -plplot_octave.plgra(); -endfunction -function plgradient(x, y, angle) - plplot_octave.plgradient(x, y, angle); -endfunction -function [xmin, xmax, ymin, ymax] = plgspa() - [xmin, xmax, ymin, ymax] = plplot_octave(48); -endfunction -function p_strm = plgstrm() - p_strm = plplot_octave(49); -endfunction -function p_ver = plgver() - p_ver = plplot_octave(50); -endfunction -function [p_xmin, p_xmax, p_ymin, p_ymax] = plgvpd() - [p_xmin, p_xmax, p_ymin, p_ymax] = plplot_octave(51); -endfunction -function [p_xmin, p_xmax, p_ymin, p_ymax] = plgvpw() - [p_xmin, p_xmax, p_ymin, p_ymax] = plplot_octave(52); -endfunction -function [p_digmax, p_digits] = plgxax() - [p_digmax, p_digits] = plplot_octave(53); -endfunction -function [p_digmax, p_digits] = plgyax() - [p_digmax, p_digits] = plplot_octave(54); -endfunction -function [p_digmax, p_digits] = plgzax() - [p_digmax, p_digits] = plplot_octave(55); -endfunction -function plhist(data, datmin, datmax, nbin, oldwin) - plplot_octave.plhist(data, datmin, datmax, nbin, oldwin); -endfunction -function plhls(h, l, s) - plplot_octave.plhls(h, l, s); -endfunction -function [p_r, p_g, p_b] = plhlsrgb(h, l, s) - [p_r, p_g, p_b] = plplot_octave(58, h, l, s); -endfunction -function plinit() - plplot_octave.plinit(); -endfunction -function pljoin(x1, y1, x2, y2) - plplot_octave.pljoin(x1, y1, x2, y2); -endfunction -function pllab(xlabel, ylabel, tlabel) - plplot_octave.pllab(xlabel, ylabel, tlabel); -endfunction -function pllightsource(x, y, z) - plplot_octave.pllightsource(x, y, z); -endfunction -function plline(x, y) - plplot_octave.plline(x, y); -endfunction -function plline3(x, y, z) - plplot_octave.plline3(x, y, z); -endfunction -function pllsty(lin) - plplot_octave.pllsty(lin); -endfunction -function p_strm = plmkstrm() - p_strm = plplot_octave(66); -endfunction -function plmtex(side, disp, pos, just, text) - plplot_octave. pend(); -endfunction -function plmtex3(side, disp, pos, just, text) - plplot_octave.plmtex3(side, disp, pos, just, text); -endfunction -function retval = c_plparseopts(p_argc, argv, mode) - retval = plplot_octave(69, p_argc, argv, mode); -endfunction -function plpat(inc, del) - plplot_octave.plpat(inc, del); -endfunction -function plpoin(x, y, code) - plplot_octave.plpoin(x, y, code); -endfunction -function plpoin3(x, y, z, code) - plplot_octave.plpoin3(x, y, z, code); -endfunction -function plprec(setp, prec) - plplot_octave.plprec(setp, prec); -endfunction -function plpsty(patt) - plplot_octave.plpsty(patt); -endfunction -function plptex(x, y, dx, dy, just, text) - plplot_octave.plptex(x, y, dx, dy, just, text); -endfunction -function plptex3(wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text) - plplot_octave.plptex3(wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text); -endfunction -function retval = plrandd() - retval = plplot_octave(77); -endfunction -function plreplot() - plplot_octave.plreplot(); -endfunction -function plrgb(r, g, b) - plplot_octave.plrgb(r, g, b); -endfunction -function plrgb1(r, g, b) - plplot_octave.plrgb1(r, g, b); -endfunction -function [p_h, p_l, p_s] = plrgbhls(r, g, b) - [p_h, p_l, p_s] = plplot_octave(81, r, g, b); -endfunction -function plschr(def, scale) - plplot_octave.plschr(def, scale); -endfunction -function plscmap0(r, g, b) - plplot_octave.plscmap0(r, g, b); -endfunction -function plscmap0a(r, g, b, a) - plplot_octave.plscmap0a(r, g, b, a); -endfunction -function plscmap0n(ncol0) - plplot_octave.plscmap0n(ncol0); -endfunction -function plscmap1(r, g, b) - plplot_octave.plscmap1(r, g, b); -endfunction -function plscmap1a(r, g, b, a) - plplot_octave.plscmap1a(r, g, b, a); -endfunction -function plscmap1l(itype, intensity, coord1, coord2, coord3, rev) - plplot_octave.plscmap1l(itype, intensity, coord1, coord2, coord3, rev); -endfunction -function plscmap1la(itype, intensity, coord1, coord2, coord3, a, rev) - plplot_octave.plscmap1la(itype, intensity, coord1, coord2, coord3, a, rev); -endfunction -function plscmap1n(ncol1) - plplot_octave.plscmap1n(ncol1); -endfunction -function plscol0(icol0, r, g, b) - plplot_octave.plscol0(icol0, r, g, b); -endfunction -function plscol0a(icol0, r, g, b, a) - plplot_octave.plscol0a(icol0, r, g, b, a); -endfunction -function plscolbg(r, g, b) - plplot_octave.plscolbg(r, g, b); -endfunction -function plscolbga(r, g, b, a) - plplot_octave.plscolbga(r, g, b, a); -endfunction -function plscolor(color) - plplot_octave.plscolor(color); -endfunction -function plscompression(compression) - plplot_octave.plscompression(compression); -endfunction -function plsdev(devname) - plplot_octave.plsdev(devname); -endfunction -function plsdidev(mar, aspect, jx, jy) - plplot_octave.plsdidev(mar, aspect, jx, jy); -endfunction -function plsdimap(dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm) - plplot_octave.plsdimap(dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm); -endfunction -function plsdiori(rot) - plplot_octave.plsdiori(rot); -endfunction -function plsdiplt(xmin, ymin, xmax, ymax) - plplot_octave.plsdiplt(xmin, ymin, xmax, ymax); -endfunction -function plsdiplz(xmin, ymin, xmax, ymax) - plplot_octave.plsdiplz(xmin, ymin, xmax, ymax); -endfunction -function plseed(s) - plplot_octave.plseed(s); -endfunction -function plsesc(esc) - plplot_octave.plsesc(esc); -endfunction -function plsfam(fam, num, bmax) - plplot_octave.plsfam(fam, num, bmax); -endfunction -function plsfci(fci) - plplot_octave.plsfci(fci); -endfunction -function plsfnam(fnam) - plplot_octave.plsfnam(fnam); -endfunction -function plsfont(family, style, weight) - plplot_octave.plsfont(family, style, weight); -endfunction -function plsmaj(def, scale) - plplot_octave.plsmaj(def, scale); -endfunction -function plsmin(def, scale) - plplot_octave.plsmin(def, scale); -endfunction -function plsori(ori) - plplot_octave.plsori(ori); -endfunction -function plspage(xp, yp, xleng, yleng, xoff, yoff) - plplot_octave.plspage(xp, yp, xleng, yleng, xoff, yoff); -endfunction -function plspal0(filename) - plplot_octave.plspal0(filename); -endfunction -function plspal1(filename, interpolate) - plplot_octave.plspal1(filename, interpolate); -endfunction -function plspause(pause) - plplot_octave.plspause(pause); -endfunction -function plsstrm(strm) - plplot_octave.plsstrm(strm); -endfunction -function plssub(nx, ny) - plplot_octave.plssub(nx, ny); -endfunction -function plssym(def, scale) - plplot_octave.plssym(def, scale); -endfunction -function plstar(nx, ny) - plplot_octave.plstar(nx, ny); -endfunction -function plstart(devname, nx, ny) - plplot_octave.plstart(devname, nx, ny); -endfunction -function plstripa(id, pen, x, y) - plplot_octave.plstripa(id, pen, x, y); -endfunction -function plstripd(id) - plplot_octave.plstripd(id); -endfunction -function plstyl(mark, space) - plplot_octave.plstyl(mark, space); -endfunction -function plsvect(arrowx, arrowy, fill) - plplot_octave.plsvect(arrowx, arrowy, fill); -endfunction -function plsvpa(xmin, xmax, ymin, ymax) - plplot_octave.plsvpa(xmin, xmax, ymin, ymax); -endfunction -function plsxax(digmax, digits) - plplot_octave.plsxax(digmax, digits); -endfunction -function plsyax(digmax, digits) - plplot_octave.plsyax(digmax, digits); -endfunction -function plsym(x, y, code) - plplot_octave.plsym(x, y, code); -endfunction -function plszax(digmax, digits) - plplot_octave.plszax(digmax, digits); -endfunction -function pltext() - plplot_octave.pltext(); -endfunction -function pltimefmt(fmt) - plplot_octave.pltimefmt(fmt); -endfunction -function plvasp(aspect) - plplot_octave.plvasp(aspect); -endfunction -function plvpas(xmin, xmax, ymin, ymax, aspect) - plplot_octave.plvpas(xmin, xmax, ymin, ymax, aspect); -endfunction -function plvpor(xmin, xmax, ymin, ymax) - plplot_octave.plvpor(xmin, xmax, ymin, ymax); -endfunction -function plvsta() - plplot_octave.plvsta(); -endfunction -function plw3d(basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az) - plplot_octave.plw3d(basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az); -endfunction -function plwid(width) - plplot_octave.plwid(width); -endfunction -function plwind(xmin, xmax, ymin, ymax) - plplot_octave.plwind(xmin, xmax, ymin, ymax); -endfunction -function status = plxormod(mode) - status = plplot_octave(139, mode); -endfunction -function [retval, state, keysym, button, string, pX, pY, dX, dY, wX, wY, subwin] = plGetCursor() - [retval, state, keysym, button, string, pX, pY, dX, dY, wX, wY, subwin] = plplot_octave(140); -endfunction -function [retval, x, y] = plTranslateCursor(x_in, y_in) - [retval, x, y] = plplot_octave(141, x_in, y_in); -endfunction -function plcol(icol0) - plplot_octave.plcol(icol0); -endfunction -function plcont(f, kx, lx, ky, ly, clevel, tr) - plplot_octave.plcont(f, kx, lx, ky, ly, clevel, tr); -endfunction -function plcont0(f, kx, lx, ky, ly, clevel) - plplot_octave.plcont0(f, kx, lx, ky, ly, clevel); -endfunction -function plcont1(f, kx, lx, ky, ly, clevel, xg, yg) - plplot_octave.plcont1(f, kx, lx, ky, ly, clevel, xg, yg); -endfunction -function plcont2(f, kx, lx, ky, ly, clevel, xg, yg) - plplot_octave.plcont2(f, kx, lx, ky, ly, clevel, xg, yg); -endfunction -function plcont2p(f, kx, lx, ky, ly, clevel, xg, yg) - plplot_octave.plcont2p(f, kx, lx, ky, ly, clevel, xg, yg); -endfunction -function zg = plgriddata(x, y, z, xg, yg, type, data) - zg = plplot_octave(148, x, y, z, xg, yg, type, data); -endfunction -function pplimage(a, xmin, xmax, ymin, ymax, zmin, zmax, dxmin, dxmax, dymin, dymax) - plplot_octave.pplimage(a, xmin, xmax, ymin, ymax, zmin, zmax, dxmin, dxmax, dymin, dymax); -endfunction -function plimagefr(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax) - plplot_octave.plimagefr(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax); -endfunction -function plimagefr1(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg) - plplot_octave.plimagefr1(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg); -endfunction -function plimagefr2(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg) - plplot_octave.plimagefr2(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xg, yg); -endfunction -function plimagefrx(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, tr) - plplot_octave.plimagefrx(a, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, tr); -endfunction -function plmesh(x, y, z, opt) - plplot_octave.plmesh(x, y, z, opt); -endfunction -function plmeshc(x, y, z, opt, clevel) - plplot_octave.plmeshc(x, y, z, opt, clevel); -endfunction -function plot3d(x, y, z, opt, side) - plplot_octave.plot3d(x, y, z, opt, side); -endfunction -function plot3dc(x, y, z, opt, clevel) - plplot_octave.plot3dc(x, y, z, opt, clevel); -endfunction -function plpoly3(x, y, z, draw, clockwise) - plplot_octave.plpoly3(x, y, z, draw, clockwise); -endfunction -function plshade(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, tr) - plplot_octave.plshade(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, tr); -endfunction -function plshade1(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, xg, yg) - plplot_octave.plshade1(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, xg, yg); -endfunction -function plshade2(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, xg, yg) - plplot_octave.plshade2(a, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, rectangular, xg, yg); -endfunction -function plshades(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular) - plplot_octave.plshades(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular); -endfunction -function plshades1(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, xg, yg) - plplot_octave.plshades1(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, xg, yg); -endfunction -function plshades2(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, xg, yg) - plplot_octave.plshades2(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, xg, yg); -endfunction -function plshadesx(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, tr) - plplot_octave.plshadesx(a, left, right, bottom, top, clevel, fill_width, cont_color, cont_width, rectangular, tr); -endfunction -function id = plstripc(xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, styline, legline1, legline2, legline3, legline4, labx, laby, labtop) - id = plplot_octave(166, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, styline, legline1, legline2, legline3, legline4, labx, laby, labtop); -endfunction -function plsurf3d(x, y, z, opt, clevel) - plplot_octave.plsurf3d(x, y, z, opt, clevel); -endfunction -function plvect(u, v, scale, tr) - plplot_octave.plvect(u, v, scale, tr); -endfunction -function plvect1(u, v, scale, xg, yg) - plplot_octave.plvect1(u, v, scale, xg, yg); -endfunction -function plvect2(u, v, scale, xg, yg) - plplot_octave.plvect2(u, v, scale, xg, yg); -endfunction -function plClearOpts() - plplot_octave.plClearOpts(); -endfunction -function retval = plGetFlt(s) - retval = plplot_octave(172, s); -endfunction -function retval = plGetInt(s) - retval = plplot_octave(173, s); -endfunction -function plOptUsage() - plplot_octave.plOptUsage(); -endfunction -function plResetOpts() - plplot_octave.plResetOpts(); -endfunction -function retval = plSetOpt(opt, optarg) - retval = plplot_octave(176, opt, optarg); -endfunction -function plSetUsage(program_string, usage_string) - plplot_octave.plSetUsage(program_string, usage_string); -endfunction -function plarrows(u, v, x, y, scale, dx, dy) - plplot_octave.plarrows(u, v, x, y, scale, dx, dy); -endfunction -function pldid2pc(xmin, ymin, xmax, ymax) - plplot_octave.pldid2pc(xmin, ymin, xmax, ymax); -endfunction -function pldip2dc(xmin, ymin, xmax, ymax) - plplot_octave.pldip2dc(xmin, ymin, xmax, ymax); -endfunction -function plsError(errcode, errmsg) - plplot_octave.plsError(errcode, errmsg); -endfunction -function plsxwin(window_id) - plplot_octave.plsxwin(window_id); -endfunction +plplot_octave; Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2010-12-31 22:06:42 UTC (rev 11407) +++ trunk/plplot_test/test_octave.sh.in 2010-12-31 23:58:49 UTC (rev 11408) @@ -44,8 +44,7 @@ verbose_test = 0; endif -@swig_octave_comment@plplot_octave; -@matwrap_octave_comment@plplot_stub; +plplot_stub; t = split("$options", "-"); if (t); t(1,:)=""; endif; for i=1:rows(t) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2011-01-01 00:26:42
|
Revision: 11409 http://plplot.svn.sourceforge.net/plplot/?rev=11409&view=rev Author: hezekiahcarty Date: 2011-01-01 00:26:35 +0000 (Sat, 01 Jan 2011) Log Message: ----------- plstring, plstring3, plcolorbar, pllegend for OCaml The OCaml examples should all match their C counterparts now, with the exception of example 33 which has not been propagated to OCaml yet. Modified Paths: -------------- trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/bindings/ocaml/plplot_impl.c trunk/bindings/ocaml/touchup.ml trunk/examples/ocaml/x04.ml trunk/examples/ocaml/x18.ml trunk/examples/ocaml/x26.ml Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot.mli 2011-01-01 00:26:35 UTC (rev 11409) @@ -29,14 +29,6 @@ | PL_Y_AXIS | PL_Z_AXIS -type plplot_legend_option_type = - PL_LEGEND_NONE - | PL_LEGEND_COLOR_BOX - | PL_LEGEND_LINE - | PL_LEGEND_SYMBOL - | PL_LEGEND_TEXT_LEFT - | PL_LEGEND_BACKGROUND - (** {3 A higher-level OCaml interface to PLplot} *) module Plot : sig @@ -557,6 +549,37 @@ | PL_VIEWPORT_DEFINED | PL_WORLD_COORDINATES_DEFINED and plplot_run_level = plplot_run_level_enum +and plplot_legend_enum = + PL_LEGEND_NONE + | PL_LEGEND_COLOR_BOX + | PL_LEGEND_LINE + | PL_LEGEND_SYMBOL + | PL_LEGEND_TEXT_LEFT + | PL_LEGEND_BACKGROUND + | PL_LEGEND_BOUNDING_BOX + | PL_LEGEND_ROW_MAJOR + | PL_LEGEND_LEFT + | PL_LEGEND_RIGHT + | PL_LEGEND_UPPER + | PL_LEGEND_LOWER + | PL_LEGEND_INSIDE + | PL_LEGEND_OUTSIDE +and plplot_legend_opt = plplot_legend_enum list +and plplot_colorbar_enum = + | PL_COLORBAR_LEFT + | PL_COLORBAR_RIGHT + | PL_COLORBAR_UPPER + | PL_COLORBAR_LOWER + | PL_COLORBAR_LABEL_LEFT + | PL_COLORBAR_LABEL_RIGHT + | PL_COLORBAR_LABEL_UPPER + | PL_COLORBAR_LABEL_LOWER + | PL_COLORBAR_IMAGE + | PL_COLORBAR_SHADE + | PL_COLORBAR_GRADIENT + | PL_COLORBAR_CAP_LOW + | PL_COLORBAR_CAP_HIGH +and plplot_colorbar_opt = plplot_colorbar_enum list external pl_setcontlabelformat : int -> int -> unit = "camlidl_plplot_core_c_pl_setcontlabelformat" external pl_setcontlabelparam : float -> float -> float -> int -> unit @@ -663,11 +686,15 @@ = "camlidl_plplot_core_c_pljoin" external pllab : string -> string -> string -> unit = "camlidl_plplot_core_c_pllab" -external pllegend : plplot_legend_option_type list -> float -> float -> - float -> int -> plplot_legend_option_type list array -> float -> float -> +external plcolorbar : plplot_colorbar_opt -> float -> float -> float -> + float -> string -> string -> float array -> float array -> unit + = "camlidl_plplot_core_c_plcolorbar_bytecode" "camlidl_plplot_core_c_plcolorbar" +external pllegend : plplot_legend_opt -> float -> float -> + float -> int -> int -> int -> int -> int -> + plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> - float array -> int array -> int array -> unit + int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend" external pllightsource : float -> float -> float -> unit = "camlidl_plplot_core_c_pllightsource" @@ -788,6 +815,10 @@ external plstar : int -> int -> unit = "camlidl_plplot_core_c_plstar" external plstart : string -> int -> int -> unit = "camlidl_plplot_core_c_plstart" +external plstring : float array -> float array -> string -> unit + = "camlidl_plplot_core_c_plstring" +external plstring3 : float array -> float array -> float array -> string -> unit + = "camlidl_plplot_core_c_plstring3" external plstripa : int -> int -> float -> float -> unit = "camlidl_plplot_core_c_plstripa" external plstripd : int -> unit = "camlidl_plplot_core_c_plstripd" Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_core.idl 2011-01-01 00:26:35 UTC (rev 11409) @@ -58,6 +58,41 @@ }; typedef enum plplot_run_level_enum plplot_run_level; +enum plplot_legend_enum { + PL_LEGEND_NONE = 1, + PL_LEGEND_COLOR_BOX = 2, + PL_LEGEND_LINE = 4, + PL_LEGEND_SYMBOL = 8, + PL_LEGEND_TEXT_LEFT = 16, + PL_LEGEND_BACKGROUND = 32, + PL_LEGEND_BOUNDING_BOX = 64, + PL_LEGEND_ROW_MAJOR = 128, + PL_LEGEND_LEFT = 256, + PL_LEGEND_RIGHT = 512, + PL_LEGEND_UPPER = 1024, + PL_LEGEND_LOWER = 2048, + PL_LEGEND_INSIDE = 4096, + PL_LEGEND_OUTSIDE = 8192, +}; +typedef [set] enum plplot_legend_enum plplot_legend_opt; + +enum plplot_colorbar_enum { + PL_COLORBAR_LEFT = 1, + PL_COLORBAR_RIGHT = 2, + PL_COLORBAR_UPPER = 4, + PL_COLORBAR_LOWER = 8, + PL_COLORBAR_LABEL_LEFT = 16, + PL_COLORBAR_LABEL_RIGHT = 32, + PL_COLORBAR_LABEL_UPPER = 64, + PL_COLORBAR_LABEL_LOWER = 128, + PL_COLORBAR_IMAGE = 256, + PL_COLORBAR_SHADE = 512, + PL_COLORBAR_GRADIENT = 1024, + PL_COLORBAR_CAP_LOW = 2048, + PL_COLORBAR_CAP_HIGH = 4096, +}; +typedef [set] enum plplot_colorbar_enum plplot_colorbar_opt; + // Any function which has a nonzero_error_int return type will raise // an Invalid_argument error if the return value is <> 0. typedef [errorcheck(plplot_check_nonzero_result), errorcode] int nonzero_error_int; @@ -212,15 +247,6 @@ PL_Y_AXIS | \ PL_Z_AXIS"); -// Hand-translated PL_LEGEND_* flags for use with pllegend -quote(mlmli, "type plplot_legend_option_type = \ - PL_LEGEND_NONE | \ - PL_LEGEND_COLOR_BOX | \ - PL_LEGEND_LINE | \ - PL_LEGEND_SYMBOL | \ - PL_LEGEND_TEXT_LEFT | \ - PL_LEGEND_BACKGROUND"); - // Custom axis labeling quote(ml, "external ml_plslabelfunc : unit -> unit = \"ml_plslabelfunc\""); quote(ml, @@ -262,5 +288,5 @@ RAW_ML(external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata") RAW_ML(external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts") -RAW_ML(external pllegend : plplot_legend_option_type list -> float -> float -> float -> int -> plplot_legend_option_type list array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> float array -> int array -> int array -> unit = "ml_pllegend_byte" "ml_pllegend") +RAW_ML(external pllegend : plplot_legend_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend") Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_h 2011-01-01 00:26:35 UTC (rev 11409) @@ -190,6 +190,11 @@ c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data); + + void +plfgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, + PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, + PLF2OPS zops, PLPointer zgp, PLINT type, PLFLT data ); */ void @@ -234,17 +239,28 @@ /* void -c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, - PLINT nlegend, PLINT *opt_array, +c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, + plplot_legend_opt opt, PLFLT x, PLFLT y, PLFLT plot_width, + PLINT bg_color, PLINT bb_color, PLINT bb_style, + PLINT nrow, PLINT ncolumn, + PLINT nlegend, const plplot_legend_opt *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLFLT text_justification, PLINT *text_colors, char **text, - PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, - PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_colors, PLFLT *symbol_scales, - PLINT *symbol_numbers, PLINT *symbols ); + PLFLT text_justification, + const PLINT *text_colors, const char **text, + const PLINT *box_colors, const PLINT *box_patterns, + const PLFLT *box_scales, const PLINT *box_line_widths, + const PLINT *line_colors, const PLINT *line_styles, + const PLINT *line_widths, + const PLINT *symbol_colors, const PLFLT *symbol_scales, + const PLINT *symbol_numbers, const char **symbols ); */ void +c_plcolorbar( plplot_colorbar_opt opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + const char *axis_opts, const char *label, + PLINT n_colors, PLFLT *colors, PLFLT *values ); + + void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); void @@ -274,7 +290,13 @@ c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLFLT *clevel, PLINT nlevel); +/* void +plfmeshc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); +*/ + + void c_plmkstrm(PLINT *p_strm); void @@ -289,17 +311,33 @@ c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLBOOL side); +/* void +plfplot3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); +*/ + + void c_plot3dc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLFLT *clevel, PLINT nlevel); /* void +plfplot3dc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + + void c_plot3dcl(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax); + + void +plfplot3dcl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); */ void @@ -458,6 +496,16 @@ PLPointer pltr_data); void +plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + + void plfshade(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), PLPointer f2eval_data, PLFLT (*c2eval) (PLINT, PLINT, PLPointer), @@ -473,6 +521,18 @@ PLPointer pltr_data); void +plfshade1( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + + void c_plslabelfunc(void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer), PLPointer label_data); */ @@ -483,6 +543,9 @@ /* void c_plsmem(PLINT maxx, PLINT maxy, void *plotmem); + + void +c_plsmema( PLINT maxx, PLINT maxy, void *plotmem ); */ void @@ -519,7 +582,18 @@ void c_plstart(const char *devname, PLINT nx, PLINT ny); +/* void +c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ); +*/ + + void +c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *string ); + + void +c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char *string ); + + void c_plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); /* @@ -543,6 +617,13 @@ PLFLT valuemin, PLFLT valuemax, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); + + void +plfimagefr( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); */ void @@ -550,7 +631,14 @@ PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax); +/* void +plfimage( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); +*/ + + void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); void @@ -559,9 +647,18 @@ /* void +plfsurf3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + + void c_plsurf3dl(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax); + + void +plfsurf3dl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT opt, PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); */ void @@ -599,6 +696,13 @@ c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); + + void +plfvect( PLFLT ( *getuv )( PLINT, PLINT, PLPointer ), + PLPointer up, PLPointer vp, + PLINT nx, PLINT ny, PLFLT scale, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); */ void @@ -679,7 +783,22 @@ void pltr2f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); + PLF2OPS +plf2ops_c(); + + PLF2OPS +plf2ops_grid_c(); + + PLF2OPS +plf2ops_grid_row_major(); + + PLF2OPS +plf2ops_grid_col_major(); + PLFLT +plf2eval1( PLINT ix, PLINT iy, PLPointer plf2eval_data ); + + PLFLT plf2eval2(PLINT ix, PLINT iy, PLPointer plf2eval_data); PLFLT Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_h.inc 2011-01-01 00:26:35 UTC (rev 11409) @@ -59,6 +59,7 @@ [mlname(plinit)] void c_plinit ( void ); [mlname(pljoin)] void c_pljoin ( double x1, double y1, double x2, double y2 ); [mlname(pllab)] void c_pllab ( [string] const char * xlabel, [string] const char * ylabel, [string] const char * tlabel ); +[mlname(plcolorbar)] void c_plcolorbar ( plplot_colorbar_opt opt, double x, double y, double length, double width, [string] const char * axis_opts, [string] const char * label, int n_colors, [in, size_is(n_colors)] double * colors, [in, size_is(n_colors)] double * values ); [mlname(pllightsource)] void c_pllightsource ( double x, double y, double z ); [mlname(plline)] void c_plline ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y ); [mlname(plline3)] void c_plline3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z ); @@ -120,6 +121,8 @@ [mlname(plssym)] void c_plssym ( double def, double scale ); [mlname(plstar)] void c_plstar ( int nx, int ny ); [mlname(plstart)] void c_plstart ( [string] const char * devname, int nx, int ny ); +[mlname(plstring)] void c_plstring ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [string] const char * string ); +[mlname(plstring3)] void c_plstring3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z, [string] const char * string ); [mlname(plstripa)] void c_plstripa ( int id, int pen, double x, double y ); [mlname(plstripd)] void c_plstripd ( int id ); [mlname(plimage)] void c_plimage ( [in, size_is(nx, ny)] double ** idata, int nx, int ny, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double Dxmin, double Dxmax, double Dymin, double Dymax ); Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_impl.c 2011-01-01 00:26:35 UTC (rev 11409) @@ -746,27 +746,42 @@ case 3: translated_option = PL_LEGEND_SYMBOL; break; case 4: translated_option = PL_LEGEND_TEXT_LEFT; break; case 5: translated_option = PL_LEGEND_BACKGROUND; break; + case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break; + case 7: translated_option = PL_LEGEND_ROW_MAJOR; break; + case 8: translated_option = PL_LEGEND_LEFT; break; + case 9: translated_option = PL_LEGEND_RIGHT; break; + case 10: translated_option = PL_LEGEND_UPPER; break; + case 11: translated_option = PL_LEGEND_LOWER; break; + case 12: translated_option = PL_LEGEND_INSIDE; break; + case 13: translated_option = PL_LEGEND_OUTSIDE; break; default: translated_option = -1; } return translated_option; } value ml_pllegend( value opt, value x, value y, value plot_width, - value bg_color, value opt_array, + value bg_color, + value bb_color, value bb_style, + value nrow, value ncolumn, + value opt_array, value text_offset, value text_scale, value text_spacing, value text_justification, value text_colors, value text, value box_colors, value box_patterns, value box_scales, + value box_line_widths, value line_colors, value line_styles, value line_widths, value symbol_colors, value symbol_scales, value symbol_numbers, value symbols ) { CAMLparam5( opt, x, y, plot_width, bg_color ); - CAMLxparam5( opt_array, text_offset, text_scale, text_spacing, - text_justification ); - CAMLxparam5( text_colors, text, box_colors, box_patterns, box_scales ); + CAMLxparam5( bb_color, bb_style, nrow, ncolumn, opt_array ); + CAMLxparam5( text_offset, text_scale, text_spacing, text_justification, + text_colors ); + CAMLxparam5( text, box_colors, box_patterns, box_scales, box_line_widths ); CAMLxparam5( line_colors, line_styles, line_widths, symbol_colors, - symbol_scales ); + symbol_scales ); CAMLxparam2( symbol_numbers, symbols ); + CAMLlocal1( result ); + result = caml_alloc( 2, 0 ); // Counter int i; @@ -786,12 +801,13 @@ INIT_INT_ARRAY( text_colors ) INIT_INT_ARRAY( box_colors ) INIT_INT_ARRAY( box_patterns ) + INIT_INT_ARRAY( box_line_widths ) INIT_INT_ARRAY( line_colors ) INIT_INT_ARRAY( line_styles ) INIT_INT_ARRAY( line_widths ) INIT_INT_ARRAY( symbol_colors ) INIT_INT_ARRAY( symbol_numbers ) - INIT_INT_ARRAY( symbols ) + INIT_STRING_ARRAY( symbols ) // Translate the legend configuration options c_opt = lor_ml_list( opt, translate_legend_option ); @@ -802,18 +818,29 @@ lor_ml_list( Field( opt_array, i ), translate_legend_option ); } - // pllegend( c_opt, Double_val( x ), Double_val( y ), -// Double_val( plot_width ), Int_val( bg_color ), n_legend, -// c_opt_array, -// Double_val( text_offset ), Double_val( text_scale ), -// Double_val( text_spacing ), Double_val( text_justification ), -// c_text_colors, c_text, -// c_box_colors, c_box_patterns, (double *) box_scales, -// c_line_colors, c_line_styles, c_line_widths, -// c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, -// c_symbols ); + // The returned width and height of the legend + PLFLT width, height; - CAMLreturn( Val_unit ); + pllegend( &width, &height, c_opt, Double_val( x ), Double_val( y ), + Double_val( plot_width ), Int_val( bg_color ), + Int_val( bb_color ), Int_val( bb_style ), + Int_val( nrow ), Int_val( ncolumn ), + n_legend, c_opt_array, + Double_val( text_offset ), Double_val( text_scale ), + Double_val( text_spacing ), + Double_val( text_justification ), + c_text_colors, c_text, + c_box_colors, c_box_patterns, (double *) box_scales, + c_box_line_widths, + c_line_colors, c_line_styles, c_line_widths, + c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, + c_symbols ); + + // Return a tuple with the legend's size + Store_field( result, 0, caml_copy_double( width ) ); + Store_field( result, 1, caml_copy_double( height ) ); + + CAMLreturn( result ); } value ml_pllegend_byte( value* argv, int argn ) @@ -822,7 +849,8 @@ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14], argv[15], argv[16], argv[17], argv[18], argv[19], - argv[20], argv[21] ); + argv[20], argv[21], argv[22], argv[23], argv[24], + argv[25], argv[26] ); } // pltr* function implementations Modified: trunk/bindings/ocaml/touchup.ml =================================================================== --- trunk/bindings/ocaml/touchup.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/touchup.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -79,6 +79,12 @@ function_attrs = None; parameter_attrs = Some ["ctime", ["out"]]; }; + { + function_name = "c_plcolorbar"; + function_attrs = None; + parameter_attrs = Some ["colors", ["in"; "size_is(n_colors)"]; + "values", ["in"; "size_is(n_colors)"]]; + }; (* For now, this will be wrapped by hand... { function_name = "c_plgriddata"; @@ -280,7 +286,7 @@ ["string"]; (* Pointers to arrays of n elements *) true, - pmatch "\\*" p_type, + pmatch "\\*" p_type && not (pmatch "const char" p_type), true, List.mem "n" names, ["in"; "size_is(n)"]; Modified: trunk/examples/ocaml/x04.ml =================================================================== --- trunk/examples/ocaml/x04.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x04.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -63,7 +63,7 @@ plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; - plpoin freql phase 3; + plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 "Phase shift (degrees)"; @@ -82,17 +82,22 @@ let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in - let symbols = [| 0; 3 |] in + let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors text - [||] [||] [||] - line_colors line_styles line_widths - symbol_colors symbol_scales symbol_numbers symbols; *) + plscol0a 15 32 32 32 0.70; + ignore ( + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.1 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors text + [||] [||] [||] [||] + line_colors line_styles line_widths + symbol_colors symbol_scales symbol_numbers symbols + ); () ) else if plot_type = 1 then ( @@ -110,13 +115,18 @@ (* from the above opt_arrays we can completely ignore everything to do with boxes and symbols *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors text - [||] [||] [||] - line_colors line_styles line_widths - [||] [||] [||] [||];*) + plscol0a 15 32 32 32 0.70; + ignore ( + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.1 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors text + [||] [||] [||] [||] + line_colors line_styles line_widths + [||] [||] [||] [||] + ); () ) Modified: trunk/examples/ocaml/x18.ml =================================================================== --- trunk/examples/ocaml/x18.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x18.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -120,7 +120,8 @@ if opt.(k) <> 0 then plline3 x y z else - plpoin3 x y z 1; + (* U+22C5 DOT OPERATOR. *) + plstring3 x y z "⋅"; plcol0 3; let title = Modified: trunk/examples/ocaml/x26.ml =================================================================== --- trunk/examples/ocaml/x26.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x26.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -158,7 +158,7 @@ plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; - plpoin freql phase 3; + plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 alty_label; ); @@ -177,17 +177,22 @@ let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in - let symbols = [| 0; 3 |] in + let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors legend_text - [||] [||] [||] - line_colors line_styles line_widths - symbol_colors symbol_scales symbol_numbers symbols;*) + plscol0a 15 32 32 32 0.70; + let _, _ = + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.10 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors legend_text + [||] [||] [||] [||] + line_colors line_styles line_widths + symbol_colors symbol_scales symbol_numbers symbols + in () (*--------------------------------------------------------------------------*\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2011-01-01 00:34:04
|
Revision: 11411 http://plplot.svn.sourceforge.net/plplot/?rev=11411&view=rev Author: hezekiahcarty Date: 2011-01-01 00:33:58 +0000 (Sat, 01 Jan 2011) Log Message: ----------- A few small fixes for the PL_MAXPOLY changes xwin.c: npts -> pls->dev_npts plgradient.c: 10. -> 180. Modified Paths: -------------- trunk/drivers/xwin.c trunk/src/plgradient.c Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2011-01-01 00:31:53 UTC (rev 11410) +++ trunk/drivers/xwin.c 2011-01-01 00:33:58 UTC (rev 11411) @@ -848,7 +848,7 @@ if ( pls->dev_npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + pts = (XPoint *) malloc( sizeof(XPoint) * pls->dev_npts ); } else { @@ -891,7 +891,7 @@ } #endif - if ( npts > PL_MAXPOLY ) + if ( pls->dev_npts > PL_MAXPOLY ) { free( pts ); } Modified: trunk/src/plgradient.c =================================================================== --- trunk/src/plgradient.c 2011-01-01 00:31:53 UTC (rev 11410) +++ trunk/src/plgradient.c 2011-01-01 00:33:58 UTC (rev 11411) @@ -86,7 +86,7 @@ // Find (x1, y1) and (x2, y2) corresponding to beginning and end // of gradient vector. - double cosangle = cos( PI * angle / 10. ); + double cosangle = cos( PI * angle / 180. ); double sinangle = sin( PI * angle / 180. ); xrot = x[0] * cosangle + y[0] * sinangle; xrot_min = xrot; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-01 23:26:28
|
Revision: 11417 http://plplot.svn.sourceforge.net/plplot/?rev=11417&view=rev Author: airwin Date: 2011-01-01 23:26:21 +0000 (Sat, 01 Jan 2011) Log Message: ----------- Add plcont-related octave wrappers which allow examples 9 and 14 to give identical results to the corresponding C examples. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-01 23:24:26 UTC (rev 11416) +++ trunk/bindings/octave/plplot_octave.i 2011-01-01 23:26:21 UTC (rev 11417) @@ -162,20 +162,20 @@ // manual template instantiation. %} -/* The following typemaps take care of marshaling values into and out of PLplot functions. The -Array rules are trickly because of the need for length checking. These rules manage -some global variables (above) to handle consistency checking amoung parameters. +// The following typemaps take care of marshaling values into and out +// of PLplot functions. The Array rules are trickly because of the +// need for length checking. These rules manage some global variables +// (above) to handle consistency checking amoung parameters. -Naming rules: - Array (sets Alen to dim[0]) - ArrayCk (tests that dim[0] == Alen) - ArrayX (sets Xlen to dim[0] - ArrayCkX (tests dim[0] == Xlen) - ArrayY (sets Ylen to dim[1]) - ArrayCkY (tests dim[1] == Ylen) - Matrix (sets Xlen to dim[0], Ylen to dim[1]) - MatrixCk (test Xlen == dim[0] && Ylen == dim[1]) -*/ +// Naming rules: +// Array (sets Alen to dim[0]) +// ArrayCk (tests that dim[0] == Alen) +// ArrayX (sets Xlen to dim[0] +// ArrayCkX (tests dim[0] == Xlen) +// ArrayY (sets Ylen to dim[1]) +// ArrayCkY (tests dim[1] == Ylen) +// Matrix (sets Xlen to dim[0], Ylen to dim[1]) +// MatrixCk (test Xlen == dim[0] && Ylen == dim[1]) /* typemaps */ %include <typemaps.i> @@ -315,56 +315,133 @@ } %typemap(freearg) (PLFLT *Array, PLINT n) {} +// The Matrix typemaps below here are a special form (with **Matrix +// replaced by *Matrix) that is only suitable for special octave +// wrappers that are defined later in the file while the usual +// PLplot functions that use **Matrix are %ignored. + // No X count but check consistency with previous -%typemap(in) PLFLT *ArrayCkX {} +%typemap(in) PLFLT *ArrayCkX (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Xlen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); +} %typemap(freearg) PLFLT *ArrayCkX {} // No Y count but check consistency with previous -%typemap(in) PLFLT *ArrayCkY {} +%typemap(in) PLFLT *ArrayCkY (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + if ( _dim($input, 0) != Ylen ) + { error("argument vectors must be same length"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); +} %typemap(freearg) PLFLT *ArrayCkY {} // With trailing X count but remember X size to check others -%typemap(in) (PLFLT *ArrayX, PLINT nx) {} +%typemap(in) (PLFLT *ArrayX, PLINT nx) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = Xlen = (PLINT)(_dim($input, 0)); +} %typemap(freearg) (PLFLT *ArrayX, PLINT nx) {} // No X count but remember X size to check others -%typemap(in) PLFLT *ArrayX {} +%typemap(in) PLFLT *ArrayX (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + Xlen = (PLINT)(_dim($input, 0)); +} %typemap(freearg) PLFLT *ArrayX {} // With trailing Y count but remember Y size to check others -%typemap(in) (PLFLT *ArrayY, PLINT ny) {} +%typemap(in) (PLFLT *ArrayY, PLINT ny) (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = Ylen = (PLINT)(_dim($input, 0)); +} %typemap(freearg) (PLFLT *ArrayY, PLINT ny) {} // No Y count but remember Y size to check others -%typemap(in) PLFLT *ArrayY {} +%typemap(in) PLFLT *ArrayY (Matrix temp) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + Ylen = (PLINT)(_dim($input, 0)); +} %typemap(freearg) (PLFLT *ArrayY) {} -/* 2D array with trailing dimensions, check consistency with previous */ -%typemap(in) (PLFLT **MatrixCk, PLINT nx, PLINT ny) (int ii) {} -%typemap(freearg) (PLFLT **MatrixCk, PLINT nx, PLINT ny) {} +// 2D array with trailing dimensions, check consistency with previous +%typemap(in) (PLFLT *MatrixCk, PLINT nx, PLINT ny) (Matrix temp) { + if ( _n_dims($input) >2 ) + { error("argument must be a scalar, vector, or 2D matrix."); SWIG_fail; } + if ( _dim($input, 0) != Xlen ) + { error("argument matrix must have same X length as X vector"); SWIG_fail; } + if ( _dim($input, 1) != Ylen ) + { error("argument matrix must have same Y length as Y vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = (PLINT)(_dim($input, 0)); + $3 = (PLINT)(_dim($input, 1)); +} +%typemap(freearg) (PLFLT *MatrixCk, PLINT nx, PLINT ny) {} +// 2D array with trailing dimensions but set the X, Y size for later checking +%typemap(in) (PLFLT *Matrix, PLINT nx, PLINT ny) (Matrix temp) { + if ( _n_dims($input) > 2 ) + { error("argument must be a scalar, vector, or 2D matrix."); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = Xlen = (PLINT)(_dim($input, 0)); + $3 = Ylen = (PLINT)(_dim($input, 1)); +} +%typemap(freearg) (PLFLT *Matrix, PLINT nx, PLINT ny) {} -/* 2D array with trailing dimensions, set the X, Y size for later checking */ -%typemap(in) (PLFLT **Matrix, PLINT nx, PLINT ny) (int ii) {} -%typemap(freearg) (PLFLT **Matrix, PLINT nx, PLINT ny) {} +// 2D array with no count but set the X, Y size for later checking +%typemap(in) PLFLT *Matrix (Matrix temp) { + if ( _n_dims($input) > 2 ) + { error("argument must be a scalar, vector, or 2D matrix."); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + Xlen = (PLINT)(_dim($input, 0)); + Ylen = (PLINT)(_dim($input, 1)); +} +%typemap(freearg) PLFLT *Matrix {} -/* 2D array with no dimensions, set the X, Y size for later checking */ -%typemap(in) PLFLT **Matrix (int ii) {} -%typemap(freearg) PLFLT **Matrix {} +// 2D array with no count but check for consistency +%typemap(in) PLFLT *MatrixCk (Matrix temp) { + if ( _n_dims($input) > 2 ) + { error("argument must be a scalar, vector, or 2D matrix."); SWIG_fail; } + if ( _dim($input, 0) != Xlen ) + { error("argument matrix must have same X length as X vector"); SWIG_fail; } + if ( _dim($input, 1) != Ylen ) + { error("argument matrix must have same Y length as Y vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); +} +%typemap(freearg) PLFLT *MatrixCk {} -/* 2D array, check for consistency */ -%typemap(in) PLFLT **MatrixCk (int ii) {} -%typemap(freearg) PLFLT **MatrixCk {} - /* Set Y length for later consistency checking, with trailing count */ /* and 2D array, check for consistency input / output version */ -%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) {} +%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) (Matrix temp) {} %typemap(argout) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) {} %typemap(freearg) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) {} + //----------------------------------------------------------------------------- // String returning functions //----------------------------------------------------------------------------- @@ -407,6 +484,20 @@ // and would require fewer swig contortions, but it has the obvious downside // of a massive octave bindings API breakage. +// N.B. For now we drop the vectorized form of arguments that the +// traditional matwrap-wrapped octave bindings have for plbtime, +// plcalc_world, plctime, plgcol0, plgcol0a, plhlsrgb, plrgbhls, +// plxormod, and plTranslateCursor for simplicity and because the +// unvectorized form works fine if you use explicit loops (as in the +// standard examples). Note, this decision means there is an octave +// bindings API breakage with the swig-generated approach, but my +// (AWI's) judgement is this was a little used feature since typically +// (except for example 29) this functionality has not been used in the +// standard examples. We may want to vectorize the arguments of these +// octave functions at a later date or change the standard PLplot API +// to vectors for all of these if it really is a worthwhile API +// change. + // Our octave bindings use the name plSetOpt for the PLplot function, // plsetopt, and use the plsetopt name for a different purpose // (plsetopt.m). We implement that here using the rename directive. @@ -484,5 +575,125 @@ const char *legline1, const char *legline2, const char *legline3, const char *legline4, const char *labx, const char *laby, const char *labtop ); - // swig-compatible common PLplot API definitions from here on. +// Various special wrappers for plcont. + +%ignore plcont; +%rename(plcont) my_plcont; +%rename(plcont0) my_plcont0; +%rename(plcont1) my_plcont1; +%rename(plcont2) my_plcont2; +%rename(plcont2p) my_plcont2p; + +%{ +// One more hack. As it is not possible (and would not be desirable) to pass +// an Octave function to plcont(), I have defined three plcont(): +// plcont uses a defined here xform() +// plcont0 uses pltr0() +// plcont1 uses pltr1() +// plcont2 uses pltr2() +// plcont2p uses pltr2p() +// +// Also, as plplot expect vectorized bidimensional arrays, I provided a +// f2c, which is a #define that does the necessary conversion. +// + +void xform( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ) +{ + *tx = *( (PLFLT *) pltr_data + 0 ) * x + *( (PLFLT *) pltr_data + 1 ) * y + *( (PLFLT *) pltr_data + 2 ); + *ty = *( (PLFLT *) pltr_data + 3 ) * x + *( (PLFLT *) pltr_data + 4 ) * y + *( (PLFLT *) pltr_data + 5 ); +} + +// convert from Fortran like arrays (one vector), to C like 2D arrays + +#define f2c( f, ff, nx, ny ) \ + PLFLT * *ff; \ + ff = (PLFLT **) alloca( nx * sizeof ( PLFLT * ) ); \ + for ( int i = 0; i < nx; i++ ) { \ + ff[i] = (PLFLT *) alloca( ny * sizeof ( PLFLT ) ); \ + for ( int j = 0; j < ny; j++ ) \ + *( ff[i] + j ) = *( f + nx * j + i );} + +// simpler plcont() for use with xform() + +void my_plcont( PLFLT *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *clevel, PLINT nlevel, PLFLT *tr ) +{ + f2c( f, ff, nx, ny ); + c_plcont( ff, nx, ny, kx, lx, ky, ly, clevel, nlevel, xform, tr ); +} + +// plcont() for use with pltr0() NOT TESTED + +void my_plcont0( PLFLT *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *clevel, PLINT nlevel ) +{ + f2c( f, ff, nx, ny ); + c_plcont( ff, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr0, NULL ); +} + +// plcont() for use with pltr1() + +void my_plcont1( PLFLT *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *clevel, PLINT nlevel, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid grid1; + grid1.nx = nx; grid1.ny = ny; + grid1.xg = xg; grid1.yg = yg; + f2c( f, ff, nx, ny ); + c_plcont( ff, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr1, &grid1 ); +} + +// plcont() for use with pltr2() +void my_plcont2( PLFLT *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *clevel, PLINT nlevel, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, nx, ny ); f2c( yg, ygg, nx, ny ); + grid2.nx = nx; grid2.ny = ny; + grid2.xg = xgg; grid2.yg = ygg; + f2c( f, ff, nx, ny ); + c_plcont( ff, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr2, &grid2 ); +} + +// plcont() for use with pltr2p() + +void my_plcont2p( PLFLT *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *clevel, PLINT nlevel, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, nx, ny ); f2c( yg, ygg, nx, ny ); + grid2.nx = nx; grid2.ny = ny; + grid2.xg = xgg; grid2.yg = ygg; + f2c( f, ff, nx, ny ); + c_plcont( ff, nx, ny, kx, lx, ky, ly, clevel, nlevel, pltr2, &grid2 ); +} +%} + +void my_plcont( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *Array, PLINT n, PLFLT *Array ); +void my_plcont0( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *Array, PLINT n ); +void my_plcont1( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *Array, PLINT n, PLFLT *ArrayCkX, PLFLT *ArrayCkY ); +void my_plcont2( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *Array, PLINT n, PLFLT *MatrixCk, PLFLT *MatrixCk ); +void my_plcont2p( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, + PLINT ly, PLFLT *Array, PLINT n, PLFLT *MatrixCk, PLFLT *MatrixCk ); + +// Deal with these later. +%ignore pllegend; +%ignore plmesh; +%ignore plmeshc; +%ignore plot3d; +%ignore plot3dc; +%ignore plot3dcl; +%ignore plsurf3d; +%ignore plsurf3dl; +%ignore plshade; +%ignore plshades; +%ignore plvect; +%ignore plimage; +%ignore plimagefr; +%ignore plMinMax2dGrid; +// swig-compatible common PLplot API definitions from here on. %include plplotcapi.i Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-01 23:24:26 UTC (rev 11416) +++ trunk/plplot_test/test_octave.sh.in 2011-01-01 23:26:21 UTC (rev 11417) @@ -77,7 +77,7 @@ # 15, 16: shade plots, callbacks, # 20: plimage # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:7 10 12 13 17 18 23:27 29:31] ; +@swig_octave_comment@for i=[1:7 9 10 12 13 14 17 18 23:27 29:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2011-01-02 00:43:41
|
Revision: 11419 http://plplot.svn.sourceforge.net/plplot/?rev=11419&view=rev Author: hezekiahcarty Date: 2011-01-02 00:43:35 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Add support for custom tick mark spacing, custom labeling in plcolorbar Custom tick mark support works like plbox/plaxes (major tick spacing + minor tick count). Custom labeling goes with shade color bars. If a user wants, labels and tick marks can be placed at the breaks between shades (PL_COLORBAR_SHADE_LAEL). The actual text used in the labeling could use some work, as it currently just uses the %g printf format. Modified Paths: -------------- trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-01-02 00:42:59 UTC (rev 11418) +++ trunk/include/plplot.h 2011-01-02 00:43:35 UTC (rev 11419) @@ -1241,6 +1241,7 @@ #define PL_COLORBAR_GRADIENT 1024 #define PL_COLORBAR_CAP_LOW 2048 #define PL_COLORBAR_CAP_HIGH 4096 +#define PL_COLORBAR_SHADE_LABEL 8192 PLDLLIMPEXP void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, @@ -1260,6 +1261,7 @@ PLDLLIMPEXP void c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, PLINT n_colors, PLFLT *colors, PLFLT *values ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-02 00:42:59 UTC (rev 11418) +++ trunk/src/pllegend.c 2011-01-02 00:43:35 UTC (rev 11419) @@ -906,6 +906,7 @@ void c_plcolorbar( PLINT opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + PLFLT ticks, PLINT sub_ticks, const char *axis_opts, const char *label, PLINT n_colors, PLFLT *colors, PLFLT *values ) { @@ -1209,26 +1210,24 @@ if ( opt & PL_COLORBAR_LEFT ) { snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + plbox( "bc", ticks, sub_ticks, opt_string, ticks, sub_ticks ); } else if ( opt & PL_COLORBAR_RIGHT ) { snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( "bc", 0.0, 0, opt_string, 0.0, 0 ); + plbox( "bc", 0.0, 0, opt_string, ticks, sub_ticks ); } else if ( opt & PL_COLORBAR_UPPER ) { snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); } else if ( opt & PL_COLORBAR_LOWER ) { snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( opt_string, 0.0, 0, "bc", 0.0, 0 ); + plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); } - // TODO: Add tick mark drawing and labeling here when n_colors > 2 - // Draw a title char perp; if ( opt & PL_COLORBAR_LABEL_LEFT ) @@ -1291,6 +1290,58 @@ snprintf( opt_string, max_opts, "b%c", perp ); plmtex( opt_string, label_offset, 0.5, 0.5, label ); } + + // Draw labels and tick marks if this is a shade color bar + // TODO: A better way to handle this would be to update the + // internals of plbox to support custom tick and label positions + // along an axis. + if ( opt & PL_COLORBAR_SHADE && opt & PL_COLORBAR_SHADE_LABEL ) + { + // Draw labels and tick marks + char label_string[40]; + char *pos_string; + PLFLT just; + PLFLT label_value, label_position; + if ( opt & PL_COLORBAR_RIGHT ) + { + pos_string = "rv"; + just = 0.0; + } + else if ( opt & PL_COLORBAR_LEFT ) + { + pos_string = "lv"; + just = 1.0; + } + else if ( opt & PL_COLORBAR_UPPER ) + { + pos_string = "t"; + just = 0.5; + } + else if ( opt & PL_COLORBAR_LOWER ) + { + pos_string = "b"; + just = 0.5; + } + for ( i = 0; i < n_steps; i++ ) + { + label_value = values[i]; + label_position = ( label_value - min_value ) / ( max_value - min_value ); + snprintf( label_string, 40, "%g", label_value ); + // Label + plmtex( pos_string, 1.5, label_position, just, label_string ); + // Tick mark + if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) + { + plwytik( 0.0, label_value, FALSE, TRUE ); + plwytik( 1.0, label_value, FALSE, FALSE ); + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + plwxtik( label_value, 0.0, FALSE, TRUE ); + plwxtik( label_value, 1.0, FALSE, FALSE ); + } + } + } // Restore plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 01:06:03
|
Revision: 11422 http://plplot.svn.sourceforge.net/plplot/?rev=11422&view=rev Author: airwin Date: 2011-01-02 01:05:57 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plmesh-related wrappers. This allows example 28 to work and give consistent results with the C equivalent. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 00:44:44 UTC (rev 11421) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 01:05:57 UTC (rev 11422) @@ -437,9 +437,9 @@ /* Set Y length for later consistency checking, with trailing count */ /* and 2D array, check for consistency input / output version */ -%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) (Matrix temp) {} -%typemap(argout) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) {} -%typemap(freearg) (PLFLT *ArrayY, PLINT ny, PLFLT **OutMatrixCk) {} +%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) (Matrix temp) {} +%typemap(argout) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) {} +%typemap(freearg) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) {} //----------------------------------------------------------------------------- @@ -680,10 +680,63 @@ void my_plcont2p( PLFLT *Matrix, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *Array, PLINT n, PLFLT *MatrixCk, PLFLT *MatrixCk ); +// plgriddata wrapper. +%ignore plgriddata; +%rename(plgriddata) my_plgriddata; + +%{ +void my_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, int npts, + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLFLT *zg, int type, PLFLT data ) +{ + f2c( zg, zgg, nptsx, nptsy ); + plgriddata( x, y, z, npts, xg, nptsx, yg, nptsy, zgg, type, data ); + for ( int i = 0; i < nptsx; i++ ) + for ( int j = 0; j < nptsy; j++ ) + *( zg + nptsx * j + i ) = zgg[i][j]; +} +%} +void my_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, int npts, + PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, + PLFLT *zg, int type, PLFLT data ); + +void +my_plgriddata( PLFLT *Array, PLFLT *ArrayCk, PLFLT *ArrayCk, PLINT n, + PLFLT *ArrayX, PLINT nx, PLFLT *ArrayY, PLINT ny, + PLFLT *OutMatrixCk, PLINT type, PLFLT data ); + +// plmesh-related wrappers. +%ignore plmesh; +%rename(plmesh) my_plmesh; +%ignore plmeshc; +%rename(plmeshc) my_plmeshc; + +%{ +// Plots a mesh representation of the function z[x][y]. + +void my_plmesh( PLFLT *x, PLFLT *y, PLFLT *z, PLINT nx, PLINT ny, PLINT opt ) +{ + f2c( z, zz, nx, ny ); + c_plmesh( x, y, zz, nx, ny, opt ); +} + +// Plots a mesh representation of the function z[x][y] with contour + +void my_plmeshc( PLFLT *x, PLFLT *y, PLFLT *z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ) +{ + f2c( z, zz, nx, ny ); + c_plmeshc( x, y, zz, nx, ny, opt, clevel, nlevel ); +} +%} + +void my_plmesh( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, + PLINT nx, PLINT ny, PLINT opt ); + +void my_plmeshc( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, + PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); + // Deal with these later. %ignore pllegend; -%ignore plmesh; -%ignore plmeshc; %ignore plot3d; %ignore plot3dc; %ignore plot3dcl; Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 00:44:44 UTC (rev 11421) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 01:05:57 UTC (rev 11422) @@ -77,7 +77,7 @@ # 15, 16: shade plots, callbacks, # 20: plimage # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:7 9 10 12 13 14 17 18 23:27 29:31] ; +@swig_octave_comment@for i=[1:7 9 10 12 13 14 17 18 23:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 01:22:49
|
Revision: 11423 http://plplot.svn.sourceforge.net/plplot/?rev=11423&view=rev Author: airwin Date: 2011-01-02 01:22:42 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plot3d-related wrappings. Allows example 11 to work and give consistent results with its C counterpart. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 01:05:57 UTC (rev 11422) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 01:22:42 UTC (rev 11423) @@ -735,11 +735,43 @@ void my_plmeshc( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); -// Deal with these later. -%ignore pllegend; +// plot3d-related wrappers. + %ignore plot3d; +%rename(plot3d) my_plot3d; %ignore plot3dc; +%rename(plot3dc) my_plot3dc; %ignore plot3dcl; +//unimplemented: %rename(plot3dcl) my_plot3dcl; + +%{ +// Plots a 3-d representation of the function z[x][y]. +void my_plot3d( PLFLT *x, PLFLT *y, PLFLT *z, + PLINT nx, PLINT ny, PLINT opt, PLINT side ) +{ + f2c( z, zz, nx, ny ) + c_plot3d( x, y, zz, nx, ny, opt, side ); +} + +// Plots a 3-d representation of the function z[x][y] with contour +void my_plot3dc( PLFLT *x, PLFLT *y, PLFLT *z, + PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel ) +{ + f2c( z, zz, nx, ny ) + c_plot3dc( x, y, zz, nx, ny, opt, clevel, nlevel ); +} +%} + +void my_plot3d( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, + PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); + +void my_plot3dc( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, + PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); + + +// Deal with these later. +%ignore pllegend; %ignore plsurf3d; %ignore plsurf3dl; %ignore plshade; Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 01:05:57 UTC (rev 11422) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 01:22:42 UTC (rev 11423) @@ -72,12 +72,13 @@ #Example 19 is not yet implemented failed = [] ; # Temporarily drop everything that involves 2D arrays and/or callbacks. -# 8, 11, 21: 3D mesh plots, -# 9, 14: 22 contours, callbacks, +# 8, 11: 3D meash-related plots, # 15, 16: shade plots, callbacks, # 20: plimage +# 21: plgriddata and 3D plots +# 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:7 9 10 12 13 14 17 18 23:31] ; +@swig_octave_comment@for i=[1:7 9:14 17 18 23:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 01:39:04
|
Revision: 11425 http://plplot.svn.sourceforge.net/plplot/?rev=11425&view=rev Author: airwin Date: 2011-01-02 01:38:58 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Add plot3d-related wrappers which allow example 8 to work and give consistent results with the corresponding C example. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 01:37:55 UTC (rev 11424) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 01:38:58 UTC (rev 11425) @@ -769,11 +769,26 @@ void my_plot3dc( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); +// plsurf3d-related wrappings: +%ignore plsurf3d; +%rename(plsurf3d) my_plsurf3d; +%ignore plsurf3dl; +//unimplemented: %rename(plsurf3d) my_plsurf3d; +%{ +void my_plsurf3d( PLFLT *x, PLFLT *y, PLFLT *z, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ) +{ + f2c( z, zz, nx, ny ) + c_plsurf3d( x, y, zz, nx, ny, opt, clevel, nlevel ); +} +%} + +void my_plsurf3d( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, + PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); + // Deal with these later. %ignore pllegend; -%ignore plsurf3d; -%ignore plsurf3dl; %ignore plshade; %ignore plshades; %ignore plvect; Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 01:37:55 UTC (rev 11424) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 01:38:58 UTC (rev 11425) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:7 9:14 17 18 23:31] ; +@swig_octave_comment@for i=[1:14 17 18 23:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 02:27:31
|
Revision: 11426 http://plplot.svn.sourceforge.net/plplot/?rev=11426&view=rev Author: airwin Date: 2011-01-02 02:27:25 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plshade-related wrappers which allows example 15 to work and give equivalent results to the corresponding C example. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 01:38:58 UTC (rev 11425) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 02:27:25 UTC (rev 11426) @@ -787,9 +787,111 @@ void my_plsurf3d( PLFLT *ArrayX, PLFLT *ArrayY, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLINT opt, PLFLT *Array, PLINT n ); +// plshade-related wrappers. + +%ignore plshade; +%rename(plshade) my_plshade; +%rename(plshade1) my_plshade1; +%rename(plshade2) my_plshade2; + +%{ +// The same as in plcont. I have hardcoded the first function pointer +// to plfill(). The second function pointer will use the same convention +// as in plcont(). +// + +// the simpler plshade() +void my_plshade( PLFLT *a, PLINT nx, PLINT ny, PLFLT *defined, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLINT rectangular, PLFLT *tr ) +{ + f2c( a, aa, nx, ny ); + c_plshade( aa, nx, ny, NULL, left, right, bottom, top, + shade_min, shade_max, sh_cmap, sh_color, sh_width, + min_color, min_width, max_color, max_width, + plfill, rectangular, xform, tr ); +} + +// plshade() for use with pltr1 +void my_plshade1( PLFLT *a, PLINT nx, PLINT ny, const char *defined, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLINT rectangular, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid grid1; + grid1.nx = nx; grid1.ny = ny; + grid1.xg = xg; grid1.yg = yg; + f2c( a, aa, nx, ny ); + c_plshade( aa, nx, ny, NULL, left, right, bottom, top, + shade_min, shade_max, sh_cmap, sh_color, sh_width, + min_color, min_width, max_color, max_width, + plfill, rectangular, pltr1, &grid1 ); +} + +// plshade() for use with pltr2 +void my_plshade2( PLFLT *a, PLINT nx, PLINT ny, const char *defined, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLINT rectangular, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, nx, ny ); f2c( yg, ygg, nx, ny ); + grid2.nx = nx; grid2.ny = ny; + grid2.xg = xgg; grid2.yg = ygg; + f2c( a, aa, nx, ny ); + c_plshade( aa, nx, ny, NULL, left, right, bottom, top, + shade_min, shade_max, sh_cmap, sh_color, sh_width, + min_color, min_width, max_color, max_width, + plfill, rectangular, pltr2, &grid2 ); +} + +%} + +// The defined functionality is completely unused, but through +// a historical anomaly is typed differently between my_plshade and +// my_plshade1 (or my_plshade2) which is why we use PLFLT *Array for +// the fourth argument of my_plshade, but const char * defined +// for the other fourth arguments. FIXME. I (AWI) recommend an API break +// with this fourth (unused) argument completely eliminated, but +// that needs discussion. +// my_plshade1 and my_plshade2 are completely untested by the standard examples. + +void my_plshade( PLFLT *Matrix, PLINT nx, PLINT ny, PLFLT *Array, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLBOOL rectangular, PLFLT *Array ); + +void my_plshade1( PLFLT *Matrix, PLINT nx, PLINT ny, const char *defined, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLBOOL rectangular, PLFLT *ArrayCkX, PLFLT *ArrayCkY); + +void my_plshade2( PLFLT *Matrix, PLINT nx, PLINT ny, const char *defined, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + PLBOOL rectangular, PLFLT *Matrix, PLFLT *Matrix); + // Deal with these later. %ignore pllegend; -%ignore plshade; %ignore plshades; %ignore plvect; %ignore plimage; Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 01:38:58 UTC (rev 11425) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 02:27:25 UTC (rev 11426) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:14 17 18 23:31] ; +@swig_octave_comment@for i=[1:15 17 18 23:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 02:53:44
|
Revision: 11427 http://plplot.svn.sourceforge.net/plplot/?rev=11427&view=rev Author: airwin Date: 2011-01-02 02:53:38 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plshades-related wrappers which allow example 16 to work and give results that are equivalent to the corresponding C example. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 02:27:25 UTC (rev 11426) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 02:53:38 UTC (rev 11427) @@ -791,6 +791,7 @@ %ignore plshade; %rename(plshade) my_plshade; +// plshade1 and plshade2 are untested by the standard examples. %rename(plshade1) my_plshade1; %rename(plshade2) my_plshade2; @@ -880,7 +881,7 @@ PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, - PLBOOL rectangular, PLFLT *ArrayCkX, PLFLT *ArrayCkY); + PLBOOL rectangular, PLFLT *ArrayCkX, PLFLT *ArrayCkY); void my_plshade2( PLFLT *Matrix, PLINT nx, PLINT ny, const char *defined, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, @@ -890,12 +891,103 @@ PLINT max_color, PLINT max_width, PLBOOL rectangular, PLFLT *Matrix, PLFLT *Matrix); +// plshades-related wrappers. + +%ignore plshades; +%rename(plshades) my_plshades; +// plshadesx untested by examples. +%rename(plshadesx) my_plshadesx; +%rename(plshades1) my_plshades1; +%rename(plshades2) my_plshades2; + +%{ +void my_plshades( PLFLT *a, PLINT nx, PLINT ny, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLINT rectangular ) +{ + f2c( a, aa, nx, ny ); + c_plshades( aa, nx, ny, NULL, left, right, bottom, top, + clevel, nlevel, fill_width, cont_color, cont_width, + plfill, rectangular, NULL, NULL ); +} + +void my_plshadesx( PLFLT *a, PLINT nx, PLINT ny, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLINT rectangular, PLFLT *tr ) +{ + f2c( a, aa, nx, ny ); + c_plshades( aa, nx, ny, NULL, left, right, bottom, top, + clevel, nlevel, fill_width, cont_color, cont_width, + plfill, rectangular, xform, tr ); +} + +void my_plshades1( PLFLT *a, PLINT nx, PLINT ny, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLINT rectangular, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid grid1; + grid1.nx = nx; grid1.ny = ny; + grid1.xg = xg; grid1.yg = yg; + + f2c( a, aa, nx, ny ); + c_plshades( aa, nx, ny, NULL, left, right, bottom, top, + clevel, nlevel, fill_width, cont_color, cont_width, + plfill, rectangular, pltr1, &grid1 ); +} + +void my_plshades2( PLFLT *a, PLINT nx, PLINT ny, + PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLINT rectangular, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, nx, ny ); f2c( yg, ygg, nx, ny ); + grid2.nx = nx; grid2.ny = ny; + grid2.xg = xgg; grid2.yg = ygg; + f2c( a, aa, nx, ny ); + c_plshades( aa, nx, ny, NULL, left, right, bottom, top, + clevel, nlevel, fill_width, cont_color, cont_width, + plfill, rectangular, pltr2, &grid2 ); +} +%} + +void my_plshades( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *Array, PLINT n, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLBOOL rectangular); + +void my_plshadesx( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *Array, PLINT n, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, PLFLT *Array); + +void my_plshades1( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *Array, PLINT n, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, PLFLT *ArrayCkX, PLFLT *ArrayCkY); + +void my_plshades2( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *Array, PLINT n, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, PLFLT *Matrix, PLFLT *Matrix); + // Deal with these later. %ignore pllegend; -%ignore plshades; %ignore plvect; %ignore plimage; %ignore plimagefr; +// Probably never. %ignore plMinMax2dGrid; // swig-compatible common PLplot API definitions from here on. %include plplotcapi.i Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 02:27:25 UTC (rev 11426) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 02:53:38 UTC (rev 11427) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:15 17 18 23:31] ; +@swig_octave_comment@for i=[1:18 23:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 04:01:25
|
Revision: 11428 http://plplot.svn.sourceforge.net/plplot/?rev=11428&view=rev Author: airwin Date: 2011-01-02 04:01:19 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plvect-related wrappers which allow example 22 to run and also produce results that are equivalent to those from the corresponding C example. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 02:53:38 UTC (rev 11427) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 04:01:19 UTC (rev 11428) @@ -982,9 +982,62 @@ PLINT cont_color, PLINT cont_width, PLBOOL rectangular, PLFLT *Matrix, PLFLT *Matrix); +// plvect-related wrappers. + +%ignore plvect; +// plvect and plvect1 untested by standard examples. +%rename(plvect) my_plvect; +%rename(plvect1) my_plvect1; +%rename(plvect2) my_plvect2; + +%{ +// Plot an array of vector arrows - uses the same function pointer +// convention as plcont + +void my_plvect( PLFLT *u, PLFLT *v, PLINT nx, PLINT ny, PLFLT scale, PLFLT *tr ) +{ + f2c( u, uu, nx, ny ); + f2c( v, vv, nx, ny ); + c_plvect( uu, vv, nx, ny, scale, xform, tr ); +} + +// plvect() for use with pltr1 +void my_plvect1( PLFLT *u, PLFLT *v, PLINT nx, PLINT ny, PLFLT scale, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid grid1; + grid1.nx = nx; grid1.ny = ny; + grid1.xg = xg; grid1.yg = yg; + f2c( u, uu, nx, ny ); + f2c( v, vv, nx, ny ); + c_plvect( uu, vv, nx, ny, scale, pltr1, &grid1 ); +} + +// plvect() for use with pltr2 +void my_plvect2( PLFLT *u, PLFLT *v, PLINT nx, PLINT ny, PLFLT scale, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, nx, ny ); f2c( yg, ygg, nx, ny ); + grid2.nx = nx; grid2.ny = ny; + grid2.xg = xgg; grid2.yg = ygg; + f2c( u, uu, nx, ny ); + f2c( v, vv, nx, ny ); + c_plvect( uu, vv, nx, ny, scale, pltr2, &grid2 ); +} +%} + +void my_plvect( PLFLT *Matrix, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLFLT scale, + PLFLT *Array ); + +void my_plvect1( PLFLT *Matrix, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLFLT scale, + PLFLT *ArrayCkX, PLFLT *ArrayCkY ); + +void my_plvect2( PLFLT *Matrix, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLFLT scale, + PLFLT *Matrix, PLFLT *Matrix); + + + // Deal with these later. %ignore pllegend; -%ignore plvect; %ignore plimage; %ignore plimagefr; // Probably never. Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 02:53:38 UTC (rev 11427) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 04:01:19 UTC (rev 11428) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:18 23:31] ; +@swig_octave_comment@for i=[1:18 22:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-02 06:23:47
|
Revision: 11429 http://plplot.svn.sourceforge.net/plplot/?rev=11429&view=rev Author: airwin Date: 2011-01-02 06:23:40 +0000 (Sun, 02 Jan 2011) Log Message: ----------- Implement plimage-related wrappers. This allows example 20 to work and give consistent results with the C equivalent. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-02 04:01:19 UTC (rev 11428) +++ trunk/bindings/octave/plplot_octave.i 2011-01-02 06:23:40 UTC (rev 11429) @@ -1034,13 +1034,99 @@ void my_plvect2( PLFLT *Matrix, PLFLT *MatrixCk, PLINT nx, PLINT ny, PLFLT scale, PLFLT *Matrix, PLFLT *Matrix); +// plimage-related wrappers. +%ignore plimage; +%rename(pplimage) my_plimage; +%ignore plimagefr; +%rename(plimagefr) my_plimagefr; +%rename(plimagefrx) my_plimagefrx; +%rename(plimagefr1) my_plimagefr1; +%rename(plimagefr2) my_plimagefr2; +%{ +// Plot an image with distortion - uses the same function pointer +void my_plimage( PLFLT *a, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, + PLFLT dxmin, PLFLT dxmax, PLFLT dymin, PLFLT dymax ) +{ + f2c( a, aa, nx, ny ); + plimage( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, dxmin, dxmax, dymin, dymax ); +} +// Plot an image with distortion - uses the same function pointer +// convention as plcont +void my_plimagefr( PLFLT *a, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax ) +{ + f2c( a, aa, nx, ny ); + plimagefr( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, NULL, NULL ); +} + +void my_plimagefrx( PLFLT *a, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *tr ) +{ + f2c( a, aa, nx, ny ); + plimagefr( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, xform, tr ); +} + +// plimagefr() for use with pltr1 +void my_plimagefr1( PLFLT *a, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid grid1; + grid1.nx = nx + 1; grid1.ny = ny + 1; + grid1.xg = xg; grid1.yg = yg; + f2c( a, aa, nx, ny ); + c_plimagefr( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr1, &grid1 ); +} + +// plimagefr() for use with pltr2 +void my_plimagefr2( PLFLT *a, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *xg, PLFLT *yg ) +{ + PLcGrid2 grid2; + f2c( xg, xgg, ( nx + 1 ), ( ny + 1 ) ); f2c( yg, ygg, ( nx + 1 ), ( ny + 1 ) ); + grid2.nx = nx + 1; grid2.ny = ny + 1; + grid2.xg = xgg; grid2.yg = ygg; + f2c( a, aa, nx, ny ); + c_plimagefr( aa, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr2, &grid2 ); +} + +%} + +void my_plimage( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); + +void my_plimagefr( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax ); + +void my_plimagefrx( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *Array ); + +void my_plimagefr1( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *ArrayCkX, PLFLT * ArrayCkY ); + +void my_plimagefr2( PLFLT *Matrix, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, PLFLT *Matrix, PLFLT *Matrix ); + // Deal with these later. %ignore pllegend; -%ignore plimage; -%ignore plimagefr; -// Probably never. +%ignore plgriddata; +// Probably never deal with this one. %ignore plMinMax2dGrid; // swig-compatible common PLplot API definitions from here on. %include plplotcapi.i Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-02 04:01:19 UTC (rev 11428) +++ trunk/plplot_test/test_octave.sh.in 2011-01-02 06:23:40 UTC (rev 11429) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:18 22:31] ; +@swig_octave_comment@for i=[1:18 20 22:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2011-01-03 07:09:43
|
Revision: 11430 http://plplot.svn.sourceforge.net/plplot/?rev=11430&view=rev Author: hezekiahcarty Date: 2011-01-03 07:09:36 +0000 (Mon, 03 Jan 2011) Log Message: ----------- Update plcolorbar with proper labeling and tick mark support for shade bars The implementation could probably be cleaned up a bit. The function label_box_custom is a copy of label_box, modified to support user-provided arrays of x- and y-positions for labels AND tick marks. It is a sort of plaxes-light, and not really meant for use outside of internal PLplot functions at this time. Modified Paths: -------------- trunk/examples/c/x33c.c trunk/src/plbox.c trunk/src/pllegend.c Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2011-01-02 06:23:40 UTC (rev 11429) +++ trunk/examples/c/x33c.c 2011-01-03 07:09:36 UTC (rev 11430) @@ -81,10 +81,10 @@ PL_COLORBAR_CAP_HIGH; const char *axis_opts_1, *axis_opts_2; - if ( bar_type == PL_COLORBAR_SHADE_LABEL ) + if ( bar_type & PL_COLORBAR_SHADE_LABEL ) { - axis_opts_1 = ""; - axis_opts_2 = ""; + axis_opts_1 = "iv"; + axis_opts_2 = "i"; } else { @@ -752,7 +752,7 @@ // Color bar examples PLFLT values_small[2] = { 0.0, 1.0 }; - PLFLT values_uneven[9] = { 0.0, 2.0, 2.5, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; + PLFLT values_uneven[9] = { 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; PLFLT values_even[9] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; plcolorbar_example_1( PL_COLORBAR_IMAGE, 0.0, 0, 2, values_small, "Image Color Bars" ); plcolorbar_example_2( PL_COLORBAR_IMAGE, 0.0, 0, 2, values_small, "Image Color Bars" ); Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2011-01-02 06:23:40 UTC (rev 11429) +++ trunk/src/plbox.c 2011-01-03 07:09:36 UTC (rev 11430) @@ -1509,7 +1509,268 @@ } //-------------------------------------------------------------------------- +// void label_box_custom() // +// Writes numeric labels on side(s) of box in custom locations +//-------------------------------------------------------------------------- + +void +label_box_custom( const char *xopt, PLINT n_xticks, PLFLT *xticks, const char *yopt, PLINT n_yticks, PLFLT *yticks ) +{ + static char string[STRING_LEN]; + PLBOOL ldx, lfx, lix, llx, lmx, lnx, ltx, lox; + PLBOOL ldy, lfy, liy, lly, lmy, lny, lty, lvy, loy; + PLFLT vpwxmi, vpwxma, vpwymi, vpwyma; + PLFLT vpwxmin, vpwxmax, vpwymin, vpwymax; + PLFLT pos, tn, offset, height, just; + PLFLT factor, tstart; + const char *timefmt; + PLINT i; + PLINT xdigmax, xdigits, xdigmax_old, xdigits_old; + PLINT ydigmax, ydigits, ydigmax_old, ydigits_old; + PLINT lxmin, lxmax, lymin, lymax; + PLINT pxmin, pxmax, pymin, pymax; + + // Save some parameters + plgxax( &xdigmax, &xdigits ); + plgyax( &ydigmax, &ydigits ); + xdigmax_old = xdigmax; + xdigits_old = xdigits; + ydigmax_old = ydigmax; + ydigits_old = ydigits; + +// Open the clip limits to the subpage limits + + plP_gclp( &lxmin, &lxmax, &lymin, &lymax ); + plP_gphy( &pxmin, &pxmax, &pymin, &pymax ); + plP_sclp( pxmin, pxmax, pymin, pymax ); + +// Set plot options from input + + ldx = plP_stsearch( xopt, 'd' ); + lfx = plP_stsearch( xopt, 'f' ); + lix = plP_stsearch( xopt, 'i' ); + llx = plP_stsearch( xopt, 'l' ); + lmx = plP_stsearch( xopt, 'm' ); + lnx = plP_stsearch( xopt, 'n' ); + ltx = plP_stsearch( xopt, 't' ); + lox = plP_stsearch( xopt, 'o' ); + + ldy = plP_stsearch( yopt, 'd' ); + lfy = plP_stsearch( yopt, 'f' ); + liy = plP_stsearch( yopt, 'i' ); + lly = plP_stsearch( yopt, 'l' ); + lmy = plP_stsearch( yopt, 'm' ); + lny = plP_stsearch( yopt, 'n' ); + lty = plP_stsearch( yopt, 't' ); + lvy = plP_stsearch( yopt, 'v' ); + loy = plP_stsearch( yopt, 'o' ); + + plP_xgvpw( &vpwxmin, &vpwxmax, &vpwymin, &vpwymax ); +// n.b. large change; vpwxmi always numerically less than vpwxma, and +// similarly for vpwymi + vpwxmi = ( vpwxmax > vpwxmin ) ? vpwxmin : vpwxmax; + vpwxma = ( vpwxmax > vpwxmin ) ? vpwxmax : vpwxmin; + vpwymi = ( vpwymax > vpwymin ) ? vpwymin : vpwymax; + vpwyma = ( vpwymax > vpwymin ) ? vpwymax : vpwymin; + +// Write horizontal label(s) + + if ( ( lmx || lnx ) && ltx ) + { + PLINT xmode, xprec, xscale; + PLFLT x_spacing, x_spacing_tmp; + + // Determine spacing between ticks + // Use the x-size of the window + x_spacing = vpwxma - vpwxmi; + if ( n_xticks > 1 ) + { + // Use the smallest space between ticks + for ( i = 1; i < n_xticks; i++ ) + { + x_spacing_tmp = fabs( xticks[i] - xticks[i - 1] ); + x_spacing = MIN( x_spacing, x_spacing_tmp ); + } + } + + plgxax( &xdigmax, &xdigits ); + pldprec( vpwxmi, vpwxma, x_spacing, lfx, &xmode, &xprec, xdigmax, &xscale ); + timefmt = plP_gtimefmt(); + + // Loop through all of the tick marks + for ( i = 0; i < n_xticks; i++ ) + { + tn = xticks[i]; + if ( BETW( tn, vpwxmi, vpwxma ) ) + { + if ( ldx ) + { + strfqsas( string, STRING_LEN, timefmt, (double) tn, plsc->qsasconfig ); + } + else + { + plform( PL_X_AXIS, tn, xscale, xprec, string, STRING_LEN, llx, lfx, lox ); + } + height = lix ? 1.75 : 1.5; + pos = ( vpwxmax > vpwxmin ) ? + ( tn - vpwxmi ) / ( vpwxma - vpwxmi ) : + ( vpwxma - tn ) / ( vpwxma - vpwxmi ); + if ( lnx ) + plmtex( "b", height, pos, 0.5, string ); + if ( lmx ) + plmtex( "t", height, pos, 0.5, string ); + plwxtik( tn, vpwymin, FALSE, !lix ); + plwxtik( tn, vpwymax, FALSE, lix ); + } + } + xdigits = 2; + plsxax( xdigmax, xdigits ); + + // Write separate exponential label if mode = 1. + + if ( !llx && !ldx && !lox && xmode ) + { + // Assume label data is for placement of exponents if no custom + // label function is provided. + if ( plsc->label_data ) + { + height = ( (PLLabelDefaults *) plsc->label_data )->exp_label_disp; + pos = ( (PLLabelDefaults *) plsc->label_data )->exp_label_pos; + just = ( (PLLabelDefaults *) plsc->label_data )->exp_label_just; + } + else + { + height = 3.2; + pos = 1.0; + just = 0.5; + } + snprintf( string, STRING_LEN, "(x10#u%d#d)", (int) xscale ); + if ( lnx ) + plmtex( "b", height, pos, just, string ); + if ( lmx ) + plmtex( "t", height, pos, just, string ); + } + } + +// Write vertical label(s) + + if ( ( lmy || lny ) && lty ) + { + PLINT ymode, yprec, yscale; + PLFLT y_spacing, y_spacing_tmp; + + // Determine spacing between ticks + // Use the y-size of the window + y_spacing = vpwyma - vpwymi; + if ( n_yticks > 1 ) + { + // Use the smallest space between ticks + for ( i = 1; i < n_yticks; i++ ) + { + y_spacing_tmp = fabs( yticks[i] - yticks[i - 1] ); + y_spacing = MIN( y_spacing, y_spacing_tmp ); + } + } + + plgyax( &ydigmax, &ydigits ); + pldprec( vpwymi, vpwyma, y_spacing, lfy, &ymode, &yprec, ydigmax, &yscale ); + timefmt = plP_gtimefmt(); + + ydigits = 0; + for ( i = 0; i < n_yticks; i++ ) + { + tn = yticks[i]; + if ( BETW( tn, vpwymi, vpwyma ) ) + { + if ( ldy ) + { + strfqsas( string, STRING_LEN, timefmt, (double) tn, plsc->qsasconfig ); + } + else + { + plform( PL_Y_AXIS, tn, yscale, yprec, string, STRING_LEN, lly, lfy, loy ); + } + pos = ( vpwymax > vpwymin ) ? + ( tn - vpwymi ) / ( vpwyma - vpwymi ) : + ( vpwyma - tn ) / ( vpwyma - vpwymi ); + if ( lny ) + { + if ( lvy ) + { + height = liy ? 1.0 : 0.5; + plmtex( "lv", height, pos, 1.0, string ); + } + else + { + height = liy ? 1.75 : 1.5; + plmtex( "l", height, pos, 0.5, string ); + } + } + if ( lmy ) + { + if ( lvy ) + { + height = liy ? 1.0 : 0.5; + plmtex( "rv", height, pos, 0.0, string ); + } + else + { + height = liy ? 1.75 : 1.5; + plmtex( "r", height, pos, 0.5, string ); + } + } + ydigits = MAX( ydigits, (PLINT) strlen( string ) ); + plwytik( vpwxmin, tn, FALSE, !liy ); + plwytik( vpwxmax, tn, FALSE, liy ); + } + } + if ( !lvy ) + ydigits = 2; + + plsyax( ydigmax, ydigits ); + + // Write separate exponential label if mode = 1. + + if ( !lly && !ldy && !loy && ymode ) + { + snprintf( string, STRING_LEN, "(x10#u%d#d)", (int) yscale ); + if ( plsc->label_data ) + { + height = ( (PLLabelDefaults *) plsc->label_data )->exp_label_disp; + pos = ( (PLLabelDefaults *) plsc->label_data )->exp_label_pos; + just = ( (PLLabelDefaults *) plsc->label_data )->exp_label_just; + } + else + { + offset = 0.02; + height = 2.0; + if ( lny ) + { + pos = 0.0 - offset; + just = 1.0; + } + if ( lmy ) + { + pos = 1.0 + offset; + just = 0.0; + } + } + plmtex( "t", height, pos, just, string ); + } + } + + // Restore saved parameters + plsxax( xdigmax_old, xdigits_old ); + plsyax( ydigmax_old, ydigits_old ); + +// Restore the clip limits to viewport edge + + plP_sclp( lxmin, lxmax, lymin, lymax ); +} + +//-------------------------------------------------------------------------- +// // Default labeling functions for PLplot // // These are the functions which are used internally by PLplot under various Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-02 06:23:40 UTC (rev 11429) +++ trunk/src/pllegend.c 2011-01-03 07:09:36 UTC (rev 11430) @@ -1205,28 +1205,9 @@ // For building axis option string PLINT max_opts = 25; char opt_string[max_opts]; + const char *tick_string; - // Draw the boxes, etc. - if ( opt & PL_COLORBAR_LEFT ) - { - snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( "bc", ticks, sub_ticks, opt_string, ticks, sub_ticks ); - } - else if ( opt & PL_COLORBAR_RIGHT ) - { - snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( "bc", 0.0, 0, opt_string, ticks, sub_ticks ); - } - else if ( opt & PL_COLORBAR_UPPER ) - { - snprintf( opt_string, max_opts, "bcm%s", axis_opts ); - plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); - } - else if ( opt & PL_COLORBAR_LOWER ) - { - snprintf( opt_string, max_opts, "bcn%s", axis_opts ); - plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); - } + tick_string = ""; // Draw a title char perp; @@ -1297,52 +1278,61 @@ // along an axis. if ( opt & PL_COLORBAR_SHADE && opt & PL_COLORBAR_SHADE_LABEL ) { - // Draw labels and tick marks - char label_string[40]; - char *pos_string; - PLFLT just; - PLFLT label_value, label_position; - if ( opt & PL_COLORBAR_RIGHT ) + if ( opt & PL_COLORBAR_LEFT ) { - pos_string = "rv"; - just = 0.0; + snprintf( opt_string, max_opts, "nt%s", axis_opts ); + label_box_custom( "", 0, NULL, opt_string, n_colors, values ); } - else if ( opt & PL_COLORBAR_LEFT ) + else if ( opt & PL_COLORBAR_RIGHT ) { - pos_string = "lv"; - just = 1.0; + snprintf( opt_string, max_opts, "mt%s", axis_opts ); + label_box_custom( "", 0, NULL, opt_string, n_colors, values ); } else if ( opt & PL_COLORBAR_UPPER ) { - pos_string = "t"; - just = 0.5; + snprintf( opt_string, max_opts, "mt%s", axis_opts ); + label_box_custom( opt_string, n_colors, values, "", 0, NULL ); } else if ( opt & PL_COLORBAR_LOWER ) { - pos_string = "b"; - just = 0.5; + snprintf( opt_string, max_opts, "nt%s", axis_opts ); + label_box_custom( opt_string, n_colors, values, "", 0, NULL ); } - for ( i = 0; i < n_steps; i++ ) + } + else + { + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_LOWER ) { - label_value = values[i]; - label_position = ( label_value - min_value ) / ( max_value - min_value ); - snprintf( label_string, 40, "%g", label_value ); - // Label - plmtex( pos_string, 1.5, label_position, just, label_string ); - // Tick mark - if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) - { - plwytik( 0.0, label_value, FALSE, TRUE ); - plwytik( 1.0, label_value, FALSE, FALSE ); - } - else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) - { - plwxtik( label_value, 0.0, FALSE, TRUE ); - plwxtik( label_value, 1.0, FALSE, FALSE ); - } + tick_string = "n"; } + else if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_UPPER ) + { + tick_string = "m"; + } } + // Draw the boxes, etc. + if ( opt & PL_COLORBAR_LEFT ) + { + snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); + plbox( "bc", ticks, sub_ticks, opt_string, ticks, sub_ticks ); + } + else if ( opt & PL_COLORBAR_RIGHT ) + { + snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); + plbox( "bc", 0.0, 0, opt_string, ticks, sub_ticks ); + } + else if ( opt & PL_COLORBAR_UPPER ) + { + snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); + plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); + } + else if ( opt & PL_COLORBAR_LOWER ) + { + snprintf( opt_string, max_opts, "bc%s%s", tick_string, axis_opts ); + plbox( opt_string, ticks, sub_ticks, "bc", 0.0, 0 ); + } + // Restore plvpor( xdmin_save, xdmax_save, ydmin_save, ydmax_save ); plwind( xwmin_save, xwmax_save, ywmin_save, ywmax_save ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2011-01-03 07:38:37
|
Revision: 11431 http://plplot.svn.sourceforge.net/plplot/?rev=11431&view=rev Author: airwin Date: 2011-01-03 07:38:30 +0000 (Mon, 03 Jan 2011) Log Message: ----------- Implement plgriddata-related wrappers. This allows octave example 21 to work and give consistent results with the C equivalent. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.i trunk/plplot_test/test_octave.sh.in Modified: trunk/bindings/octave/plplot_octave.i =================================================================== --- trunk/bindings/octave/plplot_octave.i 2011-01-03 07:09:36 UTC (rev 11430) +++ trunk/bindings/octave/plplot_octave.i 2011-01-03 07:38:30 UTC (rev 11431) @@ -435,10 +435,21 @@ %typemap(freearg) PLFLT *MatrixCk {} -/* Set Y length for later consistency checking, with trailing count */ -/* and 2D array, check for consistency input / output version */ -%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) (Matrix temp) {} -%typemap(argout) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) {} +// Set Y length for later consistency checking, with trailing count +// and 2D array, check for consistency input / output version +%typemap(in) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) (Matrix temp, octave_value_list retval) { + if ( _n_dims($input) > 1 ) + { error("argument must be a scalar or vector"); SWIG_fail; } + temp = $input.matrix_value(); + $1 = &temp(0,0); + $2 = Ylen = (PLINT)(_dim($input, 0)); + retval(0)=octave_value(Matrix(Xlen, Ylen)); + $3 = (PLFLT *)retval(0).matrix_value().data(); + +} +%typemap(argout) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) { + $result = SWIG_Octave_AppendOutput($result, retval$argnum(0)); +} %typemap(freearg) (PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk) {} @@ -696,12 +707,8 @@ *( zg + nptsx * j + i ) = zgg[i][j]; } %} -void my_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, int npts, - PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, - PLFLT *zg, int type, PLFLT data ); -void -my_plgriddata( PLFLT *Array, PLFLT *ArrayCk, PLFLT *ArrayCk, PLINT n, +void my_plgriddata( PLFLT *Array, PLFLT *ArrayCk, PLFLT *ArrayCk, PLINT n, PLFLT *ArrayX, PLINT nx, PLFLT *ArrayY, PLINT ny, PLFLT *OutMatrixCk, PLINT type, PLFLT data ); Modified: trunk/plplot_test/test_octave.sh.in =================================================================== --- trunk/plplot_test/test_octave.sh.in 2011-01-03 07:09:36 UTC (rev 11430) +++ trunk/plplot_test/test_octave.sh.in 2011-01-03 07:38:30 UTC (rev 11431) @@ -78,7 +78,7 @@ # 21: plgriddata and 3D plots # 22: plvector related wrappers. # until typemaps for swig-generated interface are done. -@swig_octave_comment@for i=[1:18 20 22:31] ; +@swig_octave_comment@for i=[1:18 20:31] ; @matwrap_octave_comment@for i=[1:18 20:31 ] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2011-01-03 08:16:39
|
Revision: 11433 http://plplot.svn.sourceforge.net/plplot/?rev=11433&view=rev Author: arjenmarkus Date: 2011-01-03 08:16:30 +0000 (Mon, 03 Jan 2011) Log Message: ----------- Fixed an omission in tkwin.c noted by David McMahon (npts instead of pls->dev_npts). Added a clarifying comment by Jos?\195?\169 Luis Garc?\195?\173a Pallero to c_plfill() and c_plfill3(). Added a description of the improvement initiated by Jos?\195?\169 to the release notes (2.46). Modified Paths: -------------- trunk/README.release trunk/drivers/tkwin.c trunk/src/plfill.c Modified: trunk/README.release =================================================================== --- trunk/README.release 2011-01-03 07:45:09 UTC (rev 11432) +++ trunk/README.release 2011-01-03 08:16:30 UTC (rev 11433) @@ -1,8 +1,8 @@ PLplot Release 5.9.8 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts -of the community to improve the PLplot plotting package. Development -releases in the 5.9.x series will be available every few months. The next +of the community to improve the PLplot plotting package. Development +releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the @@ -169,9 +169,9 @@ XVIII. As of release 5.9.6 we have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard -for PLplot for some time. If numpy is not present PLplot will now +for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the -short term then set USE_NUMERIC to ON in cmake. The PLplot support +short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. XIX. As of release 5.9.8, and for unicode-aware devices we now follow @@ -209,9 +209,9 @@ 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements -2.4 Implement build-system infrastructure for installed Ada bindings and +2.4 Implement build-system infrastructure for installed Ada bindings and examples -2.5 Code cleanup +2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions @@ -277,7 +277,7 @@ 0. Tests made for release 5.9.8 -See +See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports for a summary table of all testing done for PLplot-5.9.8. @@ -298,10 +298,10 @@ Ctest will now work correctly when the build tree path includes symlinks. -Dependencies for swig generated files fixed so they are not rebuilt every +Dependencies for swig generated files fixed so they are not rebuilt every time make is called. -Various dependency fixes to ensure that parallel builds (using make -j) +Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements @@ -313,7 +313,7 @@ build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. -2.4 Implement build-system infrastructure for installed Ada bindings and +2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library @@ -323,29 +323,29 @@ 2.5 Code cleanup -The PLplot source code has been cleaned up to make consistent use of -(const char *) and (char *) throughout. Some API functions have changed -to use const char * instead of char * to make it clear that the strings +The PLplot source code has been cleaned up to make consistent use of +(const char *) and (char *) throughout. Some API functions have changed +to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated -consistent with this. These changes fix a large number of warnings -with gcc-4.2. Note: this should not require programs using PLplot to be +consistent with this. These changes fix a large number of warnings +with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes - -PLplot now allows date / time labels to be used on axes. A new option -('d') is available for the xopt and yopt arguments to plbox which + +PLplot now allows date / time labels to be used on axes. A new option +('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly -there is a new range of options for plenv to select date / time labels. -The time format is seconds since the epoch (usually 1 Jan 1970). This -format is commonly used on most systems. The C gmtime routine can be -used to calculate this for a given date and time. The format for the -labels is controlled using a new pltimefmt function, which takes a -format string. All formatting is done using the C strftime function. -See documentation for available options on your platform. Example 29 +there is a new range of options for plenv to select date / time labels. +The time format is seconds since the epoch (usually 1 Jan 1970). This +format is commonly used on most systems. The C gmtime routine can be +used to calculate this for a given date and time. The format for the +labels is controlled using a new pltimefmt function, which takes a +format string. All formatting is done using the C strftime function. +See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from @@ -357,7 +357,7 @@ versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language -bindings. +bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be @@ -372,21 +372,21 @@ name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha -values. This change should have no effect on the device drivers that do not +values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and -aquaterm drivers support alpha values. There are some limitations with the gd +aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range -of the plotted values to be altered. Example 20 has been modified to -demonstrate this new functionality. +of the plotted values to be altered. Example 20 has been modified to +demonstrate this new functionality. -To ensure consistent results in example 21 between different platforms and +To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within -the library. plrandd will return a PLFLT random number in the range 0.0-1.0. +the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device @@ -400,9 +400,9 @@ 2.10 Improvements to the cairo driver family -Jonathan Woithe improved the xcairo driver so that it can optionally be -used with an external user supplied X Drawable. This enables a nice -separation of graphing (PLplot) and window management (Gtk, etc..). Doug +Jonathan Woithe improved the xcairo driver so that it can optionally be +used with an external user supplied X Drawable. This enables a nice +separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. @@ -439,14 +439,14 @@ fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font -may be used only for symbols. Output can now be compressed, resulting in +may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) - + 2.13 svg driver improvements This device driver has had the following improvements: schema for generated @@ -457,7 +457,7 @@ implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now -applied. +applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be @@ -508,15 +508,15 @@ 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to -date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, -Perl/PDL, Python, and Tcl now all support the common PLplot API (with the -exception of the mapping functions which are not yet implemented for all -bindings due to technical issues.) This is a significant step forward for +date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, +Perl/PDL, Python, and Tcl now all support the common PLplot API (with the +exception of the mapping functions which are not yet implemented for all +bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples -To help test the updates to the language bindings the examples have been +To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping @@ -526,10 +526,10 @@ errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. -Also new is an option for the plplot_test.sh script to run the examples +Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The -default it to use the valgrind memory checker. This has highlighted at -least one memory leaks in PLplot which have been fixed. It is not part +default it to use the valgrind memory checker. This has highlighted at +least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. @@ -539,10 +539,10 @@ stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 -and 17 in the test suite and other recent extensions of the other -examples we now have rigourous testing in place for almost the entirety -of our common API. This extensive testing framework has already helped -us track down a number of bugs, and it should make it much easier for us +and 17 in the test suite and other recent extensions of the other +examples we now have rigourous testing in place for almost the entirety +of our common API. This extensive testing framework has already helped +us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test @@ -559,7 +559,7 @@ 2.22 Internal changes to function visibility -The internal definitions of functions in PLplot have been significantly +The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this @@ -576,16 +576,16 @@ 2.24 Documentation updates -The DocBook documentation has been updated to include many of the -C-specific functions (for example plAlloc2dGrid) which are not part -of the common API, but are used in the examples and may be helpful +The DocBook documentation has been updated to include many of the +C-specific functions (for example plAlloc2dGrid) which are not part +of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). -PLplot has long had a cgm device driver which depended on the (mostly) +PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience @@ -693,9 +693,9 @@ 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. -Line plotting (plline etc) and image plotting (plimage, plimagefr) will -now ignore NaN / Inf values. Currently some of the contour plotting / 3-d -routines do not handle NaN / Inf values. This functionality will +Line plotting (plline etc) and image plotting (plimage, plimagefr) will +now ignore NaN / Inf values. Currently some of the contour plotting / 3-d +routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes @@ -711,12 +711,12 @@ 2.32 Cairo driver improvements -Improvements to the cairo driver to give better results for bitmap +Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes -Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot +Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not @@ -738,7 +738,7 @@ specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the -plplot-source/data directory or the PLplot installed directory +plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is @@ -753,7 +753,7 @@ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result -even when there was a working compiler. +even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new @@ -868,14 +868,14 @@ 2.41 Support for arbitrary storage of 2D user data -This improvement courtesy of David MacMahon adds support for arbitrary -storage of 2D user data. This is very similar to the technique employed -by some existing functions (e.g. plfcont and plfshade) that use "evaluator" -functions to access 2D user data that is stored in an arbtrary format. -The new approach extends the concept of a user-supplied (or predefined) -"evaluator" function to a group of user-supplied (or predefined) "operator" -functions. The operator functions provide for various operations on the -arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, +This improvement courtesy of David MacMahon adds support for arbitrary +storage of 2D user data. This is very similar to the technique employed +by some existing functions (e.g. plfcont and plfshade) that use "evaluator" +functions to access 2D user data that is stored in an arbtrary format. +The new approach extends the concept of a user-supplied (or predefined) +"evaluator" function to a group of user-supplied (or predefined) "operator" +functions. The operator functions provide for various operations on the +arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via @@ -987,3 +987,13 @@ alternative d compiler (the Digital Mars compiler is reported to be good). +2.46 Support large polygons + +Previous releases had an implicit limitation with respect to the +number of vertices in a polygon. This was due to the use of statically +defined arrays (to avoid allocating and freeing memory for each polygon +to be drawn). Jos\xE9 Luis Garc\xEDa Pallero found this limitation and +provided patches to eliminate this limitation. The strategy is +that for small polygons, the original statically defined arrays +are used and for large polygons new arrays are allocated and freed. +This strategy has been applied to all relevant source files. Modified: trunk/drivers/tkwin.c =================================================================== --- trunk/drivers/tkwin.c 2011-01-03 07:45:09 UTC (rev 11432) +++ trunk/drivers/tkwin.c 2011-01-03 08:16:30 UTC (rev 11433) @@ -856,7 +856,7 @@ if ( pls->dev_npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + pts = (XPoint *) malloc( sizeof(XPoint) * pls->dev_npts ); } else { Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2011-01-03 07:45:09 UTC (rev 11432) +++ trunk/src/plfill.c 2011-01-03 08:16:30 UTC (rev 11433) @@ -122,7 +122,9 @@ // void plfill() // // Pattern fills the polygon bounded by the input points. -// If hardware fill is used, a maximum of PL_MAXPOLY-1 vertices is allowed. +// For a number of vertices greater than PL_MAXPOLY-1, memory is managed via +// malloc/free. Otherwise statically defined arrays of length PL_MAXPOLY +// are used. // The final point is explicitly added if it doesn't match up to the first, // to prevent clipping problems. //-------------------------------------------------------------------------- @@ -190,7 +192,9 @@ // void plfill3() // // Pattern fills the polygon in 3d bounded by the input points. -// If hardware fill is used, a maximum of PL_MAXPOLY-1 vertices is allowed. +// For a number of vertices greater than PL_MAXPOLY-1, memory is managed via +// malloc/free. Otherwise statically defined arrays of length PL_MAXPOLY +// are used. // The final point is explicitly added if it doesn't match up to the first, // to prevent clipping problems. //-------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2011-01-10 21:59:37
|
Revision: 11465 http://plplot.svn.sourceforge.net/plplot/?rev=11465&view=rev Author: andrewross Date: 2011-01-10 21:59:30 +0000 (Mon, 10 Jan 2011) Log Message: ----------- Various formatting changes for recent commits thanks to uncrustify. Modified Paths: -------------- trunk/bindings/ocaml/plplot_impl.c trunk/bindings/tcl/tclAPI.c trunk/bindings/tcl/tclMain.c trunk/bindings/tk/plr.c trunk/drivers/tkwin.c trunk/drivers/xwin.c trunk/examples/c/x27c.c trunk/examples/c/x33c.c trunk/include/plplot.h trunk/src/plbox.c trunk/src/plbuf.c trunk/src/plfill.c trunk/src/plgradient.c trunk/src/pllegend.c trunk/src/plot3d.c trunk/utils/plrender.c trunk/utils/pltcl.c Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/bindings/ocaml/plplot_impl.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -746,10 +746,10 @@ case 3: translated_option = PL_LEGEND_SYMBOL; break; case 4: translated_option = PL_LEGEND_TEXT_LEFT; break; case 5: translated_option = PL_LEGEND_BACKGROUND; break; - case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break; - case 7: translated_option = PL_LEGEND_ROW_MAJOR; break; - case 8: translated_option = PL_LEGEND_LEFT; break; - case 9: translated_option = PL_LEGEND_RIGHT; break; + case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break; + case 7: translated_option = PL_LEGEND_ROW_MAJOR; break; + case 8: translated_option = PL_LEGEND_LEFT; break; + case 9: translated_option = PL_LEGEND_RIGHT; break; case 10: translated_option = PL_LEGEND_UPPER; break; case 11: translated_option = PL_LEGEND_LOWER; break; case 12: translated_option = PL_LEGEND_INSIDE; break; @@ -775,10 +775,10 @@ CAMLparam5( opt, x, y, plot_width, bg_color ); CAMLxparam5( bb_color, bb_style, nrow, ncolumn, opt_array ); CAMLxparam5( text_offset, text_scale, text_spacing, text_justification, - text_colors ); + text_colors ); CAMLxparam5( text, box_colors, box_patterns, box_scales, box_line_widths ); CAMLxparam5( line_colors, line_styles, line_widths, symbol_colors, - symbol_scales ); + symbol_scales ); CAMLxparam2( symbol_numbers, symbols ); CAMLlocal1( result ); result = caml_alloc( 2, 0 ); @@ -822,19 +822,19 @@ PLFLT width, height; pllegend( &width, &height, c_opt, Double_val( x ), Double_val( y ), - Double_val( plot_width ), Int_val( bg_color ), - Int_val( bb_color ), Int_val( bb_style ), - Int_val( nrow ), Int_val( ncolumn ), - n_legend, c_opt_array, - Double_val( text_offset ), Double_val( text_scale ), - Double_val( text_spacing ), - Double_val( text_justification ), - c_text_colors, c_text, - c_box_colors, c_box_patterns, (double *) box_scales, - c_box_line_widths, - c_line_colors, c_line_styles, c_line_widths, - c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, - c_symbols ); + Double_val( plot_width ), Int_val( bg_color ), + Int_val( bb_color ), Int_val( bb_style ), + Int_val( nrow ), Int_val( ncolumn ), + n_legend, c_opt_array, + Double_val( text_offset ), Double_val( text_scale ), + Double_val( text_spacing ), + Double_val( text_justification ), + c_text_colors, c_text, + c_box_colors, c_box_patterns, (double *) box_scales, + c_box_line_widths, + c_line_colors, c_line_styles, c_line_widths, + c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, + c_symbols ); // Return a tuple with the legend's size Store_field( result, 0, caml_copy_double( width ) ); Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/bindings/tcl/tclAPI.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -626,7 +626,7 @@ if ( Tcl_ExprBoolean( interp, argv[1], &result ) ) { fprintf( stderr, "wait_until command \"%s\" failed:\n\t %s\n", - argv[1], Tcl_GetStringResult(interp) ); + argv[1], Tcl_GetStringResult( interp ) ); break; } if ( result ) @@ -788,7 +788,7 @@ if ( result != TCL_OK ) { fprintf( stderr, "TCL command \"%s\" failed:\n\t %s\n", - cmd, Tcl_GetStringResult(interp) ); + cmd, Tcl_GetStringResult( interp ) ); } return result; } Modified: trunk/bindings/tcl/tclMain.c =================================================================== --- trunk/bindings/tcl/tclMain.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/bindings/tcl/tclMain.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -312,7 +312,7 @@ code = Tcl_VarEval( interp, tclStartupScript, (char *) NULL ); if ( code != TCL_OK ) { - fprintf( stderr, "%s\n", Tcl_GetStringResult(interp) ); + fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); exitCode = 1; } } Modified: trunk/bindings/tk/plr.c =================================================================== --- trunk/bindings/tk/plr.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/bindings/tk/plr.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -329,8 +329,8 @@ if ( n > PL_MAXPOLY ) { - xs = (short *) malloc( sizeof(short) * n ); - ys = (short *) malloc( sizeof(short) * n ); + xs = (short *) malloc( sizeof ( short ) * n ); + ys = (short *) malloc( sizeof ( short ) * n ); } else { Modified: trunk/drivers/tkwin.c =================================================================== --- trunk/drivers/tkwin.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/drivers/tkwin.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -487,15 +487,15 @@ TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; PLINT i; - XPoint _pts[PL_MAXPOLY]; - XPoint *pts; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; if ( dev->flags & 1 ) return; if ( npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + pts = (XPoint *) malloc( sizeof ( XPoint ) * npts ); } else { @@ -850,13 +850,13 @@ { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; - XPoint _pts[PL_MAXPOLY]; - XPoint *pts; + XPoint _pts[PL_MAXPOLY]; + XPoint *pts; int i; if ( pls->dev_npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * pls->dev_npts ); + pts = (XPoint *) malloc( sizeof ( XPoint ) * pls->dev_npts ); } else { Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/drivers/xwin.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -426,7 +426,7 @@ if ( npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * npts ); + pts = (XPoint *) malloc( sizeof ( XPoint ) * npts ); } else { @@ -848,7 +848,7 @@ if ( pls->dev_npts > PL_MAXPOLY ) { - pts = (XPoint *) malloc( sizeof(XPoint) * pls->dev_npts ); + pts = (XPoint *) malloc( sizeof ( XPoint ) * pls->dev_npts ); } else { Modified: trunk/examples/c/x27c.c =================================================================== --- trunk/examples/c/x27c.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/examples/c/x27c.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -188,7 +188,9 @@ if ( fill ) { plfill( 1 + steps * windings, xcoord, ycoord ); - } else { + } + else + { plline( 1 + steps * windings, xcoord, ycoord ); } } Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/examples/c/x33c.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -68,12 +68,12 @@ plspal1( "cmap1_blue_red.pal", 1 ); PLFLT colors[n]; - int i; + int i; PLFLT color_step; - color_step = 1.0 / (PLFLT)(n - 1); + color_step = 1.0 / (PLFLT) ( n - 1 ); for ( i = 0; i < n; i++ ) { - colors[i] = 0.0 + color_step * (PLFLT)( i ); + colors[i] = 0.0 + color_step * (PLFLT) ( i ); } PLINT opt; @@ -101,33 +101,33 @@ } plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, High Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_1, "Test label - Left, High Cap", + n, colors, values ); opt = PL_COLORBAR_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, Low Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_1, "Test label - Right, Low Cap", + n, colors, values ); opt = PL_COLORBAR_UPPER | bar_type | PL_COLORBAR_LABEL_UPPER | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, High Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_2, "Test label - Upper, High Cap", + n, colors, values ); opt = PL_COLORBAR_LOWER | bar_type | PL_COLORBAR_LABEL_LOWER | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, Low Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_2, "Test label - Lower, Low Cap", + n, colors, values ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); @@ -142,12 +142,12 @@ plspal1( "cmap1_blue_yellow.pal", 1 ); PLFLT colors[n]; - int i; + int i; PLFLT color_step; - color_step = 1.0 / (PLFLT)(n - 1); + color_step = 1.0 / (PLFLT) ( n - 1 ); for ( i = 0; i < n; i++ ) { - colors[i] = 0.0 + color_step * (PLFLT)( i ); + colors[i] = 0.0 + color_step * (PLFLT) ( i ); } PLINT opt; @@ -175,33 +175,33 @@ } plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Left, Low Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_1, "Test label - Left, Low Cap", + n, colors, values ); opt = PL_COLORBAR_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_1, "Test label - Right, High Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_1, "Test label - Right, High Cap", + n, colors, values ); opt = PL_COLORBAR_UPPER | bar_type | PL_COLORBAR_LABEL_UPPER | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Upper, Low Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_2, "Test label - Upper, Low Cap", + n, colors, values ); opt = PL_COLORBAR_LOWER | bar_type | PL_COLORBAR_LABEL_LOWER | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, - ticks, sub_ticks, - axis_opts_2, "Test label - Lower, High Cap", - n, colors, values ); + ticks, sub_ticks, + axis_opts_2, "Test label - Lower, High Cap", + n, colors, values ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); @@ -751,19 +751,19 @@ max_height = MAX( max_height, legend_height ); // Color bar examples - PLFLT values_small[2] = { 0.0, 1.0 }; + PLFLT values_small[2] = { 0.0, 1.0 }; PLFLT values_uneven[9] = { 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; - PLFLT values_even[9] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + PLFLT values_even[9] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; plcolorbar_example_1( PL_COLORBAR_IMAGE, 0.0, 0, 2, values_small, "Image Color Bars" ); plcolorbar_example_2( PL_COLORBAR_IMAGE, 0.0, 0, 2, values_small, "Image Color Bars" ); plcolorbar_example_1( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0.0, 0, 9, values_uneven, - "Shade Color Bars - Uneven Steps" ); + "Shade Color Bars - Uneven Steps" ); plcolorbar_example_2( PL_COLORBAR_SHADE, 3.0, 3, 9, values_even, - "Shade Color Bars - Even Steps" ); + "Shade Color Bars - Even Steps" ); plcolorbar_example_1( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, - "Gradient Color Bars" ); + "Gradient Color Bars" ); plcolorbar_example_2( PL_COLORBAR_GRADIENT, 0.5, 5, 2, values_small, - "Gradient Color Bars" ); + "Gradient Color Bars" ); // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/include/plplot.h 2011-01-10 21:59:30 UTC (rev 11465) @@ -1212,36 +1212,36 @@ // Routine for drawing line, symbol, or cmap0 legends // Flags for pllegend. -#define PL_LEGEND_NONE 1 -#define PL_LEGEND_COLOR_BOX 2 -#define PL_LEGEND_LINE 4 -#define PL_LEGEND_SYMBOL 8 -#define PL_LEGEND_TEXT_LEFT 16 -#define PL_LEGEND_BACKGROUND 32 -#define PL_LEGEND_BOUNDING_BOX 64 -#define PL_LEGEND_ROW_MAJOR 128 -#define PL_LEGEND_LEFT 256 -#define PL_LEGEND_RIGHT 512 -#define PL_LEGEND_UPPER 1024 -#define PL_LEGEND_LOWER 2048 -#define PL_LEGEND_INSIDE 4096 -#define PL_LEGEND_OUTSIDE 8192 +#define PL_LEGEND_NONE 1 +#define PL_LEGEND_COLOR_BOX 2 +#define PL_LEGEND_LINE 4 +#define PL_LEGEND_SYMBOL 8 +#define PL_LEGEND_TEXT_LEFT 16 +#define PL_LEGEND_BACKGROUND 32 +#define PL_LEGEND_BOUNDING_BOX 64 +#define PL_LEGEND_ROW_MAJOR 128 +#define PL_LEGEND_LEFT 256 +#define PL_LEGEND_RIGHT 512 +#define PL_LEGEND_UPPER 1024 +#define PL_LEGEND_LOWER 2048 +#define PL_LEGEND_INSIDE 4096 +#define PL_LEGEND_OUTSIDE 8192 // Flags for plcolorbar -#define PL_COLORBAR_LEFT 1 -#define PL_COLORBAR_RIGHT 2 -#define PL_COLORBAR_UPPER 4 -#define PL_COLORBAR_LOWER 8 -#define PL_COLORBAR_LABEL_LEFT 16 -#define PL_COLORBAR_LABEL_RIGHT 32 -#define PL_COLORBAR_LABEL_UPPER 64 -#define PL_COLORBAR_LABEL_LOWER 128 -#define PL_COLORBAR_IMAGE 256 -#define PL_COLORBAR_SHADE 512 -#define PL_COLORBAR_GRADIENT 1024 -#define PL_COLORBAR_CAP_LOW 2048 -#define PL_COLORBAR_CAP_HIGH 4096 -#define PL_COLORBAR_SHADE_LABEL 8192 +#define PL_COLORBAR_LEFT 1 +#define PL_COLORBAR_RIGHT 2 +#define PL_COLORBAR_UPPER 4 +#define PL_COLORBAR_LOWER 8 +#define PL_COLORBAR_LABEL_LEFT 16 +#define PL_COLORBAR_LABEL_RIGHT 32 +#define PL_COLORBAR_LABEL_UPPER 64 +#define PL_COLORBAR_LABEL_LOWER 128 +#define PL_COLORBAR_IMAGE 256 +#define PL_COLORBAR_SHADE 512 +#define PL_COLORBAR_GRADIENT 1024 +#define PL_COLORBAR_CAP_LOW 2048 +#define PL_COLORBAR_CAP_HIGH 4096 +#define PL_COLORBAR_SHADE_LABEL 8192 PLDLLIMPEXP void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/plbox.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -1525,11 +1525,11 @@ PLFLT pos, tn, offset, height, just; PLFLT factor, tstart; const char *timefmt; - PLINT i; - PLINT xdigmax, xdigits, xdigmax_old, xdigits_old; - PLINT ydigmax, ydigits, ydigmax_old, ydigits_old; - PLINT lxmin, lxmax, lymin, lymax; - PLINT pxmin, pxmax, pymin, pymax; + PLINT i; + PLINT xdigmax, xdigits, xdigmax_old, xdigits_old; + PLINT ydigmax, ydigits, ydigmax_old, ydigits_old; + PLINT lxmin, lxmax, lymin, lymax; + PLINT pxmin, pxmax, pymin, pymax; // Save some parameters plgxax( &xdigmax, &xdigits ); @@ -1590,7 +1590,7 @@ for ( i = 1; i < n_xticks; i++ ) { x_spacing_tmp = fabs( xticks[i] - xticks[i - 1] ); - x_spacing = MIN( x_spacing, x_spacing_tmp ); + x_spacing = MIN( x_spacing, x_spacing_tmp ); } } @@ -1669,7 +1669,7 @@ for ( i = 1; i < n_yticks; i++ ) { y_spacing_tmp = fabs( yticks[i] - yticks[i - 1] ); - y_spacing = MIN( y_spacing, y_spacing_tmp ); + y_spacing = MIN( y_spacing, y_spacing_tmp ); } } @@ -1807,13 +1807,13 @@ void plP_default_label( PLINT axis, PLFLT value, char *string, PLINT len, void *data ) { - PLINT scale, prec; + PLINT scale, prec; PLINT setpre, precis; char form[FORMAT_LEN], temp[TEMP_LEN]; double scale2; - scale = ((PLINT *)data)[0]; - prec = ((PLINT *)data)[1]; + scale = ( (PLINT *) data )[0]; + prec = ( (PLINT *) data )[1]; plP_gprec( &setpre, &precis ); @@ -1894,7 +1894,7 @@ { // Linear PLINT scale_prec[2] = { scale, prec }; - plP_default_label( axis, value, string, len, (void *)scale_prec ); + plP_default_label( axis, value, string, len, (void *) scale_prec ); } } } Modified: trunk/src/plbuf.c =================================================================== --- trunk/src/plbuf.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/plbuf.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -498,11 +498,12 @@ rd_data( pls, &npts, sizeof ( PLINT ) ); - if ( npts > PL_MAXPOLY ) { - xpl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); - ypl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + if ( npts > PL_MAXPOLY ) + { + xpl = (short *) malloc( ( npts + 1 ) * sizeof ( PLINT ) ); + ypl = (short *) malloc( ( npts + 1 ) * sizeof ( PLINT ) ); - if (( xpl == NULL ) || ( ypl == NULL )) + if ( ( xpl == NULL ) || ( ypl == NULL ) ) { plexit( "rdbuf_polyline: Insufficient memory for large polyline" ); } @@ -521,8 +522,8 @@ if ( npts > PL_MAXPOLY ) { - free(xpl); - free(ypl); + free( xpl ); + free( ypl ); } } @@ -733,11 +734,12 @@ rd_data( pls, &npts, sizeof ( PLINT ) ); - if ( npts > PL_MAXPOLY ) { - xpl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); - ypl = (short *) malloc( ( npts + 1 ) * sizeof( PLINT ) ); + if ( npts > PL_MAXPOLY ) + { + xpl = (short *) malloc( ( npts + 1 ) * sizeof ( PLINT ) ); + ypl = (short *) malloc( ( npts + 1 ) * sizeof ( PLINT ) ); - if (( xpl == NULL ) || ( ypl == NULL )) + if ( ( xpl == NULL ) || ( ypl == NULL ) ) { plexit( "rdbuf_polyline: Insufficient memory for large polyline" ); } @@ -755,8 +757,8 @@ if ( npts > PL_MAXPOLY ) { - free(xpl); - free(ypl); + free( xpl ); + free( ypl ); } } Modified: trunk/src/plfill.c =================================================================== --- trunk/src/plfill.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/plfill.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -149,10 +149,10 @@ } if ( n > PL_MAXPOLY - 1 ) { - xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); - ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); - if (( xpoly == NULL ) || ( ypoly == NULL )) + if ( ( xpoly == NULL ) || ( ypoly == NULL ) ) { plexit( "plfill: Insufficient memory for large polygon" ); } @@ -183,8 +183,8 @@ if ( n > PL_MAXPOLY - 1 ) { - free(xpoly); - free(ypoly); + free( xpoly ); + free( ypoly ); } } @@ -225,23 +225,23 @@ npts = n; if ( n > PL_MAXPOLY - 1 ) { - tx = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); - ty = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); - ty = (PLFLT *) malloc( ( n + 1 ) * sizeof( PLFLT ) ); - xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); - ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + tx = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); + ty = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); + ty = (PLFLT *) malloc( ( n + 1 ) * sizeof ( PLFLT ) ); + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); - if (( tx == NULL ) || ( ty == NULL ) || ( tz == NULL ) || - ( xpoly == NULL ) || ( ypoly == NULL )) + if ( ( tx == NULL ) || ( ty == NULL ) || ( tz == NULL ) || + ( xpoly == NULL ) || ( ypoly == NULL ) ) { plexit( "plfill3: Insufficient memory for large polygon" ); } } else { - tx = _tx; - ty = _ty; - tz = _tz; + tx = _tx; + ty = _ty; + tz = _tz; xpoly = _xpoly; ypoly = _ypoly; } @@ -290,11 +290,11 @@ // If the original number of points is large, then free the arrays if ( npts > PL_MAXPOLY - 1 ) { - free(tx); - free(ty); - free(tz); - free(xpoly); - free(ypoly); + free( tx ); + free( ty ); + free( tz ); + free( xpoly ); + free( ypoly ); } } Modified: trunk/src/plgradient.c =================================================================== --- trunk/src/plgradient.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/plgradient.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -131,10 +131,10 @@ npts = n; if ( n > PL_MAXPOLY - 1 ) { - xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); - ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof( PLINT ) ); + xpoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); + ypoly = (PLINT *) malloc( ( n + 1 ) * sizeof ( PLINT ) ); - if (( xpoly == NULL ) || ( ypoly == NULL )) + if ( ( xpoly == NULL ) || ( ypoly == NULL ) ) { plexit( "plgradient: Insufficient memory for large polygon" ); } @@ -165,8 +165,8 @@ // Check the original number of points if ( npts > PL_MAXPOLY - 1 ) { - free(xpoly); - free(ypoly); + free( xpoly ); + free( ypoly ); } } } @@ -251,7 +251,7 @@ // from 0. to 1. if ( ( edge = (PLFLT *) malloc( NEDGE * sizeof ( PLFLT ) ) ) == NULL ) plexit( "plgradient_soft: Insufficient memory for large polygon" -); + ); for ( i = 0; i < NEDGE; i++ ) edge[i] = (PLFLT) i / (PLFLT) ( NEDGE - 1 ); Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/pllegend.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -838,7 +838,7 @@ ys[0] = y; xs[2] = xs[0] + width; ys[2] = ys[0]; - xs[1] = (xs[0] + xs[2]) / 2.0; + xs[1] = ( xs[0] + xs[2] ) / 2.0; ys[1] = ys[0] - 0.05; plfill( 3, xs, ys ); @@ -854,7 +854,7 @@ xs[2] = xs[0]; ys[2] = ys[0] + width; xs[1] = xs[0] - 0.05; - ys[1] = (ys[0] + ys[2]) / 2.0; + ys[1] = ( ys[0] + ys[2] ) / 2.0; plfill( 3, xs, ys ); } @@ -871,7 +871,7 @@ ys[0] = y + length; xs[2] = xs[0] + width; ys[2] = ys[0]; - xs[1] = (xs[0] + xs[2]) / 2.0; + xs[1] = ( xs[0] + xs[2] ) / 2.0; ys[1] = ys[0] + 0.05; plfill( 3, xs, ys ); @@ -887,7 +887,7 @@ xs[2] = xs[0]; ys[2] = ys[0] + width; xs[1] = xs[0] + 0.05; - ys[1] = (ys[0] + ys[2]) / 2.0; + ys[1] = ( ys[0] + ys[2] ) / 2.0; plfill( 3, xs, ys ); } @@ -925,11 +925,11 @@ plgvpw( &xwmin_save, &xwmax_save, &ywmin_save, &ywmax_save ); // Active attributes to be saved and restored afterward. - PLINT col0_save = plsc->icol0; - PLFLT text_scale_save = plsc->chrht / plsc->chrdef; + PLINT col0_save = plsc->icol0; + PLFLT text_scale_save = plsc->chrht / plsc->chrdef; // Axis tick spacing - PLFLT maj_save = plsc->majht / plsc->majdef; - PLFLT min_save = plsc->minht / plsc->mindef; + PLFLT maj_save = plsc->majht / plsc->majdef; + PLFLT min_save = plsc->minht / plsc->mindef; // Position of the color bar in normalized viewport (= normalized subpage // coordinates). @@ -1006,8 +1006,8 @@ // Use the same number of steps as there are steps in // color palette 1. // TODO: Determine a better way to specify the steps here? - n_steps = plsc->ncol1; - step_size = ( max_value - min_value ) / (PLFLT)n_steps; + n_steps = plsc->ncol1; + step_size = ( max_value - min_value ) / (PLFLT) n_steps; if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) { ni = 2; @@ -1017,7 +1017,7 @@ { for ( j = 0; j < nj; j++ ) { - color_data[i][j] = min_value + (PLFLT)j * step_size; + color_data[i][j] = min_value + (PLFLT) j * step_size; } } } @@ -1030,7 +1030,7 @@ { for ( j = 0; j < nj; j++ ) { - color_data[i][j] = min_value + (PLFLT)i * step_size; + color_data[i][j] = min_value + (PLFLT) i * step_size; } } } @@ -1077,14 +1077,14 @@ } // Draw the color bar plimage( color_data, ni, nj, wx_min, wx_max, wy_min, wy_max, - min_value, max_value, wx_min, wx_max, wy_min, wy_max ); + min_value, max_value, wx_min, wx_max, wy_min, wy_max ); plFree2dGrid( color_data, ni, nj ); } else if ( opt & PL_COLORBAR_SHADE ) { // Transform grid PLcGrid grid; - PLFLT grid_axis[2] = { 0.0, 1.0 }; + PLFLT grid_axis[2] = { 0.0, 1.0 }; n_steps = n_colors; // Use the provided values. if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) @@ -1093,8 +1093,8 @@ grid.yg = values; grid.nx = 2; grid.ny = n_steps; - ni = 2; - nj = n_steps; + ni = 2; + nj = n_steps; plAlloc2dGrid( &color_data, ni, nj ); for ( i = 0; i < ni; i++ ) { @@ -1110,8 +1110,8 @@ grid.yg = grid_axis; grid.nx = n_steps; grid.ny = 2; - ni = n_steps; - nj = 2; + ni = n_steps; + nj = 2; plAlloc2dGrid( &color_data, ni, nj ); for ( i = 0; i < ni; i++ ) { @@ -1128,8 +1128,8 @@ // Draw the color bar plshades( color_data, ni, nj, NULL, wx_min, wx_max, wy_min, wy_max, - values, n_colors, 0, 0, 0, plfill, TRUE, - pltr1, (void *)(&grid) ); + values, n_colors, 0, 0, 0, plfill, TRUE, + pltr1, (void *) ( &grid ) ); plFree2dGrid( color_data, ni, nj ); } else if ( opt & PL_COLORBAR_GRADIENT ) @@ -1199,12 +1199,12 @@ // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis - plsmaj( 0.0, 0.5); - plsmin( 0.0, 0.5); + plsmaj( 0.0, 0.5 ); + plsmin( 0.0, 0.5 ); // For building axis option string - PLINT max_opts = 25; - char opt_string[max_opts]; + PLINT max_opts = 25; + char opt_string[max_opts]; const char *tick_string; tick_string = ""; @@ -1216,14 +1216,14 @@ if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) { label_offset += 4.0; - perp = '\0'; + perp = '\0'; } else { label_offset += 1.5; - perp = 'v'; + perp = 'v'; } - snprintf( opt_string, max_opts, "l%c", perp); + snprintf( opt_string, max_opts, "l%c", perp ); plmtex( opt_string, label_offset, 0.5, 0.5, label ); } else if ( opt & PL_COLORBAR_LABEL_RIGHT ) @@ -1231,14 +1231,14 @@ if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) { label_offset += 4.0; - perp = '\0'; + perp = '\0'; } else { label_offset += 1.5; - perp = 'v'; + perp = 'v'; } - snprintf( opt_string, max_opts, "r%c", perp); + snprintf( opt_string, max_opts, "r%c", perp ); plmtex( opt_string, label_offset, 0.5, 0.5, label ); } else if ( opt & PL_COLORBAR_LABEL_UPPER ) @@ -1246,14 +1246,14 @@ if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) { label_offset += 1.5; - perp = 'v'; + perp = 'v'; } else { label_offset += 4.0; - perp = '\0'; + perp = '\0'; } - snprintf( opt_string, max_opts, "t%c", perp); + snprintf( opt_string, max_opts, "t%c", perp ); plmtex( opt_string, label_offset, 0.5, 0.5, label ); } else if ( opt & PL_COLORBAR_LABEL_LOWER ) @@ -1261,17 +1261,17 @@ if ( opt & PL_COLORBAR_RIGHT || opt & PL_COLORBAR_LEFT ) { label_offset += 1.5; - perp = 'v'; + perp = 'v'; } else { label_offset += 4.0; - perp = '\0'; + perp = '\0'; } snprintf( opt_string, max_opts, "b%c", perp ); plmtex( opt_string, label_offset, 0.5, 0.5, label ); } - + // Draw labels and tick marks if this is a shade color bar // TODO: A better way to handle this would be to update the // internals of plbox to support custom tick and label positions Modified: trunk/src/plot3d.c =================================================================== --- trunk/src/plot3d.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/src/plot3d.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -173,16 +173,17 @@ if ( Ni > PL_MAXPOLY ) { - in = (PLFLT *) malloc( sizeof(PLFLT) * Ni ); - TT = (PLFLT *) malloc( 3 * sizeof(PLFLT) * Ni ); + in = (PLFLT *) malloc( sizeof ( PLFLT ) * Ni ); + TT = (PLFLT *) malloc( 3 * sizeof ( PLFLT ) * Ni ); - if ( in == NULL || TT == NULL ) { - plexit("plP_clip_poly: insufficient memory for large polygon"); + if ( in == NULL || TT == NULL ) + { + plexit( "plP_clip_poly: insufficient memory for large polygon" ); } T[0] = &TT[0]; T[1] = &TT[Ni]; - T[2] = &TT[2*Ni]; + T[2] = &TT[2 * Ni]; } else { @@ -249,8 +250,8 @@ if ( Ni > PL_MAXPOLY ) { - free(in); - free(TT); + free( in ); + free( TT ); } return No; Modified: trunk/utils/plrender.c =================================================================== --- trunk/utils/plrender.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/utils/plrender.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -839,8 +839,8 @@ if ( n > PL_MAXPOLY ) { - xs = (short *) malloc( sizeof(short) * n ); - ys = (short *) malloc( sizeof(short) * n ); + xs = (short *) malloc( sizeof ( short ) * n ); + ys = (short *) malloc( sizeof ( short ) * n ); } else { Modified: trunk/utils/pltcl.c =================================================================== --- trunk/utils/pltcl.c 2011-01-10 21:58:27 UTC (rev 11464) +++ trunk/utils/pltcl.c 2011-01-10 21:59:30 UTC (rev 11465) @@ -72,9 +72,9 @@ // Print error message if one given - tmp=Tcl_GetStringResult(interp); + tmp = Tcl_GetStringResult( interp ); if ( tmp != NULL && tmp != '\0' ) - fprintf( stderr, "%s\n", Tcl_GetStringResult(interp)); + fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); plspause( 0 ); plend(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |