| 1 | /* CLI utilities. |
| 2 | |
| 3 | Copyright (c) 2011 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 CLI_UTILS_H |
| 21 | #define CLI_UTILS_H |
| 22 | |
| 23 | /* *PP is a string denoting a number. Get the number of the. Advance |
| 24 | *PP after the string and any trailing whitespace. |
| 25 | |
| 26 | Currently the string can either be a number or "$" followed by the |
| 27 | name of a convenience variable. */ |
| 28 | |
| 29 | extern int get_number (char **); |
| 30 | |
| 31 | /* Parse a number or a range. |
| 32 | A number will be of the form handled by get_number. |
| 33 | A range will be of the form <number1> - <number2>, and |
| 34 | will represent all the integers between number1 and number2, |
| 35 | inclusive. |
| 36 | |
| 37 | While processing a range, this fuction is called iteratively; |
| 38 | At each call it will return the next value in the range. |
| 39 | |
| 40 | At the beginning of parsing a range, the char pointer PP will |
| 41 | be advanced past <number1> and left pointing at the '-' token. |
| 42 | Subsequent calls will not advance the pointer until the range |
| 43 | is completed. The call that completes the range will advance |
| 44 | pointer PP past <number2>. */ |
| 45 | |
| 46 | extern int get_number_or_range (char **); |
| 47 | |
| 48 | /* Skip leading whitespace characters in INP, returning an updated |
| 49 | pointer. If INP is NULL, return NULL. */ |
| 50 | |
| 51 | extern char *skip_spaces (char *inp); |
| 52 | |
| 53 | /* Skip leading non-whitespace characters in INP, returning an updated |
| 54 | pointer. If INP is NULL, return NULL. */ |
| 55 | |
| 56 | extern char *skip_to_space (char *inp); |
| 57 | |
| 58 | #endif /* CLI_UTILS_H */ |