Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.2 KiB

  1. /* DOS macros and globals */
  2. #ifndef _DOSDEFS_H_
  3. #define _DOSDEFS_H_
  4. #pragma message("Using the DOS translation of the common macros.")
  5. #ifndef RLDOS
  6. #pragma message("\n****************************************************************************\n")
  7. #pragma message("Hey! I think you meant to use the Windows translation of the common macros!")
  8. #pragma message("\n****************************************************************************\n")
  9. #endif
  10. #include "fcntl.h"
  11. #include "dos.h"
  12. #ifndef NULL
  13. #if (_MSC_VER >= 600)
  14. #define NULL ((void *)0)
  15. #elif (defined(M_I86SM) || defined(M_I86MM))
  16. #define NULL 0
  17. #else
  18. #define NULL 0L
  19. #endif
  20. #endif
  21. #define FALSE 0
  22. #define TRUE 1
  23. #define FAR far
  24. #define NEAR near
  25. #define LONG long
  26. #define VOID void
  27. #define PASCAL pascal
  28. #define WINAPI
  29. #define MAKELONG(a,b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
  30. #define LOWORD(l) ((WORD)(l))
  31. #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
  32. #define LOBYTE(w) ((BYTE)(w))
  33. #define HIBYTE(w) (((WORD)(w) >> 8) & 0xFF)
  34. #define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
  35. typedef unsigned char BYTE;
  36. typedef unsigned char *PBYTE;
  37. typedef unsigned long DWORD;
  38. typedef unsigned int UINT;
  39. typedef unsigned WORD;
  40. typedef int BOOL;
  41. typedef char *PSTR;
  42. typedef char NEAR *NPSTR;
  43. typedef char FAR *LPSTR;
  44. typedef int FAR *LPINT;
  45. #define CHAR char
  46. #ifndef _WCHAR_T_DEFINED
  47. typedef unsigned short wchar_t;
  48. #define _WCHAR_T_DEFINED
  49. #endif
  50. #define WCHAR wchar_t
  51. typedef WCHAR *PWCHAR;
  52. typedef WCHAR *LPWSTR, *PWSTR;
  53. typedef LPSTR PTSTR, LPTSTR;
  54. #define TEXT(quote) quote
  55. typedef unsigned char UCHAR;
  56. typedef char *PCHAR;
  57. #define UNALIGNED
  58. #define DS_SETFONT 0x40L
  59. int _ret;
  60. unsigned _error;
  61. /* These macros are for near heap only */
  62. #define FOPEN(sz) ((_ret=-1),(_error=_dos_open(sz,O_RDONLY,&_ret)),_ret)
  63. #define FCREATE(sz) ((_ret=-1),(_error=_dos_creat(sz,_A_NORMAL,&_ret)),_ret)
  64. #define FCLOSE(fh) ((_error=_dos_close(fh)))
  65. #define FREAD(fh,buf,len) ((_error=_dos_read(fh,buf,len,&_ret)),_ret)
  66. #define FWRITE(fh,buf,len) ((_error=_dos_write(fh,buf,len,&_ret)),_ret)
  67. #define FSEEK(fh,off,i) lseek(fh,(long)(off),i)
  68. #define FERROR() _error
  69. #define __FCLOSE(fp) {fflush(fp);fclose(fp);} // NT 348 bug workaround DHW
  70. #define ALLOC(n) malloc(n)
  71. #define FREE(p) free(p)
  72. #define SIZE(p) _msize(p)
  73. #define REALLOC(p,n) realloc(p,n)
  74. #define FMEMMOVE( szDst, szSrc, uSize) _fmemmove( szDst, szSrc, uSize )
  75. #define FSTRNCPY( szDst, szSrc, uSize) _fstrncpy( szDst, szSrc, uSize )
  76. #define _MBSTOWCS(ds,ss,dc,sc) mbstowcs(ds,ss,sc)
  77. #define _WCSTOMBS(ds,ss,dc,sc) wcstombs(ds,ss,sc)
  78. /* here are some macros for allocating and freeing far heap space */
  79. #define FALLOC(n) _fmalloc(n)
  80. #define FFREE(n) _ffree(n)
  81. #define FREALLOC(p,n) _frealloc(p,n)
  82. /* Some common translations macros */
  83. #define SPRINTF sprintf
  84. #define STRUPR strupr
  85. #endif // _DOSDEFS_H_