Fix typo
[rofl0r-order-pp.git] / example / lambda / str.h
blobde298eb4895597e3ac988dff606c71937a4cbf3f
1 #ifndef ORDER_EXAMPLE_LAMBDA_STR_H_VAJK20040620
2 #define ORDER_EXAMPLE_LAMBDA_STR_H_VAJK20040620
4 // (C) Copyright Vesa Karvonen 2004.
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE.)
9 // This utility module provides a number of functions for the
10 // manipulation of constant strings. Strings created by this module
11 // are interned, meaning that only one string containing a
12 // particular sequence of characters is created. Interned strings
13 // can be compared for equality using pointer comparison.
15 // The type of constant character strings.
16 typedef const char *str_type;
18 // `str_end' is used as a marker for terminating variable argument
19 // lists.
20 static const str_type str_end = 0;
22 // `str_intern(str)' interns the string `str'. The return value is
23 // the interned string. This function does not allocate a new
24 // string, but the the same pointer will be returned for all strings
25 // that have the same sequence of characters.
26 extern str_type str_intern(str_type str);
28 // `str_substr(first, beyond)' interns a new string that holds the
29 // sequence of characters starting at `first' and ending just before
30 // `beyond'. Note that the pointers `first' and `beyond' must point
31 // to the same string.
32 extern str_type str_substr(str_type first, str_type beyond);
34 // `str_cat(s1, s2, ..., sN, str_end)' interns a new string that
35 // contains the sequence `s1s2...sN'. The `str_end' parameter
36 // terminates the variable argument list and must always be passed
37 // as the last actual parameter. Note that you just can't use `0'
38 // instead of `str_end', because the literal `0' is an `int'.
39 extern str_type str_cat(str_type s0, ...);
41 // `str_skip_spaces(&str)' advanced the string `str' past the
42 // whitespace characters at the beginning of the string.
43 extern void str_skip_spaces(str_type *pstr);
45 // `str_match_prefix(&str, maybe_prefix)' tests whether the string
46 // `maybe_prefix' is a prefix of the string `str'. If the string
47 // `maybe_prefix' is a prefix of the string `str' then the return
48 // value will be non-zero and the `str' string will be advanced by
49 // the length of the `maybe_prefix' string. Otherwise the return
50 // value will be `0' and `str' will not be modified. Note that
51 // whitespace is significant to this function.
52 extern _Bool str_match_prefix(str_type *pstr, str_type maybe_prefix);
54 // `uint_to_str(n)' converts the unsigned integer `n' to a string
55 // containing a decimal representation of the unsigned integer.
56 extern str_type uint_to_str(unsigned int n);
58 #endif