WHATSNEW: Start release notes for Samba 3.6.2.
[Samba.git] / lib / talloc / script / mksyms.awk
blob83497a7a069ebca2ca90e1d5f5771208e967214a
2 # mksyms.awk
4 # Extract symbols to export from C-header files.
5 # output in version-script format for linking shared libraries.
7 # Copyright (C) 2008 Micheal Adam <obnox@samba.org>
9 BEGIN {
10 inheader=0;
11 indoxygen=0;
14 END {
18 if (inheader) {
19 if (match($0,"[)][^()]*[;][ \t]*$")) {
20 inheader = 0;
22 next;
24 if (indoxygen) {
25 if (match($0,"^#[ \t]*else[ \t]*.*$")) {
26 indoxygen = 0;
28 next;
32 /^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_\#]/ {
33 next;
36 /^extern[ \t]+[^()]+[;][ \t]*$/ {
37 gsub(/[^ \t]+[ \t]+/, "");
38 sub(/[;][ \t]*$/, "");
39 printf " %s;\n", $0;
40 next;
43 /^#[ \t]*ifdef[ \t]*DOXYGEN[ \t]*.*$/ {
44 indoxygen=1;
45 next;
48 # look for function headers:
50 gotstart = 0;
51 if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
52 gotstart = 1;
54 if(!gotstart) {
55 next;
59 /[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
60 sub(/[(].*$/, "");
61 gsub(/[^ \t]+[ \t]+/, "");
62 gsub(/^[*]+/, "");
63 printf " %s;\n",$0;
64 next;
67 /[_A-Za-z0-9]+[ \t]*[(]/ {
68 inheader=1;
69 sub(/[(].*$/, "");
70 gsub(/[^ \t]+[ \t]+/, "");
71 gsub(/^[*]/, "");
72 printf " %s;\n",$0;
73 next;