summaryrefslogtreecommitdiff
path: root/mk.sh
blob: c30ad16f3e06dfab46a992f00d3c21fb8c9bd5c3 (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
#!/bin/sh

classify_source () {
	NAME=$(basename $1 .c)

	if grep -q "^REFERENCE(" $1; then
		echo REFERENCE
	elif grep -q "define ${NAME}[ (]" $1; then
		echo MACRO
	elif grep -q "typedef.* ${NAME}.*;" $1; then
		echo TYPE
	elif grep -q "typedef.*{$" $1; then
		echo TYPE_LONG
	elif grep -q "struct.*{" $1; then
		echo STRUCT
	elif grep -q "union.*{" $1; then
		echo UNION
	elif grep -q "^[A-Za-z_].* ${NAME};" $1; then
		echo EXTERN
	elif grep -q 'TGFN' $1; then
		echo TGFN
	else
		echo FUNCTION
	fi
}