bugfixes
[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 (const char *str, int len);
43  * FUNCTION
44  *  Stores a string in the ident module and returns a handle for the string.
45  *  Copies the string.
46  * INPUTS
47  *  str - the string (or whatever) which shall be stored
48  *  len - the length of the data in bytes
49  * RESULT
50  *  id - a handle for the generated ident
51  * SEE ALSO
52  *  id_to_str, id_to_strlen
53  ***
54  */
55 inline ident      *id_from_str (const char *str, int len);
56
57 /****f* ident/id_to_str
58  *
59  * NAME
60  *  id_to_str - return a string represented by an ident
61  * SYNOPSIS
62  *  char *cp = id_to_str (ident *id);
63  * FUNCTION
64  *  Returns the string cp represented by id. This string cp is not
65  *  Null terminated!  The string may not be changed.
66  * INPUTS
67  *  id - the ident
68  * RESULT
69  *  cp - a string
70  * SEE ALSO
71  *  id_from_str, id_to_strlen
72  ***
73  */
74 inline const char *id_to_str   (ident *id);
75
76 /****f* ident/id_to_strlen
77  *
78  * NAME
79  *  id_to_strlen - return the length of a string represented by an ident
80  * SYNOPSIS
81  *  int len = id_to_strlen (ident *id);
82  * FUNCTION
83  *  Returns the length of string represented by id.
84  * INPUTS
85  *  id - the ident
86  * RESULT
87  *  len - the length of the string
88  * SEE ALSO
89  *  id_from_str, id_to_str
90  ***
91  */
92 inline int  id_to_strlen(ident *id);
93
94 /****f* ident/id_is_suffix
95  *
96  * NAME
97  *
98  * SYNOPSIS
99  *  int id_is_prefix (ident *prefix, ident *id);
100  * FUNCTION
101  *  Returns true if prefix is prefix of id.
102  * INPUTS
103  *  prefix - the prefix
104  *  id - the ident
105  * SEE ALSO
106  *  id_from_str, id_to_str, id_is_prefix
107  ***
108  */
109 /*  */
110 int id_is_prefix (ident *prefix, ident *id);
111
112 /****f* ident/id_is_suffix
113  *
114  * NAME
115  *
116  * SYNOPSIS
117  *  int id_is_suffix (ident *suffix, ident *id);
118  * FUNCTION
119  *  Returns true if suffix is suffix of id.
120  * INPUTS
121  *  suffix - the suffix
122  *  id - the ident
123  * SEE ALSO
124  *  id_from_str, id_to_str, id_is_prefix
125  ***
126  */
127 /*  */
128 int id_is_suffix (ident *suffix, ident *id);
129
130
131 # endif /* _IDENT_H_ */