Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 lines
2.4 KiB

  1. ! JSON-Fortran preprocessor macros.
  2. !
  3. ! License
  4. ! JSON-Fortran is released under a BSD-style license.
  5. ! See the [LICENSE](https://github.com/jacobwilliams/json-fortran/blob/master/LICENSE)
  6. ! file for details.
  7. !*********************************************************
  8. ! File encoding preprocessor macro.
  9. !
  10. #if defined __GFORTRAN__ && defined USE_UCS4
  11. ! gfortran compiler AND UCS4 support requested, & silence redefine warning:
  12. ! Make sure we output files with utf-8 encoding too
  13. #define FILE_ENCODING ,encoding='UTF-8'
  14. #else
  15. ! don't ask for utf-8 file encoding unless using UCS4
  16. ! this may let us use unformatted stream io to read in files more quickly
  17. ! even with unicode support turned on `inquire( ... encoding=FL_ENCODING)`
  18. ! may be able to detect json files in which each character is exactly one
  19. ! byte
  20. #define FILE_ENCODING
  21. #endif
  22. !*********************************************************
  23. !*********************************************************
  24. ! This C preprocessor macro will take a procedure name as an
  25. ! input, and output either that same procedure name if the
  26. ! code is compiled without USE_UCS4 being defined or it will
  27. ! expand the procedure name to the original procedure name,
  28. ! followed by a comma and then the original procedure name
  29. ! with 'wrap_' prepended to it. This is suitable for creating
  30. ! overloaded interfaces that will accept UCS4 character actual
  31. ! arguments as well as DEFAULT/ASCII character arguments,
  32. ! based on whether or not ISO 10646 is supported and requested.
  33. !
  34. # ifdef USE_UCS4
  35. # ifdef __GFORTRAN__
  36. ! gfortran uses cpp in old-school compatibility mode so
  37. ! the # stringify and ## concatenate operators don't work
  38. ! but we can use C/C++ style comment to ensure PROCEDURE is
  39. ! correctly tokenized and prepended with 'wrap_' when the
  40. ! macro is expanded
  41. # define MAYBEWRAP(PROCEDURE) PROCEDURE , wrap_/**/PROCEDURE
  42. # endif
  43. ! ifdef __INTEL_COMPILER
  44. ! Intel's fpp does support the more contemporary ## concatenation
  45. ! operator, but doesn't treat the C/C++ comments the same way.
  46. ! If you use the gfortran approach and pass the -noB switch to
  47. ! fpp, the macro will expand, but with a space between wrap_ and
  48. ! whatever PROCEDURE expands to
  49. ! Intel doesn't support ISO 10646 yet, but this is here to
  50. ! ease the transition once they do.
  51. ! define MAYBEWRAP(PROCEDURE) PROCEDURE , wrap_##PROCEDURE
  52. ! endif
  53. # else
  54. # define MAYBEWRAP(PROCEDURE) PROCEDURE
  55. # endif
  56. !*********************************************************