Main Page Class Hierarchy Compound List File List Compound Members File Members

# ahputaway.c File Reference

`#include <math.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <earthworm.h>`
`#include <time.h>`
`#include <trace_buf.h>`
`#include <swap.h>`
`#include <ws_clientII.h>`
`#include <ahhead.h>`
`#include <pa_subs.h>`
`#include <rpc/types.h>`
`#include <rpc/xdr.h>`

Go to the source code of this file.

## Defines
#define | MAXTXT 150
#define | AE_RHED 1
#define | AE_DTYPE 2
#define | AE_WHED 3
#define | AE_RDATA 4
#define | AE_WDATA 5
#define | AE_WRECORD 6
#define | AE_RRECORD 7
#define | AE_TTYOUT 8
#define | AE_TTYIN 9
#define | MAX(a, b) (((a) > (b)) ? (a) : (b))
#define | MIN(a, b) (((a) < (b)) ? (a) : (b))
## Functions
int | gethead (ahhed *, FILE *)
int | puthead (ahhed *, FILE *)
int | size (ahhed *)
int | tohead (int, FILE *)
int | getdata (ahhed *, char *, FILE *)
int | putdata (ahhed *, char *, FILE *)
int | putrecord (ahhed *, char *, FILE *)
int | getrecord (ahhed *, char *, FILE *)
int | getrecord2 (ahhed *, char **, FILE *)
int | gogethead (int, ahhed *, FILE *)
int | gogetrecord (int, ahhed *, char *, FILE *)
int | logger (char *, ahhed *)
int | out_is_tty (void)
int | in_is_tty (void)
char * | mkdatspace (ahhed *)
int | get_null_head (ahhed *)
int | acpy (char *, char *, unsigned)
void | ah_error (char *, char *, int)
int | maxamp (ahhed *, char *)
int | xdr_gethead (ahhed *, XDR *)
int | xdr_puthead (ahhed *, XDR *)
int | xdr_tohead (int, XDR *)
int | xdr_getdata (ahhed *, char *, XDR *)
int | xdr_putdata (ahhed *, char *, XDR *)
int | xdr_putrecord (ahhed *, char *, XDR *)
int | xdr_getrecord (ahhed *, char *, XDR *)
int | xdr_getrecord2 (ahhed *, char **, XDR *)
int | xdr_gogethead (int, ahhed *, XDR *)
int | xdr_gogetrecord (int, ahhed *, char *, XDR *)
int | xdr_ahhead (XDR *, ahhed *)
int | AHPA_init (long *OutBufferLen, char *OutDir, int debug)
int | AHPA_next_ev (TRACE_REQ *ptrReq, int nReq, char *OutDir, char *EventDate, char *EventTime, int debug)
int | AHPA_next (TRACE_REQ *getThis, double GapThresh, long OutBufferLen, int debug)
int | AHPA_end_ev (int debug)
int | AHPA_close (int debug)
int | isatty (int)
## Variables
char | AHDir [2 *MAXTXT+4]
ahhed * | AhHead
float * | mydata
int | ah_errno = 0
int | ah_nerr = 10
char * | ah_errlist []

## Define Documentation

#define AE_DTYPE 2

| Definition at line 416 of file ahputaway.c. Referenced by gethead(), maxamp(), size(), xdr_getdata(), xdr_gethead(), xdr_putdata(), and xdr_tohead().

#define AE_RDATA 4

| Definition at line 418 of file ahputaway.c. Referenced by getdata(), xdr_getdata(), and xdr_putdata().

#define AE_RHED 1

| Definition at line 415 of file ahputaway.c. Referenced by gethead(), tohead(), xdr_gethead(), and xdr_tohead().

#define AE_RRECORD 7

| Definition at line 421 of file ahputaway.c. Referenced by getrecord(), and xdr_getrecord().

#define AE_TTYIN 9

| Definition at line 423 of file ahputaway.c. Referenced by in_is_tty().

#define AE_TTYOUT 8

| Definition at line 422 of file ahputaway.c. Referenced by out_is_tty().

#define AE_WDATA 5

| Definition at line 419 of file ahputaway.c. Referenced by putdata().

#define AE_WHED 3

| Definition at line 417 of file ahputaway.c. Referenced by puthead(), and xdr_puthead().

#define AE_WRECORD 6

| Definition at line 420 of file ahputaway.c. Referenced by putrecord(), and xdr_putrecord().

#define MAX | ( | a,
|  | b |  | ) | (((a) > (b)) ? (a) : (b))

| Definition at line 983 of file ahputaway.c. Referenced by maxamp(), and mnbrak().

#define MAXTXT 150

| Definition at line 74 of file ahputaway.c. Referenced by AHPA_next(), SACPABase_end_scn(), SACPABase_end_scn_gm(), and SUDSPA_next_ev().

#define MIN | ( | a,
|  | b |  | ) | (((a) < (b)) ? (a) : (b))

| Definition at line 986 of file ahputaway.c. Referenced by BuildHyp(), BuildPhs(), and maxamp().

## Function Documentation

int acpy | ( | char * | ,
|  | char * | ,
|  | unsigned |
| ) | `[static]`

| Definition at line 964 of file ahputaway.c.

void ah_error | ( | char * | ,
|  | char * | ,
|  | int |
| ) | `[static]`

| Definition at line 973 of file ahputaway.c. References ah_errno, and ah_nerr.

int AHPA_close | ( | int | debug | ) |

| Definition at line 387 of file ahputaway.c. Referenced by PA_close().

int AHPA_end_ev | ( | int | debug | ) |

| Definition at line 376 of file ahputaway.c. Referenced by PA_end_ev().

int AHPA_init | ( | long * | OutBufferLen,
|  | char * | OutDir,
|  | int | debug
| ) |

| Definition at line 120 of file ahputaway.c. References AhHead, CreateDir(), EW_FAILURE, EW_SUCCESS, logit(), and mydata. Referenced by PA_init().

int AHPA_next | ( | TRACE_REQ * | getThis,
|  | double | GapThresh,
|  | long | OutBufferLen,
|  | int | debug
| ) |

| Definition at line 173 of file ahputaway.c. References record_info::abstime, TRACE_REQ::actLen, AhHead, TRACE_HEADER::chan, station_info::chan, station_info::code, TRACE_HEADER::datatype, ah_time::day, record_info::delta, TRACE_HEADER::endtime, EW_FAILURE, FLOAT, ah_time::hr, logit(), maxamp(), MAXTXT, ah_time::mn, ah_time::mo, mydata, record_info::ndata, TRACE_HEADER::net, TRACE_HEADER::nsamp, TRACE_REQ::pBuf, ahhed::record, TRACE_HEADER::samprate, ah_time::sec, TRACE_HEADER::sta, TRACE_HEADER::starttime, ahhed::station, station_info::stype, record_info::type, WaveMsgMakeLocal(), xdr_putrecord(), and ah_time::yr. Referenced by PA_next().

int AHPA_next_ev | ( | TRACE_REQ * | ptrReq,
|  | int | nReq,
|  | char * | OutDir,
|  | char * | EventDate,
|  | char * | EventTime,
|  | int | debug
| ) |

| Definition at line 153 of file ahputaway.c. References CreateDir(), EW_FAILURE, EW_SUCCESS, and logit(). Referenced by PA_next_ev().

int get_null_head | ( | ahhed * |  | ) | `[static]`

| Definition at line 909 of file ahputaway.c. References station_info::A0, record_info::abstime, station_info::cal, station_info::chan, station_info::code, ah_time::day, record_info::delta, event_info::dep, station_info::DS, event_info::ecomment, station_info::elev, ahhed::event, ahhed::extra, ah_time::hr, complex::i, event_info::lat, record_info::log, event_info::lon, record_info::maxamp, ah_time::mn, ah_time::mo, record_info::ndata, NEXTRAS, NOCALPTS, event_info::ot, calib::pole, complex::r, record_info::rcomment, ahhed::record, record_info::rmin, ah_time::sec, station_info::slat, station_info::slon, ahhed::station, station_info::stype, record_info::type, ah_time::yr, and calib::zero. Referenced by gethead(), and xdr_gethead().

int getdata | ( | ahhed * | ,
|  | char * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 646 of file ahputaway.c. References AE_RDATA, ah_errno, record_info::ndata, ahhed::record, and size(). Referenced by getrecord(), and getrecord2().

int gethead | ( | ahhed * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 454 of file ahputaway.c. References station_info::A0, record_info::abstime, AE_DTYPE, AE_RHED, ah_errno, station_info::cal, station_info::chan, station_info::code, ah_time::day, record_info::delta, event_info::dep, station_info::DS, event_info::ecomment, station_info::elev, ahhed::event, ahhed::extra, get_null_head(), ah_time::hr, complex::i, event_info::lat, record_info::log, event_info::lon, record_info::maxamp, ah_time::mn, ah_time::mo, record_info::ndata, NEXTRAS, NOCALPTS, event_info::ot, calib::pole, complex::r, record_info::rcomment, ahhed::record, record_info::rmin, ah_time::sec, station_info::slat, station_info::slon, ahhed::station, station_info::stype, record_info::type, TYPEMAX, TYPEMIN, ah_time::yr, and calib::zero. Referenced by getrecord(), getrecord2(), gogethead(), and tohead().

int getrecord | ( | ahhed * | ,
|  | char * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 711 of file ahputaway.c. References AE_RRECORD, ah_errno, getdata(), and gethead(). Referenced by gogetrecord().

int getrecord2 | ( | ahhed * | ,
|  | char ** | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 734 of file ahputaway.c. References getdata(), gethead(), and mkdatspace().

int gogethead | ( | int | ,
|  | ahhed * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 767 of file ahputaway.c. References gethead(), and tohead().

int gogetrecord | ( | int | ,
|  | ahhed * | ,
|  | char * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 785 of file ahputaway.c. References getrecord(), and tohead().

int in_is_tty | ( | void |  | ) | `[static]`

| Definition at line 875 of file ahputaway.c. References AE_TTYIN, ah_errno, and isatty().

int isatty | ( | int |  | ) |

| Referenced by in_is_tty(), and out_is_tty().

int logger | ( | char * | ,
|  | ahhed * |
| ) | `[static]`

| Definition at line 807 of file ahputaway.c. References record_info::log, LOGENT, LOGSIZE, and ahhed::record.

int maxamp | ( | ahhed * | ,
|  | char * |
| ) | `[static]`

| Definition at line 997 of file ahputaway.c. References AE_DTYPE, ah_errno, COMPLEX, DOUBLE, FLOAT, MAX, record_info::maxamp, MIN, min, record_info::ndata, ahhed::record, and record_info::type. Referenced by AHPA_next().

char * mkdatspace | ( | ahhed * |  | ) | `[static]`

| Definition at line 895 of file ahputaway.c. References record_info::ndata, ahhed::record, and size(). Referenced by getrecord2(), and xdr_getrecord2().

int out_is_tty | ( | void |  | ) | `[static]`

| Definition at line 857 of file ahputaway.c. References AE_TTYOUT, ah_errno, and isatty().

int putdata | ( | ahhed * | ,
|  | char * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 667 of file ahputaway.c. References AE_WDATA, ah_errno, record_info::ndata, ahhed::record, and size(). Referenced by putrecord().

int puthead | ( | ahhed * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 545 of file ahputaway.c. References AE_WHED, and ah_errno. Referenced by putrecord().

int putrecord | ( | ahhed * | ,
|  | char * | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 688 of file ahputaway.c. References AE_WRECORD, ah_errno, putdata(), and puthead().

int size | ( | ahhed * |  | ) | `[static]`

| Definition at line 566 of file ahputaway.c. References AE_DTYPE, ah_errno, ahhed::record, and record_info::type. Referenced by getdata(), mkdatspace(), putdata(), and tohead().

int tohead | ( | int | ,
|  | FILE * |
| ) | `[static]`

| Definition at line 607 of file ahputaway.c. References AE_RHED, ah_errno, gethead(), record_info::ndata, ahhed::record, and size(). Referenced by gogethead(), and gogetrecord().

int xdr_ahhead | ( | XDR * | ,
|  | ahhed * |
| ) | `[static]`

| Definition at line 1497 of file ahputaway.c. References station_info::A0, record_info::abstime, station_info::cal, station_info::chan, CHANSIZE, station_info::code, CODESIZE, COMSIZE, ah_time::day, record_info::delta, event_info::dep, station_info::DS, event_info::ecomment, station_info::elev, ahhed::event, ahhed::extra, ah_time::hr, complex::i, event_info::lat, record_info::log, LOGSIZE, event_info::lon, record_info::maxamp, ah_time::mn, ah_time::mo, record_info::ndata, NEXTRAS, NOCALPTS, event_info::ot, calib::pole, complex::r, record_info::rcomment, ahhed::record, record_info::rmin, ah_time::sec, station_info::slat, station_info::slon, ahhed::station, station_info::stype, STYPESIZE, record_info::type, ah_time::yr, and calib::zero. Referenced by xdr_gethead(), and xdr_puthead().

int xdr_getdata | ( | ahhed * | ,
|  | char * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1214 of file ahputaway.c. References AE_DTYPE, AE_RDATA, ah_errno, COMPLEX, DOUBLE, FLOAT, record_info::ndata, complex::r, ahhed::record, record_info::type, tensor::xx, and tensor::yy. Referenced by xdr_getrecord(), and xdr_getrecord2().

int xdr_gethead | ( | ahhed * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1063 of file ahputaway.c. References AE_DTYPE, AE_RHED, ah_errno, get_null_head(), ahhed::record, record_info::type, TYPEMAX, TYPEMIN, and xdr_ahhead(). Referenced by xdr_getrecord(), xdr_getrecord2(), xdr_gogethead(), and xdr_tohead().

int xdr_getrecord | ( | ahhed * | ,
|  | char * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1409 of file ahputaway.c. References AE_RRECORD, ah_errno, xdr_getdata(), and xdr_gethead(). Referenced by xdr_gogetrecord().

int xdr_getrecord2 | ( | ahhed * | ,
|  | char ** | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1432 of file ahputaway.c. References mkdatspace(), xdr_getdata(), and xdr_gethead().

int xdr_gogethead | ( | int | ,
|  | ahhed * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1466 of file ahputaway.c. References xdr_gethead(), and xdr_tohead().

int xdr_gogetrecord | ( | int | ,
|  | ahhed * | ,
|  | char * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1484 of file ahputaway.c. References xdr_getrecord(), and xdr_tohead().

int xdr_putdata | ( | ahhed * | ,
|  | char * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1299 of file ahputaway.c. References AE_DTYPE, AE_RDATA, ah_errno, COMPLEX, DOUBLE, FLOAT, record_info::ndata, complex::r, ahhed::record, record_info::type, tensor::xx, and tensor::yy. Referenced by xdr_putrecord().

int xdr_puthead | ( | ahhed * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1094 of file ahputaway.c. References AE_WHED, ah_errno, and xdr_ahhead(). Referenced by xdr_putrecord().

int xdr_putrecord | ( | ahhed * | ,
|  | char * | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1386 of file ahputaway.c. References AE_WRECORD, ah_errno, xdr_putdata(), and xdr_puthead(). Referenced by AHPA_next().

int xdr_tohead | ( | int | ,
|  | XDR * |
| ) | `[static]`

| Definition at line 1116 of file ahputaway.c. References AE_DTYPE, AE_RHED, ah_errno, COMPLEX, DOUBLE, FLOAT, complex::i, record_info::ndata, complex::r, ahhed::record, record_info::type, xdr_gethead(), tensor::xx, tensor::xy, and tensor::yy. Referenced by xdr_gogethead(), and xdr_gogetrecord().

## Variable Documentation

char* ah_errlist[]

| Initial value:
     {
      "no error",
      "read header error",
      "bad data type",
      "write header error",
      "read data error",
      "write data error",
      "write record error",
      "read record error",
      "tty can't get binary",
      "tty can't send binary"
    }
Definition at line 427 of file ahputaway.c.

int ah_errno = 0

| Definition at line 411 of file ahputaway.c. Referenced by ah_error(), getdata(), gethead(), getrecord(), in_is_tty(), maxamp(), out_is_tty(), putdata(), puthead(), putrecord(), size(), tohead(), xdr_getdata(), xdr_gethead(), xdr_getrecord(), xdr_putdata(), xdr_puthead(), xdr_putrecord(), and xdr_tohead().

int ah_nerr = 10

| Definition at line 412 of file ahputaway.c. Referenced by ah_error().

char AHDir[2*MAXTXT + 4]`[static]`

| Definition at line 76 of file ahputaway.c.

ahhed* AhHead`[static]`

| Definition at line 77 of file ahputaway.c. Referenced by AHPA_init(), and AHPA_next().

float* mydata`[static]`

| Definition at line 78 of file ahputaway.c. Referenced by AHPA_init(), and AHPA_next().