From 50a6ca39ad4ed01922aa4f755f0ca579788226cf Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 6 May 2010 21:04:40 +0000 Subject: Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657 --- firmware/libc/include/ctype.h | 75 ++++++++++++++++++++ firmware/libc/include/errno.h | 145 +++++++++++++++++++++++++++++++++++++++ firmware/libc/include/inttypes.h | 29 ++++++++ firmware/libc/include/stdint.h | 107 +++++++++++++++++++++++++++++ firmware/libc/include/stdio.h | 60 ++++++++++++++++ firmware/libc/include/stdlib.h | 58 ++++++++++++++++ firmware/libc/include/string.h | 94 +++++++++++++++++++++++++ firmware/libc/include/time.h | 49 +++++++++++++ 8 files changed, 617 insertions(+) create mode 100644 firmware/libc/include/ctype.h create mode 100644 firmware/libc/include/errno.h create mode 100644 firmware/libc/include/inttypes.h create mode 100644 firmware/libc/include/stdint.h create mode 100644 firmware/libc/include/stdio.h create mode 100644 firmware/libc/include/stdlib.h create mode 100644 firmware/libc/include/string.h create mode 100644 firmware/libc/include/time.h (limited to 'firmware/libc/include') diff --git a/firmware/libc/include/ctype.h b/firmware/libc/include/ctype.h new file mode 100644 index 0000000000..648e06dc5c --- /dev/null +++ b/firmware/libc/include/ctype.h @@ -0,0 +1,75 @@ +#ifndef _CTYPE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _CTYPE_H_ + +#include "_ansi.h" + +int _EXFUN(isalnum, (int __c)); +int _EXFUN(isalpha, (int __c)); +int _EXFUN(iscntrl, (int __c)); +int _EXFUN(isdigit, (int __c)); +int _EXFUN(isgraph, (int __c)); +int _EXFUN(islower, (int __c)); +int _EXFUN(isprint, (int __c)); +int _EXFUN(ispunct, (int __c)); +int _EXFUN(isspace, (int __c)); +int _EXFUN(isupper, (int __c)); +int _EXFUN(isxdigit,(int __c)); +int _EXFUN(tolower, (int __c)); +int _EXFUN(toupper, (int __c)); + +#ifndef __STRICT_ANSI__ +int _EXFUN(isascii, (int __c)); +int _EXFUN(toascii, (int __c)); +int _EXFUN(_tolower, (int __c)); +int _EXFUN(_toupper, (int __c)); +#endif + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +#ifdef PLUGIN +#define _ctype_ (rb->_rbctype_) +#else +extern const unsigned char _ctype_[257]; +#endif + +#ifndef __cplusplus +#define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L)) +#define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U) +#define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L) +#define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N) +#define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N)) +#define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S) +#define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P) +#define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N)) +#define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N)) +#define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C) +/* Non-gcc versions will get the library versions, and will be + slightly slower */ +#ifdef __GNUC__ +# define toupper(c) \ + __extension__ ({ int __x = (unsigned char) (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) +# define tolower(c) \ + __extension__ ({ int __x = (unsigned char) (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) +#endif +#endif /* !__cplusplus */ + +#ifndef __STRICT_ANSI__ +#define isascii(c) ((unsigned char)(c)<=0177) +#define toascii(c) ((c)&0177) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _CTYPE_H_ */ diff --git a/firmware/libc/include/errno.h b/firmware/libc/include/errno.h new file mode 100644 index 0000000000..6a24a1938f --- /dev/null +++ b/firmware/libc/include/errno.h @@ -0,0 +1,145 @@ +/* errno is not a global variable, because that would make using it + non-reentrant. Instead, its address is returned by the function + __errno. */ + +#if (defined(SIMULATOR)||defined(__PCTOOL__)) && !defined(__MINGW32__) && !defined(__CYGWIN__) + +#include "/usr/include/errno.h" /* use the host system implementation */ + +#else /* use our own implementation */ + +#ifndef _SYS_ERRNO_H_ + +#ifdef PLUGIN +#define errno (*rb->__errno) +#else +extern int errno; +#endif + +#define EPERM 1 /* Not super-user */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math arg out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Deadlock condition */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 57 /* Bad font file fmt */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data (for no delay io) */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* The object is remote */ +#define ENOLINK 67 /* The link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define ELBIN 75 /* Inode is remote (not really error) */ +#define EDOTDOT 76 /* Cross mount point (not really error) */ +#define EBADMSG 77 /* Trying to read unreadable message */ +#define ENOTUNIQ 80 /* Given log. name not unique */ +#define EBADFD 81 /* f.d. invalid for this operation */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can't access a needed shared lib */ +#define ELIBBAD 84 /* Accessing a corrupted shared lib */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many libs */ +#define ELIBEXEC 87 /* Attempting to exec a shared library */ +#define ENOSYS 88 /* Function not implemented */ +#define ENMFILE 89 /* No more files */ +#define ENOTEMPTY 90 /* Directory not empty */ +#define ENAMETOOLONG 91 /* File or path name too long */ +#define ELOOP 92 /* Too many symbolic links */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ +#define EPROTOTYPE 107 /* Protocol wrong type for socket */ +#define ENOTSOCK 108 /* Socket operation on non-socket */ +#define ENOPROTOOPT 109 /* Protocol not available */ +#define ESHUTDOWN 110 /* Can't send after socket shutdown */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EADDRINUSE 112 /* Address already in use */ +#define ECONNABORTED 113 /* Connection aborted */ +#define ENETUNREACH 114 /* Network is unreachable */ +#define ENETDOWN 115 /* Network interface is not configured */ +#define ETIMEDOUT 116 /* Connection timed out */ +#define EHOSTDOWN 117 /* Host is down */ +#define EHOSTUNREACH 118 /* Host is unreachable */ +#define EINPROGRESS 119 /* Connection already in progress */ +#define EALREADY 120 /* Socket already connected */ +#define EDESTADDRREQ 121 /* Destination address required */ +#define EMSGSIZE 122 /* Message too long */ +#define EPROTONOSUPPORT 123 /* Unknown protocol */ +#define ESOCKTNOSUPPORT 124 /* Socket type not supported */ +#define EADDRNOTAVAIL 125 /* Address not available */ +#define ENETRESET 126 +#define EISCONN 127 /* Socket is already connected */ +#define ENOTCONN 128 /* Socket is not connected */ +#define ETOOMANYREFS 129 +#define EPROCLIM 130 +#define EUSERS 131 +#define EDQUOT 132 +#define ESTALE 133 +#define ENOTSUP 134 /* Not supported */ +#define ENOMEDIUM 135 /* No medium (in tape drive) */ +#define ENOSHARE 136 /* No such host or network path */ +#define ECASECLASH 137 /* Filename exists with different case */ + +/* From cygwin32. */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ + +#define __ELASTERROR 2000 /* Users can add values starting here */ + +#endif /* _SYS_ERRNO_H */ +#endif /* !SIMULATOR */ diff --git a/firmware/libc/include/inttypes.h b/firmware/libc/include/inttypes.h new file mode 100644 index 0000000000..c03609c6d8 --- /dev/null +++ b/firmware/libc/include/inttypes.h @@ -0,0 +1,29 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 by Dave Chapman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __INTTYPES_H__ +#define __INTTYPES_H__ + +#include + +/* could possibly have (f)printf format specifies here */ + +#endif /* __INTTYPES_H__ */ diff --git a/firmware/libc/include/stdint.h b/firmware/libc/include/stdint.h new file mode 100644 index 0000000000..93f234c0e8 --- /dev/null +++ b/firmware/libc/include/stdint.h @@ -0,0 +1,107 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 by Dave Chapman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __STDINT_H__ +#define __STDINT_H__ + +#include + +/* 8 bit */ +#define INT8_MIN SCHAR_MIN +#define INT8_MAX SCHAR_MAX +#define UINT8_MAX UCHAR_MAX +#define int8_t signed char +#define uint8_t unsigned char + +/* 16 bit */ +#if USHRT_MAX == 0xffff + +#define INT16_MIN SHRT_MIN +#define INT16_MAX SHRT_MAX +#define UINT16_MAX USHRT_MAX +#define int16_t short +#define uint16_t unsigned short + +#endif + +/* 32 bit */ +#if ULONG_MAX == 0xfffffffful + +#define INT32_MIN LONG_MIN +#define INT32_MAX LONG_MAX +#define UINT32_MAX ULONG_MAX +#define int32_t long +#define uint32_t unsigned long + +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX +#define intptr_t long +#define uintptr_t unsigned long + +#elif UINT_MAX == 0xffffffffu + +#define INT32_MIN INT_MIN +#define INT32_MAX INT_MAX +#define UINT32_MAX UINT_MAX +#define int32_t int +#define uint32_t unsigned int + +#endif + +/* 64 bit */ +#ifndef LLONG_MIN +#define LLONG_MIN ((long long)9223372036854775808ull) +#endif + +#ifndef LLONG_MAX +#define LLONG_MAX 9223372036854775807ll +#endif + +#ifndef ULLONG_MAX +#define ULLONG_MAX 18446744073709551615ull +#endif + +#if ULONG_MAX == 0xffffffffffffffffull + +#define INT64_MIN LONG_MIN +#define INT64_MAX LONG_MAX +#define UINT64_MAX ULONG_MAX +#define int64_t long +#define uint64_t unsigned long + +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX +#define intptr_t long +#define uintptr_t unsigned long + +#else + +#define INT64_MIN LLONG_MIN +#define INT64_MAX LLONG_MAX +#define UINT64_MAX ULLONG_MAX +#define int64_t long long +#define uint64_t unsigned long long + +#endif + +#endif /* __STDINT_H__ */ diff --git a/firmware/libc/include/stdio.h b/firmware/libc/include/stdio.h new file mode 100644 index 0000000000..d9a6dce55f --- /dev/null +++ b/firmware/libc/include/stdio.h @@ -0,0 +1,60 @@ +#ifndef _STDIO_H_ +#define _STDIO_H_ + +#include <_ansi.h> + +#define __need_size_t +#include + +#define __need___va_list +#include + +#ifndef NULL +#define NULL 0 +#endif + +#define EOF (-1) + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define TMP_MAX 26 + +#ifdef __GNUC__ +#define __VALIST __gnuc_va_list +#else +#define __VALIST char* +#endif + +int vsnprintf (char *buf, size_t size, const char *fmt, __VALIST ap); + +int sprintf (char *buf, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); + +int snprintf (char *buf, size_t size, const char *fmt, ...) + ATTRIBUTE_PRINTF(3, 4); + +/* callback function is called for every output character (byte) with userp and + * should return 0 when ch is a char other than '\0' that should stop printing */ +int vuprintf(int (*push)(void *userp, unsigned char data), + void *userp, const char *fmt, __VALIST ap); + +int sscanf(const char *s, const char *fmt, ...) + ATTRIBUTE_SCANF(2, 3); + +#ifdef SIMULATOR +typedef void FILE; +int vfprintf(FILE *stream, const char *format, __VALIST ap); +#ifdef WIN32 +#define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set + in file.h */ +#endif +#endif + +#endif /* _STDIO_H_ */ diff --git a/firmware/libc/include/stdlib.h b/firmware/libc/include/stdlib.h new file mode 100644 index 0000000000..5f6db6da8a --- /dev/null +++ b/firmware/libc/include/stdlib.h @@ -0,0 +1,58 @@ +/* + * stdlib.h + * + * Definitions for common types, variables, and functions. + */ + +#ifndef _STDLIB_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDLIB_H_ + +#include "_ansi.h" + +#define __need_size_t +#define __need_wchar_t +#include + +#ifndef NULL +#define NULL ((void*)0) +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); + +void *malloc(size_t); +void *calloc (size_t nmemb, size_t size); +void free(void *); +void *realloc(void *, size_t); + +#define RAND_MAX INT_MAX + +void srand(unsigned int seed); +int rand(void); + +#ifndef ABS +#if defined(__GNUC__) +#define ABS(a) ({typeof (a) ___a = (a); ___a < 0 ? -___a: ___a; }) +#else +#define ABS(a) (((a) < 0) ? -(a) : (a)) +#endif /* __GNUC__ */ +#endif + +#define abs(x) ((int)ABS(x)) +#define labs(x) ((long)abs(x)) + +#ifdef SIMULATOR +void exit(int status); +#endif + +int atoi (const char *str); + +#ifdef __cplusplus +} +#endif +#endif /* _STDLIB_H_ */ diff --git a/firmware/libc/include/string.h b/firmware/libc/include/string.h new file mode 100644 index 0000000000..8986bd6a0c --- /dev/null +++ b/firmware/libc/include/string.h @@ -0,0 +1,94 @@ +/* + * string.h + * + * Definitions for memory and string functions. + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#include + +#if !defined(__size_t_defined)&& !defined(_SIZE_T_) && !defined(size_t) && !defined(_SIZE_T_DECLARED) +#define __size_t_defined +#define _SIZE_T +#define _SIZE_T_ +#define _SIZE_T_DECLARED +#define size_t size_t +typedef unsigned long size_t; +#endif + +#ifndef NULL +#define NULL ((void*)0) +#endif + +_PTR _EXFUN(memchr,(const _PTR, int, size_t)); +int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); +_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memset,(_PTR, int, size_t)); +char *_EXFUN(strcat,(char *, const char *)); +char *_EXFUN(strchr,(const char *, int)); +int _EXFUN(strcmp,(const char *, const char *)); +int _EXFUN(strcoll,(const char *, const char *)); +char *_EXFUN(strcpy,(char *, const char *)); +size_t _EXFUN(strcspn,(const char *, const char *)); +char *_EXFUN(strerror,(int)); +size_t _EXFUN(strlen,(const char *)); +char *_EXFUN(strncat,(char *, const char *, size_t)); +int _EXFUN(strncmp,(const char *, const char *, size_t)); +char *_EXFUN(strpbrk,(const char *, const char *)); +char *_EXFUN(strrchr,(const char *, int)); +size_t _EXFUN(strspn,(const char *, const char *)); +char *_EXFUN(strstr,(const char *, const char *)); +char *_EXFUN(strcasestr,(const char *, const char *)); + +size_t strlcpy(char *dst, const char *src, size_t siz); +size_t strlcat(char *dst, const char *src, size_t siz); + +#ifndef _REENT_ONLY +char *_EXFUN(strtok,(char *, const char *)); +#endif + +size_t _EXFUN(strxfrm,(char *, const char *, size_t)); + +#ifndef __STRICT_ANSI__ +char *_EXFUN(strtok_r,(char *, const char *, char **)); + +_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); +int _EXFUN(strcasecmp,(const char *, const char *)); +int _EXFUN(strncasecmp,(const char *, const char *, size_t)); + +#ifdef __CYGWIN__ +#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ +const char *_EXFUN(strsignal, (int __signo)); +#endif +int _EXFUN(strtosigno, (const char *__name)); +#endif + +/* These function names are used on Windows and perhaps other systems. */ +#ifndef strcmpi +#define strcmpi strcasecmp +#endif +#ifndef stricmp +#define stricmp strcasecmp +#endif +#ifndef strncmpi +#define strncmpi strncasecmp +#endif +#ifndef strnicmp +#define strnicmp strncasecmp +#endif + +#endif /* ! __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif +#endif /* _STRING_H_ */ diff --git a/firmware/libc/include/time.h b/firmware/libc/include/time.h new file mode 100644 index 0000000000..912fafe7ca --- /dev/null +++ b/firmware/libc/include/time.h @@ -0,0 +1,49 @@ +/* + * time.h + * + * Struct declaration for dealing with time. + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#ifdef WPSEDITOR +#include "inttypes.h" +#include +#endif + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +#if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED) +typedef long time_t; + +/* this define below is used by the mingw headers to prevent duplicate + typedefs */ +#define _TIME_T_DEFINED +#define _TIME_T_DECLARED +time_t time(time_t *t); +struct tm *localtime(const time_t *timep); +time_t mktime(struct tm *t); + +#endif /* SIMULATOR */ + +#ifdef __PCTOOL__ +/* this time.h does not define struct timespec, + so tell sys/stat.h not to use it */ +#undef __USE_MISC +#endif + +#endif /* _TIME_H_ */ + + -- cgit v1.2.3