summaryrefslogtreecommitdiff
path: root/mk.sh
blob: f1cce2c8f3c1e63331d91071dc318c38822d6dff (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.*${NAME} {" $1; then
		echo STRUCT
	elif grep -q "union.* ${NAME} {" $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
}