]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New function po_message_set_extracted_comments.
authorBruno Haible <bruno@clisp.org>
Fri, 11 Feb 2005 11:10:13 +0000 (11:10 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:11 +0000 (12:12 +0200)
gettext-tools/ChangeLog
gettext-tools/src/ChangeLog
gettext-tools/src/gettext-po.c
gettext-tools/src/gettext-po.h
gettext-tools/windows/gettextpo.def

index a8a0fd97152e0c5f16c81af12d7daedb1a9a45d0..faf07735fe7ab952bd7ff60fe9fc7f25c2a3f017 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-10  Bruno Haible  <bruno@clisp.org>
+
+       * windows/gettextpo.def: Add po_message_set_extracted_comments.
+
 2005-02-07  Bruno Haible  <bruno@clisp.org>
 
        * windows/gettextlib.def: Add c_strcasecmp, c_strncasecmp.
index 911d30bb5ef409d88c5c94709942c435501f0275..fd92e7a6ac705bf69352aaf541ef3b9019c7603a 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-10  Bruno Haible  <bruno@clisp.org>
+
+       * gettext-po.h (po_message_set_extracted_comments): New declaration.
+       * gettext-po.c (po_message_set_extracted_comments): New function.
+       Suggested by Asgeir Frimannsson <asgeirf@redhat.com>.
+
 2005-02-08  Bruno Haible  <bruno@clisp.org>
 
        * msginit.c (get_user_email): Cast _() to 'char *', to avoid compiler
index fafb3abc8ff816c16dc25af0ae91545e19c5cb63..8a811978273f21773832885a778a7a253204e99f 100644 (file)
@@ -631,6 +631,46 @@ po_message_extracted_comments (po_message_t message)
 }
 
 
+/* Change the extracted comments for a message.
+   comments should be a multiline string, ending in a newline, or empty.  */
+
+void
+po_message_set_extracted_comments (po_message_t message, const char *comments)
+{
+  message_ty *mp = (message_ty *) message;
+  string_list_ty *slp = string_list_alloc ();
+
+  {
+    char *copy = xstrdup (comments);
+    char *rest;
+
+    rest = copy;
+    while (*rest != '\0')
+      {
+       char *newline = strchr (rest, '\n');
+
+       if (newline != NULL)
+         {
+           *newline = '\0';
+           string_list_append (slp, rest);
+           rest = newline + 1;
+         }
+       else
+         {
+           string_list_append (slp, rest);
+           break;
+         }
+      }
+    free (copy);
+  }
+
+  if (mp->comment_dot != NULL)
+    string_list_free (mp->comment_dot);
+
+  mp->comment_dot = slp;
+}
+
+
 /* Return the i-th file position for a message, or NULL if i is out of
    range.  */
 
index a11c1f9128a9364223d24342c12ea1d011535c46..8baec019520cb2d0b02cbec9bd3eed4f0e9b8d96 100644 (file)
@@ -1,5 +1,5 @@
 /* Public API for GNU gettext PO files - contained in libgettextpo.
-   Copyright (C) 2003-2004 Free Software Foundation, Inc.
+   Copyright (C) 2003-2005 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software; you can redistribute it and/or modify
@@ -180,6 +180,10 @@ extern void po_message_set_comments (po_message_t message, const char *comments)
 /* Return the extracted comments for a message.  */
 extern const char * po_message_extracted_comments (po_message_t message);
 
+/* Change the extracted comments for a message.
+   comments should be a multiline string, ending in a newline, or empty.  */
+extern void po_message_set_extracted_comments (po_message_t message, const char *comments);
+
 /* Return the i-th file position for a message, or NULL if i is out of
    range.  */
 extern po_filepos_t po_message_filepos (po_message_t message, int i);
index c0f307f8772dc2f45fd6985750baff7d48d333e4..f6358c9a36ee6b2ac7662e798bc2f9cc11e4bdbf 100644 (file)
@@ -26,6 +26,7 @@ po_message_msgid_plural
 po_message_msgstr
 po_message_msgstr_plural
 po_message_set_comments
+po_message_set_extracted_comments
 po_message_set_format
 po_message_set_fuzzy
 po_message_set_msgid