Skip to content

Commit 8d4d665

Browse files
Christopher Subichvmagno
Christopher Subich
authored andcommitted
Adjust interpv templates for vscode compatibility
The mock-template code that uses the C preprocessor to define multiple versions of Interp/Extrap functions is incompatible with Fortran linting, crashing the linter (see fortran-lang/fortls#236) because it tries to process the Fortran syntax without invoking the preprocessor. This code adjusts the templates to hold just the subroutine body, leaving the `end subroutine` statement for the enclosing Fortran file. This change fixes the linter crash, although it still doesn't properly understand the subroutines.
1 parent ebce4ab commit 8d4d665

21 files changed

+521
-103
lines changed

src/interpv/Extrap1D_Abort.F90

+50
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,81 @@
1717

1818
!version that accepts real(single) arguments, with the extended interface
1919
subroutine Extrap1D_Abort_X &
20+
(numInterpSets, srcNumLevels, destNumLevels, &
21+
src_ijDim, dst_ijDim, &
22+
23+
vLevelSource, stateSource, stateDerivSource, &
24+
25+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
26+
27+
extrapEnableDown, extrapEnableUp, &
28+
extrapGuideDown, extrapGuideUp, &
29+
30+
flux, numExtArraysIn, numExtArraysOut, &
31+
ExtArraysIn, ExtArraysOut &
32+
)
2033
#define real48 single
2134
#include "Extrap1D_Abort_Body.inc"
2235
#undef real48
36+
end subroutine
2337

2438
!version that accepts real(double) arguments, with the extended interface
2539
subroutine Extrap1D_Abort_X8 &
40+
(numInterpSets, srcNumLevels, destNumLevels, &
41+
src_ijDim, dst_ijDim, &
42+
43+
vLevelSource, stateSource, stateDerivSource, &
44+
45+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
46+
47+
extrapEnableDown, extrapEnableUp, &
48+
extrapGuideDown, extrapGuideUp, &
49+
50+
flux, numExtArraysIn, numExtArraysOut, &
51+
ExtArraysIn, ExtArraysOut &
52+
)
2653
#define real48 double
2754
#include "Extrap1D_Abort_Body.inc"
2855
#undef real48
56+
end subroutine
2957

3058

3159

3260

3361
!version that accepts real(single) arguments
3462
subroutine Extrap1D_Abort &
63+
(numInterpSets, srcNumLevels, destNumLevels, &
64+
src_ijDim, dst_ijDim, &
65+
66+
vLevelSource, stateSource, stateDerivSource, &
67+
68+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
69+
70+
extrapEnableDown, extrapEnableUp, &
71+
extrapGuideDown, extrapGuideUp &
72+
)
3573
#define real48 single
3674
#define DestnFunc Extrap1D_Abort_X
3775
#include "Interp1D_PreX_Shell.inc"
3876
#undef DestnFunc
3977
#undef real48
78+
end subroutine
4079

4180
!version that accepts real(double) arguments
4281
subroutine Extrap1D_Abort8 &
82+
(numInterpSets, srcNumLevels, destNumLevels, &
83+
src_ijDim, dst_ijDim, &
84+
85+
vLevelSource, stateSource, stateDerivSource, &
86+
87+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
88+
89+
extrapEnableDown, extrapEnableUp, &
90+
extrapGuideDown, extrapGuideUp &
91+
)
4392
#define real48 double
4493
#define DestnFunc Extrap1D_Abort_X8
4594
#include "Interp1D_PreX_Shell.inc"
4695
#undef DestnFunc
4796
#undef real48
97+
end subroutine

src/interpv/Extrap1D_Abort_Body.inc

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
!!!s/r Extrap1D_Abort - Abort if an extrapolation is required
22
!subroutine Extrap1D_Abort_X &
33
!subroutine Extrap1D_Abort_X8 &
4-
(numInterpSets, srcNumLevels, destNumLevels, &
5-
src_ijDim, dst_ijDim, &
4+
! (numInterpSets, srcNumLevels, destNumLevels, &
5+
! src_ijDim, dst_ijDim, &
66

7-
vLevelSource, stateSource, stateDerivSource, &
7+
! vLevelSource, stateSource, stateDerivSource, &
88

9-
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
9+
! posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
1010

11-
extrapEnableDown, extrapEnableUp, &
12-
extrapGuideDown, extrapGuideUp, &
11+
! extrapEnableDown, extrapEnableUp, &
12+
! extrapGuideDown, extrapGuideUp, &
1313

14-
flux, numExtArraysIn, numExtArraysOut, &
15-
ExtArraysIn, ExtArraysOut &
16-
)
14+
! flux, numExtArraysIn, numExtArraysOut, &
15+
! ExtArraysIn, ExtArraysOut &
16+
! )
1717
! These are dummy arguments for this function: stateDerivSource,
1818
! stateDerivDestn, flux, numExtArraysIn, numExtArraysOut, ExtArraysIn,
1919
! ExtArraysOut
@@ -93,4 +93,4 @@
9393
!$OMP END parallel do
9494

9595

96-
end subroutine ! Extrap1D_Abort_X
96+
! end subroutine ! Extrap1D_Abort_X

src/interpv/Extrap1D_Fixed.F90

+50
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,81 @@
1717

1818
!version that accepts real(single) arguments, with the extended interface
1919
subroutine Extrap1D_Fixed_X &
20+
(numInterpSets, srcNumLevels, destNumLevels, &
21+
src_ijDim, dst_ijDim, &
22+
23+
vLevelSource, stateSource, stateDerivSource, &
24+
25+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
26+
27+
extrapEnableDown, extrapEnableUp, &
28+
extrapGuideDown, extrapGuideUp, &
29+
30+
flux, numExtArraysIn, numExtArraysOut, &
31+
ExtArraysIn, ExtArraysOut &
32+
)
2033
#define real48 single
2134
#include "Extrap1D_Fixed_Body.inc"
2235
#undef real48
36+
end subroutine
2337

2438
!version that accepts real(double) arguments, with the extended interface
2539
subroutine Extrap1D_Fixed_X8 &
40+
(numInterpSets, srcNumLevels, destNumLevels, &
41+
src_ijDim, dst_ijDim, &
42+
43+
vLevelSource, stateSource, stateDerivSource, &
44+
45+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
46+
47+
extrapEnableDown, extrapEnableUp, &
48+
extrapGuideDown, extrapGuideUp, &
49+
50+
flux, numExtArraysIn, numExtArraysOut, &
51+
ExtArraysIn, ExtArraysOut &
52+
)
2653
#define real48 double
2754
#include "Extrap1D_Fixed_Body.inc"
2855
#undef real48
56+
end subroutine
2957

3058

3159

3260

3361
!version that accepts real(single) arguments
3462
subroutine Extrap1D_Fixed &
63+
(numInterpSets, srcNumLevels, destNumLevels, &
64+
src_ijDim, dst_ijDim, &
65+
66+
vLevelSource, stateSource, stateDerivSource, &
67+
68+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
69+
70+
extrapEnableDown, extrapEnableUp, &
71+
extrapGuideDown, extrapGuideUp &
72+
)
3573
#define real48 single
3674
#define DestnFunc Extrap1D_Fixed_X
3775
#include "Interp1D_PreX_Shell.inc"
3876
#undef DestnFunc
3977
#undef real48
78+
end subroutine
4079

4180
!version that accepts real(double) arguments
4281
subroutine Extrap1D_Fixed8 &
82+
(numInterpSets, srcNumLevels, destNumLevels, &
83+
src_ijDim, dst_ijDim, &
84+
85+
vLevelSource, stateSource, stateDerivSource, &
86+
87+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
88+
89+
extrapEnableDown, extrapEnableUp, &
90+
extrapGuideDown, extrapGuideUp &
91+
)
4392
#define real48 double
4493
#define DestnFunc Extrap1D_Fixed_X8
4594
#include "Interp1D_PreX_Shell.inc"
4695
#undef DestnFunc
4796
#undef real48
97+
end subroutine

src/interpv/Extrap1D_Fixed_Body.inc

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
!!!s/r Extrap1D_Fixed - Extrapolate, to a fixed (selectable) value
22
!subroutine Extrap1D_Fixed_X &
33
!subroutine Extrap1D_Fixed_X8 &
4-
(numInterpSets, srcNumLevels, destNumLevels, &
5-
src_ijDim, dst_ijDim, &
4+
! (numInterpSets, srcNumLevels, destNumLevels, &
5+
! src_ijDim, dst_ijDim, &
66

7-
vLevelSource, stateSource, stateDerivSource, &
7+
! vLevelSource, stateSource, stateDerivSource, &
88

9-
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
9+
! posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
1010

11-
extrapEnableDown, extrapEnableUp, &
12-
extrapGuideDown, extrapGuideUp, &
11+
! extrapEnableDown, extrapEnableUp, &
12+
! extrapGuideDown, extrapGuideUp, &
1313

14-
flux, numExtArraysIn, numExtArraysOut, &
15-
ExtArraysIn, ExtArraysOut &
16-
)
14+
! flux, numExtArraysIn, numExtArraysOut, &
15+
! ExtArraysIn, ExtArraysOut &
16+
! )
1717
! These are dummy arguments for this function: stateDerivSource,
1818
! stateDerivDestn, flux, numExtArraysIn, numExtArraysOut, ExtArraysIn,
1919
! ExtArraysOut
@@ -100,4 +100,4 @@
100100
!$OMP END parallel do
101101

102102

103-
end subroutine ! Extrap1D_Fixed_X
103+
! end subroutine ! Extrap1D_Fixed_X

src/interpv/Extrap1D_LapseRate.F90

+50
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,81 @@
1919

2020
!version that accepts real(single) arguments, with the extended interface
2121
subroutine Extrap1D_LapseRate_X &
22+
(numInterpSets, srcNumLevels, destNumLevels, &
23+
src_ijDim, dst_ijDim, &
24+
25+
vLevelSource, stateSource, stateDerivSource, &
26+
27+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
28+
29+
extrapEnableDown, extrapEnableUp, &
30+
extrapGuideDown, extrapGuideUp, &
31+
32+
flux, numExtArraysIn, numExtArraysOut, &
33+
ExtArraysIn, ExtArraysOut &
34+
)
2235
#define real48 single
2336
#include "Extrap1D_LapseRate_Body.inc"
2437
#undef real48
38+
end subroutine
2539

2640
!version that accepts real(double) arguments, with the extended interface
2741
subroutine Extrap1D_LapseRate_X8 &
42+
(numInterpSets, srcNumLevels, destNumLevels, &
43+
src_ijDim, dst_ijDim, &
44+
45+
vLevelSource, stateSource, stateDerivSource, &
46+
47+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
48+
49+
extrapEnableDown, extrapEnableUp, &
50+
extrapGuideDown, extrapGuideUp, &
51+
52+
flux, numExtArraysIn, numExtArraysOut, &
53+
ExtArraysIn, ExtArraysOut &
54+
)
2855
#define real48 double
2956
#include "Extrap1D_LapseRate_Body.inc"
3057
#undef real48
58+
end subroutine
3159

3260

3361

3462

3563
!version that accepts real(single) arguments
3664
subroutine Extrap1D_LapseRate &
65+
(numInterpSets, srcNumLevels, destNumLevels, &
66+
src_ijDim, dst_ijDim, &
67+
68+
vLevelSource, stateSource, stateDerivSource, &
69+
70+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
71+
72+
extrapEnableDown, extrapEnableUp, &
73+
extrapGuideDown, extrapGuideUp &
74+
)
3775
#define real48 single
3876
#define DestnFunc Extrap1D_LapseRate_X
3977
#include "Interp1D_PreX_Shell.inc"
4078
#undef DestnFunc
4179
#undef real48
80+
end subroutine
4281

4382
!version that accepts real(double) arguments
4483
subroutine Extrap1D_LapseRate8 &
84+
(numInterpSets, srcNumLevels, destNumLevels, &
85+
src_ijDim, dst_ijDim, &
86+
87+
vLevelSource, stateSource, stateDerivSource, &
88+
89+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
90+
91+
extrapEnableDown, extrapEnableUp, &
92+
extrapGuideDown, extrapGuideUp &
93+
)
4594
#define real48 double
4695
#define DestnFunc Extrap1D_LapseRate_X8
4796
#include "Interp1D_PreX_Shell.inc"
4897
#undef DestnFunc
4998
#undef real48
99+
end subroutine

src/interpv/Extrap1D_LapseRate_Body.inc

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
!!!s/r Extrap1D_LapseRate - Extrapolate, based on lapse rates
22
!subroutine Extrap1D_LapseRate_X &
33
!subroutine Extrap1D_LapseRate_X8 &
4-
(numInterpSets, srcNumLevels, destNumLevels, &
5-
src_ijDim, dst_ijDim, &
4+
! (numInterpSets, srcNumLevels, destNumLevels, &
5+
! src_ijDim, dst_ijDim, &
66

7-
vLevelSource, stateSource, stateDerivSource, &
7+
! vLevelSource, stateSource, stateDerivSource, &
88

9-
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
9+
! posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
1010

11-
extrapEnableDown, extrapEnableUp, &
12-
extrapGuideDown, extrapGuideUp, &
11+
! extrapEnableDown, extrapEnableUp, &
12+
! extrapGuideDown, extrapGuideUp, &
1313

14-
flux, numExtArraysIn, numExtArraysOut, &
15-
ExtArraysIn, ExtArraysOut &
16-
)
14+
! flux, numExtArraysIn, numExtArraysOut, &
15+
! ExtArraysIn, ExtArraysOut &
16+
! )
1717
! These are dummy arguments for this function: stateDerivSource,
1818
! stateDerivDestn, flux, numExtArraysIn, numExtArraysOut, ExtArraysIn,
1919
! ExtArraysOut
@@ -118,4 +118,4 @@
118118
!$OMP END parallel do
119119
120120
121-
end subroutine ! Extrap1D_LapseRate_X
121+
! end subroutine ! Extrap1D_LapseRate_X

src/interpv/Extrap1D_Surface.F90

+28
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,40 @@
2121

2222
!version that accepts real(single) arguments, with the extended interface
2323
subroutine Extrap1D_Surface_X &
24+
(numInterpSets, srcNumLevels, destNumLevels, &
25+
src_ijDim, dst_ijDim, &
26+
27+
vLevelSource, stateSource, stateDerivSource, &
28+
29+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
30+
31+
extrapEnableDown, extrapEnableUp, &
32+
extrapGuideDown, extrapGuideUp, &
33+
34+
flux, numExtArraysIn, numExtArraysOut, &
35+
ExtArraysIn, ExtArraysOut &
36+
)
2437
#define real48 single
2538
#include "Extrap1D_Surface_Body.inc"
2639
#undef real48
40+
end subroutine
2741

2842
!version that accepts real(double) arguments, with the extended interface
2943
subroutine Extrap1D_Surface_X8 &
44+
(numInterpSets, srcNumLevels, destNumLevels, &
45+
src_ijDim, dst_ijDim, &
46+
47+
vLevelSource, stateSource, stateDerivSource, &
48+
49+
posnDestInSrc, vLevelDestn, stateDestn, stateDerivDestn, &
50+
51+
extrapEnableDown, extrapEnableUp, &
52+
extrapGuideDown, extrapGuideUp, &
53+
54+
flux, numExtArraysIn, numExtArraysOut, &
55+
ExtArraysIn, ExtArraysOut &
56+
)
3057
#define real48 double
3158
#include "Extrap1D_Surface_Body.inc"
3259
#undef real48
60+
end subroutine

0 commit comments

Comments
 (0)