📄 rdseed.h
字号:
/*===========================================================================*//* SEED reader | rdseed.h | header file *//*===========================================================================*//* Name: rdseed.h Purpose: contains variable and function definitions for rdseed programs Usage: #include "rdseed.h" Input: not applicable Output: not applicable Warnings: not applicable Errors: not applicable Called by: #included by many or all "rdseed" procedures Calls to: stdio.h - standard C include file for standard io functions string.h - standard C include file for string functions math.h - standard C include file for math functions macros.h - local include file with various C macros structures.h - local include file defining all structures Algorithm: not applicable Notes: "globals.h" defines and allocates space for the several globally-available variables and arrays. "rdseed.h" defines these elements as "EXTERN" for use by subprocedures and also defines all subprocedures. The construct "#ifndef . . . #endif" prevents #includes and variable definitions from being performed more than once if both "globals.h" and "rdseed.h" are #included. Both "globals.h" and "rdseed.h" are #included by the main program, while only "rdseed.h" is #included by any subprocedures. "stdio.h", "strings.h", and "math.h" are system-supplied headers, and contain no code to prevent multiple inclusion; therefore such code is contained here. "structures.h" and "macros.h" are part of the "rdseed" source code and contain codes to prevent multiple inclusion. Problems: in main routine, "globals.h" must be #included *before* "rdseed.h". References: Halbert et al, 1988; see main routine Language: C, hopefully ANSI standard Author: Dennis O'Neill Revisions: 07/15/88 Dennis O'Neill Initial preliminary release 0.9 11/09/88 Dennis O'Neill included byteswap flag 11/21/88 Dennis O'Neill Production release 1.0 02/06/89 Dennis O'Neill added decode_32bit subroutine*//* If this header is already included, don't include it again */#ifndef RDSEED_H#define RDSEED_H/* +=======================================+ *//*=================| Global and local-to-main constants |=================*//* +=======================================+ */#define LRECL_DEF 4096 /* default logical record length */#define PRECL 32768 /* default phys rec length */#define MAX_BLKT_LENGTH 16384 /* initial space allocation */#define MAX_DATA_LENGTH 2000000 /* initial space allocation */#define TEMP_CHAR_LENGTH 16384 /* space allocation */#define DECODEKEY 50+1 /* lngth of decoder key */#define MAXSGMS 1000 /* max # seismograms wanted*/#define LRECL_FMT "%4096c" /* input format for lgcl rec */#define STRINGTERM "~" /* vbl lntgh string term */#define PI 3.14159 /* The pi constant */#define isaleap(year) ((((year)%100 != 0) && ((year)%4 == 0)) || ((year)%400 == 0))/* if "MAIN" is #defined, give value to constants (do this only in main proc) */#ifdef MAIN#define EXTERN#define EQNULL =NULL /* init for linked lists */#define _PRECL PRECL + 1#define _LRECL LRECL_DEF #define _MAX_BLKT_LENGTH MAX_BLKT_LENGTH#define _MAX_DATA_LENGTH MAX_DATA_LENGTH#define _TEMP_CHAR_LENGTH TEMP_CHAR_LENGTH + 1#define _DECODEKEY DECODEKEY#define _MAXSGMS MAXSGMS#define _STRLEN 80#else/* otherwise all of these should be blank */#define EXTERN extern#define EQNULL#define _PRECL#define _LRECL#define _MAX_BLKT_LENGTH#define _MAX_DATA_LENGTH#define _TEMP_CHAR_LENGTH#define _DECODEKEY#define _MAXSGMS#define _STRLEN#endif#define fprintf myfprintf#define TAPE_DEVICE 0#define DISK_DEVICE -1/* +=======================================+ *//*=================| Inclusion of other include files |=================*//* +=======================================+ */#ifndef STDIO_H#include <stdio.h>#define STDIO_H#endif#ifndef STRING_H#include <string.h>#define STRING_H#endif#ifndef MATH_H#include <math.h>#define MATH_H#endif#include "macros.h"#include "structures.h"/* +=======================================+ *//*=================| Globally-available variables |=================*//* +=======================================+ */EXTERN FILE *inputfile; /* input data file or device */EXTERN FILE *alt_headerfile; /* alternate header file */EXTERN int output_flag; /* Flag that data has been output */EXTERN int reading_alt_file; /* Flag read of alt header file */EXTERN int LRECL; /* default logical rec length */EXTERN int byteswap; /* flag for byteswapping */EXTERN int check_reverse; /* flag for reversal checking */EXTERN int q_flag;EXTERN int more_data; /* more data tp process flag */EXTERN int outresp_old_flag; /* output response data flag (in old format) */EXTERN int outresp_flag; /* output respo0nse data flag */EXTERN int at_volume; /* At correct volume flag */EXTERN int found_lrecl_flag; /* founf logical record flag */EXTERN int input_file_type; /* flag type of input file 0 = char; -1 = block*/EXTERN char output_dir[];EXTERN int Seed_flag; /* whether to output presumably smaller seed volume */EXTERN int station_volume; /* flag type of volume 0 = seq; -1 = block*/EXTERN int volume_count; /* Count of passed volumes */EXTERN int volume_number; /* Volume number to use */EXTERN char precord[_PRECL]; /* physical input record */EXTERN char *precord_ptr; /* ptr to above */EXTERN int offset; /* offset into above */EXTERN char *lrecord_ptr; /* ptr to logical record */EXTERN int num_bytes_read; /* # bytes read from p recd */EXTERN int station_count; /* count of station match strings */EXTERN char *station_point[1500]; /* list of pointers to station match strings */EXTERN char station_list[3500]; /* string of station match strings */EXTERN int channel_count; /* count of channel match strings */EXTERN char *channel_point[250]; /* list pf pointers to channel match strings */EXTERN int network_count;EXTERN char *network_point[20]; /* list of pointers to station match strings */EXTERN char network_list[80]; /* string of station match strings */EXTERN int location_count;EXTERN char *location_point[20]; /* pointers to location strings */EXTERN char location_list[200]; /* ditto */EXTERN char channel_list[200]; /* string of channel match strings */ EXTERN int alias_count; /* count of alias file lines */EXTERN char *alias_point[50]; /* list of alias file line pointers */EXTERN int start_time_count; /* count of start time fields */EXTERN struct time *start_time_point; /* list of start time pointers */EXTERN int end_time_count; /* count of end times */EXTERN struct time *end_time_point; /* list of end time pointers */EXTERN int event_start_time_count; /* count of event start time fields */EXTERN struct time *event_start_time_point;/* list of event start time pointers */EXTERN int event_end_time_count; /* count of event end times */EXTERN struct time *event_end_time_point; /* list of event end time pointers */EXTERN int start_phase_count; /* count of start phase fields */EXTERN struct phase *start_phase_point; /* list of start phase pointers */EXTERN int end_phase_count; /* count of end phases */EXTERN struct phase *end_phase_point; /* list of end phase pointers */EXTERN char temp_char[_TEMP_CHAR_LENGTH]; /* temp storage */EXTERN char blockette[_MAX_BLKT_LENGTH]; /* blockette storage */EXTERN int blockette_type; /* blockette type number */EXTERN int blockette_length; /* blockette length (bytes) */EXTERN struct logical_record input; /* data from input file */EXTERN char outputformat[_STRLEN];EXTERN int output_format; /* Data Output Format Selection */EXTERN FILE *outputfile; /* Global output file */EXTERN char css_filename[100];/* CSS file name from volume times */EXTERN int Output_PnZs; /* flag to write Poles & Zeros */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -