Simulation Core
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

105 rader
3.9 KiB

  1. !*****************************************************************************************
  2. !> author: Jacob Williams
  3. ! license: BSD
  4. !
  5. ! A Modern Fortran JSON (JavaScript Object Notation) API.
  6. !
  7. ! This module provides access to [[json_value_module]] and
  8. ! [[json_file_module]]. For normal JSON-Fortran use, using this module
  9. ! is all that is necessary.
  10. !
  11. ! Note that this module renames the kind definition variables from [[json_kinds]]
  12. ! from [`RK`, `IK`, `LK`, `CK`, and `CDK`] to [`json_RK`, `json_IK`, `json_LK`,
  13. ! `json_CK`, and `json_CDK`] so as to avoid namespace pollution with short
  14. ! variable names.
  15. !
  16. #ifdef USE_UCS4
  17. #pragma push_macro("USE_UCS4")
  18. #undef USE_UCS4
  19. ! Since ```USE_UCS4``` **is** defined, this module also exports the
  20. ! operators `==`, `/=`, and `//` from [[json_string_utilities]] for
  21. ! `CK` and `CDK` operations.
  22. #pragma pop_macro("USE_UCS4")
  23. #endif
  24. !
  25. !### License
  26. ! * JSON-Fortran is released under a BSD-style license.
  27. ! See the [LICENSE](https://github.com/jacobwilliams/json-fortran/blob/master/LICENSE)
  28. ! file for details.
  29. !
  30. !### History
  31. ! * Joseph A. Levin : March 2012 : Original [FSON](https://github.com/josephalevin/fson)
  32. ! code [retrieved on 12/2/2013].
  33. ! * Jacob Williams : 2/8/2014 : Extensive modifications to the original FSON code.
  34. ! The original F95 code was split into four files:
  35. ! fson_path_m.f95, fson_string_m.f95, fson_value_m.f95, and fson.f95.
  36. ! The new code has been extensively updated, refactored and combined into this
  37. ! one module (json_module.f90).
  38. ! Various Fortran 2003/2008 features are now used
  39. ! (e.g., allocatable strings, newunit, generic, class, and abstract interface).
  40. ! * Development continues at: [Github](https://github.com/jacobwilliams/json-fortran)
  41. !
  42. !### See also
  43. ! * [json-fortran development site](https://github.com/jacobwilliams/json-fortran)
  44. ! * [json-fortran online documentation](https://jacobwilliams.github.io/json-fortran)
  45. ! * [JSON website](http://www.json.org/)
  46. ! * [JSON validator](http://jsonlint.com/)
  47. !
  48. !@note Originally JSON-Fortran was entirely contained within this module.
  49. module json_module
  50. use json_kinds, only: json_RK => RK, &
  51. json_IK => IK, &
  52. json_LK => LK, &
  53. json_CK => CK, &
  54. json_CDK => CDK
  55. #ifdef USE_UCS4
  56. use json_string_utilities, only: operator(==),&
  57. operator(//),&
  58. operator(/=)
  59. #endif
  60. use json_parameters, only: json_unknown,&
  61. json_null, &
  62. json_object, &
  63. json_array, &
  64. json_logical,&
  65. json_integer,&
  66. json_real, &
  67. json_double, &
  68. json_string
  69. use json_value_module
  70. use json_file_module
  71. implicit none
  72. character(kind=json_CK,len=*),parameter,private :: version = '8.3.0'
  73. !! JSON-Fortran version.
  74. !!
  75. !!@note This string should match the one in the `.VERSION` file (which is used
  76. !! for the documentation generation.)
  77. public
  78. contains
  79. !*****************************************************************************************
  80. !*****************************************************************************************
  81. !>
  82. ! Returns the JSON-Fortran version string.
  83. function json_fortran_version() result(ver)
  84. implicit none
  85. character(len=:),allocatable :: ver !! JSON-Fortran version string
  86. ver = version
  87. end function json_fortran_version
  88. !*****************************************************************************************
  89. !*****************************************************************************************
  90. end module json_module
  91. !*****************************************************************************************