1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
3 ** See ../LICENSE for license information.
4 */
5 /*
6 ** annotationTable.h
7 **
8 ** A global table that keeps information on the user-defined annotations.
9 **
10 ** For each annotation, we need:
11 **
12 **    o [key] A name (matches @name@ in code)
13 **    o State - index into metaStateTable that identifies the state associated with this annotation
14 **    o Value
15 **    o Context information (where can annotation be used)
16 */
17 
18 # ifndef ANNOTTABLE_H
19 # define ANNOTTABLE_H
20 
21 /*@constant null annotationTable annotationTable_undefined; @*/
22 # define annotationTable_undefined genericTable_undefined
23 
24 extern /*@falsewhennull@*/ bool annotationTable_isDefined(annotationTable) /*@*/ ;
25 # define annotationTable_isDefined(p_h) (genericTable_isDefined ((genericTable) (p_h)))
26 
27 extern /*@nullwhentrue@*/ bool annotationTable_isUndefined(annotationTable) /*@*/ ;
28 # define annotationTable_isUndefined(p_h) (genericTable_isDefined ((genericTable) (p_h)))
29 
30 /*@constant int DEFAULT_ANNOTTABLE_SIZE@*/
31 # define DEFAULT_ANNOTTABLE_SIZE 32
32 
33 extern /*@only@*/ annotationTable annotationTable_create (void) /*@*/ ;
34 # define annotationTable_create() ((annotationTable) genericTable_create (DEFAULT_ANNOTTABLE_SIZE))
35 
36 extern void annotationTable_insert (annotationTable p_h, /*@only@*/ annotationInfo p_annotation);
37 
38 extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ annotationInfo
39    annotationTable_lookup (annotationTable p_h, cstring p_key) /*@*/ ;
40 /*@access annotationInfo@*/
41 # define annotationTable_lookup(p_h,p_key) \
42   ((annotationInfo) genericTable_lookup ((genericTable) (p_h), p_key))
43 /*@noaccess annotationInfo@*/
44 
45 extern bool annotationTable_contains (annotationTable p_h, cstring p_key) /*@*/ ;
46 # define annotationTable_contains(p_h,p_key) \
47   (genericTable_contains ((genericTable) (p_h), p_key))
48 
49 extern /*@unused@*/ /*@only@*/ cstring annotationTable_stats(annotationTable p_h);
50 # define annotationTable_stats(p_h) genericTable_stats ((genericTable) (p_h))
51 
52 extern /*@only@*/ cstring annotationTable_unparse (annotationTable p_h);
53 
54 extern void annotationTable_free (/*@only@*/ annotationTable p_h);
55 # define annotationTable_free(p_h) (genericTable_free ((genericTable) (p_h)))
56 
57 /*@iter annotationTable_elements (sef annotationTable p_g,
58                                   yield exposed cstring m_key,
59 				  yield exposed annotationInfo m_el) @*/
60 
61 # define annotationTable_elements(p_g,m_key,m_el) \
62             genericTable_elements((genericTable) (p_g), m_key, m_el)
63 # define end_annotationTable_elements end_genericTable_elements
64 
65 extern int annotationTable_size (annotationTable p_h);
66 # define annotationTable_size(p_h) (genericTable_size(p_h))
67 
68 # else
69 # error "Multiple include"
70 # endif
71 
72 
73 
74 
75