File: prism-fortran.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (71 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<h2>Comments</h2>
<pre><code>! This is a comment</code></pre>

<h2>Strings</h2>
<pre><code>"foo 'bar' baz"
'foo ''bar'' baz'
''
ITALICS_'This is in italics'
"test &
	! Some "tricky comment" here
	&test"</code></pre>

<h2>Numbers</h2>
<pre><code>473
+56
-101
21_2
21_SHORT
1976354279568241_8
B'01110'
B"010"
O'047'
O"642"
Z'F41A'
Z"00BC"
-12.78
+1.6E3
2.1
-16.E4_8
0.45E-4
10.93E7_QUAD
.123
3E4</code></pre>

<h2>Full example</h2>
<pre><code>MODULE MOD1
TYPE INITIALIZED_TYPE
	INTEGER :: I = 1 ! Default initialization
END TYPE INITIALIZED_TYPE
SAVE :: SAVED1, SAVED2
INTEGER :: SAVED1, UNSAVED1
TYPE(INITIALIZED_TYPE) :: SAVED2, UNSAVED2
ALLOCATABLE :: SAVED1(:), SAVED2(:), UNSAVED1(:), UNSAVED2(:)
END MODULE MOD1

PROGRAM MAIN
CALL SUB1 ! The values returned by the ALLOCATED intrinsic calls
          ! in the PRINT statement are:
          ! .FALSE., .FALSE., .FALSE., and .FALSE.
          ! Module MOD1 is used, and its variables are allocated.
          ! After return from the subroutine, whether the variables
          ! which were not specified with the SAVE attribute
          ! retain their allocation status is processor dependent.
CALL SUB1 ! The values returned by the first two ALLOCATED intrinsic
	      ! calls in the PRINT statement are:
	      ! .TRUE., .TRUE.
	      ! The values returned by the second two ALLOCATED
	      ! intrinsic calls in the PRINT statement are
	      ! processor dependent and each could be either
	      ! .TRUE. or .FALSE.
CONTAINS
	SUBROUTINE SUB1
	USE MOD1 ! Brings in saved and not saved variables.
	PRINT *, ALLOCATED(SAVED1), ALLOCATED(SAVED2), &
	         ALLOCATED(UNSAVED1), ALLOCATED(UNSAVED2)
	IF (.NOT. ALLOCATED(SAVED1)) ALLOCATE(SAVED1(10))
	IF (.NOT. ALLOCATED(SAVED2)) ALLOCATE(SAVED2(10))
	IF (.NOT. ALLOCATED(UNSAVED1)) ALLOCATE(UNSAVED1(10))
	IF (.NOT. ALLOCATED(UNSAVED2)) ALLOCATE(UNSAVED2(10))
	END SUBROUTINE SUB1
END PROGRAM MAIN</code></pre>