home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / MJRDEVEL.ARC / PORTABLE.H < prev    next >
Text File  |  1988-02-08  |  5KB  |  96 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   PORTABLE.H                                                            *
  4.  *                                                                         *
  5.  *   Copyright (C) 1988 GALACTICOMM, Inc.      All Rights Reserved.        *
  6.  *                                                                         *
  7.  *   This header file supports compatibility of the source code of The     *
  8.  *   Major BBS with multiple C language compilers, specifically, those     *
  9.  *   of Microsoft, Lattice, and Borland (Turbo).                           *
  10.  *                                                                         *
  11.  *   This declaration:  include "portable.h"  should appear in each        *
  12.  *   source file, immediately following the other include directives.      *
  13.  *                                                                         *
  14.  *                                 WARNING!                                *
  15.  *                                                                         *
  16.  *   Your compiler command line must define one of these symbols:          *
  17.  *   MSC_C  LSC_C  or  TSC_C   This identifies the C compiler              *
  18.  *   (Microsoft, Lattice, or Turbo).  If Microsoft C 5.0 is in use,        *
  19.  *   you must also define the symbol MS5.                                  *
  20.  *                                                                         *
  21.  *                                              - R. Stein 1/24/88         *
  22.  *                                                                         *
  23.  ***************************************************************************/
  24.  
  25. #ifdef LSC_C
  26. char *getml();
  27. #define ADDR_OFdisaster     &disaster
  28. #define FOPRB  "rb"     /* fopen() 2nd parameter for read binary mode       */
  29. #define FOPRA  "ra"     /* fopen() 2nd parameter for read ASCII mode        */
  30. #define FOPWB  "wb"     /* fopen() 2nd parameter for write binary mode      */
  31. #define FOPWA  "wa"     /* fopen() 2nd parameter for write ASCII mode       */
  32. #define FOPRWB "rb+"    /* fopen() 2nd parameter for read/write binary mode */
  33. #define FOPRWA "ra+"    /* fopen() 2nd parameter for read/write ASCII mode  */
  34. #define FOPAB  "ab"     /* fopen() 2nd parameter for append binary mode     */
  35. #define FOPAA  "aa"     /* fopen() 2nd parameter for append ASCII mode      */
  36. #define CNTLIT 1        /* does sscanf() count literal matches?             */
  37. #define CFREGS 0        /* 0=no cflag field in REGS, use int86() ret value  */
  38. #define CKNOWN
  39. #endif
  40.  
  41. #ifdef MSC_C
  42. #define allmem()            ;
  43. #define setmem(p,n,c)       memset(p,c,n)
  44. #define getml(ln)           halloc(ln,1)
  45. char huge *halloc();
  46. #define ADDR_OFdisaster     disaster
  47. #define FOPRB  "rb"     /* fopen() 2nd parameter for read binary mode       */
  48. #define FOPRA  "ra"     /* fopen() 2nd parameter for read ASCII mode        */
  49. #define FOPWB  "wb"     /* fopen() 2nd parameter for write binary mode      */
  50. #define FOPWA  "wa"     /* fopen() 2nd parameter for write ASCII mode       */
  51. #define FOPRWB "r+b"    /* fopen() 2nd parameter for read/write binary mode */
  52. #define FOPRWA "r+a"    /* fopen() 2nd parameter for read/write ASCII mode  */
  53. #define FOPAB  "ab"     /* fopen() 2nd parameter for append binary mode     */
  54. #define FOPAA  "aa"     /* fopen() 2nd parameter for append ASCII mode      */
  55. #define CNTLIT 0        /* does sscanf() count literal matches?             */
  56. #define CFREGS 1        /* REGS has a cflag field (see TurboC dos.h)        */
  57. #define CKNOWN
  58. #ifdef MS5
  59. #define movmem(s,d,n)       memmove(d,s,n)   /* microsoft 5.0 memcpy does   */
  60. #else                                        /*   not deal with overlaps    */
  61. #define movmem(s,d,n)       memcpy(d,s,n)
  62. #endif
  63. #endif
  64.  
  65. #ifdef TSC_C
  66. #define allmem()            ;
  67. #define sizmem()            coreleft()
  68. #define getml(ln)           farmalloc(ln)
  69. void far *farmalloc(unsigned long size);
  70. #define ADDR_OFdisaster     disaster
  71. #define FOPRB  "rb"     /* fopen() 2nd parameter for read binary mode       */
  72. #define FOPRA  "rt"     /* fopen() 2nd parameter for read ASCII mode        */
  73. #define FOPWB  "wb"     /* fopen() 2nd parameter for write binary mode      */
  74. #define FOPWA  "wt"     /* fopen() 2nd parameter for write ASCII mode       */
  75. #define FOPRWB "r+b"    /* fopen() 2nd parameter for read/write binary mode */
  76. #define FOPRWA "r+t"    /* fopen() 2nd parameter for read/write ASCII mode  */
  77. #define FOPAB  "ab"     /* fopen() 2nd parameter for append binary mode     */
  78. #define FOPAA  "at"     /* fopen() 2nd parameter for append ASCII mode      */
  79. #define CNTLIT 0        /* does sscanf() count literal matches?             */
  80. #define CFREGS 1        /* REGS has a cflag field (see TurboC dos.h)        */
  81. #define CKNOWN
  82. #endif
  83.  
  84. #ifndef min
  85. #define min(a,b)        (((a) < (b)) ? (a) : (b))
  86. #define max(a,b)        (((a) > (b)) ? (a) : (b))
  87. #define abs(a)          (((a) < 0) ? -(a) : (a))
  88. #endif
  89.  
  90. #ifdef CKNOWN
  91. #undef CKNOWN
  92. #else
  93. #error YOU SHOULD IDENTIFY THE COMPILER!  (See the warning in PORTABLE.H)
  94. #endif
  95.  
  96.