beifg: Remove the unused function be_ifg_nodes_break().
[libfirm] / include / libfirm / ident.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief    Data type for unique names.
9  * @author   Goetz Lindenmaier
10  * @brief    Declarations for identifiers in the firm library
11  */
12 #ifndef FIRM_IDENT_H
13 #define FIRM_IDENT_H
14
15 #include <stddef.h>
16 #include "firm_types.h"
17 #include "begin.h"
18
19 /**
20  * @defgroup ir_ident  Identifiers
21  * @{
22  */
23
24 /**
25  *  Store a string and create an ident.
26  *
27  *  Stores a string in the ident module and returns a handle for the string.
28  *
29  *  Copies the string. @p str must be zero terminated
30  *
31  * @param str   the string which shall be stored
32  * @return id   a handle for the generated ident
33  */
34 FIRM_API ident *new_id_from_str(const char *str);
35
36 /** Store a string and create an ident.
37  *
38  * Stores a string in the ident module and returns a handle for the string.
39  * Copies the string. This version takes non-zero-terminated strings.
40  *
41  * @param str   the string (or whatever) which shall be stored
42  * @param len   the length of the data in bytes
43  * @return id   a handle for the generated ident
44  */
45 FIRM_API ident *new_id_from_chars(const char *str, size_t len);
46
47 /**
48  * Returns a string represented by an ident.
49  *
50  * Returns the string represented by id. This string is
51  * NULL terminated. The string may not be changed.
52  *
53  * @param id   the ident
54  * @return cp   a string
55  */
56 FIRM_API const char *get_id_str(ident *id);
57
58 /**
59  * Returns the length of the string represented by an ident.
60  *
61  * @param id   the ident
62  * @return len   the length of the string
63  */
64 FIRM_API size_t get_id_strlen(ident *id);
65
66 /**
67  * Test if @p prefix is a prefix of ident @p id.
68  *
69  * @param prefix   the prefix
70  * @param id       the ident
71  * @returns        1 if @p prefix is prefix of @p id, 0 otherwise
72  */
73 FIRM_API int id_is_prefix(ident *prefix, ident *id);
74
75 /**
76  * Test if @p suffix is a suffix of ident @p id.
77  *
78  * @param suffix   the suffix
79  * @param id       the ident
80  * @returns        1 if @p suffix is suffix of @p id, 0 otherwise
81  */
82 FIRM_API int id_is_suffix(ident *suffix, ident *id);
83
84 /**
85  * Test if identifier contains a given character.
86  *
87  * @param id    the ident
88  * @param c     the character
89  * @returns     1 if character is contained, 0 otherwise
90  */
91 FIRM_API int id_contains_char(ident *id, char c);
92
93 /**
94  * helper function for creating unique idents. It contains an internal counter
95  * and replaces a "%u" inside the tag with the counter.
96  */
97 FIRM_API ident *id_unique(const char *tag);
98
99 /** mangle underscore: Returns a new ident that represents first_scnd. */
100 FIRM_API ident *id_mangle_u(ident *first, ident* scnd);
101
102 /** mangle dot: Returns a new ident that represents first.scnd. */
103 FIRM_API ident *id_mangle_dot(ident *first, ident* scnd);
104
105 /** mangle: Returns a new ident that represents firstscnd. */
106 FIRM_API ident *id_mangle(ident *first, ident* scnd);
107
108 /** Returns a new ident that represents 'prefixscndsuffix'. */
109 FIRM_API ident *id_mangle3(const char *prefix, ident *middle,
110                            const char *suffix);
111
112 /** @} */
113
114 #include "end.h"
115
116 #endif