206
207
po_callback_message (char *msgctxt,
207
char *msgid, lex_pos_ty *msgid_pos, char *msgid_plural,
208
char *msgstr, size_t msgstr_len, lex_pos_ty *msgstr_pos,
211
char *prev_msgid_plural,
212
bool force_fuzzy, bool obsolete)
208
char *msgid, lex_pos_ty *msgid_pos, char *msgid_plural,
209
char *msgstr, size_t msgstr_len, lex_pos_ty *msgstr_pos,
212
char *prev_msgid_plural,
213
bool force_fuzzy, bool obsolete)
214
215
/* assert(callback_arg); */
215
216
call_directive_message (callback_arg, msgctxt,
216
msgid, msgid_pos, msgid_plural,
217
msgstr, msgstr_len, msgstr_pos,
218
prev_msgctxt, prev_msgid, prev_msgid_plural,
219
force_fuzzy, obsolete);
217
msgid, msgid_pos, msgid_plural,
218
msgstr, msgstr_len, msgstr_pos,
219
prev_msgctxt, prev_msgid, prev_msgid_plural,
220
force_fuzzy, obsolete);
274
278
/* Skip whitespace. */
275
279
while (*s != '\0' && strchr ("\n \t\r\f\v,", *s) != NULL)
278
282
/* Collect a token. */
280
284
while (*s != '\0' && strchr ("\n \t\r\f\v,", *s) == NULL)
286
/* Accept fuzzy flag. */
287
if (len == 5 && memcmp (t, "fuzzy", 5) == 0)
293
/* Accept format description. */
294
if (len >= 7 && memcmp (t + len - 7, "-format", 7) == 0)
298
enum is_format value;
303
if (n >= 3 && memcmp (p, "no-", 3) == 0)
309
else if (n >= 9 && memcmp (p, "possible-", 9) == 0)
315
else if (n >= 11 && memcmp (p, "impossible-", 11) == 0)
324
for (i = 0; i < NFORMATS; i++)
325
if (strlen (format_language[i]) == n
326
&& memcmp (format_language[i], p, n) == 0)
335
/* Accept wrap description. */
336
if (len == 4 && memcmp (t, "wrap", 4) == 0)
341
if (len == 7 && memcmp (t, "no-wrap", 7) == 0)
347
/* Unknown special comment marker. It may have been generated
348
from a future xgettext version. Ignore it. */
290
/* Accept fuzzy flag. */
291
if (len == 5 && memcmp (t, "fuzzy", 5) == 0)
297
/* Accept format description. */
298
if (len >= 7 && memcmp (t + len - 7, "-format", 7) == 0)
302
enum is_format value;
307
if (n >= 3 && memcmp (p, "no-", 3) == 0)
313
else if (n >= 9 && memcmp (p, "possible-", 9) == 0)
319
else if (n >= 11 && memcmp (p, "impossible-", 11) == 0)
328
for (i = 0; i < NFORMATS; i++)
329
if (strlen (format_language[i]) == n
330
&& memcmp (format_language[i], p, n) == 0)
339
/* Accept range description "range: <min>..<max>". */
340
if (len == 6 && memcmp (t, "range:", 6) == 0)
342
/* Skip whitespace. */
343
while (*s != '\0' && strchr ("\n \t\r\f\v,", *s) != NULL)
346
/* Collect a token. */
348
while (*s != '\0' && strchr ("\n \t\r\f\v,", *s) == NULL)
351
if (*t >= '0' && *t <= '9')
353
unsigned int min = 0;
355
for (; *t >= '0' && *t <= '9'; t++)
357
if (min <= INT_MAX / 10)
359
min = 10 * min + (*t - '0');
364
/* Avoid integer overflow. */
369
if (*t >= '0' && *t <= '9')
371
unsigned int max = 0;
372
for (; *t >= '0' && *t <= '9'; t++)
374
if (max <= INT_MAX / 10)
376
max = 10 * max + (*t - '0');
381
/* Avoid integer overflow. */
394
/* Accept wrap description. */
395
if (len == 4 && memcmp (t, "wrap", 4) == 0)
400
if (len == 7 && memcmp (t, "no-wrap", 7) == 0)
406
/* Unknown special comment marker. It may have been generated
407
from a future xgettext version. Ignore it. */
365
424
while (*s != '\0')
367
426
while (*s == ' ' || *s == '\t' || *s == '\n')
371
const char *string_start = s;
375
while (!(*s == '\0' || *s == ' ' || *s == '\t' || *s == '\n'));
377
/* See if there is a COLON and NUMBER after the STRING, separated
378
through optional spaces. */
382
while (*p == ' ' || *p == '\t' || *p == '\n')
389
while (*p == ' ' || *p == '\t' || *p == '\n')
392
if (*p >= '0' && *p <= '9')
394
/* Accumulate a number. */
399
n = n * 10 + (*p - '0');
402
while (*p >= '0' && *p <= '9');
404
if (*p == '\0' || *p == ' ' || *p == '\t' || *p == '\n')
406
/* Parsed a GNU style file comment with spaces. */
407
const char *string_end = s;
408
size_t string_length = string_end - string_start;
409
char *string = XNMALLOC (string_length + 1, char);
411
memcpy (string, string_start, string_length);
412
string[string_length] = '\0';
414
po_callback_comment_filepos (string, n);
425
/* See if there is a COLON at the end of STRING and a NUMBER after
426
it, separated through optional spaces. */
431
while (*p == ' ' || *p == '\t' || *p == '\n')
434
if (*p >= '0' && *p <= '9')
436
/* Accumulate a number. */
441
n = n * 10 + (*p - '0');
444
while (*p >= '0' && *p <= '9');
446
if (*p == '\0' || *p == ' ' || *p == '\t' || *p == '\n')
448
/* Parsed a GNU style file comment with spaces. */
449
const char *string_end = s - 1;
450
size_t string_length = string_end - string_start;
451
char *string = XNMALLOC (string_length + 1, char);
453
memcpy (string, string_start, string_length);
454
string[string_length] = '\0';
456
po_callback_comment_filepos (string, n);
466
/* See if there is a COLON and NUMBER at the end of the STRING,
467
without separating spaces. */
471
while (p > string_start)
474
if (!(*p >= '0' && *p <= '9'))
481
/* p now points to the beginning of the trailing digits segment
482
at the end of STRING. */
485
&& p > string_start + 1
488
/* Parsed a GNU style file comment without spaces. */
489
const char *string_end = p - 1;
491
/* Accumulate a number. */
497
n = n * 10 + (*p - '0');
503
size_t string_length = string_end - string_start;
504
char *string = XNMALLOC (string_length + 1, char);
506
memcpy (string, string_start, string_length);
507
string[string_length] = '\0';
509
po_callback_comment_filepos (string, n);
519
/* Parsed a file comment without line number. */
521
const char *string_end = s;
522
size_t string_length = string_end - string_start;
523
char *string = XNMALLOC (string_length + 1, char);
525
memcpy (string, string_start, string_length);
526
string[string_length] = '\0';
528
po_callback_comment_filepos (string, (size_t)(-1));
430
const char *string_start = s;
434
while (!(*s == '\0' || *s == ' ' || *s == '\t' || *s == '\n'));
436
/* See if there is a COLON and NUMBER after the STRING, separated
437
through optional spaces. */
441
while (*p == ' ' || *p == '\t' || *p == '\n')
448
while (*p == ' ' || *p == '\t' || *p == '\n')
451
if (*p >= '0' && *p <= '9')
453
/* Accumulate a number. */
458
n = n * 10 + (*p - '0');
461
while (*p >= '0' && *p <= '9');
463
if (*p == '\0' || *p == ' ' || *p == '\t' || *p == '\n')
465
/* Parsed a GNU style file comment with spaces. */
466
const char *string_end = s;
467
size_t string_length = string_end - string_start;
468
char *string = XNMALLOC (string_length + 1, char);
470
memcpy (string, string_start, string_length);
471
string[string_length] = '\0';
473
po_callback_comment_filepos (string, n);
484
/* See if there is a COLON at the end of STRING and a NUMBER after
485
it, separated through optional spaces. */
490
while (*p == ' ' || *p == '\t' || *p == '\n')
493
if (*p >= '0' && *p <= '9')
495
/* Accumulate a number. */
500
n = n * 10 + (*p - '0');
503
while (*p >= '0' && *p <= '9');
505
if (*p == '\0' || *p == ' ' || *p == '\t' || *p == '\n')
507
/* Parsed a GNU style file comment with spaces. */
508
const char *string_end = s - 1;
509
size_t string_length = string_end - string_start;
510
char *string = XNMALLOC (string_length + 1, char);
512
memcpy (string, string_start, string_length);
513
string[string_length] = '\0';
515
po_callback_comment_filepos (string, n);
525
/* See if there is a COLON and NUMBER at the end of the STRING,
526
without separating spaces. */
530
while (p > string_start)
533
if (!(*p >= '0' && *p <= '9'))
540
/* p now points to the beginning of the trailing digits segment
541
at the end of STRING. */
544
&& p > string_start + 1
547
/* Parsed a GNU style file comment without spaces. */
548
const char *string_end = p - 1;
550
/* Accumulate a number. */
556
n = n * 10 + (*p - '0');
562
size_t string_length = string_end - string_start;
563
char *string = XNMALLOC (string_length + 1, char);
565
memcpy (string, string_start, string_length);
566
string[string_length] = '\0';
568
po_callback_comment_filepos (string, n);
578
/* Parsed a file comment without line number. */
580
const char *string_end = s;
581
size_t string_length = string_end - string_start;
582
char *string = XNMALLOC (string_length + 1, char);
584
memcpy (string, string_start, string_length);
585
string[string_length] = '\0';
587
po_callback_comment_filepos (string, (size_t)(-1));
559
618
const char *string_end;
562
const char *p = s + 6;
621
const char *p = s + 6;
564
while (*p == ' ' || *p == '\t')
623
while (*p == ' ' || *p == '\t')
569
628
for (string_end = string_start; *string_end != '\0'; string_end++)
571
const char *p = string_end;
573
while (*p == ' ' || *p == '\t')
580
while (*p == ' ' || *p == '\t')
583
if (p[0] == 'l' && p[1] == 'i' && p[2] == 'n' && p[3] == 'e')
587
while (*p == ' ' || *p == '\t')
590
if (p[0] == 'n' && p[1] == 'u' && p[2] == 'm'
591
&& p[3] == 'b' && p[4] == 'e' && p[5] == 'r')
594
while (*p == ' ' || *p == '\t')
602
if (*p >= '0' && *p <= '9')
604
/* Accumulate a number. */
609
n = n * 10 + (*p - '0');
612
while (*p >= '0' && *p <= '9');
614
while (*p == ' ' || *p == '\t' || *p == '\n')
619
/* Parsed a Sun style file comment. */
620
size_t string_length = string_end - string_start;
622
XNMALLOC (string_length + 1, char);
624
memcpy (string, string_start, string_length);
625
string[string_length] = '\0';
627
po_callback_comment_filepos (string, n);
630
const char *p = string_end;
632
while (*p == ' ' || *p == '\t')
639
while (*p == ' ' || *p == '\t')
642
if (p[0] == 'l' && p[1] == 'i' && p[2] == 'n' && p[3] == 'e')
646
while (*p == ' ' || *p == '\t')
649
if (p[0] == 'n' && p[1] == 'u' && p[2] == 'm'
650
&& p[3] == 'b' && p[4] == 'e' && p[5] == 'r')
653
while (*p == ' ' || *p == '\t')
661
if (*p >= '0' && *p <= '9')
663
/* Accumulate a number. */
668
n = n * 10 + (*p - '0');
671
while (*p >= '0' && *p <= '9');
673
while (*p == ' ' || *p == '\t' || *p == '\n')
678
/* Parsed a Sun style file comment. */
679
size_t string_length = string_end - string_start;
681
XNMALLOC (string_length + 1, char);
683
memcpy (string, string_start, string_length);
684
string[string_length] = '\0';
686
po_callback_comment_filepos (string, n);