60623777a252d19961b20f3aab0ecf4e8bf32124
[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
17 /****h* libfirm/ident
18  *
19  * NAME
20  *   ident -- identifiers in the firm library
21  * NOTES
22  *  Identifiers are used in the firm library. This is the interface to it.
23  *  @@@ we need comparison of the prefis of two idents! (strncmp);
24  ******
25  */
26
27 /* Identifiers */
28 /****s* ident/ident
29  *
30  * NAME
31  *  ident - the abstract data type ident
32  * SOURCE
33  */
34 typedef const struct set_entry ident;
35 /*****/
36
37 /****f* ident/id_from_str
38  *
39  * NAME
40  *  id_from_str - store a string and create an ident
41  * SYNOPSIS
42  *  ident *id = id_from_str (char *str, int len);
43  * FUNCTION
44  *  Stores a string in the ident module and returns a handle for the string.
45  * INPUTS
46  *  str - the string (or whatever) which shall be stored
47  *  len - the length of the data in bytes
48  * RESULT
49  *  id - a handle for the generated ident
50  * SEE ALSO
51  *  id_to_str, id_to_strlen
52  ***
53  */
54 inline ident      *id_from_str (const char *str, int len);
55
56 /****f* ident/id_to_str
57  *
58  * NAME
59  *  id_to_str - return a string represented by an ident
60  * SYNOPSIS
61  *  char *cp = id_to_str (ident *id);
62  * FUNCTION
63  *  Returns the string cp represented by id. This string cp is not
64  *  Null terminated!
65  * INPUTS
66  *  id - the ident
67  * RESULT
68  *  cp - a string
69  * SEE ALSO
70  *  id_from_str, id_to_strlen
71  ***
72  */
73 inline const char *id_to_str   (ident *id);
74
75 /****f* ident/id_to_strlen
76  *
77  * NAME
78  *  id_to_strlen - return the length of a string represented by an ident
79  * SYNOPSIS
80  *  int len = id_to_strlen (ident *id);
81  * FUNCTION
82  *  Returns the length of string represented by id.
83  * INPUTS
84  *  id - the ident
85  * RESULT
86  *  len - the length of the string
87  * SEE ALSO
88  *  id_from_str, id_to_str
89  ***
90  */
91 inline int  id_to_strlen(ident *id);
92
93 /****f* ident/id_is_suffix
94  *
95  * NAME
96  *
97  * SYNOPSIS
98  *  int id_is_prefix (ident *prefix, ident *id);
99  * FUNCTION
100  *  Returns true if prefix is prefix of id.
101  * INPUTS
102  *  prefix - the prefix
103  *  id - the ident
104  * SEE ALSO
105  *  id_from_str, id_to_str, id_is_prefix
106  ***
107  */
108 /*  */
109 int id_is_prefix (ident *prefix, ident *id);
110
111 /****f* ident/id_is_suffix
112  *
113  * NAME
114  *
115  * SYNOPSIS
116  *  int id_is_suffix (ident *suffix, ident *id);
117  * FUNCTION
118  *  Returns true if suffix is suffix of id.
119  * INPUTS
120  *  suffix - the suffix
121  *  id - the ident
122  * SEE ALSO
123  *  id_from_str, id_to_str, id_is_prefix
124  ***
125  */
126 /*  */
127 int id_is_suffix (ident *suffix, ident *id);
128
129
130 # endif /* _IDENT_H_ */