Various minor fixes for compiler/linter (other then splint itself) warnings.
[splint-patched.git] / src / Headers / multiVal.h
blob19748127c6f513a1b184dd846238cb6ac92411dc
1 /*
2 ** multiVal.h
3 */
5 # ifndef MULTIVAL_H
6 # define MULTIVAL_H
8 typedef enum { MVLONG, MVCHAR, MVDOUBLE, MVSTRING } mvkind;
10 typedef /*@null@*/ struct
12 mvkind kind;
13 union
15 long int ival;
16 char cval;
17 double fval;
18 /*@only@*/ cstring sval;
19 } value;
20 } *multiVal;
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) /*@*/ ;
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) /*@*/ ;
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)
37 extern /*@observer@*/ /*@dependent@*/ cstring multiVal_forceString (multiVal p_m) /*@*/ ;
38 extern char multiVal_forceChar (multiVal p_m) /*@*/ ;
39 extern long multiVal_forceInt (multiVal p_m) /*@*/ ;
41 extern /*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring p_s) /*@*/ ;
42 extern /*@only@*/ multiVal multiVal_makeDouble (double p_x) /*@*/ ;
43 extern /*@only@*/ multiVal multiVal_makeChar (char p_x) /*@*/ ;
44 extern /*@only@*/ multiVal multiVal_makeInt (long p_x) /*@*/ ;
45 extern /*@only@*/ multiVal multiVal_unknown (void) /*@*/ ;
47 extern /*@only@*/ multiVal multiVal_copy (multiVal p_m) /*@*/ ;
48 extern void multiVal_free (/*@only@*/ multiVal p_m);
50 extern multiVal multiVal_invert (multiVal p_m) /*@*/ ;
52 extern /*@falsewhennull@*/ bool multiVal_isInt (multiVal p_m) /*@*/ ;
53 extern /*@falsewhennull@*/ bool multiVal_isChar (multiVal p_m) /*@*/ ;
54 extern /*@falsewhennull@*/ bool multiVal_isDouble (multiVal p_m) /*@*/ ;
55 extern /*@falsewhennull@*/ bool multiVal_isString (multiVal p_m) /*@*/ ;
57 extern /*@only@*/ multiVal multiVal_undump (char **p_s) /*@modifies *p_s;@*/ ;
58 extern /*@only@*/ cstring multiVal_dump (multiVal p_m) /*@*/ ;
60 extern /*@only@*/ cstring multiVal_unparse (multiVal p_m) /*@*/ ;
61 extern int multiVal_compare (multiVal p_m1, multiVal p_m2) /*@*/ ;
63 extern bool multiVal_equiv (multiVal p_m1, multiVal p_m2) /*@*/ ;
64 # define multiVal_equiv(m1,m2) ((multiVal_compare(m1, m2)) == 0)
66 # else
67 # error "Multiple include"
68 # endif