File: gmt_notunix.h

package info (click to toggle)
gmt 3.3.3-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,288 kB
  • ctags: 2,962
  • sloc: ansic: 50,470; sh: 1,760; makefile: 284; asm: 38
file content (223 lines) | stat: -rw-r--r-- 6,548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*--------------------------------------------------------------------
 *    The GMT-system:   @(#)gmt_notunix.h	3.4  01/20/00
 *
 *	Copyright (c) 1991-2000 by P. Wessel and W. H. F. Smith
 *	See COPYING file for copying and redistribution conditions.
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; version 2 of the License.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	Contact info: www.soest.hawaii.edu/gmt
 *--------------------------------------------------------------------*/
/*
 * gmt_notunix.h contains definitions for constants, structures, and
 * other parameters parameters used by GMT that are not supported by
 * non-UNIX operating systems such as Microsoft Windows.  Note that
 * all of these entities are part of POSIX.  The contents of this file
 * is only activated if one of the system preprocessor flags are defined.
 * Currently considered non-UNIX systems include
 *
 *	flag    |	OS
 *	--------------------------------------------
 *	WIN32   | Microsoft Windows 9x, NT, 2000
 *	__EMX__ | IBM OS/2 with EMX support
 *	_WIN32  | Unix emulation under Windows, like
 *		| Cygwin or DJGPP.  WIN32 implies and
 *		| sets _WIN32 but the converse is not
 *		| true.
 *
 * Author:	Paul Wessel
 * Date:	09-NOV-1999
 *
 */

/* A few general comments:
 * NO_LOCK is undefined unless under EMX and _WIN32 where we do NOT want
 * file locking.  Users who do not want file locking because, say, their
 * NFS does not support it should pass the compiler macro -DNO_LOCK.
 */


/*--------------------------------------------------------------------
 *
 *	   W I N D O W S   1 9 9 5,  1 9 9 8,  2 0 0 0,  N T
 *
 *	 THis section applies to Microsoft Windows 95, 98, NT
 *
 *--------------------------------------------------------------------*/

#ifdef WIN32	/* Start of Windows setup */

/* This section will override those in gmt_notposix.h which cannot
 * automatically be generated under Windows.
 */
 
#define SET_IN_NOTUNIX	/* This forces the following not to be reset in gmt_notposix.h */

/* These functions are available under Windows with MSVC compilers */

#define HAVE_COPYSIGN 1
#define HAVE_LOG1P 0
#define HAVE_HYPOT 1
#define HAVE_ACOSH 0
#define HAVE_ASINH 0
#define HAVE_ATANH 0
#define HAVE_RINT 0
#define HAVE_IRINT 0
#define HAVE_ISNANF 0
#define HAVE_ISNAND 0
#define HAVE_ISNAN 1
#define HAVE_J0 1
#define HAVE_J1 1
#define HAVE_JN 1
#define HAVE_Y0 1
#define HAVE_Y1 1
#define HAVE_YN 1
#define HAVE_ERF 0
#define HAVE_ERFC 0
#define HAVE_SINCOS 0
#define HAVE_ALPHASINCOS 0
#define WORDS_BIGENDIAN 0

/* Several math functions exist but the names have a leading underscore */

#define copysign(x,y) _copysign(x,y)
#define hypot(x,y) _hypot(x,y)
#define isnan(x) _isnan(x)
#define j0(x) _j0(x)
#define j1(x) _j1(x)
#define jn(n,x) _jn(n,x)
#define y0(x) _y0(x)
#define y1(x) _y1(x)
#define yn(n,x) _yn(n,x)

/* WIN32 versus _WIN32:
 *
 * In GMT, the WIN32 flag is predefined by the MicroSoft C compiler.
 * If set, we assume we are in a non-posix environment and must make
 * up the missing functions with homespun code.
 * WIN32 will set _WIN32 but the converse is not true.
 *
 * _WIN32 is set whenever we are compiling GMT on a PC not running
 * a Unix flavor.  This is true when GMT is to be installed under
 * Cygwin32.  _WIN32, when set, causes the directory delimiter to
 * be set to \ instead of /, and also attempts to deal with the fact
 * that DOS file systems have both TEXT and BINARY file modes.
 */

#ifndef _WIN32
#define _WIN32
#endif

#include <io.h>

/* GMT normally gets these macros from unistd.h */

#define R_OK 04
#define W_OK 02
#define X_OK 01
#define F_OK 00

/* This structure is normally taken from pwd.h */

struct passwd {
	char	*pw_name;
	int	pw_uid;
	int	pw_gid;
	char	*pw_dir;
	char	*pw_shell;
};

/* These two functions prototypes are normally in pwd.h & unistd.h;
 * Here, they are defined as dummies at the bottom of gmt_init.c */

struct passwd *getpwuid (const int uid);
int getuid (void);

/* getcwd is usually in unistd.h; we use a macro here
 * since the same function under WIN32 is prefixed with _ */

extern char *_getcwd (const char *path, int len);
#define getcwd(path, len) _getcwd(path, len)

/* access is usually in unistd.h; we use a macro here
 * since the same function under WIN32 is prefixed with _ */

extern int _access (const char *path, int mode);
#define access(path, mode) _access(path, mode)

/* fileno and setmode have leading _ under WIN32 */

#define fileno(stream) _fileno(stream)
#define setmode(fd,mode) _setmode(fd,mode)

EXTERN_MSC void GMT_setmode (int i_or_o);

#endif		/* End of Windows setup */

/*--------------------------------------------------------------------
 *
 *	 		  O S / 2
 *
 *	 This section applies to OS/2 with EMX support
 *
 *--------------------------------------------------------------------*/
 
#ifdef __EMX__	/* Start of OS/2 with EMX support */
/*
 *   Definitions to aid the porting of GMT to OS/2
 *   Most of the porting is taken care of by configure.
 *
 * Author:	Allen Cogbill, Los Alamos National Laboratory
 * Date:	09-NOV-1999
 */
 
#include <io.h>

#define NO_LOCK		/* Do not support file locking */
#define SET_IO_MODE	/* Need to force binary i/o upon request */
#define NO_FCNTL	/* fcntl.h does not exist here */

EXTERN_MSC void GMT_setmode (int i_or_o);

#endif		/* End of OS/2 with EMX support */


/*--------------------------------------------------------------------
 *
 *	 		  NON-UNIX
 *
 *	 This section applies to WIN32, Cygwin, and possibly DJGPP
 *
 *--------------------------------------------------------------------*/
 
#ifdef _WIN32	/* Start of NON-UNIX */

#define NO_LOCK		/* Do not support file locking */
#define SET_IO_MODE	/* Need to force binary i/o upon request */
#define DIR_DELIM '\\'	/* Backslash as directory deliimiter */

EXTERN_MSC void GMT_setmode (int i_or_o);

#endif		/* End of NON-UNIX */

/*===================================================================
 *		      U N I X   C L E AN - U P
 *===================================================================*/
 
/* Set a few Default Unix settings if they did not get set above */


#ifndef DIR_DELIM
#define DIR_DELIM '/'
#endif

#ifndef NO_FCNTL
#include <fcntl.h>
#endif