| 1 | /* The header string.h defines one macro for manipulating arrays
|
|---|
| 2 | * of character type and other objects treated as arrays of character type.
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #ifndef _STRING_
|
|---|
| 6 | #define _STRING_
|
|---|
| 7 |
|
|---|
| 8 | #include <stddef.h>
|
|---|
| 9 | #pragma CIVL ACSL
|
|---|
| 10 | /* copies n characters from the object pointed to by s2 into the
|
|---|
| 11 | object pointed to by s1. If copying takes place between objects that overlap,
|
|---|
| 12 | the behavior is undefined. */
|
|---|
| 13 | void* memcpy (void *p, const void *q, size_t size);
|
|---|
| 14 |
|
|---|
| 15 | /* Copy n bytes of src to dest, guaranteeing
|
|---|
| 16 | correct behavior for overlapping strings. */
|
|---|
| 17 | void* memmove (void *dest, const void *src, size_t n);
|
|---|
| 18 |
|
|---|
| 19 | /* copies the value of c into each of the first
|
|---|
| 20 | characters of the object pointed to by s */
|
|---|
| 21 | /*@ depends_on \access(s);
|
|---|
| 22 | @ executes_when \true;
|
|---|
| 23 | @*/
|
|---|
| 24 | $system void * memset(void *s, int c, size_t n);
|
|---|
| 25 |
|
|---|
| 26 | /* Compare N bytes of S1 and S2. */
|
|---|
| 27 | int memcmp(const void *s1, const void *s2, size_t n);
|
|---|
| 28 |
|
|---|
| 29 | /* Search N bytes of S for C. */
|
|---|
| 30 | void* memchr (const void * s, int c, size_t n);
|
|---|
| 31 |
|
|---|
| 32 | /* copies the string pointed to by s2 (including the terminating null character)
|
|---|
| 33 | into the array pointed to by s1. If copying takes place between objects that
|
|---|
| 34 | overlap, the behavior is undefined. */
|
|---|
| 35 | /*@ depends_on \access(s1, s2);
|
|---|
| 36 | @ executes_when \true;
|
|---|
| 37 | @*/
|
|---|
| 38 | $system char *strcpy(char * restrict s1, const char * restrict s2);
|
|---|
| 39 |
|
|---|
| 40 | /* Copy no more than N characters of SRC to DEST. */
|
|---|
| 41 | char *strncpy(char *dest, const char *src, size_t n);
|
|---|
| 42 |
|
|---|
| 43 | /* Append SRC onto DEST. */
|
|---|
| 44 | $system char *strcat (char *dest, const char *src);
|
|---|
| 45 |
|
|---|
| 46 | /* Append no more than N characters from SRC onto DEST. */
|
|---|
| 47 | char *strncat (char *dest, const char *src, size_t n);
|
|---|
| 48 |
|
|---|
| 49 | /* Compare S1 and S2 */
|
|---|
| 50 | /*@ depends_on \access(s1, s2);
|
|---|
| 51 | @ executes_when \true;
|
|---|
| 52 | @*/
|
|---|
| 53 | $system int strcmp(const char *s1, const char *s2);
|
|---|
| 54 |
|
|---|
| 55 | /* Compare N characters of S1 and S2 */
|
|---|
| 56 | int strncmp(const char *s1, const char *s2, size_t n);
|
|---|
| 57 |
|
|---|
| 58 | /* Compare the collated forms of S1 and S2 */
|
|---|
| 59 | int strcoll(const char *s1, const char *s2);
|
|---|
| 60 |
|
|---|
| 61 | /* Put a transformation of SRC into no more than N bytes of DEST. */
|
|---|
| 62 | size_t strxfrm(char *dest, const char *src, size_t n);
|
|---|
| 63 |
|
|---|
| 64 | /* Find the first occurrence of C in S. */
|
|---|
| 65 | char *strchr (const char * s, int c);
|
|---|
| 66 |
|
|---|
| 67 | /* Find the last occurrence of C in S. */
|
|---|
| 68 | char *strrchr (const char * s, int c);
|
|---|
| 69 |
|
|---|
| 70 | /* Return the length of the initial segment of S which
|
|---|
| 71 | consists entirely of characters not in REJECT. */
|
|---|
| 72 | size_t strcspn(const char *s, const char *reject);
|
|---|
| 73 |
|
|---|
| 74 | /* Return the length of the initial segment of S which
|
|---|
| 75 | consists entirely of characters in ACCEPT. */
|
|---|
| 76 | size_t strspn (const char *s, const char *accept);
|
|---|
| 77 |
|
|---|
| 78 | /* Find the first occurrence in S of any character in ACCEPT. */
|
|---|
| 79 | char *strpbrk (const char *s, const char *accept);
|
|---|
| 80 |
|
|---|
| 81 | /* Find the first occurrence of S2 in S1. */
|
|---|
| 82 | $system char * strstr (const char *s1, const char *s2);
|
|---|
| 83 |
|
|---|
| 84 | /* Divide S into tokens separated by characters in DELIM. */
|
|---|
| 85 | char * strtok (char *s, const char *delim);
|
|---|
| 86 |
|
|---|
| 87 | /* computes the length of the string pointed to by s. */
|
|---|
| 88 | /*@ depends_on \access(s);
|
|---|
| 89 | @ executes_when \true;
|
|---|
| 90 | @*/
|
|---|
| 91 | $system size_t strlen(const char *s);
|
|---|
| 92 |
|
|---|
| 93 | /* Return a string describing the meaning of the `errno' code in ERRNUM. */
|
|---|
| 94 | char * strerror(int errnum);
|
|---|
| 95 |
|
|---|
| 96 | #endif
|
|---|