diff options
Diffstat (limited to 'lib/ultralib/include/compiler/gcc')
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/math.h | 1 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/memory.h | 23 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/sgidefs.h | 44 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/stdarg.h | 121 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/stdio.h | 1 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/stdlib.h | 81 | ||||
| -rw-r--r-- | lib/ultralib/include/compiler/gcc/string.h | 42 |
7 files changed, 313 insertions, 0 deletions
diff --git a/lib/ultralib/include/compiler/gcc/math.h b/lib/ultralib/include/compiler/gcc/math.h new file mode 100644 index 0000000..3e93ceb --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/math.h @@ -0,0 +1 @@ +// Nothing needed here diff --git a/lib/ultralib/include/compiler/gcc/memory.h b/lib/ultralib/include/compiler/gcc/memory.h new file mode 100644 index 0000000..edfff5e --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/memory.h @@ -0,0 +1,23 @@ +#ifndef _MEMORY_H +#define _MEMORY_H +/* + memory.h +*/ + +#ifndef _SIZE_T_DEF +#define _SIZE_T_DEF +typedef unsigned size_t; +#endif + +void *memccpy(void *,void *,int,size_t); +void *memchr(void *,int,size_t); +int memcmp(const void *,const void *,size_t); +void *memcpy(void *,const void *,size_t); +int memicmp(void *,void *,size_t); +void *memmove(void *,void *,size_t); +void *memset(void *,int,size_t); + +void movmem(void *,void *,unsigned); +void setmem(void *,unsigned,int); + +#endif diff --git a/lib/ultralib/include/compiler/gcc/sgidefs.h b/lib/ultralib/include/compiler/gcc/sgidefs.h new file mode 100644 index 0000000..56567e8 --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/sgidefs.h @@ -0,0 +1,44 @@ +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ralf Baechle <ralf@gnu.org>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SGIDEFS_H +#define _SGIDEFS_H 1 + +/* + * Definitions for the ISA level + */ +#define _MIPS_ISA_MIPS1 1 +#define _MIPS_ISA_MIPS2 2 +#define _MIPS_ISA_MIPS3 3 +#define _MIPS_ISA_MIPS4 4 +#define _MIPS_ISA_MIPS5 5 + +/* + * Subprogram calling convention + * + * At the moment only _MIPS_SIM_ABI32 is in use. This will change rsn. + * Until GCC 2.8.0 is released don't rely on this definitions because the + * 64bit code is essentially using the 32bit interface model just with + * 64bit registers. + */ +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 + +#endif /* sgidefs.h */ diff --git a/lib/ultralib/include/compiler/gcc/stdarg.h b/lib/ultralib/include/compiler/gcc/stdarg.h new file mode 100644 index 0000000..af337f6 --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/stdarg.h @@ -0,0 +1,121 @@ +#ifndef _STDARG_H +#define _STDARG_H +/* ---------------------------------------- */ +/* VARARGS for MIPS/GNU CC */ +/* */ +/* */ +/* */ +/* */ +/* ---------------------------------------- */ + +/* These macros implement varargs for GNU C--either traditional or ANSU. */ + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef char * __gnuc_va_list; +#endif /* not __GNUC_VA_LIST */ + +/* If this is for internal libc use, don't define anything but + __gnuc_va_list. */ +#if defined (_STDARG_H) || defined (_VARARGS_H) + +/* In GCC version 2, we want an ellipsis at the end of the declaration + of the argument list. GCC version 1 can't parse it. */ + +#if __GNUC__ > 1 +#define __va_ellipsis ... +#else +#define __va_ellipsis +#endif + +#if __mips>=3 +#define __va_rounded_size(__TYPE) \ + (((sizeof (__TYPE) + 8 - 1) / 8) * 8) +#else +#define __va_rounded_size(__TYPE) \ + (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#endif + +/* Get definitions for _MIPS_SIM_ABI64 etc. */ +#ifdef _MIPS_SIM +#include <sgidefs.h> +#endif + +#ifdef _STDARG_H +#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64) +#define va_start(__AP, __LASTARG) \ + (__AP = __builtin_next_arg (__LASTARG) - 64 \ + + (__builtin_args_info (2) > 8 ? 64 : __builtin_args_info(2) * 8)) +#else +#define va_start(__AP, __LASTARG) \ + (__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG)) +#endif + +#else +#define va_alist __builtin_va_alist +#if __mips>=3 +/* This assumes that `long long int' is always a 64 bit type. */ +#define va_dcl long long int __builtin_va_alist; __va_ellipsis +#else +#define va_dcl int __builtin_va_alist; __va_ellipsis +#endif +/* Need alternate code for _MIPS_SIM_ABI64, but don't use that symbol + because it may not be defined. */ +#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64) +#define va_start(__AP) \ + (__AP = __builtin_next_arg () - 64 \ + + (__builtin_args_info (2) > 8 ? 64 : __builtin_args_info(2) * 8)) +#else +#define va_start(__AP) __AP = (char *) &__builtin_va_alist +#endif +#endif + +#ifndef va_end +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ +#endif +#define va_end(__AP) ((void)0) + +/* We cast to void * and then to TYPE * because this avoids + a warning about increasing the alignment requirement. */ +/* The __mips>=3 cases are reversed from the 32 bit cases, because the standard + 32 bit calling convention left-aligns all parameters smaller than a word, + whereas the __mips>=3 calling convention does not (and hence they are + right aligned). */ +#if __mips>=3 +#ifdef __MIPSEB__ +#define va_arg(__AP, __type) \ + ((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ + + __va_rounded_size (__type))))[-1] +#else +#define va_arg(__AP, __type) \ + ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ + + __va_rounded_size (__type))), \ + *(__type *) (void *) (__AP - __va_rounded_size (__type))) +#endif + +#else /* not __mips>=3 */ + +#ifdef __MIPSEB__ +/* For big-endian machines. */ +#define va_arg(__AP, __type) \ + ((__AP = (char *) ((__alignof__ (__type) > 4 \ + ? ((int)__AP + 8 - 1) & -8 \ + : ((int)__AP + 4 - 1) & -4) \ + + __va_rounded_size (__type))), \ + *(__type *) (void *) (__AP - __va_rounded_size (__type))) +#else +/* For little-endian machines. */ +#define va_arg(__AP, __type) \ + ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ + ? ((int)__AP + 8 - 1) & -8 \ + : ((int)__AP + 4 - 1) & -4) \ + + __va_rounded_size(__type))))[-1] +#endif +#endif + +typedef __gnuc_va_list va_list; + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +#endif diff --git a/lib/ultralib/include/compiler/gcc/stdio.h b/lib/ultralib/include/compiler/gcc/stdio.h new file mode 100644 index 0000000..3e93ceb --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/stdio.h @@ -0,0 +1 @@ +// Nothing needed here diff --git a/lib/ultralib/include/compiler/gcc/stdlib.h b/lib/ultralib/include/compiler/gcc/stdlib.h new file mode 100644 index 0000000..98f8a2e --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/stdlib.h @@ -0,0 +1,81 @@ +#ifndef _STDLIB_H +#define _STDLIB_H +/* + stdlib.h +*/ + +#ifndef _SIZE_T_DEF +#define _SIZE_T_DEF +typedef unsigned size_t; +#endif + +#ifndef _DIV_T_DEF +#define _DIV_T_DEF +typedef struct DIV_T { + int quot; + int rem; +} div_t; +#endif + +#ifndef _LDIV_T_DEF +#define _LDIV_T_DEF +typedef struct LDIV_T { + long quot; + long rem; +} ldiv_t; +#endif + +#ifndef _LLDIV_T_DEF +#define _LLDIV_T_DEF +typedef struct lldiv_t +{ + long long quot; + long long rem; +} lldiv_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#define _max(a,b) (((a) > (b)) ? (a) : (b)) +#define _min(a,b) (((a) < (b)) ? (a) : (b)) + +#define RAND_MAX 32767 + +int rand(void); +void srand(unsigned); + +int abs(int); +long labs(long); + +div_t div(int,int); +ldiv_t ldiv(long,long); +lldiv_t lldiv(long long, long long); + +int atoi(const char *); +long atol(const char *); + +long strtol(const char *,char **,int); +unsigned long strtoul(const char *,char **,int); + +char *itoa(int,char *,int); +char *ltoa(long,char *,int); +char *ultoa(unsigned long,char *,int); + +double atof(const char *); +double strtod(const char *,char **); + +void qsort(void *,size_t,size_t,int (*)(const void *,const void *)); +void *bsearch(const void *,const void *,size_t,size_t,int (*)(const void *,const void *)); + +void *malloc(size_t); +void *calloc(size_t,size_t); +void *realloc(void *,size_t); +void free(void *); + +void exit(int); + +void abort(void); + +#endif diff --git a/lib/ultralib/include/compiler/gcc/string.h b/lib/ultralib/include/compiler/gcc/string.h new file mode 100644 index 0000000..d82e1f1 --- /dev/null +++ b/lib/ultralib/include/compiler/gcc/string.h @@ -0,0 +1,42 @@ +#ifndef _STRING_H +#define _STRING_H +/* + string.h +*/ + +#ifndef _SIZE_T_DEF +#define _SIZE_T_DEF +typedef unsigned size_t; +#endif + +#include "memory.h" + +char *stpcpy(char *,const char *); +char *strcat(char *,const char *); +char *strchr(const char *,int); +int strcmp(const char *,const char *); +char *strcpy(char *,const char *); +size_t strcspn(const char *,const char *); +char *strdup(const char *); +char *strerror(int); +int stricmp(const char *,const char *); +size_t strlen(const char *); +char *strlwr(char *); +char *strncat(char *,const char *,size_t); +int strncmp(const char *,const char *,size_t); +char *strncpy(char *,const char *,size_t); +int strnicmp(const char *,const char *,size_t); +char *strnset(char *,int,size_t); +char *strpbrk(const char *,const char *); +char *strrchr(const char *,int); +char *strrev(char *); +char *strset(char *,int); +size_t strspn(const char *,const char *); +char *strstr(const char *,const char *); +char *strtok(char *,const char *); +char *strupr(char *); + +#define strcmpi(s1,s2) stricmp(s1,s2) +#define strncmpi(s1,s2,n) strnicmp(s1,s2,n) + +#endif |
