@@ -477,28 +477,45 @@ 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
+ #define HTS_PARSE_THOUSANDS_SEP 1
481
+ // ...other parser flags may follow...
482
+
480
483
/// Parse a numeric string
481
484
/** The number may be expressed in scientific notation, and may contain commas
482
485
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
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
492
When @a end 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 );
492
496
493
497
/// Parse a "CHR:START-END"-style region string
494
498
/** @param str String to be parsed
495
499
@param beg Set on return to the 0-based start of the region
496
500
@param end Set on return to the 1-based end of the region
497
501
@return Pointer to the colon or '\0' after the reference sequence name,
498
502
or NULL if @a str could not be parsed.
503
+ @note Equivalent to hts_parse_region(str, beg, end, NULL, HTS_PARSE_THOUSANDS_SEP)
499
504
*/
500
505
const char * hts_parse_reg (const char * str , int * beg , int * end );
501
506
507
+ /// Parse a "CHR:START-END"-style region string
508
+ /** @param str String to be parsed
509
+ @param beg Set on return to the 0-based start of the region
510
+ @param end Set on return to the 1-based end of the region
511
+ @param strend If non-NULL, set on return to point to the first character
512
+ in @a str after those forming the parsed region
513
+ @param flags Or'ed-together combination of HTS_PARSE_* flags
514
+ @return Pointer to the colon or '\0' after the reference sequence name,
515
+ or NULL if @a str could not be parsed.
516
+ */
517
+ const char * hts_parse_region (const char * str , int * beg , int * end , char * * strend , int flags );
518
+
502
519
hts_itr_t * hts_itr_query (const hts_idx_t * idx , int tid , int beg , int end , hts_readrec_func * readrec );
503
520
void hts_itr_destroy (hts_itr_t * iter );
504
521
0 commit comments