forked from enlightenment/efl
windows: Add tons of posix header stubs.
This commit is contained in:
parent
0d2fdc2bb9
commit
f91b6786b3
|
@ -124,6 +124,7 @@ exit /B 0
|
|||
:: ------------------------------------
|
||||
:: Default flags for native compilation
|
||||
set CFLAGS=-Wno-language-extension-token %CFLAGS%
|
||||
set CFLAGS=-DWIN32_LEAN_AND_MEAN %CFLAGS%
|
||||
|
||||
if defined VERBOSE (
|
||||
set CFLAGS=-v %CFLAGS%
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CYGWIN
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -226,5 +224,3 @@ eina_counter_dump(Eina_Counter *counter)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
#ifdef EFL_HAVE_THREADS
|
||||
# ifdef _WIN32
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# elif defined (__sun) || defined(__GNU__) || defined(__CYGWIN__)
|
||||
# include <unistd.h>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#ifndef EINA_INLINE_PRIVATE_H_
|
||||
# define EINA_INLINE_PRIVATE_H_
|
||||
|
||||
#ifdef HAVE_CYGWIN
|
||||
|
||||
# include <time.h>
|
||||
# include <sys/time.h>
|
||||
|
||||
|
@ -77,4 +75,3 @@ _eina_time_delta(Eina_Nano_Time *start, Eina_Nano_Time *end)
|
|||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#define EINA_XATTR_H_
|
||||
|
||||
#include "eina_types.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
//#endif
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Tools_Group Tools
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
@echo "static const char *embedded_config = \"\"" > %~2
|
||||
:: TODO: Sorry, no sed :)
|
||||
@echo "\"\";" >> %~2
|
|
@ -258,7 +258,11 @@ endforeach
|
|||
|
||||
eolian_include_directories += ['-I', meson.current_source_dir()]
|
||||
|
||||
embed_script = find_program('config_embed')
|
||||
if sys_windows == true
|
||||
embed_script = find_program('config_embed.bat')
|
||||
else
|
||||
embed_script = find_program('config_embed')
|
||||
endif
|
||||
|
||||
embed_config = custom_target('create_embedded_default_config',
|
||||
input: join_paths(meson.source_root(), 'data', 'elementary', 'config', 'standard', 'base.src.in'),
|
||||
|
|
|
@ -444,7 +444,7 @@ extern "C" {
|
|||
Embryo_Cell c;
|
||||
} Embryo_Float_Cell;
|
||||
|
||||
#if defined _MSC_VER || defined __SUNPRO_C
|
||||
#ifdef __SUNPRO_C
|
||||
/** Float to Embryo_Cell */
|
||||
# define EMBRYO_FLOAT_TO_CELL(f) (((Embryo_Float_Cell *)&(f))->c)
|
||||
/** Embryo_Cell to float */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __EVIL_STDLIB_H__
|
||||
#define __EVIL_STDLIB_H__
|
||||
|
||||
#include <evil_private.h>
|
||||
|
||||
/**
|
||||
* @file evil_stdlib.h
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI char *strcasestr(const char *haystack, const char *needle);
|
||||
//EAPI char *strcasestr(const char *haystack, const char *needle);
|
||||
|
||||
/**
|
||||
* @brief Implements the strsep function which is used to separate strings.
|
||||
|
|
|
@ -3,12 +3,20 @@
|
|||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <inttypes.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include "evil_private.h"
|
||||
|
||||
inline struct tm *localtime_r(const time_t * time, struct tm * result)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* strptime
|
||||
* based on http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD
|
||||
|
@ -68,6 +76,10 @@ static const char * const nadt[5] = {
|
|||
"EDT", "CDT", "MDT", "PDT", "\0\0\0"
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds string in string table starting from table entry `n1` until entry
|
||||
* `n2`.
|
||||
*/
|
||||
static const unsigned char *
|
||||
find_string(const unsigned char *bp, int *tgt,
|
||||
const char *const *n1, const char *const *n2,
|
||||
|
@ -416,8 +428,15 @@ strptime(const char *buf, const char *fmt, struct tm *tm)
|
|||
}
|
||||
else
|
||||
{
|
||||
TIME_ZONE_INFORMATION zone_info;
|
||||
GetTimeZoneInformation(&zone_info);
|
||||
const char timezone_table[3] = {
|
||||
zone_info.StandardName,
|
||||
zone_info.DaylightName,
|
||||
NULL,
|
||||
};
|
||||
ep = find_string(bp, &i,
|
||||
(const char * const *)tzname,
|
||||
(const char * const *)timezone_table,
|
||||
NULL, 2);
|
||||
if (ep != NULL)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef UNPOSIX_FNMATCH_H
|
||||
#define UNPOSIX_FNMATCH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// The string does not match the specified pattern.
|
||||
#define FNM_NOMATCH 1
|
||||
// <slash> in string only matches <slash> in pattern.
|
||||
#define FNM_PATHNAME (1 << 0)
|
||||
// Disable backslash escaping.
|
||||
#define FNM_NOESCAPE (1 << 1)
|
||||
// Leading <period> in string must be exactly matched by <period> in pattern.
|
||||
#define FNM_PERIOD (1 << 2)
|
||||
|
||||
int fnmatch(const char *, const char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef UNPOSIX_GETOPT_H
|
||||
#define UNPOSIX_GETOPT_H
|
||||
|
||||
#include "unimplemented.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
UNIMPLEMENTED int getopt(int argc, char * const argv[],
|
||||
const char *optstring)
|
||||
{
|
||||
#warning getopt is not implemented
|
||||
}
|
||||
|
||||
#include_next <getopt.h>
|
||||
|
||||
UNIMPLEMENTED int getopt_long(int argc, char * const argv[],
|
||||
const char *optstring,
|
||||
const struct option *longopts, int *longindex)
|
||||
{
|
||||
#warning getopt_long is not implemented
|
||||
}
|
||||
|
||||
UNIMPLEMENTED int getopt_long_only(int argc, char * const argv[],
|
||||
const char *optstring,
|
||||
const struct option *longopts, int *longindex)
|
||||
{
|
||||
#warning getopt_long_only is not implemented
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef UNPOSIX_LIBGEN_H
|
||||
#define UNPOSIX_LIBGEN_H
|
||||
|
||||
char *basename(char *);
|
||||
char *dirname(char *);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef UNPOSIX_LIMITS_H
|
||||
#define UNPOSIX_LIMITS_H
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# undef WIN32_LEAN_AND_MEAN
|
||||
# include_next <limits.h>
|
||||
# ifndef PATH_MAX
|
||||
# define PATH_MAX MAX_PATH
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef UNPOSIX_LOCALE_H
|
||||
#define UNPOSIX_LOCALE_H
|
||||
|
||||
#include_next <locale.h>
|
||||
typedef _locale_t locale_t;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef UNPOSIX_MATH_H
|
||||
#define UNPOSIX_MATH_H
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#include_next <math.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -1,28 +1,68 @@
|
|||
#ifndef PTHREAD_H
|
||||
#define PTHREAD_H
|
||||
|
||||
struct pthread_key_t { int x; };
|
||||
#include "unimplemented.h"
|
||||
|
||||
typedef struct pthread_key_t pthread_key_t;
|
||||
UNIMPLEMENTED typedef unsigned long long pthread_t;
|
||||
|
||||
typedef struct { int x; } sem_t;
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_mutexattr)
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_condattr)
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_attr)
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_rwlock)
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_cond)
|
||||
UNIMPLEMENTED_STRUCT_T(pthread_mutex)
|
||||
UNIMPLEMENTED_STRUCT_T(sem)
|
||||
|
||||
struct pthread_mutex_t { int x; };
|
||||
UNIMPLEMENTED struct sched_param {
|
||||
int sched_priority;
|
||||
};
|
||||
|
||||
typedef struct pthread_mutex_t pthread_mutex_t;
|
||||
UNIMPLEMENTED typedef int pthread_key_t;
|
||||
|
||||
struct pthread_cond_t { int x; };
|
||||
#define SCHED_RR 5
|
||||
#define SCHED_FIFO 6
|
||||
|
||||
typedef struct pthread_cond_t pthread_cond_t;
|
||||
#define PTHREAD_BARRIER_SERIAL_THREAD 1
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 2
|
||||
#define PTHREAD_CANCEL_ENABLE 3
|
||||
#define PTHREAD_CANCEL_DEFERRED 4
|
||||
#define PTHREAD_CANCEL_DISABLE 5
|
||||
#define PTHREAD_CANCELED 6
|
||||
#define PTHREAD_CREATE_DETACHED 7
|
||||
#define PTHREAD_CREATE_JOINABLE 8
|
||||
#define PTHREAD_EXPLICIT_SCHED 9
|
||||
#define PTHREAD_INHERIT_SCHED 10
|
||||
#define PTHREAD_MUTEX_DEFAULT 11
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 12
|
||||
#define PTHREAD_MUTEX_NORMAL 13
|
||||
#define PTHREAD_MUTEX_RECURSIVE 14
|
||||
#define PTHREAD_MUTEX_ROBUST 15
|
||||
#define PTHREAD_MUTEX_STALLED 16
|
||||
#define PTHREAD_ONCE_INIT 17
|
||||
#define PTHREAD_PRIO_INHERIT 18
|
||||
#define PTHREAD_PRIO_NONE 19
|
||||
#define PTHREAD_PRIO_PROTECT 20
|
||||
#define PTHREAD_PROCESS_SHARED 21
|
||||
#define PTHREAD_PROCESS_PRIVATE 22
|
||||
#define PTHREAD_SCOPE_PROCESS 23
|
||||
#define PTHREAD_SCOPE_SYSTEM 24
|
||||
|
||||
struct pthread_rwlock_t { int x; };
|
||||
UNIMPLEMENTED inline int pthread_mutex_trylock(void* m)
|
||||
{
|
||||
#warning pthread_mutex_trylock is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct pthread_rwlock_t pthread_rwlock_t;
|
||||
UNIMPLEMENTED inline int pthread_mutex_lock(void* m)
|
||||
{
|
||||
#warning pthread_mutex_lock is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* struct pthread_t { int x; }; */
|
||||
|
||||
/* typedef struct pthread_t pthread_t; */
|
||||
|
||||
typedef unsigned long long pthread_t;
|
||||
UNIMPLEMENTED inline int pthread_mutex_unlock(void* m)
|
||||
{
|
||||
#warning pthread_mutex_unlock is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,17 +1,59 @@
|
|||
#ifndef SEMAPHORE_H
|
||||
#define SEMAPHORE_H
|
||||
|
||||
int sem_close(sem_t *);
|
||||
int sem_destroy(sem_t *);
|
||||
int sem_getvalue(sem_t *restrict, int *restrict);
|
||||
int sem_init(sem_t *, int, unsigned);
|
||||
sem_t *sem_open(const char *, int, ...);
|
||||
int sem_post(sem_t *);
|
||||
int sem_timedwait(sem_t *restrict, const struct timespec *restrict);
|
||||
int sem_trywait(sem_t *);
|
||||
int sem_unlink(const char *);
|
||||
int sem_wait(sem_t *);
|
||||
#include "unimplemented.h"
|
||||
|
||||
UNIMPLEMENTED_STRUCT_T(sem)
|
||||
|
||||
UNIMPLEMENTED inline int sem_close(sem_t* sem)
|
||||
{
|
||||
#warning sem_close is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_destroy(sem_t* sem)
|
||||
{
|
||||
#warning sem_destroy is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_getvalue(sem_t* restrict sem, int* restrict x)
|
||||
{
|
||||
#warning sem_getvalue is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_init(sem_t* sem, int x, unsigned y)
|
||||
{
|
||||
#warning sem_init is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline sem_t* sem_open(const char* name, int x, ...)
|
||||
{
|
||||
#warning sem_open is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_post(sem_t* sem)
|
||||
{
|
||||
#warning sem_post is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_timedwait(sem_t* restrict sem, const struct timespec* restrict timeout)
|
||||
{
|
||||
#warning sem_timedwait is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_trywait(sem_t* sem)
|
||||
{
|
||||
#warning sem_trywait is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_unlink(const char* name)
|
||||
{
|
||||
#warning sem_unlink is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int sem_wait(sem_t* sem)
|
||||
{
|
||||
#warning sem_wait is not implemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef UNPOSIX_STDLIB_H
|
||||
#define UNPOSIX_STDLIB_H
|
||||
|
||||
#include "unimplemented.h"
|
||||
|
||||
#include <evil_stdlib.h>
|
||||
|
||||
UNIMPLEMENTED inline int mkstemp(char* template)
|
||||
{
|
||||
#warning mkstemp is not implemented
|
||||
return 0;
|
||||
}
|
||||
UNIMPLEMENTED inline int mkostemp(char* template, int flags)
|
||||
{
|
||||
#warning mkostemp is not implemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED inline int mkostemps(char* template, int suffixlen, int flags)
|
||||
{
|
||||
#warning mkostemps is not implemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include_next <stdlib.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef UNPOSIX_STRING_H
|
||||
#define UNPOSIX_STRING_H
|
||||
|
||||
#include_next <string.h>
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef UNPOSIX_STRINGS_H
|
||||
#define UNPOSIX_STRINGS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <locale.h>
|
||||
|
||||
inline int ffs(int i)
|
||||
{
|
||||
#warning ffs is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int strcasecmp(const char* s1, const char* s2)
|
||||
{
|
||||
#warning strcasecmp is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int strcasecmp_l(const char* s1, const char* s2, locale_t locale)
|
||||
{
|
||||
#warning strcasecmp_l is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int strncasecmp(const char* s1, const char* s2, size_t size)
|
||||
{
|
||||
#warning strncasecmp is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int strncasecmp_l(const char* s1, const char* s2, size_t size, locale_t locale)
|
||||
{
|
||||
#warning strncasecmp_l is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef UNPOSIX_SYS_STAT_H
|
||||
#define UNPOSIX_SYS_STAT_H
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <../ucrt/sys/types.h>
|
||||
#include_next <sys/stat.h>
|
||||
#include <corecrt.h>
|
||||
|
||||
// Missing definitions:
|
||||
// Note: some pieces of code were based on LibreSSL-Portable's compat lib and
|
||||
// adapted to EFL standards.
|
||||
#if defined(_MSC_VER)
|
||||
# define S_IRWXU 0 /* RWX user */
|
||||
# define S_IRUSR S_IREAD /* Read user */
|
||||
# define S_IWUSR S_IWRITE /* Write user */
|
||||
# define S_IXUSR 0 /* Execute user */
|
||||
# define S_IRWXG 0 /* RWX group */
|
||||
# define S_IRGRP 0 /* Read group */
|
||||
# define S_IWGRP 0 /* Write group */
|
||||
# define S_IXGRP 0 /* Execute group */
|
||||
# define S_IRWXO 0 /* RWX others */
|
||||
# define S_IROTH 0 /* Read others */
|
||||
# define S_IWOTH 0 /* Write others */
|
||||
# define S_IXOTH 0 /* Execute others */
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,12 +1,26 @@
|
|||
#ifndef TIME_H
|
||||
#define TIME_H
|
||||
|
||||
//typedef long time_t;
|
||||
#include "unimplemented.h"
|
||||
|
||||
// Windows Kit for Windows 10 already defines `struct timeval` and `time_t`
|
||||
#include <winsock2.h>
|
||||
|
||||
typedef unsigned short u_short;
|
||||
|
||||
typedef long suseconds_t;
|
||||
|
||||
typedef struct timeval timeval;
|
||||
|
||||
int gettimeofday(timeval* a, void* b);
|
||||
UNIMPLEMENTED inline int gettimeofday(struct timeval* a, void* b) {
|
||||
#warning gettimeofday is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
UNIMPLEMENTED inline struct tm *localtime_r(const time_t * time, struct tm * result)
|
||||
{
|
||||
#warning localtime_r is not implemented.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef UNPOSIX_SYS_TYPES_H
|
||||
#define UNPOSIX_SYS_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <BaseTsd.h>
|
||||
#define ssize_t SSIZE_T
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Defines stubs for unimplemented features/functions/structs in UNPOSIX namespace.
|
||||
*/
|
||||
#ifndef UNPOSIX_UNIMPLEMENTED_H
|
||||
#define UNPOSIX_UNIMPLEMENTED_H
|
||||
|
||||
#define UNIMPLEMENTED // For future checks. Use when some type is just a stub to implement later.
|
||||
|
||||
UNIMPLEMENTED struct unimplemented {
|
||||
int attr;
|
||||
};
|
||||
|
||||
UNIMPLEMENTED typedef struct unimplemented unimplemented_struct_t;
|
||||
|
||||
#define UNIMPLEMENTED_STRUCT_T(type) typedef unimplemented_struct_t type ## _t;
|
||||
#define UNIMPLEMENTED_STRUCT(type) struct type { int x; };
|
||||
|
||||
#endif
|
|
@ -1,6 +1,16 @@
|
|||
#ifndef UNISTD_H
|
||||
#define UNISTD_H
|
||||
|
||||
#include "unimplemented.h"
|
||||
|
||||
#include <evil_unistd.h>
|
||||
|
||||
#define F_OK 0
|
||||
#define W_OK 2
|
||||
#define R_OK 4
|
||||
#define X_OK 0
|
||||
|
||||
UNIMPLEMENTED extern char *optarg;
|
||||
UNIMPLEMENTED extern int optind, opterr, optopt;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue