(root)/
gettext-0.22.4/
gettext-tools/
src/
xg-message.h
       1  /* Extracting a message.  Accumulating the message list.
       2     Copyright (C) 2001-2020 Free Software Foundation, Inc.
       3  
       4     This program is free software: you can redistribute it and/or modify
       5     it under the terms of the GNU General Public License as published by
       6     the Free Software Foundation; either version 3 of the License, or
       7     (at your option) any later version.
       8  
       9     This program is distributed in the hope that it will be useful,
      10     but WITHOUT ANY WARRANTY; without even the implied warranty of
      11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12     GNU General Public License for more details.
      13  
      14     You should have received a copy of the GNU General Public License
      15     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      16  
      17  #ifndef _XGETTEXT_MESSAGE_H
      18  #define _XGETTEXT_MESSAGE_H
      19  
      20  #include <stdbool.h>
      21  
      22  #include "message.h"
      23  #include "pos.h"
      24  #include "rc-str-list.h"
      25  
      26  #include "xg-arglist-context.h"
      27  #include "xg-encoding.h"
      28  
      29  #ifdef __cplusplus
      30  extern "C" {
      31  #endif
      32  
      33  
      34  /* Add a message to the list of extracted messages.
      35     MSGCTXT must be either NULL or a malloc()ed string; its ownership is passed
      36     to the callee.
      37     MSGID must be a malloc()ed string; its ownership is passed to the callee.
      38     IS_UTF8 must be true if MSGCTXT and MSGID have already been converted to
      39     UTF-8.
      40     PLURALP must be true if and only if a call to remember_a_message_plural will
      41     follow.
      42     POS->file_name must be allocated with indefinite extent.
      43     EXTRACTED_COMMENT is a comment that needs to be copied into the POT file,
      44     or NULL.
      45     COMMENT may be savable_comment, or it may be a saved copy of savable_comment
      46     (then add_reference must be used when saving it, and drop_reference while
      47     dropping it).  Clear savable_comment.
      48     COMMENT_IS_UTF8 must be true if COMMENT has already been converted to UTF-8.
      49     Return the new or found message, or NULL if the message is excluded.  */
      50  extern message_ty *remember_a_message (message_list_ty *mlp,
      51                                         char *msgctxt,
      52                                         char *msgid,
      53                                         bool is_utf8,
      54                                         bool pluralp,
      55                                         flag_context_ty context,
      56                                         lex_pos_ty *pos,
      57                                         const char *extracted_comment,
      58                                         refcounted_string_list_ty *comment,
      59                                         bool comment_is_utf8);
      60  
      61  /* Add an msgid_plural to a message previously returned by
      62     remember_a_message.
      63     STRING must be a malloc()ed string; its ownership is passed to the callee.
      64     IS_UTF8 must be true if STRING has already been converted to UTF-8.
      65     POS->file_name must be allocated with indefinite extent.
      66     COMMENT may be savable_comment, or it may be a saved copy of savable_comment
      67     (then add_reference must be used when saving it, and drop_reference while
      68     dropping it).  Clear savable_comment.
      69     COMMENT_IS_UTF8 must be true if COMMENT has already been converted to UTF-8.
      70   */
      71  extern void remember_a_message_plural (message_ty *mp,
      72                                         char *string,
      73                                         bool is_utf8,
      74                                         flag_context_ty context,
      75                                         lex_pos_ty *pos,
      76                                         refcounted_string_list_ty *comment,
      77                                         bool comment_is_utf8);
      78  
      79  /* The following functions are used by remember_a_message.
      80     Most extractors don't need to invoke them explicitly.  */
      81  
      82  /* Eliminates the 'undecided' values in mp->is_format.  */
      83  extern void decide_is_format (message_ty *mp);
      84  
      85  /* Adds a range restriction to mp->range.  */
      86  extern void intersect_range (message_ty *mp, const struct argument_range *range);
      87  
      88  /* Eliminates the 'undecided' value in mp->do_wrap.  */
      89  extern void decide_do_wrap (message_ty *mp);
      90  
      91  /* Eliminates the 'undecided' values in mp->syntax_check.  */
      92  extern void decide_syntax_check (message_ty *mp);
      93  
      94  
      95  #ifdef __cplusplus
      96  }
      97  #endif
      98  
      99  
     100  #endif /* _XGETTEXT_MESSAGE_H */