1 /* Declarations for ident.
2 Copyright (C) 1995, 1996 Markus Armbruster */
4 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
5 ** All rights reserved.
7 ** Authors: Martin Trapp, Christian Schaefer
22 * ident -- identifiers in the firm library
24 * Identifiers are used in the firm library. This is the interface to it.
25 * @@@ we need comparison of the prefis of two idents! (strncmp);
33 * ident - the abstract data type ident
36 typedef const struct set_entry ident;
39 /****f* ident/id_from_str
42 * id_from_str - store a string and create an ident
44 * ident *id = id_from_str (const char *str, int len);
46 * Stores a string in the ident module and returns a handle for the string.
49 * str - the string (or whatever) which shall be stored
50 * len - the length of the data in bytes
52 * id - a handle for the generated ident
54 * id_to_str, id_to_strlen
57 INLINE ident *id_from_str (const char *str, int len);
59 /****f* ident/id_to_str
62 * id_to_str - return a string represented by an ident
64 * char *cp = id_to_str (ident *id);
66 * Returns the string cp represented by id. This string cp is not
67 * Null terminated! The string may not be changed.
73 * id_from_str, id_to_strlen
76 INLINE const char *id_to_str (ident *id);
78 /****f* ident/id_to_strlen
81 * id_to_strlen - return the length of a string represented by an ident
83 * int len = id_to_strlen (ident *id);
85 * Returns the length of string represented by id.
89 * len - the length of the string
91 * id_from_str, id_to_str
94 INLINE int id_to_strlen(ident *id);
96 /****f* ident/id_is_suffix
101 * int id_is_prefix (ident *prefix, ident *id);
103 * Returns true if prefix is prefix of id.
105 * prefix - the prefix
108 * id_from_str, id_to_str, id_is_prefix
112 int id_is_prefix (ident *prefix, ident *id);
114 /****f* ident/id_is_suffix
119 * int id_is_suffix (ident *suffix, ident *id);
121 * Returns true if suffix is suffix of id.
123 * suffix - the suffix
126 * id_from_str, id_to_str, id_is_prefix
130 int id_is_suffix (ident *suffix, ident *id);
132 /****f* ident/print_id
137 * int print_id (ident *id);
139 * Prints the ident to stdout.
141 * The ident to print.
143 * id_from_str, id_to_str, id_is_prefix, fprint_id
147 int print_id (ident *id);
149 /****f* ident/fprint_id
154 * int fprint_id (FILE *f, ident *id);
156 * Prints the ident to the file passed.
158 * The ident to print and the file.
160 * id_from_str, id_to_str, id_is_prefix, print_id
164 int fprint_id (FILE *F, ident *id);
167 # endif /* _IDENT_H_ */