]> pd.if.org Git - pdclib/blobdiff - includes/string.h
Re-import from Subversion.
[pdclib] / includes / string.h
index ed46905160c265b967ebd3b55c645d8f31e56ae5..9d2a517a7cc2de434d46af6274b686d77d5c1205 100644 (file)
@@ -1,27 +1,37 @@
-// ----------------------------------------------------------------------------
-// $Id$
-// ----------------------------------------------------------------------------
-// Public Domain C Library - http://pdclib.sourceforge.net
-// This code is Public Domain. Use, modify, and redistribute at will.
-// ----------------------------------------------------------------------------
-// String handling
-// ----------------------------------------------------------------------------
+/* ----------------------------------------------------------------------------
+ * $Id$
+ * ----------------------------------------------------------------------------
+ * Public Domain C Library - http://pdclib.sourceforge.net
+ * This code is Public Domain. Use, modify, and redistribute at will.
+ * ----------------------------------------------------------------------------
+ * String handling
+ * --------------------------------------------------------------------------*/
 
-#ifndef __STRING_H
-#define __STRING_H __STRING_H
+#ifndef _STRING_H
+#define _STRING_H _STRING_H
 
-// ----------------------------------------------------------------------------
-// MACROS
+#ifndef _NULL
+#include "__intern.h"
+#endif /* _NULL */
 
-#include "__NULL.h"
+/* ----------------------------------------------------------------------------
+ * MACROS
+ * --------------------------------------------------------------------------*/
 
-// ----------------------------------------------------------------------------
-// TYPEDEFS
+#define NULL _NULL
 
-#include "__size_t.h"
+/* ----------------------------------------------------------------------------
+ * TYPEDEFS
+ * --------------------------------------------------------------------------*/
 
-// ----------------------------------------------------------------------------
-// FUNCTIONS
+#ifndef _SIZE_T
+#define _SIZE_T _SIZE_T
+typedef __size_t size_t
+#endif /* _SIZE_T */
+
+/* ----------------------------------------------------------------------------
+ * FUNCTIONS
+ * --------------------------------------------------------------------------*/
 
 /** MEMory search for CHaRacter. Searches a memory area for a character.
  *  @param src The memory area.
@@ -31,7 +41,7 @@
  *          found.
  *  @see strchr()
  */
-void * memchr( const void * s, int c, size_t n );
+void * memchr( const void * src, int c, size_t n );
 
 /** MEMory CoMPare. Compares two memory areas until a difference is found.
  *  This implementation actually returns the difference of the first differing
@@ -46,7 +56,7 @@ void * memchr( const void * s, int c, size_t n );
  *          from src_2, or > 0 if otherwise.
  *  @see strncmp()
  */
-int memcmp( const void * s1, const void * s2, size_t n );
+int memcmp( const void * src_1, const void * src_2, size_t n );
 
 /** MEMory CoPY. Copies a source memory area of size n into a destination
  *  memory area.
@@ -58,7 +68,7 @@ int memcmp( const void * s1, const void * s2, size_t n );
  *  @return A pointer to the destination memory area.
  *  @see strncpy()
  */
-void * memcpy( void * restrict s1, const void * restrict s2, size_t n );
+void * memcpy( void * restrict dest, const void * restrict src, size_t n );
 
 /** MEMory CoPY. Moves a source memory area of size n into a destination
  *  memory area. The memory areas may overlap.
@@ -68,7 +78,7 @@ void * memcpy( void * restrict s1, const void * restrict s2, size_t n );
  *  @return A pointer to the destination memory area.
  *  @see strncpy()
  */
-void * memmove( void * s1, const void * s2, size_t n );
+void * memmove( void * dest, const void * src, size_t n );
 
 /** MEMory SET. Fills a memory area with a given character.
  *  @param dest The destination memory area.
@@ -76,7 +86,7 @@ void * memmove( void * s1, const void * s2, size_t n );
  *  @param n The number of characters to be written to dest.
  *  @return A pointer to the destination memory area.
  */
-void * memset( void * s, int c, size_t n );
+void * memset( void * dest, int c, size_t n );
 
 /** STRing conCATenation. Appends a C string to another. If the memory area
  *  pointed to by 'dest' is not large enough to hold both 'dest' and 'src',
@@ -199,15 +209,15 @@ int strncmp( const char * src_1, const char * src_2, size_t n );
  *  @return A pointer to the destination string.
  *  @see strcpy()
  */
-char * strncpy( char * restrict s1, const char * restrict s2, size_t n );
+char * strncpy( char * restrict dest, const char * restrict src, size_t n );
 
 /** STRing SPaN. Compares two C strings, determining the length of the
- *  substring where both strings are equal.
+ *  substring containing only characters from the second string.
  *  @param src_1 The first string to be compared.
  *  @param src_2 The second string to be compared.
  *  @return The length of the identical substring.
  */
-size_t strspn( const char * s1, const char * s2 );
+size_t strspn( const char * src_1, const char * src_2 );
 
 /** STRing TOKenizer. This (complex and not thread-safe) function allows, by
  *  subsequent calls, to parse a string for tokens. The first parameter to the
@@ -239,7 +249,7 @@ char * strtok( char * restrict src, const char * restrict seperators );
  *  @see locale.h
  *  @see strcoll()
  */
-size_t strxfrm( char * restrict s1, const char * restrict s2, size_t n );
+size_t strxfrm( char * restrict dest, const char * restrict src, size_t n );
 
 /** STRing search, return Pointer to BReaK. Searches a C string (including
  *  terminating \0) for any character contained in a second string. If the
@@ -259,7 +269,7 @@ char * strpbrk( const char * src_1, const char * src_2 );
  *  @return A pointer to the last occurrence of c in src, or NULL if no match
  *          found.
  */
-char * strrchr( const char * s, int c );
+char * strrchr( const char * src, int c );
 
 /** STRing search for STRing. Searches a C string for a substring.
  *  @param src_1 The string to be searched in.
@@ -269,4 +279,4 @@ char * strrchr( const char * s, int c );
  */
 char * strstr( const char * src_1, const char * src_2 );
 
-#endif // __STRING_H
+#endif /* _STRING_H */