Blame glib/glib/gnulib/printf-parse.h

Packit db3073
/* Parse printf format string.
Packit db3073
   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
Packit db3073
Packit db3073
   This program is free software; you can redistribute it and/or modify it
Packit db3073
   under the terms of the GNU Library General Public License as published
Packit db3073
   by the Free Software Foundation; either version 2, or (at your option)
Packit db3073
   any later version.
Packit db3073
Packit db3073
   This program is distributed in the hope that it will be useful,
Packit db3073
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit db3073
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit db3073
   Library General Public License for more details.
Packit db3073
Packit db3073
   You should have received a copy of the GNU Library General Public
Packit db3073
   License along with this program; if not, write to the Free Software
Packit db3073
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
Packit db3073
   USA.  */
Packit db3073
Packit db3073
#ifndef _PRINTF_PARSE_H
Packit db3073
#define _PRINTF_PARSE_H
Packit db3073
Packit db3073
#include "printf-args.h"
Packit db3073
Packit db3073
/* Private namespace for gnulib functions */
Packit db3073
#define printf_parse _g_gnulib_printf_parse
Packit db3073
Packit db3073
/* Flags */
Packit db3073
#define FLAG_GROUP	 1	/* ' flag */
Packit db3073
#define FLAG_LEFT	 2	/* - flag */
Packit db3073
#define FLAG_SHOWSIGN	 4	/* + flag */
Packit db3073
#define FLAG_SPACE	 8	/* space flag */
Packit db3073
#define FLAG_ALT	16	/* # flag */
Packit db3073
#define FLAG_ZERO	32
Packit db3073
Packit db3073
/* A parsed directive.  */
Packit db3073
typedef struct
Packit db3073
{
Packit db3073
  const char* dir_start;
Packit db3073
  const char* dir_end;
Packit db3073
  int flags;
Packit db3073
  const char* width_start;
Packit db3073
  const char* width_end;
Packit db3073
  int width_arg_index;
Packit db3073
  const char* precision_start;
Packit db3073
  const char* precision_end;
Packit db3073
  int precision_arg_index;
Packit db3073
  char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
Packit db3073
  int arg_index;
Packit db3073
}
Packit db3073
char_directive;
Packit db3073
Packit db3073
/* A parsed format string.  */
Packit db3073
typedef struct
Packit db3073
{
Packit db3073
  unsigned int count;
Packit db3073
  char_directive *dir;
Packit db3073
  unsigned int max_width_length;
Packit db3073
  unsigned int max_precision_length;
Packit db3073
}
Packit db3073
char_directives;
Packit db3073
Packit db3073
Packit db3073
/* Parses the format string.  Fills in the number N of directives, and fills
Packit db3073
   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
Packit db3073
   to the end of the format string.  Also fills in the arg_type fields of the
Packit db3073
   arguments and the needed count of arguments.  */
Packit db3073
#ifdef STATIC
Packit db3073
STATIC
Packit db3073
#else
Packit db3073
extern
Packit db3073
#endif
Packit db3073
int printf_parse (const char *format, char_directives *d, arguments *a);
Packit db3073
Packit db3073
#endif /* _PRINTF_PARSE_H */