~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/src/xgettext.h

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* xgettext common functions.
2
 
   Copyright (C) 2001-2003, 2005-2006 Free Software Foundation, Inc.
 
2
   Copyright (C) 2001-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
3
3
   Written by Peter Miller <millerp@canb.auug.org.au>
4
4
   and Bruno Haible <haible@clisp.cons.org>, 2001.
5
5
 
61
61
 
62
62
/* Split keyword spec into keyword, argnum1, argnum2, argnumc.  */
63
63
extern void split_keywordspec (const char *spec, const char **endp,
64
 
                               struct callshape *shapep);
 
64
                               struct callshape *shapep);
65
65
 
66
66
/* Set of alternative calling conventions for a given keyword.  */
67
67
struct callshapes
75
75
/* Insert a (keyword, callshape) pair into a hash table mapping keyword to
76
76
   'struct callshapes *'.  */
77
77
extern void insert_keyword_callshape (hash_table *table,
78
 
                                      const char *keyword, size_t keyword_len,
79
 
                                      const struct callshape *shape);
 
78
                                      const char *keyword, size_t keyword_len,
 
79
                                      const struct callshape *shape);
80
80
 
81
81
 
82
82
/* Context representing some flags.  */
89
89
  /* Regarding the secondary formatstring type.  */
90
90
  /*enum is_format*/ unsigned int is_format2    : 3;
91
91
  /*bool*/           unsigned int pass_format2  : 1;
 
92
  /* Regarding the tertiary formatstring type.  */
 
93
  /*enum is_format*/ unsigned int is_format3    : 3;
 
94
  /*bool*/           unsigned int pass_format3  : 1;
92
95
};
93
96
/* Null context.  */
94
97
extern flag_context_ty null_context;
99
102
   The result will then also have all pass_format* flags = false.  */
100
103
extern flag_context_ty
101
104
       inherited_context (flag_context_ty outer_context,
102
 
                          flag_context_ty modifier_context);
 
105
                          flag_context_ty modifier_context);
103
106
 
104
107
/* Context representing some flags, for each possible argument number.
105
108
   This is a linked list, sorted according to the argument number.  */
106
109
typedef struct flag_context_list_ty flag_context_list_ty;
107
110
struct flag_context_list_ty
108
111
{
109
 
  int argnum;                   /* current argument number, > 0 */
110
 
  flag_context_ty flags;        /* flags for current argument */
 
112
  int argnum;                   /* current argument number, > 0 */
 
113
  flag_context_ty flags;        /* flags for current argument */
111
114
  flag_context_list_ty *next;
112
115
};
113
116
 
115
118
typedef struct flag_context_list_iterator_ty flag_context_list_iterator_ty;
116
119
struct flag_context_list_iterator_ty
117
120
{
118
 
  int argnum;                           /* current argument number, > 0 */
119
 
  const flag_context_list_ty* head;     /* tail of list */
 
121
  int argnum;                           /* current argument number, > 0 */
 
122
  const flag_context_list_ty* head;     /* tail of list */
120
123
};
121
124
extern flag_context_list_iterator_ty null_context_list_iterator;
122
125
extern flag_context_list_iterator_ty passthrough_context_list_iterator;
131
134
        flag_context_list_table_ty;
132
135
extern flag_context_list_ty *
133
136
       flag_context_list_table_lookup (flag_context_list_table_ty *flag_table,
134
 
                                       const void *key, size_t keylen);
 
137
                                       const void *key, size_t keylen);
135
138
/* Record a flag in the appropriate backend's table.  */
136
139
extern void xgettext_record_flag (const char *optionstring);
137
140
 
138
141
 
 
142
/* Context while building up lexical tokens.  */
 
143
typedef enum
 
144
  {
 
145
    lc_outside, /* Initial context: outside of comments and strings.  */
 
146
    lc_comment, /* Inside a comment.  */
 
147
    lc_string   /* Inside a string literal.  */
 
148
  }
 
149
  lexical_context_ty;
 
150
 
 
151
/* Error message about non-ASCII character in a specific lexical context.  */
 
152
extern char *non_ascii_error_message (lexical_context_ty lcontext,
 
153
                                      const char *file_name,
 
154
                                      size_t line_number);
 
155
 
 
156
 
139
157
/* Canonicalized encoding name for all input files.  */
140
158
extern const char *xgettext_global_source_encoding;
141
159
 
157
175
/* Convert the given string from xgettext_current_source_encoding to
158
176
   the output file encoding (i.e. ASCII or UTF-8).
159
177
   The resulting string is either the argument string, or freshly allocated.
160
 
   The file_name and line_number are only used for error message purposes.  */
 
178
   The lcontext, file_name and line_number are only used for error message
 
179
   purposes.  */
161
180
extern char *from_current_source_encoding (const char *string,
162
 
                                           const char *file_name,
163
 
                                           size_t line_number);
 
181
                                           lexical_context_ty lcontext,
 
182
                                           const char *file_name,
 
183
                                           size_t line_number);
164
184
 
165
185
 
166
186
/* List of messages whose msgids must not be extracted, or NULL.
204
224
  if (rslp != NULL)
205
225
    {
206
226
      if (rslp->refcount > 1)
207
 
        rslp->refcount--;
 
227
        rslp->refcount--;
208
228
      else
209
 
        {
210
 
          string_list_destroy (&rslp->contents);
211
 
          free (rslp);
212
 
        }
 
229
        {
 
230
          string_list_destroy (&rslp->contents);
 
231
          free (rslp);
 
232
        }
213
233
    }
214
234
}
215
235
 
223
243
   to the callee.
224
244
   MSGID must be a malloc()ed string; its ownership is passed to the callee.
225
245
   POS->file_name must be allocated with indefinite extent.
 
246
   EXTRACTED_COMMENT is a comment that needs to be copied into the POT file,
 
247
   or NULL.
226
248
   COMMENT may be savable_comment, or it may be a saved copy of savable_comment
227
249
   (then add_reference must be used when saving it, and drop_reference while
228
250
   dropping it).  Clear savable_comment.  */
229
251
extern message_ty *remember_a_message (message_list_ty *mlp,
230
 
                                       char *msgctxt,
231
 
                                       char *msgid,
232
 
                                       flag_context_ty context,
233
 
                                       lex_pos_ty *pos,
234
 
                                       refcounted_string_list_ty *comment);
 
252
                                       char *msgctxt,
 
253
                                       char *msgid,
 
254
                                       flag_context_ty context,
 
255
                                       lex_pos_ty *pos,
 
256
                                       const char *extracted_comment,
 
257
                                       refcounted_string_list_ty *comment);
 
258
 
235
259
/* Add an msgid_plural to a message previously returned by
236
260
   remember_a_message.
237
261
   STRING must be a malloc()ed string; its ownership is passed to the callee.
240
264
   (then add_reference must be used when saving it, and drop_reference while
241
265
   dropping it).  Clear savable_comment.  */
242
266
extern void remember_a_message_plural (message_ty *mp,
243
 
                                       char *string,
244
 
                                       flag_context_ty context,
245
 
                                       lex_pos_ty *pos,
246
 
                                       refcounted_string_list_ty *comment);
 
267
                                       char *string,
 
268
                                       flag_context_ty context,
 
269
                                       lex_pos_ty *pos,
 
270
                                       refcounted_string_list_ty *comment);
247
271
 
248
272
 
249
273
/* Represents the progressive parsing of an argument list w.r.t. a single
282
306
/* Creates a fresh arglist_parser recognizing calls.
283
307
   You can pass shapes = NULL for a parser not recognizing any calls.  */
284
308
extern struct arglist_parser * arglist_parser_alloc (message_list_ty *mlp,
285
 
                                                     const struct callshapes *shapes);
 
309
                                                     const struct callshapes *shapes);
286
310
/* Clones an arglist_parser.  */
287
311
extern struct arglist_parser * arglist_parser_clone (struct arglist_parser *ap);
288
312
/* Adds a string argument to an arglist_parser.  ARGNUM must be > 0.
292
316
   (then add_reference must be used when saving it, and drop_reference while
293
317
   dropping it).  Clear savable_comment.  */
294
318
extern void arglist_parser_remember (struct arglist_parser *ap,
295
 
                                     int argnum, char *string,
296
 
                                     flag_context_ty context,
297
 
                                     char *file_name, size_t line_number,
298
 
                                     refcounted_string_list_ty *comment);
 
319
                                     int argnum, char *string,
 
320
                                     flag_context_ty context,
 
321
                                     char *file_name, size_t line_number,
 
322
                                     refcounted_string_list_ty *comment);
299
323
/* Tests whether an arglist_parser has is not waiting for more arguments after
300
324
   argument ARGNUM.  */
301
325
extern bool arglist_parser_decidedp (struct arglist_parser *ap, int argnum);