casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sysdep.h
Go to the documentation of this file.
1 /*
2  * History:
3  * pjt 31oct89 _trace_ added as defined() option, BUFALIGN 8.
4  * rjs 21feb90 Added alternate way of defining FORT_TRUE and FALSE
5  * to improve XMP and Cray-2 compatibility. This change
6  * care of Brian Glendenning.
7  * mjs ?? Increased BUFSIZE to avoid apparent OS problem on "ral".
8  * rjs 8feb91 Convex definitions.
9  * mjs 18mar91 More Convex definitions.
10  * rjs 16apr91 Removed macros redefining memcpy as bcopy -- no longer
11  * needed, and bcopy is slower on the Suns anyway.
12  * rjs 24jun91 Added memcmp define for the convex.
13  * rjs 18dec92 Added hpux. Various tidying.
14  * mjs 19feb93 Added mips.
15  * jm 07nov94 Added definition of Null and typedef of Void. The
16  * Void typedef permits proper casting in both ANSI
17  * and non-ANSI archs. Also added definition to permit
18  * the use of const in non-ANSI declarations.
19  * jm 17nov94 Changed the conditional definition around the typedef
20  * of Void because Sun defines __STDC__ even when it is
21  * zero! Defined PROTOTYPE as 1 if __STDC__ is set to 1;
22  * otherwise it is undefined. Also added ARGS definition
23  * to aide forward declartion prototyping.
24  * rjs 20nov94 Added "alpha" ifdef.
25  * rjs 19mar97 Add FORTRAN_LOGICAL define and check that miriad.h declarations
26  * have not been done before doing them again.
27  * pjt 14jun01 use WORDS_BIGENDIAN to figure out the pack routines
28  * removed 'trace' clutter from the old multiflow
29  * pjt 24jun01 PPC/powerpc is a BIGENDIAN (linux) machine
30  * pjt 21jun02 MIR4
31  * pjt 4jan05 merged in the new ATNF HAS_STRERROR
32  * pjt 6feb07 kludge for darwin_intel
33  * cgk 20dec07 make HAS_STRERROR be HAVE_STRERROR per configure.ac
34  */
35 
36 #if !defined(MIR_SYSDEP_H)
37 #define MIR_SYSDEP_H
38 
39 #include <sys/types.h>
40 #include <unistd.h>
41 
42 
43 #ifndef Null
44 #define Null '\0'
45 #endif
46 
47 /*
48  * Void is typedef'd to the proper word depending on the level of
49  * ANSI conformance. Also, if ANSI conforming, Const is defined
50  * to const; otherwise, Const is defined as a NULL statement.
51  *
52  * PROTOTYPE is defined only if function prototypes are correctly
53  * understood.
54  *
55  * ARGS defines a macro that aides in presenting prototypes.
56  * Use it as (double parentheses required):
57  * extern void keyput_c ARGS((const char *task, char *arg));
58  */
59 
60 #ifndef MIRIAD_TYPES_DEFINED
61 #define MIRIAD_TYPES_DEFINED 1
62 #ifdef __STDC__
63 #if (__STDC__ == 1)
64 typedef void Void;
65 #define Const const
66 #define PROTOTYPE 1
67 #define ARGS(s) s
68 #else
69 typedef char Void;
70 #define Const /* NULL */
71 #define ARGS(s) ()
72 #endif /* (__STDC__ == 1) */
73 #else
74 typedef char Void;
75 #define Const /* NULL */
76 #define ARGS(s) ()
77 #endif /* __STDC__ */
78 #if !defined(__cplusplus)
79 #define private static
80 #endif /* __cplusplus */
81 #endif /* MIRIAD_TYPES_DEFINED */
82 
83 typedef int int2;
84 typedef long long int int8;
85 
86 /************************************************************************/
87 /* */
88 /* UNICOS definitions */
89 /* */
90 /************************************************************************/
91 
92 #ifdef unicos
93 #include <fortran.h>
94 #define FORT_TRUE _btol(1)
95 #define FORT_FALSE _btol(0)
96 #define FORT_LOGICAL(a) (_ltob((&(a))))
97 #define BUFDBUFF 0
98 #define BUFALIGN 8
99 #define BUFSIZE 16384
100 #define defined_params
101 #endif
102 
103 /************************************************************************/
104 /* */
105 /* UNIX definitions. */
106 /* */
107 /************************************************************************/
108 
109 #ifndef defined_params
110 #if defined(convex) || defined(alpha) || defined(__alpha)
111 # define FORT_TRUE -1
112 #else
113 # define FORT_TRUE 1
114 #endif
115 
116 #define FORT_FALSE 0
117 #define FORT_LOGICAL(a) ((a) != FORT_FALSE)
118 
119 #define BUFDBUFF 0
120 #define BUFALIGN 2
121 #define BUFSIZE 16384
122 
123 /* Some machines have the "strerror" routine. Linux whinges significantly
124  if you use the "old" way of doing effectively what strerror does. */
125 
126 /* strerror is POSIX and should be supported under any POSIX.1 system */
127 /* Moving check for strerror into configure steps to define HAVE_STRERROR */
128 /* left old style build compatible check in bug.c */
129 
130 
131 /* Short cut routines when no conversion is necessary. These are
132  used for any IEEE floating point machine with FITS ordered bytes.
133 
134  WORDS_BIGENDIAN is also defined though the 'autoconf' package
135  and should appear in config.h if it's used (sun's, linuxppc, etc.)
136  two routines, pack16_c() and unpack16_c() are actually defined
137  in pack.c
138 
139  */
140 
141 
142 #ifndef WORDS_BIGENDIAN
143 # if defined (sun) || defined (convex) || defined (mips) || defined(sgi) || defined(hpux)
144 # define WORDS_BIGENDIAN
145 # endif
146 # if defined(PPC) || defined(powerpc) || defined(darwin_ppc)
147 # define WORDS_BIGENDIAN
148 # endif
149 #endif
150 
151 #if defined(i386)
152 #undef WORDS_BIGENDIAN
153 #endif
154 
155 #ifdef WORDS_BIGENDIAN
156 # define packr_c(a,b,c) memcpy((b),(char *)(a),sizeof(float)*(c))
157 # define unpackr_c(a,b,c) memcpy((char *)(b),(a),sizeof(float)*(c))
158 # define packd_c(a,b,c) memcpy((b),(char *)(a),sizeof(double)*(c))
159 # define unpackd_c(a,b,c) memcpy((char *)(b),(a),sizeof(double)*(c))
160 # define pack32_c(a,b,c) memcpy((b),(char *)(a),sizeof(int)*(c))
161 # define unpack32_c(a,b,c) memcpy((char *)(b),(a),sizeof(int)*(c))
162 
163 void pack16_c(int *in, char *out, int n);
164 void unpack16_c(char *in, int *out, int n);
165 
166 #else
167 
168 #if 1
169 void pack16_c(int *in, char *out, int n);
170 void unpack16_c(char *in, int *out, int n);
171 void pack32_c(int *in, char *out, int n);
172 void unpack32_c(char *in, int *out, int n);
173 void pack64_c(int8 *in, char *out, int n);
174 void unpack64_c(char *in, int8 *out, int n);
175 void packr_c(float *in, char *out, int n);
176 void unpackr_c(char *in, float *out, int n);
177 void packd_c(double *in, char *out, int n);
178 void unpackd_c(char *in, double *out, int n);
179 #endif
180 
181 #endif
182 #endif
183 
184 #endif /* MIR_SYSDEP_H */
void packd_c(double *in, char *out, int n)
void unpack16_c(char *in, int *out, int n)
void unpackr_c(char *in, float *out, int n)
int int2
Definition: sysdep.h:83
void unpackd_c(char *in, double *out, int n)
long long int int8
Definition: sysdep.h:84
void packr_c(float *in, char *out, int n)
void pack64_c(int8 *in, char *out, int n)
void unpack32_c(char *in, int *out, int n)
char Void
Definition: sysdep.h:74
void unpack64_c(char *in, int8 *out, int n)
void pack32_c(int *in, char *out, int n)
void pack16_c(int *in, char *out, int n)