]> andersk Git - splint.git/blob - src/Headers/multiVal.h
Initial revision
[splint.git] / src / Headers / multiVal.h
1 /*
2 ** multiVal.h
3 */
4
5 # ifndef MULTIVAL_H
6 # define MULTIVAL_H
7
8 typedef enum { MVLONG, MVCHAR, MVDOUBLE, MVSTRING } mvkind;
9
10 typedef /*@null@*/ struct _multiVal
11 {
12   mvkind   kind;
13   union _mval
14     {
15       long int     ival;
16       char         cval;
17       double       fval;
18       /*@only@*/ cstring sval;
19     } value;
20 } *multiVal;
21
22 extern /*@falsenull@*/ bool multiVal_isDefined (multiVal p_m) /*@*/ ;
23 extern /*@truenull@*/ bool multiVal_isUndefined (multiVal p_m) /*@*/ ;
24 extern /*@truenull@*/ bool multiVal_isUnknown (multiVal p_m) /*@*/ ;
25
26 /*@constant null multiVal multiVal_undefined; @*/
27 # define multiVal_undefined      (multiVal)NULL
28 # define multiVal_isDefined(m)   ((m) != multiVal_undefined)
29 # define multiVal_isUndefined(m) ((m) == multiVal_undefined)
30 # define multiVal_isUnknown(m)   ((m) == multiVal_undefined)
31
32 extern /*@observer@*/ /*@dependent@*/ cstring multiVal_forceString (multiVal p_m) /*@*/ ;
33 extern /*@unused@*/ double multiVal_forceDouble (multiVal p_m) /*@*/ ;
34 extern char multiVal_forceChar (multiVal p_m) /*@*/ ;
35 extern long multiVal_forceInt (multiVal p_m) /*@*/ ;
36
37 extern /*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring p_s) /*@*/ ;
38 extern /*@only@*/ multiVal multiVal_makeDouble (double p_x) /*@*/ ;
39 extern /*@only@*/ multiVal multiVal_makeChar (char p_x) /*@*/ ;
40 extern /*@only@*/ multiVal multiVal_makeInt (long p_x) /*@*/ ;
41 extern /*@only@*/ multiVal multiVal_unknown (void) /*@*/ ;
42
43 extern /*@only@*/ multiVal multiVal_copy (multiVal p_m) /*@*/ ;
44 extern void multiVal_free (/*@only@*/ multiVal p_m);
45
46 extern multiVal multiVal_invert (multiVal p_m) /*@*/ ;
47
48 extern /*@falsenull@*/ bool multiVal_isInt (multiVal p_m) /*@*/ ;
49 extern /*@falsenull@*/ bool multiVal_isChar (multiVal p_m) /*@*/ ;
50 extern /*@falsenull@*/ bool multiVal_isDouble (multiVal p_m) /*@*/ ;
51 extern /*@falsenull@*/ bool multiVal_isString (multiVal p_m) /*@*/ ;
52
53 extern /*@only@*/ multiVal multiVal_undump (char **p_s) /*@modifies *p_s;@*/ ;
54 extern /*@only@*/ cstring multiVal_dump (multiVal p_m) /*@*/ ;
55
56 extern /*@only@*/ cstring multiVal_unparse (multiVal p_m) /*@*/ ;
57 extern int multiVal_compare (multiVal p_m1, multiVal p_m2) /*@*/ ;
58
59 extern bool multiVal_equiv (multiVal p_m1, multiVal p_m2) /*@*/ ;
60 # define multiVal_equiv(m1,m2) ((multiVal_compare(m1, m2)) == 0)
61
62 # else
63 # error "Multiple include"
64 # endif
This page took 0.040603 seconds and 5 git commands to generate.