]> andersk Git - splint.git/blame - lib/standard.h
Added va_copy to standard.h.
[splint.git] / lib / standard.h
CommitLineData
155af98d 1/*
2a3f24b8 2** standard.h --- ISO C99 Standard Library for Splint.
155af98d 3**
4** Process with -DSTRICT to get strict library.
5*/
6
7/*@-nextlinemacros@*/
8/*@+allimponly@*/
9/*@+globsimpmodifiesnothing@*/
10
11/*
12** errno.h
13*/
14
15/*@constant int EDOM;@*/
16/*@constant int ERANGE;@*/
17/*@constant int EILSEQ;@*/
18
19# ifdef STRICT
20/*@checkedstrict@*/ int errno;
21# else
22/*@unchecked@*/ int errno;
23# endif
24
0bd4c301 25/*
26** stdbool.h
27*/
28
29/*@-likelybool@*/
30typedef _Bool bool;
31/*@=likelybool@*/
32/*@constant bool true@*/
33/*@constant bool false@*/
34/*@constant int __bool_true_false_are_defined = 1@*/
35
155af98d 36/*
37** types
38*/
39
40typedef /*@integraltype@*/ ptrdiff_t;
41typedef /*@unsignedintegraltype@*/ size_t;
42typedef /*@signedintegraltype@*/ ssize_t;
43typedef /*@integraltype@*/ wchar_t;
44
45/*
46** Added by Amendment 1 to ISO.
47*/
48
49typedef /*@integraltype@*/ wint_t;
50typedef /*@abstract@*/ mbstate_t;
51
52/*@constant null anytype NULL = 0;@*/
53
54/*
55** assert.h
56*/
57
0bd4c301 58/*@constant _Bool NDEBUG;@*/
155af98d 59
60# ifdef STRICT
0bd4c301 61/*@falseexit@*/ void assert (/*@sef@*/ _Bool e)
155af98d 62 /*@*/ ;
63# else
0bd4c301 64/*@falseexit@*/ void assert (/*@sef@*/ _Bool /*@alt int@*/ e)
155af98d 65 /*@*/ ;
66# endif
67
68
69/*
70** ctype.h
71*/
72
73# ifdef STRICT
0bd4c301 74_Bool isalnum (int c) /*@*/ ;
75_Bool isalpha (int c) /*@*/ ;
76_Bool iscntrl (int c) /*@*/ ;
77_Bool isdigit (int c) /*@*/ ;
78_Bool isgraph (int c) /*@*/ ;
79_Bool islower (int c) /*@*/ ;
80_Bool isprint (int c) /*@*/ ;
81_Bool ispunct (int c) /*@*/ ;
82_Bool isspace (int c) /*@*/ ;
83_Bool isupper (int c) /*@*/ ;
84_Bool isxdigit (int c) /*@*/ ;
155af98d 85char tolower (int c) /*@*/ ;
86char toupper (int c) /*@*/ ;
87# else
88/*
89** evans 2002-01-03: added alt char (was alt unsigned char)
90*/
91
0bd4c301 92_Bool /*@alt int@*/ isalnum (int /*@alt char, unsigned char@*/ c) /*@*/ ;
93_Bool /*@alt int@*/ isalpha (int /*@alt char, unsigned char@*/ c) /*@*/ ;
94_Bool /*@alt int@*/ iscntrl (int /*@alt char, unsigned char@*/ c) /*@*/ ;
95_Bool /*@alt int@*/ isdigit (int /*@alt char, unsigned char@*/ c) /*@*/ ;
96_Bool /*@alt int@*/ isgraph (int /*@alt char, unsigned char@*/ c) /*@*/ ;
97_Bool /*@alt int@*/ islower (int /*@alt char, unsigned char@*/ c) /*@*/ ;
98_Bool /*@alt int@*/ isprint (int /*@alt char, unsigned char@*/ c) /*@*/ ;
99_Bool /*@alt int@*/ ispunct (int /*@alt char, unsigned char@*/ c) /*@*/ ;
100_Bool /*@alt int@*/ isspace (int /*@alt char, unsigned char@*/ c) /*@*/ ;
101_Bool /*@alt int@*/ isupper (int /*@alt char, unsigned char@*/ c) /*@*/ ;
102_Bool /*@alt int@*/ isxdigit (int /*@alt char, unsigned char@*/ c) /*@*/ ;
155af98d 103char /*@alt int@*/ tolower (int /*@alt char, unsigned char@*/ c) /*@*/ ;
104char /*@alt int@*/ toupper (int /*@alt char, unsigned char@*/ c) /*@*/ ;
105# endif
106
107/*
108** locale.h
109*/
110
111struct lconv
112{
113 char *decimal_point;
114 char *thousands_sep;
115 char *grouping;
116 char *int_curr_symbol;
117 char *currency_symbol;
118 char *mon_decimal_point;
119 char *mon_thousands_sep;
120 char *mon_grouping;
121 char *positive_sign;
122 char *negative_sign;
123 char int_frac_digits;
124 char frac_digits;
125 char p_cs_precedes;
126 char p_sep_by_space;
127 char n_cs_precedes;
128 char n_sep_by_space;
129 char p_sign_posn;
130 char n_sign_posn;
131} ;
132
133/*@constant int LC_ALL;@*/
134/*@constant int LC_COLLATE;@*/
135/*@constant int LC_CTYPE;@*/
136/*@constant int LC_MONETARY;@*/
137/*@constant int LC_NUMERIC;@*/
138/*@constant int LC_TIME;@*/
139
140/*@observer@*/ /*@null@*/ char *setlocale (int category, /*@null@*/ char *locale)
141 /*@modifies internalState, errno@*/ ;
142
143struct lconv *localeconv (void) /*@*/ ;
144
145/*
146** float.h
147*/
148
149/*
150** Note, these are defined by macros, but NOT necessarily
151** constants. They may be used as lvalues.
152*/
153
154/*@unchecked@*/ int DBL_DIG;
155/*@unchecked@*/ double DBL_EPSILON;
156/*@unchecked@*/ int DBL_MANT_DIG;
157/*@unchecked@*/ double DBL_MAX;
158/*@unchecked@*/ int DBL_MAX_10_EXP;
159/*@unchecked@*/ int DBL_MAX_EXP;
160/*@unchecked@*/ double DBL_MIN;
161/*@unchecked@*/ int DBL_MIN_10_EXP;
162/*@unchecked@*/ int DBL_MIN_EXP;
163
164/*@unchecked@*/ int FLT_DIG;
165/*@unchecked@*/ float FLT_EPSILON;
166/*@unchecked@*/ int FLT_MANT_DIG;
167/*@unchecked@*/ float FLT_MAX;
168/*@unchecked@*/ int FLT_MAX_10_EXP;
169/*@unchecked@*/ int FLT_MAX_EXP;
170/*@unchecked@*/ float FLT_MIN;
171/*@unchecked@*/ int FLT_MIN_10_EXP;
172/*@unchecked@*/ int FLT_MIN_EXP;
173/*@constant int FLT_RADIX@*/
174/*@unchecked@*/ int FLT_ROUNDS;
175
176/*@unchecked@*/ int LDBL_DIG;
177/*@unchecked@*/ long double LDBL_EPSILON;
178/*@unchecked@*/ int LDBL_MANT_DIG;
179/*@unchecked@*/ long double LDBL_MAX;
180/*@unchecked@*/ int LDBL_MAX_10_EXP;
181/*@unchecked@*/ int LDBL_MAX_EXP;
182/*@unchecked@*/ long double LDBL_MIN;
183/*@unchecked@*/ int LDBL_MIN_10_EXP;
184/*@unchecked@*/ int LDBL_MIN_EXP;
185
186/*
187** limits.h
188*/
189
190/*@constant int CHAR_BIT; @*/
191/*@constant char CHAR_MAX; @*/
192/*@constant char CHAR_MIN; @*/
193/*@constant int INT_MAX; @*/
194/*@constant int INT_MIN; @*/
195/*@constant long int LONG_MAX; @*/
196/*@constant long int LONG_MIN; @*/
197/*@constant long int MB_LEN_MAX@*/
198/*@constant signed char SCHAR_MAX; @*/
199/*@constant signed char SCHAR_MIN; @*/
200/*@constant short SHRT_MAX; @*/
201/*@constant short SHRT_MIN; @*/
202/*@constant unsigned char UCHAR_MAX; @*/
203/*@constant unsigned char UCHAR_MIN; @*/
204/*@constant unsigned int UINT_MAX; @*/
205/*@constant unsigned long ULONG_MAX; @*/
206/*@constant unsigned short USHRT_MAX; @*/
207
208/*
209** math.h
ce7034f0 210**
211** evans 2002-07-03: updated from ISO C99 (http://www.vmunix.com/~gabor/c/draft.html)
155af98d 212*/
213
ce7034f0 214typedef float float_t;
215typedef double double_t;
216
155af98d 217/*@constant double HUGE_VAL; @*/
ce7034f0 218/*@constant float HUGE_VALF; @*/
219/*@constant long double HUGE_VALL; @*/
220
221/*@constant float INFINITY; @*/
222
223/*@constant float NAN; @*/
224 /*:warn implementationoptional "NAN is defined if and only if the implementation supports quiet float type NaNs.":*/ ;
225
226/*@constant int FP_INFINITE;@*/
227/*@constant int FP_NAN;@*/
228/*@constant int FP_NORMAL;@*/
229/*@constant int FP_SUBNORMAL;@*/
230/*@constant int FP_ZERO;@*/
231
232/*@constant int FP_ILOGB0;@*/
233/*@constant int FP_ILOGBNAN;@*/
234
235/*@constant int DECIMAL_DIG;@*/
236
237/* Defined for specs only - this type is any real type */
238typedef float /*@alt double, long double@*/ s_real_t;
239
240int fpclassify (/*@sef@*/ s_real_t) /*@*/ ;
241int signbit (/*@sef@*/ s_real_t) /*@*/ ;
242int isfinite (/*@sef@*/ s_real_t) /*@*/ ;
243int isnormal (/*@sef@*/ s_real_t) /*@*/ ;
244int isnan (/*@sef@*/ s_real_t) /*@*/ ;
245int isinf (/*@sef@*/ s_real_t) /*@*/ ;
155af98d 246
247/*
ce7034f0 248** math functions that may have a range error modify errno (implementation defined).
155af98d 249*/
250
155af98d 251double acos (double x) /*@modifies errno@*/ ;
ce7034f0 252double asin (double x) /*@modifies errno@*/ ;
155af98d 253double atan (double x) /*@*/ ;
254double atan2 (double y, double x) /*@*/ ;
ce7034f0 255
256double cos (double x) /*@*/ ;
257double sin (double x) /*@*/ ;
258double tan (double x) /*@*/ ;
259
155af98d 260double cosh (double x) /*@modifies errno@*/ ;
ce7034f0 261double sinh (double x) /*@modifies errno@*/ ;
155af98d 262double tanh (double x) /*@*/ ;
263
ce7034f0 264double acosh (double x) /*@modifies errno@*/ ;
265double asinh (double x) /*@modifies errno@*/ ;
266double atanh (double x) /*@modifies errno@*/ ;
267
155af98d 268double exp (double x) /*@modifies errno@*/ ;
155af98d 269double frexp (double x, /*@out@*/ int *xp) /*@modifies *xp;@*/ ;
ce7034f0 270double ldexp (double x, int n) /*@modifies errno@*/ ;
155af98d 271
272double log (double x) /*@modifies errno@*/ ;
273double log10 (double x) /*@modifies errno@*/ ;
274
ce7034f0 275double modf (double x, /*@out@*/ double *ip) /*@modifies *ip;@*/ ;
276
277double exp2 (double x) /*@modifies errno@*/ ;
278double expm1 (double x) /*@modifies errno@*/ ;
279double log1p (double x) /*@modifies errno@*/ ;
280double log2 (double x) /*@modifies errno@*/ ;
281double logb (double x) /*@modifies errno@*/ ;
282
283double scalbn (double x, int n) /*@modifies errno@*/ ;
284double scalbln (double x, long int n) /*@modifies errno@*/ ;
285long double scalblnl(long double x, long int n) /*@modifies errno@*/ ;
286
287int ilogb (double x) /*@modifies errno@*/ ;
288int ilogbf (float x) /*@modifies errno@*/ ;
289int ilogbl (long double x) /*@modifies errno@*/ ;
290
291double fabs (double x) /*@*/ ;
292float fabsf (float x) /*@*/ ;
293long double fabsl (long double x) /*@*/ ;
294
155af98d 295double pow (double x, double y) /*@modifies errno@*/ ;
ce7034f0 296float powf(float x, float y) /*@modifies errno@*/ ;
297long double powl(long double x, long double y) /*@modifies errno@*/ ;
298
155af98d 299double sqrt (double x) /*@modifies errno@*/ ;
ce7034f0 300float sqrtf(float x) /*@modifies errno@*/ ;
301long double sqrtl (long double x) /*@modifies errno@*/ ;
302
303double cbrt (double x) /*@*/ ;
304float cbrtf (float x) /*@*/ ;
305long double cbrtl (long double x) /*@*/ ;
306
307double hypot (double x, double y) /*@modifies errno@*/ ;
308float hypotf (float x, float y) /*@modifies errno@*/ ;
309long double hypotl (long double x, long double y) /*@modifies errno@*/ ;
310
311double erf (double x) /*@*/ ;
312double erfc (double x) /*@*/ ;
313float erff (float x) /*@*/ ;
314long double erfl (long double x) /*@*/ ;
315float erfcf (float x) /*@*/ ;
316long double erfcl (long double x) /*@*/ ;
317
318double gamma (double x) /*@modifies errno@*/ ;
319float gammaf(float x) /*@modifies errno@*/ ;
320long double gammal (long double x) /*@modifies errno@*/ ;
321double lgamma (double x) /*@modifies errno@*/ ;
322float lgammaf (float x) /*@modifies errno@*/ ;
323long double lgammal (long double x) /*@modifies errno@*/ ;
155af98d 324
325double ceil (double x) /*@*/ ;
ce7034f0 326float ceilf(float x) /*@*/ ;
327long double ceill(long double x) /*@*/ ;
155af98d 328
ce7034f0 329double floor (double x) /*@*/ ;
330float floorf (float x) /*@*/ ;
331long double floorl (long double x) /*@*/ ;
332
333double nearbyint (double x) /*@*/ ;
334float nearbyintf (float x) /*@*/ ;
335long double nearbyintl (long double x) /*@*/ ;
336
337double rint (double x) /*@*/;
338float rintf (float x) /*@*/ ;
339long double rintl (long double x) /*@*/ ;
340long int lrint (double x) /*@modifies errno@*/ ;
341long int lrintf (float x) /*@modifies errno@*/ ;
342long int lrintl (long double x) /*@modifies errno@*/ ;
343long long llrint (double x) /*@modifies errno@*/ ;
344long long llrintf(float x) /*@modifies errno@*/ ;
345long long llrintl(long double x) /*@modifies errno@*/ ;
346
347double round (double x) /*@*/ ;
348long int lround (double x) /*@modifies errno@*/ ;
349long long llround (double x) /*@modifies errno@*/ ;
350
351double trunc (double x) /*@*/ ;
155af98d 352double fmod (double x, double y) /*@*/ ;
ce7034f0 353double remainder (double x, double y) /*@*/ ;
354double remquo (double x, double y, /*@out@*/ int *quo) /*@modifies *quo@*/ ;
355double copysign (double x, double y) /*@*/ ;
356double nan (/*@nullterminated@*/ const char *tagp) /*@*/ ;
357double nextafter (double x, double y) /*@*/ ;
358double nextafterx (double x, long double y) /*@*/ ;
359
360double fdim (double x, double y) /*@modifies errno@*/ ;
361double fmax (double x, double y) /*@*/ ;
362double fmin (double x, double y) /*@*/ ;
363double fma (double x, double y, double z) /*@*/ ;
364
365int isgreater (s_real_t x, s_real_t y) /*@*/ ;
366int isgreaterequal (s_real_t x, s_real_t y) /*@*/ ;
367int isless (s_real_t x, s_real_t y) /*@*/ ;
368int islessequal (s_real_t x, s_real_t y) /*@*/ ;
369int islessgreater (s_real_t x, s_real_t y) /*@*/ ;
370int isunordered (s_real_t x, s_real_t y) /*@*/ ;
155af98d 371
372/*
373** These functions are optional in iso C. An implementation does not
374** have to provide them. They are included in comments here, but
375** are not required to be part of the standard library.
376*/
377
378# ifdef OPTIONAL_MATH
379
380float acosf (float x) /*@modifies errno@*/ ;
381long double acosl (long double x) /*@modifies errno@*/ ;
382float asinf (float x) /*@modifies errno@*/ ;
383long double asinl (long double x) /*@modifies errno@*/ ;
384float atanf (float x) /*@*/ ;
385long double atanl (long double x) /*@*/ ;
386float atan2f (float y, float x) /*@*/ ;
387long double atan2l (long double y, long double x) /*@*/ ;
388float ceilf (float x) /*@*/ ;
389long double ceill (long double x) /*@*/ ;
390float cosf (float x) /*@*/ ;
391long double cosl (long double x) /*@*/ ;
392float coshf (float x) /*@modifies errno@*/ ;
393long double coshl (long double x) /*@modifies errno@*/ ;
394float expf (float x) /*@modifies errno@*/ ;
395long double expl (long double x) /*@modifies errno@*/;
396float fabsf (float x) /*@*/ ;
397long double fabsl (long double x) /*@*/ ;
398float floorf (float x) /*@*/ ;
399long double floorl (long double x) /*@*/ ;
400float fmodf (float x, float y) /*@*/ ;
401long double fmodl (long double x, long double y) /*@*/ ;
402float frexpf (float x, /*@out@*/ int *xp) /*@modifies *xp@*/;
403long double frexpl (long double x, /*@out@*/ int *xp) /*@modifies *xp@*/;
404float ldexpf (float x, int n) /*@modifies errno@*/ ;
405long double ldexpl (long double x, int n) /*@modifies errno@*/ ;
406float logf (float x) /*@modifies errno@*/ ;
407long double logl (long double x) /*@modifies errno@*/ ;
408float log10f (float x) /*@modifies errno@*/;
409long double log10l (long double x) /*@modifies errno@*/;
410float modff (float x, /*@out@*/ float *xp) /*@modifies *xp@*/ ;
411long double modfl (long double x, /*@out@*/ long double *xp) /*@modifies *xp@*/ ;
412float powf (float x, float y) /*@modifies errno@*/ ;
413long double powl (long double x, long double y) /*@modifies errno@*/ ;
414float sinf (float x) /*@*/ ;
415long double sinl (long double x) /*@*/ ;
416float sinhf (float x) /*@*/ ;
417long double sinhl (long double x) /*@*/ ;
418float sqrtf (float x) /*@modifies errno@*/ ;
419long double sqrtl (long double x) /*@modifies errno@*/ ;
420float tanf (float x) /*@*/ ;
421long double tanl (long double x) /*@*/ ;
422float tanhf (float x) /*@*/ ;
423long double tanhl (long double x) /*@*/ ;
424
425# endif
426
427/*
428** setjmp.h
429*/
430
431typedef /*@abstract@*/ /*@mutable@*/ void *jmp_buf;
432
433int setjmp (/*@out@*/ jmp_buf env) /*@modifies env;@*/ ;
434/*@mayexit@*/ void longjmp (jmp_buf env, int val) /*@*/ ;
435
436/*
437** signal.h
438*/
439
440/*@constant int SIGABRT; @*/
441/*@constant int SIGFPE; @*/
442/*@constant int SIGILL; @*/
443/*@constant int SIGINT; @*/
444/*@constant int SIGSEGV; @*/
445/*@constant int SIGTERM; @*/
446
447typedef /*@integraltype@*/ sig_atomic_t;
448
449/*@constant void (*SIG_DFL)(int); @*/
450/*@constant void (*SIG_ERR)(int); @*/
451/*@constant void (*SIG_IGN)(int); @*/
452
453/*
454** signal takes an int, and a function takes int returns void, and
455** returns the function (or NULL if unsuccessful).
456*/
457
458/*@null@*/ void (*signal (int sig, /*@null@*/ void (*func)(int))) (int)
459 /*@modifies internalState, errno;@*/ ;
460
461/*@mayexit@*/ int raise (int sig) ;
462
463/*
464** stdarg.h
465*/
466
467typedef /*@abstract@*/ /*@mutable@*/ void *va_list;
468
469void va_start (/*@out@*/ va_list ap, ...) /*@modifies ap;@*/ ;
470void va_end (va_list va) /*@modifies va;@*/ ;
471
7ac98eb7 472void va_copy (/*@out@*/ va_list dest, va_list src) /*modifies dest;@*/ ;
473
155af98d 474/*
475** va_arg is builtin
476*/
477
478/*
479** stdio.h
480*/
481
482typedef /*@abstract@*/ /*@mutable@*/ void *FILE;
483typedef /*@abstract@*/ /*@mutable@*/ void *fpos_t;
484
abd7f895 485/*@constant size_t _IOFBF; @*/
486/*@constant size_t _IOLBF; @*/
487/*@constant size_t _IONBF; @*/
488
489/*@constant size_t BUFSIZ; @*/ /* evans 2002-02-27 change suggested by Walter Briscoe */
155af98d 490
155af98d 491/*@constant int EOF; @*/
492
493/*@constant int FOPEN_MAX; @*/
494/*@constant int FILENAME_MAX; @*/
495
496/*@constant int L_tmpnam; @*/
497
498/*@constant int SEEK_CUR; @*/
499/*@constant int SEEK_END; @*/
500/*@constant int SEEK_SET; @*/
501
502/*@constant int TMP_MAX; @*/
503
504# ifdef STRICT
505/*@checked@*/ FILE *stderr;
506/*@checked@*/ FILE *stdin;
507/*@checked@*/ FILE *stdout;
508# else
509/*@unchecked@*/ FILE *stderr;
510/*@unchecked@*/ FILE *stdin;
511/*@unchecked@*/ FILE *stdout;
512# endif
513
514int remove (char *filename) /*@modifies fileSystem, errno@*/ ;
515int rename (char *old, char *new) /*@modifies fileSystem, errno@*/ ;
516
d5047b91 517/*@dependent@*/ /*@null@*/ FILE *tmpfile (void)
518 /*@modifies fileSystem, errno@*/ ;
519
155af98d 520/*@observer@*/ char *
521 tmpnam (/*@out@*/ /*@null@*/ /*@returned@*/ char *s)
522 /*@modifies *s, internalState@*/ ;
523
d5047b91 524int fclose (FILE *stream)
525 /*@modifies *stream, errno, fileSystem;@*/ ;
526
155af98d 527int fflush (/*@null@*/ FILE *stream)
528 /*@modifies *stream, errno, fileSystem;@*/ ;
529
530/*@null@*/ /*@dependent@*/ FILE *fopen (char *filename, char *mode)
531 /*@modifies fileSystem@*/ ;
532
d5047b91 533/*@dependent@*/ /*@null@*/ FILE *freopen (char *filename, char *mode, FILE *stream)
155af98d 534 /*@modifies *stream, fileSystem, errno@*/ ;
535
f9264521 536void setbuf (FILE *stream, /*@null@*/ /*@exposed@*/ /*@out@*/ char *buf)
537 /*@modifies fileSystem, *stream, *buf@*/
538 /*:errorcode != 0*/ ;
539 /*:requires maxSet(buf) >= (BUFSIZ - 1):*/ ;
155af98d 540
f9264521 541int setvbuf (FILE *stream, /*@null@*/ /*@exposed@*/ /*@out@*/ char *buf,
542 int mode, size_t size)
543 /*@modifies fileSystem, *stream, *buf@*/
544 /*@requires maxSet(buf) >= (size - 1) @*/ ;
155af98d 545
546# ifdef STRICT
547/*@printflike@*/
548int fprintf (FILE *stream, char *format, ...)
549 /*@modifies fileSystem, *stream@*/ ;
550# else
551/*@printflike@*/
552int /*@alt void@*/ fprintf (FILE *stream, char *format, ...)
553 /*@modifies fileSystem, *stream@*/ ;
554# endif
555
556/*@scanflike@*/
557int fscanf (FILE *stream, char *format, ...)
f9264521 558 /*@modifies fileSystem, *stream, errno@*/ ;
155af98d 559
560# ifdef STRICT
561/*@printflike@*/
562int printf (char *format, ...)
563 /*@globals stdout@*/
564 /*@modifies fileSystem, *stdout@*/ ;
565# else
566/*@printflike@*/
567int /*@alt void@*/ printf (char *format, ...)
568 /*@globals stdout@*/
569 /*@modifies fileSystem, *stdout@*/ ;
570# endif
571
572/*@scanflike@*/
573int scanf(char *format, ...)
574 /*@globals stdin@*/
f9264521 575 /*@modifies fileSystem, *stdin, errno@*/ ;
576 /*drl added errno 09-19-2001 */ ;
155af98d 577
578# ifdef STRICT
579/*@printflike@*/
580int sprintf (/*@out@*/ char *s, char *format, ...)
f9264521 581 /*@warn bufferoverflowhigh "Buffer overflow possible with sprintf. Recommend using snprintf instead"@*/
155af98d 582 /*@modifies *s@*/ ;
583# else
584/*@printflike@*/
585int /*@alt void@*/ sprintf (/*@out@*/ char *s, char *format, ...)
f9264521 586 /*@warn bufferoverflowhigh "Buffer overflow possible with sprintf. Recommend using snprintf instead"@*/
155af98d 587 /*@modifies *s@*/ ;
588# endif
589
f9264521 590/* evans 2002-07-09: snprintf added to standard.h (from unix.h) */
591/*@printflike@*/
592int snprintf (/*@out@*/ char * restrict s, size_t n, const char * restrict format, ...)
593 /*@modifies s@*/
594 /*@requires maxSet(s) >= (n - 1)@*/ ;
595
155af98d 596/*@scanflike@*/
f9264521 597int sscanf (/*@out@*/ char *s, char *format, ...) /*@modifies errno@*/ ;
155af98d 598 /* modifies extra arguments */
599
600int vprintf (const char *format, va_list arg)
601 /*@globals stdout@*/
602 /*@modifies fileSystem, *stdout@*/ ;
603
604int vfprintf (FILE *stream, char *format, va_list arg)
605 /*@modifies fileSystem, *stream, arg, errno@*/ ;
606
607int vsprintf (/*@out@*/ char *str, const char *format, va_list ap)
608 /*@warn bufferoverflowhigh "Use vsnprintf instead"@*/
609 /*@modifies str@*/ ;
610
611int vsnprintf (/*@out@*/ char *str, size_t size, const char *format, va_list ap)
f9264521 612 /*@requires maxSet(str) >= (size - 1)@*/ /* drl - this was size, size-1 in stdio.h */
155af98d 613 /*@modifies str@*/ ;
614
615int fgetc (FILE *stream)
616 /*@modifies fileSystem, *stream, errno@*/ ;
617
618/*@null@*/ char *
619 fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream)
620 /*@modifies fileSystem, *s, *stream, errno@*/
621 /*@requires maxSet(s) >= (n -1); @*/
622 /*@ensures maxRead(s) <= (n -1) /\ maxRead(s) >= 0; @*/
623 ;
624
625int fputc (int /*@alt char@*/ c, FILE *stream)
626 /*:errorcode EOF:*/
627 /*@modifies fileSystem, *stream, errno@*/ ;
628
629int fputs (char *s, FILE *stream)
630 /*@modifies fileSystem, *stream@*/ ;
631
632/* note use of sef --- stream may be evaluated more than once */
633int getc (/*@sef@*/ FILE *stream)
f9264521 634 /*@modifies fileSystem, *stream, errno@*/ ;
155af98d 635
f9264521 636int getchar (void) /*@globals stdin@*/ /*@modifies fileSystem, *stdin, errno@*/ ;
155af98d 637
638/*@null@*/ char *gets (/*@out@*/ char *s)
639 /*@warn bufferoverflowhigh
640 "Use of gets leads to a buffer overflow vulnerability. Use fgets instead"@*/
641 /*@globals stdin@*/ /*@modifies fileSystem, *s, *stdin, errno@*/ ;
642
643int putc (int /*@alt char@*/ c, /*@sef@*/ FILE *stream)
644 /*:errorcode EOF:*/
f9264521 645 /*@modifies fileSystem, *stream, errno;@*/ ;
155af98d 646
647int putchar (int /*@alt char@*/ c)
648 /*:errorcode EOF:*/
f9264521 649 /*@globals stdout@*/
650 /*@modifies fileSystem, *stdout, errno@*/ ;
155af98d 651
652int puts (const char *s)
653 /*:errorcode EOF:*/
654 /*@globals stdout@*/
f9264521 655 /*@modifies fileSystem, *stdout, errno@*/ ;
155af98d 656
657int ungetc (int /*@alt char@*/ c, FILE *stream)
f9264521 658 /*@modifies fileSystem, *stream@*/ ;
659 /*drl REMOVED errno 09-19-2001*/
155af98d 660
661size_t
662 fread (/*@out@*/ void *ptr, size_t size, size_t nobj, FILE *stream)
f9264521 663 /*@modifies fileSystem, *ptr, *stream, errno@*/
664 /*requires maxSet(ptr) >= (size - 1) @*/
665 /*@ensures maxRead(ptr) == (size - 1) @*/ ;
155af98d 666
667size_t fwrite (void *ptr, size_t size, size_t nobj, FILE *stream)
f9264521 668 /*@modifies fileSystem, *stream, errno@*/
669 /*@requires maxRead(ptr) >= size @*/ ;
155af98d 670
671int fgetpos (FILE *stream, /*@out@*/ fpos_t *pos)
f9264521 672 /*@modifies *pos, errno@*/
673 /*@requires maxSet(pos) >= 0@*/
674 /*@ensures maxRead(pos) >= 0 @*/;
155af98d 675
676int fseek (FILE *stream, long int offset, int whence)
677 /*:errorcode -1:*/
678 /*@modifies fileSystem, *stream, errno@*/ ;
679
680int fsetpos (FILE *stream, fpos_t *pos)
681 /*@modifies fileSystem, *stream, errno@*/ ;
682
683long int ftell(FILE *stream)
684 /*:errorcode -1:*/ /*@modifies errno*/ ;
685
686void rewind (FILE *stream) /*@modifies *stream@*/ ;
687void clearerr (FILE *stream) /*@modifies *stream@*/ ;
688
689int feof (FILE *stream) /*@modifies errno@*/ ;
d5047b91 690
155af98d 691int ferror (FILE *stream) /*@modifies errno@*/ ;
692
693void perror (/*@null@*/ char *s)
694 /*@globals errno, stderr@*/ /*@modifies fileSystem, *stderr@*/ ;
695
696/*
697** stdlib.h
698*/
699
700double atof (char *s) /*@*/ ;
701int atoi (char *s) /*@*/ ;
702long int atol (char *s) /*@*/ ;
703
704double strtod (char *s, /*@null@*/ /*@out@*/ char **endp)
705 /*@modifies *endp, errno@*/ ;
706
707long strtol (char *s, /*@null@*/ /*@out@*/ char **endp, int base)
708 /*@modifies *endp, errno@*/ ;
709
710unsigned long
711 strtoul (char *s, /*@null@*/ /*@out@*/ char **endp, int base)
712 /*@modifies *endp, errno@*/ ;
713
714/*@constant int RAND_MAX; @*/
715int rand (void) /*@modifies internalState@*/ ;
716void srand (unsigned int seed) /*@modifies internalState@*/ ;
717
718/*
719 drl
720 changed 12/29/2000
721*/
722
723/*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/
724 /*@ensures maxSet(result) == (nobj - 1); @*/ ;
725/*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@*/
726 /*@ensures maxSet(result) == (size - 1); @*/ ;
727
728/*end drl changed */
729
730/* 11 June 1997: removed out on return value */
731
732# if 0
733/*@null@*/ /*@only@*/ void *
734 realloc (/*@null@*/ /*@only@*/ /*@special@*/ void *p,
735 size_t size) /*@releases p@*/ /*@modifies *p@*/
736 /*@ensures maxSet(result) == (size - 1) @*/;
737# endif
738
739/*
740** LCLint annotations cannot fully describe realloc. The semantics we
741** want are:
742** realloc returns null: ownership of parameter is not changed
743** realloc returns non-null: ownership of parameter is transferred to return value
744**
745** Otherwise, storage is in the same state before and after the call.
746*/
747
748/*@null@*/ /*@only@*/ void *
749 realloc (/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p, size_t size)
750 /*@modifies *p@*/ /*@ensures maxSet(result) >= (size - 1) @*/;
751
752void free (/*@null@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies p@*/ ;
753
754/*@constant int EXIT_FAILURE; @*/
755/*@constant int EXIT_SUCCESS; @*/
756
757/*@exits@*/ void abort (void) /*@*/ ;
758/*@exits@*/ void exit (int status) /*@*/ ;
759int atexit (void (*func)(void)) /*@modifies internalState@*/ ;
760
761/*@observer@*/ /*@null@*/ char *getenv (char *name) /*@*/ ;
762
763int system (/*@null@*/ char *s) /*@modifies fileSystem@*/ ;
764
765/*@null@*/ /*@dependent@*/ void *
766 bsearch (void *key, void *base,
767 size_t n, size_t size,
768 int (*compar)(void *, void *)) /*@*/ ;
769
770void qsort (void *base, size_t n, size_t size,
771 int (*compar)(void *, void *))
772 /*@modifies *base, errno@*/ ;
773
774int abs (int n) /*@*/ ;
775
776typedef /*@concrete@*/ struct
777{
778 int quot;
779 int rem;
780} div_t ;
781
782div_t div (int num, int denom) /*@*/ ;
783
784long int labs (long int n) /*@*/ ;
785
786typedef /*@concrete@*/ struct
787{
788 long int quot;
789 long int rem;
790} ldiv_t ;
791
792ldiv_t ldiv (long num, long denom) /*@*/ ;
793
794/*@constant size_t MB_CUR_MAX; @*/
795
796/*
797** wchar_t and wint_t functions added by Amendment 1 to ISO.
798*/
799
800/*@constant int WCHAR_MAX@*/
801/*@constant int WCHAR_MIN@*/
802/*@constant wint_t WEOF@*/
803
804wint_t btowc (int c) /*@*/ ;
805
806wint_t fgetwc (FILE *fp) /*@modifies fileSystem, *fp*/ ;
807
808/*@null@*/ wchar_t *fgetws (/*@returned@*/ wchar_t *s, int n, FILE *stream)
809 /*@modifies fileSystem, *s, *stream@*/;
810
811wint_t fputwc (wchar_t c, FILE *stream)
812 /*@modifies fileSystem, *stream@*/;
813
814int fputws (const wchar_t *s, FILE *stream)
815 /*@modifies fileSystem, *stream@*/ ;
816
817int fwide (FILE *stream, int mode) /*@*/ ;
818 /* does not modify the stream */
819
820/*@printflike@*/ int fwprintf (FILE *stream, const wchar_t *format, ...)
821 /*@modifies *stream, fileSystem@*/ ;
822
823/*@scanflike@*/ int fwscanf (FILE *stream, const wchar_t *format, ...)
824 /*@modifies *stream, fileSystem@*/ ;
825
826/* note use of sef --- stream may be evaluated more than once */
827wint_t getwc (/*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ;
828
829wint_t getwchar (void) /*@modifies fileSystem, *stdin@*/;
830
831size_t mbrlen (const char *s, size_t n, /*@null@*/ mbstate_t *ps) /*@*/ ;
832
833size_t mbrtowc (/*@null@*/ wchar_t *pwc, const char *s, size_t n,
834 /*@null@*/ mbstate_t *ps)
835 /*@modifies *pwc@*/ ;
836
837int mbsinit (/*@null@*/ const mbstate_t *ps) /*@*/ ;
838
839size_t mbsrtowcs (/*@null@*/ wchar_t *dst, const char **src, size_t len,
840 /*@null@*/ mbstate_t *ps)
841 /*@modifies *dst@*/ ;
842
843/* note use of sef --- stream may be evaluated more than once */
844wint_t putwc (wchar_t c, /*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ;
845
846wint_t putwchar (wchar_t c) /*@modifies fileSystem, *stdout@*/ ;
847
848/*@printflike@*/ int swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
849 /*@modifies *s@*/ ;
850
851/*@scanflike@*/ int swscanf (const wchar_t *s, const wchar_t *format, ...)
852 /*@modifies *stdin@*/ ;
853
854wint_t ungetwc (wint_t c, FILE *stream) /*@modifies fileSystem, *stream@*/ ;
855
856int vfwprintf (FILE *stream, const wchar_t *format, va_list arg)
857 /*@modifies fileSystem, *stream@*/ ;
858
859int vswprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg)
860 /*@modifies *s@*/ ;
861
862int vwprintf (const wchar_t *format, va_list arg)
863 /*@modifies fileSystem, *stdout@*/ ;
864
865size_t wcrtomb (/*@null@*/ /*@out@*/ char *s, wchar_t wc, /*@null@*/ mbstate_t *ps)
866 /*@modifies *s@*/;
867
868void /*@alt wchar_t *@*/
869 wcscat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2)
870 /*@modifies *s1@*/ ;
871
872/*@exposed@*/ /*@null@*/ wchar_t *
873 wcschr (/*@returned@*/ const wchar_t *s, wchar_t c)
874 /*@*/ ;
875
876int wcscmp (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
877
878int wcscoll (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
879
880void /*@alt wchar_t *@*/
881 wcscpy (/*@unique@*/ /*@out@*/ /*@returned@*/ wchar_t *s1, const wchar_t *s2)
882 /*@modifies *s1@*/ ;
883
884size_t wcscspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
885
886size_t wcsftime (/*@out@*/ wchar_t *s, size_t maxsize, const wchar_t *format,
887 const struct tm *timeptr)
888 /*@modifies *s@*/ ;
889
890size_t wcslen (const wchar_t *s) /*@*/ ;
891
892void /*@alt wchar_t *@*/
893 wcsncat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2,
894 size_t n)
895 /*@modifies *s1@*/ ;
896
897int wcsncmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ;
898
899void /*@alt wchar_t *@*/
900 wcsncpy (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2,
901 size_t n)
902 /*@modifies *s1@*/ ;
903
904/*@null@*/ wchar_t *
905 wcspbrk (/*@returned@*/ const wchar_t *s1, const wchar_t *s2)
906 /*@*/ ;
907
908/*@null@*/ wchar_t *
909 wcsrchr (/*@returned@*/ const wchar_t *s, wchar_t c)
910 /*@*/ ;
911
912size_t
913 wcsrtombs (/*@null@*/ char *dst, const wchar_t **src, size_t len,
914 /*@null@*/ mbstate_t *ps)
915 /*@modifies *src@*/ ;
916
917size_t wcsspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
918
919/*@null@*/ wchar_t *wcsstr (const wchar_t *s1, const wchar_t *s2) /*@*/ ;
920
921double wcstod (const wchar_t *nptr, /*@null@*/ wchar_t **endptr)
922 /*@modifies *endptr@*/ ;
923
924/*@null@*/ wchar_t *
925 wcstok (/*@null@*/ wchar_t *s1, const wchar_t *s2, wchar_t **ptr)
926 /*@modifies *ptr@*/;
927
928long wcstol (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base)
929 /*@modifies *endptr@*/;
930
931unsigned long
932 wcstoul (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base)
933 /*@modifies *endptr@*/;
934
935size_t
936 wcsxfrm (/*@null@*/ wchar_t *s1, const wchar_t *s2, size_t n)
937 /*@modifies *s1@*/;
938
939int wctob (wint_t c) /*@*/;
940
941/*@null@*/ wchar_t *wmemchr (const wchar_t *s, wchar_t c, size_t n) /*@*/ ;
942
943int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ;
944
945wchar_t *wmemcpy (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n)
946 /*@modifies *s1@*/;
947
948wchar_t *wmemmove (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n)
949 /*@modifies *s1@*/;
950
951wchar_t *wmemset (/*@returned@*/ wchar_t *s, wchar_t c, size_t n)
952 /*@modifies *s@*/;
953
954/*@printflike@*/ int wprintf (const wchar_t *format, ...)
955 /*@globals stdout@*/ /*@modifies errno, *stdout@*/;
956
957/*@scanflike@*/ int
958 wscanf (const wchar_t *format, ...)
959 /*@globals stdin@*/ /*@modifies errno, *stdin@*/;
960
961/*
962** wctype.h (added by Amendment 1)
963*/
964
965/* Warning: not sure about these (maybe abstract?): */
966typedef /*@integraltype@*/ wctype_t;
967typedef /*@integraltype@*/ wctrans_t;
968
969# ifdef STRICT
0bd4c301 970_Bool iswalnum (wint_t c) /*@*/ ;
971_Bool iswalpha (wint_t c) /*@*/ ;
972_Bool iswcntrl (wint_t c) /*@*/ ;
973_Bool iswctype (wint_t c, wctype_t ctg) /*@*/ ;
974_Bool iswdigit (wint_t c) /*@*/ ;
975_Bool iswgraph (wint_t c) /*@*/ ;
976_Bool iswlower (wint_t c) /*@*/ ;
977_Bool iswprint (wint_t c) /*@*/ ;
978_Bool iswpunct (wint_t c) /*@*/ ;
979_Bool iswspace (wint_t c) /*@*/ ;
980_Bool iswupper (wint_t c) /*@*/ ;
981_Bool iswxdigit (wint_t c) /*@*/ ;
155af98d 982
983wint_t towctrans (wint_t c, wctrans_t ctg) /*@*/ ;
984wint_t towlower (wint_t c) /*@*/ ;
985wint_t towupper (wint_t c) /*@*/ ;
986# else
0bd4c301 987_Bool /*@alt int@*/ iswalnum (wint_t c) /*@*/ ;
988_Bool /*@alt int@*/ iswalpha (wint_t c) /*@*/ ;
989_Bool /*@alt int@*/ iswcntrl (wint_t c) /*@*/ ;
990_Bool /*@alt int@*/ iswctype (wint_t c, wctype_t ctg) /*@*/ ;
991_Bool /*@alt int@*/ iswdigit (wint_t c) /*@*/ ;
992_Bool /*@alt int@*/ iswgraph (wint_t c) /*@*/ ;
993_Bool /*@alt int@*/ iswlower (wint_t c) /*@*/ ;
994_Bool /*@alt int@*/ iswprint (wint_t c) /*@*/ ;
995_Bool /*@alt int@*/ iswpunct (wint_t c) /*@*/ ;
996_Bool /*@alt int@*/ iswspace (wint_t c) /*@*/ ;
997_Bool /*@alt int@*/ iswupper (wint_t c) /*@*/ ;
998_Bool /*@alt int@*/ iswxdigit (wint_t c) /*@*/ ;
155af98d 999
1000wint_t /*@alt int@*/ towctrans (wint_t c, wctrans_t ctg) /*@*/ ;
1001wint_t /*@alt int@*/ towlower (wint_t c) /*@*/ ;
1002wint_t /*@alt int@*/ towupper (wint_t c) /*@*/ ;
1003# endif
1004
1005wctrans_t wctrans (const char *property) /*@*/ ;
1006wctype_t wctype (const char *property) /*@*/ ;
1007
1008int mblen (char *s, size_t n) /*@*/ ;
1009int mbtowc (/*@null@*/ wchar_t *pwc, /*@null@*/ char *s, size_t n)
1010 /*@modifies *pwc@*/ ;
1011int wctomb (/*@out@*/ /*@null@*/ char *s, wchar_t wchar)
1012 /*@modifies *s@*/ ;
1013size_t mbstowcs (/*@out@*/ wchar_t *pwcs, char *s, size_t n)
1014 /*@modifies *pwcs@*/ ;
1015size_t wcstombs (/*@out@*/ char *s, wchar_t *pwcs, size_t n)
1016 /*@modifies *s@*/ ;
1017
1018/*
1019** string.h
1020*/
1021
1022void /*@alt void * @*/
1023 memcpy (/*@unique@*/ /*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n)
1024 /*@modifies *s1@*/
1025 /*@requires maxRead(s2) >= (n - 1) /\ maxSet(s1) >= (n - 1); @*/
1026 ;
1027
1028void /*@alt void * @*/
1029 memmove (/*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n)
1030 /*@modifies *s1@*/
1031 /*@requires maxRead(s2) >= (n - 1) /\ maxSet(s1) >= (n - 1); @*/
1032 ;
1033
1034
1035 /* drl
1036 modifed 12/29/2000
1037 */
1038
1039void /*@alt char * @*/
1040 strcpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2)
1041 /*@modifies *s1@*/
1042 /*@requires maxSet(s1) >= maxRead(s2) @*/
1043 /*@ensures maxRead(s1) == maxRead (s2) /\ maxRead(result) == maxRead(s2) /\ maxSet(result) == maxSet(s1); @*/;
1044
1045void /*@alt char * @*/
1046 strncpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2, size_t n)
b87215ab 1047 /*@modifies *s1@*/
1048 /*@requires maxSet(s1) >= ( n - 1 ); @*/
1049 /*@ensures maxRead (s2) >= maxRead(s1) /\ maxRead (s1) <= n; @*/ ;
155af98d 1050
1051void /*@alt char * @*/
1052 strcat (/*@unique@*/ /*@returned@*/ char *s1, char *s2)
1053 /*@modifies *s1@*/ /*@requires maxSet(s1) >= (maxRead(s1) + maxRead(s2) );@*/
1054 /*@ensures maxRead(result) == (maxRead(s1) + maxRead(s2) );@*/;
1055
1056void /*@alt char * @*/
1057 strncat (/*@unique@*/ /*@returned@*/ char *s1, char *s2, size_t n)
1058 /*@modifies *s1@*/
1059 /*@requires maxSet(s1) >= ( maxRead(s1) + n); @*/
1060 /*@ensures maxRead(s1) >= (maxRead(s1) + n); @*/;
1061
1062 /*drl end*/
1063
1064int memcmp (void *s1, void *s2, size_t n) /*@*/ ;
1065int strcmp (char *s1, char *s2) /*@*/ ;
1066int strcoll (char *s1, char *s2) /*@*/ ;
1067int strncmp (char *s1, char *s2, size_t n) /*@*/ ;
1068size_t strxfrm (/*@out@*/ /*@null@*/ char *s1, char *s2, size_t n)
1069 /*@modifies *s1@*/ ; /* s1 may be null only if n == 0 */
1070
1071/*@null@*/ void *memchr (void *s, int c, size_t n) /*@*/ ;
1072
1073# ifdef STRICT
1074/*@exposed@*/ /*@null@*/ char *
1075strchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ;
1076# else
1077/*@exposed@*/ /*@null@*/ char *
1078 strchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0; @*/ ;
1079# endif
1080
1081size_t strcspn (char *s1, char *s2) /*@*/ ;
1082/*@null@*/ /*@exposed@*/ char *
1083 strpbrk (/*@returned@*/ char *s, char *t) /*@*/ ;
1084
1085# ifdef STRICT
1086/*@null@*/ /*@exposed@*/ char *
1087 strrchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ;
1088# else
1089/*@null@*/ /*@exposed@*/ char *
1090 strrchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ;
1091# endif
1092
1093size_t strspn (char *s, char *t) /*@*/ ;
1094
1095/*@null@*/ /*@exposed@*/ char *
2a3f24b8 1096 strstr (/*@returned@*/ const char *s, const char *t) /*@*/
155af98d 1097 /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 /\ maxRead(result) >= maxRead(t) /\ maxSet(result) >= maxRead(t)@*/ ;
1098
1099/*@null@*/ /*@exposed@*/ char *
1100 strtok (/*@returned@*/ /*@null@*/ char *s, char *t)
1101 /*@modifies *s, internalState, errno@*/ ;
1102
1103void /*@alt void *@*/ memset (/*@out@*/ /*@returned@*/ void *s,
1104 int c, size_t n)
1105 /*@modifies *s@*/ /*@requires maxSet(s) >= (n - 1) @*/ /*@ensures maxRead(s) >= (n - 1) @*/ ;
1106
1107/*@observer@*/ char *strerror (int errnum) /*@*/ ;
1108
1109/*drl */
1110size_t strlen (char *s) /*@*/ /*@ensures result == maxRead(s); @*/;
1111
1112/*
1113** time.h
1114*/
1115
1116/*@constant int CLOCKS_PER_SEC;@*/
1117
1118typedef /*@integraltype@*/ clock_t;
1119typedef /*@integraltype@*/ time_t;
1120
1121struct tm
1122 {
1123 int tm_sec;
1124 int tm_min;
1125 int tm_hour;
1126 int tm_mday;
1127 int tm_mon;
1128 int tm_year;
1129 int tm_wday;
1130 int tm_yday;
1131 int tm_isdst;
1132 } ;
1133
1134clock_t clock (void) /*@modifies internalState@*/ ;
1135double difftime (time_t time1, time_t time0) /*@*/ ;
1136time_t mktime (struct tm *timeptr) /*@*/ ;
1137
1138time_t time (/*@null@*/ /*@out@*/ time_t *tp)
1139 /*@modifies *tp@*/ ;
1140
1141/*@observer@*/ char *asctime (struct tm *timeptr)
1142 /*@modifies errno*/ /*@ensures maxSet(result) == 25 /\ maxRead(result) == 25; @*/ ;
1143
1144/*@observer@*/ char *ctime (time_t *tp) /*@*/
1145 /*@ensures maxSet(result) == 25 /\ maxRead(result) == 25; @*/;
1146
11c40ce9 1147/* 2003-11-01: remove null annotation: gmtima and localtime cannot return null */
1148/*@observer@*/ struct tm *gmtime (time_t *tp) /*@*/ ;
155af98d 1149
11c40ce9 1150/*@observer@*/ struct tm *localtime (time_t *tp)
155af98d 1151 /*@modifies errno@*/ ;
1152
1153size_t strftime (/*@out@*/ char *s, size_t smax,
1154 char *fmt, struct tm *timeptr)
1155 /*@modifies *s@*/ ;
1156
1157/*
1158** ISO c99: 7.18 Integer types <stdint.h>
1159*/
1160
1161/*
1162** These types are OPTIONAL. Provide warnings on use.
1163*/
1164
1165typedef /*@integraltype@*/ int8_t
1166 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least8_t instead."@*/ ;
1167
1168typedef /*@integraltype@*/ int16_t
1169 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least16_t instead."@*/ ;
1170
1171typedef /*@integraltype@*/ int32_t
1172 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least32_t instead."@*/ ;
1173
1174typedef /*@integraltype@*/ int64_t
1175 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least64_t instead."@*/ ;
1176
1177typedef /*@unsignedintegraltype@*/ uint8_t
1178 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least8_t instead."@*/ ;
1179
1180typedef /*@unsignedintegraltype@*/ uint16_t
1181 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least16_t instead."@*/ ;
1182
1183typedef /*@unsignedintegraltype@*/ uint32_t
1184 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least32_t instead."@*/ ;
1185
1186typedef /*@unsignedintegraltype@*/ uint64_t
1187 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least64_t instead."@*/ ;
1188
1189typedef /*@integraltype@*/ int_least8_t;
1190typedef /*@integraltype@*/ int_least16_t;
1191typedef /*@integraltype@*/ int_least32_t;
1192typedef /*@integraltype@*/ int_least64_t;
1193
1194typedef /*@unsignedintegraltype@*/ uint_least8_t;
1195typedef /*@unsignedintegraltype@*/ uint_least16_t;
1196typedef /*@unsignedintegraltype@*/ uint_least32_t;
1197typedef /*@unsignedintegraltype@*/ uint_least64_t;
1198
1199typedef /*@integraltype@*/ int_fast8_t;
1200typedef /*@integraltype@*/ int_fast16_t;
1201typedef /*@integraltype@*/ int_fast32_t;
1202typedef /*@integraltype@*/ int_fast64_t;
1203
1204typedef /*@unsignedintegraltype@*/ uint_fast8_t;
1205typedef /*@unsignedintegraltype@*/ uint_fast16_t;
1206typedef /*@unsignedintegraltype@*/ uint_fast32_t;
1207typedef /*@unsignedintegraltype@*/ uint_fast64_t;
1208
1209typedef int *intptr_t
1210 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ;
1211
1212typedef unsigned int *uintptr_t
1213 /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ;
1214
1215typedef /*@signedintegraltype@*/ intmax_t;
1216typedef /*@unsignedintegraltype@*/ uintmax_t;
1217
1218/*
1219** What should the types be here?
1220*/ /*#*/
1221
1222/*@constant int INT8_MIN@*/
1223/*@constant int INT16_MIN@*/
1224/*@constant int INT32_MIN@*/
1225/*@constant int INT64_MIN@*/
1226
1227/*@constant int INT8_MAX@*/
1228/*@constant int INT16_MAX@*/
1229/*@constant int INT32_MAX@*/
1230/*@constant int INT64_MAX@*/
1231
1232/*@constant int UINT8_MIN@*/
1233/*@constant int UINT16_MIN@*/
1234/*@constant int UINT32_MIN@*/
1235/*@constant int UINT64_MIN@*/
1236
1237/*@constant int INT_LEAST8_MIN@*/
1238/*@constant int INT_LEAST16_MIN@*/
1239/*@constant int INT_LEAST32_MIN@*/
1240/*@constant int INT_LEAST64_MIN@*/
1241
1242/*@constant int INT_LEAST8_MAX@*/
1243/*@constant int INT_LEAST16_MAX@*/
1244/*@constant int INT_LEAST32_MAX@*/
1245/*@constant int INT_LEAST64_MAX@*/
1246
1247/*@constant int UINT_LEAST8_MAX@*/
1248/*@constant int UINT_LEAST16_MAX@*/
1249/*@constant int UINT_LEAST32_MAX@*/
1250/*@constant int UINT_LEAST64_MAX@*/
1251
1252/*@constant int INT_FAST8_MIN@*/
1253/*@constant int INT_FAST16_MIN@*/
1254/*@constant int INT_FAST32_MIN@*/
1255/*@constant int INT_FAST64_MIN@*/
1256
1257/*@constant int INT_FAST8_MAX@*/
1258/*@constant int INT_FAST16_MAX@*/
1259/*@constant int INT_FAST32_MAX@*/
1260/*@constant int INT_FAST64_MAX@*/
1261
1262/*@constant int UINT_FAST8_MAX@*/
1263/*@constant int UINT_FAST16_MAX@*/
1264/*@constant int UINT_FAST32_MAX@*/
1265/*@constant int UINT_FAST64_MAX@*/
1266
1267/*@constant size_t INTPTR_MIN@*/
1268/*@constant size_t INTPTR_MAX@*/
This page took 0.219455 seconds and 5 git commands to generate.