mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-21 02:23:20 +00:00
autodetect iterate
This commit is contained in:
parent
90882d6532
commit
781fb4ce1f
5 changed files with 9 additions and 0 deletions
|
|
@ -203,6 +203,7 @@ cli_opts_t* parse_command_line(int argc, char** argv) {
|
|||
lhmsll_t* default_repeat_ifses = get_default_repeat_ifses();
|
||||
lhmsll_t* default_repeat_ipses = get_default_repeat_ipses();
|
||||
|
||||
// xxx auto: (irs == NULL && ors == NULL) || (irs == "auto" && ors == "auto")
|
||||
if (popts->reader_opts.irs == NULL)
|
||||
popts->reader_opts.irs = lhmss_get_or_die(default_rses, popts->reader_opts.ifile_fmt, argv[0]);
|
||||
if (popts->reader_opts.ifs == NULL)
|
||||
|
|
@ -217,6 +218,7 @@ cli_opts_t* parse_command_line(int argc, char** argv) {
|
|||
popts->reader_opts.allow_repeat_ips = lhmsll_get_or_die(default_repeat_ipses,
|
||||
popts->reader_opts.ifile_fmt, argv[0]);
|
||||
|
||||
// xxx auto: (irs == NULL && ors == NULL) || (irs == "auto" && ors == "auto")
|
||||
if (popts->writer_opts.ors == NULL)
|
||||
popts->writer_opts.ors = lhmss_get_or_die(default_rses, popts->writer_opts.ofile_fmt, argv[0]);
|
||||
if (popts->writer_opts.ofs == NULL)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ static lrec_t* lrec_reader_mmap_dkvp_process_multi_irs_single_others(void* pvsta
|
|||
static lrec_t* lrec_reader_mmap_dkvp_process_multi_irs_multi_others(void* pvstate, void* pvhandle, context_t* pctx);
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx autors arg?
|
||||
lrec_reader_t* lrec_reader_mmap_dkvp_alloc(char* irs, char* ifs, char* ips, int allow_repeat_ifs) {
|
||||
lrec_reader_t* plrec_reader = mlr_malloc_or_die(sizeof(lrec_reader_t));
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ lrec_reader_t* lrec_reader_mmap_dkvp_alloc(char* irs, char* ifs, char* ips, int
|
|||
plrec_reader->pvstate = (void*)pstate;
|
||||
plrec_reader->popen_func = file_reader_mmap_vopen;
|
||||
plrec_reader->pclose_func = file_reader_mmap_vclose;
|
||||
// xxx if autors ... else if ...
|
||||
if (pstate->irslen == 1) {
|
||||
plrec_reader->pprocess_func = (pstate->ifslen == 1 && pstate->ipslen == 1)
|
||||
? lrec_reader_mmap_dkvp_process_single_irs_single_others
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ static lrec_t* lrec_reader_stdio_dkvp_process_multi_irs_single_others(void* pvst
|
|||
static lrec_t* lrec_reader_stdio_dkvp_process_multi_irs_multi_others(void* pvstate, void* pvhandle, context_t* pctx);
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// xxx autors flag?
|
||||
lrec_reader_t* lrec_reader_stdio_dkvp_alloc(char* irs, char* ifs, char* ips, int allow_repeat_ifs) {
|
||||
lrec_reader_t* plrec_reader = mlr_malloc_or_die(sizeof(lrec_reader_t));
|
||||
|
||||
|
|
@ -39,6 +40,7 @@ lrec_reader_t* lrec_reader_stdio_dkvp_alloc(char* irs, char* ifs, char* ips, int
|
|||
plrec_reader->pvstate = (void*)pstate;
|
||||
plrec_reader->popen_func = file_reader_stdio_vopen;
|
||||
plrec_reader->pclose_func = file_reader_stdio_vclose;
|
||||
// xxx if autors ... else if ...
|
||||
if (pstate->irslen == 1) {
|
||||
plrec_reader->pprocess_func = (pstate->ifslen == 1 && pstate->ipslen == 1)
|
||||
? &lrec_reader_stdio_dkvp_process_single_irs_single_others
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
lrec_reader_t* lrec_reader_alloc(cli_reader_opts_t* popts) {
|
||||
if (streq(popts->ifile_fmt, "dkvp")) {
|
||||
if (popts->use_mmap_for_read)
|
||||
// xxx autors arg ?
|
||||
return lrec_reader_mmap_dkvp_alloc(popts->irs, popts->ifs, popts->ips, popts->allow_repeat_ifs);
|
||||
else
|
||||
return lrec_reader_stdio_dkvp_alloc(popts->irs, popts->ifs, popts->ips, popts->allow_repeat_ifs);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ AUTOTERM
|
|||
* non-csv stdio readers
|
||||
* csv mmap reader
|
||||
* csv stdio reader
|
||||
* json reader !?!
|
||||
* all writers
|
||||
* test w/ join as well
|
||||
|
||||
================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue