Revision: 76196
http://sourceforge.net/p/brlcad/code/76196
Author: starseeker
Date: 2020-06-25 13:21:23 +0000 (Thu, 25 Jun 2020)
Log Message:
-----------
Merge changes from trunk - r76146 through r76195
Modified Paths:
--------------
brlcad/branches/dm-fb-merge/CMakeLists.txt
brlcad/branches/dm-fb-merge/NEWS
brlcad/branches/dm-fb-merge/doc/legal/embedded/CMakeLists.txt
brlcad/branches/dm-fb-merge/include/bg/lseg.h
brlcad/branches/dm-fb-merge/include/bn/plane.h
brlcad/branches/dm-fb-merge/include/dm/bview.h
brlcad/branches/dm-fb-merge/misc/CMake/RPath_Setup.cmake
brlcad/branches/dm-fb-merge/regress/burst/CMakeLists.txt
brlcad/branches/dm-fb-merge/regress/burst/ktank.b
brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libbg/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libbg/lseg_lseg.c
brlcad/branches/dm-fb-merge/src/libbg/tests/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libbg/tests/lseg_lseg.c
brlcad/branches/dm-fb-merge/src/libbrep/opennurbs_ext.cpp
brlcad/branches/dm-fb-merge/src/libbu/units.c
brlcad/branches/dm-fb-merge/src/libged/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libged/ged_private.h
brlcad/branches/dm-fb-merge/src/libged/qray.c
brlcad/branches/dm-fb-merge/src/libtclcad/tclcad_obj.c
brlcad/branches/dm-fb-merge/src/mged/adc.c
brlcad/branches/dm-fb-merge/src/mged/attach.c
brlcad/branches/dm-fb-merge/src/mged/buttons.c
brlcad/branches/dm-fb-merge/src/mged/chgview.c
brlcad/branches/dm-fb-merge/src/mged/cmd.c
brlcad/branches/dm-fb-merge/src/mged/color_scheme.c
brlcad/branches/dm-fb-merge/src/mged/dm-generic.c
brlcad/branches/dm-fb-merge/src/mged/doevent.c
brlcad/branches/dm-fb-merge/src/mged/dozoom.c
brlcad/branches/dm-fb-merge/src/mged/fbserv.c
brlcad/branches/dm-fb-merge/src/mged/grid.c
brlcad/branches/dm-fb-merge/src/mged/menu.c
brlcad/branches/dm-fb-merge/src/mged/mged.c
brlcad/branches/dm-fb-merge/src/mged/mged_dm.h
brlcad/branches/dm-fb-merge/src/mged/set.c
brlcad/branches/dm-fb-merge/src/mged/share.c
Added Paths:
-----------
brlcad/branches/dm-fb-merge/doc/legal/embedded/lseg_pt.txt
brlcad/branches/dm-fb-merge/regress/burst/echo.b
brlcad/branches/dm-fb-merge/regress/burst/ktank_colors.ids
brlcad/branches/dm-fb-merge/src/burst/burst.cpp
brlcad/branches/dm-fb-merge/src/burst/grid.cpp
brlcad/branches/dm-fb-merge/src/burst/idents.cpp
brlcad/branches/dm-fb-merge/src/burst/old/
brlcad/branches/dm-fb-merge/src/burst/paint.cpp
brlcad/branches/dm-fb-merge/src/libbg/lseg_pt.c
brlcad/branches/dm-fb-merge/src/libbg/tests/lseg_pt.c
brlcad/branches/dm-fb-merge/src/libged/view/
Removed Paths:
-------------
brlcad/branches/dm-fb-merge/src/burst/Hm.c
brlcad/branches/dm-fb-merge/src/burst/HmGetc.c
brlcad/branches/dm-fb-merge/src/burst/HmGlob.c
brlcad/branches/dm-fb-merge/src/burst/Mm.h
brlcad/branches/dm-fb-merge/src/burst/Sc.c
brlcad/branches/dm-fb-merge/src/burst/Sc.h
brlcad/branches/dm-fb-merge/src/burst/ascii.h
brlcad/branches/dm-fb-merge/src/burst/burst.c
brlcad/branches/dm-fb-merge/src/burst/error.c
brlcad/branches/dm-fb-merge/src/burst/extern.h
brlcad/branches/dm-fb-merge/src/burst/fb.c
brlcad/branches/dm-fb-merge/src/burst/glob.c
brlcad/branches/dm-fb-merge/src/burst/grid.c
brlcad/branches/dm-fb-merge/src/burst/gridrotate.c
brlcad/branches/dm-fb-merge/src/burst/idents.c
brlcad/branches/dm-fb-merge/src/burst/paint.c
brlcad/branches/dm-fb-merge/src/burst/plot.c
brlcad/branches/dm-fb-merge/src/burst/prnt.c
brlcad/branches/dm-fb-merge/src/burst/trie.c
brlcad/branches/dm-fb-merge/src/burst/ui.c
brlcad/branches/dm-fb-merge/src/libged/aet.c
brlcad/branches/dm-fb-merge/src/libged/center.cpp
brlcad/branches/dm-fb-merge/src/libged/eye.c
brlcad/branches/dm-fb-merge/src/libged/quat.c
brlcad/branches/dm-fb-merge/src/libged/size.c
brlcad/branches/dm-fb-merge/src/libged/view.c
brlcad/branches/dm-fb-merge/src/libged/ypr.c
Property Changed:
----------------
brlcad/branches/dm-fb-merge/
brlcad/branches/dm-fb-merge/NEWS
brlcad/branches/dm-fb-merge/doc/
brlcad/branches/dm-fb-merge/include/
brlcad/branches/dm-fb-merge/regress/
brlcad/branches/dm-fb-merge/src/libbu/
Index: brlcad/branches/dm-fb-merge
===================================================================
--- brlcad/branches/dm-fb-merge 2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge 2020-06-25 13:21:23 UTC (rev 76196)
Property changes on: brlcad/branches/dm-fb-merge
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/brlcad/branches/RELEASE:57439,57447-57860,69901-69913,70323-70333,71915-72242,72525-72534,72826-72858,74376-74454,74964-75140,75372-75685
-/brlcad/branches/bioh:75720-75736,75740-75742,75860-75891,75894-75986
+/brlcad/branches/bioh:75720-75736,75740-75742,75860-75891,75894-75986,76088-76153
/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
/brlcad/branches/cmake:43219
## -8,4 +8,4 ##
/brlcad/branches/osg:62110-62113
/brlcad/branches/prep-cache:68236-68933
/brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:75440-76146
\ No newline at end of property
+/brlcad/trunk:75440-76195
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/CMakeLists.txt 2020-06-24 20:14:44 UTC (rev
76195)
+++ brlcad/branches/dm-fb-merge/CMakeLists.txt 2020-06-25 13:21:23 UTC (rev
76196)
@@ -154,6 +154,27 @@
set(CONFIG_DELTA_START "${CMAKE_BINARY_DIR}/CMakeTmp/CONFIG_DELTA_START")
execute_process(COMMAND "${CMAKE_BINARY_DIR}/CMakeTmp/sstamp${EXE_EXT}"
"${CONFIG_DELTA_START}")
+#------------------------------------------------------------------------------
+# The SuperBuild (https://blog.kitware.com/cmake-superbuilds-git-submodules/)
+# pattern requires a differentiation between the CMake installation prefix used
+# for the build and the specification of the ultimate installation location
+# used for the superbuild's install. Any hard-coded knowledge of the final
+# path backed into BRL-CAD must use the superbuild's final destination, not the
+# intermediate build-directory installation used by the superbuild.
+#
+# For the moment we are not using superbuild, but we will ultimately need to
+# move to that approach to manage increasingly complex dependencies. To allow
+# the code to work seamlessly with both variables, make them match unless both
+# are explicitly set in advance.
+if (DEFINED BRLCAD_INSTALL_PREFIX)
+ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT DEFINED
CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${BRLCAD_INSTALL_PREFIX}")
+ endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT DEFINED
CMAKE_INSTALL_PREFIX)
+endif (DEFINED BRLCAD_INSTALL_PREFIX)
+if (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED BRLCAD_INSTALL_PREFIX)
+ set(BRLCAD_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+endif (DEFINED CMAKE_INSTALL_PREFIX AND NOT DEFINED BRLCAD_INSTALL_PREFIX)
+
#---------------------------------------------------------------------
# Allow the BRLCAD_ROOT environment variable to set during build, but be noisy
# about it unless we're specifically told this is intentional. Having this
@@ -167,15 +188,15 @@
endif(SLEEP_EXEC)
endif(NOT "$ENV{BRLCAD_ROOT}" STREQUAL "" AND NOT BRLCAD_ROOT_OVERRIDE)
-# If CMAKE_INSTALL_PREFIX is "/usr", be VERY noisy about it - a make install in
+# If BRLCAD_INSTALL_PREFIX is "/usr", be VERY noisy about it - a make install
in
# this location is dangerous/destructive on some systems.
-if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
BRLCAD_ALLOW_INSTALL_TO_USR)
+if("${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
BRLCAD_ALLOW_INSTALL_TO_USR)
message(WARNING "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\nIt is
STRONGLY recommended that you DO NOT install BRL-CAD into /usr as BRL-CAD
provides several libraries that may conflict with other libraries (e.g. librt,
libbu, libbn) on certain system configurations.\nSince our libraries predate
all those that we're known to conflict with and are at the very core of our
geometry services and project heritage, we have no plans to change the names of
our libraries at this time.\nINSTALLING INTO /usr CAN MAKE A SYSTEM COMPLETELY
UNUSABLE. If you choose to continue installing into /usr, you do so entirely
at your own risk. You have been
warned.\n}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}")
if(SLEEP_EXEC)
execute_process(COMMAND ${SLEEP_EXEC} 15)
endif(SLEEP_EXEC)
message(FATAL_ERROR "If you wish to proceed using /usr as your prefix,
define BRLCAD_ALLOW_INSTALL_TO_USR=1 for CMake")
-endif("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
BRLCAD_ALLOW_INSTALL_TO_USR)
+endif("${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
BRLCAD_ALLOW_INSTALL_TO_USR)
#---------------------------------------------------------------------
# Define relative install locations and output directories. Don't set
@@ -237,6 +258,13 @@
# To ensure the previous (and internally set) CMAKE_INSTALL_PREFIX value
# is available, BRLCAD_PREFIX is used to store the value in the cache.)
+if(BRLCAD_INSTALL_PREFIX)
+ if(NOT "${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr/local")
+ get_filename_component(PATH_NORMALIZED
"${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
+ set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
+ endif(NOT "${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${BRLCAD_INSTALL_PREFIX}" STREQUAL "/usr/local")
+endif(BRLCAD_INSTALL_PREFIX)
+
if(CMAKE_INSTALL_PREFIX)
if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
get_filename_component(PATH_NORMALIZED
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}" ABSOLUTE)
@@ -243,6 +271,7 @@
set(CMAKE_SYSTEM_IGNORE_PATH "${PATH_NORMALIZED}")
endif(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT
"${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
endif(CMAKE_INSTALL_PREFIX)
+
if(BRLCAD_PREFIX)
if(NOT "${BRLCAD_PREFIX}" STREQUAL "/usr" AND NOT "${BRLCAD_PREFIX}"
STREQUAL "/usr/local")
get_filename_component(PATH_NORMALIZED "${BRLCAD_PREFIX}/${LIB_DIR}"
ABSOLUTE)
@@ -790,19 +819,19 @@
# ExternalProject_Add approach first as well - that way unmodified install
# commands in 3rd party CMake files will be moot.
#
-# if (NOT CMAKE_INSTALL_PREFIX)
-# set(CMAKE_INSTALL_PREFIX "/usr/brlcad/")
+# if (NOT BRLCAD_INSTALL_PREFIX)
+# set(BRLCAD_INSTALL_PREFIX "/usr/brlcad/")
# if (NOT MSVC)
# set(gen_exp
$<IF:$<CONFIG:Debug>,dev-${BRLCAD_VERSION}/,$<IF:$<CONFIG:Release>,rel-${BRLCAD_VERSION}/${BRLCAD_VERSION},>>)
# else (NOT MSVC)
# set(gen_exp)
# if(CMAKE_CL_64)
-# set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD
${BRLCAD_VERSION}")
+# set(BRLCAD_INSTALL_PREFIX "C:/Program Files/BRL-CAD
${BRLCAD_VERSION}")
# else(CMAKE_CL_64)
-# set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD
${BRLCAD_VERSION}")
+# set(BRLCAD_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD
${BRLCAD_VERSION}")
# endif(CMAKE_CL_64)
# endif (NOT MSVC)
-# endif (NOT CMAKE_INSTALL_PREFIX)
+# endif (NOT BRLCAD_INSTALL_PREFIX)
# install(TARGETS mged DESTINATION ${gen_exp}${BIN_DIR})
#
# Another (maybe better) option instead of generators might be to use the
CONFIGURATIONS
@@ -809,40 +838,44 @@
# option in our macros and the ExternalProject_Add management:
# https://cmake.org/cmake/help/latest/command/install.html
#
-if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT BRLCAD_INSTALL_PREFIX)
if(NOT CMAKE_CONFIGURATION_TYPES)
if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
- set(CMAKE_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}")
+ set(BRLCAD_INSTALL_PREFIX "/usr/brlcad/rel-${BRLCAD_VERSION}")
else("${CMAKE_BUILD_TYPE}" MATCHES "Release")
- set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
+ set(BRLCAD_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
endif("${CMAKE_BUILD_TYPE}" MATCHES "Release")
else(NOT CMAKE_CONFIGURATION_TYPES)
if(MSVC)
if(CMAKE_CL_64)
- set(CMAKE_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
+ set(BRLCAD_INSTALL_PREFIX "C:/Program Files/BRL-CAD ${BRLCAD_VERSION}")
else(CMAKE_CL_64)
- set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD
${BRLCAD_VERSION}")
+ set(BRLCAD_INSTALL_PREFIX "C:/Program Files (x86)/BRL-CAD
${BRLCAD_VERSION}")
endif(CMAKE_CL_64)
else(MSVC)
- set(CMAKE_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
+ set(BRLCAD_INSTALL_PREFIX "/usr/brlcad/dev-${BRLCAD_VERSION}")
endif(MSVC)
endif(NOT CMAKE_CONFIGURATION_TYPES)
- set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "BRL-CAD install
prefix" FORCE)
- set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
-endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
-set(BRLCAD_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "BRL-CAD install
prefix")
+ set(BRLCAD_INSTALL_PREFIX ${BRLCAD_INSTALL_PREFIX} CACHE PATH "BRL-CAD
install prefix" FORCE)
+ set(BRLCAD_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0)
+endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT BRLCAD_INSTALL_PREFIX)
+set(BRLCAD_PREFIX "${BRLCAD_INSTALL_PREFIX}" CACHE STRING "BRL-CAD install
prefix")
mark_as_advanced(BRLCAD_PREFIX)
+if (DEFINED BRLCAD_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${BRLCAD_INSTALL_PREFIX}")
+endif (DEFINED BRLCAD_INSTALL_PREFIX AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+
# If we've a Release build with a Debug path or vice versa, warn about
# it. A "make install" of a Release build into a dev install
# directory or vice versa is going to result in an install that
# doesn't respect BRL-CAD standard naming conventions.
-if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
- message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set
to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n")
-endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${CMAKE_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
-if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
- message(FATAL_ERROR "\nInstallation directory (CMAKE_INSTALL_PREFIX) is set
to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n")
-endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${CMAKE_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
+if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${BRLCAD_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
+ message(FATAL_ERROR "\nInstallation directory (BRLCAD_INSTALL_PREFIX) is set
to /usr/brlcad/dev-${BRLCAD_VERSION}, but build type is set to Release!\n")
+endif("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND "${BRLCAD_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/dev-${BRLCAD_VERSION}")
+if("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${BRLCAD_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
+ message(FATAL_ERROR "\nInstallation directory (BRLCAD_INSTALL_PREFIX) is set
to /usr/brlcad/rel-${BRLCAD_VERSION}, but build type is set to Debug!\n")
+endif("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND "${BRLCAD_INSTALL_PREFIX}"
STREQUAL "/usr/brlcad/rel-${BRLCAD_VERSION}")
#------------------------------------------------------------------------------
# Now that we know the install prefix, generate the binary for calculating
@@ -992,8 +1025,10 @@
CONFIG_H_APPEND(BRLCAD "#define EXECUTABLE_SUFFIX
\"${CMAKE_EXECUTABLE_SUFFIX}\"\n")
CONFIG_H_APPEND(BRLCAD "#define SHARED_LIBRARY_SUFFIX
\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"\n")
-# Let bu_dir know what the target install directory is
-CONFIG_H_APPEND(BRLCAD "#define BRLCAD_ROOT \"${CMAKE_INSTALL_PREFIX}\"\n")
+# Let bu_dir know what the target install directory is. In a superbuild
+# configuration this will be the most import place to be sure that we get the
+# actual superbuild install path, not the local BRL-CAD subbuild install path.
+CONFIG_H_APPEND(BRLCAD "#define BRLCAD_ROOT \"${BRLCAD_INSTALL_PREFIX}\"\n")
# Define the various relative paths for bu_dir (be sure to have included
# Path_Setup.cmake before this point, as that file defines these variables.)
@@ -3394,6 +3429,8 @@
endif(NOT BRLCAD_IS_SUBBUILD)
+# TODO - the below logic will have to be rethought in a superbuild setup...
+
# To set correct install paths for CMake at build time, rather than CMake
# time, some rather special logic is necessary - a build target that needs
# to be run when the current build type changes, and introspective scripting
Modified: brlcad/branches/dm-fb-merge/NEWS
===================================================================
--- brlcad/branches/dm-fb-merge/NEWS 2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/NEWS 2020-06-25 13:21:23 UTC (rev 76196)
@@ -408,6 +408,7 @@
* removed "high resolution" options from all commands - Carl Moore
* improved performance of archer loading large BoT models - Nick Reed
* added evaluated shaded drawing preference mode and menu - Nick Reed
+* fixed .mgedrc creation corruption with closed database - Cliff Yapp
* extensive improvements to NURBS Boolean evaluation - Nick Reed
* added 'bot chull' for creating convex hull envelopes - Cliff Yapp
* new manual page for the g-voxel exporter - Mandarj
Property changes on: brlcad/branches/dm-fb-merge/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/brlcad/branches/RELEASE/NEWS:57439,57447-57860,68609-68613,69901-69913,70323-70333,71915-72242,72525-72534,72826-72858,74376-74454,74964-75140
-/brlcad/branches/bioh/NEWS:75894-75986
+/brlcad/branches/bioh/NEWS:75894-75986,76088-76153
/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
/brlcad/branches/cmake/NEWS:43219
## -8,4 +8,4 ##
/brlcad/branches/osg/NEWS:62110-62113
/brlcad/branches/prep-cache/NEWS:68236-68933
/brlcad/branches/tcltk86/NEWS:68300-75257
-/brlcad/trunk/NEWS:75512-75597,75630-75814,75935-75987,76138-76142
\ No newline at end of property
+/brlcad/trunk/NEWS:75512-75597,75630-75814,75935-75987,76138-76142,76147-76195
\ No newline at end of property
Index: brlcad/branches/dm-fb-merge/doc
===================================================================
--- brlcad/branches/dm-fb-merge/doc 2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/doc 2020-06-25 13:21:23 UTC (rev 76196)
Property changes on: brlcad/branches/dm-fb-merge/doc
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/brlcad/branches/RELEASE/doc:57439,57447-57860,69901-69913,71917-72242,72525-72534,72826-72858,74376-74454,74964-75140
-/brlcad/branches/bioh/doc:75894-75986
+/brlcad/branches/bioh/doc:75894-75986,76088-76153
/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,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927
/brlcad/branches/bullet/doc:62518
/brlcad/branches/cmake/doc:43219
## -8,4 +8,4 ##
/brlcad/branches/osg/doc:62110-62113
/brlcad/branches/prep-cache/doc:68236-68933
/brlcad/branches/tcltk86/doc:68300-75257
-/brlcad/trunk/doc:75512-75597,75630-75814,75935-76034,76051-76077,76085-76137
\ No newline at end of property
+/brlcad/trunk/doc:75512-75597,75630-75814,75935-76034,76051-76077,76085-76137,76147-76195
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/doc/legal/embedded/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/doc/legal/embedded/CMakeLists.txt
2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/doc/legal/embedded/CMakeLists.txt
2020-06-25 13:21:23 UTC (rev 76196)
@@ -26,6 +26,7 @@
hv3_snit.txt
libtermlib.txt
lseg_lseg.txt
+ lseg_pt.txt
lz4.txt
marching_cubes.txt
msinttypes.txt
Copied: brlcad/branches/dm-fb-merge/doc/legal/embedded/lseg_pt.txt (from rev
76195, brlcad/trunk/doc/legal/embedded/lseg_pt.txt)
===================================================================
--- brlcad/branches/dm-fb-merge/doc/legal/embedded/lseg_pt.txt
(rev 0)
+++ brlcad/branches/dm-fb-merge/doc/legal/embedded/lseg_pt.txt 2020-06-25
13:21:23 UTC (rev 76196)
@@ -0,0 +1,31 @@
+https://www.geometrictools.com/GTE/Mathematics/DistPointSegment.h
+
+David Eberly, Geometric Tools, Redmond WA 98052
+Copyright (c) 1998-2020
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN 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/libbg/lseg_pt.c
+
Index: brlcad/branches/dm-fb-merge/include
===================================================================
--- brlcad/branches/dm-fb-merge/include 2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/include 2020-06-25 13:21:23 UTC (rev 76196)
Property changes on: brlcad/branches/dm-fb-merge/include
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/brlcad/branches/RELEASE/include:57439,57447-57860,69901-69913,71915-72242,72525-72534,72826-72858,74376-74454,74964-75140,75372-75681
-/brlcad/branches/bioh/include:75720-75736,75740-75742,75860-75891,75894-75986
+/brlcad/branches/bioh/include:75720-75736,75740-75742,75860-75891,75894-75986,76088-76153
/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,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927
/brlcad/branches/bullet/include:62518
/brlcad/branches/cmake/include:43219
## -8,4 +8,4 ##
/brlcad/branches/osg/include:62110-62113
/brlcad/branches/prep-cache/include:68236-68933
/brlcad/branches/tcltk86/include:68300-75257
-/brlcad/trunk/include:75463-75467,75630-75814,75880-76142
\ No newline at end of property
+/brlcad/trunk/include:75463-75467,75630-75814,75880-76142,76147-76195
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/include/bg/lseg.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/bg/lseg.h 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/include/bg/lseg.h 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -36,11 +36,19 @@
__BEGIN_DECLS
+/* Compute the closest point on the line segment P0->P1 to point Q. Returns
+ * the distance squared from Q to the closest point and the closest point in
+ * question if c is non-NULL.
+ */
+BG_EXPORT double
+bg_lseg_pt_dist_sq(point_t *c, const point_t P0, const point_t P1, const
point_t Q);
+
/* Compute the closest points on the line segments P0->P1 and Q0->Q1. Returns
- * the distance between the closest points and (optionally) the closest points
- * in question (c1 is the point on P0->P1, c2 is the point on Q0->Q1). */
+ * the distance squared between the closest points and (optionally) the closest
+ * points in question (c1 is the point on P0->P1, c2 is the point on Q0->Q1).
+ */
BG_EXPORT double
-bg_lseg_lseg_dist(point_t *c1, point_t *c2,
+bg_lseg_lseg_dist_sq(point_t *c1, point_t *c2,
const point_t P0, const point_t P1, const point_t Q0, const point_t Q1);
__END_DECLS
Modified: brlcad/branches/dm-fb-merge/include/bn/plane.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/bn/plane.h 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/include/bn/plane.h 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -24,6 +24,10 @@
* @brief
* Plane structures (from src/librt/plane.h) and plane/line/point calculations
*
+ * TODO - this API needs to be migrated to libbg as a geometry related API, and
+ * perhaps simplified. A lot of the closest point calculations, for example,
+ * should probably just concern themselves with the calculation itself and
+ * leave any tolerance based questions to a separate step.
*/
/** @{ */
/* @file plane.h */
Modified: brlcad/branches/dm-fb-merge/include/dm/bview.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/dm/bview.h 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/include/dm/bview.h 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -110,6 +110,7 @@
};
struct bview_grid_state {
+ int rc;
int draw; /* draw grid */
int snap; /* snap to grid */
fastf_t anchor[3];
Modified: brlcad/branches/dm-fb-merge/misc/CMake/RPath_Setup.cmake
===================================================================
--- brlcad/branches/dm-fb-merge/misc/CMake/RPath_Setup.cmake 2020-06-24
20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/misc/CMake/RPath_Setup.cmake 2020-06-25
13:21:23 UTC (rev 76196)
@@ -55,9 +55,9 @@
# location relative to the loading file's path if the installed version
is
# not present. How to do so is platform specific.
if(NOT APPLE)
- set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}" PARENT_SCOPE)
+ set(CMAKE_INSTALL_RPATH
"${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}:\$ORIGIN/../${LIB_DIR}" PARENT_SCOPE)
else(NOT APPLE)
- set(CMAKE_INSTALL_RPATH
"${CMAKE_INSTALL_PREFIX}/${LIB_DIR};@loader_path/../${LIB_DIR}" PARENT_SCOPE)
+ set(CMAKE_INSTALL_RPATH
"${BRLCAD_INSTALL_PREFIX}/${LIB_DIR};@loader_path/../${LIB_DIR}" PARENT_SCOPE)
endif(NOT APPLE)
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH for CMake <
3.0
@@ -64,7 +64,7 @@
#
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
# http://www.cmake.org/cmake/help/v3.2/policy/CMP0042.html
if ("${CMAKE_VERSION}" VERSION_LESS 3.0)
- set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}"
PARENT_SCOPE)
+ set(CMAKE_INSTALL_NAME_DIR "${BRLCAD_INSTALL_PREFIX}/${LIB_DIR}"
PARENT_SCOPE)
endif ("${CMAKE_VERSION}" VERSION_LESS 3.0)
# Add the automatically determined parts of the RPATH which point to
Index: brlcad/branches/dm-fb-merge/regress
===================================================================
--- brlcad/branches/dm-fb-merge/regress 2020-06-24 20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/regress 2020-06-25 13:21:23 UTC (rev 76196)
Property changes on: brlcad/branches/dm-fb-merge/regress
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
/brlcad/branches/RELEASE/regress:57439,57447-57860,69901-69913,71917-72242,72525-72534,72826-72858,74376-74454,75372-75681
-/brlcad/branches/bioh/regress:75860-75891,75894-75986
+/brlcad/branches/bioh/regress:75860-75891,75894-75986,76088-76153
/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,69206,69289,69346,69460-69461,69582-69583,69719-69721,69857-69859,69927
/brlcad/branches/bullet/regress:62518
/brlcad/branches/cmake/regress:43219
## -8,4 +8,4 ##
/brlcad/branches/osg/regress:62110-62113
/brlcad/branches/prep-cache/regress:68236-68933
/brlcad/branches/tcltk86/regress:68300-75257
-/brlcad/trunk/regress:75512-75597,75630-76034,76038-76077,76085-76137
\ No newline at end of property
+/brlcad/trunk/regress:75512-75597,75630-76034,76038-76077,76085-76137,76147-76195
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/regress/burst/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/regress/burst/CMakeLists.txt 2020-06-24
20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/regress/burst/CMakeLists.txt 2020-06-25
13:21:23 UTC (rev 76196)
@@ -3,9 +3,10 @@
ktank_air.ids
ktank_armor.ids
ktank_crit.ids
+ ktank_colors.ids
)
-BRLCAD_REGRESSION_TEST(regress-burst "burst;ktank.g" EXEC burst)
+BRLCAD_REGRESSION_TEST(regress-burst "nburst;ktank.g" EXEC burst)
set(BURST_CLEAN_FILES
ktank_burst.plot
@@ -29,6 +30,7 @@
CMAKEFILES(
CMakeLists.txt
+ echo.b
${BURST_INPUT_FILES}
)
Copied: brlcad/branches/dm-fb-merge/regress/burst/echo.b (from rev 76195,
brlcad/trunk/regress/burst/echo.b)
===================================================================
--- brlcad/branches/dm-fb-merge/regress/burst/echo.b
(rev 0)
+++ brlcad/branches/dm-fb-merge/regress/burst/echo.b 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -0,0 +1,39 @@
+attack-direction 35 25
+critical-comp-file ccf.file
+deflect-spall-cone yes
+dither-cells yes
+enclose-target
+enclose-portion 1 2 3 4
+#error-file error.file
+grid-file grid.file
+ground-plane yes 10 2 -2 3 -3
+burst-air-file ba.file
+histogram-file histo.file
+image-file image.file
+input-2d-shot 10 20
+input-3d-shot 10 20 30
+max-barriers 3
+max-spall-rays 7
+plot-file plot.file
+read-2d-shot-file 2dshot.file
+read-3d-shot-file 3dshot.file
+burst-armor-file armor.file
+read-burst-file rburst.file
+read-input-file input.file
+report-overlaps yes
+shotline-burst yes
+shotline-file shotline.file
+target-file target.file
+target-objects obj1 obj2 obj3
+units inches
+units feet
+units millimeters
+units centimeters
+units meters
+write-input-file inputs.file
+burst-coordinates 20 30 40
+burst-distance 10.0
+burst-file burst.file
+cell-size 11.0
+color-file color.file
+cone-half-angle 45
Modified: brlcad/branches/dm-fb-merge/regress/burst/ktank.b
===================================================================
--- brlcad/branches/dm-fb-merge/regress/burst/ktank.b 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/regress/burst/ktank.b 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -7,7 +7,7 @@
burst-air-file ktank_air.ids
burst-armor-file ktank_armor.ids
critical-comp-file ktank_crit.ids
-#color-file ktank_burst_colors
+color-file ktank_colors.ids
burst-distance 0
cell-size 16
attack-direction 0 0
Copied: brlcad/branches/dm-fb-merge/regress/burst/ktank_colors.ids (from rev
76195, brlcad/trunk/regress/burst/ktank_colors.ids)
===================================================================
--- brlcad/branches/dm-fb-merge/regress/burst/ktank_colors.ids
(rev 0)
+++ brlcad/branches/dm-fb-merge/regress/burst/ktank_colors.ids 2020-06-25
13:21:23 UTC (rev 76196)
@@ -0,0 +1 @@
+100 120 0 252 0
Modified: brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt 2020-06-24
20:14:44 UTC (rev 76195)
+++ brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt 2020-06-25
13:21:23 UTC (rev 76196)
@@ -1,45 +1,37 @@
+# Until the new code is proved out, keep the original around
+# as burst and name the new binary nburst
+add_subdirectory(old)
+
+set(LDIR "${BRLCAD_SOURCE_DIR}/src/other/linenoise")
+
set(BURST_INCLUDE_DIRS
- ${DM_INCLUDE_DIRS}
+ ${BU_INCLUDE_DIRS}
+ ${FB_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/src/other/linenoise
)
list(REMOVE_DUPLICATES BURST_INCLUDE_DIRS)
include_directories(${BURST_INCLUDE_DIRS})
set(burst_SOURCES
- Hm.c
- HmGetc.c
- HmGlob.c
- Sc.c
- burst.c
- error.c
- fb.c
- glob.c
- grid.c
- gridrotate.c
- idents.c
- paint.c
- plot.c
- prnt.c
- trie.c
- ui.c
+ burst.cpp
+ grid.cpp
+ idents.cpp
+ paint.cpp
+ ${LDIR}/utf8.c
+ ${LDIR}/linenoise.c
)
+BRLCAD_ADDEXEC(nburst "${burst_SOURCES}" "librt;libfb;libbu;${M_LIBRARY}")
-BRLCAD_ADDEXEC(burst "${burst_SOURCES}" "librt;libdm;${M_LIBRARY}")
-
-set(burst_noinst_HEADERS
+set(burst_ignore
CMakeLists.txt
- ascii.h
burst.h
- extern.h
- Mm.h
- Sc.h
+ burst.format
)
-CMAKEFILES(${burst_noinst_HEADERS} burst.format)
+CMAKEFILES(${burst_ignore})
-CMAKEFILES(TODO.txt)
-
# Local Variables:
# tab-width: 8
# mode: cmake
Deleted: brlcad/branches/dm-fb-merge/src/burst/Hm.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/Hm.c 2020-06-24 20:14:44 UTC (rev
76195)
+++ brlcad/branches/dm-fb-merge/src/burst/Hm.c 2020-06-25 13:21:23 UTC (rev
76196)
@@ -1,1130 +0,0 @@
-/* H M . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/Hm.c
- *
- * This code is derived in part from menuhit(9.3) in AT&T 9th Edition
- * UNIX, Version 1 Programmer's Manual.
- */
-
-#include "common.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include "bu/file.h"
-
-#include "./Sc.h"
-#include "./Mm.h"
-#include "./extern.h"
-
-#if defined(HAVE_FDOPEN) && !defined(HAVE_DECL_FDOPEN)
-extern FILE *fdopen(int fd, const char *mode);
-#endif
-
-#define ErLog brst_log
-
-#define HmDEBUG 0
-
-#ifndef Max
-# define Max(_a, _b) ((_a)<(_b)?(_b):(_a))
-# define Min(_a, _b) ((_a)>(_b)?(_b):(_a))
-#endif
-
-#define HmRingbell() (void) putchar('\07'), (void) fflush(stdout)
-
-/* Keys for manipulating menus. */
-#define Ctrl(c_) ((c_)&037)
-#define M_DEBUG Ctrl('?')
-#define M_DOWN 'd'
-#define M_HELP 'h'
-#define M_MYXMOUSE Ctrl('X')
-#define M_NOSELECT 'q'
-#define M_REDRAW Ctrl('L')
-#define M_SELECT ' '
-#define M_UP 'u'
-
-
-/* Alternate keys for conformance to standard conventions. */
-#define A_UP Ctrl('P')
-#define A_DOWN Ctrl('N')
-#define A_HELP '?'
-
-#define P_OFF (0)
-#define P_ON (1)
-#define P_FORCE (1<<1)
-
-#define PutMenuChar(_c, _co, _ro, _map, _bit) {\
- static int lro = -1, lco = -1;\
- if ((_map) & (_bit) || (_bit) == 0) {\
- if (lco++ != (_co)-1 || lro != (_ro)) {\
- (void) ScMvCursor(_co, _ro);\
- lco = _co;\
- }\
- (void) putchar((_c));\
- }\
- (_bit) <<= 1;\
- (_co)++;\
-}
-
-
-static int HmDirty = 0;
-static int HmPkgInit = 0;
-
-static HmWindow *windows = NULL;
-
-#define HmENTRY (itemp-win->menup->item)
-#define HmHEIGHT Min(win->height, HmMaxVis)
-typedef struct nmllist HmLList;
-struct nmllist
-{
- HmItem *itemp;
- HmLList *next;
-};
-
-
-/*
- void HmBanner(char *pgmname, int borderchr)
-
- Print program name and row of border characters to delimit the top
- of the scrolling region.
-*/
-void
-HmBanner(const char *pgmname, int borderchr)
-{
- int column;
- char *p;
-#define HmBUFLEN 81
- static char HmPgmName[HmBUFLEN] = "No name";
- static int HmBorderChr = '_';
- if (pgmname != NULL) {
- bu_strlcpy(HmPgmName, pgmname, sizeof(HmPgmName));
- HmBorderChr = borderchr;
- }
- (void) ScMvCursor(HmLftMenu, HmYBORDER);
- for (column = 1; column <= 3; column++)
- (void) putc(HmBorderChr, stdout);
- for (p = HmPgmName; column <= ScCO && *p != '\0'; column++, p++)
- (void) putc((int)(*p), stdout);
- for (; column <= ScCO; column++)
- (void) putc(HmBorderChr, stdout);
- return;
-}
-
-
-/*
- void HmPrntItem(HmItem *itemp) (DEBUG)
-
- Print contents of itemp.
-*/
-static void
-HmPrntItem(HmItem *itemp)
-{
- (void) ErLog("\t\tHmPrntItem(0x%x)\n", itemp);
- for (; itemp->text != (char *) NULL; itemp++) {
- (void) ErLog("\t\t\ttext=\"%s\"\n", itemp->text);
- (void) ErLog("\t\t\thelp=\"%s\"\n", itemp->help == (char *) NULL ?
"(null)" : itemp->help);
- (void) ErLog("\t\t\tnext=0x%x\n", itemp->next);
- (void) ErLog("\t\t\tdfn=0x%x\n", itemp->dfn);
- (void) ErLog("\t\t\tbfn=0x%x\n", itemp->bfn);
- (void) ErLog("\t\t\thfn=0x%x\n", itemp->hfn);
- (void) ErLog("\t\t\tdata=%d\n", itemp->data);
- (void) ErLog("\t\t\t----\n");
- }
- (void) ErLog("\t\t\ttext=0x%x\n", itemp->text);
- return;
-}
-
-
-/*
- void HmPrntMenu(menup) (DEBUG)
-
- Print "windows" stack.
-*/
-static void
-HmPrntMenu(HmMenu *menup)
-{
- (void) ErLog("\tHmPrntMenu(0x%x)\n", menup);
- (void) ErLog("\t\tgenerator=0x%x\n", menup->generator);
- (void) ErLog("\t\tprevtop=%d\n", menup->prevtop);
- (void) ErLog("\t\tprevhit=%d\n", menup->prevhit);
- (void) ErLog("\t\tsticky=%s\n", menup->sticky ? "true" : "false");
- HmPrntItem(menup->item);
- return;
-}
-
-
-/*
- void HmPrntWindows(void) (DEBUG)
-
- Print "windows" stack.
-*/
-static void
-HmPrntWindows(void)
-{
- HmWindow *win;
- (void) ErLog("HmPrntWindows()\n");
- for (win = windows; win != (HmWindow *) NULL; win = win->next) {
- (void) ErLog("\twin=0x%x\n", win);
- (void) ErLog("\tmenup=0x%x\n", win->menup);
- (void) ErLog("\tmenux=%d\n", win->menux);
- (void) ErLog("\tmenuy=%d\n", win->menuy);
- (void) ErLog("\twidth=%d\n", win->width);
- (void) ErLog("\theight=%d\n", win->height);
- (void) ErLog("\tdirty=0x%x\n", win->dirty);
- (void) ErLog("\tnext=0x%x\n", win->next);
- HmPrntMenu(win->menup);
- }
- return;
-}
-
-
-/*
- void HmFreeItems(Hmitem *itemp)
-
- Free storage (allocated with malloc) for an array of HmItem's.
-*/
-static void
-HmFreeItems(HmItem *itemp)
-{
- HmItem *citemp;
- int count;
- for (citemp = itemp, count = 1;
- citemp->text != (char *) NULL;
- citemp++, count++
- ) {
- MmStrFree(citemp->text);
- if (citemp->help != (char *) NULL)
- MmStrFree(citemp->help);
- }
- MmVFree(count, HmItem, itemp);
- return;
-}
-
-
-/*
- void HmFreeLList(HmLList *listp)
-
- Free storage (allocated with malloc) for a linked-list of
- HmItem's.
-*/
-static void
-HmFreeLList(HmLList *listp)
-{
- HmLList *tp;
- for (; listp != (HmLList *) NULL; listp = tp) {
- MmFree(HmItem, listp->itemp);
- tp = listp->next;
- MmFree(HmLList, listp);
- }
- return;
-}
-
-
-/*
- void HmPutItem(HmWindow *win, HmItem *itemp, int flag)
-
- Display menu entry itemp.
-
- Win is the menu control structure for itemp.
-
- Flag is a bit flag and the following bits are meaningful:
-
- P_FORCE means draw the entire entry regardless of the
- value of the dirty bitmap.
- P_ON means this entry is current so highlight it.
-*/
-static void
-HmPutItem(HmWindow *win, HmItem *itemp, int flag)
-{
- int label_len = strlen(itemp->text);
- static char buf[HmMAXLINE];
- char *p = buf;
- int col = win->menux;
- int row = win->menuy+
- (HmENTRY-win->menup->prevtop)+1;
- int width = win->width;
- int bitmap = flag & P_FORCE ?
- ~0 : win->dirty[row-win->menuy];
- int bit = 1;
- int writemask = 0;
- if (bitmap == 0)
- return;
- if (itemp->text[0] & 0200) {
- /* right-justified */
- int i;
- label_len--;
- for (i = 0; i < width - label_len; i++)
- *p++ = itemp->text[0] & 0177;
- for (i = 1; itemp->text[i] != '\0'; i++)
- *p++ = itemp->text[i];
- } else /* left-justified */
- if (itemp->text[label_len-1] & 0200) {
- int i;
- label_len--;
- for (i = 0; !(itemp->text[i] & 0200); i++)
- *p++ = itemp->text[i];
- for (; i < width; i++)
- *p++ = itemp->text[label_len] & 0177;
- } else {
- /* centered */
- int i, j;
- for (i = 0; i < (width - label_len)/2; i++)
- *p++ = ' ';
- for (j = 0; itemp->text[j] != '\0'; j++)
- *p++ = itemp->text[j];
- for (i += j; i < width; i++)
- *p++ = ' ';
- }
- *p = '\0';
-
- PutMenuChar('|', col, row, bitmap, bit);
- if (flag & P_ON)
- (void) ScSetStandout();
- else
- (void) ScClrStandout();
-
- /* Optimized printing of entry. */
- if (bitmap == ~0) {
- (void) fputs(buf, stdout);
- col += p-buf;
- bit <<= p-buf;
- } else {
- int i;
- for (i = 0; i < p-buf; i++)
- writemask |= 1<<(i+1);
- for (i = 0; i < p-buf; i++) {
- if ((bitmap & writemask) == writemask)
- break;
- writemask &= ~bit;
- PutMenuChar(buf[i], col, row, bitmap, bit);
- }
- if (i < p-buf) {
- (void) ScMvCursor(col, row);
- (void) fputs(&buf[i], stdout);
- col += (p-buf) - i;
- bit <<= (p-buf) - i;
- }
- }
-
- if (flag & P_ON)
- (void) ScClrStandout();
- PutMenuChar('|', col, row, bitmap, bit);
- return;
-}
-
-
-/*
- void HmPutBorder(HmWindow *win, row, char mark)
-
- Draw the horizontal border for row of win->menup using mark
- for the corner characters.
-*/
-static void
-HmPutBorder(HmWindow *win, int row, char mark)
-{
- int i;
- int col = win->menux;
- int bitmap = win->dirty[row - win->menuy];
- static char buf[HmMAXLINE];
- char *p = buf;
- if (bitmap == 0)
- return; /* No dirty bits. */
- *p++ = mark;
- for (i = 0; i < win->width; i++)
- *p++ = '-';
- *p++ = mark;
- *p = '\0';
- if (bitmap == ~0) {
- /* All bits dirty. */
- (void) ScMvCursor(col, row);
- (void) fputs(buf, stdout);
- } else {
- int bit = 1;
-
- for (i = 0; i < p - buf; i++)
- PutMenuChar(buf[i], col, row, bitmap, bit);
- }
- return;
-}
-
-
-/*
- void HmSetbit(HmWindow *win, int col, int row)
-
- Mark as dirty, the bit in win->dirty that corresponds to
- col and row of the screen.
-*/
-static void
-HmSetbit(HmWindow *win, int col, int row)
-{
- int bit = col - win->menux;
-#if HmDEBUG && 0
- (void) ErLog("HmSetbit:menu{<%d, %d>, <%d, %d>}col=%d, row=%d\n",
- win->menux, win->menux+win->width+1,
- win->menuy, win->menuy+HmHEIGHT+1,
- col, row
- );
-#endif
- win->dirty[row-win->menuy] |= bit == 0 ? 1 : 1 << bit;
-#if HmDEBUG && 0
- (void) ErLog("\tdirty[%d]=0x%x\r\n",
- row-win->menuy, win->dirty[row-win->menuy]
- );
-#endif
- return;
-}
-
-
-/*
- void HmClrmap(HmWindow *win)
-
- Mark as clean, the entire dirty bitmap for win.
-*/
-static void
-HmClrmap(HmWindow *win)
-{
- int row;
- int height = HmHEIGHT;
- for (row = 0; row <= height+1; row++)
- win->dirty[row] = 0;
- return;
-}
-
-
-/*
- void HmSetmap(HmWindow *win)
-
- Mark as dirty the entire dirty bitmap for win.
-*/
-static void
-HmSetmap(HmWindow *win)
-{
- int row;
- int height = HmHEIGHT;
- for (row = 0; row <= height+1; row++)
- win->dirty[row] = ~0; /* 0xffff... */
- return;
-}
-
-
-/*
- HmWindow *HmInWin(x, y, HmWindow *win)
-
- Return pointer to top window in stack, starting with win whose
- boundaries contain the screen coordinate <x, y>. If the point
- is outside of all these windows, return 0.
-*/
-static HmWindow *
-HmInWin(int x, int y, HmWindow *win)
-{
-#if HmDEBUG && 0
- if (win != (HmWindow *) NULL)
- (void) ErLog("HmInWin:x=%d y=%d win{<%d, %d>, <%d, %d>}\r\n",
- x, y,
- win->menux, win->menux+win->width+1,
- win->menuy, win->menuy+HmHEIGHT+1
- );
-#endif
- for (; win != (HmWindow *) NULL; win = win->next) {
- int height = HmHEIGHT;
- if (! (x < win->menux || x > win->menux + win->width + 1 ||
- y < win->menuy || y > win->menuy + height + 1)
- )
- return win;
- }
- return (HmWindow *) NULL;
-}
-
-
-/*
- void HmDrawWin(HmWindow *win)
-
- Draw win->menup on screen. Actually, only characters flagged as
- dirty are drawn.
-*/
-static void
-HmDrawWin(HmWindow *win)
-{
- HmItem *itemp;
- int height;
-
-#if HmDEBUG && 1
- (void) ErLog("HmDrawWin:win{<%d, %d>, <%d, %d>}\r\n",
- win->menux, win->menux+win->width+1,
- win->menuy, win->menuy+HmHEIGHT+1
- ); {
- int i;
- for (i = 0; i <= HmHEIGHT+1; i++)
- (void) ErLog("\tdirty[%d]=0x%x\r\n", i, win->dirty[i]);
- }
-#endif
- HmPutBorder(win, win->menuy, win->menup->prevtop > 0 ? '^' : '+');
- for (itemp = win->menup->item + win->menup->prevtop;
- HmENTRY-win->menup->prevtop < HmMaxVis && itemp->text != (char *) NULL;
- itemp++
- )
- HmPutItem(win, itemp,
- HmENTRY == win->menup->prevhit ? P_ON : P_OFF
- );
- height = HmHEIGHT;
- HmPutBorder(win, win->menuy+height+1, HmENTRY < win->height ? 'v' : '+');
- HmClrmap(win);
- (void) fflush(stdout);
- return;
-}
-
-
-/*
- void HmHelp(HmWindow *win, int entry)
-
- Display help message for item indexed by entry in win->menup
- on line HmYCOMMO. This message will be erased when the user
- strikes a key (or uses the mouse).
-*/
-static void
-HmHelp(HmWindow *win, int entry)
-{
- (void) ScMvCursor(HmLftMenu, HmYCOMMO);
- (void) ScClrEOL();
- (void) ScSetStandout();
- (void) printf("%s", win->menup->item[entry].help);
- (void) ScClrStandout();
- (void) fflush(stdout);
- return;
-}
-
-
-/*
- void HmError(const char *str)
-
- Display str on line HmYCOMMO.
-*/
-void
-HmError(const char *str)
-{
- (void) ScMvCursor(HmLftMenu, HmYCOMMO);
- (void) ScClrEOL();
- (void) ScSetStandout();
- (void) fputs(str, stdout);
- (void) ScClrStandout();
- (void) fflush(stdout);
- return;
-}
-
-
-/*
- void HmLiftWin(HmWindow *win)
-
- Remove win->menup from screen, marking any occluded portions
- of other menus as dirty so that they will be redrawn by HmHit().
-*/
-static void
-HmLiftWin(HmWindow *win)
-{
- int row, col;
- int lastcol = -1, lastrow = -1;
- int endcol = win->menux + win->width + 2;
- int endrow = win->menuy +
- HmHEIGHT + HmHGTBORDER;
-#if HmDEBUG && 1
- (void) ErLog("HmLiftWin:win{<%d, %d>, <%d, %d>}\r\n",
- win->menux, win->menux+win->width+1,
- win->menuy, win->menuy+HmHEIGHT+1
- );
-#endif
- for (row = win->menuy; row < endrow; row++) {
- for (col = win->menux; col < endcol; col++) {
- HmWindow *olwin;
- if ((olwin = HmInWin(col, row, win->next))
- != (HmWindow *) NULL
- ) {
- HmSetbit(olwin, col, row);
- HmDirty = 1;
- } else {
- if (lastcol != col-1 || lastrow != row)
- (void) ScMvCursor(col, row);
- lastcol = col; lastrow = row;
- (void) putchar(' ');
- }
- }
- }
- (void) fflush(stdout);
- return;
-}
-
-
-/*
- void HmPushWin(HmWindow *win)
-
- Add window to top of "windows" stack.
-*/
-static void
-HmPushWin(HmWindow *win)
-{
- win->next = windows;
- windows = win;
- return;
-}
-
-
-/*
- void HmPopWin(HmWindow *win)
-
- Delete window from top of "windows" stack.
-*/
-static void
-HmPopWin(HmWindow *win)
-{
- windows = win->next;
- return;
-}
-
-
-/*
- void HmRefreshWin(HmWindow *win)
-
- Draw any dirty portions of all windows in stack starting at win.
-*/
-static void
-HmRefreshWin(HmWindow *win)
-{
- if (win == (HmWindow *) NULL) {
- HmDirty = 0;
- return;
- }
- HmRefreshWin(win->next);
- HmDrawWin(win);
- return;
-}
-/*
- void HmRedraw(void)
-
- Force a redraw of all active menus.
-*/
-void
-HmRedraw(void)
-{
- HmWindow *win;
- int reset = 0;
-
-#if HmDEBUG && 1
- HmPrntWindows();
-#endif
- (void) ScClrText(); /* clear entire screen */
-
- /* See if we changed the maximum items displayed parameter. */
- if (HmMaxVis != HmLastMaxVis)
- reset = 1;
- for (win = windows; win != (HmWindow *) NULL; win = win->next) {
- if (reset) {
- /* Correct window to reflect new maximum. */
- /* Reset scrolling state-info in each window. */
- if (win->menup->prevhit >= HmMaxVis)
- win->menup->prevtop = win->menup->prevhit -
- HmMaxVis + 1;
- else
- win->menup->prevtop = 0;
- /* Must reallocate "dirty" bit map to fit new size. */
- MmVFree(Min(win->height, HmLastMaxVis)+HmHGTBORDER,
- int, win->dirty);
- if ((win->dirty =
- MmVAllo(HmHEIGHT+HmHGTBORDER, int)
- ) == NULL) {
- return;
- }
- }
- HmSetmap(win); /* force all bits on in "dirty" bitmap */
- }
- HmLastMaxVis = HmMaxVis;
- HmRefreshWin(windows); /* redisplay all windows */
- HmBanner((char *) NULL, 0); /* redraw banner */
- return;
-}
-
-
-/*
- void HmTtySet(void)
-
- Set up terminal handler and MYX-menu options for menu interaction.
-*/
-void
-HmTtySet(void)
-{
-}
-
-/*
- void HmTtyReset(void)
-
- Reset terminal handler and MYX-menu options to user settings.
-*/
-void
-HmTtyReset(void)
-{
-}
-
-/*
- void HmInit(int x, int y, int maxvis)
-
- Initialize position of top-level menu. Specify maximum
- number of menu items visible at once. Place these values
- in global variables. Determine as best we can whether MYX
- is available and place int result in HmMyxflag. Return
- true for success and false for failure to open "/dev/tty".
-*/
-int
-HmInit(int UNUSED(x), int UNUSED(y), int UNUSED(maxvis))
-{
- return 0;
-}
-
-
-/*
- void HmWidHgtMenu(HmWindow *win)
-
- Determine width and height of win->menup, and store in win.
-*/
-static void
-HmWidHgtMenu(HmWindow *win)
-{
- HmItem *itemp;
-
- /* Determine width of menu, allowing for border. */
- for (itemp = win->menup->item; itemp->text != (char *) NULL; itemp++) {
- int len = 0;
- int i;
- for (i = 0; itemp->text[i] != '\0'; i++) {
- if (! (itemp->text[i] & 0200))
- len++;
- }
- win->width = Max(win->width, len);
- }
- win->height = HmENTRY;
- return;
-}
-
-
-/*
- int HmFitMenu(HmWindow *nwin, HmWindow *cwin)
-
- If nwin->menup will fit below cwin->menup on screen, store
- position in nwin, and return 1. Otherwise, return 0.
-*/
-static int
-HmFitMenu(HmWindow *nwin, HmWindow *cwin)
-{
- if (cwin == (HmWindow *) NULL)
- return 0;
- else
- if (HmFitMenu(nwin, cwin->next))
- return 1;
- else
- /* Look for space underneath this menu.
*/
- if (cwin->menux + nwin->width + 1 <= ScCO
- && cwin->menuy + cwin->height + nwin->height + HmHGTBORDER
- < HmMaxVis + HmTopMenu
- ) {
- nwin->menux = cwin->menux;
- nwin->menuy = cwin->menuy + cwin->height + HmHGTBORDER - 1;
- return 1;
- } else {
- return 0;
- }
-}
-
-
-/*
- void HmPosMenu(HmWindow *win)
-
- Find best screen position for win->menup.
-*/
-static void
-HmPosMenu(HmWindow *win)
-{
- /* Determine origin (top-left corner) of menu. */
- if (win->next != (HmWindow *) NULL) {
- win->menux = win->next->menux + win->next->width + 1;
- win->menuy = win->next->menuy;
- if (win->menux + win->width + 2 > ScCO) {
- if (! HmFitMenu(win, win->next)) {
- /* No space, so overlap top-level menu. */
- win->menux = HmLftMenu;
- win->menuy = HmTopMenu;
- }
- }
- } else {
- /* Top-level menu. */
- win->menux = HmLftMenu;
- win->menuy = HmTopMenu;
- }
- return;
-}
-
-
-/*
- void HmMyxMouse(int *x, int *y)
-
- Read and decode screen coordinates from MYX "editor ptr".
- Implicit return in x and y.
-*/
-static void
-HmMyxMouse(int *x, int *y)
-{
- int c;
-
- c = HmGetchar();
- switch (c) {
- case Ctrl('A') :
- *x = HmGetchar() - ' ' + 96;
- break;
- case Ctrl('B') :
- *x = HmGetchar() - ' ' + 192;
- break;
- default :
- *x = c - ' ';
- break;
- }
- c = HmGetchar();
- switch (c) {
- case Ctrl('A') :
- *y = HmGetchar() - ' ' + 96;
- break;
- case Ctrl('B') :
- *y = HmGetchar() - ' ' + 192;
- break;
- default :
- *y = c - ' ';
- break;
- }
- (*x)++;
- (*y)++;
- return;
-}
-
-
-/*
- HmItem *HmHit(HmMenu *menup)
-
- Present menup to the user and return a pointer to the selected
- item, or 0 if there was no selection made. For more details,
- see "Hm.h".
-*/
-HmItem *
-HmHit(HmMenu *menup)
-{
- HmItem *itemp;
- HmItem *retitemp = NULL;
- HmWindow *win;
- int done = 0;
- int dynamic = 0;
- static int HmLevel = 0;
-
-#if HmDEBUG
- ErLog("HmHit(0x%x)\n", menup);
-#endif
- if (HmPkgInit == 0) {
- HmInit(HmLftMenu, HmTopMenu, HmMaxVis);
- HmPkgInit = 1;
- }
- if (++HmLevel == 1)
- HmTtySet();
-
- /* If generator function is provided, dynamically allocate the
- menu items.
- */
- if ((dynamic = (menup->item == (HmItem *) NULL))) {
- int i;
- HmItem *gitemp;
- HmLList llhead, **listp;
- for (i = 0, listp = &llhead.next;
- ;
- i++, listp = &(*listp)->next
- ) {
- if ((*listp = MmAllo(HmLList)) == NULL
- || ((*listp)->itemp = MmAllo(HmItem)) == NULL
- ) {
- goto clean_exit;
- }
- itemp = (*listp)->itemp;
- if ((gitemp = (*menup->generator)(i)) == (HmItem *) NULL) {
- itemp->text = (char *) NULL;
- (*listp)->next = (HmLList *) NULL;
- break;
- }
- if (gitemp->text != (char *) NULL) {
- if ((itemp->text = MmStrDup(gitemp->text))
- == (char *) NULL
- ) {
- goto clean_exit;
- }
- } else
- itemp->text = (char *) NULL;
- if (gitemp->help != (char *) NULL) {
- if ((itemp->help = MmStrDup(gitemp->help))
- == (char *) NULL
- ) {
- goto clean_exit;
- }
- } else
- itemp->help = (char *) NULL;
- itemp->next = gitemp->next;
- itemp->dfn = gitemp->dfn;
- itemp->bfn = gitemp->bfn;
- itemp->hfn = gitemp->hfn;
- itemp->data = gitemp->data;
-#if HmDEBUG && 0
- HmPrntItem(itemp);
-#endif
- }
-#if HmDEBUG && 0
- HmPrntLList(llhead.next);
-#endif
- /* Steal the field that the user isn't using temporarily to
- emulate the static allocation of menu items.
- */
- if (i > 0) {
- int ii;
- HmLList *lp;
- if ((menup->item = MmVAllo(i+1, HmItem)) == NULL) {
- goto clean_exit;
- }
- for (ii = 0, lp = llhead.next;
- lp != (HmLList *) NULL;
- ii++, lp = lp->next
- )
- menup->item[ii] = *lp->itemp;
- }
- HmFreeLList(llhead.next);
- if (i == 0) /* Zero items, so return NULL */
- goto clean_exit;
- }
- if ((win = MmAllo(HmWindow)) == NULL) {
-#if HmDEBUG
- ErLog("HmHit, BUG: memory pool possibly corrupted.\n");
-#endif
- goto clean_exit;
- }
- win->menup = menup;
- win->width = 0;
- HmPushWin(win);
- HmWidHgtMenu(win);
- HmPosMenu(win);
-
- if (menup->prevhit < 0 || menup->prevhit >= win->height)
- menup->prevhit = 0;
- itemp = &menup->item[menup->prevhit];
-
- if ((win->dirty = MmVAllo(HmHEIGHT+HmHGTBORDER, int)) == NULL) {
- goto clean_exit;
- }
- if (HmDirty)
- HmRefreshWin(windows);
- HmSetmap(win);
- HmDrawWin(win);
- while (! done) {
- int c;
- if (HmDirty)
- HmRefreshWin(windows);
- (void) ScMvCursor(HmXPROMPT, HmYPROMPT);
- (void) ScClrEOL();
- (void) ScMvCursor(win->menux+win->width+2,
- win->menuy+(HmENTRY-win->menup->prevtop)+1);
- (void) fflush(stdout);
- c = HmGetchar();
- (void) ScMvCursor(HmLftMenu, HmYCOMMO);
- (void) ScClrEOL();
- switch (c) {
- case M_UP :
- case A_UP :
- if (HmENTRY == 0)
- HmRingbell();
- else {
- HmPutItem(win, itemp, P_OFF | P_FORCE);
- itemp--;
- menup->prevhit = HmENTRY;
- if (HmENTRY < win->menup->prevtop) {
- win->menup->prevtop -=
- HmENTRY > HmMaxVis/2 ?
- HmMaxVis/2+1 : HmENTRY+1;
- HmSetmap(win);
- HmDrawWin(win);
- } else
- HmPutItem(win, itemp, P_ON | P_FORCE);
- }
- break;
- case M_DOWN :
- case A_DOWN :
- if (HmENTRY >= win->height-1)
- HmRingbell();
- else {
- HmPutItem(win, itemp, P_OFF | P_FORCE);
- itemp++;
- menup->prevhit = HmENTRY;
- if (HmENTRY - win->menup->prevtop >= HmMaxVis) {
- win->menup->prevtop +=
- win->height-HmENTRY > HmMaxVis/2 ?
- HmMaxVis/2 : win->height-HmENTRY;
- HmSetmap(win);
- HmDrawWin(win);
- } else
- HmPutItem(win, itemp, P_ON | P_FORCE);
- }
- break;
- case M_MYXMOUSE : {
- static int mousex, mousey;
- HmItem *lastitemp;
- if (HmGetchar() != Ctrl('_') || HmGetchar() != '1')
- goto m_badinput;
- HmMyxMouse(&mousex, &mousey);
- if (HmInWin(mousex, mousey, win) != win) {
- /* Mouse cursor outside of menu. */
- HmRingbell();
- break;
- }
- if (mousey == win->menuy && win->menup->prevtop == 0) {
- /* Top border of menu and can't scroll. */
- goto m_noselect;
- }
- if (mousey == win->menuy + HmHEIGHT + 1
- && win->height <= HmMaxVis + win->menup->prevtop
- ) {
- /* Bottom border of menu and can't scroll. */
- HmRingbell();
- break;
- }
- lastitemp = itemp;
- itemp = win->menup->item +
- win->menup->prevtop +
- (mousey - (win->menuy + 1));
- if (itemp == lastitemp)
- /* User hit item twice in a row, so select it. */
- goto m_select;
- HmPutItem(win, lastitemp, P_OFF | P_FORCE);
- menup->prevhit = HmENTRY;
- if (HmENTRY - win->menup->prevtop >= HmMaxVis) {
- win->menup->prevtop +=
- win->height-HmENTRY > HmMaxVis/2 ?
- HmMaxVis/2 : win->height-HmENTRY;
- HmSetmap(win);
- HmDrawWin(win);
- } else
- if (HmENTRY < win->menup->prevtop) {
- win->menup->prevtop -=
- HmENTRY > HmMaxVis/2 ?
- HmMaxVis/2+1 : HmENTRY+1;
- HmSetmap(win);
- HmDrawWin(win);
- } else {
- HmPutItem(win, itemp, P_ON | P_FORCE);
- }
- break;
- }
- case M_HELP :
- case A_HELP :
- HmHelp(win, HmENTRY);
- break;
- m_select :
- case M_SELECT :
- if (itemp->next != (HmMenu *) NULL) {
- HmItem *subitemp;
- if (itemp->dfn != (void (*)()) NULL) {
- int level = HmLevel;
- HmTtyReset();
- HmLevel = 0;
- (*itemp->dfn)(itemp);
- HmLevel = level;
- HmTtySet();
- }
- subitemp = HmHit(itemp->next);
- if (itemp->bfn != (void (*)()) NULL) {
- int level = HmLevel;
- HmTtyReset();
- HmLevel = 0;
- (*itemp->bfn)(itemp);
- HmLevel = level;
- HmTtySet();
- }
- if (subitemp != (HmItem *) NULL) {
- retitemp = subitemp;
- done = ! menup->sticky;
- }
- } else {
- retitemp = itemp;
- if (itemp->hfn != (void (*)()) NULL) {
- int level = HmLevel;
- HmTtyReset();
- HmLevel = 0;
- (*itemp->hfn)(itemp);
- HmLevel = level;
- HmTtySet();
- }
- done = ! menup->sticky;
- }
- break;
- m_noselect :
- case M_NOSELECT :
- done = 1;
- break;
- case M_REDRAW :
- HmRedraw();
- break;
- case M_DEBUG :
- HmPrntWindows();
- break;
- m_badinput :
- default :
- HmError("Type 'd' down, 'u' up, 'h' help, <space> to
select, 'q' no selection.");
- break;
- }
- (void) fflush(stdout);
- }
- /* Free storage of dynamic menu. */
- if (dynamic) {
- if (retitemp != (HmItem *) NULL) {
- /* Must make copy of item we are returning. */
- static HmItem dynitem;
- dynitem = *retitemp;
- retitemp = &dynitem;
- }
- HmFreeItems(menup->item);
- menup->item = 0;
- }
-
- HmLiftWin(win);
- HmPopWin(win);
- MmVFree(HmHEIGHT+HmHGTBORDER, int, win->dirty);
- MmFree(HmWindow, win);
- clean_exit :
- if (HmLevel-- == 1)
- HmTtyReset();
- return retitemp;
-}
-
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/HmGetc.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/HmGetc.c 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/src/burst/HmGetc.c 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -1,59 +0,0 @@
-/* H M G E T C . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/HmGetc.c
- *
- */
-
-#include "common.h"
-
-#include <stdio.h>
-#include <signal.h>
-
-#include "./burst.h"
-
-int
-HmGetchar(void)
-{
- int c;
-
- while ((c = getc(HmTtyFp)) == EOF)
- ;
-
- return c;
-}
-
-
-int
-HmUngetchar(int c)
-{
- return ungetc(c, HmTtyFp);
-}
-
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/HmGlob.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/HmGlob.c 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/src/burst/HmGlob.c 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -1,44 +0,0 @@
-/* H M G L O B . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/HmGlob.c
- *
- */
-
-#include "common.h"
-
-#include <stdio.h>
-
-FILE *HmTtyFp = NULL; /* read keyboard, not stdin */
-int HmLftMenu = 1; /* default top-level menu position */
-int HmTopMenu = 1;
-int HmMaxVis = 10; /* default maximum menu items displayed */
-int HmLastMaxVis = 10; /* track changes in above parameter */
-int HmTtyFd; /* read keyboard, not stdin */
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/Mm.h
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/Mm.h 2020-06-24 20:14:44 UTC (rev
76195)
+++ brlcad/branches/dm-fb-merge/src/burst/Mm.h 2020-06-25 13:21:23 UTC (rev
76196)
@@ -1,55 +0,0 @@
-/* M M . H
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/Mm.h
- *
- */
-
-#ifndef BURST_MM_H
-#define BURST_MM_H
-
-/* Emulate MUVES Mm package using malloc. */
-
-#include "common.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "bu/malloc.h"
-#include "bu/str.h"
-
-#define MmAllo(typ) (typ *) bu_malloc(sizeof(typ), CPP_FILELINE)
-#define MmFree(typ, ptr) bu_free((char *) ptr, CPP_FILELINE)
-#define MmVAllo(ct, typ) (typ *) bu_malloc((ct)*sizeof(typ),
CPP_FILELINE)
-#define MmVFree(ct, typ, ptr) bu_free((char *) ptr, CPP_FILELINE)
-#define MmStrDup(str) bu_strdup(str)
-#define MmStrFree(str) bu_free(str, CPP_FILELINE)
-
-#endif /* BURST_MM_H */
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/Sc.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/Sc.c 2020-06-24 20:14:44 UTC (rev
76195)
+++ brlcad/branches/dm-fb-merge/src/burst/Sc.c 2020-06-25 13:21:23 UTC (rev
76196)
@@ -1,260 +0,0 @@
-/* S C . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/Sc.c
- *
- */
-
-#include "common.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_SYS__IOCTL_H
-# include <sys/_ioctl.h>
-#else
-# ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-# define _winsize winsize /* For compatibility with _ioctl.h. */
-# endif
-#endif
-
-#include "bu/str.h"
-
-#include "./Sc.h"
-
-
-static FILE *out_fp; /* Output stream. */
-static int fd_stdout = 1;
-
-/* This is a global buffer for the terminal capabilities entry. */
-char ScTermcap[ScTCAPSIZ];
-
-/* This is a global buffer for the name of the terminal. */
-char ScTermname[ScTERMSIZ] = "UNKNOWN";
-
-/* Individual terminal control strings (TCS). */
-char *ScBC, /* Backspace character. */
- *ScPC, /* Padding character. */
- *ScUP, /* Cursor up one line. */
- *ScCS, /* Change scrolling region. */
- *ScSO, /* Begin standout mode. */
- *ScSE, /* End standout mode. */
- *ScCE, /* Clear to end of line. */
- *ScCL, /* Clear display and home cursor. */
- *ScHO, /* Home cursor. */
- *ScCM, /* Screen-relative cursor motion. */
- *ScTI, /* Initialize terminal. */
- *ScAL, /* Insert line. */
- *ScDL, /* Delete line. */
- *ScSR, /* Scroll text down. */
- *ScSF; /* Scroll text up. */
-
-/* Individual terminal parameters. */
-int ScLI, /* Number of lines on screen. */
- ScCO; /* Number of columns on screen. */
-
-
-/*
- This function prevents the default "PutChr" from being pulled in
- from the termcap library (-ltermlib). DO NOT change its name or
- STDOUT will be assumed as the output stream for terminal control.
- Some applications might want to open "/dev/tty" so that they can
- use STDOUT for something else.
-*/
-int
-PutChr(int c) {
- return putc((char)c, out_fp);
-}
-
-
-/*
- ScInit() must be invoked before any other function in the Sc package.
- Stream fp must be open for writing and all terminal control sequences
- will be sent to fp, giving the application the option of using STDOUT
- for other things. Besides setting the output stream, ScInit() does
- the following:
-
- Initializes the terminal. Fills terminal name and capabilities
- into external buffers. Gets terminal control strings into external
- variables. Gets individual terminal parameters into external
- variables. Returns "1" for success, "0" for failure and
- prints appropriate diagnostics on STDERR if $TERM is not set or
- there is a problem in retrieving the corresponding termcap entry.
-*/
-int
-ScInit(FILE *fp) {
- char *term; /* Name of terminal from environment. */
- out_fp = fp;
- fd_stdout = fileno(out_fp);
- if ((term = getenv("TERM")) == NULL) {
- (void) fprintf(stderr, "TERM not set or exported!\n");
- return 0;
- }
- bu_strlcpy(ScTermname, term, ScTERMSIZ);
-
- return 1; /* All is well. */
-}
-
-
-/*
- Clear from the cursor to the end of that line.
-*/
-int
-ScClrEOL(void) {
- if (ScCE == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Reset the scrolling region to the entire screen.
-*/
-int
-ScClrScrlReg(void) {
- if (ScCS == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- End standout mode.
-*/
-int
-ScClrStandout(void) {
- if (ScSE == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Clear the screen and "home" the cursor.
-*/
-int
-ScClrText(void) {
- if (ScCL == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Insert a the line under the cursor.
-*/
-int
-ScInsertLn(void) {
- if (ScAL == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Delete the line under the cursor.
-*/
-int
-ScDeleteLn(void) {
- if (ScDL == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Scroll backward 1 line.
-*/
-int
-ScDnScroll(void) {
- if (ScSR == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Move the cursor to the top-left corner of the screen.
-*/
-int
-ScHmCursor(void) {
- if (ScHO == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Move the cursor to screen coordinates x, y (for column and row,
- respectively).
-*/
-int
-ScMvCursor(int UNUSED(x), int UNUSED(y)) {
- if (ScCM == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Set the scrolling region to be from "top" line to "btm" line,
- inclusive.
-*/
-int
-ScSetScrlReg(int UNUSED(top), int UNUSED(btm)) {
- if (ScCS == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Begin standout mode.
-*/
-int
-ScSetStandout(void) {
- if (ScSO == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- Scroll text forward 1 line.
-*/
-int
-ScUpScroll(void) {
- if (ScSF == NULL)
- return 0;
- return 1;
-}
-
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/Sc.h
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/Sc.h 2020-06-24 20:14:44 UTC (rev
76195)
+++ brlcad/branches/dm-fb-merge/src/burst/Sc.h 2020-06-25 13:21:23 UTC (rev
76196)
@@ -1,167 +0,0 @@
-/* S C . H
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/Sc.h
- *
- */
-
-/**
- <Sc.h> -- MUVES "Sc" (Screen manager) package definitions
-**/
-
-#ifndef BURST_SC_H
-#define BURST_SC_H
-#include "./burst.h"
-
-/**
- int ScInit(FILE *fp)
-
- ScInit() must be invoked before any other function in the Sc
- package. Stream fp must be open for writing and all terminal
- control sequences will be sent to fp, giving the application
- the option of using STDOUT for other things. Besides setting
- the output stream, ScInit() does the following:
-
- Initializes the terminal.
-
- Fills terminal name and capabilities into these externals:
-
- char ScTermname[ScTERMSIZ] (terminal name from $TERM)
- char ScTermcap[ScTCAPSIZ] (terminal capabilities entry)
-
- Gets terminal control strings into external variables (here
- are some that don't have individual functions to output them,
- the ones that DO are below):
-
- char *ScBC (backspace character)
- char *ScPC (padding character)
- char *ScUP (move the cursor up one line)
- char *ScTI (initialize the terminal)
-
- Gets individual terminal parameters into these externals:
-
- int ScLI (number of lines on screen)
- int ScCO (number of columns on screen)
-
- Returns "1" for success, "0" for failure and prints
- appropriate diagnostics on STDERR if $TERM is not set or
- there is a problem in retrieving the corresponding termcap
- entry.
-**/
- extern int ScInit(FILE *fp);
-
-/**
-
-Below are functions paired with terminal control strings that
-they output to the stream specified with ScInit(). It is not
-recommended that the control strings be used directly, but it
-may be useful in certain applications to check their value;
-if ScInit() has not been invoked or the corresponding terminal
-capability does not exist, its control string will be NULL,
-AND the function will return "false". Otherwise, they will
-return "true" (assuming that it worked). There is no way to
-be sure of this.
-
-char *ScCE (clear from under the cursor to end of line)
-int ScClrEOL(void)
-
-char *ScCS (change scrolling region)
-int ScClrScrlReg(void)
-
-char *ScSE (end standout mode)
-int ScClrStandout(void)
-
-char *ScCL (clear screen, and home cursor)
-int ScClrText(void)
-
-char *ScAL (insert a line under the cursor)
-int ScInsertLn(void)
-
-char *ScDL (delete the line under the cursor)
-int ScDeleteLn(void)
-
-char *ScSR (scroll text backwards 1 line)
-int ScDnScroll(void)
-
-char *ScHO (move cursor to top-left corner of screen)
-int ScHmCursor(void)
-
-char *ScCM (move cursor to column and row <x, y>)
-int ScMvCursor(x, y)
-
-char *ScCS (set scrolling region from top to btm incl.)
-int ScSetScrlReg(top, btm)
-
-char *ScSO (begin standout mode)
-int ScSetStandout(void)
-
-char *ScSF (scroll text forwards 1 line)
-int ScUpScroll(void)
-
-**/
-extern char *ScBC;
-extern char *ScPC;
-extern char *ScUP;
-extern char *ScCS;
-extern char *ScSO;
-extern char *ScSE;
-extern char *ScCE;
-extern char *ScCL;
-extern char *ScHO;
-extern char *ScCM;
-extern char *ScTI;
-extern char *ScDL;
-extern char *ScSR;
-extern char *ScSF;
-
-extern int ScLI;
-extern int ScCO;
-
-extern int ScClrEOL(void);
-extern int ScClrScrlReg(void);
-extern int ScClrStandout(void);
-extern int ScClrText(void);
-extern int ScDeleteLn(void);
-extern int ScDnScroll(void);
-extern int ScHmCursor(void);
-extern int ScInsertLn(void);
-extern int ScMvCursor(int x, int y);
-extern int ScSetScrlReg(int top, int btm);
-extern int ScSetStandout(void);
-extern int ScUpScroll(void);
-
-#define ScTCAPSIZ 1024
-#define ScTERMSIZ 80
-
-extern char ScTermcap[];
-extern char ScTermname[];
-
-#endif /* BURST_SC_H */
-
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/ascii.h
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/ascii.h 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/src/burst/ascii.h 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -1,66 +0,0 @@
-/* A S C I I . H
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/ascii.h
- *
- */
-
-#ifndef BURST_ASCII_H
-#define BURST_ASCII_H
-
-#define NUL '\000'
-#define SOH '\001'
-#define STX '\002'
-#define INTR '\003'
-#define EOT '\004'
-#define ACK '\006'
-#define BEL '\007'
-#define BS '\010'
-#define HT '\011'
-#define LF '\012'
-#define FF '\014'
-#define CRET '\015'
-#define DLE '\020'
-#define DC1 '\021'
-#define DC2 '\022'
-#define DC3 '\023'
-#define DC4 '\024'
-#define KILL '\025'
-#define CAN '\030'
-#define ESC '\033'
-#define GS '\035'
-#define RS '\036'
-#define US '\037'
-#define SP '\040'
-#define DEL '\177'
-
-#define Ctrl(chr) ((int)chr&037)
-
-#endif /* BURST_ASCII_H */
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/dm-fb-merge/src/burst/burst.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/burst.c 2020-06-24 20:14:44 UTC
(rev 76195)
+++ brlcad/branches/dm-fb-merge/src/burst/burst.c 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -1,391 +0,0 @@
-/* B U R S T . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program 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 program 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.
- *
- */
-/** @file burst/burst.c
- *
- */
-
-#include "common.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <signal.h>
-
-#include "bu/app.h"
-#include "bu/getopt.h"
-#include "bu/file.h"
-#include "bu/opt.h"
-#include "bu/str.h"
-#include "bu/exit.h"
-#include "bu/log.h"
-#include "bu/vls.h"
-
-#include "./burst.h"
-#include "./extern.h"
-#include "./ascii.h"
-
-
-#define DEBUG_BURST 0 /* 1 enables debugging for this module */
-
-/*
- int getCommand(char *name, char *buf, int len, FILE *fp)
-
- Read next command line into buf and stuff the command name into name
- from input stream fp. buf must be at least len bytes long.
-
- RETURN: 1 for success
-
- 0 for end of file
-*/
-static int
-getCommand(char *name, char *buf, int len, FILE *fp)
-{
- assert(name != NULL);
- assert(buf != NULL);
- assert(fp != NULL);
- while (bu_fgets(buf, len, fp) != NULL) {
- if (buf[0] != CHAR_COMMENT) {
- if (sscanf(buf, "%1330s", name) == 1) {
- /* LNBUFSZ */
- buf[strlen(buf)-1] = NUL; /* clobber newline */
- return 1;
- } else /* Skip over blank lines. */
- continue;
- } else {
- /* Generate comment command. */
- bu_strlcpy(name, CMD_COMMENT, LNBUFSZ);
- return 1;
- }
- }
- return 0; /* EOF */
-}
-
-
-/*
- void setupSigs(void)
-
- Initialize all signal handlers.
-*/
-
-static void
-setupSigs(void)
-{
- int i;
- for (i = 0; i < NSIG; i++)
- switch (i) {
- case SIGINT :
- if ((norml_sig = signal(i, SIG_IGN)) == SIG_IGN)
- abort_sig = SIG_IGN;
- else {
- norml_sig = intr_sig;
- abort_sig = abort_RT;
- (void) signal(i, norml_sig);
- }
- break;
-#ifdef SIGPIPE
- case SIGPIPE :
- (void) signal(i, SIG_IGN);
- break;
-#endif
- default:
- break;
- }
- return;
-}
-
-/*
- void readBatchInput(FILE *fp)
-
- Read and execute commands from input stream fp.
-*/
-void
-readBatchInput(FILE *fp)
-{
- assert(fp != (FILE *) NULL);
- batchmode = 1;
- while (getCommand(cmdname, cmdbuf, LNBUFSZ, fp)) {
- Func *cmdfunc;
- if ((cmdfunc = getTrie(cmdname, cmdtrie)) == NULL) {
- int i, len = strlen(cmdname);
- brst_log("ERROR -- command syntax:\n");
- brst_log("\t%s\n", cmdbuf);
- brst_log("\t");
- for (i = 0; i < len; i++)
- brst_log(" ");
- brst_log("^\n");
- } else
- if (BU_STR_EQUAL(cmdname, CMD_COMMENT)) {
- /* special handling for comments */
- cmdptr = cmdbuf;
- cmdbuf[strlen(cmdbuf)-1] = '\0'; /* clobber newline */
- (*cmdfunc)((HmItem *) 0);
- } else {
- /* Advance pointer past nul at end of
- command name. */
- cmdptr = cmdbuf + strlen(cmdname) + 1;
- (*cmdfunc)((HmItem *) 0);
- }
- }
- batchmode = 0;
- return;
-}
-
-static const char usage[] =
- "Usage: burst [-p|-P] [file]\n"
- "\tThe -p/-P options specifies whether to plot points or lines."
-;
-
-/*
- int main(int argc, char *argv[])
-*/
-int
-main(int argc, const char *argv[])
-{
- struct burst_state s;
- const char *bfile = NULL;
- int burst_opt; /* unused, for option compatibility */
- int plot_lines = 0;
- int plot_points = 0;
- int ret_ac;
-
- bu_setprogname(argv[0]);
-
- struct bu_opt_desc d[4];
- struct bu_vls pmsg = BU_VLS_INIT_ZERO;
-
- BU_OPT(d[0], "p", "", "", NULL, &plot_points, "Plot points");
- BU_OPT(d[1], "P", "", "", NULL, &plot_lines, "Plot lines");
- BU_OPT(d[2], "b", "", "", NULL, &burst_opt, "Batch mode");
- BU_OPT_NULL(d[3]);
-
- burst_state_init(&s);
-
-
- /* Interactive mode is gone - until we strip all the leftovers out
- * of the code, let it know we're not in tty mode */
- tty = 0;
-
- bu_setlinebuf(stderr);
-
- /* Skip first arg */
- argv++; argc--;
-
- /* no options imply a request for usage */
- if (argc < 1 || !argv || argv[0] == NULL) {
- (void)fprintf(stderr, "%s\n", usage);
- return EXIT_SUCCESS;
- }
-
- /* Process options */
- ret_ac = bu_opt_parse(&pmsg, argc, argv, d);
- if (ret_ac < 0) {
- (void)fprintf(stderr, "%s\n", bu_vls_cstr(&pmsg));
- bu_vls_free(&pmsg);
- (void)fprintf(stderr, "%s\n", usage);
- return EXIT_FAILURE;
- }
- bu_vls_free(&pmsg);
-
- if (ret_ac) {
- if (!bu_file_exists(argv[0], NULL)) {
- (void)fprintf(stderr, "ERROR: Input file [%s] does not exist!\n",
argv[0]);
- (void)fprintf(stderr, "%s\n", usage);
- return EXIT_FAILURE;
- } else {
- bfile = argv[0];
- }
- }
-
- tmpfp = bu_temp_file(tmpfname, TIMER_LEN);
- if (!tmpfp) {
- bu_exit(EXIT_FAILURE, "ERROR: Unable to create temporary file.\n");
- }
-
- setupSigs();
-
- /* must be called before any output is produced */
- if (!initUi()) {
- fclose(tmpfp);
- return EXIT_FAILURE;
- }
-
-#if DEBUG_BURST
- prntTrie(cmdtrie, 0);
-#endif
- assert(airids.i_next == NULL);
- assert(armorids.i_next == NULL);
- assert(critids.i_next == NULL);
-
- if (bfile) {
- FILE *fp = fopen(bfile, "rb");
- readBatchInput(fp);
- fclose(fp);
- } else {
- readBatchInput(stdin);
- }
-
- fclose(tmpfp);
- return EXIT_SUCCESS;
-}
-
-
-/*
- void exitCleanly(int code)
-
- Should be only exit from program after success of initUi().
-*/
-void
-exitCleanly(int code)
-{
- if (tty)
- closeUi(); /* keep screen straight */
- (void) fclose(tmpfp);
- if (!bu_file_delete(tmpfname))
- locPerror(tmpfname);
- exit(code);
-}
-
-void
-burst_state_init(struct burst_state *s)
-{
- //Colors colorids;
- s->fbiop = NULL;
- s->burstfp = NULL;
- s->gridfp = NULL;
- s->histfp = NULL;
- s->outfp = NULL;
- s->plotfp = NULL;
- s->shotfp = NULL;
- s->shotlnfp = NULL;
- s->tmpfp = NULL;
- s->mainhmenu = NULL;
- //Ids airids;
- //Ids armorids;
- //Ids critids;
- s->pixgrid = NULL;
- VSET(s->pixaxis, 255, 0, 0);
- VSET(s->pixbhit, 200, 255, 200);
- VSET(s->pixbkgr, 150, 100, 255);
- VSET(s->pixblack, 0, 0, 0);
- VSET(s->pixcrit, 255, 200, 200);
- VSET(s->pixghit, 255, 0, 255);
- VSET(s->pixmiss, 200, 200, 200);
- VSET(s->pixtarg, 255, 255, 255);
- s->cmdtrie = NULL;
- s->plotline = 0;
- s->batchmode = 0;
- s->cantwarhead = 0;
- s->deflectcone = DFL_DEFLECT;
- s->dithercells = DFL_DITHER;
- s->fatalerror = 0;
- s->groundburst = 0;
- s->reportoverlaps = DFL_OVERLAPS;
- s->reqburstair = 1;
- s->shotburst = 0;
- s->tty = 1;
- s->userinterrupt = 0;
- memset(s->airfile, 0, LNBUFSZ);
- memset(s->armorfile, 0, LNBUFSZ);
- memset(s->burstfile, 0, LNBUFSZ);
- memset(s->cmdbuf, 0, LNBUFSZ);
- memset(s->cmdname, 0, LNBUFSZ);
- memset(s->colorfile, 0, LNBUFSZ);
- memset(s->critfile, 0, LNBUFSZ);
- memset(s->errfile, 0, LNBUFSZ);
- memset(s->fbfile, 0, LNBUFSZ);
- memset(s->gedfile, 0, LNBUFSZ);
- memset(s->gridfile, 0, LNBUFSZ);
- memset(s->histfile, 0, LNBUFSZ);
- memset(s->objects, 0, LNBUFSZ);
- memset(s->outfile, 0, LNBUFSZ);
- memset(s->plotfile, 0, LNBUFSZ);
- memset(s->scrbuf, 0, LNBUFSZ);
- memset(s->scriptfile, 0, LNBUFSZ);
- memset(s->shotfile, 0, LNBUFSZ);
- memset(s->shotlnfile, 0, LNBUFSZ);
- memset(s->title, 0, TITLE_LEN);
- memset(s->timer, 0, TIMER_LEN);
- memset(s->tmpfname, 0, TIMER_LEN);
- s->cmdptr = NULL;
- s->bdist = DFL_BDIST;
- VSET(s->burstpoint, 0.0, 0.0, 0.0);
- s->cellsz = DFL_CELLSIZE;
- s->conehfangle = DFL_CONEANGLE;
- VSET(s->fire, 0.0, 0.0, 0.0);
- s->griddn = 0.0;
- s->gridlf = 0.0;
- s->gridrt = 0.0;
- s->gridup = 0.0;
- VSET(s->gridhor, 0.0, 0.0, 0.0);
- VSET(s->gridsoff, 0.0, 0.0, 0.0);
- VSET(s->gridver, 0.0, 0.0, 0.0);
- s->grndbk = 0.0;
- s->grndht = 0.0;
- s->grndfr = 0.0;
- s->grndlf = 0.0;
- s->grndrt = 0.0;
- VSET(s->modlcntr, 0.0, 0.0, 0.0);
- s->modldn = 0.0;
- s->modllf = 0.0;
- s->modlrt = 0.0;
- s->modlup = 0.0;
- s->raysolidangle = 0.0;
- s->standoff = 0.0;
- s->unitconv = 1.0;
- s->viewazim = DFL_AZIMUTH;
- s->viewelev = DFL_ELEVATION;
- s->pitch = 0.0;
- s->yaw = 0.0;
- VSET(s->xaxis, 1.0, 0.0, 0.0);
- VSET(s->zaxis, 0.0, 0.0, 1.0);
- VSET(s->negzaxis, 0.0, 0.0, -1.0);
- co = 0;
- devwid = 0;
- devhgt = 0;
- firemode = FM_DFLT;
- gridsz = 512;
- gridxfin = 0;
- gridyfin = 0;
- gridxorg = 0;
- gridyorg = 0;
- gridwidth = 0;
- gridheight = 0;
- li = 0;
- nbarriers = DFL_BARRIERS;
- noverlaps = 0;
- nprocessors = 0;
- nriplevels = DFL_RIPLEVELS;
- s->nspallrays = DFL_NRAYS;
- s->units = DFL_UNITS;
- s->zoom = 1;
- s->rtip = RTI_NULL;
- s->norml_sig = NULL; /* active during interactive operation */
- s->abort_sig = NULL; /* active during ray tracing only */
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Copied: brlcad/branches/dm-fb-merge/src/burst/burst.cpp (from rev 76195,
brlcad/trunk/src/burst/burst.cpp)
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/burst.cpp
(rev 0)
+++ brlcad/branches/dm-fb-merge/src/burst/burst.cpp 2020-06-25 13:21:23 UTC
(rev 76196)
@@ -0,0 +1,1891 @@
+/* B U R S T . C P P
+ * BRL-CAD
+ *
+ * Copyright (c) 2004-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This program 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 program 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.
+ */
+/** @file burst/burst.cpp
+ *
+ */
+
+#include "common.h"
+
+#include <cstdio>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern "C" {
+#include "linenoise.h"
+}
+
+#include "bu/app.h"
+#include "bu/cmd.h"
+#include "bu/getopt.h"
+#include "bu/file.h"
+#include "bu/opt.h"
+#include "bu/str.h"
+#include "bu/exit.h"
+#include "bu/log.h"
+#include "bu/units.h"
+#include "bu/vls.h"
+
+#include "fb.h"
+#include "raytrace.h"
+
+#include "./burst.h"
+
+#define DEFAULT_BURST_PROMPT "burst> "
+
+/* logging function that takes care of writing output to errfile if it is
defined */
+void
+brst_log(struct burst_state *s, int TYPE, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ if (s->errfile) {
+ vfprintf(s->errfile, fmt, ap);
+ }
+ if (TYPE == MSG_OUT) {
+ vfprintf(stderr, fmt, ap);
+ }
+}
+
+/* Forward declare so we can use this function in a command
+ * called by this function */
+int burst_process_line(struct burst_state *s, const char *line);
+
+#define PURPOSEFLAG "--print-purpose"
+#define HELPFLAG "--print-help"
+static int
+_burst_cmd_msgs(void *UNUSED(bs), int argc, const char **argv, const char *us,
const char *ps)
+{
+ //struct burst_state *s = (struct burst_state *)bs;
+ if (argc == 2 && BU_STR_EQUAL(argv[1], HELPFLAG)) {
+ printf("Usage: %s\n%s\n", us, ps);
+ return 1;
+ }
+ if (argc == 2 && BU_STR_EQUAL(argv[1], PURPOSEFLAG)) {
+ printf("%s\n", ps);
+ return 1;
+ }
+ return 0;
+}
+
+
+void
+burst_state_init(struct burst_state *s)
+{
+ s->quit = 0;
+
+ BU_PTBL_INIT(&s->colorids);
+ s->fbiop = NULL;
+ s->burstfp = NULL;
+ s->gridfp = NULL;
+ s->histfp = NULL;
+ s->outfp = NULL;
+ s->plotfp = NULL;
+ s->shotfp = NULL;
+ s->shotlnfp = NULL;
+ BU_PTBL_INIT(&s->airids);
+ BU_PTBL_INIT(&s->armorids);
+ BU_PTBL_INIT(&s->critids);
+ s->pixgrid = NULL;
+ VSET(s->pixaxis, 255, 0, 0);
+ VSET(s->pixbhit, 200, 255, 200);
+ VSET(s->pixbkgr, 150, 100, 255);
+ VSET(s->pixblack, 0, 0, 0);
+ VSET(s->pixcrit, 255, 200, 200);
+ VSET(s->pixghit, 255, 0, 255);
+ VSET(s->pixmiss, 200, 200, 200);
+ VSET(s->pixtarg, 255, 255, 255);
+ s->plotline = 0;
+ s->batchmode = 0;
+ s->cantwarhead = 0;
+ s->deflectcone = DFL_DEFLECT;
+ s->dithercells = DFL_DITHER;
+ s->fatalerror = 0;
+ s->groundburst = 0;
+ s->reportoverlaps = DFL_OVERLAPS;
+ s->reqburstair = 1;
+ s->shotburst = 0;
+ s->userinterrupt = 0;
+ bu_vls_init(&s->airfile);
+ bu_vls_init(&s->armorfile);
+ bu_vls_init(&s->burstfile);
+ bu_vls_init(&s->cmdbuf);
+ bu_vls_init(&s->cmdname);
+ bu_vls_init(&s->colorfile);
+ bu_vls_init(&s->critfile);
+ s->errfile = NULL;
+ bu_vls_init(&s->fbfile);
+ bu_vls_init(&s->gedfile);
+ bu_vls_init(&s->gridfile);
+ bu_vls_init(&s->histfile);
+ bu_vls_init(&s->objects);
+ bu_vls_init(&s->outfile);
+ bu_vls_init(&s->plotfile);
+ bu_vls_init(&s->shotfile);
+ bu_vls_init(&s->shotlnfile);
+ memset(s->timer, 0, TIMER_LEN);
+ bu_vls_init(&s->cmdhist);
+ s->bdist = DFL_BDIST;
+ VSET(s->burstpoint, 0.0, 0.0, 0.0);
+ s->cellsz = DFL_CELLSIZE;
+ s->conehfangle = DFL_CONEANGLE;
+ VSET(s->fire, 0.0, 0.0, 0.0);
+ s->griddn = 0.0;
+ s->gridlf = 0.0;
+ s->gridrt = 0.0;
+ s->gridup = 0.0;
+ VSET(s->gridhor, 0.0, 0.0, 0.0);
+ VSET(s->gridsoff, 0.0, 0.0, 0.0);
+ VSET(s->gridver, 0.0, 0.0, 0.0);
+ s->grndbk = 0.0;
+ s->grndht = 0.0;
+ s->grndfr = 0.0;
+ s->grndlf = 0.0;
+ s->grndrt = 0.0;
+ VSET(s->modlcntr, 0.0, 0.0, 0.0);
+ s->modldn = 0.0;
+ s->modllf = 0.0;
+ s->modlrt = 0.0;
+ s->modlup = 0.0;
+ s->raysolidangle = 0.0;
+ s->standoff = 0.0;
+ s->unitconv = 1.0;
+ s->viewazim = DFL_AZIMUTH;
+ s->viewelev = DFL_ELEVATION;
+ s->pitch = 0.0;
+ s->yaw = 0.0;
+ VSET(s->xaxis, 1.0, 0.0, 0.0);
+ VSET(s->zaxis, 0.0, 0.0, 1.0);
+ VSET(s->negzaxis, 0.0, 0.0, -1.0);
+ s->co = 0;
+ s->devwid = 0;
+ s->devhgt = 0;
+ s->firemode = FM_DFLT;
+ s->gridsz = 512;
+ s->gridxfin = 0;
+ s->gridyfin = 0;
+ s->gridxorg = 0;
+ s->gridyorg = 0;
+ s->gridwidth = 0;
+ s->gridheight = 0;
+ s->li = 0;
+ s->nbarriers = DFL_BARRIERS;
+ s->noverlaps = 0;
+ s->nprocessors = 0;
+ s->nriplevels = DFL_RIPLEVELS;
+ s->nspallrays = DFL_NRAYS;
+ s->zoom = 1;
+ s->rtip = RTI_NULL;
+ s->norml_sig = NULL; /* active during interactive operation */
+ s->abort_sig = NULL; /* active during ray tracing only */
+ s->cmds = NULL;
+}
+
+
+extern "C" int
+_burst_cmd_attack_direction(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "attack-direction azim_angle elev_angle";
+ const char *purpose_string = "specify azimuth and elevation of attack
relative to target";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
+ struct burst_state *s = (struct burst_state *)bs;
+ struct bu_vls msg = BU_VLS_INIT_ZERO;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 3) {
+ printf("Usage: attack-direction az(deg) el(deg)\n");
+ return BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->viewazim) < 0) {
+ brst_log(s, MSG_OUT, "problem reading azimuth: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->viewelev) < 0) {
+ brst_log(s, MSG_OUT, "problem reading elevation: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t%g %g\n", argv[0], s->viewazim, s->viewelev);
+
+ // After echoing, convert to radians for internal use
+ s->viewazim /= RAD2DEG;
+ s->viewelev /= RAD2DEG;
+
+ bu_vls_free(&msg);
+ return ret;
+}
+
+
+extern "C" int
+_burst_cmd_critical_comp_file(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "critical-comp-file file";
+ const char *purpose_string = "input critical component idents from file";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 2) {
+ brst_log(s, MSG_OUT, "Usage: critical-comp-file file\n");
+ return BRLCAD_ERROR;
+ }
+
+ brst_log(s, MSG_LOG, "Reading critical component idents...\n");
+
+ if (!readIdents(&s->critids, argv[1])) {
+ brst_log(s, MSG_OUT, "failed to open critical component file: %s\n",
argv[1]);
+ return BRLCAD_ERROR;
+ }
+
+ brst_log(s, MSG_LOG, "Reading critical component idents... done.\n");
+
+ bu_vls_sprintf(&s->critfile, "%s", argv[1]);
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], bu_vls_cstr(&s->critfile));
+
+ return ret;
+}
+
+
+extern "C" int
+_burst_cmd_deflect_spall_cone(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "deflect-spall-cone flag";
+ const char *purpose_string = "deflect axis of spall cone half way towards
exit normal";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 2) {
+ brst_log(s, MSG_OUT, "Usage: deflect-spall-cone yes|no\n");
+ return BRLCAD_ERROR;
+ }
+
+ int tval = bu_str_true(argv[1]);
+ int fval = bu_str_false(argv[1]);
+
+ if (!tval && !fval) {
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
+ return BRLCAD_ERROR;
+ }
+
+ s->deflectcone = (fval) ? 0 : tval;
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], s->deflectcone ? "yes" : "no");
+
+ return BRLCAD_OK;
+}
+
+extern "C" int
+_burst_cmd_dither_cells(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "dither-cells flag";
+ const char *purpose_string = "if yes, randomly offset shotline within grid
cell";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 2) {
+ brst_log(s, MSG_OUT, "Usage: dither-cells yes|no\n");
+ return BRLCAD_ERROR;
+ }
+
+ int tval = bu_str_true(argv[1]);
+ int fval = bu_str_false(argv[1]);
+
+ if (!tval && !fval) {
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
+ return BRLCAD_ERROR;
+ }
+
+ s->dithercells = (fval) ? 0 : tval;
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], s->dithercells ? "yes" : "no");
+
+ return BRLCAD_OK;
+}
+
+extern "C" int
+_burst_cmd_enclose_target(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "enclose-target";
+ const char *purpose_string = "generate rectangular grid of shotlines for
full target envelope";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ struct burst_state *s = (struct burst_state *)bs;
+ s->firemode = FM_GRID;
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "enclose-target\n");
+
+ return BRLCAD_OK;
+}
+
+extern "C" int
+_burst_cmd_enclose_portion(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "enclose-portion left right bottom top";
+ const char *purpose_string = "generate partial envelope by specifying grid
boundaries";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
+ struct bu_vls msg = BU_VLS_INIT_ZERO;
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 5) {
+ brst_log(s, MSG_OUT, "Usage: enclose-portion left right bottom top\n");
+ return BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->gridlf) < 0) {
+ brst_log(s, MSG_OUT, "problem reading left border of grid: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->gridrt) < 0) {
+ brst_log(s, MSG_OUT, "problem reading right border of grid: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[3], (void *)&s->griddn) < 0) {
+ brst_log(s, MSG_OUT, "problem reading bottom border of grid: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ if (bu_opt_fastf_t(&msg, 1, &argv[4], (void *)&s->gridup) < 0) {
+ brst_log(s, MSG_OUT, "problem reading top border of grid: %s\n",
bu_vls_cstr(&msg));
+ ret = BRLCAD_ERROR;
+ }
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t\t%g %g %g %g\n", argv[0], s->gridlf, s->gridrt,
s->griddn, s->gridup);
+
+ // After echoing, convert to mm
+ s->gridlf /= s->unitconv;
+ s->gridrt /= s->unitconv;
+ s->griddn /= s->unitconv;
+ s->gridup /= s->unitconv;
+
+ bu_vls_free(&msg);
+ return ret;
+}
+
+extern "C" int
+_burst_cmd_error_file(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "error-file file";
+ const char *purpose_string = "divert all diagnostics to file";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 2) {
+ brst_log(s, MSG_OUT, "Usage: error-file file\n");
+ return BRLCAD_ERROR;
+ }
+
+ /* If we had a previous file open, close it */
+ if (s->errfile) {
+ fclose(s->errfile);
+ s->errfile = NULL;
+ }
+
+ /* If we're given a NULL argument, disable the error file */
+ if (BU_STR_EQUAL(argv[1], "NULL") || BU_STR_EQUAL(argv[1], "/dev/NULL")) {
+ return ret;
+ }
+
+ /* Try to open the file - we want to write messages to the file
+ * as they are generated. */
+ s->errfile = fopen(argv[1], "wb");
+ if (!s->errfile) {
+ brst_log(s, MSG_OUT, "failed to open error file: %s\n", argv[1]);
+ ret = BRLCAD_ERROR;
+ }
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], argv[1]);
+
+ return ret;
+}
+
+extern "C" int
+_burst_cmd_execute(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "execute";
+ const char *purpose_string = "initiate a run (no output produced without
this command)";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s) return BRLCAD_ERROR;
+
+ if (!bu_vls_strlen(&s->gedfile)) {
+ brst_log(s, MSG_OUT, "Execute failed: no target file has been
specified\n");
+ return BRLCAD_ERROR;
+ }
+
+ // Echo command
+ brst_log(s, MSG_OUT, "execute\n");
+
+ return execute_run(s);
+}
+
+extern "C" int
+_burst_cmd_grid_file(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "grid-file file";
+ const char *purpose_string = "save shotline locations (Y' Z') in file";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
+ struct burst_state *s = (struct burst_state *)bs;
+
+ if (!s || !argc || !argv) return BRLCAD_ERROR;
+
+ if (argc != 2) {
+ brst_log(s, MSG_OUT, "Usage: grid-file file\n");
+ return BRLCAD_ERROR;
+ }
+
+ /* If we had a previous file open, close it */
+ if (s->gridfp) {
+ fclose(s->gridfp);
+ s->gridfp = NULL;
+ }
+
+ /* If we're given a NULL argument, disable the grid file */
+ if (BU_STR_EQUAL(argv[1], "NULL") || BU_STR_EQUAL(argv[1], "/dev/NULL")) {
+ bu_vls_trunc(&s->gridfile, 0);
+ return ret;
+ }
+
+ /* Try to open the file */
+ s->gridfp = fopen(argv[1], "wb");
+ if (!s->gridfp) {
+ brst_log(s, MSG_OUT, "failed to open grid file: %s\n", argv[1]);
+ ret = BRLCAD_ERROR;
+ }
+
+ bu_vls_sprintf(&s->gridfile, "%s", argv[1]);
+
+ // Echo command (logCmd in original code)
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->gridfile));
+
+ return ret;
+}
+
+extern "C" int
+_burst_cmd_ground_plane(void *bs, int argc, const char **argv)
+{
+ const char *usage_string = "ground-plane flag [Z +X -X +Y -Y]";
+ const char *purpose_string = "if yes, burst on ground";
+ if (_burst_cmd_msgs(bs, argc, argv, usage_string, purpose_string)) {
+ return BRLCAD_OK;
+ }
+
+ int ret = BRLCAD_OK;
@@ 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