From 781fb4ce1fcc08e4eb011d627f4745cff433de0e Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 26 Jan 2017 21:00:51 -0500 Subject: [PATCH] autodetect iterate --- c/cli/mlrcli.c | 2 ++ c/input/lrec_reader_mmap_dkvp.c | 2 ++ c/input/lrec_reader_stdio_dkvp.c | 2 ++ c/input/lrec_readers.c | 1 + c/todo.txt | 2 ++ 5 files changed, 9 insertions(+) diff --git a/c/cli/mlrcli.c b/c/cli/mlrcli.c index 2921326ec..829891750 100644 --- a/c/cli/mlrcli.c +++ b/c/cli/mlrcli.c @@ -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) diff --git a/c/input/lrec_reader_mmap_dkvp.c b/c/input/lrec_reader_mmap_dkvp.c index f9ded6664..50512c07d 100644 --- a/c/input/lrec_reader_mmap_dkvp.c +++ b/c/input/lrec_reader_mmap_dkvp.c @@ -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 diff --git a/c/input/lrec_reader_stdio_dkvp.c b/c/input/lrec_reader_stdio_dkvp.c index 3ed1d64a3..098e0af8a 100644 --- a/c/input/lrec_reader_stdio_dkvp.c +++ b/c/input/lrec_reader_stdio_dkvp.c @@ -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 diff --git a/c/input/lrec_readers.c b/c/input/lrec_readers.c index e54d01332..73699119f 100644 --- a/c/input/lrec_readers.c +++ b/c/input/lrec_readers.c @@ -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); diff --git a/c/todo.txt b/c/todo.txt index c48a0e15a..b6636574d 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -40,6 +40,8 @@ AUTOTERM * non-csv stdio readers * csv mmap reader * csv stdio reader +* json reader !?! +* all writers * test w/ join as well ================================================================