Revision: 77097
          http://sourceforge.net/p/brlcad/code/77097
Author:   starseeker
Date:     2020-09-10 02:08:29 +0000 (Thu, 10 Sep 2020)
Log Message:
-----------
Merge from trunk: r77078 through r77096

Modified Paths:
--------------
    brlcad/branches/RELEASE/AUTHORS
    brlcad/branches/RELEASE/CMakeLists.txt
    brlcad/branches/RELEASE/NEWS
    brlcad/branches/RELEASE/TODO
    brlcad/branches/RELEASE/bench/run.sh
    brlcad/branches/RELEASE/doc/docbook/system/man3/CMakeLists.txt
    brlcad/branches/RELEASE/doc/docbook/system/mann/search.xml
    brlcad/branches/RELEASE/src/libgcv/plugins/vol/png_read.c
    brlcad/branches/RELEASE/src/libged/TODO
    brlcad/branches/RELEASE/src/librt/search.c
    brlcad/branches/RELEASE/src/librt/search.h

Added Paths:
-----------
    brlcad/branches/RELEASE/doc/docbook/system/man3/libicv.xml

Property Changed:
----------------
    brlcad/branches/RELEASE/
    brlcad/branches/RELEASE/NEWS
    brlcad/branches/RELEASE/doc/

Index: brlcad/branches/RELEASE
===================================================================
--- brlcad/branches/RELEASE     2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE     2020-09-10 02:08:29 UTC (rev 77097)

Property changes on: brlcad/branches/RELEASE
___________________________________________________________________
Modified: svn:mergeinfo
## -7,4 +7,4 ##
 /brlcad/branches/opencl:65867-66137
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
-/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-75207,75325,75375,75377-75378,75387,75470-75472,75477,75492,75495,75549,75565-75566,75656-75661,75672,75675,75678,75729,75811,76641-76768,76771-76954,76963-76967,76975-76991,76994-77077
\ No newline at end of property
+/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-75207,75325,75375,75377-75378,75387,75470-75472,75477,75492,75495,75549,75565-75566,75656-75661,75672,75675,75678,75729,75811,76641-76768,76771-76954,76963-76967,76975-76991,76994-77096
\ No newline at end of property
Modified: brlcad/branches/RELEASE/AUTHORS
===================================================================
--- brlcad/branches/RELEASE/AUTHORS     2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/AUTHORS     2020-09-10 02:08:29 UTC (rev 77097)
@@ -898,6 +898,11 @@
 2019 May
 Open Source (GSoC)
 
+Suthar, Rishabh
+nicknames yamhai, rishabhsuthar32
+2020 March
+Open Source (GSoC)
+
 Vaidya, Sahil
 nicknames sahilvaidya99
 2020 April

Modified: brlcad/branches/RELEASE/CMakeLists.txt
===================================================================
--- brlcad/branches/RELEASE/CMakeLists.txt      2020-09-10 00:41:59 UTC (rev 
77096)
+++ brlcad/branches/RELEASE/CMakeLists.txt      2020-09-10 02:08:29 UTC (rev 
77097)
@@ -2937,10 +2937,10 @@
 endif(NOT HAVE_SNPRINTF)
 
 if(HAVE_REALPATH)
-  check_c_source_runs("#include<limits.h>\n#include <stdlib.h>\nint main() { 
char dir[PATH_MAX]; const char *d = \"/tmp/REALPATH_TEST_PATH\"; d = (const 
char *)realpath(d, dir); return 0; }" HAVE_WORKING_REALPATH)
-  if(HAVE_WORKING_REALPATH)
-    CONFIG_H_APPEND(BRLCAD "#define HAVE_WORKING_REALPATH 1\n")
-  endif(HAVE_WORKING_REALPATH)
+ #check_c_source_runs("#include<limits.h>\n#include <stdlib.h>\nint main() { 
char dir[PATH_MAX]; const char *d = \"/tmp/REALPATH_TEST_PATH\"; d = (const 
char *)realpath(d, dir); return 0; }" HAVE_WORKING_REALPATH)
+ #if(HAVE_WORKING_REALPATH)
+ #  CONFIG_H_APPEND(BRLCAD "#define HAVE_WORKING_REALPATH 1\n")
+ #endif(HAVE_WORKING_REALPATH)
 endif(HAVE_REALPATH)
 
 # GetFullPathName

Modified: brlcad/branches/RELEASE/NEWS
===================================================================
--- brlcad/branches/RELEASE/NEWS        2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/NEWS        2020-09-10 02:08:29 UTC (rev 77097)
@@ -13,8 +13,10 @@
 --- 2020-08-XX  Release 7.32.X                                     ---
 ----------------------------------------------------------------------
 
+* added -size filter to MGED search command - Cliff Yapp
 * upgraded Tcl/Tk from 8.5.19 to 8.6.10 - Cliff Yapp
 * bundled zlib & libpng use API prefix and library suffix - Cliff Yapp
+* extensive improvements to OpenCL ray trace pipeline - Rishabh Suthar
 * improved rtweight density value warnings - Sean Morrison, Cliff Yapp
 * added perception-based hdtv and hdr modes for pix-bw - Sean Morrison
 * fixed semi-transparent DM and FB windows on Linux - Cliff Yapp
@@ -79,6 +81,7 @@
 * added "plate" object type filter to search command - Cliff Yapp
 * fixed latent logging bug during facetize on Windows - Bob Parker
 * fixed bug closing rt framebuffer windows on Windows - Sean Morrison
+* added EBM support for reading from database objects - Jeffrey Liu
 
 
 ----------------------------------------------------------------------
@@ -93,9 +96,13 @@
 * changed mged escape key binding to reset mouse mode - Sean Morrison
 * removed default xXyYzZ0 rate rotation key bindings - Sean Morrison
 * improved tessellation of nearly coplanar surfaces - John Anderson
-* fixed display of annotations on Windows - Daniel Roßberg
+* fixed annotations display on Windows - Daniel Roßberg, Ali Haydar
 * fixed rtedge and rtwizard occlusion object edge bug - Sean Morrison
 * rt* tools no longer force outputs to be read-only - Sean Morrison
+* fixed bug listing annotations with short label strings - Ali Haydar
+* improved support for label placement in annotations - Ali Haydar
+* fixed bug in annotation object bounding box calculation - Ali Haydar
+* fixed an annotation leader line bug affecting display - Ali Haydar
 * fixed 'burst' crash when run without options - Sean Morrison
 * changed rtweight to not truncate long pathnames - Sean Morrison
 * added new ball bearing example geometry model - Sean Morrison


Property changes on: brlcad/branches/RELEASE/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
 /brlcad/branches/prep-cache/NEWS:68236-68933
 /brlcad/branches/tcltk86/NEWS:68300-75257
 /brlcad/trunk:68170-68252
-/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74373,74376-75141,75375,75377-75378,75565-75566,75811,76645-76654,76748-76764,76862-76954,76980-76991,76994-77014
\ No newline at end of property
+/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74373,74376-75141,75375,75377-75378,75565-75566,75811,76645-76654,76748-76764,76862-76954,76980-76991,76994-77014,77078-77096
\ No newline at end of property
Modified: brlcad/branches/RELEASE/TODO
===================================================================
--- brlcad/branches/RELEASE/TODO        2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/TODO        2020-09-10 02:08:29 UTC (rev 77097)
@@ -18,7 +18,9 @@
 THESE TASKS SHOULD HAPPEN BEFORE THE NEXT RELEASE
 -------------------------------------------------
 
+* Release Testing, final commit reviews
 
+
 THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
 -------------------------------------------------------
 
@@ -170,6 +172,17 @@
 THESE ARE UNSCHEDULED BACKLOG TASKS
 -----------------------------------
 
+* bot -V check solid bot.s visualizations don't show up if bot.s is
+  first drawn in MGED - should properly "overlay" them so the user
+  doesn't have to first erase the solid from the scene visual.
+
+* MGED's startup directory is inconsistent and sometimes problematic.
+  If the current working directory is read-only (e.g., a default
+  system install and opening one of the sample .g files), then
+  numerous commands the write out to the current path will fail (e.g.,
+  "idents file.log").  Review startup path behavior and consider using
+  $HOME or some other system path, unless started on the command-line.
+
 * rtwizard's reopening of the database is causing db_dircheck
   "Duplicate of..." errors when opening read-only .g files.
 

Modified: brlcad/branches/RELEASE/bench/run.sh
===================================================================
--- brlcad/branches/RELEASE/bench/run.sh        2020-09-10 00:41:59 UTC (rev 
77096)
+++ brlcad/branches/RELEASE/bench/run.sh        2020-09-10 02:08:29 UTC (rev 
77097)
@@ -68,25 +68,32 @@
 # force locale setting to C so things like date output as expected
 LC_ALL=C
 
+# Windows has a special NUL device instead of /dev/null
+if test -f /dev/null ; then
+    export NUL=/dev/null
+else
+    export NUL=NUL
+fi
+
 # commands that this script expects
 for __cmd in echo pwd ; do
-    echo "test" | $__cmd > /dev/null 2>&1
+    echo "test" | $__cmd > $NUL 2>&1
     if test ! x$? = x0 ; then
        echo "INTERNAL ERROR: $__cmd command is required"
        exit 1
     fi
 done
-echo "test" | grep "test" > /dev/null 2>&1
+echo "test" | grep "test" > $NUL 2>&1
 if test ! x$? = x0 ; then
     echo "INTERNAL ERROR: grep command is required"
     exit 1
 fi
-echo "test" | tr "test" "test" > /dev/null 2>&1
+echo "test" | tr "test" "test" > $NUL 2>&1
 if test ! x$? = x0 ; then
     echo "INTERNAL ERROR: tr command is required"
     exit 1
 fi
-echo "test" | sed "s/test/test/" > /dev/null 2>&1
+echo "test" | sed "s/test/test/" > $NUL 2>&1
 if test ! x$? = x0 ; then
     echo "INTERNAL ERROR: sed command is required"
     exit 1
@@ -393,10 +400,10 @@
 LOGFILE=run-$$-benchmark.log
 touch "$LOGFILE"
 if test ! -w "$LOGFILE" ; then
-    if test ! "x$LOGFILE" = "x/dev/null" ; then
+    if test "x$LOGFILE" != "x/dev/null" -a "x$LOGFILE" != "xNUL" ; then
        echo "ERROR: Unable to log to $LOGFILE"
     fi
-    LOGFILE=/dev/null
+    LOGFILE=$NUL
 fi
 
 VERBOSE_ECHO=:
@@ -584,10 +591,12 @@
     $ECHO "Using [$ELP] for ELP"
 fi
 
-# more sanity checks, make sure the binaries and scripts run
-eval \"$RT\" -s1 -o light.pix \"${DB}/moss.g\" LIGHT > /dev/null 2>&1
+# prevent git shell and msys2 from expanding -F/dev/debug
+export MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL="-F/dev/debug"
+
+# sanity check: make sure $RT runs
+eval \"$RT\" -s1 -F/dev/debug \"${DB}/moss.g\" LIGHT > $NUL 2>&1
 ret=$?
-rm -f light.pix
 if test ! "x${ret}" = "x0" ; then
     $ECHO
     $ECHO "Running \"$RT\":"
@@ -597,12 +606,8 @@
     exit 2
 fi
 
-# create a temporary file named "null", fopen("/dev/null") does not work on
-# windows (using cygwin), so punt.
-> null
-eval \"$CMP\" null null >/dev/null 2>&1
-rm -f null
-
+# sanity check: make sure $CMP runs
+eval \"$CMP\" $NUL $NUL > $NUL 2>&1
 ret=$?
 if test ! "x${ret}" = "x0" ; then
     $ECHO
@@ -609,7 +614,9 @@
     $ECHO "ERROR:  CMP does not seem to work as expected"
     exit 2
 fi
-eval \"$ELP\" 0 > /dev/null 2>&1
+
+# sanity check: make sure $ELP runs
+eval \"$ELP\" 0 > $NUL 2>&1
 if test ! "x${ret}" = "x0" ; then
     $ECHO
     $ECHO "ERROR:  ELP does not seem to work as expected"
@@ -672,7 +679,7 @@
 
 
 # if expr works, let the user know about how long this might take
-if test "x`expr 1 - 1 2>/dev/null`" = "x0" ; then
+if test "x`expr 1 - 1 2>$NUL`" = "x0" ; then
     mintime="`expr 6 \* $TIMEFRAME`"
     if test $mintime -lt 1 ; then
        mintime=0 # zero is okay
@@ -860,13 +867,13 @@
     if test "x$sqrt_number" = "x" ; then
        $ECHO "ERROR: cannot compute the square root of nothing" 1>&2
        exit 1
-    elif test $sqrt_number -lt 0 > /dev/null 2>&1 ; then
+    elif test $sqrt_number -lt 0 > $NUL 2>&1 ; then
        $ECHO "ERROR: square root of negative numbers is only in your 
imagination" 1>&2
        exit 1
     fi
 
     sqrt_have_dc=yes
-    echo "1 1 + p" | dc >/dev/null 2>&1
+    echo "1 1 + p" | dc >$NUL 2>&1
     if test ! x$? = x0 ; then
        sqrt_have_dc=no
     fi
@@ -876,7 +883,7 @@
        sqrt_root=`echo "$sqrt_number v p" | dc`
     else
        sqrt_have_bc=yes
-       echo "1 + 1" | bc >/dev/null 2>&1
+       echo "1 + 1" | bc >$NUL 2>&1
        if test ! "x$?" = "x0" ; then
            sqrt_have_bc=no
        fi
@@ -1226,13 +1233,13 @@
 
     # see if we have a calculator
     perf_have_dc=yes
-    echo "1 1 + p" | dc >/dev/null 2>&1
+    echo "1 1 + p" | dc >$NUL 2>&1
     if test ! x$? = x0 ; then
        perf_have_dc=no
     fi
 
     perf_have_bc=yes
-    echo "1 + 1" | bc >/dev/null 2>&1
+    echo "1 + 1" | bc >$NUL 2>&1
     if test ! x$? = x0 ; then
        perf_have_bc=no
     fi

Index: brlcad/branches/RELEASE/doc
===================================================================
--- brlcad/branches/RELEASE/doc 2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/doc 2020-09-10 02:08:29 UTC (rev 77097)

Property changes on: brlcad/branches/RELEASE/doc
___________________________________________________________________
Modified: svn:mergeinfo
## -7,4 +7,4 ##
 /brlcad/branches/osg/doc:62110-62113
 /brlcad/branches/prep-cache/doc:68236-68933
 /brlcad/branches/tcltk86/doc:68300-75257
-/brlcad/trunk/doc:76645-76726,76795-76858,76862-76954,76980-76991,77032-77065
\ No newline at end of property
+/brlcad/trunk/doc:76645-76726,76795-76858,76862-76954,76980-76991,77032-77065,77078-77096
\ No newline at end of property
Modified: brlcad/branches/RELEASE/doc/docbook/system/man3/CMakeLists.txt
===================================================================
--- brlcad/branches/RELEASE/doc/docbook/system/man3/CMakeLists.txt      
2020-09-10 00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/doc/docbook/system/man3/CMakeLists.txt      
2020-09-10 02:08:29 UTC (rev 77097)
@@ -5,6 +5,7 @@
   librt.xml
   libwdb.xml
   redblack.xml
+  libicv.xml
   )
 
 # Some DocBook man pages generate multiple output files, if they

Copied: brlcad/branches/RELEASE/doc/docbook/system/man3/libicv.xml (from rev 
77096, brlcad/trunk/doc/docbook/system/man3/libicv.xml)
===================================================================
--- brlcad/branches/RELEASE/doc/docbook/system/man3/libicv.xml                  
        (rev 0)
+++ brlcad/branches/RELEASE/doc/docbook/system/man3/libicv.xml  2020-09-10 
02:08:29 UTC (rev 77097)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- lifted from troff+man by doclifter -->
+<refentry xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en' 
xml:id='librt3'>
+<refmeta>
+    <refentrytitle>LIBICV
+</refentrytitle>
+<manvolnum>3</manvolnum>
+<refmiscinfo class='source'>BRL-CAD</refmiscinfo>
+<refmiscinfo class='manual'>BRL-CAD</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>libicv</refname>
+<refpurpose>library for image processing in BRL-CAD</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv xml:id='synopsis'>
+<para>This file seems to be out of date with the sources.
+Consult the headers for up-to-date information.
+Use the below interface documentation at your own discretion.
+</para>
+</refsynopsisdiv>
+
+<refsect1 xml:id='bug_reports'><title>BUG REPORTS</title>
+<para>Reports of bugs or problems should be submitted via electronic
+mail to <email>[email protected]</email></para>
+</refsect1>
+</refentry>

Modified: brlcad/branches/RELEASE/doc/docbook/system/mann/search.xml
===================================================================
--- brlcad/branches/RELEASE/doc/docbook/system/mann/search.xml  2020-09-10 
00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/doc/docbook/system/mann/search.xml  2020-09-10 
02:08:29 UTC (rev 77097)
@@ -424,6 +424,14 @@
        </listitem>
       </varlistentry>
       <varlistentry>
+       <term><emphasis remap="B" role="bold">-size</emphasis> <emphasis 
remap="I">[&gt;/&lt;/=]size</emphasis></term>
+       <listitem>
+         <para>
+           True if the size of the object is within the range specified.  
NOTE:  for combs, extrudes, and other composite objects this filter considers 
<emphasis>only</emphasis> the object definition itself, not its related 
elements.
+         </para>
+       </listitem>
+      </varlistentry>
+      <varlistentry>
        <term><emphasis remap="B" role="bold">-stdattr</emphasis></term>
        <listitem>
          <para>

Modified: brlcad/branches/RELEASE/src/libgcv/plugins/vol/png_read.c
===================================================================
--- brlcad/branches/RELEASE/src/libgcv/plugins/vol/png_read.c   2020-09-10 
00:41:59 UTC (rev 77096)
+++ brlcad/branches/RELEASE/src/libgcv/plugins/vol/png_read.c   2020-09-10 
02:08:29 UTC (rev 77097)
@@ -30,67 +30,70 @@
 #include "wdb.h"
 
 struct png_read_opts{
-  int coloured;
+    int coloured;
 };
 
-static void create_opts(struct bu_opt_desc **opts_desc,
-                        void **dest_options_data)
+
+static void create_opts(struct bu_opt_desc **opts_desc, void 
**dest_options_data)
 {
-  struct png_read_opts *opts_data;
+    struct png_read_opts *opts_data;
 
-  bu_log("VOL_PLUGIN: entered create_opts()\n");
+    bu_log("VOL_PLUGIN: entered create_opts()\n");
 
-  BU_ALLOC(opts_data, struct png_read_opts);
-  *dest_options_data = opts_data;
-  *opts_desc = (struct bu_opt_desc *)bu_calloc(3, sizeof(struct bu_opt_desc), 
"options_desc");
+    BU_ALLOC(opts_data, struct png_read_opts);
+    *dest_options_data = opts_data;
+    *opts_desc = (struct bu_opt_desc *)bu_calloc(3, sizeof(struct 
bu_opt_desc), "options_desc");
 
-  opts_data->coloured = 0;
+    opts_data->coloured = 0;
 
-  BU_OPT((*opts_desc)[0], "c", "colored", NULL, bu_opt_bool,
-        &opts_data->coloured, "Check if it is coloured");
-  BU_OPT_NULL((*opts_desc)[1]);
+    BU_OPT((*opts_desc)[0], "c", "colored", NULL, bu_opt_bool,
+          &opts_data->coloured, "Check if it is coloured");
+    BU_OPT_NULL((*opts_desc)[1]);
 }
 
+
 static void free_opts(void *options_data)
 {
-  bu_log("VOL_PLUGIN: entered free_opts()\n");
+    bu_log("VOL_PLUGIN: entered free_opts()\n");
 
-  bu_free(options_data, "options_data");
+    bu_free(options_data, "options_data");
 }
 
-static int png_read(struct gcv_context *context,
-                    const struct gcv_opts *UNUSED(gcv_options),
-                    const void *options_data, const char *source_path)
+
+static int png_read(struct gcv_context *context, const struct gcv_opts 
*UNUSED(gcv_options), const void *options_data, const char *source_path)
 {
-  const point_t center = {0.0, 0.0, 0.0};
-  const fastf_t radius = 1.0;
+    const point_t center = {0.0, 0.0, 0.0};
+    const fastf_t radius = 1.0;
 
-  const struct png_read_opts *opts = (struct png_read_opts *)options_data;
+    const struct png_read_opts *opts = (struct png_read_opts *)options_data;
 
-  bu_log("importing from PNG file '%s'\n", source_path);
-  bu_log("image is coloured: %s\n", opts->coloured ? "True" : "False");
+    bu_log("importing from PNG file '%s'\n", source_path);
+    bu_log("image is coloured: %s\n", opts->coloured ? "True" : "False");
 
-  mk_id(context->dbip->dbi_wdbp, "GCV plugin test");
+    mk_id(context->dbip->dbi_wdbp, "GCV plugin test");
 
-  mk_sph(context->dbip->dbi_wdbp, "test", center, radius);
+    mk_sph(context->dbip->dbi_wdbp, "test", center, radius);
 
-  return 1;
+    return 1;
 }
 
+
 HIDDEN int png_can_read(const char * data)
 {
-  bu_log("VOL_PLUGIN: entered png_can_read, data=%p\n", (void *)data);
+    bu_log("VOL_PLUGIN: entered png_can_read, data=%p\n", (void *)data);
 
-  if (!data)
-    return 0;
-  return 1;
+    if (!data)
+       return 0;
+    return 1;
 }
 
+
 const struct gcv_filter gcv_conv_png_read = {
-  "PNG Reader", GCV_FILTER_READ, BU_MIME_MODEL_UNKNOWN, png_can_read,
-  create_opts, free_opts, png_read
+    "PNG Reader", GCV_FILTER_READ, BU_MIME_MODEL_UNKNOWN, png_can_read,
+    create_opts, free_opts, png_read
 };
 
+
 static const struct gcv_filter * const filters[] = {&gcv_conv_png_read, NULL};
 
 const struct gcv_plugin gcv_plugin_info_s = {filters};
@@ -97,9 +100,10 @@
 
 COMPILER_DLLEXPORT const struct gcv_plugin *gcv_plugin_info()
 {
-  return &gcv_plugin_info_s;
+    return &gcv_plugin_info_s;
 }
 
+
 /*
  * Local Variables:
  * tab-width: 8

Modified: brlcad/branches/RELEASE/src/libged/TODO
===================================================================
--- brlcad/branches/RELEASE/src/libged/TODO     2020-09-10 00:41:59 UTC (rev 
77096)
+++ brlcad/branches/RELEASE/src/libged/TODO     2020-09-10 02:08:29 UTC (rev 
77097)
@@ -175,6 +175,18 @@
   default to a view-oriented "underlay" but permanently stored in the
   .g file as a proper image object (top-level TODO entry).
 
+* 'gsort' or 'tables' or 'filter' command.  Distinction is that this
+  comamnd is object-aware and can process geometry by name in a given
+  column or list.  This way, one could sort output from search, nirt,
+  idents, and other table/list-based commands. Examples:
+
+  Sort by data size: [gsort -size [search .]])
+  Reverse sort of col4 by vol: [gsort -volume -k4 -r [search .]])
+
+  Desirable to intentionally pattern after POSIX sort
+  (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html),
+  adding geometry extensions similar to BSD sort(1).
+
 * 'layer' command: to create, select, delete, list enable/disable
   on/off, lock/unlock, and set other properties (e.g., color, style).
   need subcommand(s) to move geometry to/from layers, perhaps
@@ -358,10 +370,6 @@
      simulate -k 1.0  # simulate 1s of gravity, overwriting original
      simulate -G -f 1 2 3 .4 5  # no gravity, custom force, 5s
 
-* 'tables' command: do not call system() on the "sort" unix command!
-  It should perform all sorting on the data directly in memory, at
-  least without creating another process.  bad security practice.
-
 * 'text' command: imports a text file (as geometry).  have options to
   specify the spacing between lines, first line, #lines,
   underline/overline each line, convert to all upper/lower, position.

Modified: brlcad/branches/RELEASE/src/librt/search.c
===================================================================
--- brlcad/branches/RELEASE/src/librt/search.c  2020-09-10 00:41:59 UTC (rev 
77096)
+++ brlcad/branches/RELEASE/src/librt/search.c  2020-09-10 02:08:29 UTC (rev 
77097)
@@ -132,6 +132,7 @@
     { "-path",      N_PATH,         c_path,         O_ARGV },
     { "-print",     N_PRINT,        c_print,        O_ZERO },
     { "-regex",     N_REGEX,        c_regex,        O_ARGV },
+    { "-size",      N_SIZE,         c_size,         O_ARGV },
     { "-stdattr",   N_STDATTR,      c_stdattr,      O_ZERO },
     { "-type",      N_TYPE,         c_type,        O_ARGV },
 };
@@ -1155,6 +1156,81 @@
 
 
 /*
+ * -size function --
+ *
+ * True if the database object being examined satisfies
+ * the size criteria: [><=]size
+ */
+HIDDEN int
+f_size(struct db_plan_t *plan, struct db_node_t *db_node, struct db_i 
*UNUSED(dbip), struct bu_ptbl *UNUSED(results))
+{
+    struct directory *dp;
+    int ret = 0;
+    int checkval = 0;
+    struct bu_vls name = BU_VLS_INIT_ZERO;
+    struct bu_vls value = BU_VLS_INIT_ZERO;
+
+    dp = DB_FULL_PATH_CUR_DIR(db_node->path);
+    if (!dp) return 0;
+
+    /* Check for unescaped >, < or = characters.  If present, the
+     * attribute must not only be present but the value assigned to
+     * the attribute must satisfy the logical expression.  In the case
+     * where a > or < is used with a string argument the behavior will
+     * follow ASCII lexicographical order.  In the case of equality
+     * between strings, fnmatch is used to support pattern matching
+     */
+
+    checkval = string_to_name_and_val(plan->p_un._depth_data, &name, &value);
+
+    if ((bu_vls_strlen(&value) > 0 && isdigit((int)bu_vls_addr(&value)[0]))
+       || (bu_vls_strlen(&value) == 0 && isdigit((int)bu_vls_addr(&name)[0]))) 
{
+       switch (checkval) {
+           case 0:
+               ret = ((int)dp->d_len == atol(bu_vls_addr(&name))) ? 1 : 0;
+               break;
+           case 1:
+               ret = ((int)dp->d_len == atol(bu_vls_addr(&value))) ? 1 : 0;
+               break;
+           case 2:
+               ret = ((int)dp->d_len > atol(bu_vls_addr(&value))) ? 1 : 0;
+               break;
+           case 3:
+               ret = ((int)dp->d_len < atol(bu_vls_addr(&value))) ? 1 : 0;
+               break;
+           case 4:
+               ret = ((int)dp->d_len >= atol(bu_vls_addr(&value))) ? 1 : 0;
+               break;
+           case 5:
+               ret = ((int)dp->d_len <= atol(bu_vls_addr(&value))) ? 1 : 0;
+               break;
+           default:
+               ret = 0;
+               break;
+       }
+    }
+    bu_vls_free(&name);
+    bu_vls_free(&value);
+
+    if (!ret) db_node->matched_filters = 0;
+    return ret;
+}
+
+
+HIDDEN int
+c_size(char *pattern, char ***UNUSED(ignored), int UNUSED(unused), struct 
db_plan_t **resultplan, int *UNUSED(db_search_isoutput), struct bu_ptbl *tbl, 
struct db_search_context *UNUSED(ctx))
+{
+    struct db_plan_t *newplan;
+
+    newplan = palloc(N_TYPE, f_size, tbl);
+    newplan->p_un._type_data = pattern;
+    (*resultplan) = newplan;
+
+    return BRLCAD_OK;
+}
+
+
+/*
  * -bool function --
  *
  * True if the boolean operation combining the object into the tree matches

Modified: brlcad/branches/RELEASE/src/librt/search.h
===================================================================
--- brlcad/branches/RELEASE/src/librt/search.h  2020-09-10 00:41:59 UTC (rev 
77096)
+++ brlcad/branches/RELEASE/src/librt/search.h  2020-09-10 02:08:29 UTC (rev 
77097)
@@ -77,7 +77,7 @@
     N_CLOSEPAREN, N_DEPTH, N_EXEC, N_EXECDIR, N_EXPR,
     N_FLAGS, N_INAME, N_IREGEX, N_LS, N_MAXDEPTH,
     N_MINDEPTH, N_NAME, N_NNODES, N_NOT, N_OK, N_OPENPAREN, N_OR, N_PATH,
-    N_PRINT, N_PRUNE, N_REGEX, N_STDATTR, N_TYPE, N_BOOL, N_PARAM
+    N_PRINT, N_PRUNE, N_REGEX, N_SIZE, N_STDATTR, N_TYPE, N_BOOL, N_PARAM
 };
 
 
@@ -168,6 +168,7 @@
 static int c_above(char *, char ***, int, struct db_plan_t **, int *, struct 
bu_ptbl *, struct db_search_context *);
 static int c_below(char *, char ***, int, struct db_plan_t **, int *, struct 
bu_ptbl *, struct db_search_context *);
 static int c_exec(char *, char ***, int, struct db_plan_t **, int *, struct 
bu_ptbl *, struct db_search_context *);
+static int c_size(char *, char ***, int, struct db_plan_t **, int *, struct 
bu_ptbl *, struct db_search_context *);
 
 __END_DECLS
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to