libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
|
Go to the source code of this file.
Functions | |
static void | strip_space (char *line) |
static ssize_t | parser_get_next_line_impl (void *fp, char **linep, size_t *linecap, unsigned *linenum) |
static char * | parser_get_next_quoted_str2 (FILE *fp, int *linep) |
|
static |
Implementation function for parser_get_next_line(). Don't call this directly. Use parser_get_next_line() instead.
Definition at line 77 of file parser_funcs.h.
|
static |
Reads the next input word in a file stream. An input word is considered any sequence of characters not interrupted by whitespace. This function supports reading words which contain whitespace, if they are surrounded by quotes, such as this: "Hello World!"
- will return the whole string, instead of separately "Hello
and then World!"
.
The function also supports escape sequences within quoted-string input. Escape sequences always start with a backslash \
character and are followed by either a single letter, or 1-3 octal digits to express the exact ASCII code number of the character being escaped.
Supported escape sequences are:
\"</tt> - literal quote character
- <tt>\\n</tt> - line feed character
- <tt>\\r</tt> - carriage return character
- <tt>\\t</tt> - tab character
- A <tt>\\</tt> character followed immediately by a newline (using either
LF (Unix), CR (Mac) or CR-LF (DOS) newline encoding). This causes
the newline to be removed from the output, so as to allow
splitting input across multiple lines in the input file, without
inadvertently encoding newlines in the string.
- <tt>\\xxx</tt> where <tt>xxx</tt> is an octal number containing, encoding the ASCII
code of the character to be inserted into the output string.
@return A newly allocated string (using the caller's heap allocator)
containing the parsed string. You should free this string using
your normal free() function, NOT using lacf_free(). If the stream
has reached end-of-file and there are no more strings to be
parsed, this function returns an empty string (""). You must free this string using free() as normal, before stopping parsing.
Definition at line 143 of file parser_funcs.h.
|
static |
Removes all leading & trailing whitespace from a line. The string is modified in-place.
Definition at line 49 of file parser_funcs.h.