| 1 | #ifndef WIN32IOP_H
|
|---|
| 2 | #define WIN32IOP_H
|
|---|
| 3 |
|
|---|
| 4 | #ifndef START_EXTERN_C
|
|---|
| 5 | #ifdef __cplusplus
|
|---|
| 6 | # define START_EXTERN_C extern "C" {
|
|---|
| 7 | # define END_EXTERN_C }
|
|---|
| 8 | # define EXTERN_C extern "C"
|
|---|
| 9 | #else
|
|---|
| 10 | # define START_EXTERN_C
|
|---|
| 11 | # define END_EXTERN_C
|
|---|
| 12 | # define EXTERN_C
|
|---|
| 13 | #endif
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #if defined(_MSC_VER) || defined(__MINGW32__)
|
|---|
| 17 | # include <sys/utime.h>
|
|---|
| 18 | #else
|
|---|
| 19 | # include <utime.h>
|
|---|
| 20 | #endif
|
|---|
| 21 |
|
|---|
| 22 | /*
|
|---|
| 23 | * defines for flock emulation
|
|---|
| 24 | */
|
|---|
| 25 | #define LOCK_SH 1
|
|---|
| 26 | #define LOCK_EX 2
|
|---|
| 27 | #define LOCK_NB 4
|
|---|
| 28 | #define LOCK_UN 8
|
|---|
| 29 |
|
|---|
| 30 | /*
|
|---|
| 31 | * Make this as close to original stdio as possible.
|
|---|
| 32 | */
|
|---|
| 33 |
|
|---|
| 34 | /*
|
|---|
| 35 | * function prototypes for our own win32io layer
|
|---|
| 36 | */
|
|---|
| 37 | START_EXTERN_C
|
|---|
| 38 |
|
|---|
| 39 | DllExport int * win32_errno(void);
|
|---|
| 40 | DllExport char *** win32_environ(void);
|
|---|
| 41 | DllExport FILE* win32_stdin(void);
|
|---|
| 42 | DllExport FILE* win32_stdout(void);
|
|---|
| 43 | DllExport FILE* win32_stderr(void);
|
|---|
| 44 | DllExport int win32_ferror(FILE *fp);
|
|---|
| 45 | DllExport int win32_feof(FILE *fp);
|
|---|
| 46 | DllExport char* win32_strerror(int e);
|
|---|
| 47 |
|
|---|
| 48 | DllExport int win32_fprintf(FILE *pf, const char *format, ...);
|
|---|
| 49 | DllExport int win32_printf(const char *format, ...);
|
|---|
| 50 | DllExport int win32_vfprintf(FILE *pf, const char *format, va_list arg);
|
|---|
| 51 | DllExport int win32_vprintf(const char *format, va_list arg);
|
|---|
| 52 | DllExport size_t win32_fread(void *buf, size_t size, size_t count, FILE *pf);
|
|---|
| 53 | DllExport size_t win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf);
|
|---|
| 54 | DllExport FILE* win32_fopen(const char *path, const char *mode);
|
|---|
| 55 | DllExport FILE* win32_fdopen(int fh, const char *mode);
|
|---|
| 56 | DllExport FILE* win32_freopen(const char *path, const char *mode, FILE *pf);
|
|---|
| 57 | DllExport int win32_fclose(FILE *pf);
|
|---|
| 58 | DllExport int win32_fputs(const char *s,FILE *pf);
|
|---|
| 59 | DllExport int win32_fputc(int c,FILE *pf);
|
|---|
| 60 | DllExport int win32_ungetc(int c,FILE *pf);
|
|---|
| 61 | DllExport int win32_getc(FILE *pf);
|
|---|
| 62 | DllExport int win32_fileno(FILE *pf);
|
|---|
| 63 | DllExport void win32_clearerr(FILE *pf);
|
|---|
| 64 | DllExport int win32_fflush(FILE *pf);
|
|---|
| 65 | DllExport Off_t win32_ftell(FILE *pf);
|
|---|
| 66 | DllExport int win32_fseek(FILE *pf,Off_t offset,int origin);
|
|---|
| 67 | DllExport int win32_fgetpos(FILE *pf,fpos_t *p);
|
|---|
| 68 | DllExport int win32_fsetpos(FILE *pf,const fpos_t *p);
|
|---|
| 69 | DllExport void win32_rewind(FILE *pf);
|
|---|
| 70 | DllExport int win32_tmpfd(void);
|
|---|
| 71 | DllExport FILE* win32_tmpfile(void);
|
|---|
| 72 | DllExport void win32_abort(void);
|
|---|
| 73 | DllExport int win32_fstat(int fd,Stat_t *sbufptr);
|
|---|
| 74 | DllExport int win32_stat(const char *name,Stat_t *sbufptr);
|
|---|
| 75 | DllExport int win32_pipe( int *phandles, unsigned int psize, int textmode );
|
|---|
| 76 | DllExport PerlIO* win32_popen( const char *command, const char *mode );
|
|---|
| 77 | DllExport PerlIO* win32_popenlist(const char *mode, IV narg, SV **args);
|
|---|
| 78 | DllExport int win32_pclose( PerlIO *pf);
|
|---|
| 79 | DllExport int win32_rename( const char *oname, const char *newname);
|
|---|
| 80 | DllExport int win32_setmode( int fd, int mode);
|
|---|
| 81 | DllExport int win32_chsize(int fd, Off_t size);
|
|---|
| 82 | DllExport Off_t win32_lseek( int fd, Off_t offset, int origin);
|
|---|
| 83 | DllExport Off_t win32_tell( int fd);
|
|---|
| 84 | DllExport int win32_dup( int fd);
|
|---|
| 85 | DllExport int win32_dup2(int h1, int h2);
|
|---|
| 86 | DllExport int win32_open(const char *path, int oflag,...);
|
|---|
| 87 | DllExport int win32_close(int fd);
|
|---|
| 88 | DllExport int win32_eof(int fd);
|
|---|
| 89 | DllExport int win32_read(int fd, void *buf, unsigned int cnt);
|
|---|
| 90 | DllExport int win32_write(int fd, const void *buf, unsigned int cnt);
|
|---|
| 91 | DllExport int win32_spawnvp(int mode, const char *cmdname,
|
|---|
| 92 | const char *const *argv);
|
|---|
| 93 | DllExport int win32_mkdir(const char *dir, int mode);
|
|---|
| 94 | DllExport int win32_rmdir(const char *dir);
|
|---|
| 95 | DllExport int win32_chdir(const char *dir);
|
|---|
| 96 | DllExport int win32_flock(int fd, int oper);
|
|---|
| 97 | DllExport int win32_execv(const char *cmdname, const char *const *argv);
|
|---|
| 98 | DllExport int win32_execvp(const char *cmdname, const char *const *argv);
|
|---|
| 99 | DllExport void win32_perror(const char *str);
|
|---|
| 100 | DllExport void win32_setbuf(FILE *pf, char *buf);
|
|---|
| 101 | DllExport int win32_setvbuf(FILE *pf, char *buf, int type, size_t size);
|
|---|
| 102 | DllExport int win32_flushall(void);
|
|---|
| 103 | DllExport int win32_fcloseall(void);
|
|---|
| 104 | DllExport char* win32_fgets(char *s, int n, FILE *pf);
|
|---|
| 105 | DllExport char* win32_gets(char *s);
|
|---|
| 106 | DllExport int win32_fgetc(FILE *pf);
|
|---|
| 107 | DllExport int win32_putc(int c, FILE *pf);
|
|---|
| 108 | DllExport int win32_puts(const char *s);
|
|---|
| 109 | DllExport int win32_getchar(void);
|
|---|
| 110 | DllExport int win32_putchar(int c);
|
|---|
| 111 | DllExport void* win32_malloc(size_t size);
|
|---|
| 112 | DllExport void* win32_calloc(size_t numitems, size_t size);
|
|---|
| 113 | DllExport void* win32_realloc(void *block, size_t size);
|
|---|
| 114 | DllExport void win32_free(void *block);
|
|---|
| 115 |
|
|---|
| 116 | DllExport int win32_open_osfhandle(intptr_t handle, int flags);
|
|---|
| 117 | DllExport intptr_t win32_get_osfhandle(int fd);
|
|---|
| 118 | DllExport FILE* win32_fdupopen(FILE *pf);
|
|---|
| 119 |
|
|---|
| 120 | DllExport DIR* win32_opendir(char *filename);
|
|---|
| 121 | DllExport struct direct* win32_readdir(DIR *dirp);
|
|---|
| 122 | DllExport long win32_telldir(DIR *dirp);
|
|---|
| 123 | DllExport void win32_seekdir(DIR *dirp, long loc);
|
|---|
| 124 | DllExport void win32_rewinddir(DIR *dirp);
|
|---|
| 125 | DllExport int win32_closedir(DIR *dirp);
|
|---|
| 126 |
|
|---|
| 127 | DllExport char* win32_getenv(const char *name);
|
|---|
| 128 | DllExport int win32_putenv(const char *name);
|
|---|
| 129 |
|
|---|
| 130 | DllExport unsigned win32_sleep(unsigned int);
|
|---|
| 131 | DllExport int win32_times(struct tms *timebuf);
|
|---|
| 132 | DllExport unsigned win32_alarm(unsigned int sec);
|
|---|
| 133 | DllExport int win32_stat(const char *path, Stat_t *buf);
|
|---|
| 134 | DllExport char* win32_longpath(char *path);
|
|---|
|
|---|