2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
3 ** See ../LICENSE for license information.
19 extern void assertSet (/*@special@*/ /*@sef@*/ /*@unused@*/ void *p_x)
20 /*@sets p_x, *p_x@*/ ;
21 # define assertSet(x) ;
23 extern void assertDefined (/*@sef@*/ /*@unused@*/ void *p_x) ;
24 # define assertDefined(x) ;
28 extern int size_toInt (size_t p_x) /*@*/ ;
29 extern long size_toLong (size_t p_x) /*@*/ ;
30 extern size_t size_fromInt (int p_x) /*@*/ ;
31 extern int longUnsigned_toInt (long unsigned int p_x) /*@*/ ;
32 extern int long_toInt (long p_x) /*@*/ ;
33 extern long unsigned longUnsigned_fromInt (int p_x) /*@*/ ;
34 extern unsigned int int_toNonNegative (int p_x) /*@*/ ;
37 /* string functions */
39 typedef /*@concrete@*/ char *mstring;
40 typedef /*@observer@*/ char *ob_mstring;
41 typedef /*@observer@*/ /*@null@*/ char *bn_mstring;
43 extern /*@unused@*/ /*@notnull@*/ /*@observer@*/ char *
44 mstring_safePrint (/*@returned@*/ /*@null@*/ mstring p_s) /*@*/ ;
45 extern char *mstring_spaces (int p_n) /*@*/ ;
46 extern char *mstring_concat (const char *p_s1, const char *p_s2) /*@*/ ;
47 extern char *mstring_concatFree (/*@only@*/ char *p_s1, /*@only@*/ char *p_s2) /*@modifies *p_s1, *p_s2*/ ;
48 extern char *mstring_concatFree1 (/*@only@*/ char *p_s1, const char *p_s2);
49 extern char *mstring_append (/*@only@*/ char *p_s1, char p_c);
50 extern char *mstring_copy (/*@null@*/ char *p_s1) /*@*/ ;
51 extern bool mstring_equalPrefix (const char *p_c1, const char *p_c2) /*@*/ ;
52 extern bool mstring_equal (/*@null@*/ const char *p_s1, /*@null@*/ const char *p_s2) /*@*/ ;
53 extern bool mstring_containsChar (/*@unique@*/ const char *p_s, char p_c) /*@*/ ;
54 extern bool mstring_containsString (/*@unique@*/ const char *p_s, /*@unique@*/ const char *p_c) /*@*/ ;
56 extern int mstring_length (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
57 # define mstring_length(s) \
58 (((s) != NULL) ? size_toInt (strlen (s)) : 0)
60 extern /*@falsewhennull@*/ bool mstring_isDefined (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
61 # define mstring_isDefined(s) ((s) != NULL)
63 extern /*@nullwhentrue@*/ bool mstring_isEmpty (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ;
64 # define mstring_isEmpty(s) (mstring_length(s) == 0)
66 extern void mstring_markFree (/*@owned@*/ char *p_s) /*@modifies *p_s;@*/ ;
68 extern /*@notnull@*/ /*@only@*/ char *mstring_create (int p_n) /*@*/ /*@ensures maxSet(result) == p_n @*/ ;
69 extern /*@notnull@*/ /*@only@*/ char *mstring_createEmpty (void) /*@*/ ;
71 extern void mstring_free (/*@out@*/ /*@only@*/ /*@null@*/ char *p_s);
72 # define mstring_free(s) sfree(s)
74 # define mstring_createEmpty() mstring_create(0)
76 extern int int_compare (/*@sef@*/ int p_x, /*@sef@*/ int p_y) /*@*/ ;
77 # define int_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0))
80 /*@-macrofcndecl@*/ /* works for lots of types */
81 # define generic_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0))
86 # define GET(s) ((s *)smalloc(sizeof(s)))
89 extern bool isHeaderFile (cstring) /*@*/ ;
91 extern void fputline (FILE *p_out, char *p_s) /*@modifies p_out@*/;
93 extern int int_log (int p_x) /*@*/ ;
95 extern char char_fromInt (int p_x) /*@*/ ;
97 extern /*@exposed@*/ cstring removePreDirs (cstring p_s);
99 /* These are defined by the bison library (?) */
100 extern /*@external@*/ int isatty (int);
101 extern /*@external@*/ int yywrap (void);
105 # error "Multiple include"