]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/string.h
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / Include / string.h
diff --git a/StdLib/Include/string.h b/StdLib/Include/string.h
deleted file mode 100644 (file)
index 0c80944..0000000
+++ /dev/null
@@ -1,493 +0,0 @@
-/** @file\r
-    The header <string.h> declares one type and several functions, and defines\r
-    one macro useful for manipulating arrays of character type and other objects\r
-    treated as arrays of character type.  Various methods are used for\r
-    determining the lengths of the arrays, but in all cases a char * or void *\r
-    argument points to the initial (lowest addressed) character of the array. If\r
-    an array is accessed beyond the end of an object, the behavior is undefined.\r
-\r
-    Where an argument declared as size_t n specifies the length of the array for\r
-    a function, n can have the value zero on a call to that function. Unless\r
-    explicitly stated otherwise in the description of those functions, pointer\r
-    arguments on such a call must still have valid values.\r
-\r
-    For all functions declared in this header, each character shall be\r
-    interpreted as if it had the type unsigned char (and therefore every possible\r
-    object representation is valid and has a different value).\r
-\r
-    The following macros are defined in this file:<BR>\r
-    @verbatim\r
-      NULL\r
-      bcopy(a,b,c)    ( memcpy((void *)b, (const void *)a, (size_t)c))\r
-      bcmp(a,b,c)     ( memcmp((void *)a, (void *)b, (size_t)c))\r
-    @endverbatim\r
-\r
-    The following types are defined in this file:<BR>\r
-    @verbatim\r
-      size_t      Unsigned integer type of the result of the sizeof operator.\r
-    @endverbatim\r
-\r
-    The following functions are declared in this file:<BR>\r
-    @verbatim\r
-      ################ Copying Functions\r
-      void     *memcpy      (void * __restrict s1, const void * __restrict s2, size_t n);\r
-      void     *memmove     (void *s1, const void *s2, size_t n);\r
-      char     *strcpy      (char * __restrict s1, const char * __restrict s2);\r
-      char     *strncpy     (char * __restrict s1, const char * __restrict s2, size_t n);\r
-      int       strncpyX    (char * __restrict s1, const char * __restrict s2, size_t n);\r
-\r
-      ################ Concatenation Functions\r
-      char     *strcat      (char * __restrict s1, const char * __restrict s2);\r
-      char     *strncat     (char * __restrict s1, const char * __restrict s2, size_t n);\r
-      int       strncatX    (char * __restrict s1, const char * __restrict s2, size_t n);\r
-\r
-      ################ Comparison Functions\r
-      int       memcmp      (const void *s1, const void *s2, size_t n);\r
-      int       strcmp      (const char *s1, const char *s2);\r
-      int       strcoll     (const char *s1, const char *s2);\r
-      int       strncmp     (const char *s1, const char *s2, size_t n);\r
-      size_t    strxfrm     (char * __restrict s1, const char * __restrict s2, size_t n);\r
-\r
-      ################ Search Functions\r
-      void     *memchr      (const void *s, int c, size_t n);\r
-      char     *strchr      (const char *s, int c);\r
-      size_t    strcspn     (const char *s1, const char *s2);\r
-      char     *strpbrk     (const char *s1, const char *s2);\r
-      char     *strrchr     (const char *s, int c);\r
-      size_t    strspn      (const char *s1 , const char *s2);\r
-      char     *strstr      (const char *s1 , const char *s2);\r
-      char     *strtok      (char * __restrict s1, const char * __restrict s2);\r
-\r
-      ################ Miscellaneous Functions\r
-      void     *memset      (void *s, int c, size_t n);\r
-      char     *strerror    (int num);\r
-      size_t    strlen      (const char *);\r
-\r
-      ################ BSD Compatibility Functions\r
-      char     *strdup      (const char *);\r
-      int       strerror_r  (int, char *, size_t);\r
-      int       strcasecmp  (const char *s1, const char *s2);\r
-      void     *memccpy     (void *, const void *, int, size_t);\r
-      int       strncasecmp (const char *s1, const char *s2, size_t n);\r
-      size_t    strlcpy     (char *destination, const char *source, size_t size);\r
-      size_t    strlcat     (char *destination, const char *source, size_t size);\r
-      char     *strsep      (register char **stringp, register const char *delim);\r
-    @endverbatim\r
-\r
-    Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
-    This program and the accompanying materials are licensed and made available under\r
-    the terms and conditions of the BSD License that accompanies this distribution.\r
-    The full text of the license may be found at\r
-    http://opensource.org/licenses/bsd-license.\r
-\r
-    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#ifndef _STRING_H\r
-#define _STRING_H\r
-#include  <sys/EfiCdefs.h>\r
-\r
-#ifdef _EFI_SIZE_T_\r
-  typedef _EFI_SIZE_T_  size_t;\r
-  #undef _EFI_SIZE_T_\r
-  #undef _BSD_SIZE_T_\r
-#endif\r
-\r
-__BEGIN_DECLS\r
-\r
-/* ################   Copying Functions   ################################# */\r
-\r
-/** The memcpy function copies N characters from the object pointed to by Src\r
-    into the object pointed to by Dest. If copying takes place between objects\r
-    that overlap, the behavior is undefined.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the copy operation.\r
-    @param[in]    Src   Pointer to the Source data to be copied.\r
-    @param[in]    N     Number of characters (bytes) to be copied.\r
-\r
-    @return   The memcpy function returns the value of Dest.\r
-**/\r
-void     *memcpy(void * __restrict Dest, const void * __restrict Src, size_t N);\r
-\r
-/** The memmove function copies N characters from the object pointed to by Src\r
-    into the object pointed to by Dest. Copying takes place as if the N\r
-    characters from the object pointed to by Src are first copied into a\r
-    temporary array of N characters that does not overlap the objects pointed\r
-    to by Dest and Src, and then the N characters from the temporary array are\r
-    copied into the object pointed to by Dest.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the copy operation.\r
-    @param[in]    Src   Pointer to the Source data to be copied.\r
-    @param[in]    N     Number of characters (bytes) to be copied.\r
-\r
-    @return   The memmove function returns the value of Dest.\r
-**/\r
-void     *memmove(void *Dest, const void *Src, size_t N);\r
-\r
-/** The strcpy function copies the string pointed to by Src (including the\r
-    terminating null character) into the array pointed to by Dest. If copying\r
-    takes place between objects that overlap, the behavior is undefined.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the copy operation.\r
-    @param[in]    Src   Pointer to the Source data to be copied.\r
-\r
-    @return   The strcpy function returns the value of Dest.\r
-**/\r
-char     *strcpy(char * __restrict Dest, const char * __restrict Src);\r
-\r
-/** The strncpy function copies not more than N characters (characters that\r
-    follow a null character are not copied) from the array pointed to by Src to\r
-    the array pointed to by Dest. If copying takes place between objects that\r
-    overlap, the behavior is undefined.\r
-\r
-    If the array pointed to by Src is a string that is shorter than N\r
-    characters, null characters are appended to the copy in the array pointed\r
-    to by Dest, until N characters in all have been written.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the copy operation.\r
-    @param[in]    Src   Pointer to the Source data to be copied.\r
-    @param[in]    N     Number of characters (bytes) to be copied.\r
-\r
-    @return   The strncpy function returns the value of Dest.\r
-**/\r
-char     *strncpy(char * __restrict Dest, const char * __restrict Src, size_t N);\r
-\r
-/** The strncpyX function copies not more than N-1 characters (characters that\r
-    follow a null character are not copied) from the array pointed to by Src to\r
-    the array pointed to by Dest. Array Dest is guaranteed to be NULL terminated.\r
-    If copying takes place between objects that overlap,\r
-    the behavior is undefined.\r
-\r
-    strncpyX exists because normal strncpy does not indicate if the copy was\r
-    terminated because of exhausting the buffer or reaching the end of Src.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the copy operation.\r
-    @param[in]    Src   Pointer to the Source data to be copied.\r
-    @param[in]    N     Number of characters (bytes) to be copied.\r
-\r
-    @return   The strncpyX function returns 0 if the copy operation was\r
-              terminated because it reached the end of Dest.  Otherwise,\r
-              a non-zero value is returned indicating how many characters\r
-              remain in Dest.\r
-**/\r
-int       strncpyX(char * __restrict Dest, const char * __restrict Src, size_t N);\r
-\r
-/* ################   Concatenation Functions   ########################### */\r
-\r
-/** The strcat function appends a copy of the string pointed to by Src\r
-    (including the terminating null character) to the end of the string pointed\r
-    to by Dest. The initial character of Src overwrites the null character at the\r
-    end of Dest. If copying takes place between objects that overlap, the\r
-    behavior is undefined.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the concatenation operation.\r
-    @param[in]    Src   Pointer to the Source data to be concatenated.\r
-\r
-    @return   The strcat function returns the value of Dest.\r
-**/\r
-char     *strcat(char * __restrict Dest, const char * __restrict Src);\r
-\r
-/** The strncat function appends not more than N characters (a null character\r
-    and characters that follow it are not appended) from the array pointed to\r
-    by Src to the end of the string pointed to by Dest. The initial character of\r
-    Src overwrites the null character at the end of Dest. A terminating null\r
-    character is always appended to the result. If copying takes place\r
-    between objects that overlap, the behavior is undefined.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the concatenation operation.\r
-    @param[in]    Src   Pointer to the Source data to be concatenated.\r
-    @param[in]    N     Max Number of characters (bytes) to be concatenated.\r
-\r
-    @return   The strncat function returns the value of Dest.\r
-**/\r
-char     *strncat(char * __restrict Dest, const char * __restrict Src, size_t N);\r
-\r
-/** The strncatX function appends not more than N characters (a null character\r
-    and characters that follow it are not appended) from the array pointed to\r
-    by Src to the end of the string pointed to by Dest. The initial character of\r
-    Src overwrites the null character at the end of Dest. The result is always\r
-    terminated with a null character. If copying takes place between objects\r
-    that overlap, the behavior is undefined.\r
-\r
-    strncatX exists because normal strncat does not indicate if the operation\r
-    was terminated because of exhausting N or reaching the end of Src.\r
-\r
-    @param[out]   Dest  Pointer to the destination of the concatenation operation.\r
-    @param[in]    Src   Pointer to the Source data to be concatenated.\r
-    @param[in]    N     Max Number of characters (bytes) to be concatenated.\r
-\r
-    @return   The strncatX function returns 0 if the operation was terminated\r
-              because it reached the end of Dest.  Otherwise, a non-zero value is\r
-              returned indicating how many characters remain in Dest.\r
-**/\r
-int       strncatX(char * __restrict s1, const char * __restrict s2, size_t n);\r
-\r
-/* ################   Comparison Functions   ############################## */\r
-\r
-/** The memcmp function compares the first N characters of the object pointed\r
-    to by S1 to the first N characters of the object pointed to by S2.\r
-\r
-    @param[out]   S1  Pointer to the first object to be compared.\r
-    @param[in]    S2  Pointer to the object to be compared to S1.\r
-    @param[in]    N   Max Number of characters (bytes) to be compared.\r
-\r
-    @return   The memcmp function returns an integer greater than, equal to, or\r
-              less than zero, accordingly as the object pointed to by S1 is\r
-              greater than, equal to, or less than the object pointed to by S2.\r
-**/\r
-int       memcmp(const void *S1, const void *S2, size_t N);\r
-\r
-/** The strcmp function compares the string pointed to by S1 to the string\r
-    pointed to by S2.\r
-\r
-    @param[out]   S1  Pointer to the first string to be compared.\r
-    @param[in]    S2  Pointer to the string to be compared to S1.\r
-\r
-    @return   The strcmp function returns an integer greater than, equal to, or\r
-              less than zero, accordingly as the string pointed to by S1 is\r
-              greater than, equal to, or less than the string pointed to by S2.\r
-**/\r
-int       strcmp(const char *S1, const char *S2);\r
-\r
-/** The strcoll function compares the string pointed to by S1 to the string\r
-    pointed to by S2, both interpreted as appropriate to the LC_COLLATE\r
-    category of the current locale.\r
-\r
-    @param[out]   S1  Pointer to the first string to be compared.\r
-    @param[in]    S2  Pointer to the string to be compared to S1.\r
-\r
-    @return   The strcoll function returns an integer greater than, equal to,\r
-              or less than zero, accordingly as the string pointed to by S1 is\r
-              greater than, equal to, or less than the string pointed to by S2\r
-              when both are interpreted as appropriate to the current locale.\r
-**/\r
-int       strcoll(const char *S1, const char *S2);\r
-\r
-/** The strncmp function compares not more than N characters (characters that\r
-    follow a null character are not compared) from the array pointed to by S1\r
-    to the array pointed to by S2.\r
-\r
-    @param[out]   S1  Pointer to the first object to be compared.\r
-    @param[in]    S2  Pointer to the object to be compared to S1.\r
-    @param[in]    N   Max Number of characters (bytes) to be compared.\r
-\r
-    @return   The strncmp function returns an integer greater than, equal to,\r
-              or less than zero, accordingly as the possibly null-terminated\r
-              array pointed to by S1 is greater than, equal to, or less than\r
-              the possibly null-terminated array pointed to by S2.\r
-**/\r
-int       strncmp(const char *S1, const char *S2, size_t N);\r
-\r
-/** The strxfrm function transforms the string pointed to by Src and places the\r
-    resulting string into the array pointed to by Dest. The transformation is\r
-    such that if the strcmp function is applied to two transformed strings, it\r
-    returns a value greater than, equal to, or less than zero, corresponding to\r
-    the result of the strcoll function applied to the same two original\r
-    strings. No more than N characters are placed into the resulting array\r
-    pointed to by Dest, including the terminating null character. If N is zero,\r
-    Dest is permitted to be a null pointer. If copying takes place between\r
-    objects that overlap, the behavior is undefined.\r
-\r
-    @param[out]   Dest  Pointer to the object to receive the transformed string.\r
-    @param[in]    Src   Pointer to the string to be transformed.\r
-    @param[in]    N     Max Number of characters (bytes) to be transformed.\r
-\r
-    @return   The strxfrm function returns the length of the transformed string\r
-              (not including the terminating null character). If the value\r
-              returned is N or more, the contents of the array pointed to by Dest\r
-              are indeterminate.\r
-**/\r
-size_t    strxfrm(char * __restrict Dest, const char * __restrict Src, size_t N);\r
-\r
-/* ################   Search Functions   ################################## */\r
-\r
-/** The memchr function locates the first occurrence of C (converted to an\r
-    unsigned char) in the initial N characters (each interpreted as\r
-    unsigned char) of the object pointed to by S.\r
-\r
-    @param[in]    S   Pointer to the object to be searched.\r
-    @param[in]    C   The character value to search for.\r
-    @param[in]    N   Max Number of characters (bytes) to be searched.\r
-\r
-    @return   The memchr function returns a pointer to the located character,\r
-              or a null pointer if the character does not occur in the object.\r
-**/\r
-void     *memchr(const void *S, int C, size_t N);\r
-\r
-/** The strchr function locates the first occurrence of C (converted to a char)\r
-    in the string pointed to by S. The terminating null character is considered\r
-    to be part of the string.\r
-\r
-    @param[in]    S   Pointer to the object to be searched.\r
-    @param[in]    C   The character value to search for.\r
-\r
-    @return   The strchr function returns a pointer to the located character,\r
-              or a null pointer if the character does not occur in the string.\r
-**/\r
-char     *strchr(const char *S, int C);\r
-\r
-/** The strcspn function computes the length of the maximum initial segment of\r
-    the string pointed to by S1 which consists entirely of characters NOT from\r
-    the string pointed to by S2.\r
-\r
-    @param[in]    S1  Pointer to the object to be searched.\r
-    @param[in]    S2  Pointer to the list of characters to search for.\r
-\r
-    @return   The strcspn function returns the length of the segment.\r
-**/\r
-size_t    strcspn(const char *S1, const char *S2);\r
-\r
-/** The strpbrk function locates the first occurrence in the string pointed to\r
-    by S1 of any character from the string pointed to by S2.\r
-\r
-    @param[in]    S1  Pointer to the object to be searched.\r
-    @param[in]    S2  Pointer to the list of characters to search for.\r
-\r
-    @return   The strpbrk function returns a pointer to the character, or a\r
-              null pointer if no character from S2 occurs in S1.\r
-**/\r
-char     *strpbrk(const char *S1, const char *S2);\r
-\r
-/** The strrchr function locates the last occurrence of C (converted to a char)\r
-    in the string pointed to by S. The terminating null character is considered\r
-    to be part of the string.\r
-\r
-    @param[in]    S   Pointer to the object to be searched.\r
-    @param[in]    C   The character value to search for.\r
-\r
-    @return   The strrchr function returns a pointer to the character, or a\r
-              null pointer if C does not occur in the string.\r
-**/\r
-char     *strrchr(const char *S, int C);\r
-\r
-/** The strspn function computes the length of the maximum initial segment of\r
-    the string pointed to by S1 which consists entirely of characters from the\r
-    string pointed to by S2.\r
-\r
-    @param[in]    S1  Pointer to the object to be searched.\r
-    @param[in]    S2  Pointer to the list of characters to search for.\r
-\r
-    @return   The strspn function returns the length of the segment.\r
-**/\r
-size_t    strspn(const char *S1 , const char *S2);\r
-\r
-/** The strstr function locates the first occurrence in the string pointed to\r
-    by S1 of the sequence of characters (excluding the terminating null\r
-    character) in the string pointed to by S2.\r
-\r
-    @param[in]    S1  Pointer to the object to be searched.\r
-    @param[in]    S2  Pointer to the sequence of characters to search for.\r
-\r
-    @return   The strstr function returns a pointer to the located string, or a\r
-              null pointer if the string is not found. If S2 points to a string\r
-              with zero length, the function returns S1.\r
-**/\r
-char     *strstr(const char *S1 , const char *S2);\r
-\r
-/** Break a string into a sequence of tokens.\r
-\r
-    A sequence of calls to the strtok function breaks the string pointed to by\r
-    S1 into a sequence of tokens, each of which is delimited by a character\r
-    from the string pointed to by S2. The first call in the sequence has a\r
-    non-null first argument; subsequent calls in the sequence have a null first\r
-    argument. The separator string pointed to by S2 may be different from call\r
-    to call.\r
-\r
-    The first call in the sequence searches the string pointed to by S1 for the\r
-    first character that is not contained in the current separator string\r
-    pointed to by S2. If no such character is found, then there are no tokens\r
-    in the string pointed to by S1 and the strtok function returns a null\r
-    pointer. If such a character is found, it is the start of the first token.\r
-\r
-    The strtok function then searches from there for a character that is\r
-    contained in the current separator string. If no such character is found,\r
-    the current token extends to the end of the string pointed to by S1, and\r
-    subsequent searches for a token will return a null pointer. If such a\r
-    character is found, it is overwritten by a null character, which terminates\r
-    the current token. The strtok function saves a pointer to the following\r
-    character, from which the next search for a token will start.\r
-\r
-    Each subsequent call, with a null pointer as the value of the first\r
-    argument, starts searching from the saved pointer and behaves as\r
-    described above.\r
-\r
-    @param[in]    S1  Pointer to the string to be tokenized.\r
-    @param[in]    S2  Pointer to a list of separator characters.\r
-\r
-    @return   The strtok function returns a pointer to the first character of a\r
-              token, or a null pointer if there is no token.\r
-**/\r
-char     *strtok(char * __restrict S1, const char * __restrict S2);\r
-\r
-/* ################   Miscellaneous Functions   ########################### */\r
-\r
-/** The memset function copies the value of C (converted to an unsigned char)\r
-    into each of the first N characters of the object pointed to by S.\r
-\r
-    @param[out]   S   Pointer to the first element of the object to be set.\r
-    @param[in]    C   Value to store in each element of S.\r
-    @param[in]    N   Number of elements in S to be set.\r
-\r
-    @return   The memset function returns the value of S.\r
-**/\r
-void     *memset(void *S, int C, size_t N);\r
-\r
-/** The strerror function maps the number in Num to a message string.\r
-    Typically, the values for Num come from errno, but strerror shall map\r
-    any value of type int to a message.\r
-\r
-    @param[in]  Num   A value to be converted to a message.\r
-\r
-    @return   The strerror function returns a pointer to the string, the\r
-              contents of which are locale specific.  The array pointed to\r
-              must not be modified by the program, but may be overwritten by\r
-              a subsequent call to the strerror function.\r
-**/\r
-char     *strerror(int Num);\r
-\r
-/** The strlen function computes the length of the string pointed to by S.\r
-\r
-    @param[in]  S   Pointer to the string to determine the length of.\r
-\r
-    @return   The strlen function returns the number of characters that\r
-              precede the terminating null character.\r
-**/\r
-size_t    strlen(const char *S);\r
-\r
-\r
-/* ################   BSD Compatibility Functions   ####################### */\r
-\r
-char   *strdup    (const char *);\r
-int     strerror_r(int, char *, size_t);\r
-int     strcasecmp(const char *s1, const char *s2);\r
-void   *memccpy   (void *, const void *, int, size_t);\r
-int     strncasecmp(const char *s1, const char *s2, size_t n);\r
-size_t  strlcpy(char *destination, const char *source, size_t size);\r
-size_t  strlcat(char *destination, const char *source, size_t size);\r
-\r
-// bcopy is is a void function with the src/dest arguments reversed, being used in socket lib\r
-#define bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c))\r
-\r
-// bcmp is same as memcmp, returns 0 for successful compare, non-zero otherwise\r
-#define bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c))\r
-\r
-/*\r
- * Get next token from string *stringp, where tokens are possibly-empty\r
- * strings separated by characters from delim.\r
- *\r
- * Writes NULs into the string at *stringp to end tokens.\r
- * delim need not remain constant from call to call.\r
- * On return, *stringp points past the last NUL written (if there might\r
- * be further tokens), or is NULL (if there are definitely no more tokens).\r
- *\r
- * If *stringp is NULL, strsep returns NULL.\r
- */\r
-char *\r
-strsep(\r
-  register char **stringp,\r
-  register const char *delim\r
-  );\r
-\r
-__END_DECLS\r
-\r
-#endif  /* _STRING_H */\r