json-fortran 4.0.0

json-fortran-logo-250pxI just tagged the 4.0.0 release of json-fortran.  This is the first release with Unicode support (thanks to Izaak Beekman). Who says there are no good open source Fortran projects on the internet?

The Unicode build of the library is optional (and only enabled using the preprocessor directive USE_UCS4). Currently, this only works with Gfortran. It doesn’t yet work with the Intel Fortran Compiler, which is lagging behind on Unicode support. The Fortran standard supports Unicode via the selected_char_kind function, which can be used to specify the character set used for a character string, like so:

integer,parameter :: u = selected_char_kind('ISO_10646')
character(kind=u,len=11) :: string = u_'Hello World'


Tagged with: , , ,
5 comments on “json-fortran 4.0.0
  1. Stefano says:

    Hi Jacob,
    your json_fortran is great! Go on!

    I have not yet found the time to dive into its source, but I have a question: do you use deferred length allocatable strings as a member of a derived type? In case, which version of Gfortran you are using? I have a serious problem with Gfortran: I make too much (ab)use of deferred length allocatable strings defined into derived type and Gfortran 4.9.x fails to build such codes. I am wondering if you are using a newer version of Gfortran, and in case if it support deferred length allocatable strings defined into derived type.

    See you soon.

  2. Jacob says:

    Yes, I’m using allocatable strings within a derived type. It is working for me, but I have noticed some bugs (there are some workarounds in the code to get around these bugs, you can search for “bug” to see them). I’m using 4.9 and also 5.0 from http://hpc.sourceforge.net

    • Stefano says:

      Thank you Jacob,
      I have read a lot of your workarounds. If I understand correctly, you use temporary-buffer-allocatable-strings for IO and string manipulations and only after you have finished your work you copy them into the actual allocatable strings defined within the derived type, is it right?

      See you soon.

  3. Jacob says:

    Yes, that’s right. I think, in particular, the bug happens when the allocatable string in the type is passed into a subroutine where the allocatable string dummy argument is intent(out). I don’t know if this has already been reported to the Gfortran folks or not.

    • Izaak Beekman says:

      I suspect this has yet to be reported… I’ve been having issues still in gfortran 5.1 with intent out or function result allocatable strings. (Some not even embedded in derived types!) One work around I have found is to use sourced allocation rather than reallocation on assignment, FWIW.

Leave a Reply

Your email address will not be published. Required fields are marked *