diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-30 12:40:19 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-09-30 12:40:19 +0000 |
commit | ba9d696a3d912748237c8562d83863bbb6432765 (patch) | |
tree | 5b5537d773e7460efaecbc1912c7c967f5a09e03 /navit/support/libc | |
parent | 08acb219e6069de66b6342bcf3ae1e166bc9ba1f (diff) | |
download | navit-ba9d696a3d912748237c8562d83863bbb6432765.tar.gz |
Add:support_libc:Missing functions for vc
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4815 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/support/libc')
-rw-r--r-- | navit/support/libc/sys/stat.h | 196 | ||||
-rw-r--r-- | navit/support/libc/sys/time.h | 56 | ||||
-rw-r--r-- | navit/support/libc/sys/types.h | 124 |
3 files changed, 376 insertions, 0 deletions
diff --git a/navit/support/libc/sys/stat.h b/navit/support/libc/sys/stat.h new file mode 100644 index 000000000..3bd462714 --- /dev/null +++ b/navit/support/libc/sys/stat.h @@ -0,0 +1,196 @@ +/* + * stat.h + * This file has no copyright assigned and is placed in the Public Domain. + * This file is a part of the mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within the package. + * + * Symbolic constants for opening and creating files, also stat, fstat and + * chmod functions. + * + */ + +#ifndef _STAT_H_ +#define _STAT_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#define __need_size_t +#define __need_wchar_t +#ifndef RC_INVOKED +#include <stddef.h> +#endif /* Not RC_INVOKED */ + +#include <sys/types.h> + +/* + * Constants for the stat st_mode member. + */ +#define _S_IFIFO 0x1000 /* FIFO */ +#define _S_IFCHR 0x2000 /* Character */ +#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ +#define _S_IFDIR 0x4000 /* Directory */ +#define _S_IFREG 0x8000 /* Regular */ + +#define _S_IFMT 0xF000 /* File type mask */ + +#define _S_IEXEC 0x0040 +#define _S_IWRITE 0x0080 +#define _S_IREAD 0x0100 + +#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) +#define _S_IXUSR _S_IEXEC +#define _S_IWUSR _S_IWRITE +#define _S_IRUSR _S_IREAD + +#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) +#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) +#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK) +#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) + +#ifndef _NO_OLDNAMES + +#define S_IFIFO _S_IFIFO +#define S_IFCHR _S_IFCHR +#define S_IFBLK _S_IFBLK +#define S_IFDIR _S_IFDIR +#define S_IFREG _S_IFREG +#define S_IFMT _S_IFMT +#define S_IEXEC _S_IEXEC +#define S_IWRITE _S_IWRITE +#define S_IREAD _S_IREAD +#define S_IRWXU _S_IRWXU +#define S_IXUSR _S_IXUSR +#define S_IWUSR _S_IWUSR +#define S_IRUSR _S_IRUSR + +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#endif /* Not _NO_OLDNAMES */ + +#ifndef RC_INVOKED + +#ifndef _STAT_DEFINED +/* + * The structure manipulated and returned by stat and fstat. + * + * NOTE: If called on a directory the values in the time fields are not only + * invalid, they will cause localtime et. al. to return NULL. And calling + * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! + */ +struct _stat +{ + _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + _ino_t st_ino; /* Always zero ? */ + _mode_t st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + short st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + _dev_t st_rdev; /* Seems useless (not even filled in) */ + _off_t st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local + * on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ +}; + +#ifndef _NO_OLDNAMES +/* NOTE: Must be the same as _stat above. */ +struct stat +{ + dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + ino_t st_ino; /* Always zero ? */ + mode_t st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + short st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + dev_t st_rdev; /* Seems useless (not even filled in) */ + off_t st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local + * on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ +}; +#endif /* _NO_OLDNAMES */ + +#if defined (__MSVCRT__) +struct _stati64 { + _dev_t st_dev; + _ino_t st_ino; + _mode_t st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +}; +#if __MSVCRT_VERSION__ >= 0x0601 +struct __stat64 +{ + _dev_t st_dev; + _ino_t st_ino; + _mode_t st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; +}; +#endif /* __MSVCRT_VERSION__ */ +#endif /* __MSVCRT__ */ +#define _STAT_DEFINED +#endif /* _STAT_DEFINED */ + +#ifdef __cplusplus +extern "C" { +#endif + +_CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat*); +_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); +_CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat*); + +#ifndef _NO_OLDNAMES + +/* These functions live in liboldnames.a. */ +_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*); +_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); +_CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); + +#endif /* Not _NO_OLDNAMES */ + +#if defined (__MSVCRT__) +_CRTIMP int __cdecl __MINGW_NOTHROW _fstati64(int, struct _stati64 *); +_CRTIMP int __cdecl __MINGW_NOTHROW _stati64(const char *, struct _stati64 *); +/* These require newer versions of msvcrt.dll (6.10 or higher). */ +#if __MSVCRT_VERSION__ >= 0x0601 +_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*); +_CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*); +#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat(const wchar_t*, struct _stat*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); +#if __MSVCRT_VERSION__ >= 0x0601 +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); +#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#define _WSTAT_DEFINED +#endif /* _WSTAT_DEFIND */ +#endif /* __MSVCRT__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _STAT_H_ */ diff --git a/navit/support/libc/sys/time.h b/navit/support/libc/sys/time.h new file mode 100644 index 000000000..871da3f1b --- /dev/null +++ b/navit/support/libc/sys/time.h @@ -0,0 +1,56 @@ +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec != (uvp)->tv_sec) ? \ + ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ + ((tvp)->tv_usec cmp (uvp)->tv_usec)) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ + +/* Provided for compatibility with code that assumes that + the presence of gettimeofday function implies a definition + of struct timezone. */ +#ifndef _TIMEZONE_DEFINED +struct timezone +{ + int tz_minuteswest; /* of Greenwich */ + int tz_dsttime; /* type of dst correction to apply */ +}; +#define _TIMEZONE_DEFINED +#endif + +/* + Implementation as per: + The Open Group Base Specifications, Issue 6 + IEEE Std 1003.1, 2004 Edition + + The timezone pointer arg is ignored. Errors are ignored. +*/ + +#if 0 +#define __restrict__ +int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__, + void *__restrict__ /* tzp (unused) */); +#else +int gettimeofday(struct timeval *, void *); +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* _SYS_TIME_H_ */ diff --git a/navit/support/libc/sys/types.h b/navit/support/libc/sys/types.h new file mode 100644 index 000000000..ed25e5270 --- /dev/null +++ b/navit/support/libc/sys/types.h @@ -0,0 +1,124 @@ +/* + * types.h + * This file has no copyright assigned and is placed in the Public Domain. + * This file is a part of the mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within the package. + * + * The definition of constants, data types and global variables. + * + */ + +#ifndef _TYPES_H_ +#define _TYPES_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#define __need_wchar_t +#define __need_size_t +#define __need_ptrdiff_t +#ifndef RC_INVOKED +#include <stddef.h> +#endif /* Not RC_INVOKED */ + +#ifndef RC_INVOKED + +#ifndef _TIME_T_DEFINED +typedef long time_t; +#define _TIME_T_DEFINED +#endif + +#ifndef _TIME64_T_DEFINED +typedef __int64 __time64_t; +#define _TIME64_T_DEFINED +#endif + +#ifndef _OFF_T_ +#define _OFF_T_ +typedef long _off_t; + +#ifndef _NO_OLDNAMES +typedef _off_t off_t; +#endif +#endif /* Not _OFF_T_ */ + + +#ifndef _DEV_T_ +#define _DEV_T_ +#ifdef __MSVCRT__ +typedef unsigned int _dev_t; +#else +typedef short _dev_t; +#endif + +#ifndef _NO_OLDNAMES +typedef _dev_t dev_t; +#endif +#endif /* Not _DEV_T_ */ + + +#ifndef _INO_T_ +#define _INO_T_ +typedef short _ino_t; + +#ifndef _NO_OLDNAMES +typedef _ino_t ino_t; +#endif +#endif /* Not _INO_T_ */ + + +#ifndef _PID_T_ +#define _PID_T_ +typedef int _pid_t; + +#ifndef _NO_OLDNAMES +typedef _pid_t pid_t; +#endif +#endif /* Not _PID_T_ */ + + +#ifndef _MODE_T_ +#define _MODE_T_ +typedef unsigned short _mode_t; + +#ifndef _NO_OLDNAMES +typedef _mode_t mode_t; +#endif +#endif /* Not _MODE_T_ */ + + +#ifndef _SIGSET_T_ +#define _SIGSET_T_ +typedef int _sigset_t; + +#ifndef _NO_OLDNAMES +typedef _sigset_t sigset_t; +#endif +#endif /* Not _SIGSET_T_ */ + +#ifndef _SSIZE_T_ +#define _SSIZE_T_ +typedef long _ssize_t; + +#ifndef _NO_OLDNAMES +typedef _ssize_t ssize_t; +#endif +#endif /* Not _SSIZE_T_ */ + +#ifndef _FPOS64_T_ +#define _FPOS64_T_ +typedef long long fpos64_t; +#endif + +#ifndef _OFF64_T_ +#define _OFF64_T_ +typedef long long off64_t; +#endif + +#if !defined __NO_ISOCEXT +typedef unsigned int useconds_t; +#endif /* Not __NO_ISOCEXT */ + +#endif /* Not RC_INVOKED */ + +#endif /* Not _TYPES_H_ */ |