@@ -477,27 +477,40 @@ hts_idx_t *hts_idx_load2(const char *fn, const char *fnidx);
477477    int  hts_idx_get_stat (const  hts_idx_t *  idx , int  tid , uint64_t *  mapped , uint64_t *  unmapped );
478478    uint64_t  hts_idx_get_n_no_coor (const  hts_idx_t *  idx );
479479
480+ 
481+ #define  HTS_PARSE_THOUSANDS_SEP  1  ///< Ignore ',' separators within numbers
482+ 
480483/// 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 
486490    @return  Converted value of the parsed number. 
487491
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 
489493    or more) if there are any trailing characters after the number. 
490494*/ 
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 );
492499
493500/// 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. 
499512*/ 
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 );
501514
502515    hts_itr_t  * hts_itr_query (const  hts_idx_t  * idx , int  tid , int  beg , int  end , hts_readrec_func  * readrec );
503516    void  hts_itr_destroy (hts_itr_t  * iter );
0 commit comments