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);
74extern int vsprintf(char *, const char *, va_list);
75extern char *strtok_r(char *s, const char *delim, char **lasts);
76
77#ifndef SYSCLIB_DISABLE_BUILTINS
78#ifndef memchr
79#define memchr __builtin_memchr
80#endif
81#ifndef memcmp
82#define memcmp __builtin_memcmp
83#endif
84#ifndef memcpy
85#define memcpy __builtin_memcpy
86#endif
87#ifndef memset
88#define memset __builtin_memset
89#endif
90#ifndef bcmp
91#define bcmp __builtin_bcmp
92#endif
93#ifndef bzero
94#define bzero __builtin_bzero
95#endif
96#ifndef sprintf
97#define sprintf __builtin_sprintf
98#endif
99#ifndef strcat
100#define strcat __builtin_strcat
101#endif
102#ifndef strchr
103#define strchr __builtin_strchr
104#endif
105#ifndef strcmp
106#define strcmp __builtin_strcmp
107#endif
108#ifndef strcpy
109#define strcpy __builtin_strcpy
110#endif
111#ifndef strcspn
112#define strcspn __builtin_strcspn
113#endif
114#ifndef index
115#define index __builtin_index
116#endif
117#ifndef rindex
118#define rindex __builtin_rindex
119#endif
120#ifndef strlen
121#define strlen __builtin_strlen
122#endif
123#ifndef strncat
124#define strncat __builtin_strncat
125#endif
126#ifndef strncmp
127#define strncmp __builtin_strncmp
128#endif
129#ifndef strncpy
130#define strncpy __builtin_strncpy
131#endif
132#ifndef strpbrk
133#define strpbrk __builtin_strpbrk
134#endif
135#ifndef strrchr
136#define strrchr __builtin_strrchr
137#endif
138#ifndef strspn
139#define strspn __builtin_strspn
140#endif
141#ifndef strstr
142#define strstr __builtin_strstr
143#endif
144#ifndef vsprintf
145#define vsprintf __builtin_vsprintf
146#endif
147#endif
148
149#define sysclib_IMPORTS_start DECLARE_IMPORT_TABLE(sysclib, 1, 1)
150#define sysclib_IMPORTS_end END_IMPORT_TABLE
151
152#define I_setjmp DECLARE_IMPORT(4, setjmp)
153#define I_longjmp DECLARE_IMPORT(5, longjmp)
154#define I_toupper DECLARE_IMPORT(6, _toupper)
155#define I_tolower DECLARE_IMPORT(7, _tolower)
156#define I_look_ctype_table DECLARE_IMPORT(8, look_ctype_table)
157#define I_get_ctype_table DECLARE_IMPORT(9, get_ctype_table)
158#define I_memchr DECLARE_IMPORT(10, memchr)
159#define I_memcmp DECLARE_IMPORT(11, memcmp)
160#define I_memcpy DECLARE_IMPORT(12, memcpy)
161#define I_memmove DECLARE_IMPORT(13, memmove)
162#define I_memset DECLARE_IMPORT(14, memset)
163#define I_bcmp DECLARE_IMPORT(15, bcmp);
164#define I_bcopy DECLARE_IMPORT(16, bcopy);
165#define I_bzero DECLARE_IMPORT(17, bzero);
166#define I_prnt DECLARE_IMPORT(18, prnt)
167#define I_sprintf DECLARE_IMPORT(19, sprintf)
168#define I_strcat DECLARE_IMPORT(20, strcat)
169#define I_strchr DECLARE_IMPORT(21, strchr)
170#define I_strcmp DECLARE_IMPORT(22, strcmp)
171#define I_strcpy DECLARE_IMPORT(23, strcpy)
172#define I_strcspn DECLARE_IMPORT(24, strcspn)
173#define I_index DECLARE_IMPORT(25, index)
174#define I_rindex DECLARE_IMPORT(26, rindex)
175#define I_strlen DECLARE_IMPORT(27, strlen)
176#define I_strncat DECLARE_IMPORT(28, strncat)
177#define I_strncmp DECLARE_IMPORT(29, strncmp)
178#define I_strncpy DECLARE_IMPORT(30, strncpy)
179#define I_strpbrk DECLARE_IMPORT(31, strpbrk)
180#define I_strrchr DECLARE_IMPORT(32, strrchr)
181#define I_strspn DECLARE_IMPORT(33, strspn)
182#define I_strstr DECLARE_IMPORT(34, strstr)
183#define I_strtok DECLARE_IMPORT(35, strtok)
184#define I_strtol DECLARE_IMPORT(36, strtol)
185#define I_atob DECLARE_IMPORT(37, atob)
186#define I_strtoul DECLARE_IMPORT(38, strtoul)
187#define I_wmemcopy DECLARE_IMPORT(40, _wmemcopy)
188#define I_wmemset DECLARE_IMPORT(41, _wmemset)
189#define I_vsprintf DECLARE_IMPORT(42, vsprintf)
190#define I_strtok_r DECLARE_IMPORT(43, strtok_r)
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* __SYSCLIB_H__ */