3 * File name: ir/common/ident_t.h
4 * Purpose: Data type for unique names.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 1999-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
15 * Declarations for identifiers in the firm library
17 * Identifiers are used in the firm library. This is the interface to it.
26 # include "firm_common.h"
31 * The abstract data type ident.
33 * An ident represents an unique string. The == operator
34 * is sufficient to compare two idents.
36 typedef const struct set_entry ident;
39 * Store a string and create an ident.
41 * Stores a string in the ident module and returns a handle for the string.
43 * Copies the string. @p str must be zero terminated
45 * @param str - the string which shall be stored
47 * @return id - a handle for the generated ident
49 * @see get_id_str(), get_id_strlen()
51 ident *new_id_from_str (const char *str);
54 * Store a string and create an ident.
56 * Stores a string in the ident module and returns a handle for the string.
58 * Copies the string. This version can take non-zero-terminated strings
60 * @param str - the string (or whatever) which shall be stored
61 * @param len - the length of the data in bytes
63 * @return id - a handle for the generated ident
65 * @see new_get_id_str(), get_id_strlen()
67 INLINE ident *id_from_str (const char *str, int len);
70 * Returns a string represented by an ident.
72 * Returns the string represented by id. This string is
73 * NULL terminated. The string may not be changed.
75 * @param id - the ident
77 * @return cp - a string
79 * @see new_get_id_str(), id_from_str(), get_id_strlen()
81 INLINE const char *get_id_str (ident *id);
82 //INLINE const char *get_id_str (ident *id); /* No more supported */
83 #define id_to_str get_id_str
86 * Returns the length of the string represented by an ident.
88 * @param id - the ident
90 * @return len - the length of the string
92 * @see new_get_id_str(), id_from_str(), get_id_str()
94 INLINE int get_id_strlen(ident *id);
95 #define id_to_strlen get_id_strlen
97 * Returns true if prefix is a prefix of an ident.
99 * @param prefix - the prefix
100 * @param id - the ident
102 * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix()
104 int id_is_prefix (ident *prefix, ident *id);
107 * Returns true if suffix is a suffix of an ident.
109 * @param suffix - the suffix
110 * @param id - the ident
112 * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix()
114 int id_is_suffix (ident *suffix, ident *id);
117 * Return true if an ident contains a given character.
119 * @param id - the ident
120 * @param c - the character
122 * @see new_get_id_str(), id_from_str(), get_id_str()
124 int id_contains_char (ident *id, char c);
127 * Prints the ident to stdout.
129 * @param id - The ident to be printed.
132 * number of btes written
134 * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix(), fprint_id()
136 int print_id (ident *id);
139 * Prints the ident to the file passed.
141 * @param F - file pointer to print the ident to.
142 * @param id - The ident to print and the file.
145 * number of btes written
147 * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix(), print_id()
149 int fprint_id (FILE *F, ident *id);
151 # endif /* _IDENT_H_ */