src/share/vm/libadt/port.hpp

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 #ifndef _PORT_
  26 #define _PORT_
  27 // Typedefs for portable compiling
  28 
  29 #if defined(__GNUC__)
  30 
  31 #define INTERFACE       #pragma interface
  32 #define IMPLEMENTATION  #pragma implementation
  33 //INTERFACE
  34 #include <stddef.h>
  35 #include <stdlib.h>
  36 #include <string.h>
  37 #undef bzero
  38 inline void bzero(void *b, int len) { memset(b,0,len); }
  39 #undef bcopy
  40 inline void bcopy(const void *s, void *d, size_t len) { memmove(d,s,len); }
  41 #undef bcmp
  42 inline int bcmp(const void *s,const void *t,int len) { return memcmp(s,t,len);}
  43 extern "C" unsigned long strtoul(const char *s, char **end, int base);
  44 
  45 // Definition for sys_errlist varies from Sun 4.1 & Solaris.
  46 // We use the new Solaris definition.
  47 #include <string.h>
  48 
  49 // Access to the C++ class virtual function pointer
  50 // Put the class in the macro
  51 typedef void *VPTR;
  52 // G++ puts it at the end of the base class
  53 #define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));}
  54 
  55 #elif defined(__TURBOC__)
  56 
  57 #include <mem.h>
  58 #include <string.h>
  59 extern "C" int stricmp(const char *, const char *);
  60 inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); }
  61 inline void bzero(void *p, int l) { memset(p,0,l); }
  62 inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); }
  63 inline int min( int a, int b) { return a < b ? a : b; }
  64 inline int max( int a, int b) { return a > b ? a : b; }
  65 //strcasecmp moved to globalDefinitions_visCPP.hpp
  66 //inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
  67 inline long abs( long x ) { return x < 0 ? -x : x; }
  68 // Access to the C++ class virtual function pointer




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 #ifndef _PORT_
  26 #define _PORT_
  27 // Typedefs for portable compiling
  28 
  29 #if defined(__GNUC__)
  30 
  31 #define INTERFACE       #pragma interface
  32 #define IMPLEMENTATION  #pragma implementation
  33 //INTERFACE
  34 #include <stddef.h>
  35 #include <stdlib.h>
  36 #include <string.h>







  37 




  38 // Access to the C++ class virtual function pointer
  39 // Put the class in the macro
  40 typedef void *VPTR;
  41 // G++ puts it at the end of the base class
  42 #define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));}
  43 
  44 #elif defined(__TURBOC__)
  45 
  46 #include <mem.h>
  47 #include <string.h>
  48 extern "C" int stricmp(const char *, const char *);
  49 inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); }
  50 inline void bzero(void *p, int l) { memset(p,0,l); }
  51 inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); }
  52 inline int min( int a, int b) { return a < b ? a : b; }
  53 inline int max( int a, int b) { return a > b ? a : b; }
  54 //strcasecmp moved to globalDefinitions_visCPP.hpp
  55 //inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
  56 inline long abs( long x ) { return x < 0 ? -x : x; }
  57 // Access to the C++ class virtual function pointer