1 /* Declarations for ident.
2 Copyright (C) 1995, 1996 Markus Armbruster */
4 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
7 * Authors: Martin Trapp, Christian Schaefer
13 * Declarations for identifiers in the firm library
15 * Identifiers are used in the firm library. This is the interface to it.
25 # include "firm_common.h"
30 * The abstract data type ident.
32 * An ident repraesents an unique string. The == operator
33 * is sufficient to compare two idents.
35 typedef const struct set_entry ident;
38 * Store a string and create an ident.
40 * Stores a string in the ident module and returns a handle for the string.
43 * @param str - the string (or whatever) which shall be stored
44 * @param len - the length of the data in bytes
46 * @return id - a handle for the generated ident
48 * @see id_to_str(), id_to_strlen()
50 INLINE ident *id_from_str (const char *str, int len);
53 * Returns a string represented by an ident.
55 * Returns the string represented by id. This string is not
56 * NULL terminated! The string may not be changed.
58 * @param id - the ident
60 * @return cp - a string
62 * @see id_from_str(), id_to_strlen()
64 INLINE const char *id_to_str (ident *id);
67 * Returns the length of the string represented by an ident.
69 * @param id - the ident
71 * @return len - the length of the string
73 * @see id_from_str(), id_to_str()
75 INLINE int id_to_strlen(ident *id);
78 * Returns true if prefix is a prefix of an ident.
80 * @param prefix - the prefix
81 * @param id - the ident
83 * @see id_from_str(), id_to_str(), id_is_prefix()
85 int id_is_prefix (ident *prefix, ident *id);
88 * Returns true if suffix is a suffix of an ident.
90 * @param suffix - the suffix
91 * @param id - the ident
93 * @see id_from_str(), id_to_str(), id_is_prefix()
95 int id_is_suffix (ident *suffix, ident *id);
98 * Prints the ident to stdout.
100 * @param id - The ident to be printed.
103 * number of btes written
105 * @see id_from_str(), id_to_str(), id_is_prefix(), fprint_id()
107 int print_id (ident *id);
110 * Prints the ident to the file passed.
112 * @param F - file pointer to print the ident to.
113 * @param id - The ident to print and the file.
116 * number of btes written
118 * @see id_from_str(), id_to_str(), id_is_prefix(), print_id()
120 int fprint_id (FILE *F, ident *id);
122 # endif /* _IDENT_H_ */