aboutsummaryrefslogtreecommitdiff
path: root/src/include/plibc/plibc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/plibc/plibc.h')
-rw-r--r--src/include/plibc/plibc.h83
1 files changed, 75 insertions, 8 deletions
diff --git a/src/include/plibc/plibc.h b/src/include/plibc/plibc.h
index 4e3204c9..36698bf7 100644
--- a/src/include/plibc/plibc.h
+++ b/src/include/plibc/plibc.h
@@ -22,7 +22,7 @@
22 * @brief PlibC header 22 * @brief PlibC header
23 * @attention This file is usually not installed under Unix, 23 * @attention This file is usually not installed under Unix,
24 * so ship it with your application 24 * so ship it with your application
25 * @version $Revision: 69 $ 25 * @version $Revision: 87 $
26 */ 26 */
27 27
28#ifndef _PLIBC_H_ 28#ifndef _PLIBC_H_
@@ -50,8 +50,8 @@ extern "C" {
50 #include "langinfo.h" 50 #include "langinfo.h"
51#endif 51#endif
52 52
53#include <windows.h>
54#include <ws2tcpip.h> 53#include <ws2tcpip.h>
54#include <windows.h>
55#include <sys/types.h> 55#include <sys/types.h>
56#include <time.h> 56#include <time.h>
57#include <stdio.h> 57#include <stdio.h>
@@ -70,7 +70,7 @@ extern "C" {
70/* Convert LARGE_INTEGER to double */ 70/* Convert LARGE_INTEGER to double */
71#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ 71#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
72 (double)((x).LowPart)) 72 (double)((x).LowPart))
73 73#ifndef __MINGW64__
74struct stat64 74struct stat64
75{ 75{
76 _dev_t st_dev; 76 _dev_t st_dev;
@@ -85,7 +85,7 @@ struct stat64
85 __time64_t st_mtime; 85 __time64_t st_mtime;
86 __time64_t st_ctime; 86 __time64_t st_ctime;
87}; 87};
88 88#endif
89typedef unsigned int sa_family_t; 89typedef unsigned int sa_family_t;
90 90
91struct sockaddr_un { 91struct sockaddr_un {
@@ -226,8 +226,13 @@ enum
226#define MAP_SHARED 0x1 226#define MAP_SHARED 0x1
227#define MAP_PRIVATE 0x2 /* unsupported */ 227#define MAP_PRIVATE 0x2 /* unsupported */
228#define MAP_FIXED 0x10 228#define MAP_FIXED 0x10
229#define MAP_ANONYMOUS 0x20 /* unsupported */
229#define MAP_FAILED ((void *)-1) 230#define MAP_FAILED ((void *)-1)
230 231
232#define MS_ASYNC 1 /* sync memory asynchronously */
233#define MS_INVALIDATE 2 /* invalidate the caches */
234#define MS_SYNC 4 /* synchronous memory sync */
235
231struct statfs 236struct statfs
232{ 237{
233 long f_type; /* type of filesystem (see below) */ 238 long f_type; /* type of filesystem (see below) */
@@ -331,17 +336,29 @@ typedef struct
331#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) 336#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
332 337
333BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); 338BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
339BOOL _plibc_CreateShortcutW(const wchar_t *pwszSrc, const wchar_t *pwszDest);
334BOOL _plibc_DereferenceShortcut(char *pszShortcut); 340BOOL _plibc_DereferenceShortcut(char *pszShortcut);
341BOOL _plibc_DereferenceShortcutW(wchar_t *pwszShortcut);
335char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); 342char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
343wchar_t *plibc_ChooseDirW(wchar_t *pwszTitle, unsigned long ulFlags);
336char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); 344char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags);
337long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, 345wchar_t *plibc_ChooseFileW(wchar_t *pwszTitle, unsigned long ulFlags);
346
347long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
338 char *pszBuffer, long *pdLength); 348 char *pszBuffer, long *pdLength);
349long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *pszSubKey,
350 wchar_t *pszBuffer, long *pdLength);
339 351
340BOOL __win_IsHandleMarkedAsBlocking(int hHandle); 352BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
341void __win_SetHandleBlockingMode(int s, BOOL bBlocking); 353void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
342void __win_DiscardHandleBlockingMode(int s); 354void __win_DiscardHandleBlockingMode(int s);
343int _win_isSocketValid(int s); 355int _win_isSocketValid(int s);
344int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); 356int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
357int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows);
358
359int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows);
360int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows, int derefLinks);
361
345unsigned plibc_get_handle_count(); 362unsigned plibc_get_handle_count();
346 363
347typedef void (*TPanicProc) (int, char *); 364typedef void (*TPanicProc) (int, char *);
@@ -360,18 +377,25 @@ const char *hstrerror(int err);
360int mkstemp(char *tmplate); 377int mkstemp(char *tmplate);
361char *strptime (const char *buf, const char *format, struct tm *tm); 378char *strptime (const char *buf, const char *format, struct tm *tm);
362const char *inet_ntop(int af, const void *src, char *dst, size_t size); 379const char *inet_ntop(int af, const void *src, char *dst, size_t size);
380#ifndef gmtime_r
381struct tm *gmtime_r(const time_t *clock, struct tm *result);
382#endif
363 383
364int plibc_init(char *pszOrg, char *pszApp); 384int plibc_init(char *pszOrg, char *pszApp);
385int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode);
365void plibc_shutdown(); 386void plibc_shutdown();
366int plibc_initialized(); 387int plibc_initialized();
367int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); 388
368void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); 389void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
369void SetErrnoFromWinsockError(long lWinError); 390void SetErrnoFromWinsockError(long lWinError);
370void SetHErrnoFromWinError(long lWinError); 391void SetHErrnoFromWinError(long lWinError);
371void SetErrnoFromHRESULT(HRESULT hRes); 392void SetErrnoFromHRESULT(HRESULT hRes);
372int GetErrnoFromWinsockError(long lWinError); 393int GetErrnoFromWinsockError(long lWinError);
373FILE *_win_fopen(const char *filename, const char *mode); 394FILE *_win_fopen(const char *filename, const char *mode);
395int _win_fclose(FILE *);
374DIR *_win_opendir(const char *dirname); 396DIR *_win_opendir(const char *dirname);
397struct dirent *_win_readdir(DIR *dirp);
398int _win_closedir(DIR *dirp);
375int _win_open(const char *filename, int oflag, ...); 399int _win_open(const char *filename, int oflag, ...);
376#ifdef ENABLE_NLS 400#ifdef ENABLE_NLS
377char *_win_bindtextdomain(const char *domainname, const char *dirname); 401char *_win_bindtextdomain(const char *domainname, const char *dirname);
@@ -405,25 +429,56 @@ size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream );
405int _win_symlink(const char *path1, const char *path2); 429int _win_symlink(const char *path1, const char *path2);
406void *_win_mmap(void *start, size_t len, int access, int flags, int fd, 430void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
407 unsigned long long offset); 431 unsigned long long offset);
432int _win_msync(void *start, size_t length, int flags);
408int _win_munmap(void *start, size_t length); 433int _win_munmap(void *start, size_t length);
409int _win_lstat(const char *path, struct stat *buf); 434int _win_lstat(const char *path, struct stat *buf);
410int _win_lstat64(const char *path, struct stat64 *buf); 435int _win_lstat64(const char *path, struct stat64 *buf);
411int _win_readlink(const char *path, char *buf, size_t bufsize); 436int _win_readlink(const char *path, char *buf, size_t bufsize);
412int _win_accept(int s, struct sockaddr *addr, int *addrlen); 437int _win_accept(int s, struct sockaddr *addr, int *addrlen);
438
413int _win_printf(const char *format,...); 439int _win_printf(const char *format,...);
440int _win_wprintf(const wchar_t *format, ...);
441
414int _win_fprintf(FILE *f,const char *format,...); 442int _win_fprintf(FILE *f,const char *format,...);
443int _win_fwprintf(FILE *f,const wchar_t *format, ...);
444
415int _win_vprintf(const char *format, va_list ap); 445int _win_vprintf(const char *format, va_list ap);
446int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr);
447
416int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); 448int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr);
449int _win_vwprintf(const wchar_t *format, va_list ap);
450
417int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); 451int _win_vsprintf(char *dest,const char *format, va_list arg_ptr);
452int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr);
453
418int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); 454int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr);
455int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr);
456
419int _win_snprintf(char *str,size_t size,const char *format,...); 457int _win_snprintf(char *str,size_t size,const char *format,...);
458int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...);
459
420int _win_sprintf(char *dest,const char *format,...); 460int _win_sprintf(char *dest,const char *format,...);
461int _win_swprintf(wchar_t *dest, const wchar_t *format, ...);
462
421int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); 463int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
464int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr);
465
422int _win_sscanf(const char *str, const char *format, ...); 466int _win_sscanf(const char *str, const char *format, ...);
467int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...);
468
423int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); 469int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
470int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr);
471
424int _win_vscanf(const char *format, va_list arg_ptr); 472int _win_vscanf(const char *format, va_list arg_ptr);
473int _win_vwscanf(const wchar_t *format, va_list arg_ptr);
474
425int _win_scanf(const char *format, ...); 475int _win_scanf(const char *format, ...);
476int _win_wscanf(const wchar_t *format, ...);
477
426int _win_fscanf(FILE *stream, const char *format, ...); 478int _win_fscanf(FILE *stream, const char *format, ...);
479int _win_fwscanf(FILE *stream, const wchar_t *format, ...);
480
481
427pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); 482pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
428int _win_bind(int s, const struct sockaddr *name, int namelen); 483int _win_bind(int s, const struct sockaddr *name, int namelen);
429int _win_connect(int s,const struct sockaddr *name, int namelen); 484int _win_connect(int s,const struct sockaddr *name, int namelen);
@@ -461,10 +516,12 @@ size_t strnlen (const char *str, size_t maxlen);
461#endif 516#endif
462char *stpcpy(char *dest, const char *src); 517char *stpcpy(char *dest, const char *src);
463char *strcasestr(const char *haystack_start, const char *needle_start); 518char *strcasestr(const char *haystack_start, const char *needle_start);
464 519#ifndef __MINGW64__
465#define strcasecmp(a, b) stricmp(a, b) 520#define strcasecmp(a, b) stricmp(a, b)
521#define wcscasecmp(a, b) wcsicmp(a, b)
466#define strncasecmp(a, b, c) strnicmp(a, b, c) 522#define strncasecmp(a, b, c) strnicmp(a, b, c)
467 523#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
524#endif
468#endif /* WINDOWS */ 525#endif /* WINDOWS */
469 526
470#ifndef WINDOWS 527#ifndef WINDOWS
@@ -482,8 +539,11 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
482 #define CTIME_R(c, b) ctime_r(c, b) 539 #define CTIME_R(c, b) ctime_r(c, b)
483 #undef FOPEN 540 #undef FOPEN
484 #define FOPEN(f, m) fopen(f, m) 541 #define FOPEN(f, m) fopen(f, m)
542 #define FCLOSE(f) fclose(f)
485 #define FTRUNCATE(f, l) ftruncate(f, l) 543 #define FTRUNCATE(f, l) ftruncate(f, l)
486 #define OPENDIR(d) opendir(d) 544 #define OPENDIR(d) opendir(d)
545 #define CLOSEDIR(d) closedir(d)
546 #define READDIR(d) readdir(d)
487 #define OPEN open 547 #define OPEN open
488 #define CHDIR(d) chdir(d) 548 #define CHDIR(d) chdir(d)
489 #define CLOSE(f) close(f) 549 #define CLOSE(f) close(f)
@@ -506,6 +566,8 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
506 #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) 566 #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
507 #define SYMLINK(a, b) symlink(a, b) 567 #define SYMLINK(a, b) symlink(a, b)
508 #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) 568 #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
569 #define MKFIFO(p, m) mkfifo(p, m)
570 #define MSYNC(s, l, f) msync(s, l, f)
509 #define MUNMAP(s, l) munmap(s, l) 571 #define MUNMAP(s, l) munmap(s, l)
510 #define STRERROR(i) strerror(i) 572 #define STRERROR(i) strerror(i)
511 #define RANDOM() random() 573 #define RANDOM() random()
@@ -575,8 +637,11 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
575 #define PLIBC_CTIME(c) _win_ctime(c) 637 #define PLIBC_CTIME(c) _win_ctime(c)
576 #define CTIME_R(c, b) _win_ctime_r(c, b) 638 #define CTIME_R(c, b) _win_ctime_r(c, b)
577 #define FOPEN(f, m) _win_fopen(f, m) 639 #define FOPEN(f, m) _win_fopen(f, m)
640 #define FCLOSE(f) _win_fclose(f)
578 #define FTRUNCATE(f, l) _win_ftruncate(f, l) 641 #define FTRUNCATE(f, l) _win_ftruncate(f, l)
579 #define OPENDIR(d) _win_opendir(d) 642 #define OPENDIR(d) _win_opendir(d)
643 #define CLOSEDIR(d) _win_closedir(d)
644 #define READDIR(d) _win_readdir(d)
580 #define OPEN _win_open 645 #define OPEN _win_open
581 #define CHDIR(d) _win_chdir(d) 646 #define CHDIR(d) _win_chdir(d)
582 #define CLOSE(f) _win_close(f) 647 #define CLOSE(f) _win_close(f)
@@ -601,6 +666,8 @@ char *strcasestr(const char *haystack_start, const char *needle_start);
601 #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) 666 #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
602 #define SYMLINK(a, b) _win_symlink(a, b) 667 #define SYMLINK(a, b) _win_symlink(a, b)
603 #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) 668 #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
669 #define MKFIFO(p, m) _win_mkfifo(p, m)
670 #define MSYNC(s, l, f) _win_msync(s, l, f)
604 #define MUNMAP(s, l) _win_munmap(s, l) 671 #define MUNMAP(s, l) _win_munmap(s, l)
605 #define STRERROR(i) _win_strerror(i) 672 #define STRERROR(i) _win_strerror(i)
606 #define READLINK(p, b, s) _win_readlink(p, b, s) 673 #define READLINK(p, b, s) _win_readlink(p, b, s)