diff --git a/c/mapping/mapper_seqgen.c b/c/mapping/mapper_seqgen.c index 16962810d..fc3cf5b70 100644 --- a/c/mapping/mapper_seqgen.c +++ b/c/mapping/mapper_seqgen.c @@ -15,7 +15,7 @@ typedef struct _mapper_seqgen_state_t { } mapper_seqgen_state_t; #define DEFAULT_FIELD_NAME "i" - #define DEFAULT_START_STRING "0" + #define DEFAULT_START_STRING "1" #define DEFAULT_STOP_STRING "100" #define DEFAULT_STEP_STRING "1" @@ -84,11 +84,11 @@ static void mapper_seqgen_usage(FILE* o, char* argv0, char* verb) { fprintf(o, "output as specified by the following options:\n"); fprintf(o, "-f {name} Field name for counters; default \"%s\".\n", DEFAULT_FIELD_NAME); fprintf(o, "--start {number} Inclusive start value; default \"%s\".\n", DEFAULT_START_STRING); - fprintf(o, "--stop {number} Exclusive stop value; default \"%s\".\n", DEFAULT_STOP_STRING); + fprintf(o, "--stop {number} Inclusive stop value; default \"%s\".\n", DEFAULT_STOP_STRING); fprintf(o, "--step {number} Step value; default \"%s\".\n", DEFAULT_STEP_STRING); fprintf(o, "Start, stop, and/or step may be floating-point. Output is integer if start,\n"); fprintf(o, "stop, and step are all integers. Step may be negative. It may not be zero\n"); - fprintf(o, "unless start == stop (in which case zero records are emitted).\n"); + fprintf(o, "unless start == stop.\n"); } // ---------------------------------------------------------------- @@ -124,16 +124,16 @@ static sllv_t* mapper_seqgen_process(lrec_t* pinrec, context_t* pctx, void* pvst mapper_seqgen_state_t* pstate = pvstate; - int continue_cmp = -1; + int continue_cmp = 1; mv_t zero = mv_from_int(0); if (mv_i_nn_lt(&pstate->step, &zero)) { - continue_cmp = 1; + continue_cmp = -1; } sllv_t* poutrecs = sllv_alloc(); for ( mv_t counter = pstate->start; - mv_nn_comparator(&counter, &pstate->stop) == continue_cmp; + mv_nn_comparator(&counter, &pstate->stop) != continue_cmp; counter = x_xx_plus_func(&counter, &pstate->step) ) { lrec_t* poutrec = lrec_unbacked_alloc(); diff --git a/c/todo.txt b/c/todo.txt index 4e15484c4..bf1f20fc5 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -6,14 +6,9 @@ BUGFIXES ================================================================ TOP OF LIST: ----------------------------------------------------------------- -JSON formatting: -* indent by two more for jvstack -? rework comma placement for jvstack? - ---------------------------------------------------------------- 10MIN: -* sql-schema example -- after JSON formatting fix-up +* sql-schema example * publish ---------------------------------------------------------------- @@ -24,8 +19,6 @@ SEQGEN: MORE: ! make variadic min & max ! print/printn zary -! UT/mlh/mld func @ filter -! UT/mlh/mld -e, and mixed -f and -e, for filter/put UDFs/subrs/localvars: * maybe: @@ -33,6 +26,8 @@ UDFs/subrs/localvars: * hygiene: - valgrinds * UT & doc: + - UT/mlh/mld func @ filter + - UT/mlh/mld -e, and mixed -f and -e, for filter/put - no begin/end/func/subr within subr - no begin/end/func/subr within func - (lhs) func no subr call @@ -46,6 +41,7 @@ UDFs/subrs/localvars: * UT: - distinct locals within if/elseif/.../else - mlr --opprint --from s put -v '$o1 = a; local a=1000+NR; $o2 = a; a=2000+NR; $o3 = a' + - seqgen * doc: - kw autodoc mods for func/subr/call/return; also add NR PI E etc. to keyword help. - multiple filter/put -f (new mld section) diff --git a/doc/manpage.html b/doc/manpage.html index 10cf8c98b..993159afe 100644 --- a/doc/manpage.html +++ b/doc/manpage.html @@ -1000,12 +1000,12 @@ VERBS Produces a sequence of counters. Discards the input record stream. Produces output as specified by the following options: -f {name} Field name for counters; default "i". - --start {number} Inclusive start value; default "0". - --stop {number} Exclusive stop value; default "100". + --start {number} Inclusive start value; default "1". + --stop {number} Inclusive stop value; default "100". --step {number} Step value; default "1". Start, stop, and/or step may be floating-point. Output is integer if start, stop, and step are all integers. Step may be negative. It may not be zero - unless start == stop (in which case zero records are emitted). + unless start == stop. shuffle Usage: mlr shuffle {no options} diff --git a/doc/manpage.txt b/doc/manpage.txt index cd4abae84..234892301 100644 --- a/doc/manpage.txt +++ b/doc/manpage.txt @@ -853,12 +853,12 @@ VERBS Produces a sequence of counters. Discards the input record stream. Produces output as specified by the following options: -f {name} Field name for counters; default "i". - --start {number} Inclusive start value; default "0". - --stop {number} Exclusive stop value; default "100". + --start {number} Inclusive start value; default "1". + --stop {number} Inclusive stop value; default "100". --step {number} Step value; default "1". Start, stop, and/or step may be floating-point. Output is integer if start, stop, and step are all integers. Step may be negative. It may not be zero - unless start == stop (in which case zero records are emitted). + unless start == stop. shuffle Usage: mlr shuffle {no options} diff --git a/doc/mlr.1 b/doc/mlr.1 index e3dd7a316..cd75bf23d 100644 --- a/doc/mlr.1 +++ b/doc/mlr.1 @@ -1138,12 +1138,12 @@ Usage: mlr seqgen [options] Produces a sequence of counters. Discards the input record stream. Produces output as specified by the following options: -f {name} Field name for counters; default "i". ---start {number} Inclusive start value; default "0". ---stop {number} Exclusive stop value; default "100". +--start {number} Inclusive start value; default "1". +--stop {number} Inclusive stop value; default "100". --step {number} Step value; default "1". Start, stop, and/or step may be floating-point. Output is integer if start, stop, and step are all integers. Step may be negative. It may not be zero -unless start == stop (in which case zero records are emitted). +unless start == stop. .fi .if n \{\ .RE diff --git a/doc/reference.html b/doc/reference.html index 9427e9e17..180963d28 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -4674,12 +4674,12 @@ Usage: mlr seqgen [options] Produces a sequence of counters. Discards the input record stream. Produces output as specified by the following options: -f {name} Field name for counters; default "i". ---start {number} Inclusive start value; default "0". ---stop {number} Exclusive stop value; default "100". +--start {number} Inclusive start value; default "1". +--stop {number} Inclusive stop value; default "100". --step {number} Step value; default "1". Start, stop, and/or step may be floating-point. Output is integer if start, stop, and step are all integers. Step may be negative. It may not be zero -unless start == stop (in which case zero records are emitted). +unless start == stop.

@@ -4688,7 +4688,6 @@ unless start == stop (in which case zero records are emitted).

 $ mlr seqgen --stop 10
-i=0
 i=1
 i=2
 i=3
@@ -4698,6 +4697,7 @@ i=6
 i=7
 i=8
 i=9
+i=10
 

@@ -4710,6 +4710,7 @@ i=24 i=28 i=32 i=36 +i=40

@@ -4722,6 +4723,7 @@ i=36 i=32 i=28 i=24 +i=20