Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
portdefs.h
Go to the documentation of this file.
00001 /* USMID @(#) clibinc/cray/portdefs.h   92.5    10/29/99 21:41:22 */
00002 
00003 
00004 /*
00005 
00006   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00007 
00008   This program is free software; you can redistribute it and/or modify it
00009   under the terms of version 2 of the GNU General Public License as
00010   published by the Free Software Foundation.
00011 
00012   This program is distributed in the hope that it would be useful, but
00013   WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00015 
00016   Further, this software is distributed without any warranty that it is
00017   free of the rightful claim of any third person regarding infringement 
00018   or the like.  Any license provided herein, whether implied or 
00019   otherwise, applies only to this software file.  Patent licenses, if 
00020   any, provided herein do not apply to combinations of this program with 
00021   other software, or any other product whatsoever.  
00022 
00023   You should have received a copy of the GNU General Public License along
00024   with this program; if not, write the Free Software Foundation, Inc., 59
00025   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00026 
00027   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00028   Mountain View, CA 94043, or:
00029 
00030   http://www.sgi.com
00031 
00032   For further information regarding this notice, see:
00033 
00034   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00035 
00036 */
00037 
00038 #ifndef _PORTDEFS_H
00039 #define _PORTDEFS_H
00040 
00041 #if     defined(__mips)
00042 #include <sgidefs.h>
00043 #elif   defined(_UNICOS)
00044 #include <sys/param.h>
00045 #include <sys/types.h>
00046 #ifdef  _CRAYT3E
00047 #define _UINT64_TYPEDEF 1
00048 #elif   RELEASE_LEVEL >= 9100
00049 #define _UINT64_TYPEDEF 1
00050 #endif
00051 #elif   defined(_SOLARIS)
00052 #include <cray/solaris.h>
00053 #endif
00054 
00055 /*
00056  *      Handy targetting macro definitions.
00057  */
00058 
00059 #include <limits.h>
00060 
00061 #define BYTES_PER_WORD  sizeof(int)             /* word size in bytes */
00062 #define BITS_PER_WORD   (BYTES_PER_WORD * CHAR_BIT) /* word size in bits */
00063 #define _BYTES_PER_LONG sizeof(long)            /* size of long in bytes */
00064 #define _BITS_PER_LONG  (_BYTES_PER_LONG * CHAR_BIT) /* size of long in bits */
00065 
00066 #if     defined(_CRAYIEEE) || !defined(_UNICOS)
00067 #define IEEE_FLOATING_POINT                     /* IEEE floating point */
00068 #endif
00069 
00070 /* these are for a *1 and a *2 integer and logical type size */
00071 #if     defined(__mips) || defined(_LITTLE_ENDIAN)
00072 typedef signed char             int8;           /* 8-bit integer */
00073 typedef unsigned char           uint8;          /* 8-bit unsigned integer */
00074 typedef short                   int16;          /* 16-bit integer */
00075 typedef unsigned short          uint16;         /* 16-bit unsigned integer */
00076 #endif
00077 
00078 /*
00079  *      Typedefs        These typedefs are for use in situations where
00080  *                      a minimum precision is required, irrespective
00081  *                      of the targetted system.
00082  */
00083 
00084 #if     defined(_LITTLE_ENDIAN)
00085 
00086 typedef int                     int32;          /* 32-bit integer */
00087 typedef unsigned int            uint32;         /* 32-bit unsigned integer */
00088 
00089 #if     defined(_LP64)
00090 typedef long                    int64;          /* 64-bit integer */
00091 typedef unsigned long           uint64;         /* 64-bit unsigned integer */
00092 #else
00093 typedef long long               int64;          /* 64-bit integer */
00094 typedef unsigned long long      uint64;         /* 64-bit unsigned integer */
00095 #endif
00096 
00097 #elif   _MIPS_SZLONG == 64                      /* ---- MIPS 64-bit ---- */
00098 
00099 typedef long                    int64;          /* 64-bit integer */
00100 typedef unsigned long           uint64;         /* 64-bit unsigned integer */
00101 typedef int                     int32;          /* 32-bit integer */
00102 typedef unsigned int            uint32;         /* 32-bit unsigned integer */
00103 
00104 
00105 #elif   defined(_WORD32)                        /* ---- MIPS n32,   ---- */
00106                                                 /* ---- Solaris,    ---- */
00107                                                 /* ---- and  ABSOFT ---- */
00108 
00109 typedef long long               int64;          /* 64-bit integer */
00110 typedef unsigned long long      uint64;         /* 64-bit unsigned integer */
00111 typedef int                     int32;          /* 32-bit integer */
00112 typedef unsigned int            uint32;         /* 32-bit unsigned integer */
00113 
00114 
00115 #elif   defined(_CRAY1) || defined(_CRAYMPP)    /* ---- CRAY PVP and MPP ---- */
00116 
00117 typedef long                    int64;          /* 64-bit integer */
00118 #if     !_UINT64_TYPEDEF
00119 #define  _UINT64_TYPEDEF 1
00120 typedef unsigned long           uint64;         /* 64-bit unsigned integer */
00121 #endif
00122 typedef short                   int32;          /* 32-bit integer */
00123 typedef unsigned short          uint32;         /* 32-bit unsigned integer */
00124 
00125 #endif  
00126 
00127 /*
00128  *      Macros
00129  */
00130 #if defined(_CRAY1) || defined(_CRAYMPP)        /* CRAY PVP and MPP */
00131 #define _PRAGMA_INLINE_2(name)  _Pragma(#name)
00132 #define _PRAGMA_INLINE(name)    _PRAGMA_INLINE_2(inline name)
00133 #else
00134 #define _PRAGMA_INLINE(name)
00135 #endif
00136 
00137 #ifndef _UNICOS
00138 
00139 /*
00140  *      CRI-extension constants which are missing in portable POSIX/ANSI
00141  *      C header files.
00142  */
00143 
00144 #define EFLEFIRST       1000            /* from errno.h */
00145 #define EFLELAST        1999            /* from errno.h */
00146 
00147 /*
00148  *      CRI-extension function prototypes which are missing in portable 
00149  *      POSIX/ANSI C header files.
00150  */
00151 
00152 #include <sys/types.h>  /* for size_t */
00153 
00154 extern char *strnrstrn(const char *_s1, size_t _n1, const char *_s2,
00155                        size_t _n2);             /* from string.h */
00156 
00157 extern char *strnstrn(const char *_s1, size_t _n1, const char *_s2,
00158                       size_t _n2);              /* from string.h */
00159 
00160 /*
00161  *      Some CRI C compiler extension intrinsic functions are implemented as
00162  *      ordinary functions. 
00163  */
00164 
00165 #define INTRINSICS_PARM_TYPE    unsigned long
00166 
00167 extern int      _count(INTRINSICS_PARM_TYPE x);
00168 #if     !defined(__mips) || \
00169         (defined(__mips) && !(defined(__INLINE_INTRINSICS) && \
00170         defined(_COMPILER_VERSION) && (_COMPILER_VERSION>= 730)))
00171 /* prototype for functions when not compiler intrinsic */
00172 extern long     _dshiftl(INTRINSICS_PARM_TYPE x, INTRINSICS_PARM_TYPE y, int b);
00173 extern long     _dshiftr(INTRINSICS_PARM_TYPE x, INTRINSICS_PARM_TYPE y, int b);
00174 extern int      _leadz(INTRINSICS_PARM_TYPE x);
00175 extern long     _mask(int n);
00176 extern long     _maskr(int n);
00177 extern long     _maskl(int n);
00178 #endif
00179 
00180 #ifdef  __mips
00181 extern void
00182 movbit_(void *a, long long *az, long long  *nz, void *b, long long *bz);
00183 extern void
00184 movbitz_(void *a, long long *az, long long *nz, void *b, long long *bz);
00185 extern long     _pack(long *up, char *cp, long bc, int tc);
00186 extern long     _unpack(char *cp, long *up, long bc, int tc);
00187 #elif defined(_LITTLE_ENDIAN)
00188 extern void
00189 movbit_(void *a, int64 *az, int64 *nz, void *b, int64 *bz);
00190 extern void
00191 movbitz_(void *a, int64 *az, int64 *nz, void *b, int64 *bz);
00192 extern long     _pack(long *up, char *cp, long bc, int tc);
00193 extern long     _unpack(char *cp, long *up, long bc, int tc);
00194 #endif
00195 
00196 
00197 /*
00198  *      CRI extensions may be permitted (and deactivated) in portable code 
00199  *      through use of these special definitions.
00200  */
00201 
00202 #define restrict                        /* SCC type qualifier extension */
00203 #define _gsys_qtape(x)  (0)             /* CRI online tape support */
00204 #define O_RAW           0x0             /* fcntl.h flag for open(2) */
00205 
00206 #ifdef  _SOLARIS
00207 #define LOADED(x)       (x != NULL)     /* Solaris weak externals */
00208 #define LOADED_DATA(x)  (x != NULL)     /* Solaris weak externals */
00209 #else
00210 #define LOADED(x)       (1)             /* CRI soft external symbols */
00211 #define LOADED_DATA(x)  (1)             /* CRI soft external symbols */
00212 #endif
00213 
00214 #endif  /* ! _UNICOS */
00215 
00216 /*
00217  * naming conventions, used in libfi/matrix routines 
00218  * NB: using LITTLE_ENDIAN as synonym for linux here..
00219  *
00220  */
00221 #if defined(_SOLARIS) || defined(__mips) || defined(_ABSOFT) || defined(_LITTLE_ENDIAN)
00222 #define UNIX_NAMING_CONVENTION 
00223 #else
00224 #undef UNIX_NAMING_CONVENTION 
00225 #endif
00226 
00227 /*
00228  * complex result convention, used in libfi/matrix routines 
00229  * NB: using LITTLE_ENDIAN as synonym for linux here..
00230  *
00231  */
00232 
00233 #if !defined(_SOLARIS) && !defined(__mips) && !defined(_ABSOFT) && !defined(_LITTLE_ENDIAN)
00234 #define COMPLEX_AS_SCALAR
00235 #else
00236 #undef COMPLEX_AS_SCALAR
00237 #endif
00238 
00239 #endif /* _PORTDEFS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines