2 ** ansi.h --- LCLint Standard C Library
4 ** Process with -DSTRICT to get strict library.
9 /*@+globsimpmodifiesnothing@*/
15 /*@constant int EDOM;@*/
16 /*@constant int ERANGE;@*/
17 /*@constant int EILSEQ;@*/
20 /*@checkedstrict@*/ int errno;
22 /*@unchecked@*/ int errno;
29 typedef /*@integraltype@*/ ptrdiff_t;
30 typedef /*@unsignedintegraltype@*/ size_t;
31 typedef /*@signedintegraltype@*/ ssize_t;
32 typedef /*@integraltype@*/ wchar_t;
35 ** Added by Amendment 1 to ISO.
38 typedef /*@integraltype@*/ wint_t;
39 typedef /*@abstract@*/ mbstate_t;
41 /*@constant null anytype NULL = 0;@*/
47 /*@constant lltX_bool NDEBUG;@*/
50 /*@falseexit@*/ void assert (/*@sef@*/ lltX_bool e)
53 /*@falseexit@*/ void assert (/*@sef@*/ lltX_bool /*@alt int@*/ e)
63 lltX_bool isalnum (int c) /*@*/ ;
64 lltX_bool isalpha (int c) /*@*/ ;
65 lltX_bool iscntrl (int c) /*@*/ ;
66 lltX_bool isdigit (int c) /*@*/ ;
67 lltX_bool isgraph (int c) /*@*/ ;
68 lltX_bool islower (int c) /*@*/ ;
69 lltX_bool isprint (int c) /*@*/ ;
70 lltX_bool ispunct (int c) /*@*/ ;
71 lltX_bool isspace (int c) /*@*/ ;
72 lltX_bool isupper (int c) /*@*/ ;
73 lltX_bool isxdigit (int c) /*@*/ ;
74 char tolower (int c) /*@*/ ;
75 char toupper (int c) /*@*/ ;
77 lltX_bool /*@alt int@*/ isalnum (int /*@alt unsigned char@*/ c) /*@*/ ;
78 lltX_bool /*@alt int@*/ isalpha (int /*@alt unsigned char@*/ c) /*@*/ ;
79 lltX_bool /*@alt int@*/ iscntrl (int /*@alt unsigned char@*/ c) /*@*/ ;
80 lltX_bool /*@alt int@*/ isdigit (int /*@alt unsigned char@*/ c) /*@*/ ;
81 lltX_bool /*@alt int@*/ isgraph (int /*@alt unsigned char@*/ c) /*@*/ ;
82 lltX_bool /*@alt int@*/ islower (int /*@alt unsigned char@*/ c) /*@*/ ;
83 lltX_bool /*@alt int@*/ isprint (int /*@alt unsigned char@*/ c) /*@*/ ;
84 lltX_bool /*@alt int@*/ ispunct (int /*@alt unsigned char@*/ c) /*@*/ ;
85 lltX_bool /*@alt int@*/ isspace (int /*@alt unsigned char@*/ c) /*@*/ ;
86 lltX_bool /*@alt int@*/ isupper (int /*@alt unsigned char@*/ c) /*@*/ ;
87 lltX_bool /*@alt int@*/ isxdigit (int /*@alt unsigned char@*/ c) /*@*/ ;
88 char /*@alt int@*/ tolower (int /*@alt unsigned char@*/ c) /*@*/ ;
89 char /*@alt int@*/ toupper (int /*@alt unsigned char@*/ c) /*@*/ ;
101 char *int_curr_symbol;
102 char *currency_symbol;
103 char *mon_decimal_point;
104 char *mon_thousands_sep;
108 char int_frac_digits;
118 /*@constant int LC_ALL;@*/
119 /*@constant int LC_COLLATE;@*/
120 /*@constant int LC_CTYPE;@*/
121 /*@constant int LC_MONETARY;@*/
122 /*@constant int LC_NUMERIC;@*/
123 /*@constant int LC_TIME;@*/
125 /*@observer@*/ /*@null@*/ char *setlocale (int category, /*@null@*/ char *locale)
126 /*@modifies internalState, errno@*/ ;
128 struct lconv *localeconv (void) /*@*/ ;
135 ** Note, these are defined by macros, but NOT necessarily
136 ** constants. They may be used as lvalues.
139 /*@unchecked@*/ int DBL_DIG;
140 /*@unchecked@*/ double DBL_EPSILON;
141 /*@unchecked@*/ int DBL_MANT_DIG;
142 /*@unchecked@*/ double DBL_MAX;
143 /*@unchecked@*/ int DBL_MAX_10_EXP;
144 /*@unchecked@*/ int DBL_MAX_EXP;
145 /*@unchecked@*/ double DBL_MIN;
146 /*@unchecked@*/ int DBL_MIN_10_EXP;
147 /*@unchecked@*/ int DBL_MIN_EXP;
149 /*@unchecked@*/ int FLT_DIG;
150 /*@unchecked@*/ float FLT_EPSILON;
151 /*@unchecked@*/ int FLT_MANT_DIG;
152 /*@unchecked@*/ float FLT_MAX;
153 /*@unchecked@*/ int FLT_MAX_10_EXP;
154 /*@unchecked@*/ int FLT_MAX_EXP;
155 /*@unchecked@*/ float FLT_MIN;
156 /*@unchecked@*/ int FLT_MIN_10_EXP;
157 /*@unchecked@*/ int FLT_MIN_EXP;
158 /*@constant int FLT_RADIX@*/
159 /*@unchecked@*/ int FLT_ROUNDS;
161 /*@unchecked@*/ int LDBL_DIG;
162 /*@unchecked@*/ long double LDBL_EPSILON;
163 /*@unchecked@*/ int LDBL_MANT_DIG;
164 /*@unchecked@*/ long double LDBL_MAX;
165 /*@unchecked@*/ int LDBL_MAX_10_EXP;
166 /*@unchecked@*/ int LDBL_MAX_EXP;
167 /*@unchecked@*/ long double LDBL_MIN;
168 /*@unchecked@*/ int LDBL_MIN_10_EXP;
169 /*@unchecked@*/ int LDBL_MIN_EXP;
175 /*@constant int CHAR_BIT; @*/
176 /*@constant char CHAR_MAX; @*/
177 /*@constant char CHAR_MIN; @*/
178 /*@constant int INT_MAX; @*/
179 /*@constant int INT_MIN; @*/
180 /*@constant long int LONG_MAX; @*/
181 /*@constant long int LONG_MIN; @*/
182 /*@constant long int MB_LEN_MAX@*/
183 /*@constant signed char SCHAR_MAX; @*/
184 /*@constant signed char SCHAR_MIN; @*/
185 /*@constant short SHRT_MAX; @*/
186 /*@constant short SHRT_MIN; @*/
187 /*@constant unsigned char UCHAR_MAX; @*/
188 /*@constant unsigned char UCHAR_MIN; @*/
189 /*@constant unsigned int UINT_MAX; @*/
190 /*@constant unsigned long ULONG_MAX; @*/
191 /*@constant unsigned short USHRT_MAX; @*/
197 /*@constant double HUGE_VAL; @*/
200 ** math functions that may have a range error modify errno
203 double sin (double x) /*@*/ ;
204 double cos (double x) /*@*/ ;
205 double tan (double x) /*@*/ ;
206 double asin (double x) /*@modifies errno@*/ ;
207 double acos (double x) /*@modifies errno@*/ ;
208 double atan (double x) /*@*/ ;
209 double atan2 (double y, double x) /*@*/ ;
210 double sinh (double x) /*@*/ ;
211 double cosh (double x) /*@modifies errno@*/ ;
212 double tanh (double x) /*@*/ ;
214 double exp (double x) /*@modifies errno@*/ ;
215 double ldexp (double x, int n) /*@modifies errno@*/ ;
216 double frexp (double x, /*@out@*/ int *xp) /*@modifies *xp;@*/ ;
218 double log (double x) /*@modifies errno@*/ ;
219 double log10 (double x) /*@modifies errno@*/ ;
221 double pow (double x, double y) /*@modifies errno@*/ ;
222 double sqrt (double x) /*@modifies errno@*/ ;
224 double ceil (double x) /*@*/ ;
225 double floor (double x) /*@*/ ;
226 double fabs (double x) /*@*/ ;
228 double modf (double x, /*@out@*/ double *ip) /*@modifies *ip;@*/ ;
229 double fmod (double x, double y) /*@*/ ;
232 ** These functions are optional in iso C. An implementation does not
233 ** have to provide them. They are included in comments here, but
234 ** are not required to be part of the standard library.
237 # ifdef OPTIONAL_MATH
239 float acosf (float x) /*@modifies errno@*/ ;
240 long double acosl (long double x) /*@modifies errno@*/ ;
241 float asinf (float x) /*@modifies errno@*/ ;
242 long double asinl (long double x) /*@modifies errno@*/ ;
243 float atanf (float x) /*@*/ ;
244 long double atanl (long double x) /*@*/ ;
245 float atan2f (float y, float x) /*@*/ ;
246 long double atan2l (long double y, long double x) /*@*/ ;
247 float ceilf (float x) /*@*/ ;
248 long double ceill (long double x) /*@*/ ;
249 float cosf (float x) /*@*/ ;
250 long double cosl (long double x) /*@*/ ;
251 float coshf (float x) /*@modifies errno@*/ ;
252 long double coshl (long double x) /*@modifies errno@*/ ;
253 float expf (float x) /*@modifies errno@*/ ;
254 long double expl (long double x) /*@modifies errno@*/;
255 float fabsf (float x) /*@*/ ;
256 long double fabsl (long double x) /*@*/ ;
257 float floorf (float x) /*@*/ ;
258 long double floorl (long double x) /*@*/ ;
259 float fmodf (float x, float y) /*@*/ ;
260 long double fmodl (long double x, long double y) /*@*/ ;
261 float frexpf (float x, /*@out@*/ int *xp) /*@modifies *xp@*/;
262 long double frexpl (long double x, /*@out@*/ int *xp) /*@modifies *xp@*/;
263 float ldexpf (float x, int n) /*@modifies errno@*/ ;
264 long double ldexpl (long double x, int n) /*@modifies errno@*/ ;
265 float logf (float x) /*@modifies errno@*/ ;
266 long double logl (long double x) /*@modifies errno@*/ ;
267 float log10f (float x) /*@modifies errno@*/;
268 long double log10l (long double x) /*@modifies errno@*/;
269 float modff (float x, /*@out@*/ float *xp) /*@modifies *xp@*/ ;
270 long double modfl (long double x, /*@out@*/ long double *xp) /*@modifies *xp@*/ ;
271 float powf (float x, float y) /*@modifies errno@*/ ;
272 long double powl (long double x, long double y) /*@modifies errno@*/ ;
273 float sinf (float x) /*@*/ ;
274 long double sinl (long double x) /*@*/ ;
275 float sinhf (float x) /*@*/ ;
276 long double sinhl (long double x) /*@*/ ;
277 float sqrtf (float x) /*@modifies errno@*/ ;
278 long double sqrtl (long double x) /*@modifies errno@*/ ;
279 float tanf (float x) /*@*/ ;
280 long double tanl (long double x) /*@*/ ;
281 float tanhf (float x) /*@*/ ;
282 long double tanhl (long double x) /*@*/ ;
290 typedef /*@abstract@*/ /*@mutable@*/ void *jmp_buf;
292 int setjmp (/*@out@*/ jmp_buf env) /*@modifies env;@*/ ;
293 /*@mayexit@*/ void longjmp (jmp_buf env, int val) /*@*/ ;
299 /*@constant int SIGABRT; @*/
300 /*@constant int SIGFPE; @*/
301 /*@constant int SIGILL; @*/
302 /*@constant int SIGINT; @*/
303 /*@constant int SIGSEGV; @*/
304 /*@constant int SIGTERM; @*/
306 typedef /*@integraltype@*/ sig_atomic_t;
308 /*@constant void (*SIG_DFL)(int); @*/
309 /*@constant void (*SIG_ERR)(int); @*/
310 /*@constant void (*SIG_IGN)(int); @*/
313 ** signal takes an int, and a function takes int returns void, and
314 ** returns the function (or NULL if unsuccessful).
317 /*@null@*/ void (*signal (int sig, /*@null@*/ void (*func)(int))) (int)
318 /*@modifies internalState, errno;@*/ ;
320 /*@mayexit@*/ int raise (int sig) ;
326 typedef /*@abstract@*/ /*@mutable@*/ void *va_list;
328 void va_start (/*@out@*/ va_list ap, ...) /*@modifies ap;@*/ ;
329 void va_end (va_list va) /*@modifies va;@*/ ;
339 typedef /*@abstract@*/ /*@mutable@*/ void *FILE;
340 typedef /*@abstract@*/ /*@mutable@*/ void *fpos_t;
342 /*@constant int _IOFBF; @*/
343 /*@constant int _IOLBF; @*/
344 /*@constant int _IONBF; @*/
346 /*@constant int BUFSIZ; @*/
347 /*@constant int EOF; @*/
349 /*@constant int FOPEN_MAX; @*/
350 /*@constant int FILENAME_MAX; @*/
352 /*@constant int L_tmpnam; @*/
354 /*@constant int SEEK_CUR; @*/
355 /*@constant int SEEK_END; @*/
356 /*@constant int SEEK_SET; @*/
358 /*@constant int TMP_MAX; @*/
361 /*@checked@*/ FILE *stderr;
362 /*@checked@*/ FILE *stdin;
363 /*@checked@*/ FILE *stdout;
365 /*@unchecked@*/ FILE *stderr;
366 /*@unchecked@*/ FILE *stdin;
367 /*@unchecked@*/ FILE *stdout;
370 int remove (char *filename) /*@modifies fileSystem, errno@*/ ;
371 int rename (char *old, char *new) /*@modifies fileSystem, errno@*/ ;
373 /*@null@*/ FILE *tmpfile (void) /*@modifies fileSystem@*/ ;
374 /*@observer@*/ char *
375 tmpnam (/*@out@*/ /*@null@*/ /*@returned@*/ char *s)
376 /*@modifies *s, internalState@*/ ;
378 int fclose (FILE *stream) /*@modifies *stream, errno, fileSystem;@*/ ;
379 int fflush (/*@null@*/ FILE *stream)
380 /*@modifies *stream, errno, fileSystem;@*/ ;
382 /*@null@*/ /*@dependent@*/ FILE *fopen (char *filename, char *mode)
383 /*@modifies fileSystem@*/ ;
385 /*@null@*/ FILE *freopen (char *filename, char *mode, FILE *stream)
386 /*@modifies *stream, fileSystem, errno@*/ ;
388 void setbuf (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf)
389 /*@modifies fileSystem, *stream, *buf@*/ ;
391 int setvbuf (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf,
392 int mode, size_t size)
393 /*@modifies fileSystem, *stream, *buf@*/ ;
397 int fprintf (FILE *stream, char *format, ...)
398 /*@modifies fileSystem, *stream@*/ ;
401 int /*@alt void@*/ fprintf (FILE *stream, char *format, ...)
402 /*@modifies fileSystem, *stream@*/ ;
406 int fscanf (FILE *stream, char *format, ...)
407 /*@modifies fileSystem, *stream@*/ ;
411 int printf (char *format, ...)
413 /*@modifies fileSystem, *stdout@*/ ;
416 int /*@alt void@*/ printf (char *format, ...)
418 /*@modifies fileSystem, *stdout@*/ ;
422 int scanf(char *format, ...)
424 /*@modifies fileSystem, *stdin@*/ ;
428 int sprintf (/*@out@*/ char *s, char *format, ...)
432 int /*@alt void@*/ sprintf (/*@out@*/ char *s, char *format, ...)
437 int sscanf (/*@out@*/ char *s, char *format, ...) /*@*/ ;
438 /* modifies extra arguments */
440 int vprintf (const char *format, va_list arg)
442 /*@modifies fileSystem, *stdout@*/ ;
444 int vfprintf (FILE *stream, char *format, va_list arg)
445 /*@modifies fileSystem, *stream, arg, errno@*/ ;
447 int vsprintf (/*@out@*/ char *str, const char *format, va_list ap)
448 /*@warn bufferoverflowhigh "Use vsnprintf instead"@*/
451 int vsnprintf (/*@out@*/ char *str, size_t size, const char *format, va_list ap)
452 /*@requires maxSet(str) >= size@*/
455 int fgetc (FILE *stream)
456 /*@modifies fileSystem, *stream, errno@*/ ;
459 fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream)
460 /*@modifies fileSystem, *s, *stream, errno@*/
461 /*@requires MaxSet(s) >= (n -1); @*/
462 /*@ensures MaxRead(s) <= (n -1) /\ MaxRead(s) >= 0; @*/
465 int fputc (int /*@alt char@*/ c, FILE *stream)
467 /*@modifies fileSystem, *stream, errno@*/ ;
469 int fputs (char *s, FILE *stream)
470 /*@modifies fileSystem, *stream@*/ ;
472 /* note use of sef --- stream may be evaluated more than once */
473 int getc (/*@sef@*/ FILE *stream)
474 /*@modifies fileSystem, *stream@*/ ;
476 int getchar (void) /*@globals stdin@*/ /*@modifies fileSystem, *stdin@*/ ;
478 /*@null@*/ char *gets (/*@out@*/ char *s)
479 /*@warn bufferoverflowhigh
480 "Use of gets leads to a buffer overflow vulnerability. Use fgets instead"@*/
481 /*@globals stdin@*/ /*@modifies fileSystem, *s, *stdin, errno@*/ ;
483 int putc (int /*@alt char@*/ c, /*@sef@*/ FILE *stream)
485 /*@modifies fileSystem, *stream;@*/ ;
487 int putchar (int /*@alt char@*/ c)
489 /*@globals stdout@*/ /*@modifies fileSystem, *stdout@*/ ;
491 int puts (const char *s)
494 /*@modifies fileSystem, *stdout@*/ ;
496 int ungetc (int /*@alt char@*/ c, FILE *stream)
497 /*@modifies fileSystem, *stream, errno@*/ ;
500 fread (/*@out@*/ void *ptr, size_t size, size_t nobj, FILE *stream)
501 /*@modifies fileSystem, *ptr, *stream, errno@*/ ;
503 size_t fwrite (void *ptr, size_t size, size_t nobj, FILE *stream)
504 /*@modifies fileSystem, *stream, errno@*/ ;
506 int fgetpos (FILE *stream, /*@out@*/ fpos_t *pos)
507 /*@modifies *pos, errno@*/ ;
509 int fseek (FILE *stream, long int offset, int whence)
511 /*@modifies fileSystem, *stream, errno@*/ ;
513 int fsetpos (FILE *stream, fpos_t *pos)
514 /*@modifies fileSystem, *stream, errno@*/ ;
516 long int ftell(FILE *stream)
517 /*:errorcode -1:*/ /*@modifies errno*/ ;
519 void rewind (FILE *stream) /*@modifies *stream@*/ ;
520 void clearerr (FILE *stream) /*@modifies *stream@*/ ;
522 int feof (FILE *stream) /*@modifies errno@*/ ;
523 int ferror (FILE *stream) /*@modifies errno@*/ ;
525 void perror (/*@null@*/ char *s)
526 /*@globals errno, stderr@*/ /*@modifies fileSystem, *stderr@*/ ;
532 double atof (char *s) /*@*/ ;
533 int atoi (char *s) /*@*/ ;
534 long int atol (char *s) /*@*/ ;
536 double strtod (char *s, /*@null@*/ /*@out@*/ char **endp)
537 /*@modifies *endp, errno@*/ ;
539 long strtol (char *s, /*@null@*/ /*@out@*/ char **endp, int base)
540 /*@modifies *endp, errno@*/ ;
543 strtoul (char *s, /*@null@*/ /*@out@*/ char **endp, int base)
544 /*@modifies *endp, errno@*/ ;
546 /*@constant int RAND_MAX; @*/
547 int rand (void) /*@modifies internalState@*/ ;
548 void srand (unsigned int seed) /*@modifies internalState@*/ ;
555 /*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/
556 /*@ensures MaxSet(result) == (nobj - 1); @*/ ;
557 /*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@*/
558 /*@ensures MaxSet(result) == (size - 1); @*/ ;
562 /* 11 June 1997: removed out on return value */
565 /*@null@*/ /*@only@*/ void *
566 realloc (/*@null@*/ /*@only@*/ /*@special@*/ void *p,
567 size_t size) /*@releases p@*/ /*@modifies *p@*/
568 /*@ensures MaxSet(result) == (size - 1) @*/;
572 ** LCLint annotations cannot fully describe realloc. The semantics we
574 ** realloc returns null: ownership of parameter is not changed
575 ** realloc returns non-null: ownership of parameter is transferred to return value
577 ** Otherwise, storage is in the same state before and after the call.
580 /*@null@*/ /*@only@*/ void *
581 realloc (/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p, size_t size)
582 /*@modifies *p@*/ /*@ensures MaxSet(result) >= (size - 1) @*/;
584 void free (/*@null@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies p@*/ ;
586 /*@constant int EXIT_FAILURE; @*/
587 /*@constant int EXIT_SUCCESS; @*/
589 /*@exits@*/ void abort (void) /*@*/ ;
590 /*@exits@*/ void exit (int status) /*@*/ ;
591 int atexit (void (*func)(void)) /*@modifies internalState@*/ ;
593 /*@observer@*/ /*@null@*/ char *getenv (char *name) /*@*/ ;
595 int system (/*@null@*/ char *s) /*@modifies fileSystem@*/ ;
597 /*@null@*/ /*@dependent@*/ void *
598 bsearch (void *key, void *base,
599 size_t n, size_t size,
600 int (*compar)(void *, void *)) /*@*/ ;
602 void qsort (void *base, size_t n, size_t size,
603 int (*compar)(void *, void *))
604 /*@modifies *base, errno@*/ ;
606 int abs (int n) /*@*/ ;
608 typedef /*@concrete@*/ struct
614 div_t div (int num, int denom) /*@*/ ;
616 long int labs (long int n) /*@*/ ;
618 typedef /*@concrete@*/ struct
624 ldiv_t ldiv (long num, long denom) /*@*/ ;
626 /*@constant size_t MB_CUR_MAX; @*/
629 ** wchar_t and wint_t functions added by Amendment 1 to ISO.
632 /*@constant int WCHAR_MAX@*/
633 /*@constant int WCHAR_MIN@*/
634 /*@constant wint_t WEOF@*/
636 wint_t btowc (int c) /*@*/ ;
638 wint_t fgetwc (FILE *fp) /*@modifies fileSystem, *fp*/ ;
640 /*@null@*/ wchar_t *fgetws (/*@returned@*/ wchar_t *s, int n, FILE *stream)
641 /*@modifies fileSystem, *s, *stream@*/;
643 wint_t fputwc (wchar_t c, FILE *stream)
644 /*@modifies fileSystem, *stream@*/;
646 int fputws (const wchar_t *s, FILE *stream)
647 /*@modifies fileSystem, *stream@*/ ;
649 int fwide (FILE *stream, int mode) /*@*/ ;
650 /* does not modify the stream */
652 /*@printflike@*/ int fwprintf (FILE *stream, const wchar_t *format, ...)
653 /*@modifies *stream, fileSystem@*/ ;
655 /*@scanflike@*/ int fwscanf (FILE *stream, const wchar_t *format, ...)
656 /*@modifies *stream, fileSystem@*/ ;
658 /* note use of sef --- stream may be evaluated more than once */
659 wint_t getwc (/*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ;
661 wint_t getwchar (void) /*@modifies fileSystem, *stdin@*/;
663 size_t mbrlen (const char *s, size_t n, /*@null@*/ mbstate_t *ps) /*@*/ ;
665 size_t mbrtowc (/*@null@*/ wchar_t *pwc, const char *s, size_t n,
666 /*@null@*/ mbstate_t *ps)
667 /*@modifies *pwc@*/ ;
669 int mbsinit (/*@null@*/ const mbstate_t *ps) /*@*/ ;
671 size_t mbsrtowcs (/*@null@*/ wchar_t *dst, const char **src, size_t len,
672 /*@null@*/ mbstate_t *ps)
673 /*@modifies *dst@*/ ;
675 /* note use of sef --- stream may be evaluated more than once */
676 wint_t putwc (wchar_t c, /*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ;
678 wint_t putwchar (wchar_t c) /*@modifies fileSystem, *stdout@*/ ;
680 /*@printflike@*/ int swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
683 /*@scanflike@*/ int swscanf (const wchar_t *s, const wchar_t *format, ...)
684 /*@modifies *stdin@*/ ;
686 wint_t ungetwc (wint_t c, FILE *stream) /*@modifies fileSystem, *stream@*/ ;
688 int vfwprintf (FILE *stream, const wchar_t *format, va_list arg)
689 /*@modifies fileSystem, *stream@*/ ;
691 int vswprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg)
694 int vwprintf (const wchar_t *format, va_list arg)
695 /*@modifies fileSystem, *stdout@*/ ;
697 size_t wcrtomb (/*@null@*/ /*@out@*/ char *s, wchar_t wc, /*@null@*/ mbstate_t *ps)
700 void /*@alt wchar_t *@*/
701 wcscat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2)
704 /*@exposed@*/ /*@null@*/ wchar_t *
705 wcschr (/*@returned@*/ const wchar_t *s, wchar_t c)
708 int wcscmp (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
710 int wcscoll (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
712 void /*@alt wchar_t *@*/
713 wcscpy (/*@unique@*/ /*@out@*/ /*@returned@*/ wchar_t *s1, const wchar_t *s2)
716 size_t wcscspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
718 size_t wcsftime (/*@out@*/ wchar_t *s, size_t maxsize, const wchar_t *format,
719 const struct tm *timeptr)
722 size_t wcslen (const wchar_t *s) /*@*/ ;
724 void /*@alt wchar_t *@*/
725 wcsncat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2,
729 int wcsncmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ;
731 void /*@alt wchar_t *@*/
732 wcsncpy (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2,
737 wcspbrk (/*@returned@*/ const wchar_t *s1, const wchar_t *s2)
741 wcsrchr (/*@returned@*/ const wchar_t *s, wchar_t c)
745 wcsrtombs (/*@null@*/ char *dst, const wchar_t **src, size_t len,
746 /*@null@*/ mbstate_t *ps)
747 /*@modifies *src@*/ ;
749 size_t wcsspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
751 /*@null@*/ wchar_t *wcsstr (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
753 double wcstod (const wchar_t *nptr, /*@null@*/ wchar_t **endptr)
754 /*@modifies *endptr@*/ ;
757 wcstok (/*@null@*/ wchar_t *s1, const wchar_t *s2, wchar_t **ptr)
760 long wcstol (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base)
761 /*@modifies *endptr@*/;
764 wcstoul (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base)
765 /*@modifies *endptr@*/;
768 wcsxfrm (/*@null@*/ wchar_t *s1, const wchar_t *s2, size_t n)
771 int wctob (wint_t c) /*@*/;
773 /*@null@*/ wchar_t *wmemchr (const wchar_t *s, wchar_t c, size_t n) /*@*/ ;
775 int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ;
777 wchar_t *wmemcpy (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n)
780 wchar_t *wmemmove (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n)
783 wchar_t *wmemset (/*@returned@*/ wchar_t *s, wchar_t c, size_t n)
786 /*@printflike@*/ int wprintf (const wchar_t *format, ...)
787 /*@globals stdout@*/ /*@modifies errno, *stdout@*/;
790 wscanf (const wchar_t *format, ...)
791 /*@globals stdin@*/ /*@modifies errno, *stdin@*/;
794 ** wctype.h (added by Amendment 1)
797 /* Warning: not sure about these (maybe abstract?): */
798 typedef /*@integraltype@*/ wctype_t;
799 typedef /*@integraltype@*/ wctrans_t;
802 lltX_bool iswalnum (wint_t c) /*@*/ ;
803 lltX_bool iswalpha (wint_t c) /*@*/ ;
804 lltX_bool iswcntrl (wint_t c) /*@*/ ;
805 lltX_bool iswctype (wint_t c, wctype_t ctg) /*@*/ ;
806 lltX_bool iswdigit (wint_t c) /*@*/ ;
807 lltX_bool iswgraph (wint_t c) /*@*/ ;
808 lltX_bool iswlower (wint_t c) /*@*/ ;
809 lltX_bool iswprint (wint_t c) /*@*/ ;
810 lltX_bool iswpunct (wint_t c) /*@*/ ;
811 lltX_bool iswspace (wint_t c) /*@*/ ;
812 lltX_bool iswupper (wint_t c) /*@*/ ;
813 lltX_bool iswxdigit (wint_t c) /*@*/ ;
815 wint_t towctrans (wint_t c, wctrans_t ctg) /*@*/ ;
816 wint_t towlower (wint_t c) /*@*/ ;
817 wint_t towupper (wint_t c) /*@*/ ;
819 lltX_bool /*@alt int@*/ iswalnum (wint_t c) /*@*/ ;
820 lltX_bool /*@alt int@*/ iswalpha (wint_t c) /*@*/ ;
821 lltX_bool /*@alt int@*/ iswcntrl (wint_t c) /*@*/ ;
822 lltX_bool /*@alt int@*/ iswctype (wint_t c, wctype_t ctg) /*@*/ ;
823 lltX_bool /*@alt int@*/ iswdigit (wint_t c) /*@*/ ;
824 lltX_bool /*@alt int@*/ iswgraph (wint_t c) /*@*/ ;
825 lltX_bool /*@alt int@*/ iswlower (wint_t c) /*@*/ ;
826 lltX_bool /*@alt int@*/ iswprint (wint_t c) /*@*/ ;
827 lltX_bool /*@alt int@*/ iswpunct (wint_t c) /*@*/ ;
828 lltX_bool /*@alt int@*/ iswspace (wint_t c) /*@*/ ;
829 lltX_bool /*@alt int@*/ iswupper (wint_t c) /*@*/ ;
830 lltX_bool /*@alt int@*/ iswxdigit (wint_t c) /*@*/ ;
832 wint_t /*@alt int@*/ towctrans (wint_t c, wctrans_t ctg) /*@*/ ;
833 wint_t /*@alt int@*/ towlower (wint_t c) /*@*/ ;
834 wint_t /*@alt int@*/ towupper (wint_t c) /*@*/ ;
837 wctrans_t wctrans (const char *property) /*@*/ ;
838 wctype_t wctype (const char *property) /*@*/ ;
840 int mblen (char *s, size_t n) /*@*/ ;
841 int mbtowc (/*@null@*/ wchar_t *pwc, /*@null@*/ char *s, size_t n)
842 /*@modifies *pwc@*/ ;
843 int wctomb (/*@out@*/ /*@null@*/ char *s, wchar_t wchar)
845 size_t mbstowcs (/*@out@*/ wchar_t *pwcs, char *s, size_t n)
846 /*@modifies *pwcs@*/ ;
847 size_t wcstombs (/*@out@*/ char *s, wchar_t *pwcs, size_t n)
854 void /*@alt void * @*/
855 memcpy (/*@unique@*/ /*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n)
857 /*@requires MaxRead(s2) >= (n - 1) /\ MaxSet(s1) >= (n - 1); @*/
860 void /*@alt void * @*/
861 memmove (/*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n)
863 /*@requires MaxRead(s2) >= (n - 1) /\ MaxSet(s1) >= (n - 1); @*/
871 void /*@alt char * @*/
872 strcpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2)
874 /*@requires maxSet(s1) >= maxRead(s2) @*/
875 /*@ensures MaxRead(s1) == MaxRead (s2) /\ MaxRead(result) == MaxRead(s2) /\ MaxSet(result) == MaxSet(s1); @*/;
877 void /*@alt char * @*/
878 strncpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2, size_t n)
879 /*@modifies *s1@*/ /*@requires MaxSet(s1) >= ( n - 1 ); @*/ /*@ensures MaxRead (s2) >= MaxRead(s1) /\ MaxRead (s1) <= n; @*/;
881 void /*@alt char * @*/
882 strcat (/*@unique@*/ /*@returned@*/ char *s1, char *s2)
883 /*@modifies *s1@*/ /*@requires MaxSet(s1) >= (MaxRead(s1) + MaxRead(s2) );@*/
884 /*@ensures MaxRead(result) == (MaxRead(s1) + MaxRead(s2) );@*/;
886 void /*@alt char * @*/
887 strncat (/*@unique@*/ /*@returned@*/ char *s1, char *s2, size_t n)
889 /*@requires MaxSet(s1) >= ( MaxRead(s1) + n); @*/
890 /*@ensures MaxRead(s1) >= (MaxRead(s1) + n); @*/;
894 int memcmp (void *s1, void *s2, size_t n) /*@*/ ;
895 int strcmp (char *s1, char *s2) /*@*/ ;
896 int strcoll (char *s1, char *s2) /*@*/ ;
897 int strncmp (char *s1, char *s2, size_t n) /*@*/ ;
898 size_t strxfrm (/*@out@*/ /*@null@*/ char *s1, char *s2, size_t n)
899 /*@modifies *s1@*/ ; /* s1 may be null only if n == 0 */
901 /*@null@*/ void *memchr (void *s, int c, size_t n) /*@*/ ;
904 /*@exposed@*/ /*@null@*/ char *
905 strchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures MaxSet(result) >= 0 /\ MaxSet(result) <= MaxSet(s) /\ MaxRead (result) <= MaxRead(s) /\ MaxRead(result) >= 0 @*/ ;
907 /*@exposed@*/ /*@null@*/ char *
908 strchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures MaxSet(result) >= 0 /\ MaxSet(result) <= MaxSet(s) /\ MaxRead (result) <= MaxRead(s) /\ MaxRead(result) >= 0; @*/ ;
911 size_t strcspn (char *s1, char *s2) /*@*/ ;
912 /*@null@*/ /*@exposed@*/ char *
913 strpbrk (/*@returned@*/ char *s, char *t) /*@*/ ;
916 /*@null@*/ /*@exposed@*/ char *
917 strrchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures MaxSet(result) >= 0 /\ MaxSet(result) <= MaxSet(s) /\ MaxRead (result) <= MaxRead(s) /\ MaxRead(result) >= 0 @*/ ;
919 /*@null@*/ /*@exposed@*/ char *
920 strrchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures MaxSet(result) >= 0 /\ MaxSet(result) <= MaxSet(s) /\ MaxRead (result) <= MaxRead(s) /\ MaxRead(result) >= 0 @*/ ;
923 size_t strspn (char *s, char *t) /*@*/ ;
925 /*@null@*/ /*@exposed@*/ char *
926 strstr (/*@returned@*/ /*@unique@*/ char *s, char *t) /*@*/
927 /*@ensures MaxSet(result) >= 0 /\ MaxSet(result) <= MaxSet(s) /\ MaxRead (result) <= MaxRead(s) /\ MaxRead(result) >= 0 @*/ ;
929 /*@null@*/ /*@exposed@*/ char *
930 strtok (/*@returned@*/ /*@null@*/ char *s, char *t)
931 /*@modifies *s, internalState, errno@*/ ;
933 void /*@alt void *@*/ memset (/*@out@*/ /*@returned@*/ void *s,
935 /*@modifies *s@*/ /*@requires MaxSet(s) >= (n - 1) @*/ /*@ensures MaxRead(s) >= (n - 1) @*/ ;
937 /*@observer@*/ char *strerror (int errnum) /*@*/ ;
940 size_t strlen (char *s) /*@*/ /*@ensures result == MaxRead(s); @*/;
946 /*@constant int CLOCKS_PER_SEC;@*/
948 typedef /*@integraltype@*/ clock_t;
949 typedef /*@integraltype@*/ time_t;
964 clock_t clock (void) /*@modifies internalState@*/ ;
965 double difftime (time_t time1, time_t time0) /*@*/ ;
966 time_t mktime (struct tm *timeptr) /*@*/ ;
968 time_t time (/*@null@*/ /*@out@*/ time_t *tp)
971 /*@observer@*/ char *asctime (struct tm *timeptr)
972 /*@modifies errno*/ /*@ensures MaxSet(result) == 25 /\ MaxRead(result) == 25; @*/ ;
974 /*@observer@*/ char *ctime (time_t *tp) /*@*/
975 /*@ensures MaxSet(result) == 25 /\ MaxRead(result) == 25; @*/;
977 /*@null@*/ /*@observer@*/ struct tm *gmtime (time_t *tp) /*@*/ ;
979 /*@null@*/ /*@observer@*/ struct tm *localtime (time_t *tp)
980 /*@modifies errno@*/ ;
982 size_t strftime (/*@out@*/ char *s, size_t smax,
983 char *fmt, struct tm *timeptr)
987 ** ISO c99: 7.18 Integer types <stdint.h>
991 ** These types are OPTIONAL. Provide warnings on use.
994 typedef /*@integraltype@*/ int8_t
995 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least8_t instead."@*/ ;
997 typedef /*@integraltype@*/ int16_t
998 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least16_t instead."@*/ ;
1000 typedef /*@integraltype@*/ int32_t
1001 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least32_t instead."@*/ ;
1003 typedef /*@integraltype@*/ int64_t
1004 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least64_t instead."@*/ ;
1006 typedef /*@unsignedintegraltype@*/ uint8_t
1007 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least8_t instead."@*/ ;
1009 typedef /*@unsignedintegraltype@*/ uint16_t
1010 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least16_t instead."@*/ ;
1012 typedef /*@unsignedintegraltype@*/ uint32_t
1013 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least32_t instead."@*/ ;
1015 typedef /*@unsignedintegraltype@*/ uint64_t
1016 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least64_t instead."@*/ ;
1018 typedef /*@integraltype@*/ int_least8_t;
1019 typedef /*@integraltype@*/ int_least16_t;
1020 typedef /*@integraltype@*/ int_least32_t;
1021 typedef /*@integraltype@*/ int_least64_t;
1023 typedef /*@unsignedintegraltype@*/ uint_least8_t;
1024 typedef /*@unsignedintegraltype@*/ uint_least16_t;
1025 typedef /*@unsignedintegraltype@*/ uint_least32_t;
1026 typedef /*@unsignedintegraltype@*/ uint_least64_t;
1028 typedef /*@integraltype@*/ int_fast8_t;
1029 typedef /*@integraltype@*/ int_fast16_t;
1030 typedef /*@integraltype@*/ int_fast32_t;
1031 typedef /*@integraltype@*/ int_fast64_t;
1033 typedef /*@unsignedintegraltype@*/ uint_fast8_t;
1034 typedef /*@unsignedintegraltype@*/ uint_fast16_t;
1035 typedef /*@unsignedintegraltype@*/ uint_fast32_t;
1036 typedef /*@unsignedintegraltype@*/ uint_fast64_t;
1038 typedef int *intptr_t
1039 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ;
1041 typedef unsigned int *uintptr_t
1042 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ;
1044 typedef /*@signedintegraltype@*/ intmax_t;
1045 typedef /*@unsignedintegraltype@*/ uintmax_t;
1048 ** What should the types be here?
1051 /*@constant int INT8_MIN@*/
1052 /*@constant int INT16_MIN@*/
1053 /*@constant int INT32_MIN@*/
1054 /*@constant int INT64_MIN@*/
1056 /*@constant int INT8_MAX@*/
1057 /*@constant int INT16_MAX@*/
1058 /*@constant int INT32_MAX@*/
1059 /*@constant int INT64_MAX@*/
1061 /*@constant int UINT8_MIN@*/
1062 /*@constant int UINT16_MIN@*/
1063 /*@constant int UINT32_MIN@*/
1064 /*@constant int UINT64_MIN@*/
1066 /*@constant int INT_LEAST8_MIN@*/
1067 /*@constant int INT_LEAST16_MIN@*/
1068 /*@constant int INT_LEAST32_MIN@*/
1069 /*@constant int INT_LEAST64_MIN@*/
1071 /*@constant int INT_LEAST8_MAX@*/
1072 /*@constant int INT_LEAST16_MAX@*/
1073 /*@constant int INT_LEAST32_MAX@*/
1074 /*@constant int INT_LEAST64_MAX@*/
1076 /*@constant int UINT_LEAST8_MAX@*/
1077 /*@constant int UINT_LEAST16_MAX@*/
1078 /*@constant int UINT_LEAST32_MAX@*/
1079 /*@constant int UINT_LEAST64_MAX@*/
1081 /*@constant int INT_FAST8_MIN@*/
1082 /*@constant int INT_FAST16_MIN@*/
1083 /*@constant int INT_FAST32_MIN@*/
1084 /*@constant int INT_FAST64_MIN@*/
1086 /*@constant int INT_FAST8_MAX@*/
1087 /*@constant int INT_FAST16_MAX@*/
1088 /*@constant int INT_FAST32_MAX@*/
1089 /*@constant int INT_FAST64_MAX@*/
1091 /*@constant int UINT_FAST8_MAX@*/
1092 /*@constant int UINT_FAST16_MAX@*/
1093 /*@constant int UINT_FAST32_MAX@*/
1094 /*@constant int UINT_FAST64_MAX@*/
1096 /*@constant size_t INTPTR_MIN@*/
1097 /*@constant size_t INTPTR_MAX@*/