Skip to content
Snippets Groups Projects
Commit 13585252 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 30/11/2022: spl: add support for PURE and ELEMENTAL functions and subroutines

parent a999fb49
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
#MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier #MNH_LIC Copyright 1995-2022 CNRS, Meteo-France and Universite Paul Sabatier
#MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
#MNH_LIC for details. version 1. #MNH_LIC for details. version 1.
#set -x #set -x
# HP-UX 10 # HP-UX 10
...@@ -83,6 +83,7 @@ fi ...@@ -83,6 +83,7 @@ fi
# #
#modified by C. Fischer to split fortran 77 (26/04/95) #modified by C. Fischer to split fortran 77 (26/04/95)
#modified by C. Fischer to correct a bug PROGRAM-CONTAINS (16/02/96) #modified by C. Fischer to correct a bug PROGRAM-CONTAINS (16/02/96)
#modified by P. Wautelet to add support for PURE and ELEMENTAL functions and subroutines (30/11/2022)
# #
#.SH COPYRIGHT #.SH COPYRIGHT
# #
...@@ -153,7 +154,55 @@ awk ' ...@@ -153,7 +154,55 @@ awk '
} }
{ if((i_conta) != "open") { if((i_conta) != "open")
{ {
{ if((substr(u1,1,9)) == "RECURSIVE") { if((substr(u1,1,9)) == "ELEMENTAL")
{ if((substr(u2,1,10)) == "SUBROUTINE")
{ split(u3,p_name,"(");
l_name=(tolower(p_name[1]));
split((l_name),e_name,"$");
f_name=(e_name[1]) (e_name[2]) ".f90";
print (f_name); i_flag="bof";
print "! ######spl" > (f_name);
n_unit=(n_unit) + 0
}
}
}
{ if((substr(u1,1,9)) == "ELEMENTAL")
{ if((substr(u2,1,8)) == "FUNCTION")
{ split(u3,p_name,"(");
l_name=(tolower(p_name[1]));
split((l_name),e_name,"$");
f_name=(e_name[1]) (e_name[2]) ".f90";
print (f_name); i_flag="bof";
print "! ######spl" > (f_name);
n_unit=(n_unit) + 0
}
}
}
{ if((substr(u1,1,4)) == "PURE")
{ if((substr(u2,1,10)) == "SUBROUTINE")
{ split(u3,p_name,"(");
l_name=(tolower(p_name[1]));
split((l_name),e_name,"$");
f_name=(e_name[1]) (e_name[2]) ".f90";
print (f_name); i_flag="bof";
print "! ######spl" > (f_name);
n_unit=(n_unit) + 0
}
}
}
{ if((substr(u1,1,4)) == "PURE")
{ if((substr(u2,1,8)) == "FUNCTION")
{ split(u3,p_name,"(");
l_name=(tolower(p_name[1]));
split((l_name),e_name,"$");
f_name=(e_name[1]) (e_name[2]) ".f90";
print (f_name); i_flag="bof";
print "! ######spl" > (f_name);
n_unit=(n_unit) + 0
}
}
}
{ if((substr(u1,1,9)) == "RECURSIVE")
{ if((substr(u2,1,10)) == "SUBROUTINE") { if((substr(u2,1,10)) == "SUBROUTINE")
{ split(u3,p_name,"("); { split(u3,p_name,"(");
l_name=(tolower(p_name[1])); l_name=(tolower(p_name[1]));
...@@ -164,8 +213,8 @@ awk ' ...@@ -164,8 +213,8 @@ awk '
n_unit=(n_unit) + 0 n_unit=(n_unit) + 0
} }
} }
} }
{ if((substr(u1,1,9)) == "RECURSIVE") { if((substr(u1,1,9)) == "RECURSIVE")
{ if((substr(u2,1,8)) == "FUNCTION") { if((substr(u2,1,8)) == "FUNCTION")
{ split(u3,p_name,"("); { split(u3,p_name,"(");
l_name=(tolower(p_name[1])); l_name=(tolower(p_name[1]));
...@@ -176,7 +225,7 @@ awk ' ...@@ -176,7 +225,7 @@ awk '
n_unit=(n_unit) + 0 n_unit=(n_unit) + 0
} }
} }
} }
{ if((substr(u1,1,10)) == "SUBROUTINE") { if((substr(u1,1,10)) == "SUBROUTINE")
{ split(u2,p_name,"("); { split(u2,p_name,"(");
l_name=(tolower(p_name[1])); l_name=(tolower(p_name[1]));
...@@ -200,12 +249,32 @@ awk ' ...@@ -200,12 +249,32 @@ awk '
} }
else else
{ {
{ if((substr(u1,1,9)) == "RECURSIVE") { if((substr(u1,1,9)) == "ELEMENTAL")
{ if((substr(u2,1,10)) == "SUBROUTINE")
{ n_unit=(n_unit) + 1 }
}
}
{ if((substr(u1,1,9)) == "ELEMENTAL")
{ if((substr(u2,1,8)) == "FUNCTION")
{ n_unit=(n_unit) + 1 }
}
}
{ if((substr(u1,1,4)) == "PURE")
{ if((substr(u2,1,10)) == "SUBROUTINE")
{ n_unit=(n_unit) + 1 }
}
}
{ if((substr(u1,1,4)) == "PURE")
{ if((substr(u2,1,8)) == "FUNCTION")
{ n_unit=(n_unit) + 1 }
}
}
{ if((substr(u1,1,9)) == "RECURSIVE")
{ if((substr(u2,1,10)) == "SUBROUTINE") { if((substr(u2,1,10)) == "SUBROUTINE")
{ n_unit=(n_unit) + 1 } { n_unit=(n_unit) + 1 }
} }
} }
{ if((substr(u1,1,9)) == "RECURSIVE") { if((substr(u1,1,9)) == "RECURSIVE")
{ if((substr(u2,1,8)) == "FUNCTION") { if((substr(u2,1,8)) == "FUNCTION")
{ n_unit=(n_unit) + 1 } { n_unit=(n_unit) + 1 }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment