~ubuntu-branches/ubuntu/wily/alsaplayer/wily

« back to all changes in this revision

Viewing changes to intl/printf-parse.h

  • Committer: Bazaar Package Importer
  • Author(s): Hubert Chathi
  • Date: 2007-10-10 15:33:10 UTC
  • mto: (9.2.5 sid)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20071010153310-h3holq75eu2cigb0
Tags: upstream-0.99.80~rc4
ImportĀ upstreamĀ versionĀ 0.99.80~rc4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Parse printf format string.
 
2
   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
 
3
 
 
4
   This program is free software; you can redistribute it and/or modify it
 
5
   under the terms of the GNU Library General Public License as published
 
6
   by the Free Software Foundation; either version 2, or (at your option)
 
7
   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 GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public
 
15
   License along with this program; if not, write to the Free Software
 
16
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
17
   USA.  */
 
18
 
 
19
#ifndef _PRINTF_PARSE_H
 
20
#define _PRINTF_PARSE_H
 
21
 
 
22
#include "printf-args.h"
 
23
 
 
24
 
 
25
/* Flags */
 
26
#define FLAG_GROUP       1      /* ' flag */
 
27
#define FLAG_LEFT        2      /* - flag */
 
28
#define FLAG_SHOWSIGN    4      /* + flag */
 
29
#define FLAG_SPACE       8      /* space flag */
 
30
#define FLAG_ALT        16      /* # flag */
 
31
#define FLAG_ZERO       32
 
32
 
 
33
/* arg_index value indicating that no argument is consumed.  */
 
34
#define ARG_NONE        (~(size_t)0)
 
35
 
 
36
/* A parsed directive.  */
 
37
typedef struct
 
38
{
 
39
  const char* dir_start;
 
40
  const char* dir_end;
 
41
  int flags;
 
42
  const char* width_start;
 
43
  const char* width_end;
 
44
  size_t width_arg_index;
 
45
  const char* precision_start;
 
46
  const char* precision_end;
 
47
  size_t precision_arg_index;
 
48
  char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
 
49
  size_t arg_index;
 
50
}
 
51
char_directive;
 
52
 
 
53
/* A parsed format string.  */
 
54
typedef struct
 
55
{
 
56
  size_t count;
 
57
  char_directive *dir;
 
58
  size_t max_width_length;
 
59
  size_t max_precision_length;
 
60
}
 
61
char_directives;
 
62
 
 
63
 
 
64
/* Parses the format string.  Fills in the number N of directives, and fills
 
65
   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
 
66
   to the end of the format string.  Also fills in the arg_type fields of the
 
67
   arguments and the needed count of arguments.  */
 
68
#ifdef STATIC
 
69
STATIC
 
70
#else
 
71
extern
 
72
#endif
 
73
int printf_parse (const char *format, char_directives *d, arguments *a);
 
74
 
 
75
#endif /* _PRINTF_PARSE_H */