pspsdk-1.0+beta2
string.h
Go to the documentation of this file.
1 /*
2  * PSP Software Development Kit - http://www.pspdev.org
3  * -----------------------------------------------------------------------
4  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5  *
6  * string.h
7  *
8  * Copyright (c) 2002-2004 PS2DEV
9  * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
10  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
11  * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
12  *
13  * $Id: string.h 1095 2005-09-27 21:02:16Z jim $
14  */
15 
16 #ifndef _STRING_H
17 #define _STRING_H
18 
19 #include <stddef.h>
20 #include <stdarg.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 
27 /* ASM String functions by Jeff Johnston of Cygnus Solutions */
28 void * memchr(const void *, int, size_t);
29 void * memcpy(void *, const void *, size_t);
30 void * memmove(void *, const void *, size_t);
31 void * memset(void *, int, size_t);
32 
33 int memcmp(const void *, const void *, size_t);
34 
35 int strcmp(const char *, const char *);
36 int strncmp(const char *, const char *, size_t);
37 
38 unsigned int strlen(const char *);
39 
40 char * strdup(const char *s);
41 
42 char * strcat(char *, const char *);
43 char * strchr(const char *, int);
44 char * strcpy(char *, const char *);
45 char * strncat(char *, const char *, size_t);
46 char * strncpy(char *, const char *, size_t);
47 
48 char * strpbrk(const char *s, const char *accept);
49 size_t strspn(const char *s, const char *accept);
50 size_t strcspn(const char *s, const char *reject);
51 
52 static __inline__ int strcoll(const char *s1, const char *s2) { return strcmp(s1, s2); }
53 static __inline__ size_t strxfrm(char *dest, const char *src, size_t n) { strncpy(dest, src, n); return n; }
54 
55 char * strerror(int);
56 
57 // copies ascii string to sjis string
58 //
59 // args: dest sjis string buffer
60 // source ascii string buffer
61 // returns: length of ascii string copied
62 int strcpy_sjis(short* sjis_buff, const char* ascii_buff);
63 
64 // copies sjis string to ascii string
65 //
66 // args: dest ascii string buffer
67 // source sjis string buffer
68 // returns: length of sjis string copied
69 int strcpy_ascii(char* ascii_buff, const short* sjis_buff);
70 
71 
72 /* C String functions by Hiryu (A.Lee) */
73 #define stricmp strcasecmp
74 #define strnicmp strncasecmp
75 
76 int strcasecmp(const char *, const char *);
77 int strncasecmp(const char *, const char *, size_t);
78 
79 char * strtok(char *, const char *);
80 char * strrchr(const char *, int);
81 
82 char * strstr(const char *, const char *);
83 
84 char * strupr(char *);
85 char * strlwr(char *);
86 
87 static __inline__ void bzero(void * p, size_t n) { memset(p, 0, n); }
88 static __inline__ void bcopy(const void * s, void * d, size_t n) { memcpy(d, s, n); }
89 static __inline__ int bcmp(const void * s1, const void * s2, size_t n) { return memcmp(s1, s2, n); }
90 static __inline__ char * index(const char * s, int c) { return strchr(s, c); }
91 static __inline__ char * rindex(const char * s, int c) { return strrchr(s, c); }
92 
93 /* Backward compatibility... */
94 #include <ctype.h>
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif // _STRING_H