mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-20 09:49:20 +00:00
* lisp/ob-fortran.el: add a branch which handles nested lists * testing/examples/ob-fortran-test.org: add a test for matrix input * testing/lisp/test-ob-fortran.el: add a test for matrix input
2.3 KiB
2.3 KiB
a collection of examples for ob-fortran tests
simple programs
print *, 'Hello world'
integer, parameter :: i = 10
write (*, '(i2)') i
variable resolution
write (*, '(i2)') N
Define for preprocessed fortran
implicit none
write (*, '(i2)') N
write (*, '(a4)') s
arrays
Real array as input
write (*, '(3f5.2)'), s
1.0 |
2.0 |
write (*, '(2f5.2)'), s
matrix
Real matrix as input
0.0 | 42.0 |
0.0 | 0.0 |
0.0 | 0.0 |
0.0 | 0.0 | 0.0 |
0.0 | 0.0 | 42.0 |
write (*, '(i2)'), nint(s(1,2))
write (*, '(i2)'), nint(s(2,3))
failing
Should fail (TODO: add input variables for the case with explicit program statement)
program ex
print *, "output of ex program"
end program ex
Fails to compile (TODO: error check in ob-fortran.el)
print *, s
Should fail to compile with gfortran
program ex
integer*8 :: i
end program ex
programs input parameters
Pass parameters to the program
character(len=255) :: cmd
call get_command_argument(1, cmd)
write (*,*) trim(cmd)