Commits

Anonymous committed 82d8ee8

aotus can now read lonk kind integers

Comments (0)

Files changed (2)

source/aot_kinds_module.f90

 
   integer, parameter :: double_k = selected_real_kind(15)
   integer, parameter :: single_k = selected_real_kind(6)
+  integer, parameter :: long_k = selected_int_kind(15)
 
 end module aot_kinds_module

source/aotus_module.f90

 module aotus_module
   use flu_binding
-  use aot_kinds_module, only: double_k, single_k
+  use aot_kinds_module, only: double_k, single_k, long_k
   use aot_table_module, only: aot_table_getval
 
   implicit none
     module procedure get_top_real
     module procedure get_top_double
     module procedure get_top_integer
+    module procedure get_top_long
     module procedure get_top_string
     module procedure get_top_logical
   end interface
     module procedure get_table_real
     module procedure get_table_double
     module procedure get_table_integer
+    module procedure get_table_long
     module procedure get_table_string
     module procedure get_table_logical
   end interface
 
   end subroutine get_top_integer
 
+  subroutine get_top_long(conf, top_val, ErrCode, default)
+    type(flu_State) :: conf
+    integer(kind=long_k), intent(out) :: top_val
+    integer, intent(out) :: ErrCode
+    integer(kind=long_k), optional, intent(in) :: default
+
+    logical :: not_retrievable
+
+    ErrCode = 0
+    not_retrievable = .false.
+
+    if (flu_isNoneOrNil(conf, -1)) then
+      ErrCode = ibSet(ErrCode, aoterr_NonExistent)
+      not_retrievable = .true.
+    else
+      if (flu_isNumber(conf, -1)) then
+        top_val = int(flu_toNumber(conf, -1),kind=long_k)
+      else
+        ErrCode = ibSet(ErrCode, aoterr_WrongType)
+        ErrCode = ibSet(ErrCode, aoterr_Fatal)
+        not_retrievable = .true.
+      end if
+    end if
+
+    if (not_retrievable) then
+      if (present(default)) then
+        top_val = default
+      else
+        ErrCode = ibSet(ErrCode, aoterr_Fatal)
+      end if
+    end if
+    call flu_pop(conf)
+
+  end subroutine get_top_long
 
   subroutine get_top_logical(conf, top_val, ErrCode, default)
     type(flu_State) :: conf
 
   end subroutine get_table_integer
 
+  subroutine get_table_long(conf, thandle, tab_val, ErrCode, var, pos, default)
+    type(flu_State) :: conf
+    integer, intent(in) :: thandle
+    integer(kind=long_k), intent(out) :: tab_val
+    integer, intent(out) :: ErrCode
+
+    character(len=*), intent(in), optional :: var
+    integer, intent(in), optional :: pos
+    integer(kind=long_k), intent(in), optional :: default
+
+    call aot_table_getval(L=conf, thandle=thandle, &
+      &                   key=var, pos=pos)
+    call get_top_val(conf, tab_val, ErrCode, default)
+
+  end subroutine get_table_long
 
   subroutine get_table_logical(conf, thandle, tab_val, ErrCode, var, pos, default)
     type(flu_State) :: conf