Revision: 76643
http://sourceforge.net/p/brlcad/code/76643
Author: starseeker
Date: 2020-08-02 19:49:44 +0000 (Sun, 02 Aug 2020)
Log Message:
-----------
Merged changes from trunk through r76640
Modified Paths:
--------------
brlcad/branches/bioh/BUGS
brlcad/branches/bioh/NEWS
brlcad/branches/bioh/regress/asc/asc.sh
brlcad/branches/bioh/regress/dsp/run-dsp-case-set-2.sh
brlcad/branches/bioh/regress/dsp/run-dsp-case-set-3.sh
brlcad/branches/bioh/src/art/art.cpp
brlcad/branches/bioh/src/libbu/process.c
brlcad/branches/bioh/src/libged/tables/tables.c
brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
brlcad/branches/bioh/src/remrt/remrt.c
brlcad/branches/bioh/src/remrt/rtsrv.c
brlcad/branches/bioh/src/rt/do.c
brlcad/branches/bioh/src/rt/main.c
brlcad/branches/bioh/src/rt/opt.c
Property Changed:
----------------
brlcad/branches/bioh/
brlcad/branches/bioh/NEWS
brlcad/branches/bioh/regress/
brlcad/branches/bioh/src/libbu/
Index: brlcad/branches/bioh
===================================================================
--- brlcad/branches/bioh 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh 2020-08-02 19:49:44 UTC (rev 76643)
Property changes on: brlcad/branches/bioh
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
/brlcad/branches/osg:62110-62113
/brlcad/branches/prep-cache:68236-68933
/brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:75720-76157,76160-76365,76386-76568
\ No newline at end of property
+/brlcad/trunk:75720-76157,76160-76365,76386-76640
\ No newline at end of property
Modified: brlcad/branches/bioh/BUGS
===================================================================
--- brlcad/branches/bioh/BUGS 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/BUGS 2020-08-02 19:49:44 UTC (rev 76643)
@@ -233,9 +233,6 @@
book-keeping is fuxored or the db_lookup is returning NULL (or isn't
yet performed).
-* idents command is reporting a bogus region count in the region
- output table listing (first column).
-
* src/librt/primitives/bot/g_bot_include.c:rt_bot_bbox() routine isn't
calculating the bbox correctly
Modified: brlcad/branches/bioh/NEWS
===================================================================
--- brlcad/branches/bioh/NEWS 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/NEWS 2020-08-02 19:49:44 UTC (rev 76643)
@@ -13,6 +13,7 @@
--- 20XX-XX-XX Release 7.3X.X ---
----------------------------------------------------------------------
+* fixed 'idents' crash when running in a read-only dir - Sean Morrison
* fixed fb tools w/ redirected files and cv on Windows - Sean Morrison
* expanded 'bo' command docs with a DSP input example - Sean Morrison
* fixed 'in' making joint, superell, & script objects - Sean Morrison
@@ -28,7 +29,7 @@
----------------------------------------------------------------------
---- 2020-07-2X Release 7.30.10 ---
+--- 2020-07-24 Release 7.30.10 ---
----------------------------------------------------------------------
* added 3dm-g failure message about supported versions - Cliff Yapp
Property changes on: brlcad/branches/bioh/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -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:75728-75834,75934-76085,76134-76146,76148-76154,76160-76351,76386-76505
\ No newline at end of property
+/brlcad/trunk/NEWS:75728-75834,75934-76085,76134-76146,76148-76154,76160-76351,76386-76505,76569-76640
\ No newline at end of property
Index: brlcad/branches/bioh/regress
===================================================================
--- brlcad/branches/bioh/regress 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/regress 2020-08-02 19:49:44 UTC (rev 76643)
Property changes on: brlcad/branches/bioh/regress
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
/brlcad/branches/osg/regress:62110-62113
/brlcad/branches/prep-cache/regress:68236-68933
/brlcad/branches/tcltk86/regress:68300-75257
-/brlcad/trunk/regress:75728-75871,75891-75926,75934-76134,76148-76157,76160-76351,76386-76505
\ No newline at end of property
+/brlcad/trunk/regress:75728-75871,75891-75926,75934-76134,76148-76157,76160-76351,76386-76505,76569-76640
\ No newline at end of property
Modified: brlcad/branches/bioh/regress/asc/asc.sh
===================================================================
--- brlcad/branches/bioh/regress/asc/asc.sh 2020-08-02 18:52:52 UTC (rev
76642)
+++ brlcad/branches/bioh/regress/asc/asc.sh 2020-08-02 19:49:44 UTC (rev
76643)
@@ -77,7 +77,7 @@
ASC1="$1/db/moss.asc"
G1="moss_v5.g"
rm -f $G1
-$A2G $ASC1 $G1 2>&1 > $LOGFILE
+$A2G "$ASC1" $G1 2>&1 > $LOGFILE
# Next convert v5 .g file to a v5 asc file
log "convert v5 .g file to v5 asc format"
@@ -91,7 +91,7 @@
GRT="moss_v5_basic.g"
rm -f $GRT
log "$A2G $ASC2 $GRT"
-$A2G $ASC2 $GRT 2>&1 > $LOGFILE
+$A2G "$ASC2" $GRT 2>&1 > $LOGFILE
# the original v5 .g file and the round-tripped v5 .g file
# should be identical (apparently except for the color table)
@@ -178,7 +178,7 @@
#
G2ASC1="$1/regress/asc/v4.g"
log "$G2A $G2ASC1 v4.asc"
-$G2A $G2ASC1 v4.asc 2>&1 > $LOGFILE
+$G2A "$G2ASC1" v4.asc 2>&1 > $LOGFILE
STATUS=$?
# If something went wrong, bail.
if [ $STATUS -gt 0 ] ; then
Modified: brlcad/branches/bioh/regress/dsp/run-dsp-case-set-2.sh
===================================================================
--- brlcad/branches/bioh/regress/dsp/run-dsp-case-set-2.sh 2020-08-02
18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/regress/dsp/run-dsp-case-set-2.sh 2020-08-02
19:49:44 UTC (rev 76643)
@@ -26,7 +26,7 @@
LOG=$BASE2.log
TGM=$BASE2.g
- TRASH="$TGM $LOG $BASE2.rt.pix $BASE2.asc $BASE2.pix $BASE2.bw $BASE2.dsp"
+ TRASH="$TGM $LOG $BASE2.rt.pix $BASE2.pix $BASE2.bw $BASE2.dsp"
rm -f $TRASH
# convert dsp data file in asc format to pix format
Modified: brlcad/branches/bioh/regress/dsp/run-dsp-case-set-3.sh
===================================================================
--- brlcad/branches/bioh/regress/dsp/run-dsp-case-set-3.sh 2020-08-02
18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/regress/dsp/run-dsp-case-set-3.sh 2020-08-02
19:49:44 UTC (rev 76643)
@@ -38,7 +38,7 @@
LOG=$BASE2.log
TGM=$BASE2.g
- TRASH="$TGM $LOG $BASE2.rt.pix $BASE2.asc $BASE2.pix $BASE2.bw $BASE2.dsp"
+ TRASH="$TGM $LOG $BASE2.rt.pix $BASE2.pix $BASE2.bw $BASE2.dsp"
rm -f $TRASH
# convert dsp data file in asc format to pix format
Modified: brlcad/branches/bioh/src/art/art.cpp
===================================================================
--- brlcad/branches/bioh/src/art/art.cpp 2020-08-02 18:52:52 UTC (rev
76642)
+++ brlcad/branches/bioh/src/art/art.cpp 2020-08-02 19:49:44 UTC (rev
76643)
@@ -154,13 +154,13 @@
struct icv_image* bif = NULL;
}
-/* NOTE: stub in empty rt_cmdtab to satisfy ../rt/opt.c - this means
+/* NOTE: stub in empty rt_do_tab to satisfy ../rt/opt.c - this means
* we can't run the commands, but they are tied deeply into the various
* src/rt files and a significant refactor is in order to properly
* extract that functionality into a library... */
extern "C" {
- struct command_tab rt_cmdtab[] = { {NULL, NULL, NULL, 0, 0, 0} };
+ struct command_tab rt_do_tab[] = { {NULL, NULL, NULL, 0, 0, 0} };
void usage(const char* argv0, int verbose);
int get_args(int argc, const char* argv[]);
Index: brlcad/branches/bioh/src/libbu
===================================================================
--- brlcad/branches/bioh/src/libbu 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/src/libbu 2020-08-02 19:49:44 UTC (rev 76643)
Property changes on: brlcad/branches/bioh/src/libbu
___________________________________________________________________
Modified: svn:mergeinfo
## -2,4 +2,4 ##
/brlcad/branches/brep-debug/src/libbu:69168,69927,69995-69996,70148-70149,70347-70349,70377,70526-70527,71006-71007,71009-71022,71046-71047,71049,71096-71100
/brlcad/branches/dm-fb-merge/src/libbu:75426-76198
/brlcad/branches/tcltk86/src/libbu:68300-75257
-/brlcad/trunk/src/libbu:75720-75834,75879-75926,75986-76085,76148-76154,76160-76351
\ No newline at end of property
+/brlcad/trunk/src/libbu:75720-75834,75879-75926,75986-76085,76148-76154,76160-76351,76569-76640
\ No newline at end of property
Modified: brlcad/branches/bioh/src/libbu/process.c
===================================================================
--- brlcad/branches/bioh/src/libbu/process.c 2020-08-02 18:52:52 UTC (rev
76642)
+++ brlcad/branches/bioh/src/libbu/process.c 2020-08-02 19:49:44 UTC (rev
76643)
@@ -78,21 +78,26 @@
void
bu_process_close(struct bu_process *pinfo, int fd)
{
- if (!pinfo) return;
- if (fd == 0) {
- if (!pinfo->fp_in) return;
+ if (!pinfo)
+ return;
+
+ if (fd == fileno(stdin)) {
+ if (!pinfo->fp_in)
+ return;
(void)fclose(pinfo->fp_in);
pinfo->fp_in = NULL;
return;
}
- if (fd == 1) {
- if (!pinfo->fp_out) return;
+ if (fd == fileno(stdout)) {
+ if (!pinfo->fp_out)
+ return;
(void)fclose(pinfo->fp_out);
pinfo->fp_out = NULL;
return;
}
- if (fd == 2) {
- if (!pinfo->fp_err) return;
+ if (fd == fileno(stderr)) {
+ if (!pinfo->fp_err)
+ return;
(void)fclose(pinfo->fp_err);
pinfo->fp_err = NULL;
return;
@@ -103,11 +108,12 @@
FILE *
bu_process_open(struct bu_process *pinfo, int fd)
{
- if (!pinfo) return NULL;
+ if (!pinfo)
+ return NULL;
bu_process_close(pinfo, fd);
- if (fd == 0) {
+ if (fd == fileno(stdin)) {
#ifndef _WIN32
pinfo->fp_in = fdopen(pinfo->fd_in, "wb");
#else
@@ -115,7 +121,7 @@
#endif
return pinfo->fp_in;
}
- if (fd == 1) {
+ if (fd == fileno(stdout)) {
#ifndef _WIN32
pinfo->fp_out = fdopen(pinfo->fd_out, "rb");
#else
@@ -123,7 +129,7 @@
#endif
return pinfo->fp_out;
}
- if (fd == 2) {
+ if (fd == fileno(stderr)) {
#ifndef _WIN32
pinfo->fp_err = fdopen(pinfo->fd_err, "rb");
#else
@@ -139,16 +145,16 @@
void *
bu_process_fd(struct bu_process *pinfo, int fd)
{
- if (!pinfo || (fd < 0 || fd > 2)) return NULL;
- if (fd == 0) {
+ if (!pinfo || fd < 0)
+ return NULL;
+
+ if (fd == fileno(stdin))
return (void *)(&(pinfo->fd_in));
- }
- if (fd == 1) {
+ if (fd == fileno(stdout))
return (void *)(&(pinfo->fd_out));
- }
- if (fd == 2) {
+ if (fd == fileno(stderr))
return (void *)(&(pinfo->fd_err));
- }
+
return NULL;
}
@@ -156,7 +162,8 @@
int
bu_process_pid(struct bu_process *pinfo)
{
- if (!pinfo) return -1;
+ if (!pinfo)
+ return -1;
return (int)pinfo->pid;
}
@@ -164,13 +171,14 @@
int
bu_process_args(const char **cmd, const char * const **argv, struct bu_process
*pinfo)
{
- if (!pinfo) return 0;
- if (cmd) {
+ if (!pinfo)
+ return 0;
+
+ if (cmd)
*cmd = pinfo->cmd;
- }
- if (argv) {
+ if (argv)
*argv = (const char * const *)(pinfo->argv);
- }
+
return pinfo->argc;
}
@@ -179,8 +187,10 @@
bu_process_read(char *buff, int *count, struct bu_process *pinfo, int fd, int
n)
{
int ret = 1;
- if (!pinfo || !buff || !n || !count || (fd < 1 || fd > 2)) return -1;
- if (fd == 1) {
+ if (!pinfo || !buff || !n || !count || fd < 1)
+ return -1;
+
+ if (fd == fileno(stdout)) {
#ifndef _WIN32
(*count) = read((int)pinfo->fd_out, buff, n);
if ((*count) <= 0) {
@@ -195,7 +205,7 @@
(*count) = (int)dcount;
#endif
}
- if (fd == 2) {
+ if (fd == fileno(stderr)) {
#ifndef _WIN32
(*count) = read((int)pinfo->fd_err, buff, n);
if ((*count) <= 0) {
@@ -210,6 +220,7 @@
(*count) = (int)dcount;
#endif
}
+
/* sanity clamping */
if ((*count) < 0) {
perror("READ ERROR");
@@ -240,9 +251,9 @@
int pipe_out[2];
int pipe_err[2];
const char **av = NULL;
- if (!p || !cmd) {
+
+ if (!p || !cmd)
return;
- }
BU_GET(*p, struct bu_process);
(*p)->fp_in = NULL;
@@ -297,17 +308,17 @@
setpgid(0, 0);
/* Redirect stdin and stderr */
- (void)close(0);
+ (void)close(fileno(stdin));
pret = dup(pipe_in[0]);
if (pret < 0) {
perror("dup");
}
- (void)close(1);
+ (void)close(fileno(stdout));
pret = dup(pipe_out[1]);
if (pret < 0) {
perror("dup");
}
- (void)close(2);
+ (void)close(fileno(stderr));
pret = dup(pipe_err[1]);
if (pret < 0) {
perror("dup");
@@ -352,9 +363,9 @@
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
SECURITY_ATTRIBUTES sa = {0};
- if (!cmd || !argc || !argv) {
+
+ if (!cmd || !argc || !argv)
return;
- }
BU_GET(*p, struct bu_process);
(*p)->fp_in = NULL;
@@ -472,10 +483,15 @@
#ifndef _WIN32
int rpid;
int retcode = 0;
- if (!pinfo) return -1;
+
+ if (!pinfo)
+ return -1;
+
close(pinfo->fd_out);
close(pinfo->fd_err);
- while ((rpid = wait(&retcode)) != pinfo->pid && rpid != -1);
+
+ while ((rpid = wait(&retcode)) != pinfo->pid && rpid != -1) {
+ }
rc = retcode;
if (rc) {
pinfo->aborted = 1;
@@ -482,7 +498,8 @@
}
#else
DWORD retcode = 0;
- if (!pinfo) return -1;
+ if (!pinfo)
+ return -1;
/* wait for the forked process */
if (wtime > 0) {
@@ -505,8 +522,8 @@
}
/* Clean up */
- bu_process_close(pinfo, 1);
- bu_process_close(pinfo, 2);
+ bu_process_close(pinfo, fileno(stdout));
+ bu_process_close(pinfo, fileno(stderr));
/* Free copy of exec args */
if (pinfo->cmd) {
Modified: brlcad/branches/bioh/src/libged/tables/tables.c
===================================================================
--- brlcad/branches/bioh/src/libged/tables/tables.c 2020-08-02 18:52:52 UTC
(rev 76642)
+++ brlcad/branches/bioh/src/libged/tables/tables.c 2020-08-02 19:49:44 UTC
(rev 76643)
@@ -53,31 +53,34 @@
static int rd_idfd = 0;
-/* TODO - this approach to tables_sol_number assignment is pretty ugly, and
- * arguably even wrong in that it is hiding an exact floating point comparison
- * of matrices behind the (char *) case of the identt structure.
+/* TODO - this approach to tables_sol_number assignment is pretty
+ * ugly, and arguably even wrong in that it is hiding an exact
+ * floating point comparison of matrices behind the (char *) case of
+ * the identt structure.
*
* That said, this logic is doing something interesting in that it is
- * attempting to move the definition of a unique solid beyond just the object
- * to the object instance - e.g. it incorporates the matrix in the parent comb
- * in its uniqueness test.
+ * attempting to move the definition of a unique solid beyond just the
+ * object to the object instance - e.g. it incorporates the matrix in
+ * the parent comb in its uniqueness test.
*
- * Need to think about what it actually means to be a unique instance in the
- * database and do something more intelligent. For example, if we have two
- * paths:
+ * Need to think about what it actually means to be a unique instance
+ * in the database and do something more intelligent. For example, if
+ * we have two paths:
*
* a/b/c.s and d/e/c.s
*
- * do they describe the same instance in space if their matrices are all
identity
- * and their booleans all unions? Their path structure is different, but the
- * volume in space they are denoting as occupied is not.
+ * do they describe the same instance in space if their matrices are
+ * all identity and their booleans all unions? Their path structure
+ * is different, but the volume in space they are denoting as occupied
+ * is not.
*
- * One possible approach to this would be to enhance full path data structures
- * to incorporate matrix awareness, define an API to compare two such paths
- * including a check for solid uniqueness (e.g. return same if the two paths
- * define the same solid, even if the paths themselves differ), and then
- * construct the set of paths for the tables input object trees and use that
- * set to test for the uniqueness of a given path.
+ * One possible approach to this would be to enhance full path data
+ * structures to incorporate matrix awareness, define an API to
+ * compare two such paths including a check for solid uniqueness
+ * (e.g. return same if the two paths define the same solid, even if
+ * the paths themselves differ), and then construct the set of paths
+ * for the tables input object trees and use that set to test for the
+ * uniqueness of a given path.
*/
@@ -88,6 +91,7 @@
mat_t i_mat;
};
+
HIDDEN int
tables_check(char *a, char *b)
{
@@ -94,11 +98,16 @@
int c= sizeof(struct identt);
- while (c--) if (*a++ != *b++) return 0; /* no match */
+ while (c--) {
+ if (*a++ != *b++) {
+ return 0; /* no match */
+ }
+ }
return 1; /* match */
}
+
HIDDEN size_t
tables_sol_number(const matp_t matrix, char *name, size_t *old, size_t *numsol)
{
@@ -138,6 +147,7 @@
return idbuf1.i_index;
}
+
/* Build up sortable entities */
struct tree_obj {
@@ -145,6 +155,7 @@
struct bu_vls *describe;
};
+
struct table_obj {
int numreg;
int region_id;
@@ -155,15 +166,21 @@
struct bu_ptbl *tree_objs;
};
+
static int
sort_table_objs(const void *a, const void *b, void *UNUSED(arg))
{
struct table_obj *ao = *(struct table_obj **)a;
struct table_obj *bo = *(struct table_obj **)b;
- if (ao->region_id > bo->region_id) return 1;
- if (ao->region_id < bo->region_id) return -1;
- if (ao->numreg > bo->numreg) return 1;
- if (ao->numreg < bo->numreg) return -1;
+
+ if (ao->region_id > bo->region_id)
+ return 1;
+ if (ao->region_id < bo->region_id)
+ return -1;
+ if (ao->numreg > bo->numreg)
+ return 1;
+ if (ao->numreg < bo->numreg)
+ return -1;
return 0;
}
@@ -176,7 +193,7 @@
for (i = 0; i < BU_PTBL_LEN(tabptr); i++) {
o = (struct table_obj *)BU_PTBL_GET(tabptr, i);
bu_vls_printf(tabvls, " %-4d %4d %4d %4d %4d ",
- o->numreg, o->region_id, o->aircode, o->GIFTmater, o->los);
+ o->numreg, o->region_id, o->aircode, o->GIFTmater,
o->los);
bu_vls_printf(tabvls, "%s", bu_vls_addr(o->path));
if (type != ID_TABLE) {
@@ -362,11 +379,14 @@
struct directory *nextdp;
mat_t new_mat;
- /* For the 'idents' command skip over non-union combinations above
the region level,
- * these members of a combination don't add positively to the
defined regions of space
- * and their region ID's will not show up along a shotline unless
positively added
- * elsewhere in the hierarchy. This is causing headaches for users
generating an
- * association table from our 'idents' listing.
+ /* For the 'idents' command skip over non-union
+ * combinations above the region level, these members of a
+ * combination don't add positively to the defined regions
+ * of space and their region ID's will not show up along a
+ * shotline unless positively added elsewhere in the
+ * hierarchy. This is causing headaches for users
+ * generating an association table from our 'idents'
+ * listing.
*/
if (flag == ID_TABLE) {
switch (tree_list[i].tl_op) {
@@ -408,6 +428,7 @@
return;
}
+
HIDDEN void
tables_header(struct bu_vls *tabvls, int argc, const char **argv, struct ged
*gedp, char *timep)
{
@@ -439,25 +460,26 @@
bu_vls_printf(tabvls, "\n\n");
}
+
int
ged_tables_core(struct ged *gedp, int argc, const char *argv[])
{
- struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
- struct bu_vls cmd = BU_VLS_INIT_ZERO;
- struct bu_vls tabvls = BU_VLS_INIT_ZERO;
+ static const char *usage = "file object(s)";
+
+ FILE *ftabvls = NULL;
FILE *test_f = NULL;
- FILE *ftabvls = NULL;
- struct bu_ptbl cur_path;
+ char *timep;
int flag;
int status;
- char *timep;
- time_t now;
size_t i, j;
- const char *usage = "file object(s)";
- struct bu_ptbl *tabobjs = NULL;
-
size_t numreg = 0;
size_t numsol = 0;
+ struct bu_ptbl tabobjs;
+ struct bu_ptbl cur_path;
+ struct bu_vls cmd = BU_VLS_INIT_ZERO;
+ struct bu_vls tabvls = BU_VLS_INIT_ZERO;
+ struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
+ time_t now;
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
@@ -477,6 +499,7 @@
}
bu_ptbl_init(&cur_path, 8, "f_tables: cur_path");
+ bu_ptbl_init(&tabobjs, 8, "f_tables: objects");
status = GED_OK;
@@ -500,7 +523,7 @@
/* open the file */
test_f = fopen(argv[1], "w+");
if (test_f == NULL) {
- bu_vls_printf(gedp->ged_result_str, "%s: Can't open %s\n", argv[0],
argv[1]);
+ bu_vls_printf(gedp->ged_result_str, "%s: Can't open file [%s]\n\tMake
sure the directory and file are writable.\n", argv[0], argv[1]);
status = GED_ERROR;
goto end;
}
@@ -523,8 +546,6 @@
tables_header(&tabvls, argc, argv, gedp, timep);
- BU_GET(tabobjs, struct bu_ptbl);
- bu_ptbl_init(tabobjs, 8, "f_tables: objects");
/* make the tables */
for (i = 2; i < (size_t)argc; i++) {
@@ -532,14 +553,14 @@
bu_ptbl_reset(&cur_path);
if ((dp = db_lookup(gedp->ged_wdbp->dbip, argv[i], LOOKUP_NOISY)) !=
RT_DIR_NULL)
- tables_new(gedp, tabobjs, dp, &cur_path, (const fastf_t
*)bn_mat_identity, flag, &numreg, &numsol);
+ tables_new(gedp, &tabobjs, dp, &cur_path, (const fastf_t
*)bn_mat_identity, flag, &numreg, &numsol);
else
bu_vls_printf(gedp->ged_result_str, "%s: skip this object\n",
argv[i]);
}
- tables_objs_print(&tabvls, tabobjs, flag);
+ tables_objs_print(&tabvls, &tabobjs, flag);
- bu_vls_printf(gedp->ged_result_str, "Summary written in: %s\n", argv[1]);
+ bu_vls_printf(gedp->ged_result_str, "Summary written to: %s\n", argv[1]);
if (flag == SOL_TABLE || flag == REG_TABLE) {
bu_vls_printf(&tabvls, "\n\nNumber Primitives = %zu Number Regions =
%zu\n",
@@ -555,9 +576,9 @@
bu_vls_printf(gedp->ged_result_str, "Processed %lu Regions\n", numreg);
/* make ordered idents and re-print */
- bu_sort(BU_PTBL_BASEADDR(tabobjs), BU_PTBL_LEN(tabobjs), sizeof(struct
table_obj *), sort_table_objs, NULL);
+ bu_sort(BU_PTBL_BASEADDR(&tabobjs), BU_PTBL_LEN(&tabobjs),
sizeof(struct table_obj *), sort_table_objs, NULL);
- tables_objs_print(&tabvls, tabobjs, flag);
+ tables_objs_print(&tabvls, &tabobjs, flag);
bu_vls_printf(&tabvls, "* 9999999\n* 9999999\n* 9999999\n* 9999999\n*
9999999\n");
}
@@ -564,7 +585,7 @@
ftabvls = fopen(argv[1], "w+");
if (ftabvls == NULL) {
- bu_vls_printf(gedp->ged_result_str, "%s: Can't open %s\n", argv[0],
argv[1]);
+ bu_vls_printf(gedp->ged_result_str, "%s: Can't open file [%s]\n\tMake
sure the directory and file are still writable.\n", argv[0], argv[1]);
status = GED_ERROR;
goto end;
}
@@ -577,8 +598,8 @@
bu_vls_free(&tabvls);
bu_ptbl_free(&cur_path);
- for (i = 0; i < BU_PTBL_LEN(tabobjs); i++) {
- struct table_obj *o = (struct table_obj *)BU_PTBL_GET(tabobjs, i);
+ for (i = 0; i < BU_PTBL_LEN(&tabobjs); i++) {
+ struct table_obj *o = (struct table_obj *)BU_PTBL_GET(&tabobjs, i);
for (j = 0; j < BU_PTBL_LEN(o->tree_objs); j++) {
struct tree_obj *t = (struct tree_obj *)BU_PTBL_GET(o->tree_objs,
j);
bu_vls_free(t->tree);
@@ -591,8 +612,7 @@
BU_PUT(o->path, struct bu_vls);
BU_PUT(o, struct table_obj);
}
- bu_ptbl_free(tabobjs);
- BU_PUT(tabobjs, struct bu_ptbl);
+ bu_ptbl_free(&tabobjs);
return status;
}
Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-08-02 18:52:52 UTC
(rev 76642)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-08-02 19:49:44 UTC
(rev 76643)
@@ -1183,10 +1183,13 @@
void
tclcad_create_io_handler(struct ged_subprocess *p, int fd, ged_io_func_t
callback, void *data)
{
- if (!p || !p->p || !p->gedp || !p->gedp->ged_io_data) return;
+ if (!p || !p->p || !p->gedp || !p->gedp->ged_io_data)
+ return;
int *fdp = (int *)bu_process_fd(p->p, fd);
- struct tclcad_io_data *t_iod = (struct tclcad_io_data
*)p->gedp->ged_io_data;
- Tcl_CreateFileHandler(*fdp, t_iod->io_mode, callback, (ClientData)data);
+ if (fdp) {
+ struct tclcad_io_data *t_iod = (struct tclcad_io_data
*)p->gedp->ged_io_data;
+ Tcl_CreateFileHandler(*fdp, t_iod->io_mode, callback, (ClientData)data);
+ }
}
void
@@ -1194,8 +1197,10 @@
{
if (!p) return;
int *fdp = (int *)bu_process_fd(p->p, fd);
- Tcl_DeleteFileHandler(*fdp);
- close(*fdp);
+ if (fdp) {
+ Tcl_DeleteFileHandler(*fdp);
+ close(*fdp);
+ }
}
#else
@@ -1202,19 +1207,22 @@
void
tclcad_create_io_handler(struct ged_subprocess *p, int fd,
ged_io_handler_callback_t callback, void *data)
{
- if (!p || !p->p || !p->gedp || !p->gedp->ged_io_data) return;
+ if (!p || !p->p || !p->gedp || !p->gedp->ged_io_data)
+ return;
struct tclcad_io_data *t_iod = (struct tclcad_io_data
*)p->gedp->ged_io_data;
HANDLE *fdp = (HANDLE *)bu_process_fd(p->p, fd);
- (*t_iod->chan) = (void *)Tcl_MakeFileChannel(*fdp, t_iod->io_mode);
- Tcl_CreateChannelHandler(*t_iod->chan, t_iod->io_mode, callback,
(ClientData)data);
+ if (fdp) {
+ (*t_iod->chan) = (void *)Tcl_MakeFileChannel(*fdp, t_iod->io_mode);
+ Tcl_CreateChannelHandler(*t_iod->chan, t_iod->io_mode, callback,
(ClientData)data);
+ }
}
void
tclcad_delete_io_handler(struct ged_subprocess *p, int fd)
{
- if (!p || !p->p || !p->p->gedp || !p->p->gedp->ged_io_data) return;
+ if (!p || !p->p || !p->p->gedp || !p->p->gedp->ged_io_data)
+ return;
struct tclcad_io_data *t_iod = (struct tclcad_io_data
*)p->gedp->ged_io_data;
- HANDLE *fdp = (HANDLE *)bu_process_fd(p->p, fd);
Tcl_DeleteChannelHandler(t_oid->chan, NULL, (ClientData)NULL);
Tcl_Close(t_oid->interp, t_oid->chan);
}
Modified: brlcad/branches/bioh/src/remrt/remrt.c
===================================================================
--- brlcad/branches/bioh/src/remrt/remrt.c 2020-08-02 18:52:52 UTC (rev
76642)
+++ brlcad/branches/bioh/src/remrt/remrt.c 2020-08-02 19:49:44 UTC (rev
76643)
@@ -153,7 +153,7 @@
/* NOTE: satisfies linkage with do.c command parsing. possibly wrong
* to stub empty... might hinder remrt's ability to read rt commands.
*/
-struct command_tab rt_cmdtab[] = {{NULL, NULL, NULL, 0, 0, 0}};
+struct command_tab rt_do_tab[] = {{NULL, NULL, NULL, 0, 0, 0}};
struct frame {
struct frame *fr_forw;
Modified: brlcad/branches/bioh/src/remrt/rtsrv.c
===================================================================
--- brlcad/branches/bioh/src/remrt/rtsrv.c 2020-08-02 18:52:52 UTC (rev
76642)
+++ brlcad/branches/bioh/src/remrt/rtsrv.c 2020-08-02 19:49:44 UTC (rev
76643)
@@ -583,7 +583,7 @@
char *sp;
char *ep;
int len;
- extern struct command_tab rt_cmdtab[]; /* from do.c */
+ extern struct command_tab rt_do_tab[]; /* from do.c */
/* Parse the string */
len = strlen(buf);
@@ -597,7 +597,7 @@
/* Process this command */
if (debug)
bu_log("process_cmd '%s'\n", sp);
- if (rt_do_cmd(APP.a_rt_i, sp, rt_cmdtab) < 0)
+ if (rt_do_cmd(APP.a_rt_i, sp, rt_do_tab) < 0)
bu_exit(1, "process_cmd: error on '%s'\n", sp);
sp = cp;
}
Modified: brlcad/branches/bioh/src/rt/do.c
===================================================================
--- brlcad/branches/bioh/src/rt/do.c 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/src/rt/do.c 2020-08-02 19:49:44 UTC (rev 76643)
@@ -1267,7 +1267,7 @@
/**
* Command table for RT control script language
*/
-struct command_tab rt_cmdtab[] = {
+struct command_tab rt_do_tab[] = {
{"start", "frame number", "start a new frame",
cm_start, 2, 2},
{"viewsize", "size in mm", "set view size",
Modified: brlcad/branches/bioh/src/rt/main.c
===================================================================
--- brlcad/branches/bioh/src/rt/main.c 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/src/rt/main.c 2020-08-02 19:49:44 UTC (rev 76643)
@@ -106,7 +106,7 @@
extern fastf_t rt_perp_tol; /* Value for rti_tol.perp */
extern char *framebuffer; /* desired framebuffer */
-extern struct command_tab rt_cmdtab[];
+extern struct command_tab rt_do_tab[];
int save_overlaps=0; /* flag for setting rti_save_overlaps */
@@ -596,7 +596,7 @@
#endif
}
- nret = rt_do_cmd( rtip, buf, rt_cmdtab);
+ nret = rt_do_cmd( rtip, buf, rt_do_tab);
bu_free( buf, "rt_read_cmd command buffer");
if (nret < 0)
break;
Modified: brlcad/branches/bioh/src/rt/opt.c
===================================================================
--- brlcad/branches/bioh/src/rt/opt.c 2020-08-02 18:52:52 UTC (rev 76642)
+++ brlcad/branches/bioh/src/rt/opt.c 2020-08-02 19:49:44 UTC (rev 76643)
@@ -172,9 +172,10 @@
#define MAX_WIDTH (32*1024)
-extern struct command_tab rt_cmdtab[];
+extern struct command_tab rt_do_tab[];
+
/* this helper function is used to increase a bit variable through
* five levels (8 bits set at a time, 0 through level 4). this can be
* used to incrementally increase uint32 bits as typically used for
@@ -288,7 +289,7 @@
space_partition = atoi(bu_optarg);
break;
case 'c':
- (void)rt_do_cmd((struct rt_i *)0, bu_optarg, rt_cmdtab);
+ (void)rt_do_cmd((struct rt_i *)0, bu_optarg, rt_do_tab);
break;
case 'd':
densityfile = bu_optarg;
@@ -303,7 +304,7 @@
{
char buf[128] = {0};
sprintf(buf, "set background=%f/%f/%f",
color.buc_rgb[RED], color.buc_rgb[GRN], color.buc_rgb[BLU]);
- (void)rt_do_cmd((struct rt_i *)0, buf, rt_cmdtab);
+ (void)rt_do_cmd((struct rt_i *)0, buf, rt_do_tab);
}
}
break;
@@ -415,7 +416,7 @@
height = i;
break;
case 'W':
- (void)rt_do_cmd((struct rt_i *)0, "set background=1.0/1.0/1.0",
rt_cmdtab);
+ (void)rt_do_cmd((struct rt_i *)0, "set background=1.0/1.0/1.0",
rt_do_tab);
default_background = 0;
break;
case 'w':
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