@@ -477,27 +477,40 @@ hts_idx_t *hts_idx_load2(const char *fn, const char *fnidx);
477
477
int hts_idx_get_stat (const hts_idx_t * idx , int tid , uint64_t * mapped , uint64_t * unmapped );
478
478
uint64_t hts_idx_get_n_no_coor (const hts_idx_t * idx );
479
479
480
+
481
+ #define HTS_PARSE_THOUSANDS_SEP 1 ///< Ignore ',' separators within numbers
482
+
480
483
/// Parse a numeric string
481
- /** The number may be expressed in scientific notation, and may contain commas
482
- in the integer part (before any decimal point or E notation).
483
- @param str String to be parsed
484
- @param end If non-NULL, set on return to point to the first character
485
- in @a str after those forming the parsed number
484
+ /** The number may be expressed in scientific notation, and optionally may
485
+ contain commas in the integer part (before any decimal point or E notation).
486
+ @param str String to be parsed
487
+ @param strend If non-NULL, set on return to point to the first character
488
+ in @a str after those forming the parsed number
489
+ @param flags Or'ed-together combination of HTS_PARSE_* flags
486
490
@return Converted value of the parsed number.
487
491
488
- When @a end is NULL, a warning will be printed (if hts_verbose is 2
492
+ When @a strend is NULL, a warning will be printed (if hts_verbose is 2
489
493
or more) if there are any trailing characters after the number.
490
494
*/
491
- long long hts_parse_decimal (const char * str , char * * end );
495
+ long long hts_parse_decimal (const char * str , char * * strend , int flags );
496
+
497
+ /// Equivalent to hts_parse_region(str, NULL, beg, end, HTS_PARSE_THOUSANDS_SEP)
498
+ const char * hts_parse_reg (const char * str , int * beg , int * end );
492
499
493
500
/// Parse a "CHR:START-END"-style region string
494
- /** @param str String to be parsed
495
- @param beg Set on return to the 0-based start of the region
496
- @param end Set on return to the 1-based end of the region
497
- @return Pointer to the colon or '\0' after the reference sequence name,
498
- or NULL if @a str could not be parsed.
501
+ /** @param str String to be parsed
502
+ @param strend If non-NULL, set on return to point to the first character
503
+ in @a str after those forming the parsed region
504
+ @param beg Set on return to the 0-based start of the region
505
+ @param end Set on return to the 1-based end of the region
506
+ @param flags Or'ed-together combination of HTS_PARSE_* flags
507
+ @return Pointer to the colon or terminating character after the reference
508
+ sequence name, or NULL if @a str could not be parsed.
509
+
510
+ When @a strend is NULL, a warning will be printed (if hts_verbose is 2
511
+ or more) if there are any trailing characters after the region string.
499
512
*/
500
- const char * hts_parse_reg (const char * str , int * beg , int * end );
513
+ const char * hts_parse_region (const char * str , char * * strend , int * beg , int * end , int flags );
501
514
502
515
hts_itr_t * hts_itr_query (const hts_idx_t * idx , int tid , int beg , int end , hts_readrec_func * readrec );
503
516
void hts_itr_destroy (hts_itr_t * iter );
0 commit comments