Posted to tcl by arjen at Fri Jun 05 09:14:39 GMT 2026view raw
- ! bessel --
- ! Wrapper for the Fortran J0 Bessel function
- !
- ! Arguments:
- ! clientdata Any data registered for the command
- ! interp Tcl interpreter that is running the command
- ! nobj Number of arguments
- ! objv Array of argument objects
- !
- !
- integer function tcl_bessel_j0( clientdata, interp, nobj, objv ) bind(c)
- type(c_ptr), value :: clientdata
- type(tcl_interp), value :: interp
- integer(c_int), value :: nobj
- type(tcl_obj), dimension(*) :: objv
-
- real(c_double) :: arg1, result
- integer(c_int) :: rc
-
- tcl_bessel_j0 = tcl_error
-
- !
- ! The name of the command is the first argument, so correct for that
- !
- if ( nobj-1 /= 1 ) then
- call tcl_setresult( interp, "Wrong number of arguments" // c_null_char, c_null_funptr )
- return
- endif
-
- call ftcl_getdoublefromobj( interp, objv(2), arg1, rc )
- if ( rc /= tcl_ok ) then
- return
- endif
-
- tcl_bessel_j0 = tcl_ok
-
- result = bessel_j0( arg1 )
-
- call ftcl_setresult( interp, result )
- end function tcl_bessel_j0
Add a comment