home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip531.zip / wince / wince.h < prev    next >
C/C++ Source or Header  |  1997-04-22  |  8KB  |  252 lines

  1. //******************************************************************************
  2. //
  3. // File:        WINCE.H
  4. //
  5. // Description: This file declares all the Win32 APIs and C runtime functions
  6. //              that the Info-ZIP code calls, but are not implemented natively
  7. //              on Windows CE.  See WINCE.CPP for the implementation.
  8. //
  9. // Copyright:   All the source files for Pocket UnZip, except for components
  10. //              written by the Info-ZIP group, are copyrighted 1997 by Steve P.
  11. //              Miller.  The product "Pocket UnZip" itself is property of the
  12. //              author and cannot be altered in any way without written consent
  13. //              from Steve P. Miller.
  14. //
  15. // Disclaimer:  All project files are provided "as is" with no guarantee of
  16. //              their correctness.  The authors are not liable for any outcome
  17. //              that is the result of using this source.  The source for Pocket
  18. //              UnZip has been placed in the public domain to help provide an
  19. //              understanding of its implementation.  You are hereby granted
  20. //              full permission to use this source in any way you wish, except
  21. //              to alter Pocket UnZip itself.  For comments, suggestions, and
  22. //              bug reports, please write to stevemil@pobox.com.
  23. //
  24. //
  25. // Date      Name          History
  26. // --------  ------------  -----------------------------------------------------
  27. // 02/01/97  Steve Miller  Created (Version 1.0 using Info-ZIP UnZip 5.30)
  28. //
  29. //******************************************************************************
  30.  
  31. #ifndef __WINCE_H__
  32. #define __WINCE_H__
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. //******************************************************************************
  39. //***** For all platforms - Our debug output function
  40. //******************************************************************************
  41.  
  42. // If we are building for debug, we implement the DebugOut() function. If we are
  43. // building for release, then we turn all calls to DebugOut() into no-ops.  The
  44. // Microsoft compiler (and hopefully others) will not generate any code at all
  45. // for the retail version of DebugOut() defined here.  This works much better
  46. // than trying to create a variable argument macro - something C/C++ does not 
  47. // support cleanly.
  48.  
  49. #ifdef DEBUG
  50. void DebugOut(LPCTSTR szFormat, ...);
  51. #else
  52. __inline void DebugOut(LPCTSTR szFormat, ...) {}
  53. #endif
  54.  
  55.  
  56. //******************************************************************************
  57. //***** Windows NT Native
  58. //******************************************************************************
  59.  
  60. #if !defined(_WIN32_WCE)
  61. #include <io.h>
  62. #include <time.h>
  63. #include <fcntl.h>
  64. #include <sys\stat.h>
  65. #endif
  66.  
  67. //******************************************************************************
  68. //***** Windows CE Native
  69. //******************************************************************************
  70.  
  71. #if defined(_WIN32_WCE)
  72.  
  73. #ifndef ZeroMemory
  74. #define ZeroMemory(Destination,Length) memset(Destination, 0, Length)
  75. #endif
  76.  
  77. // A few forgotten defines in Windows CE's TCHAR.H
  78. #ifndef _stprintf
  79. #define _stprintf wsprintf
  80. #endif
  81.  
  82. #ifndef _vsnwprintf
  83. #define _vsntprintf(d,c,f,a) wvsprintf(d,f,a)
  84. #endif
  85.  
  86.  
  87. //******************************************************************************
  88. //***** SYS\TYPES.H functions
  89. //******************************************************************************
  90.  
  91. typedef long _off_t;
  92. typedef long time_t;
  93.  
  94.  
  95. //******************************************************************************
  96. //***** CTYPE.H functions
  97. //******************************************************************************
  98.  
  99. _CRTIMP int __cdecl isupper(int);
  100. _CRTIMP int __cdecl tolower(int);
  101.  
  102.  
  103. //******************************************************************************
  104. //***** FCNTL.H functions
  105. //******************************************************************************
  106.  
  107. #define _O_RDONLY 0x0000   // open for reading only
  108. //#define _O_WRONLY  0x0001   // open for writing only
  109. //#define _O_RDWR    0x0002   // open for reading and writing
  110. //#define _O_APPEND  0x0008   // writes done at eof
  111.  
  112. //#define _O_CREAT   0x0100   // create and open file
  113. //#define _O_TRUNC   0x0200   // open and truncate
  114. //#define _O_EXCL    0x0400   // open only if file doesn't already exist
  115.  
  116.  
  117. //#define _O_TEXT    0x4000   // file mode is text (translated)
  118. #define _O_BINARY 0x8000   // file mode is binary (untranslated)
  119.  
  120.  
  121. #define O_RDONLY  _O_RDONLY
  122. //#define O_WRONLY   _O_WRONLY
  123. //#define O_RDWR     _O_RDWR
  124. //#define O_APPEND   _O_APPEND
  125. //#define O_CREAT    _O_CREAT
  126. //#define O_TRUNC    _O_TRUNC
  127. //#define O_EXCL     _O_EXCL
  128. //#define O_TEXT     _O_TEXT
  129. #define O_BINARY  _O_BINARY
  130. //#define O_RAW      _O_BINARY
  131. //#define O_TEMPORARY   _O_TEMPORARY
  132. //#define O_NOINHERIT   _O_NOINHERIT
  133. //#define O_SEQUENTIAL  _O_SEQUENTIAL
  134. //#define O_RANDOM   _O_RANDOM
  135.  
  136. //******************************************************************************
  137. //***** IO.H functions
  138. //******************************************************************************
  139.  
  140. _CRTIMP int __cdecl chmod(const char *, int);
  141. _CRTIMP int __cdecl close(int);
  142. _CRTIMP int __cdecl isatty(int);
  143. _CRTIMP long __cdecl lseek(int, long, int);
  144. _CRTIMP int __cdecl open(const char *, int, ...);
  145. _CRTIMP int __cdecl read(int, void *, unsigned int);
  146. _CRTIMP int __cdecl setmode(int, int);
  147. _CRTIMP int __cdecl unlink(const char *);
  148.  
  149.  
  150. //******************************************************************************
  151. //***** STDIO.H functions
  152. //******************************************************************************
  153.  
  154.  
  155. //typedef struct _iobuf FILE;
  156. typedef int FILE;
  157.  
  158. #define stdin  ((int*)-2)
  159. #define stdout ((int*)-3)
  160. #define stderr ((int*)-4)
  161.  
  162. #define EOF    (-1)
  163.  
  164. _CRTIMP int __cdecl fflush(FILE *);
  165. _CRTIMP char * __cdecl fgets(char *, int, FILE *);
  166. _CRTIMP int __cdecl fileno(FILE *);
  167. _CRTIMP FILE * __cdecl fopen(const char *, const char *);
  168. _CRTIMP int __cdecl fprintf(FILE *, const char *, ...);
  169. _CRTIMP int __cdecl fclose(FILE *);
  170. _CRTIMP int __cdecl putc(int, FILE *);
  171. _CRTIMP int __cdecl sprintf(char *, const char *, ...);
  172.  
  173.  
  174. //******************************************************************************
  175. //***** STRING.H functions
  176. //******************************************************************************
  177.  
  178. _CRTIMP int     __cdecl _stricmp(const char *, const char *);
  179. _CRTIMP char *  __cdecl _strupr(char *);
  180. _CRTIMP char *  __cdecl strrchr(const char *, int);
  181.  
  182.  
  183. //******************************************************************************
  184. //***** TIME.H functions
  185. //******************************************************************************
  186.  
  187. #ifndef _TM_DEFINED
  188. struct tm {
  189.    int tm_sec;     // seconds after the minute - [0,59]
  190.    int tm_min;     // minutes after the hour - [0,59]
  191.    int tm_hour;    // hours since midnight - [0,23]
  192.    int tm_mday;    // day of the month - [1,31]
  193.    int tm_mon;     // months since January - [0,11]
  194.    int tm_year;    // years since 1900
  195. // int tm_wday;    // days since Sunday - [0,6]
  196. // int tm_yday;    // days since January 1 - [0,365]
  197.    int tm_isdst;   // daylight savings time flag
  198. };
  199. #define _TM_DEFINED
  200. #endif
  201.  
  202. _CRTIMP struct tm * __cdecl localtime(const time_t *);
  203.  
  204.  
  205. //******************************************************************************
  206. //***** SYS\STAT.H functions
  207. //******************************************************************************
  208.  
  209. struct stat {
  210. // _dev_t st_dev;
  211. // _ino_t st_ino;
  212.    unsigned short st_mode;
  213. // short st_nlink;
  214. // short st_uid;
  215. // short st_gid;
  216. // _dev_t st_rdev;
  217.    _off_t st_size;
  218. // time_t st_atime;
  219.    time_t st_mtime;
  220. // time_t st_ctime;
  221. };
  222.  
  223. #define _S_IFMT   0170000  // file type mask
  224. #define _S_IFDIR  0040000  // directory
  225. //#define _S_IFCHR   0020000  // character special
  226. //#define _S_IFIFO   0010000  // pipe
  227. #define _S_IFREG  0100000  // regular
  228. #define _S_IREAD  0000400  // read permission, owner
  229. #define _S_IWRITE 0000200  // write permission, owner
  230. #define _S_IEXEC  0000100  // execute/search permission, owner
  231.  
  232. #define S_IFMT  _S_IFMT
  233. #define S_IFDIR  _S_IFDIR
  234. //#define S_IFCHR  _S_IFCHR
  235. //#define S_IFREG  _S_IFREG
  236. #define S_IREAD  _S_IREAD
  237. #define S_IWRITE _S_IWRITE
  238. #define S_IEXEC  _S_IEXEC
  239.  
  240. _CRTIMP int __cdecl stat(const char *, struct stat *);
  241.  
  242.  
  243. //******************************************************************************
  244.  
  245. #endif // _WIN32_WCE
  246.  
  247. #ifdef __cplusplus
  248. } // extern "C"
  249. #endif
  250.  
  251. #endif // __WINCE_H__
  252.