>From 4e145c72502098a51c0e2f2dbcab1ed6e3c3dc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= Date: Mon, 6 May 2019 13:34:27 +0200 Subject: [PATCH 06/15] doc: Move libgettextpo example to the front subsection. * gettext-tools/doc/gettext.texi (po_message_t API): Move example from here... (libgettextpo): ... back to here. --- gettext-tools/doc/gettext.texi | 72 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi index 5ac499357..8bc315ebc 100644 --- a/gettext-tools/doc/gettext.texi +++ b/gettext-tools/doc/gettext.texi @@ -5280,6 +5280,42 @@ defined in a library called @samp{libgettextpo}. * po_message_t API:: The basic units of the file @end menu +Here is an example code how these functions can be used. + address@hidden +const char *filename = @dots{}; +po_file_t file = po_file_read (filename); + +if (file == NULL) + error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename); address@hidden + const char * const *domains = po_file_domains (file); + const char * const *domainp; + + for (domainp = domains; *domainp; domainp++) + @{ + const char *domain = *domainp; + po_message_iterator_t iterator = po_message_iterator (file, domain); + + for (;;) + @{ + po_message_t *message = po_next_message (iterator); + + if (message == NULL) + break; + @{ + const char *msgid = po_message_msgid (message); + const char *msgstr = po_message_msgstr (message); + + @dots{} + @} + @} + po_message_iterator_free (iterator); + @} address@hidden +po_file_free (file); address@hidden example + @node Error Handling @subsection Error Handling @@ -5448,42 +5484,6 @@ The @code{po_message_msgstr_plural} function returns the the @var{index} is out of range or for a message without plural. @end deftypefun -Here is an example code how these functions can be used. - address@hidden -const char *filename = @dots{}; -po_file_t file = po_file_read (filename); - -if (file == NULL) - error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename); address@hidden - const char * const *domains = po_file_domains (file); - const char * const *domainp; - - for (domainp = domains; *domainp; domainp++) - @{ - const char *domain = *domainp; - po_message_iterator_t iterator = po_message_iterator (file, domain); - - for (;;) - @{ - po_message_t *message = po_next_message (iterator); - - if (message == NULL) - break; - @{ - const char *msgid = po_message_msgid (message); - const char *msgstr = po_message_msgstr (message); - - @dots{} - @} - @} - po_message_iterator_free (iterator); - @} address@hidden -po_file_free (file); address@hidden example - @node Binaries @chapter Producing Binary MO Files -- 2.21.0