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