From: <ai...@us...> - 2009-02-23 19:19:00
|
Revision: 9590 http://plplot.svn.sourceforge.net/plplot/?rev=9590&view=rev Author: airwin Date: 2009-02-23 19:18:56 +0000 (Mon, 23 Feb 2009) Log Message: ----------- Try mapping PLUNICODE to 32-bit Fortran integers for the f95 versions of plsfci and plgfci (similar to the previous simplifying change we made for f77). This simplified approach works for gfortran but should be tested on other compilers as well. Modified Paths: -------------- trunk/bindings/f95/CMakeLists.txt trunk/bindings/f95/scstubs.c trunk/examples/f95/x23f.f90 Modified: trunk/bindings/f95/CMakeLists.txt =================================================================== --- trunk/bindings/f95/CMakeLists.txt 2009-02-23 18:44:56 UTC (rev 9589) +++ trunk/bindings/f95/CMakeLists.txt 2009-02-23 19:18:56 UTC (rev 9590) @@ -45,8 +45,10 @@ FILE(APPEND "${INC_FILE}" "integer, parameter :: plflt = kind(1.0)\n") endif(PL_DOUBLE) + # Only 4 bytes required in Fortran to represent an unsigned 32-bit + # PLUNICODE. FILE(APPEND "${INC_FILE}" - "integer, parameter :: plunicode = selected_int_kind(10)\n") + "integer, parameter :: plunicode = 4\n") # Mark the include file as being generated set_source_files_properties(plflt.inc PROPERTIES GENERATED ON) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2009-02-23 18:44:56 UTC (rev 9589) +++ trunk/bindings/f95/scstubs.c 2009-02-23 19:18:56 UTC (rev 9590) @@ -305,15 +305,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 @@ -834,16 +832,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. */ -/* PLSFCI(PLINT64 *fci) */ +/* 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/f95/x23f.f90 =================================================================== --- trunk/examples/f95/x23f.f90 2009-02-23 18:44:56 UTC (rev 9589) +++ trunk/examples/f95/x23f.f90 2009-02-23 19:18:56 UTC (rev 9590) @@ -187,37 +187,41 @@ 0, & 0 / +! drop the leading '8' marker for FCI because some compilers (gfortran) +! have an implementation error (integer overflow error) for that case, and +! 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", & @@ -355,7 +359,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)') & +! 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. |