home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / harbb30g.zip / INCLUDE / hbdefs.h < prev    next >
C/C++ Source or Header  |  1999-09-17  |  5KB  |  161 lines

  1. /*
  2.  * $Id: hbdefs.h,v 1.31 1999/09/17 13:29:24 vszel Exp $
  3.  */
  4.  
  5. /*
  6.  * Harbour Project source code:
  7.  * Header file for compiler and runtime basic type declarations
  8.  *
  9.  * Copyright 1999 {list of individual authors and e-mail addresses}
  10.  * www - http://www.harbour-project.org
  11.  *
  12.  * This program is free software; you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation; either version 2 of the License, or
  15.  * (at your option) any later version, with one exception:
  16.  *
  17.  * The exception is that if you link the Harbour Runtime Library (HRL)
  18.  * and/or the Harbour Virtual Machine (HVM) with other files to produce
  19.  * an executable, this does not by itself cause the resulting executable
  20.  * to be covered by the GNU General Public License. Your use of that
  21.  * executable is in no way restricted on account of linking the HRL
  22.  * and/or HVM code into it.
  23.  *
  24.  * This program is distributed in the hope that it will be useful,
  25.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27.  * GNU General Public License for more details.
  28.  *
  29.  * You should have received a copy of the GNU General Public License
  30.  * along with this program; if not, write to the Free Software
  31.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
  32.  * their web site at http://www.gnu.org/).
  33.  *
  34.  */
  35.  
  36. #ifndef HB_DEFS_H_
  37. #define HB_DEFS_H_
  38.  
  39. #include <stdarg.h>
  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include <string.h>
  43. #include "hbsetup.h"
  44.  
  45. #if defined(__IBMCPP__)
  46.    /* With the exception of WORD, the IBM Visual Age C++ compiler has
  47.       its own definitions of the Harbour types defined in the #else
  48.       section of this #ifdef block, most of which conflict with the
  49.       Harbour #undefs, due to typedef being the prevalent method of
  50.       defining the types in IBMCPP, whereas Harbour assumes that the
  51.       definitions that it is replacing have been defined using
  52.       #define. Therefore, it is necessary to skip the Harbour
  53.       definition section when using the IBMCPP compiiler, include
  54.       the IBMCPP type definitions, and then add the definition for WORD
  55.  
  56.       NOTE: This only applies to the common types that most C compilers
  57.             define. Any new types, particulary those that start with
  58.             HB_, must be placed AFTER the #endif __IBMCPP__ line!
  59.    */
  60.    #define INCL_TYPES
  61.    #include <os2.h>
  62.    #undef INT
  63.    #undef UINT
  64.  
  65. #else
  66.  
  67. #if ! defined(HB_DONT_DEFINE_BASIC_TYPES)
  68.  
  69. #undef BOOL                            /* boolean */
  70. typedef int BOOL;
  71.  
  72. #undef BYTE
  73. typedef unsigned char BYTE;            /* 1 byte unsigned */
  74.  
  75. #undef SHORT                           /* 2 bytes signed */
  76. typedef short int SHORT;
  77.  
  78. #undef USHORT                          /* 2 bytes unsigned */
  79. typedef unsigned short int USHORT;
  80.  
  81. #undef LONG                            /* 4 bytes signed */
  82. typedef long LONG;
  83.  
  84. #undef ULONG                           /* 4 bytes unsigned */
  85. typedef unsigned long ULONG;
  86.  
  87. #undef FALSE
  88. #undef TRUE
  89. #define FALSE  0
  90. #define TRUE   1
  91.  
  92. #endif /* HB_DONT_DEFINE_BASIC_TYPES */
  93. #endif /* __IBMCPP__ */
  94.  
  95. #ifndef MAX
  96. #define MAX( a, b )             ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
  97. #endif
  98. #ifndef MIN
  99. #define MIN( a, b )             ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
  100. #endif
  101.  
  102. #ifndef LOBYTE
  103. #define LOBYTE( w )             ( ( BYTE )( w ) )
  104. #endif
  105. #ifndef HIBYTE
  106. #define HIBYTE( w )             ( ( BYTE )( ( ( USHORT )( w ) >> 8 ) & 0xFF ) )
  107. #endif
  108. #ifndef MKINT
  109. #define MKINT( b1, b2 )         ( ( ( long ) b2 ) <<  8 ) | b1
  110. #endif
  111. #ifndef MKLONG
  112. #define MKLONG( b1, b2, b3, b4 ) ( ( ( long ) b4 ) << 24 ) | \
  113.                                  ( ( ( long ) b3 ) << 16 ) | \
  114.                                  ( ( ( long ) b2 ) <<  8 ) | b1
  115. #endif
  116.  
  117. #define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol
  118.  
  119. #ifdef __GNUC__
  120.    #define pascal __attribute__ ((stdcall))
  121. #endif
  122.  
  123. #ifdef _MSC_VER
  124.    #define HARBOUR void
  125.    #define EXTERNAL_LINKAGE
  126. #else
  127.    #ifdef __IBMCPP__
  128.       #define HARBOUR void
  129.       #define EXTERNAL_LINKAGE _LNK_CONV
  130.    #else
  131.       #define HARBOUR void pascal
  132.       #define EXTERNAL_LINKAGE
  133.    #endif
  134. #endif
  135.  
  136. #define __HARBOUR__
  137.  
  138. typedef BYTE HB_CHAR;
  139. typedef BYTE HB_ATTR;
  140.  
  141. typedef HARBOUR ( * PHB_FUNC )( void );
  142. typedef PHB_FUNC HB_FUNC_PTR;
  143.  
  144. typedef LONG HB_HANDLE;     /* handle to memvar value */
  145. typedef char SYMBOLSCOPE;   /* stores symbol's scope */
  146.  
  147. /* Some common character constants */
  148.  
  149. #define HB_CHAR_NUL             '\0'    /*   0 - NUL */
  150. #define HB_CHAR_EOS             HB_CHAR_NUL
  151. #define HB_CHAR_BEL             '\a'    /*   7 - Bell */
  152. #define HB_CHAR_BS              '\b'    /*   8 - Backspace */
  153. #define HB_CHAR_HT              '\t'    /*   9 - Tab horizontal */
  154. #define HB_CHAR_LF              '\n'    /*  10 - Linefeed */
  155. #define HB_CHAR_VT              '\v'    /*  11 - Tab vertical */
  156. #define HB_CHAR_FF              '\f'    /*  12 - Formfeed */
  157. #define HB_CHAR_CR              '\r'    /*  13 - Carriage return */
  158. #define HB_CHAR_EOF             '\x1A'  /*  26 - End of file marker */
  159.  
  160. #endif /* HB_DEFS_H_ */
  161.