ftnlf

Check-in [9bf2fbbda3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for 64bit systems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9bf2fbbda385dae296f2a60f6d3e9ad67364b7e5
User & Date: vadim 2016-01-27 16:14:45
Context
2016-01-28
19:10
Initialization subroutine, phase 1 check-in: 5ffc072be4 user: vadim tags: trunk
2016-01-27
16:14
Fix for 64bit systems. check-in: 9bf2fbbda3 user: vadim tags: trunk
09:07
Commit existing files. check-in: 1be03a2e74 user: vadim tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ftnlf_interp.f90.

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
            TABINT=Y(I)+A*(Y(I+1)-Y(I))
            RETURN
        ENDIF
    END FUNCTION TABINT

    ! Create new interpolation object from table at the top
    function l_newintobj(L) bind(C) result(r)
        use, intrinsic :: iso_c_binding, only: c_int, c_ptr, c_f_pointer
        use :: LuaF
        use :: LuaFE
        implicit none
        type(c_ptr), value, intent(in) :: L
        integer(c_int) :: r
        integer(4) :: ntbl, lentbl, k, i, key
        integer(4), pointer:: itbl(:)
................................................................................
        ntbl = INT(lua_objlen(L, 1), 4)
        call luaFE_check(L, ntbl > 0 .and. mod(ntbl, 2) == 0, &
            'Invalid interpolation table')
        ntbl = ntbl/2
        lentbl = (1+2*ntbl)
        
        ! Allocate Lua userdata
        ud = lua_newuserdata(L, lentbl*8)
        ! Move table atop
        call lua_insert(L, -2)
        
        ! Associate Fortran table with ptr (integer part only)
        call c_f_pointer(ud, itbl, [2])
        itbl(1) = ntbl
        itbl(2) = key







|







 







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
            TABINT=Y(I)+A*(Y(I+1)-Y(I))
            RETURN
        ENDIF
    END FUNCTION TABINT

    ! Create new interpolation object from table at the top
    function l_newintobj(L) bind(C) result(r)
        use, intrinsic :: iso_c_binding, only: c_int, c_ptr, c_f_pointer, c_size_t
        use :: LuaF
        use :: LuaFE
        implicit none
        type(c_ptr), value, intent(in) :: L
        integer(c_int) :: r
        integer(4) :: ntbl, lentbl, k, i, key
        integer(4), pointer:: itbl(:)
................................................................................
        ntbl = INT(lua_objlen(L, 1), 4)
        call luaFE_check(L, ntbl > 0 .and. mod(ntbl, 2) == 0, &
            'Invalid interpolation table')
        ntbl = ntbl/2
        lentbl = (1+2*ntbl)
        
        ! Allocate Lua userdata
        ud = lua_newuserdata(L, INT(lentbl*8, C_SIZE_T))
        ! Move table atop
        call lua_insert(L, -2)
        
        ! Associate Fortran table with ptr (integer part only)
        call c_f_pointer(ud, itbl, [2])
        itbl(1) = ntbl
        itbl(2) = key