PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
sysclib.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16#ifndef __SYSCLIB_H__
17#define __SYSCLIB_H__
18
19#include <types.h>
20#include <irx.h>
21#include <stdarg.h>
22#include <setjmp.h>
23#include <ctype.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef void (*print_callback_t)(void *context, int c);
30
31/* setjmp/longjmp are already defined in setjmp.h */
32
33/* These functions are non-standardized (IOP-only functions operating on 32-bit integers instead of wchar_t) */
34extern void *_wmemcopy(u32 *dest, const u32 *src, size_t size);
35extern void *_wmemset(u32 *dest, u32 c, size_t size);
36#ifdef SYSCLIB_ENABLE_NONSTD_WIDE_MEMCOPY
37#define wmemcopy _wmemcopy
38#define wmemset _wmemset
39#endif
40
41/* This function is non-standard. */
42extern int prnt(print_callback_t, void *context, const char * format, va_list ap);
43
44/* This function is non-standard. */
45extern char *atob(char *s, int *i);
46
47extern void *memchr(const void *s, int c, size_t n);
48extern int memcmp(const void *p, const void *q, size_t size);
49extern void * memcpy(void *dest, const void *src, size_t size);
50extern void *memmove(void *dest, const void *src, size_t size);
51extern void * memset(void *ptr, int c, size_t size);
52extern int bcmp(const void *, const void *, size_t);
53extern void bcopy(const void *, void *, size_t);
54extern void bzero(void *, size_t);
55extern int sprintf(char *str, const char *format, ...);
56extern char *strcat(char *dest, const char *src);
57extern char *strchr(const char *s, int c);
58extern int strcmp(const char *p, const char *q);
59extern char *strcpy(char *dest, const char *src);
60extern size_t strcspn(const char *s, const char *reject);
61extern char *index(const char *s, int c);
62extern char *rindex(const char *s, int c);
63extern size_t strlen(const char *s);
64extern char *strncat(char *dest, const char *src, size_t size);
65extern int strncmp(const char *p, const char *q, size_t size);
66extern char *strncpy(char *dest, const char *src, size_t size);
67extern char *strpbrk(const char *s, const char *accept);
68extern char *strrchr(const char *s, int c);
69extern size_t strspn(const char *s, const char *accept);
70extern char *strstr(const char *haystack, const char *needle);
71extern char *strtok(char *s, const char *delim);
72extern long strtol(const char *s, char **endptr, int base);
73extern unsigned long strtoul(const char *s, char **endptr, int base);
74
75// The following was introduced in export version 1.2 (around SDK 2.3)
76extern int vsprintf(char *, const char *, va_list);
77
78// The following was introduced in export version 1.4 (around SDK 2.8)
79extern char *strtok_r(char *s, const char *delim, char **lasts);
80
81#ifndef SYSCLIB_DISABLE_BUILTINS
82#ifndef memchr
83#define memchr __builtin_memchr
84#endif
85#ifndef memcmp
86#define memcmp __builtin_memcmp
87#endif
88#ifndef memcpy
89#define memcpy __builtin_memcpy
90#endif
91#ifndef memset
92#define memset __builtin_memset
93#endif
94#ifndef bcmp
95#define bcmp __builtin_bcmp
96#endif
97#ifndef bzero
98#define bzero __builtin_bzero
99#endif
100#ifndef sprintf
101#define sprintf __builtin_sprintf
102#endif
103#ifndef strcat
104#define strcat __builtin_strcat
105#endif
106#ifndef strchr
107#define strchr __builtin_strchr
108#endif
109#ifndef strcmp
110#define strcmp __builtin_strcmp
111#endif
112#ifndef strcpy
113#define strcpy __builtin_strcpy
114#endif
115#ifndef strcspn
116#define strcspn __builtin_strcspn
117#endif
118#ifndef index
119#define index __builtin_index
120#endif
121#ifndef rindex
122#define rindex __builtin_rindex
123#endif
124#ifndef strlen
125#define strlen __builtin_strlen
126#endif
127#ifndef strncat
128#define strncat __builtin_strncat
129#endif
130#ifndef strncmp
131#define strncmp __builtin_strncmp
132#endif
133#ifndef strncpy
134#define strncpy __builtin_strncpy
135#endif
136#ifndef strpbrk
137#define strpbrk __builtin_strpbrk
138#endif
139#ifndef strrchr
140#define strrchr __builtin_strrchr
141#endif
142#ifndef strspn
143#define strspn __builtin_strspn
144#endif
145#ifndef strstr
146#define strstr __builtin_strstr
147#endif
148#ifndef vsprintf
149#define vsprintf __builtin_vsprintf
150#endif
151#endif
152
153#define sysclib_IMPORTS_start DECLARE_IMPORT_TABLE(sysclib, 1, 1)
154#define sysclib_IMPORTS_end END_IMPORT_TABLE
155
156#define I_setjmp DECLARE_IMPORT(4, setjmp)
157#define I_longjmp DECLARE_IMPORT(5, longjmp)
158#define I_toupper DECLARE_IMPORT(6, _toupper)
159#define I_tolower DECLARE_IMPORT(7, _tolower)
160#define I_look_ctype_table DECLARE_IMPORT(8, look_ctype_table)
161#define I_get_ctype_table DECLARE_IMPORT(9, get_ctype_table)
162#define I_memchr DECLARE_IMPORT(10, memchr)
163#define I_memcmp DECLARE_IMPORT(11, memcmp)
164#define I_memcpy DECLARE_IMPORT(12, memcpy)
165#define I_memmove DECLARE_IMPORT(13, memmove)
166#define I_memset DECLARE_IMPORT(14, memset)
167#define I_bcmp DECLARE_IMPORT(15, bcmp);
168#define I_bcopy DECLARE_IMPORT(16, bcopy);
169#define I_bzero DECLARE_IMPORT(17, bzero);
170#define I_prnt DECLARE_IMPORT(18, prnt)
171#define I_sprintf DECLARE_IMPORT(19, sprintf)
172#define I_strcat DECLARE_IMPORT(20, strcat)
173#define I_strchr DECLARE_IMPORT(21, strchr)
174#define I_strcmp DECLARE_IMPORT(22, strcmp)
175#define I_strcpy DECLARE_IMPORT(23, strcpy)
176#define I_strcspn DECLARE_IMPORT(24, strcspn)
177#define I_index DECLARE_IMPORT(25, index)
178#define I_rindex DECLARE_IMPORT(26, rindex)
179#define I_strlen DECLARE_IMPORT(27, strlen)
180#define I_strncat DECLARE_IMPORT(28, strncat)
181#define I_strncmp DECLARE_IMPORT(29, strncmp)
182#define I_strncpy DECLARE_IMPORT(30, strncpy)
183#define I_strpbrk DECLARE_IMPORT(31, strpbrk)
184#define I_strrchr DECLARE_IMPORT(32, strrchr)
185#define I_strspn DECLARE_IMPORT(33, strspn)
186#define I_strstr DECLARE_IMPORT(34, strstr)
187#define I_strtok DECLARE_IMPORT(35, strtok)
188#define I_strtol DECLARE_IMPORT(36, strtol)
189#define I_atob DECLARE_IMPORT(37, atob)
190#define I_strtoul DECLARE_IMPORT(38, strtoul)
191#define I_wmemcopy DECLARE_IMPORT(40, _wmemcopy)
192#define I_wmemset DECLARE_IMPORT(41, _wmemset)
193#define I_vsprintf DECLARE_IMPORT(42, vsprintf)
194#define I_strtok_r DECLARE_IMPORT(43, strtok_r)
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif /* __SYSCLIB_H__ */