Commits

Anonymous committed 3385330

Complete aot tables module

  • Participants
  • Parent commits 1ebe9d6

Comments (0)

Files changed (1)

File source/aot_out_module.f90

 !! the reading functions, however it is almost completely
 !! independent and relies purely on Fortran output methods.
 module aot_out_module
+  
+  use aot_kinds_module
 
   implicit none
 
     module procedure aot_put_val_int
     module procedure aot_put_val_char
     module procedure aot_put_val_real
+    module procedure aot_put_val_long
   end interface
 
   private
       endif
       put_conf%stack(put_conf%level) = put_conf%stack(put_conf%level) + 1 
     end if
-      if (present(tname)) then
-        write(put_conf%outunit,fmt="(a)") trim(separator)//trim(tname)//' = {' 
-      else
-        write(put_conf%outunit,fmt="(a)") trim(separator)//'{'
-      end if
+  
+    if (present(tname)) then
+      write(put_conf%outunit,fmt="(a)")trim(separator)//trim(tname)//' = {' 
+    else
+      write(put_conf%outunit,fmt="(a)") trim(separator)//'{'
+    end if
     put_conf%level = put_conf%level + 1
     put_conf%indent = put_conf%indent + 4
   end subroutine aot_table_open_out
     character(len=*), optional, intent(in) :: vname
     integer, intent(in) :: val
     !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
     if ( put_conf%level .gt. 0 ) then
       if ( put_conf%stack(put_conf%level) .gt. 0) then
         ! commata for previous line maybe use advance = no ????
     end if
     if (present(vname)) then
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(a,i2)",advance ='no') trim(vname)//" = ", val
+        write(put_conf%outunit,fmt="(a,i)",advance ='no') indent//trim(vname)//" = ", val
       else
-        write(put_conf%outunit,fmt="(a,i2)") trim(vname)//" = ", val
+        write(put_conf%outunit,fmt="(a,i)") indent//trim(vname)//" = ", val
       end if 
     else
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(a,i2)", advance ='no') val
+        write(put_conf%outunit,fmt="(a,i)", advance ='no') indent,val
       end if 
     end if
   end subroutine aot_put_val_int
     character(len=*), optional, intent(in) :: vname
     character, intent(in) :: val
     !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
     if ( put_conf%level .gt. 0 ) then
       if ( put_conf%stack(put_conf%level) .gt. 0) then
         ! commata for previous line maybe use advance = no ????
     end if
     if (present(vname)) then
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(a,a)",advance ='no') trim(vname)//" = ", "'"//val//"'"
+        write(put_conf%outunit,fmt="(a,a)",advance ='no')indent// trim(vname)//" = ", "'"//val//"'"
       else
-        write(put_conf%outunit,fmt="(a,a)") trim(vname)//" = ", "'"//val//"'"
+        write(put_conf%outunit,fmt="(a,a)")indent// trim(vname)//" = ", "'"//val//"'"
       end if 
     else
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(a,a)", advance ='no'),"'",val//"'"
+        write(put_conf%outunit,fmt="(a,a)", advance ='no'),indent//"'",val//"'"
       end if 
     end if
   end subroutine aot_put_val_char
     character(len=*), optional, intent(in) :: vname
     real, intent(in) :: val
     !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
     if ( put_conf%level .gt. 0 ) then
       if ( put_conf%stack(put_conf%level) .gt. 0) then
         ! commata for previous line maybe use advance = no ????
     end if
     if (present(vname)) then
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(a,f8.2)",advance ='no') trim(vname)//" = ", val
+        write(put_conf%outunit,fmt="(a,f8.2)",advance ='no')indent// trim(vname)//" = ", val
       else
-        write(put_conf%outunit,fmt="(a,f8.2)") trim(vname)//" = ", val
+        write(put_conf%outunit,fmt="(a,f8.2)")indent// trim(vname)//" = ", val
       end if 
     else
       if(put_conf%level .ne. 0) then
-        write(put_conf%outunit,fmt="(f8.2)", advance ='no') val
+        write(put_conf%outunit,fmt="(a,f8.2)", advance ='no')indent, val
       end if 
     end if
   end subroutine aot_put_val_real
  
+  
+  subroutine aot_put_val_long(put_conf, val, vname)
+    !------------------------------------------------------------------------ 
+    type(aot_out_type), intent(inout)  :: put_conf
+    character(len=*), optional, intent(in) :: vname
+    integer(kind = long_k), intent(in) :: val
+    !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
+    if ( put_conf%level .gt. 0 ) then
+      if ( put_conf%stack(put_conf%level) .gt. 0) then
+        ! commata for previous line maybe use advance = no ????
+        write(put_conf%outunit,fmt="(a)") ","
+      end if
+      put_conf%stack(put_conf%level) =              &
+        &      put_conf%stack(put_conf%level) + 1
+    end if
+    if (present(vname)) then
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,i)",advance ='no')indent// trim(vname)//" = ", val
+      else
+        write(put_conf%outunit,fmt="(a,i)")indent// trim(vname)//" = ", val
+      end if 
+    else
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,i)", advance ='no')indent, val
+      end if 
+    end if
+  end subroutine aot_put_val_long
+
+  
+  subroutine aot_put_val_double(put_conf, val, vname)
+    !------------------------------------------------------------------------ 
+    type(aot_out_type), intent(inout)  :: put_conf
+    character(len=*), optional, intent(in) :: vname
+    real(kind = double_k), intent(in) :: val
+    !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
+    if ( put_conf%level .gt. 0 ) then
+      if ( put_conf%stack(put_conf%level) .gt. 0) then
+        ! commata for previous line maybe use advance = no ????
+        write(put_conf%outunit,fmt="(a)") ","
+      end if
+      put_conf%stack(put_conf%level) =              &
+        &      put_conf%stack(put_conf%level) + 1
+    end if
+    if (present(vname)) then
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,f4.2)",advance ='no')indent// trim(vname)//" = ", val
+      else
+        write(put_conf%outunit,fmt="(a,f4.2)")indent// trim(vname)//" = ", val
+      end if 
+    else
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,f4.2)", advance ='no')indent, val
+      end if 
+    end if
+  end subroutine aot_put_val_double
+  
+
+  subroutine aot_put_val_single(put_conf, val, vname)
+    !------------------------------------------------------------------------ 
+    type(aot_out_type), intent(inout)  :: put_conf
+    character(len=*), optional, intent(in) :: vname
+    real(kind = single_k), intent(in) :: val
+    !------------------------------------------------------------------------ 
+    character(len=put_conf%indent) :: indent
+    !------------------------------------------------------------------------
+    indent = ''
+    if ( put_conf%level .gt. 0 ) then
+      if ( put_conf%stack(put_conf%level) .gt. 0) then
+        ! commata for previous line maybe use advance = no ????
+        write(put_conf%outunit,fmt="(a)") ","
+      end if
+      put_conf%stack(put_conf%level) =              &
+        &      put_conf%stack(put_conf%level) + 1
+    end if
+    if (present(vname)) then
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,f4.2)",advance ='no')indent// trim(vname)//" = ", val
+      else
+        write(put_conf%outunit,fmt="(a,f4.2)")indent// trim(vname)//" = ", val
+      end if 
+    else
+      if(put_conf%level .ne. 0) then
+        write(put_conf%outunit,fmt="(a,f4.2)", advance ='no')indent, val
+      end if 
+    end if
+  end subroutine aot_put_val_single
+
+
 
   !> Helper function to provide new unit, as long as F2008 newunit argument
   !! in open statement is not commonly available.