File: protobuf-gen.sh

package info (click to toggle)
criu 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,500 kB
  • sloc: ansic: 139,280; python: 7,484; sh: 3,824; java: 2,799; makefile: 2,659; asm: 1,137; perl: 206; xml: 117; exp: 45
file content (23 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

TR="y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"

sed -n '/PB_AUTOGEN_START/,/PB_AUTOGEN_STOP/ {
		/PB_AUTOGEN_ST/d;
		/^[ \t]*$/d;
		s/,.*$//;
		s/\tPB_//;
		p;
	   }' criu/include/protobuf-desc.h | \
while IFS= read -r x; do
	x_la=$(echo "$x" | sed $TR)
	x_uf=$(echo "$x" | sed -nr 's/^./&#\\\
/;
		s/_(.)/\\\
\1#\\\
/g;
		p;' | \
		sed -r "/^[A-Z]#\\\\\$/!{ $TR; }" | \
		sed -r ':loop; N; s/#?\\\n//; t loop')
	echo "CR_PB_DESC($x, $x_uf, $x_la);"
done