From ae708b362940ed66fbccf2e4578057607a611250 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 21 Mar 2007 10:08:56 -0700 Subject: [PATCH] Pipe functions.h through cpp -C for the manual generation; factor out makedoc-defs.h from init.h for use in functions.h. --- Makefile.am | 4 +- doc/Makefile.am | 15 +-- doc/gen-map-doc | 48 ++++++-- doc/manual.xml.tail | 266 -------------------------------------------- functions.h | 16 +++ init.h | 58 +--------- makedoc-defs.h | 54 +++++++++ 7 files changed, 122 insertions(+), 339 deletions(-) create mode 100644 makedoc-defs.h diff --git a/Makefile.am b/Makefile.am index 566f69e9..b6aad020 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/doc/Makefile.am b/doc/Makefile.am index 891333a0..69039908 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 diff --git a/doc/gen-map-doc b/doc/gen-map-doc index 9e01cc01..fcbaeffb 100644 --- a/doc/gen-map-doc +++ b/doc/gen-map-doc @@ -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 () { @@ -13,10 +13,13 @@ while () { } close F; -open F, $functions_h or die "$functions_h: $!"; -while () { +while () { 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 () { undef $map; } } -close F; -while () { +open XML, $xml or die "$xml: $!"; +while () { 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 < +$map +$DOC{$map} + + + +Default $map function bindings + + +FunctionDefault keyDescription + + +$MAP{$map} + + +
+ +
+ + + +EOT delete $MAP{$1}; } else { print; } } +close XML; -die "unprinted maps: ". join(" ", keys %MAP) if %MAP; +warn "unprinted maps: ". join(" ", keys %MAP) if %MAP; diff --git a/doc/manual.xml.tail b/doc/manual.xml.tail index 7bba58c2..1ebe1e49 100644 --- a/doc/manual.xml.tail +++ b/doc/manual.xml.tail @@ -11,285 +11,19 @@ functions can be changed with the bind command. - -generic - - -The generic menu is not a real menu, but specifies common functions -(such as movement) available in all menus except for pager and -editor. Changing settings for this menu will affect the default -bindings for all menus (except as noted). - - - - - -Default generic function bindings - - -FunctionDefault keyDescription - - __print_map(generic) - - -
- -
- -
- - -index - - - - -Default index menu function bindings - - -FunctionDefault keyDescription - - __print_map(index) - - -
- -
- -
- - -pager - - - - -Default pager menu function bindings - - -FunctionDefault keyDescription - - __print_map(pager) - - -
- -
- -
- - -alias - - - - -Default alias menu function bindings - - -FunctionDefault keyDescription - - __print_map(alias) - - -
- -
- -
- - -query - - - - -Default query menu function bindings - - -FunctionDefault keyDescription - - __print_map(query) - - -
- -
- -
- - -attach - - - - -Default attach menu function bindings - - -FunctionDefault keyDescription - - __print_map(attach) - - -
- -
- -
- - -compose - - - - -Default compose menu function bindings - - -FunctionDefault keyDescription - - __print_map(compose) - - -
- -
- -
- - -postpone - - - - -Default postpone menu function bindings - - -FunctionDefault keyDescription - - __print_map(postpone) - - -
- -
- -
- - -browser - - - - -Default browser menu function bindings - - -FunctionDefault keyDescription - - __print_map(browser) - - -
- -
- -
- - -pgp - - - - -Default pgp menu function bindings - - -FunctionDefault keyDescription - - __print_map(pgp) - - -
- -
- -
- - -smime - - - - -Default smime menu function bindings - - -FunctionDefault keyDescription - - __print_map(smime) - - -
- -
- -
- - -mix - - - - -Default mix menu function bindings - - -FunctionDefault keyDescription - - __print_map(mix) - - -
- -
- -
- - -editor - - - - -Default editor function bindings - - -FunctionDefault keyDescription - - __print_map(editor) - - -
- -
- -
diff --git a/functions.h b/functions.h index 237e7af1..7aa06733 100644 --- a/functions.h +++ b/functions.h @@ -28,9 +28,25 @@ * - 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 */ + /* + ** + ** The generic menu is not a real menu, but specifies common functions + ** (such as movement) available in all menus except for pager and + ** editor. Changing settings for this menu will affect the default + ** bindings for all menus (except as noted). + ** + */ { "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 86b0072d..f647eda4 100644 --- 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 index 00000000..875b3503 --- /dev/null +++ b/makedoc-defs.h @@ -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 + -- 2.40.0