File: progfixed.f.try.f.ref

package info (click to toggle)
findent 4.3.6-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,144 kB
  • sloc: sh: 9,462; cpp: 6,219; fortran: 2,901; lex: 696; yacc: 535; makefile: 224; python: 155; lisp: 52
file content (331 lines) | stat: -rw-r--r-- 7,755 bytes parent folder | download | duplicates (6)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
! -I0 -i5 -a1 -b2 -d3 -f4 -m5 -Rr
      module m1
           integer k
           enum, bind(c)

                enumerator :: red =1, blue, black =5
                enumerator yellow
                enumerator gold, silver, bronze
                enumerator :: purple
                enumerator :: pink, lavender

           endenum
      contains
           function f(x)
                print *,'abc
     9      def'
                print *,"abcd
     8        efgh"
                return
           end function f
#ifdef usempi
           function f1(x,m)
                real x,m
#elif defined(useopenmp)
           function f1(x,m,n)
                real x,m,n
#else
           function f1(x)
                real x
#endif
                continue
           end function f1
      end module m1

      subroutine ticket7
           integer :: int
           real :: float
           logical :: bool
#define COND \
               if (float > 1.) then; \
                  continue ; \
                end if
           COND
           if (.true.) then
               int = int + 1
           end if

      end subroutine ticket7

      program progfixed
           type mytype  ! mytype
                integer i
                real x
           end type mytype
#ifdef abcde
           real klm@@@(10)
#endif
           real do(100)
           integer x(100)
           type(mytype)  xyz
           character*1000 astring
           continue
           a_ap: do i=1,20
              continue
           enddo a_ap
           end = 10
           if ( e .eq. n .and.
     *          e .eq. m    )then
               npar   = npar   + 1
           endif
           do i=1,
c a comment
c a comment
     x     1
c a comment
     x     0
              continue
           enddo
           do 123 i=1,2
              continue
  123      continue
           print *,'; function ',indx," function "
           continue
99880      FORMAT ('  function ')
99870      FORMAT(1X,'Invalid species name',2X,A8)
           do i=1,10
              do (i) = 5
              continue
              do(i) = 5
              continue
           enddo
           x = y   ! function values
           continue

           astring = " ! this
     x is
     x no comment!"
           print *,a,b,
     x             c,d
     x            ,e,f
           continue
           print *,a,b,
     x             c,d
     x            ,e,f
           loop: do i=1,20
              block
                do 90 k=1,90
                   do 90 k1=1,4
                      call one(a)
                      do 7 j=1,20
                         call two(a)
    7                 x=x+j
                      continue
   90           continue
                continue
              end block
           enddo loop

           bbb: block
             continue
           end block bbb

           sc: select case(ja)
             case(1)
                continue
             case(2)
                continue
           end select sc
           continue
           do i=1,20
              block
                continue
              end block
           enddo
           critical
                x=y
           endcritical
           critical
                x=y
           endcritical
           critical
                x=y
           end critical
           wv: if ( a.eq.b) then
               continue
           endif wv
           if (.false.) goto 88
           if (.false.) goto 99999
   88      if ('x' .eq. "abc''d") l=1
99999      continue
           if ('x' .eq. "abc''d") l=1
           continue
           if ('x' .eq. "abc''d")then
               continue
           endif
           ASSOCIATE ( Z => EXP(-(a**2+Y**2)) * COS(THETA))
            PRINT *, A+Z, A-Z
           END ASSOCIATE

           forall(i=1:4) x(i)=5
           continue
           forall(i=1:4)  ! forall
                x(i)=6
           end forall

           where(x.eq.0) x=5 ! where
           continue
           where(x.eq.0)
                x=10
           endwhere
           continue

           where(x.eq.0)
                x=10
           elsewhere
                x=11
           endwhere

           select case(ia)
             case(1)
                print *,3
                do i=1,9
                   continue
                enddo
             case(2)
                print*,6
             case default
                print *,0
           endselect

      end program progfixed

      subroutine one(a)
           continue
        entry myentry
           continue
           return
      end subroutine one
      subroutine two(a)
           continue
d              print *,'debug i=',i
D              print *,'debug j=',j
           x = 4 +
c next line starts with <tab>
     1     5 +
c next line starts with <sp><tab>
     2     5+
c next line starts with <sp><sp><tab>
     3     5+
c next line starts with <sp><sp><sp><tab>
     4     5+
c next line starts with <sp><sp><sp><sp><tab>
     5     5+
c next line starts with <sp><sp><sp><sp><sp><tab>
     6     5
           return
      end subroutine two
      subroutine three(a)
           continue
           return
      end subroutine three
      subroutine four(a)
           continue
           return
      end subroutine four
      subrou
     xtine five
           continue
           return
      end subroutine five
      subroutine seven
           a = 1
     x     + 2   ! comment 1
     y     + 3   ! comment 2
     y     + 4
     y     + 5
     y     + 6
           a = 1
     x     + 2   ! comment 1
     y     + 3   ! comment 2
#ifdef klm
     y     + 4 syntax error
     y     + 5 syntax error
#endif
     y     + 6
      end subroutine seven
      subroutine multiline_preproc
#ifdef one\
two\
three
           do i=1,10
#elif \
defined(q)
           do i=1,5
#else
           do i=1,7
#endif
              x=x+4
           enddo
      end subroutine multiline_preproc

      subroutine nok
           implicit none
           type domain_data
                real, dimension(:, :), allocatable :: temperature
                integer:: ibound, icopy, todomain
           end type domain_data

           type(domain_data), dimension(2), target :: dom
           allocate(dom(1) % temperature(20, 20))
           dom(1) % temperature = 0.
           dom(1) % temperature(:, 1) = 1.
      end subroutine nok


      ! testing with findentfix:
      subroutine testfix
           implicit none
           integer i,j,k
           do i=1,10
c             comment
              continue
              do j=1,6
                 continue
                 !  findentfix: do
                    do k=1,7
                       continue
                    enddo
C FINDENTFIX: enddo
              enddo
* findentFIX: do;do
                    continue
* findentfix:    enddo;enddo
              continue
           enddo
      end subroutine testfix
      subroutine testpointer
           integer, pointer :: subroutinesub
           integer, target :: i
           subroutinesub=>i     ! must not be recognized as subroutine statement
      end subroutine testpointer

      subroutine omp
           integer i,j,k
C$         integer m,n,
c$         ! comment in omp sentinel
! normal comment
*$
*$   1      o,p
           print *,i,j,k
!$         print*, m,n,o,p
!$         do 100 i=1,20
!$            do 100 j=1,i
c$               continue
c$100      continue
c$omp parallel
c$omp do
           do i=1,20
              continue
           enddo
c$omp end parallel
      end subroutine omp
      subroutine label_excercise
           do 10
     x      0 i=1,10
              continue
  100      continue
           do 02 0 i=1,10
              continue
   20      continue
      end subroutine label_excercise