Created
December 5, 2012 21:51
-
-
Save krischer/4219818 to your computer and use it in GitHub Desktop.
Cython header file for libmseed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdef extern from "i386/types.h" nogil: | |
ctypedef long long int64_t | |
ctypedef signed char int8_t | |
ctypedef short int16_t | |
ctypedef int int32_t | |
cdef extern from "stdint.h" nogil: | |
ctypedef unsigned short uint16_t | |
ctypedef unsigned char uint8_t | |
ctypedef unsigned int uint32_t | |
cdef extern from "stdio.h" nogil: | |
ctypedef long long off_t | |
cdef struct __sFILE: | |
pass | |
ctypedef __sFILE FILE | |
cdef extern from "libmseed.h" nogil: | |
enum: LIBMSEED_H | |
enum: LMPLATFORM_H | |
enum: LMP_PACKED | |
enum: LMP_BSD | |
enum: LIBMSEED_VERSION | |
enum: LIBMSEED_RELEASE | |
enum: MINRECLEN | |
enum: MAXRECLEN | |
enum: DE_ASCII | |
enum: DE_INT16 | |
enum: DE_INT32 | |
enum: DE_FLOAT32 | |
enum: DE_FLOAT64 | |
enum: DE_STEIM1 | |
enum: DE_STEIM2 | |
enum: DE_GEOSCOPE24 | |
enum: DE_GEOSCOPE163 | |
enum: DE_GEOSCOPE164 | |
enum: DE_CDSN | |
enum: DE_SRO | |
enum: DE_DWWSSN | |
enum: MS_ENDOFFILE | |
enum: MS_NOERROR | |
enum: MS_GENERROR | |
enum: MS_NOTSEED | |
enum: MS_WRONGLENGTH | |
enum: MS_OUTOFRANGE | |
enum: MS_UNKNOWNFORMAT | |
enum: MS_STBADCOMPFLAG | |
enum: HPTMODULUS | |
enum: HPTERROR | |
enum: MAX_LOG_MSG_LENGTH | |
off_t lmp_ftello(FILE *stream) | |
int lmp_fseeko(FILE *stream, off_t offset, int whence) | |
ctypedef int64_t hptime_t | |
ctypedef int8_t flag | |
cdef struct btime_s: | |
uint16_t year | |
uint16_t day | |
uint8_t hour | |
uint8_t min | |
uint8_t sec | |
uint8_t unused | |
uint16_t fract | |
ctypedef btime_s BTime | |
cdef struct fsdh_s: | |
char sequence_number[6] | |
char dataquality | |
char reserved | |
char station[5] | |
char location[2] | |
char channel[3] | |
char network[2] | |
BTime start_time | |
uint16_t numsamples | |
int16_t samprate_fact | |
int16_t samprate_mult | |
uint8_t act_flags | |
uint8_t io_flags | |
uint8_t dq_flags | |
uint8_t numblockettes | |
int32_t time_correct | |
uint16_t data_offset | |
uint16_t blockette_offset | |
cdef struct blkt_100_s: | |
float samprate | |
int8_t flags | |
uint8_t reserved[3] | |
cdef struct blkt_200_s: | |
float amplitude | |
float period | |
float background_estimate | |
uint8_t flags | |
uint8_t reserved | |
BTime time | |
char detector[24] | |
cdef struct blkt_201_s: | |
float amplitude | |
float period | |
float background_estimate | |
uint8_t flags | |
uint8_t reserved | |
BTime time | |
uint8_t snr_values[6] | |
uint8_t loopback | |
uint8_t pick_algorithm | |
char detector[24] | |
cdef struct blkt_300_s: | |
BTime time | |
uint8_t numcalibrations | |
uint8_t flags | |
uint32_t step_duration | |
uint32_t interval_duration | |
float amplitude | |
char input_channel[3] | |
uint8_t reserved | |
uint32_t reference_amplitude | |
char coupling[12] | |
char rolloff[12] | |
cdef struct blkt_310_s: | |
BTime time | |
uint8_t reserved1 | |
uint8_t flags | |
uint32_t duration | |
float period | |
float amplitude | |
char input_channel[3] | |
uint8_t reserved2 | |
uint32_t reference_amplitude | |
char coupling[12] | |
char rolloff[12] | |
cdef struct blkt_320_s: | |
BTime time | |
uint8_t reserved1 | |
uint8_t flags | |
uint32_t duration | |
float ptp_amplitude | |
char input_channel[3] | |
uint8_t reserved2 | |
uint32_t reference_amplitude | |
char coupling[12] | |
char rolloff[12] | |
char noise_type[8] | |
cdef struct blkt_390_s: | |
BTime time | |
uint8_t reserved1 | |
uint8_t flags | |
uint32_t duration | |
float amplitude | |
char input_channel[3] | |
uint8_t reserved2 | |
cdef struct blkt_395_s: | |
BTime time | |
uint8_t reserved[2] | |
cdef struct blkt_400_s: | |
float azimuth | |
float slowness | |
uint16_t configuration | |
uint8_t reserved[2] | |
cdef struct blkt_405_s: | |
uint16_t delay_values[1] | |
cdef struct blkt_500_s: | |
float vco_correction | |
BTime time | |
int8_t usec | |
uint8_t reception_qual | |
uint32_t exception_count | |
char exception_type[16] | |
char clock_model[32] | |
char clock_status[128] | |
cdef struct blkt_1000_s: | |
uint8_t encoding | |
uint8_t byteorder | |
uint8_t reclen | |
uint8_t reserved | |
cdef struct blkt_1001_s: | |
uint8_t timing_qual | |
int8_t usec | |
uint8_t reserved | |
uint8_t framecnt | |
cdef struct blkt_2000_s: | |
uint16_t length | |
uint16_t data_offset | |
uint32_t recnum | |
uint8_t byteorder | |
uint8_t flags | |
uint8_t numheaders | |
char payload[1] | |
cdef struct blkt_link_s: | |
uint16_t blktoffset | |
uint16_t blkt_type | |
uint16_t next_blkt | |
void *blktdata | |
uint16_t blktdatalen | |
blkt_link_s *next | |
ctypedef blkt_link_s BlktLink | |
cdef struct StreamState_s: | |
int64_t packedrecords | |
int64_t packedsamples | |
int32_t lastintsample | |
flag comphistory | |
ctypedef StreamState_s StreamState | |
cdef struct MSRecord_s: | |
char *record | |
int32_t reclen | |
fsdh_s *fsdh | |
BlktLink *blkts | |
blkt_100_s *Blkt100 | |
blkt_1000_s *Blkt1000 | |
blkt_1001_s *Blkt1001 | |
int32_t sequence_number | |
char network[11] | |
char station[11] | |
char location[11] | |
char channel[11] | |
char dataquality | |
hptime_t starttime | |
double samprate | |
int64_t samplecnt | |
int8_t encoding | |
int8_t byteorder | |
void *datasamples | |
int64_t numsamples | |
char sampletype | |
StreamState *ststate | |
ctypedef MSRecord_s MSRecord | |
cdef struct MSTrace_s: | |
char network[11] | |
char station[11] | |
char location[11] | |
char channel[11] | |
char dataquality | |
char type | |
hptime_t starttime | |
hptime_t endtime | |
double samprate | |
int64_t samplecnt | |
void *datasamples | |
int64_t numsamples | |
char sampletype | |
void *prvtptr | |
StreamState *ststate | |
MSTrace_s *next | |
ctypedef MSTrace_s MSTrace | |
cdef struct MSTraceGroup_s: | |
int32_t numtraces | |
MSTrace_s *traces | |
ctypedef MSTraceGroup_s MSTraceGroup | |
cdef struct MSTraceSeg_s: | |
hptime_t starttime | |
hptime_t endtime | |
double samprate | |
int64_t samplecnt | |
void *datasamples | |
int64_t numsamples | |
char sampletype | |
void *prvtptr | |
MSTraceSeg_s *prev | |
MSTraceSeg_s *next | |
ctypedef MSTraceSeg_s MSTraceSeg | |
cdef struct MSTraceID_s: | |
char network[11] | |
char station[11] | |
char location[11] | |
char channel[11] | |
char dataquality | |
char srcname[45] | |
char type | |
hptime_t earliest | |
hptime_t latest | |
void *prvtptr | |
int32_t numsegments | |
MSTraceSeg_s *first | |
MSTraceSeg_s *last | |
MSTraceID_s *next | |
ctypedef MSTraceID_s MSTraceID | |
cdef struct MSTraceList_s: | |
int32_t numtraces | |
MSTraceID_s *traces | |
MSTraceID_s *last | |
ctypedef MSTraceList_s MSTraceList | |
cdef struct SelectTime_s: | |
hptime_t starttime | |
hptime_t endtime | |
SelectTime_s *next | |
ctypedef SelectTime_s SelectTime | |
cdef struct Selections_s: | |
char srcname[100] | |
SelectTime_s *timewindows | |
Selections_s *next | |
ctypedef Selections_s Selections | |
int msr_parse(char *record, int recbuflen, MSRecord ** ppmsr, int reclen, flag dataflag, flag verbose) | |
int msr_unpack(char *record, int reclen, MSRecord ** ppmsr, flag dataflag, flag verbose) | |
int msr_pack(MSRecord *msr, void (*record_handler)(char*, int, void*), void *handlerdata, int64_t *packedsamples, flag flush, flag verbose) | |
int msr_pack_header(MSRecord *msr, flag normalize, flag verbose) | |
MSRecord* msr_init(MSRecord *msr) | |
void msr_free(MSRecord ** ppmsr) | |
void msr_free_blktchain(MSRecord *msr) | |
BlktLink* msr_addblockette(MSRecord *msr, char *blktdata, int length, int blkttype, int chainpos) | |
int msr_normalize_header(MSRecord *msr, flag verbose) | |
MSRecord* msr_duplicate(MSRecord *msr, flag datadup) | |
double msr_samprate(MSRecord *msr) | |
double msr_nomsamprate(MSRecord *msr) | |
hptime_t msr_starttime(MSRecord *msr) | |
hptime_t msr_starttime_uc(MSRecord *msr) | |
hptime_t msr_endtime(MSRecord *msr) | |
char* msr_srcname(MSRecord *msr, char *srcname, flag quality) | |
void msr_print(MSRecord *msr, flag details) | |
double msr_host_latency(MSRecord *msr) | |
int ms_detect(char *record, int recbuflen) | |
int ms_parse_raw(char *record, int maxreclen, flag details, flag swapflag) | |
MSTrace* mst_init(MSTrace *mst) | |
void mst_free(MSTrace ** ppmst) | |
MSTraceGroup* mst_initgroup(MSTraceGroup *mstg) | |
void mst_freegroup(MSTraceGroup ** ppmstg) | |
MSTrace* mst_findmatch(MSTrace *startmst, char dataquality, char *network, char *station, char *location, char *channel) | |
MSTrace* mst_findadjacent(MSTraceGroup *mstg, flag *whence, char dataquality, char *network, char *station, char *location, char *channel, double samprate, double sampratetol, hptime_t starttime, hptime_t endtime, double timetol) | |
int mst_addmsr(MSTrace *mst, MSRecord *msr, flag whence) | |
int mst_addspan(MSTrace *mst, hptime_t starttime, hptime_t endtime, void *datasamples, int64_t numsamples, char sampletype, flag whence) | |
MSTrace* mst_addmsrtogroup(MSTraceGroup *mstg, MSRecord *msr, flag dataquality, double timetol, double sampratetol) | |
MSTrace* mst_addtracetogroup(MSTraceGroup *mstg, MSTrace *mst) | |
int mst_groupheal(MSTraceGroup *mstg, double timetol, double sampratetol) | |
int mst_groupsort(MSTraceGroup *mstg, flag quality) | |
char* mst_srcname(MSTrace *mst, char *srcname, flag quality) | |
void mst_printtracelist(MSTraceGroup *mstg, flag timeformat, flag details, flag gaps) | |
void mst_printsynclist(MSTraceGroup *mstg, char *dccid, flag subsecond) | |
void mst_printgaplist(MSTraceGroup *mstg, flag timeformat, double *mingap, double *maxgap) | |
int mst_pack(MSTrace *mst, void (*record_handler)(char*, int, void*), void *handlerdata, int reclen, flag encoding, flag byteorder, int64_t *packedsamples, flag flush, flag verbose, MSRecord *mstemplate) | |
int mst_packgroup(MSTraceGroup *mstg, void (*record_handler)(char*, int, void*), void *handlerdata, int reclen, flag encoding, flag byteorder, int64_t *packedsamples, flag flush, flag verbose, MSRecord *mstemplate) | |
MSTraceList* mstl_init(MSTraceList *mstl) | |
void mstl_free(MSTraceList ** ppmstl, flag freeprvtptr) | |
MSTraceSeg* mstl_addmsr(MSTraceList *mstl, MSRecord *msr, flag dataquality, flag autoheal, double timetol, double sampratetol) | |
void mstl_printtracelist(MSTraceList *mstl, flag timeformat, flag details, flag gaps) | |
void mstl_printsynclist(MSTraceList *mstl, char *dccid, flag subsecond) | |
void mstl_printgaplist(MSTraceList *mstl, flag timeformat, double *mingap, double *maxgap) | |
cdef struct MSFileParam_s: | |
FILE *fp | |
char filename[512] | |
char *rawrec | |
int readlen | |
int readoffset | |
int packtype | |
off_t packhdroffset | |
off_t filepos | |
off_t filesize | |
int recordcount | |
ctypedef MSFileParam_s MSFileParam | |
int ms_readmsr(MSRecord ** ppmsr, char *msfile, int reclen, off_t *fpos, int *last, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readmsr_r(MSFileParam ** ppmsfp, MSRecord ** ppmsr, char *msfile, int reclen, off_t *fpos, int *last, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readmsr_main(MSFileParam ** ppmsfp, MSRecord ** ppmsr, char *msfile, int reclen, off_t *fpos, int *last, flag skipnotdata, flag dataflag, Selections *selections, flag verbose) | |
int ms_readtraces(MSTraceGroup ** ppmstg, char *msfile, int reclen, double timetol, double sampratetol, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readtraces_timewin(MSTraceGroup ** ppmstg, char *msfile, int reclen, double timetol, double sampratetol, hptime_t starttime, hptime_t endtime, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readtraces_selection(MSTraceGroup ** ppmstg, char *msfile, int reclen, double timetol, double sampratetol, Selections *selections, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readtracelist(MSTraceList ** ppmstl, char *msfile, int reclen, double timetol, double sampratetol, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readtracelist_timewin(MSTraceList ** ppmstl, char *msfile, int reclen, double timetol, double sampratetol, hptime_t starttime, hptime_t endtime, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int ms_readtracelist_selection(MSTraceList ** ppmstl, char *msfile, int reclen, double timetol, double sampratetol, Selections *selections, flag dataquality, flag skipnotdata, flag dataflag, flag verbose) | |
int msr_writemseed(MSRecord *msr, char *msfile, flag overwrite, int reclen, flag encoding, flag byteorder, flag verbose) | |
int mst_writemseed(MSTrace *mst, char *msfile, flag overwrite, int reclen, flag encoding, flag byteorder, flag verbose) | |
int mst_writemseedgroup(MSTraceGroup *mstg, char *msfile, flag overwrite, int reclen, flag encoding, flag byteorder, flag verbose) | |
char* ms_recsrcname(char *record, char *srcname, flag quality) | |
int ms_splitsrcname(char *srcname, char *net, char *sta, char *loc, char *chan, char *qual) | |
int ms_strncpclean(char *dest, char *source, int length) | |
int ms_strncpcleantail(char *dest, char *source, int length) | |
int ms_strncpopen(char *dest, char *source, int length) | |
int ms_doy2md(int year, int jday, int *month, int *mday) | |
int ms_md2doy(int year, int month, int mday, int *jday) | |
hptime_t ms_btime2hptime(BTime *btime) | |
char* ms_btime2isotimestr(BTime *btime, char *isotimestr) | |
char* ms_btime2mdtimestr(BTime *btime, char *mdtimestr) | |
char* ms_btime2seedtimestr(BTime *btime, char *seedtimestr) | |
int ms_hptime2btime(hptime_t hptime, BTime *btime) | |
char* ms_hptime2isotimestr(hptime_t hptime, char *isotimestr, flag subsecond) | |
char* ms_hptime2mdtimestr(hptime_t hptime, char *mdtimestr, flag subsecond) | |
char* ms_hptime2seedtimestr(hptime_t hptime, char *seedtimestr, flag subsecond) | |
hptime_t ms_time2hptime(int year, int day, int hour, int min, int sec, int usec) | |
hptime_t ms_seedtimestr2hptime(char *seedtimestr) | |
hptime_t ms_timestr2hptime(char *timestr) | |
double ms_nomsamprate(int factor, int multiplier) | |
int ms_genfactmult(double samprate, int16_t *factor, int16_t *multiplier) | |
int ms_ratapprox(double real, int *num, int *den, int maxval, double precision) | |
int ms_bigendianhost() | |
double ms_dabs(double val) | |
uint8_t ms_samplesize(char sampletype) | |
char* ms_encodingstr(char encoding) | |
char* ms_blktdesc(uint16_t blkttype) | |
uint16_t ms_blktlen(uint16_t blkttype, char *blktdata, flag swapflag) | |
char* ms_errorstr(int errorcode) | |
cdef struct MSLogParam_s: | |
void (*log_print)() | |
char *logprefix | |
void (*diag_print)() | |
char *errprefix | |
ctypedef MSLogParam_s MSLogParam | |
int ms_log(int level) | |
int ms_log_l(MSLogParam *logp, int level) | |
void ms_loginit(void (*log_print)(char*), char *logprefix, void (*diag_print)(char*), char *errprefix) | |
MSLogParam* ms_loginit_l(MSLogParam *logp, void (*log_print)(char*), char *logprefix, void (*diag_print)(char*), char *errprefix) | |
Selections* ms_matchselect(Selections *selections, char *srcname, hptime_t starttime, hptime_t endtime, SelectTime ** ppselecttime) | |
Selections* msr_matchselect(Selections *selections, MSRecord *msr, SelectTime ** ppselecttime) | |
int ms_addselect(Selections ** ppselections, char *srcname, hptime_t starttime, hptime_t endtime) | |
int ms_addselect_comp(Selections ** ppselections, char *net, char *sta, char *loc, char *chan, char *qual, hptime_t starttime, hptime_t endtime) | |
int ms_readselectionsfile(Selections ** ppselections, char *filename) | |
void ms_freeselections(Selections *selections) | |
void ms_printselections(Selections *selections) | |
void ms_gswap2(void *data2) | |
void ms_gswap3(void *data3) | |
void ms_gswap4(void *data4) | |
void ms_gswap8(void *data8) | |
void ms_gswap2a(void *data2) | |
void ms_gswap4a(void *data4) | |
void ms_gswap8a(void *data8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good work!