Index: palm/trunk/SOURCE/posix_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/posix_interface_mod.f90	(revision 4628)
+++ palm/trunk/SOURCE/posix_interface_mod.f90	(revision 4649)
@@ -1,4 +1,4 @@
 !> @file posix_interface_mod.f90
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! This file is part of the PALM model system.
 !
@@ -15,5 +15,6 @@
 !
 ! Copyright 1997-2020 Leibniz Universitaet Hannover
-! -------------------------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+!
 !
 ! Current revisions:
@@ -24,15 +25,19 @@
 ! -----------------
 ! $Id$
-! extensions required for MPI-I/O of particle data to restart files
-! 
+! File re-formatted to follow the PALM coding standard
+!
+!
+! 4628 2020-07-29 07:23:03Z raasch
+! Extensions required for MPI-I/O of particle data to restart files
+!
 ! 4495 2020-04-13 20:11:20Z raasch
 ! Initial version (K. Ketelsen)
 !
-! 
-!
+!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Interface to some POSIX system calls, mainly used for read/write of restart files
-!> in non-parallel mode in MPI-IO compatible format.
+!> Interface to some POSIX system calls, mainly used for read/write of restart files in non-parallel
+!> mode in MPI-IO compatible format.
 !--------------------------------------------------------------------------------------------------!
  MODULE posix_interface
@@ -50,9 +55,9 @@
 !
 !-- Definitions copied from C include file fcntl.h
-    INTEGER, PARAMETER ::  O_RDONLY =  0
-    INTEGER, PARAMETER ::  O_WRONLY =  1
-    INTEGER, PARAMETER ::  O_RDWR   =  2
-    INTEGER, PARAMETER ::  O_CREAT  = 64  !> 0100 octal
-    INTEGER, PARAMETER ::  SEEK_SET =  0
+    INTEGER, PARAMETER ::  o_creat  = 64  !< 0100 octal
+    INTEGER, PARAMETER ::  o_rdonly =  0  !<
+    INTEGER, PARAMETER ::  o_rdwr   =  2  !<
+    INTEGER, PARAMETER ::  o_wronly =  1  !<
+    INTEGER, PARAMETER ::  seek_set =  0  !<
 
 
@@ -63,7 +68,7 @@
           USE ISO_C_BINDING
           IMPLICIT NONE
-          CHARACTER(KIND=C_CHAR), DIMENSION(128) ::  pathname
-          INTEGER(KIND=C_INT), VALUE             ::  flags
-          INTEGER(KIND=C_INT), VALUE             ::  mode
+          CHARACTER(KIND=C_CHAR), DIMENSION(128) ::  pathname  !<
+          INTEGER(KIND=C_INT), VALUE             ::  flags     !<
+          INTEGER(KIND=C_INT), VALUE             ::  mode      !<
        END FUNCTION C_OPEN
     END INTERFACE
@@ -73,7 +78,7 @@
          USE ISO_C_BINDING
          IMPLICIT NONE
-         INTEGER(KIND=C_INT), VALUE              ::  fd
-         INTEGER(KIND=C_SIZE_T), VALUE           ::  offset
-         INTEGER(KIND=C_INT), VALUE              ::  whence
+         INTEGER(KIND=C_INT), VALUE    ::  fd      !<
+         INTEGER(KIND=C_SIZE_T), VALUE ::  offset  !<
+         INTEGER(KIND=C_INT), VALUE    ::  whence  !<
       END FUNCTION C_LSEEK
    END INTERFACE
@@ -86,7 +91,7 @@
           USE ISO_C_BINDING
           IMPLICIT NONE
-          INTEGER(KIND=C_INT), VALUE            ::  fd
-          TYPE(C_PTR), VALUE                    ::  buf
-          INTEGER(KIND=C_SIZE_T), VALUE         ::  nr_byte
+          INTEGER(KIND=C_INT), VALUE    ::  fd       !<
+          INTEGER(KIND=C_SIZE_T), VALUE ::  nr_byte  !<
+          TYPE(C_PTR), VALUE            ::  buf      !<
           END FUNCTION C_READ
     END INTERFACE
@@ -96,7 +101,7 @@
           USE ISO_C_BINDING
           IMPLICIT NONE
-          INTEGER(KIND=C_INT), VALUE            ::  fd
-          TYPE(C_PTR), VALUE                    ::  buf
-          INTEGER(KIND=C_SIZE_T), VALUE         ::  nr_byte
+          INTEGER(KIND=C_INT), VALUE    ::  fd       !<
+          INTEGER(KIND=C_SIZE_T), VALUE ::  nr_byte  !<
+          TYPE(C_PTR), VALUE            ::  buf      !<
        END FUNCTION C_WRITE
     END INTERFACE
@@ -106,5 +111,5 @@
           USE ISO_C_BINDING
           IMPLICIT NONE
-          INTEGER(KIND=C_INT), VALUE            ::  fd
+          INTEGER(KIND=C_INT), VALUE ::  fd  !<
        END FUNCTION C_CLOSE
     END INTERFACE
@@ -150,5 +155,9 @@
     END INTERFACE posix_write
 
-    PUBLIC posix_close, posix_lseek, posix_open, posix_read, posix_write
+    PUBLIC posix_close,                                                                            &
+           posix_lseek,                                                                            &
+           posix_open,                                                                             &
+           posix_read,                                                                             &
+           posix_write
 
  CONTAINS
@@ -158,17 +167,17 @@
     IMPLICIT NONE
 
-    CHARACTER(LEN=*), INTENT(IN)            ::  file_name
-    CHARACTER(LEN=1), DIMENSION(:), POINTER ::  f_string
-    CHARACTER(LEN=128), TARGET              ::  lo_file_name
-
-    INTEGER(C_INT)                          ::  fd
-    INTEGER(C_INT)                          ::  flags
-    INTEGER(C_INT)                          ::  name_len
-    INTEGER(C_INT)                          ::  mode
-    INTEGER, DIMENSION(1)                   ::  bufshape
-
-    LOGICAL, INTENT(IN)                     ::  rd_flag
-
-    TYPE(C_PTR)                             ::  ptr
+    CHARACTER(LEN=*), INTENT(IN)            ::  file_name     !<
+    CHARACTER(LEN=1), DIMENSION(:), POINTER ::  f_string      !<
+    CHARACTER(LEN=128), TARGET              ::  lo_file_name  !<
+
+    INTEGER(C_INT)                          ::  fd            !<
+    INTEGER(C_INT)                          ::  flags         !<
+    INTEGER(C_INT)                          ::  name_len      !<
+    INTEGER(C_INT)                          ::  mode          !<
+    INTEGER, DIMENSION(1)                   ::  bufshape      !<
+
+    LOGICAL, INTENT(IN)                     ::  rd_flag       !<
+
+    TYPE(C_PTR)                             ::  ptr           !<
 
 
@@ -177,5 +186,5 @@
 !-- different FORTRAN compiler
     name_len     = LEN( TRIM( file_name ) ) + 1
-    lo_file_name = TRIM( file_name ) // CHAR(0)
+    lo_file_name = TRIM( file_name ) // CHAR( 0 )
     ptr          = C_LOC( lo_file_name(1:1) )
     bufshape(1)  = name_len
@@ -185,9 +194,9 @@
 
     IF ( rd_flag )  THEN
-       flags = O_RDONLY
-       fd    = C_OPEN (f_string, flags, mode)  ! Open for reading
+       flags = o_rdonly
+       fd    = C_OPEN( f_string, flags, mode )  ! Open for reading
     ELSE
-       flags = O_WRONLY + O_CREAT
-       fd    = C_OPEN (f_string, flags, mode)  ! Open for writing
+       flags = o_wronly + o_creat
+       fd    = C_OPEN( f_string, flags, mode )  ! Open for writing
     ENDIF
 
@@ -202,13 +211,13 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                ::  fid
-    INTEGER(KIND=C_INT)                ::  my_fid
-    INTEGER(KIND=C_SIZE_T), INTENT(IN) ::  offset
-    INTEGER(KIND=C_SIZE_T)             ::  retval
-    INTEGER(KIND=C_INT)                ::  whence
+    INTEGER, INTENT(IN)                ::  fid     !<
+    INTEGER(KIND=C_INT)                ::  my_fid  !<
+    INTEGER(KIND=C_SIZE_T), INTENT(IN) ::  offset  !<
+    INTEGER(KIND=C_SIZE_T)             ::  retval  !<
+    INTEGER(KIND=C_INT)                ::  whence  !<
 
 
     my_fid = fid
-    whence = SEEK_SET
+    whence = seek_set
 
     retval = C_LSEEK( my_fid, offset, whence )
@@ -222,10 +231,9 @@
     IMPLICIT NONE
 
-    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:) ::  data
-    INTEGER, INTENT(IN)                                 ::  fid
-    INTEGER                                             ::  nr_byte
-    INTEGER, INTENT(IN)                                 ::  nw
-
-    TYPE(C_PTR)                                         ::  buf
+    INTEGER                                             ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                 ::  fid      !<
+    INTEGER, INTENT(IN)                                 ::  nw       !<
+    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:) ::  data     !<
+    TYPE(C_PTR)                                         ::  buf      !<
 
 
@@ -243,10 +251,9 @@
     IMPLICIT NONE
 
-    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:,:) ::  data
-    INTEGER, INTENT(IN)                                   ::  fid
-    INTEGER                                               ::  nr_byte
-    INTEGER, INTENT(IN)                                   ::  nw
-
-    TYPE(C_PTR)                                           ::  buf
+    INTEGER                                               ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                   ::  fid      !<
+    INTEGER, INTENT(IN)                                   ::  nw       !<
+    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:,:) ::  data     !<
+    TYPE(C_PTR)                                           ::  buf      !<
 
 
@@ -264,10 +271,9 @@
     IMPLICIT NONE
 
-    INTEGER(KIND=isp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data         !<
-    INTEGER, INTENT(IN)                                     ::  fid          !<
-    INTEGER                                                 ::  nr_byte      !<
-    INTEGER, INTENT(IN)                                     ::  nw           !<
-
-    TYPE(C_PTR)                                             ::  buf          !<
+    INTEGER                                                 ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                     ::  fid      !<
+    INTEGER, INTENT(IN)                                     ::  nw       !<
+    INTEGER(KIND=isp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data     !<
+    TYPE(C_PTR)                                             ::  buf      !<
 
 
@@ -285,10 +291,9 @@
     IMPLICIT NONE
 
-    INTEGER(KIND=idp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data         !<
-    INTEGER, INTENT(IN)                                     ::  fid          !<
-    INTEGER                                                 ::  nr_byte      !<
-    INTEGER, INTENT(IN)                                     ::  nw           !<
-
-    TYPE(C_PTR)                                             ::  buf          !<
+    INTEGER                                                 ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                     ::  fid      !<
+    INTEGER, INTENT(IN)                                     ::  nw       !<
+    INTEGER(KIND=idp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data     !<
+    TYPE(C_PTR)                                             ::  buf      !<
 
 
@@ -306,9 +311,9 @@
     IMPLICIT NONE
 
-    INTEGER(KIND=C_SIZE_T), INTENT(IN), TARGET, DIMENSION(:) ::  data
-    INTEGER, INTENT(IN)                                      ::  fid
-    INTEGER                                                  ::  nr_byte
-    INTEGER, INTENT(IN)                                      ::  nw
-    TYPE(C_PTR)                                              ::  buf
+    INTEGER                                                  ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                      ::  fid      !<
+    INTEGER, INTENT(IN)                                      ::  nw       !<
+    INTEGER(KIND=C_SIZE_T), INTENT(IN), TARGET, DIMENSION(:) ::  data     !<
+    TYPE(C_PTR)                                              ::  buf      !<
 
 
@@ -326,11 +331,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                             ::  fid
-    INTEGER                                         ::  nr_byte
-    INTEGER, INTENT(IN)                             ::  nw
-
-    REAL(KIND=wp), INTENT(IN), TARGET, DIMENSION(:) ::  data
-
-    TYPE(C_PTR)                                     ::  buf
+    INTEGER                                         ::  nr_byte  !<
+    INTEGER, INTENT(IN)                             ::  fid      !<
+    INTEGER, INTENT(IN)                             ::  nw       !<
+
+    REAL(KIND=wp), INTENT(IN), TARGET, DIMENSION(:) ::  data     !<
+
+    TYPE(C_PTR)                                     ::  buf      !<
 
 
@@ -348,11 +353,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                  ::  fid
-    INTEGER                                              ::  nr_byte
-    INTEGER, INTENT(IN)                                  ::  nw
-
-    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:) ::  data
-
-    TYPE(C_PTR)                                          ::  buf
+    INTEGER                                              ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                  ::  fid      !<
+    INTEGER, INTENT(IN)                                  ::  nw       !<
+
+    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:) ::  data     !<
+
+    TYPE(C_PTR)                                          ::  buf      !<
 
 
@@ -370,11 +375,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                    ::  fid
-    INTEGER                                                ::  nr_byte
-    INTEGER, INTENT(IN)                                    ::  nw
-
-    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:,:) ::  data
-
-    TYPE(C_PTR)                                            ::  buf
+    INTEGER                                                ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                    ::  fid      !<
+    INTEGER, INTENT(IN)                                    ::  nw       !<
+
+    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:,:) ::  data     !<
+
+    TYPE(C_PTR)                                            ::  buf      !<
 
 
@@ -392,11 +397,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)    ::  fid
-    INTEGER(KIND=C_INT)    ::  my_fid
-    INTEGER , INTENT(IN)   ::  nb
-    INTEGER(KIND=C_SIZE_T) ::  nr_byte
-    INTEGER(KIND=C_SIZE_T) ::  retval
-
-    TYPE(C_PTR)            ::  buf
+    INTEGER, INTENT(IN)    ::  fid      !<
+    INTEGER , INTENT(IN)   ::  nb       !<
+    INTEGER(KIND=C_INT)    ::  my_fid   !<
+    INTEGER(KIND=C_SIZE_T) ::  nr_byte  !<
+    INTEGER(KIND=C_SIZE_T) ::  retval   !<
+
+    TYPE(C_PTR)            ::  buf      !<
 
 
@@ -407,10 +412,10 @@
 
 !
-!-- The posix standard says that is not guaranteed that all bytes are read in one read system call.
-!-- If retval is not equal to nr_byte, another system call has to be issued.
+!-- The posix standard says that it is not guaranteed that all bytes are read in one read system
+!-- call. If retval is not equal to nr_byte, another system call has to be issued.
 !-- However, in all Unix distributions it is commonly accepted, that all bytes are read in one call
 !-- during during disk-IO. Therefore, here is only an error query and no reading in a while loop.
     IF ( retval /= nr_byte )  THEN
-        WRITE(6,*) 'Number of bytes read does not match the number of requested bytes'
+        WRITE( 6, * ) 'Number of bytes read does not match the number of requested bytes'
         CALL abort
     ENDIF
@@ -424,14 +429,14 @@
     IMPLICIT NONE
 
-    CHARACTER(LEN=*), DIMENSION(:)   ::  data
-    CHARACTER(LEN=LEN(data)), TARGET ::  data_buf
-
-    INTEGER, INTENT(IN)              ::  fid
-    INTEGER                          ::  i
-    INTEGER(KIND=C_INT)              ::  my_fid
-    INTEGER(KIND=C_SIZE_T)           ::  name_len
-    INTEGER(KIND=C_SIZE_T)           ::  retval
-
-    TYPE(C_PTR)                      ::  ptr
+    CHARACTER(LEN=*), DIMENSION(:)   ::  data      !<
+    CHARACTER(LEN=LEN(data)), TARGET ::  data_buf  !<
+
+    INTEGER                          ::  i         !<
+    INTEGER, INTENT(IN)              ::  fid       !<
+    INTEGER(KIND=C_INT)              ::  my_fid    !<
+    INTEGER(KIND=C_SIZE_T)           ::  name_len  !<
+    INTEGER(KIND=C_SIZE_T)           ::  retval    !<
+
+    TYPE(C_PTR)                      ::  ptr       !<
 
 
@@ -440,5 +445,5 @@
     DO  i = 1, SIZE( data )
        data_buf = data(i)
-       name_len = LEN(data(i))
+       name_len = LEN( data(i) )
        ptr      = C_LOC( data_buf(1:1) )
        retval   = C_READ( my_fid, ptr, name_len )
@@ -454,13 +459,13 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                 ::  fid
-    INTEGER(KIND=C_INT)                                 ::  my_fid
-    INTEGER(KIND=C_SIZE_T)                              ::  nr_byte
-    INTEGER , INTENT(IN)                                ::  nw
-    INTEGER(KIND=C_SIZE_T)                              ::  retval
-
-    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:) ::  data
-
-    TYPE(C_PTR)                                         ::  buf
+    INTEGER, INTENT(IN)                                 ::  fid      !<
+    INTEGER ,INTENT(IN)                                 ::  nw       !<
+    INTEGER(KIND=C_INT)                                 ::  my_fid   !<
+    INTEGER(KIND=C_SIZE_T)                              ::  nr_byte  !<
+    INTEGER(KIND=C_SIZE_T)                              ::  retval   !<
+
+    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:) ::  data     !<
+
+    TYPE(C_PTR)                                         ::  buf      !<
 
 
@@ -479,11 +484,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                   ::  fid
-    INTEGER                                               ::  nr_byte
-    INTEGER, INTENT(IN)                                   ::  nw
-
-    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:,:) ::  data
-
-    TYPE(C_PTR)                                           :: buf
+    INTEGER                                               ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                   ::  fid      !<
+    INTEGER, INTENT(IN)                                   ::  nw       !<
+
+    INTEGER(KIND=iwp), INTENT(IN), TARGET, DIMENSION(:,:) ::  data     !<
+
+    TYPE(C_PTR)                                           :: buf       !<
 
 
@@ -501,11 +506,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                     ::  fid        !<
-    INTEGER                                                 ::  nr_byte    !<
-    INTEGER, INTENT(IN)                                     ::  nw         !<
-
-    INTEGER(KIND=isp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data       !<
-
-    TYPE(C_PTR)                                             ::  buf        !<
+    INTEGER                                                 ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                     ::  fid      !<
+    INTEGER, INTENT(IN)                                     ::  nw       !<
+
+    INTEGER(KIND=isp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data     !<
+
+    TYPE(C_PTR)                                             ::  buf      !<
 
 
@@ -523,11 +528,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                     ::  fid        !<
-    INTEGER                                                 ::  nr_byte    !<
-    INTEGER, INTENT(IN)                                     ::  nw         !<
-
-    INTEGER(KIND=idp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data       !<
-
-    TYPE(C_PTR)                                             ::  buf        !<
+    INTEGER                                                 ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                     ::  fid      !<
+    INTEGER, INTENT(IN)                                     ::  nw       !<
+
+    INTEGER(KIND=idp), INTENT(IN), TARGET, DIMENSION(:,:,:) ::  data     !<
+
+    TYPE(C_PTR)                                             ::  buf      !<
 
 
@@ -545,11 +550,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                      ::  fid
-    INTEGER                                                  ::  nr_byte
-    INTEGER, INTENT(IN)                                      ::  nw
-
-    INTEGER(KIND=C_SIZE_T), INTENT(IN), TARGET, DIMENSION(:) ::  data
-
-    TYPE(C_PTR)                                              ::  buf
+    INTEGER                                                  ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                      ::  fid      !<
+    INTEGER, INTENT(IN)                                      ::  nw       !<
+
+    INTEGER(KIND=C_SIZE_T), INTENT(IN), TARGET, DIMENSION(:) ::  data     !<
+
+    TYPE(C_PTR)                                              ::  buf      !<
 
 
@@ -567,11 +572,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                             ::  fid
-    INTEGER                                         ::  nr_byte
-    INTEGER, INTENT(IN)                             ::  nw
-
-    REAL(KIND=wp), INTENT(IN), TARGET, DIMENSION(:) ::  data
-
-    TYPE(C_PTR)                                     ::  buf
+    INTEGER                                         ::  nr_byte   !<
+    INTEGER, INTENT(IN)                             ::  fid       !<
+    INTEGER, INTENT(IN)                             ::  nw        !<
+
+    REAL(KIND=wp), INTENT(IN), TARGET, DIMENSION(:) ::  data      !<
+
+    TYPE(C_PTR)                                     ::  buf       !<
 
 
@@ -589,11 +594,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                  ::  fid
-    INTEGER                                              ::  nr_byte
-    INTEGER, INTENT(IN)                                  ::  nw
-
-    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:) ::  data
-
-    TYPE(C_PTR)                                          ::  buf
+    INTEGER                                              ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                  ::  fid      !<
+    INTEGER, INTENT(IN)                                  ::  nw       !<
+
+    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:) ::  data     !<
+
+    TYPE(C_PTR)                                          ::  buf      !<
 
 
@@ -611,11 +616,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)                                    ::  fid
-    INTEGER                                                ::  nr_byte
-    INTEGER, INTENT(IN)                                    ::  nw
-
-    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:,:) ::  data
-
-    TYPE(C_PTR)                                            ::  buf
+    INTEGER                                                ::  nr_byte  !<
+    INTEGER, INTENT(IN)                                    ::  fid      !<
+    INTEGER, INTENT(IN)                                    ::  nw       !<
+
+    REAL(KIND=wp), INTENT(INOUT), TARGET, DIMENSION(:,:,:) ::  data     !<
+
+    TYPE(C_PTR)                                            ::  buf      !<
 
 
@@ -633,11 +638,11 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN)    ::  fid
-    INTEGER(KIND=C_INT)    ::  my_fid
-    INTEGER , INTENT(IN)   ::  nb
-    INTEGER(KIND=C_SIZE_T) ::  nr_byte
-    INTEGER(KIND=C_SIZE_T) ::  retval
-
-    TYPE(C_PTR)            ::  buf
+    INTEGER, INTENT(IN)    ::  fid      !<
+    INTEGER , INTENT(IN)   ::  nb       !<
+    INTEGER(KIND=C_INT)    ::  my_fid   !<
+    INTEGER(KIND=C_SIZE_T) ::  nr_byte  !<
+    INTEGER(KIND=C_SIZE_T) ::  retval   !<
+
+    TYPE(C_PTR)            ::  buf      !<
 
 
@@ -648,5 +653,5 @@
 
     IF ( retval /= nr_byte )  THEN
-       WRITE(6,*) 'Number of bytes to write does not match the number of requested bytes'
+       WRITE( 6, * ) 'Number of bytes to write does not match the number of requested bytes'
        CALL abort
     ENDIF
@@ -660,15 +665,14 @@
     IMPLICIT NONE
 
-    CHARACTER(LEN=*), DIMENSION(:)     ::  data
-
-    CHARACTER(LEN=LEN(data)+1), TARGET ::  data_buf
-
-    INTEGER, INTENT(IN)                ::  fid
-    INTEGER                            ::  i
-    INTEGER(KIND=C_INT)                ::  my_fid
-    INTEGER(KIND=C_SIZE_T)             ::  name_len
-    INTEGER(KIND=C_SIZE_T)             ::  retval
-
-    TYPE(C_PTR)                        ::  ptr
+    CHARACTER(LEN=*), DIMENSION(:)     ::  data      !<
+    CHARACTER(LEN=LEN(data)+1), TARGET ::  data_buf  !<
+
+    INTEGER                            ::  i         !<
+    INTEGER, INTENT(IN)                ::  fid       !<
+    INTEGER(KIND=C_INT)                ::  my_fid    !<
+    INTEGER(KIND=C_SIZE_T)             ::  name_len  !<
+    INTEGER(KIND=C_SIZE_T)             ::  retval    !<
+
+    TYPE(C_PTR)                        ::  ptr       !<
 
 
@@ -690,7 +694,7 @@
     IMPLICIT NONE
 
-    INTEGER, INTENT(IN) ::  fid
-    INTEGER(KIND=C_INT) ::  my_fid
-    INTEGER(KIND=C_INT) ::  retval
+    INTEGER, INTENT(IN) ::  fid     !<
+    INTEGER(KIND=C_INT) ::  my_fid  !<
+    INTEGER(KIND=C_INT) ::  retval  !<
 
 
