gnutls-api.texi: $(top_srcdir)/lib/includes/gnutls/gnutls.h.in
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
dane-api.texi: $(top_srcdir)/libdane/includes/gnutls/dane.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
x509-api.texi: $(top_srcdir)/lib/includes/gnutls/x509.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort |uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
xssl-api.texi: $(top_srcdir)/lib/includes/gnutls/xssl.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
pgp-api.texi: $(top_srcdir)/lib/includes/gnutls/openpgp.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
pkcs12-api.texi: $(top_srcdir)/lib/includes/gnutls/pkcs12.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
pkcs11-api.texi: $(top_srcdir)/lib/includes/gnutls/pkcs11.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
tpm-api.texi: $(top_srcdir)/lib/includes/gnutls/tpm.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
abstract-api.texi: $(top_srcdir)/lib/includes/gnutls/abstract.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
compat-api.texi: $(top_srcdir)/lib/includes/gnutls/compat.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
dtls-api.texi: $(top_srcdir)/lib/includes/gnutls/dtls.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
crypto-api.texi: $(top_srcdir)/lib/includes/gnutls/crypto.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
ocsp-api.texi: $(top_srcdir)/lib/includes/gnutls/ocsp.h
echo "" > $@-tmp
- for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $<|sort|uniq`; do \
- echo $(ECHO_N) "Creating documentation for file $$i... " && \
+ for i in `$(top_srcdir)/doc/scripts/getfuncs.pl < $< |sort|uniq`; do \
+ echo $(ECHO_N) "Creating documentation for $$i... " && \
$(srcdir)/scripts/gdoc -texinfo \
-function $$i \
$(C_SOURCE_FILES) >> $@-tmp 2>/dev/null && \
perl -p -e "s,^ENUMS =,ENUMS =$$STR," > tmp-$@; \
diff -u $(srcdir)/Makefile.am tmp-$@
rm -f tmp-$@
- FUNCS=`cat $(HEADER_FILES) | $(top_srcdir)/doc/scripts/getfuncs.pl|sort -d`; \
+ FUNCS=`cat $(HEADER_FILES) | $(top_srcdir)/doc/scripts/getfuncs.pl|sort -d|uniq`; \
MANS=""; \
for i in $$FUNCS; do \
MANS="$$MANS\nFUNCS += functions/$$i\nFUNCS += functions/$$i.short"; \
$enum = 0;
$lineno = 0;
+
foreach $file (@ARGV) {
if (!open(IN,"<$file")) {
print STDERR "Error: Cannot open file $file\n";
$contents = "";
}
- $prototype = "";
+ $prototype = '';
$state = 3;
} elsif ($line =~ /$doc_content/) {
# miguel-style comment kludge, look for blank lines after
print STDERR "warning: $lineno: Bad line: $_";
}
} elsif ($state == 3) { # scanning for function { (end of prototype)
+ if ($line =~ /([a-zA-Z\s]+)enum(.*)$/) {
+ $enum = 1;
+ }
+
if ($line =~ m#\s*/\*\s+MACDOC\s*#io) {
# do nothing
}
- elsif ($enum == 1 && $line =~ /(^\s*\{).*/) {
- $prototype .= "{";
+ elsif ($enum == 1 && $line =~ /(\s*\{).*/) {
+ $prototype = "typedef enum {";
}
elsif ($line =~ /([^\{]*)/) {
$prototype .= $1;
}
- if ($enum == 0 && $line =~ /\{/) {
+
+ if ($enum == 0 && $line =~ /;/) {
$prototype =~ s@/\*.*?\*/@@gos; # strip comments.
$prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
$prototype =~ s@^ +@@gos; # strip leading spaces
+
dump_function($prototype);
$function = "";
$prototype =~ s@/\*.*?\*/@@gos; # strip comments.
$prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
$prototype =~ s@^ +@@gos; # strip leading spaces
+
dump_enum($prototype);
$function = "";
$state = 0;
}
- elsif ($line =~ /([a-zA-Z\s]+)enum(.*)$/) {
- $enum = 1;
- }
}
}
+
}
if 0;
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2013 Nikos Mavrogiannopoulos
#
# This file is part of GnuTLS.
#
# given a header file in stdin it will print all functions
my $line;
-my $func;
+my $func_name;
+my $prototype;
+
+$state = 0;
+
+# 0: scanning
+# 1: comment
+# 2: struct||enum
+# 3: function
+
+sub function_print {
+ my $prototype = shift @_;
+
+ if ($prototype =~ m/^\s*\w\s+[A-Za-z0-9_]+[\s\*]+([A-Za-z0-9_]+)\s*\(.*/) {
+ $func_name = $1;
+ } elsif ($prototype =~ m/^\s*[A-Za-z0-9_]+[\s\*]+([A-Za-z0-9_]+)\s*\([^\)]+/) {
+ $func_name = $1;
+ } elsif ($prototype =~ m/^\s*\w+\s+\w+[\s\*]+([A-Za-z0-9_]+)\s*\([^\)]+/) {
+ $func_name = $1;
+ } elsif ($prototype =~ m/^[\s\*]*([A-Za-z0-9_]+)\s*\([^\)]+/) {
+ $func_name = $1;
+ } elsif ($prototype =~ m/^[\s\*]*[A-Za-z0-9_]+\s+([A-Za-z0-9_]+)/) {
+ $func_name = $1;
+ }
+
+#print STDERR "function: $prototype\n";
+ if ($func_name ne '' && ($func_name =~ m/gnutls_.*/ || $func_name =~ m/dane_.*/ || $func_name =~ m/xssl_.*/)) {
+ print $func_name . "\n";
+ }
+
+ return;
+}
while ($line=<STDIN>) {
- if ($line !~ m/typedef/ && $line !~ m/Copyright/ && $line !~ m/doc-skip/) {
- $func = '';
-
- if ($line =~ m/^\s*\w+[\s\*]+([A-Za-z0-9_]+)\s*\([^\)]+/) {
- $func = $1;
- }
+ next if ($line eq '');
+# print STDERR "line($state): $line";
- if ($line =~ m/^\s*\w+\s+\w+[\s\*]+([A-Za-z0-9_]+)\s*\([^\)]+/) {
- $func = $1;
- }
+ #skip comments
+ if ($state == 0) {
+ if ($line =~ m/^\s*\/\*/) {
+
+ next if ($line =~ m/\*\//);
+
+ $state = 1;
+ next;
+ } elsif ($line =~ m/^\s*typedef\s+enum/ || $line =~ m/^\s*enum/ ||
+ $line =~ m/^\s*struct/ || $line =~ m/^\s*typedef\s+struct/) {
+
+ next if ($line =~ m/;/);
+ $state = 2;
+ next;
+ } elsif ($line !~ m/^\s*extern/ && $line !~ m/^\s*typedef/ && $line !~ m/doc-skip/ && $line =~ m/^\s*\w/) {
+ $state = 3;
- if ($line =~ m/^[\s\*]*([A-Za-z0-9_]+)\s*\([^\)]+/) {
- $func = $1;
+ $prototype = "$line";
+ $func_name = '';
+
+ if ($line =~ m/;/) {
+ function_print($prototype);
+ $state = 0;
+ next;
+ }
+ }
+ } elsif ($state == 1) { # comment
+ if ($line =~ m/\*\//) {
+ $state = 0;
+ next;
}
+ } elsif ($state == 2) { #struct||enum
+ if ($line =~ m/;/) {
+ $state = 0;
+ next;
+ }
+ } elsif ($state == 3) {
+ $prototype .= $line;
- if ($func ne '' && ($func =~ m/gnutls_.*/ || $func =~ m/dane_.*/)) {
- print $func . "\n";
+ if ($line =~ m/;/) {
+ $state = 0;
+
+ function_print($prototype);
}
}