From 78a863790a8c7a577b6e2552c540bde2cb585cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Wed, 26 Aug 2020 00:08:31 +0200 Subject: [PATCH] improve function-summary.sh, encapsulate, tidy up --- .../bindgen_20200823.rs} | 0 .../function-summary.sh} | 26 ++++++++++++------- .../out-20200823}/STATS | 0 .../out-20200823}/bindgen/_NON_FILTERED | 0 .../out-20200823}/bindgen/cell | 0 .../out-20200823}/bindgen/channel | 0 .../out-20200823}/bindgen/ncblit | 0 .../out-20200823}/bindgen/ncdirect | 0 .../out-20200823}/bindgen/ncdplot | 0 .../out-20200823}/bindgen/ncfadectx | 0 .../out-20200823}/bindgen/ncfdplane | 0 .../out-20200823}/bindgen/nckey | 0 .../out-20200823}/bindgen/ncmenu | 0 .../out-20200823}/bindgen/ncmetric | 0 .../out-20200823}/bindgen/ncmultiselector | 0 .../out-20200823}/bindgen/ncpixel | 0 .../out-20200823}/bindgen/ncplane | 0 .../out-20200823}/bindgen/ncreader | 0 .../out-20200823}/bindgen/ncreel | 0 .../out-20200823}/bindgen/ncselector | 0 .../out-20200823}/bindgen/ncsubproc | 0 .../out-20200823}/bindgen/nctablet | 0 .../out-20200823}/bindgen/ncuplot | 0 .../out-20200823}/bindgen/ncvisual | 0 .../out-20200823}/bindgen/notcurses | 0 .../out-20200823}/bindgen/palette | 0 .../out-20200823}/static/_NON_FILTERED | 0 .../out-20200823}/static/cell | 0 .../out-20200823}/static/channel | 0 .../out-20200823}/static/ncblit | 0 .../out-20200823}/static/ncdirect | 0 .../out-20200823}/static/ncdplot | 0 .../out-20200823}/static/ncfadectx | 0 .../out-20200823}/static/ncfdplane | 0 .../out-20200823}/static/nckey | 0 .../out-20200823}/static/ncmenu | 0 .../out-20200823}/static/ncmetric | 0 .../out-20200823}/static/ncmultiselector | 0 .../out-20200823}/static/ncpixel | 0 .../out-20200823}/static/ncplane | 0 .../out-20200823}/static/ncreader | 0 .../out-20200823}/static/ncreel | 0 .../out-20200823}/static/ncselector | 0 .../out-20200823}/static/ncsubproc | 0 .../out-20200823}/static/nctablet | 0 .../out-20200823}/static/ncuplot | 0 .../out-20200823}/static/ncvisual | 0 .../out-20200823}/static/notcurses | 0 .../out-20200823}/static/palette | 0 49 files changed, 16 insertions(+), 10 deletions(-) rename tools/{function-stats.bindgen_20200823.rs => function-summary/bindgen_20200823.rs} (100%) rename tools/{function-stats.sh => function-summary/function-summary.sh} (85%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/STATS (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/_NON_FILTERED (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/cell (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/channel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncblit (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncdirect (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncdplot (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncfadectx (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncfdplane (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/nckey (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncmenu (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncmetric (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncmultiselector (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncpixel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncplane (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncreader (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncreel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncselector (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncsubproc (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/nctablet (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncuplot (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/ncvisual (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/notcurses (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/bindgen/palette (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/_NON_FILTERED (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/cell (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/channel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncblit (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncdirect (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncdplot (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncfadectx (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncfdplane (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/nckey (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncmenu (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncmetric (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncmultiselector (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncpixel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncplane (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncreader (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncreel (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncselector (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncsubproc (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/nctablet (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncuplot (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/ncvisual (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/notcurses (100%) rename tools/{function-stats-output/20200823 => function-summary/out-20200823}/static/palette (100%) diff --git a/tools/function-stats.bindgen_20200823.rs b/tools/function-summary/bindgen_20200823.rs similarity index 100% rename from tools/function-stats.bindgen_20200823.rs rename to tools/function-summary/bindgen_20200823.rs diff --git a/tools/function-stats.sh b/tools/function-summary/function-summary.sh similarity index 85% rename from tools/function-stats.sh rename to tools/function-summary/function-summary.sh index 528b53629..f8f83415a 100755 --- a/tools/function-stats.sh +++ b/tools/function-summary/function-summary.sh @@ -4,24 +4,29 @@ # and static inline functions in notcurses.h on the other, grouped by prefix. # It also generates some statistics. # +# It would be nice if this script could check for changes in the body of +# filtered functions, by asking git... between the date of today and a custom +# past date you want to check out (modified file in the bindings). +# +# I should probably re-do this in Rust, and put it as an advanced example… + -PATH_SOURCE_FILE="../include/notcurses/notcurses.h" +# TODO:enhancement: support multiple paths +PATH_SOURCE_FILE="../../include/notcurses/notcurses.h" # this is the path to the latest bindgen generated rust sources -PATH_BINDGEN_LATEST="function-stats.bindgen_20200823.rs" +# TODO: retrieve it automatically, from the target folder, the most recently created/updated) +PATH_BINDGEN_LATEST="bindgen_20200823.rs" # these are the main function prefixes used in notcurses (before the first `_`) for STATS_FILE +# NOTE: updated manually PREFIX_LIST="cell channel ncblit ncdirect ncdplot ncfadectx ncfdplane nckey ncmenu ncmetric ncmultiselector ncpixel ncplane ncreader ncreel ncselector ncsubproc nctablet ncuplot ncvisual notcurses palette" -OUTPUT_DIR_ROOT="function-stats-output/" -#DATE="$(date +%Y%m%d_%H%M%S)" # with time -DATE="$(date +%Y%m%d)" -OUTPUT_DIR="$OUTPUT_DIR_ROOT/$DATE" +OUTPUT_DIR="out-$(date +%Y%m%d)" OUTPUT_DIR_BG="$OUTPUT_DIR/bindgen" # (bindgen generated) OUTPUT_DIR_SI="$OUTPUT_DIR/static" # (static inline) STATS_FILE="$OUTPUT_DIR/STATS" -# TODO: add to the STATS_FILE and/or OUTPUT_DIR a prefix of the source_file TERM="static inline" @@ -99,10 +104,11 @@ generate() { listfn_bindgen | $GREP -vE "$filterout" | $UNIQ -u | $SORT > "$OUTPUT_DIR_BG/_NON_FILTERED" | tee -a $STATS_FILE listfn | $GREP -vE "$filterout" | $UNIQ -u | $SORT > "$OUTPUT_DIR_SI/_NON_FILTERED" | tee -a $STATS_FILE + echo -e "\n» results generated in folder \"$OUTPUT_DIR\"" -} +} #/generate -usage() { +main() { if [[ $1 == "p" ]]; then listprefixes @@ -130,4 +136,4 @@ usage() { fi } -usage $1 +main $1 diff --git a/tools/function-stats-output/20200823/STATS b/tools/function-summary/out-20200823/STATS similarity index 100% rename from tools/function-stats-output/20200823/STATS rename to tools/function-summary/out-20200823/STATS diff --git a/tools/function-stats-output/20200823/bindgen/_NON_FILTERED b/tools/function-summary/out-20200823/bindgen/_NON_FILTERED similarity index 100% rename from tools/function-stats-output/20200823/bindgen/_NON_FILTERED rename to tools/function-summary/out-20200823/bindgen/_NON_FILTERED diff --git a/tools/function-stats-output/20200823/bindgen/cell b/tools/function-summary/out-20200823/bindgen/cell similarity index 100% rename from tools/function-stats-output/20200823/bindgen/cell rename to tools/function-summary/out-20200823/bindgen/cell diff --git a/tools/function-stats-output/20200823/bindgen/channel b/tools/function-summary/out-20200823/bindgen/channel similarity index 100% rename from tools/function-stats-output/20200823/bindgen/channel rename to tools/function-summary/out-20200823/bindgen/channel diff --git a/tools/function-stats-output/20200823/bindgen/ncblit b/tools/function-summary/out-20200823/bindgen/ncblit similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncblit rename to tools/function-summary/out-20200823/bindgen/ncblit diff --git a/tools/function-stats-output/20200823/bindgen/ncdirect b/tools/function-summary/out-20200823/bindgen/ncdirect similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncdirect rename to tools/function-summary/out-20200823/bindgen/ncdirect diff --git a/tools/function-stats-output/20200823/bindgen/ncdplot b/tools/function-summary/out-20200823/bindgen/ncdplot similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncdplot rename to tools/function-summary/out-20200823/bindgen/ncdplot diff --git a/tools/function-stats-output/20200823/bindgen/ncfadectx b/tools/function-summary/out-20200823/bindgen/ncfadectx similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncfadectx rename to tools/function-summary/out-20200823/bindgen/ncfadectx diff --git a/tools/function-stats-output/20200823/bindgen/ncfdplane b/tools/function-summary/out-20200823/bindgen/ncfdplane similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncfdplane rename to tools/function-summary/out-20200823/bindgen/ncfdplane diff --git a/tools/function-stats-output/20200823/bindgen/nckey b/tools/function-summary/out-20200823/bindgen/nckey similarity index 100% rename from tools/function-stats-output/20200823/bindgen/nckey rename to tools/function-summary/out-20200823/bindgen/nckey diff --git a/tools/function-stats-output/20200823/bindgen/ncmenu b/tools/function-summary/out-20200823/bindgen/ncmenu similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncmenu rename to tools/function-summary/out-20200823/bindgen/ncmenu diff --git a/tools/function-stats-output/20200823/bindgen/ncmetric b/tools/function-summary/out-20200823/bindgen/ncmetric similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncmetric rename to tools/function-summary/out-20200823/bindgen/ncmetric diff --git a/tools/function-stats-output/20200823/bindgen/ncmultiselector b/tools/function-summary/out-20200823/bindgen/ncmultiselector similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncmultiselector rename to tools/function-summary/out-20200823/bindgen/ncmultiselector diff --git a/tools/function-stats-output/20200823/bindgen/ncpixel b/tools/function-summary/out-20200823/bindgen/ncpixel similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncpixel rename to tools/function-summary/out-20200823/bindgen/ncpixel diff --git a/tools/function-stats-output/20200823/bindgen/ncplane b/tools/function-summary/out-20200823/bindgen/ncplane similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncplane rename to tools/function-summary/out-20200823/bindgen/ncplane diff --git a/tools/function-stats-output/20200823/bindgen/ncreader b/tools/function-summary/out-20200823/bindgen/ncreader similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncreader rename to tools/function-summary/out-20200823/bindgen/ncreader diff --git a/tools/function-stats-output/20200823/bindgen/ncreel b/tools/function-summary/out-20200823/bindgen/ncreel similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncreel rename to tools/function-summary/out-20200823/bindgen/ncreel diff --git a/tools/function-stats-output/20200823/bindgen/ncselector b/tools/function-summary/out-20200823/bindgen/ncselector similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncselector rename to tools/function-summary/out-20200823/bindgen/ncselector diff --git a/tools/function-stats-output/20200823/bindgen/ncsubproc b/tools/function-summary/out-20200823/bindgen/ncsubproc similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncsubproc rename to tools/function-summary/out-20200823/bindgen/ncsubproc diff --git a/tools/function-stats-output/20200823/bindgen/nctablet b/tools/function-summary/out-20200823/bindgen/nctablet similarity index 100% rename from tools/function-stats-output/20200823/bindgen/nctablet rename to tools/function-summary/out-20200823/bindgen/nctablet diff --git a/tools/function-stats-output/20200823/bindgen/ncuplot b/tools/function-summary/out-20200823/bindgen/ncuplot similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncuplot rename to tools/function-summary/out-20200823/bindgen/ncuplot diff --git a/tools/function-stats-output/20200823/bindgen/ncvisual b/tools/function-summary/out-20200823/bindgen/ncvisual similarity index 100% rename from tools/function-stats-output/20200823/bindgen/ncvisual rename to tools/function-summary/out-20200823/bindgen/ncvisual diff --git a/tools/function-stats-output/20200823/bindgen/notcurses b/tools/function-summary/out-20200823/bindgen/notcurses similarity index 100% rename from tools/function-stats-output/20200823/bindgen/notcurses rename to tools/function-summary/out-20200823/bindgen/notcurses diff --git a/tools/function-stats-output/20200823/bindgen/palette b/tools/function-summary/out-20200823/bindgen/palette similarity index 100% rename from tools/function-stats-output/20200823/bindgen/palette rename to tools/function-summary/out-20200823/bindgen/palette diff --git a/tools/function-stats-output/20200823/static/_NON_FILTERED b/tools/function-summary/out-20200823/static/_NON_FILTERED similarity index 100% rename from tools/function-stats-output/20200823/static/_NON_FILTERED rename to tools/function-summary/out-20200823/static/_NON_FILTERED diff --git a/tools/function-stats-output/20200823/static/cell b/tools/function-summary/out-20200823/static/cell similarity index 100% rename from tools/function-stats-output/20200823/static/cell rename to tools/function-summary/out-20200823/static/cell diff --git a/tools/function-stats-output/20200823/static/channel b/tools/function-summary/out-20200823/static/channel similarity index 100% rename from tools/function-stats-output/20200823/static/channel rename to tools/function-summary/out-20200823/static/channel diff --git a/tools/function-stats-output/20200823/static/ncblit b/tools/function-summary/out-20200823/static/ncblit similarity index 100% rename from tools/function-stats-output/20200823/static/ncblit rename to tools/function-summary/out-20200823/static/ncblit diff --git a/tools/function-stats-output/20200823/static/ncdirect b/tools/function-summary/out-20200823/static/ncdirect similarity index 100% rename from tools/function-stats-output/20200823/static/ncdirect rename to tools/function-summary/out-20200823/static/ncdirect diff --git a/tools/function-stats-output/20200823/static/ncdplot b/tools/function-summary/out-20200823/static/ncdplot similarity index 100% rename from tools/function-stats-output/20200823/static/ncdplot rename to tools/function-summary/out-20200823/static/ncdplot diff --git a/tools/function-stats-output/20200823/static/ncfadectx b/tools/function-summary/out-20200823/static/ncfadectx similarity index 100% rename from tools/function-stats-output/20200823/static/ncfadectx rename to tools/function-summary/out-20200823/static/ncfadectx diff --git a/tools/function-stats-output/20200823/static/ncfdplane b/tools/function-summary/out-20200823/static/ncfdplane similarity index 100% rename from tools/function-stats-output/20200823/static/ncfdplane rename to tools/function-summary/out-20200823/static/ncfdplane diff --git a/tools/function-stats-output/20200823/static/nckey b/tools/function-summary/out-20200823/static/nckey similarity index 100% rename from tools/function-stats-output/20200823/static/nckey rename to tools/function-summary/out-20200823/static/nckey diff --git a/tools/function-stats-output/20200823/static/ncmenu b/tools/function-summary/out-20200823/static/ncmenu similarity index 100% rename from tools/function-stats-output/20200823/static/ncmenu rename to tools/function-summary/out-20200823/static/ncmenu diff --git a/tools/function-stats-output/20200823/static/ncmetric b/tools/function-summary/out-20200823/static/ncmetric similarity index 100% rename from tools/function-stats-output/20200823/static/ncmetric rename to tools/function-summary/out-20200823/static/ncmetric diff --git a/tools/function-stats-output/20200823/static/ncmultiselector b/tools/function-summary/out-20200823/static/ncmultiselector similarity index 100% rename from tools/function-stats-output/20200823/static/ncmultiselector rename to tools/function-summary/out-20200823/static/ncmultiselector diff --git a/tools/function-stats-output/20200823/static/ncpixel b/tools/function-summary/out-20200823/static/ncpixel similarity index 100% rename from tools/function-stats-output/20200823/static/ncpixel rename to tools/function-summary/out-20200823/static/ncpixel diff --git a/tools/function-stats-output/20200823/static/ncplane b/tools/function-summary/out-20200823/static/ncplane similarity index 100% rename from tools/function-stats-output/20200823/static/ncplane rename to tools/function-summary/out-20200823/static/ncplane diff --git a/tools/function-stats-output/20200823/static/ncreader b/tools/function-summary/out-20200823/static/ncreader similarity index 100% rename from tools/function-stats-output/20200823/static/ncreader rename to tools/function-summary/out-20200823/static/ncreader diff --git a/tools/function-stats-output/20200823/static/ncreel b/tools/function-summary/out-20200823/static/ncreel similarity index 100% rename from tools/function-stats-output/20200823/static/ncreel rename to tools/function-summary/out-20200823/static/ncreel diff --git a/tools/function-stats-output/20200823/static/ncselector b/tools/function-summary/out-20200823/static/ncselector similarity index 100% rename from tools/function-stats-output/20200823/static/ncselector rename to tools/function-summary/out-20200823/static/ncselector diff --git a/tools/function-stats-output/20200823/static/ncsubproc b/tools/function-summary/out-20200823/static/ncsubproc similarity index 100% rename from tools/function-stats-output/20200823/static/ncsubproc rename to tools/function-summary/out-20200823/static/ncsubproc diff --git a/tools/function-stats-output/20200823/static/nctablet b/tools/function-summary/out-20200823/static/nctablet similarity index 100% rename from tools/function-stats-output/20200823/static/nctablet rename to tools/function-summary/out-20200823/static/nctablet diff --git a/tools/function-stats-output/20200823/static/ncuplot b/tools/function-summary/out-20200823/static/ncuplot similarity index 100% rename from tools/function-stats-output/20200823/static/ncuplot rename to tools/function-summary/out-20200823/static/ncuplot diff --git a/tools/function-stats-output/20200823/static/ncvisual b/tools/function-summary/out-20200823/static/ncvisual similarity index 100% rename from tools/function-stats-output/20200823/static/ncvisual rename to tools/function-summary/out-20200823/static/ncvisual diff --git a/tools/function-stats-output/20200823/static/notcurses b/tools/function-summary/out-20200823/static/notcurses similarity index 100% rename from tools/function-stats-output/20200823/static/notcurses rename to tools/function-summary/out-20200823/static/notcurses diff --git a/tools/function-stats-output/20200823/static/palette b/tools/function-summary/out-20200823/static/palette similarity index 100% rename from tools/function-stats-output/20200823/static/palette rename to tools/function-summary/out-20200823/static/palette