Revision: 77830
          http://sourceforge.net/p/brlcad/code/77830
Author:   starseeker
Date:     2020-11-30 15:50:27 +0000 (Mon, 30 Nov 2020)
Log Message:
-----------
Merge from trunk - r77783 through r77829

Modified Paths:
--------------
    brlcad/branches/extbuild/TODO
    brlcad/branches/extbuild/doc/docbook/system/mann/saveview.xml
    brlcad/branches/extbuild/doc/legal/embedded/fort.txt
    brlcad/branches/extbuild/doc/legal/embedded/sobolseq.txt
    brlcad/branches/extbuild/include/bn/vlist.h
    brlcad/branches/extbuild/include/bu/CMakeLists.txt
    brlcad/branches/extbuild/include/bu/defines.h
    brlcad/branches/extbuild/include/bu/list.h
    brlcad/branches/extbuild/include/bu/tbl.h
    brlcad/branches/extbuild/misc/CMake/BRLCAD_Targets.cmake
    brlcad/branches/extbuild/src/libbn/CMakeLists.txt
    brlcad/branches/extbuild/src/libbn/plot3.c
    brlcad/branches/extbuild/src/libbn/soboldata.h
    brlcad/branches/extbuild/src/libbn/tabdata.c
    brlcad/branches/extbuild/src/libbn/tests/vlist.c
    brlcad/branches/extbuild/src/libbn/vlist.c
    brlcad/branches/extbuild/src/libbu/CMakeLists.txt
    brlcad/branches/extbuild/src/libbu/color.cpp
    brlcad/branches/extbuild/src/libbu/interrupt.c
    brlcad/branches/extbuild/src/libbu/parse.c
    brlcad/branches/extbuild/src/libbu/sscanf.c
    brlcad/branches/extbuild/src/libbu/y2038/time64.c
    brlcad/branches/extbuild/src/libgcv/plugins/asc/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/fastgen4/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/gdal/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/obj/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/stl/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/vol/CMakeLists.txt
    brlcad/branches/extbuild/src/libgcv/plugins/vrml/CMakeLists.txt
    brlcad/branches/extbuild/src/mged/dodraw.c

Added Paths:
-----------
    brlcad/branches/extbuild/include/bu/assert.h
    brlcad/branches/extbuild/src/libbn/sobol.c
    brlcad/branches/extbuild/src/libbu/fort.c
    brlcad/branches/extbuild/src/libbu/fort.h
    brlcad/branches/extbuild/src/libbu/tbl.c

Removed Paths:
-------------
    brlcad/branches/extbuild/src/libbn/sobolseq.c

Property Changed:
----------------
    brlcad/branches/extbuild/
    brlcad/branches/extbuild/doc/
    brlcad/branches/extbuild/include/
    brlcad/branches/extbuild/src/libbu/

Index: brlcad/branches/extbuild
===================================================================
--- brlcad/branches/extbuild    2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild    2020-11-30 15:50:27 UTC (rev 77830)

Property changes on: brlcad/branches/extbuild
___________________________________________________________________
Modified: svn:mergeinfo
## -11,4 +11,4 ##
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
 /brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:77547-77783
\ No newline at end of property
+/brlcad/trunk:77547-77829
\ No newline at end of property
Modified: brlcad/branches/extbuild/TODO
===================================================================
--- brlcad/branches/extbuild/TODO       2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/TODO       2020-11-30 15:50:27 UTC (rev 77830)
@@ -18,6 +18,10 @@
 THESE TASKS SHOULD HAPPEN BEFORE THE NEXT RELEASE
 -------------------------------------------------
 
+* MGED asynchronous subprocess management appears to be broken with
+  both mged -c and gui mode on Mac.  MGED is blocking when running
+  "rt" command until after the framebuffer window is closed.
+
 * Update libgcv plugin installation location - now that its
   available, they belong with the other plugins in libexec
 

Index: brlcad/branches/extbuild/doc
===================================================================
--- brlcad/branches/extbuild/doc        2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/doc        2020-11-30 15:50:27 UTC (rev 77830)

Property changes on: brlcad/branches/extbuild/doc
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
 /brlcad/branches/osg/doc:62110-62113
 /brlcad/branches/prep-cache/doc:68236-68933
 /brlcad/branches/tcltk86/doc:68300-75257
-/brlcad/trunk/doc:77547-77659
\ No newline at end of property
+/brlcad/trunk/doc:77547-77659,77784-77829
\ No newline at end of property
Modified: brlcad/branches/extbuild/doc/docbook/system/mann/saveview.xml
===================================================================
--- brlcad/branches/extbuild/doc/docbook/system/mann/saveview.xml       
2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/doc/docbook/system/mann/saveview.xml       
2020-11-30 15:50:27 UTC (rev 77830)
@@ -98,10 +98,10 @@
   <example><title>Save current viewing parameters in a specified file in the 
form of a shell script to run the BRL-CAD         <emphasis>rt</emphasis> 
program.</title>
 
     <para>
-      <prompt>mged&gt;</prompt><userinput>rt_script -s1024</userinput>
+      <prompt>mged&gt;</prompt><userinput>saveview script.rt -s1024</userinput>
     </para>
-    <para>Creates (or appends to) a file named <emphasis>rt_script</emphasis> 
that will contain a script to run        the <emphasis>rt</emphasis> program 
and create a color-shaded image of the current MGED display. The image
-       produced will be 1024 pixels square.
+    <para>Creates (or appends to) a file named <emphasis>script.rt</emphasis> 
that will contain a POSX shell script for running the <emphasis>rt</emphasis> 
program and create a color-shaded image of the current MGED display. The image
+         produced will be 1024 pixels square due to the additional 
<option>-s1024</option> arg specified after the script name.  Additional args 
are passed to <emphasis>rt</emphasis>.
     </para>
   </example>
 

Modified: brlcad/branches/extbuild/doc/legal/embedded/fort.txt
===================================================================
--- brlcad/branches/extbuild/doc/legal/embedded/fort.txt        2020-11-30 
15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/doc/legal/embedded/fort.txt        2020-11-30 
15:50:27 UTC (rev 77830)
@@ -22,5 +22,7 @@
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 
+file:/src/libbu/fort.c
+file:/src/libbu/fort.h
 file:/src/libged/stat/fort.c
 file:/src/libged/stat/fort.h

Modified: brlcad/branches/extbuild/doc/legal/embedded/sobolseq.txt
===================================================================
--- brlcad/branches/extbuild/doc/legal/embedded/sobolseq.txt    2020-11-30 
15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/doc/legal/embedded/sobolseq.txt    2020-11-30 
15:50:27 UTC (rev 77830)
@@ -21,6 +21,6 @@
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-file:/src/libbn/sobolseq.c
+file:/src/libbn/sobol.c
 file:/src/libbn/soboldata.h
 file:/src/libbn/tests/sobolseq.c

Index: brlcad/branches/extbuild/include
===================================================================
--- brlcad/branches/extbuild/include    2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/include    2020-11-30 15:50:27 UTC (rev 77830)

Property changes on: brlcad/branches/extbuild/include
___________________________________________________________________
Modified: svn:mergeinfo
## -10,4 +10,4 ##
 /brlcad/branches/osg/include:62110-62113
 /brlcad/branches/prep-cache/include:68236-68933
 /brlcad/branches/tcltk86/include:68300-75257
-/brlcad/trunk/include:77660-77699
\ No newline at end of property
+/brlcad/trunk/include:77660-77699,77784-77829
\ No newline at end of property
Modified: brlcad/branches/extbuild/include/bn/vlist.h
===================================================================
--- brlcad/branches/extbuild/include/bn/vlist.h 2020-11-30 15:45:42 UTC (rev 
77829)
+++ brlcad/branches/extbuild/include/bn/vlist.h 2020-11-30 15:50:27 UTC (rev 
77830)
@@ -182,7 +182,7 @@
 
 
 BN_EXPORT extern size_t bn_vlist_cmd_cnt(struct bn_vlist *vlist);
-BN_EXPORT extern int bn_vlist_bbox(struct bu_list *vlistp, point_t *bmin, 
point_t *bmax, int *length);
+BN_EXPORT extern int bn_vlist_bbox(struct bu_list *vlistp, point_t *bmin, 
point_t *bmax, size_t *length);
 
 
 

Modified: brlcad/branches/extbuild/include/bu/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/include/bu/CMakeLists.txt  2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/include/bu/CMakeLists.txt  2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -1,5 +1,6 @@
 set(bu_headers
   app.h
+  assert.h
   avs.h
   bitv.h
   cmd.h

Copied: brlcad/branches/extbuild/include/bu/assert.h (from rev 77829, 
brlcad/trunk/include/bu/assert.h)
===================================================================
--- brlcad/branches/extbuild/include/bu/assert.h                                
(rev 0)
+++ brlcad/branches/extbuild/include/bu/assert.h        2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -0,0 +1,68 @@
+/*                       A S S E R T . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/** @addtogroup bu_defines */
+/** @{ */
+
+#ifndef BU_ASSERT_H
+#define BU_ASSERT_H
+
+#include "common.h"
+
+#include "bu/defines.h"
+#include "bu/log.h"
+#include "bu/exit.h"
+
+
+/**
+ * @def BU_ASSERT(expression)
+ * @brief Alternative for assert(3) that calls LIBBU logging+bombing.
+ *
+ * This is a simple macro wrapper that logs an assertion-failure error
+ * message and aborts application execution if the specified
+ * expression is not hold true.  While it is similar in use, this
+ * wrapper does not utilize assert(3) or NDEBUG but is disabled if
+ * NO_BOMBING_MACROS is defined by the configuration.
+ */
+#ifdef NO_BOMBING_MACROS
+#  define BU_ASSERT(expression_) (void)(equation_)
+#else
+#  define BU_ASSERT(expression_)       \
+    if (UNLIKELY(!(expression_))) { \
+       const char *expression_buf_ = #expression_; \
+       bu_log("BU_ASSERT(%s) failure in file %s, line %d\n", \
+              expression_buf_, __FILE__, __LINE__); \
+       bu_bomb("BU_ASSERT FAILED\n"); \
+    }
+#endif
+
+/** @} */
+
+#endif  /* BU_ASSERT_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */

Modified: brlcad/branches/extbuild/include/bu/defines.h
===================================================================
--- brlcad/branches/extbuild/include/bu/defines.h       2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/include/bu/defines.h       2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -198,25 +198,6 @@
 #define BU_FORTRAN(lc, uc) lc ## _
 
 
-/**
- * @def BU_ASSERT(eqn)
- * Quick and easy macros to generate an informative error message and
- * abort execution if the specified condition does not hold true.
- *
- */
-#ifdef NO_BOMBING_MACROS
-#  define BU_ASSERT(_equation) (void)(_equation)
-#else
-#  define BU_ASSERT(_equation) \
-    if (UNLIKELY(!(_equation))) { \
-       const char *_equation_buf = #_equation; \
-       bu_log("BU_ASSERT(%s), failed, file %s, line %d\n", \
-              _equation_buf, __FILE__, __LINE__); \
-       bu_bomb("BU_ASSERT failure\n"); \
-    }
-#endif
-
-
 /** @} */
 
 #endif  /* BU_DEFINES_H */

Modified: brlcad/branches/extbuild/include/bu/list.h
===================================================================
--- brlcad/branches/extbuild/include/bu/list.h  2020-11-30 15:45:42 UTC (rev 
77829)
+++ brlcad/branches/extbuild/include/bu/list.h  2020-11-30 15:50:27 UTC (rev 
77830)
@@ -24,6 +24,7 @@
 #include "common.h"
 
 #include "bu/defines.h"
+#include "bu/assert.h"
 #include "bu/magic.h"
 
 __BEGIN_DECLS

Modified: brlcad/branches/extbuild/include/bu/tbl.h
===================================================================
--- brlcad/branches/extbuild/include/bu/tbl.h   2020-11-30 15:45:42 UTC (rev 
77829)
+++ brlcad/branches/extbuild/include/bu/tbl.h   2020-11-30 15:50:27 UTC (rev 
77830)
@@ -45,7 +45,7 @@
  @code
  double vals[16] = {-1.123123123123, 0, 0, 1.0/0.0, 0, 123, 0, 0, 0, -2345, 
123123.123123123123, 0, 123123123.123123123, 21, 1.0/0.0, 1};
 
- bu_num_print
+
  bu_num_print(vals, 16, 4, "my matrix\n[\n", "\t[", NULL, ", ", "]\n", 
"]\n]\n");
  
-------------------------------------------------------------------------------
 my matrix
@@ -87,95 +87,105 @@
  */
 
 
-struct bu_tbl_style {
-    const char *before_tbl;
-    const char *before_row;
-    const char *before_col;
-    const char *before_elm;
-    const char *format_scan;
-    const char *format_print;
-    const char *after_elm;
-    const char *after_col;
-    const char *after_row;
-    const char *after_tbl;
-};
+struct bu_tbl;
 
 
 /**
- * set what to print at the beginning and end of the table.
- *
- * defaults: before="" after=""
+ * static-initializer for bu_tbl objects on the stack
  */
-BU_EXPORT extern struct bu_tbl_style *
-bu_tbl_style_tbl(struct bu_tbl_style *s, const char *before, const char 
*after);
+#define BU_TBL_INIT_ZERO {0}
 
 /**
- * set what to print before and after each table row and how many rows
- * to display.
- *
- * defaults: before="" after="" maxrows=-1 (unlimited)
+ * always returns a pointer to a newly allocated table
  */
-BU_EXPORT extern struct bu_tbl_style *
-bu_tbl_style_row(struct bu_tbl_style *s, const char *before, const char 
*after, size_t maxrows);
+BU_EXPORT extern struct bu_tbl *
+bu_tbl_create();
 
+
 /**
- * set what to print before and after each table column and how many
- * columns to display.
- *
- * defaults: before="" after="" maxcols=1
+ * releases all dynamic memory associated with the specified table
  */
-BU_EXPORT extern struct bu_tbl_style *
-bu_tbl_style_col(struct bu_tbl_style *s, const char *before, const char 
*after, size_t maxcols);
+BU_EXPORT extern void
+bu_tbl_destroy(struct bu_tbl *);
 
+
 /**
- * set what to print before and after each table element.
- *
- * defaults: before="" after=""
+ * erases all cells in a table, but doesn't erase the table itself
  */
-BU_EXPORT extern struct bu_tbl_style *
-bu_tbl_style_elm(struct bu_tbl_style *s, const char *before, const char 
*after);
+BU_EXPORT extern int
+bu_tbl_clear(struct bu_tbl *);
 
+
+enum bu_tbl_style {
+    /* table border style */
+    BU_TBL_STYLE_NONE,
+    BU_TBL_STYLE_BASIC,
+    BU_TBL_STYLE_SIMPLE,
+    BU_TBL_STYLE_SINGLE,
+    BU_TBL_STYLE_DOUBLE,
+
+    /* table alignment */
+    BU_TBL_ALIGN_LEFT,
+    BU_TBL_ALIGN_CENTER,
+    BU_TBL_ALIGN_RIGHT,
+
+    /* cell styling */
+    BU_TBL_ROW_HEADER,
+
+    /* insert a horizontal separator */
+    BU_TBL_ROW_SEPARATOR,
+
+    /* cell alignment */
+    BU_TBL_ROW_ALIGN_LEFT,
+    BU_TBL_ROW_ALIGN_CENTER,
+    BU_TBL_ROW_ALIGN_RIGHT,
+    BU_TBL_COL_ALIGN_LEFT,
+    BU_TBL_COL_ALIGN_CENTER,
+    BU_TBL_COL_ALIGN_RIGHT,
+
+    /* go to next row beginning */
+    BU_TBL_ROW_END
+};
+
+
 /**
- * set scanf-style and printf-style format specifiers to use reading
- * and displaying table elements respectively
- *
- * defaults: scan="%lf" print="%.17g"
+ * sets table styling or formatting on cells printed next.
  */
-BU_EXPORT extern struct bu_tbl_style *
-bu_tbl_style_fmt(struct bu_tbl_style *s, const char *scan, const char *print);
+BU_EXPORT extern struct bu_tbl *
+bu_tbl_style(struct bu_tbl *, enum bu_tbl_style);
 
 
-
 /**
- *
- @code
-struct bu_tbl_style s = BU_TBL_STYLE_INIT_ZERO;
-bu_tbl_style_tbl(&s, "MATRIX [", "]\n");
-bu_tbl_style_row(&s, "\t[", "]\n");
-bu_tbl_print(s, vals, nvals, ncols);
- @endcode
+ * set cell position of the current table insertion point.
  */
+BU_EXPORT extern struct bu_tbl *
+bu_tbl_go_to(struct bu_tbl *, size_t row, size_t col);
 
 
 /**
- * format a set of data into a given vls string
+ * get cell position for the current table insertion point.
  */
-BU_EXPORT extern void
-bu_tbl_vls(struct bu_vls *str, const struct bu_tbl_style *s, const double 
*vals, size_t nvals, size_t ncols);
+BU_EXPORT extern struct bu_tbl *
+bu_tbl_is_at(struct bu_tbl *, size_t *row, size_t *col);
 
 
 /**
- * format a set of data into a given vls string
+ * print values into the table at the current insertion point.
+ *
+ * each column of the 'fmt' printf-style format specfier must be
+ * delimited by a '|' character.
+ *
+ * any existing values will be overwritten.
  */
-BU_EXPORT extern void
-bu_tbl_str(char *str, size_t maxlen, const struct bu_tbl_style *s, const 
double *vals, size_t nvals, size_t ncols);
+BU_EXPORT extern struct bu_tbl *
+bu_tbl_printf(struct bu_tbl *, const char *fmt, ...);
 
 
 /**
- * format a set of data and print them to the given file descriptor
+ * print a table into a vls
  */
 BU_EXPORT extern void
-bu_tbl_print(int fd, const struct bu_tbl_style *s, const void *elms, size_t 
nelms, size_t selms);
+bu_tbl_vls(struct bu_vls *str, const struct bu_tbl *t);
 
 
 __END_DECLS

Modified: brlcad/branches/extbuild/misc/CMake/BRLCAD_Targets.cmake
===================================================================
--- brlcad/branches/extbuild/misc/CMake/BRLCAD_Targets.cmake    2020-11-30 
15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/misc/CMake/BRLCAD_Targets.cmake    2020-11-30 
15:50:27 UTC (rev 77830)
@@ -49,9 +49,9 @@
   if(ENABLE_ALL_CXX_COMPILE)
     foreach(srcfile ${SRC_FILES})
       if(NOT "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}" MATCHES "src/other")
-       if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
-         set_source_files_properties(${srcfile} PROPERTIES LANGUAGE CXX)
-       endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
+             if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
+               set_source_files_properties(${srcfile} PROPERTIES LANGUAGE CXX)
+             endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
       endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}" MATCHES "src/other")
     endforeach(srcfile ${SRC_FILES})
   endif(ENABLE_ALL_CXX_COMPILE)
@@ -66,12 +66,12 @@
     set(fullpath_srcslist)
     foreach(srcfile ${srcslist})
       if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
-       get_property(IGNORE_FILE SOURCE ${srcfile} PROPERTY EXTERNAL)
-       if(IGNORE_FILE)
-         message("Note: skipping style validation on external file ${srcfile}")
-       else(IGNORE_FILE)
-         set(fullpath_srcslist ${fullpath_srcslist} 
"${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
-       endif(IGNORE_FILE)
+             get_property(IGNORE_FILE SOURCE ${srcfile} PROPERTY EXTERNAL)
+             if(IGNORE_FILE)
+               message("Note: skipping style validation on external file 
${srcfile}")
+             else(IGNORE_FILE)
+               set(fullpath_srcslist ${fullpath_srcslist} 
"${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
+             endif(IGNORE_FILE)
       endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${srcfile}")
     endforeach(srcfile ${srcslist})
 
@@ -78,12 +78,12 @@
     # If we have a list that isn't empty, use it
     if(fullpath_srcslist)
       add_custom_command(
-       TARGET ${targetname} PRE_LINK
-       COMMAND "${ASTYLE_EXECUTABLE}" --report 
--options=${BRLCAD_SOURCE_DIR}/misc/astyle.opt ${fullpath_srcslist}
-       COMMENT "Checking formatting of ${targetname} srcs"
-       )
+             TARGET ${targetname} PRE_LINK
+             COMMAND "${ASTYLE_EXECUTABLE}" --report 
--options=${BRLCAD_SOURCE_DIR}/misc/astyle.opt ${fullpath_srcslist}
+             COMMENT "Checking formatting of ${targetname} srcs"
+             )
       if(TARGET astyle)
-       add_dependencies(${targetname} astyle)
+             add_dependencies(${targetname} astyle)
       endif(TARGET astyle)
     endif(fullpath_srcslist)
 
@@ -115,8 +115,8 @@
     while(NOT "${f_ext}" STREQUAL "")
       get_filename_component(f_ext ${f_ext} EXT)
       if(f_ext)
-       set(srcfile_ext ${f_ext})
-       string(SUBSTRING "${f_ext}" 1 -1 f_ext)
+             set(srcfile_ext ${f_ext})
+             string(SUBSTRING "${f_ext}" 1 -1 f_ext)
       endif(f_ext)
     endwhile(NOT "${f_ext}" STREQUAL "")
 
@@ -164,13 +164,13 @@
 
       # Get all the flags from all the associated libraries
       foreach(libitem ${target_libs})
-       get_property(ITEM_FLAGS GLOBAL PROPERTY ${libitem}_${lang}_FLAGS)
-       list(APPEND T_FLAGS ${${libitem}_${lang}_FLAGS})
+             get_property(ITEM_FLAGS GLOBAL PROPERTY ${libitem}_${lang}_FLAGS)
+             list(APPEND T_FLAGS ${${libitem}_${lang}_FLAGS})
       endforeach(libitem ${target_libs})
 
       # If we've got anything, scrub down to unique entries
       if(T_FLAGS)
-       list(REMOVE_DUPLICATES T_FLAGS)
+             list(REMOVE_DUPLICATES T_FLAGS)
       endif(T_FLAGS)
 
       # Put the results back into the global target
@@ -178,10 +178,10 @@
 
       # Set the language specific flag variables
       if("${slang}" STREQUAL "C")
-       set(T_C_FLAGS "${T_FLAGS}")
+             set(T_C_FLAGS "${T_FLAGS}")
       endif("${slang}" STREQUAL "C")
       if("${slang}" STREQUAL "CXX")
-       set(T_CXX_FLAGS "${T_FLAGS}")
+             set(T_CXX_FLAGS "${T_FLAGS}")
       endif("${slang}" STREQUAL "CXX")
 
     endforeach(slang ${FLAG_LANGUAGES})
@@ -220,8 +220,9 @@
 
 # Determine the language for a target
 
-# For simplicity, always set compile definitions and compile flags on files 
rather
-# than build targets (less logic, simplifies dealing with OBJECT libraries.)
+# For simplicity, always set compile definitions and compile flags on
+# files rather than build targets (less logic, simplifies dealing with
+# OBJECT libraries.)
 function(SET_FLAGS_AND_DEFINITIONS srcslist)
 
   cmake_parse_arguments(S "NO_STRICT_CXX" "TARGET" "CFLAGS;CXXFLAGS;DEFINES" 
${ARGN})
@@ -233,7 +234,7 @@
     set(W_DEFINES ${S_DEFINES})
     if(W_DEFINES)
       foreach(df ${E_DEFINES})
-       list(REMOVE_ITEM W_DEFINES ${df})
+             list(REMOVE_ITEM W_DEFINES ${df})
       endforeach(df ${E_DEFINES})
     endif(W_DEFINES)
 
@@ -252,26 +253,26 @@
       get_property(E_CFLAGS SOURCE ${srcfile} PROPERTY COMPILE_FLAGS)
       set(W_CFLAGS ${S_CFLAGS})
       if(W_CFLAGS)
-       foreach(df ${E_CFLAGS})
-         list(REMOVE_ITEM W_CFLAGS ${df})
-       endforeach(df ${E_CFLAGS})
+             foreach(df ${E_CFLAGS})
+               list(REMOVE_ITEM W_CFLAGS ${df})
+             endforeach(df ${E_CFLAGS})
       endif(W_CFLAGS)
 
       foreach(tflag ${W_CFLAGS})
-       set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "${tflag}")
+             set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"${tflag}")
       endforeach(tflag ${W_CFLAGS})
 
       # Handle inline definition for C files only
       if(NOT "${C_INLINE}" STREQUAL "inline")
-       list(FIND E_DEFINES "inline=${C_INLINE}" HAVE_INLINE_DEF)
-       if("${HAVE_INLINE_DEF}" EQUAL -1)
-         set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_DEFINITIONS 
"inline=${C_INLINE}")
-       endif("${HAVE_INLINE_DEF}" EQUAL -1)
+             list(FIND E_DEFINES "inline=${C_INLINE}" HAVE_INLINE_DEF)
+             if("${HAVE_INLINE_DEF}" EQUAL -1)
+               set_property(SOURCE ${srcfile} APPEND PROPERTY 
COMPILE_DEFINITIONS "inline=${C_INLINE}")
+             endif("${HAVE_INLINE_DEF}" EQUAL -1)
       endif(NOT "${C_INLINE}" STREQUAL "inline")
 
       # Handle disabling of strict compilation if target requires that
       if(S_NO_STRICT AND NOERROR_FLAG AND BRLCAD_ENABLE_STRICT)
-       set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"-Wno-error")
+             set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"-Wno-error")
       endif(S_NO_STRICT AND NOERROR_FLAG AND BRLCAD_ENABLE_STRICT)
 
     endif("${file_language}" STREQUAL "C")
@@ -283,18 +284,18 @@
       get_property(E_CXXFLAGS SOURCE ${srcfile} PROPERTY COMPILE_FLAGS)
       set(W_CXXFLAGS ${S_CXXFLAGS})
       if(W_CXXFLAGS)
-       foreach(df ${E_CXXFLAGS})
-         list(REMOVE_ITEM W_CXXFLAGS ${df})
-       endforeach(df ${E_CXXFLAGS})
+             foreach(df ${E_CXXFLAGS})
+               list(REMOVE_ITEM W_CXXFLAGS ${df})
+             endforeach(df ${E_CXXFLAGS})
       endif(W_CXXFLAGS)
 
       foreach(tflag ${W_CXXFLAGS})
-       set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS "${tflag}")
+             set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"${tflag}")
       endforeach(tflag ${W_CXXFLAGS})
 
       # Handle disabling of strict compilation if target requires that
       if( (S_NO_STRICT OR _S_NO_STRICT_CXX) AND NOERROR_FLAG_CXX AND 
BRLCAD_ENABLE_STRICT)
-       set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"-Wno-error")
+             set_property(SOURCE ${srcfile} APPEND PROPERTY COMPILE_FLAGS 
"-Wno-error")
       endif( (S_NO_STRICT OR _S_NO_STRICT_CXX) AND NOERROR_FLAG_CXX AND 
BRLCAD_ENABLE_STRICT)
 
     endif("${file_language}" STREQUAL "C++")
@@ -315,8 +316,9 @@
   # Go all C++ if the settings request it
   SET_LANG_CXX("${srcslist}")
 
-  # Add the executable.  If the caller indicates this is a GUI type executable,
-  # add the correct flag for Visual Studio building (where it matters)
+  # Add the executable.  If the caller indicates this is a GUI type
+  # executable, add the correct flag for Visual Studio building (where
+  # it matters)
   if(E_GUI)
     add_executable(${execname} WIN32 ${srcslist})
   else(E_GUI)
@@ -362,12 +364,12 @@
     # Unfortunately, we currently need Windows binaries in the same 
directories as their DLL libraries
     if(NOT WIN32 AND NOT E_TEST_USESDATA)
       if(NOT CMAKE_CONFIGURATION_TYPES)
-       set_target_properties(${execname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY 
"${CMAKE_CURRENT_BINARY_DIR}")
+             set_target_properties(${execname} PROPERTIES 
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
       else(NOT CMAKE_CONFIGURATION_TYPES)
-       foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-         string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
-         set_target_properties(${execname} PROPERTIES 
RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER} 
"${CMAKE_CURRENT_BINARY_DIR}/${CFG_TYPE}")
-       endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+             foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+               string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
+               set_target_properties(${execname} PROPERTIES 
RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER} 
"${CMAKE_CURRENT_BINARY_DIR}/${CFG_TYPE}")
+             endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
       endif(NOT CMAKE_CONFIGURATION_TYPES)
     endif(NOT WIN32 AND NOT E_TEST_USESDATA)
   else(E_NO_INSTALL OR E_TEST)
@@ -377,8 +379,8 @@
   endif(E_NO_INSTALL OR E_TEST)
 
 
-  # Set the folder property (used in programs such as Visual Studio to organize
-  # build targets.
+  # Set the folder property (used in programs such as Visual Studio to
+  # organize build targets.
   if(E_NO_INSTALL AND NOT E_FOLDER)
     set(SUBFOLDER "/Build Only")
   endif(E_NO_INSTALL AND NOT E_FOLDER)
@@ -397,15 +399,15 @@
 endfunction(BRLCAD_ADDEXEC execname srcslist libslist)
 
 
-#-----------------------------------------------------------------------------
-# Library function handles both shared and static libs, so one "BRLCAD_ADDLIB"
-# statement will cover both automatically
+#---------------------------------------------------------------------
+# Library function handles both shared and static libs, so one
+# "BRLCAD_ADDLIB" statement will cover both automatically
 function(BRLCAD_ADDLIB libname srcslist libslist)
 
   cmake_parse_arguments(L "SHARED;STATIC;NO_INSTALL;NO_STRICT;NO_STRICT_CXX" 
"FOLDER" "SHARED_SRCS;STATIC_SRCS" ${ARGN})
 
-  # The naming convention used for variables is the upper case of the library
-  # name, without the lib prefix.
+  # The naming convention used for variables is the upper case of the
+  # library name, without the lib prefix.
   string(REPLACE "lib" "" LOWERCORE "${libname}")
   string(TOUPPER ${LOWERCORE} UPPER_CORE)
 
@@ -425,7 +427,8 @@
   # Local copy of srcslist in case manipulation is needed
   set(lsrcslist ${srcslist})
 
-  # If we're going to have a specified subfolder, prepare the appropriate 
string:
+  # If we're going to have a specified subfolder, prepare the
+  # appropriate string:
   if(L_FOLDER)
     set(SUBFOLDER "/${L_FOLDER}")
   endif(L_FOLDER)
@@ -464,9 +467,9 @@
     # Ask me how I know.
     if(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
       foreach(ll ${libslist})
-       if (TARGET ${ll})
-         add_dependencies(${libname}-obj ${ll})
-       endif (TARGET ${ll})
+             if (TARGET ${ll})
+               add_dependencies(${libname}-obj ${ll})
+             endif (TARGET ${ll})
       endforeach(ll ${libslist})
     endif(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
 
@@ -517,7 +520,8 @@
     endif(TARGET ${pt} AND ${pt} MATCHES "^lib*")
   endforeach(pt ${possible_targets})
 
-  # Now that we have both the sources lists and the build targets, assign flags
+  # Now that we have both the sources lists and the build targets,
+  # assign flags
   SET_FLAGS_AND_DEFINITIONS("${srcslist};${L_SHARED_SRCS};${L_STATIC_SRCS}"
     TARGET ${libname}
     CFLAGS "${L_C_FLAGS}"
@@ -537,9 +541,9 @@
     VALIDATE_STYLE("${libstatic}" "${srcslist};${L_STATIC_SRCS}")
     if(NOT L_NO_INSTALL)
       install(TARGETS ${libstatic}
-       RUNTIME DESTINATION ${BIN_DIR}
-       LIBRARY DESTINATION ${LIB_DIR}
-       ARCHIVE DESTINATION ${LIB_DIR})
+             RUNTIME DESTINATION ${BIN_DIR}
+             LIBRARY DESTINATION ${LIB_DIR}
+             ARCHIVE DESTINATION ${LIB_DIR})
     endif(NOT L_NO_INSTALL)
   endif(L_STATIC OR (BUILD_STATIC_LIBS AND NOT L_SHARED))
 
@@ -553,44 +557,56 @@
     endif(NOT "${libslist}" STREQUAL "" AND NOT "${libslist}" STREQUAL "NONE")
     if(NOT L_NO_INSTALL)
       install(TARGETS ${libname}
-       RUNTIME DESTINATION ${BIN_DIR}
-       LIBRARY DESTINATION ${LIB_DIR}
-       ARCHIVE DESTINATION ${LIB_DIR})
+             RUNTIME DESTINATION ${BIN_DIR}
+             LIBRARY DESTINATION ${LIB_DIR}
+             ARCHIVE DESTINATION ${LIB_DIR})
     endif(NOT L_NO_INSTALL)
   endif(L_SHARED OR (BUILD_SHARED_LIBS AND NOT L_STATIC))
 
 endfunction(BRLCAD_ADDLIB libname srcslist libslist)
 
-#-----------------------------------------------------------------------------
-# For situations when a local 3rd party library (say, zlib) has been chosen in
-# preference to a system version of that library, it is important to ensure
-# that the local header(s) get included before the system headers.  Normally
-# this is handled by explicitly specifying the local include paths (which,
-# being explicitly specified and non-standard, are checked prior to default
-# system locations) but there are some situations (macports being a classic
-# example) where *other* "non-standard" installed copies of libraries may
-# exist and be found if those directories are included ahead of the desired
+#---------------------------------------------------------------------
+# For situations when a local 3rd party library (say, zlib) has been
+# chosen in preference to a system version of that library, it is
+# important to ensure that the local header(s) get included before the
+# system headers.  Normally this is handled by explicitly specifying
+# the local include paths (which, being explicitly specified and
+# non-standard, are checked prior to default system locations) but
+# there are some situations (macports being a classic example) where
+# *other* "non-standard" installed copies of libraries may exist and
+# be found if those directories are included ahead of the desired
 # local copy.  An observed case:
 #
 # 1.  macports is installed on OSX
-# 2.  X11 is found in macports, X11 directories are set to /usr/macports based 
paths
-# 3.  These paths are mixed into the general include path lists for some 
BRL-CAD libs.
-# 4.  Because these paths are a) non-standard and b) contain zlib.h they result
-#     in "system" versions of zlib present in macports being found first even 
when
-#     the local zlib is enabled, if the macports paths happen to appear in the
-#     include directory list before the local zlib include paths.
 #
-# To mitigate this problem, BRL-CAD library include directories are sorted
-# according to the following hierarchy (using gcc's left-to-right search
-# order as a basis: http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html):
+# 2.  X11 is found in macports, X11 directories are set to
+#     /usr/macports based paths
 #
-# 1.  If CMAKE_CURRENT_BINARY_DIR or CMAKE_CURRENT_SOURCE_DIR are in the
-#     include list, they come first.
-# 2.  If BRLCAD_BINARY_DIR/include or BRLCAD_SOURCE_DIR/include are present,
-#     they come second.
-# 3.  For remaining paths, if the "root" path matches the BRLCAD_SOURCE_DIR
-#     or BRLCAD_BINARY_DIR paths, they are appended.
+# 3.  These paths are mixed into the general include path lists for
+#     some BRL-CAD libs.
+#
+# 4.  Because these paths are a) non-standard and b) contain zlib.h
+#     they result in "system" versions of zlib present in macports
+#     being found first even when the local zlib is enabled, if the
+#     macports paths happen to appear in the include directory list
+#     before the local zlib include paths.
+#
+# To mitigate this problem, BRL-CAD library include directories are
+# sorted according to the following hierarchy (using gcc's
+# left-to-right search order as a basis:
+# http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html):
+#
+# 1.  If CMAKE_CURRENT_BINARY_DIR or CMAKE_CURRENT_SOURCE_DIR are in
+#     the include list, they come first.
+#
+# 2.  If BRLCAD_BINARY_DIR/include or BRLCAD_SOURCE_DIR/include are
+#     present, they come second.
+#
+# 3.  For remaining paths, if the "root" path matches the
+#     BRLCAD_SOURCE_DIR or BRLCAD_BINARY_DIR paths, they are appended.
+#
 # 4.  Any remaining paths are appended.
+#
 function(BRLCAD_SORT_INCLUDE_DIRS DIR_LIST)
   if(${DIR_LIST})
     set(ORDERED_ELEMENTS "${CMAKE_CURRENT_BINARY_DIR}" 
"${CMAKE_CURRENT_SOURCE_DIR}" "${BRLCAD_BINARY_DIR}/include" 
"${BRLCAD_SOURCE_DIR}/include")
@@ -603,8 +619,8 @@
       set(DEF_EXISTS "-1")
       list(FIND ${DIR_LIST} ${element} DEF_EXISTS)
       if(NOT "${DEF_EXISTS}" STREQUAL "-1")
-       set(NEW_DIR_LIST ${NEW_DIR_LIST} ${element})
-       list(REMOVE_ITEM ${DIR_LIST} ${element})
+             set(NEW_DIR_LIST ${NEW_DIR_LIST} ${element})
+             list(REMOVE_ITEM ${DIR_LIST} ${element})
       endif(NOT "${DEF_EXISTS}" STREQUAL "-1")
     endforeach(element ${ORDERED_ELEMENTS})
 
@@ -612,8 +628,8 @@
     foreach(inc_path ${${DIR_LIST}})
       IS_SUBPATH("${BRLCAD_BINARY_DIR}" "${inc_path}" SUBPATH_TEST)
       if("${SUBPATH_TEST}" STREQUAL "1")
-       set(NEW_DIR_LIST ${NEW_DIR_LIST} ${inc_path})
-       list(REMOVE_ITEM ${DIR_LIST} ${inc_path})
+             set(NEW_DIR_LIST ${NEW_DIR_LIST} ${inc_path})
+             list(REMOVE_ITEM ${DIR_LIST} ${inc_path})
       endif("${SUBPATH_TEST}" STREQUAL "1")
     endforeach(inc_path ${${DIR_LIST}})
 
@@ -621,8 +637,8 @@
     foreach(inc_path ${${DIR_LIST}})
       IS_SUBPATH("${BRLCAD_SOURCE_DIR}" "${inc_path}" SUBPATH_TEST)
       if("${SUBPATH_TEST}" STREQUAL "1")
-       set(NEW_DIR_LIST ${NEW_DIR_LIST} ${inc_path})
-       list(REMOVE_ITEM ${DIR_LIST} ${inc_path})
+             set(NEW_DIR_LIST ${NEW_DIR_LIST} ${inc_path})
+             list(REMOVE_ITEM ${DIR_LIST} ${inc_path})
       endif("${SUBPATH_TEST}" STREQUAL "1")
     endforeach(inc_path ${${DIR_LIST}})
 
@@ -632,8 +648,8 @@
       set(DEF_EXISTS "-1")
       list(FIND ${DIR_LIST} ${element} DEF_EXISTS)
       if(NOT "${DEF_EXISTS}" STREQUAL "-1")
-       set(LAST_DIR_LIST ${LAST_DIR_LIST} ${element})
-       list(REMOVE_ITEM ${DIR_LIST} ${element})
+             set(LAST_DIR_LIST ${LAST_DIR_LIST} ${element})
+             list(REMOVE_ITEM ${DIR_LIST} ${element})
       endif(NOT "${DEF_EXISTS}" STREQUAL "-1")
     endforeach(element ${LAST_ELEMENTS})
 
@@ -648,19 +664,21 @@
   endif(${DIR_LIST})
 endfunction(BRLCAD_SORT_INCLUDE_DIRS)
 
-#-----------------------------------------------------------------------------
-# Wrapper to properly include directories for a BRL-CAD build.  Handles the
-# SYSTEM option to the include_directories command, as well as calling the
-# sort function.
+#---------------------------------------------------------------------
+# Wrapper to properly include directories for a BRL-CAD build.
+# Handles the SYSTEM option to the include_directories command, as
+# well as calling the sort function.
 function(BRLCAD_INCLUDE_DIRS DIR_LIST)
 
-  # TODO - We don't want parent directories values augmenting DIR_LIST for
-  # subsequent targets - if we're calling this, we're taking full control of
-  # all inclusions for all targets in this and subsequent directories.  We
-  # should probably use the target level INCLUDE_DIRECTORIES property and
-  # stop setting include_directories on entire directories all together
-  # for maximal precision and minimum surprises...
-  #set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
+  # TODO - We don't want parent directories values augmenting DIR_LIST
+  # for subsequent targets - if we're calling this, we're taking full
+  # control of all inclusions for all targets in this and subsequent
+  # directories.  We should probably use the target level
+  # INCLUDE_DIRECTORIES property and stop setting include_directories
+  # on entire directories all together for maximal precision and
+  # minimum surprises...
+  #
+  # set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
 
   set(INCLUDE_DIRS ${${DIR_LIST}})
   if(INCLUDE_DIRS)
@@ -683,9 +701,9 @@
     endforeach(sp ${SYS_INCLUDE_PATTERNS})
     if(IS_SYSPATH OR NOT IS_LOCAL)
       if(IS_SYSPATH)
-       include_directories(SYSTEM ${inc_dir})
+             include_directories(SYSTEM ${inc_dir})
       else(IS_SYSPATH)
-       include_directories(AFTER SYSTEM ${inc_dir})
+             include_directories(AFTER SYSTEM ${inc_dir})
       endif(IS_SYSPATH)
     else(IS_SYSPATH OR NOT IS_LOCAL)
       include_directories(BEFORE ${inc_dir})
@@ -694,11 +712,12 @@
 
 endfunction(BRLCAD_INCLUDE_DIRS DIR_LIST)
 
-#-----------------------------------------------------------------------------
-# Wrapper to handle include directories specific to libraries.  Removes
-# duplicates and makes sure the <LIB>_INCLUDE_DIRS list is in the cache
-# immediately, so it can be used by other libraries.  These lists are not
-# intended as toplevel user settable options so mark as advanced.
+#---------------------------------------------------------------------
+# Wrapper to handle include directories specific to libraries.
+# Removes duplicates and makes sure the <LIB>_INCLUDE_DIRS list is in
+# the cache immediately, so it can be used by other libraries.  These
+# lists are not intended as toplevel user settable options so mark as
+# advanced.
 function(BRLCAD_LIB_INCLUDE_DIRS libname DIR_LIST LOCAL_DIR_LIST)
   string(TOUPPER ${libname} LIB_UPPER)
 
@@ -711,27 +730,29 @@
 endfunction(BRLCAD_LIB_INCLUDE_DIRS)
 
 
-#-----------------------------------------------------------------------------
-# Files needed by BRL-CAD need to be both installed and copied into the
-# correct locations in the build directories to allow executables to run
-# at build time.  Ideally, we would like any error messages returned when
-# running from the build directory to direct back to the copies of files in
-# the source tree, since those are the ones that should be edited.
-# On platforms that support symlinks, this is possible - build directory
-# "copies" of files are symlinks to the source tree version.  On platforms
-# without symlink support, we are forced to copy the files into place in
-# the build directories.  In both cases we have a build target that is
-# triggered if source files are edited in order to allow the build system
-# to take further actions (for example, re-generating tclIndex and pkgIndex.tcl
-# files when the source .tcl files change).
+#---------------------------------------------------------------------
+# Files needed by BRL-CAD need to be both installed and copied into
+# the correct locations in the build directories to allow executables
+# to run at build time.  Ideally, we would like any error messages
+# returned when running from the build directory to direct back to the
+# copies of files in the source tree, since those are the ones that
+# should be edited.  On platforms that support symlinks, this is
+# possible - build directory "copies" of files are symlinks to the
+# source tree version.  On platforms without symlink support, we are
+# forced to copy the files into place in the build directories.  In
+# both cases we have a build target that is triggered if source files
+# are edited in order to allow the build system to take further
+# actions (for example, re-generating tclIndex and pkgIndex.tcl files
+# when the source .tcl files change).
 #
-# Because BRLCAD_MANAGE_FILES defines custom commands and specifies the files 
it is
-# to copy/symlink as dependencies, there is a potential for file names to
-# conflict with build target names. (This has actually been observed with
-# MSVC - our file INSTALL in the toplevel source directory conflicts with the
-# MSVC target named INSTALL.) To avoid conflicts and make the dependencies
-# of the custom commands robust we supply full file paths as dependencies to
-# the file copying custom commands.
+# Because BRLCAD_MANAGE_FILES defines custom commands and specifies
+# the files it is to copy/symlink as dependencies, there is a
+# potential for file names to conflict with build target names. (This
+# has actually been observed with MSVC - our file INSTALL in the
+# toplevel source directory conflicts with the MSVC target named
+# INSTALL.) To avoid conflicts and make the dependencies of the custom
+# commands robust we supply full file paths as dependencies to the
+# file copying custom commands.
 
 function(BRLCAD_MANAGE_FILES inputdata targetdir)
 
@@ -745,14 +766,14 @@
     CMAKE_PARSE_ARGUMENTS(${VAR_PREFIX} "EXEC" "FOLDER" "" ${ARGN})
   endif(${ARGC} GREATER 2)
 
-  # Handle both a list of one or more files and variable holding a list of 
files -
-  # find out what we've got.
+  # Handle both a list of one or more files and variable holding a
+  # list of files - find out what we've got.
   NORMALIZE_FILE_LIST("${inputdata}" RLIST datalist FPLIST fullpath_datalist 
TARGET targetname)
 
   # Identify the source files for CMake
   CMAKEFILES(${datalist})
 
-  
#-----------------------------------------------------------------------------
+  #-------------------------------------------------------------------
   # Some of the more advanced build system features in BRL-CAD's CMake
   # build need to know whether symlink support is present on the
   # current OS - go ahead and do this test up front, caching the
@@ -774,35 +795,37 @@
     endif(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/link_test_dest")
   endif(NOT DEFINED HAVE_SYMLINK)
 
-  # Now that the input data and target names are in order, define the custom
-  # commands needed for build directory data copying on this platform (per
-  # symlink test results.)
+  # Now that the input data and target names are in order, define the
+  # custom commands needed for build directory data copying on this
+  # platform (per symlink test results.)
 
   if(HAVE_SYMLINK)
 
-    # Make sure the target directory exists (symlinks need the target 
directory already in place)
+    # Make sure the target directory exists (symlinks need the target
+    # directory already in place)
     if(NOT CMAKE_CONFIGURATION_TYPES)
       execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory 
"${CMAKE_BINARY_DIR}/${targetdir}")
     else(NOT CMAKE_CONFIGURATION_TYPES)
       foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-       string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
-       execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory 
"${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}")
+             string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
+             execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory 
"${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}")
       endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
     endif(NOT CMAKE_CONFIGURATION_TYPES)
 
-    # Using symlinks - in this case, the custom command doesn't actually have 
to
-    # do the work every time the source file changes - once established, the 
symlink
-    # will behave correctly.  That being the case, we just go ahead and 
establish the
-    # symlinks in the configure stage.
+    # Using symlinks - in this case, the custom command doesn't
+    # actually have to do the work every time the source file changes
+    # - once established, the symlink will behave correctly.  That
+    # being the case, we just go ahead and establish the symlinks in
+    # the configure stage.
     foreach(filename ${fullpath_datalist})
       get_filename_component(ITEM_NAME ${filename} NAME)
       if(NOT CMAKE_CONFIGURATION_TYPES)
-       execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filename} 
"${CMAKE_BINARY_DIR}/${targetdir}/${ITEM_NAME}")
+             execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
${filename} "${CMAKE_BINARY_DIR}/${targetdir}/${ITEM_NAME}")
       else(NOT CMAKE_CONFIGURATION_TYPES)
-       foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-         string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
-         execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
${filename} "${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}/${ITEM_NAME}")
-       endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+             foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
+               string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
+               execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
${filename} "${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}/${ITEM_NAME}")
+             endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
       endif(NOT CMAKE_CONFIGURATION_TYPES)
     endforeach(filename ${fullpath_datalist})
 
@@ -810,14 +833,15 @@
     file(GLOB listing LIST_DIRECTORIES false 
"${CMAKE_BINARY_DIR}/${targetdir}/*")
     foreach (filename ${listing})
       if (NOT EXISTS ${filename})
-       message("Removing stale symbolic link ${filename}")
-       execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${filename})
+             message("Removing stale symbolic link ${filename}")
+             execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${filename})
       endif (NOT EXISTS ${filename})
     endforeach (filename ${listing})
 
-    # The custom command is still necessary - since it depends on the original 
source files,
-    # this will be the trigger that tells other commands depending on this 
data that
-    # they need to re-run one one of the source files is changed.
+    # The custom command is still necessary - since it depends on the
+    # original source files, this will be the trigger that tells other
+    # commands depending on this data that they need to re-run when
+    # one of the source files is changed.
     add_custom_command(
       OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${targetname}.sentinel"
       COMMAND ${CMAKE_COMMAND} -E touch 
"${CMAKE_CURRENT_BINARY_DIR}/${targetname}.sentinel"
@@ -833,8 +857,8 @@
       set(${targetname}_cmake_contents "${${targetname}_cmake_contents}  
file(COPY \${FILES_TO_COPY} DESTINATION 
\"${CMAKE_BINARY_DIR}/${targetdir}\")\n")
     else(NOT CMAKE_CONFIGURATION_TYPES)
       foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-       string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
-       set(${targetname}_cmake_contents "${${targetname}_cmake_contents}  
file(COPY \${FILES_TO_COPY} DESTINATION 
\"${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}\")\n")
+             string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
+             set(${targetname}_cmake_contents "${${targetname}_cmake_contents} 
 file(COPY \${FILES_TO_COPY} DESTINATION 
\"${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}\")\n")
       endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
     endif(NOT CMAKE_CONFIGURATION_TYPES)
     set(${targetname}_cmake_contents 
"${${targetname}_cmake_contents}endforeach(filename \${CURRENT_FILE_LIST})\n")
@@ -849,13 +873,15 @@
       )
   endif(HAVE_SYMLINK)
 
-  # Define the target and add it to this directories list of data targets
+  # Define the target and add it to this directories list of data
+  # targets
   add_custom_target(${targetname}_cp ALL DEPENDS 
"${CMAKE_CURRENT_BINARY_DIR}/${targetname}.sentinel")
   set_target_properties(${targetname}_cp PROPERTIES FOLDER "BRL-CAD File 
Copying")
   BRLCAD_ADD_DIR_LIST_ENTRY(DATA_TARGETS "${CMAKE_CURRENT_BINARY_DIR}" 
${targetname}_cp)
 
-  # Because the target name for managed files is likely cryptic, we add a 
dependency to the managed_files target
-  # so this poriton of the logic can be referenced
+  # Because the target name for managed files is likely cryptic, we
+  # add a dependency to the managed_files target so this poriton of
+  # the logic can be referenced
   add_dependencies(managed_files ${targetname}_cp)
 
   # Set the FOLDER property.  If the target has supplied a folder, use
@@ -866,8 +892,9 @@
     set_target_properties(${targetname}_cp PROPERTIES FOLDER "BRL-CAD File 
Setup/${${VAR_PREFIX}_FOLDER}")
   endif("${${VAR_PREFIX}_FOLDER}" STREQUAL "")
 
-  # Add outputs to the distclean rules - this is consistent regardless of what 
type the output
-  # file is, symlink or copy.  Just need to handle the single and multiconfig 
cases.
+  # Add outputs to the distclean rules - this is consistent regardless
+  # of what type the output file is, symlink or copy.  Just need to
+  # handle the single and multiconfig cases.
   foreach(filename ${fullpath_datalist})
     get_filename_component(ITEM_NAME "${filename}" NAME)
     if(NOT CMAKE_CONFIGURATION_TYPES)
@@ -874,14 +901,15 @@
       DISTCLEAN("${CMAKE_BINARY_DIR}/${targetdir}/${ITEM_NAME}")
     else(NOT CMAKE_CONFIGURATION_TYPES)
       foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-       string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
-       
DISTCLEAN("${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}/${ITEM_NAME}")
+             string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
+             
DISTCLEAN("${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${targetdir}/${ITEM_NAME}")
       endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
     endif(NOT CMAKE_CONFIGURATION_TYPES)
   endforeach(filename ${fullpath_datalist})
 
-  # The installation rule relates only to the original source directory copy, 
and so doesn't
-  # need to explicitly concern itself with configurations.
+  # The installation rule relates only to the original source
+  # directory copy, and so doesn't need to explicitly concern itself
+  # with configurations.
   if(${VAR_PREFIX}_EXEC)
     install(PROGRAMS ${datalist} DESTINATION ${targetdir})
   else(${VAR_PREFIX}_EXEC)
@@ -891,8 +919,8 @@
 endfunction(BRLCAD_MANAGE_FILES)
 
 #-----------------------------------------------------------------------------
-# Specific uses of the BRLCAD_MANAGED_FILES functionality - these cover most
-# of the common cases in BRL-CAD.
+# Specific uses of the BRLCAD_MANAGED_FILES functionality - these
+# cover most of the common cases in BRL-CAD.
 
 function(BRLCAD_ADDDATA datalist targetdir)
   BRLCAD_MANAGE_FILES(${datalist} ${DATA_DIR}/${targetdir})
@@ -911,52 +939,57 @@
 
 
 #-----------------------------------------------------------------------------
-# The default operational mode of Regression tests is to be executed by a
-# parent CMake script, which captures the I/O from the test and stores it in an
-# individual log file named after the test.  By default, a custom command and
-# CTest add_test command are set up to run a configured script.  If TEST_SCRIPT
-# is provided specifying a particular script file that is used, otherwise the
-# convention of ${testname}.cmake.in in the current source directory is assumed
-# to specify the input test script.
+# The default operational mode of Regression tests is to be executed
+# by a parent CMake script, which captures the I/O from the test and
+# stores it in an individual log file named after the test.  By
+# default, a custom command and CTest add_test command are set up to
+# run a configured script.  If TEST_SCRIPT is provided specifying a
+# particular script file that is used, otherwise the convention of
+# ${testname}.cmake.in in the current source directory is assumed to
+# specify the input test script.
 #
 # Particularly when configuration dependent builds are in play, a test
-# executable's location needs special handling to ensure the scripts run the
-# correct version of a program.  The standard mechanism is to specify the CMake
-# target name of the executable by supplying it via the EXEC option and then
-# pass the output of $<TARGET_FILE:${${testname}_EXEC}> to the running CMake
-# script. (Note that the script must in turn post-process this value to unquote
-# it in case of special characters in pathnames.)
+# executable's location needs special handling to ensure the scripts
+# run the correct version of a program.  The standard mechanism is to
+# specify the CMake target name of the executable by supplying it via
+# the EXEC option and then pass the output of
+# $<TARGET_FILE:${${testname}_EXEC}> to the running CMake
+# script. (Note that the script must in turn post-process this value
+# to unquote it in case of special characters in pathnames.)
 #
-# To allow for more customized test execution, the option TEST_DEFINED may be
-# passed to the function to instruct it to skip all setup for add_test and
-# custom command definitions.  It is the callers responsibility to define an
-# appropriately named test with add_test - BRLCAD_REGRESSION_TEST in this mode
-# will then perform only the specific build target definition and subsequent
-# steps for wiring the test into the higher level commands.
+# To allow for more customized test execution, the option TEST_DEFINED
+# may be passed to the function to instruct it to skip all setup for
+# add_test and custom command definitions.  It is the callers
+# responsibility to define an appropriately named test with add_test -
+# BRLCAD_REGRESSION_TEST in this mode will then perform only the
+# specific build target definition and subsequent steps for wiring the
+# test into the higher level commands.
 #
 # Standard actions for all regression targets:
 #
-# 1.  A custom build target with the pattern regress-${testname} is defined
-#     to allow for individual execution of the regression test with
-#     "make ${testname}"
+# 1.  A custom build target with the pattern regress-${testname} is
+#     defined to allow for individual execution of the regression test
+#     with "make ${testname}"
 #
-# 2.  A label is added identifying the test as a regression test so the top
-#     level commands "make check" and "make regress" know this particular
-#     tests is one of the tests they are supposed to execute.
+# 2.  A label is added identifying the test as a regression test so
+#     the top level commands "make check" and "make regress" know this
+#     particular tests is one of the tests they are supposed to
+#     execute.
 #
-# 3.  Any dependencies in ${depends_list} are added as build requirements to
-#     the regress and check targets.  This ensures that (unlike "make test"
-#     and CTest itself) when those targets are built the dependencies of the
-#     tests are built first.  (A default CTest run prior to building will
-#     result in all tests failing.)
+# 3.  Any dependencies in ${depends_list} are added as build
+#     requirements to the regress and check targets.  This ensures
+#     that (unlike "make test" and CTest itself) when those targets
+#     are built the dependencies of the tests are built first.  (A
+#     default CTest run prior to building will result in all tests
+#     failing.)
 #
 # 4.  If the keyword "STAND_ALONE" is passed in, a ${testname} target
-#     is defined but no other connections are made between that target and the
-#     agglomeration targets.
+#     is defined but no other connections are made between that target
+#     and the agglomeration targets.
 #
-# 5.  If a TIMEOUT argument is passed, a specific timeout tiem is set on the
-#     test. Otherwise, a default is assigned to ensure no test runs
-#     indefinitely.
+# 5.  If a TIMEOUT argument is passed, a specific timeout tiem is set
+#     on the test. Otherwise, a default is assigned to ensure no test
+#     runs indefinitely.
 
 function(BRLCAD_REGRESSION_TEST testname depends_list)
 
@@ -997,9 +1030,9 @@
     add_dependencies(${testname} ${depends_list})
   endif (depends_list)
 
-  # Make sure we at least get this into the regression test folder - local
-  # subdirectories may override this if they have more specific locations
-  # they want to use.
+  # Make sure we at least get this into the regression test folder -
+  # local subdirectories may override this if they have more specific
+  # locations they want to use.
   if (${testname}_STAND_ALONE)
     set_target_properties(${testname} PROPERTIES FOLDER "BRL-CAD Regression 
Tests")
   else (${testname}_STAND_ALONE)
@@ -1006,11 +1039,12 @@
     set_target_properties(${testname} PROPERTIES FOLDER "BRL-CAD Regression 
Tests/regress")
   endif (${testname}_STAND_ALONE)
 
-  # In Visual Studio, none of the regress build targets are added to the 
default build.
+  # In Visual Studio, none of the regress build targets are added to
+  # the default build.
   set_target_properties(${testname} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
 
-  # Group any test not excluded by the STAND_ALONE flag with the other 
regression tests by
-  # assigning a standard label
+  # Group any test not excluded by the STAND_ALONE flag with the other
+  # regression tests by assigning a standard label
   if (NOT ${testname}_STAND_ALONE)
     set_tests_properties(${testname} PROPERTIES LABELS "Regression")
   else (NOT ${testname}_STAND_ALONE)

Modified: brlcad/branches/extbuild/src/libbn/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/src/libbn/CMakeLists.txt   2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbn/CMakeLists.txt   2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -32,7 +32,7 @@
   rand.c
   randsph.c
   scale.c
-  sobolseq.c
+  sobol.c
   sphmap.c
   str.c
   symbol.c

Modified: brlcad/branches/extbuild/src/libbn/plot3.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/plot3.c  2020-11-30 15:45:42 UTC (rev 
77829)
+++ brlcad/branches/extbuild/src/libbn/plot3.c  2020-11-30 15:50:27 UTC (rev 
77830)
@@ -791,7 +791,7 @@
 static int
 read_ieee(FILE *fp, int cnt, int mode)
 {
-    int ret;
+    size_t ret;
     if (mode == PL_OUTPUT_MODE_BINARY) {
        for (int i = 0; i < cnt; i++) {
            char inbuf[SIZEOF_NETWORK_DOUBLE];
@@ -804,7 +804,7 @@
     if (mode == PL_OUTPUT_MODE_TEXT) {
        double val;
        for (int i = 0; i < cnt; i++) {
-           ret = fscanf(fp, "%lf", &val);
+           ret = (size_t)fscanf(fp, "%lf", &val);
            if (ret != 1)
                return 1;
        }

Copied: brlcad/branches/extbuild/src/libbn/sobol.c (from rev 77829, 
brlcad/trunk/src/libbn/sobol.c)
===================================================================
--- brlcad/branches/extbuild/src/libbn/sobol.c                          (rev 0)
+++ brlcad/branches/extbuild/src/libbn/sobol.c  2020-11-30 15:50:27 UTC (rev 
77830)
@@ -0,0 +1,354 @@
+/* Copyright (c) 2007 Massachusetts Institute of Technology
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* Generation of Sobol sequences in up to 1111 dimensions, based on
+   the algorithms described in: P. Bratley and B. L. Fox, Algorithm
+   659, ACM Trans.  Math. Soft. 14 (1), 88-100 (1988), as modified by:
+   S. Joe and F. Y. Kuo, ACM Trans. Math. Soft 29 (1), 49-57 (2003).
+
+   Note that the code below was written without even looking at the
+   Fortran code from the TOMS paper, which is only semi-free (being
+   under the restrictive ACM copyright terms).  Then I went to the
+   Fortran code and took out the table of primitive polynomials and
+   starting direction #'s ... since this is just a table of numbers
+   generated by a deterministic algorithm, it is not copyrightable.
+   (Obviously, the format of these tables then necessitated some
+   slight modifications to the code.)
+
+   For the test integral of Joe and Kuo (see the main() program
+   below), I get exactly the same results for integrals up to 1111
+   dimensions compared to the table of published numbers (to the 5
+   published significant digits).
+
+   This is not to say that the authors above should not be credited
+   for their clear description of the algorithm (and their tabulation
+   of the critical numbers).  Please cite them.  Just that I needed a
+   free/open-source implementation. */
+
+#include "common.h"
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "bu/assert.h"
+#include "bu/malloc.h"
+#include "bn/rand.h"
+#include "bn/sobol.h"
+#include "soboldata.h"
+
+
+/* Period parameters */
+#define NL_N 624
+#define NL_M 397
+#define NL_MATRIX_A 0x9908b0dfUL   /* constant vector a */
+#define NL_UPPER_MASK 0x80000000UL /* most significant w-r bits */
+#define NL_LOWER_MASK 0x7fffffffUL /* least significant r bits */
+
+/* Maximum supported dimension of Sobol output array */
+#define SOBOL_MAXDIM 1111
+
+
+struct bn_soboldata {
+    unsigned sdim; /* dimension of sequence being generated */
+    uint32_t *mdata; /* array of length 32 * sdim */
+    uint32_t *m[32]; /* more convenient pointers to mdata, of direction #s */
+    uint32_t *x; /* previous x = x_n, array of length sdim */
+    unsigned *b; /* position of fixed point in x[i] is after bit b[i] */
+    uint32_t n; /* number of x's generated so far */
+    uint32_t NL_mt[NL_N]; /* the array for the state vector  */
+    int NL_mti; /* mti==N+1 means mt[N] is not initialized */
+    double *cvec;  /* The current sequence vector */
+};
+
+
+/* initializes NLmt[N] with a seed */
+static void nlopt_init_genrand(struct bn_soboldata *sd, unsigned long s)
+{
+    sd->NL_mt[0]= s & 0xffffffffUL;
+    for (sd->NL_mti=1; sd->NL_mti<NL_N; sd->NL_mti++) {
+       sd->NL_mt[sd->NL_mti] = (1812433253UL * (sd->NL_mt[sd->NL_mti-1] ^ 
(sd->NL_mt[sd->NL_mti-1] >> 30)) + sd->NL_mti);
+       /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
+       /* In the previous versions, MSBs of the seed affect   */
+       /* only MSBs of the array mt[].                        */
+       /* 2002/01/09 modified by Makoto Matsumoto             */
+       sd->NL_mt[sd->NL_mti] &= 0xffffffffUL;
+       /* for >32 bit machines */
+    }
+}
+
+
+/* generates a random number on [0, 0xffffffff]-interval */
+static uint32_t nlopt_genrand_int32(struct bn_soboldata *sd)
+{
+    uint32_t y;
+    static uint32_t mag01[2]={0x0UL, NL_MATRIX_A};
+
+    if (sd->NL_mti >= NL_N) { /* generate N words at one time */
+       int kk;
+
+       if (sd->NL_mti == NL_N+1)   /* if init_genrand() has not been called, */
+           nlopt_init_genrand(sd, 5489UL); /* a default initial seed is used */
+
+       for (kk=0;kk<NL_N-NL_M;kk++) {
+           y = (sd->NL_mt[kk]&NL_UPPER_MASK)|(sd->NL_mt[kk+1]&NL_LOWER_MASK);
+           sd->NL_mt[kk] = sd->NL_mt[kk+NL_M] ^ (y >> 1) ^ mag01[y & 0x1UL];
+       }
+       for (;kk<NL_N-1;kk++) {
+           y = (sd->NL_mt[kk]&NL_UPPER_MASK)|(sd->NL_mt[kk+1]&NL_LOWER_MASK);
+           sd->NL_mt[kk] = sd->NL_mt[kk+(NL_M-NL_N)] ^ (y >> 1) ^ mag01[y & 
0x1UL];
+       }
+       y = (sd->NL_mt[NL_N-1]&NL_UPPER_MASK)|(sd->NL_mt[0]&NL_LOWER_MASK);
+       sd->NL_mt[NL_N-1] = sd->NL_mt[NL_M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
+
+       sd->NL_mti = 0;
+    }
+
+    y = sd->NL_mt[sd->NL_mti++];
+
+    /* Tempering */
+    y ^= (y >> 11);
+    y ^= (y << 7) & 0x9d2c5680UL;
+    y ^= (y << 15) & 0xefc60000UL;
+    y ^= (y >> 18);
+
+    return y;
+}
+
+
+/* generates a random number on [0, 1) with 53-bit resolution*/
+static double nlopt_genrand_res53(struct bn_soboldata *sd)
+{
+    uint32_t a=nlopt_genrand_int32(sd)>>5;
+    uint32_t b=nlopt_genrand_int32(sd)>>6;
+    return(a*67108864.0+b)*(1.0/9007199254740992.0);
+}
+/* These real versions are due to Isaku Wada, 2002/01/09 added */
+
+
+/* generate uniform random number in [a, b) with 53-bit resolution,
+ * added by SGJ.  Not static because we use this in libbn testing, but
+ * it is not public API. */
+BN_EXPORT double _sobol_urand(struct bn_soboldata *sd, double a, double b)
+{
+    return(a + (b - a) * nlopt_genrand_res53(sd));
+}
+
+
+/* Return position (0, 1, ...) of rightmost (least-significant) zero bit in n.
+ *
+ * This code uses a 32-bit version of algorithm to find the rightmost
+ * one bit in Knuth, _The Art of Computer Programming_, volume 4A
+ * (draft fascicle), section 7.1.3, "Bitwise tricks and techniques."
+ *
+ * Assumes n has a zero bit, i.e. n < 2^32 - 1.
+ *
+ */
+static unsigned rightzero32(uint32_t n)
+{
+#if defined(__GNUC__) && \
+    ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3)
+    return __builtin_ctz(~n); /* gcc builtin for version >= 3.4 */
+#else
+    const uint32_t a = 0x05f66a47; /* magic number, found by brute force */
+    static const unsigned decode[32] = {0, 1, 2, 26, 23, 3, 15, 27, 24, 21, 
19, 4, 12, 16, 28, 6, 31, 25, 22, 14, 20, 18, 11, 5, 30, 13, 17, 10, 29, 9, 8, 
7};
+    n = ~n; /* change to rightmost-one problem */
+    n = a * (n & (~n + 1u)); /* store in n to make sure mult. is 32 bits */
+    return decode[n >> 27];
+#endif
+}
+
+
+/* generate the next term x_{n+1} in the Sobol sequence, as an array
+   x[sdim] of numbers in (0, 1).  Returns 1 on success, 0 on failure
+   (if too many #'s generated) */
+static int sobol_gen(struct bn_soboldata *sd, double *x)
+{
+    unsigned c, b, i, sdim;
+
+    if (sd->n == 4294967295U)
+       return 0; /* n == 2^32 - 1 ... we would need to switch to a
+                    64-bit version to generate more terms. */
+
+    c = rightzero32(sd->n++);
+    sdim = sd->sdim;
+    for (i = 0; i < sdim; ++i) {
+       b = sd->b[i];
+       if (b >= c) {
+           sd->x[i] ^= sd->m[c][i] << (b - c);
+           x[i] = ((double) (sd->x[i])) / (1U << (b+1));
+       }
+       else {
+           sd->x[i] = (sd->x[i] << (c - b)) ^ sd->m[c][i];
+           sd->b[i] = c;
+           x[i] = ((double) (sd->x[i])) / (1U << (c+1));
+       }
+    }
+    return 1;
+}
+
+
+/* next vector x[sdim] in Sobol sequence, with each x[i] in (0, 1) */
+static void sobol_next_01(struct bn_soboldata *s)
+{
+    if (!sobol_gen(s, s->cvec)) {
+       /* fall back on pseudo random numbers in the unlikely event
+          that we exceed 2^32-1 points */
+       unsigned int i;
+       for (i = 0; i < s->sdim; ++i)
+           s->cvec[i] = _sobol_urand(s, 0.0, 1.0);
+    }
+}
+
+
+static int sobol_init(struct bn_soboldata *sd, unsigned sdim, unsigned long 
seed)
+{
+    unsigned i, j;
+
+    if (!sdim || sdim > MAXDIM)
+       return 0;
+
+    sd->mdata = (uint32_t *)bu_calloc(sdim * 32, sizeof(uint32_t), "sobol 
mdata");
+
+    /* mti==N+1 means mt[N] is not initialized */
+    sd->NL_mti=NL_N+1;
+
+    for (j = 0; j < 32; ++j) {
+       sd->m[j] = sd->mdata + j * sdim;
+       sd->m[j][0] = 1; /* special-case Sobol sequence */
+    }
+    for (i = 1; i < sdim; ++i) {
+       uint32_t a = sobol_a[i-1];
+       unsigned d = 0, k;
+
+       while (a) {
+           ++d;
+           a >>= 1;
+       }
+       d--; /* d is now degree of poly */
+
+       /* set initial values of m from table */
+       for (j = 0; j < d; ++j)
+           sd->m[j][i] = sobol_minit[j][i-1];
+
+       /* fill in remaining values using recurrence */
+       for (j = d; j < 32; ++j) {
+           a = sobol_a[i-1];
+           sd->m[j][i] = sd->m[j - d][i];
+           for (k = 0; k < d; ++k) {
+               sd->m[j][i] ^= ((a & 1) * sd->m[j-d+k][i]) << (d-k);
+               a >>= 1;
+           }
+       }
+    }
+
+    sd->x = (uint32_t *)bu_calloc(sdim, sizeof(uint32_t), "sobol x");
+    sd->b = (unsigned *)bu_calloc(sdim, sizeof(unsigned), "sobol b");
+
+    for (i = 0; i < sdim; ++i) {
+       sd->x[i] = 0;
+       sd->b[i] = 0;
+    }
+
+    sd->n = 0;
+    sd->sdim = sdim;
+
+    if (seed)
+       nlopt_init_genrand(sd, seed);
+
+    return 1;
+}
+
+
+/********************************************************************/
+/* BN API for Sobol sequences */
+
+
+struct bn_soboldata *
+bn_sobol_create(unsigned int sdim, unsigned long seed)
+{
+    struct bn_soboldata *s = NULL;
+    BU_ASSERT(sdim <= BN_SOBOL_MAXDIM);
+
+    s = (struct bn_soboldata *)bu_calloc(1, sizeof(struct bn_soboldata), 
"sobol data");
+    s->cvec = (double *)bu_calloc(SOBOL_MAXDIM, sizeof(double), "results 
array");
+
+    sobol_init(s, sdim, seed);
+
+    return s;
+}
+
+
+void
+bn_sobol_destroy(struct bn_soboldata *sd)
+{
+    if (!sd)
+       return;
+
+    bu_free(sd->mdata, "sobol mdata");
+    bu_free(sd->x, "sobol x");
+    bu_free(sd->b, "sobol b");
+    bu_free(sd->cvec, "sobol cvec");
+    bu_free(sd, "sobol");
+}
+
+
+double *
+bn_sobol_next(struct bn_soboldata *s, const double *lb, const double *ub)
+{
+    unsigned int i;
+
+    sobol_next_01(s);
+
+    if (lb && ub) {
+       for (i = 0; i < s->sdim; ++i) {
+           s->cvec[i] = lb[i] + (ub[i] - lb[i]) * s->cvec[i];
+       }
+    }
+
+    return s->cvec;
+}
+
+
+void
+bn_sobol_skip(struct bn_soboldata *s, unsigned n)
+{
+    if (!s)
+       return;
+
+    unsigned int k = 1;
+    while (k*2 < n)
+       k *= 2;
+    while (k-- > 0)
+       sobol_gen(s, s->cvec);
+}
+
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
+

Modified: brlcad/branches/extbuild/src/libbn/soboldata.h
===================================================================
--- brlcad/branches/extbuild/src/libbn/soboldata.h      2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbn/soboldata.h      2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -20,8 +20,8 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifndef SOBOLSEQ_H
-#define SOBOLSEQ_H
+#ifndef SOBOLDATA_H
+#define SOBOLDATA_H
 
 #include "common.h"
 
@@ -879,4 +879,4 @@
      6737,2995,7235,7713,973,4821,2377,1673,1,6541}
 };
 
-#endif
+#endif /* SOBOLDATA_H */

Deleted: brlcad/branches/extbuild/src/libbn/sobolseq.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/sobolseq.c       2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbn/sobolseq.c       2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -1,330 +0,0 @@
-/* Copyright (c) 2007 Massachusetts Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Generation of Sobol sequences in up to 1111 dimensions, based on the
-   algorithms described in:
-   P. Bratley and B. L. Fox, Algorithm 659, ACM Trans.
-   Math. Soft. 14 (1), 88-100 (1988),
-   as modified by:
-   S. Joe and F. Y. Kuo, ACM Trans. Math. Soft 29 (1), 49-57 (2003).
-
-   Note that the code below was written without even looking at the
-   Fortran code from the TOMS paper, which is only semi-free (being
-   under the restrictive ACM copyright terms).  Then I went to the
-   Fortran code and took out the table of primitive polynomials and
-   starting direction #'s ... since this is just a table of numbers
-   generated by a deterministic algorithm, it is not copyrightable.
-   (Obviously, the format of these tables then necessitated some
-   slight modifications to the code.)
-
-   For the test integral of Joe and Kuo (see the main() program
-   below), I get exactly the same results for integrals up to 1111
-   dimensions compared to the table of published numbers (to the 5
-   published significant digits).
-
-   This is not to say that the authors above should not be credited for
-   their clear description of the algorithm (and their tabulation of
-   the critical numbers).  Please cite them.  Just that I needed
-   a free/open-source implementation. */
-
-#include "common.h"
-#include <stdlib.h>
-#include <math.h>
-#include "bu/malloc.h"
-#include "bn/rand.h"
-#include "bn/sobol.h"
-#include "soboldata.h"
-
-/* Period parameters */
-#define NL_N 624
-#define NL_M 397
-#define NL_MATRIX_A 0x9908b0dfUL   /* constant vector a */
-#define NL_UPPER_MASK 0x80000000UL /* most significant w-r bits */
-#define NL_LOWER_MASK 0x7fffffffUL /* least significant r bits */
-
-/* Maximum supported dimension of Sobol output array */
-#define SOBOL_MAXDIM 1111
-
-struct bn_soboldata {
-    unsigned sdim; /* dimension of sequence being generated */
-    uint32_t *mdata; /* array of length 32 * sdim */
-    uint32_t *m[32]; /* more convenient pointers to mdata, of direction #s */
-    uint32_t *x; /* previous x = x_n, array of length sdim */
-    unsigned *b; /* position of fixed point in x[i] is after bit b[i] */
-    uint32_t n; /* number of x's generated so far */
-    uint32_t NL_mt[NL_N]; /* the array for the state vector  */
-    int NL_mti; /* mti==N+1 means mt[N] is not initialized */
-    double *cvec;  /* The current sequence vector */
-};
-
-/* initializes NLmt[N] with a seed */
-static void nlopt_init_genrand(struct bn_soboldata *sd, unsigned long s)
-{
-    sd->NL_mt[0]= s & 0xffffffffUL;
-    for (sd->NL_mti=1; sd->NL_mti<NL_N; sd->NL_mti++) {
-       sd->NL_mt[sd->NL_mti] = (1812433253UL * (sd->NL_mt[sd->NL_mti-1] ^ 
(sd->NL_mt[sd->NL_mti-1] >> 30)) + sd->NL_mti);
-       /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
-       /* In the previous versions, MSBs of the seed affect   */
-       /* only MSBs of the array mt[].                        */
-       /* 2002/01/09 modified by Makoto Matsumoto             */
-       sd->NL_mt[sd->NL_mti] &= 0xffffffffUL;
-       /* for >32 bit machines */
-    }
-}
-
-/* generates a random number on [0,0xffffffff]-interval */
-static uint32_t nlopt_genrand_int32(struct bn_soboldata *sd)
-{
-    uint32_t y;
-    static uint32_t mag01[2]={0x0UL, NL_MATRIX_A};
-
-    if (sd->NL_mti >= NL_N) { /* generate N words at one time */
-       int kk;
-
-       if (sd->NL_mti == NL_N+1)   /* if init_genrand() has not been called, */
-           nlopt_init_genrand(sd, 5489UL); /* a default initial seed is used */
-
-       for (kk=0;kk<NL_N-NL_M;kk++) {
-           y = (sd->NL_mt[kk]&NL_UPPER_MASK)|(sd->NL_mt[kk+1]&NL_LOWER_MASK);
-           sd->NL_mt[kk] = sd->NL_mt[kk+NL_M] ^ (y >> 1) ^ mag01[y & 0x1UL];
-       }
-       for (;kk<NL_N-1;kk++) {
-           y = (sd->NL_mt[kk]&NL_UPPER_MASK)|(sd->NL_mt[kk+1]&NL_LOWER_MASK);
-           sd->NL_mt[kk] = sd->NL_mt[kk+(NL_M-NL_N)] ^ (y >> 1) ^ mag01[y & 
0x1UL];
-       }
-       y = (sd->NL_mt[NL_N-1]&NL_UPPER_MASK)|(sd->NL_mt[0]&NL_LOWER_MASK);
-       sd->NL_mt[NL_N-1] = sd->NL_mt[NL_M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
-
-       sd->NL_mti = 0;
-    }
-
-    y = sd->NL_mt[sd->NL_mti++];
-
-    /* Tempering */
-    y ^= (y >> 11);
-    y ^= (y << 7) & 0x9d2c5680UL;
-    y ^= (y << 15) & 0xefc60000UL;
-    y ^= (y >> 18);
-
-    return y;
-}
-
-/* generates a random number on [0,1) with 53-bit resolution*/
-static double nlopt_genrand_res53(struct bn_soboldata *sd)
-{
-    uint32_t a=nlopt_genrand_int32(sd)>>5, b=nlopt_genrand_int32(sd)>>6;
-    return(a*67108864.0+b)*(1.0/9007199254740992.0);
-}
-/* These real versions are due to Isaku Wada, 2002/01/09 added */
-
-
-/* generate uniform random number in [a,b) with 53-bit resolution,
- * added by SGJ.  Not static because we use this in libbn testing,
- * but it is not public API. */
-BN_EXPORT double _sobol_urand(struct bn_soboldata *sd, double a, double b)
-{
-    return(a + (b - a) * nlopt_genrand_res53(sd));
-}
-
-/* Return position (0, 1, ...) of rightmost (least-significant) zero bit in n.
- *
- * This code uses a 32-bit version of algorithm to find the rightmost
- * one bit in Knuth, _The Art of Computer Programming_, volume 4A
- * (draft fascicle), section 7.1.3, "Bitwise tricks and
- * techniques."
- *
- * Assumes n has a zero bit, i.e. n < 2^32 - 1.
- *
- */
-static unsigned rightzero32(uint32_t n)
-{
-#if defined(__GNUC__) && \
-    ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3)
-    return __builtin_ctz(~n); /* gcc builtin for version >= 3.4 */
-#else
-    const uint32_t a = 0x05f66a47; /* magic number, found by brute force */
-    static const unsigned decode[32] = 
{0,1,2,26,23,3,15,27,24,21,19,4,12,16,28,6,31,25,22,14,20,18,11,5,30,13,17,10,29,9,8,7};
-    n = ~n; /* change to rightmost-one problem */
-    n = a * (n & (-n)); /* store in n to make sure mult. is 32 bits */
-    return decode[n >> 27];
-#endif
-}
-
-/* generate the next term x_{n+1} in the Sobol sequence, as an array
-   x[sdim] of numbers in (0,1).  Returns 1 on success, 0 on failure
-   (if too many #'s generated) */
-static int sobol_gen(struct bn_soboldata *sd, double *x)
-{
-    unsigned c, b, i, sdim;
-
-    if (sd->n == 4294967295U) return 0; /* n == 2^32 - 1 ... we would
-                                          need to switch to a 64-bit version
-                                          to generate more terms. */
-    c = rightzero32(sd->n++);
-    sdim = sd->sdim;
-    for (i = 0; i < sdim; ++i) {
-       b = sd->b[i];
-       if (b >= c) {
-           sd->x[i] ^= sd->m[c][i] << (b - c);
-           x[i] = ((double) (sd->x[i])) / (1U << (b+1));
-       }
-       else {
-           sd->x[i] = (sd->x[i] << (c - b)) ^ sd->m[c][i];
-           sd->b[i] = c;
-           x[i] = ((double) (sd->x[i])) / (1U << (c+1));
-       }
-    }
-    return 1;
-}
-
-/* next vector x[sdim] in Sobol sequence, with each x[i] in (0,1) */
-static void bn_sobol_next_01(struct bn_soboldata *s)
-{
-    if (!sobol_gen(s, s->cvec)) {
-       /* fall back on pseudo random numbers in the unlikely event
-          that we exceed 2^32-1 points */
-       unsigned int i;
-       for (i = 0; i < s->sdim; ++i)
-           s->cvec[i] = _sobol_urand(s, 0.0,1.0);
-    }
-}
-
-static int sobol_init(struct bn_soboldata *sd, unsigned sdim, unsigned long 
seed)
-{
-    unsigned i,j;
-
-    if (!sdim || sdim > MAXDIM) return 0;
-
-    sd->mdata = (uint32_t *) bu_malloc(sizeof(uint32_t) * (sdim * 32), "sobol 
mdata");
-    if (!sd->mdata) return 0;
-
-    /* mti==N+1 means mt[N] is not initialized */
-    sd->NL_mti=NL_N+1;
-
-    for (j = 0; j < 32; ++j) {
-       sd->m[j] = sd->mdata + j * sdim;
-       sd->m[j][0] = 1; /* special-case Sobol sequence */
-    }
-    for (i = 1; i < sdim; ++i) {
-       uint32_t a = sobol_a[i-1];
-       unsigned d = 0, k;
-
-       while (a) {
-           ++d;
-           a >>= 1;
-       }
-       d--; /* d is now degree of poly */
-
-       /* set initial values of m from table */
-       for (j = 0; j < d; ++j)
-           sd->m[j][i] = sobol_minit[j][i-1];
-
-       /* fill in remaining values using recurrence */
-       for (j = d; j < 32; ++j) {
-           a = sobol_a[i-1];
-           sd->m[j][i] = sd->m[j - d][i];
-           for (k = 0; k < d; ++k) {
-               sd->m[j][i] ^= ((a & 1) * sd->m[j-d+k][i]) << (d-k);
-               a >>= 1;
-           }
-       }
-    }
-
-    sd->x = (uint32_t *) bu_malloc(sizeof(uint32_t) * sdim, "sobol x");
-    if (!sd->x) { bu_free(sd->mdata, "sobol x"); return 0; }
-
-    sd->b = (unsigned *) bu_malloc(sizeof(unsigned) * sdim, "sobol b");
-    if (!sd->b) { bu_free(sd->x, "sobol x"); bu_free(sd->mdata, "sobol 
mdata"); return 0; }
-
-    for (i = 0; i < sdim; ++i) {
-       sd->x[i] = 0;
-       sd->b[i] = 0;
-    }
-
-    sd->n = 0;
-    sd->sdim = sdim;
-
-    if (seed) nlopt_init_genrand(sd, seed);
-
-    return 1;
-}
-
-
-
-/************************************************************************/
-/* API to Sobol sequence creation */
-
-struct bn_soboldata *bn_sobol_create(unsigned int sdim, unsigned long seed)
-{
-    struct bn_soboldata *s = NULL;
-    if (sdim > BN_SOBOL_MAXDIM) return NULL;
-    s = (struct bn_soboldata *) bu_malloc(sizeof(struct bn_soboldata), "sobol 
data");
-    if (!s) return NULL;
-    s->cvec = (double *)bu_malloc(sizeof(double) * SOBOL_MAXDIM, "results 
array");
-    if (!sobol_init(s, sdim, seed)) { bu_free(s, "sobol data"); return NULL; }
-    return s;
-}
-
-void bn_sobol_destroy(struct bn_soboldata *sd)
-{
-    if (sd) {
-       bu_free(sd->mdata, "sobol mdata");
-       bu_free(sd->x, "sobol x");
-       bu_free(sd->b, "sobol b");
-       bu_free(sd->cvec, "sobol cvec");
-       bu_free(sd, "sobol");
-    }
-}
-
-/* return next vector in Sobol sequence, scaled to (lb[i], ub[i]) interval */
-double *bn_sobol_next(struct bn_soboldata *s, const double *lb, const double 
*ub)
-{
-    unsigned int i;
-    bn_sobol_next_01(s);
-    if (lb && ub) {
-       for (i = 0; i < s->sdim; ++i) {
-           s->cvec[i] = lb[i] + (ub[i] - lb[i]) * s->cvec[i];
-       }
-    }
-    return s->cvec;
-}
-
-/* Joe and Kuo (2003), per Acworth et al (1998) */
-void bn_sobol_skip(struct bn_soboldata *s, unsigned n)
-{
-    if (s) {
-       unsigned int k = 1;
-       while (k*2 < n) k *= 2;
-       while (k-- > 0) sobol_gen(s, s->cvec);
-    }
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
-

Modified: brlcad/branches/extbuild/src/libbn/tabdata.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/tabdata.c        2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbn/tabdata.c        2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -25,6 +25,7 @@
 #include "bio.h"
 
 #include "bu/debug.h"
+#include "bu/assert.h"
 #include "bu/log.h"
 #include "bu/malloc.h"
 #include "bu/parallel.h"
@@ -915,7 +916,7 @@
     char       *cp;
     size_t nbytes;
     size_t len;
-    int got;
+    ssize_t got;
     int        fd;
     size_t i;
 
@@ -947,7 +948,7 @@
            perror(filename);
            bu_log("bn_tabdata_binary_read read error on \"%s\"\n", filename);
        } else {
-           bu_log("bn_tabdata_binary_read(%s) expected %zu got %d\n", 
filename, len, got);
+           bu_log("bn_tabdata_binary_read(%s) expected %zu got %zd\n", 
filename, len, got);
        }
        bu_free(data, "bn_tabdata[]");
        bu_semaphore_acquire(BU_SEM_SYSCALL);

Modified: brlcad/branches/extbuild/src/libbn/tests/vlist.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/tests/vlist.c    2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbn/tests/vlist.c    2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -38,7 +38,7 @@
     point_t ptzero = VINIT_ZERO;
     struct bu_list head;
     struct bu_list vlfree;
-    int cmd_cnt_length = 0;
+    size_t cmd_cnt_length = 0;
     int expected_length = 0;
 
     sscanf(argv[1], "%d", &expected_length);
@@ -50,7 +50,7 @@
     BU_LIST_INIT(&head);
     BU_LIST_INIT(&vlfree);
     if (expected_length < 0) {
-       return bn_vlist_cmd_cnt(NULL);
+       return (int)bn_vlist_cmd_cnt(NULL);
     }
 
     for (int i = 0; i < expected_length; i++) {
@@ -59,7 +59,7 @@
 
     cmd_cnt_length = bn_vlist_cmd_cnt((struct bn_vlist*) & head);
 
-    return !(expected_length == cmd_cnt_length);
+    return !((size_t)expected_length == cmd_cnt_length);
 }
 
 

Modified: brlcad/branches/extbuild/src/libbn/vlist.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/vlist.c  2020-11-30 15:45:42 UTC (rev 
77829)
+++ brlcad/branches/extbuild/src/libbn/vlist.c  2020-11-30 15:50:27 UTC (rev 
77830)
@@ -109,12 +109,12 @@
 }
 
 int
-bn_vlist_bbox(struct bu_list *vlistp, point_t *bmin, point_t *bmax, int 
*length) 
+bn_vlist_bbox(struct bu_list *vlistp, point_t *bmin, point_t *bmax, size_t 
*length)
 {
     struct bn_vlist* vp;
     int cmd = 0;
     int disp_mode = 0;
-    int len = 0;
+    size_t len = 0;
     for (BU_LIST_FOR(vp, bn_vlist, vlistp)) {
        cmd = bn_vlist_bbox_internal(vp, bmin, bmax, &disp_mode);
        if (cmd) {

Index: brlcad/branches/extbuild/src/libbu
===================================================================
--- brlcad/branches/extbuild/src/libbu  2020-11-30 15:45:42 UTC (rev 77829)
+++ brlcad/branches/extbuild/src/libbu  2020-11-30 15:50:27 UTC (rev 77830)

Property changes on: brlcad/branches/extbuild/src/libbu
___________________________________________________________________
Modified: svn:mergeinfo
## -3,4 +3,4 ##
 
/brlcad/branches/brep-debug/src/libbu:69168,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/dm-fb-merge/src/libbu:75426-76198
 /brlcad/branches/tcltk86/src/libbu:68300-75257
-/brlcad/trunk/src/libbu:77547-77657,77690-77770
\ No newline at end of property
+/brlcad/trunk/src/libbu:77547-77657,77690-77770,77784-77829
\ No newline at end of property
Modified: brlcad/branches/extbuild/src/libbu/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/src/libbu/CMakeLists.txt   2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbu/CMakeLists.txt   2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -41,6 +41,8 @@
   set_property(SOURCE y2038/time64.c APPEND PROPERTY COMPILE_FLAGS "-fPIC")
 endif(HAVE_FPIC)
 
+set_property(SOURCE fort.c APPEND PROPERTY COMPILE_FLAGS "-g -ggdb -O0")
+
 set(LIBBU_SOURCES
   y2038/time64.c
   affinity.c
@@ -71,6 +73,7 @@
   fchmod.c
   fgets.c
   file.c
+  fort.c
   fnmatch.c
   getcwd.c
   gethostname.c
@@ -117,6 +120,7 @@
   str.c
   tc.c
   tcllist.c
+  tbl.c
   temp.c
   thread.cpp
   units.c
@@ -172,6 +176,7 @@
   CMakeLists.txt
   bitv.h
   charclass.h
+  fort.h
   mime.cmake
   parallel.h
   process.h

Modified: brlcad/branches/extbuild/src/libbu/color.cpp
===================================================================
--- brlcad/branches/extbuild/src/libbu/color.cpp        2020-11-30 15:45:42 UTC 
(rev 77829)
+++ brlcad/branches/extbuild/src/libbu/color.cpp        2020-11-30 15:50:27 UTC 
(rev 77830)
@@ -26,13 +26,13 @@
 #include <string.h>
 #include <stdarg.h>
 #include <errno.h>
+#include <random>
 #include "bio.h"
 
-#include <random>
-
 #include "bu/color.h"
 #include "bu/log.h"
 #include "bu/malloc.h"
+#include "bu/assert.h"
 
 
 #define COMMA ','

Copied: brlcad/branches/extbuild/src/libbu/fort.c (from rev 77829, 
brlcad/trunk/src/libbu/fort.c)
===================================================================
--- brlcad/branches/extbuild/src/libbu/fort.c                           (rev 0)
+++ brlcad/branches/extbuild/src/libbu/fort.c   2020-11-30 15:50:27 UTC (rev 
77830)
@@ -0,0 +1,7754 @@
+/*
+libfort
+
+MIT License
+
+Copyright (c) 2017 - 2020 Seleznev Anton
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/* The file was GENERATED by an amalgamation script.*/
+/* DO NOT EDIT BY HAND!!! */
+
+
+#define FT_AMALGAMED_SOURCE /* Macros to make internal libfort functions 
static */
+
+
+/********************************************************
+   Begin of file "fort_utils.h"
+ ********************************************************/
+
+#ifndef FORT_IMPL_H
+#define FORT_IMPL_H
+
+#if defined(_MSC_VER)
+#define _CRT_SECURE_NO_WARNINGS /* To disable warnings for unsafe functions */
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <stdio.h>
+#include "fort.h"
+
+#include "bu/str.h"
+
+/* Define FT_INTERNAL to make internal libfort functions static
+ * in the result amalgamed source file.
+ */
+#ifdef FT_AMALGAMED_SOURCE
+#define FT_INTERNAL static
+#else
+#define FT_INTERNAL
+#endif /* FT_AMALGAMED_SORCE */
+
+
+#define FORT_DEFAULT_COL_SEPARATOR '|'
+extern char g_col_separator;
+
+#define FORT_COL_SEPARATOR_LENGTH 1
+
+#define FORT_UNUSED  __attribute__((unused))
+
+#define F_MALLOC fort_malloc
+#define F_FREE fort_free
+#define F_CALLOC fort_calloc
+#define F_REALLOC fort_realloc
+#define F_STRDUP fort_strdup
+#define F_WCSDUP fort_wcsdup
+/* @todo: replace with custom impl !!!*/
+#define F_UTF8DUP utf8dup
+
+#define F_CREATE(type) ((type *)F_CALLOC(sizeof(type), 1))
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#define FT_NEWLINE "\n"
+#define FT_SPACE " "
+
+/*****************************************************************************
+ *               DEFAULT_SIZES
+ * ***************************************************************************/
+#define DEFAULT_STR_BUF_SIZE 1024
+#define DEFAULT_VECTOR_CAPACITY 10
+
+/*****************************************************************************
+ *               DATA TYPES
+ * ***************************************************************************/
+
+enum f_get_policy {
+    CREATE_ON_NULL,
+    DONT_CREATE_ON_NULL
+};
+
+enum f_bool {
+    F_FALSE = 0,
+    F_TRUE = 1
+};
+
+enum f_cell_type {
+    COMMON_CELL,
+    GROUP_MASTER_CELL,
+    GROUP_SLAVE_CELL
+};
+
+enum f_geometry_type {
+    VISIBLE_GEOMETRY,
+    INTERN_REPR_GEOMETRY
+};
+
+enum f_string_type {
+    CHAR_BUF,
+#ifdef FT_HAVE_WCHAR
+    W_CHAR_BUF,
+#endif /* FT_HAVE_WCHAR */
+#ifdef FT_HAVE_UTF8
+    UTF8_BUF,
+#endif /* FT_HAVE_WCHAR */
+};
+
+struct f_string_view {
+    union {
+        const char *cstr;
+#ifdef FT_HAVE_WCHAR
+        const wchar_t *wstr;
+#endif
+#ifdef FT_HAVE_UTF8
+        const void *u8str;
+#endif
+        const void *data;
+    } u;
+    enum f_string_type type;
+};
+typedef struct f_string_view f_string_view_t;
+
+
+#define FT_STR_2_CAT_(arg1, arg2) \
+    arg1##arg2
+#define FT_STR_2_CAT(arg1, arg2) \
+    FT_STR_2_CAT_(arg1, arg2)
+
+#define UNIQUE_NAME_(prefix) \
+    FT_STR_2_CAT(prefix,__COUNTER__)
+#define UNIQUE_NAME(prefix) \
+    UNIQUE_NAME_(prefix)
+
+typedef int f_status;
+
+
+
+
+struct f_table_properties;
+struct f_row;
+struct f_vector;
+struct f_cell;
+struct f_string_buffer;
+struct f_separator {
+    int enabled;
+};
+
+typedef struct f_table_properties f_table_properties_t;
+typedef struct f_vector f_vector_t;
+typedef struct f_cell f_cell_t;
+typedef struct f_string_buffer f_string_buffer_t;
+typedef struct f_row f_row_t;
+typedef struct f_separator f_separator_t;
+
+struct f_context {
+    f_table_properties_t *table_properties;
+    size_t row;
+    size_t column;
+};
+typedef struct f_context f_context_t;
+
+struct f_conv_context {
+    union {
+        char *buf;
+#ifdef FT_HAVE_WCHAR
+        wchar_t *wbuf;
+#endif
+#ifdef FT_HAVE_UTF8
+        const void *u8str;
+#endif
+    } u;
+    size_t raw_avail;
+    struct f_context *cntx;
+    enum f_string_type b_type;
+};
+typedef struct f_conv_context f_conv_context_t;
+
+
+/*****************************************************************************
+ *               LIBFORT helpers
+ *****************************************************************************/
+
+extern void *(*fort_malloc)(size_t size);
+extern void (*fort_free)(void *ptr);
+extern void *(*fort_calloc)(size_t nmemb, size_t size);
+extern void *(*fort_realloc)(void *ptr, size_t size);
+
+FT_INTERNAL
+void set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void 
*ptr));
+
+FT_INTERNAL
+char *fort_strdup(const char *str);
+
+
+
+FT_INTERNAL
+size_t number_of_columns_in_format_string(const f_string_view_t *fmt);
+
+FT_INTERNAL
+size_t number_of_columns_in_format_buffer(const f_string_buffer_t *fmt);
+
+#if defined(FT_HAVE_WCHAR)
+FT_INTERNAL
+wchar_t *fort_wcsdup(const wchar_t *str);
+#endif
+
+
+
+FT_INTERNAL
+int print_n_strings(f_conv_context_t *cntx, size_t n, const char *str);
+
+
+FT_INTERNAL
+int ft_nprint(f_conv_context_t *cntx, const char *str, size_t strlen);
+#ifdef FT_HAVE_WCHAR
+FT_INTERNAL
+int ft_nwprint(f_conv_context_t *cntx, const wchar_t *str, size_t strlen);
+#endif /* FT_HAVE_WCHAR */
+#ifdef FT_HAVE_UTF8
+FT_INTERNAL
+int ft_nu8print(f_conv_context_t *cntx, const void *beg, const void *end);
+#endif /* FT_HAVE_UTF8 */
+
+
+/*#define PRINT_DEBUG_INFO fprintf(stderr, "error in %s(%s:%d)\n", 
__FUNCTION__, __FILE__, __LINE__);*/
+#define PRINT_DEBUG_INFO
+
+#define FT_CHECK(statement) \
+    do { \
+        tmp = statement; \
+        if (tmp < 0) {\
+            PRINT_DEBUG_INFO \
+            goto clear; \
+        } \
+    } while(0)
+
+#define CHCK_RSLT_ADD_TO_WRITTEN(statement) \
+    do { \
+        tmp = statement; \
+        if (tmp < 0) {\
+            PRINT_DEBUG_INFO \
+            goto clear; \
+        } \
+        written += (size_t)tmp; \
+    } while(0)
+
+#define CHCK_RSLT_ADD_TO_INVISIBLE_WRITTEN(statement) \
+    do { \
+        tmp = statement; \
+        if (tmp < 0) {\
+            PRINT_DEBUG_INFO \
+            goto clear; \
+        } \
+        invisible_written += (size_t)tmp; \
+    } while(0)
+
+
+#define CHECK_NOT_NEGATIVE(x) \
+    do { if ((x) < 0) goto fort_fail; } while (0)
+
+#endif /* FORT_IMPL_H */
+
+/********************************************************
+   End of file "fort_utils.h"
+ ********************************************************/
+
+
+/********************************************************
+   Begin of file "vector.h"
+ ********************************************************/
+
+#ifndef VECTOR_H
+#define VECTOR_H
+
+/* #include "fort_utils.h" */ /* Commented by amalgamation script */
+
+
+#define INVALID_VEC_INDEX ((size_t) -1)
+
+FT_INTERNAL
+f_vector_t *create_vector(size_t item_size, size_t capacity);
+
+FT_INTERNAL
+void destroy_vector(f_vector_t *);
+
+FT_INTERNAL
+size_t vector_size(const f_vector_t *);
+
+FT_INTERNAL
+size_t vector_capacity(const f_vector_t *);
+
+FT_INTERNAL
+int vector_push(f_vector_t *, const void *item);
+
+FT_INTERNAL
+int vector_insert(f_vector_t *, const void *item, size_t pos);
+
+FT_INTERNAL
+f_vector_t *vector_split(f_vector_t *, size_t pos);
+
+FT_INTERNAL
+const void *vector_at_c(const f_vector_t *vector, size_t index);
+
+FT_INTERNAL
+void *vector_at(f_vector_t *, size_t index);
+
+FT_INTERNAL
+f_status vector_swap(f_vector_t *cur_vec, f_vector_t *mv_vec, size_t pos);
+
+FT_INTERNAL
+void vector_clear(f_vector_t *);
+
+FT_INTERNAL
+int vector_erase(f_vector_t *, size_t index);
+
+#ifdef FT_TEST_BUILD
+f_vector_t *copy_vector(f_vector_t *);
+size_t vector_index_of(const f_vector_t *, const void *item);
+#endif
+
+#define VECTOR_AT(vector, pos, data_type) \
+    *(data_type *)vector_at((vector), (pos))
+
+#define VECTOR_AT_C(vector, pos, const_data_type) \
+    *(const_data_type *)vector_at_c((vector), (pos))
+
+#endif /* VECTOR_H */
+
+/********************************************************
+   End of file "vector.h"
+ ********************************************************/
+
+
+/********************************************************
+   Begin of file "wcwidth.h"
+ ********************************************************/
+
+#ifndef WCWIDTH_H
+#define WCWIDTH_H
+
+/* #include "fort_utils.h" */ /* Commented by amalgamation script */
+
+#ifdef FT_HAVE_WCHAR
+#include <wchar.h>
+
+FT_INTERNAL
+int mk_wcswidth(const wchar_t *pwcs, size_t n);
+
+#endif /* FT_HAVE_WCHAR */
+
+#endif /* WCWIDTH_H */
+
+/********************************************************
+   End of file "wcwidth.h"
+ ********************************************************/
+
+
+/********************************************************
+   Begin of file "utf8.h"
+ ********************************************************/
+
+// The latest version of this library is available on GitHub;
+// https://github.com/sheredom/utf8.h
+
+// This is free and unencumbered software released into the public domain.
+//
+// Anyone is free to copy, modify, publish, use, compile, sell, or
+// distribute this software, either in source code form or as a compiled
+// binary, for any purpose, commercial or non-commercial, and by any
+// means.
+//
+// In jurisdictions that recognize copyright laws, the author or authors
+// of this software dedicate any and all copyright interest in the
+// software to the public domain. We make this dedication for the benefit
+// of the public at large and to the detriment of our heirs and
+// successors. We intend this dedication to be an overt act of
+// relinquishment in perpetuity of all present and future rights to this
+// software under copyright law.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+// For more information, please refer to <http://unlicense.org/>
+
+#ifndef SHEREDOM_UTF8_H_INCLUDED
+#define SHEREDOM_UTF8_H_INCLUDED
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+
+// disable 'bytes padding added after construct' warning
+#pragma warning(disable : 4820)
+#endif
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#if defined(_MSC_VER)
+typedef __int32 utf8_int32_t;
+#else
+#include <stdint.h>
+typedef int32_t utf8_int32_t;
+#endif
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wold-style-cast"
+#pragma clang diagnostic ignored "-Wcast-qual"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__clang__) || defined(__GNUC__)
+#define utf8_nonnull __attribute__((nonnull))
+#define utf8_pure __attribute__((pure))
+#define utf8_restrict __restrict__
+#define utf8_weak __attribute__((weak))
+#elif defined(_MSC_VER)
+#define utf8_nonnull
+#define utf8_pure
+#define utf8_restrict __restrict
+#define utf8_weak __inline
+#else
+#define utf8_nonnull
+#define utf8_pure
+#define utf8_restrict
+#define utf8_weak inline
+#endif
+
+#ifdef __cplusplus
+#define utf8_null NULL
+#else
+#define utf8_null 0
+#endif
+
+// Return less than 0, 0, greater than 0 if src1 < src2, src1 == src2, src1 >
+// src2 respectively, case insensitive.
+utf8_nonnull utf8_pure utf8_weak int utf8casecmp(const void *src1,
+        const void *src2);
+
+// Append the utf8 string src onto the utf8 string dst.
+utf8_nonnull utf8_weak void *utf8cat(void *utf8_restrict dst,
+                                     const void *utf8_restrict src);
+
+// Find the first match of the utf8 codepoint chr in the utf8 string src.
+utf8_nonnull utf8_pure utf8_weak void *utf8chr(const void *src,
+        utf8_int32_t chr);
+
+// Return less than 0, 0, greater than 0 if src1 < src2,
+// src1 == src2, src1 > src2 respectively.
+utf8_nonnull utf8_pure utf8_weak int utf8cmp(const void *src1,
+        const void *src2);
+
+// Copy the utf8 string src onto the memory allocated in dst.
+utf8_nonnull utf8_weak void *utf8cpy(void *utf8_restrict dst,
+                                     const void *utf8_restrict src);
+
+// Number of utf8 codepoints in the utf8 string src that consists entirely
+// of utf8 codepoints not from the utf8 string reject.
+utf8_nonnull utf8_pure utf8_weak size_t utf8cspn(const void *src,
+        const void *reject);
+
+// Duplicate the utf8 string src by getting its size, malloc'ing a new buffer
+// copying over the data, and returning that. Or 0 if malloc failed.
+utf8_nonnull utf8_weak void *utf8dup(const void *src);
+
+// Number of utf8 codepoints in the utf8 string str,
+// excluding the null terminating byte.
+utf8_nonnull utf8_pure utf8_weak size_t utf8len(const void *str);
+
+// Visible width of utf8string.
+utf8_nonnull utf8_pure utf8_weak size_t utf8width(const void *str);
+
+// Visible width of codepoint.
+utf8_nonnull utf8_pure utf8_weak int utf8cwidth(utf8_int32_t c);
+
+// Return less than 0, 0, greater than 0 if src1 < src2, src1 == src2, src1 >
+// src2 respectively, case insensitive. Checking at most n bytes of each utf8
+// string.
+utf8_nonnull utf8_pure utf8_weak int utf8ncasecmp(const void *src1,
+        const void *src2, size_t n);
+
+// Append the utf8 string src onto the utf8 string dst,
+// writing at most n+1 bytes. Can produce an invalid utf8
+// string if n falls partway through a utf8 codepoint.
+utf8_nonnull utf8_weak void *utf8ncat(void *utf8_restrict dst,
+                                      const void *utf8_restrict src, size_t n);
+
+// Return less than 0, 0, greater than 0 if src1 < src2,
+// src1 == src2, src1 > src2 respectively. Checking at most n
+// bytes of each utf8 string.
+utf8_nonnull utf8_pure utf8_weak int utf8ncmp(const void *src1,
+        const void *src2, size_t n);
+
+// Copy the utf8 string src onto the memory allocated in dst.
+// Copies at most n bytes. If there is no terminating null byte in
+// the first n bytes of src, the string placed into dst will not be
+// null-terminated. If the size (in bytes) of src is less than n,
+// extra null terminating bytes are appended to dst such that at
+// total of n bytes are written. Can produce an invalid utf8
+// string if n falls partway through a utf8 codepoint.
+utf8_nonnull utf8_weak void *utf8ncpy(void *utf8_restrict dst,
+                                      const void *utf8_restrict src, size_t n);
+
+// Similar to utf8dup, except that at most n bytes of src are copied. If src is
+// longer than n, only n bytes are copied and a null byte is added.
+//
+// Returns a new string if successful, 0 otherwise
+utf8_nonnull utf8_weak void *utf8ndup(const void *src, size_t n);
+
+// Locates the first occurence in the utf8 string str of any byte in the
+// utf8 string accept, or 0 if no match was found.
+utf8_nonnull utf8_pure utf8_weak void *utf8pbrk(const void *str,
+        const void *accept);
+
+// Find the last match of the utf8 codepoint chr in the utf8 string src.
+utf8_nonnull utf8_pure utf8_weak void *utf8rchr(const void *src, int chr);
+
+// Number of bytes in the utf8 string str,
+// including the null terminating byte.
+utf8_nonnull utf8_pure utf8_weak size_t utf8size(const void *str);
+
+// Number of utf8 codepoints in the utf8 string src that consists entirely
+// of utf8 codepoints from the utf8 string accept.
+utf8_nonnull utf8_pure utf8_weak size_t utf8spn(const void *src,
+        const void *accept);
+
+// The position of the utf8 string needle in the utf8 string haystack.
+utf8_nonnull utf8_pure utf8_weak void *utf8str(const void *haystack,
+        const void *needle);
+
+// The position of the utf8 string needle in the utf8 string haystack, case
+// insensitive.
+utf8_nonnull utf8_pure utf8_weak void *utf8casestr(const void *haystack,
+        const void *needle);
+
+// Return 0 on success, or the position of the invalid
+// utf8 codepoint on failure.
+utf8_nonnull utf8_pure utf8_weak void *utf8valid(const void *str);
+
+// Sets out_codepoint to the next utf8 codepoint in str, and returns the 
address
+// of the utf8 codepoint after the current one in str.
+utf8_nonnull utf8_weak void *
+utf8codepoint(const void *utf8_restrict str,
+              utf8_int32_t *utf8_restrict out_codepoint);
+
+// Returns the size of the given codepoint in bytes.
+utf8_weak size_t utf8codepointsize(utf8_int32_t chr);
+
+// Write a codepoint to the given string, and return the address to the next
+// place after the written codepoint. Pass how many bytes left in the buffer to

@@ Diff output truncated at 100000 characters. @@
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