5 @c -----------------------------------------------------------------------------
6 @node Functions for f90, , Package f90, Package f90
9 @opencatbox{Categories:}
10 @category{Share packages}
11 @category{Package f90}
13 @c -----------------------------------------------------------------------------
15 @c -----------------------------------------------------------------------------
16 @anchor{f90_output_line_length_max}
17 @defvr {Option variable} f90_output_line_length_max
20 @code{f90_output_line_length_max} is the maximum number of characters of Fortran code
21 which are output by @code{f90} per line.
22 Longer lines of code are divided, and printed with an ampersand @code{&} at the end of an output line
23 and an ampersand at the beginning of the following line.
25 @code{f90_output_line_length_max} must be a positive integer.
31 @c foo : expand ((xxx + yyy + 7)^4);
32 @c f90_output_line_length_max;
34 @c f90_output_line_length_max : 40 $
39 (%i2) foo : expand ((xxx + yyy + 7)^4);
41 (%o2) yyy + 4 xxx yyy + 28 yyy + 6 xxx yyy + 84 xxx yyy
43 + 294 yyy + 4 xxx yyy + 84 xxx yyy + 588 xxx yyy + 1372 yyy
45 + xxx + 28 xxx + 294 xxx + 1372 xxx + 2401
46 (%i3) f90_output_line_length_max;
48 (%i4) f90 ('foo = foo);
49 foo = yyy**4+4*xxx*yyy**3+28*yyy**3+6*xxx**2*yyy**2+84*xxx*yyy**2&
50 &+294*yyy**2+4*xxx**3*yyy+84*xxx**2*yyy+588*xxx*yyy+1372*yyy+xxx**&
51 &4+28*xxx**3+294*xxx**2+1372*xxx+2401
53 (%i5) f90_output_line_length_max : 40 $
54 (%i6) f90 ('foo = foo);
55 foo = yyy**4+4*xxx*yyy**3+28*yyy**3+6*xx&
56 &x**2*yyy**2+84*xxx*yyy**2+294*yyy**2+4*x&
57 &xx**3*yyy+84*xxx**2*yyy+588*xxx*yyy+1372&
58 &*yyy+xxx**4+28*xxx**3+294*xxx**2+1372*xx&
63 @opencatbox{Categories:}
64 @category{Global variables}
65 @category{Translation and compilation}
66 @category{Package f90}
70 @c -----------------------------------------------------------------------------
72 @deffn {Function} f90 (@var{expr_1}, @dots{}, @var{expr_n})
74 Prints one or more expressions @var{expr_1}, @dots{}, @var{expr_n}
75 as a Fortran 90 program.
76 Output is printed to the standard output.
78 @code{f90} prints output in the so-called "free form" input format for
79 Fortran 90: there is no special attention to column positions.
80 Long lines are split at a fixed width with the ampersand @code{&} continuation
82 the number of output characters per line, not including ampersands,
83 is specified by @code{f90_output_line_length_max}.
84 @code{f90} outputs an ampersand at the end of a split line
85 and another at the beginning of the next line.
87 @code{load("f90")} loads this function. See also the function @mrefdot{fortran}
93 @c foo : expand ((xxx + yyy + 7)^4);
98 (%i2) foo : expand ((xxx + yyy + 7)^4);
100 (%o2) yyy + 4 xxx yyy + 28 yyy + 6 xxx yyy + 84 xxx yyy
102 + 294 yyy + 4 xxx yyy + 84 xxx yyy + 588 xxx yyy + 1372 yyy
104 + xxx + 28 xxx + 294 xxx + 1372 xxx + 2401
105 (%i3) f90 ('foo = foo);
106 foo = yyy**4+4*xxx*yyy**3+28*yyy**3+6*xxx**2*yyy**2+84*xxx*yyy**2&
107 &+294*yyy**2+4*xxx**3*yyy+84*xxx**2*yyy+588*xxx*yyy+1372*yyy+xxx**&
108 &4+28*xxx**3+294*xxx**2+1372*xxx+2401
112 Multiple expressions.
113 Capture standard output into a file via the @mref{with_stdout} function.
117 @c foo : sin (3*x + 1) - cos (7*x - 2);
118 @c with_stdout ("foo.f90", f90 (x = 0.25, y = 0.625, 'foo = foo, 'stop, 'end));
119 @c printfile ("foo.f90");
123 (%i2) foo : sin (3*x + 1) - cos (7*x - 2);
124 (%o2) sin(3 x + 1) - cos(7 x - 2)
125 (%i3) with_stdout ("foo.f90",
126 f90 (x=0.25, y=0.625, 'foo=foo, 'stop, 'end));
128 (%i4) printfile ("foo.f90");
131 foo = sin(3*x+1)-cos(7*x-2)
137 @opencatbox{Categories:}
138 @category{Translation and compilation}
139 @category{Package f90}