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 * Initialises the ident handling.
32 * Must be called before any id_*() function can be called.
37 * The abstract data type ident.
39 * An ident represents an unique string. The == operator
40 * is sufficient to compare two idents.
42 typedef const struct set_entry ident;
45 * Store a string and create an ident.
47 * Stores a string in the ident module and returns a handle for the string.
50 * @param str - the string (or whatever) which shall be stored
51 * @param len - the length of the data in bytes
53 * @return id - a handle for the generated ident
55 * @see id_to_str(), id_to_strlen()
57 INLINE ident *id_from_str (const char *str, int len);
60 * Returns a string represented by an ident.
62 * Returns the string represented by id. This string is
63 * NULL terminated. The string may not be changed.
65 * @param id - the ident
67 * @return cp - a string
69 * @see id_from_str(), id_to_strlen()
71 INLINE const char *id_to_str (ident *id);
74 * Returns the length of the string represented by an ident.
76 * @param id - the ident
78 * @return len - the length of the string
80 * @see id_from_str(), id_to_str()
82 INLINE int id_to_strlen(ident *id);
85 * Returns true if prefix is a prefix of an ident.
87 * @param prefix - the prefix
88 * @param id - the ident
90 * @see id_from_str(), id_to_str(), id_is_prefix()
92 int id_is_prefix (ident *prefix, ident *id);
95 * Returns true if suffix is a suffix of an ident.
97 * @param suffix - the suffix
98 * @param id - the ident
100 * @see id_from_str(), id_to_str(), id_is_prefix()
102 int id_is_suffix (ident *suffix, ident *id);
105 * Prints the ident to stdout.
107 * @param id - The ident to be printed.
110 * number of btes written
112 * @see id_from_str(), id_to_str(), id_is_prefix(), fprint_id()
114 int print_id (ident *id);
117 * Prints the ident to the file passed.
119 * @param F - file pointer to print the ident to.
120 * @param id - The ident to print and the file.
123 * number of btes written
125 * @see id_from_str(), id_to_str(), id_is_prefix(), print_id()
127 int fprint_id (FILE *F, ident *id);
129 # endif /* _IDENT_H_ */