source: trunk/server/lib/talloc/script/mksyms.awk

Last change on this file was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 1.2 KB
Line 
1#
2# mksyms.awk
3#
4# Extract symbols to export from C-header files.
5# output in version-script format for linking shared libraries.
6#
7# Copyright (C) 2008 Micheal Adam <obnox@samba.org>
8#
9BEGIN {
10 inheader=0;
11 indoxygen=0;
12}
13
14END {
15}
16
17{
18 if (inheader) {
19 if (match($0,"[)][^()]*[;][ \t]*$")) {
20 inheader = 0;
21 }
22 next;
23 }
24 if (indoxygen) {
25 if (match($0,"^#[ \t]*else[ \t]*.*$")) {
26 indoxygen = 0;
27 }
28 next;
29 }
30}
31
32/^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_\#]/ {
33 next;
34}
35
36/^extern[ \t]+[^()]+[;][ \t]*$/ {
37 gsub(/[^ \t]+[ \t]+/, "");
38 sub(/[;][ \t]*$/, "");
39 printf " %s;\n", $0;
40 next;
41}
42
43/^#[ \t]*ifdef[ \t]*DOXYGEN[ \t]*.*$/ {
44 indoxygen=1;
45 next;
46}
47
48# look for function headers:
49{
50 gotstart = 0;
51 if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
52 gotstart = 1;
53 }
54 if(!gotstart) {
55 next;
56 }
57}
58
59/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
60 sub(/[(].*$/, "");
61 gsub(/[^ \t]+[ \t]+/, "");
62 gsub(/^[*]+/, "");
63 printf " %s;\n",$0;
64 next;
65}
66
67/[_A-Za-z0-9]+[ \t]*[(]/ {
68 inheader=1;
69 sub(/[(].*$/, "");
70 gsub(/[^ \t]+[ \t]+/, "");
71 gsub(/^[*]/, "");
72 printf " %s;\n",$0;
73 next;
74}
75
Note: See TracBrowser for help on using the repository browser.