GDB (API)
/home/stan/gdb/src/gdb/common/format.h
Go to the documentation of this file.
00001 /* Parse a printf-style format string.
00002 
00003    Copyright (C) 1986-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
00021 # define USE_PRINTF_I64 1
00022 # define PRINTF_HAS_LONG_LONG
00023 #else
00024 # define USE_PRINTF_I64 0
00025 #endif
00026 
00027 /* The argclass represents the general type of data that goes with a
00028    format directive; int_arg for %d, long_arg for %l, and so forth.
00029    Note that these primarily distinguish types by size and need for
00030    special handling, so for instance %u and %x are (at present) also
00031    classed as int_arg.  */
00032 
00033 enum argclass
00034   {
00035     literal_piece,
00036     int_arg, long_arg, long_long_arg, ptr_arg,
00037     string_arg, wide_string_arg, wide_char_arg,
00038     double_arg, long_double_arg, decfloat_arg
00039   };
00040 
00041 /* A format piece is a section of the format string that may include a
00042    single print directive somewhere in it, and the associated class
00043    for the argument.  */
00044 
00045 struct format_piece
00046 {
00047   char *string;
00048   enum argclass argclass;
00049 };
00050 
00051 /* Return an array of printf fragments found at the given string, and
00052    rewrite ARG with a pointer to the end of the format string.  */
00053 
00054 extern struct format_piece *parse_format_string (const char **arg);
00055 
00056 /* Given a pointer to an array of format pieces, free any memory that
00057    would have been allocated by parse_format_string.  */
00058 
00059 extern void free_format_pieces (struct format_piece *frags);
00060 
00061 /* Freeing, cast as a cleanup.  */
00062 
00063 extern void free_format_pieces_cleanup (void *);
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines