summaryrefslogtreecommitdiffstats
path: root/src/util/getsyms.sed
blob: 7bd33dbd7d9a01c1453d321e9352ee060681ed76 (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
# emulate a C preprocessor (well, sort of)
y/	/ /
s/  */ /g
/\/\*/{
	:COMMENT
	y/	/ /
	s/  */ /g
	/\*\//!{
		N
		bCOMMENT
	}
}
s/\/\*.*\*\///
/^ *#ifdef/{
	s/^ *#ifdef //
	b
}
/^ *#ifndef/{
	s/^ *#ifndef //
	b
}
/^ *#if.*defined/{
	s/^ *#if //
	:IF
	/^defined/!{
		:NUKE
		s/^.//
		/^defined/!bNUKE
	}
	h
	/^defined/s/^defined *( *\([A-Za-z0-9_]*\) *).*/\1/p
	g
	/^defined/s/^defined *( *\([[A-Za-z0-9_]*\) *)//
	/defined/!{
		d
		b
	}
	bIF
}
d