From: <ai...@us...> - 2009-04-26 01:49:28
|
Revision: 9854 http://plplot.svn.sourceforge.net/plplot/?rev=9854&view=rev Author: airwin Date: 2009-04-26 01:49:22 +0000 (Sun, 26 Apr 2009) Log Message: ----------- Second and fourth Tk examples will be ignored if Itk is not enabled. Modified Paths: -------------- trunk/cmake/modules/tcl-related.cmake trunk/examples/tk/CMakeLists.txt trunk/examples/tk/Makefile.examples.in trunk/plplot_test/plplot-test-interactive.sh.in Modified: trunk/cmake/modules/tcl-related.cmake =================================================================== --- trunk/cmake/modules/tcl-related.cmake 2009-04-26 01:20:41 UTC (rev 9853) +++ trunk/cmake/modules/tcl-related.cmake 2009-04-26 01:49:22 UTC (rev 9854) @@ -201,3 +201,6 @@ set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE) set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) endif(ENABLE_tcl) +if(NOT ENABLE_itk) + set(itk_true "#") +endif(NOT ENABLE_itk) Modified: trunk/examples/tk/CMakeLists.txt =================================================================== --- trunk/examples/tk/CMakeLists.txt 2009-04-26 01:20:41 UTC (rev 9853) +++ trunk/examples/tk/CMakeLists.txt 2009-04-26 01:49:22 UTC (rev 9854) @@ -110,21 +110,17 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tclIndex DESTINATION ${DATA_DIR}/examples/tk) -set(tk_SCRIPTS - tk01 - tk02 - tk03 - tk04 - ) +# The second and fourth Tk examples depend on Itk to work. +set(tk_SCRIPTS tk01 tk03) +set(tk_SRC xtk01.c) + +if(ENABLE_itk) + list(APPEND tk_SCRIPTS tk02 tk04) + list(APPEND tk_SRC xtk02.c xtk04.c) +endif(ENABLE_itk) install(PROGRAMS ${tk_SCRIPTS} DESTINATION ${DATA_DIR}/examples/tk) -set(tk_SRC - xtk01.c - xtk02.c - xtk04.c - ) - install(FILES ${tk_SRC} DESTINATION ${DATA_DIR}/examples/tk) set(CC ${CMAKE_C_COMPILER}) Modified: trunk/examples/tk/Makefile.examples.in =================================================================== --- trunk/examples/tk/Makefile.examples.in 2009-04-26 01:20:41 UTC (rev 9853) +++ trunk/examples/tk/Makefile.examples.in 2009-04-26 01:49:22 UTC (rev 9854) @@ -27,15 +27,14 @@ @pkg_config_true@PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ @pkg_config_true@RPATHCMD = @RPATHCMD@ -EXECUTABLES_list = \ - xtk01$(EXEEXT) \ - xtk02$(EXEEXT) \ - xtk04$(EXEEXT) +EXECUTABLES_list = xtk01$(EXEEXT) +# Second and fourth examples depend on itk. +@itk_true@itk_EXECUTABLES_list = xtk02$(EXEEXT) xtk04$(EXEEXT) -all: $(EXECUTABLES_list) +all: $(EXECUTABLES_list) $(itk_EXECUTABLES_list) clean: - rm -f $(EXECUTABLES_list) + rm -f $(EXECUTABLES_list) $(itk_EXECUTABLES_list) .c$(EXEEXT): @pkg_config_true@ $(CC) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config --cflags --libs plplot$(LIB_TAG)-tcl` Modified: trunk/plplot_test/plplot-test-interactive.sh.in =================================================================== --- trunk/plplot_test/plplot-test-interactive.sh.in 2009-04-26 01:20:41 UTC (rev 9853) +++ trunk/plplot_test/plplot-test-interactive.sh.in 2009-04-26 01:49:22 UTC (rev 9854) @@ -108,17 +108,23 @@ DIRECTORY[$COUNT]="tk" COMMAND[$COUNT]="./xtk01 -f tk01" COUNT=$(( $COUNT + 1 )) +fi +if [ "@ENABLE_itk@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="tk" COMMAND[$COUNT]="./xtk02 -f tk02" COUNT=$(( $COUNT + 1 )) +fi +if [ "@ENABLE_tk@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="tk" - COMMAND[$COUNT]="plserver -f tk03" + COMMAND[$COUNT]="plserver -f tk03" COUNT=$(( $COUNT + 1 )) +fi +if [ "@ENABLE_itk@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="tk" COMMAND[$COUNT]="./xtk04 -f tk04" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2009-05-03 21:03:20
|
Revision: 9894 http://plplot.svn.sourceforge.net/plplot/?rev=9894&view=rev Author: hbabcock Date: 2009-05-03 21:03:15 +0000 (Sun, 03 May 2009) Log Message: ----------- Updated for the 5.9.4 release. Modified Paths: -------------- trunk/OLD-README.release trunk/README.release Modified: trunk/OLD-README.release =================================================================== --- trunk/OLD-README.release 2009-05-03 20:00:32 UTC (rev 9893) +++ trunk/OLD-README.release 2009-05-03 21:03:15 UTC (rev 9894) @@ -1,3 +1,639 @@ +PLplot Release 5.9.3 +~~~~~~~~~~~~~~~~~~~~ +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 +stable release will be 5.10.0. + + If you encounter a problem that is not already documented in the +PROBLEMS file, then please send bug reports to PLplot developers via the +mailing lists at http://sourceforge.net/mail/?group_id=2915 . + + Please see the license under which this software is distributed +(LGPL), and the disclaimer of all warranties, given in the COPYING.LIB +file. + + +Notices for Users. + +I. This is the official notice that our deprecated autotools-based build +system has been removed as of release 5.9.1. Instead, use the CMake-based +build system following the directions in the INSTALL file. + +II. This is official notice that we (as of 5.9.1) no longer support +Octave-2.1.73 which has a variety of run-time issues in our tests of the +Octave examples on different platforms. In contrast our tests show we get +good run-time results with all our Octave examples for Octave-3.0.1. Also, +that is the recommended stable version of Octave at +http://www.gnu.org/software/octave/download.html so that is the only version +of Octave we support at this time. + +III. This is official notice that the PLplot team have decided (as of release +5.9.1) for consistency sake to change the PLplot stream variables +plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results +returned by plgvpw to reflect the exact window limit values input by users +using plwind. Previously to this change, the stream variables and the values +returned by plgvpw reflected the internal slightly expanded range of window +limits used by PLplot so that the user's specified limits would be on the +graph. Two users noted this slight difference, and we agree with them it +should not be there. Note that internally, PLplot still uses the expanded +ranges so most users results will be identical. However, you may notice +some small changes to your plot results if you use these stream variables +directly (only possible in C/C++) or use plgvpw. + +IV. This is official notice that (as of release 5.9.2) we have set +HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin +will follow later once it appears the Apple version of X supports it. + +V. This is official notice that (as of release 5.9.3) our build system +requires CMake version 2.6.0 or higher. + +VI. This is official notice that (as of release 5.9.3) we have deprecated +the gcw device driver and the related gnome2 and pygcw bindings since these +are essentially unmaintained. For example, the gcw device and associated +bindings still depends on the plfreetype approach for accessing unicode +fonts which has known issues (inconsistent text offsets, inconvenient font +setting capabilities, and incorrect rendering of CTL languages). To avoid +these issues we advise using the xcairo device and the externally supplied +XDrawable or Cairo context associated with the xcairo device and the +extcairo device (see examples/c/README.cairo) instead. If you still +absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite +the known problems, then they can still be accessed by setting PLD_gcw, +ENABLE_gnome2, and/or ENABLE_pygcw to ON. + +VII. This is official notice that (as of release 5.9.3) we have deprecated +the gd device driver which implements the png, jpeg, and gif devices. This +device driver is essentially unmaintained. For example, it still depends on +the plfreetype approach for accessing unicode fonts which has known issues +(inconsistent text offsets, inconvenient font setting capabilities, and +incorrect rendering of CTL languages). To avoid these issues for PNG +format, we advise using the pngcairo or pngqt devices. To avoid these +issues for the JPEG format, we advise using the jpgqt device. PNG is +normally considered a better raster format than GIF, but if you absolutely +require GIF format, we advise using the pngcairo or pngqt devices and then +downgrading the results to the GIF format using the ImageMagick "convert" +application. For those platforms where libgd (the dependency of the gd +device driver) is accessible while the required dependencies of the cairo +and/or qt devices are not accessible, you can still use these deprecated +devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. + +VIII. This is official notice that the tk, itk, and itcl components of +PLplot have been reenabled again by default (as of release 5.9.3) after +being disabled by default as of release 5.9.1 due to segfaults. The cause +of the segfaults was a bug (now fixed) in how pthread support was +implemented for the Tk-related components of PLplot. + +INDEX + +1. Changes relative to PLplot 5.9.2 (the previous development release) + +1.1 libnistcd (a.k.a. libcd) now built internally for -dev cgm +1.2 get-drv-info now changed to test-drv-info +1.3 Text clipping now enabled by default for the cairo devices +1.4 A powerful qt device driver has been implemented +1.5 The PLplot API is now accessible from Qt GUI applications +1.6 NaN / Inf support for some PLplot functions + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +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 +examples +2.5 Code cleanup +2.6 Date / time labels for axes +2.7 Alpha value support +2.8 New PLplot functions +2.9 External libLASi library improvements affecting our psttf device. +2.10 Improvements to the cairo driver family. +2.11 wxWidgets driver improvements +2.12 pdf driver improvements +2.13 svg driver improvements +2.14 Ada language support +2.15 OCaml language support +2.16 Perl/PDL language support +2.17 Update to various language bindings +2.18 Update to various examples +2.19 Extension of our test framework +2.20 Rename test subdirectory to plplot_test +2.21 Website support files updated +2.22 Internal changes to function visibility +2.23 Dynamic driver support in Windows +2.24 Documentation updates +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm +2.26 get-drv-info now changed to test-drv-info +2.27 Text clipping now enabled by default for the cairo devices +2.28 A powerful qt device driver has been implemented +2.29 The PLplot API is now accessible from Qt GUI applications +2.30 NaN / Inf support for some PLplot functions + +1. Changes relative to PLplot 5.9.2 (the previous development release) + +1.1 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) +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 +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +1.2 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +1.3 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +1.4 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overal sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. +Qt-4.5 has some essential SVG functionality so we recommend that +version (downloadable from http://www.qtsoftware.com/downloads for Linux, +Mac OS X, and Windows) for svgqt. Qt-4.5 is the version we have used for +most of our testing, but limited testing for Qt-4.4 indicates that version +should be fine for qt devices other than svgqt. + +1.5 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +1.6 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 +depend on whether the language binding used supports NaN / Inf values. + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed + +CMake (with the exception of a special build script for the DJGPP platform) +is now the only supported build system. It has been tested on Linux / Unix, +Mac OS-X and Windows platforms. + +2.2 Build system bug fixes + +Various fixes include the following: + +Ctest will now work correctly when the build tree path includes symlinks. + +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) +work under unix. + +2.3 Build system improvements + +We now transform link flag results delivered to the CMake environment by +pkg-config into the preferred CMake form of library information. The +practical effect of this improvement is that external libraries in +non-standard locations now have their rpath options set correctly for our +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 +examples + +Install source files, library information files, and the plplotada library +associated with the Ada bindings. Configure and install the pkg-config file +for the plplotada library. Install the Ada examples and a configured Makefile +to build them in the install tree. + +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 +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 +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 +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 +demonstrates the new capabilities. + +N.B. Our reliance on C library POSIX time routines to (1) convert from +broken-down time to time-epoch, (2) to convert from time-epoch to +broken-down time, and (3) to format results with strftime have proved +problematic for non-C languages which have time routines of variable +quality. Also, it is not clear that even the POSIX time routines are +available on Windows. So we have plans afoot to implement high-quality +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. + +WARNING..... Therefore, assuming these plans are implemented, the present +part of our date/time PLplot API that uses POSIX time routines will be +changed. + +2.7 Alpha value support + +PLplot core has been modified to support a transparency or alpha value +channel for each color in color map 0 and 1. In addition a number of new +functions were added the PLplot API so that the user can both set and query +alpha values for color in the two color maps. These functions have the same +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 +currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and +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. + +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. +plseed will allow the random number generator to be seeded. + +2.9 External libLASi library improvements affecting our psttf device. + +Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been +released at http://sourceforge.net/svn/?group_id=187113 . We recommend +using this latest version of libLASi for building PLplot and the psttf +device since this version of libLASi is more robust against glyph +information returned by pango/cairo/fontconfig that on rare occasions is not +suitable for use by libLASi. + +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 +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. + +2.11 wxWidgets driver improvements + +Complete reorganization of the driver code. A new backend was added, based +on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 +and later. This backend produces antialized output similar to the +AGG backend but has no dependency on the AGG library. The basic wxDC +backend and the wxGraphicsContext backend process the text output +on their own, which results in much nicer plots than with the standard +Hershey fonts and is much faster than using the freetype library. New +options were introduced in the wxWidgets driver: + - backend: Choose backend: (0) standard, (1) using AGG library, + (2) using wxGraphicsContext + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - text: Use own text routines (text=0|1) + - freetype: Use FreeType library (freetype=0|1) +The option "text" changed its meaning, since it enabled the FreeType library +support, while now the option enables the driver's own text routines. + +Some other features were added: + * the wxWidgets driver now correctly clears the background (or parts of it) + * transparency support was added + * the "locate mode" (already availale in the xwin and tk driver) was + implemented, where graphics input events are processed and translated + to world coordinates + +2.12 pdf driver improvements + +The pdf driver (which is based on the haru library http://www.libharu.org) +processes the text output now on its own. So far only the Adobe Type1 +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 +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 +file now validates properly at http://validator.w3.org/ for the +automatically detected document type of SVG 1.1; -geometry option now works; +alpha channel transparency has been implemented; file familying for +multipage examples has been implemented; coordinate scaling has been +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. + +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 +careful of which SVG viewer or editor you try because a number of them have +some bugs that need to be resolved. For example, there is a librsvg bug in +text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that +affects all svg use within GNOME as well as the ImageMagick "display" +application. However, at least the latest konqueror and firefox as well as +inkscape and scribus-ng (but not scribus!) give outstanding looking results +for files generated by our svg device driver. + +2.14 Ada language support + +We now have a complete Ada bindings implemented for PLplot. We also have a +complete set of our standard examples implemented in Ada which give results +that are identical with corresponding results for the C standard examples. +This is an excellent test of a large subset of the Ada bindings. We now +enable Ada by default for our users and request widespread testing of this +new feature. + +2.15 OCaml language support + +Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml +bindings implemented for PLplot. We also have a complete set of our standard +examples implemented in OCaml which give results that are identical with +corresponding results for the C standard examples. This is an excellent test +of a large subset of the OCaml bindings. We now enable OCaml by default for +our users and request widespread testing of this new feature. + +2.16 Perl/PDL language support + +Thanks to Doug Hunt's efforts the external Perl/PDL module, +PDL::Graphics::PLplot version 0.46 available at +http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date +to give access to recently added PLplot API. The instructions for how to +install this module on top of an offical PDL release are given in +examples/perl/README.perldemos. Doug has also finished implementing a +complete set of standard examples in Perl/PDL which are part of PLplot and +which produce identical results to their C counterparts if the above updated +module has been installed. Our build system tests the version of +PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the +list of Perl/PDL examples that are run as part of our standard tests is +substantially reduced to avoid examples that use the new functionality. In +sum, if you use PDL::Graphics::PLplot version 0.46 or later the full +complement of PLplot commands is available to you from Perl/PDL, but +otherwise not. + +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 +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 +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 +functions. The examples have also been checked to ensure consistent results +between different language bindings. Currently there are still some minor +differences in the results for the tcl examples, probably due to rounding +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 +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 +of the standard ctest tests because it can be _very_ slow for a complete +set of language bindings and device drivers. + +2.19 Extension of our test framework + +The standard test suite for PLplot now carries out a comparison of the +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 +to maintain high quality for our ongoing PLplot releases. + +2.20 Rename test subdirectory to plplot_test + +This change was necessary to quit clashing with the "make test" target which +now works for the first time ever (by executing ctest). + +2.21 Website support files updated + +Our new website content is generated with PHP and uses CSS (cascaded style +sheets) to implement a consistent style. This new approach demanded lots of +changes in the website support files that are used to generate and upload +our website and which are automatically included with the release. + +2.22 Internal changes to function visibility + +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 +on windows. + +2.23 Dynamic driver support in Windows + +An interface based on the ltdl library function calls was established +which allows to open and close dynamic link libraries (DLL) during +run-time and call functions from these libraries. As a consequence +drivers can now be compiled into single DLLs separate from the core +plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now +ON by default for Windows if a shared plplot library is built. + +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 +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) +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 +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +2.26 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +2.27 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +2.28 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overal sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. +Qt-4.5 has some essential SVG functionality so we recommend that +version (downloadable from http://www.qtsoftware.com/downloads for Linux, +Mac OS X, and Windows) for svgqt. Qt-4.5 is the version we have used for +most of our testing, but limited testing for Qt-4.4 indicates that version +should be fine for qt devices other than svgqt. + +2.29 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +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 +depend on whether the language binding used supports NaN / Inf values. + + PLplot Release 5.9.2 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts Modified: trunk/README.release =================================================================== --- trunk/README.release 2009-05-03 20:00:32 UTC (rev 9893) +++ trunk/README.release 2009-05-03 21:03:15 UTC (rev 9894) @@ -1,4 +1,4 @@ -PLplot Release 5.9.3 +PLplot Release 5.9.4 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development @@ -85,14 +85,8 @@ INDEX -1. Changes relative to PLplot 5.9.2 (the previous development release) +1. Changes relative to PLplot 5.9.3 (the previous development release) -1.1 libnistcd (a.k.a. libcd) now built internally for -dev cgm -1.2 get-drv-info now changed to test-drv-info -1.3 Text clipping now enabled by default for the cairo devices -1.4 A powerful qt device driver has been implemented -1.5 The PLplot API is now accessible from Qt GUI applications -1.6 NaN / Inf support for some PLplot functions 2. Changes relative to PLplot 5.8.0 (the previous stable release) @@ -128,111 +122,9 @@ 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions -1. Changes relative to PLplot 5.9.2 (the previous development release) -1.1 libnistcd (a.k.a. libcd) now built internally for -dev cgm +1. Changes relative to PLplot 5.9.3 (the previous development release) -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) -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 -to our -dev cgm users, we have brought that -source code in house under lib/nistcd and now build libnistcd routinely -as part of our ordinary builds. The only changes we have made to the -cd1.3 source code is visibility changes in cd.h and swapping the sense of -the return codes for the test executables so that 0 is returned on success -and 1 on failure. If you want to test libnistcd on your platform, -please run - -make test_nistcd - -in the top-level build tree. (That tests runs all the test executables -that are built as part of cd1.3 and compares the results that are generated -with the *.cgm files that are supplied as part of cd1.3.) - -Two applications that convert and/or display CGM results on Linux are -ralcgm (which is called by the ImageMagick convert and display applications) -and uniconvertor. - -Some additional work on -dev cgm is required to implement antialiasing and -non-Hershey fonts, but both those should be possible using libnistcd according -to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. - -1.2 get-drv-info now changed to test-drv-info - -To make cross-building much easier for PLplot we now configure the *.rc -files that are used to describe our various dynamic devices rather than -generating the required *.rc files with get-drv-info. We have changed the -name of get-drv-info to test-drv-info. That name is more appropriate -because that executable has always tested dynamic loading of the driver -plug-ins as well as generating the *.rc files from the information gleaned -from that dynamic loading. Now, we simply run test-drv-info as an option -(defaults to ON unless cross-building is enabled) and compare the resulting -*.rc file with the one configured by cmake to be sure the dynamic device -has been built correctly. - -1.3 Text clipping now enabled by default for the cairo devices - -When correct text clipping was first implemented for cairo devices, it was -discovered that the libcairo library of that era (2007-08) did that clipping -quite inefficiently so text clipping was disabled by default. Recent tests -of text clipping for the cairo devices using libcairo 1.6.4 (released in -2008-04) shows text clipping is quite efficient now. Therefore, it is now -enabled by default. If you notice a significant slowdown for some libcairo -version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for -your cairo device plots (and accept the improperly clipped text results that -might occur with that option). Better yet, use libcairo 1.6.4 or later. - -1.4 A powerful qt device driver has been implemented - -Thanks to the efforts of Alban Rochel of the QSAS team, we now have a qt -device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, -jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an -elementary interactive device where, for now, the possible interactions -consist of resizing the window and right clicking with the mouse to control -paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, -pngqt, ppmqt, and tiffqt are file devices whose overal sizes are specified -in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable -pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, -svgqt are file devices whose overall sizes are specified in points (1/72 of -an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG -formatted files. The qt device driver is based on the powerful facilities -of Qt4 so all qt devices implement variable opacity (alpha channel) effects -(see example 30). The qt devices also use system unicode fonts, and deal -with CTL (complex text layout) languages automatically without any -intervention required by the user. (To show this, try qt device results -from examples 23 [mathematical symbols] and 24 [CTL languages].) - -Our exhaustive Linux testing of the qt devices (which consisted of detailed -comparisons for all our standard examples between qt device results and the -corresponding cairo device results) indicates this device driver is mature, -but testing on other platforms is requested to confirm that maturity. -Qt-4.5 has some essential SVG functionality so we recommend that -version (downloadable from http://www.qtsoftware.com/downloads for Linux, -Mac OS X, and Windows) for svgqt. Qt-4.5 is the version we have used for -most of our testing, but limited testing for Qt-4.4 indicates that version -should be fine for qt devices other than svgqt. - -1.5 The PLplot API is now accessible from Qt GUI applications - -This important new feature has been implemented by Alban Rochel of the QSAS -team as a spin-off of the qt device driver project using the extqt device -(which constitutes the tenth qt device). See examples/c++/README.qt_example -for a brief description of a simple Qt example which accesses the PLplot API -and which is built in the installed examples tree using the pkg-config -approach. Our build system has been enhanced to configure the necessary -plplotd-qt.pc file. - -1.6 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 -depend on whether the language binding used supports NaN / Inf values. - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-05-05 11:16:05
|
Revision: 9916 http://plplot.svn.sourceforge.net/plplot/?rev=9916&view=rev Author: andrewross Date: 2009-05-05 11:15:34 +0000 (Tue, 05 May 2009) Log Message: ----------- Fix to ensure plrandd works correctly with tk. Fixes the interactive test with plserver in the install tree. Modified Paths: -------------- trunk/bindings/tk/PLWin.itk trunk/examples/tcl/x17.tcl trunk/examples/tcl/x21.tcl Modified: trunk/bindings/tk/PLWin.itk =================================================================== --- trunk/bindings/tk/PLWin.itk 2009-05-05 08:47:27 UTC (rev 9915) +++ trunk/bindings/tk/PLWin.itk 2009-05-05 11:15:34 UTC (rev 9916) @@ -67,6 +67,10 @@ eval $plwin cmd plshade $args } + method plrandd {args} { + eval $plwin cmd plrandd $args + } + # From here on down, we just insert what comes out of plitclgen (file # gen.itcl). If you don't like the handling of one of these for some # reason, then add the method name to the ignore list in plitclgen, Modified: trunk/examples/tcl/x17.tcl =================================================================== --- trunk/examples/tcl/x17.tcl 2009-05-05 08:47:27 UTC (rev 9915) +++ trunk/examples/tcl/x17.tcl 2009-05-05 11:15:34 UTC (rev 9916) @@ -101,7 +101,7 @@ after 10 ;# Wait for 10 ms set t [expr {double($n) * $dt}] - set noise [expr {[plrandd] - 0.5}] + set noise [expr {[$w cmd plrandd] - 0.5}] set y1 [expr {$y1 + $noise}] set y2 [expr {sin($t*$PI/18.)}] set y3 [expr {$y2 * $noise}] Modified: trunk/examples/tcl/x21.tcl =================================================================== --- trunk/examples/tcl/x21.tcl 2009-05-05 08:47:27 UTC (rev 9915) +++ trunk/examples/tcl/x21.tcl 2009-05-05 11:15:34 UTC (rev 9916) @@ -85,8 +85,8 @@ $w cmd plseed 5489 for {set i 0} {$i < $pts} {incr i} { - set xt [expr {($xmax-$xmin)*[plrandd]}] - set yt [expr {($ymax-$ymin)*[plrandd]}] + set xt [expr {($xmax-$xmin)*[$w cmd plrandd]}] + set yt [expr {($ymax-$ymin)*[$w cmd plrandd]}] if {$randn == 0} { x $i = [expr {$xt + $xmin}] y $i = [expr {$yt + $ymin}] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-05-05 11:35:39
|
Revision: 9917 http://plplot.svn.sourceforge.net/plplot/?rev=9917&view=rev Author: andrewross Date: 2009-05-05 11:35:31 +0000 (Tue, 05 May 2009) Log Message: ----------- Fix up problems with tcl example 2 and 24 so they work with plserver as well. Modified Paths: -------------- trunk/examples/tcl/x02.tcl trunk/examples/tcl/x24.tcl trunk/plplot_test/plplot-test-interactive.sh.in Modified: trunk/examples/tcl/x02.tcl =================================================================== --- trunk/examples/tcl/x02.tcl 2009-05-05 11:15:34 UTC (rev 9916) +++ trunk/examples/tcl/x02.tcl 2009-05-05 11:35:31 UTC (rev 9917) @@ -71,7 +71,7 @@ # Use max saturation set s 1.0 - plhlsrgb $h $l $s r1 g1 b1 + $w cmd plhlsrgb $h $l $s r1 g1 b1 # puts [format "%3d %15.9f %15.9f %15.9f %15.9f %15.9f %15.9f" $i1 $h $l $s $r1 $g1 $b1] if $see_the_bug { r $i1 = [expr int($r1 * 255.001)] @@ -82,7 +82,7 @@ set g2 [expr int($g1 * 255.001)] set b2 [expr int($b1 * 255.001)] # puts [format "%3d %3d %3d %3d" $i1 $r2 $g2 $b2] - plscol0 $i1 $r2 $g2 $b2 + $w cmd plscol0 $i1 $r2 $g2 $b2 } } @@ -102,7 +102,7 @@ puts [format "%3d %3d %3d %3d" $i $r1 $g1 $b1] } # The following call currently segfaults. - plscmap0 r g b $ntot + $w cmd plscmap0 r g b $ntot } x02_draw_windows $w 100 $offset Modified: trunk/examples/tcl/x24.tcl =================================================================== --- trunk/examples/tcl/x24.tcl 2009-05-05 11:15:34 UTC (rev 9916) +++ trunk/examples/tcl/x24.tcl 2009-05-05 11:35:31 UTC (rev 9917) @@ -126,8 +126,8 @@ $w cmd plscmap0n 7 $w cmd plscmap0 red green blue 7 - plschr 0 4.0 - plfont 1 + $w cmd plschr 0 4.0 + $w cmd plfont 1 for {set i 0} {$i < 4} {incr i} { $w cmd plcol0 [expr {$i + 1}] Modified: trunk/plplot_test/plplot-test-interactive.sh.in =================================================================== --- trunk/plplot_test/plplot-test-interactive.sh.in 2009-05-05 11:15:34 UTC (rev 9916) +++ trunk/plplot_test/plplot-test-interactive.sh.in 2009-05-05 11:35:31 UTC (rev 9917) @@ -165,13 +165,12 @@ EOF cd ../tk pwd -# Drop 2 to avoid 'invalid command name "plhlsrgb"' error. # Drop 14 because multiple devices do not seem to work in this context. -# Drop 24 to avoid 'invalid command name "plschr"' error. # Drop 31 since it produces empty plot (by design). plserver <<EOF source tkdemos.tcl 1 +2 3 4 5 @@ -192,6 +191,7 @@ 21 22 23 +24 25 26 27 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2009-05-10 20:28:59
|
Revision: 9954 http://plplot.svn.sourceforge.net/plplot/?rev=9954&view=rev Author: hbabcock Date: 2009-05-10 20:28:48 +0000 (Sun, 10 May 2009) Log Message: ----------- Updated for the 5.9.5 Release. Modified Paths: -------------- trunk/OLD-README.release trunk/README.release Modified: trunk/OLD-README.release =================================================================== --- trunk/OLD-README.release 2009-05-10 19:34:41 UTC (rev 9953) +++ trunk/OLD-README.release 2009-05-10 20:28:48 UTC (rev 9954) @@ -1,3 +1,581 @@ +PLplot Release 5.9.4 +~~~~~~~~~~~~~~~~~~~~ +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 +stable release will be 5.10.0. + + If you encounter a problem that is not already documented in the +PROBLEMS file, then please send bug reports to PLplot developers via the +mailing lists at http://sourceforge.net/mail/?group_id=2915 . + + Please see the license under which this software is distributed +(LGPL), and the disclaimer of all warranties, given in the COPYING.LIB +file. + + +Notices for Users. + +I. This is the official notice that our deprecated autotools-based build +system has been removed as of release 5.9.1. Instead, use the CMake-based +build system following the directions in the INSTALL file. + +II. This is official notice that we (as of 5.9.1) no longer support +Octave-2.1.73 which has a variety of run-time issues in our tests of the +Octave examples on different platforms. In contrast our tests show we get +good run-time results with all our Octave examples for Octave-3.0.1. Also, +that is the recommended stable version of Octave at +http://www.gnu.org/software/octave/download.html so that is the only version +of Octave we support at this time. + +III. This is official notice that the PLplot team have decided (as of release +5.9.1) for consistency sake to change the PLplot stream variables +plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results +returned by plgvpw to reflect the exact window limit values input by users +using plwind. Previously to this change, the stream variables and the values +returned by plgvpw reflected the internal slightly expanded range of window +limits used by PLplot so that the user's specified limits would be on the +graph. Two users noted this slight difference, and we agree with them it +should not be there. Note that internally, PLplot still uses the expanded +ranges so most users results will be identical. However, you may notice +some small changes to your plot results if you use these stream variables +directly (only possible in C/C++) or use plgvpw. + +IV. This is official notice that (as of release 5.9.2) we have set +HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin +will follow later once it appears the Apple version of X supports it. + +V. This is official notice that (as of release 5.9.3) our build system +requires CMake version 2.6.0 or higher. + +VI. This is official notice that (as of release 5.9.3) we have deprecated +the gcw device driver and the related gnome2 and pygcw bindings since these +are essentially unmaintained. For example, the gcw device and associated +bindings still depends on the plfreetype approach for accessing unicode +fonts which has known issues (inconsistent text offsets, inconvenient font +setting capabilities, and incorrect rendering of CTL languages). To avoid +these issues we advise using the xcairo device and the externally supplied +XDrawable or Cairo context associated with the xcairo device and the +extcairo device (see examples/c/README.cairo) instead. If you still +absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite +the known problems, then they can still be accessed by setting PLD_gcw, +ENABLE_gnome2, and/or ENABLE_pygcw to ON. + +VII. This is official notice that (as of release 5.9.3) we have deprecated +the gd device driver which implements the png, jpeg, and gif devices. This +device driver is essentially unmaintained. For example, it still depends on +the plfreetype approach for accessing unicode fonts which has known issues +(inconsistent text offsets, inconvenient font setting capabilities, and +incorrect rendering of CTL languages). To avoid these issues for PNG +format, we advise using the pngcairo or pngqt devices. To avoid these +issues for the JPEG format, we advise using the jpgqt device. PNG is +normally considered a better raster format than GIF, but if you absolutely +require GIF format, we advise using the pngcairo or pngqt devices and then +downgrading the results to the GIF format using the ImageMagick "convert" +application. For those platforms where libgd (the dependency of the gd +device driver) is accessible while the required dependencies of the cairo +and/or qt devices are not accessible, you can still use these deprecated +devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. + +VIII. This is official notice that the tk, itk, and itcl components of +PLplot have been reenabled again by default (as of release 5.9.3) after +being disabled by default as of release 5.9.1 due to segfaults. The cause +of the segfaults was a bug (now fixed) in how pthread support was +implemented for the Tk-related components of PLplot. + +INDEX + +1. Changes relative to PLplot 5.9.3 (the previous development release) + +1.1 Various bug fixes +1.2 Cairo driver improvements + + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +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 +examples +2.5 Code cleanup +2.6 Date / time labels for axes +2.7 Alpha value support +2.8 New PLplot functions +2.9 External libLASi library improvements affecting our psttf device. +2.10 Improvements to the cairo driver family. +2.11 wxWidgets driver improvements +2.12 pdf driver improvements +2.13 svg driver improvements +2.14 Ada language support +2.15 OCaml language support +2.16 Perl/PDL language support +2.17 Update to various language bindings +2.18 Update to various examples +2.19 Extension of our test framework +2.20 Rename test subdirectory to plplot_test +2.21 Website support files updated +2.22 Internal changes to function visibility +2.23 Dynamic driver support in Windows +2.24 Documentation updates +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm +2.26 get-drv-info now changed to test-drv-info +2.27 Text clipping now enabled by default for the cairo devices +2.28 A powerful qt device driver has been implemented +2.29 The PLplot API is now accessible from Qt GUI applications +2.30 NaN / Inf support for some PLplot functions +2.31 Various bug fixes +2.32 Cairo driver improvements + +1. Changes relative to PLplot 5.9.3 (the previous development release) + +1.1 Various bug fixes + +Various bugs in the 5.9.3 release have been fixed including: + +- Include missing file needed for the aqt driver on Mac OS X +- Missing library version number for nistcd +- Fixes for the qt examples with dynamic drivers disabled +- Fixes to several tcl examples so they work with plserver +- Fix pkg-config files to work correctly with Debug / Release build types set +- Make fortran command line argument parsing work with shared libraries on Windows + +1.2 Cairo driver improvements + +Improvements to the cairo driver to give better results for bitmap +formats when used with anti-aliasing file viewers. + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed + +CMake (with the exception of a special build script for the DJGPP platform) +is now the only supported build system. It has been tested on Linux / Unix, +Mac OS-X and Windows platforms. + +2.2 Build system bug fixes + +Various fixes include the following: + +Ctest will now work correctly when the build tree path includes symlinks. + +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) +work under unix. + +2.3 Build system improvements + +We now transform link flag results delivered to the CMake environment by +pkg-config into the preferred CMake form of library information. The +practical effect of this improvement is that external libraries in +non-standard locations now have their rpath options set correctly for our +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 +examples + +Install source files, library information files, and the plplotada library +associated with the Ada bindings. Configure and install the pkg-config file +for the plplotada library. Install the Ada examples and a configured Makefile +to build them in the install tree. + +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 +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 +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 +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 +demonstrates the new capabilities. + +N.B. Our reliance on C library POSIX time routines to (1) convert from +broken-down time to time-epoch, (2) to convert from time-epoch to +broken-down time, and (3) to format results with strftime have proved +problematic for non-C languages which have time routines of variable +quality. Also, it is not clear that even the POSIX time routines are +available on Windows. So we have plans afoot to implement high-quality +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. + +WARNING..... Therefore, assuming these plans are implemented, the present +part of our date/time PLplot API that uses POSIX time routines will be +changed. + +2.7 Alpha value support + +PLplot core has been modified to support a transparency or alpha value +channel for each color in color map 0 and 1. In addition a number of new +functions were added the PLplot API so that the user can both set and query +alpha values for color in the two color maps. These functions have the same +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 +currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and +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. + +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. +plseed will allow the random number generator to be seeded. + +2.9 External libLASi library improvements affecting our psttf device. + +Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been +released at http://sourceforge.net/svn/?group_id=187113 . We recommend +using this latest version of libLASi for building PLplot and the psttf +device since this version of libLASi is more robust against glyph +information returned by pango/cairo/fontconfig that on rare occasions is not +suitable for use by libLASi. + +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 +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. + +2.11 wxWidgets driver improvements + +Complete reorganization of the driver code. A new backend was added, based +on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 +and later. This backend produces antialized output similar to the +AGG backend but has no dependency on the AGG library. The basic wxDC +backend and the wxGraphicsContext backend process the text output +on their own, which results in much nicer plots than with the standard +Hershey fonts and is much faster than using the freetype library. New +options were introduced in the wxWidgets driver: + - backend: Choose backend: (0) standard, (1) using AGG library, + (2) using wxGraphicsContext + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - text: Use own text routines (text=0|1) + - freetype: Use FreeType library (freetype=0|1) +The option "text" changed its meaning, since it enabled the FreeType library +support, while now the option enables the driver's own text routines. + +Some other features were added: + * the wxWidgets driver now correctly clears the background (or parts of it) + * transparency support was added + * the "locate mode" (already availale in the xwin and tk driver) was + implemented, where graphics input events are processed and translated + to world coordinates + +2.12 pdf driver improvements + +The pdf driver (which is based on the haru library http://www.libharu.org) +processes the text output now on its own. So far only the Adobe Type1 +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 +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 +file now validates properly at http://validator.w3.org/ for the +automatically detected document type of SVG 1.1; -geometry option now works; +alpha channel transparency has been implemented; file familying for +multipage examples has been implemented; coordinate scaling has been +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. + +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 +careful of which SVG viewer or editor you try because a number of them have +some bugs that need to be resolved. For example, there is a librsvg bug in +text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that +affects all svg use within GNOME as well as the ImageMagick "display" +application. However, at least the latest konqueror and firefox as well as +inkscape and scribus-ng (but not scribus!) give outstanding looking results +for files generated by our svg device driver. + +2.14 Ada language support + +We now have a complete Ada bindings implemented for PLplot. We also have a +complete set of our standard examples implemented in Ada which give results +that are identical with corresponding results for the C standard examples. +This is an excellent test of a large subset of the Ada bindings. We now +enable Ada by default for our users and request widespread testing of this +new feature. + +2.15 OCaml language support + +Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml +bindings implemented for PLplot. We also have a complete set of our standard +examples implemented in OCaml which give results that are identical with +corresponding results for the C standard examples. This is an excellent test +of a large subset of the OCaml bindings. We now enable OCaml by default for +our users and request widespread testing of this new feature. + +2.16 Perl/PDL language support + +Thanks to Doug Hunt's efforts the external Perl/PDL module, +PDL::Graphics::PLplot version 0.46 available at +http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date +to give access to recently added PLplot API. The instructions for how to +install this module on top of an offical PDL release are given in +examples/perl/README.perldemos. Doug has also finished implementing a +complete set of standard examples in Perl/PDL which are part of PLplot and +which produce identical results to their C counterparts if the above updated +module has been installed. Our build system tests the version of +PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the +list of Perl/PDL examples that are run as part of our standard tests is +substantially reduced to avoid examples that use the new functionality. In +sum, if you use PDL::Graphics::PLplot version 0.46 or later the full +complement of PLplot commands is available to you from Perl/PDL, but +otherwise not. + +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 +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 +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 +functions. The examples have also been checked to ensure consistent results +between different language bindings. Currently there are still some minor +differences in the results for the tcl examples, probably due to rounding +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 +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 +of the standard ctest tests because it can be _very_ slow for a complete +set of language bindings and device drivers. + +2.19 Extension of our test framework + +The standard test suite for PLplot now carries out a comparison of the +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 +to maintain high quality for our ongoing PLplot releases. + +2.20 Rename test subdirectory to plplot_test + +This change was necessary to quit clashing with the "make test" target which +now works for the first time ever (by executing ctest). + +2.21 Website support files updated + +Our new website content is generated with PHP and uses CSS (cascaded style +sheets) to implement a consistent style. This new approach demanded lots of +changes in the website support files that are used to generate and upload +our website and which are automatically included with the release. + +2.22 Internal changes to function visibility + +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 +on windows. + +2.23 Dynamic driver support in Windows + +An interface based on the ltdl library function calls was established +which allows to open and close dynamic link libraries (DLL) during +run-time and call functions from these libraries. As a consequence +drivers can now be compiled into single DLLs separate from the core +plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now +ON by default for Windows if a shared plplot library is built. + +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 +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) +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 +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +2.26 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +2.27 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +2.28 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse (or hitting +<return> to be consistent with other PLplot interactive devices) to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. Qt-4.5 +(the version we used for most of our tests) has some essential SVG +functionality so we recommend that version (downloadable from +http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for +svgqt. One of our developers found that pdfqt was orders of magnitude +slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a +64 bit box. That problem was completely cured by moving to the downloadable +Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on +other platforms. One of our developers also found that all first pages of +examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. +From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we +assume this black first page for qtwidget problem also exists for Qt-4.4.3, +but we haven't tested that combination. + +In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, +but if you run into any difficulty with it please switch to Qt-4.5.x (once +Qt-4.5.x is installed all you have to do is to put the 4.5.x version of +qmake in your path, and cmake does the rest). If the problem persists for +Qt-4.5, then it is worth reporting a qt bug. + +2.29 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +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 +depend on whether the language binding used supports NaN / Inf values. + +2.31 Various bug fixes + +Various bugs in the 5.9.3 release have been fixed including: + +- Include missing file needed for the aqt driver on Mac OS X +- Missing library version number for nistcd +- Fixes for the qt examples with dynamic drivers disabled +- Fixes to several tcl examples so they work with plserver +- Fix pkg-config files to work correctly with Debug / Release build types set +- Make fortran command line argument parsing work with shared libraries on Windows + +2.32 Cairo driver improvements + +Improvements to the cairo driver to give better results for bitmap +formats when used with anti-aliasing file viewers. + + PLplot Release 5.9.3 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts Modified: trunk/README.release =================================================================== --- trunk/README.release 2009-05-10 19:34:41 UTC (rev 9953) +++ trunk/README.release 2009-05-10 20:28:48 UTC (rev 9954) @@ -1,4 +1,4 @@ -PLplot Release 5.9.4 +PLplot Release 5.9.5 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development @@ -85,12 +85,9 @@ INDEX -1. Changes relative to PLplot 5.9.3 (the previous development release) +1. Changes relative to PLplot 5.9.4 (the previous development release) -1.1 Various bug fixes -1.2 Cairo driver improvements - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -127,24 +124,7 @@ 2.31 Various bug fixes 2.32 Cairo driver improvements -1. Changes relative to PLplot 5.9.3 (the previous development release) -1.1 Various bug fixes - -Various bugs in the 5.9.3 release have been fixed including: - -- Include missing file needed for the aqt driver on Mac OS X -- Missing library version number for nistcd -- Fixes for the qt examples with dynamic drivers disabled -- Fixes to several tcl examples so they work with plserver -- Fix pkg-config files to work correctly with Debug / Release build types set -- Make fortran command line argument parsing work with shared libraries on Windows - -1.2 Cairo driver improvements - -Improvements to the cairo driver to give better results for bitmap -formats when used with anti-aliasing file viewers. - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-11 14:08:21
|
Revision: 9963 http://plplot.svn.sourceforge.net/plplot/?rev=9963&view=rev Author: smekal Date: 2009-05-11 14:08:05 +0000 (Mon, 11 May 2009) Log Message: ----------- Further improvements on D bindings. Changed examples accordingly. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x12d.d trunk/examples/d/x13d.d trunk/examples/d/x24d.d trunk/examples/d/x25d.d trunk/examples/d/x29d.d trunk/examples/d/x30d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/bindings/d/plplot.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -40,15 +40,25 @@ void plbin(PLFLT[] x, PLFLT[] y, PLINT opt) { PLINT nbin = x.length; - assert(nbin==y.length, "Arrays must be of same length!"); - c_plbin(nbin, cast(PLFLT*)x, cast(PLFLT*)y, opt); + assert(nbin==y.length, "plbin(): Arrays must be of same length!"); + c_plbin(nbin, x.ptr, y.ptr, opt); } /* This draws a box around the current viewport. */ -//void c_plbox(char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); +void plbox(string xopt, PLFLT xtick, PLINT nxsub, string yopt, PLFLT ytick, PLINT nysub) +{ + c_plbox(toStringz(xopt), xtick, nxsub, toStringz(yopt), ytick, nysub); +} /* This is the 3-d analogue of plbox(). */ -//void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); +void plbox3(string xopt, string xlabel, PLFLT xtick, PLINT nsubx, + string yopt, string ylabel, PLFLT ytick, PLINT nsuby, + string zopt, string zlabel, PLFLT ztick, PLINT nsubz) +{ + c_plbox3(toStringz(xopt), toStringz(xlabel), xtick, nsubx, + toStringz(yopt), toStringz(ylabel), ytick, nsuby, + toStringz(zopt), toStringz(zlabel), ztick, nsubz); +} /* Draws a contour plot from data in f(nx,ny). Is just a front-end to * plfcont, with a particular choice for f2eval and f2eval_data. @@ -62,16 +72,39 @@ //void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); /* Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) */ -//void c_plerrx(PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y); +void plerrx(PLFLT[] xmin, PLFLT[] xmax, PLFLT[] y) +{ + PLINT n=y.length; + assert(n==xmin.length, "plerrx(): Arrays must be of same length!"); + assert(n==xmax.length, "plerrx(): Arrays must be of same length!"); + c_plerrx(n, xmin.ptr, xmax.ptr, y.ptr); +} /* Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) */ -//void c_plerry(PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax); +void plerry(PLFLT[] x, PLFLT[] ymin, PLFLT[] ymax) +{ + PLINT n=x.length; + assert(n==ymin.length, "plerry(): Arrays must be of same length!"); + assert(n==ymax.length, "plerry(): Arrays must be of same length!"); + c_plerry(n, x.ptr, ymin.ptr, ymax.ptr); +} /* Pattern fills the polygon bounded by the input points. */ -//void c_plfill(PLINT n, PLFLT *x, PLFLT *y); +void plfill(PLFLT[] x, PLFLT[] y) +{ + PLINT n=x.length; + assert(n==y.length, "plfill(): Arrays must be of same length!"); + c_plfill(n, x.ptr, y.ptr); +} /* Pattern fills the 3d polygon bounded by the input points. */ -//void c_plfill3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); +void plfill3(PLFLT[] x, PLFLT[] y, PLFLT[] z) +{ + PLINT n=x.length; + assert(n==y.length, "plfill3(): Arrays must be of same length!"); + assert(n==z.length, "plfill3(): Arrays must be of same length!"); + c_plfill3(n, x.ptr, y.ptr, z.ptr); +} /* Get the current device (keyword) name */ //void c_plgdev(char *p_dev); @@ -89,14 +122,17 @@ //void c_plhist(PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt); /* Simple routine for labelling graphs. */ -//void c_pllab(char *xlabel, char *ylabel, char *tlabel); +void pllab(string xlabel, string ylabel, string tlabel) +{ + c_pllab(toStringz(xlabel), toStringz(ylabel), toStringz(tlabel)); +} /* Draws line segments connecting a series of points. */ void plline(PLFLT[] x, PLFLT[] y) { PLINT n = x.length; - assert(n==y.length, "Arrays must be of same length!"); - c_plline(n, cast(PLFLT*)x, cast(PLFLT*)y); + assert(n==y.length, "plline(): Arrays must be of same length!"); + c_plline(n, x.ptr, y.ptr); } /* Draws a line in 3 space. */ @@ -684,8 +720,8 @@ alias c_plaxes plaxes; //alias c_plbin plbin; alias c_plbop plbop; -alias c_plbox plbox; -alias c_plbox3 plbox3; +//alias c_plbox plbox; +//alias c_plbox3 plbox3; alias c_plcalc_world plcalc_world; alias c_plclear plclear; alias c_plcol0 plcol0; @@ -698,11 +734,11 @@ alias c_plenv plenv; alias c_plenv0 plenv0; alias c_pleop pleop; -alias c_plerrx plerrx; -alias c_plerry plerry; +//alias c_plerrx plerrx; +//alias c_plerry plerry; alias c_plfamadv plfamadv; -alias c_plfill plfill; -alias c_plfill3 plfill3; +//alias c_plfill plfill; +//alias c_plfill3 plfill3; alias c_plflush plflush; alias c_plfont plfont; alias c_plfontld plfontld; @@ -739,7 +775,7 @@ alias c_plimagefr plimagefr; alias c_plinit plinit; alias c_pljoin pljoin; -alias c_pllab pllab; +//alias c_pllab pllab; alias c_pllightsource pllightsource; //alias c_plline plline; alias c_plline3 plline3; @@ -876,7 +912,6 @@ /* This functions similarly to plbox() except that the origin of the axes */ /* is placed at the user-specified point (x0, y0). */ - void c_plaxes(PLFLT x0, PLFLT y0, char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); /* Flags for plbin() - opt argument */ @@ -893,13 +928,11 @@ void c_plbop(); /* This draws a box around the current viewport. */ +void c_plbox(char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); -void c_plbox(char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); - /* This is the 3-d analogue of plbox(). */ +void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); -void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); - /* Calculate world coordinates and subpage from relative device coordinates. */ void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); @@ -968,25 +1001,21 @@ void c_pleop(); /* Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) */ +void c_plerrx(PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y); -void c_plerrx(PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y); - /* Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) */ +void c_plerry(PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax); -void c_plerry(PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax); - /* Advance to the next family file on the next new page */ void c_plfamadv(); /* Pattern fills the polygon bounded by the input points. */ +void c_plfill(PLINT n, PLFLT *x, PLFLT *y); -void c_plfill(PLINT n, PLFLT *x, PLFLT *y); - /* Pattern fills the 3d polygon bounded by the input points. */ +void c_plfill3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); -void c_plfill3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); - /* Flushes the output stream. Use sparingly, if at all. */ void c_plflush(); @@ -1141,9 +1170,8 @@ void c_pljoin(PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2); /* Simple routine for labelling graphs. */ +void c_pllab(char *xlabel, char *ylabel, char *tlabel); -void c_pllab(char *xlabel, char *ylabel, char *tlabel); - /* Sets position of the light source */ void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); Modified: trunk/examples/d/x12d.d =================================================================== --- trunk/examples/d/x12d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x12d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -54,7 +54,7 @@ PLFLT[4] x = [x0, x0, x0+1.0, x0+1.0];; PLFLT[4] y = [0.0, y0, y0, 0.0]; - plfill( 4, cast(PLFLT*)x, cast(PLFLT*)y ); + plfill(x, y); plcol0( 1 ); pllsty( 1 ); plline(x, y); Modified: trunk/examples/d/x13d.d =================================================================== --- trunk/examples/d/x13d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x13d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -52,7 +52,7 @@ } plcol0( i+1 ); plpsty( (i+3)%8+1 ); - plfill( j, cast(PLFLT*)x, cast(PLFLT*)y ); + plfill(x, y); plcol0( 1 ); plline(x, y); just = (2.*PI/500.)*(theta0 + theta1)/2.; Modified: trunk/examples/d/x24d.d =================================================================== --- trunk/examples/d/x24d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x24d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -139,7 +139,7 @@ for(int i = 0; i < 4; i++ ) { plcol0(i + 1); - plfill(4, cast(PLFLT*)px, cast(PLFLT*)py); + plfill(px, py); for(int j = 0; j < py.length; j++) py[j] += 1.0/4.0; Modified: trunk/examples/d/x25d.d =================================================================== --- trunk/examples/d/x25d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x25d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -80,7 +80,7 @@ plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(1); plpsty(0); - plfill(x0.length, cast(PLFLT*)x0, cast(PLFLT*)y0); + plfill(x0, y0); plcol0(2); pllsty(1); plline(x0, y0); Modified: trunk/examples/d/x29d.d =================================================================== --- trunk/examples/d/x29d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x29d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -132,9 +132,9 @@ plline(x, y); plcol0(2); - plerrx(npts, cast(PLFLT*)xerr1, cast(PLFLT*)xerr2, cast(PLFLT*)y); + plerrx(xerr1, xerr2, y); plcol0(3); - plerry(npts, cast(PLFLT*)x, cast(PLFLT*)yerr1, cast(PLFLT*)yerr2); + plerry(x, yerr1, yerr2); /* Rescale major / minor tick marks back to default */ plsmin(0.0, 1.0); Modified: trunk/examples/d/x30d.d =================================================================== --- trunk/examples/d/x30d.d 2009-05-11 08:29:49 UTC (rev 9962) +++ trunk/examples/d/x30d.d 2009-05-11 14:08:05 UTC (rev 9963) @@ -81,7 +81,7 @@ plcol0(icol); /* Draw the rectangle */ - plfill(4, cast(PLFLT*)px, cast(PLFLT*)py); + plfill(px, py); /* Shift the rectangles coordinates */ for(int j=0; j<4; j++) { @@ -125,7 +125,7 @@ py[1] = py[0]; py[2] = py[0] + 0.1; py[3] = py[2]; - plfill(4, cast(PLFLT*)px, cast(PLFLT*)py); + plfill(px, py); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-11 21:39:51
|
Revision: 9966 http://plplot.svn.sourceforge.net/plplot/?rev=9966&view=rev Author: airwin Date: 2009-05-11 21:39:43 +0000 (Mon, 11 May 2009) Log Message: ----------- Export core library (nistcd, csirocsa, csironn, qsastime, plplotd) linking information using the INSTALL(EXPORT ....) command signature and use that exported information to build the installed C examples with cmake as a proof of concept of the idea. Modified Paths: -------------- trunk/examples/CMakeLists.txt trunk/examples/c/CMakeLists.txt trunk/lib/csa/CMakeLists.txt trunk/lib/nistcd/CMakeLists.txt trunk/lib/nn/CMakeLists.txt trunk/lib/qsastime/CMakeLists.txt trunk/src/CMakeLists.txt Added Paths: ----------- trunk/examples/CMakeLists.txt_installed_examples.in trunk/examples/c/CMakeLists.txt_installed_examples_c Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/examples/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -260,3 +260,14 @@ DESTINATION ${DATA_DIR}/examples RENAME Makefile ) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt_installed_examples + @ONLY + ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt_installed_examples + DESTINATION ${DATA_DIR}/examples + RENAME CMakeLists.txt + ) Added: trunk/examples/CMakeLists.txt_installed_examples.in =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples.in (rev 0) +++ trunk/examples/CMakeLists.txt_installed_examples.in 2009-05-11 21:39:43 UTC (rev 9966) @@ -0,0 +1,32 @@ +# Top-level CMakeLists.txt for installed PLplot examples +### +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +project(installed_plplot_examples) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.4 FATAL_ERROR) +# Location where PLplot cmake build system first looks for cmake modules. +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +#Configurable items. +set(INCLUDE_DIR @INCLUDE_DIR@) + +include(export_plplot) +add_subdirectory(c) Property changes on: trunk/examples/CMakeLists.txt_installed_examples.in ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/c/CMakeLists.txt =================================================================== --- trunk/examples/c/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/examples/c/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -104,6 +104,11 @@ DESTINATION ${DATA_DIR}/examples/c ) +install(FILES CMakeLists.txt_installed_examples_c + DESTINATION ${DATA_DIR}/examples/c + RENAME CMakeLists.txt + ) + set(CC ${CMAKE_C_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in Added: trunk/examples/c/CMakeLists.txt_installed_examples_c =================================================================== --- trunk/examples/c/CMakeLists.txt_installed_examples_c (rev 0) +++ trunk/examples/c/CMakeLists.txt_installed_examples_c 2009-05-11 21:39:43 UTC (rev 9966) @@ -0,0 +1,61 @@ +# c/CMakeLists.txt for installed PLplot examples +### +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(c_STRING_INDICES + "01" + "02" + "03" + "04" + "05" + "06" + "07" + "08" + "09" + "10" + "11" + "12" + "13" + "14" + "15" + "16" + "17" + "18" + "19" + "20" + "21" + "22" + "23" + "24" + "25" + "26" + "27" + "28" + "29" + "30" + "31" + "32" + ) + +include_directories(${INCLUDE_DIR}) +foreach(STRING_INDEX ${c_STRING_INDICES}) + add_executable(x${STRING_INDEX}c x${STRING_INDEX}c.c) + target_link_libraries(x${STRING_INDEX}c plplot${LIB_TAG} ${MATH_LIB}) +endforeach(STRING_INDEX ${c_STRING_INDICES}) Property changes on: trunk/examples/c/CMakeLists.txt_installed_examples_c ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lib/csa/CMakeLists.txt =================================================================== --- trunk/lib/csa/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/lib/csa/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -42,7 +42,8 @@ target_link_libraries(csirocsa ${MATH_LIB}) endif(MATH_LIB) - install(TARGETS csirocsa DESTINATION + install(TARGETS csirocsa + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} Modified: trunk/lib/nistcd/CMakeLists.txt =================================================================== --- trunk/lib/nistcd/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/lib/nistcd/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -140,8 +140,8 @@ endif(TEST_NISTCD AND NOT CMAKE_CROSSCOMPILING) # install library and binaries - install( TARGETS - nistcd + install(TARGETS nistcd + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} Modified: trunk/lib/nn/CMakeLists.txt =================================================================== --- trunk/lib/nn/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/lib/nn/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -48,6 +48,7 @@ ) target_link_libraries(csironn ${QHULL_LIBRARIES}) install(TARGETS csironn + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} Modified: trunk/lib/qsastime/CMakeLists.txt =================================================================== --- trunk/lib/qsastime/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/lib/qsastime/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -101,6 +101,7 @@ install(FILES ${qsastime_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR}) install(TARGETS qsastime + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-05-11 20:34:34 UTC (rev 9965) +++ trunk/src/CMakeLists.txt 2009-05-11 21:39:43 UTC (rev 9966) @@ -321,10 +321,12 @@ endif(USE_RPATH) install(TARGETS plplot${LIB_TAG} +EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) +install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples) #message("libplplot${LIB_TAG}_LINK_FLAGS = ${libplplot${LIB_TAG}_LINK_FLAGS}") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-12 08:29:58
|
Revision: 9969 http://plplot.svn.sourceforge.net/plplot/?rev=9969&view=rev Author: smekal Date: 2009-05-12 08:29:49 +0000 (Tue, 12 May 2009) Log Message: ----------- Further improvement of D bindings. Necessary changes to existing D examples. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x02d.d trunk/examples/d/x06d.d trunk/examples/d/x07d.d trunk/examples/d/x24d.d trunk/examples/d/x29d.d trunk/examples/d/x30d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/bindings/d/plplot.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -6,18 +6,6 @@ // improved D interface -/* Prints out "text" at specified position relative to viewport */ -void plmtex(string side, PLFLT disp, PLFLT pos, PLFLT just, string text) -{ - c_plmtex(toStringz(side), disp, pos, just, toStringz(text)); -} - -/* Prints out "text" at world cooordinate (x,y). */ -void plptex(PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, string text) -{ - c_plptex(x, y, dx, dy, just, toStringz(text)); -} - /* Process options list using current options info. */ int plparseopts(char[][] args, PLINT mode) { @@ -39,7 +27,7 @@ /* Plot a histogram using x to store data values and y to store frequencies */ void plbin(PLFLT[] x, PLFLT[] y, PLINT opt) { - PLINT nbin = x.length; + PLINT nbin=x.length; assert(nbin==y.length, "plbin(): Arrays must be of same length!"); c_plbin(nbin, x.ptr, y.ptr, opt); } @@ -130,13 +118,19 @@ /* Draws line segments connecting a series of points. */ void plline(PLFLT[] x, PLFLT[] y) { - PLINT n = x.length; + PLINT n=x.length; assert(n==y.length, "plline(): Arrays must be of same length!"); c_plline(n, x.ptr, y.ptr); } /* Draws a line in 3 space. */ -//void c_plline3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); +void plline3(PLFLT[] x, PLFLT[] y, PLFLT[] z) +{ + PLINT n=x.length; + assert(n==y.length, "plline3(): Arrays must be of same length!"); + assert(n==z.length, "plline3(): Arrays must be of same length!"); + c_plline3(n, x.ptr, y.ptr, z.ptr); +} /* plot continental outline in world coordinates */ //void c_plmap(void function(PLINT , PLFLT *, PLFLT *)mapform, char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); @@ -150,8 +144,17 @@ /* Plots a mesh representation of the function z[x][y] with contour */ //void c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); +/* Prints out "text" at specified position relative to viewport */ +void plmtex(string side, PLFLT disp, PLFLT pos, PLFLT just, string text) +{ + c_plmtex(toStringz(side), disp, pos, just, toStringz(text)); +} + /* Prints out "text" at specified position relative to viewport (3D)*/ -//void c_plmtex3(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); +void plmtex3(string side, PLFLT disp, PLFLT pos, PLFLT just, string text) +{ + c_plmtex3(toStringz(side), disp, pos, just, toStringz(text)); +} /* Plots a 3-d representation of the function z[x][y]. */ //void c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side); @@ -164,40 +167,119 @@ //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); /* Set fill pattern directly. */ -//void c_plpat(PLINT nlin, PLINT *inc, PLINT *del); +void plpat(PLINT[] inc, PLINT[] del) +{ + PLINT nlin=inc.length; + assert(nlin==del.length, "plpat(): Arrays must be of same length!"); + c_plpat(nlin, inc.ptr, del.ptr); +} /* Plots array y against x for n points using ASCII code "code".*/ -//void c_plpoin(PLINT n, PLFLT *x, PLFLT *y, PLINT code); +void plpoin(PLFLT[] x, PLFLT[] y, PLINT code) +{ + PLINT n=x.length; + assert(n==y.length, "plpoin(): Arrays must be of same length!"); + c_plpoin(n, x.ptr, y.ptr, code); +} /* Draws a series of points in 3 space. */ -//void c_plpoin3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code); +void plpoin3(PLFLT[] x, PLFLT[] y, PLFLT[] z, PLINT code) +{ + PLINT n=x.length; + assert(n==y.length, "plpoin3(): Arrays must be of same length!"); + assert(n==z.length, "plpoin3(): Arrays must be of same length!"); + c_plpoin3(n, x.ptr, y.ptr, z.ptr, code); +} /* Draws a polygon in 3 space. */ -//void c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc); +void plpoly3(PLFLT[] x, PLFLT[] y, PLFLT[] z, PLBOOL[] draw, PLBOOL ifcc) +{ + PLINT n=x.length; + assert(n==y.length, "plpoly3(): Arrays must be of same length!"); + assert(n==z.length, "plpoly3(): Arrays must be of same length!"); + assert(n-1==draw.length, "plpoly3(): Array draw must be of same length then other arrays minus 1!"); + c_plpoly3(n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc); +} +/* Prints out "text" at world cooordinate (x,y). */ +void plptex(PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, string text) +{ + c_plptex(x, y, dx, dy, just, toStringz(text)); +} + /* Prints out "text" at world cooordinate (x,y,z). */ -//void c_plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, char *text); +void plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, + PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, string text) +{ + c_plptex3(wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz(text)); +} /* Set color map 0 colors by 8 bit RGB values */ -//void c_plscmap0(PLINT *r, PLINT *g, PLINT *b, PLINT ncol0); +void plscmap0(PLINT[] r, PLINT[] g, PLINT[] b) +{ + PLINT ncol0=r.length; + assert(ncol0==g.length, "plscmap0(): Arrays must be of same length!"); + assert(ncol0==b.length, "plscmap0(): Arrays must be of same length!"); + c_plscmap0(r.ptr, g.ptr, b.ptr, ncol0); +} /* Set color map 0 colors by 8 bit RGB values and alpha values */ -//void c_plscmap0a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0); +void plscmap0a(PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a) +{ + PLINT ncol0=r.length; + assert(ncol0==g.length, "plscmap0a(): Arrays must be of same length!"); + assert(ncol0==b.length, "plscmap0a(): Arrays must be of same length!"); + assert(ncol0==a.length, "plscmap0a(): Arrays must be of same length!"); + c_plscmap0a(r.ptr, g.ptr, b.ptr, a.ptr, ncol0); +} /* Set color map 1 colors by 8 bit RGB values */ -//void c_plscmap1(PLINT *r, PLINT *g, PLINT *b, PLINT ncol1); +void plscmap1(PLINT[] r, PLINT[] g, PLINT[] b) +{ + PLINT ncol1=r.length; + assert(ncol1==g.length, "plscmap1(): Arrays must be of same length!"); + assert(ncol1==b.length, "plscmap1(): Arrays must be of same length!"); + c_plscmap1(r.ptr, g.ptr, b.ptr, ncol1); +} /* Set color map 1 colors by 8 bit RGB and alpha values */ -//void c_plscmap1a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1); +void plscmap1a(PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a) +{ + PLINT ncol1=r.length; + assert(ncol1==g.length, "plscmap1a(): Arrays must be of same length!"); + assert(ncol1==b.length, "plscmap1a(): Arrays must be of same length!"); + assert(ncol1==a.length, "plscmap1a(): Arrays must be of same length!"); + c_plscmap1a(r.ptr, g.ptr, b.ptr, a.ptr, ncol1); +} /* Set color map 1 colors using a piece-wise linear relationship between */ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ -//void c_plscmap1l(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *rev); +void plscmap1l(PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, + PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] rev) +{ + PLINT npts=intensity.length; + assert(npts==coord1.length, "plscmap1l(): Arrays must be of same length!"); + assert(npts==coord2.length, "plscmap1l(): Arrays must be of same length!"); + assert(npts==coord3.length, "plscmap1l(): Arrays must be of same length!"); + assert(npts-1==rev.length, "plscmap1l(): Array rev must be of same length then other arrays minus 1!"); + c_plscmap1l(itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, rev.ptr); +} + /* Set color map 1 colors using a piece-wise linear relationship between */ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ /* Will also linear interpolate alpha values. */ -//void c_plscmap1la(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *rev); +void plscmap1la(PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, + PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] rev) +{ + PLINT npts=intensity.length; + assert(npts==coord1.length, "plscmap1la(): Arrays must be of same length!"); + assert(npts==coord2.length, "plscmap1la(): Arrays must be of same length!"); + assert(npts==coord3.length, "plscmap1la(): Arrays must be of same length!"); + assert(npts==a.length, "plscmap1la(): Arrays must be of same length!"); + assert(npts-1==rev.length, "plscmap1la(): Array rev must be of same length then other arrays minus 1!"); + c_plscmap1la(itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, rev.ptr); +} /* Set the device (keyword) name */ void plsdev(string devname) @@ -218,7 +300,10 @@ //void plfshade(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLFLT function(PLINT , PLINT , PLPointer )c2eval, PLPointer c2eval_data, PLINT nx, PLINT ny, 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); /* Initialize PLplot, passing the device name and windows/page settings. */ -//void c_plstart(char *devname, PLINT nx, PLINT ny); +void plstart(string devname, PLINT nx, PLINT ny) +{ + c_plstart(toStringz(devname), nx, ny); +} /* Create 1d stripchart */ //void c_plstripc(PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, char **legline, char *labx, char *laby, char *labtop); @@ -231,7 +316,12 @@ //void c_plimage(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax); /* Set up a new line style */ -//void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); +void plstyl(PLINT[] mark, PLINT[] space) +{ + PLINT nms=mark.length; + assert(nms==space.length, "plstyl(): Arrays must be of same length!"); + c_plstyl(nms, mark.ptr, space.ptr); +} /* Plots the 3d surface representation of the function z[x][y]. */ //void c_plsurf3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); @@ -241,10 +331,18 @@ //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); /* Plots array y against x for n points using Hershey symbol "code" */ -//void c_plsym(PLINT n, PLFLT *x, PLFLT *y, PLINT code); +void plsym(PLFLT[] x, PLFLT[] y, PLINT code) +{ + PLINT n=x.length; + assert(n==y.length, "plsym(): Arrays must be of same length!"); + c_plsym(n, x.ptr, y.ptr, code); +} /* Set the format for date / time labels */ -//void c_pltimefmt(char *fmt); +void pltimefmt(string fmt) +{ + c_pltimefmt(toStringz(fmt)); +} /*--------------------------------------------------------------------------* * Functions for use from C or C++ only @@ -269,7 +367,9 @@ //void plseopH(void function(void *, int *)handler, void *handler_data); /* Set the variables to be used for storing error info */ -//void plsError(PLINT *errcode, char *errmsg); +//void plsError(PLINT *errcode, char *errmsg) +//{ +//} /* Sets an optional user exit handler. */ //void plsexit(int function(char *)handler); @@ -778,39 +878,39 @@ //alias c_pllab pllab; alias c_pllightsource pllightsource; //alias c_plline plline; -alias c_plline3 plline3; +//alias c_plline3 plline3; alias c_pllsty pllsty; alias c_plmap plmap; alias c_plmeridians plmeridians; alias c_plmesh plmesh; alias c_plmeshc plmeshc; alias c_plmkstrm plmkstrm; -// alias c_plmtex plmtex; -alias c_plmtex3 plmtex3; +//alias c_plmtex plmtex; +//alias c_plmtex3 plmtex3; alias c_plot3d plot3d; alias c_plot3dc plot3dc; alias c_plot3dcl plot3dcl; -// alias c_plparseopts plparseopts; -alias c_plpat plpat; -alias c_plpoin plpoin; -alias c_plpoin3 plpoin3; -alias c_plpoly3 plpoly3; +//alias c_plparseopts plparseopts; +//alias c_plpat plpat; +//alias c_plpoin plpoin; +//alias c_plpoin3 plpoin3; +//alias c_plpoly3 plpoly3; alias c_plprec plprec; alias c_plpsty plpsty; -// alias c_plptex plptex; -alias c_plptex3 plptex3; +//alias c_plptex plptex; +//alias c_plptex3 plptex3; alias c_plreplot plreplot; alias c_plrgb plrgb; alias c_plrgb1 plrgb1; alias c_plrgbhls plrgbhls; alias c_plschr plschr; -alias c_plscmap0 plscmap0; -alias c_plscmap0a plscmap0a; +//alias c_plscmap0 plscmap0; +//alias c_plscmap0a plscmap0a; alias c_plscmap0n plscmap0n; -alias c_plscmap1 plscmap1; -alias c_plscmap1a plscmap1a; -alias c_plscmap1l plscmap1l; -alias c_plscmap1la plscmap1la; +//alias c_plscmap1 plscmap1; +//alias c_plscmap1a plscmap1a; +//alias c_plscmap1l plscmap1l; +//alias c_plscmap1la plscmap1la; alias c_plscmap1n plscmap1n; alias c_plscol0 plscol0; alias c_plscol0a plscol0a; @@ -843,21 +943,21 @@ alias c_plssub plssub; alias c_plssym plssym; alias c_plstar plstar; -alias c_plstart plstart; +//alias c_plstart plstart; alias c_plstripa plstripa; alias c_plstripc plstripc; alias c_plstripd plstripd; -alias c_plstyl plstyl; +//alias c_plstyl plstyl; alias c_plsurf3d plsurf3d; alias c_plsurf3dl plsurf3dl; alias c_plsvect plsvect; alias c_plsvpa plsvpa; alias c_plsxax plsxax; alias c_plsyax plsyax; -alias c_plsym plsym; +//alias c_plsym plsym; alias c_plszax plszax; alias c_pltext pltext; -alias c_pltimefmt pltimefmt; +//alias c_pltimefmt pltimefmt; alias c_plvasp plvasp; alias c_plvect plvect; alias c_plvpas plvpas; @@ -1179,9 +1279,8 @@ void c_plline(PLINT n, PLFLT *x, PLFLT *y); /* Draws a line in 3 space. */ +void c_plline3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); -void c_plline3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); - /* Set line style. */ void c_pllsty(PLINT lin); @@ -1210,8 +1309,7 @@ void c_plmtex(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); /* Prints out "text" at specified position relative to viewport (3D)*/ - -void c_plmtex3(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); +void c_plmtex3(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); /* Plots a 3-d representation of the function z[x][y]. */ @@ -1254,36 +1352,30 @@ */ /* Set fill pattern directly. */ +void c_plpat(PLINT nlin, PLINT *inc, PLINT *del); -void c_plpat(PLINT nlin, PLINT *inc, PLINT *del); - /* Plots array y against x for n points using ASCII code "code".*/ +void c_plpoin(PLINT n, PLFLT *x, PLFLT *y, PLINT code); -void c_plpoin(PLINT n, PLFLT *x, PLFLT *y, PLINT code); - /* Draws a series of points in 3 space. */ +void c_plpoin3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code); -void c_plpoin3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code); - /* Draws a polygon in 3 space. */ +void c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc); -void c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc); - /* Set the floating point precision (in number of places) in numeric labels. */ void c_plprec(PLINT setp, PLINT prec); /* Set fill pattern, using one of the predefined patterns.*/ +void c_plpsty(PLINT patt); -void c_plpsty(PLINT patt); - /* Prints out "text" at world cooordinate (x,y). */ void c_plptex(PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, char *text); /* Prints out "text" at world cooordinate (x,y,z). */ +void c_plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, char *text); -void c_plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, char *text); - /* Replays contents of plot buffer to current device/file. */ void c_plreplot(); @@ -1305,60 +1397,47 @@ void c_plschr(PLFLT def, PLFLT scale); /* Set color map 0 colors by 8 bit RGB values */ +void c_plscmap0(PLINT *r, PLINT *g, PLINT *b, PLINT ncol0); -void c_plscmap0(PLINT *r, PLINT *g, PLINT *b, PLINT ncol0); - /* Set color map 0 colors by 8 bit RGB values and alpha values */ +void c_plscmap0a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0); -void c_plscmap0a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0); - /* Set number of colors in cmap 0 */ +void c_plscmap0n(PLINT ncol0); -void c_plscmap0n(PLINT ncol0); - /* Set color map 1 colors by 8 bit RGB values */ +void c_plscmap1(PLINT *r, PLINT *g, PLINT *b, PLINT ncol1); -void c_plscmap1(PLINT *r, PLINT *g, PLINT *b, PLINT ncol1); - /* Set color map 1 colors by 8 bit RGB and alpha values */ +void c_plscmap1a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1); -void c_plscmap1a(PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1); - /* Set color map 1 colors using a piece-wise linear relationship between */ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ +void c_plscmap1l(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *rev); -void c_plscmap1l(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *rev); - /* Set color map 1 colors using a piece-wise linear relationship between */ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ /* Will also linear interpolate alpha values. */ +void c_plscmap1la(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *rev); -void c_plscmap1la(PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *rev); - /* Set number of colors in cmap 1 */ +void c_plscmap1n(PLINT ncol1); -void c_plscmap1n(PLINT ncol1); - /* Set a given color from color map 0 by 8 bit RGB value */ +void c_plscol0(PLINT icol0, PLINT r, PLINT g, PLINT b); -void c_plscol0(PLINT icol0, PLINT r, PLINT g, PLINT b); - /* Set a given color from color map 0 by 8 bit RGB value */ +void c_plscol0a(PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a); -void c_plscol0a(PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a); - /* Set the background color by 8 bit RGB value */ +void c_plscolbg(PLINT r, PLINT g, PLINT b); -void c_plscolbg(PLINT r, PLINT g, PLINT b); - /* Set the background color by 8 bit RGB value and alpha value*/ +void c_plscolbga(PLINT r, PLINT g, PLINT b, PLFLT a); -void c_plscolbga(PLINT r, PLINT g, PLINT b, PLFLT a); - /* Used to globally turn color output on/off */ +void c_plscolor(PLINT color); -void c_plscolor(PLINT color); - /* Set the compression level */ void c_plscompression(PLINT compression); @@ -1457,9 +1536,8 @@ void c_plstar(PLINT nx, PLINT ny); /* Initialize PLplot, passing the device name and windows/page settings. */ +void c_plstart(char *devname, PLINT nx, PLINT ny); -void c_plstart(char *devname, PLINT nx, PLINT ny); - /* Add a point to a stripchart. */ void c_plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); @@ -1482,9 +1560,8 @@ void c_plimage(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax); /* Set up a new line style */ +void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); -void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); - /* Plots the 3d surface representation of the function z[x][y]. */ void c_plsurf3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); @@ -1511,9 +1588,8 @@ void c_plsyax(PLINT digmax, PLINT digits); /* Plots array y against x for n points using Hershey symbol "code" */ +void c_plsym(PLINT n, PLFLT *x, PLFLT *y, PLINT code); -void c_plsym(PLINT n, PLFLT *x, PLFLT *y, PLINT code); - /* Set z axis labeling parameters */ void c_plszax(PLINT digmax, PLINT digits); @@ -1523,10 +1599,8 @@ void c_pltext(); /* Set the format for date / time labels */ - +void c_pltimefmt(char *fmt); -void c_pltimefmt(char *fmt); - /* Sets the edges of the viewport with the given aspect ratio, leaving */ /* room for labels. */ Modified: trunk/examples/d/x02d.d =================================================================== --- trunk/examples/d/x02d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x02d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -97,7 +97,7 @@ plgcol0(i, &r[i], &g[i], &b[i]); /* Now set cmap0 all at once (faster, since fewer driver calls) */ - plscmap0(cast(int*)r, cast(int*)g, cast(int*)b, 116); + plscmap0(r, g, b); draw_windows(100, 16); Modified: trunk/examples/d/x06d.d =================================================================== --- trunk/examples/d/x06d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x06d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -3,54 +3,49 @@ Font demo. */ -import plplot; import std.string; +import plplot; /*--------------------------------------------------------------------------*\ * main * * Displays the entire "plpoin" symbol (font) set. \*--------------------------------------------------------------------------*/ -int main( char[][] args ) +int main(char[][] args) { - char[] text; - PLFLT x, y; - /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); /* Initialize plplot */ plinit(); - pladv( 0 ); + pladv(0); /* Set up viewport and window */ - plcol0( 2 ); - plvpor( 0.1, 1.0, 0.1, 0.9 ); - plwind( 0.0, 1.0, 0.0, 1.3 ); + plcol0(2); + plvpor(0.1, 1.0, 0.1, 0.9); + plwind(0.0, 1.0, 0.0, 1.3); /* Draw the grid using plbox */ - plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); + plbox("bcg", 0.1, 0, "bcg", 0.1, 0); /* Write the digits below the frame */ - plcol0( 15 ); - for( size_t i=0; i<=9; i++ ) { - text = format( "%d", i ); - plmtex("b", 1.5, (0.1*i+0.05), 0.5, text); - } + plcol0(15); + PLFLT[1] x, y; + for(size_t i=0; i<=9; i++) + plmtex("b", 1.5, (0.1*i+0.05), 0.5, format("%d", i)); size_t k = 0; - for( size_t i=0; i<=12; i++ ) { + for(size_t i=0; i<=12; i++) { /* Write the digits to the left of the frame */ - text = format( "%d", 10*i ); - plmtex("lv", 1.0, (1.0-(2*i+1)/26.0), 1.0, text); - for( size_t j=0; j<=9; j++ ) { - x = 0.1*j+0.05; - y = 1.25-0.1*i; + plmtex("lv", 1.0, (1.0-(2*i+1)/26.0), 1.0, format("%d", 10*i)); + for(size_t j=0; j<=9; j++) { + x[0] = 0.1*j+0.05; + y[0] = 1.25-0.1*i; /* Display the symbols (plpoin expects that x and y are arrays so */ /* pass pointers) */ - if( k<128 ) - plpoin( 1, &x, &y, k ); + if(k<128) + plpoin(x, y, k); k = k+1; } } Modified: trunk/examples/d/x07d.d =================================================================== --- trunk/examples/d/x07d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x07d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -17,8 +17,8 @@ \*--------------------------------------------------------------------------*/ int main( char[][] args ) { - char[] text; - PLFLT x, y; + string text; + PLFLT[1] x, y; /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -26,8 +26,8 @@ /* Initialize plplot */ plinit(); - plfontld( 1 ); - for( size_t l=0; l<17; l++) { + plfontld(1); + for(size_t l=0; l<17; l++) { pladv( 0 ); /* Set up viewport and window */ @@ -51,11 +51,11 @@ text = format( "%d", base[l] + 10 * i ); plmtex("lv", 1.0, (0.95-0.1*i), 1.0, text); for( size_t j=0; j<=9; j++ ) { - x = 0.1*j+0.05; - y = 0.95-0.1*i; + x[0] = 0.1*j+0.05; + y[0] = 0.95-0.1*i; /* Display the symbols */ - plsym( 1, &x, &y, base[l]+k ); + plsym(x, y, base[l]+k); k = k+1; } } Modified: trunk/examples/d/x24d.d =================================================================== --- trunk/examples/d/x24d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x24d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -132,7 +132,7 @@ plbox("", 1.0, 0, "", 1.0, 0); plscmap0n(7); - plscmap0(cast(PLINT*)red, cast(PLINT*)green, cast(PLINT*)blue, 7); + plscmap0(red, green, blue); plschr(0, 4.0); plfont(1); Modified: trunk/examples/d/x29d.d =================================================================== --- trunk/examples/d/x29d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x29d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -223,7 +223,7 @@ /* Rescale symbol size (used by plpoin) by 0.5 */ plssym(0.0,0.5); - plpoin(npts, cast(PLFLT*)x, cast(PLFLT*)y, 2); + plpoin(x, y, 2); plline(x, y); } } Modified: trunk/examples/d/x30d.d =================================================================== --- trunk/examples/d/x30d.d 2009-05-11 23:36:57 UTC (rev 9968) +++ trunk/examples/d/x30d.d 2009-05-12 08:29:49 UTC (rev 9969) @@ -42,7 +42,7 @@ static PLFLT[] gcoord = [ 0.0, 0.0 ]; static PLFLT[] bcoord = [ 0.0, 0.0 ]; static PLFLT[] acoord = [ 0.0, 1.0 ]; -static PLBOOL[] rev = [ 0, 0 ]; +static PLBOOL[] rev = [ 0 ]; int main( char[][] args ) @@ -52,7 +52,7 @@ plinit(); plscmap0n(4); - plscmap0a(cast(PLINT*)red, cast(PLINT*)green, cast(PLINT*)blue, cast(PLFLT*)alpha, 4); + plscmap0a(red, green, blue, alpha); /* Page 1: @@ -135,8 +135,7 @@ /* Create the color map with 128 colors and use plscmap1la to initialize */ /* the color values with a linear varying transparency (or alpha) */ plscmap1n(128); - plscmap1la(1, 2, cast(PLFLT*)pos, cast(PLFLT*)rcoord, cast(PLFLT*)gcoord, - cast(PLFLT*)bcoord, cast(PLFLT*)acoord, cast(PLBOOL*)rev); + plscmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev); /* Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will */ /* used for the shade plot. plshades will use linear interpolation to */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-12 16:49:18
|
Revision: 9970 http://plplot.svn.sourceforge.net/plplot/?rev=9970&view=rev Author: airwin Date: 2009-05-12 16:48:50 +0000 (Tue, 12 May 2009) Log Message: ----------- Reorganize CMake build system for installed examples. plplot_configure.cmake_installed_examples.in keeps track of the CMake variables that need to be configured for the installed examples build. The configured form of that file is installed in examples/cmake/modules (as plplot_configure.cmake). The export files are also stored in that directory. CMakeLists.txt_installed_examples (installed as examples/CMakeLists.txt) is no longer configured and simply includes everything in cmake/modules. Modified Paths: -------------- trunk/examples/CMakeLists.txt trunk/src/CMakeLists.txt Added Paths: ----------- trunk/examples/CMakeLists.txt_installed_examples trunk/examples/plplot_configure.cmake_installed_examples.in Removed Paths: ------------- trunk/examples/CMakeLists.txt_installed_examples.in Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2009-05-12 08:29:49 UTC (rev 9969) +++ trunk/examples/CMakeLists.txt 2009-05-12 16:48:50 UTC (rev 9970) @@ -261,13 +261,20 @@ RENAME Makefile ) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples + DESTINATION ${DATA_DIR}/examples + RENAME CMakeLists.txt + ) + configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples.in - ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt_installed_examples + ${CMAKE_CURRENT_SOURCE_DIR}/plplot_configure.cmake_installed_examples.in + ${CMAKE_CURRENT_BINARY_DIR}/plplot_configure.cmake_installed_examples @ONLY ) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt_installed_examples - DESTINATION ${DATA_DIR}/examples - RENAME CMakeLists.txt +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/plplot_configure.cmake_installed_examples + DESTINATION ${DATA_DIR}/examples/cmake/modules + RENAME plplot_configure.cmake ) + Copied: trunk/examples/CMakeLists.txt_installed_examples (from rev 9968, trunk/examples/CMakeLists.txt_installed_examples.in) =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples (rev 0) +++ trunk/examples/CMakeLists.txt_installed_examples 2009-05-12 16:48:50 UTC (rev 9970) @@ -0,0 +1,32 @@ +# Top-level CMakeLists.txt for installed PLplot examples +### +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +project(installed_plplot_examples) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.4 FATAL_ERROR) +# Location where PLplot cmake build system first looks for cmake modules. +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) + +#Configurable items. +include(plplot_configure) + +include(export_plplot) +add_subdirectory(c) Property changes on: trunk/examples/CMakeLists.txt_installed_examples ___________________________________________________________________ Added: svn:mergeinfo + Added: svn:eol-style + native Deleted: trunk/examples/CMakeLists.txt_installed_examples.in =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples.in 2009-05-12 08:29:49 UTC (rev 9969) +++ trunk/examples/CMakeLists.txt_installed_examples.in 2009-05-12 16:48:50 UTC (rev 9970) @@ -1,33 +0,0 @@ -# Top-level CMakeLists.txt for installed PLplot examples -### -### Process this file with cmake to produce Makefile -### -# Copyright (C) 2009 Alan W. Irwin -# -# This file is part of PLplot. -# -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; version 2 of the License. -# -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -project(installed_plplot_examples) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.4 FATAL_ERROR) -# Location where PLplot cmake build system first looks for cmake modules. -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) - -#Configurable items. -set(LIB_TAG "@LIB_TAG@") -set(INCLUDE_DIR @INCLUDE_DIR@) - -include(export_plplot) -add_subdirectory(c) Added: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in (rev 0) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 16:48:50 UTC (rev 9970) @@ -0,0 +1,4 @@ +# This file used to configure CMake variables that are used to build the +# installed examples. +set(LIB_TAG "@LIB_TAG@") +set(INCLUDE_DIR @INCLUDE_DIR@) Property changes on: trunk/examples/plplot_configure.cmake_installed_examples.in ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-05-12 08:29:49 UTC (rev 9969) +++ trunk/src/CMakeLists.txt 2009-05-12 16:48:50 UTC (rev 9970) @@ -326,7 +326,7 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) -install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples) +install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples/cmake/modules) #message("libplplot${LIB_TAG}_LINK_FLAGS = ${libplplot${LIB_TAG}_LINK_FLAGS}") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-12 18:39:00
|
Revision: 9972 http://plplot.svn.sourceforge.net/plplot/?rev=9972&view=rev Author: airwin Date: 2009-05-12 18:38:50 +0000 (Tue, 12 May 2009) Log Message: ----------- Add f77 and f95 to CMake-based build of installed examples. Modified Paths: -------------- trunk/bindings/f77/CMakeLists.txt trunk/bindings/f95/CMakeLists.txt trunk/examples/CMakeLists.txt_installed_examples trunk/examples/f77/CMakeLists.txt trunk/examples/f95/CMakeLists.txt trunk/examples/plplot_configure.cmake_installed_examples.in Added Paths: ----------- trunk/examples/f77/CMakeLists.txt_installed_examples_f77 trunk/examples/f95/CMakeLists.txt_installed_examples_f95 Modified: trunk/bindings/f77/CMakeLists.txt =================================================================== --- trunk/bindings/f77/CMakeLists.txt 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/bindings/f77/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) @@ -20,207 +20,223 @@ if(ENABLE_f77) -## Generate source files depending on type of PLFLT -## Note: Sed will possibly fail on windows. Would this be better -## done using the cmake configure_file option eventually? -if(PL_DOUBLE) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f - COMMAND ${CMAKE_COMMAND} - -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 - ) -else(PL_DOUBLE) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f - COMMAND sed - -f ${CMAKE_CURRENT_SOURCE_DIR}/double2single.sed ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 > ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f - DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/double2single.sed - ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 - ) -endif(PL_DOUBLE) + ## Generate source files depending on type of PLFLT + ## Note: Sed will possibly fail on windows. Would this be better + ## done using the cmake configure_file option eventually? + if(PL_DOUBLE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f + COMMAND ${CMAKE_COMMAND} + -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 + ) + else(PL_DOUBLE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f + COMMAND sed + -f ${CMAKE_CURRENT_SOURCE_DIR}/double2single.sed ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 > ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/double2single.sed + ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 + ) + endif(PL_DOUBLE) -if(WIN32) - # Set the flags for the C compiler. The C stubs need to have the - # correction case and calling convention for the Fortran compiler - IF(TARGET_FORTRAN MATCHES "IVF") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DIVF") - ELSEIF(TARGET_FORTRAN MATCHES "CVF") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DCVF") - ENDIF(TARGET_FORTRAN MATCHES "IVF") -endif(WIN32) + if(WIN32) + # Set the flags for the C compiler. The C stubs need to have the + # correction case and calling convention for the Fortran compiler + IF(TARGET_FORTRAN MATCHES "IVF") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DIVF") + ELSEIF(TARGET_FORTRAN MATCHES "CVF") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DCVF") + ENDIF(TARGET_FORTRAN MATCHES "IVF") + endif(WIN32) -if(F77_CMD_LINE) - set(HAVE_F77PARSE_CL_FALSE C) -else(F77_CMD_LINE) - set(HAVE_F77PARSE_CL_TRUE C) -endif(F77_CMD_LINE) + if(F77_CMD_LINE) + set(HAVE_F77PARSE_CL_FALSE C) + else(F77_CMD_LINE) + set(HAVE_F77PARSE_CL_TRUE C) + endif(F77_CMD_LINE) -configure_file( -${CMAKE_CURRENT_SOURCE_DIR}/configurable.f.cmake -${CMAKE_CURRENT_BINARY_DIR}/configurable.f -) -set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/configurable.f -PROPERTIES GENERATED ON) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/configurable.f.cmake + ${CMAKE_CURRENT_BINARY_DIR}/configurable.f + ) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/configurable.f + PROPERTIES GENERATED ON) -# Set the include path -include_directories( -${CMAKE_CURRENT_SOURCE_DIR} -${CMAKE_SOURCE_DIR}/lib/qsastime -${CMAKE_SOURCE_DIR}/include -${CMAKE_BINARY_DIR} -${CMAKE_BINARY_DIR}/include -) + # Set the include path + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/lib/qsastime + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/include + ) -## Build C part of F77 bindings -set(plplotf77c${LIB_TAG}_LIB_SRCS -sc3d.c -sccont.c -scstubs.c -) + ## Build C part of F77 bindings + set(plplotf77c${LIB_TAG}_LIB_SRCS + sc3d.c + sccont.c + scstubs.c + ) -if(BUILD_SHARED_LIBS) - SET_SOURCE_FILES_PROPERTIES( ${plplotf77c${LIB_TAG}_LIB_SRCS} + if(BUILD_SHARED_LIBS) + SET_SOURCE_FILES_PROPERTIES( ${plplotf77c${LIB_TAG}_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) -endif(BUILD_SHARED_LIBS) + endif(BUILD_SHARED_LIBS) -add_library(plplotf77c${LIB_TAG} ${plplotf77c${LIB_TAG}_LIB_SRCS}) + add_library(plplotf77c${LIB_TAG} ${plplotf77c${LIB_TAG}_LIB_SRCS}) -target_link_libraries(plplotf77c${LIB_TAG} plplot${LIB_TAG}) + target_link_libraries(plplotf77c${LIB_TAG} plplot${LIB_TAG}) -if(USE_RPATH) - get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) - set_target_properties(plplotf77c${LIB_TAG} - PROPERTIES - SOVERSION ${plplotf77_SOVERSION} - VERSION ${plplotf77_VERSION} - INSTALL_RPATH "${LIB_INSTALL_RPATH}" - INSTALL_NAME_DIR "${LIB_DIR}" - ) -else(USE_RPATH) - set_target_properties(plplotf77c${LIB_TAG} - PROPERTIES - SOVERSION ${plplotf77_SOVERSION} - VERSION ${plplotf77_VERSION} - INSTALL_NAME_DIR "${LIB_DIR}" - ) -endif(USE_RPATH) + if(USE_RPATH) + get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) + set_target_properties(plplotf77c${LIB_TAG} + PROPERTIES + SOVERSION ${plplotf77_SOVERSION} + VERSION ${plplotf77_VERSION} + INSTALL_RPATH "${LIB_INSTALL_RPATH}" + INSTALL_NAME_DIR "${LIB_DIR}" + ) + else(USE_RPATH) + set_target_properties(plplotf77c${LIB_TAG} + PROPERTIES + SOVERSION ${plplotf77_SOVERSION} + VERSION ${plplotf77_VERSION} + INSTALL_NAME_DIR "${LIB_DIR}" + ) + endif(USE_RPATH) -# Set the path and the suffix for the (shared) libraries -if(CYGWIN) - if(BUILD_SHARED_LIBS) - set(SHLIB_DIR "${BIN_DIR}") - endif(BUILD_SHARED_LIBS) - set(VERSION_SUFFIX "-${plplotf77_VERSION}") -else(CYGWIN) - set(VERSION_SUFFIX "") -endif(CYGWIN) + # Set the path and the suffix for the (shared) libraries + if(CYGWIN) + if(BUILD_SHARED_LIBS) + set(SHLIB_DIR "${BIN_DIR}") + endif(BUILD_SHARED_LIBS) + set(VERSION_SUFFIX "-${plplotf77_VERSION}") + else(CYGWIN) + set(VERSION_SUFFIX "") + endif(CYGWIN) -install(TARGETS plplotf77c${LIB_TAG} -ARCHIVE DESTINATION ${LIB_DIR} -LIBRARY DESTINATION ${LIB_DIR} -RUNTIME DESTINATION ${BIN_DIR} -) + install(TARGETS plplotf77c${LIB_TAG} + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) -## Build fortran part of F77 bindings -if(STATIC_OPTS) - # Put the file configurable.f in a separate static library - set(plplotf77opts${LIB_TAG}_LIB_SRCS - configurable.f - ) - set(plplotf77${LIB_TAG}_LIB_SRCS - strutil.f - sfstubs.f - ) -else(STATIC_OPTS) - set(plplotf77${LIB_TAG}_LIB_SRCS - strutil.f - sfstubs.f - configurable.f - ) -endif(STATIC_OPTS) + ## Build fortran part of F77 bindings + if(STATIC_OPTS) + # Put the file configurable.f in a separate static library + set(plplotf77opts${LIB_TAG}_LIB_SRCS + configurable.f + ) + set(plplotf77${LIB_TAG}_LIB_SRCS + strutil.f + sfstubs.f + ) + else(STATIC_OPTS) + set(plplotf77${LIB_TAG}_LIB_SRCS + strutil.f + sfstubs.f + configurable.f + ) + endif(STATIC_OPTS) -if(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MINGW) - SET(plplotf77${LIB_TAG}_LIB_SRCS ${plplotf77${LIB_TAG}_LIB_SRCS} plplotf77.def) -endif(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MINGW) + if(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MINGW) + SET(plplotf77${LIB_TAG}_LIB_SRCS ${plplotf77${LIB_TAG}_LIB_SRCS} plplotf77.def) + endif(WIN32 AND BUILD_SHARED_LIBS AND NOT CYGWIN AND NOT MINGW) -add_library(plplotf77${LIB_TAG} ${plplotf77${LIB_TAG}_LIB_SRCS}) + add_library(plplotf77${LIB_TAG} ${plplotf77${LIB_TAG}_LIB_SRCS}) -if(STATIC_OPTS) - add_library(plplotf77opts${LIB_TAG} STATIC ${plplotf77opts${LIB_TAG}_LIB_SRCS}) - target_link_libraries(plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) - target_link_libraries(plplotf77opts${LIB_TAG} plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) -else(STATIC_OPTS) - target_link_libraries(plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) -endif(STATIC_OPTS) + if(STATIC_OPTS) + add_library(plplotf77opts${LIB_TAG} STATIC ${plplotf77opts${LIB_TAG}_LIB_SRCS}) + target_link_libraries(plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) + target_link_libraries(plplotf77opts${LIB_TAG} plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) + else(STATIC_OPTS) + target_link_libraries(plplotf77${LIB_TAG} plplotf77c${LIB_TAG}) + endif(STATIC_OPTS) -if(USE_RPATH) - set_target_properties(plplotf77${LIB_TAG} - PROPERTIES - SOVERSION ${plplotf77_SOVERSION} - VERSION ${plplotf77_VERSION} - INSTALL_RPATH "${LIB_INSTALL_RPATH}" - INSTALL_NAME_DIR "${LIB_DIR}" - ) -else(USE_RPATH) - set_target_properties(plplotf77${LIB_TAG} - PROPERTIES - SOVERSION ${plplotf77_SOVERSION} - VERSION ${plplotf77_VERSION} - INSTALL_NAME_DIR "${LIB_DIR}" - ) -endif(USE_RPATH) + if(USE_RPATH) + set_target_properties(plplotf77${LIB_TAG} + PROPERTIES + SOVERSION ${plplotf77_SOVERSION} + VERSION ${plplotf77_VERSION} + INSTALL_RPATH "${LIB_INSTALL_RPATH}" + INSTALL_NAME_DIR "${LIB_DIR}" + ) + else(USE_RPATH) + set_target_properties(plplotf77${LIB_TAG} + PROPERTIES + SOVERSION ${plplotf77_SOVERSION} + VERSION ${plplotf77_VERSION} + INSTALL_NAME_DIR "${LIB_DIR}" + ) + endif(USE_RPATH) -install(TARGETS plplotf77${LIB_TAG} -ARCHIVE DESTINATION ${LIB_DIR} -LIBRARY DESTINATION ${LIB_DIR} -RUNTIME DESTINATION ${BIN_DIR} -) + install(TARGETS plplotf77${LIB_TAG} + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) -# Configure pkg-config *.pc file corresponding to libplplotf77${LIB_TAG} -if(PKG_CONFIG_EXECUTABLE) - if(LIB_TAG) - set(PC_PRECISION "double") - else(LIB_TAG) - set(PC_PRECISION "single") - endif(LIB_TAG) - # Each list element must consist of a colon-separated string with the - # following fields which are parsed out in the foreach loop below and - # used to configure the corresponding pkg-config *.pc file. - # BINDING - ENABLE_${BINDING} keeps track of whether a - # binding has been enabled (ON) or not (OFF). - # Also, ${BINDING} used to determine PC_FILE_SUFFIX - # which helps to determine name of configured - # *.pc file. - # PC_SHORT_NAME - Used in *.pc NAME: field - # PC_LONG_NAME - Used in *.pc Description: field - # PC_LIBRARY_NAME - Used in *.pc Libs: field - # Also used to determine PC_LINK_FLAGS and - # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags: - # fields. - set(PC_DATA "f77:F77:F77 bindings, :plplotf77${LIB_TAG}${VERSION_SUFFIX}") + if(STATIC_OPTS) + install(TARGETS plplotf77opts${LIB_TAG} + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) + endif(STATIC_OPTS) - string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA}) - set(PC_FILE_SUFFIX "-${BINDING}") - set(PC_REQUIRES "plplot${LIB_TAG}") - string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA}) - string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA}) - string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA}) - set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}") - set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}") - set(PC_LINK_FLAGS - "-l${PC_LIBRARY_NAME} -lplplotf77c${LIB_TAG}${VERSION_SUFFIX} ${PC_LINK_FLAGS}" - ) - set(PC_CONFIGURED_FILE - ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc - ) - configure_file( - ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake - ${PC_CONFIGURED_FILE} - @ONLY - ) - install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR}) -endif(PKG_CONFIG_EXECUTABLE) + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotf77.cmake + ) + + # Configure pkg-config *.pc file corresponding to libplplotf77${LIB_TAG} + if(PKG_CONFIG_EXECUTABLE) + if(LIB_TAG) + set(PC_PRECISION "double") + else(LIB_TAG) + set(PC_PRECISION "single") + endif(LIB_TAG) + # Each list element must consist of a colon-separated string with the + # following fields which are parsed out in the foreach loop below and + # used to configure the corresponding pkg-config *.pc file. + # BINDING - ENABLE_${BINDING} keeps track of whether a + # binding has been enabled (ON) or not (OFF). + # Also, ${BINDING} used to determine PC_FILE_SUFFIX + # which helps to determine name of configured + # *.pc file. + # PC_SHORT_NAME - Used in *.pc NAME: field + # PC_LONG_NAME - Used in *.pc Description: field + # PC_LIBRARY_NAME - Used in *.pc Libs: field + # Also used to determine PC_LINK_FLAGS and + # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags: + # fields. + set(PC_DATA "f77:F77:F77 bindings, :plplotf77${LIB_TAG}${VERSION_SUFFIX}") + + string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA}) + set(PC_FILE_SUFFIX "-${BINDING}") + set(PC_REQUIRES "plplot${LIB_TAG}") + string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA}) + string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA}) + string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA}) + set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}") + set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}") + set(PC_LINK_FLAGS + "-l${PC_LIBRARY_NAME} -lplplotf77c${LIB_TAG}${VERSION_SUFFIX} ${PC_LINK_FLAGS}" + ) + set(PC_CONFIGURED_FILE + ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc + ) + configure_file( + ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake + ${PC_CONFIGURED_FILE} + @ONLY + ) + install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR}) + endif(PKG_CONFIG_EXECUTABLE) endif(ENABLE_f77) Modified: trunk/bindings/f95/CMakeLists.txt =================================================================== --- trunk/bindings/f95/CMakeLists.txt 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/bindings/f95/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) @@ -99,17 +99,17 @@ endif(USE_RPATH) install(TARGETS plplotf95c${LIB_TAG} + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) - ## Build fortran part of F95 bindings if(STATIC_OPTS) set(plplotf95opts${LIB_TAG}_LIB_SRCS configurable.f90 - ) + ) set(plplotf95${LIB_TAG}_LIB_SRCS strutil.f90 sfstubsf95.f90 @@ -170,11 +170,26 @@ endif(CYGWIN) install(TARGETS plplotf95${LIB_TAG} + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) + if(STATIC_OPTS) + install(TARGETS plplotf95opts${LIB_TAG} + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) + endif(STATIC_OPTS) + + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotf95.cmake + ) + # For CMake-2.6.0 and above, the module files are created by # default during the library build in the bindings/f95 directory. install( Modified: trunk/examples/CMakeLists.txt_installed_examples =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/examples/CMakeLists.txt_installed_examples 2009-05-12 18:38:50 UTC (rev 9972) @@ -30,4 +30,20 @@ include(export_plplot) add_subdirectory(c) -add_subdirectory(c++) + +if(ENABLE_cxx) + add_subdirectory(c++) +endif(ENABLE_cxx) + +if(ENABLE_f77) + add_subdirectory(f77) +endif(ENABLE_f77) + +if(ENABLE_f95) + add_subdirectory(f95) +endif(ENABLE_f95) + +if(ENABLE_d) + add_subdirectory(d) +endif(ENABLE_d) + Modified: trunk/examples/f77/CMakeLists.txt =================================================================== --- trunk/examples/f77/CMakeLists.txt 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/examples/f77/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) @@ -132,3 +132,8 @@ DESTINATION ${DATA_DIR}/examples/f77 ) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples_f77 +DESTINATION ${DATA_DIR}/examples/f77 +RENAME CMakeLists.txt +) + Added: trunk/examples/f77/CMakeLists.txt_installed_examples_f77 =================================================================== --- trunk/examples/f77/CMakeLists.txt_installed_examples_f77 (rev 0) +++ trunk/examples/f77/CMakeLists.txt_installed_examples_f77 2009-05-12 18:38:50 UTC (rev 9972) @@ -0,0 +1,64 @@ +# f77/CMakeLists.txt for installed PLplot examples. +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(f77_STRING_INDICES +"01" +"02" +"03" +"04" +"05" +"06" +"07" +"08" +"09" +"10" +"11" +"12" +"13" +"14" +"15" +"16" +"16a" +"17" +"18" +"19" +"20" +"21" +"22" +"23" +"24" +"25" +"26" +"27" +"28" +"29" +"30" +"31" +) + +include_directories(${INCLUDE_DIR}) +foreach(STRING_INDEX ${f77_STRING_INDICES}) + add_executable(x${STRING_INDEX}f ${CMAKE_CURRENT_SOURCE_DIR}/x${STRING_INDEX}f.f) + if(STATIC_OPTS) + target_link_libraries(x${STRING_INDEX}f plplotf77opts${LIB_TAG} plplotf77${LIB_TAG}) + else(STATIC_OPTS) + target_link_libraries(x${STRING_INDEX}f plplotf77${LIB_TAG}) + endif(STATIC_OPTS) +endforeach(STRING_INDEX ${f77_STRING_INDICES}) Property changes on: trunk/examples/f77/CMakeLists.txt_installed_examples_f77 ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/f95/CMakeLists.txt =================================================================== --- trunk/examples/f95/CMakeLists.txt 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/examples/f95/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) @@ -114,3 +114,8 @@ DESTINATION ${DATA_DIR}/examples/f95 ) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples_f95 +DESTINATION ${DATA_DIR}/examples/f95 +RENAME CMakeLists.txt +) + Added: trunk/examples/f95/CMakeLists.txt_installed_examples_f95 =================================================================== --- trunk/examples/f95/CMakeLists.txt_installed_examples_f95 (rev 0) +++ trunk/examples/f95/CMakeLists.txt_installed_examples_f95 2009-05-12 18:38:50 UTC (rev 9972) @@ -0,0 +1,69 @@ +# f77/CMakeLists.txt for installed PLplot examples. +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(f77_STRING_INDICES +"01" +"02" +"03" +"04" +"05" +"06" +"07" +"08" +"09" +"10" +"11" +"12" +"13" +"14" +"15" +"16" +"16a" +"17" +"18" +"19" +"20" +"21" +"22" +"23" +"24" +"25" +"26" +"27" +"28" +"29" +"30" +"31" +) + +include_directories(${INCLUDE_DIR} ${F95_MOD_DIR}) +foreach(STRING_INDEX ${f77_STRING_INDICES}) + # Need unique target name + add_executable(x${STRING_INDEX}f95 x${STRING_INDEX}f.f90) + set_target_properties( + x${STRING_INDEX}f95 PROPERTIES + OUTPUT_NAME x${STRING_INDEX}f + ) + if(STATIC_OPTS) + target_link_libraries(x${STRING_INDEX}f95 plplotf95opts${LIB_TAG} plplotf95${LIB_TAG}) + else(STATIC_OPTS) + target_link_libraries(x${STRING_INDEX}f95 plplotf95${LIB_TAG}) + endif(STATIC_OPTS) +endforeach(STRING_INDEX ${f77_STRING_INDICES}) Property changes on: trunk/examples/f95/CMakeLists.txt_installed_examples_f95 ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 17:55:16 UTC (rev 9971) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 18:38:50 UTC (rev 9972) @@ -2,3 +2,14 @@ # installed examples. set(LIB_TAG "@LIB_TAG@") set(INCLUDE_DIR @INCLUDE_DIR@) +set(ENABLE_cxx @ENABLE_cxx@) +set(ENABLE_f77 @ENABLE_f77@) +set(ENABLE_f95 @ENABLE_f95@) +if(ENABLE_F77 OR ENABLE_f95) + set(STATIC_OPTS @STATIC_OPTS@) + enable_language(Fortran) +endif(ENABLE_F77 OR ENABLE_f95) +if(ENABLE_f95) + set(F95_MOD_DIR @F95_MOD_DIR@) +endif(ENABLE_f95) +#set(ENABLE_d @ENABLE_d@) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-12 19:09:23
|
Revision: 9973 http://plplot.svn.sourceforge.net/plplot/?rev=9973&view=rev Author: airwin Date: 2009-05-12 19:09:15 +0000 (Tue, 12 May 2009) Log Message: ----------- Add D examples to CMake-based build system for installed examples. Modified Paths: -------------- trunk/bindings/d/CMakeLists.txt trunk/examples/CMakeLists.txt trunk/examples/d/CMakeLists.txt trunk/examples/plplot_configure.cmake_installed_examples.in Added Paths: ----------- trunk/examples/d/CMakeLists.txt_installed_examples_d Modified: trunk/bindings/d/CMakeLists.txt =================================================================== --- trunk/bindings/d/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) +++ trunk/bindings/d/CMakeLists.txt 2009-05-12 19:09:15 UTC (rev 9973) @@ -33,8 +33,14 @@ add_library(plplotdmd${LIB_TAG} STATIC ${plplotdmd${LIB_TAG}_LIB_SRCS}) install(TARGETS plplotdmd${LIB_TAG} + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotd.cmake + ) + endif(ENABLE_d) Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) +++ trunk/examples/CMakeLists.txt 2009-05-12 19:09:15 UTC (rev 9973) @@ -278,3 +278,25 @@ RENAME plplot_configure.cmake ) +# Install PLplot-specific language support files needed for CMake-based +# build of installed examples. + +set(LANG_SUPPORT_FILES + CMakeD_Copyright.txt + CMakeDCompiler.cmake.in + CMakeDInformation.cmake + CMakeDetermineDCompiler.cmake + CMakeTestDCompiler.cmake + + CMakeAdaCompiler.cmake.in + CMakeAdaInformation.cmake + CMakeDetermineAdaCompiler.cmake + CMakeTestAdaCompiler.cmake + ) + +foreach(LANG_SUPPORT_FILE ${LANG_SUPPORT_FILES}) + install(FILES + ${CMAKE_SOURCE_DIR}/cmake/modules/${LANG_SUPPORT_FILE} + DESTINATION ${DATA_DIR}/examples/cmake/modules + ) +endforeach(LANG_SUPPORT_FILE ${LANG_SUPPORT_FILES}) Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-05-12 18:38:50 UTC (rev 9972) +++ trunk/examples/d/CMakeLists.txt 2009-05-12 19:09:15 UTC (rev 9973) @@ -71,3 +71,9 @@ DESTINATION ${DATA_DIR}/examples/d RENAME Makefile ) + +install(FILES CMakeLists.txt_installed_examples_d + DESTINATION ${DATA_DIR}/examples/d + RENAME CMakeLists.txt + ) + Added: trunk/examples/d/CMakeLists.txt_installed_examples_d =================================================================== --- trunk/examples/d/CMakeLists.txt_installed_examples_d (rev 0) +++ trunk/examples/d/CMakeLists.txt_installed_examples_d 2009-05-12 19:09:15 UTC (rev 9973) @@ -0,0 +1,47 @@ +# d/CMakeLists.txt for installed PLplot examples +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(d_STRING_INDICES +"02" +"03" +"04" +"05" +"06" +"07" +"08" +"10" +"11" +"12" +"13" +"17" +"23" +"24" +"25" +"27" +"29" +"30" +) + +include_directories(${INCLUDE_DIR}) +foreach(STRING_INDEX ${d_STRING_INDICES}) + set(d_SRCS ${d_SRCS} x${STRING_INDEX}d.d) + add_executable(x${STRING_INDEX}d x${STRING_INDEX}d.d) + target_link_libraries(x${STRING_INDEX}d plplotdmd${LIB_TAG} plplot${LIB_TAG} ${MATH_LIB}) +endforeach(STRING_INDEX ${d_STRING_INDICES}) Property changes on: trunk/examples/d/CMakeLists.txt_installed_examples_d ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 18:38:50 UTC (rev 9972) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 19:09:15 UTC (rev 9973) @@ -12,4 +12,7 @@ if(ENABLE_f95) set(F95_MOD_DIR @F95_MOD_DIR@) endif(ENABLE_f95) -#set(ENABLE_d @ENABLE_d@) +set(ENABLE_d @ENABLE_d@) +if(ENABLE_d) + enable_language(D) +endif(ENABLE_d) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-12 22:50:57
|
Revision: 9976 http://plplot.svn.sourceforge.net/plplot/?rev=9976&view=rev Author: airwin Date: 2009-05-12 22:50:43 +0000 (Tue, 12 May 2009) Log Message: ----------- Add Ada examples to new CMake-based build system for installed examples. Modified Paths: -------------- trunk/bindings/ada/CMakeLists.txt trunk/examples/CMakeLists.txt_installed_examples trunk/examples/ada/CMakeLists.txt trunk/examples/plplot_configure.cmake_installed_examples.in Added Paths: ----------- trunk/examples/ada/CMakeLists.txt_installed_examples_ada Modified: trunk/bindings/ada/CMakeLists.txt =================================================================== --- trunk/bindings/ada/CMakeLists.txt 2009-05-12 21:52:53 UTC (rev 9975) +++ trunk/bindings/ada/CMakeLists.txt 2009-05-12 22:50:43 UTC (rev 9976) @@ -21,15 +21,15 @@ if(ENABLE_ada) set(SOURCE_LIST - plplot.adb - plplot.ads - plplot_thin.adb - plplot_thin.ads - plplot_traditional.adb - plplot_traditional.ads - plplot_auxiliary.adb - plplot_auxiliary.ads - ) + plplot.adb + plplot.ads + plplot_thin.adb + plplot_thin.ads + plplot_traditional.adb + plplot_traditional.ads + plplot_auxiliary.adb + plplot_auxiliary.ads + ) # These are Ada library information files built by gnat. I am not # sure whether the name suffixes correspond to the *.adb or *.ads files @@ -38,67 +38,73 @@ # N.B. the absolute location prefix of these files may have to be changed # in the future since this is a CMake internal. set(ALI_PREFIX - ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/plplotada${LIB_TAG}.dir - ) + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/plplotada${LIB_TAG}.dir + ) set(ALI_LIST - ${ALI_PREFIX}/plplot.ali - ${ALI_PREFIX}/plplot_thin.ali - ${ALI_PREFIX}/plplot_traditional.ali - ${ALI_PREFIX}/plplot_auxiliary.ali - ) + ${ALI_PREFIX}/plplot.ali + ${ALI_PREFIX}/plplot_thin.ali + ${ALI_PREFIX}/plplot_traditional.ali + ${ALI_PREFIX}/plplot_auxiliary.ali + ) set(plplotada${LIB_TAG}_LIB_SRCS) foreach(SOURCE_FILE ${SOURCE_LIST}) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - ) + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + ) list(APPEND plplotada${LIB_TAG}_LIB_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - ) + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + ) endforeach(SOURCE_FILE ${SOURCE_LIST}) add_library(plplotada${LIB_TAG} ${plplotada${LIB_TAG}_LIB_SRCS}) target_link_libraries(plplotada${LIB_TAG} - plplot${LIB_TAG} ${GNAT_LIB} - ) + plplot${LIB_TAG} ${GNAT_LIB} + ) if(USE_RPATH) get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) set_target_properties(plplotada${LIB_TAG} - PROPERTIES - SOVERSION ${plplotada_SOVERSION} - VERSION ${plplotada_VERSION} - INSTALL_RPATH "${LIB_INSTALL_RPATH}" - INSTALL_NAME_DIR "${LIB_DIR}" - ) + PROPERTIES + SOVERSION ${plplotada_SOVERSION} + VERSION ${plplotada_VERSION} + INSTALL_RPATH "${LIB_INSTALL_RPATH}" + INSTALL_NAME_DIR "${LIB_DIR}" + ) else(USE_RPATH) set_target_properties(plplotada${LIB_TAG} - PROPERTIES - SOVERSION ${plplotada_SOVERSION} - VERSION ${plplotada_VERSION} - INSTALL_NAME_DIR "${LIB_DIR}" - ) + PROPERTIES + SOVERSION ${plplotada_SOVERSION} + VERSION ${plplotada_VERSION} + INSTALL_NAME_DIR "${LIB_DIR}" + ) endif(USE_RPATH) install(FILES ${plplotada${LIB_TAG}_LIB_SRCS} - DESTINATION ${ADA_INCLUDE_DIR} - ) + DESTINATION ${ADA_INCLUDE_DIR} + ) # Permissions of *.ali files in accordance with # http://www.ada-france.org/debian/debian-ada-policy.html install(FILES ${ALI_LIST} - DESTINATION ${ADA_LIB_DIR} - PERMISSIONS OWNER_READ GROUP_READ WORLD_READ - ) + DESTINATION ${ADA_LIB_DIR} + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ + ) install(TARGETS plplotada${LIB_TAG} - ARCHIVE DESTINATION ${LIB_DIR} - LIBRARY DESTINATION ${LIB_DIR} - RUNTIME DESTINATION ${BIN_DIR} - ) + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotada.cmake + ) + # Configure pkg-config *.pc file corresponding to libplplotada${LIB_TAG} if(PKG_CONFIG_EXECUTABLE) if(LIB_TAG) @@ -121,7 +127,7 @@ # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags: # fields. set(PC_DATA "ada:Ada:Ada bindings, :plplotada${LIB_TAG}") - + string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA}) set(PC_FILE_SUFFIX "-${BINDING}") set(PC_REQUIRES "plplot${LIB_TAG}") @@ -132,13 +138,13 @@ set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}") set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}") set(PC_CONFIGURED_FILE - ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc - ) + ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc + ) configure_file( - ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake - ${PC_CONFIGURED_FILE} - @ONLY - ) + ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake + ${PC_CONFIGURED_FILE} + @ONLY + ) install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR}) endif(PKG_CONFIG_EXECUTABLE) Modified: trunk/examples/CMakeLists.txt_installed_examples =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples 2009-05-12 21:52:53 UTC (rev 9975) +++ trunk/examples/CMakeLists.txt_installed_examples 2009-05-12 22:50:43 UTC (rev 9976) @@ -47,3 +47,7 @@ add_subdirectory(d) endif(ENABLE_d) +if(ENABLE_ada) + add_subdirectory(ada) +endif(ENABLE_ada) + Modified: trunk/examples/ada/CMakeLists.txt =================================================================== --- trunk/examples/ada/CMakeLists.txt 2009-05-12 21:52:53 UTC (rev 9975) +++ trunk/examples/ada/CMakeLists.txt 2009-05-12 22:50:43 UTC (rev 9976) @@ -147,3 +147,8 @@ RENAME Makefile ) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt_installed_examples_ada +DESTINATION ${DATA_DIR}/examples/ada +RENAME CMakeLists.txt +) + Added: trunk/examples/ada/CMakeLists.txt_installed_examples_ada =================================================================== --- trunk/examples/ada/CMakeLists.txt_installed_examples_ada (rev 0) +++ trunk/examples/ada/CMakeLists.txt_installed_examples_ada 2009-05-12 22:50:43 UTC (rev 9976) @@ -0,0 +1,115 @@ +# ada/CMakeLists.txt for installed PLplot examples +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(ada_STRING_INDICES + "01" + "02" + "03" + "04" + "05" + "06" + "07" + "08" + "09" + "10" + "11" + "12" + "13" + "14" + "15" + "16" + "17" + "18" + "19" + "20" + "21" + "22" + "23" + "24" + "25" + "26" + "27" + "28" + "29" + "30" + "31" + "thick01" + "thick02" + "thick03" + "thick04" + "thick05" + "thick06" + "thick07" + "thick08" + "thick09" + "thick10" + "thick11" + "thick12" + "thick13" + "thick14" + "thick15" + "thick16" + "thick17" + "thick18" + "thick19" + "thick20" + "thick21" + "thick22" + "thick23" + "thick24" + "thick25" + "thick26" + "thick27" + "thick28" + "thick29" + "thick30" + "thick31" + ) + +include_directories(${INCLUDE_DIR} ${ADA_INCLUDE_DIR}) +foreach(STRING_INDEX ${ada_STRING_INDICES}) + set(TARGET_NAME x${STRING_INDEX}a) + set(SOURCE_FILE x${STRING_INDEX}a.adb) + # Note due to limitations of the Ada language support for CMake, the the + # nominal source file for add_executable is compiled (which is why a + # real file has to be specified), but otherwise it is ignored except for + # its .adb suffix which identifies the Ada language. The actual source + # file name for the internal gnatmake command that creates the + # executable is constructed from <TARGET>.adb. Since no directory can + # be specified from this construction (don't ask), you must specify the + # directory of <TARGET>.adb with a -aI option (see below). + add_executable( + ${TARGET_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} + ) + + # The first -aI option is required to find <TARGET>.adb (see above + # comment). The second -aI option gives access to the libplplotada spec + # files. The -aL option gives access to the installed libplplotada + # *.ali files. + + set_target_properties( + ${TARGET_NAME} + PROPERTIES + LINK_FLAGS + "-aI${CMAKE_SOURCE_DIR}/ada -aI${ADA_INCLUDE_DIR} -aL${ADA_LIB_DIR}" + ) + target_link_libraries(${TARGET_NAME} plplotada${LIB_TAG}) +endforeach(STRING_INDEX ${ada_STRING_INDICES}) Property changes on: trunk/examples/ada/CMakeLists.txt_installed_examples_ada ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 21:52:53 UTC (rev 9975) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-12 22:50:43 UTC (rev 9976) @@ -2,6 +2,7 @@ # installed examples. set(LIB_TAG "@LIB_TAG@") set(INCLUDE_DIR @INCLUDE_DIR@) +set(MATH_LIB @MATH_LIB@) set(ENABLE_cxx @ENABLE_cxx@) set(ENABLE_f77 @ENABLE_f77@) set(ENABLE_f95 @ENABLE_f95@) @@ -16,3 +17,9 @@ if(ENABLE_d) enable_language(D) endif(ENABLE_d) +set(ENABLE_ada @ENABLE_ada@) +if(ENABLE_ada) + enable_language(Ada) + set(ADA_INCLUDE_DIR @ADA_INCLUDE_DIR@) + set(ADA_LIB_DIR @ADA_LIB_DIR@) +endif(ENABLE_ada) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-14 11:37:54
|
Revision: 9978 http://plplot.svn.sourceforge.net/plplot/?rev=9978&view=rev Author: smekal Date: 2009-05-14 11:37:36 +0000 (Thu, 14 May 2009) Log Message: ----------- Further improvement of D bindings. Necessary changes to existing D examples. Example 17 doesn't crash anymore. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x05d.d trunk/examples/d/x17d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-14 00:16:19 UTC (rev 9977) +++ trunk/bindings/d/plplot.d 2009-05-14 11:37:36 UTC (rev 9978) @@ -18,11 +18,21 @@ /* simple arrow plotter. */ //void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -//void c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); +void plsvect(PLFLT[] arrowx, PLFLT[] arrowy, PLBOOL fill) +{ + PLINT npts=arrowx.length; + assert(npts==arrowy.length, "plsvect(): Arrays must be of same length!"); + c_plsvect(arrowx.ptr, arrowy.ptr, npts, fill); +} + /* This functions similarly to plbox() except that the origin of the axes */ /* is placed at the user-specified point (x0, y0). */ -//void c_plaxes(PLFLT x0, PLFLT y0, char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); +void plaxes(PLFLT x0, PLFLT y0, string xopt, PLFLT xtick, PLINT nxsub, + string yopt, PLFLT ytick, PLINT nysub) +{ + c_plaxes(x0, y0, toStringz(xopt), xtick, nxsub, toStringz(yopt), ytick, nysub); +} /* Plot a histogram using x to store data values and y to store frequencies */ void plbin(PLFLT[] x, PLFLT[] y, PLINT opt) @@ -95,19 +105,37 @@ } /* Get the current device (keyword) name */ -//void c_plgdev(char *p_dev); +void plgdev(out string p_dev) +{ + char[1024] temp; + c_plgdev(temp.ptr); + p_dev=toString(temp.ptr); +} /* Get the (current) output file name. Must be preallocated to >80 bytes */ -//void c_plgfnam(char *fnam); +void plgfnam(out string fnam) +{ + char[1024] temp; + c_plgfnam(temp.ptr); + fnam=toString(temp.ptr); +} /* grid irregularly sampled data */ //void c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data); /* Get the current library version number */ -//void c_plgver(char *p_ver); +void plgver(out string p_ver) +{ + char[1024] temp; + c_plgver(temp.ptr); + p_ver=toString(temp.ptr); +} /* Draws a histogram of n values of a variable in array data[0..n-1] */ -//void c_plhist(PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt); +void plhist(PLFLT[] data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt) +{ + c_plhist(data.length, data.ptr, datmin, datmax, nbin, opt); +} /* Simple routine for labelling graphs. */ void pllab(string xlabel, string ylabel, string tlabel) @@ -306,7 +334,24 @@ } /* Create 1d stripchart */ -//void c_plstripc(PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, char **legline, char *labx, char *laby, char *labtop); +void plstripc(PLINT* id, string xspec, string yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, + PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, + PLINT colbox, PLINT collab, PLINT[] colline, PLINT[] styline, string[] legline, + string labx, string laby, string labtop) +{ + assert(4==colline.length, "plstripc(): Arrays must be of length 4!"); + assert(4==styline.length, "plstripc(): Arrays must be of length 4!"); + assert(4==legline.length, "plstripc(): Arrays must be of length 4!"); + + char*[4] leglinez; + for(int i=0; i<4; i++) { + leglinez[i] = toStringz(legline[i]); + } + + c_plstripc(id, toStringz(xspec), toStringz(yspec), xmin, xmax, xjump, ymin, ymax, + xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez.ptr, + toStringz(labx), toStringz(laby), toStringz(labtop)); +} /* plots a 2d image (or a matrix too large for plshade() ) */ //void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, PLFLT valuemin, PLFLT valuemax); @@ -817,7 +862,7 @@ alias c_pl_setcontlabelformat pl_setcontlabelformat; alias c_pl_setcontlabelparam pl_setcontlabelparam; alias c_pladv pladv; -alias c_plaxes plaxes; +//alias c_plaxes plaxes; //alias c_plbin plbin; alias c_plbop plbop; //alias c_plbox plbox; @@ -848,13 +893,13 @@ alias c_plgcol0a plgcol0a; alias c_plgcolbga plgcolbga; alias c_plgcompression plgcompression; -alias c_plgdev plgdev; +//alias c_plgdev plgdev; alias c_plgdidev plgdidev; alias c_plgdiori plgdiori; alias c_plgdiplt plgdiplt; alias c_plgfam plgfam; alias c_plgfci plgfci; -alias c_plgfnam plgfnam; +//alias c_plgfnam plgfnam; alias c_plgfont plgfont; alias c_plglevel plglevel; alias c_plgpage plgpage; @@ -862,13 +907,13 @@ alias c_plgriddata plgriddata; alias c_plgspa plgspa; alias c_plgstrm plgstrm; -alias c_plgver plgver; +//alias c_plgver plgver; alias c_plgvpd plgvpd; alias c_plgvpw plgvpw; alias c_plgxax plgxax; alias c_plgyax plgyax; alias c_plgzax plgzax; -alias c_plhist plhist; +//alias c_plhist plhist; alias c_plhls plhls; alias c_plhlsrgb plhlsrgb; alias c_plimage plimage; @@ -945,12 +990,12 @@ alias c_plstar plstar; //alias c_plstart plstart; alias c_plstripa plstripa; -alias c_plstripc plstripc; +//alias c_plstripc plstripc; alias c_plstripd plstripd; //alias c_plstyl plstyl; alias c_plsurf3d plsurf3d; alias c_plsurf3dl plsurf3dl; -alias c_plsvect plsvect; +//alias c_plsvect plsvect; alias c_plsvpa plsvpa; alias c_plsxax plsxax; alias c_plsyax plsyax; @@ -1005,11 +1050,9 @@ void c_pladv(PLINT page); /* simple arrow plotter. */ +void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); -void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - -void c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); - /* This functions similarly to plbox() except that the origin of the axes */ /* is placed at the user-specified point (x0, y0). */ void c_plaxes(PLFLT x0, PLFLT y0, char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); @@ -1153,9 +1196,8 @@ void c_plgcompression(PLINT *compression); /* Get the current device (keyword) name */ +void c_plgdev(char *p_dev); -void c_plgdev(char *p_dev); - /* Retrieve current window into device space */ void c_plgdidev(PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy); @@ -1177,9 +1219,8 @@ void c_plgfam(PLINT *p_fam, PLINT *p_num, PLINT *p_bmax); /* Get the (current) output file name. Must be preallocated to >80 bytes */ +void c_plgfnam(char *fnam); -void c_plgfnam(char *fnam); - /* Get the current font family, style and weight */ void c_plgfont(PLINT *p_family, PLINT *p_style, PLINT *p_weight); @@ -1200,80 +1241,66 @@ void c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data); - /* type of gridding algorithm for plgriddata() */ - +/* type of gridding algorithm for plgriddata() */ const GRID_CSA = 1; const GRID_DTLI = 2; const GRID_NNI = 3; const GRID_NNIDW = 4; const GRID_NNLI = 5; +const GRID_NNAIDW = 6; -const GRID_NNAIDW = 6; /* Get subpage boundaries in absolute coordinates */ +void c_plgspa(PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax); -void c_plgspa(PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax); - /* Get current stream number. */ +void c_plgstrm(PLINT *p_strm); -void c_plgstrm(PLINT *p_strm); - /* Get the current library version number */ +void c_plgver(char *p_ver); -void c_plgver(char *p_ver); - /* Get viewport boundaries in normalized device coordinates */ +void c_plgvpd(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); -void c_plgvpd(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); - /* Get viewport boundaries in world coordinates */ +void c_plgvpw(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); -void c_plgvpw(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); - /* Get x axis labeling parameters */ +void c_plgxax(PLINT *p_digmax, PLINT *p_digits); -void c_plgxax(PLINT *p_digmax, PLINT *p_digits); - /* Get y axis labeling parameters */ +void c_plgyax(PLINT *p_digmax, PLINT *p_digits); -void c_plgyax(PLINT *p_digmax, PLINT *p_digits); - /* Get z axis labeling parameters */ +void c_plgzax(PLINT *p_digmax, PLINT *p_digits); -void c_plgzax(PLINT *p_digmax, PLINT *p_digits); - -/* Draws a histogram of n values of a variable in array data[0..n-1] */ - /* Flags for plhist() - opt argument; note: some flags are passed to plbin() for the actual plotting */ const PL_HIST_DEFAULT = 0; const PL_HIST_NOSCALING = 1; const PL_HIST_IGNORE_OUTLIERS = 2; const PL_HIST_NOEXPAND = 8; - const PL_HIST_NOEMPTY = 16; -void c_plhist(PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt); +/* Draws a histogram of n values of a variable in array data[0..n-1] */ +void c_plhist(PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt); + /* Set current color (map 0) by hue, lightness, and saturation. */ +void c_plhls(PLFLT h, PLFLT l, PLFLT s); -void c_plhls(PLFLT h, PLFLT l, PLFLT s); - /* Functions for converting between HLS and RGB color space */ +void c_plhlsrgb(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b); -void c_plhlsrgb(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b); - /* Initializes PLplot, using preset or default options */ +void c_plinit(); -void c_plinit(); - /* Draws a line segment from (x1, y1) to (x2, y2). */ +void c_pljoin(PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2); -void c_pljoin(PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2); - /* Simple routine for labelling graphs. */ void c_pllab(char *xlabel, char *ylabel, char *tlabel); /* Sets position of the light source */ -void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); +void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); /* Draws line segments connecting a series of points. */ void c_plline(PLINT n, PLFLT *x, PLFLT *y); @@ -1282,13 +1309,11 @@ void c_plline3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); /* Set line style. */ +void c_pllsty(PLINT lin); -void c_pllsty(PLINT lin); - /* plot continental outline in world coordinates */ +void c_plmap(void function(PLINT , PLFLT *, PLFLT *)mapform, char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); -void c_plmap(void function(PLINT , PLFLT *, PLFLT *)mapform, char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); - /* Plot the latitudes and longitudes on the background. */ void c_plmeridians(void function(PLINT , PLFLT *, PLFLT *)mapform, PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); @@ -1532,24 +1557,20 @@ void c_plssym(PLFLT def, PLFLT scale); /* Initialize PLplot, passing in the windows/page settings. */ +void c_plstar(PLINT nx, PLINT ny); -void c_plstar(PLINT nx, PLINT ny); - /* Initialize PLplot, passing the device name and windows/page settings. */ void c_plstart(char *devname, PLINT nx, PLINT ny); /* Add a point to a stripchart. */ +void c_plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); -void c_plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); - /* Create 1d stripchart */ +void c_plstripc(PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, char **legline, char *labx, char *laby, char *labtop); -void c_plstripc(PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, char **legline, char *labx, char *laby, char *labtop); - /* Deletes and releases memory used by a stripchart. */ +void c_plstripd(PLINT id); -void c_plstripd(PLINT id); - /* plots a 2d image (or a matrix too large for plshade() ) */ void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, PLFLT valuemin, PLFLT valuemax); Modified: trunk/examples/d/x05d.d =================================================================== --- trunk/examples/d/x05d.d 2009-05-14 00:16:19 UTC (rev 9977) +++ trunk/examples/d/x05d.d 2009-05-14 11:37:36 UTC (rev 9978) @@ -3,22 +3,16 @@ Histogram demo. */ -import plplot; import std.math; -import std.string; +import plplot; /*--------------------------------------------------------------------------*\ * main * * Draws a histogram from sample data. \*--------------------------------------------------------------------------*/ -int main( char[][] args ) +int main(char[][] args) { - const int NPTS=2047; - - PLFLT[NPTS] data; - PLFLT delta; - /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -26,16 +20,17 @@ plinit(); /* Fill up data points */ - - delta = 2.0 * PI / cast(double)NPTS; - for( size_t i=0; i<NPTS; i++ ) + const int npts=2047; + PLFLT delta = 2.0*PI/npts; + PLFLT[npts] data; + for(size_t i=0; i<npts; i++ ) data[i] = sin(i*delta); - plcol0( 1 ); - plhist( NPTS, &data[0], -1.1, 1.1, 44, 0 ); - plcol0( 2 ); - pllab( "#frValue", "#frFrequency", - "#frPLplot Example 5 - Probability function of Oscillator" ); + plcol0(1); + plhist(data, -1.1, 1.1, 44, PL_HIST_DEFAULT); + plcol0(2); + pllab("#frValue", "#frFrequency", + "#frPLplot Example 5 - Probability function of Oscillator"); plend(); Modified: trunk/examples/d/x17d.d =================================================================== --- trunk/examples/d/x17d.d 2009-05-14 00:16:19 UTC (rev 9977) +++ trunk/examples/d/x17d.d 2009-05-14 11:37:36 UTC (rev 9978) @@ -3,25 +3,25 @@ Plots a simple stripchart with four pens. */ -import plplot; import std.string; import std.math; import std.stdio; import std.c.stdlib; +import plplot; /*--------------------------------------------------------------------------*\ * main program \*--------------------------------------------------------------------------*/ -int main( char[][] args ) +int main(char[][] args) { /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); /* If db is used the plot is much more smooth. However, because of the async X behaviour, one does not have a real-time scripcharter. */ - plsetopt( "db", "" ); - plsetopt( "np", "" ); + plsetopt("db", ""); + plsetopt("np", ""); /* User sets up plot completely except for window and data * Eventually settings in place when strip chart is created will be @@ -49,7 +49,7 @@ PLINT[4] colline = [ 2, 3, 4, 5 ]; /* pens legend */ - char[][4] legline = [ "sum", "sin", "sin*noi", "sin+noi" ]; + string[4] legline = [ "sum", "sin", "sin*noi", "sin+noi" ]; PLFLT xlab = 0.; /* legend position */ PLFLT ylab = 0.25; @@ -60,7 +60,7 @@ /* Initialize plplot */ plinit(); - pladv( 0 ); + pladv(0); plvsta(); /* Register our error variables with PLplot */ @@ -70,38 +70,37 @@ plsError( &pl_errcode, cast(char*)errmsg ); PLINT id1; - plstripc( &id1, "bcnst", "bcnstv", - tmin, tmax, tjump, ymin, ymax, - xlab, ylab, - autoy, acc, - colbox, collab, - cast(PLINT*)colline, cast(PLINT*)styline, cast(char**)legline, - "t", "", "Strip chart demo" ); + plstripc(&id1, "bcnst", "bcnstv", + tmin, tmax, tjump, ymin, ymax, + xlab, ylab, + autoy, acc, + colbox, collab, + colline, styline, legline, + "t", "", "Strip chart demo"); - if( pl_errcode ) { - writefln( "%s\n", errmsg ); // TODO: to stderr + if(pl_errcode) { + writefln("%s\n", errmsg); // TODO: to stderr return 1; } /* Let plplot handle errors from here on */ - plsError( null, null ); + plsError(null, null); autoy = 0; /* autoscale y */ acc = 1; /* accumulate */ /* This is to represent a loop over time */ /* Let's try a random walk process */ - PLFLT y1=0.0, y2=0.0, y3=0.0, y4=0.0; PLFLT dt=0.1; - const nsteps=1000; + const int nsteps=1000; PLFLT t, noise; - for( size_t n=0; n<nsteps; n++ ) { + for(size_t n=0; n<nsteps; n++) { // todo: usleep? // todo: poll? - t = cast(PLFLT)n*dt; - noise = (cast(PLFLT)std.c.stdlib.rand()/(std.c.stdlib.RAND_MAX+1.0))-0.5; + t = n*dt; + noise = (rand()/(RAND_MAX+1.0))-0.5; y1 += noise; y2 = sin(t*PI/18.); y3 = y2*noise; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-22 20:29:07
|
Revision: 9985 http://plplot.svn.sourceforge.net/plplot/?rev=9985&view=rev Author: airwin Date: 2009-05-22 20:28:43 +0000 (Fri, 22 May 2009) Log Message: ----------- Implement infrastructure to have a shared version of libplplotdmd, but do not actually use it since shared library building using gdc seems broken (at least on Debian Lenny). Modified Paths: -------------- trunk/bindings/d/CMakeLists.txt trunk/cmake/modules/plplot_version.cmake Modified: trunk/bindings/d/CMakeLists.txt =================================================================== --- trunk/bindings/d/CMakeLists.txt 2009-05-20 03:52:37 UTC (rev 9984) +++ trunk/bindings/d/CMakeLists.txt 2009-05-22 20:28:43 UTC (rev 9985) @@ -29,9 +29,40 @@ set(plplotdmd${LIB_TAG}_LIB_SRCS plplot.d ) + # STATIC library the only one that seems to work for now (at least + # on Debian Lenny) so use that rather than shared alternative + set(plplotdmd_SHARED) + if(plplotdm_SHARED) + add_library(plplotdmd${LIB_TAG} ${plplotdmd${LIB_TAG}_LIB_SRCS}) - add_library(plplotdmd${LIB_TAG} STATIC ${plplotdmd${LIB_TAG}_LIB_SRCS}) + if(BUILD_SHARED_LIBS) + SET_SOURCE_FILES_PROPERTIES(${plplotdmd${LIB_TAG}_LIB_SRCS} + PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) + endif(BUILD_SHARED_LIBS) + target_link_libraries(plplotdmd${LIB_TAG} plplot${LIB_TAG}) + + if(USE_RPATH) + get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) + set_target_properties(plplotdmd${LIB_TAG} + PROPERTIES + SOVERSION ${plplotdmd_SOVERSION} + VERSION ${plplotdmd_VERSION} + INSTALL_RPATH "${LIB_INSTALL_RPATH}" + INSTALL_NAME_DIR "${LIB_DIR}" + ) + else(USE_RPATH) + set_target_properties(plplotdmd${LIB_TAG} + PROPERTIES + SOVERSION ${plplotdmd_SOVERSION} + VERSION ${plplotdmd_VERSION} + INSTALL_NAME_DIR "${LIB_DIR}" + ) + endif(USE_RPATH) + else(plplotdm_SHARED) + add_library(plplotdmd${LIB_TAG} STATIC ${plplotdmd${LIB_TAG}_LIB_SRCS}) + endif(plplotdm_SHARED) + install(TARGETS plplotdmd${LIB_TAG} EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} Modified: trunk/cmake/modules/plplot_version.cmake =================================================================== --- trunk/cmake/modules/plplot_version.cmake 2009-05-20 03:52:37 UTC (rev 9984) +++ trunk/cmake/modules/plplot_version.cmake 2009-05-22 20:28:43 UTC (rev 9985) @@ -45,6 +45,9 @@ set(plplotcxx_SOVERSION 9) set(plplotcxx_VERSION ${plplotcxx_SOVERSION}.3.0) +set(plplotdmd_SOVERSION 0) +set(plplotdmd_VERSION ${plplotdmd_SOVERSION}.0.0) + set(plplotf77_SOVERSION 9) set(plplotf77_VERSION ${plplotf77_SOVERSION}.1.1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-23 22:39:47
|
Revision: 9998 http://plplot.svn.sourceforge.net/plplot/?rev=9998&view=rev Author: airwin Date: 2009-05-23 22:39:39 +0000 (Sat, 23 May 2009) Log Message: ----------- Add build of tk examples to new CMake-based build system for the installed examples tree. Modified Paths: -------------- trunk/bindings/tcl/CMakeLists.txt trunk/examples/CMakeLists.txt_installed_examples trunk/examples/plplot_configure.cmake_installed_examples.in trunk/examples/tk/CMakeLists.txt Added Paths: ----------- trunk/examples/tk/CMakeLists.txt_installed_examples_tk Modified: trunk/bindings/tcl/CMakeLists.txt =================================================================== --- trunk/bindings/tcl/CMakeLists.txt 2009-05-23 22:16:12 UTC (rev 9997) +++ trunk/bindings/tcl/CMakeLists.txt 2009-05-23 22:39:39 UTC (rev 9998) @@ -67,6 +67,7 @@ endif(USE_RPATH) install(TARGETS tclmatrix${LIB_TAG} +EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} @@ -230,11 +231,17 @@ endif(USE_RPATH) install(TARGETS plplottcltk${LIB_TAG} +EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) +install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplottcltk.cmake + ) + set(plplottcltk${LIB_TAG}_INSTALLED_HEADERS pltcl.h ) Modified: trunk/examples/CMakeLists.txt_installed_examples =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples 2009-05-23 22:16:12 UTC (rev 9997) +++ trunk/examples/CMakeLists.txt_installed_examples 2009-05-23 22:39:39 UTC (rev 9998) @@ -149,3 +149,9 @@ add_custom_target(test_noninteractive DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/compare) add_dependencies(test_noninteractive ${targets_LIST}) + +if(ENABLE_tk) + add_subdirectory(tk) + get_property(targets_examples_tk GLOBAL PROPERTY TARGETS_examples_tk) +endif(ENABLE_tk) + Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-23 22:16:12 UTC (rev 9997) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-23 22:39:39 UTC (rev 9998) @@ -17,6 +17,7 @@ set(ENABLE_pdl @ENABLE_pdl@) set(ENABLE_python @ENABLE_python@) set(ENABLE_tcl @ENABLE_tcl@) +set(ENABLE_tk @ENABLE_tk@) # Always enable C language. enable_language(C) @@ -60,9 +61,15 @@ set(ENABLE_pygcw @ENABLE_pygcw@) endif(ENABLE_python) -if(ENABLE_tcl) +if(ENABLE_tcl OR ENABLE_tk) set(TCL_TCLSH @TCL_TCLSH@) set(MKTCLINDEX @MKTCLINDEX@) set(MKTCLINDEX_ARGS @MKTCLINDEX_ARGS@) -endif(ENABLE_tcl) +endif(ENABLE_tcl OR ENABLE_tk) +if(ENABLE_tk) + set(ENABLE_itk @ENABLE_itk@) + set(TCL_INCLUDE_PATH @TCL_INCLUDE_PATH@) + set(TK_INCLUDE_PATH @TK_INCLUDE_PATH@) +endif(ENABLE_tk) + Modified: trunk/examples/tk/CMakeLists.txt =================================================================== --- trunk/examples/tk/CMakeLists.txt 2009-05-23 22:16:12 UTC (rev 9997) +++ trunk/examples/tk/CMakeLists.txt 2009-05-23 22:39:39 UTC (rev 9998) @@ -163,3 +163,9 @@ add_custom_target(tclIndex_examples_tk ALL DEPENDS ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex ) + +install(FILES CMakeLists.txt_installed_examples_tk + DESTINATION ${DATA_DIR}/examples/tk + RENAME CMakeLists.txt + ) + Added: trunk/examples/tk/CMakeLists.txt_installed_examples_tk =================================================================== --- trunk/examples/tk/CMakeLists.txt_installed_examples_tk (rev 0) +++ trunk/examples/tk/CMakeLists.txt_installed_examples_tk 2009-05-23 22:39:39 UTC (rev 9998) @@ -0,0 +1,141 @@ +# tk/CMakeLists.txt for installed PLplot examples +### Process this file with cmake to produce Makefile +### +# Copyright (C) 2009 Alan W. Irwin +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU Library General Public License as published +# by the Free Software Foundation; version 2 of the License. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +set(tk_FILES) + +set(tk_SRC_FILES + README.tkdemos + runAllDemos.tcl + runExtendedDemos.tcl + tkdemos.tcl + tk01 + tk02 + tk03 + tk04 + ) + +set(tk_STRING_INDICES + "01" + "02" + "03" + "04" + "05" + "06" + "07" + "08" + "09" + "10" + "11" + "12" + "13" + "14" + "15" + "16" + "17" + "18" + "19" + "20" + "21" + "22" + "23" + "24" + "25" + "26" + "27" + "28" + "29" + "30" + ) + +# Copy files to the binary directory (if different) for generating tclIndex +# This ensures no files are created in the source tree. +if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_file ${tk_SRC_FILES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} + COMMAND ${CMAKE_COMMAND} + -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/${_file} + ${CMAKE_CURRENT_BINARY_DIR}/${_file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file} + ) + set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) + endforeach(_file ${tk_SRC_FILES}) +endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + +foreach(STRING_INDEX ${tk_STRING_INDICES}) + set(_file x${STRING_INDEX}.tcl) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} + COMMAND ${CMAKE_COMMAND} + -E copy + ${CMAKE_SOURCE_DIR}/tcl/${_file} + ${CMAKE_CURRENT_BINARY_DIR}/${_file} + DEPENDS ${CMAKE_SOURCE_DIR}/tcl/${_file} + ) + set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) +endforeach(STRING_INDEX ${tk_STRING_INDICES}) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl + COMMAND ${CMAKE_COMMAND} + -E copy + ${CMAKE_SOURCE_DIR}/tcl/plgrid.tcl + ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl + DEPENDS ${CMAKE_SOURCE_DIR}/tcl/plgrid.tcl + ) +set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex + COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS} + DEPENDS ${tk_FILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + +# The second and fourth Tk examples depend on Itk to work. +set(tk_SCRIPTS tk01 tk03) +set(tk_SRC xtk01.c) + +if(ENABLE_itk) + list(APPEND tk_SCRIPTS tk02 tk04) + list(APPEND tk_SRC xtk02.c xtk04.c) +endif(ENABLE_itk) + +include_directories( + ${TCL_INCLUDE_PATH} + ${TK_INCLUDE_PATH} + ${INCLUDE_DIR} + ) +foreach(TK_SRC_FILE ${tk_SRC}) + string(REGEX REPLACE ".c$" "" TK_EXE ${TK_SRC_FILE}) + add_executable(${TK_EXE} ${TK_SRC_FILE}) + if(BUILD_SHARED_LIBS) + SET_SOURCE_FILES_PROPERTIES(${TK_SRC_FILE} + PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) + endif(BUILD_SHARED_LIBS) + target_link_libraries(${TK_EXE} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${MATH_LIB}) + set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk ${TK_EXE}) +endforeach(TK_SRC_FILE ${tk_SRC}) + +add_custom_target(tclIndex_examples_tk ALL + DEPENDS ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex + ) +set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk tclIndex_examples_tk) Property changes on: trunk/examples/tk/CMakeLists.txt_installed_examples_tk ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-24 04:11:05
|
Revision: 10001 http://plplot.svn.sourceforge.net/plplot/?rev=10001&view=rev Author: airwin Date: 2009-05-24 04:11:03 +0000 (Sun, 24 May 2009) Log Message: ----------- Officially deprecate the hpgl devices (hp7470, hp7580, and lj_hpgl) and the pbm device for the reasons mentioned on list and in README.release. Modified Paths: -------------- trunk/README.release trunk/cmake/modules/drivers-init.cmake Modified: trunk/README.release =================================================================== --- trunk/README.release 2009-05-24 03:59:57 UTC (rev 10000) +++ trunk/README.release 2009-05-24 04:11:03 UTC (rev 10001) @@ -83,6 +83,15 @@ of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. +IX. This is official notice that the hpgl device driver (containing the +hp7470, hp7580, and lj_hpgl devices) has been deprecated as of release 5.9.4. +hp7450 and hp7580 produce many "Invalid pen selection." messages on our +standard examples and lj_hpgl segfaults. + +X. This is official notice that the pbm device driver (containing the +pbm device) has been deprecated as of release 5.9.4 because glibc detects +a catastrophic double free. + INDEX 1. Changes relative to PLplot 5.9.4 (the previous development release) Modified: trunk/cmake/modules/drivers-init.cmake =================================================================== --- trunk/cmake/modules/drivers-init.cmake 2009-05-24 03:59:57 UTC (rev 10000) +++ trunk/cmake/modules/drivers-init.cmake 2009-05-24 04:11:03 UTC (rev 10001) @@ -109,9 +109,12 @@ "gcw:gcw:OFF" # Do not implement gnome which is superseded by gcw #"gnome:gnome:OFF" -"hp7470:hpgl:ON" -"hp7580:hpgl:ON" -"lj_hpgl:hpgl:ON" +# Produces ton of "Invalid pen selection." messages +"hp7470:hpgl:OFF" +# Produces ton of "Invalid pen selection." messages +"hp7580:hpgl:OFF" +# Segfaults. +"lj_hpgl:hpgl:OFF" "imp:impress:OFF" # Default off because poorly maintained (colours are incorrect) # must use software fill, and must run as root. @@ -121,7 +124,8 @@ "mem:mem:ON" "ntk:ntk:OFF" "null:null:ON" -"pbm:pbm:ON" +# glibc detects double free +"pbm:pbm:OFF" "pdf:pdf:OFF" # (2007-09-01) As discussed on list, don't enable plmeta until we sort # out the known issues (e.g., strings, aspect ratio, and TrueType fonts). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-24 16:10:38
|
Revision: 10002 http://plplot.svn.sourceforge.net/plplot/?rev=10002&view=rev Author: airwin Date: 2009-05-24 16:10:28 +0000 (Sun, 24 May 2009) Log Message: ----------- Considerably simplify new CMake-based build system for the installed lua, python, and tcl examples by configuring the examples directory used in the installed version of plplot-test.sh to point to the source tree rather than the build tree in those cases. This means that no files have to be copied to the build tree of the installed examples for lua, python, and tcl, those subdirectories don't have to be processed, etc. Modified Paths: -------------- trunk/examples/CMakeLists.txt_installed_examples trunk/examples/lua/CMakeLists.txt trunk/examples/python/CMakeLists.txt trunk/examples/tcl/CMakeLists.txt trunk/plplot_test/CMakeLists.txt trunk/plplot_test/plplot-test.sh.cmake Removed Paths: ------------- trunk/examples/lua/CMakeLists.txt_installed_examples_lua trunk/examples/python/CMakeLists.txt_installed_examples_python trunk/examples/tcl/CMakeLists.txt_installed_examples_tcl Modified: trunk/examples/CMakeLists.txt_installed_examples =================================================================== --- trunk/examples/CMakeLists.txt_installed_examples 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/CMakeLists.txt_installed_examples 2009-05-24 16:10:28 UTC (rev 10002) @@ -70,8 +70,6 @@ endif(ENABLE_java) if(ENABLE_lua) - add_subdirectory(lua) - get_property(targets_examples_lua GLOBAL PROPERTY TARGETS_examples_lua) list(APPEND language_info_LIST lua:lua) endif(ENABLE_lua) @@ -101,14 +99,10 @@ endif(ENABLE_pdl) if(ENABLE_python) - add_subdirectory(python) - get_property(targets_examples_python GLOBAL PROPERTY TARGETS_examples_python) list(APPEND language_info_LIST python:p) endif(ENABLE_python) if(ENABLE_tcl) - add_subdirectory(tcl) - get_property(targets_examples_tcl GLOBAL PROPERTY TARGETS_examples_tcl) list(APPEND language_info_LIST tcl:t) endif(ENABLE_tcl) Modified: trunk/examples/lua/CMakeLists.txt =================================================================== --- trunk/examples/lua/CMakeLists.txt 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/lua/CMakeLists.txt 2009-05-24 16:10:28 UTC (rev 10002) @@ -119,8 +119,3 @@ RENAME plplot_examples.lua ) -install(FILES CMakeLists.txt_installed_examples_lua - DESTINATION ${DATA_DIR}/examples/lua - RENAME CMakeLists.txt - ) - Deleted: trunk/examples/lua/CMakeLists.txt_installed_examples_lua =================================================================== --- trunk/examples/lua/CMakeLists.txt_installed_examples_lua 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/lua/CMakeLists.txt_installed_examples_lua 2009-05-24 16:10:28 UTC (rev 10002) @@ -1,81 +0,0 @@ -# lua/CMakeLists.txt for installed PLplot examples -### Process this file with cmake to produce Makefile -### -# Copyright (C) 2009 Alan W. Irwin -# -# This file is part of PLplot. -# -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; version 2 of the License. -# -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -set(lua_STRING_INDICES -"01" -"02" -"03" -"04" -"05" -"06" -"07" -"08" -"09" -"10" -"11" -"12" -"13" -"14" -"15" -"16" -"17" -"18" -"19" -"20" -"21" -"22" -"23" -"24" -"25" -"26" -"27" -"28" -"29" -"30" -"31" -) - -set(lua_SCRIPTS plplot_examples.lua) -foreach(STRING_INDEX ${lua_STRING_INDICES}) - set(lua_SCRIPTS ${lua_SCRIPTS} x${STRING_INDEX}.lua) -endforeach(STRING_INDEX ${lua_STRING_INDICES}) - -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - # equivalent to install commands but at "make" time rather than - # "make install" time, to the build tree if different than the source - # tree. - set(command_depends) - foreach(file ${lua_SCRIPTS}) - set( - command_DEPENDS - ${command_DEPENDS} - ${CMAKE_CURRENT_BINARY_DIR}/${file} - ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file} - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ) - endforeach(file ${lua_SCRIPTS} ${lua_DATA}) - add_custom_target(lua_examples ALL DEPENDS ${command_DEPENDS}) - set_property(GLOBAL APPEND PROPERTY TARGETS_examples_lua lua_examples) -endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - Modified: trunk/examples/python/CMakeLists.txt =================================================================== --- trunk/examples/python/CMakeLists.txt 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/python/CMakeLists.txt 2009-05-24 16:10:28 UTC (rev 10002) @@ -187,8 +187,3 @@ PERMISSIONS ${PERM_DATA} ) -install(FILES CMakeLists.txt_installed_examples_python - DESTINATION ${DATA_DIR}/examples/python - RENAME CMakeLists.txt - ) - Deleted: trunk/examples/python/CMakeLists.txt_installed_examples_python =================================================================== --- trunk/examples/python/CMakeLists.txt_installed_examples_python 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/python/CMakeLists.txt_installed_examples_python 2009-05-24 16:10:28 UTC (rev 10002) @@ -1,129 +0,0 @@ -# python/CMakeLists.txt for installed PLplot examples -### Process this file with cmake to produce Makefile -### -# Copyright (C) 2009 Alan W. Irwin -# -# This file is part of PLplot. -# -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; version 2 of the License. -# -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# N.B. examples 14 and 17 handled independently. -set(python_STRING_INDICES -"01" -"02" -"03" -"04" -"05" -"06" -"07" -"08" -"09" -"10" -"11" -"12" -"13" -"15" -"16" -"18" -"19" -"20" -"21" -"22" -"23" -"24" -"25" -"26" -"27" -"28" -"29" -"30" -) - -set(python_SCRIPTS) -# Add some additional installed module files to list of what is normally -# copied to examples/python in the build tree. -set(python_DATA plplot_py_demos.py plplot_python_start.py) -foreach(STRING_INDEX ${python_STRING_INDICES}) - set(python_SCRIPTS ${python_SCRIPTS} x${STRING_INDEX}) - set(python_DATA ${python_DATA} xw${STRING_INDEX}.py) -endforeach(STRING_INDEX ${python_STRING_INDICES}) - -# This list contains standalone scripts which are executable and which -# should be copied to the installed examples build directory. -set( -python_SCRIPTS -${python_SCRIPTS} -pythondemos.py -x14 -x17 -x31 -prova.py -xw14.py -xw17.py -xw31.py -plplot_logo.py -test_circle.py -) - -if(ENABLE_pygcw) - set( - python_SCRIPTS - ${python_SCRIPTS} - plplotcanvas_demo.py - plplotcanvas_animation.py - ) -endif(ENABLE_pygcw) - -# This list contains python modules which are not executable on their own and -# data files that should be copied to the installed examples build tree. - -set( -python_DATA -${python_DATA} -README.pythondemos -README.logo -svg_760x120_gradient.patch -qplplot.py -) - -if(ENABLE_pygcw) - set( - python_DATA - ${python_DATA} - README.plplotcanvas - ) -endif(ENABLE_pygcw) - -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - # equivalent to install commands but at "make" time rather than - # "make install" time, to the build tree if different than the source - # tree. - set(command_depends) - foreach(file ${python_SCRIPTS} ${python_DATA}) - set( - command_DEPENDS - ${command_DEPENDS} - ${CMAKE_CURRENT_BINARY_DIR}/${file} - ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file} - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ) - endforeach(file ${python_SCRIPTS} ${python_DATA}) - add_custom_target(python_examples ALL DEPENDS ${command_DEPENDS}) - set_property(GLOBAL APPEND PROPERTY TARGETS_examples_python python_examples) -endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - Modified: trunk/examples/tcl/CMakeLists.txt =================================================================== --- trunk/examples/tcl/CMakeLists.txt 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/tcl/CMakeLists.txt 2009-05-24 16:10:28 UTC (rev 10002) @@ -120,8 +120,3 @@ add_dependencies(tclIndex_examples_tcl tcl_examples) endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -install(FILES CMakeLists.txt_installed_examples_tcl - DESTINATION ${DATA_DIR}/examples/tcl - RENAME CMakeLists.txt - ) - Deleted: trunk/examples/tcl/CMakeLists.txt_installed_examples_tcl =================================================================== --- trunk/examples/tcl/CMakeLists.txt_installed_examples_tcl 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/examples/tcl/CMakeLists.txt_installed_examples_tcl 2009-05-24 16:10:28 UTC (rev 10002) @@ -1,114 +0,0 @@ -# tcl/CMakeLists.txt for installed PLplot examples -### Process this file with cmake to produce Makefile -### -# Copyright (C) 2009 Alan W. Irwin -# -# This file is part of PLplot. -# -# PLplot is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library General Public License as published -# by the Free Software Foundation; version 2 of the License. -# -# PLplot is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with PLplot; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -set(tcl_FILES -README.tcldemos -plgrid.tcl -plot.dat -plot.tcl -r.dat -stats.log -tcldemos.tcl -) - -set(tcl_STRING_INDICES -"01" -"02" -"03" -"04" -"05" -"06" -"07" -"08" -"09" -"10" -"11" -"12" -"13" -"14" -"15" -"16" -"17" -"18" -"19" -"20" -"21" -"22" -"23" -"24" -"25" -"26" -"27" -"28" -"29" -"30" -"31" -) - -set(tcl_SCRIPTS) -foreach(STRING_INDEX ${tcl_STRING_INDICES}) - set(tcl_FILES ${tcl_FILES} x${STRING_INDEX}.tcl) - set(tcl_SCRIPTS ${tcl_SCRIPTS} x${STRING_INDEX}) -endforeach(STRING_INDEX ${tcl_STRING_INDICES}) - -# Copy file and scripts to the binary directory if different to the -# source directory. Needed because the tclIndex file -# is generated in the binary tree not the source tree. -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - set(tclIndex_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set(tclIndex_DEPENDS) - foreach(file ${tcl_SCRIPTS} ${tcl_FILES}) - set( - tclIndex_DEPENDS - ${tclIndex_DEPENDS} - ${CMAKE_CURRENT_BINARY_DIR}/${file} - ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file} - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ) - endforeach(file ${tcl_SCRIPTS} ${tcl_FILES}) - add_custom_target(tcl_examples ALL DEPENDS ${tclIndex_DEPENDS}) -else(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - set(tclIndex_DEPENDS ${tcl_FILES} ${tcl_SCRIPTS}) - set(tclIndex_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - -add_custom_command( -OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex -COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS} -DEPENDS ${tclIndex_DEPENDS} -WORKING_DIRECTORY ${tclIndex_WORKING_DIRECTORY} -) - -add_custom_target(tclIndex_examples_tcl ALL - DEPENDS ${tclIndex_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex -) -set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tcl tclIndex_examples_tcl) - -# Workaround CMake 2-level make recursion issue where independent -# file dependency chains that refer to the same files must have -# target dependencies between them in order to work for parallel -# builds (and possibly some visual studio builds). -if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - add_dependencies(tclIndex_examples_tcl tcl_examples) -endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") Modified: trunk/plplot_test/CMakeLists.txt =================================================================== --- trunk/plplot_test/CMakeLists.txt 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/plplot_test/CMakeLists.txt 2009-05-24 16:10:28 UTC (rev 10002) @@ -13,13 +13,23 @@ set(JAVA_TEST_ENVIRONMENT "${TEST_ENVIRONMENT} PLPLOT_JAVA_WRAP_DIR=${CMAKE_BINARY_DIR}/bindings/java/ PLPLOT_CLASSPATH=${CMAKE_BINARY_DIR}/examples/java/plplot.jar") + #Build-tree configuration + set(CONFIGURED_EXAMPLES_DIR EXAMPLES_DIR) configure_file( plplot-test.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh @ONLY ) + #Install-tree configuration + set(CONFIGURED_EXAMPLES_DIR SRC_EXAMPLES_DIR) configure_file( + plplot-test.sh.cmake + ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install + @ONLY + ) + + configure_file( plplot-test-interactive.sh.in ${CMAKE_CURRENT_BINARY_DIR}/plplot-test-interactive.sh @ONLY @@ -357,9 +367,10 @@ endforeach(SCRIPT ${SCRIPTS}) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh + FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install DESTINATION ${DATA_DIR}/examples PERMISSIONS ${PERM_SCRIPTS} + RENAME plplot-test.sh ) install( Modified: trunk/plplot_test/plplot-test.sh.cmake =================================================================== --- trunk/plplot_test/plplot-test.sh.cmake 2009-05-24 04:11:03 UTC (rev 10001) +++ trunk/plplot_test/plplot-test.sh.cmake 2009-05-24 16:10:28 UTC (rev 10002) @@ -163,13 +163,13 @@ cxxdir=$EXAMPLES_DIR/c++ f77dir=$EXAMPLES_DIR/f77 f95dir=$EXAMPLES_DIR/f95 -pythondir=$EXAMPLES_DIR/python -tcldir=$EXAMPLES_DIR/tcl +pythondir=$@CONFIGURED_EXAMPLES_DIR@/python +tcldir=$@CONFIGURED_EXAMPLES_DIR@/tcl perldir=$SRC_EXAMPLES_DIR/perl javadir=$EXAMPLES_DIR/java adadir=$EXAMPLES_DIR/ada ocamldir=$EXAMPLES_DIR/ocaml -luadir=$EXAMPLES_DIR/lua +luadir=$@CONFIGURED_EXAMPLES_DIR@/lua ddir=$EXAMPLES_DIR/d octave=@OCTAVE@ octavedir=\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2009-05-25 17:41:29
|
Revision: 10003 http://plplot.svn.sourceforge.net/plplot/?rev=10003&view=rev Author: hezekiahcarty Date: 2009-05-25 17:41:11 +0000 (Mon, 25 May 2009) Log Message: ----------- Add offscreen/raster rendering support in the Cairo driver for plimage and plimagefr Modified Paths: -------------- trunk/drivers/cairo.c trunk/include/plplot.h trunk/src/plimage.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-05-24 16:10:28 UTC (rev 10002) +++ trunk/drivers/cairo.c 2009-05-25 17:41:11 UTC (rev 10003) @@ -73,18 +73,23 @@ static int text_anti_aliasing; static int graphics_anti_aliasing; static int external_drawable; +static int rasterize_image; static DrvOpt cairo_options[] = {{"text_clipping", DRV_INT, &text_clipping, "Use text clipping (text_clipping=0|1)"}, {"text_anti_aliasing", DRV_INT, &text_anti_aliasing, "Set desired text anti-aliasing (text_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t)"}, {"graphics_anti_aliasing", DRV_INT, &graphics_anti_aliasing, "Set desired graphics anti-aliasing (graphics_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t"}, {"external_drawable", DRV_INT, &external_drawable, "Plot to external X drawable"}, + {"rasterize_image", DRV_INT, &rasterize_image, "Raster or vector image rendering (rasterize_image=0|1)"}, {NULL, DRV_INT, NULL, NULL}}; typedef struct { cairo_surface_t *cairoSurface; cairo_t *cairoContext; + cairo_surface_t *cairoSurface_raster; + cairo_t *cairoContext_raster; short text_clipping; short text_anti_aliasing; short graphics_anti_aliasing; + short rasterize_image; double downscale; char *pangoMarkupString; short upDown; @@ -211,6 +216,9 @@ static void poly_line(PLStream *, short *, short *, PLINT); static void filled_polygon(PLStream *pls, short *xa, short *ya, PLINT npts); static void rotate_cairo_surface(PLStream *, float, float, float, float, float, float); +/* Rasterization of plotted material */ +static void start_raster(PLStream*); +static void end_raster(PLStream*); /* PLplot interface functions */ @@ -224,6 +232,84 @@ void plD_polyline_cairo (PLStream *, short *, short *, PLINT); /*---------------------------------------------------------------------- + start_raster() + + Set up off-screen rasterized rendering + ----------------------------------------------------------------------*/ + +void start_raster(PLStream *pls) +{ + PLCairo *aStream; + cairo_surface_t *tmp_sfc; + cairo_t *tmp_context; + + aStream = (PLCairo *)pls->dev; + + /* Do not use the external surface if the user says not to */ + if (!aStream->rasterize_image) + return; + + /* Create an image surface and context for the offscreen rendering */ + aStream->cairoSurface_raster = + cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pls->xlength, pls->ylength); + aStream->cairoContext_raster = cairo_create(aStream->cairoSurface_raster); + + /* Disable antialiasing for the raster surface. The output seems to look + better that way. */ + cairo_set_antialias(aStream->cairoContext_raster, CAIRO_ANTIALIAS_NONE); + + /* Swap the raster and main plot surfaces and contexts */ + tmp_sfc = aStream->cairoSurface; + tmp_context = aStream->cairoContext; + aStream->cairoSurface = aStream->cairoSurface_raster; + aStream->cairoContext = aStream->cairoContext_raster; + /* Save the main plot surface and context for when we are finished */ + aStream->cairoSurface_raster = tmp_sfc; + aStream->cairoContext_raster = tmp_context; +} + +/*---------------------------------------------------------------------- + end_raster() + + Finish off-screen rasterized rendering and copy the result on to the + main plot surface. + ----------------------------------------------------------------------*/ + +void end_raster(PLStream *pls) +{ + PLCairo *aStream; + cairo_surface_t *tmp_sfc; + cairo_t *tmp_context; + + aStream = (PLCairo *)pls->dev; + + /* Do not use the external surface if the user says not to */ + if (!aStream->rasterize_image) + return; + + /* Some Cairo devices support delayed device setup (eg: xcairo with + external drawable and extcairo with an external context). */ + if (aStream->cairoContext == NULL) + plexit("Can not plot to a Cairo device with no context"); + + /* Restore the main plot surface and context for future plotting */ + tmp_sfc = aStream->cairoSurface; + tmp_context = aStream->cairoContext; + aStream->cairoSurface = aStream->cairoSurface_raster; + aStream->cairoContext = aStream->cairoContext_raster; + aStream->cairoSurface_raster = tmp_sfc; + aStream->cairoContext_raster = tmp_context; + + /* Blit the raster surface on to the main plot */ + cairo_set_source_surface(aStream->cairoContext, aStream->cairoSurface_raster, 0.0, 0.0); + cairo_paint(aStream->cairoContext); + + /* Free the now extraneous surface and context */ + cairo_destroy(aStream->cairoContext_raster); + cairo_surface_destroy(aStream->cairoSurface_raster); +} + +/*---------------------------------------------------------------------- plD_bop_cairo() Set up for the next page. @@ -394,6 +480,12 @@ case PLESC_END_TEXT: /* finish a string of text */ text_end_cairo(pls, (EscText *) ptr); break; + case PLESC_START_RASTERIZE: /* Start offscreen/rasterized rendering */ + start_raster(pls); + break; + case PLESC_END_RASTERIZE: /* End offscreen/rasterized rendering */ + end_raster(pls); + break; } } @@ -943,8 +1035,9 @@ speed for a modern cairo stack.*/ aStream->text_clipping = 1; text_clipping = 1; - text_anti_aliasing = 0; // use 'default' text aliasing by default - graphics_anti_aliasing = 0; // use 'default' graphics aliasing by default + text_anti_aliasing = 0; /* use 'default' text aliasing by default */ + graphics_anti_aliasing = 0; /* use 'default' graphics aliasing by default */ + rasterize_image = 1; /* Enable rasterization by default */ /* Check for cairo specific options */ plParseDrvOpts(cairo_options); @@ -954,9 +1047,10 @@ aStream->text_clipping = 0; } - /* Record users desired text and graphics aliasing */ + /* Record users desired text and graphics aliasing and rasterization */ aStream->text_anti_aliasing = text_anti_aliasing; aStream->graphics_anti_aliasing = graphics_anti_aliasing; + aStream->rasterize_image = rasterize_image; return aStream; } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2009-05-24 16:10:28 UTC (rev 10002) +++ trunk/include/plplot.h 2009-05-25 17:41:11 UTC (rev 10003) @@ -269,6 +269,8 @@ #define PLESC_TEXT_CHAR 29 /* render a character of text */ #define PLESC_CONTROL_CHAR 30 /* handle a text control character (super/subscript, etc.) */ #define PLESC_END_TEXT 31 /* finish a drawing a line of text */ +#define PLESC_START_RASTERIZE 32 /* start rasterized rendering */ +#define PLESC_END_RASTERIZE 33 /* end rasterized rendering */ /* Alternative unicode text handling control characters */ #define PLTEXT_FONTCHANGE 0 /* font change in the text stream */ Modified: trunk/src/plimage.c =================================================================== --- trunk/src/plimage.c 2009-05-24 16:10:28 UTC (rev 10002) +++ trunk/src/plimage.c 2009-05-25 17:41:11 UTC (rev 10003) @@ -101,6 +101,7 @@ /* The color to use in the fill */ PLFLT color; + plP_esc(PLESC_START_RASTERIZE, NULL); for (ix = 0; ix < nx ; ix++) { for (iy = 0; iy < ny ; iy++) { /* Only plot values within in appropriate range */ @@ -134,6 +135,7 @@ plfill(4, xf, yf); } } + plP_esc(PLESC_END_RASTERIZE, NULL); } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-26 11:29:56
|
Revision: 10004 http://plplot.svn.sourceforge.net/plplot/?rev=10004&view=rev Author: smekal Date: 2009-05-26 11:29:32 +0000 (Tue, 26 May 2009) Log Message: ----------- Added D examples 1 and 14. Changed CMake files accordingly. Small changes to D bindings (plsetopt) and D example 3 (style). Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt trunk/examples/d/CMakeLists.txt_installed_examples_d trunk/examples/d/x03d.d Added Paths: ----------- trunk/examples/d/x01d.d trunk/examples/d/x14d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-25 17:41:11 UTC (rev 10003) +++ trunk/bindings/d/plplot.d 2009-05-26 11:29:32 UTC (rev 10004) @@ -470,7 +470,10 @@ /* Process input strings, treating them as an option and argument pair. */ /* The first is for the external API, the second the work routine declared here for backward compatibilty. */ -//int c_plsetopt(char *opt, char *optarg); +int plsetopt(string opt, string optarg) +{ + return c_plsetopt(toStringz(opt), toStringz(optarg)); +} /* Miscellaneous */ @@ -970,7 +973,7 @@ alias c_plsdiplt plsdiplt; alias c_plsdiplz plsdiplz; alias c_plsesc plsesc; -alias c_plsetopt plsetopt; +//alias c_plsetopt plsetopt; alias c_plsfam plsfam; alias c_plsfci plsfci; // alias c_plsfnam plsfnam; @@ -1742,16 +1745,13 @@ PLFLT plf2evalr(PLINT ix, PLINT iy, PLPointer plf2eval_data); - /* Command line parsing utilities */ - +/* Command line parsing utilities */ /* Clear internal option table info structure. */ +void plClearOpts(); -void plClearOpts(); - /* Reset internal option table info structure. */ +void plResetOpts(); -void plResetOpts(); - /* Merge user option table into internal info structure. */ int plMergeOpts(PLOptionTable *options, char *name, char **notes); @@ -1763,11 +1763,10 @@ /* Process input strings, treating them as an option and argument pair. */ /* The first is for the external API, the second the work routine declared here for backward compatibilty. */ +int c_plsetopt(char *opt, char *optarg); -int c_plsetopt(char *opt, char *optarg); +int plSetOpt(char *opt, char *optarg); -int plSetOpt(char *opt, char *optarg); - /* Process options list using current options info. */ int c_plparseopts(int *p_argc, char **argv, PLINT mode); Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-05-25 17:41:11 UTC (rev 10003) +++ trunk/examples/d/CMakeLists.txt 2009-05-26 11:29:32 UTC (rev 10004) @@ -20,25 +20,27 @@ set(d_SRCS) set(d_STRING_INDICES -"02" -"03" -"04" -"05" -"06" -"07" -"08" -"10" -"11" -"12" -"13" -"17" -"23" -"24" -"25" -"27" -"29" -"30" -) + "01" + "02" + "03" + "04" + "05" + "06" + "07" + "08" + "10" + "11" + "12" + "13" + "14" + "17" + "23" + "24" + "25" + "27" + "29" + "30" + ) if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") Modified: trunk/examples/d/CMakeLists.txt_installed_examples_d =================================================================== --- trunk/examples/d/CMakeLists.txt_installed_examples_d 2009-05-25 17:41:11 UTC (rev 10003) +++ trunk/examples/d/CMakeLists.txt_installed_examples_d 2009-05-26 11:29:32 UTC (rev 10004) @@ -19,6 +19,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA set(d_STRING_INDICES + "01" "02" "03" "04" @@ -30,6 +31,7 @@ "11" "12" "13" + "14" "17" "23" "24" Added: trunk/examples/d/x01d.d =================================================================== --- trunk/examples/d/x01d.d (rev 0) +++ trunk/examples/d/x01d.d 2009-05-26 11:29:32 UTC (rev 10004) @@ -0,0 +1,292 @@ +/* $Id: $ + + Simple line plot and multiple windows demo. + + Copyright (C) 2009 Werner Smekal + + This file is part of PLplot. + + PLplot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Library Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + PLplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with PLplot; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +import std.math; +import std.stdio; +import std.string; + +import plplot; + +static int locate_mode; +static int test_xor; +static int fontset = 1; +static string f_name; + +/* Options data structure definition. */ +//~ static PLOptionTable[] options[] = { +//~ { + //~ "locate", /* Turns on test of API locate function */ + //~ NULL, + //~ NULL, + //~ &locate_mode, + //~ PL_OPT_BOOL, + //~ "-locate", + //~ "Turns on test of API locate function" }, +//~ { + //~ "xor", /* Turns on test of xor function */ + //~ NULL, + //~ NULL, + //~ &test_xor, + //~ PL_OPT_BOOL, + //~ "-xor", + //~ "Turns on test of XOR" }, +//~ { + //~ "font", /* For switching between font set 1 & 2 */ + //~ NULL, + //~ NULL, + //~ &fontset, + //~ PL_OPT_INT, + //~ "-font number", + //~ "Selects stroke font set (0 or 1, def:1)" }, +//~ { + //~ "save", /* For saving in postscript */ + //~ NULL, + //~ NULL, + //~ &f_name, + //~ PL_OPT_STRING, + //~ "-save filename", + //~ "Save plot in color postscript `file'" }, +//~ { + //~ NULL, /* option */ + //~ NULL, /* handler */ + //~ NULL, /* client data */ + //~ NULL, /* address of variable to set */ + //~ 0, /* mode flag */ + //~ NULL, /* short syntax */ + //~ NULL } /* long syntax */ +//~ }; + +//~ const char *notes[] = {"Make sure you get it right!", NULL}; + +/* Function prototypes */ + +/*--------------------------------------------------------------------------*\ + * main + * + * Generates several simple line plots. Demonstrates: + * - subwindow capability + * - setting up the window, drawing plot, and labelling + * - changing the color + * - automatic axis rescaling to exponential notation + * - placing the axes in the middle of the box + * - gridded coordinate axes +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + /* plplot initialization */ + /* Divide page into 2x2 plots unless user overrides */ + plssub(2, 2); + + /* Parse and process command line arguments */ + //plMergeOpts(options, "x01c options", notes); + plparseopts(args, PL_PARSE_FULL); + + /* Get version number, just for kicks */ + string ver; + plgver(ver); + writefln("PLplot library version: %s", ver); // TODO: to stdout + + /* Initialize plplot */ + plinit(); + + /* Select font set as per input flag */ + if(fontset) + plfontld(1); + else + plfontld(0); + + plot myPlot = new plot; + + /* Set up the data & plot */ + myPlot.plot1(6, 1, 0, 0, 0); + + /* Set up the data & plot */ + PLINT digmax = 5; + plsyax(digmax, 0); + myPlot.plot1(1, 0.0014, 0, 0.0185, 1); + + myPlot.plot2(); + myPlot.plot3(); + + /* + * Show how to save a plot: + * Open a new device, make it current, copy parameters, + * and replay the plot buffer + */ + if(f_name) { /* command line option '-save filename' */ + PLINT cur_strm, new_strm; + + writefln("The current plot was saved in color Postscript under the name `%s'.", f_name); + plgstrm(&cur_strm); /* get current stream */ + plmkstrm(&new_strm); /* create a new one */ + + plsfnam(f_name); /* file name */ + plsdev("psc"); /* device type */ + + plcpstrm(cur_strm, 0); /* copy old stream parameters to new stream */ + plreplot(); /* do the save by replaying the plot buffer */ + plend1(); /* finish the device */ + + plsstrm(cur_strm); /* return to previous stream */ + } + + /* Let's get some user input */ + if(locate_mode) { + PLGraphicsIn gin; + + /*for(;;) { + if(!plGetCursor(&gin)) + break; + if(gin.keysym==PLK_Escape) + break; + pltext(); + if(gin.keysym<0xFF && isprint(gin.keysym)) + writefln("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c'", + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); + else + writefln("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x", + gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); + plgra(); + }*/ + } + + /* Don't forget to call plend() to finish off! */ + plend(); + return 0; +} + +class plot { + private PLFLT[] x, y, x0, y0; + private PLFLT[6] xs, ys; + private PLINT[1] space1 = [ 1500 ], mark1 = [ 1500 ]; + + public void plot1(PLFLT xscale, PLFLT yscale, PLFLT xoff, PLFLT yoff, int do_test) + { + x.length=60; + y.length=60; + for(int i=0; i<60; i++) { + x[i] = xoff + xscale*(i+1)/60.0; + y[i] = yoff + yscale*pow(x[i], 2.); + } + + PLFLT xmin = x[0]; + PLFLT xmax = x[59]; + PLFLT ymin = y[0]; + PLFLT ymax = y[59]; + + for(int i=0; i<xs.length; i++) { + xs[i] = x[i*10+3]; + ys[i] = y[i*10+3]; + } + + /* Set up the viewport and window using PLENV. The range in X is */ + /* 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are */ + /* scaled separately (just = 0), and we just draw a labelled */ + /* box (axis = 0). */ + plcol0(1); + plenv(xmin, xmax, ymin, ymax, 0, 0); + plcol0(2); + pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); + + /* Plot the data points */ + plcol0(4); + plpoin(xs, ys, 9); + + /* Draw the line through the data */ + plcol0(3); + plline(x, y); + + /* xor mode enable erasing a line/point/text by replotting it again */ + /* it does not work in double buffering mode, however */ + + if (do_test && test_xor) { + writefln("The -xor command line option can only be exercised if your " + "system\nhas usleep(), which does not seem to happen."); + } + } + + public void plot2() + { + /* Set up the viewport and window using PLENV. The range in X is -2.0 to + 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately + (just = 0), and we draw a box with axes (axis = 1). */ + plcol0(1); + plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); + plcol0(2); + pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); + + /* Fill up the arrays */ + x.length=100; + y.length=100; + for(int i=0; i<100; i++) { + x[i] = (i-19.0)/6.0; + y[i] = 1.0; + if(x[i] != 0.0) + y[i] = sin(x[i])/x[i]; + } + + /* Draw the line */ + plcol0(3); + plwid(2); + plline(x, y); + plflush(); + plwid(1); + } + + public void plot3() + { + /* For the final graph we wish to override the default tick intervals, and + so do not use PLENV */ + pladv(0); + + /* Use standard viewport, and define X range from 0 to 360 degrees, Y range + from -1.2 to 1.2. */ + plvsta(); + plwind(0.0, 360.0, -1.2, 1.2); + + /* Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. */ + plcol0(1); + plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); + + /* Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl + expects a pointer!! */ + plstyl(mark1, space1); + plcol0(2); + plbox("g", 30.0, 0, "g", 0.2, 0); + plstyl(null, null); + + plcol0(3); + pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); + + x.length=101; + y.length=101; + for(int i=0; i<101; i++) { + x[i] = 3.6*i; + y[i] = sin(x[i]*PI/180.0); + } + + plcol0(4); + plline(x, y); + } +} \ No newline at end of file Property changes on: trunk/examples/d/x01d.d ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/d/x03d.d =================================================================== --- trunk/examples/d/x03d.d 2009-05-25 17:41:11 UTC (rev 10003) +++ trunk/examples/d/x03d.d 2009-05-26 11:29:32 UTC (rev 10004) @@ -13,10 +13,8 @@ * * Generates polar plot, with 1-1 scaling. \*--------------------------------------------------------------------------*/ -int main( char[][] args ) +int main(char[][] args) { - string text; - PLFLT dtr = PI/180.0; PLFLT[361] x0, y0; for(size_t i=0; i<x0.length; i++) { @@ -52,9 +50,11 @@ /* Draw radial spokes for polar grid */ pljoin(0.0, 0.0, dx, dy); - text = format("%.0f", round(theta)); + + /* Write labels for angle */ + string text; + text = format("%d", lrint(theta)); - /* Write labels for angle */ PLFLT offset; if(theta<9.99) offset = 0.45; Added: trunk/examples/d/x14d.d =================================================================== --- trunk/examples/d/x14d.d (rev 0) +++ trunk/examples/d/x14d.d 2009-05-26 11:29:32 UTC (rev 10004) @@ -0,0 +1,354 @@ +/* $Id: $ + + Demo of multiple stream/window capability (requires Tk or Tcl-DP). + + Maurice LeBrun + IFS, University of Texas at Austin + + Copyright (C) 2009 Werner Smekal + + This file is part of PLplot. + + PLplot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Library Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + PLplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with PLplot; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +import std.string; +import std.math; +import std.stdio; + +import plplot; + +/*--------------------------------------------------------------------------*\ + * main + * + * Plots several simple functions from other example programs. + * + * This version sends the output of the first 4 plots (one page) to two + * independent streams. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + /* Select either TK or DP driver and use a small window */ + /* Using DP results in a crash at the end due to some odd cleanup problems */ + /* The geometry strings MUST be in writable memory */ + string geometry_master = "500x410+100+200"; + string geometry_slave = "500x410+650+200"; + + /* plplot initialization */ + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + string driver; + plgdev(driver); + + PLINT fam, num, bmax; + plgfam(&fam, &num, &bmax); + + writefln("Demo of multiple output streams via the %s driver.", driver); + writefln("Running with the second stream as slave to the first.\n"); + + /* If valid geometry specified on command line, use it for both streams. */ + PLFLT xp0, yp0; + PLINT xleng0, yleng0, xoff0, yoff0; + plgpage(&xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0); + bool valid_geometry = (xleng0 > 0 && yleng0 > 0); + + /* Set up first stream */ + if(valid_geometry) + plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); + else + plsetopt("geometry", geometry_master); + + plsdev(driver); + plssub(2, 2); + plinit(); + + /* Start next stream */ + plsstrm(1); + + if(valid_geometry) + plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); + else + plsetopt("geometry", geometry_slave); + + /* Turn off pause to make this a slave (must follow master) */ + plspause(0); + plsdev(driver); + plsfam(fam, num, bmax); + + /* Currently number of digits in format number can only be + * set via the command line option */ + plsetopt("fflen", "2"); + plinit(); + + /* Set up the data & plot */ + /* Original case */ + plsstrm(0); + + plot myPlot = new plot; + myPlot.plot1(6, 1, 0, 0); + + /* Set up the data & plot */ + myPlot.plot1(1, 1e6, 0, 0); + + /* Set up the data & plot */ + int digmax = 2; + plsyax(digmax, 0); + myPlot.plot1(1, 1e-6, 0, 0); + + /* Set up the data & plot */ + digmax = 5; + plsyax(digmax, 0); + myPlot.plot1(1, 0.0014, 0, 0.0185); + + /* To slave */ + /* The pleop() ensures the eop indicator gets lit. */ + plsstrm(1); + myPlot.plot4(); + pleop(); + + /* Back to master */ + plsstrm(0); + myPlot.plot2(); + myPlot.plot3(); + + /* To slave */ + plsstrm(1); + myPlot.plot5(); + pleop(); + + /* Back to master to wait for user to advance */ + plsstrm(0); + pleop(); + + /* Call plend to finish off. */ + plend(); + return 0; +} + + +class plot { + private PLFLT[] x, y, x0, y0; + private PLFLT[6] xs, ys; + private PLINT[1] space1 = [ 1500 ], mark1 = [ 1500 ]; + + // special variables for plot5() and mypltr + private const int XPTS=35; + private const int YPTS=46; + private const double XSPA=2.0/(XPTS-1); + private const double YSPA=2.0/(YPTS-1); + private PLFLT[6] tr = [ XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 ]; + + public void plot1(PLFLT xscale, PLFLT yscale, PLFLT xoff, PLFLT yoff) + { + x.length=60; + y.length=60; + for(int i=0; i<60; i++) { + x[i] = xoff + xscale*(i+1)/60.0; + y[i] = yoff + yscale*pow(x[i], 2.); + } + + PLFLT xmin = x[0]; + PLFLT xmax = x[59]; + PLFLT ymin = y[0]; + PLFLT ymax = y[59]; + + for(int i=0; i<xs.length; i++) { + xs[i] = x[i*10+3]; + ys[i] = y[i*10+3]; + } + + /* Set up the viewport and window using PLENV. The range in X is */ + /* 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are */ + /* scaled separately (just = 0), and we just draw a labelled */ + /* box (axis = 0). */ + plcol0(1); + plenv(xmin, xmax, ymin, ymax, 0, 0); + plcol0(6); + pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); + + /* Plot the data points */ + plcol0(9); + plpoin(xs, ys, 9); + + /* Draw the line through the data */ + plcol0(4); + plline(x, y); + plflush(); + } + + public void plot2() + { + /* Set up the viewport and window using PLENV. The range in X is -2.0 to + 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately + (just = 0), and we draw a box with axes (axis = 1). */ + plcol0(1); + plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); + plcol0(2); + pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); + + /* Fill up the arrays */ + x.length=100; + y.length=100; + for(int i=0; i<100; i++) { + x[i] = (i-19.0)/6.0; + y[i] = 1.0; + if(x[i] != 0.0) + y[i] = sin(x[i])/x[i]; + } + + /* Draw the line */ + plcol0(3); + plline(x, y); + plflush(); + } + + public void plot3() + { + /* For the final graph we wish to override the default tick intervals, and + so do not use PLENV */ + pladv(0); + + /* Use standard viewport, and define X range from 0 to 360 degrees, Y range + from -1.2 to 1.2. */ + plvsta(); + plwind(0.0, 360.0, -1.2, 1.2); + + /* Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. */ + plcol0(1); + plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); + + /* Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl + expects a pointer!! */ + plstyl(mark1, space1); + plcol0(2); + plbox("g", 30.0, 0, "g", 0.2, 0); + plstyl(null, null); + + plcol0(3); + pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); + + x.length=101; + y.length=101; + for(int i=0; i<101; i++) { + x[i] = 3.6*i; + y[i] = sin(x[i]*PI/180.0); + } + + plcol0(4); + plline(x, y); + plflush(); + } + + public void plot4() + { + string text; + + x0.length=361; + y0.length=361; + PLFLT dtr = PI/180.0; + for(int i=0; i<361; i++) { + x0[i] = cos(dtr*i); + y0[i] = sin(dtr*i); + } + + /* Set up viewport and window, but do not draw box */ + plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); + + x.length=361; + y.length=361; + for(int i=1; i<=10; i++) { + for(int j=0; j<361; j++) { + x[j] = 0.1*i*x0[j]; + y[j] = 0.1*i*y0[j]; + } + + /* Draw circles for polar grid */ + plline(x, y); + } + + plcol0(2); + for(int i = 0; i <= 11; i++) { + PLFLT theta = 30.0*i; + PLFLT dx = cos(dtr*theta); + PLFLT dy = sin(dtr*theta); + + /* Draw radial spokes for polar grid */ + pljoin(0.0, 0.0, dx, dy); + text = format("%d", lrint(theta)); + + /* Write labels for angle */ + + /* Slightly off zero to avoid floating point logic flips at 90 and 270 deg. */ + if(dx >= -0.00001) + plptex(dx, dy, dx, dy, -0.15, text); + else + plptex(dx, dy, -dx, -dy, 1.15, text); + } + + /* Draw the graph */ + + for(int i=0; i<361; i++) { + PLFLT r = sin(dtr*(5*i)); + x[i] = x0[i]*r; + y[i] = y0[i]*r; + } + plcol0(3); + plline(x, y); + + plcol0(4); + plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); + plflush(); + } + + /* =============================================================== */ + /* Demonstration of contour plotting */ + private void mypltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data) + { + *tx = tr[0]*x + tr[1]*y + tr[2]; + *ty = tr[3]*x + tr[4]*y + tr[5]; + } + + public void plot5() + { + PLFLT[11] clevel = [ -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. ]; + + /* Set up function arrays */ + PLFLT[][] z, w; + z.length=XPTS; + w.length=XPTS; + for (int i=0; i<XPTS; i++) { + PLFLT xx = cast(double)(i-(XPTS/2))/(XPTS/2); + z[i].length=YPTS; + w[i].length=YPTS; + for (int j=0; j<YPTS; j++) { + PLFLT yy = cast(double)(j-(YPTS/2))/(YPTS/2)-1.0; + z[i][j] = xx*xx - yy*yy; + w[i][j] = 2*xx*yy; + } + } + + plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); + plcol0(2); + //plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr, null); + plstyl(mark1, space1); + plcol0(3); + //plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr, null); + plcol0(1); + pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); + plflush(); + } +} \ No newline at end of file Property changes on: trunk/examples/d/x14d.d ___________________________________________________________________ Added: svn:executable + * Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-29 07:30:04
|
Revision: 10009 http://plplot.svn.sourceforge.net/plplot/?rev=10009&view=rev Author: smekal Date: 2009-05-29 07:29:50 +0000 (Fri, 29 May 2009) Log Message: ----------- D Bindings improvements: * For the functions plscmap1l and plscmap1la the last parameter can be omitted now (set to null). * Added helper function to convert D dynamic array to C dynamic array. * Aliases for C functions (pltr, fill, defined) used as callback functions in certain PLplot functions. * Added implementation of plshade and plshades. * Few syntax changes. Added D example 15 and finished example 30 (which uses plshades). Changed CMakeLists.txt file accordingly. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt trunk/examples/d/x30d.d Added Paths: ----------- trunk/examples/d/x15d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-28 09:23:39 UTC (rev 10008) +++ trunk/bindings/d/plplot.d 2009-05-29 07:29:50 UTC (rev 10009) @@ -6,6 +6,31 @@ // improved D interface +// helper function to convert D dynamic arrays in C dynamic arrays +private PLFLT** convert_array(PLFLT[][] a) +{ + size_t nx=a.length; + size_t ny=a[0].length; + + PLFLT** c_a = (new PLFLT*[nx]).ptr; + for(size_t i=0; i<nx; i++) { + assert(ny==a[i].length, "convert_array(): Array must be 2 dimensional!"); + c_a[i] = a[i].ptr; + } + + return c_a; +} + +// certain functions must be declared as C functions so that PLplot +// can handle them +extern (C) { + alias PLINT function(PLFLT, PLFLT) def_func; + alias void function(PLINT, PLFLT* , PLFLT*) fill_func; + alias void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr_func; +} + + + /* Process options list using current options info. */ int plparseopts(char[][] args, PLINT mode) { @@ -283,13 +308,14 @@ /* Set color map 1 colors using a piece-wise linear relationship between */ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ void plscmap1l(PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, - PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] rev) + PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] rev=null) { PLINT npts=intensity.length; assert(npts==coord1.length, "plscmap1l(): Arrays must be of same length!"); assert(npts==coord2.length, "plscmap1l(): Arrays must be of same length!"); assert(npts==coord3.length, "plscmap1l(): Arrays must be of same length!"); - assert(npts-1==rev.length, "plscmap1l(): Array rev must be of same length then other arrays minus 1!"); + if(rev!=null) + assert(npts-1==rev.length, "plscmap1l(): Array rev must be of same length then other arrays minus 1!"); c_plscmap1l(itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, rev.ptr); } @@ -298,14 +324,15 @@ /* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */ /* Will also linear interpolate alpha values. */ void plscmap1la(PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1, - PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] rev) + PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] rev=null) { PLINT npts=intensity.length; assert(npts==coord1.length, "plscmap1la(): Arrays must be of same length!"); assert(npts==coord2.length, "plscmap1la(): Arrays must be of same length!"); assert(npts==coord3.length, "plscmap1la(): Arrays must be of same length!"); assert(npts==a.length, "plscmap1la(): Arrays must be of same length!"); - assert(npts-1==rev.length, "plscmap1la(): Array rev must be of same length then other arrays minus 1!"); + if(rev!=null) + assert(npts-1==rev.length, "plscmap1la(): Array rev must be of same length then other arrays minus 1!"); c_plscmap1la(itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, rev.ptr); } @@ -314,7 +341,7 @@ { c_plsdev(toStringz(devname)); } - + /* Set the output file name. */ void plsfnam(string fnam) { @@ -322,11 +349,31 @@ } /* Shade region. */ -//void c_plshade(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT , 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -//void c_plshade1(PLFLT *a, PLINT nx, PLINT ny, PLINT function(PLFLT , 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -//void c_plshades(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT , PLFLT )defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -//void plfshade(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLFLT function(PLINT , PLINT , PLPointer )c2eval, PLPointer c2eval_data, PLINT nx, PLINT ny, 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void plshade(PLFLT[][] a, def_func 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, + pltr_func pltr=null, PLPointer pltr_data=null) +{ + PLINT nx=a.length; + PLINT ny=a[0].length; + + c_plshade(convert_array(a), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap, + sh_color, sh_width, min_color, min_width, max_color, max_width, &c_plfill, + rectangular, pltr, pltr_data); +} +void plshades(PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT[] clevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, pltr_func pltr=null, PLPointer pltr_data=null) +{ + PLINT nx=a.length; + PLINT ny=a[0].length; + + c_plshades(convert_array(a), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, clevel.length, + fill_width, cont_color, cont_width, &c_plfill, rectangular, pltr, pltr_data); +} + /* Initialize PLplot, passing the device name and windows/page settings. */ void plstart(string devname, PLINT nx, PLINT ny) { @@ -978,9 +1025,8 @@ alias c_plsfci plsfci; // alias c_plsfnam plsfnam; alias c_plsfont plsfont; -alias c_plshade plshade; -alias c_plshade1 plshade1; -alias c_plshades plshades; +//alias c_plshade plshade; +//alias c_plshades plshades; alias c_plsmaj plsmaj; alias c_plsmem plsmem; alias c_plsmin plsmin; @@ -1153,9 +1199,8 @@ void c_plerry(PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax); /* Advance to the next family file on the next new page */ +void c_plfamadv(); -void c_plfamadv(); - /* Pattern fills the polygon bounded by the input points. */ void c_plfill(PLINT n, PLFLT *x, PLFLT *y); @@ -1514,13 +1559,18 @@ void c_plsfont(PLINT family, PLINT style, PLINT weight); /* Shade region. */ +void c_plshade(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT, 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, void function(PLINT, PLFLT*, PLFLT*) fill, PLBOOL rectangular, + void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr, PLPointer pltr_data); -void c_plshade(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT , 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void c_plshades(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT, PLFLT) defined, PLFLT xmin, + PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, void function(PLINT, PLFLT*, PLFLT*) fill, + PLBOOL rectangular, void function(PLFLT, PLFLT, PLFLT*, PLFLT *, PLPointer) pltr, + PLPointer pltr_data); -void c_plshade1(PLFLT *a, PLINT nx, PLINT ny, PLINT function(PLFLT , 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - -void c_plshades(PLFLT **a, PLINT nx, PLINT ny, PLINT function(PLFLT , PLFLT )defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - void plfshade(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLFLT function(PLINT , PLINT , PLPointer )c2eval, PLPointer c2eval_data, PLINT nx, PLINT ny, 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, void function(PLINT , PLFLT *, PLFLT *)fill, PLBOOL rectangular, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); /* Set up lengths of major tick marks. */ Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-05-28 09:23:39 UTC (rev 10008) +++ trunk/examples/d/CMakeLists.txt 2009-05-29 07:29:50 UTC (rev 10009) @@ -33,6 +33,7 @@ "12" "13" "14" + "15" "17" "23" "24" Added: trunk/examples/d/x15d.d =================================================================== --- trunk/examples/d/x15d.d (rev 0) +++ trunk/examples/d/x15d.d 2009-05-29 07:29:50 UTC (rev 10009) @@ -0,0 +1,238 @@ +/* $Id: $ + + Shade plot demo. + + Maurice LeBrun + IFS, University of Texas at Austin + 31 Aug 1993 +*/ + +import std.math; +import std.stdio; +import std.string; + +import plplot; + + +/*--------------------------------------------------------------------------*\ + * main + * + * Does a variety of shade plots. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + const int XPTS=35; /* Data points in x */ + const int YPTS=46; /* Data points in y */ + + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + /* Set up color map 0 */ + // plscmap0n(3); + + // create plot object + plot myPlot = new plot; + + /* Set up color map 1 */ + myPlot.cmap1_init2(); + + /* Initialize plplot */ + plinit(); + + /* Set up data array */ + PLFLT xx, yy; + PLFLT[][] z = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + z[i] = new PLFLT[YPTS]; + + for(int i=0; i<XPTS; i++) { + xx = cast(double)(i-(XPTS/2))/(XPTS/2); + for(int j=0; j<YPTS; j++) { + yy = cast(double)(j-(YPTS/2))/(YPTS/2)-1.0; + z[i][j] = xx*xx - yy*yy + (xx-yy)/(xx*xx+yy*yy+0.1); + } + } + + /* Plot using identity transform */ + myPlot.plot1(z); + myPlot.plot2(z); + myPlot.plot3(); + + plend(); + return 0; +} + + +class plot { + + /*--------------------------------------------------------------------------*\ + * cmap1_init1 + * + * Initializes color map 1 in HLS space. + \*--------------------------------------------------------------------------*/ + public void cmap1_init1() + { + PLFLT[] i = [ 0.0, 0.45, 0.55, 1.0 ]; // left boundary, just before center, + // just after center, right boundary + PLFLT[] h = [ 260.0, 260.0, 20.0, 20.0 ]; // hue -- low: blue-violet, only change as we go over vertex + // hue -- high: red, keep fixed + PLFLT[] l = [ 0.5, 0.0, 0.0, 0.5 ]; // lightness -- low, lightness -- center + // lightness -- center, lightness -- high + PLFLT[] s = [ 1.0, 1.0, 1.0, 1.0 ]; // maximum saturation + + plscmap1l(0, i, h, l, s); + } + + /*--------------------------------------------------------------------------*\ + * cmap1_init2 + * + * Initializes color map 1 in HLS space. + \*--------------------------------------------------------------------------*/ + public void cmap1_init2() + { + PLFLT[] i = [ 0.0, 0.45, 0.55, 1.0 ]; // left boundary, just before center, + // just after center, right boundary + PLFLT[] h = [ 260.0, 260.0, 20.0, 20.0 ]; // hue -- low: blue-violet, only change as we go over vertex + // hue -- high: red, keep fixed + PLFLT[] l = [ 0.6, 0.0, 0.0, 0.6 ]; // lightness -- low, lightness -- center + // lightness -- center, lightness -- high + PLFLT[] s = [ 1.0, 0.5, 0.5, 1.0 ]; // saturation -- low, saturation -- center + // saturation -- center, saturation -- high + + plscmap1l(0, i, h, l, s); + } + + /*--------------------------------------------------------------------------*\ + * plot1 + * + * Illustrates a single shaded region. + \*--------------------------------------------------------------------------*/ + public void plot1(PLFLT[][] z) + { + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + PLFLT zmin, zmax; + f2mnmx(z, zmin, zmax); + + PLFLT shade_min = zmin + (zmax-zmin)*0.4; + PLFLT shade_max = zmin + (zmax-zmin)*0.6; + PLFLT sh_color = 7; + PLINT sh_width = 2; + PLINT sh_cmap = 0; + PLINT min_color = 9; + PLINT max_color = 2; + PLINT min_width = 2; + PLINT max_width = 2; + + plpsty(8); + plshade(z, null,-1., 1., -1., 1., + shade_min, shade_max, + sh_cmap, sh_color, sh_width, + min_color, min_width, max_color, max_width, 1); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + pllab("distance", "altitude", "Bogon flux"); + } + + /*--------------------------------------------------------------------------*\ + * plot2 + * + * Illustrates multiple adjacent shaded regions, using different fill + * patterns for each region. + \*--------------------------------------------------------------------------*/ + public void plot2(PLFLT[][] z) + { + static PLINT nlin[10] = [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]; + static PLINT inc[10][2] = [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], + [450,-450], [0, 900], [0, 450], [450, -450], [0, 900] ]; + static PLINT del[10][2] = [ [2000, 2000], [2000, 2000], [2000, 2000], + [2000, 2000], [2000, 2000], [2000, 2000], + [2000, 2000], [2000, 2000], [4000, 4000], + [4000, 2000] ]; + + PLINT sh_cmap = 0, sh_width = 2; + PLINT min_color = 0, min_width = 0, max_color = 0, max_width = 0; + + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + PLFLT zmin, zmax; + f2mnmx(z, zmin, zmax); + + /* Plot using identity transform */ + for(int i=0; i<10; i++) { + PLFLT shade_min = zmin + (zmax-zmin)*i/10.0; + PLFLT shade_max = zmin + (zmax-zmin)*(i+1)/10.0; + PLFLT sh_color = i+6; + plpat(inc[i][0..nlin[i]], del[i][0..nlin[i]]); + + plshade(z, null, -1., 1., -1., 1., + shade_min, shade_max, + sh_cmap, sh_color, sh_width, + min_color, min_width, max_color, max_width, 1); + } + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + pllab("distance", "altitude", "Bogon flux"); + } + + /*--------------------------------------------------------------------------*\ + * plot3 + * + * Illustrates shaded regions in 3d, using a different fill pattern for + * each region. + \*--------------------------------------------------------------------------*/ + public void plot3() + { + static PLFLT xx[2][5] = [ [-1.0, 1.0, 1.0, -1.0, -1.0], + [-1.0, 1.0, 1.0, -1.0, -1.0] ]; + static PLFLT yy[2][5] = [ [1.0, 1.0, 0.0, 0.0, 1.0], + [-1.0, -1.0, 0.0, 0.0, -1.0] ]; + static PLFLT zz[2][5] = [ [0.0, 0.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 1.0, 1.0, 0.0] ]; + + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + plw3d(1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40); + + /* Plot using identity transform */ + plcol0(1); + plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); + plcol0(2); + pllab("","","3-d polygon filling"); + + plcol0(3); + plpsty(1); + plline3(xx[0], yy[0], zz[0]); + plfill3(xx[0][0..4], yy[0][0..4], zz[0][0..4]); + plpsty(2); + plline3(xx[1], yy[1], zz[1]); + plfill3(xx[1][0..4], yy[1][0..4], zz[1][0..4]); + } + + /*--------------------------------------------------------------------------*\ + * f2mnmx + * + * Returns min & max of input 2d array. + \*--------------------------------------------------------------------------*/ + public void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) + { + fmx = f[0][0]; + fmn = fmx; + + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[0].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); + } + } + } +} \ No newline at end of file Property changes on: trunk/examples/d/x15d.d ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/examples/d/x30d.d =================================================================== --- trunk/examples/d/x30d.d 2009-05-28 09:23:39 UTC (rev 10008) +++ trunk/examples/d/x30d.d 2009-05-29 07:29:50 UTC (rev 10009) @@ -29,24 +29,25 @@ import plplot; import std.string; -static PLINT[] red = [ 0, 255, 0, 0 ]; -static PLINT[] green = [ 0, 0, 255, 0 ]; -static PLINT[] blue = [ 0, 0, 0, 255 ]; -static PLFLT[] alpha = [ 1.0, 1.0, 1.0, 1.0 ]; -static PLFLT[] px = [ 0.1, 0.5, 0.5, 0.1 ]; -static PLFLT[] py = [ 0.1, 0.1, 0.5, 0.5 ]; -static PLFLT[] pos = [ 0.0, 1.0 ]; -static PLFLT[] rcoord = [ 1.0, 1.0 ]; -static PLFLT[] gcoord = [ 0.0, 0.0 ]; -static PLFLT[] bcoord = [ 0.0, 0.0 ]; -static PLFLT[] acoord = [ 0.0, 1.0 ]; -static PLBOOL[] rev = [ 0 ]; +int main(char[][] args) +{ + PLINT[] red = [ 0, 255, 0, 0 ]; + PLINT[] green = [ 0, 0, 255, 0 ]; + PLINT[] blue = [ 0, 0, 0, 255 ]; + PLFLT[] alpha = [ 1.0, 1.0, 1.0, 1.0 ]; + PLFLT[] px = [ 0.1, 0.5, 0.5, 0.1 ]; + PLFLT[] py = [ 0.1, 0.1, 0.5, 0.5 ]; -int main( char[][] args ) -{ + PLFLT[] pos = [ 0.0, 1.0 ]; + PLFLT[] rcoord = [ 1.0, 1.0 ]; + PLFLT[] gcoord = [ 0.0, 0.0 ]; + PLFLT[] bcoord = [ 0.0, 0.0 ]; + PLFLT[] acoord = [ 0.0, 1.0 ]; + PLBOOL[] rev = [ 0 ]; + /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -140,24 +141,18 @@ /* Create a 2 x 2 array that contains the z values (0.0 to 1.0) that will */ /* used for the shade plot. plshades will use linear interpolation to */ /* calculate the z values of all the intermediate points in this array. */ - PLFLT[2][2] z; + PLFLT[][] z = [ [0.0, 1.0], [0.0, 1.0] ]; - z[0][0] = 0.0; - z[1][0] = 0.0; - z[0][1] = 1.0; - z[1][1] = 1.0; - /* Set the color levels array. These levels are also between 0.0 and 1.0 */ - PLFLT[101] clevel; + PLFLT[] clevel; + clevel.length=101; for(int i=0; i<clevel.length; i++) clevel[i] = 0.01*i; /* Draw the shade plot with zmin = 0.0, zmax = 1.0 and x and y coordinate ranges */ /* such that it fills the entire plotting area. */ - //plshades(cast(PLFLT**)z, 2, 2, null, 0.0, 1.0, 0.0, 1.0, cast(PLFLT*)clevel, - // 101, 0, -1, 2, plfill, 1, null, null); + plshades(z, null, 0.0, 1.0, 0.0, 1.0, clevel, 0, -1, 2, 1); plend(); return 0; } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-05-29 19:52:54
|
Revision: 10013 http://plplot.svn.sourceforge.net/plplot/?rev=10013&view=rev Author: smekal Date: 2009-05-29 19:51:53 +0000 (Fri, 29 May 2009) Log Message: ----------- Added plmap to the improved D bindings. Added working D examples 18 and 19 and changed CMakeLists.txt accordingly. Commited also example 9 which doesn't compile yet. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt Added Paths: ----------- trunk/examples/d/x09d.d trunk/examples/d/x18d.d trunk/examples/d/x19d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-05-29 19:27:13 UTC (rev 10012) +++ trunk/bindings/d/plplot.d 2009-05-29 19:51:53 UTC (rev 10013) @@ -6,6 +6,15 @@ // improved D interface +// certain functions must be declared as C functions so that PLplot +// can handle them +extern (C) { + alias PLINT function(PLFLT, PLFLT) def_func; + alias void function(PLINT, PLFLT* , PLFLT*) fill_func; + alias void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr_func; + alias void function(PLINT, PLFLT*, PLFLT*) mapform_func; +} + // helper function to convert D dynamic arrays in C dynamic arrays private PLFLT** convert_array(PLFLT[][] a) { @@ -21,16 +30,6 @@ return c_a; } -// certain functions must be declared as C functions so that PLplot -// can handle them -extern (C) { - alias PLINT function(PLFLT, PLFLT) def_func; - alias void function(PLINT, PLFLT* , PLFLT*) fill_func; - alias void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr_func; -} - - - /* Process options list using current options info. */ int plparseopts(char[][] args, PLINT mode) { @@ -186,11 +185,12 @@ } /* plot continental outline in world coordinates */ -//void c_plmap(void function(PLINT , PLFLT *, PLFLT *)mapform, char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); +void plmap(mapform_func mapform, string type, PLFLT minlong, PLFLT maxlong, + PLFLT minlat, PLFLT maxlat) +{ + c_plmap(mapform, toStringz(type), minlong, maxlong, minlat, maxlat); +} -/* Plot the latitudes and longitudes on the background. */ -//void c_plmeridians(void function(PLINT , PLFLT *, PLFLT *)mapform, PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); - /* Plots a mesh representation of the function z[x][y]. */ //void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); @@ -469,29 +469,6 @@ /* Sets an optional user abort handler. */ //void plsabort(void function(char *)handler); -/* Transformation routines */ - -/* Identity transformation. */ -//void pltr0(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - -/* Does linear interpolation from singly dimensioned coord arrays. */ -//void pltr1(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - -/* Does linear interpolation from doubly dimensioned coord arrays */ -/* (column dominant, as per normal C 2d arrays). */ -//void pltr2(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - -/* Just like pltr2() but uses pointer arithmetic to get coordinates from */ -/* 2d grid tables. */ -//void pltr2p(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - -/* Identity transformation for plots from Fortran. */ -//void pltr0f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); - -/* Does linear interpolation from doubly dimensioned coord arrays */ -/* (row dominant, i.e. Fortran ordering). */ -//void pltr2f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); - /* Function evaluators */ /* Does a lookup from a 2d function array. Array is of type (PLFLT **), */ @@ -975,7 +952,7 @@ //alias c_plline plline; //alias c_plline3 plline3; alias c_pllsty pllsty; -alias c_plmap plmap; +//alias c_plmap plmap; alias c_plmeridians plmeridians; alias c_plmesh plmesh; alias c_plmeshc plmeshc; @@ -1360,16 +1337,16 @@ void c_pllsty(PLINT lin); /* plot continental outline in world coordinates */ -void c_plmap(void function(PLINT , PLFLT *, PLFLT *)mapform, char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); +void c_plmap(void function(PLINT, PLFLT*, PLFLT*) mapform, char *type, PLFLT minlong, + PLFLT maxlong, PLFLT minlat, PLFLT maxlat); /* Plot the latitudes and longitudes on the background. */ +void c_plmeridians(void function(PLINT, PLFLT*, PLFLT*) mapform, PLFLT dlong, PLFLT dlat, + PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); -void c_plmeridians(void function(PLINT , PLFLT *, PLFLT *)mapform, PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); - /* Plots a mesh representation of the function z[x][y]. */ +void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); -void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); - /* Plots a mesh representation of the function z[x][y] with contour */ void c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); @@ -1749,37 +1726,31 @@ void plsabort(void function(char *)handler); - /* Transformation routines */ +/* Transformation routines */ /* Identity transformation. */ +void pltr0(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data); -void pltr0(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - /* Does linear interpolation from singly dimensioned coord arrays. */ +void pltr1(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data); -void pltr1(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - /* Does linear interpolation from doubly dimensioned coord arrays */ /* (column dominant, as per normal C 2d arrays). */ +void pltr2(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data); -void pltr2(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - /* Just like pltr2() but uses pointer arithmetic to get coordinates from */ /* 2d grid tables. */ +void pltr2p(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data); -void pltr2p(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); - /* Identity transformation for plots from Fortran. */ +void pltr0f(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data); -void pltr0f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); - /* Does linear interpolation from doubly dimensioned coord arrays */ /* (row dominant, i.e. Fortran ordering). */ +void pltr2f(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data); -void pltr2f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); +/* Function evaluators */ - /* Function evaluators */ - /* Does a lookup from a 2d function array. Array is of type (PLFLT **), */ /* and is column dominant (normal C ordering). */ Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-05-29 19:27:13 UTC (rev 10012) +++ trunk/examples/d/CMakeLists.txt 2009-05-29 19:51:53 UTC (rev 10013) @@ -28,6 +28,7 @@ "06" "07" "08" +# "09" "10" "11" "12" @@ -35,6 +36,8 @@ "14" "15" "17" + "18" + "19" "23" "24" "25" Added: trunk/examples/d/x09d.d =================================================================== --- trunk/examples/d/x09d.d (rev 0) +++ trunk/examples/d/x09d.d 2009-05-29 19:51:53 UTC (rev 10013) @@ -0,0 +1,369 @@ +/* $Id: $ + + Contour plot demo. + + This file is part of PLplot. + + PLplot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Library Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + PLplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with PLplot; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +import std.string; +import plplot; + +#define XPTS 35 /* Data points in x */ +#define YPTS 46 /* Data points in y */ + +#define XSPA 2./(XPTS-1) +#define YSPA 2./(YPTS-1) + +/* polar plot data */ +#define PERIMETERPTS 100 +#define RPTS 40 +#define THETAPTS 40 + +/* potential plot data */ +#define PPERIMETERPTS 100 +#define PRPTS 40 +#define PTHETAPTS 64 +#define PNLEVEL 20 + +static PLFLT clevel[11] = +{-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.}; + +/* Transformation function */ + +extern (C) { + PLFLT[] tr = {XSPA, 0.0, -1.0, 0.0, YSPA, -1.0}; + + void mypltr(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data) + { + *tx = tr[0]*x + tr[1]*y + tr[2]; + *ty = tr[3]*x + tr[4]*y + tr[5]; + } +} + +static void polar() +/*polar contour plot example.*/ +{ + int i,j; + PLcGrid2 cgrid2; + PLFLT **z; + PLFLT px[PERIMETERPTS], py[PERIMETERPTS]; + PLFLT t, r, theta; + PLFLT lev[10]; + + plenv(-1., 1., -1., 1., 0, -2); + plcol0(1); + +/*Perimeter*/ + for (i = 0; i < PERIMETERPTS; i++) { + t = (2.*M_PI/(PERIMETERPTS-1))*(double)i; + px[i] = cos(t); + py[i] = sin(t); + } + plline(PERIMETERPTS, px, py); + +/*create data to be contoured.*/ + plAlloc2dGrid(&cgrid2.xg, RPTS, THETAPTS); + plAlloc2dGrid(&cgrid2.yg, RPTS, THETAPTS); + plAlloc2dGrid(&z, RPTS, THETAPTS); + cgrid2.nx = RPTS; + cgrid2.ny = THETAPTS; + + for (i = 0; i < RPTS; i++) { + r = i/(double)(RPTS-1); + for (j = 0; j < THETAPTS; j++) { + theta = (2.*M_PI/(double)(THETAPTS-1))*(double)j; + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); + z[i][j] = r; + } + } + + for (i = 0; i < 10; i++) { + lev[i] = 0.05 + 0.10*(double) i; + } + + plcol0(2); + plcont(z, RPTS, THETAPTS, 1, RPTS, 1, THETAPTS, lev, 10, + pltr2, (void *) &cgrid2); + plcol0(1); + pllab("", "", "Polar Contour Plot"); + plFree2dGrid(z, RPTS, THETAPTS); + plFree2dGrid(cgrid2.xg, RPTS, THETAPTS); + plFree2dGrid(cgrid2.yg, RPTS, THETAPTS); +} + +/*--------------------------------------------------------------------------*\ + * f2mnmx + * + * Returns min & max of input 2d array. +\*--------------------------------------------------------------------------*/ + +static void +f2mnmx(PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax) +{ + int i, j; + + *fmax = f[0][0]; + *fmin = *fmax; + + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { + *fmax = MAX(*fmax, f[i][j]); + *fmin = MIN(*fmin, f[i][j]); + } + } +} + +static void potential() +/*shielded potential contour plot example.*/ +{ + PLcGrid2 cgrid2; + PLFLT rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; + PLFLT peps, xpmin, xpmax, ypmin, ypmax; + PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; + PLFLT div1, div1i, div2, div2i; + PLFLT **z; + PLINT nlevelneg, nlevelpos; + PLFLT dz, clevel, clevelneg[PNLEVEL], clevelpos[PNLEVEL]; + PLINT ncollin, ncolbox, ncollab; + PLFLT px[PPERIMETERPTS], py[PPERIMETERPTS]; + PLFLT t, r, theta; + + /*create data to be contoured.*/ + plAlloc2dGrid(&cgrid2.xg, PRPTS, PTHETAPTS); + plAlloc2dGrid(&cgrid2.yg, PRPTS, PTHETAPTS); + plAlloc2dGrid(&z, PRPTS, PTHETAPTS); + cgrid2.nx = PRPTS; + cgrid2.ny = PTHETAPTS; + + for (i = 0; i < PRPTS; i++) { + r = 0.5 + (double) i; + for (j = 0; j < PTHETAPTS; j++) { + theta = (2.*M_PI/(double)(PTHETAPTS-1))*(0.5 + (double) j); + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); + } + } + + rmax = r; + f2mnmx(cgrid2.xg, PRPTS, PTHETAPTS, &xmin, &xmax); + f2mnmx(cgrid2.yg, PRPTS, PTHETAPTS, &ymin, &ymax); + x0 = (xmin + xmax)/2.; + y0 = (ymin + ymax)/2.; + + /* Expanded limits */ + peps = 0.05; + xpmin = xmin - fabs(xmin)*peps; + xpmax = xmax + fabs(xmax)*peps; + ypmin = ymin - fabs(ymin)*peps; + ypmax = ymax + fabs(ymax)*peps; + + /* Potential inside a conducting cylinder (or sphere) by method of images. + Charge 1 is placed at (d1, d1), with image charge at (d2, d2). + Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). + Also put in smoothing term at small distances. + */ + + eps = 2.; + + q1 = 1.; + d1 = rmax/4.; + + q1i = - q1*rmax/d1; + d1i = pow(rmax, 2.)/d1; + + q2 = -1.; + d2 = rmax/4.; + + q2i = - q2*rmax/d2; + d2i = pow(rmax, 2.)/d2; + + for(int i=0; i<PRPTS; i++) { + for(int j=0; j<PTHETAPTS; j++) { + div1 = sqrt(pow(cgrid2.xg[i][j]-d1, 2.) + pow(cgrid2.yg[i][j]-d1, 2.) + pow(eps, 2.)); + div1i = sqrt(pow(cgrid2.xg[i][j]-d1i, 2.) + pow(cgrid2.yg[i][j]-d1i, 2.) + pow(eps, 2.)); + div2 = sqrt(pow(cgrid2.xg[i][j]-d2, 2.) + pow(cgrid2.yg[i][j]+d2, 2.) + pow(eps, 2.)); + div2i = sqrt(pow(cgrid2.xg[i][j]-d2i, 2.) + pow(cgrid2.yg[i][j]+d2i, 2.) + pow(eps, 2.)); + z[i][j] = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; + } + } + f2mnmx(z, zmin, zmax); + + /* Positive and negative contour levels.*/ + dz = (zmax-zmin)/PNLEVEL; + nlevelneg = 0; + nlevelpos = 0; + for(int i=0; i<PNLEVEL; i++) { + clevel = zmin + (i+0.5)*dz; + if(clevel<=0.) + clevelneg[nlevelneg++] = clevel; + else + clevelpos[nlevelpos++] = clevel; + } + /* Colours! */ + ncollin = 11; + ncolbox = 1; + ncollab = 2; + + /* Finally start plotting this page! */ + pladv(0); + plcol0(ncolbox); + + plvpas(0.1, 0.9, 0.1, 0.9, 1.0); + plwind(xpmin, xpmax, ypmin, ypmax); + plbox("", 0., 0, "", 0., 0); + + plcol0(ncollin); + if(nlevelneg >0) { + /* Negative contours */ + pllsty(2); + plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, pltr2, (void*)&cgrid2); + } + + if(nlevelpos >0) { + /* Positive contours */ + pllsty(1); + plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, pltr2, (void*)&cgrid2); + } + + /* Draw outer boundary */ + for(int i=0; i<PPERIMETERPTS; i++) { + t = (2.*PI/(PPERIMETERPTS-1))*i; + px[i] = x0 + rmax*cos(t); + py[i] = y0 + rmax*sin(t); + } + + plcol0(ncolbox); + plline(px, py); + + plcol0(ncollab); + pllab("", "", "Shielded potential of charges in a conducting sphere"); +} + + +/*--------------------------------------------------------------------------*\ + * main + * + * Does several contour plots using different coordinate mappings. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + PLINT[] mark = [ 1500 ], space = [ 1500 ]; + + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + /* Initialize plplot */ + plinit(); + + /* Set up function arrays */ + PLFLT xx, yy; + PLFLT[][] z = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + z[i] = new PLFLT[YPTS]; + + PLFLT[][] w = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + w[i] = new PLFLT[YPTS]; + + for(int i=0; i<XPTS; i++) { + xx = cast(double)(i-(XPTS/2))/(XPTS/2); + for(int j=0; j<YPTS; j++) { + yy = cast(double)(j-(YPTS/2))/(YPTS / 2)-1.0; + z[i][j] = xx*xx - yy*yy; + w[i][j] = 2*xx*yy; + } + } + + /* Set up grids */ + cgrid1.xg = (new PLFLT[XPTS]).ptr; + cgrid1.yg = (new PLFLT[XPTS]).ptr; + + PLFLT[][] cgrid2.xg = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + cgrid2.xg[i] = new PLFLT[YPTS]; + + PLFLT[][] cgrid2.yg = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + cgrid2.yg[i] = new PLFLT[YPTS]; + + PLFLT argx, argy, distort; + for(int i=0; i<XPTS; i++) { + for(int j=0; j<YPTS; j++) { + mypltr(cast(PLFLT)i, cast(PLFLT)j, &xx, &yy, null); + + argx = xx * M_PI/2; + argy = yy * M_PI/2; + distort = 0.4; + + cgrid1.xg[i] = xx + distort * cos(argx); + cgrid1.yg[j] = yy - distort * cos(argy); + + cgrid2.xg[i][j] = xx + distort * cos(argx) * cos(argy); + cgrid2.yg[i][j] = yy - distort * cos(argx) * cos(argy); + } + } + + /* Plot using identity transform */ + pl_setcontlabelparam(0.006, 0.3, 0.1, 1); + plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); + plcol0(2); + plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr); + + plstyl(mark, space); + plcol0(3); + plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr); + plstyl(null, null); + plcol0(1); + pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); + pl_setcontlabelparam(0.006, 0.3, 0.1, 0); + + /* Plot using 1d coordinate transform */ + plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); + plcol0(2); + plcont(z, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + + plstyl(1, mark, space); + plcol0(3); + plcont(w, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + plstyl(null, null); + plcol0(1); + pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); + + /* Plot using 2d coordinate transform */ + plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); + plcol0(2); + plcont(z, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + + plstyl(mark, space); + plcol0(3); + plcont(w, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + plstyl(null, null); + plcol0(1); + pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); + + pl_setcontlabelparam(0.006, 0.3, 0.1, 0); + polar(); + + pl_setcontlabelparam(0.006, 0.3, 0.1, 0); + potential(); + + plend(); + + return 0; +} Property changes on: trunk/examples/d/x09d.d ___________________________________________________________________ Added: svn:executable + * Added: svn:eol-style + native Added: trunk/examples/d/x18d.d =================================================================== --- trunk/examples/d/x18d.d (rev 0) +++ trunk/examples/d/x18d.d 2009-05-29 19:51:53 UTC (rev 10013) @@ -0,0 +1,130 @@ +/* $Id: $ + + 3-d line and point plot demo. Adapted from x08c.c. +*/ + +import std.math; +import std.string; + +import plplot; + +int opt[] = [ 1, 0, 1, 0 ]; +PLFLT alt[] = [ 20.0, 35.0, 50.0, 65.0 ]; +PLFLT az[] = [ 30.0, 40.0, 50.0, 60.0 ]; + +/*--------------------------------------------------------------------------*\ + * main + * + * Does a series of 3-d plots for a given data set, with different + * viewing options in each plot. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + const int npts=1000; + + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + /* Initialize plplot */ + plinit(); + + for(int k=0; k<4; k++) + test_poly(k); + + PLFLT[] x = new PLFLT[npts]; + PLFLT[] y = new PLFLT[npts]; + PLFLT[] z = new PLFLT[npts]; + + /* From the mind of a sick and twisted physicist... */ + PLFLT r; + for(int i=0; i<npts; i++) { + z[i] = -1. + 2.*i/npts; + + /* Pick one ... */ + /* r = 1. - cast(PLFLT)i/npts; */ + r = z[i]; + + x[i] = r*cos(2.*PI*6.*i/npts); + y[i] = r*sin(2.*PI*6.*i/npts); + } + + for(int k=0; k<4; k++) { + pladv(0); + plvpor(0.0, 1.0, 0.0, 0.9); + plwind(-1.0, 1.0, -0.9, 1.1); + plcol0(1); + plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]); + plbox3("bnstu", "x axis", 0.0, 0, + "bnstu", "y axis", 0.0, 0, + "bcdmnstuv", "z axis", 0.0, 0); + + plcol0(2); + + if(opt[k]) + plline3(x, y, z); + else + plpoin3(x, y, z, 1 ); + + plcol0(3); + plmtex("t", 1.0, 0.5, 0.5, format("#frPLplot Example 18 - Alt=%.0f, Az=%.0f", alt[k], az[k])); + } + + plend(); + + return 0; +} + +void test_poly(int k) +{ + PLINT draw[][] = [ [ 1, 1, 1, 1 ], + [ 1, 0, 1, 0 ], + [ 0, 1, 0, 1 ], + [ 1, 1, 0, 0 ] ]; + + PLFLT[] x = new PLFLT[5]; + PLFLT[] y = new PLFLT[5]; + PLFLT[] z = new PLFLT[5]; + + pladv(0); + plvpor(0.0, 1.0, 0.0, 0.9); + plwind(-1.0, 1.0, -0.9, 1.1); + plcol0(1); + plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]); + plbox3("bnstu", "x axis", 0.0, 0, + "bnstu", "y axis", 0.0, 0, + "bcdmnstuv", "z axis", 0.0, 0); + + plcol0(2); + + PLFLT theta(int a) { return 2*PI*a/20; } + PLFLT phi(int a) { return PI*a/20.1; } + + for(int i=0; i<20; i++) { + for(int j=0; j<20; j++) { + x[0] = sin(phi(j)) * cos(theta(i)); + y[0] = sin(phi(j)) * sin(theta(i)); + z[0] = cos(phi(j)); + + x[1] = sin(phi(j+1)) * cos(theta(i)); + y[1] = sin(phi(j+1)) * sin(theta(i)); + z[1] = cos(phi(j+1)); + + x[2] = sin(phi(j+1)) * cos(theta(i+1)); + y[2] = sin(phi(j+1)) * sin(theta(i+1)); + z[2] = cos(phi(j+1)); + + x[3] = sin(phi(j)) * cos(theta(i+1)); + y[3] = sin(phi(j)) * sin(theta(i+1)); + z[3] = cos(phi(j)); + + x[4] = sin(phi(j)) * cos(theta(i)); + y[4] = sin(phi(j)) * sin(theta(i)); + z[4] = cos(phi(j)); + + plpoly3(x, y, z, draw[k], 1 ); + } + } + + plcol0(3); + plmtex("t", 1.0, 0.5, 0.5, "unit radius sphere"); +} Property changes on: trunk/examples/d/x18d.d ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/examples/d/x19d.d =================================================================== --- trunk/examples/d/x19d.d (rev 0) +++ trunk/examples/d/x19d.d 2009-05-29 19:51:53 UTC (rev 10013) @@ -0,0 +1,79 @@ +/* $Id: $ + + Illustrates backdrop plotting of world, US maps. + Contributed by Wesley Ebisuzaki. +*/ + +import std.math; + +import plplot; + +extern (C) { + /*--------------------------------------------------------------------------*\ + * mapform19 + * + * Defines specific coordinate transformation for example 19. + * Not to be confused with mapform in src/plmap.c. + * x[], y[] are the coordinates to be plotted. + \*--------------------------------------------------------------------------*/ + void mapform19(PLINT n, PLFLT* x, PLFLT* y) + { + double xp, yp, radius; + + for(int i=0; i<n; i++) { + radius = 90.0-y[i]; + xp = radius*cos(x[i]*PI/180.0); + yp = radius*sin(x[i]*PI/180.0); + x[i] = xp; + y[i] = yp; + } + } +} + + +/*--------------------------------------------------------------------------*\ + * main + * + * Shows two views of the world map. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + /* Longitude (x) and latitude (y) */ + PLFLT miny = -70; + PLFLT maxy = 80; + + plinit(); + + /* Cartesian plots */ + /* Most of world */ + PLFLT minx = 190; + PLFLT maxx = 190+360; + + plcol0(1); + plenv(minx, maxx, miny, maxy, 1, -1); + plmap(null, "usaglobe", minx, maxx, miny, maxy); + + /* The Americas */ + minx = 190; + maxx = 340; + + plcol0(1); + plenv(minx, maxx, miny, maxy, 1, -1); + plmap(null, "usaglobe", minx, maxx, miny, maxy); + + /* Polar, Northern hemisphere */ + minx = 0; + maxx = 360; + + plenv(-75., 75., -75., 75., 1, -1); + plmap(&mapform19, "globe", minx, maxx, miny, maxy); + + pllsty(2); + plmeridians(&mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); + + plend(); + return 0; +} Property changes on: trunk/examples/d/x19d.d ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-05-31 18:56:17
|
Revision: 10020 http://plplot.svn.sourceforge.net/plplot/?rev=10020&view=rev Author: airwin Date: 2009-05-31 18:56:12 +0000 (Sun, 31 May 2009) Log Message: ----------- Add build of wxPLplotDemo to CMake-based build system for installed examples. Modified Paths: -------------- trunk/bindings/wxwidgets/CMakeLists.txt trunk/examples/c++/CMakeLists.txt_installed_examples_cxx trunk/examples/plplot_configure.cmake_installed_examples.in Modified: trunk/bindings/wxwidgets/CMakeLists.txt =================================================================== --- trunk/bindings/wxwidgets/CMakeLists.txt 2009-05-30 23:56:32 UTC (rev 10019) +++ trunk/bindings/wxwidgets/CMakeLists.txt 2009-05-31 18:56:12 UTC (rev 10020) @@ -83,11 +83,17 @@ # Install library in lib/ install(TARGETS plplotwxwidgets${LIB_TAG} + EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotwxwidgets.cmake + ) + install(FILES ${plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR} Modified: trunk/examples/c++/CMakeLists.txt_installed_examples_cxx =================================================================== --- trunk/examples/c++/CMakeLists.txt_installed_examples_cxx 2009-05-30 23:56:32 UTC (rev 10019) +++ trunk/examples/c++/CMakeLists.txt_installed_examples_cxx 2009-05-31 18:56:12 UTC (rev 10020) @@ -1,3 +1,4 @@ +# -*- mode: cmake -*- # c++/CMakeLists.txt for installed PLplot examples ### Process this file with cmake to produce Makefile ### @@ -19,39 +20,39 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA set(cxx_STRING_INDICES -"01cc" -"01" -"02" -"03" -"04" -"05" -"06" -"07" -"08" -"09" -"10" -"11" -"12" -"13" -"14" -"15" -"16" -"17" -"18" -"19" -"20" -"21" -"22" -"23" -"24" -"25" -"26" -"27" -"28" -"29" -"30" -"31" -) + "01cc" + "01" + "02" + "03" + "04" + "05" + "06" + "07" + "08" + "09" + "10" + "11" + "12" + "13" + "14" + "15" + "16" + "17" + "18" + "19" + "20" + "21" + "22" + "23" + "24" + "25" + "26" + "27" + "28" + "29" + "30" + "31" + ) include_directories(${INCLUDE_DIR}) foreach(STRING_INDEX ${cxx_STRING_INDICES}) @@ -59,3 +60,14 @@ target_link_libraries(x${STRING_INDEX} plplotcxx${LIB_TAG} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_cxx x${STRING_INDEX}) endforeach(STRING_INDEX ${cxx_STRING_INDICES}) + +if(ENABLE_wxwidgets) + # Build wxwidgets applications with same wxwidgets compile and link flags + # as used with the PLplot wxwidgets device driver. + set_source_files_properties( + wxPLplotDemo.cpp + PROPERTIES COMPILE_FLAGS "${wxwidgets_COMPILE_FLAGS}" + ) + add_executable(wxPLplotDemo wxPLplotDemo.cpp) + target_link_libraries(wxPLplotDemo ${wxwidgets_LINK_FLAGS} plplotwxwidgets${LIB_TAG}) +endif(ENABLE_wxwidgets) Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-30 23:56:32 UTC (rev 10019) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-05-31 18:56:12 UTC (rev 10020) @@ -29,6 +29,7 @@ set(ENABLE_tcl @ENABLE_tcl@) set(ENABLE_tk @ENABLE_tk@) set(ENABLE_gnome2 @ENABLE_gnome2@) +set(ENABLE_wxwidgets @ENABLE_wxwidgets@) # Always enable C language. enable_language(C) @@ -84,6 +85,13 @@ set(TK_INCLUDE_PATH @TK_INCLUDE_PATH@) endif(ENABLE_tk) +if(ENABLE_wxwidgets) + # Use identical compile and link flags to build wxwidgets application. + set(wxwidgets_COMPILE_FLAGS "@wxwidgets_COMPILE_FLAGS@") + set(wxwidgets_LINK_FLAGS @wxwidgets_LINK_FLAGS@) +endif(ENABLE_wxwidgets) + +# List of all non-interactive devices. # Exclude psc since that already has been used for comparisons above. # Exclude some other devices (linuxvga, conex?) in plplot-test.sh where it is # unlikely they are interactive. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-06-01 19:39:34
|
Revision: 10023 http://plplot.svn.sourceforge.net/plplot/?rev=10023&view=rev Author: airwin Date: 2009-06-01 19:39:29 +0000 (Mon, 01 Jun 2009) Log Message: ----------- Build qt_example with new CMake-based build system for the installed examples. Modified Paths: -------------- trunk/drivers/CMakeLists.txt trunk/examples/c++/CMakeLists.txt_installed_examples_cxx trunk/examples/plplot_configure.cmake_installed_examples.in Modified: trunk/drivers/CMakeLists.txt =================================================================== --- trunk/drivers/CMakeLists.txt 2009-06-01 18:48:39 UTC (rev 10022) +++ trunk/drivers/CMakeLists.txt 2009-06-01 19:39:29 UTC (rev 10023) @@ -223,7 +223,18 @@ list(APPEND test_dyndrivers_TDEPENDS ${SOURCE_ROOT_NAME}) endif(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) - install(TARGETS ${SOURCE_ROOT_NAME} DESTINATION ${DRV_DIR}) + if(SOURCE_ROOT_NAME STREQUAL "qt") + install(TARGETS ${SOURCE_ROOT_NAME} + EXPORT export_plplot + DESTINATION ${DRV_DIR} + ) + install(EXPORT export_plplot + DESTINATION ${DATA_DIR}/examples/cmake/modules + FILE export_plplotqt.cmake + ) + else(SOURCE_ROOT_NAME STREQUAL "qt") + install(TARGETS ${SOURCE_ROOT_NAME} DESTINATION ${DRV_DIR}) + endif(SOURCE_ROOT_NAME STREQUAL "qt") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ROOT_NAME}.rc DESTINATION ${DRV_DIR} Modified: trunk/examples/c++/CMakeLists.txt_installed_examples_cxx =================================================================== --- trunk/examples/c++/CMakeLists.txt_installed_examples_cxx 2009-06-01 18:48:39 UTC (rev 10022) +++ trunk/examples/c++/CMakeLists.txt_installed_examples_cxx 2009-06-01 19:39:29 UTC (rev 10023) @@ -71,3 +71,36 @@ add_executable(wxPLplotDemo wxPLplotDemo.cpp) target_link_libraries(wxPLplotDemo ${wxwidgets_LINK_FLAGS} plplotwxwidgets${LIB_TAG}) endif(ENABLE_wxwidgets) + +if(PLD_extqt AND TARGET qt) + # Must find Qt4 all over again here rather than simply copying variables + # from the core build to this installed examples build so that we can + # access the qt4_wrap_cpp macro here. + find_package(Qt4) + # To avoid Qt4 version mismatch make sure the Qt version matches that + # used by the core build. + if(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") + if(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2) + set(QT_USE_QTSVG 1) + endif(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2) + + include(${QT_USE_FILE}) + add_definitions(-DPLD_extqt) + qt4_wrap_cpp( + QT_MOC_OUTFILES + ${CMAKE_CURRENT_SOURCE_DIR}/qt_PlotWindow.h + ) + # message("QT_MOC_OUTFILES = ${QT_MOC_OUTFILES}") + set_source_files_properties( + ${QT_MOC_OUTFILES} + PROPERTIES GENERATED "ON" + ) + add_executable(qt_example qt_example.cpp qt_PlotWindow.cpp ${QT_MOC_OUTFILES}) + # Use file location + plplot${LIB_TAG} rather than the "qt" target + # because otherwise rpath is not set properly for the qt module. + get_target_property(qt_LOCATION qt IMPORTED_LOCATION_NOCONFIG) + target_link_libraries(qt_example ${QT_LIBRARIES} ${qt_LOCATION} plplot${LIB_TAG}) + else(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") + message(STATUS "WARNING: Qt4 not found or wrong version. qt_example not built") + endif(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") +endif(PLD_extqt AND TARGET qt) Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2009-06-01 18:48:39 UTC (rev 10022) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2009-06-01 19:39:29 UTC (rev 10023) @@ -91,7 +91,18 @@ set(wxwidgets_LINK_FLAGS @wxwidgets_LINK_FLAGS@) endif(ENABLE_wxwidgets) -# List of all non-interactive devices. +# Set interactive/external devices that are needed to build certain examples. +set(PLD_xcairo @PLD_xcairo@) +set(PLD_extcairo @PLD_extcairo@) +set(PLD_extqt @PLD_extqt@) + +if(PLD_extqt) + set(CORE_QT_VERSION_MAJOR @QT_VERSION_MAJOR@) + set(CORE_QT_VERSION_MINOR @QT_VERSION_MINOR@) + set(CORE_QT_VERSION_PATCH @QT_VERSION_PATCH@) +endif(PLD_extqt) + +# List of all devices that will be used for non_interactive tests. # Exclude psc since that already has been used for comparisons above. # Exclude some other devices (linuxvga, conex?) in plplot-test.sh where it is # unlikely they are interactive. @@ -172,6 +183,3 @@ set(PLD_wxpng @PLD_wxpng@) set(PLD_xfig @PLD_xfig@) -# Set interactive devices -set(PLD_xcairo @PLD_xcairo@) -set(PLD_extcairo @PLD_extcairo@) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-06-03 08:12:49
|
Revision: 10028 http://plplot.svn.sourceforge.net/plplot/?rev=10028&view=rev Author: smekal Date: 2009-06-03 08:12:27 +0000 (Wed, 03 Jun 2009) Log Message: ----------- D bindings now include improved plcont() function. The D bindings provide PLcGrid and PLcGrid2 structs now. D example 9 fully ported. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt trunk/examples/d/x09d.d trunk/examples/d/x15d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/bindings/d/plplot.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -15,9 +15,26 @@ alias void function(PLINT, PLFLT*, PLFLT*) mapform_func; } +// D definition of PLcGrid and PLcGrid2 +struct PLcGrid +{ + PLFLT[] xg; + PLFLT[] yg; + PLFLT[] zg; +} +struct PLcGrid2 +{ + PLFLT[][] xg; + PLFLT[][] yg; + PLFLT[][] zg; +} + // helper function to convert D dynamic arrays in C dynamic arrays private PLFLT** convert_array(PLFLT[][] a) { + if(!a) + return null; + size_t nx=a.length; size_t ny=a[0].length; @@ -85,8 +102,59 @@ /* Draws a contour plot from data in f(nx,ny). Is just a front-end to * plfcont, with a particular choice for f2eval and f2eval_data. */ -//void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + pltr_func pltr, PLPointer pltr_data=null) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + pltr, pltr_data); +} + +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + ref PLcGrid cgrid) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + + c_PLcGrid c; + c.xg = cgrid.xg.ptr; + c.nx = cgrid.xg.length; + c.yg = cgrid.yg.ptr; + c.ny = cgrid.yg.length; + c.zg = cgrid.zg.ptr; + c.nz = cgrid.zg.length; + + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + &pltr1, &c); +} + +void plcont(PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel, + ref PLcGrid2 cgrid2) +{ + PLINT nx=f.length; + PLINT ny=f[0].length; + + c_PLcGrid2 c2; + c2.xg = convert_array(cgrid2.xg); + c2.yg = convert_array(cgrid2.yg); + c2.zg = convert_array(cgrid2.zg); + c2.nx = cgrid2.xg.length; + c2.ny = cgrid2.xg[0].length; + if(cgrid2.yg) { + assert(c2.nx==cgrid2.yg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.yg[0].length, "plcont(): Arrays must be of same length!"); + } + if(cgrid2.zg) { + assert(c2.nx==cgrid2.zg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.zg[0].length, "plcont(): Arrays must be of same length!"); + } + + c_plcont(convert_array(f), nx, ny, kx, lx, ky, ly, clevel.ptr, clevel.length, + &pltr2, &c2); +} + /* Draws a contour plot using the function evaluator f2eval and data stored * by way of the f2eval_data pointer. This allows arbitrary organizations * of 2d array data to be used. @@ -772,7 +840,7 @@ PLINT ny; PLINT nz; } -alias _N7 PLcGrid; +alias _N7 c_PLcGrid; /* * PLcGrid2 is for passing (as arrays of pointers) 2d coordinate @@ -788,7 +856,7 @@ PLINT nx; PLINT ny; } -alias _N8 PLcGrid2; +alias _N8 c_PLcGrid2; /* * NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet @@ -898,7 +966,7 @@ alias c_plclear plclear; alias c_plcol0 plcol0; alias c_plcol1 plcol1; -alias c_plcont plcont; +//alias c_plcont plcont; alias c_plcpstrm plcpstrm; alias c_plctime plctime; alias c_plend plend; @@ -1103,34 +1171,30 @@ void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); /* Calculate world coordinates and subpage from relative device coordinates. */ +void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); -void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); - /* Clear current subpage. */ +void c_plclear(); -void c_plclear(); - /* Set color, map 0. Argument is integer between 0 and 15. */ +void c_plcol0(PLINT icol0); -void c_plcol0(PLINT icol0); - /* Set color, map 1. Argument is a float between 0. and 1. */ +void c_plcol1(PLFLT col1); -void c_plcol1(PLFLT col1); - /* Draws a contour plot from data in f(nx,ny). Is just a front-end to * plfcont, with a particular choice for f2eval and f2eval_data. */ +void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, + PLFLT *clevel, PLINT nlevel, + void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr, PLPointer pltr_data); -void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - /* Draws a contour plot using the function evaluator f2eval and data stored * by way of the f2eval_data pointer. This allows arbitrary organizations * of 2d array data to be used. */ +void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); -void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); - /* Copies state parameters from the reference stream to the current stream. */ void c_plcpstrm(PLINT iplsr, PLBOOL flags); Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/CMakeLists.txt 2009-06-03 08:12:27 UTC (rev 10028) @@ -28,7 +28,7 @@ "06" "07" "08" -# "09" + "09" "10" "11" "12" Modified: trunk/examples/d/x09d.d =================================================================== --- trunk/examples/d/x09d.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/x09d.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -21,32 +21,15 @@ */ import std.string; +import std.math; import plplot; -#define XPTS 35 /* Data points in x */ -#define YPTS 46 /* Data points in y */ +const int XPTS=35; /* Data points in x */ +const int YPTS=46; /* Data points in y */ -#define XSPA 2./(XPTS-1) -#define YSPA 2./(YPTS-1) - -/* polar plot data */ -#define PERIMETERPTS 100 -#define RPTS 40 -#define THETAPTS 40 - -/* potential plot data */ -#define PPERIMETERPTS 100 -#define PRPTS 40 -#define PTHETAPTS 64 -#define PNLEVEL 20 - -static PLFLT clevel[11] = -{-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.}; - /* Transformation function */ - extern (C) { - PLFLT[] tr = {XSPA, 0.0, -1.0, 0.0, YSPA, -1.0}; + PLFLT[] tr = [ 2./(XPTS-1), 0.0, -1.0, 0.0, 2./(YPTS-1), -1.0 ]; void mypltr(PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data) { @@ -55,56 +38,61 @@ } } -static void polar() /*polar contour plot example.*/ +void polar() { - int i,j; - PLcGrid2 cgrid2; - PLFLT **z; - PLFLT px[PERIMETERPTS], py[PERIMETERPTS]; - PLFLT t, r, theta; - PLFLT lev[10]; + const int PERIMETERPTS=100; + const int RPTS=40; + const int THETAPTS=40; - plenv(-1., 1., -1., 1., 0, -2); - plcol0(1); + plenv(-1., 1., -1., 1., 0, -2); + plcol0(1); -/*Perimeter*/ - for (i = 0; i < PERIMETERPTS; i++) { - t = (2.*M_PI/(PERIMETERPTS-1))*(double)i; - px[i] = cos(t); - py[i] = sin(t); - } - plline(PERIMETERPTS, px, py); + /*Perimeter*/ + PLFLT[] px, py; + px.length = PERIMETERPTS; + py.length = PERIMETERPTS; + PLFLT t; + for(int i=0; i<PERIMETERPTS; i++) { + t = 2.*PI/(PERIMETERPTS-1)*i; + px[i] = cos(t); + py[i] = sin(t); + } + plline(px, py); -/*create data to be contoured.*/ - plAlloc2dGrid(&cgrid2.xg, RPTS, THETAPTS); - plAlloc2dGrid(&cgrid2.yg, RPTS, THETAPTS); - plAlloc2dGrid(&z, RPTS, THETAPTS); - cgrid2.nx = RPTS; - cgrid2.ny = THETAPTS; + /*create data to be contoured.*/ + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.xg[i] = new PLFLT[THETAPTS]; + cgrid2.yg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.yg[i] = new PLFLT[THETAPTS]; - for (i = 0; i < RPTS; i++) { - r = i/(double)(RPTS-1); - for (j = 0; j < THETAPTS; j++) { - theta = (2.*M_PI/(double)(THETAPTS-1))*(double)j; - cgrid2.xg[i][j] = r*cos(theta); - cgrid2.yg[i][j] = r*sin(theta); - z[i][j] = r; - } - } + PLFLT[][] z = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + z[i] = new PLFLT[THETAPTS]; - for (i = 0; i < 10; i++) { - lev[i] = 0.05 + 0.10*(double) i; - } + PLFLT r, theta; + for(int i=0; i<RPTS; i++) { + r = i/cast(double)(RPTS-1); + for(int j=0; j<THETAPTS; j++) { + theta = 2.*PI/(THETAPTS-1)*j; + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); + z[i][j] = r; + } + } - plcol0(2); - plcont(z, RPTS, THETAPTS, 1, RPTS, 1, THETAPTS, lev, 10, - pltr2, (void *) &cgrid2); - plcol0(1); - pllab("", "", "Polar Contour Plot"); - plFree2dGrid(z, RPTS, THETAPTS); - plFree2dGrid(cgrid2.xg, RPTS, THETAPTS); - plFree2dGrid(cgrid2.yg, RPTS, THETAPTS); + PLFLT[] lev; + lev.length=10; + for(int i=0; i<10; i++) + lev[i] = 0.05 + 0.10*i; + + plcol0(2); + plcont(z, 1, RPTS, 1, THETAPTS, lev, cgrid2); + plcol0(1); + pllab("", "", "Polar Contour Plot"); } /*--------------------------------------------------------------------------*\ @@ -112,89 +100,87 @@ * * Returns min & max of input 2d array. \*--------------------------------------------------------------------------*/ - -static void -f2mnmx(PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax) +void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) { - int i, j; + fmx = f[0][0]; + fmn = fmx; - *fmax = f[0][0]; - *fmin = *fmax; - - for (i = 0; i < nx; i++) { - for (j = 0; j < ny; j++) { - *fmax = MAX(*fmax, f[i][j]); - *fmin = MIN(*fmin, f[i][j]); - } + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[i].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); } + } } -static void potential() + /*shielded potential contour plot example.*/ +void potential() { - PLcGrid2 cgrid2; - PLFLT rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; - PLFLT peps, xpmin, xpmax, ypmin, ypmax; - PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; - PLFLT div1, div1i, div2, div2i; - PLFLT **z; - PLINT nlevelneg, nlevelpos; - PLFLT dz, clevel, clevelneg[PNLEVEL], clevelpos[PNLEVEL]; - PLINT ncollin, ncolbox, ncollab; - PLFLT px[PPERIMETERPTS], py[PPERIMETERPTS]; - PLFLT t, r, theta; + const int PERIMETERPTS=100; + const int RPTS=40; + const int THETAPTS=64; + const int NLEVEL=20; /*create data to be contoured.*/ - plAlloc2dGrid(&cgrid2.xg, PRPTS, PTHETAPTS); - plAlloc2dGrid(&cgrid2.yg, PRPTS, PTHETAPTS); - plAlloc2dGrid(&z, PRPTS, PTHETAPTS); - cgrid2.nx = PRPTS; - cgrid2.ny = PTHETAPTS; + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.xg[i] = new PLFLT[THETAPTS]; + cgrid2.yg = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + cgrid2.yg[i] = new PLFLT[THETAPTS]; + + PLFLT[][] z = new PLFLT[][RPTS]; + for(int i=0; i<RPTS; i++) + z[i] = new PLFLT[THETAPTS]; - for (i = 0; i < PRPTS; i++) { - r = 0.5 + (double) i; - for (j = 0; j < PTHETAPTS; j++) { - theta = (2.*M_PI/(double)(PTHETAPTS-1))*(0.5 + (double) j); - cgrid2.xg[i][j] = r*cos(theta); - cgrid2.yg[i][j] = r*sin(theta); + PLFLT r, theta; + for(int i=0; i<RPTS; i++) { + r = 0.5+i; + for(int j=0; j<THETAPTS; j++) { + theta = 2.*PI/(THETAPTS-1)*(0.5+j); + cgrid2.xg[i][j] = r*cos(theta); + cgrid2.yg[i][j] = r*sin(theta); } } + PLFLT rmax = r; + + PLFLT xmin, xmax, ymin, ymax; + f2mnmx(cgrid2.xg, xmin, xmax); + f2mnmx(cgrid2.yg, ymin, ymax); + PLFLT x0 = (xmin+xmax)/2.; + PLFLT y0 = (ymin+ymax)/2.; - rmax = r; - f2mnmx(cgrid2.xg, PRPTS, PTHETAPTS, &xmin, &xmax); - f2mnmx(cgrid2.yg, PRPTS, PTHETAPTS, &ymin, &ymax); - x0 = (xmin + xmax)/2.; - y0 = (ymin + ymax)/2.; - /* Expanded limits */ - peps = 0.05; - xpmin = xmin - fabs(xmin)*peps; - xpmax = xmax + fabs(xmax)*peps; - ypmin = ymin - fabs(ymin)*peps; - ypmax = ymax + fabs(ymax)*peps; + PLFLT peps = 0.05; + PLFLT xpmin = xmin - fabs(xmin)*peps; + PLFLT xpmax = xmax + fabs(xmax)*peps; + PLFLT ypmin = ymin - fabs(ymin)*peps; + PLFLT ypmax = ymax + fabs(ymax)*peps; /* Potential inside a conducting cylinder (or sphere) by method of images. Charge 1 is placed at (d1, d1), with image charge at (d2, d2). Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). Also put in smoothing term at small distances. */ + PLFLT eps = 2.; - eps = 2.; + PLFLT q1 = 1.; + PLFLT d1 = rmax/4.; - q1 = 1.; - d1 = rmax/4.; + PLFLT q1i = - q1*rmax/d1; + PLFLT d1i = pow(rmax, 2.)/d1; - q1i = - q1*rmax/d1; - d1i = pow(rmax, 2.)/d1; + PLFLT q2 = -1.; + PLFLT d2 = rmax/4.; - q2 = -1.; - d2 = rmax/4.; + PLFLT q2i = - q2*rmax/d2; + PLFLT d2i = pow(rmax, 2.)/d2; - q2i = - q2*rmax/d2; - d2i = pow(rmax, 2.)/d2; - - for(int i=0; i<PRPTS; i++) { - for(int j=0; j<PTHETAPTS; j++) { + PLFLT div1, div1i, div2, div2i; + for(int i=0; i<RPTS; i++) { + for(int j=0; j<THETAPTS; j++) { div1 = sqrt(pow(cgrid2.xg[i][j]-d1, 2.) + pow(cgrid2.yg[i][j]-d1, 2.) + pow(eps, 2.)); div1i = sqrt(pow(cgrid2.xg[i][j]-d1i, 2.) + pow(cgrid2.yg[i][j]-d1i, 2.) + pow(eps, 2.)); div2 = sqrt(pow(cgrid2.xg[i][j]-d2, 2.) + pow(cgrid2.yg[i][j]+d2, 2.) + pow(eps, 2.)); @@ -202,13 +188,18 @@ z[i][j] = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; } } + PLFLT zmin, zmax; f2mnmx(z, zmin, zmax); /* Positive and negative contour levels.*/ - dz = (zmax-zmin)/PNLEVEL; - nlevelneg = 0; - nlevelpos = 0; - for(int i=0; i<PNLEVEL; i++) { + PLFLT dz = (zmax-zmin)/NLEVEL; + PLFLT[] clevelneg, clevelpos; + PLFLT clevel; + clevelneg.length = NLEVEL; + clevelpos.length = NLEVEL; + int nlevelneg = 0; + int nlevelpos = 0; + for(int i=0; i<NLEVEL; i++) { clevel = zmin + (i+0.5)*dz; if(clevel<=0.) clevelneg[nlevelneg++] = clevel; @@ -216,9 +207,9 @@ clevelpos[nlevelpos++] = clevel; } /* Colours! */ - ncollin = 11; - ncolbox = 1; - ncollab = 2; + PLINT ncollin = 11; + PLINT ncolbox = 1; + PLINT ncollab = 2; /* Finally start plotting this page! */ pladv(0); @@ -232,18 +223,22 @@ if(nlevelneg >0) { /* Negative contours */ pllsty(2); - plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, pltr2, (void*)&cgrid2); + plcont(z, 1, RPTS, 1, THETAPTS, clevelneg, cgrid2); } if(nlevelpos >0) { /* Positive contours */ pllsty(1); - plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, pltr2, (void*)&cgrid2); + plcont(z, 1, RPTS, 1, THETAPTS, clevelpos, cgrid2); } /* Draw outer boundary */ - for(int i=0; i<PPERIMETERPTS; i++) { - t = (2.*PI/(PPERIMETERPTS-1))*i; + PLFLT[] px, py; + px.length = PERIMETERPTS; + py.length = PERIMETERPTS; + PLFLT t; + for(int i=0; i<PERIMETERPTS; i++) { + t = (2.*PI/(PERIMETERPTS-1))*i; px[i] = x0 + rmax*cos(t); py[i] = y0 + rmax*sin(t); } @@ -264,6 +259,7 @@ int main(char[][] args) { PLINT[] mark = [ 1500 ], space = [ 1500 ]; + PLFLT[] clevel = [ -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. ]; /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -272,7 +268,6 @@ plinit(); /* Set up function arrays */ - PLFLT xx, yy; PLFLT[][] z = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) z[i] = new PLFLT[YPTS]; @@ -281,6 +276,7 @@ for(int i=0; i<XPTS; i++) w[i] = new PLFLT[YPTS]; + PLFLT xx, yy; for(int i=0; i<XPTS; i++) { xx = cast(double)(i-(XPTS/2))/(XPTS/2); for(int j=0; j<YPTS; j++) { @@ -291,14 +287,16 @@ } /* Set up grids */ - cgrid1.xg = (new PLFLT[XPTS]).ptr; - cgrid1.yg = (new PLFLT[XPTS]).ptr; + PLcGrid cgrid1; + cgrid1.xg = new PLFLT[XPTS]; + cgrid1.yg = new PLFLT[YPTS]; - PLFLT[][] cgrid2.xg = new PLFLT[][XPTS]; + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) cgrid2.xg[i] = new PLFLT[YPTS]; - PLFLT[][] cgrid2.yg = new PLFLT[][XPTS]; + cgrid2.yg = new PLFLT[][XPTS]; for(int i=0; i<XPTS; i++) cgrid2.yg[i] = new PLFLT[YPTS]; @@ -307,8 +305,8 @@ for(int j=0; j<YPTS; j++) { mypltr(cast(PLFLT)i, cast(PLFLT)j, &xx, &yy, null); - argx = xx * M_PI/2; - argy = yy * M_PI/2; + argx = xx*PI/2; + argy = yy*PI/2; distort = 0.4; cgrid1.xg[i] = xx + distort * cos(argx); @@ -320,14 +318,15 @@ } /* Plot using identity transform */ + pl_setcontlabelformat(4, 3); pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr); + plcont(z, 1, XPTS, 1, YPTS, clevel, &mypltr); plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr); + plcont(w, 1, XPTS, 1, YPTS, clevel, &mypltr); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); @@ -336,11 +335,11 @@ /* Plot using 1d coordinate transform */ plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + plcont(z, 1, XPTS, 1, YPTS, clevel, cgrid1); - plstyl(1, mark, space); + plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, pltr1, cast(void*)&cgrid1); + plcont(w, 1, XPTS, 1, YPTS, clevel, cgrid1); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); @@ -348,11 +347,11 @@ /* Plot using 2d coordinate transform */ plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); - plcont(z, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + plcont(z, 1, XPTS, 1, YPTS, clevel, cgrid2); plstyl(mark, space); plcol0(3); - plcont(w, 1, XPTS, 1, YPTS, clevel, pltr2, (void *)&cgrid2); + plcont(w, 1, XPTS, 1, YPTS, clevel, cgrid2); plstyl(null, null); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); Modified: trunk/examples/d/x15d.d =================================================================== --- trunk/examples/d/x15d.d 2009-06-02 23:23:25 UTC (rev 10027) +++ trunk/examples/d/x15d.d 2009-06-03 08:12:27 UTC (rev 10028) @@ -229,7 +229,7 @@ fmn = fmx; for(int i=0; i<f.length; i++) { - for(int j=0; j<f[0].length; j++) { + for(int j=0; j<f[i].length; j++) { fmx = fmax(fmx, f[i][j]); fmn = fmin(fmn, f[i][j]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-06-05 06:07:51
|
Revision: 10031 http://plplot.svn.sourceforge.net/plplot/?rev=10031&view=rev Author: smekal Date: 2009-06-05 06:07:40 +0000 (Fri, 05 Jun 2009) Log Message: ----------- Finished improvement of D bindings (more or less). Fixed example 3. Fixed example 8 and 11 due to changes in D bindings. Added D examples 16 and 26. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/CMakeLists.txt trunk/examples/d/x03d.d trunk/examples/d/x08d.d trunk/examples/d/x11d.d Added Paths: ----------- trunk/examples/d/x16d.d trunk/examples/d/x26d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-06-04 15:23:16 UTC (rev 10030) +++ trunk/bindings/d/plplot.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -58,8 +58,59 @@ } /* simple arrow plotter. */ -//void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void plvect(PLFLT[][] u, PLFLT[][] v, PLFLT scale, pltr_func pltr=null, PLPointer pltr_data=null) +{ + PLINT nx=u.length; + PLINT ny=u[0].length; + assert(nx==v.length, "plvect(): Arrays must be of same length!"); + assert(ny==v[0].length, "plvect(): Arrays must be of same length!"); + + c_plvect(convert_array(u), convert_array(v), nx, ny, scale, pltr, pltr_data); +} +void plvect(PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid cgrid) +{ + PLINT nx=u.length; + PLINT ny=u[0].length; + assert(nx==v.length, "plvect(): Arrays must be of same length!"); + assert(ny==v[0].length, "plvect(): Arrays must be of same length!"); + + c_PLcGrid c; + c.xg = cgrid.xg.ptr; + c.nx = cgrid.xg.length; + c.yg = cgrid.yg.ptr; + c.ny = cgrid.yg.length; + c.zg = cgrid.zg.ptr; + c.nz = cgrid.zg.length; + + c_plvect(convert_array(u), convert_array(v), nx, ny, scale, &pltr1, &c); +} + +void plvect(PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid2 cgrid2) +{ + PLINT nx=u.length; + PLINT ny=u[0].length; + assert(nx==v.length, "plvect(): Arrays must be of same length!"); + assert(ny==v[0].length, "plvect(): Arrays must be of same length!"); + + c_PLcGrid2 c2; + c2.xg = convert_array(cgrid2.xg); + c2.yg = convert_array(cgrid2.yg); + c2.zg = convert_array(cgrid2.zg); + c2.nx = cgrid2.xg.length; + c2.ny = cgrid2.xg[0].length; + if(cgrid2.yg) { + assert(c2.nx==cgrid2.yg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.yg[0].length, "plcont(): Arrays must be of same length!"); + } + if(cgrid2.zg) { + assert(c2.nx==cgrid2.zg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.zg[0].length, "plcont(): Arrays must be of same length!"); + } + + c_plvect(convert_array(u), convert_array(v), nx, ny, scale, &pltr2, &c2); +} + void plsvect(PLFLT[] arrowx, PLFLT[] arrowy, PLBOOL fill) { PLINT npts=arrowx.length; @@ -213,7 +264,19 @@ } /* grid irregularly sampled data */ -//void 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 plgriddata(PLFLT[] x, PLFLT[] y, PLFLT[] z, PLFLT[] xg, PLFLT[] yg, PLFLT[][] zg, PLINT type, PLFLT data) +{ + PLINT npts = x.length; + assert(npts==y.length, "plgriddata(): Arrays must be of same length!"); + assert(npts==z.length, "plgriddata(): Arrays must be of same length!"); + + PLINT nxg = xg.length; + PLINT nyg = yg.length; + assert(nxg==zg.length, "plgriddata(): Arrays must be of same length!"); + assert(nyg==zg[0].length, "plgriddata(): Arrays must be of same length!"); + + c_plgriddata(x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg, convert_array(zg), type, data); +} /* Get the current library version number */ void plgver(out string p_ver) @@ -260,11 +323,29 @@ } /* Plots a mesh representation of the function z[x][y]. */ -//void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); +void plmesh(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + + assert(nx==x.length, "plmesh(): Arrays must be of same length!"); + assert(ny==y.length, "plmesh(): Arrays must be of same length!"); + c_plmesh(x.ptr, y.ptr, convert_array(z), nx, ny, opt); +} + /* Plots a mesh representation of the function z[x][y] with contour */ -//void c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); +void plmeshc(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + + assert(nx==x.length, "plmeshc(): Arrays must be of same length!"); + assert(ny==y.length, "plmeshc(): Arrays must be of same length!"); + c_plmeshc(x.ptr, y.ptr, convert_array(z), nx, ny, opt, clevel.ptr, clevel.length); +} + /* Prints out "text" at specified position relative to viewport */ void plmtex(string side, PLFLT disp, PLFLT pos, PLFLT just, string text) { @@ -278,15 +359,44 @@ } /* Plots a 3-d representation of the function z[x][y]. */ -//void c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side); +void plot3d(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLBOOL side) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + + assert(nx==x.length, "plot3d(): Arrays must be of same length!"); + assert(ny==y.length, "plot3d(): Arrays must be of same length!"); + c_plot3d(x.ptr, y.ptr, convert_array(z), nx, ny, opt, side); +} + /* Plots a 3-d representation of the function z[x][y] with contour. */ -//void c_plot3dc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); +void plot3dc(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + + assert(nx==x.length, "plot3dc(): Arrays must be of same length!"); + assert(ny==y.length, "plot3dc(): Arrays must be of same length!"); + c_plot3dc(x.ptr, y.ptr, convert_array(z), nx, ny, opt, clevel.ptr, clevel.length); +} + /* Plots a 3-d representation of the function z[x][y] with contour and * y index limits. */ -//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 plot3dcl(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel, + PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + + assert(nx==x.length, "plot3dcl(): Arrays must be of same length!"); + assert(ny==y.length, "plot3dcl(): Arrays must be of same length!"); + c_plot3dcl(x.ptr, y.ptr, convert_array(z), nx, ny, opt, clevel.ptr, clevel.length, + ixstart, ixn, indexymin.ptr, indexymax.ptr); +} + /* Set fill pattern directly. */ void plpat(PLINT[] inc, PLINT[] del) { @@ -442,6 +552,51 @@ fill_width, cont_color, cont_width, &c_plfill, rectangular, pltr, pltr_data); } +void plshades(PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT[] clevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, ref PLcGrid cgrid) +{ + PLINT nx=a.length; + PLINT ny=a[0].length; + + c_PLcGrid c; + c.xg = cgrid.xg.ptr; + c.nx = cgrid.xg.length; + c.yg = cgrid.yg.ptr; + c.ny = cgrid.yg.length; + c.zg = cgrid.zg.ptr; + c.nz = cgrid.zg.length; + + c_plshades(convert_array(a), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, clevel.length, + fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr1, &c); +} + +void plshades(PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT[] clevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, + PLBOOL rectangular, ref PLcGrid2 cgrid2) +{ + PLINT nx=a.length; + PLINT ny=a[0].length; + + c_PLcGrid2 c2; + c2.xg = convert_array(cgrid2.xg); + c2.yg = convert_array(cgrid2.yg); + c2.zg = convert_array(cgrid2.zg); + c2.nx = cgrid2.xg.length; + c2.ny = cgrid2.xg[0].length; + if(cgrid2.yg) { + assert(c2.nx==cgrid2.yg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.yg[0].length, "plcont(): Arrays must be of same length!"); + } + if(cgrid2.zg) { + assert(c2.nx==cgrid2.zg.length, "plcont(): Arrays must be of same length!"); + assert(c2.ny==cgrid2.zg[0].length, "plcont(): Arrays must be of same length!"); + } + + c_plshades(convert_array(a), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, clevel.length, + fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr2, &c2); +} + /* Initialize PLplot, passing the device name and windows/page settings. */ void plstart(string devname, PLINT nx, PLINT ny) { @@ -469,12 +624,29 @@ } /* plots a 2d image (or a matrix too large for plshade() ) */ -//void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, PLFLT valuemin, PLFLT valuemax); +void plimagefr(PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, + PLFLT valuemin, PLFLT valuemax) +{ + PLINT nx=idata.length; + PLINT ny=idata[0].length; + c_plimagefr(convert_array(idata), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, + Dymin, Dymax, valuemin, valuemax); +} + /* plots a 2d image (or a matrix too large for plshade() ) - colors automatically scaled */ -//void c_plimage(PLFLT **idata, 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 plimage(PLFLT[][] idata, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax) +{ + PLINT nx=idata.length; + PLINT ny=idata[0].length; + c_plimage(convert_array(idata), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, + Dymin, Dymax); +} + /* Set up a new line style */ void plstyl(PLINT[] mark, PLINT[] space) { @@ -484,12 +656,33 @@ } /* Plots the 3d surface representation of the function z[x][y]. */ -//void c_plsurf3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); +void plsurf3d(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel=null) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + assert(nx==x.length, "plsurf3d(): Arrays must be of same length!"); + assert(ny==y.length, "plsurf3d(): Arrays must be of same length!"); + + if(clevel) + c_plsurf3d(x.ptr, y.ptr, convert_array(z), nx, ny, opt, clevel.ptr, clevel.length); + else + c_plsurf3d(x.ptr, y.ptr, convert_array(z), nx, ny, opt, null, 0); +} /* Plots the 3d surface representation of the function z[x][y] with y * index limits. */ -//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 plsurf3dl(PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel, + PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax) +{ + PLINT nx=z.length; + PLINT ny=z[0].length; + assert(nx==x.length, "plsurf3d(): Arrays must be of same length!"); + assert(ny==y.length, "plsurf3d(): Arrays must be of same length!"); + c_plsurf3dl(x.ptr, y.ptr, convert_array(z), nx, ny, opt, clevel.ptr, clevel.length, + ixstart, ixn, indexymin.ptr, indexymax.ptr); +} + /* Plots array y against x for n points using Hershey symbol "code" */ void plsym(PLFLT[] x, PLFLT[] y, PLINT code) { @@ -999,7 +1192,7 @@ alias c_plglevel plglevel; alias c_plgpage plgpage; alias c_plgra plgra; -alias c_plgriddata plgriddata; +//alias c_plgriddata plgriddata; alias c_plgspa plgspa; alias c_plgstrm plgstrm; //alias c_plgver plgver; @@ -1011,8 +1204,8 @@ //alias c_plhist plhist; alias c_plhls plhls; alias c_plhlsrgb plhlsrgb; -alias c_plimage plimage; -alias c_plimagefr plimagefr; +//alias c_plimage plimage; +//alias c_plimagefr plimagefr; alias c_plinit plinit; alias c_pljoin pljoin; //alias c_pllab pllab; @@ -1022,14 +1215,14 @@ alias c_pllsty pllsty; //alias c_plmap plmap; alias c_plmeridians plmeridians; -alias c_plmesh plmesh; -alias c_plmeshc plmeshc; +//alias c_plmesh plmesh; +//alias c_plmeshc plmeshc; alias c_plmkstrm plmkstrm; //alias c_plmtex plmtex; //alias c_plmtex3 plmtex3; -alias c_plot3d plot3d; -alias c_plot3dc plot3dc; -alias c_plot3dcl plot3dcl; +//alias c_plot3d plot3d; +//alias c_plot3dc plot3dc; +//alias c_plot3dcl plot3dcl; //alias c_plparseopts plparseopts; //alias c_plpat plpat; //alias c_plpoin plpoin; @@ -1087,8 +1280,8 @@ //alias c_plstripc plstripc; alias c_plstripd plstripd; //alias c_plstyl plstyl; -alias c_plsurf3d plsurf3d; -alias c_plsurf3dl plsurf3dl; +//alias c_plsurf3d plsurf3d; +//alias c_plsurf3dl plsurf3dl; //alias c_plsvect plsvect; alias c_plsvpa plsvpa; alias c_plsxax plsxax; @@ -1098,7 +1291,7 @@ alias c_pltext pltext; //alias c_pltimefmt pltimefmt; alias c_plvasp plvasp; -alias c_plvect plvect; +//alias c_plvect plvect; alias c_plvpas plvpas; alias c_plvpor plvpor; alias c_plvsta plvsta; @@ -1127,29 +1320,27 @@ \*--------------------------------------------------------------------------*/ - /* All void types */ +/* All void types */ +/* C routines callable from stub routines come first */ - /* C routines callable from stub routines come first */ - /* set the format of the contour labels */ +void c_pl_setcontlabelformat(PLINT lexp, PLINT sigdig); -void c_pl_setcontlabelformat(PLINT lexp, PLINT sigdig); - /* set offset and spacing of contour labels */ +void c_pl_setcontlabelparam(PLFLT offset, PLFLT size, PLFLT spacing, PLINT active); -void c_pl_setcontlabelparam(PLFLT offset, PLFLT size, PLFLT spacing, PLINT active); - /* Advance to subpage "page", or to the next one if "page" = 0. */ +void c_pladv(PLINT page); -void c_pladv(PLINT page); - /* simple arrow plotter. */ -void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, + void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr, PLPointer pltr_data); void c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); /* This functions similarly to plbox() except that the origin of the axes */ /* is placed at the user-specified point (x0, y0). */ -void c_plaxes(PLFLT x0, PLFLT y0, char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); +void c_plaxes(PLFLT x0, PLFLT y0, char *xopt, PLFLT xtick, PLINT nxsub, + char *yopt, PLFLT ytick, PLINT nysub); /* Flags for plbin() - opt argument */ const PL_BIN_DEFAULT = 0; @@ -1161,9 +1352,8 @@ void c_plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt); /* Start new page. Should only be used with pleop(). */ +void c_plbop(); -void c_plbop(); - /* This draws a box around the current viewport. */ void c_plbox(char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); @@ -1193,7 +1383,9 @@ * by way of the f2eval_data pointer. This allows arbitrary organizations * of 2d array data to be used. */ -void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data); +void plfcont(PLFLT function(PLINT, PLINT, PLPointer) f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, + PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, + void function(PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer) pltr, PLPointer pltr_data); /* Copies state parameters from the reference stream to the current stream. */ void c_plcpstrm(PLINT iplsr, PLBOOL flags); @@ -1203,36 +1395,28 @@ /* Converts input values from relative device coordinates to relative plot */ /* coordinates. */ +void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); -void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); - /* Converts input values from relative plot coordinates to relative */ /* device coordinates. */ +void pldip2dc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); -void pldip2dc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); - /* End a plotting session for all open streams. */ +void c_plend(); -void c_plend(); - /* End a plotting session for the current stream only. */ +void c_plend1(); -void c_plend1(); - /* Simple interface for defining viewport and window. */ +void c_plenv(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); -void c_plenv(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); - - /* similar to plenv() above, but in multiplot mode does not advance the subpage, instead the current subpage is cleared */ +void c_plenv0(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); -void c_plenv0(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); - /* End current page. Should only be used with plbop(). */ +void c_pleop(); -void c_pleop(); - /* Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) */ void c_plerrx(PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y); @@ -1249,56 +1433,44 @@ void c_plfill3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z); /* Flushes the output stream. Use sparingly, if at all. */ +void c_plflush(); -void c_plflush(); - /* Sets the global font flag to 'ifont'. */ +void c_plfont(PLINT ifont); -void c_plfont(PLINT ifont); - /* Load specified font set. */ +void c_plfontld(PLINT fnt); -void c_plfontld(PLINT fnt); - /* Get character default height and current (scaled) height */ +void c_plgchr(PLFLT *p_def, PLFLT *p_ht); -void c_plgchr(PLFLT *p_def, PLFLT *p_ht); - /* Returns 8 bit RGB values for given color from color map 0 */ +void c_plgcol0(PLINT icol0, PLINT *r, PLINT *g, PLINT *b); -void c_plgcol0(PLINT icol0, PLINT *r, PLINT *g, PLINT *b); - /* Returns 8 bit RGB values for given color from color map 0 and alpha value */ +void c_plgcol0a(PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *a); -void c_plgcol0a(PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *a); - /* Returns the background color by 8 bit RGB value */ +void c_plgcolbg(PLINT *r, PLINT *g, PLINT *b); -void c_plgcolbg(PLINT *r, PLINT *g, PLINT *b); - /* Returns the background color by 8 bit RGB value and alpha value */ +void c_plgcolbga(PLINT *r, PLINT *g, PLINT *b, PLFLT *a); -void c_plgcolbga(PLINT *r, PLINT *g, PLINT *b, PLFLT *a); - /* Returns the current compression setting */ +void c_plgcompression(PLINT *compression); -void c_plgcompression(PLINT *compression); - /* Get the current device (keyword) name */ void c_plgdev(char *p_dev); /* Retrieve current window into device space */ +void c_plgdidev(PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy); -void c_plgdidev(PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy); - /* Get plot orientation */ +void c_plgdiori(PLFLT *p_rot); -void c_plgdiori(PLFLT *p_rot); - /* Retrieve current window into plot space */ +void c_plgdiplt(PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax); -void c_plgdiplt(PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax); - /* Get FCI (font characterization integer) */ void c_plgfci(PLUNICODE *pfci); @@ -1311,25 +1483,22 @@ void c_plgfnam(char *fnam); /* Get the current font family, style and weight */ +void c_plgfont(PLINT *p_family, PLINT *p_style, PLINT *p_weight); -void c_plgfont(PLINT *p_family, PLINT *p_style, PLINT *p_weight); - /* Get the (current) run level. */ +void c_plglevel(PLINT *p_level); -void c_plglevel(PLINT *p_level); - /* Get output device parameters. */ +void c_plgpage(PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, + PLINT *p_xoff, PLINT *p_yoff); -void c_plgpage(PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, PLINT *p_xoff, PLINT *p_yoff); - /* Switches to graphics screen. */ +void c_plgra(); -void c_plgra(); - /* grid irregularly sampled data */ +void 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 c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data); - /* type of gridding algorithm for plgriddata() */ const GRID_CSA = 1; const GRID_DTLI = 2; @@ -1412,13 +1581,12 @@ void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); /* Plots a mesh representation of the function z[x][y] with contour */ +void c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel); -void c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); - /* Creates a new stream and makes it the default. */ +void c_plmkstrm(PLINT *p_strm); -void c_plmkstrm(PLINT *p_strm); - /* Prints out "text" at specified position relative to viewport */ void c_plmtex(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); @@ -1426,18 +1594,18 @@ void c_plmtex3(char *side, PLFLT disp, PLFLT pos, PLFLT just, char *text); /* Plots a 3-d representation of the function z[x][y]. */ +void c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side); -void c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side); - /* Plots a 3-d representation of the function z[x][y] with contour. */ +void c_plot3dc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel); -void c_plot3dc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); - /* Plots a 3-d representation of the function z[x][y] with contour and * y index limits. */ +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 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); - /* * definitions for the opt argument in plot3dc() and plsurf3d() * @@ -1454,16 +1622,16 @@ const FACETED=1<<7; /* draw outline for each square that makes up the surface */ const MESH=1<<8; /* draw mesh */ - /* - * valid options for plot3dc(): - * - * DRAW_SIDES, BASE_CONT, TOP_CONT (not yet), - * MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY. - * - * valid options for plsurf3d(): - * - * MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES. - */ +/* + * valid options for plot3dc(): + * + * DRAW_SIDES, BASE_CONT, TOP_CONT (not yet), + * MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY. + * + * valid options for plsurf3d(): + * + * MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES. + */ /* Set fill pattern directly. */ void c_plpat(PLINT nlin, PLINT *inc, PLINT *del); @@ -1478,9 +1646,8 @@ void c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc); /* Set the floating point precision (in number of places) in numeric labels. */ +void c_plprec(PLINT setp, PLINT prec); -void c_plprec(PLINT setp, PLINT prec); - /* Set fill pattern, using one of the predefined patterns.*/ void c_plpsty(PLINT patt); @@ -1666,42 +1833,39 @@ void c_plstripd(PLINT id); /* plots a 2d image (or a matrix too large for plshade() ) */ +void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, + PLFLT valuemin, PLFLT valuemax); -void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, PLFLT valuemin, PLFLT valuemax); - /* plots a 2d image (or a matrix too large for plshade() ) - colors automatically scaled */ +void c_plimage(PLFLT **idata, 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_plimage(PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax); - /* Set up a new line style */ void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); /* Plots the 3d surface representation of the function z[x][y]. */ +void c_plsurf3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel); -void c_plsurf3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel); - /* Plots the 3d surface representation of the function z[x][y] with y * index limits. */ +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 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); - /* Sets the edges of the viewport to the specified absolute coordinates */ +void c_plsvpa(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax); -void c_plsvpa(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax); - /* Set x axis labeling parameters */ +void c_plsxax(PLINT digmax, PLINT digits); -void c_plsxax(PLINT digmax, PLINT digits); - /* Set inferior X window */ +void plsxwin(PLINT window_id); -void plsxwin(PLINT window_id); - /* Set y axis labeling parameters */ +void c_plsyax(PLINT digmax, PLINT digits); -void c_plsyax(PLINT digmax, PLINT digits); - /* Plots array y against x for n points using Hershey symbol "code" */ void c_plsym(PLINT n, PLFLT *x, PLFLT *y, PLINT code); Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2009-06-04 15:23:16 UTC (rev 10030) +++ trunk/examples/d/CMakeLists.txt 2009-06-05 06:07:40 UTC (rev 10031) @@ -35,13 +35,16 @@ "13" "14" "15" + "16" "17" "18" "19" "23" "24" "25" + "26" "27" +# "28" "29" "30" ) Modified: trunk/examples/d/x03d.d =================================================================== --- trunk/examples/d/x03d.d 2009-06-04 15:23:16 UTC (rev 10030) +++ trunk/examples/d/x03d.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -25,6 +25,10 @@ /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); + /* Set orientation to landscape - note not all device drivers + * support this, in particular most interactive drivers do not */ + plsori(1); + /* Initialize plplot */ plinit(); @@ -52,8 +56,7 @@ pljoin(0.0, 0.0, dx, dy); /* Write labels for angle */ - string text; - text = format("%d", lrint(theta)); + string text = format("%d", lrint(theta)); PLFLT offset; if(theta<9.99) Modified: trunk/examples/d/x08d.d =================================================================== --- trunk/examples/d/x08d.d 2009-06-04 15:23:16 UTC (rev 10030) +++ trunk/examples/d/x08d.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -86,17 +86,13 @@ * Does a series of 3-d plots for a given data set, with different * viewing options in each plot. \*--------------------------------------------------------------------------*/ -int main( char[][] args ) +int main(char[][] args) { const nlevel=10; const XPTS=35; /* Data points in x */ const YPTS=46; /* Data points in y */ - PLFLT* x, y; - PLFLT** z; PLFLT xx, yy, r; - PLFLT zmin, zmax, step; - PLFLT[nlevel] clevel; bool rosen=true; PLFLT[] alt = [ 60.0, 20.0 ]; @@ -115,10 +111,12 @@ plinit(); /* Allocate data structures */ - x = cast(PLFLT*)std.c.stdlib.calloc( XPTS, PLFLT.sizeof ); - y = cast(PLFLT*)std.c.stdlib.calloc( YPTS, PLFLT.sizeof ); + PLFLT[XPTS] x; + PLFLT[YPTS] y; - plAlloc2dGrid( &z, XPTS, YPTS ); + PLFLT[][] z = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + z[i] = new PLFLT[YPTS]; for( int i=0; i<XPTS; i++) { x[i] = (cast(PLFLT)(i-(XPTS/2))/cast(PLFLT)(XPTS/2)); @@ -150,9 +148,12 @@ } } - plMinMax2dGrid( z, XPTS, YPTS, &zmax, &zmin ); - step = (zmax-zmin)/(nlevel+1); - for( size_t i=0; i<nlevel; i++ ) + PLFLT zmin, zmax; + f2mnmx(z, zmin, zmax); + + PLFLT step = (zmax-zmin)/(nlevel+1); + PLFLT[nlevel] clevel; + for(size_t i=0; i<nlevel; i++) clevel[i] = zmin+step+step*i; pllightsource( 1.,1.,1. ); @@ -179,33 +180,45 @@ case 0: /* diffuse light surface plot */ cmap1_init( 1 ); - plsurf3d( x, y, z, XPTS, YPTS, 0, null, 0 ); + plsurf3d(x, y, z, 0); break; case 1: /* magnitude colored plot */ cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR, null, 0 ); + plsurf3d(x, y, z, MAG_COLOR); break; case 2: /* magnitude colored plot with faceted squares */ cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | FACETED, null, 0 ); + plsurf3d(x, y, z, MAG_COLOR | FACETED); break; default: /* magnitude colored plot with contours */ cmap1_init( 0 ); - plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT, - cast(PLFLT*)clevel, nlevel ); + plsurf3d(x, y, z, MAG_COLOR | SURF_CONT | BASE_CONT, clevel); break; } } } - /* Clean up */ - std.c.stdlib.free( x ); - std.c.stdlib.free( y ); - plFree2dGrid( z, XPTS, YPTS ); - plend(); return 0; } + +/*--------------------------------------------------------------------------*\ + * f2mnmx + * + * Returns min & max of input 2d array. +\*--------------------------------------------------------------------------*/ +void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) +{ + fmx = f[0][0]; + fmn = fmx; + + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[i].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); + } + } +} Modified: trunk/examples/d/x11d.d =================================================================== --- trunk/examples/d/x11d.d 2009-06-04 15:23:16 UTC (rev 10030) +++ trunk/examples/d/x11d.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -18,7 +18,7 @@ GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License - along with PLplot; if not, write to the Free Software + along with PLplot; if not, write to the Free So ftware Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -62,12 +62,7 @@ char[] title[] = [ "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" ]; - PLFLT[XPTS] x; - PLFLT[YPTS] y; - PLFLT** z; PLFLT xx, yy; - PLFLT[nlevel] clevel; - PLFLT zmin, zmax, step; /* Parse and process command line arguments */ plparseopts(args, PL_PARSE_FULL); @@ -75,7 +70,13 @@ /* Initialize plplot */ plinit(); - plAlloc2dGrid( &z, XPTS, YPTS ); + PLFLT[XPTS] x; + PLFLT[YPTS] y; + + PLFLT[][] z = new PLFLT[][XPTS]; + for(int i=0; i<XPTS; i++) + z[i] = new PLFLT[YPTS]; + for( int i=0; i<XPTS; i++ ) x[i] = 3.*cast(PLFLT)(i-(XPTS/2))/cast(PLFLT)(XPTS/2); @@ -97,8 +98,11 @@ } } - plMinMax2dGrid( z, XPTS, YPTS, &zmax, &zmin ); - step = (zmax-zmin)/(nlevel+1); + PLFLT zmin, zmax; + f2mnmx(z, zmin, zmax); + + PLFLT step = (zmax-zmin)/(nlevel+1); + PLFLT[nlevel] clevel; for( size_t i=0; i<nlevel; i++ ) clevel[i] = zmin+step+step*i; @@ -118,20 +122,19 @@ switch( i ) { case 0: /* wireframe plot */ - plmesh( cast(PLFLT*)x, cast(PLFLT*)y, z, XPTS, YPTS, opt[k] ); + plmesh(x, y, z, opt[k]); break; case 1: /* magnitude colored wireframe plot */ - plmesh( cast(PLFLT*)x, cast(PLFLT*)y, z, XPTS, YPTS, opt[k] | MAG_COLOR ); + plmesh(x, y, z, opt[k] | MAG_COLOR ); break; case 2: /* magnitude colored wireframe plot with sides */ - plot3d( cast(PLFLT*)x, cast(PLFLT*)y, z, XPTS, YPTS, opt[k] | MAG_COLOR, 1 ); + plot3d(x, y, z, opt[k] | MAG_COLOR, 1 ); break; case 3: /* magnitude colored wireframe plot with base contour */ - plmeshc( cast(PLFLT*)x, cast(PLFLT*)y, z, XPTS, YPTS, opt[k] | MAG_COLOR | BASE_CONT, - cast(PLFLT*)clevel, nlevel ); + plmeshc(x, y, z, opt[k] | MAG_COLOR | BASE_CONT, clevel); break; } @@ -140,9 +143,24 @@ } } - /* Clean up */ - plFree2dGrid( z, XPTS, YPTS ); - plend(); return 0; } + +/*--------------------------------------------------------------------------*\ + * f2mnmx + * + * Returns min & max of input 2d array. +\*--------------------------------------------------------------------------*/ +void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) +{ + fmx = f[0][0]; + fmn = fmx; + + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[i].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); + } + } +} Added: trunk/examples/d/x16d.d =================================================================== --- trunk/examples/d/x16d.d (rev 0) +++ trunk/examples/d/x16d.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -0,0 +1,328 @@ +/* $Id: $ + + plshade demo, using color fill. + + Maurice LeBrun + IFS, University of Texas at Austin + 20 Mar 1994 +*/ + +import std.string; +import std.math; + +import plplot; + +/* Fundamental settings. See notes[] for more info. */ + +int ns = 20; /* Default number of shade levels */ +int nx = 35; /* Default number of data points in x */ +int ny = 46; /* Default number of data points in y */ +int exclude = 0; /* By default do not plot a page illustrating + * exclusion. API is probably going to change + * anyway, and cannot be reproduced by any + * front end other than the C one. */ + +/* Transformation function */ +PLFLT[] tr; + +extern (C) { + void mypltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void* pltr_data) + { + *tx = tr[0] * x+tr[1] * y+tr[2]; + *ty = tr[3] * x+tr[4] * y+tr[5]; + } +} + +/* Options data structure definition. */ +//~ static PLOptionTable options[] = { +//~ { + //~ "exclude", /* Turns on page showing exclusion */ + //~ NULL, + //~ NULL, + //~ &exclude, + //~ PL_OPT_BOOL, + //~ "-exclude", + //~ "Plot the \"exclusion\" page." }, +//~ { + //~ "ns", /* Number of shade levels */ + //~ NULL, + //~ NULL, + //~ &ns, + //~ PL_OPT_INT, + //~ "-ns levels", + //~ "Sets number of shade levels" }, +//~ { + //~ "nx", /* Number of data points in x */ + //~ NULL, + //~ NULL, + //~ &nx, + //~ PL_OPT_INT, + //~ "-nx xpts", + //~ "Sets number of data points in x" }, +//~ { + //~ "ny", /* Number of data points in y */ + //~ NULL, + //~ NULL, + //~ &ny, + //~ PL_OPT_INT, + //~ "-ny ypts", + //~ "Sets number of data points in y" }, +//~ { + //~ NULL, /* option */ + //~ NULL, /* handler */ + //~ NULL, /* client data */ + //~ NULL, /* address of variable to set */ + //~ 0, /* mode flag */ + //~ NULL, /* short syntax */ + //~ NULL } /* long syntax */ +//~ }; + +//~ static const char *notes[] = { +//~ "To get smoother color variation, increase ns, nx, and ny. To get faster", +//~ "response (especially on a serial link), decrease them. A decent but quick", +//~ "test results from ns around 5 and nx, ny around 25.", +//~ NULL}; + +extern (C) { + PLINT zdefined(PLFLT x, PLFLT y) + { + PLFLT z = sqrt(x*x + y*y); + + return z<0.4 || z>0.6; + } +} + + +/*--------------------------------------------------------------------------*\ + * main + * + * Does several shade plots using different coordinate mappings. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + const int PERIMETERPTS=100; + + /* Parse and process command line arguments */ + //plMergeOpts(options, "x16c options", notes); + plparseopts(args, PL_PARSE_FULL); + + /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ + plscmap0n(3); + + /* Initialize plplot */ + plinit(); + + /* Set up transformation function */ + tr = [ 2./(nx-1), 0.0, -1.0, 0.0, 2./(ny-1), -1.0 ]; + + /* Allocate data structures */ + PLFLT[][] z = new PLFLT[][nx]; + for(int i=0; i<nx; i++) + z[i] = new PLFLT[ny]; + + PLFLT[][] w = new PLFLT[][nx]; + for(int i=0; i<nx; i++) + w[i] = new PLFLT[ny]; + + /* Set up data array */ + PLFLT x, y; + for(int i=0; i<nx; i++) { + x = cast(double)(i-(nx/2))/(nx/2); + for(int j=0; j<ny; j++) { + y = cast(double)(j-(ny/2))/(ny/2) - 1.0; + + z[i][j] = -sin(7*x)*cos(7*y) + x*x - y*y; + w[i][j] = -cos(7*x)*sin(7*y) + 2*x*y; + } + } + PLFLT zmin, zmax; + f2mnmx(z, zmin, zmax); + + PLFLT[] clevel = new PLFLT[ns]; + for(int i=0; i<ns; i++) + clevel[i] = zmin + (zmax-zmin)*(i+0.5)/ns; + + PLFLT[] shedge = new PLFLT[ns+1]; + for(int i=0; i<ns+1; i++) + shedge[i] = zmin + (zmax-zmin)*i/ns; + + /* Set up coordinate grids */ + PLcGrid cgrid1; + cgrid1.xg = new PLFLT[nx]; + cgrid1.yg = new PLFLT[ny]; + + PLcGrid2 cgrid2; + cgrid2.xg = new PLFLT[][nx]; + for(int i=0; i<nx; i++) + cgrid2.xg[i] = new PLFLT[ny]; + + cgrid2.yg = new PLFLT[][nx]; + for(int i=0; i<nx; i++) + cgrid2.yg[i] = new PLFLT[ny]; + + PLFLT argx, argy, distort; + for(int i=0; i<nx; i++) { + for(int j=0; j<ny; j++) { + mypltr(i, j, &x, &y, null); + + argx = x*PI/2; + argy = y*PI/2; + distort = 0.4; + + cgrid1.xg[i] = x + distort * cos(argx); + cgrid1.yg[j] = y - distort * cos(argy); + + cgrid2.xg[i][j] = x + distort * cos(argx) * cos(argy); + cgrid2.yg[i][j] = y - distort * cos(argx) * cos(argy); + } + } + + /* Plot using identity transform */ + PLINT fill_width = 2, cont_color = 0, cont_width = 0; + + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + plpsty(0); + + plshades(z, null, -1., 1., -1., 1., shedge, fill_width, + cont_color, cont_width, 1); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + pllab("distance", "altitude", "Bogon density"); + + /* Plot using 1d coordinate transform */ + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + plpsty(0); + + plshades(z, null, -1., 1., -1., 1., shedge, fill_width, + cont_color, cont_width, 1, cgrid1); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + pllab("distance", "altitude", "Bogon density"); + + /* Plot using 2d coordinate transform */ + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + plpsty(0); + + plshades(z, null, -1., 1., -1., 1., shedge, fill_width, + cont_color, cont_width, 0, cgrid2); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + plcont(w, 1, nx, 1, ny, clevel, cgrid2); + + pllab("distance", "altitude", "Bogon density, with streamlines"); + + /* Plot using 2d coordinate transform */ + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + plpsty(0); + + plshades(z, null, -1., 1., -1., 1., shedge, fill_width, + 2, 3, 0, cgrid2); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + plcol0(2); + + pllab("distance", "altitude", "Bogon density"); + + /* Note this exclusion API will probably change. */ + + /* Plot using 2d coordinate transform and exclusion*/ + if(exclude) { + pladv(0); + plvpor(0.1, 0.9, 0.1, 0.9); + plwind(-1.0, 1.0, -1.0, 1.0); + + plpsty(0); + + plshades(z, &zdefined, -1., 1., -1., 1., shedge, fill_width, + cont_color, cont_width, 0, cgrid2); + + plcol0(1); + plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + + pllab("distance", "altitude", "Bogon density with exclusion"); + } + + /* Example with polar coordinates. */ + pladv(0); + plvpor( .1, .9, .1, .9 ); + plwind( -1., 1., -1., 1. ); + + plpsty(0); + + /* Build new coordinate matrices. */ + PLFLT r, t; + for(int i=0; i<nx; i++) { + r = cast(PLFLT)i/(nx-1); + for(int j=0; j<ny; j++) { + t = 2.*PI/(ny-1.)*j; + cgrid2.xg[i][j] = r*cos(t); + cgrid2.yg[i][j] = r*sin(t); + z[i][j] = exp(-r*r)*cos(5.*PI*r)*cos(5.*t); + } + } + + /* Need a new shedge to go along with the new data set. */ + f2mnmx(z, zmin, zmax); + + for(int i=0; i<ns+1; i++) + shedge[i] = zmin + (zmax-zmin)*i/ns; + + /* Now we can shade the interior region. */ + plshades(z, null, -1., 1., -1., 1., shedge, fill_width, + cont_color, cont_width, 0, cgrid2); + + /* Now we can draw the perimeter. (If do before, shade stuff may overlap.) */ + PLFLT[PERIMETERPTS] px, py; + for(int i=0; i<PERIMETERPTS; i++) { + t = 2.*PI/(PERIMETERPTS-1)*i; + px[i] = cos(t); + py[i] = sin(t); + } + plcol0(1); + plline(px, py); + + /* And label the plot.*/ + plcol0(2); + pllab("", "", "Tokamak Bogon Instability"); + + plend(); + + return 0; +} + +/*--------------------------------------------------------------------------*\ + * f2mnmx + * + * Returns min & max of input 2d array. +\*--------------------------------------------------------------------------*/ +void f2mnmx(PLFLT[][] f, out PLFLT fmn, out PLFLT fmx) +{ + fmx = f[0][0]; + fmn = fmx; + + for(int i=0; i<f.length; i++) { + for(int j=0; j<f[i].length; j++) { + fmx = fmax(fmx, f[i][j]); + fmn = fmin(fmn, f[i][j]); + } + } +} Property changes on: trunk/examples/d/x16d.d ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/examples/d/x26d.d =================================================================== --- trunk/examples/d/x26d.d (rev 0) +++ trunk/examples/d/x26d.d 2009-06-05 06:07:40 UTC (rev 10031) @@ -0,0 +1,182 @@ +/* -*- coding: utf-8; -*- + + $Id: $ + + Multi-lingual version of the first page of example 4. + + Copyright (C) 2009 Werner Smekal + + Thanks to the following for providing translated strings for this example: + Valery Pipin (Russian) + + This file is part of PLplot. + + PLplot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Library Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + PLplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with PLplot; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/* + This example designed just for devices (e.g., psttfc and the + cairo-related devices) that use the pango and fontconfig libraries. The + best choice of glyph is selected by fontconfig and automatically rendered + by pango in way that is sensitive to complex text layout (CTL) language + issues for each unicode character in this example. Of course, you must + have the appropriate TrueType fonts installed to have access to all the + required glyphs. + + Translation instructions: The strings to be translated are given by + x_label, y_label, alty_label, title_label, and line_label below. The + encoding used must be UTF-8. + + The following strings to be translated involve some scientific/mathematical + jargon which is now discussed further to help translators. + + (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . + (2) degrees is an angular measure, see + http://en.wikipedia.org/wiki/Degree_(angle) . + (3) low-pass filter is one that transmits (passes) low frequencies. + (4) pole is in the mathematical sense, see + http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" + means a particular mathematical transformation of the filter function has + a single pole, see + http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . + Furthermore, a single-pole filter must have an inverse square decline + (or -20 db/decade). Since the filter plotted here does have that + characteristic, it must by definition be a single-pole filter, see also + http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm + (5) decade represents a factor of 10, see + http://en.wikipedia.org/wiki/Decade_(log_scale) . +*/ + + +import std.string; +import std.math; + +import plplot; + +string[] x_label = [ + "Frequency", + "Частота", + null +]; + +string[] y_label = [ + "Amplitude (dB)", + "Амплитуда (dB)", + null +]; + +string[] alty_label = [ + "Phase shift (degrees)", + "Фазовый сдвиг (градусы)", + null +]; + +string[] title_label = [ + "Single Pole Low-Pass Filter", + "Однополюсный Низко-Частотный Фильтр", + null +]; + +string[] line_label = [ + "-20 dB/decade", + "-20 dB/десяток", + null +]; + + +/*--------------------------------------------------------------------------*\ + * main + * + * Illustration of logarithmic axes, and redefinition of window. +\*--------------------------------------------------------------------------*/ +int main(char[][] args) +{ + /* Parse and process command line arguments */ + plparseopts(args, PL_PARSE_FULL); + + /* Initialize plplot */ + plinit(); + plfont(2); + + /* Make log plots using two different styles. */ + int i=0; + while(x_label[i]) { + plot1(0, x_label[i], y_label[i], alty_label[i], title_label[i], line_label[i]); + i++; + } + + plend(); + return 0; +} + +/*--------------------------------------------------------------------------*\ + * plot1 + * + * Log-linear plot. +\*--------------------------------------------------------------------------*/ +void plot1(int type, string x_label, string y_label, string alty_label, + string title_label, string line_label) +{ + /* Set up data for log plot */ + PLFLT[101] freql, ampl, phase; + PLFLT f0=1.0, freq; + for(int i=0; i<101; i++) { + freql[i] = -2.0+i/20.0; + freq = pow(10.0, freql[i]); + ampl[i] = 20.0 * log10(1.0/sqrt(1.0+pow((freq/f0), 2.))); + phase[i] = -(180.0/PI) * atan(freq/f0); + } + + pladv(0); + + plvpor(0.15, 0.85, 0.1, 0.9); + plwind(-2.0, 3.0, -80.0, 0.0); + + /* Try different axis and labelling styles. */ + plcol0(1); + switch(type) { + case 0: + plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); + break; + case 1: + plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); + break; + } + + /* Plot ampl vs freq */ + plcol0(2); + plline(freql, ampl); + plcol0(1); + plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label); + + /* Put labels on */ + plcol0(1); + plmtex("b", 3.2, 0.5, 0.5, x_label); + plmtex("t", 2.0, 0.5, 0.5, title_label); + plcol0(2); + plmtex("l", 5.0, 0.5, 0.5, y_label); + + /* For the gridless case, put phase vs freq on same plot */ + if(type==0) { + plcol0(1); + plwind(-2.0, 3.0, -100.0, 0.0); + plbox("", 0.0, 0, "cmstv", 30.0, 3); + plcol0(3); + plline(freql, phase); + plcol0(3); + plmtex("r", 5.0, 0.5, 0.5, alty_label); + } +} Property changes on: trunk/examples/d/x26d.d ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |