9f4efee7908b97f600df6043ca52661e6e5ac1cb
[libfirm] / ir / ident / ident.h
1 /* Declarations for ident.
2    Copyright (C) 1995, 1996 Markus Armbruster */
3
4 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
5 ** All rights reserved.
6 **
7 ** Authors: Martin Trapp, Christian Schaefer
8 */
9
10 /* $Id$ */
11
12 # ifndef _IDENT_H_
13 # define _IDENT_H_
14
15 # include "assert.h"
16 # include "common.h"
17
18 /****h* libfirm/ident
19  *
20  * NAME
21  *   ident -- identifiers in the firm library
22  * NOTES
23  *  Identifiers are used in the firm library. This is the interface to it.
24  *  @@@ we need comparison of the prefis of two idents! (strncmp);
25  ******
26  */
27
28 /* Identifiers */
29 /****s* ident/ident
30  *
31  * NAME
32  *  ident - the abstract data type ident
33  * SOURCE
34  */
35 typedef const struct set_entry ident;
36 /*****/
37
38 /****f* ident/id_from_str
39  *
40  * NAME
41  *  id_from_str - store a string and create an ident
42  * SYNOPSIS
43  *  ident *id = id_from_str (const char *str, int len);
44  * FUNCTION
45  *  Stores a string in the ident module and returns a handle for the string.
46  *  Copies the string.
47  * INPUTS
48  *  str - the string (or whatever) which shall be stored
49  *  len - the length of the data in bytes
50  * RESULT
51  *  id - a handle for the generated ident
52  * SEE ALSO
53  *  id_to_str, id_to_strlen
54  ***
55  */
56 INLINE ident      *id_from_str (const char *str, int len);
57
58 /****f* ident/id_to_str
59  *
60  * NAME
61  *  id_to_str - return a string represented by an ident
62  * SYNOPSIS
63  *  char *cp = id_to_str (ident *id);
64  * FUNCTION
65  *  Returns the string cp represented by id. This string cp is not
66  *  Null terminated!  The string may not be changed.
67  * INPUTS
68  *  id - the ident
69  * RESULT
70  *  cp - a string
71  * SEE ALSO
72  *  id_from_str, id_to_strlen
73  ***
74  */
75 INLINE const char *id_to_str   (ident *id);
76
77 /****f* ident/id_to_strlen
78  *
79  * NAME
80  *  id_to_strlen - return the length of a string represented by an ident
81  * SYNOPSIS
82  *  int len = id_to_strlen (ident *id);
83  * FUNCTION
84  *  Returns the length of string represented by id.
85  * INPUTS
86  *  id - the ident
87  * RESULT
88  *  len - the length of the string
89  * SEE ALSO
90  *  id_from_str, id_to_str
91  ***
92  */
93 INLINE int  id_to_strlen(ident *id);
94
95 /****f* ident/id_is_suffix
96  *
97  * NAME
98  *
99  * SYNOPSIS
100  *  int id_is_prefix (ident *prefix, ident *id);
101  * FUNCTION
102  *  Returns true if prefix is prefix of id.
103  * INPUTS
104  *  prefix - the prefix
105  *  id - the ident
106  * SEE ALSO
107  *  id_from_str, id_to_str, id_is_prefix
108  ***
109  */
110 /*  */
111 int id_is_prefix (ident *prefix, ident *id);
112
113 /****f* ident/id_is_suffix
114  *
115  * NAME
116  *
117  * SYNOPSIS
118  *  int id_is_suffix (ident *suffix, ident *id);
119  * FUNCTION
120  *  Returns true if suffix is suffix of id.
121  * INPUTS
122  *  suffix - the suffix
123  *  id - the ident
124  * SEE ALSO
125  *  id_from_str, id_to_str, id_is_prefix
126  ***
127  */
128 /*  */
129 int id_is_suffix (ident *suffix, ident *id);
130
131
132 # endif /* _IDENT_H_ */