From 212b6554a51cc6619f054201cb9b07186ae24a11 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sat, 9 May 2015 12:37:57 -0700 Subject: [PATCH] Makefile neaten --- c/Makefile | 25 +++++++++++++++++-------- c/mapping/mapper_sort.c | 5 +++++ c/todo.txt | 5 +---- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/c/Makefile b/c/Makefile index bd4530823..1126780ee 100644 --- a/c/Makefile +++ b/c/Makefile @@ -14,17 +14,22 @@ FDSL_OBJS = ./dsls/filter_dsl_parse.o ./dsls/filter_dsl_lexer.o ./dsls/filter_ds # ---------------------------------------------------------------- # mlr for default use. -# mlrd for valgrind. -#top: mlr catc catc0 test +# mlrg for valgrind. top: tags mlr test install: top cp mlr $(HOME)/bin/ +all: tags mlr mlrd mlrg mlrp catc catc0 catd catgo catrust cutd cutgo + +tags: .always + ctags -R . + mlr: .always tags dsls $(CC) $(NON_DSL_SRCS) $(PDSL_OBJS) $(FDSL_OBJS) $(LFLAGS) -o mlr +# Memcheck version mlrk: .always tags dsls $(CC) -DUSE_MCHECK $(NON_DSL_SRCS) $(PDSL_OBJS) $(FDSL_OBJS) $(LFLAGS) -o mlrk @@ -48,6 +53,9 @@ dsls: .always # ---------------------------------------------------------------- test: unit-test reg-test +# Unfortunately --error-exitcode=1 doesn't work well since there are +# valgrind-detected errors in stdlibs. :( + unit-test: test-mlrutil test-lrec #valgrind --leak-check=full --error-exitcode=1 ./a.out valgrind --leak-check=full ./test-mlrutil @@ -58,16 +66,21 @@ unit-test: test-mlrutil test-lrec reg-test: ./test/run +# Run this after unit-test expected output has changed, and is verified to be +# OK. (Example: after adding new test cases in test/run.) regtest-copy: cp test/output/out test/expected # ---------------------------------------------------------------- +# Unit-test executables test-lrec: .always $(CCDEBUG) -D__TEST_LREC_MAIN__ lib/mlrutil.c containers/lrec.c containers/hdr_keeper.c containers/sllv.c containers/slls.c containers/lrec_parsers.c containers/test_lrec.c -o test-lrec test-mlrutil: .always $(CCDEBUG) -D__TEST_MLRUTIL_MAIN__ lib/mlrutil.c lib/test_mlrutil.c -o test-mlrutil +# ---------------------------------------------------------------- +# Standalone mains dheap: $(CCDEBUG) -D__DHEAP_MAIN__ containers/dheap.c lib/mlrutil.c @@ -105,6 +118,8 @@ evl: $(CCDEBUG) -D__LREC_EVALUATORS_MAIN__ mapping/lrec_evaluators.c mapping/mlr_val.c containers/mlr_dsl_ast.c containers/sllv.c containers/slls.c lib/mlrutil.c lib/mtrand.c containers/lrec.c -lm # ---------------------------------------------------------------- +# xxx to do: move these to ../language-comparisons. + catc: tools/catc.c $(CC) tools/catc.c -o catc catc0: tools/catc0.c @@ -121,12 +136,6 @@ cutd: cutd.d cutgo: cutgo.go go build cutgo.go -# ---------------------------------------------------------------- -all: tags mlr mlrd mlrg mlrp catc catc0 catd catgo catrust cutd cutgo - -tags: .always - ctags -R . - # ---------------------------------------------------------------- clean: @rm -vf mlr mlrd mlrg mlrp tester catc catc0 catd catgo catrust cutd cutgo mlr-unit-tester diff --git a/c/mapping/mapper_sort.c b/c/mapping/mapper_sort.c index 0991fd906..667be5101 100644 --- a/c/mapping/mapper_sort.c +++ b/c/mapping/mapper_sort.c @@ -165,7 +165,12 @@ sllv_t* mapper_sort_func(lrec_t* pinrec, context_t* pctx, void* pvstate) { pcmp_sort_params = pstate->sort_params; cmp_params_length = pstate->pkey_field_names->length; + + // xxx to do: allow the user to specify the sort algorithm from the CLI, assuming portability qsort(pbucket_array, num_buckets, sizeof(bucket_t*), pbucket_comparator); + //heapsort(pbucket_array, num_buckets, sizeof(bucket_t*), pbucket_comparator); + //mergesort(pbucket_array, num_buckets, sizeof(bucket_t*), pbucket_comparator); + pcmp_sort_params = NULL; cmp_params_length = 0; diff --git a/c/todo.txt b/c/todo.txt index 32d3c554c..28eb18027 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -6,14 +6,10 @@ ================================================================ FEATURES -!! sort -nr !! - -> put uniq & count-distinct into the same file. then rm extraneous extern @ .h - -> check 1 vs. 1.0 etc in sort -n -> cmp heap/merge/quick/... !! quantiles !! !! reminder pgr legend is broken !! http://en.wikipedia.org/wiki/Order_statistic_tree -! bulk rename cols 1,2,3,4,5 this,that,something,foo,bar: needs doc ! sub function. e.g. "300ms" -> "300" ! ordered cut (a la reorder). either a new command (yeck) or cut option (e.g. cut -o) * stats1 mode: lhmsi & then sort. what about "1"=="1.0"? @@ -34,6 +30,7 @@ NEATEN * "level_1", "level_2", etc. are just confusing. come up with more descriptive names. * rip through filenames @ start & abend unless -f each. * play with python sketch.py (& rename -- mlr.py??) & make sure it's at least usable for something +* put uniq & count-distinct into the same file. then rm extraneous extern @ .h ! re-do mlr sort -n stats in t1.rb -> mlrwik