2009-02-05 19:51:50 -05:00
|
|
|
USING: accessors alien alien.c-types alien.fortran alien.structs
|
|
|
|
alien.syntax arrays assocs kernel namespaces sequences tools.test ;
|
2009-02-05 16:29:59 -05:00
|
|
|
IN: alien.fortran.tests
|
|
|
|
|
2009-02-05 19:51:50 -05:00
|
|
|
F-RECORD: fortran_test_record
|
|
|
|
{ "integer" "foo" }
|
|
|
|
{ "real" "bar" }
|
|
|
|
{ "character*4" "bas" } ;
|
2009-02-05 16:29:59 -05:00
|
|
|
|
|
|
|
! fortran-name>symbol-name
|
|
|
|
|
|
|
|
[ "fun_" ] [ "FUN" fortran-name>symbol-name ] unit-test
|
|
|
|
[ "fun_times__" ] [ "Fun_Times" fortran-name>symbol-name ] unit-test
|
|
|
|
|
|
|
|
! fortran-type>c-type
|
|
|
|
|
|
|
|
[ "short" ]
|
|
|
|
[ "integer*2" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int" ]
|
|
|
|
[ "integer*4" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int" ]
|
2009-02-05 19:51:50 -05:00
|
|
|
[ "INTEGER" fortran-type>c-type ] unit-test
|
2009-02-05 16:29:59 -05:00
|
|
|
|
|
|
|
[ "longlong" ]
|
|
|
|
[ "iNteger*8" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int[0]" ]
|
|
|
|
[ "integer(*)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int[0]" ]
|
|
|
|
[ "integer(3,*)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int[3]" ]
|
|
|
|
[ "integer(3)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int[6]" ]
|
|
|
|
[ "integer(3,2)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int[24]" ]
|
|
|
|
[ "integer(4,3,2)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "char[1]" ]
|
|
|
|
[ "character" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "char[17]" ]
|
|
|
|
[ "character*17" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "char[17]" ]
|
|
|
|
[ "character(17)" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int" ]
|
|
|
|
[ "logical" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "float" ]
|
|
|
|
[ "real" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "double" ]
|
|
|
|
[ "double precision" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "float" ]
|
|
|
|
[ "real*4" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "double" ]
|
|
|
|
[ "real*8" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "(fortran-complex)" ]
|
|
|
|
[ "complex" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "(fortran-double-complex)" ]
|
|
|
|
[ "double complex" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "(fortran-complex)" ]
|
|
|
|
[ "complex*8" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "(fortran-double-complex)" ]
|
|
|
|
[ "complex*16" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "(fortran-double-complex)" ]
|
|
|
|
[ "complex*16" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "fortran_test_record" ]
|
|
|
|
[ "fortran_test_record" fortran-type>c-type ] unit-test
|
|
|
|
|
|
|
|
! fortran-arg-type>c-type
|
|
|
|
|
|
|
|
[ "int*" { } ]
|
|
|
|
[ "integer" fortran-arg-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int*" { } ]
|
|
|
|
[ "integer(3)" fortran-arg-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int*" { } ]
|
|
|
|
[ "integer(*)" fortran-arg-type>c-type ] unit-test
|
|
|
|
|
2009-02-05 19:51:50 -05:00
|
|
|
[ "fortran_test_record*" { } ]
|
|
|
|
[ "fortran_test_record" fortran-arg-type>c-type ] unit-test
|
2009-02-05 16:29:59 -05:00
|
|
|
|
|
|
|
[ "char*" { "long" } ]
|
|
|
|
[ "character" fortran-arg-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "char*" { "long" } ]
|
|
|
|
[ "character(17)" fortran-arg-type>c-type ] unit-test
|
|
|
|
|
|
|
|
! fortran-ret-type>c-type
|
|
|
|
|
|
|
|
[ "void" { "char*" "long" } ]
|
|
|
|
[ "character(17)" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int" { } ]
|
|
|
|
[ "integer" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "int" { } ]
|
|
|
|
[ "logical" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "double" { } ]
|
|
|
|
[ "real" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "double" { } ]
|
|
|
|
[ "double precision" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "void" { "(fortran-complex)*" } ]
|
|
|
|
[ "complex" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "void" { "(fortran-double-complex)*" } ]
|
|
|
|
[ "double complex" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "void" { "int*" } ]
|
|
|
|
[ "integer(*)" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
|
|
|
[ "void" { "fortran_test_record*" } ]
|
|
|
|
[ "fortran_test_record" fortran-ret-type>c-type ] unit-test
|
|
|
|
|
2009-02-05 19:51:50 -05:00
|
|
|
! fortran-sig>c-sig
|
|
|
|
|
|
|
|
[ "double" { "int*" "char*" "float*" "double*" "long" } ]
|
|
|
|
[ "real" { "integer" "character*17" "real" "real*8" } fortran-sig>c-sig ]
|
|
|
|
unit-test
|
|
|
|
|
|
|
|
[ "void" { "char*" "long" "char*" "char*" "int*" "long" "long" } ]
|
|
|
|
[ "character*18" { "character*17" "character" "integer" } fortran-sig>c-sig ]
|
|
|
|
unit-test
|
|
|
|
|
|
|
|
[ "void" { "(fortran-complex)*" "char*" "char*" "int*" "long" "long" } ]
|
|
|
|
[ "complex" { "character*17" "character" "integer" } fortran-sig>c-sig ]
|
|
|
|
unit-test
|
|
|
|
|
|
|
|
! fortran-record>c-struct
|
|
|
|
|
|
|
|
[ {
|
|
|
|
{ "double" "ex" }
|
|
|
|
{ "float" "wye" }
|
|
|
|
{ "int" "zee" }
|
|
|
|
{ "char[20]" "woo" }
|
|
|
|
} ] [
|
|
|
|
{
|
|
|
|
{ "DOUBLE PRECISION" "EX" }
|
|
|
|
{ "REAL" "WYE" }
|
|
|
|
{ "INTEGER" "ZEE" }
|
|
|
|
{ "CHARACTER(20)" "WOO" }
|
|
|
|
} fortran-record>c-struct
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
! F-RECORD:
|
|
|
|
|
|
|
|
[ 12 ] [ "fortran_test_record" heap-size ] unit-test
|
|
|
|
[ 0 ] [ "foo" "fortran_test_record" offset-of ] unit-test
|
|
|
|
[ 4 ] [ "bar" "fortran_test_record" offset-of ] unit-test
|
|
|
|
[ 8 ] [ "bas" "fortran_test_record" offset-of ] unit-test
|
|
|
|
|