** Authors: Martin Trapp, Christian Schaefer
*/
+/* $Id$ */
+
# ifndef _IDENT_H_
# define _IDENT_H_
# include "assert.h"
+# include "common.h"
/****h* libfirm/ident
*
* ident -- identifiers in the firm library
* NOTES
* Identifiers are used in the firm library. This is the interface to it.
- *
+ * @@@ we need comparison of the prefis of two idents! (strncmp);
******
*/
* NAME
* id_from_str - store a string and create an ident
* SYNOPSIS
- * ident *id = id_from_str (char *str, int len);
+ * ident *id = id_from_str (const char *str, int len);
* FUNCTION
* Stores a string in the ident module and returns a handle for the string.
+ * Copies the string.
* INPUTS
* str - the string (or whatever) which shall be stored
* len - the length of the data in bytes
* id_to_str, id_to_strlen
***
*/
-inline ident *id_from_str (char *str, int len);
+INLINE ident *id_from_str (const char *str, int len);
/****f* ident/id_to_str
*
* SYNOPSIS
* char *cp = id_to_str (ident *id);
* FUNCTION
- * Returns the string cp represented by id. This string cp is not Null terminated!
+ * Returns the string cp represented by id. This string cp is not
+ * Null terminated! The string may not be changed.
* INPUTS
* id - the ident
* RESULT
* id_from_str, id_to_strlen
***
*/
-inline const char *id_to_str (ident *id);
+INLINE const char *id_to_str (ident *id);
/****f* ident/id_to_strlen
*
* id_from_str, id_to_str
***
*/
-inline int id_to_strlen(ident *id);
+INLINE int id_to_strlen(ident *id);
+
+/****f* ident/id_is_suffix
+ *
+ * NAME
+ *
+ * SYNOPSIS
+ * int id_is_prefix (ident *prefix, ident *id);
+ * FUNCTION
+ * Returns true if prefix is prefix of id.
+ * INPUTS
+ * prefix - the prefix
+ * id - the ident
+ * SEE ALSO
+ * id_from_str, id_to_str, id_is_prefix
+ ***
+ */
+/* */
+int id_is_prefix (ident *prefix, ident *id);
+
+/****f* ident/id_is_suffix
+ *
+ * NAME
+ *
+ * SYNOPSIS
+ * int id_is_suffix (ident *suffix, ident *id);
+ * FUNCTION
+ * Returns true if suffix is suffix of id.
+ * INPUTS
+ * suffix - the suffix
+ * id - the ident
+ * SEE ALSO
+ * id_from_str, id_to_str, id_is_prefix
+ ***
+ */
+/* */
+int id_is_suffix (ident *suffix, ident *id);
+
# endif /* _IDENT_H_ */