]> andersk Git - splint.git/blame - src/Headers/multiVal.h
Fix tracker issue 1837229.
[splint.git] / src / Headers / multiVal.h
CommitLineData
885824d3 1/*
2** multiVal.h
3*/
4
5# ifndef MULTIVAL_H
6# define MULTIVAL_H
7
8typedef enum { MVLONG, MVCHAR, MVDOUBLE, MVSTRING } mvkind;
9
28bf4b0b 10typedef /*@null@*/ struct
885824d3 11{
12 mvkind kind;
28bf4b0b 13 union
14 {
15 long int ival;
16 char cval;
17 double fval;
18 /*@only@*/ cstring sval;
19 } value;
885824d3 20} *multiVal;
21
0e41eb0e 22extern /*@falsewhennull@*/ bool multiVal_isDefined (multiVal p_m) /*@*/ ;
23extern /*@nullwhentrue@*/ bool multiVal_isUndefined (multiVal p_m) /*@*/ ;
24extern /*@nullwhentrue@*/ bool multiVal_isUnknown (multiVal p_m) /*@*/ ;
885824d3 25
a956d444 26extern multiVal multiVal_add (multiVal p_m1, multiVal p_m2) /*@*/ ;
27extern multiVal multiVal_subtract (multiVal p_m1, multiVal p_m2) /*@*/ ;
28extern multiVal multiVal_multiply (multiVal p_m1, multiVal p_m2) /*@*/ ;
29extern multiVal multiVal_divide (multiVal p_m1, multiVal p_m2) /*@*/ ;
30
885824d3 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
37extern /*@observer@*/ /*@dependent@*/ cstring multiVal_forceString (multiVal p_m) /*@*/ ;
38extern /*@unused@*/ double multiVal_forceDouble (multiVal p_m) /*@*/ ;
39extern char multiVal_forceChar (multiVal p_m) /*@*/ ;
40extern long multiVal_forceInt (multiVal p_m) /*@*/ ;
41
42extern /*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring p_s) /*@*/ ;
43extern /*@only@*/ multiVal multiVal_makeDouble (double p_x) /*@*/ ;
44extern /*@only@*/ multiVal multiVal_makeChar (char p_x) /*@*/ ;
45extern /*@only@*/ multiVal multiVal_makeInt (long p_x) /*@*/ ;
46extern /*@only@*/ multiVal multiVal_unknown (void) /*@*/ ;
47
48extern /*@only@*/ multiVal multiVal_copy (multiVal p_m) /*@*/ ;
49extern void multiVal_free (/*@only@*/ multiVal p_m);
50
51extern multiVal multiVal_invert (multiVal p_m) /*@*/ ;
52
0e41eb0e 53extern /*@falsewhennull@*/ bool multiVal_isInt (multiVal p_m) /*@*/ ;
54extern /*@falsewhennull@*/ bool multiVal_isChar (multiVal p_m) /*@*/ ;
55extern /*@falsewhennull@*/ bool multiVal_isDouble (multiVal p_m) /*@*/ ;
56extern /*@falsewhennull@*/ bool multiVal_isString (multiVal p_m) /*@*/ ;
885824d3 57
58extern /*@only@*/ multiVal multiVal_undump (char **p_s) /*@modifies *p_s;@*/ ;
59extern /*@only@*/ cstring multiVal_dump (multiVal p_m) /*@*/ ;
60
61extern /*@only@*/ cstring multiVal_unparse (multiVal p_m) /*@*/ ;
62extern int multiVal_compare (multiVal p_m1, multiVal p_m2) /*@*/ ;
63
64extern 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.122821 seconds and 5 git commands to generate.