# string.h

Go to the documentation of this file.

    00001 /*
    00002  * PSP Software Development Kit - http://www.pspdev.org
    00003  * -----------------------------------------------------------------------
    00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
    00005  *
    00006  * string.h
    00007  *
    00008  * Copyright (c) 2002-2004 PS2DEV
    00009  * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
    00010  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
    00011  * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
    00012  *
    00013  * $Id: string.h 1095 2005-09-27 21:02:16Z jim $
    00014  */
    00015
    00016 #ifndef _STRING_H
    00017 #define _STRING_H
    00018
    00019 #include <stddef.h>
    00020 #include <stdarg.h>
    00021
    00022 #ifdef __cplusplus
    00023 extern "C" {
    00024 #endif
    00025
    00026
    00027 /* ASM String functions by Jeff Johnston of Cygnus Solutions */
    00028 void *  memchr(const void *, int, size_t);
    00029 void *  memcpy(void *, const void *, size_t);
    00030 void *  memmove(void *, const void *, size_t);
    00031 void *  memset(void *, int, size_t);
    00032
    00033 int     memcmp(const void *, const void *, size_t);
    00034
    00035 int     strcmp(const char *, const char *);
    00036 int     strncmp(const char *, const char *, size_t);
    00037
    00038 unsigned int strlen(const char *);
    00039
    00040 char *  strdup(const char *s);
    00041
    00042 char *  strcat(char *, const char *);
    00043 char *  strchr(const char *, int);
    00044 char *  strcpy(char *, const char *);
    00045 char *  strncat(char *, const char *, size_t);
    00046 char *  strncpy(char *, const char *, size_t);
    00047
    00048 char *  strpbrk(const char *s, const char *accept);
    00049 size_t  strspn(const char *s, const char *accept);
    00050 size_t  strcspn(const char *s, const char *reject);
    00051
    00052 static __inline__ int strcoll(const char *s1, const char *s2) { return strcmp(s1, s2); }
    00053 static __inline__ size_t strxfrm(char *dest, const char *src, size_t n) { strncpy(dest, src, n); return n; }
    00054
    00055 char *  strerror(int);
    00056
    00057 // copies ascii string to sjis string
    00058 //
    00059 // args:    dest sjis string buffer
    00060 //          source ascii string buffer
    00061 // returns: length of ascii string copied
    00062 int strcpy_sjis(short* sjis_buff, const char* ascii_buff);
    00063
    00064 // copies sjis string to ascii string
    00065 //
    00066 // args:    dest ascii string buffer
    00067 //          source sjis string buffer
    00068 // returns: length of sjis string copied
    00069 int strcpy_ascii(char* ascii_buff, const short* sjis_buff);
    00070
    00071
    00072 /* C String functions by Hiryu (A.Lee) */
    00073 #define stricmp strcasecmp
    00074 #define strnicmp strncasecmp
    00075
    00076 int      strcasecmp(const char *, const char *);
    00077 int      strncasecmp(const char *, const char *, size_t);
    00078
    00079 char *  strtok(char *, const char *);
    00080 char *  strrchr(const char *, int);
    00081
    00082 char *  strstr(const char *, const char *);
    00083
    00084 char * strupr(char *);
    00085 char * strlwr(char *);
    00086
    00087 static __inline__ void bzero(void * p, size_t n) { memset(p, 0, n); }
    00088 static __inline__ void bcopy(const void * s, void * d, size_t n) { memcpy(d, s, n); }
    00089 static __inline__ int bcmp(const void * s1, const void * s2, size_t n) { return memcmp(s1, s2, n); }
    00090 static __inline__ char * index(const char * s, int c) { return strchr(s, c); }
    00091 static __inline__ char * rindex(const char * s, int c) { return strrchr(s, c); }
    00092
    00093 /* Backward compatibility... */
    00094 #include <ctype.h>
    00095
    00096 #ifdef __cplusplus
    00097 }
    00098 #endif
    00099
    00100 #endif  // _STRING_H