1 #+Title: a collection of examples for ob-fortran tests
6 :ID: 459384e8-1797-4f11-867e-dde0473ea7cc
9 #+begin_src fortran :results silent
10 print *, 'Hello world'
13 #+name: fortran_parameter
14 #+begin_src fortran :results silent
15 integer, parameter :: i = 10
21 :ID: d8d1dfd3-5f0c-48fe-b55d-777997e02242
23 #+begin_src fortran :var N = 15 :results silent
27 Define for preprocessed fortran
28 #+begin_src fortran :defines N 42 :results silent
33 #+begin_src fortran :var s="word" :results silent
38 :ID: c28569d9-04ce-4cad-ab81-1ea29f691465
41 #+begin_src fortran :var s='(1.0 2.0 3.0) :results silent
42 write (*, '(3f5.2)'), s
49 #+begin_src fortran :var s=test_tbl :results silent
50 write (*, '(2f5.2)'), s
55 :ID: 891ead4a-f87a-473c-9ae0-1cf348bcd04f
57 Should fail (TODO: add input variables for the case with explicit
59 #+begin_src fortran :var s="word" :results silent
61 print *, "output of ex program"
65 Fails to compile (TODO: error check in ob-fortran.el)
66 #+begin_src fortran :var s='(1 ()) :results silent
70 Should fail to compile with gfortran
71 #+begin_src fortran :flags --std=f95 --pedantic-error :results silent
77 * programs input parameters
79 :ID: 2d5330ea-9934-4737-9ed6-e1d3dae2dfa4
81 Pass parameters to the program
82 #+begin_src fortran :cmdline "23" :results silent
83 character(len=255) :: cmd
84 call get_command_argument(1, cmd)