home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / v2tov3.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  83 lines

  1. /***
  2. *v2tov3.h - macros for porting MS C v.2 to v.3 and later
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file defines macros which can be used to ease the problems
  8. *       of porting MS C version 2.0 programs to MS C versions 3.0 and later.
  9. *
  10. *       [Internal]
  11. *
  12. ****/
  13.  
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif  /* _MSC_VER > 1000 */
  17.  
  18. #ifndef _INC_V2TOV3
  19. #define _INC_V2TOV3
  20.  
  21. #ifndef _CRTBLD
  22. /*
  23.  * This is an internal C runtime header file. It is used when building
  24.  * the C runtimes only. It is not to be used as a public header file.
  25.  */
  26. #error ERROR: Use of C runtime library internal header file.
  27. #endif  /* _CRTBLD */
  28.  
  29. #/* macro to translate the names used to force binary mode for files */
  30.  
  31. #define O_RAW   O_BINARY
  32.  
  33. /* macro to translate setnbuf calls to the equivalent setbuf call */
  34.  
  35. #define setnbuf(stream) setbuf(stream, NULL)
  36.  
  37. /* macro to translate stclen calls to the equivalent strlen call */
  38.  
  39. #define stclen(s)       strlen(s)
  40.  
  41. /* macro to translate stscmp calls to the equivalent strcmp call */
  42.  
  43. #define stscmp(s,t)     strcmp(s,t)
  44.  
  45. /* macro to translate stpchr calls to the equivalent strchr call */
  46.  
  47. #define stpchr(s,c)     strchr(s,c)
  48.  
  49. /* macro to translate stpbrk calls to the equivalent strpbrk call */
  50.  
  51. #define stpbrk(s,b)     strpbrk(s,b)
  52.  
  53. /* macro to translate stcis calls to the equivalent strspn call */
  54.  
  55. #define stcis(s1,s2)    strspn(s1,s2)
  56.  
  57. /* macro to translate stcisn calls to the equivalent strcspn call */
  58.  
  59. #define stcisn(s1,s2)   strcspn(s1,s2)
  60.  
  61. /* macro to translate setmem calls to the equivalent memset call */
  62.  
  63. #define setmem(p, n, c)         memset(p, c, n)
  64.  
  65. /* macro to translate movmem calls to the equivalent memcpy call */
  66.  
  67. #define movmem(s, d, n)         memcpy(d, s, n)
  68.  
  69. /* MS C version 2.0 min, max, and abs macros */
  70.  
  71. #define max(a,b)        (((a) > (b)) ? (a) : (b))
  72. #define min(a,b)        (((a) < (b)) ? (a) : (b))
  73. #define abs(a)          (((a) < 0) ? -(a) : (a))
  74.  
  75. /* macros which implement MS C version 2.0's extended ctype macros, iscym and
  76.  * iscysmf
  77.  */
  78.  
  79. #define iscsymf(c)      (isalpha(c) || ((c) == '_'))
  80. #define iscsym(c)       (isalnum(c) || ((c) == '_'))
  81.  
  82. #endif  /* _INC_V2TOV3 */
  83.