Code review to compile with -ansi
[libfirm] / ir / ident / ident.h
index c211854..9f4efee 100644 (file)
@@ -7,10 +7,13 @@
 ** Authors: Martin Trapp, Christian Schaefer
 */
 
+/* $Id$ */
+
 # ifndef _IDENT_H_
 # define _IDENT_H_
 
 # include "assert.h"
+# include "common.h"
 
 /****h* libfirm/ident
  *
@@ -18,7 +21,7 @@
  *   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);
  ******
  */
 
@@ -37,9 +40,10 @@ typedef const struct set_entry ident;
  * 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
@@ -49,7 +53,7 @@ typedef const struct set_entry ident;
  *  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
  *
@@ -58,7 +62,8 @@ inline ident      *id_from_str (char *str, int len);
  * 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
@@ -67,7 +72,7 @@ inline ident      *id_from_str (char *str, int len);
  *  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
  *
@@ -85,6 +90,43 @@ inline const char *id_to_str   (ident *id);
  *  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_ */