From: <and...@us...> - 2009-01-26 09:25:15
|
Revision: 9390 http://plplot.svn.sourceforge.net/plplot/?rev=9390&view=rev Author: andrewross Date: 2009-01-26 09:25:06 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Properly check the return value of various functions for errors. Problems shown up via the gcc warn_unused_result attribute when compiling Debian packages. Modified Paths: -------------- trunk/bindings/octave/massage.c trunk/drivers/gd.c trunk/drivers/pbm.c trunk/examples/c/x20c.c trunk/src/plcore.c trunk/utils/pltek.c Modified: trunk/bindings/octave/massage.c =================================================================== --- trunk/bindings/octave/massage.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/bindings/octave/massage.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -44,8 +44,7 @@ exit(1); } - while (! feof(fp)){ - fgets(b, sizeof(b), fp); + while (! feof(fp) && fgets(b, sizeof(b), fp) != NULL ){ if (strchr(b, '-')) strcpy(doc[item++], b); } @@ -56,8 +55,7 @@ exit(1); } - while (! feof(fp)){ - fgets(b, sizeof(b), fp); + while (! feof(fp) && fgets(b, sizeof(b), fp) != NULL){ if ((p2 = strchr(b, '('))){ /* function ... = ...( */ p1 = p2; while(*p1-- != ' '); @@ -67,7 +65,10 @@ strncpy(tok, p1, p2-p1); *(tok+(int)(p2-p1))='\0'; printf("%s", b); - fgets(b, sizeof(b), fp); + if (fgets(b, sizeof(b), fp) == NULL) { + fprintf(stderr,"Error reading line\n"); + return 1; + } printf("%s%%\n", b); /* % function ... = ...(*/ sprintf(b,"plplot_octave_txt/%s.txt", tok); @@ -89,16 +90,24 @@ } else { printf("%% Original PLplot call documentation:\n%%\n"); fp1 = fopen(b,"r"); - while(!feof(fp1)) { - fgets(b, sizeof(b), fp1); + while(!feof(fp1) && fgets(b, sizeof(b), fp1) != NULL) { printf("%% %s", b); } fclose(fp1); } - fgets(b, sizeof(b), fp); /* % No doc...*/ - fgets(b, sizeof(b), fp); + if (fgets(b, sizeof(b), fp) == NULL) { /* % No doc...*/ + fprintf(stderr,"Error reading line\n"); + return 1; + } + if (fgets(b, sizeof(b), fp) == NULL) { + fprintf(stderr,"Error reading line\n"); + return 1; + } printf("%s", b); /* plplot_oct...*/ - fgets(b, sizeof(b), fp); + if (fgets(b, sizeof(b), fp) == NULL) { + fprintf(stderr,"Error reading line\n"); + return 1; + } printf("%s\n", b); /* endfunction*/ } } Modified: trunk/drivers/gd.c =================================================================== --- trunk/drivers/gd.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/drivers/gd.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -1305,6 +1305,7 @@ int im_size=0; int png_compression; void *im_ptr=NULL; + size_t nwrite; if (pls->family || pls->page == 1) { @@ -1348,7 +1349,9 @@ im_ptr = gdImagePngPtr(dev->im_out, &im_size); #endif if( im_ptr ) { - fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + nwrite = fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + if (nwrite != im_size) + plabort("gd driver: Error writing png file"); gdFree(im_ptr); } @@ -1528,6 +1531,7 @@ png_Dev *dev=(png_Dev *)pls->dev; int im_size=0; void *im_ptr=NULL; + size_t nwrite; if (pls->family || pls->page == 1) { /* image is written to output file by the driver @@ -1536,7 +1540,9 @@ /* gdImageJpeg(dev->im_out, pls->OutFile, pls->dev_compression); */ im_ptr = gdImageJpegPtr(dev->im_out, &im_size, pls->dev_compression); if( im_ptr ) { - fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + nwrite = fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + if (nwrite != im_size) + plabort("gd driver: Error writing png file"); gdFree(im_ptr); } @@ -1560,6 +1566,7 @@ png_Dev *dev=(png_Dev *)pls->dev; int im_size=0; void *im_ptr=NULL; + size_t nwrite; if (pls->family || pls->page == 1) { /* image is written to output file by the driver @@ -1568,7 +1575,9 @@ /* gdImageGif(dev->im_out, pls->OutFile); */ im_ptr = gdImageGifPtr(dev->im_out, &im_size); if( im_ptr ) { - fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + nwrite = fwrite(im_ptr, sizeof(char), im_size, pls->OutFile); + if (nwrite != im_size) + plabort("gd driver: Error writing png file"); gdFree(im_ptr); } Modified: trunk/drivers/pbm.c =================================================================== --- trunk/drivers/pbm.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/drivers/pbm.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -235,6 +235,7 @@ plD_eop_pbm(PLStream *pls) { FILE *fp = pls->OutFile; + size_t im_size, nwrite; if (fp != NULL) { fprintf(fp, "%s\n", "P6"); @@ -249,7 +250,10 @@ fprintf(fp, "%c", cmap[i][j][k]); } */ - fwrite( cmap, 1, pls->xlength * pls->ylength * 3, fp ); + im_size = pls->xlength*pls->ylength*3; + nwrite = fwrite( cmap, 1, im_size, fp ); + if (nwrite != im_size) + plabort("gd driver: Error writing png file"); fclose(fp); } Modified: trunk/examples/c/x20c.c =================================================================== --- trunk/examples/c/x20c.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/examples/c/x20c.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -303,25 +303,41 @@ if ((fp = fopen(fname,"rb")) == NULL) return 1; - fscanf(fp,"%s\n", ver); /* version */ + if (fscanf(fp,"%s\n", ver) != 1) { /* version */ + fclose(fp); + return 1; + } /* printf("version: %s\n", ver);*/ - if (strcmp(ver, "P5")) /* I only understand this! */ + if (strcmp(ver, "P5")) { /* I only understand this! */ + fclose(fp); return 1; + } while((i=fgetc(fp)) == '#') { - fgets(ver, 80, fp); /* comments */ + if (fgets(ver, 80, fp) == NULL) { /* comments */ + fclose(fp); + return 1; + } /* printf("%s", ver); */ } ungetc(i, fp); - fscanf(fp,"%d%d%d\n", &w, &h, num_col); /* width, height num colors */ + if (fscanf(fp,"%d%d%d\n", &w, &h, num_col) != 3) { /* width, height num colors */ + fclose(fp); + return 1; + } /* printf("width=%d height=%d num_col=%d\n", w, h, *num_col); */ img = (unsigned char *) malloc(w*h*sizeof(char)); plAlloc2dGrid(&imf, w, h); - fread(img, sizeof(char), w*h, fp); + if (fread(img, sizeof(char), w*h, fp) != w*h) { + fclose(fp); + free(img); + plFree2dGrid(imf,w,h); + return 1; + } fclose(fp); for (i=0; i<w; i++) Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/src/plcore.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -2150,7 +2150,8 @@ inBuildTree = 1; } } - chdir(currdir); + if (chdir(currdir) != 0) + pldebug("plInBuildTree():", "Unable to chdir to current directory"); } } inited = 1; Modified: trunk/utils/pltek.c =================================================================== --- trunk/utils/pltek.c 2009-01-26 09:06:30 UTC (rev 9389) +++ trunk/utils/pltek.c 2009-01-26 09:25:06 UTC (rev 9390) @@ -36,6 +36,7 @@ long start[MAXPAGES]; /* start (offset) of each page */ char buf[BUFSZ], xtra, lastchar = '\0'; char c, ibuf[128], *t; + size_t nwrite; if (argc < 2) { describe(); @@ -134,7 +135,10 @@ istop = 0; for (i = 0; i < 8196; i++) { /* less than 8MB per page! */ if (xtra) { - fwrite(&xtra, 1, 1, stdout); + if (fwrite(&xtra, 1, 1, stdout) != 1) { + fprintf(stderr,"Error writing to stdout\n"); + exit(1); + } xtra = '\0'; } nb = fread(buf, 1, BUFSZ, fd); @@ -143,7 +147,10 @@ ifirst = 0; for (j = 0; j < nb; j++) { if (buf[j] == '\f') { - fwrite(&buf[ifirst], 1, j - ifirst, stdout); + if (fwrite(&buf[ifirst], 1, j - ifirst, stdout) != j-ifirst) { + fprintf(stderr,"Error writing to stdout\n"); + exit(1); + } fflush(stdout); istop = 1; break; @@ -155,7 +162,10 @@ xtra = ESC; j--; } - fwrite(&buf[ifirst], 1, j - ifirst, stdout); + if (fwrite(&buf[ifirst], 1, j - ifirst, stdout) != j-ifirst ) { + fprintf(stderr,"Error writing to stdout\n"); + exit(1); + } } if ( termtype == xterm ) tek_mode(ALPHA_MODE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-01-30 02:38:03
|
Revision: 9416 http://plplot.svn.sourceforge.net/plplot/?rev=9416&view=rev Author: airwin Date: 2009-01-30 02:38:01 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Find, check version consistency, and use LUA_EXECUTABLE. Modified Paths: -------------- trunk/cmake/modules/lua.cmake trunk/plplot_test/test_lua.sh.in Modified: trunk/cmake/modules/lua.cmake =================================================================== --- trunk/cmake/modules/lua.cmake 2009-01-30 00:34:33 UTC (rev 9415) +++ trunk/cmake/modules/lua.cmake 2009-01-30 02:38:01 UTC (rev 9416) @@ -58,3 +58,40 @@ set(ENABLE_lua OFF CACHE BOOL "Enable LUA bindings" FORCE) endif(NOT LUA_FOUND) endif(ENABLE_lua) + +if(ENABLE_lua) + find_program(LUA_EXECUTABLE lua) + if(NOT LUA_EXECUTABLE) + message(STATUS "WARNING: " + "lua executable not found. Disabling lua bindings") + set(ENABLE_lua OFF CACHE BOOL "Enable LUA bindings" FORCE) + endif(NOT LUA_EXECUTABLE) +endif(ENABLE_lua) + +if(ENABLE_lua) + # Check whether you have found a lua executable that is consistent + # with the library version. + execute_process(COMMAND ${LUA_EXECUTABLE} -v + OUTPUT_VARIABLE LUA_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE LUA_VERSION + ERROR_STRIP_TRAILING_WHITESPACE + ) + #message("(preliminary) LUA_VERSION = ${LUA_VERSION}") + string(REGEX MATCH "[0-9]\\.[0-9]\\.[0-9]" LUA_VERSION "${LUA_VERSION}") + message(STATUS "LUA_VERSION = ${LUA_VERSION}") + set(LUA_VERSION_VALID) + if(${LUA_VERSION} VERSION_LESS "5.1.0" AND NOT HAVE_lua51) + set(LUA_VERSION_VALID ON) + endif(${LUA_VERSION} VERSION_LESS "5.1.0" AND NOT HAVE_lua51) + if(${LUA_VERSION} VERSION_GREATER "5.0.9999999" AND HAVE_lua51) + set(LUA_VERSION_VALID ON) + endif(${LUA_VERSION} VERSION_GREATER "5.0.9999999" AND HAVE_lua51) + + if(NOT LUA_VERSION_VALID) + message(STATUS "WARNING: " + "lua executable found but version not consistent with library. Disabling lua bindings") + set(ENABLE_lua OFF CACHE BOOL "Enable LUA bindings" FORCE) + endif(NOT LUA_VERSION_VALID) + +endif(ENABLE_lua) Modified: trunk/plplot_test/test_lua.sh.in =================================================================== --- trunk/plplot_test/test_lua.sh.in 2009-01-30 00:34:33 UTC (rev 9415) +++ trunk/plplot_test/test_lua.sh.in 2009-01-30 02:38:01 UTC (rev 9416) @@ -38,12 +38,12 @@ fi if [ "$index" = "14" ] ; then echo ${results}/x${index}a${lang}%n.$dsuffix | \ - lua x${index}.${lang} -dev $device -o ${results}/x${index}${lang}%n.$dsuffix \ + @LUA_EXECUTABLE@ x${index}.${lang} -dev $device -o ${results}/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| ${results}/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? else - lua x${index}.${lang} -dev $device -o ${results}/x${index}${lang}%n.$dsuffix \ + @LUA_EXECUTABLE@ x${index}.${lang} -dev $device -o ${results}/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| ${results}/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-01 01:23:40
|
Revision: 9423 http://plplot.svn.sourceforge.net/plplot/?rev=9423&view=rev Author: airwin Date: 2009-02-01 01:23:32 +0000 (Sun, 01 Feb 2009) Log Message: ----------- Unless and until something better comes along, follow the Debian convention for installation location of the Lua shared object wrapper for PLplot. Modified Paths: -------------- trunk/bindings/lua/CMakeLists.txt trunk/cmake/modules/lua.cmake trunk/examples/lua/CMakeLists.txt Modified: trunk/bindings/lua/CMakeLists.txt =================================================================== --- trunk/bindings/lua/CMakeLists.txt 2009-02-01 01:22:04 UTC (rev 9422) +++ trunk/bindings/lua/CMakeLists.txt 2009-02-01 01:23:32 UTC (rev 9423) @@ -51,13 +51,13 @@ plplotluac PROPERTIES INSTALL_RPATH "${LIB_INSTALL_RPATH}" - INSTALL_NAME_DIR "${LIB_DIR}" + INSTALL_NAME_DIR "${LUA_DIR}" ) else(USE_RPATH) set_target_properties( plplotluac PROPERTIES - INSTALL_NAME_DIR "${LIB_DIR}" + INSTALL_NAME_DIR "${LUA_DIR}" ) endif(USE_RPATH) @@ -70,6 +70,6 @@ ) endif(APPLE) -install(TARGETS plplotluac LIBRARY DESTINATION ${LIB_DIR}) +install(TARGETS plplotluac LIBRARY DESTINATION ${LUA_DIR}) endif(ENABLE_lua) Modified: trunk/cmake/modules/lua.cmake =================================================================== --- trunk/cmake/modules/lua.cmake 2009-02-01 01:22:04 UTC (rev 9422) +++ trunk/cmake/modules/lua.cmake 2009-02-01 01:23:32 UTC (rev 9423) @@ -94,4 +94,12 @@ set(ENABLE_lua OFF CACHE BOOL "Enable LUA bindings" FORCE) endif(NOT LUA_VERSION_VALID) +if(ENABLE_lua) + # Unless some better convention comes along, follow what Debian does for + # install location of Lua wrapper shared object. + if(HAVE_lua51) + set(LUA_DIR ${LIB_DIR}/lua/5.1/plplot) + else(HAVE_lua51) + set(LUA_DIR ${LIB_DIR}/lua/50/plplot) + endif(HAVE_lua51) endif(ENABLE_lua) Modified: trunk/examples/lua/CMakeLists.txt =================================================================== --- trunk/examples/lua/CMakeLists.txt 2009-02-01 01:22:04 UTC (rev 9422) +++ trunk/examples/lua/CMakeLists.txt 2009-02-01 01:23:32 UTC (rev 9423) @@ -94,7 +94,7 @@ @ONLY ) -set(lua_lib_location ${LIB_DIR}) +set(lua_lib_location ${LUA_DIR}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plplot_examples.lua.in ${CMAKE_CURRENT_BINARY_DIR}/plplot_examples.lua_install This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-02 20:26:57
|
Revision: 9434 http://plplot.svn.sourceforge.net/plplot/?rev=9434&view=rev Author: airwin Date: 2009-02-02 20:26:52 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Build-system updates for qsas time code. These changes build and install the qsastime library, makes libplplotd depend on this library (from a build-system viewpoint although there are no calls in libplplotd to this library, yet), and finally build an excutable in the build tree (but not in the install tree) that tests the new qsastime library. Modified Paths: -------------- trunk/cmake/modules/plplot_version.cmake trunk/drivers/CMakeLists.txt trunk/lib/CMakeLists.txt trunk/src/CMakeLists.txt Added Paths: ----------- trunk/lib/qsastime/CMakeLists.txt Modified: trunk/cmake/modules/plplot_version.cmake =================================================================== --- trunk/cmake/modules/plplot_version.cmake 2009-02-02 20:21:40 UTC (rev 9433) +++ trunk/cmake/modules/plplot_version.cmake 2009-02-02 20:26:52 UTC (rev 9434) @@ -33,6 +33,9 @@ set(csironn_SOVERSION 0) set(csironn_VERSION ${csironn_SOVERSION}.0.1) +set(qsastime_SOVERSION 0) +set(qsastime_VERSION ${qsastime_SOVERSION}.0.1) + set(plplot_SOVERSION 9) set(plplot_VERSION ${plplot_SOVERSION}.6.1) Modified: trunk/drivers/CMakeLists.txt =================================================================== --- trunk/drivers/CMakeLists.txt 2009-02-02 20:21:40 UTC (rev 9433) +++ trunk/drivers/CMakeLists.txt 2009-02-02 20:26:52 UTC (rev 9434) @@ -46,6 +46,7 @@ ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/lib/csa ${CMAKE_BINARY_DIR}/lib/nn + ${CMAKE_BINARY_DIR}/lib/qsastime ${libplplot${LIB_TAG}_RPATH} ) Modified: trunk/lib/CMakeLists.txt =================================================================== --- trunk/lib/CMakeLists.txt 2009-02-02 20:21:40 UTC (rev 9433) +++ trunk/lib/CMakeLists.txt 2009-02-02 20:26:52 UTC (rev 9434) @@ -1,2 +1,3 @@ add_subdirectory(csa) add_subdirectory(nn) +add_subdirectory(qsastime) Added: trunk/lib/qsastime/CMakeLists.txt =================================================================== --- trunk/lib/qsastime/CMakeLists.txt (rev 0) +++ trunk/lib/qsastime/CMakeLists.txt 2009-02-02 20:26:52 UTC (rev 9434) @@ -0,0 +1,53 @@ +# lib/qsastime/CMakeLists.txt for PLplot +### +### 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 + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ) + +set(qsastime_LIB_SRCS +MJDtime.c +MJDtime.h +) + +if(BUILD_SHARED_LIBS) + SET_SOURCE_FILES_PROPERTIES( ${qsastime_LIB_SRCS} + PROPERTIES COMPILE_FLAGS "-DUSINGDLL" + ) +endif(BUILD_SHARED_LIBS) + +add_library(qsastime ${qsastime_LIB_SRCS}) +set_target_properties( +qsastime +PROPERTIES +SOVERSION ${qsastime_SOVERSION} +VERSION ${qsastime_VERSION} +INSTALL_NAME_DIR "${LIB_DIR}" +) + +install(TARGETS qsastime +ARCHIVE DESTINATION ${LIB_DIR} +LIBRARY DESTINATION ${LIB_DIR} +RUNTIME DESTINATION ${BIN_DIR} +) + +add_executable(test_qsastime MJDtime_test.c) +target_link_libraries(test_qsastime qsastime) Property changes on: trunk/lib/qsastime/CMakeLists.txt ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-02-02 20:21:40 UTC (rev 9433) +++ trunk/src/CMakeLists.txt 2009-02-02 20:26:52 UTC (rev 9434) @@ -191,6 +191,16 @@ ) endif(HAVE_QHULL) +set( + libplplot${LIB_TAG}_LINK_LIBRARIES + ${libplplot${LIB_TAG}_LINK_LIBRARIES} + qsastime + ) +set( + libplplot${LIB_TAG}_LINK_FLAGS + "${libplplot${LIB_TAG}_LINK_FLAGS} -lqsastime" + ) + if(WITH_FREETYPE) get_source_file_property(PLFREETYPE_COMPILE_PROPS plfreetype.c COMPILE_FLAGS) # Deal with NOTFOUND case. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-02-05 20:06:46
|
Revision: 9457 http://plplot.svn.sourceforge.net/plplot/?rev=9457&view=rev Author: andrewross Date: 2009-02-05 20:06:41 +0000 (Thu, 05 Feb 2009) Log Message: ----------- Ensure example 32 is propagated to the website. Note currently C-only. Modified Paths: -------------- trunk/scripts/htdocs-gen_plot-examples.sh trunk/www/examples.php Modified: trunk/scripts/htdocs-gen_plot-examples.sh =================================================================== --- trunk/scripts/htdocs-gen_plot-examples.sh 2009-02-05 15:38:44 UTC (rev 9456) +++ trunk/scripts/htdocs-gen_plot-examples.sh 2009-02-05 20:06:41 UTC (rev 9457) @@ -82,7 +82,7 @@ $CP examples/c/lena.pgm . for exe in 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; do + 23 24 25 26 27 28 29 30 31 32; do if [ $exe = "08" -o $exe = "16" -o $exe = "20" -o $exe = "30" ] ; then # The default cairo graphics AA looks good for these examples now Modified: trunk/www/examples.php =================================================================== --- trunk/www/examples.php 2009-02-05 15:38:44 UTC (rev 9456) +++ trunk/www/examples.php 2009-02-05 20:06:41 UTC (rev 9457) @@ -102,6 +102,8 @@ \n"), array(31, 1, 1, " <p>Diagnostic demo to exercise all our set/get functions. The result should be a properly-formatted empty plot with black background.</p> + array(32, 1, 1, " + <p>Demo of how to draw box-whisker / candlestick plots using plplot. These are commonly used for financial data.</p> \n")); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-06 19:36:07
|
Revision: 9465 http://plplot.svn.sourceforge.net/plplot/?rev=9465&view=rev Author: airwin Date: 2009-02-06 19:36:00 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Interpretation of the month argument changed from 1-12 to 0-11 for setFromUT, breakDownMJD, and for some corresponding qsastime_extra.c functions. This change makes our month index convention consistent with the C library's convention for tm->tm_month (see K&R page 255) where 0 corresponds to January, and 11 corresponds to December and should be much less confusing for those who are used to the C library convention which probably originated in the idea that the month index was going to be used as the index of arrays whose starting index was 0. Note, in contrast, the C library time formatting function, strftime, has a month format %m which returns 01-12 for the results (see K&R page 257) which is the understood human convention for specifying month indexes. The corresponding %m field in strfMJD of libqsastime continues to follow that same human convention. I still get the same result for qsastime_test and example 29, but that test is fairly superficial and the implementation of the changed month convention affects a fair number of lines of code. Thus, planned detailed testing of setFromUT, breakDownMJD, and strfMJD against the closest Linux library functions is essential to increase confidence that this convention change introduced no bugs. Modified Paths: -------------- trunk/lib/qsastime/qsastime.c trunk/lib/qsastime/qsastime_extra.c trunk/lib/qsastime/qsastime_test.c trunk/src/plbox.c Modified: trunk/lib/qsastime/qsastime.c =================================================================== --- trunk/lib/qsastime/qsastime.c 2009-02-06 05:14:29 UTC (rev 9464) +++ trunk/lib/qsastime/qsastime.c 2009-02-06 19:36:00 UTC (rev 9465) @@ -58,7 +58,7 @@ double dbase_day, time_sec, dextraDays; int extraDays; - if(month < 1 || month > 12) + if(month < 0 || month > 11) return 1; if(year <= 0) { @@ -75,21 +75,21 @@ stores the expected exact integer results of the calculation with exact representation unless the result is much larger than the integer overflow limit. */ - dbase_day = year * 365. + leaps + MonthStartDOY_L[month-1] + day - 678943; + dbase_day = year * 365. + leaps + MonthStartDOY_L[month] + day - 678943; else - dbase_day = year * 365. + leaps + MonthStartDOY[month-1] + day - 678943; + dbase_day = year * 365. + leaps + MonthStartDOY[month] + day - 678943; } - else if(year < 1582 || (year == 1582 && month < 10) || (year == 1582 && month == 10 && day < 15) || forceJulian) + else if(year < 1582 || (year == 1582 && month < 9) || (year == 1582 && month == 9 && day < 15) || forceJulian) { /* count leap years on Julian Calendar */ /* MJD for Jan 1 0000 (correctly Jan 01, BCE 1) is - 678943, count from there */ leaps = (year -1 ) / 4; if(year%4 == 0) - dbase_day = year * 365. + leaps + MonthStartDOY_L[month-1] + day - 678943; + dbase_day = year * 365. + leaps + MonthStartDOY_L[month] + day - 678943; else - dbase_day = year * 365. + leaps + MonthStartDOY[month-1] + day - 678943; + dbase_day = year * 365. + leaps + MonthStartDOY[month] + day - 678943; } else { @@ -100,9 +100,9 @@ lastyear = year - 1; leaps = lastyear / 4 - lastyear / 100 + lastyear / 400; if( (year%4 == 0 && year%100 != 0) || (year%4 == 0 && year%400 == 0) ) - dbase_day = year * 365. + leaps + MonthStartDOY_L[month-1] + day - 678941; + dbase_day = year * 365. + leaps + MonthStartDOY_L[month] + day - 678941; else - dbase_day = year * 365. + leaps + MonthStartDOY[month-1] + day - 678941; + dbase_day = year * 365. + leaps + MonthStartDOY[month] + day - 678941; } @@ -150,13 +150,13 @@ const char * getMonth( int m) { static char *months = {"Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec"}; - return &(months[(m-1)*4]); + return &(months[(m)*4]); } const char * getLongMonth( int m) { static char *months = {"January\0\0\0February\0\0March\0\0\0\0\0April\0\0\0\0\0May\0\0\0\0\0\0\0June\0\0\0\0\0\0July\0\0\0\0\0\0August\0\0\0\0September\0October\0\0\0November\0\0December"}; - return &(months[(m-1)*10]); + return &(months[(m)*10]); } @@ -264,27 +264,27 @@ } /* j is now always positive */ - *month = 0; + *month = -1; if(*year%4 != 0) { - while(j > MonthStartDOY[*month]) + while(j > MonthStartDOY[*month +1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY[*month -1]; + *day = j - MonthStartDOY[*month]; } else { /* put this year's leap day back as it is done here */ j++; - while(j > MonthStartDOY_L[*month]) + while(j > MonthStartDOY_L[*month +1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY_L[*month -1]; + *day = j - MonthStartDOY_L[*month]; } } else if( j < -100840 || forceJulian == 1) @@ -296,26 +296,26 @@ j = j - (int)(*year * 365.25); - *month = 0; + *month = -1; if(*year%4 != 0) { - while(j > MonthStartDOY[*month]) + while(j > MonthStartDOY[*month +1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY[*month -1]; + *day = j - MonthStartDOY[*month]; } else { /* put leap day back for this year as done here */ j++; - while(j > MonthStartDOY_L[*month]) + while(j > MonthStartDOY_L[*month + 1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY_L[*month -1]; + *day = j - MonthStartDOY_L[*month]; } } else @@ -327,24 +327,24 @@ lastyear = *year - 1; j = j - *year * 365 - lastyear / 4 + lastyear / 100 - lastyear / 400; - *month = 0; + *month = -1; if((*year%4 == 0 && *year%100 != 0) || (*year%4 == 0 && *year%400 == 0) ) { - while(j > MonthStartDOY_L[*month]) + while(j > MonthStartDOY_L[*month +1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY_L[*month -1]; + *day = j - MonthStartDOY_L[*month]; } else { - while(j > MonthStartDOY[*month]) + while(j > MonthStartDOY[*month +1]) { (*month)++; - if(*month == 12) break; + if(*month == 11) break; } - *day = j - MonthStartDOY[*month -1]; + *day = j - MonthStartDOY[*month]; } } @@ -481,9 +481,9 @@ /* month/day/year */ int y = year %100; if(ysign == 0) - sprintf(DateTime, "%02d/%02d/%02d", month, day, y ); + sprintf(DateTime, "%02d/%02d/%02d", month+1, day, y ); else - sprintf(DateTime, "%02d/%02d/-%02d", month, day, y ); + sprintf(DateTime, "%02d/%02d/-%02d", month+1, day, y ); strncat(&(buf[posn]), DateTime, last - posn); posn = strlen(buf); @@ -505,9 +505,9 @@ { /* year-month-day */ if(ysign == 0) - sprintf(DateTime, "%04d-%02d-%02d", year, month, day ); + sprintf(DateTime, "%04d-%02d-%02d", year, month+1, day ); else - sprintf(DateTime, "-%04d-%02d-%02d", year, month, day ); + sprintf(DateTime, "-%04d-%02d-%02d", year, month+1, day ); strncat(&(buf[posn]), DateTime, last - posn); posn = strlen(buf); @@ -571,7 +571,7 @@ else if(next == 'm') { /* month (01 - 12) */ - sprintf(DateTime, "%02d", month); + sprintf(DateTime, "%02d", month+1); strncat(&(buf[posn]), DateTime, last - posn); posn = strlen(buf); @@ -802,7 +802,7 @@ else if(next == 'Z') { /* time zone and calendar, alwaus UTC */ - if(year < 1582 || (year == 1582 && month < 10) || (year == 1582 && month == 10 && day < 15) || forceJulian == 1) + if(year < 1582 || (year == 1582 && month < 9) || (year == 1582 && month == 9 && day < 15) || forceJulian == 1) strncat(&(buf[posn]), "UTC Julian", last - posn); else strncat(&(buf[posn]), "UTC Gregorian", last - posn); Modified: trunk/lib/qsastime/qsastime_extra.c =================================================================== --- trunk/lib/qsastime/qsastime_extra.c 2009-02-06 05:14:29 UTC (rev 9464) +++ trunk/lib/qsastime/qsastime_extra.c 2009-02-06 19:36:00 UTC (rev 9465) @@ -75,7 +75,7 @@ if(startAt > len) return 1; seconds = strtod(&(ISOstring[startAt]), NULL); - setFromUT(y, m, d, h, min, seconds, MJD, 0); + setFromUT(y, m-1, d, h, min, seconds, MJD, 0); return 0; } @@ -245,9 +245,9 @@ if(delim == 1) { if(ysign == 0) - sprintf(DateTime, "%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m, d, hour, min, sec1, sec ); + sprintf(DateTime, "%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m+1, d, hour, min, sec1, sec ); else - sprintf(DateTime, "-%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m, d, hour, min, sec1, sec ); + sprintf(DateTime, "-%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m+1, d, hour, min, sec1, sec ); /* remove trailing white space */ while( ( ptr = strrchr(&(DateTime[0]), ' ')) != NULL) ptr[0] ='\0'; @@ -256,9 +256,9 @@ else { if(ysign == 0) - sprintf(DateTime, "%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m, d, hour, min, sec1, sec ); + sprintf(DateTime, "%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m+1, d, hour, min, sec1, sec ); else - sprintf(DateTime, "-%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m, d, hour, min, sec1, sec ); + sprintf(DateTime, "-%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m+1, d, hour, min, sec1, sec ); /* remove trailing white space */ slen = strlen(DateTime)-1; Modified: trunk/lib/qsastime/qsastime_test.c =================================================================== --- trunk/lib/qsastime/qsastime_test.c 2009-02-06 05:14:29 UTC (rev 9464) +++ trunk/lib/qsastime/qsastime_test.c 2009-02-06 19:36:00 UTC (rev 9465) @@ -34,7 +34,7 @@ char buf[360]; char copy[360]; int y = 2004; - int m = 1; + int m = 0; int d = 23; int hour = 13; int min =39; @@ -52,12 +52,12 @@ MJDtime MJD2; - printf("Start date/time components: %d-%d-%d %d:%d:%13.11g\n", y, m, d, hour, min, sec); + printf("Start date/time components: %d-%d-%d %d:%d:%13.11g\n", y, m+1, d, hour, min, sec); setFromUT(y, m, d, hour, min, sec, &MJD2, 0); breakDownMJD(&y,&m,&d,&hour,&min,&sec, &MJD2, 0); - printf("date/time components: %d-%d-%d %d:%d:%13.11g\n\n", y, m, d, hour, min, sec ); + printf("date/time components: %d-%d-%d %d:%d:%13.11g\n\n", y, m+1, d, hour, min, sec ); printf("MJD = %d, seconds = %17.15g\n", MJD2.base_day, MJD2.time_sec); printf( " MJD = %18.10f \n", getMJD(&MJD2)); @@ -101,7 +101,7 @@ /* try julian/gregorian changeover */ y = 1752; - m = 9; + m = 8; d = 15; hour = 0; @@ -122,7 +122,7 @@ localt = (int)MJD2.time_sec + (MJD2.base_day - 40587) * 86400; ptm = gmtime(&localt); #ifndef _MSC_VER - /* note %s not implement in cygwin 1.5 gcc 3.x nothing printed */ + /* note %s not implemented in cygwin 1.5 gcc 3.x nothing printed */ strftime(&(buf[0]), 360, " strftime(): (invalid before 1970)\n ------\n '%a %b %e %H:%M:%S UTC %Y' \n %c\n %D %F \n %j \n %r \n %s \n %e-%b-%Y", ptm); #else Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2009-02-06 05:14:29 UTC (rev 9464) +++ trunk/src/plbox.c 2009-02-06 19:36:00 UTC (rev 9465) @@ -1248,7 +1248,7 @@ for (tn = tp; BETW(tn, vpwxmi, vpwxma); tn += xtick1) { if (ldx) { t = (double) tn; - setFromUT(1970,1,1,0,0,t,&tm,0); + setFromUT(1970,0,1,0,0,t,&tm,0); strfMJD(string, 40, timefmt, &tm, 0); } else { @@ -1297,7 +1297,7 @@ for (tn = tp; BETW(tn, vpwymi, vpwyma); tn += ytick1) { if (ldy) { t = (double) tn; - setFromUT(1970,1,1,0,0,t,&tm,0); + setFromUT(1970,0,1,0,0,t,&tm,0); strfMJD(string, 40, timefmt, &tm, 0); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2009-02-07 13:54:49
|
Revision: 9469 http://plplot.svn.sourceforge.net/plplot/?rev=9469&view=rev Author: arjenmarkus Date: 2009-02-07 13:54:45 +0000 (Sat, 07 Feb 2009) Log Message: ----------- Added DEC$ATTRIBUTES compiler directives to access the COMMON block "PLPLOT" under CVF (and Intel Fortran) under Windows. The COMMON block must be explicitly exported and imported and this is the way to do it. Modified Paths: -------------- trunk/bindings/f77/sfstubs.fm4 trunk/examples/f77/x09f.fm4 trunk/examples/f77/x14f.fm4 Modified: trunk/bindings/f77/sfstubs.fm4 =================================================================== --- trunk/bindings/f77/sfstubs.fm4 2009-02-07 04:39:01 UTC (rev 9468) +++ trunk/bindings/f77/sfstubs.fm4 2009-02-07 13:54:45 UTC (rev 9469) @@ -238,6 +238,8 @@ integer nx, ny, kx, lx, ky, ly, nlevel real*8 z(nx, ny), clevel(nlevel) real*8 tr(6) + +!DEC$ ATTRIBUTES DLLEXPORT :: PLPLOT common /plplot/ tr call plcont7(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,tr) Modified: trunk/examples/f77/x09f.fm4 =================================================================== --- trunk/examples/f77/x09f.fm4 2009-02-07 04:39:01 UTC (rev 9468) +++ trunk/examples/f77/x09f.fm4 2009-02-07 13:54:45 UTC (rev 9469) @@ -34,6 +34,7 @@ & xg2(xdim, ydim), yg2(xdim, ydim) real*8 tr, xx, yy, argx, argy, distort +CDEC$ ATTRIBUTES DLLIMPORT :: PLPLOT common /plplot/ tr(6) data clevel /-1.d0, -0.8d0, -0.6d0, -0.4d0, -0.2d0, Modified: trunk/examples/f77/x14f.fm4 =================================================================== --- trunk/examples/f77/x14f.fm4 2009-02-07 04:39:01 UTC (rev 9468) +++ trunk/examples/f77/x14f.fm4 2009-02-07 13:54:45 UTC (rev 9469) @@ -59,7 +59,7 @@ write(6,'(3A)') 'Demo of multiple output streams via the ', & driver(:lnblnk(driver)), ' driver.' - write(6,'(A)') 'Running with the second stream as slave '// + write(6,'(A)') 'Running with the second stream as slave '// & 'to the first.' write(6,*) C flush unit 6 so this part of stdout is guaranteed to be written prior @@ -407,6 +407,7 @@ & xg2(xdim, ydim), yg2(xdim, ydim) real*8 tr, xx, yy, argx, argy, distort +!DEC$ ATTRIBUTES DLLIMPORT :: PLPLOT common /plplot/ tr(6) data clevel /-1.d0, -0.8d0, -0.6d0, -0.4d0, -0.2d0, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Alan W. I. <ir...@be...> - 2009-02-07 16:24:15
|
On 2009-02-07 13:54-0000 arj...@us... wrote: > Revision: 9469 > http://plplot.svn.sourceforge.net/plplot/?rev=9469&view=rev > Author: arjenmarkus > Date: 2009-02-07 13:54:45 +0000 (Sat, 07 Feb 2009) > > Log Message: > ----------- > Added DEC$ATTRIBUTES compiler directives to access the COMMON block "PLPLOT" under CVF (and Intel Fortran) under Windows. The COMMON block must be explicitly exported and imported and this is the way to do it. > > Modified Paths: > -------------- > trunk/bindings/f77/sfstubs.fm4 > trunk/examples/f77/x09f.fm4 > trunk/examples/f77/x14f.fm4 Hi Arjen: >From the way you have implemented this, I assume this compiler directive is commented out so that no compilers will pay attention to this other than the relevant ones? I noticed one directive line was started with CDEC$ and the others with !DEC$. Is their some significance to that change in commenting out symbol? Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |
From: Arjen M. <arj...@de...> - 2009-02-09 07:59:46
|
Hi Alan, you're right. No, there is no difference. The exclamation mark should have been a C, as it should be an acceptable for any FORTRAN 77 compiler (even and especially any strict F77 compiler). I think it is okay to use lower-case, so that these lines are less obtrusive, but I have not tried yet. Regards, Arjen Delft Hydraulics, GeoDelft, the Subsurface and Groundwater unit of TNO and parts of Rijkswaterstaat have joined forces in a new independent institute for delta technology, Deltares. Deltares combines knowledge and experience in the field of water, soil and the subsurface. We provide innovative solutions to make living in deltas, coastal areas and river basins safe, clean and sustainable. DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. |
From: Arjen M. <arj...@de...> - 2009-02-09 08:02:39
|
Hi Alan, these compiler directives are indeed regarded as comments by any compiler other than the one that uses "DEC$" as an indicator. With OpenMP you will find directives like: COMP$ do parallel Such directives are only used when the appropriate compile option is given, otherwise they are merely comments. I should probably add a comment as to their use. Regards, Arjen Delft Hydraulics, GeoDelft, the Subsurface and Groundwater unit of TNO and parts of Rijkswaterstaat have joined forces in a new independent institute for delta technology, Deltares. Deltares combines knowledge and experience in the field of water, soil and the subsurface. We provide innovative solutions to make living in deltas, coastal areas and river basins safe, clean and sustainable. DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. |
From: <and...@us...> - 2009-02-08 22:05:59
|
Revision: 9475 http://plplot.svn.sourceforge.net/plplot/?rev=9475&view=rev Author: andrewross Date: 2009-02-08 22:05:56 +0000 (Sun, 08 Feb 2009) Log Message: ----------- Use #define's to set the size of various char buffers to ensure that the values used to define the buffers are the same as those used in calls to snprintf. Modified Paths: -------------- trunk/drivers/cairo.c trunk/drivers/get-drv-info.c trunk/drivers/gnome.c trunk/drivers/plmeta.c trunk/drivers/ps.c trunk/drivers/psttf.cc trunk/drivers/tk.c trunk/drivers/xwin.c trunk/include/plplotP.h trunk/src/plbox.c trunk/src/plcont.c trunk/src/plcore.c trunk/src/plctrl.c trunk/src/plfreetype.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/cairo.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -157,8 +157,11 @@ "PLPLOT_FREETYPE_SYMBOL_FAMILY" }; -char familyLookup[NPANGOLOOKUP][1024]; +#define FAMILY_LOOKUP_LEN 1024 +char familyLookup[NPANGOLOOKUP][FAMILY_LOOKUP_LEN]; +#define TAG_LEN 200 + const char *weightLookup[2] = { "normal", "bold" @@ -566,20 +569,20 @@ { int i; unsigned char fontFamily, fontStyle, fontWeight; - char openTag[200]; + char openTag[TAG_LEN]; /* Generate the font info for the open tag & concatenate this onto the markup string. */ plP_fci2hex(fci, &fontFamily, PL_FCI_FAMILY); plP_fci2hex(fci, &fontStyle, PL_FCI_STYLE); plP_fci2hex(fci, &fontWeight, PL_FCI_WEIGHT); - snprintf(openTag, 200, "<span font_desc=\"%s %.2f\" ", familyLookup[fontFamily], fontSize); + snprintf(openTag, TAG_LEN, "<span font_desc=\"%s %.2f\" ", familyLookup[fontFamily], fontSize); strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); - snprintf(openTag, 200, "style=\"%s\" ", styleLookup[fontStyle]); + snprintf(openTag, TAG_LEN, "style=\"%s\" ", styleLookup[fontStyle]); strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); - snprintf(openTag, 200, "weight=\"%s\">", weightLookup[fontWeight]); + snprintf(openTag, TAG_LEN, "weight=\"%s\">", weightLookup[fontWeight]); strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); /* Move to the right sub/super-script level */ @@ -686,10 +689,10 @@ This was copied from the psttf driver. */ for(i=0;i<NPANGOLOOKUP;i++){ if((a = getenv(envFamilyLookup[i])) != NULL){ - strncpy(familyLookup[i],a,1024); + strncpy(familyLookup[i],a,FAMILY_LOOKUP_LEN); } else { - strncpy(familyLookup[i],defaultFamilyLookup[i],1024); + strncpy(familyLookup[i],defaultFamilyLookup[i],FAMILY_LOOKUP_LEN); } } Modified: trunk/drivers/get-drv-info.c =================================================================== --- trunk/drivers/get-drv-info.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/get-drv-info.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -31,6 +31,9 @@ #include <signal.h> #include <stdlib.h> +#define SYM_LEN 300 +#define DRVSPEC_LEN 400 + /* SEGV signal handler */ RETSIGTYPE catch_segv (int sig) @@ -43,9 +46,9 @@ main (int argc, char* argv[]) { lt_dlhandle dlhand; - char sym[300]; + char sym[SYM_LEN]; char* drvnam = argv[1]; - char drvspec[ 400 ]; + char drvspec[ DRVSPEC_LEN ]; char** info; /* Establish a handler for SIGSEGV signals. */ @@ -53,9 +56,9 @@ lt_dlinit (); #ifdef LTDL_WIN32 - snprintf( drvspec, 400, "%s", drvnam ); + snprintf( drvspec, DRVSPEC_LEN, "%s", drvnam ); #else - snprintf( drvspec, 400, "%s/%s", plGetDrvDir (), drvnam ); + snprintf( drvspec, DRVSPEC_LEN, "%s/%s", plGetDrvDir (), drvnam ); #endif /* LTDL_WIN32 */ dlhand = lt_dlopenext (drvspec); if (dlhand == NULL) { @@ -63,7 +66,7 @@ "libltdl error: %s\n", drvspec, lt_dlerror ()); return 1; } - snprintf (sym, 300, "plD_DEVICE_INFO_%s", drvnam); + snprintf (sym, SYM_LEN, "plD_DEVICE_INFO_%s", drvnam); info = (char **) lt_dlsym (dlhand, sym); if (info != NULL) { printf ("%s", *info); Modified: trunk/drivers/gnome.c =================================================================== --- trunk/drivers/gnome.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/gnome.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -67,6 +67,8 @@ /* Magnification factor for the PLplot physical dimensions */ #define MAG_FACTOR 10 +#define BUFFER_LEN 128 + #ifndef ABS #define ABS(x) ((x < 0) ? (-(x)) : (x)) #endif @@ -248,7 +250,7 @@ static guint dragging; guint move; GdkCursor *cursor; - char buffer[128]; + char buffer[BUFFER_LEN]; PLGraphicsIn* gin = &(page->gin); ItemColor* color; GnomeCanvasItem* item_at_cursor; @@ -345,10 +347,10 @@ buffer[0] = '\0'; else if (color->cmap == 0) - snprintf (buffer, 128, " x = %f y = %f color = %d (cmap0)", + snprintf (buffer, BUFFER_LEN, " x = %f y = %f color = %d (cmap0)", gin->wX, gin->wY, (int) color->color); else - snprintf (buffer, 128, " x = %f y = %f color = %f (cmap1)", + snprintf (buffer, BUFFER_LEN, " x = %f y = %f color = %f (cmap1)", gin->wX, gin->wY, color->color); /*// FIXME : Terrible global variable hack*/ @@ -540,7 +542,7 @@ GnomeCanvasPoints* points; guint np; guint32 loclinecolor; - char buffer[32]; + char buffer[BUFFER_LEN]; dev = pls->dev; page = g_malloc (sizeof (GnomePLdevPage)); @@ -700,7 +702,7 @@ gtk_notebook_set_show_tabs (dev->notebook, (np > 0)); - snprintf (buffer, 32, "Page %d", np+1); + snprintf (buffer, BUFFER_LEN, "Page %d", np+1); gtk_notebook_append_page (dev->notebook, GTK_WIDGET (page->sw), gtk_label_new (buffer)); Modified: trunk/drivers/plmeta.c =================================================================== --- trunk/drivers/plmeta.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/plmeta.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -67,7 +67,8 @@ /* Used for constructing error messages */ -static char buffer[256]; +#define BUFFER_LEN 256 +static char buffer[BUFFER_LEN]; /* Function prototypes */ @@ -410,7 +411,7 @@ /* The forward byte offset is located exactly 7 bytes after the BOP */ fwbyte_offset = dev->lp_offset + 7; if (pl_fsetpos(file, &fwbyte_offset)) { - snprintf(buffer, 256, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", + snprintf(buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", (int) fwbyte_offset); plexit(buffer); } @@ -435,7 +436,7 @@ #ifdef DEBUG if (pl_fsetpos(file, &fwbyte_offset)) { - snprintf(buffer, 256, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", + snprintf(buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", (int) fwbyte_offset); plexit(buffer); } @@ -450,7 +451,7 @@ /* Return to current page offset */ if (pl_fsetpos(file, &cp_offset)) { - snprintf(buffer, 256, "UpdatePrevPagehdr (plmeta.c): fsetpos to cp_offset (%d) failed", + snprintf(buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to cp_offset (%d) failed", (int) cp_offset); plexit(buffer); } @@ -478,7 +479,7 @@ (int) cp_offset, (int) dev->lp_offset); if (pl_fsetpos(file, &dev->index_offset)) { - snprintf(buffer, 256, "UpdateIndex (plmeta.c): fsetpos to index_offset (%d) failed", + snprintf(buffer, BUFFER_LEN, "UpdateIndex (plmeta.c): fsetpos to index_offset (%d) failed", (int) dev->index_offset); plexit(buffer); } @@ -490,7 +491,7 @@ (int) dev->lp_offset, (int) cp_offset); if (pl_fsetpos(file, &cp_offset)) { - snprintf(buffer, 256, "UpdateIndex (plmeta.c): fsetpos to cp_offset (%d) failed", + snprintf(buffer, BUFFER_LEN, "UpdateIndex (plmeta.c): fsetpos to cp_offset (%d) failed", (int) cp_offset); plexit(buffer); } Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/ps.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -65,7 +65,8 @@ static void proc_str (PLStream *, EscText *); static void esc_purge (unsigned char *, unsigned char *); -static char outbuf[128]; +#define OUTBUF_LEN 128 +static char outbuf[OUTBUF_LEN]; static int text = 1; static int color; static int hrshsym = 1; @@ -408,7 +409,7 @@ else putc(' ', OF); - snprintf(outbuf, 128, "%d %d D", x2, y2); + snprintf(outbuf, OUTBUF_LEN, "%d %d D", x2, y2); dev->ptcnt++; pls->linepos += 12; } @@ -417,9 +418,9 @@ pls->linepos = 0; if (x1 == x2 && y1 == y2) /* must be a single dot, draw a circle */ - snprintf(outbuf, 128, "%d %d A", x1, y1); + snprintf(outbuf, OUTBUF_LEN, "%d %d A", x1, y1); else - snprintf(outbuf, 128, "%d %d M %d %d D", x1, y1, x2, y2); + snprintf(outbuf, OUTBUF_LEN, "%d %d M %d %d D", x1, y1, x2, y2); dev->llx = MIN(dev->llx, x1); dev->lly = MIN(dev->lly, y1); dev->urx = MAX(dev->urx, x1); @@ -657,7 +658,7 @@ /* First time through start with a x y moveto */ if (n == 0) { - snprintf(outbuf, 128, "N %d %d M", x, y); + snprintf(outbuf, OUTBUF_LEN, "N %d %d M", x, y); dev->llx = MIN(dev->llx, x); dev->lly = MIN(dev->lly, y); dev->urx = MAX(dev->urx, x); @@ -676,7 +677,7 @@ pls->bytecnt++; - snprintf(outbuf, 128, "%d %d D", x, y); + snprintf(outbuf, OUTBUF_LEN, "%d %d D", x, y); dev->llx = MIN(dev->llx, x); dev->lly = MIN(dev->lly, y); dev->urx = MAX(dev->urx, x); Modified: trunk/drivers/psttf.cc =================================================================== --- trunk/drivers/psttf.cc 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/psttf.cc 2009-02-08 22:05:56 UTC (rev 9475) @@ -72,7 +72,8 @@ static void proc_str (PLStream *, EscText *); static void esc_purge (char *, char *); -static char outbuf[128]; +#define OUTBUF_LEN 128 +static char outbuf[OUTBUF_LEN]; static int text = 1; static int color; static int hrshsym = 0; @@ -97,7 +98,8 @@ "PLPLOT_FREETYPE_SYMBOL_FAMILY" }; -char FamilyLookup[N_Pango_Lookup][1024]; +#define FAMILY_LOOKUP_LEN 1024 +char FamilyLookup[N_Pango_Lookup][FAMILY_LOOKUP_LEN]; const FontWeight WeightLookup[2] = { NORMAL_WEIGHT, @@ -283,10 +285,10 @@ // or defaults. for (i=0;i<N_Pango_Lookup;i++) { if ( (a = getenv(EnvFamilyLookup[i])) != NULL ) { - strncpy(FamilyLookup[i],a,1024); + strncpy(FamilyLookup[i],a,FAMILY_LOOKUP_LEN); } else { - strncpy(FamilyLookup[i],DefaultFamilyLookup[i],1024); + strncpy(FamilyLookup[i],DefaultFamilyLookup[i],FAMILY_LOOKUP_LEN); } } @@ -471,7 +473,7 @@ else doc->osBody() << ' '; - snprintf(outbuf, 128, "%d %d D", x2, y2); + snprintf(outbuf, OUTBUF_LEN, "%d %d D", x2, y2); dev->ptcnt++; pls->linepos += 12; } @@ -480,9 +482,9 @@ pls->linepos = 0; if (x1 == x2 && y1 == y2) /* must be a single dot, draw a circle */ - snprintf(outbuf, 128, "%d %d A", x1, y1); + snprintf(outbuf, OUTBUF_LEN, "%d %d A", x1, y1); else - snprintf(outbuf, 128, "%d %d M %d %d D", x1, y1, x2, y2); + snprintf(outbuf, OUTBUF_LEN, "%d %d M %d %d D", x1, y1, x2, y2); dev->llx = MIN(dev->llx, x1); dev->lly = MIN(dev->lly, y1); dev->urx = MAX(dev->urx, x1); @@ -734,7 +736,7 @@ /* First time through start with a x y moveto */ if (n == 0) { - snprintf(outbuf, 128, "N %d %d M", x, y); + snprintf(outbuf, OUTBUF_LEN, "N %d %d M", x, y); dev->llx = MIN(dev->llx, x); dev->lly = MIN(dev->lly, y); dev->urx = MAX(dev->urx, x); @@ -753,7 +755,7 @@ pls->bytecnt++; - snprintf(outbuf, 128, "%d %d D", x, y); + snprintf(outbuf, OUTBUF_LEN, "%d %d D", x, y); dev->llx = MIN(dev->llx, x); dev->lly = MIN(dev->lly, y); dev->urx = MAX(dev->urx, x); Modified: trunk/drivers/tk.c =================================================================== --- trunk/drivers/tk.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/tk.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -79,6 +79,9 @@ #define LOCATE_INVOKED_VIA_API 1 #define LOCATE_INVOKED_VIA_DRIVER 2 +#define STR_LEN 10 +#define CMD_LEN 100 + /* A handy command wrapper */ #define tk_wr(code) \ @@ -641,7 +644,7 @@ tk_di(PLStream *pls) { TkDev *dev = (TkDev *) pls->dev; - char str[10]; + char str[STR_LEN]; dbug_enter("tk_di"); @@ -659,7 +662,7 @@ /* Change orientation */ if (pls->difilt & PLDI_ORI) { - snprintf(str, 10, "%f", pls->diorot); + snprintf(str, STR_LEN, "%f", pls->diorot); Tcl_SetVar(dev->interp, "rot", str, 0); server_cmd( pls, "$plwidget cmd plsetopt -ori $rot", 1 ); @@ -669,13 +672,13 @@ /* Change window into plot space */ if (pls->difilt & PLDI_PLT) { - snprintf(str, 10, "%f", pls->dipxmin); + snprintf(str, STR_LEN, "%f", pls->dipxmin); Tcl_SetVar(dev->interp, "xl", str, 0); - snprintf(str, 10, "%f", pls->dipymin); + snprintf(str, STR_LEN, "%f", pls->dipymin); Tcl_SetVar(dev->interp, "yl", str, 0); - snprintf(str, 10, "%f", pls->dipxmax); + snprintf(str, STR_LEN, "%f", pls->dipxmax); Tcl_SetVar(dev->interp, "xr", str, 0); - snprintf(str, 10, "%f", pls->dipymax); + snprintf(str, STR_LEN, "%f", pls->dipymax); Tcl_SetVar(dev->interp, "yr", str, 0); server_cmd( pls, "$plwidget cmd plsetopt -wplt $xl,$yl,$xr,$yr", 1 ); @@ -685,13 +688,13 @@ /* Change window into device space */ if (pls->difilt & PLDI_DEV) { - snprintf(str, 10, "%f", pls->mar); + snprintf(str, STR_LEN, "%f", pls->mar); Tcl_SetVar(dev->interp, "mar", str, 0); - snprintf(str, 10, "%f", pls->aspect); + snprintf(str, STR_LEN, "%f", pls->aspect); Tcl_SetVar(dev->interp, "aspect", str, 0); - snprintf(str, 10, "%f", pls->jx); + snprintf(str, STR_LEN, "%f", pls->jx); Tcl_SetVar(dev->interp, "jx", str, 0); - snprintf(str, 10, "%f", pls->jy); + snprintf(str, STR_LEN, "%f", pls->jy); Tcl_SetVar(dev->interp, "jy", str, 0); server_cmd( pls, "$plwidget cmd plsetopt -mar $mar", 1 ); @@ -1324,7 +1327,7 @@ plwindow_init(PLStream *pls) { TkDev *dev = (TkDev *) pls->dev; - char command[100]; + char command[CMD_LEN]; unsigned int bg; dbug_enter("plwindow_init"); @@ -1346,7 +1349,7 @@ bg = pls->cmap0[0].b | (pls->cmap0[0].g << 8) | (pls->cmap0[0].r << 16); if (bg > 0) { - snprintf(command, 100, "$plwidget configure -plbg #%06x", bg); + snprintf(command, CMD_LEN, "$plwidget configure -plbg #%06x", bg); server_cmd( pls, command, 0 ); } @@ -1368,12 +1371,12 @@ /* color map options */ if (pls->ncol0) { - snprintf(command, 100, "$plwidget cmd plsetopt -ncol0 %d", pls->ncol0); + snprintf(command, CMD_LEN, "$plwidget cmd plsetopt -ncol0 %d", pls->ncol0); server_cmd( pls, command, 0 ); } if (pls->ncol1) { - snprintf(command, 100, "$plwidget cmd plsetopt -ncol1 %d", pls->ncol1); + snprintf(command, CMD_LEN, "$plwidget cmd plsetopt -ncol1 %d", pls->ncol1); server_cmd( pls, command, 0 ); } Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/drivers/xwin.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -112,6 +112,8 @@ #define ROMAP_CMAP1_COLORS 50 #define TC_CMAP1_COLORS 200 +#define HEADER_LEN 1024 + /* Variables to hold RGB components of given colormap. */ /* Used in an ugly hack to get past some X11R5 and TK limitations. */ @@ -1085,7 +1087,7 @@ XSizeHints hint; int x, y; U_INT width, height, border, depth; - char header[1024]; + char header[HEADER_LEN]; dbug_enter("InitMain"); @@ -1129,13 +1131,13 @@ /* Window title */ if (pls->plwindow){ /* allow -plwindow to specify wm decoration name */ - strncpy(header, pls->plwindow, 1024); + strncpy(header, pls->plwindow, HEADER_LEN); } else if(pls->program) { - strncpy(header, pls->program, 1024); /* else program name */ + strncpy(header, pls->program, HEADER_LEN); /* else program name */ } else - strncpy(header,"Plplot",1024); + strncpy(header,"Plplot",HEADER_LEN); /* Window creation */ Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/include/plplotP.h 2009-02-08 22:05:56 UTC (rev 9475) @@ -391,6 +391,9 @@ #define PLPLOT_TCL_ENV "PLPLOT_TCL" #define PLPLOT_HOME_ENV "PLPLOT_HOME" +/* Maximum size for path strings in the plplot code */ +#define PLPLOT_MAX_PATH 1024 + /* * Some stuff that is included (and compiled into) plsym.h * Other modules might want this, so we will "extern" it Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/src/plbox.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -25,6 +25,10 @@ #include "plplotP.h" #include "qsastime.h" +#define STRING_LEN 40 +#define FORMAT_LEN 10 +#define TEMP_LEN 30 + static PLFLT xlog[8] = { 0.301030, 0.477121, 0.602060, 0.698970, @@ -656,7 +660,7 @@ PLFLT wx2, PLFLT wy2, PLFLT vmin_in, PLFLT vmax_in, PLFLT tick, PLINT nsub, PLINT nolast, PLINT *digits) { - static char string[40]; + static char string[STRING_LEN]; PLINT lb, ld, lf, li, ll, ln, ls, lt, lu; PLINT major, minor, mode, prec, scale; PLINT i, i1, i2, i3, i4; @@ -773,7 +777,7 @@ tp = tick1 * (1. + floor(vmin / tick1)); for (tn = tp; BETW(tn, vmin, vmax); tn += tick1) { if(BETW(tn, vmin+tcrit, vmax-tcrit)) { - plform(tn, scale, prec, string, 40, ll, lf); + plform(tn, scale, prec, string, STRING_LEN, ll, lf); pos = (vmax_in > vmin_in)? (tn - vmin) / (vmax - vmin): (vmax - tn) / (vmax - vmin); @@ -782,7 +786,7 @@ } *digits = 2; if (!ll && mode) { - snprintf(string, 40, "(x10#u%d#d)", (int) scale); + snprintf(string, STRING_LEN, "(x10#u%d#d)", (int) scale); plxytx(wx1, wy1, wx2, wy2, height, 1.0, 0.5, string); } } @@ -867,7 +871,7 @@ PLFLT wx, PLFLT wy1, PLFLT wy2, PLFLT vmin_in, PLFLT vmax_in, PLFLT tick, PLINT nsub, PLINT *digits) { - static char string[40]; + static char string[STRING_LEN]; PLINT lb, lc, ld, lf, li, ll, lm, ln, ls, lt, lu, lv; PLINT i, mode, prec, scale; PLINT nsub1, lstring; @@ -989,7 +993,7 @@ *digits = 0; tp = tick1 * floor(vmin / tick1); for (tn = tp + tick1; BETW(tn, vmin, vmax); tn += tick1) { - plform(tn, scale, prec, string, 40, ll, lf); + plform(tn, scale, prec, string, STRING_LEN, ll, lf); pos = (vmax_in > vmin_in)? (tn - vmin) / (vmax - vmin): (vmax - tn) / (vmax - vmin); @@ -1003,7 +1007,7 @@ *digits = MAX(*digits, lstring); } if (!ll && mode) { - snprintf(string, 40, "(x10#u%d#d)", (int) scale); + snprintf(string, STRING_LEN, "(x10#u%d#d)", (int) scale); pos = 1.15; height = 0.5; if (ln && !right) { @@ -1192,7 +1196,7 @@ static void label_box(const char *xopt, PLFLT xtick1, const char *yopt, PLFLT ytick1) { - static char string[40]; + static char string[STRING_LEN]; PLBOOL ldx, lfx, lix, llx, lmx, lnx, ltx; PLBOOL ldy, lfy, liy, lly, lmy, lny, lty, lvy; PLFLT vpwxmi, vpwxma, vpwymi, vpwyma; @@ -1249,10 +1253,10 @@ if (ldx) { t = (double) tn; setFromUT(1970,0,1,0,0,t,&tm,0); - strfMJD(string, 40, timefmt, &tm, 0); + strfMJD(string, STRING_LEN, timefmt, &tm, 0); } else { - plform(tn, xscale, xprec, string, 40, llx, lfx); + plform(tn, xscale, xprec, string, STRING_LEN, llx, lfx); } height = lix ? 1.75 : 1.5; pos = (vpwxmax > vpwxmin)? @@ -1271,7 +1275,7 @@ if (!llx && !ldx && xmode) { pos = 1.0; height = 3.2; - snprintf(string, 40, "(x10#u%d#d)", (int) xscale); + snprintf(string, STRING_LEN, "(x10#u%d#d)", (int) xscale); if (lnx) plmtex("b", height, pos, 0.5, string); if (lmx) @@ -1298,10 +1302,10 @@ if (ldy) { t = (double) tn; setFromUT(1970,0,1,0,0,t,&tm,0); - strfMJD(string, 40, timefmt, &tm, 0); + strfMJD(string, STRING_LEN, timefmt, &tm, 0); } else { - plform(tn, yscale, yprec, string, 40, lly, lfy); + plform(tn, yscale, yprec, string, STRING_LEN, lly, lfy); } pos = (vpwymax > vpwymin)? (tn - vpwymi) / (vpwyma - vpwymi): @@ -1334,7 +1338,7 @@ /* Write separate exponential label if mode = 1. */ if (!lly && !ldy && ymode) { - snprintf(string, 40, "(x10#u%d#d)", (int) yscale); + snprintf(string, STRING_LEN, "(x10#u%d#d)", (int) yscale); offset = 0.02; height = 2.0; if (lny) { @@ -1386,8 +1390,8 @@ value = pow(10.0, exponent); if (exponent < 0) { - char form[10]; - snprintf(form, 10, "%%.%df", ABS(exponent)); + char form[FORMAT_LEN]; + snprintf(form, FORMAT_LEN, "%%.%df", ABS(exponent)); snprintf(string, len, form, value); } else { @@ -1406,7 +1410,7 @@ /* Linear */ PLINT setpre, precis; - char form[10], temp[30]; + char form[FORMAT_LEN], temp[TEMP_LEN]; double scale2; plP_gprec(&setpre, &precis); @@ -1422,8 +1426,8 @@ scale2 = pow(10., prec); value = floor((value * scale2) + .5) / scale2; - snprintf(form, 10, "%%.%df", (int) prec); - snprintf(temp, 30, form, value); + snprintf(form, FORMAT_LEN, "%%.%df", (int) prec); + snprintf(temp, TEMP_LEN, form, value); strncpy(string, temp, len); } } Modified: trunk/src/plcont.c =================================================================== --- trunk/src/plcont.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/src/plcont.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -316,7 +316,9 @@ * Obviously there are security issues here that * should be addressed as well. */ - char form[10], tmpstring[15]; +#define FORM_LEN 10 +#define TMPSTRING_LEN 15 + char form[FORM_LEN], tmpstring[TMPSTRING_LEN]; PLINT exponent = 0; PLFLT mant, tmp; @@ -349,9 +351,9 @@ if (mant != 0.0) mant = (int )(mant*pow(10.0, prec-1) + 0.5*mant/fabs(mant))/pow(10.0, prec-1); - snprintf(form, 10, "%%.%df", prec-1); + snprintf(form, FORM_LEN, "%%.%df", prec-1); snprintf(string, len, form, mant); - snprintf(tmpstring, 15, "#(229)10#u%d", exponent); + snprintf(tmpstring, TMPSTRING_LEN, "#(229)10#u%d", exponent); strncat(string, tmpstring, len); if (abs(exponent) < limexp || value == 0.0) { @@ -365,7 +367,7 @@ if (prec < 0) prec = 0; - snprintf(form, 10, "%%.%df", (int) prec); + snprintf(form, FORM_LEN, "%%.%df", (int) prec); snprintf(string, len, form, value); } } Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/src/plcore.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -45,6 +45,10 @@ #endif #endif +#define BUFFER_SIZE 80 +#define BUFFER2_SIZE 300 +#define DRVSPEC_SIZE 400 + /*--------------------------------------------------------------------------*\ * Driver Interface * @@ -395,12 +399,12 @@ char *endptr; char *endptr2; - char msgbuf[80]; + char msgbuf[BUFFER_SIZE]; *num = strtoul(text,&endptr,0); if (end != endptr[0]) { - snprintf(msgbuf,80,"text2num: invalid control string detected - %c expected",end); + snprintf(msgbuf,BUFFER_SIZE,"text2num: invalid control string detected - %c expected",end); plwarn(msgbuf); } @@ -677,9 +681,9 @@ char* ptr = utf8_to_ucs4 (string + i, &unichar); #endif if (ptr == NULL) { - char buf[80]; + char buf[BUFFER_SIZE]; strncpy (buf, string, 30); - snprintf (buf, 80, "UTF-8 string is malformed: %s%s", + snprintf (buf, BUFFER_SIZE, "UTF-8 string is malformed: %s%s", buf, strlen (string) > 30 ? "[...]" : ""); plabort (buf); return; @@ -2125,8 +2129,8 @@ static int inBuildTree = 0; if (inited == 0) { - char currdir[256]; - char builddir[256]; + char currdir[PLPLOT_MAX_PATH]; + char builddir[PLPLOT_MAX_PATH]; /* AM: getcwd has a somewhat strange status on Windows, its proper name is _getcwd, this is a problem in the case of DLLs, like with @@ -2136,14 +2140,14 @@ #define getcwd _getcwd #endif - if (getcwd(currdir, 256) == NULL) { + if (getcwd(currdir, PLPLOT_MAX_PATH) == NULL) { pldebug("plInBuildTree():", "Not enough buffer space"); } else { /* The chdir / getcwd call is to ensure we get the physical * path without any symlinks */ /* Ignore error in chdir - build tree may not exist */ if (chdir(BUILD_DIR) == 0) { - if (getcwd(builddir, 256) == NULL) { + if (getcwd(builddir, PLPLOT_MAX_PATH) == NULL) { pldebug("plInBuildTree():", "Not enough buffer space"); } else { @@ -2214,7 +2218,7 @@ int n; #ifdef ENABLE_DYNDRIVERS - char buf[300]; + char buf[BUFFER2_SIZE]; char* drvdir; char *devnam, *devdesc, *devtype, *driver, *tag, *seqstr; int seq; @@ -2253,15 +2257,14 @@ /* Only consider entries that have the ".rc" suffix */ if ((len > 0) && (strcmp (name + len, ".rc") == 0)) { - char path[300]; - char buf[300]; + char path[PLPLOT_MAX_PATH]; FILE* fd; /* Open the driver's info file */ - snprintf (path, 300, "%s/%s", drvdir, name); + snprintf (path, PLPLOT_MAX_PATH, "%s/%s", drvdir, name); fd = fopen (path, "r"); if (fd == NULL) { - snprintf (buf, 300, + snprintf (buf, BUFFER2_SIZE, "plInitDispatchTable: Could not open driver info file %s\n", name); plabort (buf); @@ -2274,7 +2277,7 @@ pldebug ("plInitDispatchTable", "Opened driver info file %s\n", name); - while (fgets (buf, 300, fd) != NULL) + while (fgets (buf, BUFFER2_SIZE, fd) != NULL) { fprintf (fp_drvdb, "%s", buf); if ( buf [strlen (buf) - 1] != '\n' ) @@ -2331,7 +2334,7 @@ i = 0; done = !(i < npldynamicdevices); while( !done ) { - char *p = fgets( buf, 300, fp_drvdb ); + char *p = fgets( buf, BUFFER2_SIZE, fp_drvdb ); if (p == 0) { done = 1; @@ -2510,7 +2513,7 @@ { #ifdef ENABLE_DYNDRIVERS int i, drvidx; - char sym[60]; + char sym[BUFFER_SIZE]; char *tag; int n=plsc->device - 1; @@ -2552,11 +2555,11 @@ /* Load the driver if it hasn't been loaded yet. */ if (!driver->dlhand) { - char drvspec[ 400 ]; + char drvspec[ DRVSPEC_SIZE ]; #ifdef LTDL_WIN32 - snprintf( drvspec, 400, "%s", driver->drvnam ); + snprintf( drvspec, DRVSPEC_SIZE, "%s", driver->drvnam ); #else - snprintf( drvspec, 400, "%s/%s", plGetDrvDir (), driver->drvnam ); + snprintf( drvspec, DRVSPEC_SIZE, "%s/%s", plGetDrvDir (), driver->drvnam ); #endif /* LTDL_WIN32 */ pldebug("plLoadDriver", "Trying to load %s on %s\n", @@ -2577,7 +2580,7 @@ /* Now we are ready to ask the driver's device dispatch init function to initialize the entries in the dispatch table. */ - snprintf( sym, 60, "plD_dispatch_init_%s", tag ); + snprintf( sym, BUFFER_SIZE, "plD_dispatch_init_%s", tag ); { PLDispatchInit dispatch_init = (PLDispatchInit) lt_dlsym( driver->dlhand, sym ); if (!dispatch_init) Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/src/plctrl.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -53,6 +53,8 @@ /* Random number generator (Mersenne Twister) */ #include "mt19937ar.h" +#define BUFFER_SIZE 256 + /* Static functions */ /* Used by any external init code to suggest a path */ @@ -120,8 +122,8 @@ return; } if (icol0 < 0 || icol0 >= plsc->ncol0) { - char buffer[256]; - snprintf(buffer, 256, "plcol0: Invalid color map entry: %d", (int) icol0); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plcol0: Invalid color map entry: %d", (int) icol0); plabort(buffer); return; } @@ -152,8 +154,8 @@ return; } if (col1 < 0 || col1 > 1) { - char buffer[256]; - snprintf(buffer, 256, "plcol1: Invalid color map position: %f", (PLFLT) col1); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plcol1: Invalid color map position: %f", (PLFLT) col1); plabort(buffer); return; } @@ -232,14 +234,14 @@ if (plsc->cmap0 == NULL) plscmap0n(0); if (icol0 < 0 || icol0 >= plsc->ncol0) { - char buffer[256]; - snprintf(buffer, 256, "plscol0: Illegal color table value: %d", (int) icol0); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscol0: Illegal color table value: %d", (int) icol0); plabort(buffer); return; } if ((r < 0 || r > 255) || (g < 0 || g > 255) || (b < 0 || b > 255)) { - char buffer[256]; - snprintf(buffer, 256, "plscol0: Invalid RGB color: %d, %d, %d", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscol0: Invalid RGB color: %d, %d, %d", (int) r, (int) g, (int) b); plabort(buffer); return; @@ -261,14 +263,14 @@ if (plsc->cmap0 == NULL) plscmap0n(0); if (icol0 < 0 || icol0 >= plsc->ncol0) { - char buffer[256]; - snprintf(buffer, 256, "plscol0a: Illegal color table value: %d", (int) icol0); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscol0a: Illegal color table value: %d", (int) icol0); plabort(buffer); return; } if ((r < 0 || r > 255) || (g < 0 || g > 255) || (b < 0 || b > 255) || (a < 0 || a > 1.0)) { - char buffer[256]; - snprintf(buffer, 256, "plscol0a: Invalid RGB color: %d, %d, %d, %f", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscol0a: Invalid RGB color: %d, %d, %d, %f", (int) r, (int) g, (int) b, (double) a); plabort(buffer); return; @@ -301,8 +303,8 @@ *b = -1; if (icol0 < 0 || icol0 > plsc->ncol0) { - char buffer[256]; - snprintf(buffer, 256, "plgcol0: Invalid color index: %d", (int) icol0); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plgcol0: Invalid color index: %d", (int) icol0); plabort(buffer); return; } @@ -333,8 +335,8 @@ *a = -1.0; if (icol0 < 0 || icol0 > plsc->ncol0) { - char buffer[256]; - snprintf(buffer, 256, "plgcol0: Invalid color index: %d", (int) icol0); + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plgcol0: Invalid color index: %d", (int) icol0); plabort(buffer); return; } @@ -366,8 +368,8 @@ (g[i] < 0 || g[i] > 255) || (b[i] < 0 || b[i] > 255)) { - char buffer[256]; - snprintf(buffer, 256, "plscmap0: Invalid RGB color: %d, %d, %d", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscmap0: Invalid RGB color: %d, %d, %d", (int) r[i], (int) g[i], (int) b[i]); plabort(buffer); return; @@ -403,8 +405,8 @@ (b[i] < 0 || b[i] > 255) || (a[i] < 0.0 || a[i] > 1.0)) { - char buffer[256]; - snprintf(buffer, 256, "plscmap0a: Invalid RGB color: %d, %d, %d, %f", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscmap0a: Invalid RGB color: %d, %d, %d, %f", (int) r[i], (int) g[i], (int) b[i], (double) a[i]); plabort(buffer); return; @@ -439,8 +441,8 @@ (g[i] < 0 || g[i] > 255) || (b[i] < 0 || b[i] > 255)) { - char buffer[256]; - snprintf(buffer, 256, "plscmap1: Invalid RGB color: %d, %d, %d", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscmap1: Invalid RGB color: %d, %d, %d", (int) r[i], (int) g[i], (int) b[i]); plabort(buffer); return; @@ -475,8 +477,8 @@ (b[i] < 0 || b[i] > 255) || (a[i] < 0.0 || a[i] > 1.0)) { - char buffer[256]; - snprintf(buffer, 256, "plscmap1a: Invalid RGB color: %d, %d, %d, %f", + char buffer[BUFFER_SIZE]; + snprintf(buffer, BUFFER_SIZE, "plscmap1a: Invalid RGB color: %d, %d, %d, %f", (int) r[i], (int) g[i], (int) b[i], (double) a[i]); plabort(buffer); return; @@ -1778,7 +1780,7 @@ { int i = 0, count = 0; size_t len; - char line[256]; + char line[BUFFER_SIZE]; while (pls->OutFile == NULL) { @@ -1835,10 +1837,10 @@ void plP_getmember(PLStream *pls) { - char tmp[256]; - char prefix[256]; + char tmp[BUFFER_SIZE]; + char prefix[BUFFER_SIZE]; char* suffix; - char num[256]; + char num[BUFFER_SIZE]; int maxlen; maxlen = strlen(pls->BaseName) + 10; @@ -1852,13 +1854,13 @@ suffix = strstr (pls->BaseName, "%n"); - snprintf(tmp, 256, "%%0%1ii", (int) pls->fflen); - snprintf(num, 256, tmp, pls->member); + snprintf(tmp, BUFFER_SIZE, "%%0%1ii", (int) pls->fflen); + snprintf(num, BUFFER_SIZE, tmp, pls->member); if (suffix == NULL) snprintf (pls->FileName, maxlen, "%s.%s", pls->BaseName, num); else { - strncpy (prefix, pls->BaseName, 256); + strncpy (prefix, pls->BaseName, BUFFER_SIZE); prefix [suffix - pls->BaseName] = 0; snprintf (pls->FileName, maxlen, "%s%s%s", prefix, num, suffix + 2); } @@ -1875,7 +1877,7 @@ void plP_sfnam(PLStream *pls, const char *fnam) { - char prefix[256]; + char prefix[BUFFER_SIZE]; char* suffix; int maxlen; pls->OutFile = NULL; @@ -1894,7 +1896,7 @@ if (suffix == NULL) strncpy(pls->FileName, fnam, maxlen); else { - strncpy (prefix, fnam, 256); + strncpy (prefix, fnam, BUFFER_SIZE); prefix [suffix - fnam] = 0; snprintf (pls->FileName, maxlen, "%s%s", prefix, suffix + 2); } @@ -2057,7 +2059,7 @@ { int m; int i = 0; - char line[256]; + char line[BUFFER_SIZE]; while (i++ < 10) { fputs(s, stdout); @@ -2088,7 +2090,7 @@ PLFLT m; double m1; int i = 0; - char line[256]; + char line[BUFFER_SIZE]; while (i++ < 10) { fputs(s, stdout); Modified: trunk/src/plfreetype.c =================================================================== --- trunk/src/plfreetype.c 2009-02-08 21:15:41 UTC (rev 9474) +++ trunk/src/plfreetype.c 2009-02-08 22:05:56 UTC (rev 9475) @@ -558,7 +558,7 @@ FT_Data *FT; char *a; /* font paths and file names can be long so leave generous (1024) room */ - char font_dir[1024]; + char font_dir[PLPLOT_MAX_PATH]; /* N.B. must be in exactly same order as TrueTypeLookup */ const char *env_font_names[N_TrueTypeLookup] = { "PLPLOT_FREETYPE_SANS_FONT", @@ -672,9 +672,9 @@ */ if ((a = getenv("PLPLOT_FREETYPE_FONT_DIR")) != NULL) - strncpy(font_dir,a,1024); + strncpy(font_dir,a,PLPLOT_MAX_PATH); else - strncpy(font_dir,default_unix_font_dir,1024); + strncpy(font_dir,default_unix_font_dir,PLPLOT_MAX_PATH); #endif @@ -701,16 +701,16 @@ #else if ((a[0]=='/')||(a[0]=='~')) /* check for unix abs path */ #endif - strncpy(FT->font_name[i],a,1024); + strncpy(FT->font_name[i],a,PLPLOT_MAX_PATH); else { - strncpy(FT->font_name[i],font_dir,1024); - strncat(FT->font_name[i],a,1024); + strncpy(FT->font_name[i],font_dir,PLPLOT_MAX_PATH); + strncat(FT->font_name[i],a,PLPLOT_MAX_PATH); } } else { - strncpy(FT->font_name[i],font_dir,1024); - strncat(FT->font_name[i],(char *)TrueTypeLookup[i].pfont,1024); + strncpy(FT->font_name[i],font_dir,PLPLOT_MAX_PATH); + strncat(FT->font_name[i],(char *)TrueTypeLookup[i].pfont,PLPLOT_MAX_PATH); } { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-02-09 09:41:13
|
Revision: 9478 http://plplot.svn.sourceforge.net/plplot/?rev=9478&view=rev Author: andrewross Date: 2009-02-09 09:41:11 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Fix up use of strncat and strncpy to correctly interpret the size parameter. Modified Paths: -------------- trunk/drivers/cairo.c trunk/drivers/psttf.cc trunk/src/plctrl.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-02-08 22:34:26 UTC (rev 9477) +++ trunk/drivers/cairo.c 2009-02-09 09:41:11 UTC (rev 9478) @@ -498,17 +498,17 @@ switch(ucs4[i]) { case 38: - strncat(pangoMarkupString, "&", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "&", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); break; case 60: - strncat(pangoMarkupString, "<", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "<", MAX_MARKUP_LEN)-1-strlen(pangoMarkupString); break; case 62: - strncat(pangoMarkupString, ">", MAX_MARKUP_LEN); + strncat(pangoMarkupString, ">", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); break; default: ucs4_to_utf8(ucs4[i],utf8); - strncat(pangoMarkupString, utf8, MAX_MARKUP_LEN); + strncat(pangoMarkupString, utf8, MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); break; } i++; @@ -517,24 +517,24 @@ i++; if (ucs4[i] == (PLUNICODE)plplotEsc){ /* a escape character to display */ ucs4_to_utf8(ucs4[i],utf8); - strncat(pangoMarkupString, utf8, MAX_MARKUP_LEN); + strncat(pangoMarkupString, utf8, MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); i++; continue; } else { if(ucs4[i] == (PLUNICODE)'u'){ /* Superscript */ if(upDown < 0){ - strncat(pangoMarkupString, "</sub>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "</sub>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); } else { - strncat(pangoMarkupString, "<sup>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "<sup>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); } upDown++; } if(ucs4[i] == (PLUNICODE)'d'){ /* Subscript */ if(upDown > 0){ - strncat(pangoMarkupString, "</sup>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "</sup>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); } else { - strncat(pangoMarkupString, "<sub>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "<sub>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); } upDown--; } @@ -577,24 +577,24 @@ plP_fci2hex(fci, &fontStyle, PL_FCI_STYLE); plP_fci2hex(fci, &fontWeight, PL_FCI_WEIGHT); snprintf(openTag, TAG_LEN, "<span font_desc=\"%s %.2f\" ", familyLookup[fontFamily], fontSize); - strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); + strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); snprintf(openTag, TAG_LEN, "style=\"%s\" ", styleLookup[fontStyle]); - strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); + strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); snprintf(openTag, TAG_LEN, "weight=\"%s\">", weightLookup[fontWeight]); - strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN); + strncat(pangoMarkupString, openTag, MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); /* Move to the right sub/super-script level */ if(upDown > 0){ while(upDown > 0){ - strncat(pangoMarkupString, "<sup>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "<sup>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); upDown--; } } if(upDown < 0){ while(upDown < 0){ - strncat(pangoMarkupString, "<sub>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "<sub>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); upDown++; } } @@ -610,18 +610,18 @@ { if(upDown > 0){ while(upDown > 0){ - strncat(pangoMarkupString, "</sup>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "</sup>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); upDown--; } } if(upDown < 0){ while(upDown < 0){ - strncat(pangoMarkupString, "</sub>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "</sub>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); upDown++; } } - strncat(pangoMarkupString, "</span>", MAX_MARKUP_LEN); + strncat(pangoMarkupString, "</span>", MAX_MARKUP_LEN-1-strlen(pangoMarkupString)); } /*--------------------------------------------------------------------- @@ -689,10 +689,12 @@ This was copied from the psttf driver. */ for(i=0;i<NPANGOLOOKUP;i++){ if((a = getenv(envFamilyLookup[i])) != NULL){ - strncpy(familyLookup[i],a,FAMILY_LOOKUP_LEN); + strncpy(familyLookup[i],a,FAMILY_LOOKUP_LEN-1); + familyLookup[i][FAMILY_LOOKUP_LEN-1] = '\0'; } else { - strncpy(familyLookup[i],defaultFamilyLookup[i],FAMILY_LOOKUP_LEN); + strncpy(familyLookup[i],defaultFamilyLookup[i],FAMILY_LOOKUP_LEN-1); + familyLookup[i][FAMILY_LOOKUP_LEN-1] = '\0'; } } Modified: trunk/drivers/psttf.cc =================================================================== --- trunk/drivers/psttf.cc 2009-02-08 22:34:26 UTC (rev 9477) +++ trunk/drivers/psttf.cc 2009-02-09 09:41:11 UTC (rev 9478) @@ -285,10 +285,12 @@ // or defaults. for (i=0;i<N_Pango_Lookup;i++) { if ( (a = getenv(EnvFamilyLookup[i])) != NULL ) { - strncpy(FamilyLookup[i],a,FAMILY_LOOKUP_LEN); + strncpy(FamilyLookup[i],a,FAMILY_LOOKUP_LEN-1); + FamilyLookup[i][FAMILY_LOOKUP_LEN-1] = '\0'; } else { strncpy(FamilyLookup[i],DefaultFamilyLookup[i],FAMILY_LOOKUP_LEN); + FamilyLookup[i][FAMILY_LOOKUP_LEN-1] = '\0'; } } Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-02-08 22:34:26 UTC (rev 9477) +++ trunk/src/plctrl.c 2009-02-09 09:41:11 UTC (rev 9478) @@ -1893,9 +1893,10 @@ suffix = strstr (fnam, "%n"); - if (suffix == NULL) + if (suffix == NULL) { strncpy(pls->FileName, fnam, maxlen-1); pls->FileName[maxlen-1] = '\0'; + } else { strncpy (prefix, fnam, BUFFER_SIZE-1); prefix [(suffix - fnam)<BUFFER_SIZE?(suffix-fnam):BUFFER_SIZE-1] = '\0'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-09 22:56:45
|
Revision: 9484 http://plplot.svn.sourceforge.net/plplot/?rev=9484&view=rev Author: airwin Date: 2009-02-09 22:56:38 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Establish the convention that our Fortran 77 source code commentary lines start with lower-case 'c' rather than 'C' or '!'. As Arjen has mentioned, the elimination of '!' to introduce commentary lines should reduce (but probably not eliminate) errors for compilers that demand (either directly or through an option the user might specify) strict Fortran 77 compliance. I made the (arbitrary) choice of 'c' rather than 'C' to be consistent with the lower-case style of the rest of our fortran source code. Modified Paths: -------------- trunk/bindings/f77/sfstubs.fm4 trunk/examples/f77/x01f.fm4 trunk/examples/f77/x02f.fm4 trunk/examples/f77/x03f.fm4 trunk/examples/f77/x04f.fm4 trunk/examples/f77/x05f.fm4 trunk/examples/f77/x06f.fm4 trunk/examples/f77/x07f.fm4 trunk/examples/f77/x08f.fm4 trunk/examples/f77/x09f.fm4 trunk/examples/f77/x10f.fm4 trunk/examples/f77/x11f.fm4 trunk/examples/f77/x12f.fm4 trunk/examples/f77/x13f.fm4 trunk/examples/f77/x14f.fm4 trunk/examples/f77/x15f.fm4 trunk/examples/f77/x16af.fm4 trunk/examples/f77/x16f.fm4 trunk/examples/f77/x17f.fm4 trunk/examples/f77/x18f.fm4 trunk/examples/f77/x19f.fm4 trunk/examples/f77/x20f.fm4 trunk/examples/f77/x21f.fm4 trunk/examples/f77/x22f.fm4 trunk/examples/f77/x23f.fm4 trunk/examples/f77/x24f.fm4 trunk/examples/f77/x25f.fm4 trunk/examples/f77/x26f.fm4 trunk/examples/f77/x27f.fm4 trunk/examples/f77/x28f.fm4 trunk/examples/f77/x29f.fm4 trunk/examples/f77/x30f.fm4 trunk/examples/f77/x31f.fm4 Modified: trunk/bindings/f77/sfstubs.fm4 =================================================================== --- trunk/bindings/f77/sfstubs.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/bindings/f77/sfstubs.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,40 +1,40 @@ -!*********************************************************************** -! $Id$ -! sfstubs.f -! -! Copyright (C) 2004 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 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 file contains the more complicated fortran stub routines -! that the more generic scstubs.c cannot handle. -! Typical stubs here must convert a fortran character string -! to C or vice versa. -! N.B. the called routines (that are defined in scstubs.c) have -! a suffix of '7' to avoid name clashes and also presumably as a -! signal in scstubs.c that they were called from these routines. -! Where arguments are floating-point we explicitly type them as real*8. -! This typing is never used since these arguments are -! actually passed by reference. That implies these routines should -! work if the calling routine and libplplot itself are both -! double precision or both single precision. -! -!*********************************************************************** +c*********************************************************************** +c $Id$ +c sfstubs.f +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as published +c by the Free Software Foundation; either version 2 of the License, or +c (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public License +c along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c +c +c This file contains the more complicated fortran stub routines +c that the more generic scstubs.c cannot handle. +c Typical stubs here must convert a fortran character string +c to C or vice versa. +c N.B. the called routines (that are defined in scstubs.c) have +c a suffix of '7' to avoid name clashes and also presumably as a +c signal in scstubs.c that they were called from these routines. +c Where arguments are floating-point we explicitly type them as real*8. +c This typing is never used since these arguments are +c actually passed by reference. That implies these routines should +c work if the calling routine and libplplot itself are both +c double precision or both single precision. +c +c*********************************************************************** subroutine plsetopt(opt, optarg) @@ -49,7 +49,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plabort(text) @@ -63,7 +63,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plsdev(dnam) @@ -77,7 +77,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plgdev(dnam) @@ -91,7 +91,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plsfnam(fnam) @@ -105,7 +105,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plgfnam(fnam) @@ -119,7 +119,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plgver(ver) @@ -133,7 +133,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plaxes(x0,y0,xopt,xtick,nxsub,yopt,ytick,nysub) @@ -151,7 +151,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plbox(xopt,xtick,nxsub,yopt,ytick,nysub) @@ -169,7 +169,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plbox3(xopt,xlabel,xtick,nxsub,yopt,ylabel,ytick,nysub, & zopt,zlabel,ztick,nzsub) @@ -194,7 +194,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plcon0(z,nx,ny,kx,lx,ky,ly,clevel,nlevel) @@ -206,7 +206,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plcon1(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,xg,yg) @@ -218,7 +218,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plcon2(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,xg,yg) @@ -230,7 +230,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plcont(z,nx,ny,kx,lx,ky,ly,clevel,nlevel) @@ -239,14 +239,14 @@ real*8 z(nx, ny), clevel(nlevel) real*8 tr(6) -!DEC$ ATTRIBUTES DLLEXPORT :: PLPLOT +cDEC$ ATTRIBUTES DLLEXPORT :: PLPLOT common /plplot/ tr call plcont7(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,tr) end -!*********************************************************************** +c*********************************************************************** subroutine plvec0(u, v, nx, ny, scale) @@ -258,7 +258,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plvec1(u, v, nx, ny, scale, xg, yg) @@ -270,7 +270,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plvec2(u, v, nx, ny, scale, xg, yg) @@ -282,7 +282,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plvect(u, v, nx, ny, scale) @@ -296,7 +296,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshade0(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -313,7 +313,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshade07(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -323,7 +323,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshade1(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -341,7 +341,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshade17(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -352,7 +352,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshade2(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -370,7 +370,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshade27(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -381,7 +381,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshade(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -408,7 +408,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshades0(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -423,7 +423,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshades07(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -432,7 +432,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshades1(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -447,7 +447,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshades17(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -456,7 +456,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshades2(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -472,7 +472,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshades27(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -481,7 +481,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plshades(z, nx, ny, defined, & xmin, xmax, ymin, ymax, @@ -498,7 +498,7 @@ include 'sfstubs.h' -! call plstrf2c(dnam, string1, maxlen) +c call plstrf2c(dnam, string1, maxlen) call plshades7(z, nx, ny, s1, & xmin, xmax, ymin, ymax, @@ -507,7 +507,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plimagefr0(z,nx,ny,xmin,xmax,ymin,ymax,zmin,zmax, & valuemin,valuemax,lx) @@ -522,7 +522,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plimagefr1(z,nx,ny,xmin,xmax,ymin,ymax,zmin,zmax, & valuemin,valuemax,xg,yg,lx) @@ -537,7 +537,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plimagefr2(z,nx,ny,xmin,xmax,ymin,ymax,zmin,zmax, & valuemin,valuemax,xg,yg,lx) @@ -552,7 +552,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plimagefr(z,nx,ny,xmin,xmax,ymin,ymax,zmin,zmax, & valuemin,valuemax,lx) @@ -569,7 +569,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine pllab(xlab,ylab,title) @@ -586,7 +586,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plmtex(side,disp,pos,xjust,text) @@ -603,7 +603,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plmtex3(side,disp,pos,xjust,text) @@ -620,7 +620,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plptex(x,y,dx,dy,xjust,text) @@ -636,7 +636,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plptex3(x,y,z,dx,dy,dz,sx,sy,sz,xjust,text) @@ -652,7 +652,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plstart(devname, nx, ny) @@ -668,7 +668,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine plmap(mapform,mapname,minx,maxx,miny,maxy) @@ -686,7 +686,7 @@ end subroutine -!*********************************************************************** +c*********************************************************************** subroutine plmeridians(mapform,dlong,dlat,minlong,maxlong, & minlat,maxlat) @@ -703,7 +703,7 @@ end subroutine -!*********************************************************************** +c*********************************************************************** subroutine plstripc(id, xspec, yspec, xmin, xmax, xjump, & ymin, ymax, xlpos, ylpos, y_ascl, acc, @@ -736,7 +736,7 @@ end -!*********************************************************************** +c*********************************************************************** subroutine pltimefmt(fmt) @@ -750,4 +750,4 @@ end -!*********************************************************************** +c*********************************************************************** Modified: trunk/examples/f77/x01f.fm4 =================================================================== --- trunk/examples/f77/x01f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x01f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,23 +1,23 @@ -C $Id$ -C Simple line plot and multiple windows demo. -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Simple line plot and multiple windows demo. +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none real*8 x(101), y(101) @@ -28,41 +28,41 @@ integer digmax integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C some fortran compilers demand typing of intrinsic lnblnk, and -C although this is not demanded on g77 it also works there. +c some fortran compilers demand typing of intrinsic lnblnk, and +c although this is not demanded on g77 it also works there. integer lnblnk -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Print plplot version +c Print plplot version call plgver(version) write (*,'(a,a)') 'PLplot library version: ', & version(:lnblnk(version)) -C Initialize plplot -C Divide page into 2x2 plots +c Initialize plplot +c Divide page into 2x2 plots call plstar(2,2) -C Set up the data -C Original case +c Set up the data +c Original case xscale = 6.d0 yscale = 1.d0 xoff = 0.d0 yoff = 0.d0 -C Do a plot +c Do a plot call plot1() -C Set up the data +c Set up the data xscale = 1.d0 yscale = 0.0014d0 yoff = 0.0185d0 -C Do a plot +c Do a plot digmax = 5 call plsyax(digmax, 0) @@ -70,11 +70,11 @@ call plot2() call plot3() -C Don't forget to call PLEND to finish off! +c Don't forget to call PLEND to finish off! call plend() end -C====================================================================== +c====================================================================== subroutine plot1() implicit none @@ -101,28 +101,28 @@ ys(i) = y((i-1)*10+4) enddo -C Set up the viewport and window using PLENV. The range in X is -C 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -C scaled separately (just = 0), and we just draw a labelled -C box (axis = 0). +c Set up the viewport and window using PLENV. The range in X is +c 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are +c scaled separately (just = 0), and we just draw a labelled +c box (axis = 0). call plcol0(1) call plenv( xmin, xmax, ymin, ymax, 0, 0 ) call plcol0(2) call pllab( '(x)', '(y)', '#frPLplot Example 1 - y=x#u2' ) -C Plot the data points +c Plot the data points call plcol0(4) call plpoin( 6, xs, ys, 9 ) -C Draw the line through the data +c Draw the line through the data call plcol0(3) call plline( 60, x, y ) end -C====================================================================== +c====================================================================== subroutine plot2() real*8 x(101), y(101) @@ -131,12 +131,12 @@ integer i common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff -C====================================================================== -C -C Set up the viewport and window using PLENV. The range in X is -C -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are -C scaled separately (just = 0), and we draw a box with axes -C (axis = 1). +c====================================================================== +c +c Set up the viewport and window using PLENV. The range in X is +c -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are +c scaled separately (just = 0), and we draw a box with axes +c (axis = 1). call plcol0(1) call plenv(-2.0d0, 10.0d0, -0.4d0, 1.2d0, 0, 1 ) @@ -144,14 +144,14 @@ call pllab( '(x)', 'sin(x)/x', & '#frPLplot Example 1 - Sinc Function' ) -C Fill up the arrays +c Fill up the arrays do i = 1, 100 x(i) = (i-20.0d0)/6.0d0 y(i) = 1.0d0 if (x(i) .ne. 0.0d0) y(i) = sin(x(i)) / x(i) enddo -C Draw the line +c Draw the line call plcol0(3) call plwid(2) @@ -159,11 +159,11 @@ call plwid(1) end -C====================================================================== +c====================================================================== subroutine plot3() -C -C For the final graph we wish to override the default tick intervals, -C and so do not use_ PLENV +c +c For the final graph we wish to override the default tick intervals, +c and so do not use_ PLENV real*8 PI parameter (PI = 3.1415926535897932384d0) @@ -174,19 +174,19 @@ common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff call pladv(0) -C Use_ standard viewport, and define X range from 0 to 360 degrees, -C Y range from -1.2 to 1.2. +c Use_ standard viewport, and define X range from 0 to 360 degrees, +c Y range from -1.2 to 1.2. call plvsta() call plwind( 0.0d0, 360.0d0, -1.2d0, 1.2d0 ) -C Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. +c Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. call plcol0(1) call plbox( 'bcnst', 60.0d0, 2, 'bcnstv', 0.2d0, 2 ) -C Superimpose a dashed line grid, with 1.5 mm marks and spaces. With -C only a single mark and space element, we do not need arrays +c Superimpose a dashed line grid, with 1.5 mm marks and spaces. With +c only a single mark and space element, we do not need arrays call plstyl( 1, 1500, 1500 ) call plcol0(2) Modified: trunk/examples/f77/x02f.fm4 =================================================================== --- trunk/examples/f77/x02f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x02f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,37 +1,37 @@ -C $Id$ -C Demonstrates multiple windows and color map 0 -C -C Copyright (C) 2004 Alan W. Irwin -C Copyright (C) 2005 Andrew Ross -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Demonstrates multiple windows and color map 0 +c +c Copyright (C) 2004 Alan W. Irwin +c Copyright (C) 2005 Andrew Ross +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Initialize plplot +c Initialize plplot call plinit() -C Run demos +c Run demos call demo1 call demo2 @@ -40,17 +40,17 @@ end -C-------------------------------------------------------------------------- -C demo1 -C -C Demonstrates multiple windows and default color map 0 palette. -C-------------------------------------------------------------------------- +c-------------------------------------------------------------------------- +c demo1 +c +c Demonstrates multiple windows and default color map 0 palette. +c-------------------------------------------------------------------------- subroutine demo1 implicit none call plbop -C Divide screen into 16 regions +c Divide screen into 16 regions call plssub(4,4) call draw_windows(16, 0) @@ -60,12 +60,12 @@ end -C-------------------------------------------------------------------------- -C demo2 -C -C Demonstrates multiple windows, user-modified color map 0 palette, -C and HLS -> RGB translation. -C-------------------------------------------------------------------------- +c-------------------------------------------------------------------------- +c demo2 +c +c Demonstrates multiple windows, user-modified color map 0 palette, +c and HLS -> RGB translation. +c-------------------------------------------------------------------------- subroutine demo2 implicit none integer r(116), g(116), b(116) @@ -76,21 +76,21 @@ call plbop -C Divide screen into 100 regions +c Divide screen into 100 regions call plssub(10,10) do i=0,99 -C Bounds on HLS, from plhlsrgb() commentary -- -C hue [0., 360.] degrees -C lightness [0., 1.] magnitude -C saturation [0., 1.] magnitude +c Bounds on HLS, from plhlsrgb() commentary -- +c hue [0., 360.] degrees +c lightness [0., 1.] magnitude +c saturation [0., 1.] magnitude -C Vary hue uniformly from left to right +c Vary hue uniformly from left to right h = (360.d0/10.d0)*mod(i,10) -C Vary lightness uniformly from top to bottom, between min and max +c Vary lightness uniformly from top to bottom, between min and max l = lmin + (lmax - lmin) * (i / 10) / 9.d0 -C Use_ max saturation +c Use_ max saturation s = 1.d0 call plhlsrgb(h, l, s, r1, g1, b1) @@ -112,11 +112,11 @@ end -C-------------------------------------------------------------------------- -C draw_windows -C -C Draws a set of numbered boxes with colors according to cmap0 entry. -C-------------------------------------------------------------------------- +c-------------------------------------------------------------------------- +c draw_windows +c +c Draws a set of numbered boxes with colors according to cmap0 entry. +c-------------------------------------------------------------------------- subroutine draw_windows( nw, cmap0_offset ) implicit none integer nw, cmap0_offset Modified: trunk/examples/f77/x03f.fm4 =================================================================== --- trunk/examples/f77/x03f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x03f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,23 +1,23 @@ -C $Id$ -C Generates polar plot with, 1-1 scaling -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Generates polar plot with, 1-1 scaling +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none real*8 PI @@ -29,11 +29,11 @@ integer i, j, nsp integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Set orientation to landscape - note not all device drivers -C support this, in particular most interactive drivers do not. +c Set orientation to landscape - note not all device drivers +c support this, in particular most interactive drivers do not. call plsori(1) dtr = PI/180.0d0 @@ -42,11 +42,11 @@ y0(i) = sin(dtr * dble (i)) enddo -C Initialize PLplot +c Initialize PLplot call plinit() -C Set up viewport and window, but do not draw box +c Set up viewport and window, but do not draw box call plenv(-1.3d0, 1.3d0, -1.3d0, 1.3d0, 1, -2) do i = 1,10 @@ -54,7 +54,7 @@ x(j) = 0.1d0*i*x0(j) y(j) = 0.1d0*i*y0(j) enddo -C Draw circles for polar grid +c Draw circles for polar grid call plline(361,x,y) enddo @@ -64,12 +64,12 @@ dx = cos(dtr*theta) dy = sin(dtr*theta) -C Draw radial spokes for polar grid +c Draw radial spokes for polar grid call pljoin(0.0d0, 0.0d0, dx, dy) write (text,'(i3)') nint(theta) -C Write labels for angle +c Write labels for angle text = text(nsp(text):) @@ -81,15 +81,15 @@ offset = 0.15 endif -C Slightly off zero to avoid floating point logic flips at -C 90 and 270 deg. +c Slightly off zero to avoid floating point logic flips at +c 90 and 270 deg. if (dx.ge.-0.00001d0) then call plptex(dx, dy, dx, dy, -offset, text) else call plptex(dx, dy, -dx, -dy, (1.d0 + offset), text) end if enddo -C Draw the graph +c Draw the graph do i=0,360 r = sin(dtr*dble (5*i)) @@ -103,15 +103,15 @@ call plmtex('t', 2.0d0, 0.5d0, 0.5d0, & '#frPLplot Example 3 - r(#gh)=sin 5#gh') -C Close the plot at end +c Close the plot at end call plend end integer function nsp(text) -C ================== +c ================== -C Find first non-space character +c Find first non-space character implicit none character*(*) text Modified: trunk/examples/f77/x04f.fm4 =================================================================== --- trunk/examples/f77/x04f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x04f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,33 +1,33 @@ -C $Id$ -C Illustration of logarithmic axes, and redefinition of window -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Illustration of logarithmic axes, and redefinition of window +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) call plinit call plfont(2) -C Make log plots using two different styles. +c Make log plots using two different styles. call plot1(0) call plot1(1) call plend @@ -41,7 +41,7 @@ integer i, type call pladv(0) -C Set up data for log plot. +c Set up data for log plot. f0 = 1.d0 do i=0,100 freql(i)= -2.0d0 + dble (i)/20.0d0 @@ -52,7 +52,7 @@ call plvpor(0.15d0, 0.85d0, 0.1d0, 0.9d0) call plwind(-2.0d0, 3.0d0, -80.0d0, 0.0d0) call plcol0(1) -C Try different axis and labelling styles. +c Try different axis and labelling styles. if (type.eq.0) then call plbox('bclnst', 0.0d0, 0, 'bnstv', 0.0d0, 0) elseif (type.eq.1) then @@ -60,20 +60,20 @@ else stop 'plot1: invalid type' endif -C Plot ampl vs freq. +c Plot ampl vs freq. call plcol0(2) call plline(101,freql,ampl) call plcol0(1) call plptex(1.6d0, -30.0d0, 1.0d0, -20.0d0, 0.5d0, & '-20 dB/decade') -C Put labels on. +c Put labels on. call plcol0(1) call plmtex('b', 3.2d0, 0.5d0, 0.5d0, 'Frequency') call plmtex('t', 2.0d0, 0.5d0, 0.5d0, & 'Single Pole Low-Pass Filter') call plcol0(2) call plmtex('l', 5.0d0, 0.5d0, 0.5d0, 'Amplitude (dB)') -C For the gridless case, put phase vs freq on same plot. +c For the gridless case, put phase vs freq on same plot. if(type.eq.0) then call plcol0(1) call plwind(-2.0d0, 3.0d0, -100.0d0, 0.0d0) Modified: trunk/examples/f77/x05f.fm4 =================================================================== --- trunk/examples/f77/x05f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x05f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,23 +1,23 @@ -C $Id$ -C Draws a histogram from sample data -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Draws a histogram from sample data +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none real*8 PI @@ -29,12 +29,12 @@ real*8 data(NPTS), delta integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Initialize plplot +c Initialize plplot call plinit() -C Fill up data points +c Fill up data points delta = 2.0d0 * PI / dble (NPTS) do i=1,NPTS Modified: trunk/examples/f77/x06f.fm4 =================================================================== --- trunk/examples/f77/x06f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x06f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,23 +1,23 @@ -C $Id$ -C Displays the plotter symbols for PLPOIN -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Displays the plotter symbols for PLPOIN +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none integer i, j, k @@ -26,28 +26,28 @@ character*3 text integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Full sized page for display +c Full sized page for display call plinit() call pladv(0) call plcol0(2) -C Set up viewport and window +c Set up viewport and window call plvpor(0.1d0, 1.0d0, 0.1d0, 0.9d0) call plwind(0.0d0, 1.0d0, 0.0d0, 1.3d0) -C Draw the grid using plbox +c Draw the grid using plbox call plbox('bcg', 0.1d0, 0, 'bcg', 0.1d0, 0) call plcol0(15) -C Write the digits below the frame +c Write the digits below the frame do i=0,9 write (text,'(i1)') i @@ -56,7 +56,7 @@ k=0 do i=0,12 -C Write the digits to the left of the frame +c Write the digits to the left of the frame if(i.eq.0) then write (text,'(i1)') 10*i @@ -71,7 +71,7 @@ x=0.1d0*j+0.05d0 y=1.25d0-0.1d0*i -C Display the symbols +c Display the symbols if (k.lt.128) call plpoin(1,x,y,k) k=k+1 Modified: trunk/examples/f77/x07f.fm4 =================================================================== --- trunk/examples/f77/x07f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x07f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,23 +1,23 @@ -C $Id$ -C Displays the plotter symbols for PLSYM -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Displays the plotter symbols for PLSYM +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none @@ -30,10 +30,10 @@ real*8 x, y integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) -C Full sized page for display +c Full sized page for display call plinit() call plfontld(1) @@ -42,17 +42,17 @@ call plcol0(2) -C Set up viewport and window +c Set up viewport and window call plvpor(0.15d0, 0.95d0, 0.1d0, 0.9d0) call plwind(0.0d0, 1.0d0, 0.0d0, 1.0d0) -C Draw the grid using plbox +c Draw the grid using plbox call plbox('bcg', 0.1d0, 0,'bcg', 0.1d0, 0) call plcol0(15) -C Write the digits below the frame +c Write the digits below the frame do i=0,9 write (text,'(i1)') i @@ -62,7 +62,7 @@ k=0 do i=0,9 -C Write the digits to the left of the frame +c Write the digits to the left of the frame if(base(l)+10*i.eq.0) then write (text,'(i1)') base(l)+10*i @@ -79,7 +79,7 @@ x=0.1d0*j+0.05d0 y=0.95d0-0.1d0*i -C Display the symbols +c Display the symbols call plsym(1,x,y,base(l)+k) k=k+1 Modified: trunk/examples/f77/x08f.fm4 =================================================================== --- trunk/examples/f77/x08f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x08f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,30 +1,30 @@ -C $Id$ -C 3-d plot demo -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c 3-d plot demo +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA implicit none real*8 PI parameter (PI = 3.1415926535897932384d0) integer i, j, k, ifshade, xpts, ypts, xdim, ydim -C xdim is the leading dimension of z, xpts <= xdim is the leading -C dimension of z that is defined. +c xdim is the leading dimension of z, xpts <= xdim is the leading +c dimension of z that is defined. parameter (xdim=99, ydim=100, xpts=35, ypts=46) real*8 x(xdim), y(ydim), z(xdim,ypts), xx, yy, r @@ -38,8 +38,8 @@ integer nlevel parameter (nlevel = 10) real*8 zmin, zmax, step, clevel(nlevel) -C Plotting options for 3d plots, see plplot.h for the C definitions -C of these options. +c Plotting options for 3d plots, see plplot.h for the C definitions +c of these options. integer DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY, MAG_COLOR, & BASE_CONT, TOP_CONT, SURF_CONT, DRAW_SIDES, FACETED, MESH parameter(DRAW_LINEX = 1) @@ -54,7 +54,7 @@ parameter(MESH = 256) integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) @@ -75,14 +75,14 @@ yy = y(j) if(rosen.eq.1) then z(i,j) = (1.d0 - xx)**2 + 100.d0*(yy - xx**2)**2 -C The log argument may be zero for just the right grid. +c The log argument may be zero for just the right grid. if(z(i,j).gt.0.d0) then z(i,j) = log(z(i,j)) else z(i,j) = -5.d0 endif else -C sombrero function +c sombrero function r = sqrt(xx*xx + yy*yy) z(i,j) = exp(-r*r) * cos(2.0d0*PI*r) endif @@ -116,25 +116,25 @@ & 'bcdmnstuv','z axis', 0.0d0, 0) call plcol0(2) if(ifshade.eq.0) then -C diffuse light surface plot +c diffuse light surface plot call cmap1_init(1) call plsurf3d(x, y, z, xpts, ypts, & 0, & clevel, 0, xdim) elseif(ifshade.eq.1) then -C magnitude colored plot +c magnitude colored plot call cmap1_init(0) call plsurf3d(x, y, z, xpts, ypts, & MAG_COLOR, & clevel, 0, xdim) elseif(ifshade.eq.2) then -C magnitude colored plot with faceted squares +c magnitude colored plot with faceted squares call cmap1_init(0) call plsurf3d(x, y, z, xpts, ypts, & ior(MAG_COLOR, FACETED), & clevel, 0, xdim) elseif(ifshade.eq.3) then -C magnitude colored plot with contours +c magnitude colored plot with contours call cmap1_init(0) call plsurf3d(x, y, z, xpts, ypts, & ior(MAG_COLOR, ior(SURF_CONT, BASE_CONT)), @@ -147,50 +147,50 @@ call plend end -C---------------------------------------------------------------------------- +c---------------------------------------------------------------------------- subroutine cmap1_init(gray) -C For gray.eq.1, basic grayscale variation from half-dark -C to light. Otherwise, hue variations around the front of the -C colour wheel from blue to green to red with constant lightness -C and saturation. +c For gray.eq.1, basic grayscale variation from half-dark +c to light. Otherwise, hue variations around the front of the +c colour wheel from blue to green to red with constant lightness +c and saturation. implicit none integer gray real*8 i(0:1), h(0:1), l(0:1), s(0:1) integer rev(0:1) -C left boundary +c left boundary i(0) = 0.d0 -C right boundary +c right boundary i(1) = 1.d0 if (gray.eq.1) then -C hue -- low: red (arbitrary if s=0) +c hue -- low: red (arbitrary if s=0) h(0) = 0.0d0 -C hue -- high: red (arbitrary if s=0) +c hue -- high: red (arbitrary if s=0) h(1) = 0.0d0 -C lightness -- low: half-dark +c lightness -- low: half-dark l(0) = 0.5d0 -C lightness -- high: light +c lightness -- high: light l(1) = 1.0d0 -C minimum saturation +c minimum saturation s(0) = 0.0d0 -C minimum saturation +c minimum saturation s(1) = 0.0d0 else -C This combination of hues ranges from blue to cyan to green to yellow -C to red (front of colour wheel) with constant lightness = 0.6 -C and saturation = 0.8. +c This combination of hues ranges from blue to cyan to green to yellow +c to red (front of colour wheel) with constant lightness = 0.6 +c and saturation = 0.8. -C hue -- low: blue +c hue -- low: blue h(0) = 240.d0 -C hue -- high: red +c hue -- high: red h(1) = 0.0d0 -C lightness -- low: +c lightness -- low: l(0) = 0.6d0 -C lightness -- high: +c lightness -- high: l(1) = 0.6d0 -C saturation +c saturation s(0) = 0.8d0 -C minimum saturation +c minimum saturation s(1) = 0.8d0 endif rev(0) = 0 @@ -199,9 +199,9 @@ call plscmap1l(0, 2, i, h, l, s, rev) end -C---------------------------------------------------------------------------- -C Subroutine a2mnmx -C Minimum and the maximum elements of a 2-d array. +c---------------------------------------------------------------------------- +c Subroutine a2mnmx +c Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) implicit none Modified: trunk/examples/f77/x09f.fm4 =================================================================== --- trunk/examples/f77/x09f.fm4 2009-02-09 21:32:31 UTC (rev 9483) +++ trunk/examples/f77/x09f.fm4 2009-02-09 22:56:38 UTC (rev 9484) @@ -1,32 +1,32 @@ -C $Id$ -C Contour plot demo. -C -C Copyright (C) 2004 Alan W. Irwin -C -C This file is part of PLplot. -C -C PLplot is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Library Public License as -C published by the Free Software Foundation; either version 2 of the -C License, or (at your option) any later version. -C -C PLplot is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU Library General Public License for more details. -C -C You should have received a copy of the GNU Library General Public -C License along with PLplot; if not, write to the Free Software -C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +c $Id$ +c Contour plot demo. +c +c Copyright (C) 2004 Alan W. Irwin +c +c This file is part of PLplot. +c +c PLplot is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Library Public License as +c published by the Free Software Foundation; either version 2 of the +c License, or (at your option) any later version. +c +c PLplot is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU Library General Public License for more details. +c +c You should have received a copy of the GNU Library General Public +c License along with PLplot; if not, write to the Free Software +c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -C Does several contour plots using different coordinate mappings. +c Does several contour plots using different coordinate mappings. implicit none real*8 PI parameter (PI = 3.1415926535897932384d0) integer i, j, nptsx, nptsy, xdim, ydim -C xdim and ydim are the absolute static dimensions. -C nptsx, and nptsy are the (potentially dynamic) defined area of the 2D -C arrays that is actually used. +c xdim and ydim are the absolute static dimensions. +c nptsx, and nptsy are the (potentially dynamic) defined area of the 2D +c arrays that is actually used. parameter (xdim=99, ydim=100, nptsx=35,nptsy=46) real*8 z(xdim, ydim), w(xdim, ydim), clevel(11), @@ -34,14 +34,14 @@ & xg2(xdim, ydim), yg2(xdim, ydim) real*8 tr, xx, yy, argx, argy, distort -CDEC$ ATTRIBUTES DLLIMPORT :: PLPLOT +cDEC$ ATTRIBUTES DLLIMPORT :: PLPLOT common /plplot/ tr(6) data clevel /-1.d0, -0.8d0, -0.6d0, -0.4d0, -0.2d0, & 0.d0, 0.2d0, 0.4d0, 0.6d0 ,0.8d0, 1.d0/ integer PL_PARSE_FULL parameter(PL_PARSE_FULL = 1) -C Process command-line arguments +c Process command-line arguments call plparseopts(PL_PARSE_FULL) tr(1) = 2.d0/dble(nptsx-1) @@ -51,7 +51,7 @@ tr(5) = 2.d0/dble(nptsy-1) tr(6) = -1.0d0 -C Calculate the data matrices. +c Calculate the data matrices. do i=1,nptsx xx = dble(i-1-(nptsx/2))/dble (nptsx/2) do j=1,nptsy @@ -61,7 +61,7 @@ enddo enddo -C Build the 1-d coord arrays. +c Build the 1-d coord arrays. distort = 0.4d0 do i=1,nptsx xx = -1.d0 + dble(i-1)*2.d0/dble(nptsx-1) @@ -73,7 +73,7 @@ yg1(j) = yy - distort*cos(0.5d0*PI*yy) enddo -C Build the 2-d coord arrays. +c Build the 2-d coord arrays. do i=1,nptsx xx = -1.d0 + dble(i-1)*2.d0/dble(nptsx-1) argx = 0.5d0*PI*xx @@ -87,7 +87,7 @@ call plinit -C Plot using identity transform +c Plot using identity transform call pl_setcontlabelformat(4,3) call pl_setcontlabelparam(0.006d0, 0.3d0, 0.1d0, 1) call plenv(-1.0d0, 1.0d0, -1.0d0, 1.0d0, 0, 0) @@ -102,7 +102,7 @@ & 'Streamlines of flow') call pl_setcontlabelparam(0.006d0, 0.3d0, 0.1... [truncated message content] |
From: <ai...@us...> - 2009-02-13 18:59:59
|
Revision: 9523 http://plplot.svn.sourceforge.net/plplot/?rev=9523&view=rev Author: airwin Date: 2009-02-13 18:59:53 +0000 (Fri, 13 Feb 2009) Log Message: ----------- As an experiment, try mapping PLUNICODE to 32-bit Fortran integers for the f77 versions of plsfci, plgfci. This approach works for gfortran. If it also works for a variety of other fortran compilers, then we should extend this approach to f95 as well. Modified Paths: -------------- trunk/bindings/f77/scstubs.c trunk/examples/f77/x23f.fm4 Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2009-02-13 09:45:41 UTC (rev 9522) +++ trunk/bindings/f77/scstubs.c 2009-02-13 18:59:53 UTC (rev 9523) @@ -299,15 +299,13 @@ c_plgfam(fam, num, bmax); } -/* Note: Fortran does not have unsigned integers so we need to use a - * 64 bit signed integer which corresponds to a fortran integer*8 - * in order to contain the number. */ +/* Note: Fortran does not distinguish between unsigned and signed integers + so the 32-bit PLUNICODE can be mapped to 4-byte Fortran integer outside + this routine. */ void -PLGFCI(PLINT64 *pfci) +PLGFCI(PLUNICODE *pfci) { - PLUNICODE fci; - c_plgfci(&fci); - *pfci = (PLINT64) fci; + c_plgfci(pfci); } void @@ -775,15 +773,13 @@ c_plsfam(*fam, *num, *bmax); } -/* Note: Fortran does not have unsigned integers so we need to use a - * 64 bit signed integer which corresponds to a fortran integer*8 - * in order to contain the number. */ +/* Note: Fortran does not distinguish between unsigned and signed integers + so the 32-bit PLUNICODE can be mapped to 4-byte Fortran integer outside + this routine. */ void -PLSFCI(PLINT64 *fci) +PLSFCI(PLUNICODE *fci) { - PLUNICODE f; - f = (PLUNICODE) (*fci & 0xffffffff); - c_plsfci(f); + c_plsfci(*fci); } void Modified: trunk/examples/f77/x23f.fm4 =================================================================== --- trunk/examples/f77/x23f.fm4 2009-02-13 09:45:41 UTC (rev 9522) +++ trunk/examples/f77/x23f.fm4 2009-02-13 18:59:53 UTC (rev 9523) @@ -31,7 +31,7 @@ real*8 chardef, charht, deltax, deltay, x, y integer i, j, page, length, slice character*20 cmdString - integer*8 fci_old + integer*4 fci_old integer ifamily, istyle, iweight real*8 dy integer family_index, style_index, weight_index @@ -45,7 +45,7 @@ c c Displays Greek letters and mathematically interesting Unicode ranges c - integer fci_combinations + integer fci_combinations parameter(fci_combinations = 30) character*5 greek(48) @@ -56,7 +56,7 @@ integer nxcells(11) integer nycells(11) integer offset(11) - integer*8 fci(fci_combinations) + integer*4 fci(fci_combinations) character*11 family(5) character*8 style(3) character*7 weight(2) @@ -194,37 +194,40 @@ &0, &0 / +c drop the leading '8' marker for FCI because some compilers (gfortran) +c have an implementation error (integer overflow error) for that case, and +c the marker is not needed, in any case, for calls to plsfci. data (fci(i), i=1,fci_combinations) / - & z'80000000', - & z'80000001', - & z'80000002', - & z'80000003', - & z'80000004', - & z'80000010', - & z'80000011', - & z'80000012', - & z'80000013', - & z'80000014', - & z'80000020', - & z'80000021', - & z'80000022', - & z'80000023', - & z'80000024', - & z'80000100', - & z'80000101', - & z'80000102', - & z'80000103', - & z'80000104', - & z'80000110', - & z'80000111', - & z'80000112', - & z'80000113', - & z'80000114', - & z'80000120', - & z'80000121', - & z'80000122', - & z'80000123', - & z'80000124' / + & z'00000000', + & z'00000001', + & z'00000002', + & z'00000003', + & z'00000004', + & z'00000010', + & z'00000011', + & z'00000012', + & z'00000013', + & z'00000014', + & z'00000020', + & z'00000021', + & z'00000022', + & z'00000023', + & z'00000024', + & z'00000100', + & z'00000101', + & z'00000102', + & z'00000103', + & z'00000104', + & z'00000110', + & z'00000111', + & z'00000112', + & z'00000113', + & z'00000114', + & z'00000120', + & z'00000121', + & z'00000122', + & z'00000123', + & z'00000124' / data (family(i), i=1,5) / & "sans-serif", @@ -367,7 +370,8 @@ & trim(weight(weight_index+1))//': '// & 'The quick brown fox jumps over the lazy dog' elseif(page == 13) then - write(string,'(a,"#<0x",z8,">",a)') +C Note, must put in missing FCI marker for this particular case. + write(string,'(a,"#<0x8",z7.7,">",a)') & 'Page 14, '//trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': ', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-18 23:57:37
|
Revision: 9552 http://plplot.svn.sourceforge.net/plplot/?rev=9552&view=rev Author: airwin Date: 2009-02-18 22:58:12 +0000 (Wed, 18 Feb 2009) Log Message: ----------- Add broken-down time as an option to specify the offsets in configqsas. Modified Paths: -------------- trunk/lib/qsastime/README.qsastime_API trunk/lib/qsastime/qsastime.c trunk/lib/qsastime/qsastime.h trunk/src/plbox.c Modified: trunk/lib/qsastime/README.qsastime_API =================================================================== --- trunk/lib/qsastime/README.qsastime_API 2009-02-18 20:36:22 UTC (rev 9551) +++ trunk/lib/qsastime/README.qsastime_API 2009-02-18 22:58:12 UTC (rev 9552) @@ -4,12 +4,19 @@ ========================= -void configqsas(double scale, double offset1, double offset2, int ccontrol); +void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec); +Within this routine if ifbtime_offset is false, then the broken-down +time arguments are ignored. If ifbtime_offset is true, then the input +offset1 and offset2 values are ignored, and instead, the broken-down +time values are used to calculate offset1 and offset2 with the help of +an internal call to setFromUT. + This routine allocates memory for the global qsasconfig pointer to a QSASConfig struct. It initializes the four variables encapsulated -in QSASConfig with scale, offset1, offset2, and ccontrol. Further details -of the meaning of these four variables is contained in qsastime.h. +in QSASConfig with scale, offset1, offset2, and ccontrol. Further +details of the meaning of these four variables is contained in +qsastime.h. Although this API gives the user a large degree of flexibility in choosing the transformation between broken-down time and continuous time, a number of @@ -101,12 +108,13 @@ double sec, double *ctime); Determine continuous time (ctime). Wraps the existing internal (not -visible by default) setFromUT to use the four global variables discussed above in the -transformation from broken-down-time to ctime. Note, because of the -transformation implied by the four variables mentioned above, the ctime -result can be stored in just a double assuming the user has picked a -reasonable epoch that is not so distant from his plotted range of times that -it causes a noticable loss of numerical precision. +visible by default) setFromUT to use the four global variables +discussed above in the transformation from broken-down-time to ctime. +Note, because of the transformation implied by the four variables +mentioned above, the ctime result can be stored in just a double +assuming the user has picked a reasonable epoch that is not so distant +from his plotted range of times that it causes a noticable loss of +numerical precision. ========================= Modified: trunk/lib/qsastime/qsastime.c =================================================================== --- trunk/lib/qsastime/qsastime.c 2009-02-18 20:36:22 UTC (rev 9551) +++ trunk/lib/qsastime/qsastime.c 2009-02-18 22:58:12 UTC (rev 9552) @@ -859,10 +859,12 @@ return posn; } -void configqsas(double scale, double offset1, double offset2, int ccontrol) +void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec) { /* Configure the transformation between continuous time and broken-down time that is used for ctimeqsas, btimeqsas, and strfqsas. */ + int forceJulian, ret; + MJDtime MJD_value, *MJD=&MJD_value; /* Allocate memory for qsasconfig if that hasn't been done by a previous call. */ @@ -875,6 +877,19 @@ } if(scale != 0.) { + if(ifbtime_offset) { + if(ccontrol & 0x1) + forceJulian = 1; + else + forceJulian = -1; + ret = setFromUT(year, month, day, hour, min, sec, MJD, forceJulian); + if(ret) { + fprintf(stderr, "configqsas: some problem with broken-down arguments\n"); + exit(EXIT_FAILURE); + } + offset1 = (double)MJD->base_day; + offset2 = MJD->time_sec/(double)SecInDay; + } qsasconfig->scale = scale; qsasconfig->offset1 = offset1; qsasconfig->offset2 = offset2; @@ -884,7 +899,7 @@ default is continuous time (stored as a double) is seconds since 1970-01-01 while broken-down time is Gregorian with no other additional corrections. */ - qsasconfig->scale = 1./86400.; + qsasconfig->scale = 1./(double)SecInDay; qsasconfig->offset1 = (double) MJD_1970; qsasconfig->offset2 = 0.; qsasconfig->ccontrol = 0x0; Modified: trunk/lib/qsastime/qsastime.h =================================================================== --- trunk/lib/qsastime/qsastime.h 2009-02-18 20:36:22 UTC (rev 9551) +++ trunk/lib/qsastime/qsastime.h 2009-02-18 22:58:12 UTC (rev 9552) @@ -101,7 +101,7 @@ QSASTIMEDLLIMPEXP_DATA(QSASConfig) *qsasconfig; /* externally accessible functions */ -QSASTIMEDLLIMPEXP void configqsas(double scale, double offset1, double offset2, int ccontrol); +QSASTIMEDLLIMPEXP void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec); QSASTIMEDLLIMPEXP void closeqsas(void); QSASTIMEDLLIMPEXP int ctimeqsas(int year, int month, int day, int hour, int min, double sec, double * ctime); QSASTIMEDLLIMPEXP void btimeqsas(int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime); Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2009-02-18 20:36:22 UTC (rev 9551) +++ trunk/src/plbox.c 2009-02-18 22:58:12 UTC (rev 9552) @@ -1252,7 +1252,7 @@ for (tn = tp; BETW(tn, vpwxmi, vpwxma); tn += xtick1) { if (ldx) { t = (double) tn; - configqsas(0., 0., 0., 0x0); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0.); ctimeqsas(1970,0,1,0,0,t,&tm); strfqsas(string, STRING_LEN, timefmt, tm); closeqsas(); @@ -1303,7 +1303,7 @@ for (tn = tp; BETW(tn, vpwymi, vpwyma); tn += ytick1) { if (ldy) { t = (double) tn; - configqsas(0., 0., 0., 0x0); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0.); ctimeqsas(1970,0,1,0,0,t,&tm); strfqsas(string, STRING_LEN, timefmt, tm); closeqsas(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-20 19:43:17
|
Revision: 9564 http://plplot.svn.sourceforge.net/plplot/?rev=9564&view=rev Author: airwin Date: 2009-02-20 19:43:15 +0000 (Fri, 20 Feb 2009) Log Message: ----------- Convert to a thread-safe libqsastime where qsasconfig is carried as an extra argument to configqsas, closeqsas, btimeqsas, ctimeqsas, and strfqsas rather than as a global library variable. Thanks to Andrew Ross for this suggestiong for making libqsastime thread safe. Modified Paths: -------------- trunk/lib/qsastime/README.qsastime_API trunk/lib/qsastime/qsastime.c trunk/lib/qsastime/qsastime.h trunk/src/plbox.c Modified: trunk/lib/qsastime/README.qsastime_API =================================================================== --- trunk/lib/qsastime/README.qsastime_API 2009-02-20 19:38:15 UTC (rev 9563) +++ trunk/lib/qsastime/README.qsastime_API 2009-02-20 19:43:15 UTC (rev 9564) @@ -1,10 +1,11 @@ -The desired API for libqsastime should consist of just five functions that -are actually publicly visible. The names of these five functions are -subject to change, but I hope we can finalize those names shortly. +The desired API for libqsastime should consist of just five functions +that are actually publicly visible. ========================= -void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec); +void configqsas(double scale, double offset1, double offset2, int +ccontrol, int ifbtime_offset, int year, int month, int day, int hour, +int min, double sec, QSASCONFIG **qsasconfig); Within this routine if ifbtime_offset is false, then the broken-down time arguments are ignored. If ifbtime_offset is true, then the input @@ -12,17 +13,20 @@ time values are used to calculate offset1 and offset2 with the help of an internal call to setFromUT. -This routine allocates memory for the global qsasconfig pointer to -a QSASConfig struct. It initializes the four variables encapsulated -in QSASConfig with scale, offset1, offset2, and ccontrol. Further -details of the meaning of these four variables is contained in -qsastime.h. +If *qsasconfig is NULL, this routine allocates memory for a QSASCONFIG +struct and points *qsaconfig to that memory location. It initializes +the four variables encapsulated in that struct with scale, offset1, +offset2, and ccontrol. Further details of the meaning of these four +variables is contained in qsastime.h. The special pointer to a +pointer QSASCONFIG argument is required so that the external pointer +can be changed if/when the memory is allocated. -Although this API gives the user a large degree of flexibility in choosing -the transformation between broken-down time and continuous time, a number of -combinations of offset1, offset2, scale, and ccontrol are documented -below for some common time system transformations to guide the user. -(Some of these are currently just placeholders.) +Although this API gives the user a large degree of flexibility in +choosing the transformation between broken-down time and continuous +time, a number of combinations of offset1, offset2, scale, and +ccontrol are documented below for some common time system +transformations to guide the user. (Some of these are currently just +placeholders.) Broken- Contin- offset1 offset2 scale correction Notes down uous @@ -39,76 +43,87 @@ 1. These offset1, offset2, scale, and correction values are the library default if the user does not call time_config at all. -2. We define civil time as the civil time on the prime meridian. (The user -is responsible for converting their local time to civil time using their -locale data for time zone and daylight savings time adjustment). Currently, -our civil time corresponds to UTC as defined in note 3. +2. We define civil time as the civil time on the prime meridian. (The +user is responsible for converting their local time to civil time +using their locale data for time zone and daylight savings time +adjustment). Currently, our civil time corresponds to UTC as defined +in note 3. -3. We use the file at http://maia.usno.navy.mil/ser7/tai-utc.dat to define -the relationship between UTC and TAI (and thus TT) for correction = 1. +3. We use the file at http://maia.usno.navy.mil/ser7/tai-utc.dat to +define the relationship between UTC and TAI (and thus TT) for +correction = 1. For epochs prior to the starting date of that file (1961-01-01 = JD -2437300.5 UTC) we assume the same TAI-UTC offset of 1.422818 seconds as for -the starting date of that file. This assumption of no variation in the -earth rotation rate prior to 1961 is obviously not correct so that the TT -derived from our code will not be reliable prior to that date. That is, if -you use GMT (a historical backwards extension of UTC corresponding to civil -time for the prime meridian) for broken down time prior to 1961, the TT -result you will get will not produce a good approximation to the historical -ephemeris time that is the correct backwards extension of TT, see -http://en.wikipedia.org/wiki/Ephemeris_time. +2437300.5 UTC) we assume the same TAI-UTC offset of 1.422818 seconds +as for the starting date of that file. This assumption of no +variation in the earth rotation rate prior to 1961 is obviously not +correct so that the TT derived from our code will not be reliable +prior to that date. That is, if you use GMT (a historical backwards +extension of UTC corresponding to civil time for the prime meridian) +for broken down time prior to 1961, the TT result you will get will +not produce a good approximation to the historical ephemeris time that +is the correct backwards extension of TT, see +http://en.wikipedia.org/wiki/Ephemeris_time. -For epochs after the ending date of that file (currently 2009-01-01 = JD -2454832.5 UTC) we assume the same TAI-UTC offset (currently 34 seconds) as -for the ending date of that file, i.e., we assume no leap seconds after the -ending date of the file. Insertion of leap seconds cannot be predicted years -in advance (because future predictions of the earth rotation rate are not -reliable on such time scales) so the transformation between civil time (UTC) -and TT cannot be known years in advance. However, the approximation of -assuming no leap seconds after the end of the file should be correct on time -scales less than roughly a year so when a decision is made in advance to -insert an official leap second, there should be plenty of time for that -decision to propagate to http://maia.usno.navy.mil/ser7/tai-utc.dat and -ultimately our code releases. Thus, so long as we make releases on a timely -basis, our calculation of TT for current epochs should always be reliable. +For epochs after the ending date of that file (currently 2009-01-01 = +JD 2454832.5 UTC) we assume the same TAI-UTC offset (currently 34 +seconds) as for the ending date of that file, i.e., we assume no leap +seconds after the ending date of the file. Insertion of leap seconds +cannot be predicted years in advance (because future predictions of +the earth rotation rate are not reliable on such time scales) so the +transformation between civil time (UTC) and TT cannot be known years +in advance. However, the approximation of assuming no leap seconds +after the end of the file should be correct on time scales less than +roughly a year so when a decision is made in advance to insert an +official leap second, there should be plenty of time for that decision +to propagate to http://maia.usno.navy.mil/ser7/tai-utc.dat and +ultimately our code releases. Thus, so long as we make releases on a +timely basis, our calculation of TT for current epochs should always +be reliable. -2. I haven't checked the code yet, but I assume this relationship holds for -all transformations between broken-down time and continuous time in MJD -when the broken-down time and continuous time are defined on the same -continuous time scale (TT in this case). All other relationships are -derived from the known offsets with respect to TT and differences between -MJD epochs and native (TT, TAI, etc.) epochs. +2. I haven't checked the code yet, but I assume this relationship +holds for all transformations between broken-down time and continuous +time in MJD when the broken-down time and continuous time are defined +on the same continuous time scale (TT in this case). All other +relationships are derived from the known offsets with respect to TT +and differences between MJD epochs and native (TT, TAI, etc.) epochs. -3. Offset derived from definition TT = TAI + 32.184 s = TAI + 0.0003725 d +3. Offset derived from definition TT = TAI + 32.184 s = TAI + +0.0003725 d -4. Continuous times (e.g., TT) without further designation are in seconds -since the native (e.g., TT) epoch. NEEDS WORK to figure out offset. +4. Continuous times (e.g., TT) without further designation are in +seconds since the native (e.g., TT) epoch. NEEDS WORK to figure out +offset. 5. the POSIX time standard of seconds since the Unix epoch is actually -discontinuous (see remarks in http://en.wikipedia.org/wiki/Unix_Time). So -our "Unix (TAI)" continuous time scale (NOT YET IN THE TABLE) corresponds to -the continuous "International Atomic Time-based variant" discussed in the -above article. NEEDS FURTHER INVESTIGATION. +discontinuous (see remarks in http://en.wikipedia.org/wiki/Unix_Time). +So our "Unix (TAI)" continuous time scale (NOT YET IN THE TABLE) +corresponds to the continuous "International Atomic Time-based +variant" discussed in the above article. NEEDS FURTHER INVESTIGATION. -dTT/dTCG = 1-LG, where LG = 6.969290134D-10, -IAU Resolution B1.9 Re-definition of Terrestrial Time TT, +dTT/dTCG = 1-LG, where LG = 6.969290134D-10, IAU Resolution B1.9 +Re-definition of Terrestrial Time TT, http://syrte.obspm.fr/IAU_resolutions/Resol-UAI.htm -Time ephemeris reference is Irwin and -Fukushima, 1999, http://adsabs.harvard.edu/full/1999A&A...348..642I). +Time ephemeris reference is Irwin and Fukushima, 1999, +http://adsabs.harvard.edu/full/1999A&A...348..642I). ========================= -void closeqsas (void): +void closeqsas (QSASCONFIG **qsasconfig): -Closes library by freeing memory allocated for qsasconfig. +This routine closes the library by freeing memory allocated for +qsasconfig if *qsaconfig is non-NULL and sets *qsasconfig to NULL. +The special pointer to a pointer QSASCONFIG argument is required in +order to change the external pointer. + ========================= void ctimeqsas (int year, int month, int day, int hour, int min, -double sec, double *ctime); +double sec, double *ctime, QSASCONFIG *qsasconfig); Determine continuous time (ctime). Wraps the existing internal (not -visible by default) setFromUT to use the four global variables +visible by default) setFromUT to use the four variables in qsasconfig discussed above in the transformation from broken-down-time to ctime. Note, because of the transformation implied by the four variables mentioned above, the ctime result can be stored in just a double @@ -119,26 +134,28 @@ ========================= void btimeqsas (int *year, int *month, int *day, int *hour, int *min, -double *sec, double ctime); +double *sec, double ctime, QSASCONFIG *qsasconfig); -Determine broken-down time (btime). This is the inverse of ctimeqsas. It -wraps the existing internal (not visible by default) breakDownMJD to use the -four global variables discussed above in the transformation from ctime to -btime. Note, because of the transformation implied by the four variables -mentioned above, the input ctime can be just a double assuming the user has -picked a reasonable epoch that is not so distant from his plotted range of -times that it causes a noticable loss of numerical precision. +Determine broken-down time (btime). This is the inverse of ctimeqsas. +It wraps the existing internal (not visible by default) breakDownMJD +to use the four variables in qsasconfig discussed above in the +transformation from ctime to btime. Note, because of the +transformation implied by the four variables, the input ctime can be +just a double assuming the user has picked a reasonable epoch that is +not so distant from his plotted range of times that it causes a +noticable loss of numerical precision. ========================= -size_t strfqsas (char * buf, size_t len, const char * format, const -double ctime); +size_t strfqsas (char * buf, size_t len, const char * format, const +double ctime, QSASCONFIG *qsasconfig); -This wraps the existing internal (not visible by default) strfMJD to use the -four global variables discussed above in the transformation from ctime to -btime. Note, because of the transformation implied by the four variables -mentioned above, the input ctime can be just a double assuming the user has -picked a reasonable epoch that is not so distant from his plotted range of -times that it causes a noticable loss of numerical precision. +This wraps the existing internal (not visible by default) strfMJD to +use the four variables in qsasconfig discussed above in the +transformation from ctime to btime. Note, because of the +transformation implied by the four variables, the input ctime can be +just a double assuming the user has picked a reasonable epoch that is +not so distant from his plotted range of times that it causes a +noticable loss of numerical precision. ========================= Modified: trunk/lib/qsastime/qsastime.c =================================================================== --- trunk/lib/qsastime/qsastime.c 2009-02-20 19:38:15 UTC (rev 9563) +++ trunk/lib/qsastime/qsastime.c 2009-02-20 19:43:15 UTC (rev 9564) @@ -859,18 +859,18 @@ return posn; } -void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec) +void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec, QSASConfig **qsasconfig) { /* Configure the transformation between continuous time and broken-down time that is used for ctimeqsas, btimeqsas, and strfqsas. */ int forceJulian, ret; MJDtime MJD_value, *MJD=&MJD_value; - /* Allocate memory for qsasconfig if that hasn't been done by a + /* Allocate memory for *qsasconfig if that hasn't been done by a previous call. */ - if(qsasconfig == NULL) { - qsasconfig = (QSASConfig *) malloc((size_t) sizeof(QSASConfig)); - if (qsasconfig == NULL) { + if(*qsasconfig == NULL) { + *qsasconfig = (QSASConfig *) malloc((size_t) sizeof(QSASConfig)); + if (*qsasconfig == NULL) { fprintf(stderr, "configqsas: out of memory\n"); exit(EXIT_FAILURE); } @@ -890,32 +890,32 @@ offset1 = (double)MJD->base_day; offset2 = MJD->time_sec/(double)SecInDay; } - qsasconfig->scale = scale; - qsasconfig->offset1 = offset1; - qsasconfig->offset2 = offset2; - qsasconfig->ccontrol = ccontrol; + (*qsasconfig)->scale = scale; + (*qsasconfig)->offset1 = offset1; + (*qsasconfig)->offset2 = offset2; + (*qsasconfig)->ccontrol = ccontrol; } else { /* if scale is 0., then use default values. Currently, that default is continuous time (stored as a double) is seconds since 1970-01-01 while broken-down time is Gregorian with no other additional corrections. */ - qsasconfig->scale = 1./(double)SecInDay; - qsasconfig->offset1 = (double) MJD_1970; - qsasconfig->offset2 = 0.; - qsasconfig->ccontrol = 0x0; + (*qsasconfig)->scale = 1./(double)SecInDay; + (*qsasconfig)->offset1 = (double) MJD_1970; + (*qsasconfig)->offset2 = 0.; + (*qsasconfig)->ccontrol = 0x0; } } -void closeqsas(void) +void closeqsas(QSASConfig **qsasconfig) { /* Close library if it has been opened. */ - if(qsasconfig != NULL) { - free((void *) qsasconfig); - qsasconfig = NULL; + if(*qsasconfig != NULL) { + free((void *) *qsasconfig); + *qsasconfig = NULL; } } -int ctimeqsas(int year, int month, int day, int hour, int min, double sec, double * ctime){ +int ctimeqsas(int year, int month, int day, int hour, int min, double sec, double * ctime, QSASConfig *qsasconfig){ MJDtime MJD_value, *MJD=&MJD_value; int forceJulian, ret; double integral_offset1, integral_offset2, integral_scaled_ctime; @@ -938,7 +938,7 @@ } -void btimeqsas(int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime){ +void btimeqsas(int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime, QSASConfig *qsasconfig){ MJDtime MJD_value, *MJD=&MJD_value; int forceJulian; double integral_offset1, integral_offset2, integral_scaled_ctime; @@ -959,7 +959,8 @@ breakDownMJD(year, month, day, hour, min, sec, MJD, forceJulian); } -size_t strfqsas(char * buf, size_t len, const char *format, double ctime){ +size_t strfqsas(char * buf, size_t len, const char *format, double ctime, QSASConfig *qsasconfig) +{ MJDtime MJD_value, *MJD=&MJD_value; int forceJulian; double integral_offset1, integral_offset2, integral_scaled_ctime; Modified: trunk/lib/qsastime/qsastime.h =================================================================== --- trunk/lib/qsastime/qsastime.h 2009-02-20 19:38:15 UTC (rev 9563) +++ trunk/lib/qsastime/qsastime.h 2009-02-20 19:43:15 UTC (rev 9564) @@ -98,13 +98,15 @@ }QSASConfig; -QSASTIMEDLLIMPEXP_DATA(QSASConfig) *qsasconfig; - /* externally accessible functions */ -QSASTIMEDLLIMPEXP void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec); -QSASTIMEDLLIMPEXP void closeqsas(void); -QSASTIMEDLLIMPEXP int ctimeqsas(int year, int month, int day, int hour, int min, double sec, double * ctime); -QSASTIMEDLLIMPEXP void btimeqsas(int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime); -QSASTIMEDLLIMPEXP size_t strfqsas(char * buf, size_t len, const char *format, double ctime); +QSASTIMEDLLIMPEXP void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec, QSASConfig **qsasconfig); +QSASTIMEDLLIMPEXP void closeqsas(QSASConfig **qsasconfig); + +QSASTIMEDLLIMPEXP int ctimeqsas(int year, int month, int day, int hour, int min, double sec, double * ctime, QSASConfig *qsasconfig); + +QSASTIMEDLLIMPEXP void btimeqsas(int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime, QSASConfig *qsasconfig); + +QSASTIMEDLLIMPEXP size_t strfqsas(char * buf, size_t len, const char *format, double ctime, QSASConfig *qsasconfig); + #endif Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2009-02-20 19:38:15 UTC (rev 9563) +++ trunk/src/plbox.c 2009-02-20 19:43:15 UTC (rev 9564) @@ -1206,6 +1206,7 @@ const char *timefmt; double tm; double t; + QSASConfig *qsasconfig = NULL; /* Set plot options from input */ @@ -1252,10 +1253,10 @@ for (tn = tp; BETW(tn, vpwxmi, vpwxma); tn += xtick1) { if (ldx) { t = (double) tn; - configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0.); - ctimeqsas(1970,0,1,0,0,t,&tm); - strfqsas(string, STRING_LEN, timefmt, tm); - closeqsas(); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &qsasconfig); + ctimeqsas(1970,0,1,0,0,t,&tm, qsasconfig); + strfqsas(string, STRING_LEN, timefmt, tm, qsasconfig); + closeqsas(&qsasconfig); } else { plform(tn, xscale, xprec, string, STRING_LEN, llx, lfx); @@ -1303,10 +1304,10 @@ for (tn = tp; BETW(tn, vpwymi, vpwyma); tn += ytick1) { if (ldy) { t = (double) tn; - configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0.); - ctimeqsas(1970,0,1,0,0,t,&tm); - strfqsas(string, STRING_LEN, timefmt, tm); - closeqsas(); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &qsasconfig); + ctimeqsas(1970,0,1,0,0,t,&tm, qsasconfig); + strfqsas(string, STRING_LEN, timefmt, tm, qsasconfig); + closeqsas(&qsasconfig); } else { plform(tn, yscale, yprec, string, STRING_LEN, lly, lfy); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-20 21:18:37
|
Revision: 9565 http://plplot.svn.sourceforge.net/plplot/?rev=9565&view=rev Author: airwin Date: 2009-02-20 21:18:33 +0000 (Fri, 20 Feb 2009) Log Message: ----------- Add a pointer to a QSASConfig in plstrm.h. This pointer is currently only used in plbox.c, but that is about to change. Modified Paths: -------------- trunk/bindings/f77/CMakeLists.txt trunk/bindings/f95/CMakeLists.txt trunk/bindings/gnome2/lib/CMakeLists.txt trunk/bindings/gnome2/python/CMakeLists.txt trunk/bindings/java/CMakeLists.txt trunk/bindings/lua/CMakeLists.txt trunk/bindings/ocaml/myocamlbuild.ml.cmake trunk/bindings/python/CMakeLists.txt trunk/bindings/tcl/CMakeLists.txt trunk/bindings/wxwidgets/CMakeLists.txt trunk/drivers/CMakeLists.txt trunk/examples/ada/CMakeLists.txt trunk/examples/c/CMakeLists.txt trunk/examples/c++/CMakeLists.txt trunk/examples/f77/CMakeLists.txt trunk/examples/f95/CMakeLists.txt trunk/include/plstrm.h trunk/src/plbox.c trunk/utils/CMakeLists.txt Modified: trunk/bindings/f77/CMakeLists.txt =================================================================== --- trunk/bindings/f77/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/f77/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -67,6 +67,7 @@ # 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 Modified: trunk/bindings/f95/CMakeLists.txt =================================================================== --- trunk/bindings/f95/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/f95/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -23,6 +23,7 @@ # Set the include path include_directories( ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} Modified: trunk/bindings/gnome2/lib/CMakeLists.txt =================================================================== --- trunk/bindings/gnome2/lib/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/gnome2/lib/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -45,6 +45,7 @@ # Set the include path include_directories( ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ) Modified: trunk/bindings/gnome2/python/CMakeLists.txt =================================================================== --- trunk/bindings/gnome2/python/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/gnome2/python/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -111,6 +111,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${PYTHON_INCLUDE_PATH} Modified: trunk/bindings/java/CMakeLists.txt =================================================================== --- trunk/bindings/java/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/java/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -104,6 +104,7 @@ set(java_interface_INCLUDE_PATHS ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include Modified: trunk/bindings/lua/CMakeLists.txt =================================================================== --- trunk/bindings/lua/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/lua/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -23,6 +23,7 @@ # This is currently the include list for swig. set(lua_interface_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} Modified: trunk/bindings/ocaml/myocamlbuild.ml.cmake =================================================================== --- trunk/bindings/ocaml/myocamlbuild.ml.cmake 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/ocaml/myocamlbuild.ml.cmake 2009-02-20 21:18:33 UTC (rev 9565) @@ -29,6 +29,7 @@ (* gcc needs to know where to find the needed #includes *) flag ["c"; "compile"] (S[A"-ccopt"; A"-I@SOURCE_DIR@/include"; + A"-ccopt"; A"-I@SOURCE_DIR@/lib/qsastime"; A"-ccopt"; A"-I@BUILD_DIR@/include"] ); (* Custom tag for OCaml bytecode *) Modified: trunk/bindings/python/CMakeLists.txt =================================================================== --- trunk/bindings/python/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/python/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -32,6 +32,7 @@ # the Python headers. Not particular pretty... set(python_interface_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} Modified: trunk/bindings/tcl/CMakeLists.txt =================================================================== --- trunk/bindings/tcl/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/tcl/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -29,6 +29,7 @@ include_directories( ${TCL_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include Modified: trunk/bindings/wxwidgets/CMakeLists.txt =================================================================== --- trunk/bindings/wxwidgets/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/bindings/wxwidgets/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -39,6 +39,7 @@ # Set the include path include_directories( ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_SOURCE_DIR}/bindings/c++ ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include Modified: trunk/drivers/CMakeLists.txt =================================================================== --- trunk/drivers/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/drivers/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -32,6 +32,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ) Modified: trunk/examples/ada/CMakeLists.txt =================================================================== --- trunk/examples/ada/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/examples/ada/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -87,6 +87,7 @@ remove_definitions("-DHAVE_CONFIG_H") include_directories( ${CMAKE_BINARY_DIR}/examples/ada + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR}/bindings/ada ) endif(BUILD_TEST) Modified: trunk/examples/c/CMakeLists.txt =================================================================== --- trunk/examples/c/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/examples/c/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -60,7 +60,11 @@ if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") - include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) + include_directories( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime + ${CMAKE_BINARY_DIR}/include + ) endif(BUILD_TEST) foreach(STRING_INDEX ${c_STRING_INDICES}) set(c_SRCS ${c_SRCS} x${STRING_INDEX}c.c) Modified: trunk/examples/c++/CMakeLists.txt =================================================================== --- trunk/examples/c++/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/examples/c++/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -63,6 +63,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/bindings/c++ ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR}/include ) endif(BUILD_TEST) Modified: trunk/examples/f77/CMakeLists.txt =================================================================== --- trunk/examples/f77/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/examples/f77/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -95,7 +95,11 @@ if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") - include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) + include_directories( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime + ${CMAKE_BINARY_DIR}/include + ) endif(BUILD_TEST) foreach(STRING_INDEX ${f77_STRING_INDICES}) if(BUILD_TEST) Modified: trunk/examples/f95/CMakeLists.txt =================================================================== --- trunk/examples/f95/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/examples/f95/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -67,7 +67,10 @@ ) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc PROPERTIES GENERATED ON) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/lib/qsastime + ) if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") Modified: trunk/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/include/plstrm.h 2009-02-20 21:18:33 UTC (rev 9565) @@ -30,6 +30,7 @@ #include "disptab.h" #include "pldll.h" +#include "qsastime.h" /*--------------------------------------------------------------------------*\ * Define the PLDev data structure. @@ -478,6 +479,15 @@ * for hexpower = 4-6 so there is room for expansion of this scheme into more * font attributes if required. (hexpower = 7 is reserved for the 0x8 marker * of the FCI.) + * + **************************************************************************** + * + * Time related variable + * + * qsasconfig is a pointer to a struct that keeps track of the details + * of the transformation between broken-down and continuous time used + * in the qsastime library. + * \*--------------------------------------------------------------------------*/ #define PL_MAX_CMAP1CP 256 @@ -711,7 +721,12 @@ */ void *psdoc; + /* pointer to a struct that keeps track of the details of the + transformation between broken-down and continuous time used in + the qsastime library. */ + QSASConfig *qsasconfig; + } PLStream; /*--------------------------------------------------------------------------*\ Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/src/plbox.c 2009-02-20 21:18:33 UTC (rev 9565) @@ -23,7 +23,6 @@ */ #include "plplotP.h" -#include "qsastime.h" #define STRING_LEN 40 #define FORMAT_LEN 10 @@ -1206,7 +1205,6 @@ const char *timefmt; double tm; double t; - QSASConfig *qsasconfig = NULL; /* Set plot options from input */ @@ -1253,10 +1251,10 @@ for (tn = tp; BETW(tn, vpwxmi, vpwxma); tn += xtick1) { if (ldx) { t = (double) tn; - configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &qsasconfig); - ctimeqsas(1970,0,1,0,0,t,&tm, qsasconfig); - strfqsas(string, STRING_LEN, timefmt, tm, qsasconfig); - closeqsas(&qsasconfig); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &(plsc->qsasconfig)); + ctimeqsas(1970,0,1,0,0,t,&tm, plsc->qsasconfig); + strfqsas(string, STRING_LEN, timefmt, tm, plsc->qsasconfig); + closeqsas(&(plsc->qsasconfig)); } else { plform(tn, xscale, xprec, string, STRING_LEN, llx, lfx); @@ -1304,10 +1302,10 @@ for (tn = tp; BETW(tn, vpwymi, vpwyma); tn += ytick1) { if (ldy) { t = (double) tn; - configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &qsasconfig); - ctimeqsas(1970,0,1,0,0,t,&tm, qsasconfig); - strfqsas(string, STRING_LEN, timefmt, tm, qsasconfig); - closeqsas(&qsasconfig); + configqsas(1./86400., 0., 0., 0x0, 1, 1970, 0, 1, 0, 0, 0., &(plsc->qsasconfig)); + ctimeqsas(1970,0,1,0,0,t,&tm, plsc->qsasconfig); + strfqsas(string, STRING_LEN, timefmt, tm, plsc->qsasconfig); + closeqsas(&(plsc->qsasconfig)); } else { plform(tn, yscale, yprec, string, STRING_LEN, lly, lfy); Modified: trunk/utils/CMakeLists.txt =================================================================== --- trunk/utils/CMakeLists.txt 2009-02-20 19:43:15 UTC (rev 9564) +++ trunk/utils/CMakeLists.txt 2009-02-20 21:18:33 UTC (rev 9565) @@ -21,6 +21,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-02-21 00:30:15
|
Revision: 9567 http://plplot.svn.sourceforge.net/plplot/?rev=9567&view=rev Author: airwin Date: 2009-02-21 00:30:02 +0000 (Sat, 21 Feb 2009) Log Message: ----------- Implement plconfigtime, plbtime, and plctime, the new time API for PLplot. Modified Paths: -------------- trunk/include/plplot.h trunk/src/CMakeLists.txt Added Paths: ----------- trunk/src/pltime.c Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2009-02-20 23:26:02 UTC (rev 9566) +++ trunk/include/plplot.h 2009-02-21 00:30:02 UTC (rev 9567) @@ -490,6 +490,7 @@ #define pladv c_pladv #define plaxes c_plaxes #define plbin c_plbin +#define plbtime c_plbtime #define plbop c_plbop #define plbox c_plbox #define plbox3 c_plbox3 @@ -497,8 +498,10 @@ #define plclear c_plclear #define plcol0 c_plcol0 #define plcol1 c_plcol1 +#define plconfigtime c_plconfigtime #define plcont c_plcont #define plcpstrm c_plcpstrm +#define plctime c_plctime #define plend c_plend #define plend1 c_plend1 #define plenv c_plenv @@ -716,6 +719,10 @@ PLDLLIMPEXP void c_plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt); +/* Calculate broken-down time from continuous time for current stream. */ +PLDLLIMPEXP void +c_plbtime(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime); + /* Start new page. Should only be used with pleop(). */ PLDLLIMPEXP void @@ -754,6 +761,11 @@ PLDLLIMPEXP void c_plcol1(PLFLT col1); +/* Configure transformation between continuous and broken-down time (and + vice versa) for current stream. */ +PLDLLIMPEXP void +c_plconfigtime(PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec); + /* 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. */ @@ -785,7 +797,11 @@ /* Converts input values from relative device coordinates to relative plot */ /* coordinates. */ +/* Calculate continuous time from broken-down time for current stream. */ PLDLLIMPEXP void +c_plctime(PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime); + +PLDLLIMPEXP void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); /* Converts input values from relative plot coordinates to relative */ @@ -1544,7 +1560,7 @@ PLDLLIMPEXP void c_pltext(void); -/* Set the format for date / time labels */ +/* Set the format for date / time labels for current stream. */ PLDLLIMPEXP void c_pltimefmt(const char *fmt); Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-02-20 23:26:02 UTC (rev 9566) +++ trunk/src/CMakeLists.txt 2009-02-21 00:30:02 UTC (rev 9567) @@ -49,6 +49,7 @@ plgridd.c plvect.c mt19937ar.c +pltime.c ) if(LTDL_WIN32) set(plplot${LIB_TAG}_LIB_SRCS ${plplot${LIB_TAG}_LIB_SRCS} ltdl_win32.c) Added: trunk/src/pltime.c =================================================================== --- trunk/src/pltime.c (rev 0) +++ trunk/src/pltime.c 2009-02-21 00:30:02 UTC (rev 9567) @@ -0,0 +1,59 @@ +/* $Id$ + + Routines for interfacing with qsastime library routines. + + 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 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 +*/ + +#include "plplotP.h" + +/* Calculate broken-down time from continuous time for current stream. */ +void +c_plbtime(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime) +{ + btimeqsas(year, month, day, hour, min, sec, ctime, plsc->qsasconfig); +} + +/* Configure transformation between continuous and broken-down time (and + vice versa) for current stream. */ +void +c_plconfigtime(PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec) +{ + configqsas(scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day, hour, min, sec, &(plsc->qsasconfig)); +} + +/* Calculate continuous time from broken-down time for current stream. */ +void +c_plctime(PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime) +{ + ctimeqsas(year, month, day, hour, min, sec, ctime, plsc->qsasconfig); +} + +/* Set format for date / time labels. */ +void +c_pltimefmt(const char *fmt) +{ + if (plsc->timefmt) + free_mem(plsc->timefmt); + + plsc->timefmt = (char *) malloc((size_t) (strlen(fmt)+1)); + strcpy(plsc->timefmt, fmt); + +} + Property changes on: trunk/src/pltime.c ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-02-23 15:54:48
|
Revision: 9586 http://plplot.svn.sourceforge.net/plplot/?rev=9586&view=rev Author: andrewross Date: 2009-02-23 15:54:44 +0000 (Mon, 23 Feb 2009) Log Message: ----------- Initial start on making plplot NaN / Inf aware. There will be more to follow on this. Ensure isnan / isinf macros are defined in plplot.h if they are not defined on the system. Also ensure INFINITY is defined. Remove duplicate definitions of isnan from C/C++ example 21 (now in plplot.h) and from plgridd.c. Update plMinMax2dGrid to ignore NaN and +/-Inf values when finding max / min values. Update plimage/plimagefr to ignore Nan and +/- Inf when plotting images. Thanks to Hez Carty for parts of this patch. Modified Paths: -------------- trunk/examples/c/x21c.c trunk/examples/c++/x21.cc trunk/include/plplot.h trunk/src/pdfutils.c trunk/src/plgridd.c trunk/src/plimage.c Modified: trunk/examples/c/x21c.c =================================================================== --- trunk/examples/c/x21c.c 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/examples/c/x21c.c 2009-02-23 15:54:44 UTC (rev 9586) @@ -23,15 +23,6 @@ #include "plcdemos.h" -#if !defined(HAVE_ISNAN) -# define isnan(x) ((x) != (x)) -#endif - -#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) -#undef isnan -#define isnan _isnan -#endif - /* Options data structure definition. */ static PLINT pts = 500; Modified: trunk/examples/c++/x21.cc =================================================================== --- trunk/examples/c++/x21.cc 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/examples/c++/x21.cc 2009-02-23 15:54:44 UTC (rev 9586) @@ -28,15 +28,6 @@ #include "plc++demos.h" -#if !defined(HAVE_ISNAN) - #define isnan(x) ((x) != (x)) -#endif - -#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) -#undef isnan -#define isnan _isnan -#endif - // Need for some Mac OSX systems with broken <cmath> header #ifdef BROKEN_ISNAN_CXX extern "C" int isnan (double); Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/include/plplot.h 2009-02-23 15:54:44 UTC (rev 9586) @@ -184,6 +184,29 @@ typedef void* PLPointer; /*--------------------------------------------------------------------------*\ + * Add in missing isnan / isinf functions on some platforms +\*--------------------------------------------------------------------------*/ + +#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) +# define isnan _isnan +# define isinf _isinf +#else +# if !defined(HAVE_ISNAN) +# define isnan(x) ((x) != (x)) +# endif +# if !defined(HAVE_ISINF) +# define isinf(x) (!isnan(x) && isnan(x-x)) +# endif +#endif + +/* Check if C99 INFINITY macro is available - if not then + * define a replacement */ +#ifndef INFINITY +#define INFINITY (1.0/0.0) +#endif + + +/*--------------------------------------------------------------------------*\ * Complex data types and other good stuff \*--------------------------------------------------------------------------*/ Modified: trunk/src/pdfutils.c =================================================================== --- trunk/src/pdfutils.c 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/src/pdfutils.c 2009-02-23 15:54:44 UTC (rev 9586) @@ -908,6 +908,7 @@ * MinMax2dGrid() * * Finds the maximum and minimum of a 2d matrix allocated with plAllc2dGrid(). + * NaN and +/- infinity values are ignored. \*--------------------------------------------------------------------------*/ void @@ -916,10 +917,16 @@ int i, j; PLFLT m, M; - M = m = f[0][0]; + if (isnan(f[0][0]) || isinf(f[0][0])) { + M = -INFINITY; + m = INFINITY; + } + else + M = m = f[0][0]; for (i = 0; i < nx; i++) { for (j = 0; j < ny; j++) { + if (isnan(f[i][j]) || isinf(f[i][j])) continue; if (f[i][j] > M) M = f[i][j]; if (f[i][j] < m) m = f[i][j]; } Modified: trunk/src/plgridd.c =================================================================== --- trunk/src/plgridd.c 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/src/plgridd.c 2009-02-23 15:54:44 UTC (rev 9586) @@ -35,10 +35,6 @@ #include <qhull/qhull_a.h> #endif -#if !defined(HAVE_ISNAN) -#define isnan(x) ((x) != (x)) -#endif - /* forward declarations */ static void grid_nnaidw (PLFLT *x, PLFLT *y, PLFLT *z, int npts, Modified: trunk/src/plimage.c =================================================================== --- trunk/src/plimage.c 2009-02-23 14:39:52 UTC (rev 9585) +++ trunk/src/plimage.c 2009-02-23 15:54:44 UTC (rev 9586) @@ -234,7 +234,7 @@ } else { datum = idata[ix][iy]; - if (datum < zmin || datum > zmax) { + if (isnan(datum) || datum < zmin || datum > zmax) { /* Set to a guaranteed-not-to-plot value */ z[ix * ny + iy] = COLOR_NO_PLOT; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-09-15 13:31:21
|
Revision: 10410 http://plplot.svn.sourceforge.net/plplot/?rev=10410&view=rev Author: smekal Date: 2009-09-15 13:31:01 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Added the redefinition macros considering snprintf to plc++demos.h and plcdemos.h, as well as the HAVE_SNPRINTF macros to plConfig.h.cmake. Example 19 (C/C++) compile now again for Visual C++. Modified Paths: -------------- trunk/examples/c/plcdemos.h trunk/examples/c++/plc++demos.h trunk/include/plConfig.h.cmake Modified: trunk/examples/c/plcdemos.h =================================================================== --- trunk/examples/c/plcdemos.h 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/examples/c/plcdemos.h 2009-09-15 13:31:01 UTC (rev 10410) @@ -39,6 +39,24 @@ #define ROUND(a) (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5)) #endif +/* Declarations for save string functions */ + +#ifdef PL_HAVE_SNPRINTF + /* In case only _snprintf is declared (as for Visual C++ and + Borland compiler toolset) we redefine the function names */ + #ifdef _PL_HAVE_SNPRINTF + #define snprintf _snprintf + #define snscanf _snscanf + #endif /* _PL_HAVE_SNPRINTF */ +#else /* !PL_HAVE_SNPRINTF */ + /* declare dummy functions which just call the unsafe + functions ignoring the size of the string */ + int plsnprintf( char *buffer, int n, const char *format, ... ); + int plsnscanf( const char *buffer, int n, const char *format, ... ); + #define snprintf plsnprintf + #define snscanf plsnscanf +#endif /* PL_HAVE_SNPRINTF */ + /* Add in missing isnan definition if required */ #if defined(PL__HAVE_ISNAN) # define isnan _isnan Modified: trunk/examples/c++/plc++demos.h =================================================================== --- trunk/examples/c++/plc++demos.h 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/examples/c++/plc++demos.h 2009-09-15 13:31:01 UTC (rev 10410) @@ -28,6 +28,24 @@ #define ROUND(a) (PLINT)((a)<0. ? ((a)-0.5) : ((a)+0.5)) #endif +/* Declarations for save string functions */ + +#ifdef PL_HAVE_SNPRINTF + /* In case only _snprintf is declared (as for Visual C++ and + Borland compiler toolset) we redefine the function names */ + #ifdef _PL_HAVE_SNPRINTF + #define snprintf _snprintf + #define snscanf _snscanf + #endif /* _PL_HAVE_SNPRINTF */ +#else /* !PL_HAVE_SNPRINTF */ + /* declare dummy functions which just call the unsafe + functions ignoring the size of the string */ + int plsnprintf( char *buffer, int n, const char *format, ... ); + int plsnscanf( const char *buffer, int n, const char *format, ... ); + #define snprintf plsnprintf + #define snscanf plsnscanf +#endif /* PL_HAVE_SNPRINTF */ + /* Add in missing isnan definition if required */ #if defined(PL__HAVE_ISNAN) # define isnan _isnan Modified: trunk/include/plConfig.h.cmake =================================================================== --- trunk/include/plConfig.h.cmake 2009-09-15 01:54:02 UTC (rev 10409) +++ trunk/include/plConfig.h.cmake 2009-09-15 13:31:01 UTC (rev 10410) @@ -44,6 +44,16 @@ /* Define if you have c++ accessible stdint.h */ #cmakedefine PL_HAVE_CXX_STDINT_H +/* Define if snprintf is available */ +#ifndef PL_HAVE_SNPRINTF +#cmakedefine PL_HAVE_SNPRINTF +#endif + +/* Define if _snprintf is available */ +#ifndef _PL_HAVE_SNPRINTF +#cmakedefine _PL_HAVE_SNPRINTF +#endif + /* Define if isinf is available */ #cmakedefine PL_HAVE_ISINF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-09-28 22:45:24
|
Revision: 11231 http://plplot.svn.sourceforge.net/plplot/?rev=11231&view=rev Author: airwin Date: 2010-09-28 22:45:18 +0000 (Tue, 28 Sep 2010) Log Message: ----------- Drop cmap1 color box option so that all colors are expressed with cmap0. That is a nice simplification as discussed on list. Improve handling of PL_LEGEND_NONE so that it overrides all other opt_array flags. Reorder/rename some arguments in a more rational manner. For example, the color box, line, and symbols for each legend entry are rendered in that order so put the arguments in that order as well. Modified Paths: -------------- trunk/examples/c/x04c.c trunk/include/plplot.h trunk/src/pllegend.c Modified: trunk/examples/c/x04c.c =================================================================== --- trunk/examples/c/x04c.c 2010-09-28 17:49:52 UTC (rev 11230) +++ trunk/examples/c/x04c.c 2010-09-28 22:45:18 UTC (rev 11231) @@ -54,8 +54,8 @@ PLINT line_styles[2]; PLINT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2], symbols[2]; - PLINT cmap0_colors[2], cmap_patterns[2]; - PLFLT symbol_scales[2], cmap_scales[2], cmap1_colors[2]; + PLINT box_colors[2], box_patterns[2]; + PLFLT symbol_scales[2], box_scales[2]; pladv( 0 ); @@ -137,20 +137,18 @@ symbol_numbers[1] = 4; symbols[0] = 3; symbols[1] = 3; - cmap0_colors[0] = 2; - cmap0_colors[1] = 3; - cmap1_colors[0] = 0.; - cmap1_colors[1] = 1.; - cmap_patterns[0] = 0; - cmap_patterns[1] = 3; - cmap_scales[0] = 0.5; - cmap_scales[1] = 0.5; + box_colors[0] = 2; + box_colors[1] = 3; + box_patterns[0] = 0; + box_patterns[1] = 3; + box_scales[0] = 0.5; + box_scales[1] = 0.5; plscol0a( 15, 32, 32, 32, 0.90 ); pllegend( PL_LEGEND_BACKGROUND, 0.57, 0.85, 0.06, 15, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, + box_colors, box_patterns, box_scales, line_colors, line_styles, line_widths, - symbol_numbers, symbol_colors, symbol_scales, symbols, - cmap0_colors, cmap1_colors, cmap_patterns, cmap_scales ); + symbol_colors, symbol_scales, symbol_numbers, symbols ); } Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2010-09-28 17:49:52 UTC (rev 11230) +++ trunk/include/plplot.h 2010-09-28 22:45:18 UTC (rev 11231) @@ -1209,11 +1209,10 @@ /* Routine for drawing line, symbol, cmap0, or cmap1 legends */ // Flags for pllegend. -#define PL_LEGEND_NONE 0 -#define PL_LEGEND_LINE 1 -#define PL_LEGEND_SYMBOL 2 -#define PL_LEGEND_CMAP0 4 -#define PL_LEGEND_CMAP1 8 +#define PL_LEGEND_NONE 1 +#define PL_LEGEND_COLOR_BOX 2 +#define PL_LEGEND_LINE 4 +#define PL_LEGEND_SYMBOL 8 #define PL_LEGEND_TEXT_LEFT 16 #define PL_LEGEND_BACKGROUND 32 @@ -1222,11 +1221,10 @@ PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, PLINT *text_colors, char **text, + PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_numbers, PLINT *symbol_colors, - PLFLT *symbol_scales, PLINT *symbols, - PLINT *cmap0_colors, PLFLT * cmap1_colors, - PLINT *cmap_patterns, PLFLT *cmap_scales ); + PLINT *symbol_colors, PLFLT *symbol_scales, + PLINT *symbol_numbers, PLINT *symbols ); /* Sets position of the light source */ PLDLLIMPEXP void Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-09-28 17:49:52 UTC (rev 11230) +++ trunk/src/pllegend.c 2010-09-28 22:45:18 UTC (rev 11231) @@ -115,11 +115,11 @@ //! @param nlegend : number of legend entries //! @param opt_array : array of nlegend values of options to control //! each individual plotted area corresponding to a legend entry. If -//! the PL_LEGEND_NONE, PL_LEGEND_CMAP0, PL_LEGEND_CMAP1, -//! PL_LEGEND_LINE, and/or PL_LEGEND_SYMBOL bits are set, the plotted -//! area corresponding to a legend entry is specified with nothing; a -//! colored box (with the color of that box determined by either a -//! cmap0 index or a cmap1 value); a line; and/or a line of symbols +//! the PL_LEGEND_NONE bit is set, then nothing is plotted in the +//! plotted area. If the PL_LEGEND_COLOR_BOX, PL_LEGEND_LINE, and/or +//! PL_LEGEND_SYMBOL bits are set, the plotted area corresponding to a +//! legend entry is specified with a colored box; a line; and/or a +//! line of symbols //! @param text_offset : offset of the text area from the plot area in //! units of character width //! @param text_scale : character height scale for text annotations @@ -132,6 +132,13 @@ //! are allowed as well. //! @param text_colors : array of nlegend text colors (cmap0 indices). //! @param text : array of nlegend text annotations +//! @param box_colors : array of nlegend colors (cmap0 indices) for +//! the discrete colored boxes (PL_LEGEND_COLOR_BOX) +//! @param box_patterns : array of nlegend patterns (plpsty indices) +//! for the discrete colored boxes (PL_LEGEND_COLOR_BOX) +//! @param box_scales : array of nlegend scales (units of fraction of +//! character height) for the height of the discrete colored boxes +//! (PL_LEGEND_COLOR_BOX) //! @param line_colors : array of nlegend line colors (cmap0 indices) //! (PL_LEGEND_LINE) //! @param line_styles : array of nlegend line styles (plsty indices) @@ -145,15 +152,6 @@ //! symbol height (PL_LEGEND_SYMBOL) //! @param symbols : array of nlegend symbols (plpoin indices) //! (PL_LEGEND_SYMBOL) -//! @param cmap0_colors : array of nlegend colors (cmap0 indices) for -//! the discrete colored boxes (PL_LEGEND_CMAP0) -//! @param cmap1_colors : array of nlegend colors (cmap1 values) for -//! the discrete colored boxes (PL_LEGEND_CMAP1) -//! @param cmap_patterns : array of nlegend patterns (plpsty indices) -//! for the discrete colored boxes (PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1) -//! @param cmap_scales : array of nlegend scales (units of fraction of -//! character height) for the height of the discrete colored boxes -//! (PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1) //! //! N.B. the total width of the legend is made up of plplot_width + //! text_offset (converted to normalized subpage coordinates) + width @@ -170,11 +168,10 @@ PLINT nlegend, PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, PLINT *text_colors, char **text, + PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_numbers, PLINT *symbol_colors, - PLFLT *symbol_scales, PLINT *symbols, - PLINT *cmap0_colors, PLFLT *cmap1_colors, - PLINT *cmap_patterns, PLFLT *cmap_scales ) + PLINT *symbol_colors, PLFLT *symbol_scales, + PLINT *symbol_numbers, PLINT *symbols ) { // Viewport world-coordinate limits @@ -188,7 +185,7 @@ // y-position of the current legend entry PLFLT ty, dty; // Positions of the legend entries - PLFLT dxs, *xs, *ys, xl[2], yl[2], xcmap[4], ycmap[4]; + PLFLT dxs, *xs, *ys, xl[2], yl[2], xbox[4], ybox[4]; PLINT i, j; // Active attributes to be saved and restored afterward. PLINT col0_save = plsc->icol0, @@ -205,7 +202,7 @@ PLFLT x_world_per_mm, y_world_per_mm, text_width0 = 0., text_width; PLFLT total_width_border, total_width, total_height; - PLINT some_lines = 0, some_symbols = 0, some_cmaps = 0; + PLINT some_boxes = 0, some_lines = 0, some_symbols = 0; PLINT max_symbol_numbers = 0; plgvpd( &xdmin_save, &xdmax_save, &ydmin_save, &ydmax_save ); @@ -219,6 +216,8 @@ for ( i = 0; i < nlegend; i++ ) { + if ( opt_array[i] & PL_LEGEND_COLOR_BOX ) + some_boxes = 1; if ( opt_array[i] & PL_LEGEND_LINE ) some_lines = 1; if ( opt_array[i] & PL_LEGEND_SYMBOL ) @@ -226,8 +225,6 @@ max_symbol_numbers = MAX( max_symbol_numbers, symbol_numbers[i] ); some_symbols = 1; } - if ( opt_array[i] & ( PL_LEGEND_CMAP0 | PL_LEGEND_CMAP1 ) ) - some_cmaps = 1; } plgvpw( &xmin, &xmax, &ymin, &ymax ); @@ -298,12 +295,12 @@ plot_x_end_world += total_width_border; text_x_world += total_width_border; - if ( some_cmaps ) + if ( some_boxes ) { - xcmap[0] = plot_x_world; - xcmap[1] = plot_x_world; - xcmap[2] = plot_x_end_world; - xcmap[3] = plot_x_end_world; + xbox[0] = plot_x_world; + xbox[1] = plot_x_world; + xbox[2] = plot_x_end_world; + xbox[3] = plot_x_end_world; } if ( some_lines ) @@ -341,49 +338,42 @@ plcol0( text_colors[i] ); plptex( text_x_world + text_justification * text_width0, ty, 0.1, 0.0, text_justification, text[i] ); - if ( opt_array[i] & PL_LEGEND_CMAP0 ) + if ( !( opt_array[i] & PL_LEGEND_NONE ) ) { - plcol0( cmap0_colors[i] ); - plpsty( cmap_patterns[i] ); - ycmap[0] = ty + 0.5 * dty * cmap_scales[i]; - ycmap[1] = ty - 0.5 * dty * cmap_scales[i]; - ycmap[2] = ty - 0.5 * dty * cmap_scales[i]; - ycmap[3] = ty + 0.5 * dty * cmap_scales[i]; - plfill( 4, xcmap, ycmap ); - } - if ( opt_array[i] & PL_LEGEND_CMAP1 ) - { - plcol1( cmap1_colors[i] ); - plpsty( cmap_patterns[i] ); - ycmap[0] = ty + 0.5 * dty * cmap_scales[i]; - ycmap[1] = ty - 0.5 * dty * cmap_scales[i]; - ycmap[2] = ty - 0.5 * dty * cmap_scales[i]; - ycmap[3] = ty + 0.5 * dty * cmap_scales[i]; - plfill( 4, xcmap, ycmap ); - } - if ( opt_array[i] & PL_LEGEND_LINE ) - { - plcol0( line_colors[i] ); - pllsty( line_styles[i] ); - plwid( line_widths[i] ); - yl[0] = ty; - yl[1] = ty; - plline( 2, xl, yl ); - pllsty( line_style_save ); - plwid( line_width_save ); - } + if ( opt_array[i] & PL_LEGEND_COLOR_BOX ) + { + plcol0( box_colors[i] ); + plpsty( box_patterns[i] ); + ybox[0] = ty + 0.5 * dty * box_scales[i]; + ybox[1] = ty - 0.5 * dty * box_scales[i]; + ybox[2] = ty - 0.5 * dty * box_scales[i]; + ybox[3] = ty + 0.5 * dty * box_scales[i]; + plfill( 4, xbox, ybox ); + } + if ( opt_array[i] & PL_LEGEND_LINE ) + { + plcol0( line_colors[i] ); + pllsty( line_styles[i] ); + plwid( line_widths[i] ); + yl[0] = ty; + yl[1] = ty; + plline( 2, xl, yl ); + pllsty( line_style_save ); + plwid( line_width_save ); + } - if ( opt_array[i] & PL_LEGEND_SYMBOL ) - { - plcol0( symbol_colors[i] ); - plssym( 0., symbol_scales[i] ); - dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( MAX( symbol_numbers[i], 2 ) - 1 ); - for ( j = 0; j < symbol_numbers[i]; j++ ) + if ( opt_array[i] & PL_LEGEND_SYMBOL ) { - xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; - ys[j] = ty; + plcol0( symbol_colors[i] ); + plssym( 0., symbol_scales[i] ); + dxs = ( plot_x_end_world - plot_x_world - symbol_width ) / (double) ( MAX( symbol_numbers[i], 2 ) - 1 ); + for ( j = 0; j < symbol_numbers[i]; j++ ) + { + xs[j] = plot_x_world + 0.5 * symbol_width + dxs * (double) j; + ys[j] = ty; + } + plpoin( symbol_numbers[i], xs, ys, symbols[i] ); } - plpoin( symbol_numbers[i], xs, ys, symbols[i] ); } } if ( some_symbols ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2010-12-30 01:58:57
|
Revision: 11401 http://plplot.svn.sourceforge.net/plplot/?rev=11401&view=rev Author: hezekiahcarty Date: 2010-12-30 01:58:51 +0000 (Thu, 30 Dec 2010) Log Message: ----------- Add plshades and plgradient support to plcolorbar Modified Paths: -------------- trunk/examples/c/x33c.c trunk/src/pllegend.c Modified: trunk/examples/c/x33c.c =================================================================== --- trunk/examples/c/x33c.c 2010-12-29 23:30:10 UTC (rev 11400) +++ trunk/examples/c/x33c.c 2010-12-30 01:58:51 UTC (rev 11401) @@ -61,97 +61,109 @@ }; void -plcolorbar_example_1() +plcolorbar_example_1( PLINT bar_type, PLINT n, const char *title ) { pladv( 0 ); // Setup color palette 1 plspal1( "cmap1_blue_red.pal", 1 ); - PLINT n; - n = 2; - PLFLT colors[n]; - colors[0] = 0.0; - colors[1] = 1.0; PLFLT values[n]; - values[0] = 6.0; - values[1] = 13.0; + int i; + PLFLT color_step, value_step; + color_step = 1.0 / (PLFLT)(n - 1); + value_step = 8.0 / (PLFLT)(n - 1); + for ( i = 0; i < n; i++ ) + { + colors[i] = 0.0 + color_step * (PLFLT)( i ); + values[i] = 6.0 + value_step * (PLFLT)( i ); + } PLINT opt; - opt = PL_COLORBAR_LEFT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LEFT | + opt = PL_COLORBAR_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, "tv", "Test label - Left, High Cap", n, colors, values ); - opt = PL_COLORBAR_RIGHT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_RIGHT | + opt = PL_COLORBAR_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, "tv", "Test label - Right, Low Cap", n, colors, values ); - opt = PL_COLORBAR_UPPER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_UPPER | + opt = PL_COLORBAR_UPPER | bar_type | PL_COLORBAR_LABEL_UPPER | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, "t", "Test label - Upper, High Cap", n, colors, values ); - opt = PL_COLORBAR_LOWER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LOWER | + opt = PL_COLORBAR_LOWER | bar_type | PL_COLORBAR_LABEL_LOWER | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, "t", "Test label - Lower, Low Cap", n, colors, values ); + + plvpor( 0.0, 1.0, 0.0, 1.0 ); + plwind( 0.0, 1.0, 0.0, 1.0 ); + plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } void -plcolorbar_example_2() +plcolorbar_example_2( PLINT bar_type, PLINT n, const char *title ) { pladv( 0 ); // Setup color palette 1 plspal1( "cmap1_blue_yellow.pal", 1 ); - PLINT n; - n = 2; - PLFLT colors[n]; - colors[0] = 0.0; - colors[1] = 1.0; PLFLT values[n]; - values[0] = 6.0; - values[1] = 13.0; + int i; + PLFLT color_step, value_step; + color_step = 1.0 / (PLFLT)(n - 1); + value_step = 8.0 / (PLFLT)(n - 1); + for ( i = 0; i < n; i++ ) + { + colors[i] = 0.0 + color_step * (PLFLT)( i ); + values[i] = 6.0 + value_step * (PLFLT)( i ); + } PLINT opt; - opt = PL_COLORBAR_LEFT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LEFT | + opt = PL_COLORBAR_LEFT | bar_type | PL_COLORBAR_LABEL_LEFT | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, "tv", "Test label - Left, Low Cap", n, colors, values ); - opt = PL_COLORBAR_RIGHT | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_RIGHT | + opt = PL_COLORBAR_RIGHT | bar_type | PL_COLORBAR_LABEL_RIGHT | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.1, 0.4, 0.5, 0.1, "tv", "Test label - Right, High Cap", n, colors, values ); - opt = PL_COLORBAR_UPPER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_UPPER | + opt = PL_COLORBAR_UPPER | bar_type | PL_COLORBAR_LABEL_UPPER | PL_COLORBAR_CAP_LOW; plcolorbar( opt, 0.1, 0.1, 0.5, 0.1, "t", "Test label - Upper, Low Cap", n, colors, values ); - opt = PL_COLORBAR_LOWER | PL_COLORBAR_IMAGE | PL_COLORBAR_LABEL_LOWER | + opt = PL_COLORBAR_LOWER | bar_type | PL_COLORBAR_LABEL_LOWER | PL_COLORBAR_CAP_HIGH; plcolorbar( opt, 0.4, 0.1, 0.5, 0.1, "t", "Test label - Lower, High Cap", n, colors, values ); + + plvpor( 0.0, 1.0, 0.0, 1.0 ); + plwind( 0.0, 1.0, 0.0, 1.0 ); + plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } //-------------------------------------------------------------------------- @@ -697,8 +709,12 @@ max_height = MAX( max_height, legend_height ); // Color bar examples - plcolorbar_example_1(); - plcolorbar_example_2(); + plcolorbar_example_1( PL_COLORBAR_IMAGE, 2, "Image Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_IMAGE, 2, "Image Color Bars" ); + plcolorbar_example_1( PL_COLORBAR_SHADE, 9, "Shade Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_SHADE, 9, "Shade Color Bars" ); + plcolorbar_example_1( PL_COLORBAR_GRADIENT, 2, "Gradient Color Bars" ); + plcolorbar_example_2( PL_COLORBAR_GRADIENT, 2, "Gradient Color Bars" ); // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2010-12-29 23:30:10 UTC (rev 11400) +++ trunk/src/pllegend.c 2010-12-30 01:58:51 UTC (rev 11401) @@ -1081,13 +1081,73 @@ } else if ( opt & PL_COLORBAR_SHADE ) { - plabort( "PL_COLORBAR_SHADE is not implemented yet" ); + n_steps = n_colors; + // Use the provided values. + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + ni = 2; + nj = n_steps; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = values[j]; + } + } + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + ni = n_steps; + nj = 2; + plAlloc2dGrid( &color_data, ni, nj ); + for ( i = 0; i < ni; i++ ) + { + for ( j = 0; j < nj; j++ ) + { + color_data[i][j] = values[i]; + } + } + } + else + { + plabort( "plcolorbar: Invalid side" ); + } + // Draw the color bar + plshades( color_data, ni, nj, NULL, wx_min, wx_max, wy_min, wy_max, + values, n_colors, 0, 0, 0, plfill, TRUE, NULL, NULL ); + plFree2dGrid( color_data, ni, nj ); } else if ( opt & PL_COLORBAR_GRADIENT ) { - plabort( "PL_COLORBAR_GRADIENT is not implemented yet" ); + PLFLT xs[4], ys[4]; + xs[0] = wx_min; + ys[0] = wy_min; + xs[1] = wx_max; + ys[1] = wy_min; + xs[2] = wx_max; + ys[2] = wy_max; + xs[3] = wx_min; + ys[3] = wy_max; + PLFLT angle; + if ( opt & PL_COLORBAR_LEFT || opt & PL_COLORBAR_RIGHT ) + { + angle = 90.0; + } + else if ( opt & PL_COLORBAR_UPPER || opt & PL_COLORBAR_LOWER ) + { + angle = 0.0; + } + else + { + plabort( "plcolorbar: Invalid side" ); + } + plgradient( 4, xs, ys, angle ); } + // Restore the previous drawing color to use for outlines and text + plcol0( col0_save ); + // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis @@ -1223,7 +1283,6 @@ plsmaj( 0.0, maj_save ); plsmin( 0.0, min_save ); plschr( 0.0, text_scale_save ); - plcol0( col0_save ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-07-16 19:20:11
|
Revision: 12426 http://sourceforge.net/p/plplot/code/12426 Author: arjenmarkus Date: 2013-07-16 19:20:07 +0000 (Tue, 16 Jul 2013) Log Message: ----------- Update the list of PLplot parameters for Tcl Expand Tcl example 16 with the rest of the calls to colorbar. Note: there remains a small difference in the PS file for this example with the PS file for the C example. I have not been able to trace the cause yet. Modified Paths: -------------- trunk/bindings/tcl/plplot_parameters.h trunk/examples/tcl/x16.tcl Modified: trunk/bindings/tcl/plplot_parameters.h =================================================================== --- trunk/bindings/tcl/plplot_parameters.h 2013-07-16 16:42:32 UTC (rev 12425) +++ trunk/bindings/tcl/plplot_parameters.h 2013-07-16 19:20:07 UTC (rev 12426) @@ -186,35 +186,56 @@ variable PL_LEGEND_ROW_MAJOR 128\n\ \n\ \n\ -variable PL_COLORBAR_LABEL_LEFT 1\n\ +variable PL_COLORBAR_LABEL_LEFT 0x1\n\ \n\ \n\ -variable PL_COLORBAR_LABEL_RIGHT 2\n\ +variable PL_COLORBAR_LABEL_RIGHT 0x2\n\ \n\ \n\ -variable PL_COLORBAR_LABEL_TOP 4\n\ +variable PL_COLORBAR_LABEL_TOP 0x4\n\ \n\ \n\ -variable PL_COLORBAR_LABEL_BOTTOM 8\n\ +variable PL_COLORBAR_LABEL_BOTTOM 0x8\n\ \n\ \n\ -variable PL_COLORBAR_IMAGE 16\n\ +variable PL_COLORBAR_IMAGE 0x10\n\ \n\ \n\ -variable PL_COLORBAR_SHADE 32\n\ +variable PL_COLORBAR_SHADE 0x20\n\ \n\ \n\ -variable PL_COLORBAR_GRADIENT 64\n\ +variable PL_COLORBAR_GRADIENT 0x40\n\ \n\ \n\ -variable PL_COLORBAR_CAP_LOW 128\n\ +variable PL_COLORBAR_CAP_NONE 0x80\n\ \n\ \n\ -variable PL_COLORBAR_CAP_HIGH 256\n\ +variable PL_COLORBAR_CAP_LOW 0x100\n\ \n\ \n\ -variable PL_COLORBAR_SHADE_LABEL 512\n\ +variable PL_COLORBAR_CAP_HIGH 0x200\n\ \n\ +\n\ +variable PL_COLORBAR_SHADE_LABEL 0x400\n\ +\n\ +\n\ +variable PL_COLORBAR_ORIENT_RIGHT 0x800\n\ +\n\ +\n\ +variable PL_COLORBAR_ORIENT_TOP 0x1000\n\ +\n\ +\n\ +variable PL_COLORBAR_ORIENT_LEFT 0x2000\n\ +\n\ +\n\ +variable PL_COLORBAR_ORIENT_BOTTOM 0x4000\n\ +\n\ +\n\ +variable PL_COLORBAR_BACKGROUND 0x8000\n\ +\n\ +\n\ +variable PL_COLORBAR_BOUNDING_BOX 0x10000\n\ +\n\ # device coordinates\n\ variable PLSWIN_DEVICE 1\n\ \n\ Modified: trunk/examples/tcl/x16.tcl =================================================================== --- trunk/examples/tcl/x16.tcl 2013-07-16 16:42:32 UTC (rev 12425) +++ trunk/examples/tcl/x16.tcl 2013-07-16 19:20:07 UTC (rev 12426) @@ -99,7 +99,6 @@ shedge $fill_width $cont_color $cont_width \ 1 "NULL" - # Colorbar: # We draw only one bar, so use single values, not lists # @@ -123,7 +122,6 @@ $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 - $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 @@ -147,6 +145,29 @@ shedge $fill_width $cont_color $cont_width \ 1 pltr1 xg1 yg1 + # Colorbar: + # We draw only one bar, so use single values, not lists + # + # Smaller text + $w cmd plschr 0.0 0.75 + # Small ticks on the vertical axis + $w cmd plsmaj 0.0 0.5 + $w cmd plsmin 0.0 0.5 + + $w cmd plcolorbar \ + [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ + 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ + $cont_color $cont_width \ + $label_opts $labels \ + $axis_opts \ + $axis_ticks $axis_subticks \ + shedge + + # Reset text and tick sizes + $w cmd plschr 0.0 1.0 + $w cmd plsmaj 0.0 1.0 + $w cmd plsmin 0.0 1.0 + $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 @@ -170,6 +191,29 @@ shedge $fill_width $cont_color $cont_width \ 0 pltr2 xg2 yg2 + # Colorbar: + # We draw only one bar, so use single values, not lists + # + # Smaller text + $w cmd plschr 0.0 0.75 + # Small ticks on the vertical axis + $w cmd plsmaj 0.0 0.5 + $w cmd plsmin 0.0 0.5 + + $w cmd plcolorbar \ + [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ + 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ + $cont_color $cont_width \ + $label_opts $labels \ + $axis_opts \ + $axis_ticks $axis_subticks \ + shedge + + # Reset text and tick sizes + $w cmd plschr 0.0 1.0 + $w cmd plsmaj 0.0 1.0 + $w cmd plsmin 0.0 1.0 + $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 @@ -192,6 +236,29 @@ shedge $fill_width 2 3 \ 0 pltr2 xg2 yg2 + # Colorbar: + # We draw only one bar, so use single values, not lists + # + # Smaller text + $w cmd plschr 0.0 0.75 + # Small ticks on the vertical axis + $w cmd plsmaj 0.0 0.5 + $w cmd plsmin 0.0 0.5 + + $w cmd plcolorbar \ + [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ + 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ + $cont_color $cont_width \ + $label_opts $labels \ + $axis_opts \ + $axis_ticks $axis_subticks \ + shedge + + # Reset text and tick sizes + $w cmd plschr 0.0 1.0 + $w cmd plsmaj 0.0 1.0 + $w cmd plsmin 0.0 1.0 + $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 @@ -247,6 +314,29 @@ shedge $fill_width $cont_color $cont_width \ 0 pltr2 xg yg $wrap + # Colorbar: + # We draw only one bar, so use single values, not lists + # + # Smaller text + $w cmd plschr 0.0 0.75 + # Small ticks on the vertical axis + $w cmd plsmaj 0.0 0.5 + $w cmd plsmin 0.0 0.5 + + $w cmd plcolorbar \ + [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ + 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ + $cont_color $cont_width \ + $label_opts $labels \ + $axis_opts \ + $axis_ticks $axis_subticks \ + shedge + + # Reset text and tick sizes + $w cmd plschr 0.0 1.0 + $w cmd plsmaj 0.0 1.0 + $w cmd plsmin 0.0 1.0 + # Hold perimeter matrix px f 100; matrix py f 100 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-08-24 05:35:02
|
Revision: 12495 http://sourceforge.net/p/plplot/code/12495 Author: airwin Date: 2013-08-24 05:34:58 +0000 (Sat, 24 Aug 2013) Log Message: ----------- For default -DDOCBOOK_XML_BACKEND=ON case, implement a dvi build. N.B. This dvi build only works if the patch given at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720624 is applied to /usr/share/pyshared/dbtexmf/dblatex/unient.py to fix a bug in the dblatex package. Use different inline-print_???.ent files depending on whether -DDOCBOOK_XML_BACKEND=ON or OFF. Modified Paths: -------------- trunk/cmake/modules/docbook.cmake trunk/doc/docbook/src/CMakeLists.txt Added Paths: ----------- trunk/doc/docbook/src/inline-print_dsl.ent trunk/doc/docbook/src/inline-print_xsl.ent Removed Paths: ------------- trunk/doc/docbook/src/inline-print.ent Modified: trunk/cmake/modules/docbook.cmake =================================================================== --- trunk/cmake/modules/docbook.cmake 2013-08-21 22:10:51 UTC (rev 12494) +++ trunk/cmake/modules/docbook.cmake 2013-08-24 05:34:58 UTC (rev 12495) @@ -119,13 +119,7 @@ set(BUILD_HTML ON) if(GZIP) set(BUILD_PRINT ON) - option(BUILD_DVI "BUILD dvi form of documentation" OFF) - if(NOT BUILD_DVI) - message(STATUS - "WARNING: Not building dvi documentation - " - "Bugs in xmlto for this case." - ) - endif(NOT BUILD_DVI) + option(BUILD_DVI "BUILD dvi form of documentation" ON) else(GZIP) set(BUILD_PRINT OFF) message(STATUS Modified: trunk/doc/docbook/src/CMakeLists.txt =================================================================== --- trunk/doc/docbook/src/CMakeLists.txt 2013-08-21 22:10:51 UTC (rev 12494) +++ trunk/doc/docbook/src/CMakeLists.txt 2013-08-24 05:34:58 UTC (rev 12495) @@ -27,7 +27,13 @@ set(MANVOL "3plplot") foreach(suffix info html print) - set(inline_entities ${CMAKE_CURRENT_SOURCE_DIR}/inline-${suffix}.ent) + if(suffix STREQUAL "print" AND DOCBOOK_XML_BACKEND) + set(inline_entities ${CMAKE_CURRENT_SOURCE_DIR}/inline-${suffix}_xsl.ent) + elseif(suffix STREQUAL "print" AND NOT DOCBOOK_XML_BACKEND) + set(inline_entities ${CMAKE_CURRENT_SOURCE_DIR}/inline-${suffix}_dsl.ent) + else(suffix STREQUAL "print" AND DOCBOOK_XML_BACKEND) + set(inline_entities ${CMAKE_CURRENT_SOURCE_DIR}/inline-${suffix}.ent) + endif(suffix STREQUAL "print" AND DOCBOOK_XML_BACKEND) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${PLPLOTDOC}.xml.in ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-${suffix}.xml @@ -359,6 +365,37 @@ @ONLY ) + if(BUILD_DVI) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + # Drop -x ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} option + # since it doesn't appear to work with --with-dblatex + COMMAND ${XMLTO} -vv --with-dblatex dvi ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml + COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/plplotdoc-print.dvi ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + DEPENDS + ${SOURCE_FILES} + ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml + ${CMAKE_CURRENT_SOURCE_DIR}/inline-print_xsl.ent + ) + add_custom_target( + dvi_target ALL + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.dvi + ) + # These files used for more than one target. Therefore must + # use target dependencies rather than file dependencies to build + # them. Otherwise, parallel builds won't work. + add_dependencies(dvi_target + docbook_plplot-symbols_txt + docbook_plplot-structs_txt + ) + + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_built_files + "${BASE}.ps.gz\n" + ) + + endif(BUILD_DVI) + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BASE}.ps.gz COMMAND ${XMLTO} -vv --with-fop -x ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} ps ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml @@ -367,7 +404,7 @@ DEPENDS ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml - ${CMAKE_CURRENT_SOURCE_DIR}/inline-print.ent + ${CMAKE_CURRENT_SOURCE_DIR}/inline-print_xsl.ent ) add_custom_target( ps_target ALL @@ -393,7 +430,7 @@ DEPENDS ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml - ${CMAKE_CURRENT_SOURCE_DIR}/inline-print.ent + ${CMAKE_CURRENT_SOURCE_DIR}/inline-print_xsl.ent ) add_custom_target( pdf_target ALL @@ -415,6 +452,9 @@ print ALL ) add_dependencies(print ps_target pdf_target) + if(BUILD_DVI) + add_dependencies(print dvi_target) + endif(BUILD_DVI) endif(BUILD_PRINT) else(DOCBOOK_XML_BACKEND) if(BUILD_HTML) @@ -490,7 +530,7 @@ ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${PLPLOTDOC}-print.xml ${CMAKE_CURRENT_BINARY_DIR}/${STYLESHEET_PRINT} - ${CMAKE_CURRENT_SOURCE_DIR}/inline-print.ent + ${CMAKE_CURRENT_SOURCE_DIR}/inline-print_xsl.ent ) # Following approach used in our ABS, use shell commands to recurse Deleted: trunk/doc/docbook/src/inline-print.ent =================================================================== --- trunk/doc/docbook/src/inline-print.ent 2013-08-21 22:10:51 UTC (rev 12494) +++ trunk/doc/docbook/src/inline-print.ent 2013-08-24 05:34:58 UTC (rev 12495) @@ -1 +0,0 @@ -<!ENTITY over-under "Ё"> Copied: trunk/doc/docbook/src/inline-print_dsl.ent (from rev 12492, trunk/doc/docbook/src/inline-print.ent) =================================================================== --- trunk/doc/docbook/src/inline-print_dsl.ent (rev 0) +++ trunk/doc/docbook/src/inline-print_dsl.ent 2013-08-24 05:34:58 UTC (rev 12495) @@ -0,0 +1 @@ +<!ENTITY over-under "Ё"> Added: trunk/doc/docbook/src/inline-print_xsl.ent =================================================================== --- trunk/doc/docbook/src/inline-print_xsl.ent (rev 0) +++ trunk/doc/docbook/src/inline-print_xsl.ent 2013-08-24 05:34:58 UTC (rev 12495) @@ -0,0 +1 @@ +<!ENTITY over-under "S(freq)"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-11-12 00:54:58
|
Revision: 12677 http://sourceforge.net/p/plplot/code/12677 Author: airwin Date: 2013-11-12 00:54:54 +0000 (Tue, 12 Nov 2013) Log Message: ----------- VERSION ==> PLPLOT_VERSION (to make the code easier to understand and to reduce the possibility of name clashes in the future). PLPLOT_TCL_VERSION ==> PLPLOT_VERSION (since we want to identifiy the PLplot tcl/tk bindings with PLPLOT_VERSION and not potentially some other version string. Propagate PLPLOT_ITCL_VERSION, PLPLOT_ITK_VERSION, and PLPLOT_IWIDGETS_VERSION from CMake to the C code environment. N.B. The first of these changes is quite intrusive so the tests below are useful but they are far from a guarantee that there are no lingering issues from this change. So stay alert for VERSION issues when you use the PLplot svn trunk. Tested by Alan W. Irwin <ai...@us...> on Linux using the test_noninteractive targets for the build tree and the traditional and CMake-based build systems for the installed examples tree. Modified Paths: -------------- trunk/CMakeLists.txt trunk/abi-compliance-checker.xml.template.in trunk/bindings/ocaml/META.in trunk/bindings/ocaml/plcairo/META.in trunk/bindings/tcl/pkgIndex.tcl.in trunk/bindings/tcl/tclAPI.c trunk/bindings/tk/Pltk_Init.c trunk/bindings/tk/pkgIndex.tcl.in trunk/bindings/tk-x-plat/Plplotter_Init.c trunk/bindings/tk-x-plat/pkgIndex.tcl.in trunk/cmake/modules/docbook.cmake trunk/cmake/modules/instdirs.cmake trunk/cmake/modules/plplot_version.cmake trunk/config.h.in trunk/doc/Doxyfile.in trunk/drivers/ps.c trunk/drivers/psttf.cc trunk/pkgcfg/plplot-template.pc.in trunk/plplot_test/plplot-test.sh.in trunk/src/plargs.c trunk/src/plcore.c Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/CMakeLists.txt 2013-11-12 00:54:54 UTC (rev 12677) @@ -248,7 +248,7 @@ endif(WIN32_AND_NOT_CYGWIN) set( CPACK_SOURCE_PACKAGE_FILE_NAME - "plplot-${VERSION}" + "plplot-${PLPLOT_VERSION}" CACHE INTERNAL "tarball basename" ) set(CPACK_SOURCE_GENERATOR TGZ) Modified: trunk/abi-compliance-checker.xml.template.in =================================================================== --- trunk/abi-compliance-checker.xml.template.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/abi-compliance-checker.xml.template.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -1,4 +1,4 @@ -<version>${VERSION}</version> +<version>${PLPLOT_VERSION}</version> <headers> ${PREFIX}/include/plplot </headers> Modified: trunk/bindings/ocaml/META.in =================================================================== --- trunk/bindings/ocaml/META.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/ocaml/META.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -1,7 +1,7 @@ # findlib META file for ocaml-plplot requires = "" description = "PLplot library bindings" -version = "@VERSION@" +version = "@PLPLOT_VERSION@" browse_interfaces = " Plplot " linkopts = "-ccopt \"-L@SHLIB_DIR@\"" archive(byte) = "plplot.cma" Modified: trunk/bindings/ocaml/plcairo/META.in =================================================================== --- trunk/bindings/ocaml/plcairo/META.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/ocaml/plcairo/META.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -2,7 +2,7 @@ requires = "plplot" requires += "cairo" description = "PLplot Cairo extras" -version = "@VERSION@" +version = "@PLPLOT_VERSION@" browse_interfaces = " Plcairo " archive(byte) = "plcairo.cma" archive(native) = "plcairo.cmxa" Modified: trunk/bindings/tcl/pkgIndex.tcl.in =================================================================== --- trunk/bindings/tcl/pkgIndex.tcl.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tcl/pkgIndex.tcl.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -73,5 +73,5 @@ rename load_pkg_Pltcl {} } -package ifneeded Pltcl @PLPLOT_TCL_VERSION@ [list load_pkg_Pltcl $dir] +package ifneeded Pltcl @PLPLOT_VERSION@ [list load_pkg_Pltcl $dir] Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tcl/tclAPI.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -398,10 +398,10 @@ int debug = plsc->debug; const char *libDir = NULL; static char initScript[] = - "tcl_findLibrary plplot " VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary"; + "tcl_findLibrary plplot " PLPLOT_VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary"; #ifdef PLPLOT_EXTENDED_SEARCH static char initScriptExtended[] = - "tcl_findLibrary plplot " VERSION "/tcl \"\" plplot.tcl PL_LIBRARY pllibrary"; + "tcl_findLibrary plplot " PLPLOT_VERSION "/tcl \"\" plplot.tcl PL_LIBRARY pllibrary"; #endif #ifdef USE_TCL_STUBS @@ -441,7 +441,7 @@ #endif #endif - Tcl_SetVar( interp, "plversion", VERSION, TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "plversion", PLPLOT_VERSION, TCL_GLOBAL_ONLY ); // Begin search for init script // Each search begins with a test of libDir, so rearrangement is easy. @@ -606,7 +606,7 @@ // We really need this so the TEA based 'make install' can // properly determine the package we have installed - Tcl_PkgProvide( interp, "Pltcl", VERSION ); + Tcl_PkgProvide( interp, "Pltcl", PLPLOT_VERSION ); return TCL_OK; } Modified: trunk/bindings/tk/Pltk_Init.c =================================================================== --- trunk/bindings/tk/Pltk_Init.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tk/Pltk_Init.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -101,7 +101,7 @@ } #endif - Tcl_PkgProvide( interp, "Pltk", VERSION ); + Tcl_PkgProvide( interp, "Pltk", PLPLOT_VERSION ); return TCL_OK; } Modified: trunk/bindings/tk/pkgIndex.tcl.in =================================================================== --- trunk/bindings/tk/pkgIndex.tcl.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tk/pkgIndex.tcl.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -90,4 +90,4 @@ rename load_pkg_Pltk {} } -package ifneeded Pltk @PLPLOT_TCL_VERSION@ [list load_pkg_Pltk $dir] +package ifneeded Pltk @PLPLOT_VERSION@ [list load_pkg_Pltk $dir] Modified: trunk/bindings/tk-x-plat/Plplotter_Init.c =================================================================== --- trunk/bindings/tk-x-plat/Plplotter_Init.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tk-x-plat/Plplotter_Init.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -90,7 +90,7 @@ Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plPlotterCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL ); - Tcl_PkgProvide( interp, "Plplotter", VERSION ); + Tcl_PkgProvide( interp, "Plplotter", PLPLOT_VERSION ); return TCL_OK; } Modified: trunk/bindings/tk-x-plat/pkgIndex.tcl.in =================================================================== --- trunk/bindings/tk-x-plat/pkgIndex.tcl.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/bindings/tk-x-plat/pkgIndex.tcl.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -90,5 +90,5 @@ rename load_pkg_Plplotter {} } -package ifneeded Plplotter @PLPLOT_TCL_VERSION@ [list load_pkg_Plplotter $dir] +package ifneeded Plplotter @PLPLOT_VERSION@ [list load_pkg_Plplotter $dir] Modified: trunk/cmake/modules/docbook.cmake =================================================================== --- trunk/cmake/modules/docbook.cmake 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/cmake/modules/docbook.cmake 2013-11-12 00:54:54 UTC (rev 12677) @@ -333,11 +333,11 @@ # The "MANIFEST" variables needed in top-level CMakeLists.txt and # in doc/docbook/src/CMakeLists.txt. if(BUILD_DOC OR PREBUILT_DOC) - set(BASE "${PACKAGE}-${VERSION}") + set(BASE "${PACKAGE}-${PLPLOT_VERSION}") set(INFO_MANIFEST "INFO-MANIFEST") - set(BASE_INFO "${PACKAGE}-info-${VERSION}") + set(BASE_INFO "${PACKAGE}-info-${PLPLOT_VERSION}") set(MAN_MANIFEST "MAN-MANIFEST") - set(BASE_MAN "${PACKAGE}-man-${VERSION}") + set(BASE_MAN "${PACKAGE}-man-${PLPLOT_VERSION}") set(HTML_MANIFEST "HTML-MANIFEST") - set(BASE_HTML "${PACKAGE}-html-${VERSION}") + set(BASE_HTML "${PACKAGE}-html-${PLPLOT_VERSION}") endif(BUILD_DOC OR PREBUILT_DOC) Modified: trunk/cmake/modules/instdirs.cmake =================================================================== --- trunk/cmake/modules/instdirs.cmake 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/cmake/modules/instdirs.cmake 2013-11-12 00:54:54 UTC (rev 12677) @@ -75,7 +75,7 @@ # cached values above. # Data. -set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${PACKAGE}${VERSION}) +set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${PACKAGE}${PLPLOT_VERSION}) # Libraries. set(LIB_DIR ${CMAKE_INSTALL_LIBDIR}) @@ -90,7 +90,7 @@ set(SHLIB_DIR ${CMAKE_INSTALL_LIBDIR}) # Tcl files. -set(TCL_DIR ${CMAKE_INSTALL_DATADIR}/${PACKAGE}${VERSION}/tcl) +set(TCL_DIR ${CMAKE_INSTALL_DATADIR}/${PACKAGE}${PLPLOT_VERSION}/tcl) # Ada source files (*.adb, *.ads) (following recommendations in # http://www.ada-france.org/debian/debian-ada-policy.html @@ -101,7 +101,7 @@ set(ADA_LIB_DIR ${CMAKE_INSTALL_LIBDIR}/ada/adalib/plplotada${LIB_TAG}) # Drivers. -set(DRV_DIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE}${VERSION}/drivers${LIB_TAG}) +set(DRV_DIR ${CMAKE_INSTALL_LIBDIR}/${PACKAGE}${PLPLOT_VERSION}/drivers${LIB_TAG}) # Documentation. set(DOC_DIR ${CMAKE_INSTALL_DATADIR}/doc/${PACKAGE}) Modified: trunk/cmake/modules/plplot_version.cmake =================================================================== --- trunk/cmake/modules/plplot_version.cmake 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/cmake/modules/plplot_version.cmake 2013-11-12 00:54:54 UTC (rev 12677) @@ -4,16 +4,9 @@ # Version data that need review and possible modification for each release. -set(VERSION 5.9.10) +# Overall PLplot version number. +set(PLPLOT_VERSION 5.9.10) -# According to man package, PLPLOT_TCL_VERSION (used in the various -# pkgIndex.tcl scripts) should be strictly numbers alternating with -# decimal points with the first number (the major number) signifying -# incompatible changes in the scripts. To keep our life simple, let us -# use the same as the VERSION above so long as it is strictly numerical. - -set(PLPLOT_TCL_VERSION ${VERSION}) - # CPack version numbers for release tarball name. set(CPACK_PACKAGE_VERSION_MAJOR 5) set(CPACK_PACKAGE_VERSION_MINOR 9) Modified: trunk/config.h.in =================================================================== --- trunk/config.h.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/config.h.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -276,12 +276,17 @@ // Define to 1 if you have the ANSI C header files. #cmakedefine STDC_HEADERS 1 +// Overall PLplot version number +#define PLPLOT_VERSION "@PLPLOT_VERSION@" + // Location of Tcl stuff -#define TCL_DIR "@TCL_DIR@" +#define TCL_DIR "@TCL_DIR@" +// Consistent package versions for Itcl and friends found by PLplot +// If PLplot could not find consistent values these are set to 0.0.0 +#define PLPLOT_ITCL_VERSION "@PLPLOT_ITCL_VERSION@" +#define PLPLOT_ITK_VERSION "@PLPLOT_ITK_VERSION@" +#define PLPLOT_IWIDGETS_VERSION "@PLPLOT_IWIDGETS_VERSION@" -// Version number of package -#define VERSION "@VERSION@" - // Define if csa is desired #cmakedefine WITH_CSA Modified: trunk/doc/Doxyfile.in =================================================================== --- trunk/doc/Doxyfile.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/doc/Doxyfile.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -32,7 +32,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @VERSION@ +PROJECT_NUMBER = @PLPLOT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer Modified: trunk/drivers/ps.c =================================================================== --- trunk/drivers/ps.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/drivers/ps.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -252,7 +252,7 @@ fprintf( OF, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" ); fprintf( OF, "%%%%Title: PLplot Graph\n" ); - fprintf( OF, "%%%%Creator: PLplot Version %s\n", VERSION ); + fprintf( OF, "%%%%Creator: PLplot Version %s\n", PLPLOT_VERSION ); fprintf( OF, "%%%%CreationDate: %s\n", ps_getdate() ); fprintf( OF, "%%%%Pages: (atend)\n" ); fprintf( OF, "%%%%EndComments\n\n" ); Modified: trunk/drivers/psttf.cc =================================================================== --- trunk/drivers/psttf.cc 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/drivers/psttf.cc 2013-11-12 00:54:54 UTC (rev 12677) @@ -319,7 +319,7 @@ doc->osHeader() << "%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doc->osHeader() << "%%Title: PLplot Graph\n"; - doc->osHeader() << "%%Creator: PLplot Version " << VERSION << "\n"; + doc->osHeader() << "%%Creator: PLplot Version " << PLPLOT_VERSION << "\n"; doc->osHeader() << "%%CreationDate: " << ps_getdate() << "\n"; doc->osHeader() << "%%Pages: (atend)\n"; doc->osHeader() << "%%EndComments\n\n"; Modified: trunk/pkgcfg/plplot-template.pc.in =================================================================== --- trunk/pkgcfg/plplot-template.pc.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/pkgcfg/plplot-template.pc.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -1,10 +1,10 @@ libdir=@SHLIB_DIR@ includedir=@INCLUDE_DIR@ -drvdir=@LIB_DIR@/plplot@VERSION@/drivers@LIB_TAG@ +drvdir=@LIB_DIR@/plplot@PLPLOT_VERSION@/drivers@LIB_TAG@ Name: PLplot @PC_SHORT_NAME@ Description: Scientific plotting library (@PC_LONG_NAME@@PC_PRECISION@ precision) @PC_REQUIRES_TAG@: @PC_REQUIRES@ -Version: @VERSION@ +Version: @PLPLOT_VERSION@ Libs: -L${libdir} @PC_LINK_FLAGS@ Cflags: -I${includedir} @PC_COMPILE_FLAGS@ Modified: trunk/plplot_test/plplot-test.sh.in =================================================================== --- trunk/plplot_test/plplot-test.sh.in 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/plplot_test/plplot-test.sh.in 2013-11-12 00:54:54 UTC (rev 12677) @@ -33,7 +33,7 @@ # (e.g., gv for postscript files and kview or a browser for png, gif, # or jpeg files on Linux systems) to make sure they display properly. -version=@VERSION@ +version=@PLPLOT_VERSION@ EXAMPLES_DIR=${EXAMPLES_DIR:-.} SRC_EXAMPLES_DIR=${SRC_EXAMPLES_DIR:-.} Modified: trunk/src/plargs.c =================================================================== --- trunk/src/plargs.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/src/plargs.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -1578,7 +1578,7 @@ opt_v( const char * PL_UNUSED( opt ), const char * PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) ) { if ( !mode_quiet ) - fprintf( stderr, "PLplot library version: %s\n", VERSION ); + fprintf( stderr, "PLplot library version: %s\n", PLPLOT_VERSION ); return 2; } Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2013-11-11 22:23:48 UTC (rev 12676) +++ trunk/src/plcore.c 2013-11-12 00:54:54 UTC (rev 12677) @@ -3823,7 +3823,7 @@ void c_plgver( char *p_ver ) { - strcpy( p_ver, VERSION ); + strcpy( p_ver, PLPLOT_VERSION ); } // Set inferior X window This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |