Revision: 71931
          http://sourceforge.net/p/brlcad/code/71931
Author:   starseeker
Date:     2018-10-01 15:43:16 +0000 (Mon, 01 Oct 2018)
Log Message:
-----------
merging RELEASE branch to STABLE branch, r71918 through r71930

Modified Paths:
--------------
    brlcad/branches/STABLE/TODO
    brlcad/branches/STABLE/include/bu/file.h
    brlcad/branches/STABLE/src/libbu/dir.c
    brlcad/branches/STABLE/src/libged/facetize.c
    brlcad/branches/STABLE/src/librt/cache.c
    brlcad/branches/STABLE/src/librt/tree.c

Property Changed:
----------------
    brlcad/branches/STABLE/
    brlcad/branches/STABLE/CHANGES
    brlcad/branches/STABLE/NEWS
    brlcad/branches/STABLE/bench/
    brlcad/branches/STABLE/db/
    brlcad/branches/STABLE/doc/
    brlcad/branches/STABLE/doc/STRATEGY
    brlcad/branches/STABLE/doc/docbook/articles/
    brlcad/branches/STABLE/doc/docbook/books/
    brlcad/branches/STABLE/doc/docbook/lessons/
    brlcad/branches/STABLE/include/
    brlcad/branches/STABLE/regress/
    brlcad/branches/STABLE/regress/repository.sh
    brlcad/branches/STABLE/src/libged/polyclip.cpp
    brlcad/branches/STABLE/src/other/

Index: brlcad/branches/STABLE
===================================================================
--- brlcad/branches/STABLE      2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE      2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE:66164
 
/brlcad/branches/brep-debug:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl:65867-66137
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
-/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-66123,66128-66132,66134-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-66123,66128-66132,66134-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/CHANGES
===================================================================
--- brlcad/branches/STABLE/CHANGES      2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/CHANGES      2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/CHANGES
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/CHANGES:60491,60626-60628,61063,61076-66129,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/CHANGES:60491,60626-60628,61063,61076-66129,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/CHANGES:66164
 
/brlcad/branches/brep-debug/CHANGES:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/CHANGES:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/CHANGES:65867-66137
 /brlcad/branches/osg/CHANGES:62110-62113
 /brlcad/branches/prep-cache/CHANGES:68236-68933
-/brlcad/trunk/CHANGES:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-54103,55606-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/CHANGES:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-54103,55606-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/NEWS
===================================================================
--- brlcad/branches/STABLE/NEWS 2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/NEWS 2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/NEWS:60491,61063,61075-66129,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/NEWS:60491,61063,61075-66129,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/NEWS:66164
 
/brlcad/branches/brep-debug/NEWS:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/NEWS:62518
## -8,4 +8,4 ##
 /brlcad/branches/osg/NEWS:62110-62113
 /brlcad/branches/prep-cache/NEWS:68236-68933
 /brlcad/trunk:68170-68252
-/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Modified: brlcad/branches/STABLE/TODO
===================================================================
--- brlcad/branches/STABLE/TODO 2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/TODO 2018-10-01 15:43:16 UTC (rev 71931)
@@ -22,36 +22,18 @@
 THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
 -------------------------------------------------------
 
-* prep caching
- ** implement a function to consolidate bu_brlcad_root,
-    bu_brlcad_data, and bu_brlcad_dir.  Pass in a bu_locate_t enum,
-    the relative path, and the log/no-log flag.  Intent is to support
-    flexibility implied by presence of BIN_DIR, LIB_DIR, etc. build
-    settings.  Will need great care to ensure correct behavior is
-    preserved - bu_brlcad_root and bu_brlcad_data will need verbose
-    deprecation process, once bu_locate is implemented.  Also will
-    need matching tcl function.
+* finish implementation and testing of bu_dir. bu_brlcad_root and
+  bu_brlcad_data will need verbose deprecation process.  Also need
+  need matching tcl function.
 
-    const char *
-    bu_dir(const char *path, int (log*)(const char *, ...));
+* Need to eliminate bu_argv0_full_path and rework the bu_brlcad_*
+  functions that currently rely on it to take that path as a
+  parameter from the calling application.  The library shouldn't be
+  responsible for managing that path - there are too many issues
+  with doing so.  The current approach fixes some concerns but
+  breaks if an application changes its notion of the current working
+  directory after initialization, for example.
 
-    Examples:
-    bu_dir(B_ROOT, NULL); /* returns application "root" */
-    bu_dir(B_CWD, NULL); /* returns current working directory */
-    bu_dir(B_SHARE, bu_log); /* returns app share dir, logs via bu_log */
-    bu_dir(B_TEMP, NULL); /* returns an mkdtemp directory?? */
-    bu_dir(B_CACHE, NULL); /* returns a read/write cache dir */
-    bu_dir(B_CONFIG, NULL); /* returns a read/write config dir, e.g., 
~/.brlcad */
-
- ** Need to eliminate bu_argv0_full_path and rework the bu_brlcad_*
-    functions that currently rely on it to take that path as a
-    parameter from the calling application.  The library shouldn't be
-    responsible for managing that path - there are too many issues
-    with doing so.  The current approach fixes some concerns but
-    breaks if an application changes its notion of the current working
-    directory after initialization, for example.
-
-
 * tree command shouldn't infinite loop when encountering a cyclic
   path - need to print a warning and stop walking.  Requries full
   path awareness in tree command walk.

Index: brlcad/branches/STABLE/bench
===================================================================
--- brlcad/branches/STABLE/bench        2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/bench        2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/bench
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/bench:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/bench:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/bench:66164
 
/brlcad/branches/brep-debug/bench:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/bench:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/bench:65867-66137
 /brlcad/branches/osg/bench:62110-62113
 /brlcad/branches/prep-cache/bench:68236-68933
-/brlcad/trunk/bench:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/bench:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/db
===================================================================
--- brlcad/branches/STABLE/db   2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/db   2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/db
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/db:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/db:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/db:66164
 
/brlcad/branches/brep-debug/db:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/db:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/db:65867-66137
 /brlcad/branches/osg/db:62110-62113
 /brlcad/branches/prep-cache/db:68236-68933
-/brlcad/trunk/db:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/db:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/doc
===================================================================
--- brlcad/branches/STABLE/doc  2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/doc  2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/doc
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/doc:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/doc:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/doc:66164
 
/brlcad/branches/brep-debug/doc:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/doc:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/doc:65867-66137
 /brlcad/branches/osg/doc:62110-62113
 /brlcad/branches/prep-cache/doc:68236-68933
-/brlcad/trunk/doc:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/doc:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/doc/STRATEGY
===================================================================
--- brlcad/branches/STABLE/doc/STRATEGY 2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/doc/STRATEGY 2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/doc/STRATEGY
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/doc/STRATEGY:60491,61063,61075-66129,66135,66164,66169,68098-68615,68617-71918
+/brlcad/branches/RELEASE/doc/STRATEGY:60491,61063,61075-66129,66135,66164,66169,68098-68615,68617-71930
 /brlcad/branches/STABLE/doc/STRATEGY:66164
 
/brlcad/branches/brep-debug/doc/STRATEGY:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/doc/STRATEGY:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/doc/STRATEGY:65867-66137
 /brlcad/branches/osg/doc/STRATEGY:62110-62113
 /brlcad/branches/prep-cache/doc/STRATEGY:68236-68933
-/brlcad/trunk/doc/STRATEGY:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-66807,67001-71912
\ No newline at end of property
+/brlcad/trunk/doc/STRATEGY:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-66807,67001-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/doc/docbook/articles
===================================================================
--- brlcad/branches/STABLE/doc/docbook/articles 2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/doc/docbook/articles 2018-10-01 15:43:16 UTC (rev 
71931)

Property changes on: brlcad/branches/STABLE/doc/docbook/articles
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +1 ##
+/brlcad/trunk/doc/docbook/articles:71913-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/doc/docbook/books
===================================================================
--- brlcad/branches/STABLE/doc/docbook/books    2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/doc/docbook/books    2018-10-01 15:43:16 UTC (rev 
71931)

Property changes on: brlcad/branches/STABLE/doc/docbook/books
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/doc/docbook/books:60491,70332-71918
+/brlcad/branches/RELEASE/doc/docbook/books:60491,70332-71930
 
/brlcad/branches/brep-debug/doc/docbook/books:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/doc/docbook/books:62518
 /brlcad/branches/cmake/doc/docbook/books:43219
## -6,4 +6,4 ##
 /brlcad/branches/opencl/doc/docbook/books:65867-66137
 /brlcad/branches/osg/doc/docbook/books:62110-62113
 /brlcad/branches/prep-cache/doc/docbook/books:68236-68933
-/brlcad/trunk/doc/docbook/books:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71912
\ No newline at end of property
+/brlcad/trunk/doc/docbook/books:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/doc/docbook/lessons
===================================================================
--- brlcad/branches/STABLE/doc/docbook/lessons  2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/doc/docbook/lessons  2018-10-01 15:43:16 UTC (rev 
71931)

Property changes on: brlcad/branches/STABLE/doc/docbook/lessons
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +1 ##
+/brlcad/trunk/doc/docbook/lessons:71913-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/include
===================================================================
--- brlcad/branches/STABLE/include      2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/include      2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/include
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/include:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/include:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/include:66164
 
/brlcad/branches/brep-debug/include:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/include:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/include:65867-66137
 /brlcad/branches/osg/include:62110-62113
 /brlcad/branches/prep-cache/include:68236-68933
-/brlcad/trunk/include:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/include:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Modified: brlcad/branches/STABLE/include/bu/file.h
===================================================================
--- brlcad/branches/STABLE/include/bu/file.h    2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/include/bu/file.h    2018-10-01 15:43:16 UTC (rev 
71931)
@@ -51,8 +51,8 @@
 /**
  * Returns truthfully whether the given file path exists or not.  An
  * empty or NULL path name is treated as a non-existent file and, as
- * such, will return false.  If fd is non-NULL, it will be set to an
- * open file descriptor for the provided path.
+ * such, will return false.  If fd is non-NULL, it will be set to a
+ * read-only open file descriptor for the provided path.
  *
  * @return >0 The given filename exists.
  * @return 0 The given filename does not exist.

Index: brlcad/branches/STABLE/regress
===================================================================
--- brlcad/branches/STABLE/regress      2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/regress      2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/regress
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/regress:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/regress:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/regress:66164
 
/brlcad/branches/brep-debug/regress:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/regress:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/regress:65867-66137
 /brlcad/branches/osg/regress:62110-62113
 /brlcad/branches/prep-cache/regress:68236-68933
-/brlcad/trunk/regress:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/regress:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Index: brlcad/branches/STABLE/regress/repository.sh
===================================================================
--- brlcad/branches/STABLE/regress/repository.sh        2018-10-01 15:28:27 UTC 
(rev 71930)
+++ brlcad/branches/STABLE/regress/repository.sh        2018-10-01 15:43:16 UTC 
(rev 71931)

Property changes on: brlcad/branches/STABLE/regress/repository.sh
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/regress/repository.sh:60491,70332-71918
+/brlcad/branches/RELEASE/regress/repository.sh:60491,70332-71930
 
/brlcad/branches/brep-debug/regress/repository.sh:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/regress/repository.sh:62518
 /brlcad/branches/cmake/regress/repository.sh:43219
## -6,4 +6,4 ##
 /brlcad/branches/opencl/regress/repository.sh:65867-66137
 /brlcad/branches/osg/regress/repository.sh:62110-62113
 /brlcad/branches/prep-cache/regress/repository.sh:68236-68933
-/brlcad/trunk/regress/repository.sh:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71912
\ No newline at end of property
+/brlcad/trunk/regress/repository.sh:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
Modified: brlcad/branches/STABLE/src/libbu/dir.c
===================================================================
--- brlcad/branches/STABLE/src/libbu/dir.c      2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/src/libbu/dir.c      2018-10-01 15:43:16 UTC (rev 
71931)
@@ -49,6 +49,18 @@
 #include "bu/file.h"
 
 
+static const char DSLASH[2] = {BU_DIR_SEPARATOR, '\0'};
+
+
+static void
+nibble_trailing_slash(char *path)
+{
+    if ((strlen(path) > 1) && path[strlen(path)-1] == BU_DIR_SEPARATOR) {
+       path[strlen(path)-1] = '\0'; /* nibble any trailing slash */
+    }
+}
+
+
 static const char *
 dir_temp(char *buf, size_t len)
 {
@@ -116,6 +128,8 @@
        }
     }
 
+    nibble_trailing_slash(path);
+
     bu_strlcpy(buf, path, len);
     return buf;
 }
@@ -172,6 +186,8 @@
        bu_strlcpy(path, root, MAXPATHLEN);
     }
 
+    nibble_trailing_slash(path);
+
     bu_strlcpy(buf, path, len);
     return buf;
 }
@@ -218,8 +234,8 @@
     if (BU_STR_EMPTY(path)) {
        dir_home(temp, MAXPATHLEN);
        bu_strlcat(path, temp, MAXPATHLEN);
-       /* FIXME: assumes slash */
-       bu_strlcat(path, "/.cache", MAXPATHLEN);
+       bu_strlcat(path, DSLASH, MAXPATHLEN);
+       bu_strlcat(path, ".cache", MAXPATHLEN);
     }
 
     /* method 3: fallback to temp directory subdir */
@@ -226,13 +242,15 @@
     if (BU_STR_EMPTY(path)) {
        dir_temp(temp, MAXPATHLEN);
        bu_strlcat(path, temp, MAXPATHLEN);
-       /* FIXME: assumes slash */
-       bu_strlcat(path, "/.cache", MAXPATHLEN);
+       bu_strlcat(path, DSLASH, MAXPATHLEN);
+       bu_strlcat(path, ".cache", MAXPATHLEN);
     }
 
+    nibble_trailing_slash(path);
+
     /* finally, append our application subdirectory */
-    /* FIXME: assumes slash */
-    bu_strlcat(path, "/BRL-CAD", MAXPATHLEN);
+    bu_strlcat(path, DSLASH, MAXPATHLEN);
+    bu_strlcat(path, PACKAGE_NAME, MAXPATHLEN);
 
     bu_strlcpy(buf, path, len);
     return buf;
@@ -245,7 +263,8 @@
     char home[MAXPATHLEN] = {0};
 
     dir_home(home, MAXPATHLEN);
-    bu_strlcat(home, "/.config", MAXPATHLEN);
+    bu_strlcat(home, DSLASH, MAXPATHLEN);
+    bu_strlcat(home, ".config", MAXPATHLEN);
 
     if (len) {
        bu_strlcpy(buf, home, len);

Modified: brlcad/branches/STABLE/src/libged/facetize.c
===================================================================
--- brlcad/branches/STABLE/src/libged/facetize.c        2018-10-01 15:28:27 UTC 
(rev 71930)
+++ brlcad/branches/STABLE/src/libged/facetize.c        2018-10-01 15:43:16 UTC 
(rev 71931)
@@ -935,7 +935,7 @@
        free_pnts = 1;
 
        if (opts->verbosity) {
-           bu_log("SPSR: generating %d points from %s\n", objname);
+           bu_log("SPSR: generating %d points from %s\n", max_pnts, objname);
        }
 
        if (analyze_obj_to_pnts(pnts, &avg_thickness, gedp->ged_wdbp->dbip, 
objname, &btol, flags, max_pnts, opts->max_time, opts->verbosity)) {
@@ -1015,7 +1015,7 @@
            if (bot->faces) bu_free(bot->faces, "verts");
            ret = GED_FACETIZE_FAILURE;
            if (!opts->quiet) {
-               bu_log("SPSR: facetization failed, final BoT was not solid\n", 
bot->num_faces);
+               bu_log("SPSR: facetization failed, final BoT was not solid\n");
            }
            goto ged_facetize_spsr_memfree;
        }
@@ -1087,7 +1087,7 @@
     }
 
     if (decimation_succeeded && !opts->quiet) {
-       bu_log("SPSR: decimation succeeded, final BoT has %d faces\n", 
bot->num_faces);
+       bu_log("SPSR: decimation succeeded, final BoT has %d faces\n", 
(int)bot->num_faces);
     }
 
     if (!opts->make_nmg) {
@@ -1378,9 +1378,9 @@
            feature_size = successful_feature_size;
            if (!opts->quiet && bot->faces) {
                if (opts->feature_size <= 0) {
-                   bu_log("CM: unable to polygonize at target size (%g), using 
last successful BoT with %d faces, feature size %g\n", target_feature_size, 
bot->num_faces, successful_feature_size);
+                   bu_log("CM: unable to polygonize at target size (%g), using 
last successful BoT with %d faces, feature size %g\n", target_feature_size, 
(int)bot->num_faces, successful_feature_size);
                } else {
-                   bu_log("CM: successfully created %d faces, feature size 
%g\n", bot->num_faces, successful_feature_size);
+                   bu_log("CM: successfully created %d faces, feature size 
%g\n", (int)bot->num_faces, successful_feature_size);
                }
            }
        } else {
@@ -1400,7 +1400,7 @@
     }
 
     if (bot->num_faces && feature_size < target_feature_size && !opts->quiet) {
-       bu_log("CM: successfully polygonized BoT with %d faces at feature size 
%g\n", bot->num_faces, feature_size);
+       bu_log("CM: successfully polygonized BoT with %d faces at feature size 
%g\n", (int)bot->num_faces, feature_size);
     }
 
     if (!bot->faces) {
@@ -1480,7 +1480,7 @@
            if (bot->faces) bu_free(bot->faces, "verts");
            ret = GED_FACETIZE_FAILURE;
            if (!opts->quiet) {
-               bu_log("CM: facetization failed, final BoT was not solid\n", 
bot->num_faces);
+               bu_log("CM: facetization failed, final BoT was not solid\n");
            }
            goto ged_facetize_continuation_memfree;
        }
@@ -1487,7 +1487,7 @@
     }
 
     if (decimation_succeeded && !opts->quiet) {
-       bu_log("CM: decimation succeeded, final BoT has %d faces\n", 
bot->num_faces);
+       bu_log("CM: decimation succeeded, final BoT has %d faces\n", 
(int)bot->num_faces);
     }
 
     if (!opts->make_nmg) {
@@ -1665,7 +1665,7 @@
        if (flags & GED_FACETIZE_NMGBOOL) {
            opts->nmg_log_print_header = 1;
            if (argc == 1) {
-               bu_vls_sprintf(opts->nmg_log_header, "NMG: tessellating 
%s...\n", argv[0], tol->abs, tol->rel, tol->norm);
+               bu_vls_sprintf(opts->nmg_log_header, "NMG: tessellating 
%s...\n", argv[0]);
            } else {
                bu_vls_sprintf(opts->nmg_log_header, "NMG: tessellating %d 
objects with tolerances a=%g, r=%g, n=%g\n", argc, tol->abs, tol->rel, 
tol->norm);
            }
@@ -1906,7 +1906,7 @@
            bu_log("Error adding attribute %s to comb %s", attrav[3], rcname);
        }
        attrav[3] = "facetize:spsr_depth";
-       bu_vls_sprintf(&anum, "%g", opts->s_opts.depth);
+       bu_vls_sprintf(&anum, "%d", opts->s_opts.depth);
        attrav[4] = bu_vls_addr(&anum);
        if (ged_attr(gedp, 5, (const char **)&attrav) != GED_OK && 
opts->verbosity) {
            bu_log("Error adding attribute %s to comb %s", attrav[3], rcname);
@@ -2196,9 +2196,9 @@
     }
 
     /* Final report */
-    bu_vls_printf(gedp->ged_result_str, "Objects successfully converted: %d of 
%d\n", to_convert - BU_PTBL_LEN(ar2), to_convert);
+    bu_vls_printf(gedp->ged_result_str, "Objects successfully converted: %d of 
%d\n", (int)(to_convert - BU_PTBL_LEN(ar2)), to_convert);
     if (BU_PTBL_LEN(ar2)) {
-       bu_vls_printf(gedp->ged_result_str, "WARNING: %d objects failed:\n", 
BU_PTBL_LEN(ar2));
+       bu_vls_printf(gedp->ged_result_str, "WARNING: %d objects failed:\n", 
(int)BU_PTBL_LEN(ar2));
        for (i = 0; i < BU_PTBL_LEN(ar2); i++) {
            struct directory *n = (struct directory *)BU_PTBL_GET(ar2, i);
            const char *oname = bu_avs_get(&rnames, n->d_namep);
@@ -2469,7 +2469,7 @@
        }
        if (_ged_facetize_add_children(gedp, cdp, opts) != GED_OK) {
            if (!opts->quiet) {
-               bu_log("Error: duplication of assembly %s failed!\n", 
cdp->d_namep, BU_PTBL_LEN(pc));
+               bu_log("Error: duplication of assembly %s failed!\n", 
cdp->d_namep);
            }
            continue;
        }
@@ -2481,7 +2481,7 @@
        _ged_facetize_mkname(gedp, opts, n->d_namep, SOLID_OBJ_NAME);
        _ged_facetize_mkname(gedp, opts, n->d_namep, COMB_OBJ_NAME);
        if (!opts->quiet) {
-           bu_log("Copying region (%d of %d) %s -> %s\n", i+1, 
BU_PTBL_LEN(ar), n->d_namep, bu_avs_get(opts->c_map, n->d_namep));
+           bu_log("Copying region (%d of %d) %s -> %s\n", (int)(i+1), 
(int)BU_PTBL_LEN(ar), n->d_namep, bu_avs_get(opts->c_map, n->d_namep));
        }
        if (_ged_facetize_cpcomb(gedp, n->d_namep, opts) != GED_OK) {
            if (opts->verbosity) {
@@ -2630,9 +2630,9 @@
     }
 
     /* Final report */
-    bu_vls_printf(gedp->ged_result_str, "Objects successfully converted: %d of 
%d\n", to_convert - BU_PTBL_LEN(ar), to_convert);
+    bu_vls_printf(gedp->ged_result_str, "Objects successfully converted: %d of 
%d\n", (int)(to_convert - BU_PTBL_LEN(ar)), to_convert);
     if (BU_PTBL_LEN(ar)) {
-       bu_vls_printf(gedp->ged_result_str, "WARNING: %d objects failed:\n", 
BU_PTBL_LEN(ar));
+       bu_vls_printf(gedp->ged_result_str, "WARNING: %d objects failed:\n", 
(int)BU_PTBL_LEN(ar));
        for (i = 0; i < BU_PTBL_LEN(ar); i++) {
            struct directory *n = (struct directory *)BU_PTBL_GET(ar, i);
            bu_vls_printf(gedp->ged_result_str, "       %s\n", n->d_namep);

Index: brlcad/branches/STABLE/src/libged/polyclip.cpp
===================================================================
--- brlcad/branches/STABLE/src/libged/polyclip.cpp      2018-10-01 15:28:27 UTC 
(rev 71930)
+++ brlcad/branches/STABLE/src/libged/polyclip.cpp      2018-10-01 15:43:16 UTC 
(rev 71931)

Property changes on: brlcad/branches/STABLE/src/libged/polyclip.cpp
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/src/libged/polyclip.cpp:60491,61063,61076-66129,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/src/libged/polyclip.cpp:60491,61063,61076-66129,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/src/libged/polyclip.cpp:66164
 
/brlcad/branches/brep-debug/src/libged/polyclip.cpp:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63232,63338,63481,63618,63669,64173-64174,64176-64177,64244,64360-64361,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/src/libged/polyclip.cpp:62518
## -5,4 +5,4 ##
 /brlcad/branches/gct/src/libged/polyclip.cpp:62423-62425
 /brlcad/branches/osg/src/libged/polyclip.cpp:62110-62113
 /brlcad/branches/prep-cache/src/libged/polyclip.cpp:68236-68933
-/brlcad/trunk/src/libged/polyclip.cpp:50761-68099,68132-71913
\ No newline at end of property
+/brlcad/trunk/src/libged/polyclip.cpp:50761-68099,68132-71929
\ No newline at end of property
Modified: brlcad/branches/STABLE/src/librt/cache.c
===================================================================
--- brlcad/branches/STABLE/src/librt/cache.c    2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/src/librt/cache.c    2018-10-01 15:43:16 UTC (rev 
71931)
@@ -30,7 +30,11 @@
 
 /* system headers */
 #include <errno.h>
-
+#include <string.h>
+#include <ctype.h>
+#ifdef HAVE_SYS_STAT_H
+#  include <sys/stat.h> /* for mkdir */
+#endif
 #include <lz4.h>
 
 #include "bnetwork.h"
@@ -64,6 +68,89 @@
 }
 
 
+HIDDEN int
+cache_create_path(const char *path, int is_file)
+{
+    char *dir;
+
+    if (bu_file_exists(path, NULL)) {
+       if (is_file && !bu_file_directory(path))
+           return 1;
+       /* file in the way! */
+       return -1;
+    }
+
+    if (!path /* empty or root path (recursive base case) */
+       || strlen(path) == 0
+       || (strlen(path) == 1 && path[0] == BU_DIR_SEPARATOR)
+       || (strlen(path) == 1 && path[0] == '/')
+       || (strlen(path) == 3 && isalpha(path[0]) && path[1] == ':' && path[2] 
== BU_DIR_SEPARATOR)
+       || (strlen(path) == 3 && isalpha(path[0]) && path[1] == ':' && path[2] 
== '/'))
+    {
+       return 1;
+    }
+    dir = bu_path_dirname(path);
+    cache_create_path(dir, 0);
+    bu_free(dir, "dirname");
+
+    if (!is_file && !bu_file_directory(path)) {
+#ifdef HAVE_WINDOWS_H
+       CreateDirectory(path, NULL);
+#else
+       /* mode: 775 */
+       mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+#endif
+    } else if (is_file && !bu_file_exists(path, NULL)) {
+       /* touch file */
+       FILE *fp = fopen(path, "w");
+       fclose(fp);
+    }
+    return bu_file_exists(path, NULL);
+}
+
+
+HIDDEN int
+cache_format(const char *librt_cache)
+{
+    int format = 0;
+    struct bu_vls path = BU_VLS_INIT_ZERO;
+    const char *cpath = NULL;
+    struct bu_vls fmt_str = BU_VLS_INIT_ZERO;
+    size_t ret;
+    FILE *fp;
+
+    bu_vls_printf(&path, "%s%c%s", librt_cache, BU_DIR_SEPARATOR, "format");
+    cpath = bu_vls_cstr(&path);
+    if (!cache_create_path(cpath, 1) || !bu_file_exists(cpath, NULL)) {
+       bu_vls_free(&path);
+       return -1;
+    }
+
+    fp = fopen(cpath, "r");
+    if (!fp) {
+       bu_vls_free(&path);
+       return -2;
+    }
+
+    bu_vls_gets(&fmt_str, fp);
+    fclose(fp);
+
+    ret = bu_sscanf(bu_vls_cstr(&fmt_str), "%d", &format);
+    if (ret != 1) {
+       fp = fopen(cpath, "w");
+       bu_vls_sprintf(&fmt_str, "%d\n", format);
+       if (fp) {
+           ret = fwrite(bu_vls_cstr(&fmt_str), bu_vls_strlen(&fmt_str), 1, fp);
+       }
+       fclose(fp);
+    }
+    bu_vls_free(&fmt_str);
+    bu_vls_free(&path);
+
+    return format;
+}
+
+
 HIDDEN void
 cache_generate_name(char name[STATIC_ARRAY(37)], const struct soltab *stp)
 {
@@ -102,71 +189,64 @@
 struct rt_cache *
 rt_cache_open(void)
 {
-    struct bu_vls full_path = BU_VLS_INIT_ZERO;
-    struct bu_vls tmp_path = BU_VLS_INIT_ZERO;
-    const char * const file_name = "rt_cache.tmp";
-    char *home_path;
-    FILE *tmpfp;
-    char temppath[MAXPATHLEN];
+    const char *librt_cache = NULL;
+    struct bu_vls rtdb = BU_VLS_INIT_ZERO;
+    char cache[MAXPATHLEN] = {0};
+    int format = 0;
     int create;
     struct rt_cache *result;
-    const char *librt_cache = NULL;
 
     librt_cache = getenv("LIBRT_CACHE");
-    if (!BU_STR_EMPTY(librt_cache) && bu_str_false(librt_cache)) {
-       /* default unset is on, so it's explicitly turned off */
-       return NULL;
-    }
+    if (!BU_STR_EMPTY(librt_cache)) {
+       int disabled = 0;
 
-    BU_GET(result, struct rt_cache);
+       /* default unset is on, so do nothing if explicitly off */
+       if (bu_str_false(librt_cache))
+           return NULL;
 
-    /* First, check HOME, tmp and the current working directory for
-     * a pre-existing cache file */
-    home_path = getenv("HOME");
-    if (home_path != (char *)NULL) {
-       bu_vls_sprintf(&full_path, "%s/%s", home_path, file_name);
-       if (bu_file_exists(bu_vls_addr(&full_path), NULL))
-           goto have_cache_file;
-    }
+       librt_cache = bu_file_realpath(librt_cache, cache);
 
-    /* create a temp file in order to extract the tmp file working
-     * directory - we have our own name, but need the path */
-    tmpfp = bu_temp_file(temppath, MAXPATHLEN);
-    if (tmpfp != NULL) {
-       struct bu_vls dir = BU_VLS_INIT_ZERO;
-       fclose(tmpfp);
-       if (bu_path_component(&dir, temppath, BU_PATH_DIRNAME)) {
-           bu_vls_sprintf(&full_path, "%s/%s", bu_vls_addr(&dir), file_name);
-           bu_vls_sprintf(&tmp_path, "%s/%s", bu_vls_addr(&dir), file_name);
-           bu_vls_free(&dir);
-           if (bu_file_exists(bu_vls_addr(&full_path), NULL))
-               goto have_cache_file;
+       if (!bu_file_directory(librt_cache)) {
+           bu_log("WARNING: Caching disabled. Specified directory does not 
exist.\n");
+           disabled = 1;
+       } else if (!bu_file_writable(librt_cache)) {
+           bu_log("WARNING: Caching disabled. Specified directory is not 
writable.\n");
+           disabled = 1;
        }
+       if (disabled) {
+           bu_log("         Specified: LIBRT_CACHE=%s\n"
+                  "         To enable, specify a writable directory that 
exists.\n"
+                  "         Unsetting LIBRT_CACHE will use system default.\n"
+                  , librt_cache);
+           return NULL;
+       }
+    } else {
+       /* LIBRT_CACHE is either set-and-empty or unset.  Default is on. */
+       librt_cache = bu_dir(cache, MAXPATHLEN, BU_DIR_CACHE, ".rt", NULL);
+       if (!bu_file_exists(librt_cache, NULL)) {
+           cache_create_path(librt_cache, 0);
+       }
     }
 
-    /* As a last resort, check the current directory */
-    bu_vls_sprintf(&full_path, "%s", file_name);
-    if (bu_file_exists(bu_vls_addr(&full_path), NULL))
-       goto have_cache_file;
+    /* cache dir should exist by now */
+    if (!bu_file_exists(librt_cache, NULL) || !bu_file_directory(librt_cache))
+       return NULL;
 
-    /* If we got this far, we have nothing.  If we have HOME, use that, else
-     * fall back on tmp, and as a last resort try current dir */
-    if (home_path) {
-       bu_vls_sprintf(&full_path, "%s/%s", home_path, file_name);
-    } else if (bu_vls_strlen(&tmp_path) > 0) {
-       bu_vls_sprintf(&full_path, "%s", bu_vls_addr(&tmp_path));
-    } else {
-       bu_vls_sprintf(&full_path, "%s", file_name);
-    }
+    format = cache_format(librt_cache);
+    if (format < 0)
+       return NULL;
 
-have_cache_file:
-    create = !bu_file_exists(bu_vls_addr(&full_path), NULL);
+    /* actual v0 cache is just a single file for now */
+    bu_vls_printf(&rtdb, "%s%c%s", librt_cache, BU_DIR_SEPARATOR, "rt.db");
+    create = !bu_file_exists(bu_vls_addr(&rtdb), NULL);
+
+    BU_GET(result, struct rt_cache);
     if (create)
-       result->dbip = db_create(bu_vls_addr(&full_path), 5);
+       result->dbip = db_create(bu_vls_addr(&rtdb), 5);
     else
-       result->dbip = db_open(bu_vls_addr(&full_path), DB_OPEN_READWRITE);
+       result->dbip = db_open(bu_vls_addr(&rtdb), DB_OPEN_READWRITE);
 
-    bu_vls_free(&full_path);
+    bu_vls_free(&rtdb);
 
     if (!result->dbip || (!create && db_dirbuild(result->dbip))) {
        db_close(result->dbip);
@@ -187,6 +267,7 @@
     cache_check(cache);
 
     db_close(cache->dbip);
+    cache->dbip = NULL; /* sanity */
     BU_PUT(cache, struct rt_cache);
 }
 

Modified: brlcad/branches/STABLE/src/librt/tree.c
===================================================================
--- brlcad/branches/STABLE/src/librt/tree.c     2018-10-01 15:28:27 UTC (rev 
71930)
+++ brlcad/branches/STABLE/src/librt/tree.c     2018-10-01 15:43:16 UTC (rev 
71931)
@@ -521,7 +521,11 @@
      * long as idb_ptr is set to null.  Note that the prep routine may
      * have changed st_id.
      */
-    ret = rt_cache_prep(data->cache, stp, ip);
+    if (rtip->rti_dbip->dbi_version > 4) {
+       ret = rt_cache_prep(data->cache, stp, ip);
+    } else {
+       ret = rt_obj_prep(stp, ip, stp->st_rtip);
+    }
     if (ret) {
        int hash;
        /* Error, solid no good */
@@ -772,7 +776,9 @@
        }
 
        data.tbl = tbl;
-       data.cache = rt_cache_open();
+       if (rtip->rti_dbip->dbi_version > 4) {
+           data.cache = rt_cache_open();
+       }
 
        i = db_walk_tree(rtip->rti_dbip, argc, argv, ncpus,
                         &tree_state,
@@ -781,7 +787,9 @@
                         _rt_gettree_leaf, (void *)&data);
        bu_avs_free(&tree_state.ts_attrs);
 
-       rt_cache_close(data.cache);
+       if (rtip->rti_dbip->dbi_version > 4) {
+           rt_cache_close(data.cache);
+       }
     }
 
     /* DEBUG:  Ensure that all region trees are valid */

Index: brlcad/branches/STABLE/src/other
===================================================================
--- brlcad/branches/STABLE/src/other    2018-10-01 15:28:27 UTC (rev 71930)
+++ brlcad/branches/STABLE/src/other    2018-10-01 15:43:16 UTC (rev 71931)

Property changes on: brlcad/branches/STABLE/src/other
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
-/brlcad/branches/RELEASE/src/other:60491,61063,61075-66129,66135,66164,66169-68615,68617-71918
+/brlcad/branches/RELEASE/src/other:60491,61063,61075-66129,66135,66164,66169-68615,68617-71930
 /brlcad/branches/STABLE/src/other:66164
 
/brlcad/branches/brep-debug/src/other:61373,61375,61404,61427,61429,61470,61544,61567,61576,61999,62018,62094,62098,62107,62117,62406,62416-62519,62521-62584,62593-62614,62623,62658,62660-62674,62681-62771,62876,62901,62907,62910,62925,62928,62931-63025,63027,63051,63054-63056,63069,63071-63073,63122,63160-63161,63165,63171,63184,63187,63189-63190,63193-63196,63200,63202,63205-63210,63213,63219-63225,63232-63233,63236,63238,63338,63350-63353,63481,63618,63669,64173-64174,64176-64177,64229-64233,64242,64244,64360-64362,65165,65245,65249,65334,65833-65834,66370-66375,66931-66932,66934,67012-67015,67018-67019,67021-67022,67406,67740,67746-67748,67950,67952,68144-68145,68636,68640-68643,68820,69081,69109,69168,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
 /brlcad/branches/bullet/src/other:62518
## -7,4 +7,4 ##
 /brlcad/branches/opencl/src/other:65867-66137
 /brlcad/branches/osg/src/other:62110-62113
 /brlcad/branches/prep-cache/src/other:68236-68933
-/brlcad/trunk/src/other:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71913
\ No newline at end of property
+/brlcad/trunk/src/other:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-71929
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to