]> andersk Git - splint.git/blame - src/Headers/misc.h
*** empty log message ***
[splint.git] / src / Headers / misc.h
CommitLineData
885824d3 1/*
28bf4b0b 2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
885824d3 3** See ../LICENSE for license information.
4**
5*/
6/*
7** misc.h
8**
9** (general.c)
10*/
11
12# ifndef MISC_H
13# define MISC_H
14
15# ifndef NOLCL
16# include "lclMisc.h"
17# endif
18
19extern void assertSet (/*@special@*/ /*@sef@*/ /*@unused@*/ void *p_x)
20 /*@sets p_x, *p_x@*/ ;
21# define assertSet(x) ;
22
885824d3 23/*@-czechfcns@*/
24extern int size_toInt (size_t p_x) /*@*/ ;
25extern long size_toLong (size_t p_x) /*@*/ ;
26extern size_t size_fromInt (int p_x) /*@*/ ;
27extern int longUnsigned_toInt (long unsigned int p_x) /*@*/ ;
28extern int long_toInt (long p_x) /*@*/ ;
29extern long unsigned longUnsigned_fromInt (int p_x) /*@*/ ;
30/*@=czechfcns@*/
31
32/* string functions */
33
34typedef /*@concrete@*/ char *mstring;
35typedef /*@observer@*/ char *ob_mstring;
36typedef /*@observer@*/ /*@null@*/ char *bn_mstring;
37
38extern /*@unused@*/ /*@notnull@*/ /*@observer@*/ char *
39 mstring_safePrint (/*@returned@*/ /*@null@*/ mstring p_s) /*@*/ ;
40extern char *mstring_spaces (int p_n) /*@*/ ;
41extern char *mstring_concat (const char *p_s1, const char *p_s2) /*@*/ ;
42extern char *mstring_concatFree (/*@only@*/ char *p_s1, /*@only@*/ char *p_s2) /*@modifies *p_s1, *p_s2*/ ;
43extern char *mstring_concatFree1 (/*@only@*/ char *p_s1, const char *p_s2);
44extern char *mstring_append (/*@only@*/ char *p_s1, char p_c);
45extern char *mstring_copy (/*@null@*/ char *p_s1) /*@*/ ;
46extern bool mstring_equalPrefix (const char *p_c1, const char *p_c2) /*@*/ ;
47extern bool mstring_equal (/*@null@*/ const char *p_s1, /*@null@*/ const char *p_s2) /*@*/ ;
28bf4b0b 48extern bool mstring_containsChar (const char *p_s, char p_c) /*@*/ ;
885824d3 49
50extern int mstring_length (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
51# define mstring_length(s) \
52 (((s) != NULL) ? size_toInt (strlen (s)) : 0)
53
54extern /*@falsenull@*/ bool mstring_isDefined (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
55# define mstring_isDefined(s) ((s) != NULL)
56
57extern /*@truenull@*/ bool mstring_isEmpty (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
58# define mstring_isEmpty(s) (mstring_length(s) == 0)
59
60extern void mstring_markFree (/*@owned@*/ char *p_s) /*@modifies *p_s;@*/ ;
61
62extern /*@notnull@*/ /*@only@*/ char *mstring_create (int p_n) /*@*/ ;
63extern /*@notnull@*/ /*@only@*/ char *mstring_createEmpty (void) /*@*/ ;
64
65extern void mstring_free (/*@out@*/ /*@only@*/ /*@null@*/ char *p_s);
66# define mstring_free(s) sfree(s)
67
68# define mstring_createEmpty() mstring_create(0)
69
70extern int int_compare (/*@sef@*/ int p_x, /*@sef@*/ int p_y) /*@*/ ;
71# define int_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0))
72
73/*@-macroparams@*/
74/*@-macrofcndecl@*/ /* works for lots of types */
75# define generic_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0))
76/*@=macrofcndecl@*/
77/*@=macroparams@*/
78
79/*@notfunction@*/
80# define GET(s) ((s *)smalloc(sizeof(s)))
81
28bf4b0b 82/*@-czechfcns@*/
885824d3 83extern bool isHeaderFile (cstring) /*@*/ ;
84
85extern void fputline (FILE *p_out, char *p_s) /*@modifies p_out@*/;
86
87extern int int_log (int p_x) /*@*/ ;
88
89extern char char_fromInt (int p_x) /*@*/ ;
90
28bf4b0b 91extern /*@exposed@*/ cstring removePreDirs (cstring p_s);
885824d3 92
93/* These are defined by the bison library (?) */
94extern /*@external@*/ int isatty (int);
95extern /*@external@*/ int yywrap (void);
28bf4b0b 96/*@=czechfcns@*/
885824d3 97
98# else
99# error "Multiple include"
100# endif
28bf4b0b 101
102
103
104
105
This page took 0.06327 seconds and 5 git commands to generate.