]> andersk Git - splint.git/blob - src/Headers/multiVal.h
Renamed truenull nullwhentrue and falsenull falsewhennull
[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
11 {
12   mvkind   kind;
13   union
14   {
15     long int     ival;
16     char         cval;
17     double       fval;
18     /*@only@*/ cstring sval;
19   } value;
20 } *multiVal;
21
22 extern /*@falsewhennull@*/ bool multiVal_isDefined (multiVal p_m) /*@*/ ;
23 extern /*@nullwhentrue@*/ bool multiVal_isUndefined (multiVal p_m) /*@*/ ;
24 extern /*@nullwhentrue@*/ bool multiVal_isUnknown (multiVal p_m) /*@*/ ;
25
26 extern multiVal multiVal_add (multiVal p_m1, multiVal p_m2) /*@*/ ;
27 extern multiVal multiVal_subtract (multiVal p_m1, multiVal p_m2) /*@*/ ;
28 extern multiVal multiVal_multiply (multiVal p_m1, multiVal p_m2) /*@*/ ;
29 extern multiVal multiVal_divide (multiVal p_m1, multiVal p_m2) /*@*/ ;
30
31 /*@constant null multiVal multiVal_undefined; @*/
32 # define multiVal_undefined      (multiVal)NULL
33 # define multiVal_isDefined(m)   ((m) != multiVal_undefined)
34 # define multiVal_isUndefined(m) ((m) == multiVal_undefined)
35 # define multiVal_isUnknown(m)   ((m) == multiVal_undefined)
36
37 extern /*@observer@*/ /*@dependent@*/ cstring multiVal_forceString (multiVal p_m) /*@*/ ;
38 extern /*@unused@*/ double multiVal_forceDouble (multiVal p_m) /*@*/ ;
39 extern char multiVal_forceChar (multiVal p_m) /*@*/ ;
40 extern long multiVal_forceInt (multiVal p_m) /*@*/ ;
41
42 extern /*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring p_s) /*@*/ ;
43 extern /*@only@*/ multiVal multiVal_makeDouble (double p_x) /*@*/ ;
44 extern /*@only@*/ multiVal multiVal_makeChar (char p_x) /*@*/ ;
45 extern /*@only@*/ multiVal multiVal_makeInt (long p_x) /*@*/ ;
46 extern /*@only@*/ multiVal multiVal_unknown (void) /*@*/ ;
47
48 extern /*@only@*/ multiVal multiVal_copy (multiVal p_m) /*@*/ ;
49 extern void multiVal_free (/*@only@*/ multiVal p_m);
50
51 extern multiVal multiVal_invert (multiVal p_m) /*@*/ ;
52
53 extern /*@falsewhennull@*/ bool multiVal_isInt (multiVal p_m) /*@*/ ;
54 extern /*@falsewhennull@*/ bool multiVal_isChar (multiVal p_m) /*@*/ ;
55 extern /*@falsewhennull@*/ bool multiVal_isDouble (multiVal p_m) /*@*/ ;
56 extern /*@falsewhennull@*/ bool multiVal_isString (multiVal p_m) /*@*/ ;
57
58 extern /*@only@*/ multiVal multiVal_undump (char **p_s) /*@modifies *p_s;@*/ ;
59 extern /*@only@*/ cstring multiVal_dump (multiVal p_m) /*@*/ ;
60
61 extern /*@only@*/ cstring multiVal_unparse (multiVal p_m) /*@*/ ;
62 extern int multiVal_compare (multiVal p_m1, multiVal p_m2) /*@*/ ;
63
64 extern bool multiVal_equiv (multiVal p_m1, multiVal p_m2) /*@*/ ;
65 # define multiVal_equiv(m1,m2) ((multiVal_compare(m1, m2)) == 0)
66
67 # else
68 # error "Multiple include"
69 # endif
This page took 0.040072 seconds and 5 git commands to generate.