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

# global_loc_rw.c File Reference

`#include <global_loc_rw.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <kom.h>`
`#include <earthworm.h>`

Go to the source code of this file.

## Defines
#define | GLOBAL_AMPLINE_VERSION (short)4
#define | GLOBAL_PHSLINE_VERSION (short)2
#define | GLOBAL_LOC_VERSION (short)3
## Functions
GLOBAL_MSG_STATUS | InitGlobalAmpLine (GLOBAL_AMPLINE_STRUCT *p_struct)
GLOBAL_MSG_STATUS | InitGlobalPhaseLine (GLOBAL_PHSLINE_STRUCT *p_struct)
GLOBAL_MSG_STATUS | InitGlobalLoc (GLOBAL_LOC_STRUCT *p_struct)
GLOBAL_MSG_STATUS | WriteAmpLineToBuffer (GLOBAL_AMPLINE_STRUCT *p_struct, char *p_buffer, unsigned int p_length)
GLOBAL_MSG_STATUS | WritePhaseLineToBuffer (GLOBAL_PHSLINE_STRUCT *p_struct, char *p_buffer, unsigned int p_length)
GLOBAL_MSG_STATUS | WriteLocToBuffer (GLOBAL_LOC_STRUCT *p_loc, char *p_buffer, unsigned int p_length)
GLOBAL_MSG_STATUS | StringToAmpLine (GLOBAL_AMPLINE_STRUCT *p_amp, char *p_string)
GLOBAL_MSG_STATUS | StringToPhaseLine (GLOBAL_PHSLINE_STRUCT *p_struct, char *p_string)
GLOBAL_MSG_STATUS | StringToLoc (GLOBAL_LOC_STRUCT *p_loc, char *p_string)
int | AddAmpLineToPhase (GLOBAL_PHSLINE_STRUCT *p_phase, GLOBAL_AMPLINE_STRUCT *p_amp)
int | AddPhaseLineToLoc (GLOBAL_LOC_STRUCT *p_loc, GLOBAL_PHSLINE_STRUCT *p_phase)
int | GetLocPhaseIndex (GLOBAL_LOC_STRUCT *p_loc, GLOBAL_PHSLINE_STRUCT *p_phase)
GLOBAL_MSG_STATUS | ClearAmpLines (GLOBAL_PHSLINE_STRUCT *p_phase)
GLOBAL_MSG_STATUS | ClearPhaseLines (GLOBAL_LOC_STRUCT *p_loc)

## Define Documentation

#define GLOBAL_AMPLINE_VERSION (short)4

| Definition at line 13 of file global_loc_rw.c. Referenced by AddAmpLineToPhase(), InitGlobalAmpLine(), StringToAmpLine(), and WriteAmpLineToBuffer().

#define GLOBAL_LOC_VERSION (short)3

| Definition at line 17 of file global_loc_rw.c. Referenced by AddPhaseLineToLoc(), ClearAmpLines(), ClearPhaseLines(), InitGlobalLoc(), StringToLoc(), and WriteLocToBuffer().

#define GLOBAL_PHSLINE_VERSION (short)2

| Definition at line 15 of file global_loc_rw.c. Referenced by AddAmpLineToPhase(), AddPhaseLineToLoc(), InitGlobalPhaseLine(), StringToPhaseLine(), and WritePhaseLineToBuffer().

## Function Documentation

int AddAmpLineToPhase | ( | GLOBAL_PHSLINE_STRUCT * | p_phase,
|  | GLOBAL_AMPLINE_STRUCT * | p_amp
| ) |

| Definition at line 939 of file global_loc_rw.c. References _GLOBAL_AMPLINE_STRUCT::adcounts, _GLOBAL_AMPLINE_STRUCT::amp_time, _GLOBAL_PHSLINE_STRUCT::amps, _GLOBAL_AMPLINE_STRUCT::amptype, _GLOBAL_AMPLINE_STRUCT::channel, GLOBAL_AMPLINE_VERSION, GLOBAL_MSG_BADAMPTYPE, GLOBAL_MSG_BADPARAM, GLOBAL_MSG_NULL, GLOBAL_MSG_VERSINVALID, GLOBAL_PHSLINE_VERSION, MSG_LOGO::instid, _GLOBAL_AMPLINE_STRUCT::location, _GLOBAL_AMPLINE_STRUCT::logo, MAX_AMPS_PER_GLOBALPHASE, MSG_LOGO::mod, _GLOBAL_AMPLINE_STRUCT::network, _GLOBAL_AMPLINE_STRUCT::period, _GLOBAL_AMPLINE_STRUCT::pick_sequence, _GLOBAL_AMPLINE_STRUCT::station, MSG_LOGO::type, _GLOBAL_PHSLINE_STRUCT::version, and _GLOBAL_AMPLINE_STRUCT::version. Referenced by AddPhaseLineToLoc(), and StringToLoc().

int AddPhaseLineToLoc | ( | GLOBAL_LOC_STRUCT * | p_loc,
|  | GLOBAL_PHSLINE_STRUCT * | p_phase
| ) |

| Definition at line 990 of file global_loc_rw.c. References AddAmpLineToPhase(), _GLOBAL_PHSLINE_STRUCT::amps, _GLOBAL_PHSLINE_STRUCT::channel, GLOBAL_LOC_MAXPHS, GLOBAL_LOC_VERSION, GLOBAL_MSG_BADPARAM, GLOBAL_MSG_MAXCHILDREN, GLOBAL_MSG_NULL, GLOBAL_MSG_VERSINVALID, GLOBAL_PHSLINE_VERSION, MSG_LOGO::instid, _GLOBAL_PHSLINE_STRUCT::location, _GLOBAL_PHSLINE_STRUCT::logo, _GLOBAL_AMPLINE_STRUCT::logo, MAX_AMPS_PER_GLOBALPHASE, MSG_LOGO::mod, _GLOBAL_PHSLINE_STRUCT::network, GLOBAL_LOC_DATA::nphs, _GLOBAL_PHSLINE_STRUCT::phase_name, GLOBAL_LOC_DATA::phases, _GLOBAL_PHSLINE_STRUCT::pick_time, _GLOBAL_PHSLINE_STRUCT::polarity, _GLOBAL_PHSLINE_STRUCT::quality, _GLOBAL_PHSLINE_STRUCT::sequence, _GLOBAL_PHSLINE_STRUCT::station, MSG_LOGO::type, GLOBAL_LOC_DATA::version, and _GLOBAL_PHSLINE_STRUCT::version.

GLOBAL_MSG_STATUS ClearAmpLines | ( | GLOBAL_PHSLINE_STRUCT * | p_phase | ) |

| Definition at line 1085 of file global_loc_rw.c. References _GLOBAL_PHSLINE_STRUCT::amps, GLOBAL_LOC_VERSION, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_VERSINVALID, InitGlobalAmpLine(), MAX_AMPS_PER_GLOBALPHASE, and _GLOBAL_PHSLINE_STRUCT::version.

GLOBAL_MSG_STATUS ClearPhaseLines | ( | GLOBAL_LOC_STRUCT * | p_loc | ) |

| Definition at line 1106 of file global_loc_rw.c. References GLOBAL_LOC_VERSION, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_VERSINVALID, GLOBAL_LOC_DATA::nphs, and GLOBAL_LOC_DATA::version.

int GetLocPhaseIndex | ( | GLOBAL_LOC_STRUCT * | p_loc,
|  | GLOBAL_PHSLINE_STRUCT * | p_phase
| ) |

| Definition at line 1057 of file global_loc_rw.c. References MSG_LOGO::instid, _GLOBAL_PHSLINE_STRUCT::logo, MSG_LOGO::mod, GLOBAL_LOC_DATA::nphs, GLOBAL_LOC_DATA::phases, and _GLOBAL_PHSLINE_STRUCT::sequence.

GLOBAL_MSG_STATUS InitGlobalAmpLine | ( | GLOBAL_AMPLINE_STRUCT * | p_struct | ) |

| Definition at line 31 of file global_loc_rw.c. References _GLOBAL_AMPLINE_STRUCT::adcounts, _GLOBAL_AMPLINE_STRUCT::amp_time, _GLOBAL_AMPLINE_STRUCT::amptype, AMPTYPE_NONE, _GLOBAL_AMPLINE_STRUCT::channel, GLOBAL_AMPLINE_VERSION, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, MSG_LOGO::instid, _GLOBAL_AMPLINE_STRUCT::location, _GLOBAL_AMPLINE_STRUCT::logo, MSG_LOGO::mod, _GLOBAL_AMPLINE_STRUCT::network, _GLOBAL_AMPLINE_STRUCT::period, _GLOBAL_AMPLINE_STRUCT::pick_sequence, _GLOBAL_AMPLINE_STRUCT::station, MSG_LOGO::type, and _GLOBAL_AMPLINE_STRUCT::version. Referenced by ClearAmpLines(), InitGlobalPhaseLine(), and StringToAmpLine().

GLOBAL_MSG_STATUS InitGlobalLoc | ( | GLOBAL_LOC_STRUCT * | p_struct | ) |

| Definition at line 89 of file global_loc_rw.c. References GLOBAL_LOC_DATA::depth, GLOBAL_LOC_DATA::dmin, GLOBAL_LOC_DATA::event_id, GLOBAL_LOC_DATA::gap, GLOBAL_LOC_MAXPHS, GLOBAL_LOC_VERSION, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, InitGlobalPhaseLine(), MSG_LOGO::instid, GLOBAL_LOC_DATA::lat, GLOBAL_LOC_DATA::logo, GLOBAL_LOC_DATA::lon, MSG_LOGO::mod, GLOBAL_LOC_DATA::nphs, GLOBAL_LOC_DATA::origin_id, GLOBAL_LOC_DATA::origin_time, GLOBAL_LOC_DATA::phases, GLOBAL_LOC_DATA::pick_count, GLOBAL_LOC_DATA::rms, MSG_LOGO::type, and GLOBAL_LOC_DATA::version. Referenced by StringToLoc().

GLOBAL_MSG_STATUS InitGlobalPhaseLine | ( | GLOBAL_PHSLINE_STRUCT * | p_struct | ) |

| Definition at line 57 of file global_loc_rw.c. References _GLOBAL_PHSLINE_STRUCT::amps, _GLOBAL_PHSLINE_STRUCT::channel, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_PHSLINE_VERSION, InitGlobalAmpLine(), MSG_LOGO::instid, _GLOBAL_PHSLINE_STRUCT::location, _GLOBAL_PHSLINE_STRUCT::logo, MAX_AMPS_PER_GLOBALPHASE, MSG_LOGO::mod, _GLOBAL_PHSLINE_STRUCT::network, _GLOBAL_PHSLINE_STRUCT::phase_name, _GLOBAL_PHSLINE_STRUCT::pick_time, _GLOBAL_PHSLINE_STRUCT::polarity, _GLOBAL_PHSLINE_STRUCT::quality, _GLOBAL_PHSLINE_STRUCT::sequence, _GLOBAL_PHSLINE_STRUCT::station, MSG_LOGO::type, and _GLOBAL_PHSLINE_STRUCT::version. Referenced by InitGlobalLoc(), and StringToPhaseLine().

GLOBAL_MSG_STATUS StringToAmpLine | ( | GLOBAL_AMPLINE_STRUCT * | p_amp,
|  | char * | p_string
| ) |

| Definition at line 345 of file global_loc_rw.c. References _GLOBAL_AMPLINE_STRUCT::adcounts, _GLOBAL_AMPLINE_STRUCT::amp_time, _GLOBAL_AMPLINE_STRUCT::amptype, _GLOBAL_AMPLINE_STRUCT::channel, DecodeAuthor(), GLOBAL_AMPLINE_BUFFER, GLOBAL_AMPLINE_MAXBUFSIZE, GLOBAL_AMPLINE_VERSION, GLOBAL_MSG_BADPARAM, GLOBAL_MSG_FORMATERROR, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_VERSINVALID, InitGlobalAmpLine(), k_err(), k_long(), k_put(), k_str(), k_val(), _GLOBAL_AMPLINE_STRUCT::location, logit(), _GLOBAL_AMPLINE_STRUCT::logo, _GLOBAL_AMPLINE_STRUCT::network, _GLOBAL_AMPLINE_STRUCT::period, _GLOBAL_AMPLINE_STRUCT::pick_sequence, _GLOBAL_AMPLINE_STRUCT::station, and _GLOBAL_AMPLINE_STRUCT::version. Referenced by StringToLoc().

GLOBAL_MSG_STATUS StringToLoc | ( | GLOBAL_LOC_STRUCT * | p_loc,
|  | char * | p_string
| ) |

| Definition at line 622 of file global_loc_rw.c. References AddAmpLineToPhase(), DecodeAuthor(), GLOBAL_LOC_DATA::depth, GLOBAL_LOC_DATA::dmin, GLOBAL_LOC_DATA::event_id, GLOBAL_LOC_DATA::gap, GLOBAL_LOC_MAXPHS, GLOBAL_LOC_SUM_BUFFER, GLOBAL_LOC_VERSION, GLOBAL_MSG_BADCHILD, GLOBAL_MSG_FORMATERROR, GLOBAL_MSG_MAXCHILDREN, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_VERSINVALID, InitGlobalLoc(), k_err(), k_long(), k_put(), k_str(), k_val(), GLOBAL_LOC_DATA::lat, logit(), GLOBAL_LOC_DATA::logo, GLOBAL_LOC_DATA::lon, GLOBAL_LOC_DATA::nphs, GLOBAL_LOC_DATA::origin_id, GLOBAL_LOC_DATA::origin_time, GLOBAL_LOC_DATA::phases, GLOBAL_LOC_DATA::pick_count, GLOBAL_LOC_DATA::rms, StringToAmpLine(), StringToPhaseLine(), and GLOBAL_LOC_DATA::version.

GLOBAL_MSG_STATUS StringToPhaseLine | ( | GLOBAL_PHSLINE_STRUCT * | p_struct,
|  | char * | p_string
| ) |

| Definition at line 482 of file global_loc_rw.c. References _GLOBAL_PHSLINE_STRUCT::channel, DecodeAuthor(), GLOBAL_MSG_BADPARAM, GLOBAL_MSG_FORMATERROR, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_VERSINVALID, GLOBAL_PHSLINE_SUM_BUFFER, GLOBAL_PHSLINE_SUM_MAXSIZE, GLOBAL_PHSLINE_VERSION, InitGlobalPhaseLine(), k_err(), k_long(), k_put(), k_str(), k_val(), _GLOBAL_PHSLINE_STRUCT::location, logit(), _GLOBAL_PHSLINE_STRUCT::logo, _GLOBAL_PHSLINE_STRUCT::network, _GLOBAL_PHSLINE_STRUCT::phase_name, _GLOBAL_PHSLINE_STRUCT::pick_time, _GLOBAL_PHSLINE_STRUCT::polarity, _GLOBAL_PHSLINE_STRUCT::quality, _GLOBAL_PHSLINE_STRUCT::sequence, _GLOBAL_PHSLINE_STRUCT::station, and _GLOBAL_PHSLINE_STRUCT::version. Referenced by StringToLoc().

GLOBAL_MSG_STATUS WriteAmpLineToBuffer | ( | GLOBAL_AMPLINE_STRUCT * | p_struct,
|  | char * | p_buffer,
|  | unsigned int | p_length
| ) |

| Definition at line 128 of file global_loc_rw.c. References _GLOBAL_AMPLINE_STRUCT::adcounts, _GLOBAL_AMPLINE_STRUCT::amp_time, _GLOBAL_AMPLINE_STRUCT::amptype, _GLOBAL_AMPLINE_STRUCT::channel, EncodeAuthor(), GLOBAL_AMPLINE_MAXBUFSIZE, GLOBAL_AMPLINE_VERSION, GLOBAL_MSG_BADPARAM, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_TOOSMALL, GLOBAL_MSG_VERSINVALID, _GLOBAL_AMPLINE_STRUCT::location, _GLOBAL_AMPLINE_STRUCT::logo, _GLOBAL_AMPLINE_STRUCT::network, _GLOBAL_AMPLINE_STRUCT::period, _GLOBAL_AMPLINE_STRUCT::pick_sequence, _GLOBAL_AMPLINE_STRUCT::station, and _GLOBAL_AMPLINE_STRUCT::version. Referenced by WriteLocToBuffer().

GLOBAL_MSG_STATUS WriteLocToBuffer | ( | GLOBAL_LOC_STRUCT * | p_loc,
|  | char * | p_buffer,
|  | unsigned int | p_length
| ) |

| Definition at line 226 of file global_loc_rw.c. References _GLOBAL_PHSLINE_STRUCT::amps, GLOBAL_LOC_DATA::depth, GLOBAL_LOC_DATA::dmin, EncodeAuthor(), GLOBAL_LOC_DATA::event_id, GLOBAL_LOC_DATA::gap, GLOBAL_AMPLINE_BUFFER, GLOBAL_LOC_MAXBUFSIZE, GLOBAL_LOC_SUM_MAXSIZE, GLOBAL_LOC_VERSION, GLOBAL_MSG_BADPARAM, GLOBAL_MSG_DEFINESMALL, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_TOOSMALL, GLOBAL_MSG_VERSINVALID, GLOBAL_PHSLINE_BUFFER, GLOBAL_PHSLINE_MAXBUFSIZE, GLOBAL_LOC_DATA::lat, GLOBAL_LOC_DATA::logo, _GLOBAL_AMPLINE_STRUCT::logo, GLOBAL_LOC_DATA::lon, MAX_AMPS_PER_GLOBALPHASE, GLOBAL_LOC_DATA::nphs, GLOBAL_LOC_DATA::origin_id, GLOBAL_LOC_DATA::origin_time, GLOBAL_LOC_DATA::phases, GLOBAL_LOC_DATA::pick_count, GLOBAL_LOC_DATA::rms, MSG_LOGO::type, GLOBAL_LOC_DATA::version, WriteAmpLineToBuffer(), and WritePhaseLineToBuffer().

GLOBAL_MSG_STATUS WritePhaseLineToBuffer | ( | GLOBAL_PHSLINE_STRUCT * | p_struct,
|  | char * | p_buffer,
|  | unsigned int | p_length
| ) |

| Definition at line 177 of file global_loc_rw.c. References _GLOBAL_PHSLINE_STRUCT::channel, EncodeAuthor(), GLOBAL_MSG_BADPARAM, GLOBAL_MSG_NULL, GLOBAL_MSG_STATUS, GLOBAL_MSG_SUCCESS, GLOBAL_MSG_TOOSMALL, GLOBAL_MSG_VERSINVALID, GLOBAL_PHSLINE_MAXBUFSIZE, GLOBAL_PHSLINE_VERSION, _GLOBAL_PHSLINE_STRUCT::location, _GLOBAL_PHSLINE_STRUCT::logo, _GLOBAL_PHSLINE_STRUCT::network, _GLOBAL_PHSLINE_STRUCT::phase_name, _GLOBAL_PHSLINE_STRUCT::pick_time, _GLOBAL_PHSLINE_STRUCT::polarity, _GLOBAL_PHSLINE_STRUCT::quality, _GLOBAL_PHSLINE_STRUCT::sequence, _GLOBAL_PHSLINE_STRUCT::station, and _GLOBAL_PHSLINE_STRUCT::version. Referenced by WriteLocToBuffer().