2008-03-01 23:03:37 -08:00
|
|
|
#ifndef __EVIL_H__
|
|
|
|
#define __EVIL_H__
|
2008-02-27 13:01:30 -08:00
|
|
|
|
|
|
|
#ifdef EAPI
|
|
|
|
# undef EAPI
|
|
|
|
#endif /* EAPI */
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2008-03-05 01:19:38 -08:00
|
|
|
# ifdef EFL_EVIL_BUILD
|
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif /* ! DLL_EXPORT */
|
2008-02-27 13:01:30 -08:00
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
2008-03-05 01:19:38 -08:00
|
|
|
# endif /* ! EFL_EVIL_BUILD */
|
2008-02-27 13:01:30 -08:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
2008-06-06 10:44:59 -07:00
|
|
|
|
2008-02-27 13:01:30 -08:00
|
|
|
/**
|
|
|
|
* @mainpage Evil
|
2009-10-24 08:39:59 -07:00
|
|
|
* @image html e_big.png
|
2008-02-29 14:42:14 -08:00
|
|
|
* @author Vincent Torri
|
|
|
|
* @date 2008
|
2008-02-27 13:01:30 -08:00
|
|
|
*
|
|
|
|
* @section intro_sec Introduction
|
|
|
|
*
|
|
|
|
* The Evil library is an evil library that ports some evil Unix
|
|
|
|
* functions to the Windows (XP or Mobile) platform. The evilness is
|
|
|
|
* so huge that the most of the functions are not POSIX or BSD
|
|
|
|
* compliant.
|
|
|
|
*
|
|
|
|
* These functions are intended to be used in the Enlightenment
|
|
|
|
* Fundations Libraries only and can be compiled only on Windows.
|
|
|
|
*
|
|
|
|
* @section evil_sec Evil API Documentation
|
|
|
|
*
|
|
|
|
* Take a look at the evil documentation of the @ref Dlfcn.
|
|
|
|
*
|
|
|
|
* Take a look at the demoniac documentation of the @ref Mman.
|
|
|
|
*
|
|
|
|
* Take a look at the satanic documentation of the @ref Evil.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file evil.h
|
|
|
|
* @brief The file that provides miscellaneous functions ported from Unix.
|
|
|
|
* @defgroup Evil Miscellaneous functions ported from Unix.
|
|
|
|
*
|
|
|
|
* This header provides miscallenaous functions that exist on Unix
|
|
|
|
* but not on Windows platform. They try to follow the conformance of
|
|
|
|
* the Unix versions.
|
|
|
|
*/
|
|
|
|
|
2008-06-11 14:34:09 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
#undef WIN32_LEAN_AND_MEAN
|
|
|
|
|
2008-02-27 13:01:30 -08:00
|
|
|
#include <stdlib.h>
|
2008-12-09 22:15:03 -08:00
|
|
|
#include <stdio.h>
|
2008-02-27 13:01:30 -08:00
|
|
|
#include <sys/time.h>
|
2008-02-29 14:42:14 -08:00
|
|
|
#include <limits.h>
|
2008-06-11 14:34:09 -07:00
|
|
|
#include <sys/stat.h>
|
2008-06-29 05:09:48 -07:00
|
|
|
#include <fcntl.h>
|
2009-10-24 08:39:59 -07:00
|
|
|
#include <math.h>
|
2008-02-27 13:01:30 -08:00
|
|
|
|
2008-09-14 00:07:39 -07:00
|
|
|
|
2008-06-11 14:34:09 -07:00
|
|
|
#ifdef PATH_MAX
|
|
|
|
# undef PATH_MAX
|
|
|
|
#endif /* PATH_MAX */
|
|
|
|
|
|
|
|
#define PATH_MAX MAX_PATH
|
2008-03-22 01:35:43 -07:00
|
|
|
|
2008-09-14 00:07:39 -07:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
2009-02-19 12:03:58 -08:00
|
|
|
#include <io.h>
|
|
|
|
|
2008-09-14 23:56:14 -07:00
|
|
|
#define F_OK 0 /* Check for file existence */
|
|
|
|
#define X_OK 1 /* MS access() doesn't check for execute permission. */
|
|
|
|
#define W_OK 2 /* Check for write permission */
|
|
|
|
#define R_OK 4 /* Check for read permission */
|
|
|
|
|
|
|
|
#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
|
|
|
|
#define _S_IXUSR _S_IEXEC
|
|
|
|
#define _S_IWUSR _S_IWRITE
|
|
|
|
#define _S_IRUSR _S_IREAD
|
|
|
|
|
|
|
|
typedef int pid_t;
|
2008-09-14 00:07:39 -07:00
|
|
|
typedef SSIZE_T ssize_t;
|
|
|
|
typedef unsigned short mode_t;
|
|
|
|
|
2008-12-27 10:53:56 -08:00
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
typedef signed int int32_t;
|
2009-09-16 10:25:28 -07:00
|
|
|
typedef __int64 int64_t;
|
2008-12-27 10:53:56 -08:00
|
|
|
typedef unsigned __int64 uint64_t;
|
|
|
|
|
2008-09-14 00:07:39 -07:00
|
|
|
#endif /* _MSC_VER */
|
|
|
|
|
|
|
|
|
2008-02-27 13:01:30 -08:00
|
|
|
#ifndef __CEGCC__
|
|
|
|
|
2008-06-29 05:09:48 -07:00
|
|
|
typedef unsigned long uid_t;
|
|
|
|
typedef unsigned long gid_t;
|
|
|
|
|
2008-09-14 23:56:14 -07:00
|
|
|
#endif /* ! __CEGCC__ */
|
2008-06-11 14:34:09 -07:00
|
|
|
|
|
|
|
|
2008-09-14 23:56:14 -07:00
|
|
|
#include "evil_fcntl.h"
|
|
|
|
#include "evil_langinfo.h"
|
2008-11-21 14:57:45 -08:00
|
|
|
#include "evil_main.h"
|
2008-09-14 23:56:14 -07:00
|
|
|
#include "evil_stdlib.h"
|
2008-10-11 07:35:26 -07:00
|
|
|
#include "evil_stdio.h"
|
|
|
|
#include "evil_string.h"
|
2008-09-14 23:56:14 -07:00
|
|
|
#include "evil_unistd.h"
|
|
|
|
#include "evil_util.h"
|
2008-06-11 14:34:09 -07:00
|
|
|
|
|
|
|
|
2008-06-10 00:16:53 -07:00
|
|
|
#if defined(__MSDOS__) || defined(__EMX__) || \
|
|
|
|
(defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__))
|
|
|
|
# if defined(_MSC_VER) || defined(__MINGW32__)
|
|
|
|
|
|
|
|
# ifdef S_ISDIR
|
|
|
|
# undef S_ISDIR
|
|
|
|
# endif
|
|
|
|
# ifdef S_ISREG
|
|
|
|
# undef S_ISREG
|
|
|
|
# endif
|
|
|
|
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
|
|
|
|
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
|
|
|
|
|
|
|
|
# define S_IRUSR _S_IRUSR
|
|
|
|
# define S_IWUSR _S_IWUSR
|
|
|
|
# define S_IXUSR _S_IXUSR
|
|
|
|
# define S_IRGRP S_IRUSR
|
|
|
|
# define S_IROTH S_IRUSR
|
|
|
|
# define S_IWGRP S_IWUSR
|
|
|
|
# define S_IWOTH S_IWUSR
|
|
|
|
# define S_IXGRP S_IXUSR
|
|
|
|
# define S_IXOTH S_IXUSR
|
2008-06-29 05:09:48 -07:00
|
|
|
|
2008-10-29 04:07:43 -07:00
|
|
|
# define open(path, flag, ...) _open((path), _O_BINARY | (flag), __VA_ARGS__)
|
2008-06-10 00:16:53 -07:00
|
|
|
# define close(fd) _close(fd)
|
|
|
|
# define read(fd,buffer,count) _read((fd),(buffer),(count))
|
|
|
|
# define write(fd,buffer,count) _write((fd),(buffer),(count))
|
|
|
|
# define unlink(filename) _unlink((filename))
|
|
|
|
# define mkdir(p,m) _mkdir(p)
|
2009-10-24 08:39:59 -07:00
|
|
|
# define access(p,m) _access((p),(m))
|
2008-06-10 00:16:53 -07:00
|
|
|
# define lstat(f,s) _stat((f),(s))
|
|
|
|
# define strdup(s) _strdup(s)
|
2009-10-24 08:39:59 -07:00
|
|
|
# ifndef fileno
|
|
|
|
# define fileno(f) _fileno(f)
|
|
|
|
# endif
|
2009-09-16 11:05:04 -07:00
|
|
|
# define fdopen(fd,m) _fdopen((fd),(m))
|
2009-09-16 14:59:37 -07:00
|
|
|
# define tzset _tzset
|
2009-10-24 08:39:59 -07:00
|
|
|
# define hypot(x,y) _hypot((x),(y))
|
2008-06-10 00:16:53 -07:00
|
|
|
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-02-27 13:01:30 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-03-01 23:03:37 -08:00
|
|
|
#endif /* __EVIL_H__ */
|