1 /* hts_internal.h -- internal functions; not part of the public API. 2 3 Copyright (C) 2015-2016 Genome Research Ltd. 4 5 Permission is hereby granted, free of charge, to any person obtaining a copy 6 of this software and associated documentation files (the "Software"), to deal 7 in the Software without restriction, including without limitation the rights 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 copies of the Software, and to permit persons to whom the Software is 10 furnished to do so, subject to the following conditions: 11 12 The above copyright notice and this permission notice shall be included in 13 all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 DEALINGS IN THE SOFTWARE. */ 22 23 #ifndef HTSLIB_HTS_INTERNAL_H 24 #define HTSLIB_HTS_INTERNAL_H 25 26 #include <stddef.h> 27 #include <ctype.h> 28 29 #include "htslib/hts.h" 30 31 #include "textutils_internal.h" 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 struct hFILE; 38 39 struct hts_json_token { 40 char type; ///< Token type 41 char *str; ///< Value as a C string (filled in for all token types) 42 // TODO Add other fields to fill in for particular data types, e.g. 43 // int inum; 44 // float fnum; 45 }; 46 47 struct cram_fd; 48 49 char *hts_idx_getfn(const char *fn, const char *ext); 50 51 // The CRAM implementation stores the loaded index within the cram_fd rather 52 // than separately as is done elsewhere in htslib. So if p is a pointer to 53 // an hts_idx_t with p->fmt == HTS_FMT_CRAI, then it actually points to an 54 // hts_cram_idx_t and should be cast accordingly. 55 typedef struct hts_cram_idx_t { 56 int fmt; 57 struct cram_fd *cram; 58 } hts_cram_idx_t; 59 60 61 // Entry point to hFILE_multipart backend. 62 struct hFILE *hopen_htsget_redirect(struct hFILE *hfile, const char *mode); 63 64 struct hts_path_itr { 65 kstring_t path, entry; 66 void *dirv; // DIR * privately 67 const char *pathdir, *prefix, *suffix; 68 size_t prefix_len, suffix_len, entry_dir_l; 69 }; 70 71 void hts_path_itr_setup(struct hts_path_itr *itr, const char *path, 72 const char *builtin_path, const char *prefix, size_t prefix_len, 73 const char *suffix, size_t suffix_len); 74 75 const char *hts_path_itr_next(struct hts_path_itr *itr); 76 77 void *load_plugin(void **pluginp, const char *filename, const char *symbol); 78 void *plugin_sym(void *plugin, const char *name, const char **errmsg); 79 void close_plugin(void *plugin); 80 81 #ifdef __cplusplus 82 } 83 #endif 84 85 #endif 86