summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/evil/ChangeLog20
-rw-r--r--legacy/evil/configure.ac2
-rw-r--r--legacy/evil/src/lib/Evil.h112
-rw-r--r--legacy/evil/src/lib/dlfcn/dlfcn.h2
-rw-r--r--legacy/evil/src/lib/evil.c138
-rw-r--r--legacy/evil/src/lib/mman/sys/mman.h2
6 files changed, 150 insertions, 126 deletions
diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog
index 4c70e49f01..b96070b5db 100644
--- a/legacy/evil/ChangeLog
+++ b/legacy/evil/ChangeLog
@@ -1,3 +1,23 @@
12008-06-10 Vincent Torri <doursse at users dot sf dot net>
2
3 * configure.ac:
4 * src/lib/dlfcn/dlfcn.h:
5 * src/lib/mman/sys/mman.h:
6 define EFL_EVIL_MMAN_BUILD and EFL_EVIL_DLFCN_BUILD so
7 that functions in Evil.h are not declared as import
8
9 * src/lib/evil.c: (setenv), (unsetenv), (realpath),
10 (evil_sockets_init), (evil_sockets_shutdown), (evil_pipe),
11 (evil_tmpdir_get), (evil_homedir_get):
12 rename pipe() to evil_pipe().
13 set tmpdir to "Temp" and homedir to "My Documents" on WinCE
14
15 * src/lib/Evil.h:
16 define pipe() as evil_pipe(). This allow to use our pipe()
17 implementation to be usedwith cegcc, as it is broken on that
18 platform.
19 move the defines at the end of the file
20
12008-06-09 Vincent Torri <doursse at users dot sf dot net> 212008-06-09 Vincent Torri <doursse at users dot sf dot net>
2 22
3 * src/lib/Evil.h: 23 * src/lib/Evil.h:
diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac
index dcaf907b82..7da7ba1247 100644
--- a/legacy/evil/configure.ac
+++ b/legacy/evil/configure.ac
@@ -33,6 +33,8 @@ AC_SUBST(lt_enable_auto_import)
33 33
34dnl needed for correct definition of EAPI 34dnl needed for correct definition of EAPI
35AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) 35AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built])
36AC_DEFINE(EFL_EVIL_MMAM_BUILD, 1, [Define to mention that evil is built])
37AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil is built])
36 38
37AM_INIT_AUTOMAKE(1.6 dist-bzip2) 39AM_INIT_AUTOMAKE(1.6 dist-bzip2)
38 40
diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h
index 9283748613..d041752b4d 100644
--- a/legacy/evil/src/lib/Evil.h
+++ b/legacy/evil/src/lib/Evil.h
@@ -287,25 +287,6 @@ EAPI int symlink(const char *oldpath, const char *newpath);
287EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz); 287EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
288 288
289/** 289/**
290 * @brief Create a pair of sockets.
291 *
292 * @param fds A pointer that contains two sockets.
293 *
294 * Create a pair of sockets that can be use with select().
295 * Hence, evil_sockets_init() must have been caled at least
296 * once before. Contrary to Unix, that functions does not
297 * create a pair of file descriptors.
298 *
299 * Conformity: Not applicable.
300 *
301 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
302 * Windows XP.
303 *
304 * @ingroup Evil
305 */
306EAPI int pipe(int *fds);
307
308/**
309 * @brief Create, modify, or remove environment variables. 290 * @brief Create, modify, or remove environment variables.
310 * 291 *
311 * @param name The name of the environment variable. 292 * @param name The name of the environment variable.
@@ -349,42 +330,6 @@ EAPI int unsetenv(const char *name);
349 330
350#endif /* ! __CEGCC__ */ 331#endif /* ! __CEGCC__ */
351 332
352
353#if defined(__MSDOS__) || defined(__EMX__) || \
354 (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__))
355# if defined(_MSC_VER) || defined(__MINGW32__)
356
357# ifdef S_ISDIR
358# undef S_ISDIR
359# endif
360# ifdef S_ISREG
361# undef S_ISREG
362# endif
363# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
364# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
365
366# define S_IRUSR _S_IRUSR
367# define S_IWUSR _S_IWUSR
368# define S_IXUSR _S_IXUSR
369# define S_IRGRP S_IRUSR
370# define S_IROTH S_IRUSR
371# define S_IWGRP S_IWUSR
372# define S_IWOTH S_IWUSR
373# define S_IXGRP S_IXUSR
374# define S_IXOTH S_IXUSR
375# define open(path,...) _open((path),__VA_ARGS__)
376# define close(fd) _close(fd)
377# define read(fd,buffer,count) _read((fd),(buffer),(count))
378# define write(fd,buffer,count) _write((fd),(buffer),(count))
379# define unlink(filename) _unlink((filename))
380# define mkdir(p,m) _mkdir(p)
381# define getcwd(b,s) _getcwd((b),(s))
382# define lstat(f,s) _stat((f),(s))
383# define strdup(s) _strdup(s)
384
385# endif
386#endif
387
388/** 333/**
389 * @brief Return an absolute or full path name for a specified relative path name. 334 * @brief Return an absolute or full path name for a specified relative path name.
390 * 335 *
@@ -443,6 +388,25 @@ EAPI int evil_sockets_init(void);
443EAPI void evil_sockets_shutdown(void); 388EAPI void evil_sockets_shutdown(void);
444 389
445/** 390/**
391 * @brief Create a pair of sockets.
392 *
393 * @param fds A pointer that contains two sockets.
394 *
395 * Create a pair of sockets that can be use with select().
396 * Hence, evil_sockets_init() must have been caled at least
397 * once before. Contrary to Unix, that functions does not
398 * create a pair of file descriptors.
399 *
400 * Conformity: Not applicable.
401 *
402 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
403 * Windows XP.
404 *
405 * @ingroup Evil
406 */
407EAPI int evil_pipe(int *fds);
408
409/**
446 * @brief Return a dir to store temporary files. 410 * @brief Return a dir to store temporary files.
447 * 411 *
448 * @return The directory to store temporary files. 412 * @return The directory to store temporary files.
@@ -563,6 +527,44 @@ EAPI char *evil_wchar_to_char(const wchar_t *text);
563EAPI char *evil_last_error_get(void); 527EAPI char *evil_last_error_get(void);
564 528
565 529
530#if defined(__MSDOS__) || defined(__EMX__) || \
531 (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__))
532# if defined(_MSC_VER) || defined(__MINGW32__)
533
534# ifdef S_ISDIR
535# undef S_ISDIR
536# endif
537# ifdef S_ISREG
538# undef S_ISREG
539# endif
540# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
541# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
542
543# define S_IRUSR _S_IRUSR
544# define S_IWUSR _S_IWUSR
545# define S_IXUSR _S_IXUSR
546# define S_IRGRP S_IRUSR
547# define S_IROTH S_IRUSR
548# define S_IWGRP S_IWUSR
549# define S_IWOTH S_IWUSR
550# define S_IXGRP S_IXUSR
551# define S_IXOTH S_IXUSR
552# define open(path,...) _open((path),__VA_ARGS__)
553# define close(fd) _close(fd)
554# define read(fd,buffer,count) _read((fd),(buffer),(count))
555# define write(fd,buffer,count) _write((fd),(buffer),(count))
556# define unlink(filename) _unlink((filename))
557# define mkdir(p,m) _mkdir(p)
558# define getcwd(b,s) _getcwd((b),(s))
559# define lstat(f,s) _stat((f),(s))
560# define strdup(s) _strdup(s)
561
562# endif
563#endif
564
565#define pipe(fd) evil_pipe(fd)
566
567
566#ifdef __cplusplus 568#ifdef __cplusplus
567} 569}
568#endif 570#endif
diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.h b/legacy/evil/src/lib/dlfcn/dlfcn.h
index 7a15ba7ec3..bf5a82f311 100644
--- a/legacy/evil/src/lib/dlfcn/dlfcn.h
+++ b/legacy/evil/src/lib/dlfcn/dlfcn.h
@@ -14,7 +14,7 @@
14#endif /* EAPI */ 14#endif /* EAPI */
15 15
16#ifdef _WIN32 16#ifdef _WIN32
17# ifdef EFL_EVIL_BUILD 17# ifdef EFL_EVIL_DLFCN_BUILD
18# ifdef DLL_EXPORT 18# ifdef DLL_EXPORT
19# define EAPI __declspec(dllexport) 19# define EAPI __declspec(dllexport)
20# else 20# else
diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c
index 9ebf3b9f0c..e1bb61c807 100644
--- a/legacy/evil/src/lib/evil.c
+++ b/legacy/evil/src/lib/evil.c
@@ -245,12 +245,78 @@ readlink(const char *path, char *buf, size_t bufsiz)
245 return -1; 245 return -1;
246} 246}
247 247
248int
249setenv(const char *name, const char *value)
250{
251 char *str;
252 int length;
253 int res;
254
255 length = strlen(name) + strlen(value) + 2;
256 str = (char *)malloc(length);
257 sprintf(str, "%s=%s", name, value);
258 res = _putenv(str);
259 free(str);
260
261 return res;
262}
263
264int
265unsetenv(const char *name)
266{
267 char *str;
268 int length;
269 int res;
270
271 length = strlen(name) + 2;
272 str = (char *)malloc(length);
273 sprintf(str, "%s=", name);
274 res = _putenv(str);
275 free(str);
276
277 return res;
278}
279
280#endif /* ! __CEGCC__ */
281
282char *
283realpath(const char *file_name, char *resolved_name)
284{
285#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
286 return _fullpath(resolved_name, file_name, PATH_MAX);
287#else
288 int length;
289
290 length = strlen(file_name);
291 if ((length + 1) > PATH_MAX)
292 length = PATH_MAX - 1;
293 memcpy(resolved_name, file_name, length);
294 resolved_name[length] = '\0';
295
296 return resolved_name;
297#endif /* __CEGCC__ || __MINGW32CE__ */
298}
299
300int
301evil_sockets_init(void)
302{
303 WSADATA wsa_data;
304
305 return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0;
306}
307
308void
309evil_sockets_shutdown(void)
310{
311 WSACleanup();
312}
313
248/* 314/*
249 * The code of the following functions has been kindly offered 315 * The code of the following functions has been kindly offered
250 * by Tor Lillqvist. 316 * by Tor Lillqvist.
251 */ 317 */
252int 318int
253pipe(int *fds) 319evil_pipe(int *fds)
254{ 320{
255 struct sockaddr_in saddr; 321 struct sockaddr_in saddr;
256 struct timeval tv; 322 struct timeval tv;
@@ -355,77 +421,11 @@ pipe(int *fds)
355 return -1; 421 return -1;
356} 422}
357 423
358int
359setenv(const char *name, const char *value)
360{
361 char *str;
362 int length;
363 int res;
364
365 length = strlen(name) + strlen(value) + 2;
366 str = (char *)malloc(length);
367 sprintf(str, "%s=%s", name, value);
368 res = _putenv(str);
369 free(str);
370
371 return res;
372}
373
374int
375unsetenv(const char *name)
376{
377 char *str;
378 int length;
379 int res;
380
381 length = strlen(name) + 2;
382 str = (char *)malloc(length);
383 sprintf(str, "%s=", name);
384 res = _putenv(str);
385 free(str);
386
387 return res;
388}
389
390#endif /* ! __CEGCC__ */
391
392char *
393realpath(const char *file_name, char *resolved_name)
394{
395#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
396 return _fullpath(resolved_name, file_name, PATH_MAX);
397#else
398 int length;
399
400 length = strlen(file_name);
401 if ((length + 1) > PATH_MAX)
402 length = PATH_MAX - 1;
403 memcpy(resolved_name, file_name, length);
404 resolved_name[length] = '\0';
405
406 return resolved_name;
407#endif /* __CEGCC__ || __MINGW32CE__ */
408}
409
410int
411evil_sockets_init(void)
412{
413 WSADATA wsa_data;
414
415 return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0;
416}
417
418void
419evil_sockets_shutdown(void)
420{
421 WSACleanup();
422}
423
424const char * 424const char *
425evil_tmpdir_get(void) 425evil_tmpdir_get(void)
426{ 426{
427#ifdef _WIN32_WCE 427#ifdef _WIN32_WCE
428 return "\\windows"; 428 return "\\temp";
429#else 429#else
430 char *tmpdir; 430 char *tmpdir;
431 431
@@ -443,7 +443,7 @@ const char *
443evil_homedir_get(void) 443evil_homedir_get(void)
444{ 444{
445#ifdef _WIN32_WCE 445#ifdef _WIN32_WCE
446 return "\\windows"; 446 return "\\my documents";
447#else 447#else
448 char *homedir; 448 char *homedir;
449 449
diff --git a/legacy/evil/src/lib/mman/sys/mman.h b/legacy/evil/src/lib/mman/sys/mman.h
index 12df1f6d3e..a918e8ebaf 100644
--- a/legacy/evil/src/lib/mman/sys/mman.h
+++ b/legacy/evil/src/lib/mman/sys/mman.h
@@ -7,7 +7,7 @@
7#endif /* EAPI */ 7#endif /* EAPI */
8 8
9#ifdef _WIN32 9#ifdef _WIN32
10# ifdef EFL_EVIL_BUILD 10# ifdef EFL_EVIL_MMAN_BUILD
11# ifdef DLL_EXPORT 11# ifdef DLL_EXPORT
12# define EAPI __declspec(dllexport) 12# define EAPI __declspec(dllexport)
13# else 13# else