]> granicus.if.org Git - mutt/commitdiff
Pipe functions.h through cpp -C for the manual generation; factor out
authorChristoph Berg <cb@df7cb.de>
Wed, 21 Mar 2007 17:08:56 +0000 (10:08 -0700)
committerChristoph Berg <cb@df7cb.de>
Wed, 21 Mar 2007 17:08:56 +0000 (10:08 -0700)
makedoc-defs.h from init.h for use in functions.h.

Makefile.am
doc/Makefile.am
doc/gen-map-doc
doc/manual.xml.tail
functions.h
init.h
makedoc-defs.h [new file with mode: 0644]

index 566f69e900e2165fef2d4588f54968f82ddacf4b..b6aad020929e178a668b86aa5459ed0f5100070b 100644 (file)
@@ -75,7 +75,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
        rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \
        _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
        mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h Muttrc.head Muttrc \
-       makedoc.c stamp-doc-rc README.SSL smime.h\
+       makedoc.c makedoc-defs.h stamp-doc-rc README.SSL smime.h \
        muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
        ChangeLog ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
        snprintf.c regex.c crypt-gpgme.h
@@ -199,7 +199,7 @@ update-doc: stamp-doc-rc
 
 Muttrc: stamp-doc-rc
 
-stamp-doc-rc: $(srcdir)/init.h makedoc Muttrc.head
+stamp-doc-rc: $(srcdir)/init.h $(srcdir)/makedoc-defs.h makedoc Muttrc.head
        -rm -f Muttrc stamp-doc-rc
        sed -e 's,[@]docdir[@],$(docdir),' $(srcdir)/Muttrc.head > Muttrc
        $(CPP) $(AM_CPPFLAGS) $(DEFS) $(CPPFLAGS) -D_MAKEDOC -C \
index 891333a0b8b6b10247a83586bba98474405becab..69039908617cfad73ab132f221ee3fc7e68df7b9 100644 (file)
@@ -130,13 +130,14 @@ EDIT = sed -e 's,@sysconfdir\@,$(sysconfdir),g' \
 mutt.1: $(srcdir)/mutt.man
        $(EDIT) $(srcdir)/mutt.man > $@
 
-stamp-doc-xml: $(top_srcdir)/makedoc.c $(top_srcdir)/init.h manual.xml.head \
-               $(top_srcdir)/functions.h $(top_srcdir)/OPS* manual.xml.tail \
-               $(top_srcdir)/VERSION $(top_srcdir)/ChangeLog
+stamp-doc-xml: $(top_srcdir)/makedoc.c $(top_srcdir)/makedoc-defs.h $(top_srcdir)/init.h \
+               manual.xml.head $(top_srcdir)/functions.h $(top_srcdir)/OPS* manual.xml.tail \
+               $(srcdir)/gen-map-doc $(top_srcdir)/VERSION $(top_srcdir)/ChangeLog
        $(MAKE) ../makedoc$(EXEEXT) # we do not want to rebuild the documentation in tarball builds
-       ( date=`head -n 1 $(top_srcdir)/ChangeLog | LC_ALL=C cut -d ' ' -f 1`; \
-         sed -e "s/@VERSION\@/`cat $(top_srcdir)/VERSION` ($$date)/" $(srcdir)/manual.xml.head ;\
-         $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s ;\
-         perl $(srcdir)/gen-map-doc $(top_srcdir)/functions.h $(top_srcdir)/OPS* < $(srcdir)/manual.xml.tail \
+       ( date=`head -n 1 $(top_srcdir)/ChangeLog | LC_ALL=C cut -d ' ' -f 1` && \
+         sed -e "s/@VERSION\@/`cat $(top_srcdir)/VERSION` ($$date)/" $(srcdir)/manual.xml.head && \
+         $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s && \
+         $(MAKEDOC_CPP) $(top_srcdir)/functions.h | \
+           perl $(srcdir)/gen-map-doc $(srcdir)/manual.xml.tail $(top_srcdir)/OPS* \
        ) > manual.xml
        touch stamp-doc-xml
index 9e01cc01e55a307e4795a26f1de4953184628fb8..fcbaeffb0295fc45411742eac91419135e3f0f55 100644 (file)
@@ -2,9 +2,9 @@
 
 use strict;
 
-my (%OPS, %MAP, $map);
+my (%OPS, %MAP, %DOC, $map);
 
-my $functions_h = shift @ARGV;
+my $xml = shift @ARGV;
 
 open F, "cat @ARGV |" or die "OPS*: $!";
 while (<F>) {
@@ -13,10 +13,13 @@ while (<F>) {
 }
 close F;
 
-open F, $functions_h or die "$functions_h: $!";
-while (<F>) {
+while (<STDIN>) {
   if (/^struct binding_t Op.*{ \/\* map: (.*) \*\//) {
     $map = $1;
+    $DOC{$map} = "";
+  }
+  if ($map and /^\s*\*\*\s*(.*)/) {
+    $DOC{$map} .= "$1\n";
   }
   if ($map and /{\s*"(.+)"\s*,\s*(\w+)\s*,\s*(?:"([^"]+)"|(\w+))\s*}/) {
     my ($function, $op, $binding) = ($1, $2, $3 || $4);
@@ -40,16 +43,43 @@ while (<F>) {
     undef $map;
   }
 }
-close F;
 
-while (<STDIN>) {
+open XML, $xml or die "$xml: $!";
+while (<XML>) {
   if (/__print_map\((.*)\)/) {
-    die "map $1 undefined" unless $MAP{$1};
-    print $MAP{$1};
+    my $map = $1;
+    unless ($MAP{$map}) {
+      warn "map $map undefined";
+      next;
+    }
+    print <<EOT;
+<sect2 id="${map}_map">
+<title>$map</title>
+$DOC{$map}
+<para>
+
+<table id="${map}_table">
+<title>Default $map function bindings</title>
+<tgroup cols="3">
+<thead>
+<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
+</thead>
+<tbody>
+$MAP{$map}
+</tbody>
+</tgroup>
+</table>
+
+</para>
+
+</sect2>
+
+EOT
     delete $MAP{$1};
   } else {
     print;
   }
 }
+close XML;
 
-die "unprinted maps: ". join(" ", keys %MAP) if %MAP;
+warn "unprinted maps: ". join(" ", keys %MAP) if %MAP;
index 7bba58c24d950d5320facf8420a251a2ba9a66d9..1ebe1e491643783503fa66c20ff4f82b217e7885 100644 (file)
@@ -11,285 +11,19 @@ functions can be changed with the <link linkend="bind">bind</link>
 command.
 </para>
 
-<sect2 id="generic_map">
-<title>generic</title>
-
-<para>
-The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
-(such as movement) available in all menus except for <emphasis>pager</emphasis> and
-<emphasis>editor</emphasis>.  Changing settings for this menu will affect the default
-bindings for all menus (except as noted).
-</para>
-
-<para>
-
-<table id="generic_table">
-<title>Default generic function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(generic)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="index_map">
-<title>index</title>
-
-<para>
-
-<table id="index_table">
-<title>Default index menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(index)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="pager_map">
-<title>pager</title>
-
-<para>
-
-<table id="pager_table">
-<title>Default pager menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(pager)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="alias_map">
-<title>alias</title>
-
-<para>
-
-<table id="alias_table">
-<title>Default alias menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(alias)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="query_map">
-<title>query</title>
-
-<para>
-
-<table id="query_table">
-<title>Default query menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(query)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="attach_map">
-<title>attach</title>
-
-<para>
-
-<table id="attach_table">
-<title>Default attach menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(attach)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="compose_map">
-<title>compose</title>
-
-<para>
-
-<table id="compose_table">
-<title>Default compose menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(compose)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="postpone_map">
-<title>postpone</title>
-
-<para>
-
-<table id="postpone_table">
-<title>Default postpone menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(postpone)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="browser_map">
-<title>browser</title>
-
-<para>
-
-<table id="browser_table">
-<title>Default browser menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(browser)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="pgp_map">
-<title>pgp</title>
-
-<para>
-
-<table id="pgp_table">
-<title>Default pgp menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(pgp)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="smime_map">
-<title>smime</title>
-
-<para>
-
-<table id="smime_table">
-<title>Default smime menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(smime)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="mix_map">
-<title>mix</title>
-
-<para>
-
-<table id="mix_table">
-<title>Default mix menu function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(mix)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
-
-<sect2 id="editor_map">
-<title>editor</title>
-
-<para>
-
-<table id="editor_table">
-<title>Default editor function bindings</title>
-<tgroup cols="3">
-<thead>
-<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
-</thead>
-<tbody>
 __print_map(editor)
-</tbody>
-</tgroup>
-</table>
-
-</para>
-
-</sect2>
 
 </sect1>
 
index 237e7af15c1d65c6d3968ad47cca1427b2faaea4..7aa067334bd832f56abd79fd9d935c4a40ed477d 100644 (file)
  * - If you need to bind a control char, use the octal value because the \cX
  * construct does not work at this level.
  *
+ * - The magic "map:" comments define how the map will be called in the
+ * manual. Lines starting with "**" will be included in the manual.
+ *
  */
 
+#ifdef _MAKEDOC
+# include "config.h"
+# include "makedoc-defs.h"
+#endif
+
 struct binding_t OpGeneric[] = { /* map: generic */
+  /*
+  ** <para>
+  ** The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
+  ** (such as movement) available in all menus except for <emphasis>pager</emphasis> and
+  ** <emphasis>editor</emphasis>.  Changing settings for this menu will affect the default
+  ** bindings for all menus (except as noted).
+  ** </para>
+  */
   { "top-page",                OP_TOP_PAGE,            "H" },
   { "next-entry",      OP_NEXT_ENTRY,          "j" },
   { "previous-entry",  OP_PREV_ENTRY,          "k" },
diff --git a/init.h b/init.h
index 86b0072dfd1685ff9ee1752f708c26d266ef9bcc..f647eda40d9b422d019d8a404e4fa391df739305 100644 (file)
--- a/init.h
+++ b/init.h
@@ -19,6 +19,7 @@
 
 #ifdef _MAKEDOC
 # include "config.h"
+# include "makedoc-defs.h"
 #else
 # include "sort.h"
 #endif
@@ -80,59 +81,6 @@ struct option_t
 #define ISPELL "ispell"
 #endif
 
-/* build complete documentation */
-
-#ifdef _MAKEDOC
-# ifndef USE_IMAP
-#  define USE_IMAP
-# endif
-# ifndef MIXMASTER
-#  define MIXMASTER "mixmaster"
-# endif
-# ifndef USE_POP
-#  define USE_POP
-# endif
-# ifndef USE_SMTP
-#  define USE_SMTP
-# endif
-# ifndef USE_SSL_OPENSSL
-#  define USE_SSL_OPENSSL
-# endif
-# ifndef USE_SSL_GNUTLS
-#  define USE_SSL_GNUTLS
-# endif
-# ifndef USE_SSL
-#  define USE_SSL
-# endif
-# ifndef USE_SOCKET
-#  define USE_SOCKET
-# endif
-# ifndef USE_DOTLOCK
-#  define USE_DOTLOCK
-# endif
-# ifndef DL_STANDALONE
-#  define DL_STANDALONE
-# endif
-# ifndef USE_HCACHE
-#  define USE_HCACHE
-# endif
-# ifndef HAVE_DB4
-#  define HAVE_DB4
-# endif
-# ifndef HAVE_GDBM
-#  define HAVE_GDBM
-# endif
-# ifndef HAVE_QDBM
-#  define HAVE_QDBM
-# endif
-# ifndef HAVE_LIBIDN
-#  define HAVE_LIBIDN
-# endif
-# ifndef HAVE_GETADDRINFO
-#  define HAVE_GETADDRINFO
-# endif
-#endif
-
 struct option_t MuttVars[] = {
   /*++*/
   { "abort_nosubject", DT_QUAD, R_NONE, OPT_SUBJECT, M_ASKYES },
@@ -2030,7 +1978,7 @@ struct option_t MuttVars[] = {
   ** .pp
   ** Example: set certificate_file=~/.mutt/certificates
   */
-# if defined _MAKEDOC || !defined(USE_SSL_GNUTLS)
+# ifdef USE_SSL_OPENSSL
   { "ssl_usesystemcerts", DT_BOOL, R_NONE, OPTSSLSYSTEMCERTS, 1 },
   /*
   ** .pp
@@ -2050,7 +1998,7 @@ struct option_t MuttVars[] = {
   ** This variables specifies whether to attempt to use SSLv2 in the
   ** SSL authentication process.
   */
-# endif /* defined _MAKEDOC || !defined(USE_SSL_GNUTLS) */
+# endif /* defined USE_SSL_OPENSSL */
   { "ssl_use_sslv3", DT_BOOL, R_NONE, OPTSSLV3, 1 },
   /*
   ** .pp
diff --git a/makedoc-defs.h b/makedoc-defs.h
new file mode 100644 (file)
index 0000000..875b350
--- /dev/null
@@ -0,0 +1,54 @@
+/* build complete documentation */
+
+# ifndef CRYPT_BACKEND_GPGME
+#  define CRYPT_BACKEND_GPGME
+# endif
+# ifndef USE_IMAP
+#  define USE_IMAP
+# endif
+# ifndef MIXMASTER
+#  define MIXMASTER "mixmaster"
+# endif
+# ifndef USE_POP
+#  define USE_POP
+# endif
+# ifndef USE_SMTP
+#  define USE_SMTP
+# endif
+# ifndef USE_SSL_OPENSSL
+#  define USE_SSL_OPENSSL
+# endif
+# ifndef USE_SSL_GNUTLS
+#  define USE_SSL_GNUTLS
+# endif
+# ifndef USE_SSL
+#  define USE_SSL
+# endif
+# ifndef USE_SOCKET
+#  define USE_SOCKET
+# endif
+# ifndef USE_DOTLOCK
+#  define USE_DOTLOCK
+# endif
+# ifndef DL_STANDALONE
+#  define DL_STANDALONE
+# endif
+# ifndef USE_HCACHE
+#  define USE_HCACHE
+# endif
+# ifndef HAVE_DB4
+#  define HAVE_DB4
+# endif
+# ifndef HAVE_GDBM
+#  define HAVE_GDBM
+# endif
+# ifndef HAVE_QDBM
+#  define HAVE_QDBM
+# endif
+# ifndef HAVE_LIBIDN
+#  define HAVE_LIBIDN
+# endif
+# ifndef HAVE_GETADDRINFO
+#  define HAVE_GETADDRINFO
+# endif
+