From e7aa6859f08565d58684fa4b9c40fed716f0ba17 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 21 Sep 2015 10:20:35 +0000 Subject: [PATCH] Add '-C' flag to meantools-derive Fix memory leak in meantools-derive --- Changelog | 8 ++++++++ Makefile | 2 +- man/kondo_preprocess.1 | 2 +- man/meankondo.1 | 4 ++-- man/meantools-convert.1 | 2 +- man/meantools.1 | 7 ++++++- man/numkondo.1 | 2 +- src/definitions.cpp | 2 +- src/meantools_deriv.c | 42 ++++++++++++++++++++++++++++++++++++++--- src/types.h | 1 + 10 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 Changelog diff --git a/Changelog b/Changelog new file mode 100644 index 0000000..0cf1bbb --- /dev/null +++ b/Changelog @@ -0,0 +1,8 @@ +1.3.1: + + * '-C' flag in meantools-derive: + allows to pipe the output of meantools-derive directly into numkondo. + + * Fixed memory leak in meantools-derive. + + diff --git a/Makefile b/Makefile index f6233fe..19fc350 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # if static=1 then link libkondo statically but other libraries dynamically STATIC=1 -VERSION=1.3 +VERSION=1.3.1 # products of the compilation PROJECT_BINS= meankondo numkondo meantools kondo_preprocess meantools-convert diff --git a/man/kondo_preprocess.1 b/man/kondo_preprocess.1 index e6e5c59..99712b1 100644 --- a/man/kondo_preprocess.1 +++ b/man/kondo_preprocess.1 @@ -1,5 +1,5 @@ .Dd $Mdocdate: April 14 2015 $ -.Dt kondo_preprocess 1.3 +.Dt kondo_preprocess 1.3.1 .Os .Sh NAME .Nm kondo_preprocess diff --git a/man/meankondo.1 b/man/meankondo.1 index 0a299d7..865659c 100644 --- a/man/meankondo.1 +++ b/man/meankondo.1 @@ -1,5 +1,5 @@ .Dd $Mdocdate: April 13 2015 $ -.Dt meankondo 1.3 +.Dt meankondo 1.3.1 .Os .Sh NAME .Nm meankondo @@ -44,7 +44,7 @@ as well as the following pre-processors, which generate configuration files for .It Fl t Ar threads The number of threads to use for the computation. .It Fl C -Format the ouptput so it can be piped to +Format the output so it can be piped to .Sy numkondo , that is, instead of printing the flow equation, print a full configuration file containing the flow equation as well as all the other entries of the configuration file that do not pertain to the computation of the flow equation. .It Fl v diff --git a/man/meantools-convert.1 b/man/meantools-convert.1 index 4f8b191..f73f3ce 100644 --- a/man/meantools-convert.1 +++ b/man/meantools-convert.1 @@ -1,5 +1,5 @@ .Dd $Mdocdate: June 12 2015 $ -.Dt meantools-convert 1.3 +.Dt meantools-convert 1.3.1 .Os .Sh NAME .Nm meantools-convert diff --git a/man/meantools.1 b/man/meantools.1 index 376a4c1..e361123 100644 --- a/man/meantools.1 +++ b/man/meantools.1 @@ -1,5 +1,5 @@ .Dd $Mdocdate: April 14 2015 $ -.Dt meantools 1.3 +.Dt meantools 1.3.1 .Os .Sh NAME .Nm meantools @@ -13,6 +13,7 @@ .Sy derive .Op Fl d Ar nderivs .Op Fl V Ar variables +.Op Fl C .Op Ar config_file .Pp .Nm @@ -95,6 +96,10 @@ The variables that depend on the extra virtual parameter (defaults to all) (WARN would interpret the argument as being a flag, for example, write '-V "0,-1"' instead of '-V "-1,0"'). .Pp Can either be a ',' separated list if indices or 'all' to derive with respect to all available variables. +.It Fl C +Format the output so it can be piped to +.Sy numkondo , +that is, instead of printing the flow equation, print a full configuration file containing the flow equation as well as all the other entries of the configuration file that do not pertain to the computation of the flow equation. .El .Pp .Sy Configuration file: diff --git a/man/numkondo.1 b/man/numkondo.1 index 9506cf4..e7b4807 100644 --- a/man/numkondo.1 +++ b/man/numkondo.1 @@ -1,5 +1,5 @@ .Dd $Mdocdate: April 14 2015 $ -.Dt numkondo 1.3 +.Dt numkondo 1.3.1 .Os .Sh NAME .Nm numkondo diff --git a/src/definitions.cpp b/src/definitions.cpp index 1884488..25715e5 100644 --- a/src/definitions.cpp +++ b/src/definitions.cpp @@ -17,7 +17,7 @@ limitations under the License. #ifndef DEFINITIONS_GCC #define DEFINITIONS_GCC -#define VERSION "1.3" +#define VERSION "1.3.1" // number of entries in a configuration file #define ARG_COUNT 10 diff --git a/src/meantools_deriv.c b/src/meantools_deriv.c index 28d8641..b096380 100644 --- a/src/meantools_deriv.c +++ b/src/meantools_deriv.c @@ -46,6 +46,8 @@ int tool_deriv_read_args(int argc, const char* argv[], Str_Array* str_args, Mean (*opts).deriv_derivs=1; // derive with respect to all variables (*opts).deriv_vars.length=-1; + // do not chain + (*opts).chain=0; // loop over arguments @@ -61,6 +63,10 @@ int tool_deriv_read_args(int argc, const char* argv[], Str_Array* str_args, Mean case 'V': flag=CP_FLAG_VARS; break; + // chain + case 'C': + (*opts).chain=1; + break; } } } @@ -104,6 +110,8 @@ int tool_deriv(Str_Array str_args, Meantools_Options opts){ // flow equation for the derivatives Grouped_Polynomial flow_equation_deriv; int i; + // header of the entry + Char_Array arg_header; // parse flow equation @@ -142,6 +150,29 @@ int tool_deriv(Str_Array str_args, Meantools_Options opts){ // compute derivatives flow_equation_derivative(opts.deriv_derivs, opts.deriv_vars, flow_equation, &flow_equation_deriv); + // print + // if chain then print config file + if(opts.chain==1){ + for(i=0;i