forked from JohnWStockwellJr/SeisUnix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsu.h
103 lines (89 loc) · 2.97 KB
/
su.h
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
/* Copyright (c) Colorado School of Mines, 2011.*/
/* All rights reserved. */
/* su.h - include file for SU programs
*
* $Author: john $
* $Source: /usr/local/cwp/src/su/include/RCS/su.h,v $
* $Revision: 1.34 $ ; $Date: 2011/11/11 23:56:14 $
*/
#ifndef SU_H
#define SU_H
#include "par.h"
/* TYPEDEFS */
typedef union { /* storage for arbitrary type */
char s[8];
short h;
unsigned short u;
long l;
unsigned long v;
int i;
unsigned int p;
float f;
double d;
unsigned int U:16;
unsigned int P:32;
} Value;
/* DEFINES */
#define CHECK_NT(label,nt) \
if(nt > SU_NFLTS) err("%s=%d must not exceed %d",label,nt,SU_NFLTS)
#define NALLOC (524288)
#define NFALLOC (NALLOC/FSIZE)
#define NIALLOC (NALLOC/ISIZE)
#define NDALLOC (NALLOC/DSIZE)
#define LOWBYTE(w) ((w) & 0xFF)
#define HIGHBYTE(w) LOWBYTE((w) >>8)
#define LOWWORD(w) ((w) & 0xFFFF)
#define HIGHWORD(w) LOWWORD((w) >>16)
#define ISNEGCHAR(c) ((c) & 0x80)
#define SIGNEXTEND(c) (~0xFF | (int) (c))
/* READ_OK - read permission for access(2)
* WRITE_OK - write permission for access(2)
* EXEC_OK - exec permission for access(2)
* FILE_OK - file existence for access(2)
* Note: these are changed from the usual defines in file.h
* because this include exists on some machines and
* not others, often overlaps fcntl.h, etc. Lint is
* happier with a fresh start.
* Note: Post-ANSI sometimes R_OK in unistd.h (this isn't
* an ANSI file).
*/
#define READ_OK 4
#define WRITE_OK 2
#define EXEC_OK 1
#define FILE_OK 0
/* For plotting by keyword */
#define IS_DEPTH(str) (( STREQ(str,"gelev") || \
STREQ(str,"selev") || \
STREQ(str,"sdepth") || \
STREQ(str,"gdel") || \
STREQ(str,"sdel") || \
STREQ(str,"swdep") || \
STREQ(str,"gwdep") )?cwp_true:cwp_false)
#define IS_COORD(str) (( STREQ(str,"sx") || \
STREQ(str,"sy") || \
STREQ(str,"gx") || \
STREQ(str,"gy") )?cwp_true:cwp_false)
/* FUNCTION PROTOTYPES */
#ifdef __cplusplus /* if C++, specify external linkage to C functions */
extern "C" {
#endif
/* valpkge */
int vtoi(register cwp_String type, Value val);
long vtol(register cwp_String type, Value val);
float vtof(register cwp_String type, Value val);
double vtod(register cwp_String type, Value val);
int valcmp(register cwp_String type, Value val1, Value val2);
void printfval(register cwp_String type, Value val);
void fprintfval(FILE *stream, register cwp_String type, Value val);
void scanfval(register cwp_String type, Value *valp);
void atoval(cwp_String type, cwp_String keyval, Value *valp);
void getparval(cwp_String name, cwp_String type, int n, Value *valp);
Value valtoabs(cwp_String type, Value val);
/* segy coordinate scalar utilities */
short elco_scalar(int ncoords, double c[]);
double from_segy_elco_multiplier(short segy_scalar);
double to_segy_elco_multiplier(short segy_scalar); /* reciprocal of from */
#ifdef __cplusplus /* if C++, end external linkage specification */
}
#endif
#endif