summaryrefslogtreecommitdiff
path: root/support/syscall-gen/gensys.sh
blob: 7559be96421efeed4022928323158a82acaa5ebe (plain)
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
#!/bin/sh

if [ $# -ne 2 ]; then
	echo usage: $0 sysname arch
	exit 1
fi

mastergen() {
	sed -e '
	s/\$//g
	:join
		/\\$/{a\

		N
		s/\\\n//
		b join
		}
	2,${
		/^#/!s/\([{}()*,]\)/ \1 /g
	}
	' < syscalls+$1.master | awk -f gencalls.awk $1 $2 > sys+$1-$2.myr
}

hdrgen() {
	sed -e '
	s/\$//g
	:join
		/[,(\\]$/{a\

		N
		s/\\*\n//
		b join
		}
	2,${
		/^#/!s/\([{}()*,]\)/ \1 /g
	}
	' < syscalls+$1.h | tee sysjoined.txt | awk -f gencalls.awk $1 $2 > sys+$1-$2.myr
}

rm -f have.txt want.txt gentypes+$1-$2.frag

if [ `uname` = Linux ]; then
	hdrgen $1 $2
	python ./c2myr.py $1 $2
	hdrgen $1 $2
else
	mastergen $1 $2
	python ./c2myr.py $1 $2
	mastergen $1 $2
fi