forked from mpi-forum/mem-alloc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAKE-APPLANG
executable file
·118 lines (99 loc) · 3.88 KB
/
MAKE-APPLANG
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
#!/bin/bash
# Synopsis: ./MAKE-APPLANG
# Input:
FILES=("chap-pt2pt/pt2pt.tex+Point-to-Point Communication"
"chap-datatypes/datatypes.tex+Datatypes"
"chap-coll/coll.tex+Collective Communication"
"chap-context/context.tex+Groups, Contexts, Communicators, and Caching"
"chap-topol/topol.tex+Process Topologies"
"chap-inquiry/inquiry.tex+MPI Environmenta Management"
"chap-misc/misc-2.tex+The Info Object"
"chap-dynamic/dynamic-2.tex+Process Creation and Management"
"chap-one-side/one-side-2.tex+One-Sided Communications"
"chap-ei/ei-2.tex+External Interfaces"
"chap-io/io-2.tex+I/O"
"chap-binding/binding-2.tex+Language Bindings"
"chap-prof/prof.tex+Profiling Interface"
"chap-deprecated/deprecated.tex+Deprecated")
# Output: appLang-CNames.tex appLang-CppNames.tex appLang-FNames.tex
# These output files will be included in:
# appLang-C.tex appLang-C++.tex appLang-Fortran.tex
# which itself (together with appLang-Const.tex)
# are included by mpi-report.tex
# ---------------------------------------------
# arguments of the following subroutines:
# $1 - Source file name
# $2 - Subsection name
# $3 - type ie "c" or "f"
create_subsection()
{
local source=$1
local type=$3
local destFileName
case "$type" in
"c" )
destFileName="appLang-CNames.tex"
re='^ *\\mpibind|^ *\\mpiemptybind'
realName="$2 C Bindings"
;;
"f" )
destFileName="appLang-FNames.tex"
re='^ *\\mpifbind'
realName="$2 Fortran Bindings"
;;
esac
echo >> $destFileName
echo "\\subsection{$realName}" >> $destFileName
egrep "$re" $source | sed -e 's/mpiemptybindidx/mpiemptybindNOidx/' > applang.tmp
# The following two are equivalent:
# sort -t"{" +0 -1 applang.tmp >> $destFileName
sort -t"{" -k 1,2 applang.tmp >> $destFileName
}
create_cpp_subsection()
{
local source=$1
local destFileName="appLang-CppNames.tex"
re='^ *\\mpicppbind|^ *\\mpicppemptybind'
realName="$2 C++ Bindings"
egrep "$re" $source | grep -v '<CLASS>' | sed -e 's/MPI::/MPI::+/' -e 's/\([^:]*\)(/+\1+(/' -e 's/^+/++ZZZ/' > applang.tmp
# The following are equivalent:
# sort -t"+" +2 -3 +1 -2 applang.tmp | sed -e 's/^++ZZZ//' -e 's/MPI:://g' -e 's/+//' -e 's/+//' -e 's/+//' | sed -e 's/\(.*\)/\\noindent\\hspace{1em}\1/' >> $destFileName
if [ -s applang.tmp ] ; then
# Only generate a section if is it non-empty (this suppresses an empty
# "Deprecated C++ Bindings" section).
echo >> $destFileName
echo "\\subsection{$realName}" >> $destFileName
echo "%%HEADER" >> $destFileName
echo "%%SKIP" >> $destFileName
echo "%%ENDHEADER" >> $destFileName
echo "\\begin{verbatim}" >> $destFileName
echo "namespace MPI {" >> $destFileName
echo "\\end{verbatim}" >> $destFileName
sort -t"+" -k 3,4 -k 2,3 applang.tmp | sed -e 's/^++ZZZ//' -e 's/MPI:://g' -e 's/+//' -e 's/+//' -e 's/+//' | sed -e 's/\(.*\)/\\noindent\\hspace{1em}\1/' >> $destFileName
echo "%%HEADER" >> $destFileName
echo "%%SKIP" >> $destFileName
echo "%%ENDHEADER" >> $destFileName
echo "\\begin{verbatim}" >> $destFileName
echo "};" >> $destFileName
echo "\\end{verbatim}" >> $destFileName
else
echo "Real name = $realName"
if [ "$realName" = "Deprecated C++ Bindings" ] ; then
echo "\\MPIdelete{2.2}{11}{C++ Deprecated Functions section}" >> $destFileName
fi
fi
}
rm -f appLang-CNames.tex appLang-FNames.tex appLang-CppNames.tex
echo '% Do not edit this file. It is automatically generated by MAKE-APPLANG' > appLang-CNames.tex
echo '% Do not edit this file. It is automatically generated by MAKE-APPLANG' > appLang-FNames.tex
echo '% Do not edit this file. It is automatically generated by MAKE-APPLANG' > appLang-CppNames.tex
len=${#FILES[*]}
i=0
while [ $i -lt $len ]; do
file=`echo ${FILES[$i]} | cut -d\+ -f1`
string=`echo ${FILES[$i]} | cut -d\+ -f2`
create_subsection $file "$string" "c"
create_subsection $file "$string" "f"
create_cpp_subsection $file "$string"
let i++
done