From: <arj...@us...> - 2009-11-11 12:06:43
|
Revision: 10580 http://plplot.svn.sourceforge.net/plplot/?rev=10580&view=rev Author: arjenmarkus Date: 2009-11-11 12:06:11 +0000 (Wed, 11 Nov 2009) Log Message: ----------- Correct two F95-isms in example x19f for FORTRAN 77. Note that the interface has to explicitly use the hidden string length argument. (It also assumes this appears at the end of the argument list) Modified Paths: -------------- trunk/bindings/f77/scstubs.c trunk/examples/f77/x19f.fm4 Modified: trunk/bindings/f77/scstubs.c =================================================================== --- trunk/bindings/f77/scstubs.c 2009-11-10 19:13:35 UTC (rev 10579) +++ trunk/bindings/f77/scstubs.c 2009-11-11 12:06:11 UTC (rev 10580) @@ -37,8 +37,9 @@ static void ( STDCALL *plmapform )( PLINT *, PLFLT *, PLFLT * ); /* Note: slightly different prototype than * (*mapform)! */ /* Slightly different to (*label_func) as we don't support PLPointer for - * additional data in f77. */ -static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT * ); + * additional data in f77. + * Note the hidden argument! */ +static void ( STDCALL *pllabelfunc )( PLINT *, PLFLT *, char *, PLINT *, PLINT ); void PL_SETCONTLABELFORMAT( PLINT *lexp, PLINT *sigdig ) @@ -481,7 +482,10 @@ { int i; - ( *pllabelfunc )( &axis, &value, label, &length ); + /* (AM) Note the hidden argument "length" - it ensures that the string "label" + is recognised to have that length + */ + ( *pllabelfunc )( &axis, &value, label, &length, length ); /* Ensure string is null terminated */ i = length - 1; Modified: trunk/examples/f77/x19f.fm4 =================================================================== --- trunk/examples/f77/x19f.fm4 2009-11-10 19:13:35 UTC (rev 10579) +++ trunk/examples/f77/x19f.fm4 2009-11-11 12:06:11 UTC (rev 10580) @@ -38,6 +38,20 @@ end c-------------------------------------------------------------------------- +c floor +c +c Compatibility function - keep all examples as equal as possible +c-------------------------------------------------------------------------- + real*8 function floor(x) + real*8 x + if ( x .gt. 0.0d0 ) then + floor = real(int(x)) + else + floor = real(int(x)-1) + endif + end + +c-------------------------------------------------------------------------- c mapform19 c c Defines specific coordinate transformation for example 19. @@ -67,7 +81,7 @@ return end -c "Normalize" longitude values so that they always fall between +c "Normalize" longitude values so that they always fall between c -180.0 and 180.0 function normalize_longitude(lon) implicit none @@ -76,7 +90,7 @@ if ((lon .ge. -180.0d0) .and. (lon .le. 180.0d0)) then normalize_longitude = lon - else + else times = floor ((abs(lon) + 180.0d0) / 360.0d0) if (lon .lt. 0.0d0) then normalize_longitude = lon + 360.0d0 * times @@ -92,7 +106,7 @@ implicit none integer axis, length real*8 value - character*(length) label + character*(*) label character*5 direction_label real*8 label_val real*8 normalize_longitude @@ -115,13 +129,13 @@ else direction_label = '' endif - endif + endif if (axis .eq. 2 .and. value .eq. 0.0d0) then c A special case for the equator - label = direction_label + label = direction_label else if (abs(label_val) .lt. 100.0d0) then write(label,'(I2.1,A2)') iabs(int(label_val)),direction_label - else + else write(label,'(I3.1,A2)') iabs(int(label_val)),direction_label endif end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |