home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples1.exe / smc / imports.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  8.2 KB  |  255 lines

  1. #ifdef  _MSC_VER
  2. extern  "C" {
  3. #endif
  4. /****************************************************************************/
  5. /*                   Little helper routines defined "inline"                */
  6. /****************************************************************************/
  7.  
  8. inline
  9. int     isalpha(int c)
  10. {
  11.     return  (c >= 'A' && c <= 'Z' ||
  12.              c >= 'a' && c <= 'z');
  13. }
  14.  
  15. inline
  16. int     isdigit(int c)
  17. {
  18.     return  (c >= '0' && c <= '9');
  19. }
  20.  
  21. inline
  22. int     isalnum(int c)
  23. {
  24.     return  isalpha(c) || isdigit(c);
  25. }
  26.  
  27. inline
  28. int     isspace(int c)
  29. {
  30.     return  (c == ' ') || (c == '\t');
  31. }
  32.  
  33. inline
  34. int     toupper(int c)
  35. {
  36.     if  (c >= 'a' && c <= 'z')
  37.         c -= 'a' - 'A';
  38.  
  39.     return  c;
  40. }
  41.  
  42. #ifndef _MSC_VER
  43.  
  44. int     max( int a,  int b) { return (a > b) ? a : b; }
  45. uint    max(uint a, uint b) { return (a > b) ? a : b; }
  46.  
  47. void    forceDebugBreak(){}
  48.  
  49. #endif
  50.  
  51. /****************************************************************************/
  52. /*                                varargs                                   */
  53. /****************************************************************************/
  54.  
  55. #ifndef _MSC_VER
  56.  
  57. typedef ArgIterator  va_list;
  58. void    va_end(INOUT va_list args) { args.End(); }
  59.  
  60. #endif
  61.  
  62. /****************************************************************************/
  63. /*                                  SEH                                     */
  64. /****************************************************************************/
  65.  
  66. #ifndef _MSC_VER
  67.  
  68. extern  unsigned    _exception_code();
  69. extern  void *      _exception_info();
  70.  
  71. extern  int         _abnormal_termination();
  72.  
  73. #endif
  74.  
  75. /****************************************************************************/
  76. /*                                file I/O                                  */
  77. /****************************************************************************/
  78.  
  79. #ifndef _MSC_VER
  80.  
  81. const uint _O_RDONLY     = 0x0000;
  82. const uint _O_WRONLY     = 0x0001;
  83. const uint _O_RDWR       = 0x0002;
  84. const uint _O_APPEND     = 0x0008;
  85.  
  86. const uint _O_CREAT      = 0x0100;
  87. const uint _O_TRUNC      = 0x0200;
  88. const uint _O_EXCL       = 0x0400;
  89.  
  90. const uint _O_TEXT       = 0x4000;
  91. const uint _O_BINARY     = 0x8000;
  92.  
  93. const uint _O_SEQUENTIAL = 0x0020;
  94. const uint _O_RANDOM     = 0x0010;
  95.  
  96. const uint _S_IFMT      =  0170000;
  97. const uint _S_IFDIR     =  0040000;
  98. const uint _S_IFCHR     =  0020000;
  99. const uint _S_IFIFO     =  0010000;
  100. const uint _S_IFREG     =  0100000;
  101. const uint _S_IREAD     =  0000400;
  102. const uint _S_IWRITE    =  0000200;
  103. const uint _S_IEXEC     =  0000100;
  104.  
  105. const uint _A_NORMAL    =  0x00;
  106. const uint _A_RDONLY    =  0x01;
  107. const uint _A_HIDDEN    =  0x02;
  108. const uint _A_SYSTEM    =  0x04;
  109. const uint _A_SUBDIR    =  0x10;
  110. const uint _A_ARCH      =  0x20;
  111.  
  112. #endif
  113.  
  114. IMPCRT("msvcrt.dll:printf")     int      printf(           const char *fmt, ...);
  115. IMPCRT("msvcrt.dll:sprintf")    int     sprintf(char *dst, const char *fmt, ...);
  116. IMPCRT("msvcrt.dll:_close")     int     _close(int);
  117. IMPCRT("msvcrt.dll:_open")      int     _open(const char *, int, ...);
  118. IMPCRT("msvcrt.dll:_unlink")    int     _unlink(const char *);
  119. IMPCRT("msvcrt.dll:_write")     int     _write(int, const void *, unsigned int);
  120.  
  121. #ifndef _MSC_VER
  122.  
  123. typedef unsigned short  _ino_t;
  124. typedef unsigned int    _dev_t;
  125. typedef __int32         _off_t;
  126.  
  127. struct  _Fstat
  128. {
  129.         _dev_t st_dev;
  130.         _ino_t st_ino;
  131.         unsigned short st_mode;
  132.         short st_nlink;
  133.         short st_uid;
  134.         short st_gid;
  135.         _dev_t st_rdev;
  136.         _off_t st_size;
  137.         time_t st_atime;
  138.         time_t st_mtime;
  139.         time_t st_ctime;
  140. };
  141.  
  142. IMPCRT("msvcrt.dll:_stat")      int     _stat(const char *, _Fstat *);
  143.  
  144. struct  _iobuf
  145. {
  146.         char *_ptr;
  147.         int   _cnt;
  148.         char *_base;
  149.         int   _flag;
  150.         int   _file;
  151.         int   _charbuf;
  152.         int   _bufsiz;
  153.         char *_tmpfname;
  154. };
  155. typedef _iobuf FILE;
  156.  
  157. #endif
  158.  
  159. IMPCRT("msvcrt.dll:fopen")      FILE *  fopen(const char *, const char *);
  160. IMPCRT("msvcrt.dll:fgets")      char *  fgets(char *, int, FILE *);
  161. IMPCRT("msvcrt.dll:fclose")     int     fclose(FILE *);
  162. IMPCRT("msvcrt.dll:fflush")     int     fflush(FILE *);
  163. IMPCRT("msvcrt.dll:_flushall")  int     _flushall();
  164.  
  165. /****************************************************************************/
  166. /*                           wildcards / paths                              */
  167. /****************************************************************************/
  168.  
  169. #ifndef _MSC_VER
  170.  
  171. const   size_t          _MAX_PATH        = 260;
  172. const   size_t          _MAX_DRIVE       = 3;
  173. const   size_t          _MAX_DIR         = 256;
  174. const   size_t          _MAX_FNAME       = 256;
  175. const   size_t          _MAX_EXT         = 256;
  176.  
  177. struct _finddata_t
  178. {
  179.     unsigned    attrib;
  180.     time_t      time_create;    /* -1 for FAT file systems */
  181.     time_t      time_access;    /* -1 for FAT file systems */
  182.     time_t      time_write;
  183.     unsigned    size;
  184.     char        name[260];
  185. };
  186.  
  187. #endif
  188.  
  189. IMPCRT("msvcrt.dll:_findclose") int     _findclose(__int32);
  190. IMPCRT("msvcrt.dll:_findfirst") LONG    _findfirst(const char *, _finddata_t *);
  191. IMPCRT("msvcrt.dll:_findnext")  int     _findnext(__int32, _finddata_t *);
  192.  
  193. IMPCRT("msvcrt.dll:_splitpath") void    _splitpath(const char *, char *, char *, char *, char *);
  194. IMPCRT("msvcrt.dll:_makepath")  void    _makepath(char *, const char *, const char *, const char *, const char *);
  195.  
  196. /****************************************************************************/
  197. /*                            string / memory                               */
  198. /****************************************************************************/
  199.  
  200. IMPCRT("msvcrt.dll:memcmp")     int     memcmp(const void *, const void *, size_t);
  201. IMPCRT("msvcrt.dll:memcpy")     void    memcpy(void *, const void *, size_t);
  202. IMPCRT("msvcrt.dll:memset")     void *  memset(void *,  int, size_t);
  203. IMPCRT("msvcrt.dll:strlen")     size_t  strlen(const char *);
  204. IMPCRT("msvcrt.dll:strchr")     char *  strchr(const char *, int);
  205. IMPCRT("msvcrt.dll:strcmp")     int     strcmp(const char *, const char *);
  206. IMPCRT("msvcrt.dll:strcpy")     char *  strcpy(char *, const char *);
  207. IMPCRT("msvcrt.dll:strcat")     char *  strcat(char *, const char *);
  208. IMPCRT("msvcrt.dll:strncpy")    char *  strncpy(char *, const char *, size_t);
  209. IMPCRT("msvcrt.dll:_stricmp")   int    _stricmp(const char *, const char *);
  210.  
  211. IMPCRT("msvcrt.dll:wcscmp")     int     wcscmp(const wchar_t *, const wchar_t *);
  212. IMPCRT("msvcrt.dll:wcslen")     size_t  wcslen(const wchar_t *);
  213. IMPCRT("msvcrt.dll:wcscpy")     wchar_t*wcscpy(wchar_t *, const wchar_t *);
  214. IMPCRT("msvcrt.dll:wcschr")     wchar_t*wcschr(const wchar_t *, wchar_t);
  215. IMPCRT("msvcrt.dll:wcscat")     wchar_t*wcscat(wchar_t *, const wchar_t *);
  216. IMPCRT("msvcrt.dll:wcsrchr")    wchar_t*wcsrchr(const wchar_t *, wchar_t);
  217. IMPCRT("msvcrt.dll:wcsncmp")    int     wcsncmp(const wchar_t *, const wchar_t *, size_t);
  218.  
  219. IMPCRT("msvcrt.dll:mbstowcs")   size_t  mbstowcs(wchar *, const char *, size_t);
  220. IMPCRT("msvcrt.dll:wcstombs")   size_t  wcstombs(char *, const wchar *, size_t);
  221.  
  222. #if MGDDATA
  223. int                                     strcmp(char managed [] str1, char * str2)
  224. {
  225.     UNIMPL(!"strcmp");
  226.     return  0;
  227. }
  228. #endif
  229.  
  230. /****************************************************************************/
  231. /*                             misc C runtime                               */
  232. /****************************************************************************/
  233.  
  234. IMPCRT("msvcrt.dll:malloc")     void *  malloc(size_t);
  235. IMPCRT("msvcrt.dll:free")       void    free(void *);
  236.  
  237. IMPCRT("msvcrt.dll:qsort")      void    qsort(void *, size_t, size_t, int (*)(const void *, const void *));
  238.  
  239. IMPCRT("msvcrt.dll:exit")       void    exit(int);
  240.  
  241. IMPCRT("msvcrt.dll:srand")      void    srand(int);
  242. IMPCRT("msvcrt.dll:rand")       int      rand();
  243.  
  244. IMPCRT("msvcrt.dll:time")       void    time(time_t *);
  245.  
  246. IMPCRT("msvcrt.dll:atof")       double  atof(const char *);
  247. IMPCRT("msvcrt.dll:atoi")       int     atoi(const char *);
  248.  
  249. IMPCRT("msvcrt.dll:_isnan")     int     _isnan(double);
  250.  
  251. /****************************************************************************/
  252. #ifdef  _MSC_VER
  253. }
  254. #endif
  255.