-
Notifications
You must be signed in to change notification settings - Fork 15
/
indent_em_all
executable file
·58 lines (44 loc) · 911 Bytes
/
indent_em_all
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
#!/bin/bash
PROTECT_MACROS_WSC="
G_BEGIN_DECLS
G_END_DECLS
"
PROTECT_MACROS_WC="
UPDATE_MMAP_OPTIMISED_CASES_RIG
UPDATE_MMAP_OPTIMISED_CASES
"
cd lqr
for M in $PROTECT_MACROS_WSC
do
sed -i "s/\<${M}\>/${M};/g" *.{c,h}
done
for M in $PROTECT_MACROS_WC
do
sed -i "s/\<${M}\>/case ${M}:/g" *.{c,h}
done
indent *.{c,h}
for M in $PROTECT_MACROS_WSC
do
sed -i "s/\<${M};/${M}/g" *.{c,h}
done
for M in $PROTECT_MACROS_WC
do
sed -i "s/\<case ${M}:/${M}/g" *.{c,h}
done
rm *~
cd ..
cd examples
indent *.{cpp,h}
sed -i "s@^{[[:space:]]*/\*[[:space:]]*{{{[[:space:]]*\*/@{/*{{{*/@;
s@^}[[:space:]]*/\*[[:space:]]*}}}[[:space:]]*\*/@}/*}}}*/@;" *.{cpp,h}
rm *~
cd ..
if [ -d experiments ]
then
cd experiments
indent *.{cpp,h}
sed -i "s@^{[[:space:]]*/\*[[:space:]]*{{{[[:space:]]*\*/@{/*{{{*/@;
s@^}[[:space:]]*/\*[[:space:]]*}}}[[:space:]]*\*/@}/*}}}*/@;" *.{cpp,h}
rm *~
cd ..
fi