Updated script that can be controled by Nodejs web app

This commit is contained in:
mac OS
2024-11-25 12:24:18 +07:00
parent c440eda1f4
commit 8b0ab2bd3a
8662 changed files with 1803808 additions and 34 deletions

View File

@@ -0,0 +1,29 @@
MODULE char_test
CONTAINS
SUBROUTINE change_strings(strings, n_strs, out_strings)
IMPLICIT NONE
! Inputs
INTEGER, INTENT(IN) :: n_strs
CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings
CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: out_strings
!f2py INTEGER, INTENT(IN) :: n_strs
!f2py CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings
!f2py CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: strings
! Misc.
INTEGER*4 :: j
DO j=1, n_strs
out_strings(1,j) = strings(1,j)
out_strings(2,j) = 'A'
END DO
END SUBROUTINE change_strings
END MODULE char_test

View File

@@ -0,0 +1,34 @@
function sint(s) result(i)
implicit none
character(len=*) :: s
integer :: j, i
i = 0
do j=len(s), 1, -1
if (.not.((i.eq.0).and.(s(j:j).eq.' '))) then
i = i + ichar(s(j:j)) * 10 ** (j - 1)
endif
end do
return
end function sint
function test_in_bytes4(a) result (i)
implicit none
integer :: sint
character(len=4) :: a
integer :: i
i = sint(a)
a(1:1) = 'A'
return
end function test_in_bytes4
function test_inout_bytes4(a) result (i)
implicit none
integer :: sint
character(len=4), intent(inout) :: a
integer :: i
if (a(1:1).ne.' ') then
a(1:1) = 'E'
endif
i = sint(a)
return
end function test_inout_bytes4

View File

@@ -0,0 +1,8 @@
SUBROUTINE GREET(NAME, GREETING)
CHARACTER NAME*(*), GREETING*(*)
CHARACTER*(50) MESSAGE
MESSAGE = 'Hello, ' // NAME // ', ' // GREETING
c$$$ PRINT *, MESSAGE
END SUBROUTINE GREET

View File

@@ -0,0 +1,7 @@
subroutine string_inout_optional(output)
implicit none
character*(32), optional, intent(inout) :: output
if (present(output)) then
output="output string"
endif
end subroutine

View File

@@ -0,0 +1,14 @@
subroutine charint(trans, info)
character, intent(in) :: trans
integer, intent(out) :: info
if (trans == 'N') then
info = 1
else if (trans == 'T') then
info = 2
else if (trans == 'C') then
info = 3
else
info = -1
end if
end subroutine charint

View File

@@ -0,0 +1,12 @@
python module _char_handling_test
interface
subroutine charint(trans, info)
callstatement (*f2py_func)(&trans, &info)
callprotoargument char*, int*
character, intent(in), check(trans=='N'||trans=='T'||trans=='C') :: trans = 'N'
integer intent(out) :: info
end subroutine charint
end interface
end python module _char_handling_test

View File

@@ -0,0 +1,12 @@
python module _char_handling_test
interface
subroutine charint(trans, info)
callstatement (*f2py_func)(&trans, &info)
callprotoargument char*, int*
character, intent(in), check(*trans=='N'||*trans=='T'||*trans=='C') :: trans = 'N'
integer intent(out) :: info
end subroutine charint
end interface
end python module _char_handling_test

View File

@@ -0,0 +1,9 @@
MODULE string_test
character(len=8) :: string
character string77 * 8
character(len=12), dimension(5,7) :: strarr
character strarr77(5,7) * 12
END MODULE string_test

View File

@@ -0,0 +1,12 @@
C FILE: STRING.F
SUBROUTINE FOO(A,B,C,D)
CHARACTER*5 A, B
CHARACTER*(*) C,D
Cf2py intent(in) a,c
Cf2py intent(inout) b,d
A(1:1) = 'A'
B(1:1) = 'B'
C(1:1) = 'C'
D(1:1) = 'D'
END
C END OF FILE STRING.F