build as needed
[platform/upstream/binutils.git] / gdb / common / print-utils.h
1 /* Cell-based print utility routines for GDB, the GNU debugger.
2
3    Copyright (C) 1986-2014 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 #ifndef COMMON_CELLS_H
21 #define COMMON_CELLS_H
22
23 /* %d for LONGEST.  The result is stored in a circular static buffer,
24    NUMCELLS deep.  */
25
26 extern char *pulongest (ULONGEST u);
27
28 /* %u for ULONGEST.  The result is stored in a circular static buffer,
29    NUMCELLS deep.  */
30
31 extern char *plongest (LONGEST l);
32
33 extern char *phex (ULONGEST l, int sizeof_l);
34
35 /* Convert a ULONGEST into a HEX string, like %lx.  The result is
36    stored in a circular static buffer, NUMCELLS deep.  */
37
38 extern char *phex_nz (ULONGEST l, int sizeof_l);
39
40 /* Converts a LONGEST to a C-format hexadecimal literal and stores it
41    in a static string.  Returns a pointer to this string.  */
42
43 extern char *hex_string (LONGEST num);
44
45 /* Converts a LONGEST number to a C-format hexadecimal literal and
46    stores it in a static string.  Returns a pointer to this string
47    that is valid until the next call.  The number is padded on the
48    left with 0s to at least WIDTH characters.  */
49
50 extern char *hex_string_custom (LONGEST num, int width);
51
52 /* Convert VAL to a numeral in the given radix.  For
53  * radix 10, IS_SIGNED may be true, indicating a signed quantity;
54  * otherwise VAL is interpreted as unsigned.  If WIDTH is supplied, 
55  * it is the minimum width (0-padded if needed).  USE_C_FORMAT means
56  * to use C format in all cases.  If it is false, then 'x' 
57  * and 'o' formats do not include a prefix (0x or leading 0).  */
58
59 extern char *int_string (LONGEST val, int radix, int is_signed, int width, 
60                          int use_c_format);     
61
62 /* Convert a CORE_ADDR into a string.  */
63
64 extern const char *core_addr_to_string (const CORE_ADDR addr);
65
66 extern const char *core_addr_to_string_nz (const CORE_ADDR addr);
67
68 extern const char *host_address_to_string (const void *addr);
69
70 #endif /* COMMON_CELLS_H */