ftnlf

Check-in [5575fc87bb]
Login

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

Overview
Comment:Output array is now allocated by the called Lua function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5575fc87bb0f9c383db310e5afdb95f6a65736e3
User & Date: vadim 2018-05-14 21:06:27
Context
2018-05-15
07:38
Generate DLL for Fortran eXtensions. check-in: b071967c92 user: vadim tags: trunk
2018-05-14
21:06
Output array is now allocated by the called Lua function. check-in: 5575fc87bb user: vadim tags: trunk
11:47
Extra test. check-in: e6f10e8262 user: vadim tags: trunk, caller-allocates
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ftnlf.f90.

147
148
149
150
151
152
153
154



155
156
157
158
159
160
161
...
212
213
214
215
216
217
218
219



220
221
222
223
224
225
226
...
276
277
278
279
280
281
282
283
284
285
286
287


288
289
290
291
292
293
294
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354


355

356
357
358
359
360
361
362
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
...
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
...
535
536
537
538
539
540
541
542
543
544
545

546
547
548
549
550
551


552
553
554
555
556
557
558
...
561
562
563
564
565
566
567






568
569
570

571
572
573

574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611


612
613
614
615
616
617
618
619
620
621


622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639











640
641
642
643
644
645
646
        ! Number of arguments
        n = ns - 1 + size(args) + 4
        ! check stack
        ! < DEBUG >
        if (lua_gettop(L_st) /= n + 1) stop 88

        ! Call Lua
        nv = size(fvals) + 2



        res = lua_pcall(L_st, n, nv, 0)
        r = lcheck(res)
        if (.not. r) return

        call unpackvals(fvals, arr_m, arr_o)
        call lua_pop(L_st, nv)

................................................................................
        ! Number of arguments
        n = 3 - 1 + size(args) + 4
        ! check stack
        ! < DEBUG >
        if (lua_gettop(L_st) /= n + 1) stop 88

        ! Call Lua
        nv = size(fvals) + 2



        res = lua_pcall(L_st, n, nv, 0)
        r = lcheck(res)
        if (.not. r) return

        call unpackvals(fvals, arr_m, arr_o)
        call lua_pop(L_st, nv)

................................................................................
        ! create userdata values
        ! 1. input parameters
        if (.not. createuv(narr_i, ns)) return
        call filluv(narr_i, arr_i)
        ! 2. modified parameters
        if (.not. createuv(narr_m, ns)) return
        call filluv(narr_m, arr_m)
        ! 3. output parameters
        if (.not. createuv(narr_o, ns)) return

        ! Push number of output values
        call lua_pushinteger(L_st, int(nv, c_intptr_t))


        
        r = .true.
    contains
        ! Create UD value
        ! Protected call is used
        ! In case of error pop extra arguments from the stack
        function createuv(n, ns) result(r)
................................................................................
        nv = size(fvals)
        narr_o = size(arr_o)
        narr_m = size(arr_m)

        ! get numerical arguments (no checks are made here,
        ! see lfun_tail)
        do k = 1, nv
            fvals(k) = lua_tonumber(L_st, 2+k)
        end do

        ! extract userdata values
        ! 1. modified parameters
        call xtruv(1, narr_m, arr_m)
        ! 2. output parameters


        call xtruv(2, narr_o, arr_o)


    contains
        ! Extract UD value on the stack index onto array
        ! No checks are made
        subroutine xtruv(ix, s, arr)
            use, intrinsic :: iso_c_binding, only: c_f_pointer
            integer(4), intent(in) :: ix, s
................................................................................
    function lfuncallc(L) bind(C) result(r)
        type(c_ptr), value, intent(in) :: L
        integer(c_int) :: r

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tblname key arg1 ... argn UI UM UO NV
        ! Get table from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_REGISTRYINDEX)
        call lfun_checktbl(L, 'cached ')
        
        ! Remove table name
        call lua_remove(L, 1)
................................................................................
    ! Fetch table from BD (two-level name)
    subroutine gettbl2(L)
        type(c_ptr) :: L

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tbldirname tblname key arg1 ... argn UI UM UO NV
        ! Get tbldir from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_GLOBALSINDEX)
        call lfun_checktbl(L, 'global ')
        
        ! Remove tbldir name
        call lua_remove(L, 1)

        ! Stack is now: tblname key arg1 ... argn UI UM UO NV tbldir
        ! Get table from tbldir
        call lua_pushvalue(L, 1)
        call lua_gettable(L, -2)
        call lfun_checktbl(L, 'table ')
        
        ! Remove table name
        call lua_remove(L, 1)
        ! Stack is now: key arg1 ... argn UI UM UO NV tbldir tbl
        ! Remove tbldir
        call lua_remove(L, -2)
        ! Stack is now: key arg1 ... argn UI UM UO NV tbl
    end subroutine gettbl2

    ! Fetch table from BD (one-level name)
    subroutine gettbl1(L)
        type(c_ptr) :: L

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tblname key arg1 ... argn UI UM UO NV 
        ! Get table from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_GLOBALSINDEX)
        call lfun_checktbl(L, 'global ')
        
        ! Remove table name
        call lua_remove(L, 1)
................................................................................
            call lua_pushstring_f(L, ': table expected, got '//trim(tn))
            call lua_concat(L, 3)
            typ = lua_error(L)
        end if
    end subroutine lfun_checktbl

    ! Tail of lfuncall* functions
    ! Expecting stack on input: key arg1 ... argn UI UM UO NV tbl
    ! Expecting stack on output: none
    function lfun_tail(L) result(r)
        use ftnlf_fxcore, only: mt_interp

        type(c_ptr) :: L
        integer(4) :: r, typ
        integer(4) :: na, nv, k
        type(c_ptr) :: udck
        character(9) :: buf
        character(10) :: buft



        r = 0
        ! to support extra pushes
        call luaL_checkstack(L, 5, F_C_STR('stack overflow'))
        ! Number of numeric arguments
        na = lua_gettop(L) - (2+4) 

................................................................................
        call lua_gettable(L, -2)
        typ = lua_type(L, -1)
        ! Move value below the arguments
        call lua_insert(L, 2)
        ! pop table
        call lua_pop(L, 1)







        ! Get number of output arguments
        ! Get and pop dimensions
        nv = INT(lua_tointeger(L, -1), 4)

        call lua_pop(L, 1)

        ! Send UM and UO userdata values to stack bottom

        ! to return them later
        call lua_insert(L, 1)
        call lua_insert(L, 1)

        ! Stack is now:
        ! UM UO key val arg1 ... argn UI
        ! < DEBUG >
        call luaFE_check(L, lua_gettop(L) == na+5, 'stack inconsistency')

        ! classify value and call it
        if (typ == LUA_TNUMBER) then
            ! Constant
            if (ckarg(nv == 1, &
                & 'Too many output arguments for constant ') /= 0) return
            ! Pop input userdata and arguments
            call lua_pop(L, na+1)
            ! stack is now: UM UO key val
        elseif (typ == LUA_TUSERDATA) then
            udck = luaL_checkudata(L, 4, F_C_STR(mt_interp))
            ! Interpolation table
            ! Expecting one argument
            if (ckarg(na == 1 .and. nv == 1, &
                & 'Too many arguments for interpolation function ') /= 0) return
            ! Pop input userdata
            call lua_pop(L, 1)
            ! Stack is now: UM UO key ud arg
            ! call userdata w/metamethod
            ! argument gets replaced with result
            call lua_call(L, na, nv)
            ! stack is now: UM UO key val
        elseif (typ == LUA_TFUNCTION) then
            ! Function of (many) arguments
            ! Stack is now: UM UO key fun arg1 .. argn UI
            ! Push userdata values
            call lua_pushvalue(L, 1)
            call lua_pushvalue(L, 2)
            ! Stack is now: UM UO key fun arg1 .. argn UI UM UO
            ! Call function w/out protection, since we're already in pcall


            call lua_call(L, na+3, nv)
            ! Stack is now: UM UO key val1 ... valn
        else
            ! Other types -> signal error
            typ = ckarg(.false., 'Bad type of value ')
            return
        endif

        ! remove key, so argument numbering is consistent
        call lua_remove(L, 3)



        r = 2+nv ! number of returns
        ! < DEBUG >
        call luaFE_check(L, lua_gettop(L) == r, 'stack inconsistency')

        ! Check values
        do k = 1, nv
            typ = lua_type(L, 2+k)
            if (typ /= LUA_TNUMBER) then
                ! Format error message
                write (buf,10) k
10              format ('value #', I2)
                call lua_typename_f(L, typ, buft)
                call luaFE_check(L, .false., &
                & 'bad type of '//buf//': '//'number' &
                & //' expected, got '//TRIM(buft))
            end if
        end do












    contains
        function ckarg(cond, msg) result(r)
            integer(4) :: r
            logical, intent(in) :: cond
            character(*), intent(in) :: msg
            integer(4), parameter :: ix_key = 3







|
>
>
>







 







|
>
>
>







 







<
<



>
>







 







|






>
>
|
>







 







|







 







|








|







|


|









|







 







|
|

|
>






>
>







 







>
>
>
>
>
>

<
|
>
|

<
>
|
<



|

|




|



|

|


|



|



|


|


<
|

>
>
|
|







|
>
>

|





|










>
>
>
>
>
>
>
>
>
>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
282
283
284
285
286
287
288


289
290
291
292
293
294
295
296
297
298
299
300
...
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
...
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586

587
588
589
590

591
592

593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
        ! Number of arguments
        n = ns - 1 + size(args) + 4
        ! check stack
        ! < DEBUG >
        if (lua_gettop(L_st) /= n + 1) stop 88

        ! Call Lua
        nv = size(fvals) + 1
        if (size(arr_o) /= 0) then
            nv = nv + 1
        end if
        res = lua_pcall(L_st, n, nv, 0)
        r = lcheck(res)
        if (.not. r) return

        call unpackvals(fvals, arr_m, arr_o)
        call lua_pop(L_st, nv)

................................................................................
        ! Number of arguments
        n = 3 - 1 + size(args) + 4
        ! check stack
        ! < DEBUG >
        if (lua_gettop(L_st) /= n + 1) stop 88

        ! Call Lua
        nv = size(fvals) + 1
        if (size(arr_o) /= 0) then
            nv = nv + 1
        end if
        res = lua_pcall(L_st, n, nv, 0)
        r = lcheck(res)
        if (.not. r) return

        call unpackvals(fvals, arr_m, arr_o)
        call lua_pop(L_st, nv)

................................................................................
        ! create userdata values
        ! 1. input parameters
        if (.not. createuv(narr_i, ns)) return
        call filluv(narr_i, arr_i)
        ! 2. modified parameters
        if (.not. createuv(narr_m, ns)) return
        call filluv(narr_m, arr_m)



        ! Push number of output values
        call lua_pushinteger(L_st, int(nv, c_intptr_t))
        ! Push size of output array (if needed)
        call lua_pushinteger(L_st, int(size(arr_o), c_intptr_t))
        
        r = .true.
    contains
        ! Create UD value
        ! Protected call is used
        ! In case of error pop extra arguments from the stack
        function createuv(n, ns) result(r)
................................................................................
        nv = size(fvals)
        narr_o = size(arr_o)
        narr_m = size(arr_m)

        ! get numerical arguments (no checks are made here,
        ! see lfun_tail)
        do k = 1, nv
            fvals(k) = lua_tonumber(L_st, 1+k)
        end do

        ! extract userdata values
        ! 1. modified parameters
        call xtruv(1, narr_m, arr_m)
        ! 2. output parameters
        if (size(arr_o) /= 0) then
            k = 2+nv
            call xtruv(k, narr_o, arr_o)
        end if

    contains
        ! Extract UD value on the stack index onto array
        ! No checks are made
        subroutine xtruv(ix, s, arr)
            use, intrinsic :: iso_c_binding, only: c_f_pointer
            integer(4), intent(in) :: ix, s
................................................................................
    function lfuncallc(L) bind(C) result(r)
        type(c_ptr), value, intent(in) :: L
        integer(c_int) :: r

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tblname key arg1 ... argn UI UM NV FO
        ! Get table from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_REGISTRYINDEX)
        call lfun_checktbl(L, 'cached ')
        
        ! Remove table name
        call lua_remove(L, 1)
................................................................................
    ! Fetch table from BD (two-level name)
    subroutine gettbl2(L)
        type(c_ptr) :: L

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tbldirname tblname key arg1 ... argn UI UM NV FO
        ! Get tbldir from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_GLOBALSINDEX)
        call lfun_checktbl(L, 'global ')
        
        ! Remove tbldir name
        call lua_remove(L, 1)

        ! Stack is now: tblname key arg1 ... argn UI UM NV FO tbldir
        ! Get table from tbldir
        call lua_pushvalue(L, 1)
        call lua_gettable(L, -2)
        call lfun_checktbl(L, 'table ')
        
        ! Remove table name
        call lua_remove(L, 1)
        ! Stack is now: key arg1 ... argn UI UM NV FO tbldir tbl
        ! Remove tbldir
        call lua_remove(L, -2)
        ! Stack is now: key arg1 ... argn UI UM NV FO tbl
    end subroutine gettbl2

    ! Fetch table from BD (one-level name)
    subroutine gettbl1(L)
        type(c_ptr) :: L

        ! Provide stack
        call luaL_checkstack(L, 4, F_C_STR('too many arguments'))
        
        ! Stack is now: tblname key arg1 ... argn UI UM NV FO
        ! Get table from the globals
        call lua_pushvalue(L, 1)
        call lua_gettable(L, LUA_GLOBALSINDEX)
        call lfun_checktbl(L, 'global ')
        
        ! Remove table name
        call lua_remove(L, 1)
................................................................................
            call lua_pushstring_f(L, ': table expected, got '//trim(tn))
            call lua_concat(L, 3)
            typ = lua_error(L)
        end if
    end subroutine lfun_checktbl

    ! Tail of lfuncall* functions
    ! Expecting stack on input: key arg1 ... argn UI UM NV FO tbl
    ! Expecting stack on output: val1 ... valn UO?
    function lfun_tail(L) result(r)
        use ftnlf_fxcore, only: mt_interp, mt_FA
        use, intrinsic :: iso_c_binding, only: c_size_t
        type(c_ptr) :: L
        integer(4) :: r, typ
        integer(4) :: na, nv, k
        type(c_ptr) :: udck
        character(9) :: buf
        character(10) :: buft
        integer(4) :: oflag, osize
        integer(c_size_t) :: uos

        r = 0
        ! to support extra pushes
        call luaL_checkstack(L, 5, F_C_STR('stack overflow'))
        ! Number of numeric arguments
        na = lua_gettop(L) - (2+4) 

................................................................................
        call lua_gettable(L, -2)
        typ = lua_type(L, -1)
        ! Move value below the arguments
        call lua_insert(L, 2)
        ! pop table
        call lua_pop(L, 1)

        ! Get flag of requested userdata output
        osize = int(lua_tointeger(L, -1), 4)
        oflag = 0
        if (osize /= 0) then
            oflag = 1
        end if
        ! Get number of output arguments

        nv = INT(lua_tointeger(L, -2), 4)
        ! Pop them
        call lua_pop(L, 2)


        ! Send UM userdata value to stack bottom
        ! to return it later

        call lua_insert(L, 1)

        ! Stack is now:
        ! UM key val arg1 ... argn UI
        ! < DEBUG >
        call luaFE_check(L, lua_gettop(L) == na+4, 'stack inconsistency')

        ! classify value and call it
        if (typ == LUA_TNUMBER) then
            ! Constant
            if (ckarg(nv == 1 .and. oflag == 0, &
                & 'Too many output arguments for constant ') /= 0) return
            ! Pop input userdata and arguments
            call lua_pop(L, na+1)
            ! stack is now: UM key val
        elseif (typ == LUA_TUSERDATA) then
            udck = luaL_checkudata(L, 3, F_C_STR(mt_interp))
            ! Interpolation table
            ! Expecting one argument
            if (ckarg(na == 1 .and. nv == 1 .and. oflag == 0, &
                & 'Too many arguments for interpolation function ') /= 0) return
            ! Pop input userdata
            call lua_pop(L, 1)
            ! Stack is now: UM key ud arg
            ! call userdata w/metamethod
            ! argument gets replaced with result
            call lua_call(L, na, nv)
            ! stack is now: UM key val
        elseif (typ == LUA_TFUNCTION) then
            ! Function of (many) arguments
            ! Stack is now: UM key fun arg1 .. argn UI
            ! Push userdata values
            call lua_pushvalue(L, 1)

            ! Stack is now: UM key fun arg1 .. argn UI UM
            ! Call function w/out protection, since we're already in pcall
            ! Expecting oflag to be 0 or 1, so that nv+oflag gives
            ! the number of expected results
            call lua_call(L, na+2, nv+oflag)
            ! Stack is now: UM key val1 ... valn UO?
        else
            ! Other types -> signal error
            typ = ckarg(.false., 'Bad type of value ')
            return
        endif

        ! remove key, so argument numbering is consistent
        call lua_remove(L, 2)
        ! @@ bad diagnostics below, since 
        ! 1  extra arg in stack (UM) before returned vals

        r = 1+nv+oflag ! number of returns
        ! < DEBUG >
        call luaFE_check(L, lua_gettop(L) == r, 'stack inconsistency')

        ! Check values
        do k = 1, nv
            typ = lua_type(L, 1+k)
            if (typ /= LUA_TNUMBER) then
                ! Format error message
                write (buf,10) k
10              format ('value #', I2)
                call lua_typename_f(L, typ, buft)
                call luaFE_check(L, .false., &
                & 'bad type of '//buf//': '//'number' &
                & //' expected, got '//TRIM(buft))
            end if
        end do
        if (oflag /= 0) then
            k = nv+2
            ! Check UO value
            udck = luaL_checkudata(L, k, F_C_STR(mt_FA))
            ! Check length
            ! bytes to double
            uos = lua_objlen(L, k)/8
            if (uos < osize) then
                r = luaL_argerror(L, k, F_C_STR('too short output array'))
            end if
        end if

    contains
        function ckarg(cond, msg) result(r)
            integer(4) :: r
            logical, intent(in) :: cond
            character(*), intent(in) :: msg
            integer(4), parameter :: ix_key = 3

Changes to ftnlf_fxcore.f90.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! (Fortran arrayas, linear interpolation, ...)
module ftnlf_fxcore
    use LuaF
    use LuaFE
    use, intrinsic :: iso_c_binding, only: c_int, c_ptr
    implicit none
    private
    ! Public API: loader function, userdata id for interp objects,
    ! C functions to operate with Fortran arrays
    public ldr_fx_core
    public l_fa_new, l_fa_pack, l_fa_unpack, fx_fa_copy
    public mt_interp

    character(*), parameter :: mt_FA = 'ftnlf.fx.fa'
    character(*), parameter :: mt_interp = 'ftnlf.fx.interp'

contains

    ! FX.Core module loader







|



|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! (Fortran arrayas, linear interpolation, ...)
module ftnlf_fxcore
    use LuaF
    use LuaFE
    use, intrinsic :: iso_c_binding, only: c_int, c_ptr
    implicit none
    private
    ! Public API: loader function, userdata ids,
    ! C functions to operate with Fortran arrays
    public ldr_fx_core
    public l_fa_new, l_fa_pack, l_fa_unpack, fx_fa_copy
    public mt_FA, mt_interp

    character(*), parameter :: mt_FA = 'ftnlf.fx.fa'
    character(*), parameter :: mt_interp = 'ftnlf.fx.interp'

contains

    ! FX.Core module loader

Changes to intel/c.cmd.

1
2



call "C:\Program Files\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" ia32 vs2010
ifort /QxHOST /O2 /C /traceback /warn ..\luaf\luaf.f90 ..\luaf\luafe.f90 ..\ftnlf_fxcore.f90 ..\ftnlf.f90 ..\test.f90 /exe:ftnlf_test.exe lua5.1_32.lib 




|
>
>
>
1
2
3
4
5
call "C:\Program Files\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" ia32 vs2010
ifort /c /QxHOST /O2 /C /traceback /warn ..\luaf\luaf.f90 ..\luaf\luafe.f90 ..\ftnlf_fxcore.f90 ..\ftnlf.f90 
lib /out:ftnlf.lib *.obj
ifort /QxHOST /O2 /C /traceback /warn ..\test.f90 /exe:ftnlf_test.exe ftnlf.lib lua5.1_32.lib 
del *.obj

Added intel/clib.cmd.









>
>
>
>
1
2
3
4
call "C:\Program Files\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" ia32 vs2010
ifort /c /QxHOST /O2 /warn ..\luaf\luaf.f90 ..\luaf\luafe.f90 ..\ftnlf_fxcore.f90 ..\ftnlf.f90 
lib /out:ftnlf.lib *.obj
del *.obj

Changes to testdb.lua.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
local FXC = require('FX.Core')
iii = FXC.interp({0,1,10,0,15,-3})

tbl1 = { val1 = 17.4e-1,
v2 = function(x,y) return (x/y) end,
v3 = iii,
valN = function(x,y,ai,am,ao)

ao[1] = (x+y)*ai[1]
ao[2] = (x*y)/ai[2]
ao[3] = math.atan2(y*ai[3],x*ai[4])
am[1] = am[1]*(-10.)
return x-y, x+y
end
}

dir1 = {
   tbl1 = { v5 = function(x,y) return x-y end },
   tbl2 = { v6 = FXC.interp({-10,1,10,70}), v7 = -29.3e-4},







|
>
|
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local FXC = require('FX.Core')
iii = FXC.interp({0,1,10,0,15,-3})

tbl1 = { val1 = 17.4e-1,
v2 = function(x,y) return (x/y) end,
v3 = iii,
valN = function(x,y,ai,am)
   local ao = FXC.array(10)
   ao[1] = (x+y)*ai[1]
   ao[2] = (x*y)/ai[2]
   ao[3] = math.atan2(y*ai[3],x*ai[4])
   am[1] = am[1]*(-10.)
   return x-y, x+y, ao
end
}

dir1 = {
   tbl1 = { v5 = function(x,y) return x-y end },
   tbl2 = { v6 = FXC.interp({-10,1,10,70}), v7 = -29.3e-4},