gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_2_99_3-7-gb679178


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_99_3-7-gb679178
Date: Mon, 20 Jun 2011 18:21:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=b679178e1c1b08286068462c9bbbbb4f303351e5

The branch, master has been updated
       via  b679178e1c1b08286068462c9bbbbb4f303351e5 (commit)
       via  7114ead4d4e0e4159001089f861c60c80f5bb417 (commit)
       via  cb05a3c0f76d4d923d79d0e2a64ff9d76311adfe (commit)
      from  d57800e66a27850365cd42e52f0128e2b6d49dad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b679178e1c1b08286068462c9bbbbb4f303351e5
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Jun 20 20:21:18 2011 +0200

    Tables were also made floating

commit 7114ead4d4e0e4159001089f861c60c80f5bb417
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Jun 20 19:15:40 2011 +0200

    figures were made floating.

commit cb05a3c0f76d4d923d79d0e2a64ff9d76311adfe
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Jun 20 18:38:26 2011 +0200

    Added high-quality pdf images.

-----------------------------------------------------------------------

Summary of changes:
 doc/cha-auth.texi                        |    7 ++-
 doc/cha-cert-auth.texi                   |   26 +++++++----
 doc/cha-internals.texi                   |   70 ++++++++++++++++++---------
 doc/cha-intro-tls.texi                   |   26 +++++-----
 doc/cha-library.texi                     |   12 +++--
 doc/examples/ex-client1.c                |    2 +-
 doc/gnutls-certificate-user-use-case.pdf |  Bin 0 -> 14341 bytes
 doc/gnutls-client-server-use-case.pdf    |  Bin 0 -> 8102 bytes
 doc/gnutls-crypto-layers.pdf             |  Bin 0 -> 9506 bytes
 doc/gnutls-extensions_st.pdf             |  Bin 0 -> 12372 bytes
 doc/gnutls-handshake-sequence.pdf        |  Bin 0 -> 7669 bytes
 doc/gnutls-handshake-state.pdf           |  Bin 0 -> 12442 bytes
 doc/gnutls-internals.pdf                 |  Bin 0 -> 23669 bytes
 doc/gnutls-layers.pdf                    |  Bin 0 -> 18439 bytes
 doc/gnutls-logo.pdf                      |  Bin 0 -> 1953 bytes
 doc/gnutls-mod_auth_st.pdf               |  Bin 0 -> 13234 bytes
 doc/gnutls-objects.pdf                   |  Bin 0 -> 25872 bytes
 doc/gnutls-pgp.pdf                       |  Bin 0 -> 31116 bytes
 doc/gnutls-x509.pdf                      |  Bin 0 -> 17321 bytes
 doc/latex/cover.tex.in                   |   32 ++++++------
 doc/pkcs11-vision.pdf                    |  Bin 0 -> 11499 bytes
 doc/scripts/mytexi2latex                 |   77 ++++++++++++++++++++++++------
 22 files changed, 169 insertions(+), 83 deletions(-)
 create mode 100644 doc/gnutls-certificate-user-use-case.pdf
 create mode 100644 doc/gnutls-client-server-use-case.pdf
 create mode 100644 doc/gnutls-crypto-layers.pdf
 create mode 100644 doc/gnutls-extensions_st.pdf
 create mode 100644 doc/gnutls-handshake-sequence.pdf
 create mode 100644 doc/gnutls-handshake-state.pdf
 create mode 100644 doc/gnutls-internals.pdf
 create mode 100644 doc/gnutls-layers.pdf
 create mode 100644 doc/gnutls-logo.pdf
 create mode 100644 doc/gnutls-mod_auth_st.pdf
 create mode 100644 doc/gnutls-objects.pdf
 create mode 100644 doc/gnutls-pgp.pdf
 create mode 100644 doc/gnutls-x509.pdf
 create mode 100644 doc/pkcs11-vision.pdf

diff --git a/doc/cha-auth.texi b/doc/cha-auth.texi
index 9a9bb38..edfb36d 100644
--- a/doc/cha-auth.texi
+++ b/doc/cha-auth.texi
@@ -348,10 +348,9 @@ maintain @acronym{PSK} keys.
 In @acronym{GnuTLS} every key exchange method is associated with a
 credentials type. So in order to enable to enable a specific method,
 the corresponding credentials type should be initialized and set using
address@hidden  A mapping is shown below.
-
-Key exchange algorithms and the corresponding credential types:
address@hidden  A mapping is shown in @ref{tab:key-exchange-cred}.
 
address@hidden Table,tab:key-exchange-cred
 @multitable @columnfractions .4 .25 .25
 
 @headitem Key exchange @tab Client credentials @tab Server credentials
@@ -384,6 +383,8 @@ Key exchange algorithms and the corresponding credential 
types:
 @tab @code{CRD_PSK}
 
 @end multitable
address@hidden exchange algorithms and the corresponding credential types.}
address@hidden float
 
 @node Parameters stored in credentials
 @section Parameters Stored in Credentials
diff --git a/doc/cha-cert-auth.texi b/doc/cha-cert-auth.texi
index 2342618..c4675ae 100644
--- a/doc/cha-cert-auth.texi
+++ b/doc/cha-cert-auth.texi
@@ -20,12 +20,15 @@ entities.  Usually more than one certification authorities 
exist, and
 certification authorities may certify other authorities to issue
 certificates as well, following a hierarchical model.
 
address@hidden @image{gnutls-x509,7cm}
address@hidden Figure,fig:x509
address@hidden,7cm}
address@hidden X.509 hierarchical trust model.}
address@hidden float
 
 One needs to trust one or more CAs for his secure communications. In
 that case only the certificates issued by the trusted authorities are
-acceptable.  The framework is illustrated on the figure above.
-Detailed examples are listed below.
+acceptable.  The framework is illustrated on @ref{fig:x509}.
+Detailed examples involving X.509 certificates are listed below.
 
 @menu
 * X.509 certificates::
@@ -308,11 +311,13 @@ CA. @acronym{OpenPGP} allows anyone to sign anyone's else 
public
 key. When Alice signs Bob's key, she is introducing Bob's key to
 anyone who trusts Alice. If someone trusts Alice to introduce keys,
 then Alice is a trusted introducer in the mind of that observer.
+For example in @ref{fig:openpgp}, David trusts Alice to be an introducer and 
Alice
+signed Bob's key thus Dave trusts Bob's key to be the real one.
 
address@hidden @image{gnutls-pgp,8cm}
-
-For example: If David trusts Alice to be an introducer, and Alice
-signed Bob's key, Dave also trusts Bob's key to be the real one.
address@hidden Figure,fig:openpgp
address@hidden,8cm}
address@hidden OpenPGP trust model.}
address@hidden float
 
 There are some key points that are important in that model. In the
 example Alice has to sign Bob's key, only if she is sure that the key
@@ -390,9 +395,12 @@ main advantage is that it allows operations on private key 
objects such as decry
 and signing without accessing the key itself.
 
 Moreover it can be used to allow all applications in the same operating system 
to access
-shared cryptographic keys and certificates in a uniform way, as in the 
following picture.
+shared cryptographic keys and certificates in a uniform way, as in 
@ref{fig:pkcs11-vision}.
 
address@hidden @image{pkcs11-vision,8cm}
address@hidden Figure,fig:pkcs11-vision
address@hidden,8cm}
address@hidden #11 module usage.}
address@hidden float
 
 @subsection Initialization
 To allow all the  @acronym{GnuTLS} applications to access @acronym{PKCS} #11 
tokens
diff --git a/doc/cha-internals.texi b/doc/cha-internals.texi
index 29bc25c..a889a04 100644
--- a/doc/cha-internals.texi
+++ b/doc/cha-internals.texi
@@ -18,34 +18,49 @@ happens inside the black box.
 
 @node The TLS Protocol
 @section The TLS Protocol
-The main needs for the TLS protocol to be used are
-shown in the image below.
-
address@hidden @image{gnutls-client-server-use-case,9cm}
-
-This is being accomplished by the following object diagram.
+The main use case for the TLS protocol is shown in @ref{fig:client-server}.
+A user of a library implementing the protocol expects no less than this 
functionality,
+i.e., to be able to set parameters such as the accepted security level, 
perform a
+negotiation with the peer and be able to exchange data.
+
address@hidden Figure,fig:client-server
address@hidden,9cm}
address@hidden protocol use case.}
address@hidden float
+
+This in @acronym{GnuTLS} is being accomplished by an object-oriented 
architecture 
+as shown in @ref{fig:gnutls-objects}.
 Note that since @acronym{GnuTLS} is being developed in C
 object are just structures with attributes. The operations listed
 are functions that require the first parameter to be that object.
address@hidden @image{gnutls-objects,12cm}
+
address@hidden Figure,fig:gnutls-objects
address@hidden,12cm}
address@hidden objects.}
address@hidden float
 
 @node TLS Handshake Protocol
 @section TLS Handshake Protocol
 The @acronym{GnuTLS} handshake protocol is implemented as a state
 machine that waits for input or returns immediately when the non-blocking
-transport layer functions are used. The main idea is shown in the following
-figure.
+transport layer functions are used. The main idea is shown in 
@ref{fig:gnutls-handshake}.
 
address@hidden @image{gnutls-handshake-state,9cm}
address@hidden Figure,fig:gnutls-handshake
address@hidden,9cm}
address@hidden handshake state machine.}
address@hidden float
 
 Also the way the input is processed varies per ciphersuite. Several 
 implementations of the internal handlers are available and 
 @funcref{gnutls_handshake} only multiplexes the input to the appropriate 
 handler. For example a @acronym{PSK} ciphersuite has a different 
 implementation of the @code{process_client_key_exchange} than a
-certificate ciphersuite.
+certificate ciphersuite. We illustrate the idea in 
@ref{fig:gnutls-handshake-sequence}.
 
address@hidden @image{gnutls-handshake-sequence,12cm}
address@hidden Figure,fig:gnutls-handshake-sequence
address@hidden,12cm}
address@hidden handshake process sequence.}
address@hidden float
 
 @node TLS Authentication Methods
 @section TLS Authentication Methods
@@ -53,10 +68,7 @@ In @acronym{GnuTLS} authentication methods can be 
implemented quite
 easily.  Since the required changes to add a new authentication method
 affect only the handshake protocol, a simple interface is used. An
 authentication method needs only to implement the functions as seen in
-the figure below.
-
address@hidden @image{gnutls-mod_auth_st,12cm}
-
address@hidden:gnutls-mod-auth}.
 The functions that need to be implemented are the ones responsible for
 interpreting the handshake protocol messages. It is common for such
 functions to read data from one or more @code{credentials_t}
@@ -64,6 +76,11 @@ address@hidden as the
 @code{gnutls_certificate_credentials_t} structures} and write data,
 such as certificates, usernames etc. to @code{auth_info_t} structures.
 
address@hidden Figure,fig:gnutls-mod-auth
address@hidden,12cm}
address@hidden authentication method structure.}
address@hidden float
+
 Simple examples of existing authentication methods can be seen in
 @code{auth_psk.c} for PSK ciphersuites and @code{auth_srp.c} for SRP
 ciphersuites. After implementing these functions the structure holding
@@ -73,9 +90,12 @@ its pointers has to be registered in 
@code{gnutls_algorithms.c} in the
 @node TLS Extension Handling
 @section TLS Extension Handling
 As with authentication methods, the TLS extensions handlers can be
-implemented using the following interface.
+implemented using the interface shown in @ref{fig:gnutls-ext}.
 
address@hidden @image{gnutls-extensions_st,12cm}
address@hidden Figure,fig:gnutls-ext
address@hidden,12cm}
address@hidden extensions structure.}
address@hidden float
 
 Here there are two functions, one for receiving the extension data
 and one for sending. These functions have to check internally whether
@@ -311,9 +331,12 @@ API was introduced in.
 @node Certificate Handling
 @section Certificate Handling
 What is provided by the certificate handling functions
-is summarized in the following diagram.
+is summarized in @ref{fig:gnutls-cert-use-case}.
 
address@hidden @image{gnutls-certificate-user-use-case,12cm}
address@hidden Figure,fig:gnutls-cert-use-case
address@hidden,12cm}
address@hidden certificate subsystem use cases.}
address@hidden float
 
 @node Cryptographic Backend
 @section Cryptographic Backend
@@ -324,9 +347,12 @@ those is a challenging task for every cryptographic  
application or
 library. Unfortunately the cryptographic libraries that GnuTLS is based 
 on take no advantage of these properties. For this reason GnuTLS handles 
 this internally by following a layered approach to accessing
-cryptographic operations as in the following figure. 
+cryptographic operations as in @ref{fig:crypto-layers}.
 
address@hidden @image{gnutls-crypto-layers,12cm}
address@hidden Figure,fig:crypto-layers
address@hidden,12cm}
address@hidden cryptographic back-end design.}
address@hidden float
 
 The TLS layer uses a cryptographic provider layer, that will in turn either 
 use the default crypto provider - a crypto library, or use an external
diff --git a/doc/cha-intro-tls.texi b/doc/cha-intro-tls.texi
index d8dc5bc..b45551e 100644
--- a/doc/cha-intro-tls.texi
+++ b/doc/cha-intro-tls.texi
@@ -49,9 +49,12 @@ alert protocol is above the record protocol.
 The Handshake protocol is responsible for the security parameters'
 negotiation, the initial key exchange and authentication.  
 @xref{The Handshake Protocol}, for more information about the handshake
-protocol.  The protocol layering in TLS is shown in the figure below.
+protocol.  The protocol layering in TLS is shown in @ref{fig:tls-layers}.
 
address@hidden @image{gnutls-layers,12cm}
address@hidden Figure,fig:tls-layers
address@hidden,12cm}
address@hidden TLS protocol layers.}
address@hidden float
 
 @node The transport layer
 @section The Transport Layer
@@ -855,20 +858,17 @@ can be used both by clients and servers.
 @cindex key sizes
 
 In TLS, since a lot of algorithms are involved, it is not easy to set
-a consistent security level.  For this reason this section will
+a consistent security level.  For this reason in @ref{tab:key-sizes} we
 present some correspondance between key sizes of symmetric algorithms
-and public key algorithms based on the ``ECRYPT II Yearly Report on Algorithms 
and Keysizes (2009-2010)''
-in @xcite{ECRYPT}.  Those can be used to generate certificates with
-appropriate key sizes as well as parameters for Diffie-Hellman and SRP
+and public key algorithms based on @xcite{ECRYPT}. 
+Those can be used to generate certificates with
+appropriate key sizes as well as select parameters for Diffie-Hellman and SRP
 authentication.
 
address@hidden Table,tab:key-sizes
 @multitable @columnfractions .10 .15 .10 .20 .35
 
address@hidden Security bits
address@hidden RSA, DH and SRP parameter size
address@hidden ECC key size
address@hidden Security parameter
address@hidden Description
address@hidden Security bits @tab RSA, DH and SRP parameter size @tab ECC key 
size @tab Security parameter @tab Description
 
 @item 64
 @tab 816
@@ -901,8 +901,10 @@ authentication.
 @tab Foreseeable future
 
 @end multitable
address@hidden sizes and security parameters.}
address@hidden float
 
-The first column provides a security parameter in a number of bits. This
+The first column  provides a security parameter in a number of bits. This
 gives an indication of the number of combinations to be tried by an adversary
 to brute force a key. For example to test all possible keys in a 112 bit 
security parameter
 @math{2^{112}} combinations have to be tried. For today's technology this is 
infeasible.
diff --git a/doc/cha-library.texi b/doc/cha-library.texi
index 5f738e1..84e88e8 100644
--- a/doc/cha-library.texi
+++ b/doc/cha-library.texi
@@ -61,11 +61,8 @@ smaller library, with the required features, can be 
generated.
 @section General Idea
 
 A brief description of how @acronym{GnuTLS} works internally is shown
-at the figure below. This section may be easier to understand after
+at @ref{fig:gnutls-design}. This section may be easier to understand after
 having seen the examples at @ref{examples}.
-
address@hidden @image{gnutls-internals,12cm}
-
 As shown in the figure, there is a read-only global state that is
 initialized once by the global initialization function.  This global
 structure, among others, contains the memory allocation functions
@@ -75,6 +72,11 @@ for the deinitialization function which frees all memory 
allocated in
 the global structure and is called after the program has permanently
 finished using @acronym{GnuTLS}.
 
address@hidden Figure,fig:gnutls-design
address@hidden,12cm}
address@hidden level design of GnuTLS.}
address@hidden float
+
 The credentials structure is used by some authentication methods, such
 as certificate authentication.  A
 credentials structure may contain certificates, private keys,
@@ -88,7 +90,7 @@ using the appropriate functions, and put its trusted 
certificates in
 this structure. The next step is to associate the credentials
 structure with each @acronym{TLS} session.
 
-A @acronym{GnuTLS} session contains all the required stuff for a
+A @acronym{GnuTLS} session contains all the required information for a
 session to handle one secure connection. This session calls directly
 to the transport layer functions, in order to communicate with the
 peer.  Every session has a unique session ID shared with the peer.
diff --git a/doc/examples/ex-client1.c b/doc/examples/ex-client1.c
index b5b7665..322e400 100644
--- a/doc/examples/ex-client1.c
+++ b/doc/examples/ex-client1.c
@@ -40,7 +40,7 @@ main (void)
   gnutls_init (&session, GNUTLS_CLIENT);
 
   /* Use default priorities */
-  gnutls_priority_set_direct (session, 
"PERFORMANCE:+ANON-ECDH:+ANON-DH:!ARCFOUR-128",
+  gnutls_priority_set_direct (session, "PERFORMANCE:+ANON-ECDH:+ANON-DH",
                               NULL);
 
   /* put the anonymous credentials to the current session
diff --git a/doc/gnutls-certificate-user-use-case.pdf 
b/doc/gnutls-certificate-user-use-case.pdf
new file mode 100644
index 0000000..8e85279
Binary files /dev/null and b/doc/gnutls-certificate-user-use-case.pdf differ
diff --git a/doc/gnutls-client-server-use-case.pdf 
b/doc/gnutls-client-server-use-case.pdf
new file mode 100644
index 0000000..0079b02
Binary files /dev/null and b/doc/gnutls-client-server-use-case.pdf differ
diff --git a/doc/gnutls-crypto-layers.pdf b/doc/gnutls-crypto-layers.pdf
new file mode 100644
index 0000000..642f0ff
Binary files /dev/null and b/doc/gnutls-crypto-layers.pdf differ
diff --git a/doc/gnutls-extensions_st.pdf b/doc/gnutls-extensions_st.pdf
new file mode 100644
index 0000000..54fadc7
Binary files /dev/null and b/doc/gnutls-extensions_st.pdf differ
diff --git a/doc/gnutls-handshake-sequence.pdf 
b/doc/gnutls-handshake-sequence.pdf
new file mode 100644
index 0000000..d24c4e6
Binary files /dev/null and b/doc/gnutls-handshake-sequence.pdf differ
diff --git a/doc/gnutls-handshake-state.pdf b/doc/gnutls-handshake-state.pdf
new file mode 100644
index 0000000..9c834ed
Binary files /dev/null and b/doc/gnutls-handshake-state.pdf differ
diff --git a/doc/gnutls-internals.pdf b/doc/gnutls-internals.pdf
new file mode 100644
index 0000000..97b1d74
Binary files /dev/null and b/doc/gnutls-internals.pdf differ
diff --git a/doc/gnutls-layers.pdf b/doc/gnutls-layers.pdf
new file mode 100644
index 0000000..31aa89e
Binary files /dev/null and b/doc/gnutls-layers.pdf differ
diff --git a/doc/gnutls-logo.pdf b/doc/gnutls-logo.pdf
new file mode 100644
index 0000000..4f26fab
Binary files /dev/null and b/doc/gnutls-logo.pdf differ
diff --git a/doc/gnutls-mod_auth_st.pdf b/doc/gnutls-mod_auth_st.pdf
new file mode 100644
index 0000000..5a1882e
Binary files /dev/null and b/doc/gnutls-mod_auth_st.pdf differ
diff --git a/doc/gnutls-objects.pdf b/doc/gnutls-objects.pdf
new file mode 100644
index 0000000..dd164a1
Binary files /dev/null and b/doc/gnutls-objects.pdf differ
diff --git a/doc/gnutls-pgp.pdf b/doc/gnutls-pgp.pdf
new file mode 100644
index 0000000..978e790
Binary files /dev/null and b/doc/gnutls-pgp.pdf differ
diff --git a/doc/gnutls-x509.pdf b/doc/gnutls-x509.pdf
new file mode 100644
index 0000000..050df14
Binary files /dev/null and b/doc/gnutls-x509.pdf differ
diff --git a/doc/latex/cover.tex.in b/doc/latex/cover.tex.in
index 0c51e18..b60bc80 100644
--- a/doc/latex/cover.tex.in
+++ b/doc/latex/cover.tex.in
@@ -2,16 +2,11 @@
 
 \thispagestyle{empty}
 
-\hspace{\linewidth}
-\hspace{-1.9cm}
-\includegraphics[height=1.3cm]{../gnutls-logo}
-\vspace{-.4cm}
-\\
 \HRule
 \vspace{.3cm}
 \\
 address@hidden
-{\Large{GNUTLS}}
+{\bf{\Large{GnuTLS}}}
 &
 \vspace{-.6cm}
 \begin{flushright}
@@ -21,9 +16,14 @@ This document applies to GnuTLS @VERSION@
 \end{tabular}
 
 \vspace*{\stretch{2}}
+\begin{center}
+\includegraphics{../gnutls-logo.pdf}
+\end{center}
+\vspace*{\stretch{2}}
 
 \begin{flushright}
-by Nikos Mavrogiannopoulos and Simon Josefsson
+by Nikos Mavrogiannopoulos\\
+and Simon Josefsson
 \end{flushright}
 \vspace{-0.5cm}
 \HRule
@@ -45,15 +45,15 @@ This document applies to GnuTLS @VERSION@
 
 \vspace*{\stretch{2}}
 
+\begin{quotation}
+Copyright \copyright{} 2011 Free Software Foundation, Inc.
+\end{quotation}
+
 \begin{flushleft}
-\par
-Copyright \copyright\ 2011 Free Software Foundation\\
-\par
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3
-or any later version published by the Free Software Foundation;
-with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
-A copy of the license is included in the section entitled "GNU
-Free Documentation License".
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
+copy of the license is included in the section entitled ``GNU Free
+Documentation License''.
 \end{flushleft}
-
diff --git a/doc/pkcs11-vision.pdf b/doc/pkcs11-vision.pdf
new file mode 100644
index 0000000..b0ae272
Binary files /dev/null and b/doc/pkcs11-vision.pdf differ
diff --git a/doc/scripts/mytexi2latex b/doc/scripts/mytexi2latex
index 7d1cb4a..aa54766 100755
--- a/doc/scripts/mytexi2latex
+++ b/doc/scripts/mytexi2latex
@@ -10,6 +10,9 @@ use constant MULTITABLE => 6;
 use constant EXAMPLE => 7;
 use constant SMALL_EXAMPLE => 8;
 use constant QUOTE => 9;
+use constant FLOAT => 10;
+use constant FLOAT_TABLE => 11;
+use constant MULTITABLE_INIT => 12;
 
 sub unescape()
 {
@@ -45,35 +48,55 @@ my $underscorematch = 
"[\\s\\w\\d-\\.\\/address@hidden:\\~]";
 my $codematch = "[\\s\\w\\d-\\.\\/address@hidden:\\-\\\"\+\\%]";
 my ($line, $prev_mode);
 my ($verbatim, $label);
+my @stack = ();
+
 while ($line = <FILE>) {
        $verbatim = 0;
 
         if ($mode == SKIP) {
 #print "%menu: $line";
                 if ($line =~ m/address@hidden /) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                $prev_mode = $mode;
                 next;
         } elsif ($mode == ITEMIZE) {
 #print "%itemize: $line";
                 if ($line =~ s/address@hidden itemize/\\end{itemize}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                 $line =~ s/address@hidden (.+)/\\item $1/g;
                $prev_mode = $mode;
         } elsif ($mode == ENUMERATE) {
                 if ($line =~ s/address@hidden itemize/\\end{enumerate}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                 if ($line =~ s/address@hidden enumerate/\\end{enumerate}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                 $line =~ s/address@hidden(.*)/\\item $1/g;
                $prev_mode = $mode;
+        } elsif ($mode == FLOAT) {
+                if ($line =~ s/address@hidden 
float/\\label\{$label\}\n\\end{figure}/g) {
+                        $mode = pop(@stack);
+                }
+                $line =~ 
s/address@hidden(\w)\,($spacematch)\}/\\includegraphics\[width=$2\]\{$1\}/g;
+               $line =~ s/address@hidden/\\caption\{/g;
+               $prev_mode = $mode;
+        } elsif ($mode == FLOAT_TABLE) {
+                if ($line =~ s/address@hidden 
float/\\label\{$label\}\n\\end{table}/g) {
+                        $mode = pop(@stack);
+                } else {
+                       $line =~ s/address@hidden/\\caption\{/g;
+                       $line =~ s/address@hidden address@hidden ([\.\d]+) 
([\.\d]+) 
([\.\d]+)$/\n\\begin{tabular}{|p{3.3cm}|p{3.3cm}|p{4.3cm}|}\n\\hline\n/g;
+                       $line =~ s/address@hidden address@hidden ([\.\d]+) 
([\.\d]+) ([\.\d]+) ([\.\d]+) 
([\.\d]+)$/\n\\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{3cm}|}\n\\hline\n/g;
+                       push(@stack, FLOAT_TABLE);
+                       goto multitable;
+               }
+               $prev_mode = $mode;
         } elsif ($mode == TABLE_ITEMIZE) {
                 if ($line =~ s/address@hidden table/\n\\end{itemize}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                chomp $line;
                if ($line eq "") {
@@ -86,8 +109,9 @@ while ($line = <FILE>) {
 
                $prev_mode = $mode;
         } elsif ($mode == MULTITABLE) {
+multitable:
                 if ($line =~ s/address@hidden 
multitable/\\\\\n\\hline\n\\end{tabular}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 } else {
                        chomp $line;
                        if ($line eq "") {
@@ -97,31 +121,33 @@ while ($line = <FILE>) {
                        $line =~ s/address@hidden/\&/g;
                        if ($line =~ m/address@hidden/) {
                                $line =~ s/address@hidden 
(.+)/$1\\\\\n\\hline\n\\hline/g;
+                               $prev_mode = MULTITABLE_INIT;
                        } else {
-                               if ($prev_mode != $mode) {
+                               if ($prev_mode == MULTITABLE_INIT) {
                                        $line =~ s/address@hidden (.+)/$1/g;
                                        $line =~ s/address@hidden (.+)/$1/g;
-                               } else {
+                                       $prev_mode = MULTITABLE;
+                               } elsif ($prev_mode == MULTITABLE) {
                                        $line =~ s/address@hidden 
(.+)/\\\\\n\\hline\n$1/g;
                                        $line =~ s/address@hidden 
(.+)/\\\\\n\\hline\n$1/g;
                                }
                        }
                }
-               $prev_mode = $mode;
+
         } elsif ($mode == VERBATIM) {
                 if ($line =~ s/address@hidden verbatim/\\end{verbatim}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                $verbatim = 1;
                $prev_mode = $mode;
         } elsif ($mode == QUOTE) {
                 if ($line =~ s/address@hidden quotation/\\end{quote}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                $prev_mode = $mode;
         } elsif ($mode == EXAMPLE) {
                 if ($line =~ s/address@hidden example/\\end{example}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                $line =~ s/address@hidden/{/g;
                $line =~ s/address@hidden/}/g;
@@ -130,7 +156,7 @@ while ($line = <FILE>) {
                $prev_mode = $mode;
         } elsif ($mode == SMALL_EXAMPLE) {
                 if ($line =~ s/address@hidden 
smallexample/\\end{smallexample}/g) {
-                        $mode = NORMAL;
+                        $mode = pop(@stack);
                 }
                $line =~ s/address@hidden/\{/g;
                $line =~ s/address@hidden/\}/g;
@@ -173,43 +199,64 @@ while ($line = <FILE>) {
                } else {
                        $label = '';
                }
-
                 if ($line =~ s/address@hidden//g) {
                         $mode = SKIP;
+                        push(@stack, NORMAL);
                        next;
                 }
                 if ($line =~ s/address@hidden//g) {
                         $mode = SKIP;
+                        push(@stack, NORMAL);
                        next;
                 }
                 if ($line =~ s/address@hidden 
address@hidden/\\begin{itemize}/g) {
                         $mode = ITEMIZE;
+                        push(@stack, NORMAL);
                 }
                 if ($line =~ s/address@hidden/\\begin{itemize}/g) {
                         $mode = ITEMIZE;
+                        push(@stack, NORMAL);
+                }
+                if ($line =~ s/address@hidden 
Figure\,(.*)/\\begin{figure}[htp]\n\\centering/g) {
+                       $label = $1;
+                        push(@stack, NORMAL);
+                        $mode = FLOAT;
+                }
+                if ($line =~ s/address@hidden 
Table\,(.*)/\\begin{table}[htp]\n\\centering/g) {
+                       $label = $1;
+                        push(@stack, NORMAL);
+                        $mode = FLOAT_TABLE;
                 }
                 if ($line =~ s/address@hidden/\\begin{enumerate}/g) {
+                        push(@stack, NORMAL);
                         $mode = ENUMERATE;
                 }
                 if ($line =~ s/address@hidden .*/\n\\begin{itemize}/g) {
+                        push(@stack, NORMAL);
                         $mode = TABLE_ITEMIZE;
                 }
                 if ($line =~ s/address@hidden address@hidden ([\.\d]+) 
([\.\d]+) 
([\.\d]+)$/\n\\begin{tabular}{|p{3.3cm}|p{3.3cm}|p{4.3cm}|}\n\\hline\n/g) {
+                        push(@stack, NORMAL);
                         $mode = MULTITABLE;
                 }
                 if ($line =~ s/address@hidden address@hidden ([\.\d]+) 
([\.\d]+) ([\.\d]+) ([\.\d]+) 
([\.\d]+)$/\n\\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{3cm}|}\n\\hline\n/g)
 {
+                        push(@stack, NORMAL);
                         $mode = MULTITABLE;
                 }
                 if ($line =~ s/address@hidden/\\begin{example}/g) {
+                        push(@stack, NORMAL);
                         $mode = EXAMPLE;
                 }
                 if ($line =~ s/address@hidden/\\begin{smallexample}/g) {
+                        push(@stack, NORMAL);
                         $mode = SMALL_EXAMPLE;
                 }
                 if ($line =~ s/address@hidden/\\begin{verbatim}/g) {
+                        push(@stack, NORMAL);
                         $mode = VERBATIM;
                 }
                 if ($line =~ s/address@hidden/\\begin{quote}/g) {
+                        push(@stack, NORMAL);
                         $mode = QUOTE;
                 }
         }
@@ -220,7 +267,7 @@ while ($line = <FILE>) {
                $line =~ s/\%/\\%/g;
                $line =~ s/\#/\\\#/g;
                 $line =~ s/address@hidden (.*)/\\examplefile{\.\.\/$1}/g;
-               $line =~ 
s/address@hidden($match+)\,($match+)\}/\\includegraphics\[width\=$2\]\{\.\.\/$1\}/g;
+               $line =~ 
s/address@hidden($match+)\,($match+)\}/\\includegraphics\[width\=$2\]\{\.\.\/$1\.pdf\}/g;
                $line =~ s/address@hidden($spacematch+)\}/$1/g;
                $line =~ s/address@hidden/\{\\bf /g;
                $line =~ s/address@hidden (.*)/\% $1/g;


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]