home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / win3 / patches / symantec / rtlinc.exe / HANDLE.H < prev    next >
C/C++ Source or Header  |  1993-05-18  |  2KB  |  63 lines

  1. /*_ handle.h   Thu May  4 1989   Modified by: Walter Bright */
  2.  
  3. #ifndef __HANDLE_H
  4. #define __HANDLE_H    1
  5.  
  6. #if __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. /* Values above this are handles, below this are far pointers    */
  11. #define HANDLE_BASE    0xFE000000
  12.  
  13. /* Maximum number of handles possible    */
  14. #define HANDLE_MAX    ((int)(0x10000 - (HANDLE_BASE >> 16)))
  15.  
  16. /* Size of pages (for EMM implementations, must match EMM_PAGESIZE)    */
  17. #define HANDLE_PAGESIZE        (16*1024)
  18.  
  19. /*********************************
  20.  * Determine if handle is a real handle or a far pointer.
  21.  * Returns:
  22.  *    !=0 if handle
  23.  *    0   if far pointer
  24.  */
  25.  
  26. int handle_ishandle(void __handle *h);
  27.  
  28. #define handle_ishandle(h) ((int)(((unsigned long) (h) >= HANDLE_BASE) != 0))
  29.  
  30. void __handle * __cdecl handle_malloc(unsigned);
  31. void __handle * __cdecl handle_calloc(unsigned);
  32. void __handle * __cdecl handle_realloc(void __handle *,unsigned);
  33. char __handle * __cdecl handle_strdup(char __handle *);
  34. void __cdecl handle_free(void __handle *);
  35. int __cdecl handle_usingemm(void);
  36. void __cdecl handle_remap(void);
  37.  
  38. /* Enable these to lock out using handle memory    */
  39. #if NO_HANDLE || DOS16RM || __INTSIZE == 4 || __OS2__ || __NT__
  40. #define __handle
  41. #define handle_malloc(n)    malloc(n)
  42. #define handle_calloc(n)    calloc((n),1)
  43. #define handle_realloc(h,n)    realloc((h),(n))
  44. #define handle_free(h)        free(h)
  45. #define handle_strdup(h)    strdup(h)
  46. #define handle_usingemm()    0
  47. #define handle_remap()
  48.  
  49. #undef handle_ishandle
  50. #define handle_ishandle(h)    0
  51.  
  52. #ifndef __STDLIB_H
  53. #include    <stdlib.h>    /* get definitions of malloc, etc.    */
  54. #endif
  55. char *    __cdecl strdup(const char *);
  56. #endif
  57.  
  58. #if __cplusplus
  59. }
  60. #endif
  61.  
  62. #endif /* __HANDLE_H */
  63.